// Calculates personal win rate from personal history dictionary. public double CalcPersonalWinRate() { int wins = 0; int games = 0; foreach (int matchId in personalHistory.Keys) { games += 1; PersonalParticipant personalParticipant = personalHistory[matchId]; if (personalParticipant.isWin) { wins += 1; } } return(100d * wins / games); }
// Calculates champion statistics from personal and global history // dictionaries. public void CalcChampionStats() { foreach (int matchId in personalHistory.Keys) { PersonalParticipant personalParticipant = personalHistory[matchId]; foreach (GlobalParticipant globalParticipant in globalHistory[matchId]) { if (globalParticipant.teamId == personalParticipant.teamId) { if (globalParticipant.championId != personalParticipant.championId) { AddTally(globalParticipant.championId, globalParticipant.isWin ? Stats.AllyWin : Stats.AllyLoss); } } else { AddTally(globalParticipant.championId, globalParticipant.isWin ? Stats.EnemyWin : Stats.EnemyLoss); } } } }