public bool EvaluateEndGame(int gameID) { IGame game = GetGameById(gameID); bool isSplitPot = game.Logger.IsSplitPot; Player winner = game.Winner; foreach (var player in game.Seats) { User user = userController.GetUserByName(player.Username); user.Stats.NumOfGames++; user.Stats.TotalGrossProfit += player.ChipBalance - player.OriginalBalance; user.Stats.HighestCashGain = Math.Max(player.ChipBalance - player.OriginalBalance, user.Stats.HighestCashGain); user.Stats.AvgGrossProfit = user.Stats.TotalGrossProfit / user.Stats.NumOfGames; user.Stats.AvgCashGain = (user.Stats.AvgCashGain * (user.Stats.NumOfGames - 1) + Math.Max(player.ChipBalance - player.OriginalBalance, 0)) / user.Stats.NumOfGames; if (user.Username == winner.Username) { user.Stats.Points += 5; } else { user.Stats.Points -= 1; } if (isSplitPot) { user.MoneyBalance += game.State.Pot / game.Seats.Count; } else if (game.Pref.ChipPolicy > 0) { user.MoneyBalance += player.ChipBalance; } else { user.MoneyBalance = player.ChipBalance; } Console.WriteLine(user.Username + "avg cash gain : " + user.Stats.AvgCashGain); Console.WriteLine(user.Username + "avg gross profit : " + user.Stats.AvgGrossProfit); Console.WriteLine(user.Username + "highest cash gain : " + user.Stats.HighestCashGain); Console.WriteLine(user.Username + "total gross profit : " + user.Stats.TotalGrossProfit); dbManager.UpdateUserStats(user); dbManager.EditUser(user); } gameLogCollection.Add(gameID, game.Logger); dbManager.AddGameLog(game.Logger); games.Remove(gameID); return(true); }