예제 #1
0
        public bool DispelOneBuff(MsgInformationEx MsgDTO, object[] param)
        {
            var qqNum    = (long)param[0];
            var buffName = param[1] as string;

            if (!OSPersonBuff.CheckBuff(qqNum, buffName))
            {
                MsgSender.PushMsg(MsgDTO, "目标身上没有指定buff!");
                return(false);
            }

            var sourcePerson = OSPerson_Doremi.GetPerson(MsgDTO.FromQQ);

            if (sourcePerson.Golds < 100)
            {
                MsgSender.PushMsg(MsgDTO, "驱散该buff需要100金币,你没有足够的金币!");
                return(false);
            }

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

            OSPersonBuff.Remove(qqNum, buffName);

            sourcePerson.Golds -= 100;
            sourcePerson.Update();

            MsgSender.PushMsg(MsgDTO, "驱散成功!");
            return(true);
        }
예제 #2
0
        public bool Reborn(MsgInformationEx MsgDTO, object[] param)
        {
            var aimQQ = (long)param[0];

            var key   = $"AliveState-{MsgDTO.FromGroup}-{aimQQ}";
            var cache = SCacheService.Get <AliveStateCache>(key);

            if (cache == null)
            {
                MsgSender.PushMsg(MsgDTO, "该成员不需要复活!", true);
                return(false);
            }

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

            var osPerson = OSPerson_Doremi.GetPerson(MsgDTO.FromQQ);

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

            SCacheService.Cache(key, cache, DateTime.Now);

            MsgSender.PushMsg(MsgDTO, $"复活成功!你当前剩余金币:{osPerson.Golds}", true);
            return(true);
        }
예제 #3
0
        public bool Dispel(MsgInformationEx MsgDTO, object[] param)
        {
            var qqNum = (long)param[0];

            var sourcePerson = OSPerson_Doremi.GetPerson(MsgDTO.FromQQ);

            if (sourcePerson.Golds < 500)
            {
                MsgSender.PushMsg(MsgDTO, "驱散全部buff需要500金币,你没有足够的金币!");
                return(false);
            }

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

            OSPersonBuff.RemoveAll(qqNum);

            sourcePerson.Golds -= 500;
            sourcePerson.Update();

            MsgSender.PushMsg(MsgDTO, "驱散成功!");
            return(true);
        }
예제 #4
0
파일: PetAI.cs 프로젝트: Dolany/DolanyAI
        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);
        }
예제 #5
0
        public bool GoldLimitBonus(MsgInformationEx MsgDTO, object[] param)
        {
            var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ);

            if (osPerson.Golds < 500)
            {
                MsgSender.PushMsg(MsgDTO, $"你没有足够的金币兑换({osPerson.Golds.CurencyFormat()}/{500.CurencyFormat()})", true);
                return(false);
            }

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

            osPerson.Golds -= 500;

            var cache = PersonCacheRecord.Get(MsgDTO.FromQQ, "抽奖");

            if (!int.TryParse(cache.Value, out var times))
            {
                times = 0;
            }

            times++;
            cache.Value = times.ToString();

            osPerson.Update();
            cache.Update();

            MsgSender.PushMsg(MsgDTO, $"兑换成功,你现在共有{times}次抽奖机会,快使用 【抽奖】 命令试试看吧!", true);

            return(true);
        }
예제 #6
0
        public bool Reborn(MsgInformationEx MsgDTO, object[] param)
        {
            var aimQQ = (long)param[0];

            var cache = AliveStateSvc.GetState(MsgDTO.FromGroup, aimQQ);

            if (cache == null)
            {
                MsgSender.PushMsg(MsgDTO, "该成员不需要复活!", true);
                return(false);
            }

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

            var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ);

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

            cache.RebornTime = DateTime.Now;
            AliveStateSvc.Cache(cache);

            MsgSender.PushMsg(MsgDTO, $"复活成功!你当前剩余金币:{osPerson.Golds}", true);
            return(true);
        }
