コード例 #1
0
        public bool MyLackItems(MsgInformationEx MsgDTO, object[] param)
        {
            var itemColle     = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var allColleItems = itemColle.HonorCollections.SelectMany(p => p.Value.Items).Select(p => p.Key);
            var allItems      = HonorSvc.HonorList.Where(h => !h.IsLimit).SelectMany(h => h.Items);

            var lackItems = allItems.Where(p => !allColleItems.Contains(p.Name)).ToList();

            if (lackItems.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "恭喜你已经集齐了所有物品,快使用【灵魂转生】命令来升级吧!");
                return(false);
            }

            var msg = $"你总共缺少{lackItems.Count}件物品\r\n";

            if (lackItems.Count <= 20)
            {
                msg += string.Join(",", lackItems.Select(p => p.Name));
            }
            else
            {
                msg += "你缺少的物品太多啦!这里就不一一列举了!";
            }

            MsgSender.PushMsg(MsgDTO, msg);
            return(true);
        }
コード例 #2
0
        public bool ResolveItem(MsgInformationEx MsgDTO, object[] param)
        {
            var name = param[0] as string;
            var item = HonorSvc.FindItem(name);

            if (item == null)
            {
                MsgSender.PushMsg(MsgDTO, "未查找到相关物品!");
                return(false);
            }

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

            if (!itemColle.CheckItem(name))
            {
                MsgSender.PushMsg(MsgDTO, "你尚未持有该物品!");
                return(false);
            }

            itemColle.ItemConsume(name);
            itemColle.Update();

            var count      = Math.Max(item.Price / 20, 1);
            var flavorings = ExpeditionSceneSvc.RandFlavorings(count);

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

            cookingRec.FlavoringIncome(flavorings);
            cookingRec.Update();

            var msg = flavorings.Select(p => $"{p.Key}×{p.Value}").JoinToString(",");

            MsgSender.PushMsg(MsgDTO, $"分解成功!你获得了:\r\n{msg}");
            return(true);
        }
コード例 #3
0
ファイル: ShoppingAI.cs プロジェクト: Dolany/DolanyAI
        private bool SellItem(MsgInformationEx MsgDTO, DriftBottleItemModel item, int count = 1)
        {
            var record = ItemCollectionRecord.Get(MsgDTO.FromQQ);

            if (!record.CheckItem(item.Name, count))
            {
                MsgSender.PushMsg(MsgDTO, "你的背包里没有足够多的该物品!");
                return(false);
            }

            var price = HonorSvc.GetItemPrice(item, MsgDTO.FromQQ);
            var msg   = $"贩卖 {item.Name}*{count} 将获得 {(price * count).CurencyFormat()},是否确认贩卖?";

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

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

            TransHelper.SellItemToShop(item.Name, osPerson, count);
            osPerson.Update();

            MsgSender.PushMsg(MsgDTO, $"贩卖成功!你当前拥有金币 {osPerson.Golds.CurencyFormat()}");
            return(true);
        }
コード例 #4
0
        public void 雹()
        {
            var record = ItemCollectionRecord.Get(SelfQQNum);

            if (record.HonorCollections.IsNullOrEmpty())
            {
                MsgSender.PushMsg(GroupNum, 0, "你没有任何物品", BindAi);
                return;
            }

            var commonItems = record.HonorCollections.Where(p => p.Value.Type == HonorType.Normal).SelectMany(p => p.Value.Items).ToList();

            if (commonItems.IsNullOrEmpty())
            {
                MsgSender.PushMsg(GroupNum, 0, "你没有任何非限定物品", BindAi);
                return;
            }

            var(key, _) = commonItems.RandElement();

            var osPerson = OSPerson.GetPerson(SelfQQNum);

            TransHelper.SellItemToShop(key, osPerson);
            osPerson.Update();

            MsgSender.PushMsg(GroupNum, 0, $"你贩卖了 {key}\r\n你当前拥有金币 {osPerson.Golds}", BindAi);
        }
