From 027af49bc97057983de03bc20c32848080786b90 Mon Sep 17 00:00:00 2001 From: kremsy Date: Thu, 16 Jan 2014 18:49:52 +0100 Subject: [PATCH] changes too new structure --- .../core/Callbacks/CallbackManager.php | 4 ++-- .../core/Configurators/ScriptSettings.php | 19 +++++++------------ .../core/Configurators/ServerSettings.php | 13 +++++-------- application/plugins/CustomVotes.php | 13 ++++++------- application/plugins/WidgetPlugin.php | 13 +++++-------- 5 files changed, 25 insertions(+), 37 deletions(-) diff --git a/application/core/Callbacks/CallbackManager.php b/application/core/Callbacks/CallbackManager.php index 2ec26814..5445e6f3 100644 --- a/application/core/Callbacks/CallbackManager.php +++ b/application/core/Callbacks/CallbackManager.php @@ -180,8 +180,8 @@ class CallbackManager { // Server Callbacks if (!$this->maniaControl->client) return; - $this->maniaControl->client->readCB(); - $callbacks = $this->maniaControl->client->getCBResponses(); + + $callbacks = $this->maniaControl->client->executeCallbacks(); if (!is_array($callbacks)) { trigger_error("Error reading server callbacks. " . $this->maniaControl->getClientErrorText()); return; diff --git a/application/core/Configurators/ScriptSettings.php b/application/core/Configurators/ScriptSettings.php index faed1a35..bdb7b0e7 100644 --- a/application/core/Configurators/ScriptSettings.php +++ b/application/core/Configurators/ScriptSettings.php @@ -91,8 +91,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { * @return bool */ public function loadSettingsFromDatabase() { - $this->maniaControl->client->query('GetModeScriptSettings'); - $scriptSettings = $this->maniaControl->client->getResponse(); + $scriptSettings = (array)$this->maniaControl->client->getModeScriptSettings(); if(isset($scriptSettings['faultString'])) { if($scriptSettings['faultString'] == 'Not in script mode.') { return false; @@ -122,7 +121,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { return true; } - $success = $this->maniaControl->client->query('SetModeScriptSettings', $loadedSettings); + $success = $this->maniaControl->client->setModeScriptSettings($loadedSettings); if(!$success) { trigger_error('Error occured: ' . $this->maniaControl->getClientErrorText()); return false; @@ -146,8 +145,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { $pagesId = 'ScriptSettingsPages'; $frame = new Frame(); - $this->maniaControl->client->query('GetModeScriptInfo'); - $scriptInfo = $this->maniaControl->client->getResponse(); + $scriptInfo = (array)$this->maniaControl->client->getModeScriptInfo(); if(isset($scriptInfo['faultCode'])) { // Not in script mode $label = new Label(); @@ -157,8 +155,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { } $scriptParams = $scriptInfo['ParamDescs']; - $this->maniaControl->client->query('GetModeScriptSettings'); - $scriptSettings = $this->maniaControl->client->getResponse(); + $scriptSettings = (array)$this->maniaControl->client->getModeScriptSettings(); // Config $pagerSize = 9.; @@ -285,8 +282,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { return; } - $this->maniaControl->client->query('GetModeScriptSettings'); - $scriptSettings = $this->maniaControl->client->getResponse(); + $scriptInfo = (array)$this->maniaControl->client->getModeScriptInfo(); $prefixLength = strlen(self::ACTION_PREFIX_SETTING); @@ -348,8 +344,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { * @param $setting */ public function toggleBooleanSetting($setting, Player $player) { - $this->maniaControl->client->query('GetModeScriptSettings'); - $scriptSettings = $this->maniaControl->client->getResponse(); + $scriptInfo = (array)$this->maniaControl->client->getModeScriptInfo(); if(!isset($scriptSettings[$setting])) { var_dump('no setting ' . $setting); @@ -373,7 +368,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { if(!$newSettings) { return true; } - $success = $this->maniaControl->client->query('SetModeScriptSettings', $newSettings); + $success = $this->maniaControl->client->setModeScriptSettings($newSettings); if(!$success) { $this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login); return false; diff --git a/application/core/Configurators/ServerSettings.php b/application/core/Configurators/ServerSettings.php index e186f7f2..987cbc1a 100644 --- a/application/core/Configurators/ServerSettings.php +++ b/application/core/Configurators/ServerSettings.php @@ -99,8 +99,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { return false; } - $this->maniaControl->client->query('GetServerOptions'); - $serverSettings = $this->maniaControl->client->getResponse(); + $serverSettings = (array)$this->maniaControl->client->getServerOptions(); $loadedSettings = array(); while($row = $result->fetch_object()) { if(!isset($serverSettings[$row->settingName])) { @@ -114,7 +113,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { return true; } - $success = $this->maniaControl->client->query('SetServerOptions', $loadedSettings); + $success = $this->maniaControl->client->getServerOptions($loadedSettings); if(!$success) { trigger_error('Error occurred: ' . $this->maniaControl->getClientErrorText()); return false; @@ -138,8 +137,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { $pagesId = 'ServerSettingsPages'; $frame = new Frame(); - $this->maniaControl->client->query('GetServerOptions'); - $serverSettings = $this->maniaControl->client->getResponse(); + $serverSettings = $this->maniaControl->client->getServerOptions(); // Config $pagerSize = 9.; @@ -270,8 +268,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { } // Note on ServerOptions the whole Options have to be saved, otherwise a error will appear - $this->maniaControl->client->query('GetServerOptions'); - $serverSettings = $this->maniaControl->client->getResponse(); + $serverSettings = $this->maniaControl->client->getServerOptions(); $prefixLength = strlen(self::ACTION_PREFIX_SETTING); @@ -332,7 +329,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { if(!$newSettings) { return true; } - $success = $this->maniaControl->client->query('SetServerOptions', $newSettings); + $success = $this->maniaControl->client->setServerOptions($newSettings); if(!$success) { $this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login); return false; diff --git a/application/plugins/CustomVotes.php b/application/plugins/CustomVotes.php index b22cea05..69eb01fb 100644 --- a/application/plugins/CustomVotes.php +++ b/application/plugins/CustomVotes.php @@ -191,11 +191,10 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP $this->addVoteMenuItem($itemQuad, 5, 'Vote for Restart-Map'); //Check if Pause exists in current gamemode - $this->maniaControl->client->query('GetModeScriptInfo'); - $scriptInfos = $this->maniaControl->client->getResponse(); + $scriptInfos = (array)$this->maniaControl->client->getModeScriptInfo(); $pauseExists = false; - foreach($scriptInfos["CommandDescs"] as $param) { + foreach($scriptInfos["commandDescs"] as $param) { if($param['Name'] == "Command_ForceWarmUp") { $pauseExists = true; break; @@ -248,20 +247,20 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP if($voteResult >= $this->currentNeededRatio) { switch($voteName) { case 'teambalance': - $this->maniaControl->client->query('AutoTeamBalance'); + $this->maniaControl->client->autoTeamBalance(); $this->maniaControl->chat->sendInformation('$sVote Successfully -> Teams got Balanced!'); break; case 'skipmap': case 'nextmap': - $this->maniaControl->client->query('NextMap'); + $this->maniaControl->client->nextMap(); $this->maniaControl->chat->sendInformation('$sVote Successfully -> Map skipped!'); break; case 'restartmap': - $this->maniaControl->client->query('RestartMap'); + $this->maniaControl->client->restartMap(); $this->maniaControl->chat->sendInformation('$sVote Successfully -> Map restarted!'); break; case 'pausegame': - $this->maniaControl->client->query('SendModeScriptCommands', array('Command_ForceWarmUp' => True)); + $this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => True)); $this->maniaControl->chat->sendInformation('$sVote Successfully -> Current Game paused!'); break; } diff --git a/application/plugins/WidgetPlugin.php b/application/plugins/WidgetPlugin.php index 8507520b..67c0df0b 100644 --- a/application/plugins/WidgetPlugin.php +++ b/application/plugins/WidgetPlugin.php @@ -286,11 +286,9 @@ class WidgetPlugin implements CallbackListener, Plugin { $backgroundQuad->setSize($width, $height); $backgroundQuad->setStyles($quadStyle, $quadSubstyle); - $this->maniaControl->client->query('GetMaxPlayers'); - $maxPlayers = $this->maniaControl->client->getResponse(); + $maxPlayers = $this->maniaControl->client->getMaxPlayers(); - $this->maniaControl->client->query('GetMaxSpectators'); - $maxSpectators = $this->maniaControl->client->getResponse(); + $maxSpectators = $this->maniaControl->client->getMaxSpectators(); $serverName = $this->maniaControl->server->getName(); @@ -440,10 +438,9 @@ class WidgetPlugin implements CallbackListener, Plugin { $requester = null; // if the nextmap is not a queued map, get it from map info if($queuedMap == null) { - $this->maniaControl->client->query("GetNextMapInfo"); - $map = $this->maniaControl->client->getResponse(); - $name = $map['Name']; - $author = $map['Author']; + $map = $this->maniaControl->client->getNextMapInfo(); + $name = $map->name; + $author = $map->author; } else { $requester = $queuedMap[0]; $map = $queuedMap[1];