Esempio n. 1
0
        public bool BlackJadeExchange(MsgInformationEx MsgDTO, object[] param)
        {
            var ratio = BlackJadeExchangeRec.RealTimeRatio(MsgDTO.FromGroup);
            var count = WaiterSvc.WaitForNum(MsgDTO.FromGroup, MsgDTO.FromQQ, $"当前墨玉汇率为:{ratio}金币 = 1墨玉,请输入兑换墨玉数量!(单次限购100枚墨玉)", bjCount => bjCount > 0 && bjCount <= 100,
                                             MsgDTO.BindAi);

            if (count <= 0)
            {
                MsgSender.PushMsg(MsgDTO, "操作取消!");
                return(false);
            }

            var consumeTotal = count * ratio;
            var osPerson     = OSPerson.GetPerson(MsgDTO.FromQQ);

            if (osPerson.Golds < consumeTotal)
            {
                MsgSender.PushMsg(MsgDTO, $"你的金币余额不足!({consumeTotal.CurencyFormat()}/{osPerson.Golds.CurencyFormat()})");
                return(false);
            }

            var asset = ArchAsset.Get(MsgDTO.FromQQ);

            asset.BlackJade += count;
            osPerson.Golds  -= consumeTotal;

            asset.Update();
            osPerson.Update();

            MsgSender.PushMsg(MsgDTO, $"兑换成功!你当前剩余墨玉 {asset.BlackJade}枚,金币 {osPerson.Golds.CurencyFormat()}!");
            return(true);
        }
Esempio n. 2
0
        public bool Recruit(MsgInformationEx MsgDTO, object[] param)
        {
            var castle = KindomCastle.Get(MsgDTO.FromGroup, MsgDTO.FromQQ);

            var soldierGroups = SoldierGroup.Get(MsgDTO.FromQQ);
            var curTotal      = soldierGroups.Sum(g => g.Count);

            var remain = Math.Max(castle.SoldierMaxVolume - curTotal, 0);
            var msg    = $"你当前共拥有士兵 {curTotal}人,还可招募 {remain}人";

            if (remain == 0)
            {
                msg += "\r\n无法招募新的士兵!";
                MsgSender.PushMsg(MsgDTO, msg, true);
                return(false);
            }

            var golds = castle.Golds;

            msg += $"\r\n你当前拥有金钱 {golds},最多招募等量的士兵";
            if (golds == 0)
            {
                msg += "\r\n无法招募新的士兵!";
                MsgSender.PushMsg(MsgDTO, msg, true);
                return(false);
            }

            var maxRecruit = Math.Min(remain, golds);
            var num        = WaiterSvc.WaitForNum(MsgDTO.FromGroup, MsgDTO.FromQQ, $"请输入招募士兵的数量!(1~{maxRecruit})", p => p >= 1 && p <= maxRecruit, MsgDTO.BindAi);

            if (num <= 0)
            {
                MsgSender.PushMsg(MsgDTO, "操作取消!");
                return(false);
            }

            var group = new SoldierGroup()
            {
                Owner = MsgDTO.FromQQ,
                Count = num,
                State = SoldierState.Working,
                Name  = $"第{GroupNamingRec.GetNextNo(MsgDTO.FromQQ)}军"
            };

            group.Insert();

            castle.Golds -= num;
            castle.Update();

            MsgSender.PushMsg(MsgDTO, "招募成功!");
            return(true);
        }
Esempio n. 3
0
        public bool SetPetAttr(MsgInformationEx MsgDTO, object[] param)
        {
            var      pet       = PetRecord.Get(MsgDTO.FromQQ);
            var      needGolds = false;
            OSPerson osPerson  = null;

            if (!string.IsNullOrEmpty(pet.Attribute))
            {
                osPerson = OSPerson.GetPerson(MsgDTO.FromQQ);

                if (osPerson.Golds < 300)
                {
                    MsgSender.PushMsg(MsgDTO, $"金币余额不足!({osPerson.Golds.CurencyFormat()}/{300.CurencyFormat()})");
                    return(false);
                }

                if (!WaiterSvc.WaitForConfirm_Gold(MsgDTO, 300))
                {
                    MsgSender.PushMsg(MsgDTO, "操作取消");
                    return(false);
                }

                needGolds = true;
            }

            var randAttrs   = Rander.RandSort(PetExtent.AllAttributes.ToArray());
            var msg         = $"请选择宠物食性:\r\n{string.Join("\r\n", randAttrs.Select((p, idx) => $"{idx + 1}:{p}"))}";
            var selectedIdx = WaiterSvc.WaitForNum(MsgDTO.FromGroup, MsgDTO.FromQQ, msg, i => i > 0 && i <= randAttrs.Length, MsgDTO.BindAi);

            if (selectedIdx == -1)
            {
                MsgSender.PushMsg(MsgDTO, "操作取消");
                return(false);
            }

            pet.Attribute = randAttrs[selectedIdx - 1];
            pet.Update();

            if (needGolds)
            {
                osPerson.Golds -= 300;
                osPerson.Update();
            }

            MsgSender.PushMsg(MsgDTO, "设定成功!");
            return(true);
        }
Esempio n. 4
0
        private bool StartExpedite(MsgInformationEx MsgDTO)
        {
            var extEndur = VipArmerRecord.Get(MsgDTO.FromQQ).CheckArmer("耐力护符") ? 10 : 0;

            var pet              = PetRecord.Get(MsgDTO.FromQQ);
            var petLevel         = PetLevelSvc[pet.Level];
            var enduranceConsume = PetEnduranceRecord.Get(MsgDTO.FromQQ);
            var curEndurance     = petLevel.Endurance - enduranceConsume.ConsumeTotal + extEndur;

            var todayExpeditions = ExpeditionSceneSvc.TodayExpedition().Where(p => p.Endurance <= curEndurance).ToList();

            if (todayExpeditions.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, $"{pet.Name}已经累的完全动不了了!");
                return(false);
            }

            var msg       = $"请选择远征副本:\r\n{todayExpeditions.Select((exp, idx) => $"{idx + 1}:{exp.ToString(curEndurance)}").JoinToString("\r\n")}";
            var selection = WaiterSvc.WaitForNum(MsgDTO.FromGroup, MsgDTO.FromQQ, msg, i => i > 0 && i <= todayExpeditions.Count, MsgDTO.BindAi, 12, false);

            if (selection < 0)
            {
                MsgSender.PushMsg(MsgDTO, "操作取消");
                return(false);
            }

            var aimExpedition = todayExpeditions[selection - 1];
            var expRec        = new ExpeditionRecord
            {
                EndTime = DateTime.Now.AddMinutes(aimExpedition.TimeConsume),
                QQNum   = MsgDTO.FromQQ,
                Scene   = aimExpedition.Name
            };

            expRec.Insert();

            enduranceConsume.ConsumeTotal += aimExpedition.Endurance;
            enduranceConsume.Update();

            MsgSender.PushMsg(MsgDTO, $"远征开始!目标:【{aimExpedition.Name}】!(请于{expRec.EndTime:yyyy-MM-dd HH:mm:ss}后使用 宠物远征 命令回收远征奖励!)");
            return(true);
        }