コード例 #1
0
ファイル: ChessEngine.cs プロジェクト: Dolany/DolanyAI
        private void ProceedTurn()
        {
            var response = WaitCallBack(GroupNum, SelfQQNum, $"回合开始!请输入合适的数字来获取随机效果!\r\n{ChessBoardStr()}",
                                        msg => int.TryParse(msg, out var num) && AvailableNums.Contains(num));

            if (string.IsNullOrEmpty(response) || !int.TryParse(response, out var selectedNum) || !AvailableNums.Contains(selectedNum))
            {
                //MsgSender.PushMsg(GroupNum, 0, "回合结束!", BindAi);
                return;
            }

            var model = Chessborad[selectedNum - 1];

            MsgSender.PushMsg(GroupNum, 0, $"随机效果已生效:{model.Name}!\r\n{model.Description}", BindAi);
            Thread.Sleep(1000);

            model.Method();
            model.IsChecked = true;

            Thread.Sleep(1000);
            //MsgSender.PushMsg(GroupNum, 0, "回合结束!", BindAi);
        }
コード例 #2
0
ファイル: AdvGameEngine.cs プロジェクト: Dolany/DolanyAI
        public void GameStart()
        {
            MsgSender.PushMsg(GroupNum, 0, $"冒险开始!当前副本是 {CaveModel.Name} !", BindAi);
            Thread.Sleep(1000);

            try
            {
                while (Winner == null)
                {
                    ProcessTurn();
                    AlterTurn();
                    Thread.Sleep(2000);
                }

                Settlement();
            }
            catch (Exception ex)
            {
                MsgSender.PushMsg(GroupNum, 0, "游戏异常,对决结束!", BindAi);
                RuntimeLogger.Log(ex);
            }
        }
コード例 #3
0
        public bool GiftBonus(MsgInformationEx MsgDTO, object[] param)
        {
            var qqNum = (long)param[0];
            var name  = param[1] as string;
            var count = (int)(long)param[2];

            var gift = GiftSvc[name];

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

            var osPerson = OSPerson.GetPerson(qqNum);

            osPerson.GiftIncome(name, count);
            osPerson.Update();

            MsgSender.PushMsg(MsgDTO, "奖励已生效!");
            return(true);
        }
コード例 #4
0
ファイル: DeveloperOnlyAI.cs プロジェクト: Dolany/DolanyAI
        public bool FishingBonus(MsgInformationEx MsgDTO, object[] param)
        {
            var command = param[0] as string;
            var qqNum   = (long)param[1];
            var count   = (int)(long)param[2];

            var enter = CrossWorldAiSvc[MsgDTO.FromGroup].AllAvailableGroupCommands.FirstOrDefault(p => p.CommandsList.Contains(command));

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

            var dailyLimit = DailyLimitRecord.Get(qqNum, enter.ID);

            dailyLimit.Decache(count);
            dailyLimit.Update();

            MsgSender.PushMsg(MsgDTO, "奖励已生效!");
            return(true);
        }
コード例 #5
0
        public bool ConnectiongState(MsgInformationEx MsgDTO, object[] param)
        {
            var command = new MsgCommand()
            {
                Command = CommandType.ConnectionState,
                BindAi  = MsgDTO.BindAi
            };

            var info = WaiterSvc.WaitForRelationId(command);

            if (info == null)
            {
                MsgSender.PushMsg(MsgDTO, "超时!");
                return(false);
            }

            var dic = JsonConvert.DeserializeObject <Dictionary <string, bool> >(info.Msg);
            var msg = string.Join("\r\n", dic.Select(p => $"{p.Key}:{(p.Value ? "连接中" : "已断开")}"));

            MsgSender.PushMsg(MsgDTO, msg);
            return(true);
        }
コード例 #6
0
        public bool MyLimitItems(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.Limit)
                                                       .OrderByDescending(p => (HonorSvc.FindHonor(p.Key) as LimitHonorModel)?.SortKey).SelectMany(p => p.Value.Items)
                                                       .ToDictionary(p => p.Key, p => p.Value));
            var msg = $"你收集到的限定物品有:\r\n{string.Join("\r\n", itemMsgs.Take(5))}";

            if (itemMsgs.Count > 5)
            {
                msg += $"\r\n当前显示第 1/{(itemMsgs.Count - 1) / 5 + 1}页,请使用 我的限定物品 [页码] 命令查看更多物品!";
            }
            MsgSender.PushMsg(MsgDTO, msg, true);
            return(true);
        }
