示例#1
0
        public async Task <string> SendCetusMissions(int index)
        {
            var missions = await api.GetSyndicateMissions();

            var sb = new StringBuilder();

            sb.AppendLine(WFFormatter.ToString(missions.First(mission => mission.syndicate == "Ostrons"), index));
            sb.AppendLine();
            sb.Append("您正在查看 希图斯 的全部赏金任务, 使用: /金星赏金 来查询 福尔图娜 的赏金任务.");
            return(sb.ToString().AddPlatformInfo().AddRemainCallCount());
        }
        public async Task CheckWarframeUpdates()
        {
            var updates = await GetWarframeUpdates();

            if (!sendedUpdateSet.Contains(updates.First()))
            {
                var msg = WFFormatter.ToString(updates.First());
                Messenger.Broadcast(msg);
                sendedUpdateSet.Add(updates.First());
            }
        }
示例#3
0
        public async Task <string> SendFortunaMissions(int index)
        {
            var missions = await api.GetSyndicateMissions();

            var sb = new StringBuilder();

            sb.AppendLine(WFFormatter.ToString(missions.First(mission => mission.syndicate == "Solaris United"), index));
            sb.AppendLine();
            sb.Append($"您正在查看 福尔图娜 的全部赏金任务, 使用: /地球赏金 来查询希图斯的赏金任务.");
            return(sb.ToString().AddPlatformInfo().AddRemainCallCount());
        }
示例#4
0
        // private List<Fissure> _fissures = api.GetFissures();

        public void SendCycles(GroupID group)
        {
            var cetuscycle   = api.GetCetusCycle();
            var valliscycle  = api.GetVallisCycle();
            var earthcycle   = api.GetEarthCycle();
            var cambioncycle = api.GetCambionCycle();
            var msg          = $"{WFFormatter.ToString(cetuscycle.Result)}\r\n" +
                               $"{WFFormatter.ToString(valliscycle.Result)}\r\n" +
                               $"{WFFormatter.ToString(earthcycle.Result)}\r\n" +
                               $"{WFFormatter.ToString(cambioncycle.Result)}";

            Messenger.SendGroup(group, msg.AddPlatformInfo().AddRemainCallCount(group));
        }
示例#5
0
        // private List<Fissure> _fissures = api.GetFissures();

        public async Task <string> Cycles()
        {
            var cetuscycle   = api.GetCetusCycle();
            var valliscycle  = api.GetVallisCycle();
            var earthcycle   = api.GetEarthCycle();
            var cambioncycle = api.GetCambionCycle();
            var msg          = $"{WFFormatter.ToString(await cetuscycle)}\n" +
                               $"{WFFormatter.ToString(await valliscycle)}\n" +
                               $"{WFFormatter.ToString(await earthcycle)}\n" +
                               $"{WFFormatter.ToString(await cambioncycle)}";

            return(msg.AddPlatformInfo().AddRemainCallCount());
        }
示例#6
0
        public void SendEvent(GroupID group)
        {
            var events = api.GetEvents().Result;

            if (events.Any())
            {
                var msg = WFFormatter.ToString(events);
                Messenger.SendGroup(group, msg.AddPlatformInfo().AddRemainCallCount(group));
            }
            else
            {
                Messenger.SendGroup(group, "目前游戏内没有任何活动 (尸鬼, 豺狼, 舰队).".AddPlatformInfo().AddRemainCallCount(group));
            }
        }
示例#7
0
        public void SendKuvaMissions(GroupID group)
        {
            var sb    = new StringBuilder();
            var kuvas = api.GetKuvaMissions().Result;

            sb.AppendLine("以下是所有赤毒任务: \n\n");
            // foreach (var kuva in kuvas.Where(k => k.missiontype.Contains("KuvaMission") && k.start < DateTime.Now && DateTime.Now < k.end))
            foreach (var kuva in kuvas)
            {
                sb.AppendLine(WFFormatter.ToString(kuva));
                sb.AppendLine();
            }
            Messenger.SendGroup(group, sb.ToString().Trim());
        }