コード例 #5
0
        public bool MyLimitItems_Paged(MsgInformationEx MsgDTO, object[] param)
        {
            var pageNo = (int)(long)param[0];

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

            if (query.TotalItemCount() == 0)
            {
                MsgSender.PushMsg(MsgDTO, "你的背包空空如也~", true);
                return(false);
            }

            var itemMsgs = HonorSvc.GetOrderedItemsStr(query.HonorCollections.Where(p => p.Value.Type == HonorType.Limit)
                                                       .OrderByDescending(p => (HonorSvc.FindHonor(p.Key) as LimitHonorModel)?.SortKey).SelectMany(p => p.Value.Items)
                                                       .ToDictionary(p => p.Key, p => p.Value));
            var totalPageCount = (itemMsgs.Count - 1) / 5 + 1;

            if (pageNo <= 0 || pageNo > totalPageCount)
            {
                MsgSender.PushMsg(MsgDTO, "页码错误!", true);
                return(false);
            }

            var msg = $"该页的物品有:\r\n{string.Join("\r\n", itemMsgs.Skip((pageNo - 1) * 5).Take(5))}";

            if (itemMsgs.Count > 5)
            {
                msg += $"\r\n当前显示第 {pageNo}/{(itemMsgs.Count - 1) / 5 + 1}页,请使用 我的限定物品 [页码] 命令查看更多物品!";
            }
            MsgSender.PushMsg(MsgDTO, msg, true);
            return(true);
        }
コード例 #6
0
ファイル: ShoppingAI.cs プロジェクト: Dolany/DolanyAI
        public bool ShopInfo_Rare(MsgInformationEx MsgDTO, object[] param)
        {
            var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ);
            var golds    = osPerson.Golds;

            var todayRec    = DailySellItemRareRecord.GetToday();
            var tomorrowRec = DailySellItemRareRecord.GetTomorrow();

            if (todayRec.IsOver)
            {
                MsgSender.PushMsg(MsgDTO,
                                  $"稀有商店休息中~\r\n下次开放时间:明天 {tomorrowRec.Hour}:00:00 ~ {tomorrowRec.Hour + 3}:00:00");
                return(false);
            }

            if (todayRec.IsBefore)
            {
                MsgSender.PushMsg(MsgDTO,
                                  $"稀有商店休息中~\r\n下次开放时间:今天 {todayRec.Hour}:00:00 ~ {todayRec.Hour + 3}:00:00");
                return(false);
            }

            var sellItems = todayRec.Items;
            var record    = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var itemsStr  = string.Join("\r\n", sellItems.Select(si =>
                                                                 $"{si.Name}({HonorSvc.FindHonorFullName(si.Name)})({record.GetCount(si.Name)})({si.Attr}):{si.Price.CurencyFormat()}"));

            var msg = $"当前售卖的商品:\r\n{itemsStr}\r\n你当前持有 {golds.CurencyFormat()}";

            MsgSender.PushMsg(MsgDTO, msg);

            return(true);
        }
コード例 #7
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);
        }
コード例 #8
0
ファイル: LotteryAI.cs プロジェクト: Dolany/DolanyAI
        public bool LimitBonus(MsgInformationEx MsgDTO, object[] param)
        {
            var cache = PersonCacheRecord.Get(MsgDTO.FromQQ, "抽奖");

            if (string.IsNullOrEmpty(cache.Value) || !int.TryParse(cache.Value, out var times) || times <= 0)
            {
                MsgSender.PushMsg(MsgDTO, "你没有抽奖机会!", true);
                return(false);
            }

            var items = HonorSvc.CurMonthLimitItems();
            var item  = items.ToDictionary(p => p, p => p.Rate).RandRated();

            var session = new MsgSession(MsgDTO);

            session.Add($"恭喜你抽到了 【{item.Name}】*1");
            session.Add($"    {item.Description} ");

            var record = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var m      = record.ItemIncome(item.Name);

            if (!string.IsNullOrEmpty(m))
            {
                session.Add(m);
            }

            session.Send();

            cache.Value = (times - 1).ToString();
            cache.Update();

            return(true);
        }
