Ejemplo n.º 1
0
 function preview()
 {
     $config = $this->fetchAndAssertConfig(_('starting it'));
     $server = $this->session->get('server');
     $this->response->configFile = $this->session->get('configFile', \ManiaLib\Utils\Formatting::stripStyles($server->name));
     $header = \DedicatedManager\Helpers\Header::getInstance();
     $header->rightText = _('Back to plugins');
     $header->rightIcon = 'back';
     $header->rightLink = $this->request->createLinkArgList('../plugins');
 }
Ejemplo n.º 2
0
 function getConnectUrl($login)
 {
     $player = \ManiaLive\Data\Storage::getInstance()->getPlayerObject($login);
     $queryArgs = 'nickname=' . rawurlencode(substr(\ManiaLib\Utils\Formatting::stripStyles($player->nickName), 0, 30));
     if ($channel = Structures\Channel::GetDefault()) {
         $queryArgs .= '&channel=' . rawurlencode($channel->getPath());
     }
     $queryArgs .= '&token=' . rawurlencode(Connection::getInstance()->getToken($login));
     if ($this->voicePassword) {
         $queryArgs .= '&password='******'ts3server://' . $this->voiceHost . ':' . $this->voicePort . '?' . $queryArgs;
 }
Ejemplo n.º 3
0
 function onLoad()
 {
     $config = Config::getInstance();
     if (!$config->serverChannelName) {
         $config->serverChannelName = substr('ManiaPlanet> ' . Formatting::stripStyles($this->connection->getMainServerPlayerInfo()->nickName), 0, 40);
     }
     $this->tsConnection = Connection::getInstance();
     $this->tsConnection->open();
     if (!$this->tsConnection->isConnected()) {
         $this->enableTickerEvent();
     }
     Signal::getInstance()->subscribe('notifyEvent', array($this, 'onTeamSpeakEvent'));
     $this->enableDedicatedEvents(ServerEvent::ON_PLAYER_CONNECT | ServerEvent::ON_PLAYER_DISCONNECT | ServerEvent::ON_PLAYER_INFO_CHANGED);
 }
Ejemplo n.º 4
0
 function spectate()
 {
     list($options) = $this->fetchAndAssertConfig(_('starting it'));
     $defaultFileName = \ManiaLib\Utils\Formatting::stripStyles($options->name);
     $this->response->configFile = $this->session->get('configFile', $defaultFileName);
     $service = new \DedicatedManager\Services\ServerService();
     $this->response->servers = $service->getLives();
     $this->response->spectate = $this->session->get('spectate', new \DedicatedManager\Services\Spectate());
     if (!$this->response->servers) {
         $this->response->spectate->method = 'login';
     }
     $header = \DedicatedManager\Helpers\Header::getInstance();
     $header->rightText = _('Back to relay server configuration');
     $header->rightIcon = 'back';
     $header->rightLink = $this->request->createLinkArgList('../config');
 }
Ejemplo n.º 5
0
 function onBeginMap($map, $warmUp, $matchContinuation)
 {
     $this->checkpoints = array();
     $oldMap = $this->currentMap;
     $this->currentMap = Map::fromArray($map);
     if ($oldMap) {
         Console::printlnFormatted('Map change: ' . Formatting::stripStyles($oldMap->name) . ' -> ' . Formatting::stripStyles($this->currentMap->name));
     }
     $this->resetScores();
     if ($warmUp) {
         $this->isWarmUp = true;
     }
     $gameInfos = $this->connection->getCurrentGameInfo();
     if ($gameInfos != $this->gameInfos) {
         foreach ($gameInfos as $key => $value) {
             $this->gameInfos->{$key} = $value;
         }
     }
     $serverOptions = $this->connection->getServerOptions();
     if ($serverOptions != $this->server) {
         foreach ($serverOptions as $key => $value) {
             $this->server->{$key} = $value;
         }
     }
 }
Ejemplo n.º 6
0
						<select id="spectateManaged" name="spectate[managed]" data-native-menu="false">
						<?php 
    foreach ($servers as $server) {
        ?>
							<?php 
        $serverId = $server->rpcHost . ':' . $server->rpcPort . ':' . $server->rpcPassword;
        ?>
							<option value="<?php 
        echo $serverId;
        ?>
" <?php 
        echo $serverId == $spectate->managed ? 'selected="selected"' : '';
        ?>
>
								<?php 
        echo \ManiaLib\Utils\Formatting::stripStyles($server->name);
        ?>
							</option>
						<?php 
    }
    ?>
						</select>
					</li>
				</ul>
			</fieldset>
		<?php 
}
?>
			<fieldset id="fieldset-spectate-login" class="relay-method" data-theme="b">
				<ul data-role="listview" data-inset="true">
					<li data-role="list-divider"><?php 
