Example #1
0
 protected function cancelMatch($login, Match $match)
 {
     \ManiaLive\Utilities\Logger::debug(sprintf('Cancelling match %d', $match->id));
     unset($this->countDown[$match->id]);
     if (array_key_exists($login, $this->matchCancellers)) {
         $this->matchCancellers[$login]++;
     } else {
         $this->matchCancellers[$login] = 1;
     }
     if ($this->matchCancellers[$login] > $this->config->authorizedMatchCancellation) {
         $this->matchMakingService->increasePlayerPenalty($login, 42 + 5 * ($this->matchCancellers[$login] - $this->config->authorizedMatchCancellation), $this->storage->serverLogin, $this->scriptName, $this->titleIdString);
     }
     $this->matchMakingService->cancelMatch($match);
     $this->matchMakingService->updatePlayerState($login, $match->id, Services\PlayerInfo::PLAYER_STATE_CANCEL);
     $this->connection->chatSendServerMessageToLanguage($this->dictionary->getChat(array(array('textId' => 'matchCancel', 'params' => array(static::PREFIX, $this->storage->getPlayerObject($login)->nickName)))));
     foreach ($match->players as $playerLogin) {
         Services\PlayerInfo::Get($playerLogin)->isInMatch = false;
         $this->gui->eraseMatchSumUp($playerLogin);
         if ($playerLogin != $login) {
             $this->setPlayerReady($playerLogin);
         } else {
             $this->setPlayerNotReady($playerLogin);
         }
     }
     $this->updateKarma($login);
 }
Example #2
0
 protected function updateMatchPlayerState($login, $state)
 {
     if ($state == Services\PlayerInfo::PLAYER_STATE_QUITTER || $state == Services\PlayerInfo::PLAYER_STATE_GIVE_UP) {
         $this->matchMakingService->increasePlayerPenalty($login, $this->config->penaltyForQuitter, $this->lobby->login, $this->scriptName, $this->titleIdString);
     }
     $this->players[$login] = $state;
     $this->matchMakingService->updatePlayerState($login, $this->matchId, $state);
 }