changes too new structure

This commit is contained in:
kremsy 2014-01-16 18:49:52 +01:00 committed by Steffen Schröder
parent af16f2ac8d
commit 027af49bc9
5 changed files with 25 additions and 37 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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];