コード例 #9
0
ファイル: LotteryAI.cs プロジェクト: Dolany/DolanyAI
        public bool TenLimitBonus(MsgInformationEx MsgDTO, object[] param)
        {
            var cache = PersonCacheRecord.Get(MsgDTO.FromQQ, "抽奖");

            if (string.IsNullOrEmpty(cache.Value) || !int.TryParse(cache.Value, out var times) || times < 10)
            {
                MsgSender.PushMsg(MsgDTO, "你没有足够的抽奖机会!", true);
                return(false);
            }

            var itemsRateDic = HonorSvc.CurMonthLimitItems().ToDictionary(p => p, p => p.Rate);
            var randItems    = SafeDictionary <string, int> .Empty;

            for (var i = 0; i < 10; i++)
            {
                var randItem = itemsRateDic.RandRated();
                randItems[randItem.Name] += 1;
            }

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

            foreach (var(name, count) in randItems.Data)
            {
                itemColle.ItemIncome(name, count);
            }

            var msg = $"恭喜你抽到了 {randItems.Data.Select(p => $"【{p.Key}】*{p.Value}").JoinToString(",")} !";

            MsgSender.PushMsg(MsgDTO, msg, true);

            cache.Value = (times - 10).ToString();
            cache.Update();

            return(true);
        }
コード例 #10
0
        public bool ItemBonus(MsgInformationEx MsgDTO, object[] param)
        {
            var qqNum    = (long)param[0];
            var itemName = param[1] as string;
            var count    = (int)(long)param[2];

            var item = HonorSvc.FindItem(itemName);

            if (item == null)
            {
                MsgSender.PushMsg(MsgDTO, "未找到该物品!");
                return(false);
            }

            var record = ItemCollectionRecord.Get(qqNum);
            var msg    = record.ItemIncome(itemName, count);

            if (!string.IsNullOrEmpty(msg))
            {
                MsgSender.PushMsg(MsgDTO, msg);
            }

            MsgSender.PushMsg(MsgDTO, "奖励已生效!");
            return(true);
        }
コード例 #11
0
        public bool MyKitchen(MsgInformationEx MsgDTO, object[] param)
        {
            var cookingRec = CookingRecord.Get(MsgDTO.FromQQ);
            var level      = CookingLevelSvc.LocationLevel(cookingRec.TotalPrice);
            var msg        = $"【{level.Name}(lv.{level.Level})】\r\n";
            var itemColle  = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var dietList   = cookingRec.LearndDietMenu.Select(diet =>
            {
                var Diet = CookingDietSvc[diet];
                if (!Diet.Flavorings.IsNullOrEmpty() && !cookingRec.CheckFlavorings(Diet.Flavorings) ||
                    !Diet.Materials.IsNullOrEmpty() && !itemColle.CheckItem(Diet.Materials))
                {
                    return($"{diet}(材料不足)");
                }

                return(diet);
            });

            msg +=
                $"已学会的菜谱:{string.Join(",", dietList)}\r\n";
            msg += $"当前持有菜肴:{string.Join(",", cookingRec.CookedDietDic.Select(p => $"{p.Key}*{p.Value}"))}\r\n";
            msg += $"当前持有调味料:{string.Join(",", cookingRec.FlavoringDic.Select(p => $"{p.Key}*{p.Value}"))}\r\n";
            msg += $"推荐学习菜谱:【{CookingDietSvc.SuggestDiet(cookingRec.LearndDietMenu)?.Name}】";

            MsgSender.PushMsg(MsgDTO, msg);
            return(true);
        }
コード例 #12
0
        public void 雾雨()
        {
            var sellingItems = TransHelper.GetDailySellItems();
            var item         = sellingItems.RandElement();
            var record       = ItemCollectionRecord.Get(SelfQQNum);
            var msg          = record.ItemIncome(item.Name);

            MsgSender.PushMsg(GroupNum, 0, $"你获得了:{item.Name}\r\n{msg}", BindAi);
        }
コード例 #13
0
ファイル: ShoppingAI.cs プロジェクト: Dolany/DolanyAI
        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);
        }
