Example #1
0
        public ISpeedrunEmbedGenerator CreateLeaderboardEmbed(Leaderboard leaderboard)
        {
            ResetEmbedBuilder();

            _embedBuilder.WithTitle(
                $"{leaderboard.Game.Names["international"]} {leaderboard.GetCategoryName} Leaderboard");
            _embedBuilder.WithUrl(leaderboard.WebLink);
            var stringBuilder = new StringBuilder();

            foreach (var run in leaderboard.RunList)
            {
                var player = leaderboard.Players.FirstOrDefault(x => x.Id == run.Run.Players[0]?.Id);
                stringBuilder.AppendLine(
                    $"**{StringCleanerHelper.NumberToRanking(run.Place)}**: {player?.Names["international"]}" +
                    $" {StringCleanerHelper.SpeedrunTimeConverter(run.Run.Time.Primary)}");
            }

            _embedBuilder.AddField("Runs", stringBuilder);

            var icon = leaderboard.Game.Assets["icon"];

            if (icon != null)
            {
                _embedBuilder.WithThumbnailUrl(icon.Uri);
            }

            return(this);
        }
        public ILeagueEmbedGenerator CreateChampionDataEmbed(ChampionData championData)
        {
            ResetBuilder();

            _embedBuilder.WithTitle($"{championData.ChampionId} as of patch {championData.Patch}");

            var stringBuilder = new StringBuilder();

            stringBuilder
            .AppendLine(
                $"**Pick Rate:** {championData.PickRate.ToPercentage()} ({StringCleanerHelper.NumberToRanking(championData.Rankings.PickRates)})")
            .AppendLine(
                $"**Win Rate:** {championData.WinRate.ToPercentage()} ({StringCleanerHelper.NumberToRanking(championData.Rankings.WinRates)})")
            .AppendLine(
                $"**Ban Rate:** {championData.BanRate.ToPercentage()} ({StringCleanerHelper.NumberToRanking(championData.Rankings.BanRates)})");

            _embedBuilder.AddField("Picks/Bans", stringBuilder.ToString());

            stringBuilder.Clear();

            stringBuilder
            .AppendLine(
                $"**Kills:** {championData.Kills.ToChampionGgScore()} ({StringCleanerHelper.NumberToRanking(championData.Rankings.Kills)})")
            .AppendLine(
                $"**Deaths:** {championData.Deaths.ToChampionGgScore()} ({StringCleanerHelper.NumberToRanking(championData.Rankings.Deaths)})")
            .AppendLine(
                $"**Assists:** {championData.Assists.ToChampionGgScore()} ({StringCleanerHelper.NumberToRanking(championData.Rankings.Assists)})")
            .AppendLine($"**KDA:** {championData.Kda.ToChampionGgScore()}");

            _embedBuilder.AddField("KDA", stringBuilder.ToString());

            stringBuilder.Clear();

            stringBuilder
            .AppendLine(
                $"**Damage done:** {championData.Damage.Total.ToChampionGgScore()} ({StringCleanerHelper.NumberToRanking(championData.Rankings.DamageDealt)})")
            .AppendLine(
                $"**True Damage:** {championData.Damage.TotalTrue.ToChampionGgScore()} ({championData.Damage.PercentageTrue.ToPercentage()})")
            .AppendLine(
                $"**Magic Damage:** {championData.Damage.TotalMagic.ToChampionGgScore()} ({championData.Damage.PercentageMagic.ToPercentage()})")
            .AppendLine(
                $"**Physical Damage:** {championData.Damage.TotalPhysical.ToChampionGgScore()} ({championData.Damage.PercentagePhysical.ToPercentage()})");

            _embedBuilder.AddField("Damage", stringBuilder.ToString());

            return(this);
        }