コード例 #7
0
        public bool MyExpeditionHistory(MsgInformationEx MsgDTO, object[] param)
        {
            var history = ExpeditionHistory.Get(MsgDTO.FromQQ);

            if (history.SceneDic.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "尚未记录到远征信息!");
                return(false);
            }

            var hotScenes = history.SceneDic.OrderByDescending(p => p.Value).Take(3).ToList();
            var session   = new MsgSession(MsgDTO);

            session.Add($"你最热衷的远征地点:{hotScenes.Select(s => $"{s.Key}*{s.Value}次").JoinToString(",")}");
            session.Add($"共获得金币:{history.GoldsTotal.CurencyFormat()}");
            session.Add($"共获得调味料:{history.FlavoringTotal}个");
            session.Add($"共获得物品:{history.ItemBonusCount}个");
            session.Add($"物品总价值:{history.ItemBonusPriceTotal.CurencyFormat()}");

            session.Send();
            return(true);
        }
コード例 #8
0
        public void AddReview(PicReviewRecord record)
        {
            var oldRec = MongoService <PicReviewRecord> .GetOnly(p => p.QQNum == record.QQNum && p.Usage == record.Usage && p.Status == PicReviewStatus.Waiting);

            if (oldRec == null)
            {
                record.Insert();
            }
            else
            {
                oldRec.PicName    = record.PicName;
                oldRec.CreateTime = record.CreateTime;
                oldRec.GroupNum   = record.GroupNum;
                oldRec.Update();
            }

            var count = MongoService <PicReviewRecord> .Count(p => p.Status == PicReviewStatus.Waiting);

            var msg = $"有新的待审核图片!\r\n来自 {GroupSettingSvc[record.GroupNum].Name} 的 {record.QQNum}\r\n当前剩余 {count} 张图片待审核!";

            MsgSender.PushMsg(0, Global.DeveloperNumber, msg, Global.DefaultConfig.MainAi);
        }
コード例 #9
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);
        }
コード例 #10
0
        public bool Supply(MsgInformationEx MsgDTO, object[] param)
        {
            var castle = KindomCastle.Get(MsgDTO.FromGroup, MsgDTO.FromQQ);

            var starvingGroups = SoldierGroup.StarvingGroups(MsgDTO.FromQQ);

            if (starvingGroups.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "你没有需要补给的军队!", true);
                return(false);
            }

            var totalConsume     = 0;
            var feededGroupCount = 0;

            foreach (var starvingGroup in starvingGroups)
            {
                if (castle.Commissariat < starvingGroup.Count)
                {
                    break;
                }

                castle.Commissariat -= starvingGroup.Count;
                starvingGroup.Feed();
                totalConsume += starvingGroup.Count;
                feededGroupCount++;
            }
            castle.Update();

            var session = new MsgSession(MsgDTO);

            session.Add("补给完成!");
            session.Add($"共补给 {feededGroupCount}支军队,共消耗粮草 {totalConsume}");
            session.Add($"当前剩余 {starvingGroups.Count - feededGroupCount}支军队尚未补给,当前剩余粮草 {castle.Commissariat}");

            session.Send();
            return(true);
        }
コード例 #11
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);
        }
コード例 #12
0
        public bool DeathStaring(MsgInformationEx MsgDTO, object[] param)
        {
            var aimQQ   = (long)param[0];
            var minutes = (int)(long)param[1];

            if (minutes <= 0 || minutes > 500)
            {
                MsgSender.PushMsg(MsgDTO, "错误的时间范围!");
                return(false);
            }

            var key = $"AliveState-{MsgDTO.FromGroup}-{aimQQ}";

            if (!SkillCheck(MsgDTO, aimQQ, key))
            {
                return(false);
            }

            var rebornTime = DateTime.Now.AddMinutes(minutes);

            DoSkill(MsgDTO, aimQQ, key, rebornTime, "死亡凝视");
            return(true);
        }