コード例 #14
0
ファイル: ShoppingAI.cs プロジェクト: Dolany/DolanyAI
        public bool Reborn(MsgInformationEx MsgDTO, object[] param)
        {
            var itemColl = ItemCollectionRecord.Get(MsgDTO.FromQQ);

            if (itemColl.HonorCollections.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "你尚未集齐所有非限定物品!", true);
                return(false);
            }

            var normalHonors = itemColl.HonorCollections.Where(h => h.Value.Type == HonorType.Normal).ToList();
            var items        = normalHonors.Select(p => p.Value).SelectMany(h => h.Items.Keys).ToList();

            var allItems = HonorSvc.HonorList.Where(h => !(h is LimitHonorModel)).SelectMany(h => h.Items).Select(p => p.Name);

            if (items.Count != allItems.Count())
            {
                MsgSender.PushMsg(MsgDTO, "你尚未集齐所有非限定物品!", true);
                return(false);
            }

            var response = WaiterSvc.WaitForInformation(MsgDTO, $"请输入想获取的荣誉称号名称(不能超过{RebornHonorLimit}个字)",
                                                        info => info.FromQQ == MsgDTO.FromQQ && info.FromGroup == MsgDTO.FromGroup && info.Msg != null && info.Msg.Length <= RebornHonorLimit, 10);

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

            var honorName = response.Msg;
            var osPerson  = OSPerson.GetPerson(MsgDTO.FromQQ);

            if (osPerson.HonorNames.Contains(honorName))
            {
                MsgSender.PushMsg(MsgDTO, "你已经获取了该荣誉称号,操作取消!");
                return(false);
            }

            osPerson.Level++;
            osPerson.HonorNames.Add(honorName);

            foreach (var honor in normalHonors.Select(p => p.Key))
            {
                TransHelper.SellHonorToShop(itemColl, honor, osPerson);
            }

            itemColl.Update();
            osPerson.Update();

            MsgSender.PushMsg(MsgDTO, $"恭喜【{honorName}】,转生成功!");
            return(true);
        }
コード例 #15
0
ファイル: 迷之匣.cs プロジェクト: Dolany/DolanyAI
        public bool Purchase(MsgInformationEx MsgDTO)
        {
            var shopItems = TransHelper.GetDailySellItems();
            var randItem  = shopItems.RandElement();
            var itemColle = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var msg       = itemColle.ItemIncome(randItem.Name);

            msg = $"恭喜你获得了 {randItem.Name}\r\n{msg}";
            MsgSender.PushMsg(MsgDTO, msg);

            return(true);
        }
コード例 #16
0
ファイル: ShoppingAI.cs プロジェクト: Dolany/DolanyAI
        public bool SellRedundant(MsgInformationEx MsgDTO, object[] param)
        {
            if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "快晴"))
            {
                MsgSender.PushMsg(MsgDTO, "你无法进行该操作!(快晴)");
                return(false);
            }

            var record = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var ics    = record.HonorCollections.Values.SelectMany(hc => hc.Items.Where(p => p.Value > 1)).ToList();

            if (ics.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "你没有任何多余的物品!");
                return(false);
            }

            var ictm = ics.Select(p => new
            {
                p.Key,
                Count   = p.Value - 1,
                IsLimit = HonorSvc.IsLimitItem(p.Key),
                Price   = HonorSvc.GetItemPrice(HonorSvc.FindItem(p.Key), MsgDTO.FromQQ)
            }).ToList();
            var msg = $"你即将贩卖{ictm.Sum(i => i.Count)}件物品," +
                      $"其中有{ictm.Count(i => i.IsLimit)}件限定物品," +
                      $"共价值{ictm.Sum(p => p.Price * p.Count).CurencyFormat()},是否继续?";

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

            foreach (var ic in ictm)
            {
                record.ItemConsume(ic.Key, ic.Count);
            }
            record.Update();

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

            osPerson.Golds += ictm.Sum(p => p.Price * p.Count);
            osPerson.Update();

            MsgSender.PushMsg(MsgDTO, $"贩卖成功,你当前拥有{osPerson.Golds.CurencyFormat()}!");
            return(true);
        }