예제 #7
0
        public bool Buy(MsgInformationEx MsgDTO, object[] param)
        {
            var name   = param[0] as string;
            var vipSvc = DailyVipShopSvc[name];

            if (vipSvc != null)
            {
                DailyVipShopSvc.Serve(MsgDTO, name);
                return(false);
            }

            if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "快晴"))
            {
                MsgSender.PushMsg(MsgDTO, "你无法进行该操作!(快晴)");
                return(false);
            }

            var sellingItems = TransHelper.GetDailySellItems();
            var todayRec     = DailySellItemRareRecord.GetToday();

            if (DateTime.Now.Hour >= todayRec.Hour && DateTime.Now.Hour <= todayRec.Hour + 2)
            {
                sellingItems = sellingItems.Concat(todayRec.Items);
            }

            var sellItem = sellingItems.FirstOrDefault(si => si.Name == name);

            if (sellItem == null)
            {
                MsgSender.PushMsg(MsgDTO, "此物品未在商店中售卖!");
                return(false);
            }

            var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ);

            if (osPerson.Golds < sellItem.Price)
            {
                MsgSender.PushMsg(MsgDTO, "你持有的金币不足以购买此物品!");
                return(false);
            }

            var price = OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "极光") ? sellItem.Price * 80 / 100 : sellItem.Price;

            if (!WaiterSvc.WaitForConfirm_Gold(MsgDTO, price))
            {
                MsgSender.PushMsg(MsgDTO, "交易取消!");
                return(false);
            }

            var record    = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var incomeMsg = record.ItemIncome(sellItem.Name);

            OSPerson.GoldConsume(osPerson.QQNum, price);

            MsgSender.PushMsg(MsgDTO, $"{incomeMsg}\r\n购买成功!你当前剩余的金币为 {(osPerson.Golds - sellItem.Price).CurencyFormat()}");
            return(true);
        }
예제 #8
0
파일: PetAI.cs 프로젝트: Dolany/DolanyAI
        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);
        }
예제 #9
0
        public bool Present(MsgInformationEx MsgDTO, object[] param)
        {
            var aimNum = (long)param[0];
            var name   = param[1] as string;

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

            if (!sourceRecord.CheckItem(name))
            {
                MsgSender.PushMsg(MsgDTO, "你没有此物品", true);
                return(false);
            }

            var itemModel = HonorSvc.FindItem(name);
            var price     = HonorSvc.GetItemPrice(itemModel, MsgDTO.FromQQ) * 5 / 100;

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

            var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ);

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

            sourceRecord.ItemConsume(name);
            sourceRecord.Update();

            var aimRecord = ItemCollectionRecord.Get(aimNum);
            var msg       = aimRecord.ItemIncome(name);

            var res = "赠送成功!";

            if (!string.IsNullOrEmpty(msg))
            {
                res += $"\r\n{msg}";
            }
            MsgSender.PushMsg(MsgDTO, res);

            return(true);
        }
예제 #10
0
        public bool Buy(MsgInformationEx MsgDTO, object[] param)
        {
            var name = param[0] as string;

            if (RandShopperSvc.SellingGoods.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "商店尚未营业!", true);
                return(false);
            }

            if (!RandShopperSvc.SellingGoods.Contains(name))
            {
                MsgSender.PushMsg(MsgDTO, "此商品未在商店中出售!", true);
                return(false);
            }

            var osPerson   = OSPerson_Doremi.GetPerson(MsgDTO.FromQQ);
            var armerModel = ArmerSvc[name];

            if (osPerson.Golds < armerModel.Price)
            {
                MsgSender.PushMsg(MsgDTO, $"你持有的金币不足以购买此物品({osPerson.Golds}/{armerModel.Price})", true);
                return(false);
            }

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

            osPerson.Golds -= armerModel.Price;
            var paRec = PersonArmerRecord.Get(MsgDTO.FromQQ);

            paRec.ArmerGet(name);
            paRec.Update();
            osPerson.Update();

            MsgSender.PushMsg(MsgDTO, "购买成功!");
            return(true);
        }
