public bool Purchase(MsgInformationEx MsgDTO) { var endurance = PetEnduranceRecord.Get(MsgDTO.FromQQ); endurance.ConsumeTotal -= 10; endurance.ConsumeTotal = Math.Max(0, endurance.ConsumeTotal); endurance.Update(); var pet = PetRecord.Get(MsgDTO.FromQQ); MsgSender.PushMsg(MsgDTO, $"{pet.Name}感觉一股清凉传遍全身,恢复了10点耐力!"); return(true); }
public bool Purchase(MsgInformationEx MsgDTO) { var pet = PetRecord.Get(MsgDTO.FromQQ); var petLevel = PetLevelSvc[pet.Level]; var enduranceConsume = PetEnduranceRecord.Get(MsgDTO.FromQQ); var restoreEndurance = Math.Min(petLevel.Endurance / 2, enduranceConsume.ConsumeTotal); enduranceConsume.ConsumeTotal -= restoreEndurance; enduranceConsume.Update(); MsgSender.PushMsg(MsgDTO, $"恭喜{pet.Name}恢复了 {restoreEndurance}点耐力!"); return(true); }
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); }