예제 #1
0
        private async Task <EmbedFieldBuilder> GetDropMapField(string[] shipNameArr, ulong guildId)
        {
            string embedMsg = null;
            var    result   = await Features.GamesInfo.Kancolle.SearchDropMap(shipNameArr);

            switch (result.error)
            {
            case Features.GamesInfo.Error.Drop.Help:
                throw new ArgumentException(Sentences.KancolleHelp(Context.Guild));

            case Features.GamesInfo.Error.Drop.NotFound:
                throw new ArgumentException(Sentences.ShipgirlDontExist(Context.Guild));

            case Features.GamesInfo.Error.Drop.NotReferenced:
                embedMsg = Sentences.ShipNotReferencedMap(Context.Guild);
                break;

            case Features.GamesInfo.Error.Drop.DontDrop:
                embedMsg = Sentences.DontDropOnMaps(Context.Guild);
                break;

            case Features.GamesInfo.Error.Drop.None:
                foreach (var k in result.answer.dropMap)
                {
                    embedMsg += "**" + k.Key + ":** ";
                    switch (k.Value)
                    {
                    case Features.GamesInfo.Response.DropMapLocation.NormalOnly:
                        embedMsg += Sentences.OnlyNormalNodes(Context.Guild);
                        break;

                    case Features.GamesInfo.Response.DropMapLocation.BossOnly:
                        embedMsg += Sentences.OnlyBossNode(Context.Guild);
                        break;

                    case Features.GamesInfo.Response.DropMapLocation.Anywhere:
                        embedMsg += Sentences.AnyNode(Context.Guild);
                        break;
                    }
                    embedMsg += Environment.NewLine;
                }
                break;

            default:
                throw new NotImplementedException();
            }
            return(new EmbedFieldBuilder()
            {
                Name = Sentences.MapDrop(Context.Guild) + ((result.answer != null && result.answer.rarity != null) ? (Sentences.Rarity(Context.Guild) + ": " + result.answer.rarity.ToString() + " / 7") : ("")),
                Value = embedMsg
            });
        }
예제 #2
0
        private async Task <EmbedFieldBuilder> GetDropConstructionField(string[] shipNameArr)
        {
            string embedMsg = null;
            var    result   = await Features.GamesInfo.Kancolle.SearchDropConstruction(shipNameArr);

            switch (result.error)
            {
            case Features.GamesInfo.Error.Drop.Help:
                throw new ArgumentException(Sentences.KancolleHelp(Context.Guild));

            case Features.GamesInfo.Error.Drop.NotFound:
                throw new ArgumentException(Sentences.ShipgirlDontExist(Context.Guild));

            case Features.GamesInfo.Error.Drop.NotReferenced:
                embedMsg = Sentences.ShipNotReferencedConstruction(Context.Guild);
                break;

            case Features.GamesInfo.Error.Drop.DontDrop:
                embedMsg = Sentences.DontDropOnMaps(Context.Guild);
                break;

            case Features.GamesInfo.Error.Drop.None:
                int i = 1;
                foreach (var elem in result.answer.elems)
                {
                    embedMsg += "**" + elem.chance + "%:** "
                                + Sentences.Fuel(Context.Guild) + " " + elem.fuel + ", "
                                + Sentences.Ammos(Context.Guild) + " " + elem.ammos + ", "
                                + Sentences.Iron(Context.Guild) + " " + elem.iron + ", "
                                + Sentences.Bauxite(Context.Guild) + " " + elem.bauxite + ", "
                                + Sentences.DevMat(Context.Guild) + " " + elem.devMat
                                + Environment.NewLine;
                    i++;
                }
                break;

            default:
                throw new NotImplementedException();
            }
            return(new EmbedFieldBuilder()
            {
                Name = Sentences.ConstructionDrop(Context.Guild),
                Value = embedMsg
            });
        }
