Exemplo n.º 1
0
        public static List <UserAccount> GetTop(RankEnum type = RankEnum.Level, EndlessMode mode = EndlessMode.Default)
        {
            List <UserAccount> sortedList = null;

            switch (type)
            {
            case RankEnum.Level:
            case RankEnum.Solo:
                try
                {
                    sortedList = UserAccountProvider.GetLeaderBoard(type, mode)
                                 .Take(10)
                                 .ToList()
                                 .Select(id => UserAccountProvider.GetById(id.Key))
                                 .ToList();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                break;

            case RankEnum.Duo:
            case RankEnum.Trio:
            case RankEnum.Quad:
                sortedList = UserAccountProvider.GetLeaderBoard(type, mode)
                             .Take(20)
                             .Select(id => UserAccountProvider.GetById(id.Key))
                             .GroupBy(p =>
                                      (p.ServerStats.GetStreak(mode) + p.ServerStatsTotal.GetStreak(mode)).GetEntry(type).Item2)
                             .Select(group => group.First())
                             .OrderByDescending(d =>
                                                (d.ServerStats.GetStreak(mode) + d.ServerStatsTotal.GetStreak(mode)).GetEntry(type).Item1)
                             .ToList();
                break;
            }

            return(sortedList);
        }
Exemplo n.º 2
0
 public static int GetRank(UserAccount user, RankEnum type = RankEnum.Level, EndlessMode mode = EndlessMode.Default)
 {
     return(UserAccountProvider.GetLeaderBoard(type, mode).IndexOf(user.ID));
 }