void UpdateSummoner(Summoner summoner, AllPublicSummonerDataDTO publicSummonerData, AggregatedStats[] aggregatedStats, PlayerLifeTimeStats lifeTimeStatistics, RecentGames recentGames, DbConnection connection) { int accountId = summoner.AccountId; lock (ActiveAccountIds) { // Avoid concurrent updates of the same account, it's asking for trouble and is redundant anyways // We might obtain outdated results in one query but that's a minor issue in comparison to corrupted database results if (ActiveAccountIds.Contains(accountId)) return; ActiveAccountIds.Add(accountId); } // Use a transaction because we're going to insert a fair amount of data using (var transaction = connection.BeginTransaction()) { UpdateSummonerFields(summoner, connection, true); UpdateRunes(summoner, publicSummonerData, connection); UpdateSummonerRatings(summoner, lifeTimeStatistics, connection); // A season value of zero indicates the current season only for (int season = 0; season < aggregatedStats.Length; season++) UpdateSummonerRankedStatistics(summoner, season, aggregatedStats[season], connection); UpdateSummonerGames(summoner, recentGames, connection); transaction.Commit(); } lock (ActiveAccountIds) ActiveAccountIds.Remove(accountId); }
void GetLifeTimeStatistics(PlayerLifeTimeStats lifeTimeStatistics) { LifeTimeStatistics = lifeTimeStatistics; ProcessReply(); }
void UpdateSummonerRatings(SummonerDescription summoner, PlayerLifeTimeStats lifeTimeStatistics) { List<PlayerStatSummary> summaries = lifeTimeStatistics.playerStatSummaries.playerStatSummarySet; ProcessSummary("summoners_rift", "normal", "Unranked", summoner, summaries, true); ProcessSummary("twisted_treeline", "premade", "RankedPremade3x3", summoner, summaries); ProcessSummary("summoners_rift", "solo", "RankedSolo5x5", summoner, summaries); ProcessSummary("summoners_rift", "premade", "RankedPremade5x5", summoner, summaries); ProcessSummary("dominion", "normal", "OdinUnranked", summoner, summaries); }
void UpdateSummonerRatings(Summoner summoner, PlayerLifeTimeStats lifeTimeStatistics, DbConnection connection) { List<PlayerStatSummary> summaries = lifeTimeStatistics.playerStatSummaries.playerStatSummarySet; ProcessSummary(MapType.SummonersRift, GameModeType.Normal, "Unranked", summoner, summaries, connection, true); ProcessSummary(MapType.TwistedTreeline, GameModeType.Premade, "RankedPremade3x3", summoner, summaries, connection); ProcessSummary(MapType.SummonersRift, GameModeType.Solo, "RankedSolo5x5", summoner, summaries, connection); ProcessSummary(MapType.SummonersRift, GameModeType.Premade, "RankedPremade5x5", summoner, summaries, connection); ProcessSummary(MapType.Dominion, GameModeType.Normal, "OdinUnranked", summoner, summaries, connection, true); }
public void endPlayerLifeStatsResponder(PlayerLifeTimeStats pStats) { endLifeStats.Add(pStats); //ConsoleOut("\tGameUpdate: EndLifeStats"); if (endLifeStats.Count >= endTotalPlayers && endSummonerStats.Count >= endTotalPlayers) { stopWaitHandle.Set(); } }
private void updateSummoner(PublicSummoner pSumm, PlayerLifeTimeStats summStats, AggregatedStats aggStats, AllPublicSummonerDataDTO summPages, MasteryBook masteries) { PlayerStatSummary rSolo5x5; PlayerStatSummary rTeam5x5; PlayerStatSummary normal5x5; List<ChampionStatistics> champStats = ChampionStatistics.GetChampionStatistics(aggStats); db.updateSummoner("summonerLevel", pSumm.summonerLevel.ToString(), pSumm.summonerId); db.updateSummoner("profileIconId", pSumm.profileIconId.ToString(), pSumm.summonerId); if ((rSolo5x5 = summStats.getRankedSolo5x5()) != null) { db.updateSummoner("solo5x5_elo", rSolo5x5.rating.ToString(), pSumm.summonerId); db.updateSummoner("solo5x5_wins", rSolo5x5.wins.ToString(), pSumm.summonerId); db.updateSummoner("solo5x5_losses", rSolo5x5.losses.ToString(), pSumm.summonerId); db.updateSummoner("solo5x5_maxElo", rSolo5x5.maxRating.ToString(), pSumm.summonerId); } if ((rTeam5x5 = summStats.getRankedTeam5x5()) != null) { db.updateSummoner("team5x5_elo", rTeam5x5.rating.ToString(), pSumm.summonerId); db.updateSummoner("team5x5_wins", rTeam5x5.wins.ToString(), pSumm.summonerId); db.updateSummoner("team5x5_losses", rTeam5x5.losses.ToString(), pSumm.summonerId); db.updateSummoner("team5x5_maxElo", rTeam5x5.maxRating.ToString(), pSumm.summonerId); } if ((normal5x5 = summStats.getNormal5x5()) != null) { db.updateSummoner("normal5x5_elo", normal5x5.rating.ToString(), pSumm.summonerId); db.updateSummoner("normal5x5_wins", normal5x5.wins.ToString(), pSumm.summonerId); db.updateSummoner("normal5x5_losses", normal5x5.losses.ToString(), pSumm.summonerId); db.updateSummoner("normal5x5_maxElo", normal5x5.maxRating.ToString(), pSumm.summonerId); } db.updateSummoner("ranked_kills", ChampionStatistics.totalRankedKills(champStats).ToString(), pSumm.summonerId); db.updateSummoner("ranked_assists", ChampionStatistics.totalRankedAssists(champStats).ToString(), pSumm.summonerId); db.updateSummoner("ranked_deaths", ChampionStatistics.totalRankedDeaths(champStats).ToString(), pSumm.summonerId); db.updateSummoner("ranked_pentaKills", ChampionStatistics.totalRankedPentaKills(champStats).ToString(), pSumm.summonerId); db.updateSummoner("ranked_quadraKills", ChampionStatistics.totalRankedQuadraKills(champStats).ToString(), pSumm.summonerId); db.updateSummoner("ranked_tripleKills", ChampionStatistics.totalRankedTripleKills(champStats).ToString(), pSumm.summonerId); db.updateSummoner("ranked_doubleKills", ChampionStatistics.totalRankedDoubleKills(champStats).ToString(), pSumm.summonerId); db.updateSummoner("ranked_minionKills", ChampionStatistics.totalRankedMinionKills(champStats).ToString(), pSumm.summonerId); db.updateSummoner("ranked_goldEarned", ChampionStatistics.totalRankedGoldEarned(champStats).ToString(), pSumm.summonerId); db.updateSummoner("ranked_turretsDestroyed", ChampionStatistics.totalRankedTurretsDestroyed(champStats).ToString(), pSumm.summonerId); db.updateSummoner("ranked_mostKills", ChampionStatistics.rankedMostKills(champStats).ToString(), pSumm.summonerId); db.updateSummoner("ranked_mostDeaths", ChampionStatistics.rankedMostDeaths(champStats).ToString(), pSumm.summonerId); /** Update Runes and Masteries */ }