コード例 #13
0
        public bool StarLightBreak(MsgInformationEx MsgDTO, object[] param)
        {
            var aimQQ = (long)param[0];
            var hours = (int)(long)param[1];

            if (hours <= 0 || hours > 80)
            {
                MsgSender.PushMsg(MsgDTO, "错误的时间范围!");
                return(false);
            }

            var key = $"AliveState-{MsgDTO.FromGroup}-{aimQQ}";

            if (!SkillCheck(MsgDTO, aimQQ, key))
            {
                return(false);
            }

            var rebornTime = DateTime.Now.AddHours(hours);

            DoSkill(MsgDTO, aimQQ, key, rebornTime, "星光爆裂");
            return(true);
        }
コード例 #14
0
        public bool DreamSeal(MsgInformationEx MsgDTO, object[] param)
        {
            var aimQQ = (long)param[0];
            var days  = (int)(long)param[1];

            if (days <= 0 || days > 30)
            {
                MsgSender.PushMsg(MsgDTO, "错误的时间范围!");
                return(false);
            }

            var key = $"AliveState-{MsgDTO.FromGroup}-{aimQQ}";

            if (!SkillCheck(MsgDTO, aimQQ, key))
            {
                return(false);
            }

            var rebornTime = DateTime.Now.AddDays(days);

            DoSkill(MsgDTO, aimQQ, key, rebornTime, "梦想封印");
            return(true);
        }
コード例 #15
0
ファイル: GiftAI.cs プロジェクト: Dolany/DolanyAI
        public bool ViewGift(MsgInformationEx MsgDTO, object[] param)
        {
            var name = param[0] as string;
            var gift = GiftSvc[name];

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

            var msg = $"礼物名:{gift.Name}\r\n";

            msg += $"描述:{gift.Description}\r\n";
            msg += $"羁绊值:{gift.Intimate}\r\n";
            msg += $"魅力值:{gift.Glamour}\r\n";
            msg += $"兑换需要材料:{string.Join(",", gift.MaterialDic.Select(p => $"{p.Key}*{p.Value}"))}\r\n";
            msg += $"兑换需要金币:{gift.GoldNeed.CurencyFormat()}";

            MsgSender.PushMsg(MsgDTO, msg);

            return(true);
        }
コード例 #16
0
        public bool Register(MsgInformationEx MsgDTO, object[] param)
        {
            var groupNum = (long)param[0];
            var name     = param[1] as string;

            GroupSettingSvc.Delete(groupNum);
            var setting = new GroupSettings()
            {
                GroupNum = groupNum,
                Name     = name,
                BindAi   = MsgDTO.BindAi,
                BindAis  = new List <string>()
                {
                    MsgDTO.BindAi
                },
                WorldLine = CrossWorldAiSvc.DefaultWorldLine.Name
            };

            setting.Insert();

            MsgSender.PushMsg(MsgDTO, "注册成功!");
            return(true);
        }
コード例 #17
0
ファイル: CharactorSettingAI.cs プロジェクト: Dolany/DolanyAI
        private static void TryToUpdateChar(MsgInformationEx MsgDTO, string charactor, string settingName, string content)
        {
            if (!IsCharactorCreator(MsgDTO, charactor))
            {
                MsgSender.PushMsg(MsgDTO, "只能修改自己创建的人物哦~");
                return;
            }

            if (IsSettingFull(MsgDTO.FromGroup, charactor, settingName))
            {
                MsgSender.PushMsg(MsgDTO, $"每个人物只能设定{MaxSettingPerChar}个属性哦~");
                return;
            }

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

            var aimQQ = (long)param[0];
            var name  = param[1] as string;
            var price = (int)(long)param[2];

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

            if (price <= 0)
            {
                MsgSender.PushMsg(MsgDTO, "价格异常!");
                return(false);
            }

            if (HonorSvc.FindItem(name) != null)
            {
                return(DealItem(MsgDTO, name, aimQQ, price));
            }

            if (CookingDietSvc[name] != null)
            {
                return(DealDiet(MsgDTO, name, aimQQ, price));
            }

            MsgSender.PushMsg(MsgDTO, "未查找到相关物品信息!");
            return(false);
        }