示例#8
0
        public async Task <string> SendKuvaMissions()
        {
            var sb    = new StringBuilder();
            var kuvas = await api.GetKuvaMissions();

            sb.AppendLine("以下是所有赤毒任务: \n\n");
            // foreach (var kuva in kuvas.Where(k => k.missiontype.Contains("KuvaMission") && k.start < DateTime.Now && DateTime.Now < k.end))
            foreach (var kuva in kuvas)
            {
                sb.AppendLine(WFFormatter.ToString(kuva));
                sb.AppendLine();
            }
            return(sb.ToString().Trim());
        }
示例#9
0
        public async Task <string> SendEvent()
        {
            var events = await api.GetEvents();

            if (events.Any())
            {
                var msg = WFFormatter.ToString(events);
                return(msg.AddPlatformInfo().AddRemainCallCount());
            }
            else
            {
                return("目前游戏内没有任何活动 (尸鬼, 豺狼, 舰队).".AddPlatformInfo().AddRemainCallCount());
            }
        }
示例#10
0
        public string SendRelicInfo(string word)
        {
            var relic = api.GetRelics(word);

            if (relic.IsEmpty())
            {
                return("没有找到符合条件的遗物.");
            }
            else
            {
                var msg = WFFormatter.ToString(relic);
                return(msg);
            }
        }
示例#11
0
        public void SendAllAlerts(GroupID group)
        {
            UpdateAlertPool();
            var alerts = AlertPool;
            var sb     = new StringBuilder();

            sb.AppendLine("指挥官, 下面是太阳系内所有的警报任务, 供您挑选.");
            foreach (var alert in alerts)
            {
                sb.AppendLine(WFFormatter.ToString(alert));
                sb.AppendLine();
            }

            Messenger.SendGroup(group, sb.ToString().Trim().AddPlatformInfo());
        }
示例#12
0
        public void SendAllInvasions(GroupID group)
        {
            UpdateInvasionPool();
            var invasions = InvasionPool;
            var sb        = new StringBuilder();

            sb.AppendLine("指挥官, 下面是太阳系内所有的入侵任务.");
            sb.AppendLine();

            foreach (var invasion in invasions.Where(invasion => !invasion.completed))
            {
                sb.AppendLine(WFFormatter.ToString(invasion));
                sb.AppendLine();
            }

            Messenger.SendGroup(group, sb.ToString().Trim().AddPlatformInfo());
        }
示例#13
0
        public async Task <string> SendRivenInfos(string weapon)
        {
            var sb = new StringBuilder();

            try
            {
                if (isWFA)
                {
                    var weaponinfo = translator.GetMatchedWeapon(weapon.Format());
                    if (weaponinfo.Any())
                    {
                        if (Config.Instance.NotifyBeforeResult)
                        {
                            AsyncContext.SendGroupMessage("好嘞, 等着, 着啥急啊, 这不帮你查呢.");
                        }
                        var orders = await GetRivenOrders(weaponinfo.First().name);

                        var data = (await GetRivenDatas()).Where(d => d.compatibility.Format() == weapon).ToList();
                        var msg  = orders.Any() ? WFFormatter.ToString(orders.Take(Config.Instance.WFASearchCount).ToList(), data, weaponinfo.First()) : $"抱歉, 目前紫卡市场没有任何出售: {weapon} 紫卡的用户.".AddRemainCallCount();
                        sb.AppendLine(msg.AddPlatformInfo());
                    }
                    else
                    {
                        sb.AppendLine($"武器 {weapon} 不存在.");
                        var similarlist = translator.GetSimilarItem(weapon, "rm");
                        if (similarlist.Any())
                        {
                            sb.AppendLine("请问这下面有没有你要找的武器呢?(可尝试复制下面的名称来进行搜索)");
                            foreach (var item in similarlist)
                            {
                                sb.AppendLine($"    {item}");
                            }
                        }
                    }
                }
                else
                {
                    sb.AppendLine("本机器人没有 WFA 授权, 本功能无法使用, 请联系机器人管理员.");
                }
            }
            catch (WebException)
            {
                sb.AppendLine("经过我们的多次尝试, 依然无法访问紫卡市场. 如果你不能谅解, 有本事顺着网线来打我呀.");
            }
            return(sb.ToString().Trim());
        }
