Exemplo n.º 1
0
        public static Discord.EmbedBuilder GetChampionInfo(ChampionData champion)
        {
            var builder = Builders.BaseBuilder("", "", Color.Magenta,
                                               new EmbedAuthorBuilder().WithName("Champion.gg information").WithUrl("http://champion.gg"), "");

            builder.AddInlineField("Champion Information",
                                   $"**Champion: **{Temp.GetChampionName(champion.ChampionId)}\n" +
                                   $"**Role: **{champion.Role}\n" +
                                   $"**Patch: **{champion.Patch}");
            builder.AddInlineField("Overall Statistics:",
                                   $"**WinRate: **{Math.Round(champion.WinRate*100, 2)}%\n" +
                                   $"**PlayRate: **{Math.Round(champion.PlayRate*100, 2)}%\n" +
                                   $"**Role Played Percentage: **{Math.Round(champion.PercentageRolePlayed*100, 2)}%\n" +
                                   $"**Total Games Played: **{champion.TotalGamesPlayed}");
            builder.AddInlineField("Position Placings:",
                                   $"**Kills: ** {champion.PositionData.Kills}th\n" +
                                   $"**Deaths: **{champion.PositionData.Deaths}th\n" +
                                   $"**Assists: **{champion.PositionData.Assists}th\n" +
                                   $"**Gold Earned: **{champion.PositionData.GoldEarned}th\n" +
                                   $"**WinRate: **{champion.PositionData.WinRates}th\n" +
                                   $"**BanRate: **{champion.PositionData.BanRates}th\n" +
                                   $"**PickRate: **{champion.PositionData.PlayRates}th");
            builder.AddInlineField("Average Statistics:",
                                   $"**Kills: **{Math.Round(champion.AverageKills, 3)}\n" +
                                   $"**Deaths: **{Math.Round(champion.AverageDeaths, 3)}\n" +
                                   $"**Assists: **{Math.Round(champion.AverageAssists, 3)}\n" +
                                   $"**Minions killed:** {Math.Round(champion.MinionsKilled, 3)}\n" +
                                   $"**Allied Jungle Monsters Killed: **{Math.Round(champion.MonstersKilledTeamJungle, 3)}\n" +
                                   $"**Enemy Jungle Monsters Killed: **{Math.Round(champion.MonstersKilledEnemyJungle, 3)}\n" +
                                   $"**Damage Healed: **{Math.Round(champion.Healed, 3)}\n");
            return(builder);
        }
Exemplo n.º 2
0
        public static Discord.EmbedBuilder UserInfo(string username)
        {
            RootObject root = RequestHandler.GetUserByName(username);
            User       user = root.user;

            Discord.EmbedBuilder builder = Builders.BaseBuilder("Link to " + Names.SmashLadder + " Profile", "All information known about **" + user.username + "**",
                                                                ColorPicker.SmashModule,
                                                                new EmbedAuthorBuilder().WithName(Names.SmashLadder)
                                                                .WithUrl("http://www.smashladder.com"), "");
            builder.WithThumbnailUrl("https://www.smashladder.com/images/subhypepikachu-logo.png");
            if (user.selected_flair != null)
            {
                builder.WithAuthor(new EmbedAuthorBuilder().WithName(Names.SmashLadder)
                                   .WithUrl("http://www.smashladder.com").WithIconUrl("http:" + user.selected_flair.url));
            }
            string location = "";

            if (!string.IsNullOrEmpty(user.location.Locality))
            {
                location += user.location.Locality + ", ";
            }
            if (!string.IsNullOrEmpty(user.location.State))
            {
                location += user.location.State + ", ";
            }
            if (!string.IsNullOrEmpty(user.location.Country.name))
            {
                location += user.location.Country.name;
            }
            string status = "Offline";
            string sub    = "";

            if (user.is_online != null)
            {
                status = "Online";
            }
            if (user.is_subscribed != null)
            {
                sub = "**User is subscribed!**\n";
            }
            builder.AddField(new EmbedFieldBuilder().WithName("Profile").WithValue(
                                 "**Name: **" + user.username + "\n" +
                                 "**Member Since: **" + user.member_since.full.ToLongDateString() + "\n" +
                                 "**Location: **" + location + "\n" +
                                 "**Status message: **" + user.away_message + "\n" +
                                 "**Total matches played: **" + user.total_matches_played + "\n" +
                                 "**Status: **" + status + "\n" + sub
                                 ));
            var filteredgames = user.ladder_information.AllGames.Where(x => x != null).ToList();

            try
            {
                filteredgames = filteredgames.Where(x => x.league.stats.RankedPlayed != 0).ToList();
            }
            catch
            {
                //No ranked games played
            }
            foreach (var game in filteredgames)
            {
                try
                {
                    var characters = "";
                    var count      = 3;
                    if (game.characters.Count < count)
                    {
                        count = game.characters.Count;
                    }
                    if (count != 0)
                    {
                        characters = "**Characters:**\n";
                        for (int i = 0; i < count; i++)
                        {
                            characters += "**  " + game.characters[i].name + ": **" + game.characters[i].percent + "%\n";
                        }
                    }
                    var rank = "**Ranked: **Unranked\n";
                    if (!string.IsNullOrEmpty(game.league.Tier))
                    {
                        rank = "**Ranked: **" + game.league.Tier + " " + game.league.Division + "\n";
                    }
                    builder.AddField(new EmbedFieldBuilder().WithName(game.name).WithValue(
                                         "**Total ranked games played: **" + game.league.stats.RankedPlayed + "\n" +
                                         rank +
                                         characters
                                         ));
                }
                catch
                {
                }
            }

            if (root.now_playing != null)
            {
                string type = "Friendlies";
                if (root.now_playing.is_ranked)
                {
                    type = "Ranked";
                }

                string rankp1 = "Unranked";
                try
                {
                    var games1 = root.now_playing.player1.ladder_information.AllGames;
                    games1 = games1.Where(x => x != null).ToList();
                    SmashHandler.DataTypes.Game gamep1 = games1.Single(x => x.id == root.now_playing.ladder.id);
                    if (!string.IsNullOrEmpty(gamep1.league.Tier))
                    {
                        rankp1 = gamep1.league.Tier + " " + gamep1.league.Division;
                    }
                }
                catch { }
                string rankp2 = "Unranked";
                try
                {
                    var games2 = root.now_playing.player2.ladder_information.AllGames;
                    games2 = games2.Where(x => x != null).ToList();
                    SmashHandler.DataTypes.Game gamep2 = games2.Single(x => x.id == root.now_playing.ladder.id);
                    if (!string.IsNullOrEmpty(gamep2.league.Tier))
                    {
                        rankp2 = gamep2.league.Tier + " " + gamep2.league.Division;
                    }
                }
                catch { }
                builder.AddField(new EmbedFieldBuilder().WithName("Currently Playing").WithValue(
                                     "**" + root.now_playing.ladder_name + " " + type + "**: \n" +
                                     "Using " + root.now_playing.preferred_build.name + "\n" +
                                     root.now_playing.player1.username + " " + "(" + rankp1 + ")" + " vs " + root.now_playing.player2.username + " (" + rankp2 + ")"));
            }
            builder.WithUrl(user.profile_url);
            return(builder);
        }