Beispiel #1
0
 public void Update()
 {
     Armers.Remove(p => p == 0);
     EscapeArmers.Remove(p => p == 0);
     SpecialArmers.Remove(p => p == 0);
     MongoService <PersonArmerRecord> .Update(this);
 }
Beispiel #2
0
        public void Serve(MsgInformationEx MsgDTO, string serviceName)
        {
            var armer = Armers.FirstOrDefault(p => p.Name == serviceName);

            if (armer == null)
            {
                MsgSender.PushMsg(MsgDTO, $"未找到相关内容:{serviceName}");
                return;
            }

            var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ);

            if (osPerson.Diamonds < armer.DiamondsNeed)
            {
                MsgSender.PushMsg(MsgDTO, $"钻石余额不足({osPerson.Diamonds.CurencyFormat("Diamond")}/{armer.DiamondsNeed.CurencyFormat("Diamond")})!");
                return;
            }

            if (!CheckLimit(MsgDTO, armer))
            {
                return;
            }

            if (!CheckMaxContains(MsgDTO, armer))
            {
                return;
            }

            if (!WaiterSvc.WaitForConfirm(MsgDTO, $"此操作将花费{armer.DiamondsNeed.CurencyFormat("Diamond")},是否继续?"))
            {
                MsgSender.PushMsg(MsgDTO, "操作取消!");
                return;
            }

            if (!armer.Purchase(MsgDTO))
            {
                return;
            }

            osPerson           = OSPerson.GetPerson(MsgDTO.FromQQ);
            osPerson.Diamonds -= armer.DiamondsNeed;
            osPerson.Update();

            var purchaseRec = new VipSvcPurchaseRecord()
            {
                QQNum        = MsgDTO.FromQQ,
                SvcName      = armer.Name,
                PurchaseTime = DateTime.Now,
                Diamonds     = armer.DiamondsNeed
            };

            purchaseRec.Insert();
        }
Beispiel #3
0
        public void ArmerGet(string name, int count = 1)
        {
            if (Armers == null)
            {
                Armers = new Dictionary <string, int>();
            }

            if (!Armers.ContainsKey(name))
            {
                Armers.Add(name, 0);
            }

            Armers[name] += count;
        }
Beispiel #4
0
 public string[] RandGoods(int count)
 {
     return(Rander.RandSort(Armers.ToArray()).Take(count).Select(p => p.Name).ToArray());
 }