示例#1
0
 private void AppendSpellData(ChampionDto champion, FormattedEmbedBuilder message)
 {
     for (int i = 0; i < champion.Spells.Count; i++)
     {
         ChampionSpellDto     spell       = champion.Spells.ElementAt(i);
         FormattedTextBuilder spellDetail = new FormattedTextBuilder()
                                            .Append("Cost:", AppendOption.Italic)
                                            .Append($" {spell.GetCostString()}")
                                            .AppendNewLine()
                                            .Append("Range:", AppendOption.Italic)
                                            .Append($" {spell.GetRangeString()}")
                                            .AppendNewLine()
                                            .Append("Cooldown:", AppendOption.Italic)
                                            .Append($" {spell.GetCooldownString()}");
         message.AddField($"{GetSpellKey(i)} - {spell.Name}", spellDetail.ToString(),
                          new AppendOption[] { AppendOption.Underscore }, inline: false);
     }
 }
示例#2
0
        private void AppendStatsOfRole(LeagueRole role, int entryCount, FormattedEmbedBuilder message)
        {
            List <ChampionStatsDto> roleStats = this._championStats.Where(x => x.Role.Equals(role.ApiRole)).ToList();

            if (entryCount * 2 > roleStats.Count)
            {
                entryCount = (int)Math.Truncate(roleStats.Count / (decimal)2);
            }
            FormattedTextBuilder winrates = new FormattedTextBuilder();

            for (int i = 0; i < entryCount && i < roleStats.Count; i++)
            {
                ChampionStatsDto topX         = roleStats.ElementAt(i);
                string           championLine = this.BuildChampionStats(topX, i + 1);
                if (i > 0)
                {
                    winrates.AppendNewLine();
                }
                winrates.Append(championLine);
            }
            if (roleStats.Count > entryCount * 2)
            {
                winrates.AppendNewLine();
            }
            for (int i = roleStats.Count - entryCount; i >= 0 && i < roleStats.Count; i++)
            {
                ChampionStatsDto bottomX      = roleStats.ElementAt(i);
                string           championLine = this.BuildChampionStats(bottomX, i + 1);
                winrates.AppendNewLine().Append(championLine);
            }
            string resultText = winrates.ToString();

            if (string.IsNullOrWhiteSpace(resultText))
            {
                resultText = ". . .";
            }
            message.AddField(role.Name, resultText, new AppendOption[] { AppendOption.Underscore });
        }