public static function updateCounts(GameUsers $user, GameUsers $opponent, $roomGroupId, $action, $gameId = null, $double = 0, $normal = true, $type = null, $time = null) { //Add Log $result = new FunctionResult(); $result->success = true; if (!empty($user) && !empty($action)) { if ($action == GameUtils::$GAME_RESULT_ACTION_WIN) { $user->setWinGameCount($user->getWinGameCount() + 1); if ($type == GameUtils::$GAME_RESULT_ACTION_TYPE_QUIT) { $user->setWinCountQuitGame($user->getWinCountQuitGame() + 1); } else { if ($type == GameUtils::$GAME_RESULT_ACTION_TYPE_LEFT) { $user->setWinCountConnectionLostGame($user->getWinCountConnectionLostGame() + 1); } } if (!$normal) { $user->setWinCountDoubleGame($user->getWinCountDoubleGame() + 1); } } else { if ($action == GameUtils::$GAME_RESULT_ACTION_LOST) { $user->setLostGameCount($user->getLostGameCount() + 1); if ($type == GameUtils::$GAME_RESULT_ACTION_TYPE_QUIT) { $user->setLostCountQuitGame($user->getLostCountQuitGame() + 1); } else { if ($type == GameUtils::$GAME_RESULT_ACTION_TYPE_LEFT) { $user->setLostCountConnectionLostGame($user->getLostCountConnectionLostGame() + 1); } } if (!$normal) { $user->setLostCountDoubleGame($user->getLostCountDoubleGame() + 1); } } else { $result->success = false; $result->result = "Action unknown"; } } } return $result; }