Esempio n. 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);
 }