コード例 #19
0
        public bool MyItemsByAttr(MsgInformationEx MsgDTO, object[] param)
        {
            var name = param[0] as string;

            if (!PetExtent.AllAttributes.Contains(name))
            {
                MsgSender.PushMsg(MsgDTO, "请输入正确的特性名!", true);
                return(false);
            }

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

            if (record.HonorCollections.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "你的背包空空如也~", true);
                return(false);
            }

            var items = record.HonorCollections.Where(p => p.Value.Items != null).SelectMany(p => p.Value.Items
                                                                                             .Where(item =>
            {
                var itemModel = HonorSvc.FindItem(item.Key);
                return(itemModel.Attributes != null && itemModel.Attributes.Contains(name));
            })).ToList();

            if (!items.Any())
            {
                MsgSender.PushMsg(MsgDTO, "你没有该特性的物品!", true);
                return(false);
            }

            var msg = $"你收集的物品中,【{name}】 特性的物品有:\r\n" +
                      string.Join(",", items.Select(item => $"{item.Key}*{item.Value}"));

            MsgSender.PushMsg(MsgDTO, msg);
            return(true);
        }
コード例 #20
0
        public bool FunctionBonus(MsgInformationEx MsgDTO, object[] param)
        {
            var command = param[0] as string;
            var qqNum   = (long)param[1];
            var count   = (int)(long)param[2];

            var enters = CrossWorldAiSvc[MsgDTO.FromGroup].AllAvailableGroupCommands.Where(p => p.Command == command).ToList();

            if (enters.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "未找到该功能!", true);
                return(false);
            }

            var enter = enters.First();

            if (enters.Count > 1)
            {
                var options  = enters.Select(p => $"{p.Command} {p.SyntaxHint}").ToArray();
                var response = WaiterSvc.WaitForOptions(MsgDTO.FromGroup, MsgDTO.FromQQ, "请选择需要奖励的功能:", options, MsgDTO.BindAi);
                if (response < 0)
                {
                    MsgSender.PushMsg(MsgDTO, "操作取消!");
                    return(false);
                }

                enter = enters[response];
            }

            var dailyLimit = DailyLimitRecord.Get(qqNum, enter.ID);

            dailyLimit.Decache(count);
            dailyLimit.Update();

            MsgSender.PushMsg(MsgDTO, "奖励已生效!");
            return(true);
        }
