Exemple #1
0
        public async Task Mastery(string region, string summonerName, string championName)
        {
            RiotData   data       = new RiotData();
            RiotClient riotClient = new RiotClient(OptionManager.RiotKey);

            DataLibrary.Champion champion = null;
            Discord.EmbedBuilder builder  = null;
            var championList = data.Champions.Where(x => x.name.ToLower().Equals(championName.ToLower())).ToList();

            if (championList.Count < 1)
            {
                championList = new RiotData().Champions.Where(x => x.name.ToLower().Contains(championName.ToLower()))
                               .ToList();
            }
            champion = championList[0];
            if (champion != null)
            {
                var summoner        = riotClient.Summoner.GetSummonerByName(summonerName, PlatformHelper.StringToPlatform(region));
                var masteries       = riotClient.Masteries.GetchampionMasteries(PlatformHelper.StringToPlatform(region), summoner.SummonerId);
                var championMastery = masteries.FirstOrDefault(x => x.ChampionId == champion.ChampionId);
                builder = Builders.BaseBuilder($"{summoner.Name} mastery for {champion.name}", "", Color.DarkBlue, null, $"http://ddragon.leagueoflegends.com/cdn/6.24.1/img/champion/{champion.key}.png");
                builder.AddInlineField("Level", championMastery.Level);
                builder.AddInlineField("Points", championMastery.ChampionPoints);
            }
            else
            {
                builder = Builders.ErrorBuilder("Champion was not found");
            }

            await ReplyAsync("", embed : builder.Build());
        }
Exemple #2
0
        public async Task GetItem([Remainder] string name)
        {
            var message = await ReplyAsync("Getting data...");

            var database = new RiotData();
            //var item = database.Items.FirstOrDefault(x => x.name.ToLower().Equals(name.ToLower()));
            var     itemList = database.Items.Where(x => x.name.ToLower().Equals(name.ToLower())).Include(i => i.gold).ToList();
            ItemDto item     = null;

            Discord.EmbedBuilder builder = null;
            if (itemList.Count > 1)
            {
                var items = database.Items.Where(x => x.name.ToLower().Contains(name.ToLower())).ToList();
                builder = Builders.BaseBuilder("Multiple items found", "", Color.Red, null, "");
                string itemsstring = "";
                items.ForEach(x => itemsstring += x.name + "\n");
                builder.AddField("Items", itemsstring);
                await ReplyAsync("", embed : builder.Build());
            }
            else
            {
                var items = database.Items.Include(x => x.gold).Where(x => x.name.ToLower().Contains(name.ToLower())).ToList();
                if (items.Count == 1)
                {
                    item    = items[0];
                    builder = Builders.BaseBuilder("", "", Color.DarkBlue,
                                                   new EmbedAuthorBuilder().WithName(item.name),
                                                   $"http://ddragon.leagueoflegends.com/cdn/6.24.1/img/item/{item.ItemId}.png");
                    builder.AddField("Effect", item.plaintext);
                    builder.AddField("Tooltip",
                                     Regex.Replace(item.description.Replace("<br>", "\n"), "<.*?>", String.Empty));
                    builder.AddField("Cost", $"**Total: **{item.gold.total}\n" +
                                     $"**Base: **{item.gold.Base}");
                    if (!string.IsNullOrEmpty(item.requiredChampion))
                    {
                        builder.AddField("Required Champion", item.requiredChampion);
                    }
                    if (item.consumed)
                    {
                        builder.AddField("Consumable",
                                         $"This item is a consumable and a play can have {item.stacks} of this item at a time.");
                    }
                    await ReplyAsync("", embed : builder.Build());
                }
                else if (items.Count > 1)
                {
                    builder = Builders.BaseBuilder("Multiple items found", "", Color.Red, null, "");
                    string itemsstring = "";
                    items.ForEach(x => itemsstring += x.name + "\n");
                    builder.AddField("Items", itemsstring);
                    await ReplyAsync("", embed : builder.Build());
                }
                else
                {
                    builder = Builders.ErrorBuilder("Item not found");
                    await ReplyAsync("", embed : builder.Build());
                }
            }
            await message.DeleteAsync();
        }
