protected function __construct() { $this->identifier = 'ManiaLive ' . \ManiaLiveApplication\Version; $config = Config::getInstance(); $this->connection = Connection::factory($config->host, $config->port, $config->timeout, $config->user, $config->password); Dispatcher::register(Event::getClass(), $this, Event::ON_ECHO); }
protected function __construct() { Dispatcher::register(ServerEvent::getClass(), $this, ServerEvent::ON_PLAYER_CHAT); $command = new Command('help', 0); $command->addLoginAsFirstParameter = true; $command->log = false; $command->help = 'Display all visible commands to a player it takes no parameter'; $command->callback = array($this, 'help'); $this->register($command); $command = new Command('man', 1); $command->addLoginAsFirstParameter = true; $command->help = 'Display help for every commands you give as parameter' . "\n" . 'exemple of usage: /man man'; $command->isPublic = true; $command->log = false; $command->callback = array($this, 'man'); $this->register($command); $command = new Command('man', 2); $command->addLoginAsFirstParameter = true; $command->help = 'Display help for the command with the corresponding parameters' . "\n" . 'exemple of usage: /man man 2'; $command->isPublic = true; $command->log = false; $command->callback = array($this, 'man'); $this->register($command); $config = \ManiaLive\DedicatedApi\Config::getInstance(); $this->connection = Connection::factory($config->host, $config->port, $config->timeout, $config->user, $config->password); }
protected function init() { new \ManiaLive\Features\Tick\Ticker(); $config = \ManiaLive\DedicatedApi\Config::getInstance(); $this->connection = Connection::factory($config->host, $config->port, $config->timeout, $config->user, $config->password); $this->connection->enableCallbacks(true); \ManiaLive\Data\Storage::getInstance(); \ManiaLive\Features\ChatCommand\Interpreter::getInstance(); \ManiaLive\Features\EchoHandler::getInstance(); \ManiaLive\Gui\GuiHandler::getInstance(); \ManiaLive\PluginHandler\PluginHandler::getInstance(); \ManiaLive\Threading\ThreadHandler::getInstance(); Dispatcher::dispatch(new Event(Event::ON_INIT)); }
protected function __construct() { $this->modalBg = new Bgs1(340, 200); $this->modalBg->setSubStyle(Bgs1::BgDialogBlur); $this->modalBg->setAlign('center', 'center'); $this->modalBg->setPosZ(Window::Z_MODAL); $this->modalBg->setScriptEvents(); $this->nextLoop = microtime(true); Dispatcher::register(AppEvent::getClass(), $this, AppEvent::ALL & ~AppEvent::ON_POST_LOOP); Dispatcher::register(PlayerEvent::getClass(), $this, PlayerEvent::ON_PLAYER_CHANGE_SIDE); Dispatcher::register(ServerEvent::getClass(), $this, ServerEvent::ON_PLAYER_CONNECT | ServerEvent::ON_PLAYER_DISCONNECT); $config = \ManiaLive\DedicatedApi\Config::getInstance(); $this->connection = Connection::factory($config->host, $config->port, $config->timeout, $config->user, $config->password); }
final function __construct() { $this->dependencies = array(); $this->methods = array(); $items = explode('\\', get_class($this)); $this->author = $items[1]; $this->name = $items[2]; $this->id = $this->author . '\\' . $this->name; $this->setVersion(1); $config = \ManiaLive\DedicatedApi\Config::getInstance(); $this->connection = Connection::factory($config->host, $config->port, $config->timeout, $config->user, $config->password); $this->pluginHandler = PluginHandler::getInstance(); $this->storage = Storage::getInstance(); $this->chatCommands = array(); }
function onClickMode($login, $mode) { try { $config = \ManiaLive\DedicatedApi\Config::getInstance(); Connection::factory($config->host, $config->port)->setGameMode($mode); $dialog = Dialog::Create($login, false); $dialog->setSize(125, 40); $dialog->setTitle('Game Mode Changed!'); $dialog->setText('You have selected ' . self::$modes[$mode][0] . ",\n" . 'New game mode will be set on map change!' . "\n" . 'Do you want to restart now?'); $dialog->setButtons(Dialog::YES | Dialog::NO); $dialog->addCloseCallback(array($this, 'onDialogClosed')); $dialog->centerOnScreen(); $dialog->showModal(); $this->show(); } catch (\Exception $ex) { $win = Info::Create($login, false); $win->setSize(40, 23); $win->setTitle('Error'); $win->setText($ex->getMessage()); $win->centerOnScreen(); $win->showModal(); } }
function onInit() { $config = \ManiaLive\DedicatedApi\Config::getInstance(); $this->connection = Connection::factory($config->host, $config->port, $config->timeout, $config->user, $config->password); $this->serverStatus = $this->connection->getStatus(); $players = $this->connection->getPlayerList(-1, 0); foreach ($players as $player) { try { $details = $this->connection->getDetailedPlayerInfo($player->login); foreach ($details as $key => $value) { if ($value) { $player->{$key} = $value; } } if ($player->spectatorStatus % 10 == 0) { $this->players[$player->login] = $player; } else { $this->spectators[$player->login] = $player; } } catch (\Exception $e) { } } try { $this->maps = $this->connection->getMapList(-1, 0); $this->nextMap = $this->maps[$this->connection->getNextMapIndex()]; $this->currentMap = $this->connection->getCurrentMapInfo(); Console::printlnFormatted('Current map: ' . Formatting::stripStyles($this->currentMap->name)); } catch (\Exception $e) { $this->maps = array(); $this->nextMap = null; $this->currentMap = null; } $this->server = $this->connection->getServerOptions(); $this->gameInfos = $this->connection->getCurrentGameInfo(); try { $this->serverLogin = $this->connection->getSystemInfo()->serverLogin; } catch (\Exception $e) { $this->serverLogin = null; } }