Example #1
0
 /**
  * @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));
     }
 }