Exemple #3
0
        public async Task GetTech([Remainder] string name)
        {
            var tech = MeleeHandler.RequestHandler.GetTechnique(name);

            if (tech == null)
            {
                await ReplyAsync("", embed : Builders.ErrorBuilder("Tech not found").Build());
            }
            else
            {
                var builder = Builders.BaseBuilder("", "", Color.Teal,
                                                   new EmbedAuthorBuilder().WithName(tech.TechName),
                                                   "");
                builder.AddField("Information",
                                 $"**Description: **{tech.Description}\n" +
                                 $"**Inputs: **{tech.Inputs}\n" +
                                 $"**SmashWiki Link: **{tech.SmashWikiLink}");
                if (tech.Gifs != null)
                {
                    builder.WithImageUrl($"https://zippy.gfycat.com/{tech.Gifs[0].Url}.gif");
                    foreach (var gif in tech.Gifs)
                    {
                        string source = "";
                        if (!string.IsNullOrEmpty(gif.Source))
                        {
                            source = $"**Source: **{gif.Source}";
                        }
                        builder.AddInlineField(gif.Description,
                                               $"**Link: **https://gfycat.com/{gif.Url} \n" + source
                                               );
                    }
                }
                await ReplyAsync("", embed : builder.Build());
            }
        }
Exemple #4
0
        public async Task GetCharacter([Remainder] string name)
        {
            var character = MeleeHandler.RequestHandler.GetCharacter(name);

            if (character == null)
            {
                await ReplyAsync("", embed : Builders.ErrorBuilder("Character not found"));
            }
            else
            {
                var builder = Builders.BaseBuilder("", "", Color.Teal,
                                                   new EmbedAuthorBuilder().WithName(character.name).WithIconUrl($"http://smashlounge.com/img/pixel/{character.name.Replace(" ", "")}HeadSSBM.png"), "");
                builder.AddField("Description", character.guide);
                builder.AddField("Stats", $"**Tier: **{character.tierdata}\n" +
                                 $"**Weight: **{character.weight}\n" +
                                 $"**Fallspeed: **{character.fallspeed}\n" +
                                 $"**Can Walljump: **{Convert.ToBoolean(Int32.Parse(character.walljump))}");
                if (character.gifs != null)
                {
                    foreach (var smashLoungeGif in character.gifs)
                    {
                        builder.AddInlineField(smashLoungeGif.Description,
                                               $"**Link: **https://gfycat.com/{smashLoungeGif.Url}\n" +
                                               $"**Source: **{smashLoungeGif.Source}\n");
                    }
                }
                await ReplyAsync("", embed : builder.Build());
            }
        }
Exemple #5
0
 public async Task Info([Remainder, Summary("Username of the user needing to be queries")] string username)
 {
     try
     {
         await ReplyAsync("", embed : SmashBuilder.UserInfo(username));
     }
     catch
     {
         await ReplyAsync("", embed : Builders.ErrorBuilder("User \"" + username + "\" was not found. \nPlease try to look it up on " + Names.SmashLadder));
     }
 }
Exemple #6
0
        public async Task GetCharacter([Remainder][Summary("The name of the chracter")] string name)
        {
            var character = RequestHandler.GetCharacterName(name);

            if (character == null)
            {
                await ReplyAsync("", embed : Builders.ErrorBuilder("Character not found"));
            }
            var moves = RequestHandler.GetMoves(name);

            Discord.EmbedBuilder builder = Builders.BaseBuilder("", "", Color.DarkTeal,
                                                                new EmbedAuthorBuilder().WithName("KuroganeHammer Result:").WithUrl("http://kuroganehammer.com"),
                                                                character.ThumbnailURL);
            //builder.WithImageUrl(character.MainImageURL);
            builder.WithUrl(character.FullURL);
            string info = "";

            info += "**Name: **" + character.Name;
            if (!string.IsNullOrEmpty(character.Description))
            {
                info += "**Description: **" + character.Description;
            }
            if (!string.IsNullOrEmpty(character.Style))
            {
                info += "**Style: **" + character.Style;
            }
            builder.AddField(new EmbedFieldBuilder().WithName("Information").WithValue(info));
            var movement = RequestHandler.GetMovement(name);
            var half     = movement.Attributes.Count / 2;
            var info1    = "";
            var info2    = "";

            for (int i = 0; i < movement.Attributes.Count / 2; i++)
            {
                info1 += $"**{movement.Attributes[i].Name}**: {movement.Attributes[i].Value}\n";
                info2 += $"**{movement.Attributes[i + half].Name}**: {movement.Attributes[i + half].Value}\n";
            }
            builder.AddInlineField("Movement", info1);
            builder.AddInlineField("Movement", info2);
            string movesinfo    = "";
            string specials     = "";
            int    specialcount = 0;
            string aerials      = "";
            string smashes      = "";
            string grabs        = "";
            string tilts        = "";

            moves.ForEach(x =>
            {
                if (x.MoveType == "ground")
                {
                    if (x.Name.Contains("smash"))
                    {
                        smashes += x.Name + "\n";
                    }
                    else if (x.Name.Contains("tilt"))
                    {
                        tilts += x.Name + "\n";
                    }
                    else if (x.Name.ToLower().Contains("grab"))
                    {
                        grabs += x.Name + "\n";
                    }
                    else
                    {
                        movesinfo += x.Name + "\n";
                    }
                }

                if (x.MoveType == "special")
                {
                    specials += x.Name + "\n";
                    specialcount++;
                }
                if (x.MoveType == "aerial")
                {
                    aerials += x.Name + "\n";
                }
            });
            builder.AddInlineField("Ground Moves", movesinfo);
            builder.AddInlineField("Smashes", smashes);
            builder.AddInlineField("Specials", specials);
            builder.AddInlineField("Aerials", aerials);
            builder.AddInlineField("Tilts", tilts);
            builder.AddInlineField("Grabs", tilts);
            await ReplyAsync("", embed : builder.Build());
        }
