Exemple #1
0
        public bool ResetPetSkill(MsgInformationEx MsgDTO, object[] param)
        {
            const int ResetSkillCost = 100;
            var       osPerson       = OSPerson.GetPerson(MsgDTO.FromQQ);

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

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

            var pet    = PetRecord.Get(MsgDTO.FromQQ);
            var expRec = ExpeditionRecord.GetLastest(MsgDTO.FromQQ);

            if (expRec != null && expRec.IsExpediting)
            {
                MsgSender.PushMsg(MsgDTO, $"{pet.Name}正在【{expRec.Scene}】进行一项伟大的远征,请于{expRec.EndTime:yyyy-MM-dd HH:mm:ss}后再试!");
                return(false);
            }

            pet.SkillReset();
            pet.Update();

            osPerson.Golds -= ResetSkillCost;
            osPerson.Update();

            MsgSender.PushMsg(MsgDTO, "重置成功!");
            return(true);
        }
Exemple #2
0
        public bool UpgradePetSkill(MsgInformationEx MsgDTO, object[] param)
        {
            var name  = (string)param[0];
            var skill = PetSkillSvc[name];

            if (skill == null)
            {
                MsgSender.PushMsg(MsgDTO, "未查找到该技能!", true);
                return(false);
            }

            var pet    = PetRecord.Get(MsgDTO.FromQQ);
            var expRec = ExpeditionRecord.GetLastest(MsgDTO.FromQQ);

            if (expRec != null && expRec.IsExpediting)
            {
                MsgSender.PushMsg(MsgDTO, $"{pet.Name}正在【{expRec.Scene}】进行一项伟大的远征,请于{expRec.EndTime:yyyy-MM-dd HH:mm:ss}后再试!");
                return(false);
            }

            if (pet.Skills.IsNullOrEmpty() || !pet.Skills.ContainsKey(name))
            {
                MsgSender.PushMsg(MsgDTO, $"{pet.Name}尚未学习该技能!", true);
                return(false);
            }

            if (pet.Skills[name] >= 5)
            {
                MsgSender.PushMsg(MsgDTO, $"{pet.Name}的该技能已经升到了满级!", true);
                return(false);
            }

            if (pet.RemainSkillPoints <= 0)
            {
                MsgSender.PushMsg(MsgDTO, $"{pet.Name}没有可用的技能点!", true);
                return(false);
            }

            pet.Skills[name]++;
            pet.RemainSkillPoints--;
            pet.Update();

            MsgSender.PushMsg(MsgDTO, $"恭喜{pet.Name}的{name}技能成功升到了{pet.Skills[name]}级!");
            return(true);
        }
Exemple #3
0
        public bool FeedPet(MsgInformationEx MsgDTO, object[] param)
        {
            var name = param[0] as string;

            var pet    = PetRecord.Get(MsgDTO.FromQQ);
            var expRec = ExpeditionRecord.GetLastest(MsgDTO.FromQQ);

            if (expRec != null && expRec.IsExpediting)
            {
                MsgSender.PushMsg(MsgDTO, $"{pet.Name}正在【{expRec.Scene}】进行一项伟大的远征,请于{expRec.EndTime:yyyy-MM-dd HH:mm:ss}后再试!");
                return(false);
            }

            if (string.IsNullOrEmpty(pet.Attribute))
            {
                MsgSender.PushMsg(MsgDTO, "请先设置宠物食性!", true);
                return(false);
            }

            if (pet.LastFeedTime != null && pet.LastFeedTime.Value.AddHours(FeedInterval) > DateTime.Now)
            {
                var msg = $"{pet.Name}还饱着呢,不想吃东西(请与{pet.LastFeedTime.Value.AddHours(FeedInterval)}后再试)";
                MsgSender.PushMsg(MsgDTO, msg);
                return(false);
            }

            var item = HonorSvc.FindItem(name);

            if (item != null)
            {
                return(FeedPetWithItem(MsgDTO, pet, item));
            }

            var diet = CookingDietSvc[name];

            if (diet != null)
            {
                return(FeedPetWithDiet(MsgDTO, pet, diet));
            }

            MsgSender.PushMsg(MsgDTO, "未查找到相关物品或菜肴!");
            return(false);
        }
Exemple #4
0
        public bool Fight(MsgInformationEx MsgDTO, object[] param)
        {
            var aimQQ = (long)param[0];

            if (aimQQ == MsgDTO.FromQQ)
            {
                MsgSender.PushMsg(MsgDTO, "你无法挑战你自己!");
                return(false);
            }

            if (!PetAgainstSvc.CheckGroup(MsgDTO.FromGroup))
            {
                MsgSender.PushMsg(MsgDTO, "本群正在进行一场宠物对决,请稍后再试!");
                return(false);
            }

            if (!PetAgainstSvc.CheckQQ(MsgDTO.FromQQ))
            {
                MsgSender.PushMsg(MsgDTO, "你的宠物正在进行一场宠物对决,请稍后再试!");
                return(false);
            }

            if (!PetAgainstSvc.CheckQQ(aimQQ))
            {
                MsgSender.PushMsg(MsgDTO, "你的对手正在进行一场宠物对决,请稍后再试!");
                return(false);
            }

            if (BindAiSvc.AllAiNums.Contains(aimQQ))
            {
                MsgSender.PushMsg(MsgDTO, "鱼唇的人类,你无法挑战AI的威严!", true);
                return(false);
            }

            var sourcePet = PetRecord.Get(MsgDTO.FromQQ);
            var expRec    = ExpeditionRecord.GetLastest(MsgDTO.FromQQ);

            if (expRec != null && expRec.IsExpediting)
            {
                MsgSender.PushMsg(MsgDTO, $"{sourcePet.Name}正在【{expRec.Scene}】进行一项伟大的远征,请于{expRec.EndTime:yyyy-MM-dd HH:mm:ss}后再试!");
                return(false);
            }

            if (sourcePet.Level < 3)
            {
                MsgSender.PushMsg(MsgDTO, $"{sourcePet.Name}还没到3级,无法参加宠物对决!");
                return(false);
            }

            var aimPet = PetRecord.Get(aimQQ);

            if (aimPet.Level < 3)
            {
                MsgSender.PushMsg(MsgDTO, "对方的宠物还没到3级,无法参加宠物对决!");
                return(false);
            }

            expRec = ExpeditionRecord.GetLastest(aimQQ);
            if (expRec != null && expRec.IsExpediting)
            {
                MsgSender.PushMsg(MsgDTO, $"{aimPet.Name}正在【{expRec.Scene}】进行一项伟大的远征,请于{expRec.EndTime:yyyy-MM-dd HH:mm:ss}后再试!");
                return(false);
            }

            if (!WaiterSvc.WaitForConfirm(MsgDTO.FromGroup, aimQQ, "你被邀请参加一场宠物对决,是否同意?", MsgDTO.BindAi, 10))
            {
                MsgSender.PushMsg(MsgDTO, "对决取消!");
                return(false);
            }

            PetAgainstSvc.StartGame(sourcePet, aimPet, MsgDTO.FromGroup, MsgDTO.BindAi);
            return(true);
        }