Exemplo n.º 1
0
        private ILocalisable <string>[] MakeTable(IEnumerable <PlayerData> players, IEnumerable <Registration> applications, Range <int> range)
        {
            var paired = applications.Join(players, a => a.UserId, p => p.Id, (a, p) => (Application: a, Player: p));

            var ignore = GuildSettings.Get <RegistrationSettings>().IgnoreList;

            paired = paired.Where(a => !(ignore.Contains(a.Application.UserId) && a.Application.GuildId == null))
                     .OrderByDescending(a => a.Player.MaxStage)
                     .ThenByDescending(a => Math.Round(Math.Sqrt(a.Player.Relics), 0))
                     .ThenByDescending(a => a.Player.AttacksPerWeek)
                     .ThenBy(a => a.Application.EditTime)
                     .Skip(range.From);

            var table = new List <LocalisedString> {
            };

            table.Add((LocalisedString)ApplyText.LIST_TABLEHEADERS);
            var pos = range.From + 1;

            foreach (var app in paired)
            {
                var user = Client.GetUser(app.Application.UserId);
                if (user == null)
                {
                    continue;
                }
                table.Add(new LocalisedString(ApplyText.LIST_ROW, pos++.ToString(),
                                              user,
                                              user.Id,
                                              app.Player.MaxStage,
                                              app.Application.Images?.Length ?? 0,
                                              app.Player.Relics,
                                              app.Player.AttacksPerWeek,
                                              app.Player.TapsPerCQ,
                                              (DateTime.Now - app.Application.EditTime).Days,
                                              app.Application.GuildId == null ? "-g" : ""));
                if (table.Count == range.To - range.From)
                {
                    break;
                }
            }

            return(table.ToArray());
        }
Exemplo n.º 2
0
 private TitanLordSettings TitanLordSettings(int group) => GuildSettings.Get <TitanLordSettings>(group);