Exemple #1
0
        public virtual async Task TM_SectorWorlds(string sector = null)
        {
            EmbedBuilder msg = null;

            if (string.IsNullOrEmpty(sector) || sector == "?")
            {
                await SendHelpMessage($"Usage: {BotConfiguration.thisBotConfig.CommandIndicator}sector-worlds spin", "This command will return a sectors worlds information", $"{BotConfiguration.thisBotConfig.CommandIndicator}sector-worlds <sector>");

                return;
            }

            string txt = $"Here is the world data for the {sector} sector:-";


            try
            {
                string data = GetResponse(mapService.TravellerMapAPI[Enums.TravellerAPIMapEnums.Sector].Replace("/sector", $"/{sector}"));

                SectorSurvey sectorSurvey = new SectorSurvey(data);

                msg = GetMsg(defaultColor, $"{sectorSurvey.Title} Worlds", txt);
                msg.AddField("Coords", sectorSurvey.Coords, true);


                int cnt  = 0;
                int tcnt = 0;
                foreach (WorldSurvey world in sectorSurvey.Worlds)
                {
                    msg.AddField($"{world.Name}", $"{world.Hex} - {world.UWP} - {world.Z}\n", true);
                    cnt++;
                    tcnt++;

                    if (cnt == 20)
                    {
                        cnt = 0;
                        await SendMessageAsync(msg, null, $"{tcnt}/{sectorSurvey.Worlds.Count} continued...");

                        msg = GetMsg(defaultColor, $"{sectorSurvey.Title} Worlds...", null, null, "...continued");
                    }
                }
            }
            catch (Exception ex)
            {
                msg = GetErrorMsg($"Error:\n{ex.Message}", Context.User);
            }


            await SendMessageAsync(msg);
        }
Exemple #2
0
        public virtual async Task TM_Sector(string sector = null)
        {
            EmbedBuilder msg = null;

            if (string.IsNullOrEmpty(sector) || sector == "?")
            {
                await SendHelpMessage($"Usage: {BotConfiguration.thisBotConfig.CommandIndicator}sector spin", "This command will return a sectors information", $"{BotConfiguration.thisBotConfig.CommandIndicator}sector <sector>");

                return;
            }

            string txt = $"Here is the data for the {sector} sector:-";


            if (mapService != null)
            {
                try
                {
                    string data = GetResponse(mapService.TravellerMapAPI[Enums.TravellerAPIMapEnums.Sector].Replace("/sector", $"/{sector}"));

                    SectorSurvey sectorSurvey = new SectorSurvey(data);

                    msg = GetMsg(defaultColor, $"{sectorSurvey.Title} Survey", txt);
                    msg.AddField("Coords", sectorSurvey.Coords, true);
                    msg.AddField("Names", sectorSurvey.GetNames());
                    msg.AddField("Subsectors", sectorSurvey.GetSubSectors());
                    msg.AddField("Allegancies", sectorSurvey.GetAlegancies());
                    msg.AddField("Worlds", sectorSurvey.Worlds.Count, true);
                }
                catch (Exception ex)
                {
                    msg = GetErrorMsg($"Error:\n{ex.Message}", Context.User);
                }
            }
            else
            {
                msg = GetErrorMsg("Service does not use Traveller API", Context.User);
            }

            await SendMessageAsync(msg);
        }