Пример #1
0
        private async Task ProcessList()
        {
            try
            {
                IMessageChannel channel = await ChannelProvider.GetDMChannelAsync(this.Context);

                List <TReminder> reminders = this._reminderDAO.GetAll(this.Context.User.Id);
                IOrderedEnumerable <TReminder> orderedList = reminders.OrderBy(x => x.ExpirationTime);

                FormattedEmbedBuilder message = new FormattedEmbedBuilder()
                                                .AppendTitle($"{XayahReaction.Hourglass} Active reminders");
                if (orderedList.Count() > 0)
                {
                    foreach (TReminder entry in orderedList)
                    {
                        message.AddField($"Expires: {entry.ExpirationTime} UTC", entry.Message, inline: false);
                    }
                }
                else
                {
                    message.AppendDescription("imagine a soulrending void", AppendOption.Italic);
                }
                await channel.SendEmbedAsync(message);

                await this.Context.Message.AddReactionIfNotDMAsync(this.Context, XayahReaction.Envelope);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Пример #2
0
        private void AppendStatisticData(ChampionDto champion, FormattedEmbedBuilder message)
        {
            StatsDto    stats          = champion.Stats;
            int         decimals       = 3;
            NumberAlign statList       = new NumberAlign(decimals, stats.GetStats());
            NumberAlign statGrowthList = new NumberAlign(decimals, stats.GetStatGrowthList());
            string      statData       =
                $"Health         - {statList.Align(stats.Hp)} | + {statGrowthList.TrimmedAlign(stats.HpPerLevel)}" +
                Environment.NewLine +
                $"Health Regen.  - {statList.Align(stats.HpRegen)} | + {statGrowthList.TrimmedAlign(stats.HpRegenPerLevel)}" +
                Environment.NewLine +
                $"Mana           - {statList.Align(stats.Mp)} | + {statGrowthList.TrimmedAlign(stats.MpPerLevel)}" +
                Environment.NewLine +
                $"Mana Regen     - {statList.Align(stats.MpRegen)} | + {statGrowthList.TrimmedAlign(stats.MpRegenPerLevel)}" +
                Environment.NewLine +
                $"Attack Damage  - {statList.Align(stats.AttackDamage)} | + {statGrowthList.TrimmedAlign(stats.AttackDamagePerLevel)}" +
                Environment.NewLine +
                $"Attack Speed   - {statList.Align(stats.GetBaseAttackSpeed())} | + {statGrowthList.TrimmedAlign(stats.AttackSpeedPerLevel)}%" +
                Environment.NewLine +
                $"Armor          - {statList.Align(stats.Armor)} | + {statGrowthList.TrimmedAlign(stats.ArmorPerLevel)}" +
                Environment.NewLine +
                $"Magic Resist   - {statList.Align(stats.Spellblock)} | + {statGrowthList.TrimmedAlign(stats.SpellblockPerLevel)}" +
                Environment.NewLine +
                $"Attack Range   - {statList.Align(stats.AttackRange)}" +
                Environment.NewLine +
                $"Movement Speed - {statList.Align(stats.MoveSpeed)}";

            message.AddField("Stats", statData,
                             new AppendOption[] { AppendOption.Underscore },
                             new AppendOption[] { AppendOption.Codeblock }, inline: false);
        }
Пример #3
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);
     }
 }
Пример #4
0
        private void AppendSkinData(ChampionDto champion, FormattedEmbedBuilder message)
        {
            List <SkinDto> skins = champion.Skins.Where(x => x.Num > 0).ToList();

            skins.Sort((a, b) => a.Num.CompareTo(b.Num));
            string skinData = string.Empty;

            foreach (SkinDto skin in skins)
            {
                string skinNum = skin.Num.ToString();
                while (skinNum.Length < 2)
                {
                    skinNum = "0" + skinNum;
                }
                skinData += $"{Environment.NewLine}`{skinNum}` - {skin.Name}";
            }
            message.AddField("Skins", skinData,
                             new AppendOption[] { AppendOption.Underscore }, inline: false);
        }
Пример #5
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 });
        }