public override async Task <OverlayItemBase> GetProcessedItem(UserViewModel user, IEnumerable <string> arguments, Dictionary <string, string> extraSpecialIdentifiers) { OverlayLeaderboard copy = (OverlayLeaderboard)this.GetCopy(); if (this.LeaderboardType == LeaderboardTypeEnum.Subscribers && this.refreshSubscribers) { this.refreshSubscribers = false; List <KeyValuePair <UserViewModel, DateTimeOffset> > usersToShow = new List <KeyValuePair <UserViewModel, DateTimeOffset> >(); var orderedUsers = userSubDates.OrderByDescending(kvp => kvp.Value.TotalDaysFromNow()); for (int i = 0; i < this.TotalToShow && i < orderedUsers.Count(); i++) { usersToShow.Add(orderedUsers.ElementAt(i)); } foreach (KeyValuePair <UserViewModel, DateTimeOffset> userToShow in usersToShow) { extraSpecialIdentifiers["DETAILS"] = userToShow.Value.GetAge(); OverlayCustomHTMLItem htmlItem = (OverlayCustomHTMLItem)await base.GetProcessedItem(userToShow.Key, arguments, extraSpecialIdentifiers); copy.LeaderboardEntries.Add(htmlItem.HTMLText); } return(copy); } else if (this.LeaderboardType == LeaderboardTypeEnum.Donations && this.refreshDonations) { this.refreshDonations = false; List <UserDonationModel> topDonators = new List <UserDonationModel>(); var orderedUsers = this.userDonations.OrderByDescending(kvp => kvp.Value.Amount); for (int i = 0; i < this.TotalToShow && i < orderedUsers.Count(); i++) { topDonators.Add(orderedUsers.ElementAt(i).Value); } foreach (UserDonationModel topDonator in topDonators) { extraSpecialIdentifiers["DETAILS"] = topDonator.AmountText; OverlayCustomHTMLItem htmlItem = (OverlayCustomHTMLItem)await base.GetProcessedItem(topDonator.User, arguments, extraSpecialIdentifiers); copy.LeaderboardEntries.Add(htmlItem.HTMLText); } return(copy); } else if (this.LeaderboardType == LeaderboardTypeEnum.CurrencyRank) { if (ChannelSession.Settings.Currencies.ContainsKey(this.CurrencyID)) { UserCurrencyViewModel currency = ChannelSession.Settings.Currencies[this.CurrencyID]; if (this.lastCurrencyRefresh < DateTimeOffset.Now) { this.lastCurrencyRefresh = DateTimeOffset.Now.AddMinutes(1); Dictionary <uint, int> currencyAmounts = new Dictionary <uint, int>(); foreach (UserDataViewModel userData in ChannelSession.Settings.UserData.Values) { currencyAmounts[userData.ID] = userData.GetCurrencyAmount(currency); } this.currencyUsersToShow.Clear(); for (int i = 0; i < this.TotalToShow && i < currencyAmounts.Count; i++) { try { KeyValuePair <uint, int> top = currencyAmounts.Aggregate((current, highest) => (current.Key <= 0 || current.Value < highest.Value) ? highest : current); if (!top.Equals(default(KeyValuePair <uint, int>))) { this.currencyUsersToShow.Add(ChannelSession.Settings.UserData[top.Key]); currencyAmounts.Remove(top.Key); } } catch (Exception ex) { Util.Logger.Log(ex); } } } foreach (UserDataViewModel userToShow in this.currencyUsersToShow) { extraSpecialIdentifiers["DETAILS"] = userToShow.GetCurrencyAmount(currency).ToString(); OverlayCustomHTMLItem htmlItem = (OverlayCustomHTMLItem)await base.GetProcessedItem(new UserViewModel(userToShow), arguments, extraSpecialIdentifiers); copy.LeaderboardEntries.Add(htmlItem.HTMLText); } return(copy); } } return(null); }