示例#14
0
        public string SendAllPersistentEnemies()
        {
            var enemies = StalkerPool;

            if (!enemies.Any())
            {
                return("目前没有小小黑出现.");
            }

            var sb = new StringBuilder();

            sb.AppendLine("下面是全太阳系内的小小黑, 快去锤爆?");
            foreach (var enemy in enemies)
            {
                sb.AppendLine(WFFormatter.ToString(enemy));
            }
            return(sb.ToString().Trim());
        }
示例#15
0
        public void SendAllPersistentEnemies(GroupID group)
        {
            var enemies = StalkerPool;

            if (!enemies.Any())
            {
                Messenger.SendGroup(group, "目前没有小小黑出现.");
                return;
            }

            var sb = new StringBuilder();

            sb.AppendLine("下面是全太阳系内的小小黑, 快去锤爆?");
            foreach (var enemy in enemies)
            {
                sb.AppendLine(WFFormatter.ToString(enemy));
            }
            Messenger.SendGroup(group, sb.ToString().Trim());
        }
示例#16
0
        private void CheckPersistentEnemies()
        {
            var enemies = StalkerPool;

            if (!enemies.Any(enemy => enemy.isDiscovered && !sendedStalkerSet.Contains(enemy.lastDiscoveredTime)))
            {
                return;
            }

            var sb = new StringBuilder();

            sb.AppendLine("我看到有小小黑冒头了? 干!");

            foreach (var enemy in enemies.Where(enemy => enemy.isDiscovered && !sendedStalkerSet.Contains(enemy.lastDiscoveredTime)))
            {
                sb.AppendLine(WFFormatter.ToString(enemy));
                sendedStalkerSet.Add(enemy.lastDiscoveredTime);
            }

            Messenger.Broadcast(sb.ToString().Trim());
        }
示例#17
0
        public async Task <string> SendAllAlerts()
        {
            try
            {
                await UpdateAlertPool();
            }
            catch (OperationCanceledException)
            {
                return("操作超时.");
            }
            var alerts = AlertPool;
            var sb     = new StringBuilder();

            sb.AppendLine("指挥官, 下面是太阳系内所有的警报任务, 供您挑选.");
            foreach (var alert in alerts)
            {
                sb.AppendLine(WFFormatter.ToString(alert));
                sb.AppendLine();
            }

            return(sb.ToString().Trim().AddPlatformInfo());
        }
示例#18
0
        public async Task <string> SendAllInvasions()
        {
            try
            {
                await UpdateInvasionPool();
            }
            catch (OperationCanceledException)
            {
                return("操作超时.");
            }
            var invasions = InvasionPool;
            var sb        = new StringBuilder();

            sb.AppendLine("指挥官, 下面是太阳系内所有的入侵任务.");
            sb.AppendLine();

            foreach (var invasion in invasions.Where(invasion => !invasion.completed))
            {
                sb.AppendLine(WFFormatter.ToString(invasion));
                sb.AppendLine();
            }

            return(sb.ToString().Trim().AddPlatformInfo());
        }
