/** * @param $login */ private function updateKarma($login) { $player = $this->storage->getPlayerObject($login); $playerInfo = Services\PlayerInfo::Get($login); if ($player && $playerInfo) { $penalty = $this->matchMakingService->getPlayerPenalty($login, $this->storage->serverLogin, $this->scriptName, $this->titleIdString); if ($penalty > 0) { if (array_key_exists($login, $this->blockedPlayers)) { if (time() - $this->blockedPlayers[$login] >= $penalty) { $this->matchMakingService->decreasePlayerPenalty($login, time() - $this->blockedPlayers[$login], $this->storage->serverLogin, $this->scriptName, $this->titleIdString); } } else { $this->blockedPlayers[$login] = time(); $this->connection->chatSendServerMessageToLanguage($this->dictionary->getChat(array(array('textId' => 'playerSuspended', 'params' => array(self::PREFIX, $player->nickName))))); } $this->setPlayerNotReady($login); $this->resetShortKey($login); $this->updatePlayerList = true; $this->gui->updateWaitingScreenLabel($this->gui->getBadKarmaText($penalty), $login); $this->gui->disableReadyButton($login); } else { unset($this->blockedPlayers[$login]); $this->setPlayerNotReady($login); $this->gui->updateWaitingScreenLabel(null, $login); $this->gui->disableReadyButton($login, false); } } else { if (array_key_exists($login, $this->blockedPlayers)) { unset($this->blockedPlayers[$login]); } \ManiaLive\Utilities\Logger::debug(sprintf('UpdateKarma for not connected player %s', $login)); } }
protected function play() { \ManiaLive\Utilities\Logger::debug('play()'); $this->matchMakingService->updateMatchState($this->matchId, Services\Match::PLAYING); Label::EraseAll(); switch ($this->state) { case self::DECIDING: $ratios = array(); $ratios[] = new Structures\VoteRatio('NextMap', -1.0); $ratios[] = new Structures\VoteRatio('JumpToMapIndex', -1.0); $this->connection->setCallVoteRatiosEx(false, $ratios); $this->connection->chatSendServerMessageToLanguage($this->dictionary->getChat(array(array('textId' => 'matchStarting', 'params' => array(static::PREFIX))))); break; case static::PLAYER_LEFT: $this->connection->chatSendServerMessageToLanguage(array(array('Lang' => 'fr', 'Text' => static::PREFIX . 'Le joueur est de retour.'), array('Lang' => 'en', 'Text' => static::PREFIX . 'Player is back.'))); break; case static::WAITING_BACKUPS: $this->connection->chatSendServerMessageToLanguage(array(array('Lang' => 'fr', 'Text' => static::PREFIX . 'Les remplaçants sont connectés.'), array('Lang' => 'en', 'Text' => static::PREFIX . 'Substitutes are connected.'))); break; } $this->changeState(self::PLAYING); }