Beispiel #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());
        }
Beispiel #2
0
        public async Task Champion([Remainder] string name)
        {
            var database  = new RiotData();
            var champions = database.Champions.Where(x => x.name.ToLower().Equals(name.ToLower())).Include(c => c.spells).Include(c => c.skins).Include(c => c.info).Include(c => c.passive).ToList();

            DataLibrary.Champion champ = null;
            champ = champions.FirstOrDefault(x => x.name.ToLower().Equals(name.ToLower()));
            if (champ == null)
            {
                champ = champions.First();
            }
            var builder = Builders.BaseBuilder(champ.name, champ.title, Color.DarkBlue, null, $"http://ddragon.leagueoflegends.com/cdn/6.24.1/img/champion/{champ.key}.png");
            var keys    = new List <string>()
            {
                "Q", "W", "E", "R"
            };
            string abilities = "";

            builder.AddField("Abilities", $"{champ.name} has the following spells:");
            for (int i = 0; i < 4; i++)
            {
                //abilities += $"**{keys[i]} {champ.spells[i].name}:**  {champ.spells[i].sanitizedDescription}\n";
                builder.AddField(keys[i] + " " + champ.spells[i].name + ":", $"{champ.spells[i].sanitizedDescription}");
            }
            builder.AddField("Passive", $"**{champ.passive.name}: **{champ.passive.description}");
            //builder.AddField("Abilities", abilities);
            string skins = "";

            champ.skins.ForEach(x => skins += x.name + "\n");
            builder.AddField("Skins", skins);
            await ReplyAsync("", embed : builder.Build());
        }
Beispiel #3
0
        public async Task Skill([Summary("Champion name")] string champion, [Summary("Ability used")] string ability)
        {
            var database = new RiotData();
            List <DataLibrary.Champion> champions = database.Champions.Include(c => c.spells).ThenInclude(s => s.vars).ThenInclude(s => s.Coeff).ToList();

            DataLibrary.Champion champ = null;
            champ = champions.FirstOrDefault(x => x.name.ToLower().Equals(champion.ToLower()));
            if (champ == null)
            {
                champ = champions.FirstOrDefault(x => x.name.ToLower().Contains(champion.ToLower()));
            }
            var keys = new List <string>()
            {
                "Q", "W", "E", "R"
            };
            int index   = keys.IndexOf(ability.ToUpper());
            var spell   = champ.spells[index];
            var builder = Builders.BaseBuilder(spell.name, "", Color.DarkBlue,
                                               new EmbedAuthorBuilder().WithName(champ.name + " " + ability), $"http://ddragon.leagueoflegends.com/cdn/6.24.1/img/spell/{spell.key}.png ");

            builder.AddField("Description", spell.sanitizedDescription);
            string tooltip = spell.sanitizedTooltip;

            foreach (var spellVar in spell.vars)
            {
                tooltip = tooltip.Replace("{{ " + spellVar.key + " }}", spellVar.Coeff[0].value.ToString());
            }
            var spellburn = spell.EffectBurn.Split(',').ToList();

            for (int i = 1; i < spellburn.Count; i++)
            {
                tooltip = tooltip.Replace("{{ e" + i + " }}", spellburn[i]);
            }

            builder.AddField("Tooltip", tooltip);
            builder.AddField("Stats", $"**Resource: **{spell.costType}\n" +
                             $"**Costs: **{spell.resource.Replace("{{ cost }}", "40")}\n" +
                             $"**Cooldown: **{spell.cooldownBurn}");

            await ReplyAsync("", embed : builder.Build());
        }