コード例 #17
0
ファイル: 星耀之匣.cs プロジェクト: Dolany/DolanyAI
        public bool Purchase(MsgInformationEx MsgDTO)
        {
            var todayRec = DailySellItemRareRecord.GetToday();

            if (!todayRec.IsActive)
            {
                MsgSender.PushMsg(MsgDTO, "稀有商店尚未开启,你无法购买此物品!");
                return(false);
            }

            var itemColle = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var msgs      = todayRec.Items.Select(item => itemColle.ItemIncome(item.Name));

            MsgSender.PushMsg(MsgDTO, string.Join("\r\n", msgs));
            return(true);
        }
コード例 #18
0
        public bool MyHonors(MsgInformationEx MsgDTO, object[] param)
        {
            var query = ItemCollectionRecord.Get(MsgDTO.FromQQ);

            if (query.HonorList == null || query.HonorList.All(p => HonorSvc.IsLimitHonor(p)))
            {
                MsgSender.PushMsg(MsgDTO, "你还没有获得任何成就,继续加油吧~", true);
                return(false);
            }

            var msg = $"你获得的普通成就有:{string.Join(",", query.HonorList.Where(p => !HonorSvc.IsLimitHonor(p)))}\r\n";

            msg += $"你获得的限定成就有:{string.Join(",", query.HonorList.Where(p => HonorSvc.IsLimitHonor(p)))}";
            MsgSender.PushMsg(MsgDTO, msg, true);
            return(true);
        }
コード例 #19
0
ファイル: ShoppingAI.cs プロジェクト: Dolany/DolanyAI
        public bool ShopInfo(MsgInformationEx MsgDTO, object[] param)
        {
            var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ);
            var golds    = osPerson.Golds;

            var sellItems = TransHelper.GetDailySellItems();
            var record    = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var itemsStr  = string.Join("\r\n", sellItems.Select(si =>
                                                                 $"{si.Name}({HonorSvc.FindHonorFullName(si.Name)})({record.GetCount(si.Name)})({si.Attr}):{si.Price.CurencyFormat()}"));

            var msg = $"今日售卖的商品:\r\n{itemsStr}\r\n你当前持有 {golds.CurencyFormat()}";

            MsgSender.PushMsg(MsgDTO, msg);

            return(true);
        }
コード例 #20
0
        private void FishItem(MsgInformationEx MsgDTO)
        {
            if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "梅雨") && Rander.RandInt(100) < 30)
            {
                MsgSender.PushMsg(MsgDTO, "欸呀呀,捞瓶子失败了!(梅雨)", true);
                return;
            }

            var item      = HonorSvc.RandItem();
            var record    = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var honorName = HonorSvc.FindHonorName(item.Name);

            var count     = 1;
            var vipArmers = VipArmerRecord.Get(MsgDTO.FromQQ);

            if (vipArmers.CheckArmer("安妮的镜子"))
            {
                count = 2;
            }
            vipArmers.Armers.Remove(p => p.Name == "安妮的镜子");
            vipArmers.Update();

            DriftBottleAnalyzeRecord.Record(item.Name, count);

            var s   = record.ItemIncome(item.Name, count);
            var msg = "你捞到了 \r\n" +
                      $"{(string.IsNullOrEmpty(item.PicPath) ? string.Empty : $"{CodeApi.Code_Image_Relational(item.PicPath)}\r\n")}" +
                      $"{item.Name}{(count > 1 ? $"*{count}" : string.Empty)} \r\n" +
                      $"    {item.Description} \r\n" +
                      $"稀有率为 {HonorSvc.ItemRate(item)}%\r\n" +
                      $"售价为:{item.Price} 金币\r\n" +
                      $"特性:{(item.Attributes == null ? "无" : string.Join(",", item.Attributes))}\r\n" +
                      $"你总共拥有该物品 {record.HonorCollections[honorName].Items[item.Name]}个";

            if (!string.IsNullOrEmpty(s))
            {
                msg += $"\r\n{s}";
            }

            if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "钻石尘") && Rander.RandInt(100) < 50)
            {
                OSPerson.GoldConsume(MsgDTO.FromQQ, 40);
                msg += "\r\n欸呀呀,你丢失了40金币(钻石尘)";
            }

            MsgSender.PushMsg(MsgDTO, msg, true);
        }
