From c8d45a14a41d3f59723fb114fa6fdf1d88113bae Mon Sep 17 00:00:00 2001 From: kremsy Date: Fri, 10 Jan 2014 00:18:15 +0100 Subject: [PATCH] =?UTF-8?q?pause=20button=20(wusste=20garnet=20dass=20es?= =?UTF-8?q?=20das=20wort=20pause=20auch=20im=20englishen=20gibt=20aber=20w?= =?UTF-8?q?abbit=20meinte=20dass=20is=20dort=20genauso,=20und=20break=20w?= =?UTF-8?q?=C3=A4r=20bl=C3=B6d^^)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManiaExchangeInfoSearcher.php | 4 --- application/core/Maps/MapCommands.php | 2 +- application/core/Server/ServerCommands.php | 32 ++++++++++++++++++- 3 files changed, 32 insertions(+), 6 deletions(-) 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"); } /**