示例#19
0
        public void SendWMInfo(string item, GroupID group, bool quickReply, bool isbuyer)
        {
            // 下面 你将要 看到的 是 本项目 最大的  粪山
            // Actually 这粪山挺好用的
            var words = new List <string> {
                "prime", "p", "甲"
            };
            var heads = new List <string> {
                "头部神经光", "头部神经", "头部神", "头部", "头"
            };

            foreach (var word in words)
            {
                foreach (var head in heads)
                {
                    if (!item.Contains("头部神经光元"))
                    {
                        if (item.Contains(word + head))
                        {
                            item = item.Replace(word + head, word + "头部神经光元");
                            break;
                        }
                    }
                }
            }
            var searchword   = translator.TranslateSearchWord(item);
            var formateditem = item;

            if (item == searchword)
            {
                searchword   = translator.TranslateSearchWord(item + "一套");
                formateditem = item + "一套";
                if (formateditem == searchword)
                {
                    searchword   = translator.TranslateSearchWord(item.Replace("p", "prime").Replace("总图", "蓝图"));
                    formateditem = item.Replace("p", "prime").Replace("总图", "蓝图");
                    if (formateditem == searchword)
                    {
                        searchword   = translator.TranslateSearchWord(item.Replace("p", "prime") + "一套");
                        formateditem = item.Replace("p", "prime") + "一套";
                        if (formateditem == searchword)
                        {
                            var sb          = new StringBuilder();
                            var similarlist = translator.GetSimilarItem(item.Format(), "wm");
                            sb.AppendLine($"物品 {item} 不存在或格式错误.");
                            if (similarlist.Any())
                            {
                                sb.AppendLine($"请问这下面有没有你要找的物品呢?(可尝试复制下面的名称来进行搜索)");
                                foreach (var similarresult in similarlist)
                                {
                                    sb.AppendLine($"    {similarresult}");
                                }
                            }


                            sb.AppendLine("注: 这个命令是用来查询 WarframeMarket 上面的物品的, 不是其他什么东西.");
                            Messenger.SendGroup(group, sb.ToString().Trim().AddRemainCallCount(group));
                            return;
                        }
                    }
                }
            }

            var msg = string.Empty;

            if (Config.Instance.NotifyBeforeResult)
            {
                Messenger.SendGroup(group, "好嘞, 等着, 着啥急啊, 这不帮你查呢.");
            }

            var failed = false;

            if (Config.Instance.IsThirdPartyWM)
            {
                try
                {
                    if (isWFA)
                    {
                        var infoEx = GetWMINfoEx(searchword);
                        if (infoEx.orders.Items.Any())
                        {
                            OrderWMInfoEx(infoEx, isbuyer);
                            translator.TranslateWMOrderEx(infoEx, searchword);
                            msg = WFFormatter.ToString(infoEx, quickReply, isbuyer);
                        }
                        else
                        {
                            msg = $"抱歉, WarframeMarket 上目前还没有售卖 {item} 的用户";
                        }
                    }
                    else
                    {
                        msg = "很抱歉, 本机器人没有 WFA 授权, 无法使用第三方 WM, 这很可能是由于错误设置导致的. 请联系机器人负责人.";
                    }
                }
                catch (Exception)
                {
                    Messenger.SendGroup(group, "很抱歉, 在使用第三方 API 时遇到了网络问题. 正在为您转官方 API.");
                    failed = true;
                }
            }

            if (!Config.Instance.IsThirdPartyWM || failed)
            {
                var info = GetWMInfo(searchword);
                if (info.payload.orders.Any())
                {
                    OrderWMInfo(info, isbuyer);
                    translator.TranslateWMOrder(info, searchword);
                    msg = WFFormatter.ToString(info, quickReply, isbuyer);
                }
                else
                {
                    msg = $"抱歉, WarframeMarket 上目前还没有售卖 {item} 的用户";
                }
            }

            if (!quickReply)
            {
                msg = $"{msg}\n\n快捷回复请使用指令 <查询 {item} -QR>";
            }

            if (!isbuyer)
            {
                msg = $"{msg}\n\n查询买家请使用指令 <查询 {item} -B>";
            }

            Messenger.SendGroup(group, msg.AddPlatformInfo().AddRemainCallCount(group));
        }