コード例 #21
0
        public bool Purchase(MsgInformationEx MsgDTO)
        {
            var todayRec = DailySellItemRareRecord.GetToday();

            if (!todayRec.IsActive)
            {
                MsgSender.PushMsg(MsgDTO, "稀有商店尚未开启,你无法购买此物品!");
                return(false);
            }

            var randItem  = todayRec.Items.RandElement();
            var itemColle = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var msg       = itemColle.ItemIncome(randItem.Name);

            MsgSender.PushMsg(MsgDTO, $"你获得了{randItem.Name}\r\n{msg}");
            return(true);
        }
コード例 #22
0
ファイル: GiftAI.cs プロジェクト: Dolany/DolanyAI
        public bool MakeGift(MsgInformationEx MsgDTO, object[] param)
        {
            var name = param[0] as string;
            var gift = GiftSvc[name];

            if (gift == null)
            {
                MsgSender.PushMsg(MsgDTO, "未查找到该礼物!");
                return(false);
            }

            var sellingGifts = GiftSvc.SellingGifts;

            if (sellingGifts.All(p => p.Name != name))
            {
                MsgSender.PushMsg(MsgDTO, "该礼物未在礼物商店中出售,请使用 礼物商店 命令查看今日可兑换的礼物!", true);
                return(false);
            }

            var itemRecord = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var mdic       = itemRecord.HonorCollections.SelectMany(p => p.Value.Items).ToDictionary(p => p.Key, p => p.Value);
            var osPerson   = OSPerson.GetPerson(MsgDTO.FromQQ);

            if (!gift.Check(mdic, osPerson.Golds, out var msg))
            {
                MsgSender.PushMsg(MsgDTO, $"兑换{name}需要:\r\n{msg}材料不足,无法兑换!");
                return(false);
            }

            if (!WaiterSvc.WaitForConfirm(MsgDTO, $"兑换{name}需要:\r\n{msg}是否兑换?"))
            {
                MsgSender.PushMsg(MsgDTO, "操作取消!");
                return(false);
            }

            itemRecord.ItemConsume(gift.MaterialDic);
            itemRecord.Update();
            osPerson.Golds -= gift.GoldNeed;
            osPerson.GiftIncome(name);
            osPerson.Update();

            MsgSender.PushMsg(MsgDTO, "兑换成功!可以使用 赠送礼物 命令将礼物送给其他人!", true);

            return(true);
        }
コード例 #23
0
ファイル: AdvGameEngine.cs プロジェクト: Dolany/DolanyAI
        private void Settlement()
        {
            var msg = $"对决结束!{CodeApi.Code_At(Winner.QQNum)}获取了胜利!";

            if (Bonus > 0)
            {
                msg += $"\r\n获得了全部赏金 {Bonus}金币!";
                var osPerson = OSPerson.GetPerson(Winner.QQNum);
                osPerson.Golds += Bonus;
                osPerson.Update();
            }
            MsgSender.PushMsg(GroupNum, 0, msg, BindAi);

            foreach (var player in players)
            {
                var p = AdvPlayer.GetPlayer(player.QQNum);
                p.BattleRecord(p.QQNum == Winner.QQNum);
                p.Update();
                if (p.QQNum != Winner.QQNum)
                {
                    var osPerson = OSPerson.GetPerson(p.QQNum);
                    osPerson.Golds -= 100;
                    osPerson.Update();
                    MsgSender.PushMsg(GroupNum, p.QQNum, $"你不幸输掉了对决,扣除100金币,你剩余金币为 {osPerson.Golds}", BindAi);
                    continue;
                }

                if (p.WinTotal % 10 != 0)
                {
                    continue;
                }

                var items = HonorSvc.CurMonthLimitItems();
                var item  = items.RandElement();
                MsgSender.PushMsg(GroupNum, p.QQNum, $"你已经累计赢得 {p.WinTotal}场对决,获取额外奖励 {item.Name}*1", BindAi);

                var record   = ItemCollectionRecord.Get(p.QQNum);
                var honorMsg = record.ItemIncome(item.Name);
                if (!string.IsNullOrEmpty(honorMsg))
                {
                    MsgSender.PushMsg(GroupNum, 0, honorMsg, BindAi);
                }
            }
        }