예제 #3
0
        public async Task Charac(params string[] shipNameArr)
        {
            Utilities.CheckAvailability(Context.Guild, Program.Module.Kancolle);
            await p.DoAction(Context.User, Program.Module.Kancolle);

            var result = await Features.GamesInfo.Kancolle.SearchCharac(shipNameArr);

            switch (result.error)
            {
            case Features.GamesInfo.Error.Charac.Help:
                await ReplyAsync(Sentences.KancolleHelp(Context.Guild));

                break;

            case Features.GamesInfo.Error.Charac.NotFound:
                await ReplyAsync(Sentences.ShipgirlDontExist(Context.Guild));

                break;

            case Features.GamesInfo.Error.Charac.None:
                EmbedBuilder embed = new EmbedBuilder()
                {
                    Color    = Color.Blue,
                    Title    = result.answer.name,
                    ImageUrl = result.answer.thumbnailUrl
                };
                foreach (Tuple <string, string> s in result.answer.allCategories)
                {
                    embed.AddField(s.Item1, s.Item2);
                }
                await ReplyAsync("", false, embed.Build());

                break;

            default:
                throw new NotImplementedException();
            }
        }
예제 #4
0
        public async Task Charac(params string[] name)
        {
            Utilities.CheckAvailability(Context.Guild, Program.Module.Arknights);
            await Program.p.DoAction(Context.User, Program.Module.Arknights);

            var result = await Features.GamesInfo.Arknights.SearchCharac(name);

            switch (result.error)
            {
            case Features.GamesInfo.Error.Charac.Help:
                await ReplyAsync(Sentences.ArknightsHelp(Context.Guild));

                break;

            case Features.GamesInfo.Error.Charac.NotFound:
                await ReplyAsync(Sentences.OperatorDontExist(Context.Guild));

                break;

            case Features.GamesInfo.Error.Charac.InvalidLevel:
                await ReplyAsync("The level given must be between 1 and the maximum skill level.");

                break;

            case Features.GamesInfo.Error.Charac.None:
                List <EmbedFieldBuilder> fields = new List <EmbedFieldBuilder>
                {
                    new EmbedFieldBuilder
                    {
                        Name     = "Position",
                        Value    = result.answer.type,
                        IsInline = true
                    },
                    new EmbedFieldBuilder
                    {
                        Name     = "HR Tags",
                        Value    = string.Join(", ", result.answer.tags),
                        IsInline = true
                    },
                    new EmbedFieldBuilder
                    {
                        Name     = "Rarity",
                        Value    = result.answer.rarity,
                        IsInline = true
                    }
                };
                foreach (var skill in result.answer.skills)
                {
                    fields.Add(new EmbedFieldBuilder
                    {
                        Name  = skill.name,
                        Value = skill.description
                    });
                }
                EmbedFooterBuilder footer = null;
                if (result.answer.skills.Length > 0)
                {
                    footer = new EmbedFooterBuilder
                    {
                        Text = "Skills displayed are at " + (result.answer.skillLevel < 8 ? "level " + result.answer.skillLevel : "mastery " + (result.answer.skillLevel - 7))
                    };
                }
                var msg = await ReplyAsync("", false, new EmbedBuilder
                {
                    Title       = result.answer.name,
                    Url         = result.answer.wikiUrl,
                    Description = result.answer.description,
                    ImageUrl    = result.answer.imgUrl,
                    Color       = Color.Blue,
                    Fields      = fields,
                    Footer      = footer
                }.Build());

                if (result.answer.skills.Length > 0)
                {
                    await msg.AddReactionsAsync(new[] { new Emoji("⏪"), new Emoji("◀️"), new Emoji("▶️"), new Emoji("⏩") });

                    Program.p.ARKNIGHTS_SKILLS_INFO.Add(msg.Id, (result.answer.skillLevel - 1, result.answer.skillKeys));
                }
                break;

            default:
                throw new NotImplementedException();
            }
        }