diff --git a/application/core/ManiaExchange/ManiaExchangeInfoSearcher.php b/application/core/ManiaExchange/ManiaExchangeInfoSearcher.php index de77428d..c2fc32cf 100644 --- a/application/core/ManiaExchange/ManiaExchangeInfoSearcher.php +++ b/application/core/ManiaExchange/ManiaExchangeInfoSearcher.php @@ -187,10 +187,6 @@ class ManiaExchangeInfoSearcher { //TODO rename to ManiaExchangeManager $this->maniaControl->client->query('GetModeScriptInfo'); $scriptInfos = $this->maniaControl->client->getResponse(); - /* - $this->maniaControl->client->query('SendModeScriptCommands', array('Command_ForceWarmUp' => True)); - $test = $this->maniaControl->client->getResponse(); Just a test, and its working!*/ - $mapTypes = $scriptInfos["CompatibleMapTypes"]; // compile search URL diff --git a/application/core/Maps/MapCommands.php b/application/core/Maps/MapCommands.php index 67a1bb79..3b9c10cb 100644 --- a/application/core/Maps/MapCommands.php +++ b/application/core/Maps/MapCommands.php @@ -85,7 +85,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb $itemQuad = new Quad_Icons64x64_1(); $itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowFastNext); $itemQuad->setAction(self::ACTION_SKIP_MAP); - $this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 1, 'Skip Map'); + $this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 2, 'Skip Map'); } /** diff --git a/application/core/Server/ServerCommands.php b/application/core/Server/ServerCommands.php index 41421525..d57822b4 100644 --- a/application/core/Server/ServerCommands.php +++ b/application/core/Server/ServerCommands.php @@ -2,11 +2,14 @@ namespace ManiaControl\Server; +use FML\Controls\Quads\Quad_Icons128x32_1; +use FML\Controls\Quads\Quad_Icons64x64_1; use ManiaControl\ManiaControl; use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Commands\CommandListener; +use ManiaControl\Manialinks\ManialinkPageAnswerListener; use ManiaControl\Players\Player; /** @@ -14,7 +17,12 @@ use ManiaControl\Players\Player; * * @author steeffeen & kremsy */ -class ServerCommands implements CallbackListener, CommandListener { +class ServerCommands implements CallbackListener, CommandListener, ManialinkPageAnswerListener { + /** + * Constants + */ + const ACTION_SET_PAUSE = 'ServerCommands.SetPause'; + /** * Private properties */ @@ -47,6 +55,28 @@ class ServerCommands implements CallbackListener, CommandListener { $this->maniaControl->commandManager->registerCommandListener('disablemapdownload', $this, 'command_DisableMapDownload', true); $this->maniaControl->commandManager->registerCommandListener('enablehorns', $this, 'command_EnableHorns', true); $this->maniaControl->commandManager->registerCommandListener('disablehorns', $this, 'command_DisableHorns', true); + + + $this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SET_PAUSE, $this, 'setPause'); + + //TODO correct class? + // Set Pause + $itemQuad = new Quad_Icons128x32_1(); //TODO check if mode supports it + $itemQuad->setSubStyle($itemQuad::SUBSTYLE_ManiaLinkSwitch); + $itemQuad->setAction(self::ACTION_SET_PAUSE); + $this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 1, 'Pauses the current map.'); + + } + + /** + * Breaks the current game + * @param array $callback + */ + public function setPause(array $callback){ + $this->maniaControl->client->query('SendModeScriptCommands', array('Command_ForceWarmUp' => True)); + $success = $this->maniaControl->client->getResponse(); + if(!$success) + $this->maniaControl->chat->sendError("Error while setting the break"); } /**