コード例 #24
0
        public bool ViewHonor(MsgInformationEx MsgDTO, object[] param)
        {
            var name  = param[0] as string;
            var honor = HonorSvc.FindHonor(name);

            if (honor == null)
            {
                MsgSender.PushMsg(MsgDTO, $"未找到该成就:{name}");
                return(false);
            }

            var record   = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var items    = honor.Items.Select(h => $"{h.Name}*{record.GetCount(h.Name)}");
            var itemsMsg = string.Join(",", items);
            var msg      = $"解锁成就 【{honor.FullName}】 需要集齐:{itemsMsg}";

            MsgSender.PushMsg(MsgDTO, msg);
            return(true);
        }
コード例 #25
0
ファイル: ShoppingAI.cs プロジェクト: Dolany/DolanyAI
        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);
        }
コード例 #26
0
ファイル: ShoppingAI.cs プロジェクト: Dolany/DolanyAI
        public bool ViewItem(MsgInformationEx MsgDTO, object[] param)
        {
            var osPerson      = OSPerson.GetPerson(MsgDTO.FromQQ);
            var itemRecord    = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var glamourRecord = GlamourRecord.Get(MsgDTO.FromGroup, MsgDTO.FromQQ);

            var normalHonors = itemRecord.HonorCollections.Where(h => h.Value.Type == HonorType.Normal).ToList();
            var items        = normalHonors.Select(p => p.Value).SelectMany(h => h.Items.Keys).ToList();

            var allNormalItems = HonorSvc.HonorList.Where(h => !h.IsLimit).SelectMany(h => h.Items).Select(p => p.Name).ToArray();

            var msgList = new List <string>();

            if (!osPerson.HonorNames.IsNullOrEmpty())
            {
                msgList.Add(string.Join("", osPerson.HonorNames.Select(h => $"【{h}】")));
            }
            msgList.Add($"等级:{osPerson.EmojiLevel}");
            msgList.Add($"经验值:{items.Count}/{allNormalItems.Length}{(items.Count == allNormalItems.Length ? "(可转生)" : string.Empty)}");

            msgList.Add($"金币:{osPerson.Golds.CurencyFormat()}");
            if (osPerson.Diamonds > 0)
            {
                msgList.Add($"钻石:{osPerson.Diamonds.CurencyFormat("Diamond")}");
            }
            msgList.Add($"物品数量:{itemRecord.TotalItemCount()}");
            msgList.Add($"成就数量:{itemRecord.HonorList?.Count ?? 0}");
            if (glamourRecord.Glamour > 0)
            {
                msgList.Add($"魅力值:{glamourRecord.Glamour}");
            }

            var buffs = OSPersonBuff.Get(MsgDTO.FromQQ);

            if (!buffs.IsNullOrEmpty())
            {
                msgList.Add("Buff列表:");
                msgList.AddRange(buffs.Select(b => $"{b.Name}:{b.Description}({b.ExpiryTime})"));
            }

            MsgSender.PushMsg(MsgDTO, string.Join("\r\n", msgList), true);
            return(true);
        }
コード例 #27
0
        public bool MyItems(MsgInformationEx MsgDTO, object[] param)
        {
            var query = ItemCollectionRecord.Get(MsgDTO.FromQQ);

            if (query.TotalItemCount() == 0)
            {
                MsgSender.PushMsg(MsgDTO, "你的背包空空如也~", true);
                return(false);
            }

            var itemMsgs = HonorSvc.GetOrderedItemsStr(query.HonorCollections.Where(p => p.Value.Type == HonorType.Normal).SelectMany(p => p.Value.Items)
                                                       .ToDictionary(p => p.Key, p => p.Value));
            var msg = $"你收集到的物品有:\r\n{string.Join("\r\n", itemMsgs.Take(7))}";

            if (itemMsgs.Count > 7)
            {
                msg += $"\r\n当前显示第 1/{(itemMsgs.Count - 1) / 7 + 1}页,请使用 我的物品 [页码] 命令查看更多物品!";
            }
            MsgSender.PushMsg(MsgDTO, msg, true);
            return(true);
        }
