Exemple #1
0
        private async Task RecordLoss(Match match, List <PlayerMMrChange> losingTeam)
        {
            var gameMode = GetGameModeStatGameMode(match.gameMode, losingTeam[0]);

            var loserId = new BattleTagIdCombined(
                losingTeam.Select(w => PlayerId.Create(w.battleTag)).ToList(),
                match.gateway,
                gameMode,
                match.season,
                match.gameMode == GameMode.GM_1v1 && match.season >= 2 ? (Race?)losingTeam.Single().race : null);

            var loser = await _playerRepository.LoadGameModeStatPerGateway(loserId.Id) ?? PlayerGameModeStatPerGateway.Create(loserId);

            loser.RecordWin(false);

            var firstLooser = losingTeam.First();

            loser.RecordRanking(
                (int?)firstLooser.updatedMmr?.rating ?? (int?)firstLooser.mmr?.rating ?? 0,
                (int?)firstLooser.updatedRanking?.rp ?? (int?)firstLooser.ranking?.rp ?? 0);

            await _playerRepository.UpsertPlayerGameModeStatPerGateway(loser);
        }
Exemple #2
0
        private async Task RecordWin(Match match, List <PlayerMMrChange> winners)
        {
            var gameMode = GetGameModeStatGameMode(match.gameMode, winners[0]);

            var winnerId = new BattleTagIdCombined(
                winners.Select(w => PlayerId.Create(w.battleTag)).ToList(),
                match.gateway,
                gameMode,
                match.season,
                match.gameMode == GameMode.GM_1v1 && match.season >= 2 ? (Race?)winners.Single().race : null);

            var winner = await _playerRepository.LoadGameModeStatPerGateway(winnerId.Id) ?? PlayerGameModeStatPerGateway.Create(winnerId);

            winner.RecordWin(true);
            winner.RecordRanking(
                (int?)winners.First().updatedMmr?.rating ?? (int?)winners.First().mmr?.rating ?? 0,
                (int?)winners.First().updatedRanking?.rp ?? (int?)winners.First().ranking?.rp ?? 0);

            await _playerRepository.UpsertPlayerGameModeStatPerGateway(winner);
        }