コード例 #21
0
ファイル: AutoTimingTool.cs プロジェクト: Dolany/DolanyAI
        protected override void ScheduleDo(SchedulerTimer timer)
        {
            var curHour  = DateTime.Now.Hour;
            var settings = MongoService <AutoPowerSetting> .Get(p => p.Hour == curHour);

            foreach (var setting in settings)
            {
                var GroupSettingMgr = AutofacSvc.Resolve <GroupSettingSvc>();
                switch (setting.ActionType)
                {
                case AutoPowerSettingActionType.PowerOn:
                {
                    var groupSetting = GroupSettingMgr[setting.GroupNum];
                    groupSetting.IsPowerOn = true;
                    groupSetting.Update();

                    MsgSender.PushMsg(setting.GroupNum, 0, "开机成功!", groupSetting.BindAi);
                    break;
                }

                case AutoPowerSettingActionType.PowerOff:
                {
                    var groupSetting = GroupSettingMgr[setting.GroupNum];
                    groupSetting.IsPowerOn = false;
                    groupSetting.Update();

                    MsgSender.PushMsg(setting.GroupNum, 0, "关机成功!", groupSetting.BindAi);
                    break;
                }

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            timer.Interval = SchedulerTimer.NextHourInterval;
        }
コード例 #22
0
        public bool ViewItem(MsgInformationEx MsgDTO, object[] param)
        {
            var name = param[0] as string;
            var item = HonorSvc.FindItem(name);

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

            var record = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var msg    = $"{(string.IsNullOrEmpty(item.PicPath) ? string.Empty : $"{CodeApi.Code_Image_Relational(item.PicPath)}\r\n")}" +
                         $"{item.Name}\r\n" +
                         $"    {item.Description}\r\n" +
                         $"稀有率:{HonorSvc.ItemRate(item)}%\r\n" +
                         $"价格:{HonorSvc.GetItemPrice(item, MsgDTO.FromQQ).CurencyFormat()}\r\n" +
                         $"特性:{(item.Attributes == null ? "无" : string.Join(",", item.Attributes))}\r\n" +
                         $"可解锁成就:{HonorSvc.FindHonorFullName(item.Name)}\r\n" +
                         $"你拥有该物品:{record.GetCount(item.Name)}个";

            MsgSender.PushMsg(MsgDTO, msg);
            return(true);
        }
コード例 #23
0
ファイル: PetAI.cs プロジェクト: Dolany/DolanyAI
        public bool SetPetKind(MsgInformationEx MsgDTO, object[] param)
        {
            var name = param[0] as string;

            name = name?.Trim();
            if (string.IsNullOrEmpty(name))
            {
                MsgSender.PushMsg(MsgDTO, "种族不能为空!", true);
                return(false);
            }

            if (name.Length > 10)
            {
                MsgSender.PushMsg(MsgDTO, "种族不能超过10个字!", true);
                return(false);
            }
            var pet = PetRecord.Get(MsgDTO.FromQQ);

            pet.PetNo = name;
            pet.Update();

            MsgSender.PushMsg(MsgDTO, "设定成功!");
            return(true);
        }
コード例 #24
0
        public bool RefreshVipShop(MsgInformationEx MsgDTO, object[] param)
        {
            var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ);

            if (osPerson.Diamonds < 10)
            {
                MsgSender.PushMsg(MsgDTO, $"很抱歉,你当前的钻石余额不足,无法刷新vip商店!({osPerson.Diamonds}/10)");
                return(false);
            }

            if (!WaiterSvc.WaitForConfirm(MsgDTO, $"此操作将花费{10.CurencyFormat("Diamond")},是否继续?"))
            {
                MsgSender.PushMsg(MsgDTO, "操作取消!");
                return(false);
            }

            osPerson.Diamonds -= 10;
            osPerson.Update();

            DailyVipGoodsRecord.Refresh(MsgDTO.FromQQ);

            MsgSender.PushMsg(MsgDTO, "刷新成功!");
            return(true);
        }
コード例 #25
0
        public void 浓雾()
        {
            var query = ItemCollectionRecord.Get(AimQQNum);

            if (query == null || query.HonorCollections.IsNullOrEmpty())
            {
                MsgSender.PushMsg(GroupNum, 0, "对手没有任何物品!", BindAi);
                return;
            }

            var nomalHonors = query.HonorCollections.Where(p => p.Value.Type == HonorType.Normal).ToList();

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

            var(key, _) = nomalHonors.SelectMany(p => p.Value.Items).RandElement();
            var record = ItemCollectionRecord.Get(SelfQQNum);
            var msg    = record.ItemIncome(key);

            MsgSender.PushMsg(GroupNum, 0, $"你获得了 {key}!\r\n{msg}", BindAi);
        }
コード例 #26
0
ファイル: PlusOneAI.cs プロジェクト: Dolany/DolanyAI
        private void Repeat(MsgInformationEx MsgDTO, PlusOneModel groupCache)
        {
            if (groupCache.MsgCache != MsgDTO.FullMsg)
            {
                groupCache.MsgCache          = MsgDTO.FullMsg;
                groupCache.IsAlreadyRepeated = false;

                return;
            }
            if (groupCache.IsAlreadyRepeated)
            {
                return;
            }

            AIAnalyzer.AddCommandCount(new CmdRec()
            {
                FunctionalAi = AIName,
                Command      = "PlusOneOverride",
                GroupNum     = MsgDTO.FromGroup,
                BindAi       = MsgDTO.BindAi
            });
            MsgSender.PushMsg(MsgDTO, MsgDTO.FullMsg);
            groupCache.IsAlreadyRepeated = true;
        }
コード例 #27
0
        private static void ShowRandFortune(MsgInformationEx MsgDTO, RandomFortuneCache rf)
        {
            var msg = string.Empty;

            if (rf.BlessValue > 0)
            {
                rf.FortuneValue += rf.BlessValue;
                rf.FortuneValue  = rf.FortuneValue > 100 ? 100 : rf.FortuneValue;
                msg             += $"恭喜你受到了 {rf.BlessName} 的祝福\r\n";
                msg             += $"你今天的运势是:{rf.FortuneValue}%({rf.BlessValue}↑)\r\n";
            }
            else if (rf.BlessValue < 0)
            {
                rf.FortuneValue += rf.BlessValue;
                rf.FortuneValue  = rf.FortuneValue < 0 ? 0 : rf.FortuneValue;
                msg             += $"哎呀呀,你受到了 {rf.BlessName} 的诅咒\r\n";
                msg             += $"你今天的运势是:{rf.FortuneValue}%({Math.Abs(rf.BlessValue)}↓)\r\n";
            }
            else
            {
                msg += "你今天的运势是:" + rf.FortuneValue + "%\r\n";
            }

            var builder = new StringBuilder();

            builder.Append(msg);

            for (var i = 0; i < rf.FortuneValue; i++)
            {
                builder.Append("|");
            }

            msg = builder.ToString();

            MsgSender.PushMsg(MsgDTO, msg, true);
        }
コード例 #28
0
ファイル: AdvGameEngine.cs プロジェクト: Dolany/DolanyAI
        private void ProcessCave(ICave cave)
        {
            var msg = $"你遇到了 {cave.Description} !\r\n";

            Thread.Sleep(2000);

            switch (cave.Type)
            {
            case CaveType.宝箱:
                msg += ProcessTreasureCave(cave as TreasureCave);
                break;

            case CaveType.陷阱:
                msg += ProcessTrapCave(cave as TrapCave);
                break;

            case CaveType.怪兽:
                msg += ProcessMonsterCave(cave as MonsterCave);
                break;
            }

            MsgSender.PushMsg(GroupNum, CurPlayer.QQNum, msg, BindAi);
            cave.Visible = true;
        }
コード例 #29
0
        public bool Cook(MsgInformationEx MsgDTO, object[] param)
        {
            var dietName = param[0] as string;

            var Diet = CookingDietSvc[dietName];

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

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

            if (pet.Level < Diet.Level)
            {
                MsgSender.PushMsg(MsgDTO, $"{pet.Name}的等级太低,还不能烹饪该菜肴!({pet.Level}/{Diet.Level})");
                return(false);
            }

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

            if (cookingRec.LearndDietMenu.IsNullOrEmpty() || !cookingRec.LearndDietMenu.Contains(dietName))
            {
                MsgSender.PushMsg(MsgDTO, $"你尚未学会{dietName}的烹饪方法!(可使用【{Diet.ExchangeHonor}】兑换,详情请参见【帮助 兑换菜谱】)");
                return(false);
            }

            var falvoringNeedStr = string.Join(",", Diet.Flavorings.Select(f => $"{f.Key}({cookingRec.FlavoringDic.GetDicValueSafe(f.Key)}/{f.Value})"));

            if (!Diet.Flavorings.IsNullOrEmpty() && !cookingRec.CheckFlavorings(Diet.Flavorings))
            {
                MsgSender.PushMsg(MsgDTO, $"调味料不足!({falvoringNeedStr})");
                return(false);
            }

            var itemColle       = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var allitems        = itemColle.AllItemsDic;
            var materialNeedStr = string.Join(",", Diet.Materials.Select(m => $"{m.Key}({allitems.GetDicValueSafe(m.Key)}/{m.Value})"));

            if (!Diet.Materials.IsNullOrEmpty() && !itemColle.CheckItem(Diet.Materials))
            {
                MsgSender.PushMsg(MsgDTO, $"材料不足!({materialNeedStr})");
                return(false);
            }

            var msg = $"烹饪 {dietName} 将需要消耗\r\n{falvoringNeedStr}\r\n{materialNeedStr}\r\n是否确认?";

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

            cookingRec.FlavoringConsume(Diet.Flavorings);
            itemColle.ItemConsume(Diet.Materials);

            cookingRec.AddDiet(dietName);

            cookingRec.Update();
            itemColle.Update();

            MsgSender.PushMsg(MsgDTO, "烹饪成功!");
            return(true);
        }
コード例 #30
0
        private static void Repeat(MsgInformationEx MsgDTO)
        {
            Thread.Sleep(SleepTime);

            MsgSender.PushMsg(MsgDTO, MsgDTO.FullMsg);
        }