Пример #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();
            }
        }