internal MatchScore(long match, double score, bool win, MatchStats matchStats) { Match = match; Score = score; Win = win; MatchStats = matchStats; }
internal void Compile(MatchOnly[] matches, Dictionary<long, int> matchesChamp, Dictionary<int, string> champDict) { foreach (MatchOnly match in matches) { int champ = matchesChamp[match.matchId]; IEnumerable<Participant> participants = match.participants.Where(x => x.championId == champ); Participant self = participants.First(); IEnumerable<Participant> teammates = match.participants.Where(x => x.teamId == self.teamId); IEnumerable<int> kills = teammates.Select(x => x.stats.kills); int teamKills = kills.Sum(); IEnumerable<int> deaths = teammates.Select(x => x.stats.deaths); int teamDeaths = deaths.Sum(); double score = Score(self.stats.kills + self.stats.assists, self.stats.deaths, teamKills, teamDeaths); string champName = champDict[champ]; MatchStats matchStats = new MatchStats(Constants.MATCH_DETAILS + match.matchId, champName, self.stats.kills, self.stats.deaths, self.stats.assists); MatchScore matchScore = new MatchScore(match.matchId, score, self.stats.winner, matchStats); matchScores.Add(matchScore); } }