changes too new structure
This commit is contained in:
parent
af16f2ac8d
commit
027af49bc9
@ -180,8 +180,8 @@ class CallbackManager {
|
|||||||
|
|
||||||
// Server Callbacks
|
// Server Callbacks
|
||||||
if (!$this->maniaControl->client) return;
|
if (!$this->maniaControl->client) return;
|
||||||
$this->maniaControl->client->readCB();
|
|
||||||
$callbacks = $this->maniaControl->client->getCBResponses();
|
$callbacks = $this->maniaControl->client->executeCallbacks();
|
||||||
if (!is_array($callbacks)) {
|
if (!is_array($callbacks)) {
|
||||||
trigger_error("Error reading server callbacks. " . $this->maniaControl->getClientErrorText());
|
trigger_error("Error reading server callbacks. " . $this->maniaControl->getClientErrorText());
|
||||||
return;
|
return;
|
||||||
|
@ -91,8 +91,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function loadSettingsFromDatabase() {
|
public function loadSettingsFromDatabase() {
|
||||||
$this->maniaControl->client->query('GetModeScriptSettings');
|
$scriptSettings = (array)$this->maniaControl->client->getModeScriptSettings();
|
||||||
$scriptSettings = $this->maniaControl->client->getResponse();
|
|
||||||
if(isset($scriptSettings['faultString'])) {
|
if(isset($scriptSettings['faultString'])) {
|
||||||
if($scriptSettings['faultString'] == 'Not in script mode.') {
|
if($scriptSettings['faultString'] == 'Not in script mode.') {
|
||||||
return false;
|
return false;
|
||||||
@ -122,7 +121,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$success = $this->maniaControl->client->query('SetModeScriptSettings', $loadedSettings);
|
$success = $this->maniaControl->client->setModeScriptSettings($loadedSettings);
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
trigger_error('Error occured: ' . $this->maniaControl->getClientErrorText());
|
trigger_error('Error occured: ' . $this->maniaControl->getClientErrorText());
|
||||||
return false;
|
return false;
|
||||||
@ -146,8 +145,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$pagesId = 'ScriptSettingsPages';
|
$pagesId = 'ScriptSettingsPages';
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
|
|
||||||
$this->maniaControl->client->query('GetModeScriptInfo');
|
$scriptInfo = (array)$this->maniaControl->client->getModeScriptInfo();
|
||||||
$scriptInfo = $this->maniaControl->client->getResponse();
|
|
||||||
if(isset($scriptInfo['faultCode'])) {
|
if(isset($scriptInfo['faultCode'])) {
|
||||||
// Not in script mode
|
// Not in script mode
|
||||||
$label = new Label();
|
$label = new Label();
|
||||||
@ -157,8 +155,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
}
|
}
|
||||||
$scriptParams = $scriptInfo['ParamDescs'];
|
$scriptParams = $scriptInfo['ParamDescs'];
|
||||||
|
|
||||||
$this->maniaControl->client->query('GetModeScriptSettings');
|
$scriptSettings = (array)$this->maniaControl->client->getModeScriptSettings();
|
||||||
$scriptSettings = $this->maniaControl->client->getResponse();
|
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
$pagerSize = 9.;
|
$pagerSize = 9.;
|
||||||
@ -285,8 +282,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->maniaControl->client->query('GetModeScriptSettings');
|
$scriptInfo = (array)$this->maniaControl->client->getModeScriptInfo();
|
||||||
$scriptSettings = $this->maniaControl->client->getResponse();
|
|
||||||
|
|
||||||
$prefixLength = strlen(self::ACTION_PREFIX_SETTING);
|
$prefixLength = strlen(self::ACTION_PREFIX_SETTING);
|
||||||
|
|
||||||
@ -348,8 +344,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
* @param $setting
|
* @param $setting
|
||||||
*/
|
*/
|
||||||
public function toggleBooleanSetting($setting, Player $player) {
|
public function toggleBooleanSetting($setting, Player $player) {
|
||||||
$this->maniaControl->client->query('GetModeScriptSettings');
|
$scriptInfo = (array)$this->maniaControl->client->getModeScriptInfo();
|
||||||
$scriptSettings = $this->maniaControl->client->getResponse();
|
|
||||||
|
|
||||||
if(!isset($scriptSettings[$setting])) {
|
if(!isset($scriptSettings[$setting])) {
|
||||||
var_dump('no setting ' . $setting);
|
var_dump('no setting ' . $setting);
|
||||||
@ -373,7 +368,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
if(!$newSettings) {
|
if(!$newSettings) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$success = $this->maniaControl->client->query('SetModeScriptSettings', $newSettings);
|
$success = $this->maniaControl->client->setModeScriptSettings($newSettings);
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
|
||||||
return false;
|
return false;
|
||||||
|
@ -99,8 +99,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->maniaControl->client->query('GetServerOptions');
|
$serverSettings = (array)$this->maniaControl->client->getServerOptions();
|
||||||
$serverSettings = $this->maniaControl->client->getResponse();
|
|
||||||
$loadedSettings = array();
|
$loadedSettings = array();
|
||||||
while($row = $result->fetch_object()) {
|
while($row = $result->fetch_object()) {
|
||||||
if(!isset($serverSettings[$row->settingName])) {
|
if(!isset($serverSettings[$row->settingName])) {
|
||||||
@ -114,7 +113,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$success = $this->maniaControl->client->query('SetServerOptions', $loadedSettings);
|
$success = $this->maniaControl->client->getServerOptions($loadedSettings);
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
trigger_error('Error occurred: ' . $this->maniaControl->getClientErrorText());
|
trigger_error('Error occurred: ' . $this->maniaControl->getClientErrorText());
|
||||||
return false;
|
return false;
|
||||||
@ -138,8 +137,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$pagesId = 'ServerSettingsPages';
|
$pagesId = 'ServerSettingsPages';
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
|
|
||||||
$this->maniaControl->client->query('GetServerOptions');
|
$serverSettings = $this->maniaControl->client->getServerOptions();
|
||||||
$serverSettings = $this->maniaControl->client->getResponse();
|
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
$pagerSize = 9.;
|
$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
|
// Note on ServerOptions the whole Options have to be saved, otherwise a error will appear
|
||||||
$this->maniaControl->client->query('GetServerOptions');
|
$serverSettings = $this->maniaControl->client->getServerOptions();
|
||||||
$serverSettings = $this->maniaControl->client->getResponse();
|
|
||||||
|
|
||||||
$prefixLength = strlen(self::ACTION_PREFIX_SETTING);
|
$prefixLength = strlen(self::ACTION_PREFIX_SETTING);
|
||||||
|
|
||||||
@ -332,7 +329,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
if(!$newSettings) {
|
if(!$newSettings) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$success = $this->maniaControl->client->query('SetServerOptions', $newSettings);
|
$success = $this->maniaControl->client->setServerOptions($newSettings);
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
|
||||||
return false;
|
return false;
|
||||||
|
@ -191,11 +191,10 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$this->addVoteMenuItem($itemQuad, 5, 'Vote for Restart-Map');
|
$this->addVoteMenuItem($itemQuad, 5, 'Vote for Restart-Map');
|
||||||
|
|
||||||
//Check if Pause exists in current gamemode
|
//Check if Pause exists in current gamemode
|
||||||
$this->maniaControl->client->query('GetModeScriptInfo');
|
$scriptInfos = (array)$this->maniaControl->client->getModeScriptInfo();
|
||||||
$scriptInfos = $this->maniaControl->client->getResponse();
|
|
||||||
|
|
||||||
$pauseExists = false;
|
$pauseExists = false;
|
||||||
foreach($scriptInfos["CommandDescs"] as $param) {
|
foreach($scriptInfos["commandDescs"] as $param) {
|
||||||
if($param['Name'] == "Command_ForceWarmUp") {
|
if($param['Name'] == "Command_ForceWarmUp") {
|
||||||
$pauseExists = true;
|
$pauseExists = true;
|
||||||
break;
|
break;
|
||||||
@ -248,20 +247,20 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
if($voteResult >= $this->currentNeededRatio) {
|
if($voteResult >= $this->currentNeededRatio) {
|
||||||
switch($voteName) {
|
switch($voteName) {
|
||||||
case 'teambalance':
|
case 'teambalance':
|
||||||
$this->maniaControl->client->query('AutoTeamBalance');
|
$this->maniaControl->client->autoTeamBalance();
|
||||||
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Teams got Balanced!');
|
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Teams got Balanced!');
|
||||||
break;
|
break;
|
||||||
case 'skipmap':
|
case 'skipmap':
|
||||||
case 'nextmap':
|
case 'nextmap':
|
||||||
$this->maniaControl->client->query('NextMap');
|
$this->maniaControl->client->nextMap();
|
||||||
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Map skipped!');
|
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Map skipped!');
|
||||||
break;
|
break;
|
||||||
case 'restartmap':
|
case 'restartmap':
|
||||||
$this->maniaControl->client->query('RestartMap');
|
$this->maniaControl->client->restartMap();
|
||||||
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Map restarted!');
|
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Map restarted!');
|
||||||
break;
|
break;
|
||||||
case 'pausegame':
|
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!');
|
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Current Game paused!');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -286,11 +286,9 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
$backgroundQuad->setSize($width, $height);
|
$backgroundQuad->setSize($width, $height);
|
||||||
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
||||||
|
|
||||||
$this->maniaControl->client->query('GetMaxPlayers');
|
$maxPlayers = $this->maniaControl->client->getMaxPlayers();
|
||||||
$maxPlayers = $this->maniaControl->client->getResponse();
|
|
||||||
|
|
||||||
$this->maniaControl->client->query('GetMaxSpectators');
|
$maxSpectators = $this->maniaControl->client->getMaxSpectators();
|
||||||
$maxSpectators = $this->maniaControl->client->getResponse();
|
|
||||||
|
|
||||||
$serverName = $this->maniaControl->server->getName();
|
$serverName = $this->maniaControl->server->getName();
|
||||||
|
|
||||||
@ -440,10 +438,9 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
$requester = null;
|
$requester = null;
|
||||||
// if the nextmap is not a queued map, get it from map info
|
// if the nextmap is not a queued map, get it from map info
|
||||||
if($queuedMap == null) {
|
if($queuedMap == null) {
|
||||||
$this->maniaControl->client->query("GetNextMapInfo");
|
$map = $this->maniaControl->client->getNextMapInfo();
|
||||||
$map = $this->maniaControl->client->getResponse();
|
$name = $map->name;
|
||||||
$name = $map['Name'];
|
$author = $map->author;
|
||||||
$author = $map['Author'];
|
|
||||||
} else {
|
} else {
|
||||||
$requester = $queuedMap[0];
|
$requester = $queuedMap[0];
|
||||||
$map = $queuedMap[1];
|
$map = $queuedMap[1];
|
||||||
|
Loading…
Reference in New Issue
Block a user