Ejemplo n.º 7
0
 function doVote($login, $vote)
 {
     $player = $this->storage->players[$login];
     $this->db->execute('INSERT INTO `Votes` (`login`, `lp`, `mapUid`, `mapName`, `vote`) ' . 'VALUES (%s, %d, %s, %s, %d) ' . 'ON DUPLICATE KEY UPDATE vote=VALUES(vote), lp=VALUES(lp), mapName=VALUES(mapName)', $this->db->quote($login), $player->ladderStats['PlayerRankings'][0]['Score'], $this->db->quote($this->storage->currentMap->uId), $this->db->quote(\ManiaLib\Utils\Formatting::stripStyles($this->storage->currentMap->name)), $vote);
     return $this->db->affectedRows() > 0;
 }
Ejemplo n.º 8
0
 protected function formatForTwitter($text)
 {
     return \ManiaLib\Utils\Formatting::stripStyles($text);
 }
Ejemplo n.º 9
0
 protected function runJumper()
 {
     foreach ($this->countDown as $matchId => $countDown) {
         switch (--$countDown) {
             case -15:
                 unset($this->countDown[$matchId]);
                 break;
             case -10:
                 //nobreak;
             //nobreak;
             case -5:
                 $match = $this->matchMakingService->getMatch($matchId);
                 //FIXME: maybe use storage which is a safer way to know if a player is still here
                 $players = array_filter($match->players, function ($p) {
                     return !Services\PlayerInfo::Get($p)->isAway();
                 });
                 if ($players) {
                     \ManiaLive\Utilities\Logger::debug('re-display jumper for: ' . implode(',', $players));
                     $this->sendToServer($players, $match->matchServerLogin);
                 } else {
                     //no need to keep this countdown if all player are gone
                     unset($this->countDown[$matchId]);
                     continue;
                 }
                 $this->countDown[$matchId] = $countDown;
                 break;
             case 0:
                 \ManiaLive\Utilities\Logger::debug(sprintf('prepare jump for match : %d', $matchId));
                 $match = $this->matchMakingService->getMatch($matchId);
                 if ($match->state >= Match::PREPARED) {
                     \ManiaLive\Utilities\Logger::debug(sprintf('jumping to server : %s', $match->matchServerLogin));
                     $players = array_map(array($this->storage, 'getPlayerObject'), $match->players);
                     $this->sendToServer($match->players, $match->matchServerLogin);
                     $nicknames = array();
                     foreach ($players as $player) {
                         if ($player && !array_key_exists($player->login, $this->blockedPlayers)) {
                             $nicknames[] = '$<' . \ManiaLib\Utils\Formatting::stripStyles($player->nickName) . '$>';
                             $this->connection->addGuest($player, true);
                         }
                     }
                     $this->connection->chatSendServerMessageToLanguage($this->dictionary->getChat(array(array('textId' => 'matchJoin', 'params' => array(self::PREFIX, implode(' & ', $nicknames))))));
                 } else {
                     \ManiaLive\Utilities\Logger::debug(sprintf('jump cancel match state is : %d', $match->state));
                     foreach ($match->players as $player) {
                         $this->setReadyLabel($player);
                     }
                 }
                 unset($match);
                 //nobreak
             //nobreak
             default:
                 $this->countDown[$matchId] = $countDown;
                 break;
         }
     }
 }
Ejemplo n.º 10
0
 function preview()
 {
     list($options) = $this->fetchAndAssertConfig(_('starting it'));
     $this->fetchAndAssertSettings(_('starting server'));
     $this->fetchAndAssertMaps(_('starting server'));
     $defaultFileName = \ManiaLib\Utils\Formatting::stripStyles($options->name);
     $this->response->configFile = $this->session->get('configFile', $defaultFileName);
     $this->response->matchFile = $this->session->get('matchFile', $defaultFileName);
     $header = \DedicatedManager\Helpers\Header::getInstance();
     $header->rightText = _('Back to map selection');
     $header->rightIcon = 'back';
     $header->rightLink = $this->request->createLinkArgList('../maps');
 }