예제 #11
0
파일: PetAI.cs 프로젝트: Dolany/DolanyAI
        public bool SetPetPic(MsgInformationEx MsgDTO, object[] param)
        {
            var 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);
            }

            var info = WaiterSvc.WaitForInformation(MsgDTO, "请上传图片(不能超过300KB)!",
                                                    information => information.FromGroup == MsgDTO.FromGroup && information.FromQQ == MsgDTO.FromQQ &&
                                                    !string.IsNullOrEmpty(Utility.ParsePicGuid(information.Msg)), 10);

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

            var bindai = BindAiSvc[MsgDTO.BindAi];

            var picGuid    = Utility.ParsePicGuid(info.Msg);
            var imageCache = Utility.ReadImageCacheInfo(picGuid, bindai.ImagePath);

            if (imageCache == null)
            {
                MsgSender.PushMsg(MsgDTO, "未读取到图片!");
                return(false);
            }

            var fileName = $"PetPic-{MsgDTO.FromQQ}.{imageCache.type}";

            if (!Utility.DownloadImage(imageCache.url, CachePath + fileName))
            {
                MsgSender.PushMsg(MsgDTO, "图片下载失败,请稍后再试!");
                return(false);
            }

            var picFile = new FileInfo(CachePath + fileName);

            if (picFile.Length / 1024 > 300)
            {
                MsgSender.PushMsg(MsgDTO, "图片过大,请选择较小的图片重新上传!", true);
                picFile.Delete();
                return(false);
            }

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

            MsgSender.PushMsg(MsgDTO, "上传成功!待审核通过后方可生效!");
            var review = new PicReviewRecord()
            {
                GroupNum = MsgDTO.FromGroup,
                QQNum    = MsgDTO.FromQQ,
                Usage    = "宠物头像",
                PicName  = picFile.Name
            };

            PicReviewSvc.AddReview(review);

            return(true);
        }
예제 #12
0
        public bool AssertCalculate(MsgInformationEx MsgDTO, object[] param)
        {
            var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ);

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

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

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

            var resultDic = new Dictionary <string, int> {
                { "金币资产", osPerson.Golds }
            };

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

            if (!itemRecord.HonorCollections.IsNullOrEmpty())
            {
                var itemAssert = itemRecord.AssertToGold();

                resultDic.Add("物品资产", itemAssert);
            }

            if (!osPerson.GiftDic.IsNullOrEmpty())
            {
                var giftsMaterialDic = osPerson.GiftDic.SelectMany(p => GiftSvc[p.Key].MaterialDic);
                var giftAssert       = giftsMaterialDic.Sum(g => HonorSvc.FindItem(g.Key).Price *g.Value);
                resultDic.Add("礼物资产", giftAssert);
            }

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

            if (pet.Level > 0 || pet.Exp > 0)
            {
                var petAssert = PetLevelSvc.ExpToGolds(pet.Level, pet.Exp);
                resultDic.Add("宠物资产", petAssert);
            }

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

            if (!dietRec.LearndDietMenu.IsNullOrEmpty() || !dietRec.CookedDietDic.IsNullOrEmpty() || !dietRec.FlavoringDic.IsNullOrEmpty())
            {
                var dietAssert = dietRec.LearndDietMenu.Sum(menu =>
                                                            HonorSvc.FindHonor(CookingDietSvc[menu].ExchangeHonor).Items.Sum(item => item.Price));
                dietAssert += dietRec.CookedDietDic.Sum(diet => CookingDietSvc[diet.Key].EstimatedPrice * diet.Value);
                dietAssert += dietRec.FlavoringDic.Sum(p => p.Value) * 20;
                resultDic.Add("烹饪资产", dietAssert);
            }

            var msg = "请查阅你的资产评估报告:\r\n" +
                      $"{string.Join("\r\n", resultDic.Select(rd => $"{rd.Key}:{rd.Value.CurencyFormat()}"))}" +
                      $"\r\n总资产:{resultDic.Sum(p => p.Value).CurencyFormat()}";

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