コード例 #28
0
        public ExpeditionAward Award(long QQNum)
        {
            var award = new ExpeditionAward()
            {
                Name = Name
            };

            if (GoldBonus != null)
            {
                award.Gold = GoldBonus.Min + Rander.RandRange(GoldBonus.Min, GoldBonus.Max);
                var osPerson = OSPerson.GetPerson(QQNum);
                osPerson.Golds += award.Gold;
                osPerson.Update();
            }

            if (ItemBonus != null)
            {
                var count = ItemBonus.Min + Rander.RandRange(ItemBonus.Min, ItemBonus.Max);
                award.Items = Enumerable.Range(0, count).Select(p => ItemBonus.Options.RandElement()).ToList();
                var itemColle = ItemCollectionRecord.Get(QQNum);
                foreach (var item in award.Items)
                {
                    itemColle.ItemIncome(item);
                }
            }

            if (FlavoringBonus != null)
            {
                var count = FlavoringBonus.Min + Rander.RandRange(FlavoringBonus.Min, FlavoringBonus.Max);
                award.Flavorings = Enumerable.Range(0, count).Select(p => FlavoringBonus.Options.RandElement()).ToList();
                var flavoringRec = CookingRecord.Get(QQNum);
                foreach (var flavoring in award.Flavorings)
                {
                    flavoringRec.FlavoringIncome(flavoring);
                }
                flavoringRec.Update();
            }

            return(award);
        }
コード例 #29
0
        public bool ExchangeMenu(MsgInformationEx MsgDTO, object[] param)
        {
            var dietName = param[0] as string;
            var diet     = CookingDietSvc[dietName];

            if (diet == null)
            {
                MsgSender.PushMsg(MsgDTO, "未查找到相关菜肴");
                return(false);
            }

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

            if (cookingRec.LearndDietMenu.Contains(dietName))
            {
                MsgSender.PushMsg(MsgDTO, "你已经学会了该菜肴的烹饪方法!");
                return(false);
            }

            var itemColle  = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var honorModel = HonorSvc.FindHonor(diet.ExchangeHonor);
            var items      = honorModel.Items.ToDictionary(p => p.Name, p => 1);

            if (!itemColle.CheckItem(items))
            {
                MsgSender.PushMsg(MsgDTO, $"你尚未集齐【{diet.ExchangeHonor}】的所有物品!");
                return(false);
            }

            itemColle.ItemConsume(items);
            itemColle.Update();

            cookingRec.LearndDietMenu.Add(diet.Name);
            cookingRec.Update();

            MsgSender.PushMsg(MsgDTO, "兑换成功!");
            return(true);
        }
コード例 #30
0
ファイル: ShoppingAI.cs プロジェクト: Dolany/DolanyAI
        private bool SellHonor(MsgInformationEx MsgDTO, string honorName)
        {
            var colleRec = ItemCollectionRecord.Get(MsgDTO.FromQQ);

            if (colleRec.HonorCollections.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "你尚未拥有任何物品!");
                return(false);
            }

            var items           = HonorSvc.FindHonor(honorName).Items;
            var honorCollection = colleRec.HonorCollections;

            if (!honorCollection.ContainsKey(honorName) || honorCollection[honorName].Items.Count < items.Count)
            {
                MsgSender.PushMsg(MsgDTO, "你尚未集齐该成就下的所有物品!");
                return(false);
            }

            var price = HonorSvc.GetHonorPrice(honorName, MsgDTO.FromQQ);
            var msg   = $"贩卖此成就将获得 {price.CurencyFormat()},是否确认贩卖?";

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

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

            TransHelper.SellHonorToShop(colleRec, honorName, osPerson);

            colleRec.Update();
            osPerson.Update();

            MsgSender.PushMsg(MsgDTO, $"贩卖成功!你当前拥有金币 {osPerson.Golds.CurencyFormat()}");
            return(true);
        }