Ejemplo n.º 1
0
        public bool Expedite(MsgInformationEx MsgDTO, object[] param)
        {
            var expeditionRec = ExpeditionRecord.GetLastest(MsgDTO.FromQQ);

            if (expeditionRec == null)
            {
                return(StartExpedite(MsgDTO));
            }

            var pet = PetRecord.Get(MsgDTO.FromQQ);

            if (expeditionRec.IsExpediting)
            {
                MsgSender.PushMsg(MsgDTO, $"{pet.Name}还在远征中,请于 {expeditionRec.EndTime:yyyy-MM-dd HH:mm:ss}后再试!");
                return(false);
            }

            if (expeditionRec.IsDrawn)
            {
                return(StartExpedite(MsgDTO));
            }

            DrawAwards(expeditionRec, MsgDTO);
            return(true);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        private void DrawAwards(ExpeditionRecord expeditionRec, MsgInformationEx MsgDTO)
        {
            var expeditionModel = ExpeditionSceneSvc[expeditionRec.Scene];
            var award           = expeditionModel.Award(MsgDTO.FromQQ);

            MsgSender.PushMsg(MsgDTO, award.ToString());

            expeditionRec.IsDrawn = true;
            expeditionRec.Update();

            var history = ExpeditionHistory.Get(MsgDTO.FromQQ);

            history.AddScene(expeditionModel.Name);
            history.EnduranceConsume    += expeditionModel.Endurance;
            history.FlavoringTotal      += award.Flavorings.Count;
            history.GoldsTotal          += award.Gold;
            history.ItemBonusCount      += award.Items.Count;
            history.ItemBonusPriceTotal += award.Items.Sum(item => HonorSvc.FindItem(item).Price);

            history.Update();
        }