Exemple #7
0
        public async Task GetMove(string charactername, [Remainder] string moveName)
        {
            Discord.EmbedBuilder builder = null;
            var character = RequestHandler.GetCharacterName(charactername);

            if (character == null)
            {
                await ReplyAsync("", embed : Builders.ErrorBuilder("Character not found"));
            }
            var  moves = RequestHandler.GetMoves(charactername);
            Move move  = null;

            move = moves.FirstOrDefault(x => x.Name.ToLower().Equals(moveName.ToLower()));
            if (move == null)
            {
                move = moves.FirstOrDefault(x => x.Name.ToLower().Contains(moveName.ToLower()));
            }
            if (move != null)
            {
                builder = Builders.BaseBuilder("", "", Color.DarkBlue,
                                               new EmbedAuthorBuilder().WithName(character.Name + " | " + move.Name)
                                               .WithUrl("http://kuroganehammer.com/smash4/" + move.Owner), character.ThumbnailURL);
                string statistics = "";
                //builder.WithImageUrl("https://zippy.gfycat.com/EuphoricCookedHornshark.webm"); //TODO Add later when gifs are supported but holy shit it works.
                if (!string.IsNullOrEmpty(move.MoveType))
                {
                    statistics += "**Move Type:** " + move.MoveType + "\n";
                }
                if (!string.IsNullOrEmpty(move.BaseDamage))
                {
                    statistics += "**Base Damage:** " + move.BaseDamage + "%\n";
                }
                if (!string.IsNullOrEmpty(move.BaseKockbackSetKnockback))
                {
                    statistics += "**Base/Set Knockback: **" + move.BaseKockbackSetKnockback + "\n";
                }
                if (!string.IsNullOrEmpty(move.LandingLag))
                {
                    statistics += "**Landinglag: **" + move.LandingLag + " frames\n";
                }
                if (!string.IsNullOrEmpty(move.HitboxActive))
                {
                    statistics += "**Hitbox Active: **Frames " + move.HitboxActive + "\n";
                }
                if (!string.IsNullOrEmpty(move.KnockbackGrowth))
                {
                    statistics += "**Knockback Growth: **" + move.HitboxActive + "\n";
                }
                if (!string.IsNullOrEmpty(move.Angle))
                {
                    statistics += "**Angle: **" + move.Angle.Replace("361", "Sakuari Angle/361") + "\n";
                }
                if (!string.IsNullOrEmpty(move.AutoCancel))
                {
                    statistics += "**Auto-Cancel: **Frame " + move.AutoCancel.Replace("&gt;", ">") + "\n";
                }
                if (!string.IsNullOrEmpty(move.FirstActionableFrame))
                {
                    statistics += "**First Actionable Frame: **" + move.FirstActionableFrame + "\n";
                }
                builder.AddInlineField("Statistics",
                                       statistics);
                if (move.Angle.Equals("361"))
                {
                    builder.AddInlineField("Sakurai Angle",
                                           "\"The Sakurai angle (sometimes displayed as * in moveset lists) is a special knockback behavior that many attacks use. While it reads in the game data as an angle of 361 degrees, the actual resulting angle is dependent on whether the victim is on the ground or in the air, as well as the strength of the knockback.\"\nSource: https://www.ssbwiki.com/Sakurai_angle");
                }

                builder.AddField("Info",
                                 "If you don't understand the values please visit http://kuroganehammer.com/Glossary");
                await ReplyAsync("", embed : builder.Build());
            }
            else
            {
                await ReplyAsync("", embed : Builders.ErrorBuilder("Move was not found"));
            }
        }