예제 #1
0
파일: PetAI.cs 프로젝트: Dolany/DolanyAI
        private static bool FeedPetWithDiet(MsgInformationEx MsgDTO, PetRecord pet, CookingDietModel diet)
        {
            if (!diet.Attributes.Contains(pet.Attribute))
            {
                MsgSender.PushMsg(MsgDTO, $"{pet.Name}说不想吃这个东西(请喂食正确特性的菜肴)");
                return(false);
            }

            var cookingRec = CookingRecord.Get(MsgDTO.FromQQ);

            if (!cookingRec.CheckDiet(diet.Name))
            {
                MsgSender.PushMsg(MsgDTO, "你没有该菜肴!");
                return(false);
            }

            var resMsg = $"{pet.Name}兴奋的吃掉了 {diet.Name},并打了个饱嗝\r\n";

            pet.LastFeedTime = DateTime.Now;
            resMsg          += pet.ExtGain(MsgDTO, diet.Exp);
            cookingRec.DietConsume(diet.Name);
            cookingRec.Update();

            MsgSender.PushMsg(MsgDTO, resMsg);
            return(true);
        }
예제 #2
0
파일: PetAI.cs 프로젝트: Dolany/DolanyAI
        private static bool FeedPetWithItem(MsgInformationEx MsgDTO, PetRecord pet, DriftBottleItemModel item)
        {
            if (item.Attributes == null)
            {
                MsgSender.PushMsg(MsgDTO, "该物品无法投喂!");
                return(false);
            }

            if (!item.Attributes.Contains(pet.Attribute))
            {
                MsgSender.PushMsg(MsgDTO, $"{pet.Name}说不想吃这个东西(请喂食正确特性的物品)");
                return(false);
            }

            var honorRecord = ItemCollectionRecord.Get(MsgDTO.FromQQ);

            if (!honorRecord.CheckItem(item.Name))
            {
                MsgSender.PushMsg(MsgDTO, "你没有该物品!", true);
                return(false);
            }

            var resMsg = $"{pet.Name}兴奋的吃掉了 {item.Name},并打了个饱嗝\r\n";

            pet.LastFeedTime = DateTime.Now;
            resMsg          += pet.ExtGain(MsgDTO, item.Exp);
            honorRecord.ItemConsume(item.Name);
            honorRecord.Update();

            MsgSender.PushMsg(MsgDTO, resMsg);
            return(true);
        }