public async Task TrophyList() { int total_trophies = TrophyService.GetTrophies().Count(); int trophies_per_page = 8; int total_pages = (int)Math.Ceiling((float)total_trophies / trophies_per_page); int current_page = 0; int current_page_trophy_count = 0; IPaginatedMessage message = new PaginatedMessage(); Discord.Messaging.IEmbed embed = null; IEnumerable <ITrophy> trophy_list = TrophyService.GetTrophies(); foreach (ITrophy trophy in trophy_list) { if (current_page_trophy_count == 0) { ++current_page; embed = new Discord.Messaging.Embed(); embed.Title = string.Format("All Trophies ({0})", TrophyService.GetTrophies().Count()); embed.Description = string.Format("For more details about a trophy, use `?trophy <name>` (e.g. `{0}trophy \"{1}\"`).", Config.Prefix, trophy_list.First().Name); embed.Footer = string.Format("Page {0} of {1}", current_page, total_pages); embed.Color = new Color(255, 204, 77).ToSystemDrawingColor(); } double completion_rate = await Db.GetTrophyCompletionRateAsync(trophy); string description = (trophy.Flags.HasFlag(TrophyFlags.Hidden) && completion_rate <= 0.0) ? string.Format("_{0}_", TrophyBase.HiddenTrophyDescription) : trophy.Description; // If this was a first-time trophy, show who unlocked it. if (trophy.Flags.HasFlag(TrophyFlags.OneTime) && completion_rate > 0.0) { IEnumerable <IUnlockedTrophyInfo> user_ids = await Db.GetCreatorsWithTrophyAsync(trophy); if (user_ids.Count() > 0 && Context.Guild != null) { IGuildUser user = await Context.Guild.GetUserAsync(user_ids.First().Creator.UserId.Value); if (user != null) { description += string.Format(" (unlocked by {0})", user.Mention); } } } embed.AddField(string.Format("{0} **{1}** ({2:0.#}%)", trophy.Icon, trophy.Name, completion_rate), description); ++current_page_trophy_count; if (current_page_trophy_count >= trophies_per_page) { message.AddPage(embed); current_page_trophy_count = 0; } } // Add the last embed to the message. if (embed != null) { message.AddPage(embed); } await ReplyAsync(message); }