/// <summary> /// Translates Sequence contents into human readable formats and Decimal representations. Contains game ID, but not sequence. /// </summary> /// <returns></returns> public Dictionary <string, string> MakeHumanReadable(bool getUsername = false) { if (this.status == Status.Uninitialized) { return(null); } Dictionary <string, string> x = new Dictionary <string, string>(); x.Add("Game", gameName[0].ToString().ToUpper() + gameName.Substring(1)); //x.Add("Iteration", gameIteration.ToString()); x.Add("Game ID", gameID); x.Add("Time", playedTime.AddHours(-Defs.EST_OFFSET).ToString("yyyy MMMM dd") + ", " + playedTime.AddHours(-Defs.EST_OFFSET).ToString("HH:mm") + " EST"); int i = 1; foreach (var player in Players) { if (getUsername) { x.Add("Player " + i, GuildCache.GetUsername(player.Item1) + " (" + player.Item1.ToString() + ")"); } else { x.Add("Player " + i + " ID", player.Item1.ToString()); } x.Add("Player " + i + " Points", player.Item2.ToString()); i++; } return(x); }
public SavedLeaderboard(string key, string[] leaderboardFile, Scoring type = Scoring.Points, short fortnightNo = -1, ulong teamspecific = 0) { this.scoringType = type; this.KEY = key; string[] temp; string team, username; team = ""; username = ""; int score = 0; this.FORTNIGHT_NO = fortnightNo; RESULTS = new List <LBUser>(); this.teamspecific = teamspecific; try { foreach (string str in leaderboardFile) { temp = str.Split(':'); if (temp.Count() != 2) { throw new Exception(); } ulong ID = 0; ID = UInt64.Parse(temp[0]); if (ID == 447487261760552982) { //dummy account which defaults to null, shouldn't appear on lb continue; } team = GuildCache.GetTeam(ID) ?? "?"; if (team == "?") { team = SaveFiles_Mapped.SearchCachedTeam(ID) ?? "?"; } if (teamspecific != 0) { if (team != teamspecific.ToString()) { continue; } } username = GuildCache.GetUsername(ID) ?? "?"; score = Int32.Parse(temp[1]); RESULTS.Add(new LBUser(ID, username, team, score)); } } catch (Exception e) { throw e; } CalculateTeamScores(); if (key == "POINTS-SERVER" && fortnightNo == FORTNIGHT_NUMBER && teamspecific == 0) { GuildCache.SetTeamScore(RED_TEAM_SCORE, 1); GuildCache.SetTeamScore(YELLOW_TEAM_SCORE, 2); GuildCache.SetTeamScore(GREEN_TEAM_SCORE, 3); GuildCache.SetTeamScore(BLUE_TEAM_SCORE, 4); } SortLeaderboard(); }