maniaplanet api update

This commit is contained in:
kremsy 2014-01-20 09:24:17 +01:00 committed by Steffen Schröder
parent 6520e75738
commit 7d8ba59771
6 changed files with 22 additions and 27 deletions

View File

@ -98,8 +98,8 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
trigger_error($mysqli->error);
return false;
}
$serverSettings = $this->maniaControl->client->getServerOptions()->toArray();
$serverSettings = (array)$this->maniaControl->client->getServerOptions();
$loadedSettings = array();
while($row = $result->fetch_object()) {
if(!isset($serverSettings[$row->settingName])) {
@ -137,8 +137,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
$pagesId = 'ServerSettingsPages';
$frame = new Frame();
//TODO temporary
$serverSettings = $this->maniaControl->client->execute('GetServerOptions');
$serverSettings = $this->maniaControl->client->getServerOptions()->toArray();
// Config
$pagerSize = 9.;
@ -268,8 +267,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
return;
}
// Note on ServerOptions the whole Options have to be saved, otherwise a error will appear
$serverSettings = $this->maniaControl->client->execute('GetServerOptions'); //TODO just temporary
$serverSettings = $this->maniaControl->client->getServerOptions()->toArray();
$prefixLength = strlen(self::ACTION_PREFIX_SETTING);
@ -361,6 +359,9 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
// $chatMessage = '$ff0' . $title . ' $<' . $player->nickname . '$> set ScriptSetting' . ($settingsCount > 1 ? 's' : '') . ' ';
foreach($newSettings as $setting => $value) {
if($value == null) {
continue;
}
$statement->bind_param('iss', $this->maniaControl->server->index, $setting, $value);
$statement->execute();
if($statement->error) {
@ -393,16 +394,4 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
return true;
}
/**
* Parse the Setting Value to a String Representation
*
* @param mixed $value
* @return string
*/
private function parseSettingValue($value) {
if(is_bool($value)) {
return ($value ? 'True' : 'False');
}
return (string)$value;
}
}

View File

@ -106,8 +106,8 @@ class Connection
* @param string $authLevel
* @param array $params
*/
public function execute($methodName, $params = array(), $multicall = false)
{//TODO just temporary
protected function execute($methodName, $params = array(), $multicall = false)
{
if($multicall)
{
$this->xmlrpcClient->addCall($methodName, $params);

View File

@ -15,6 +15,7 @@ class ScriptInfo extends AbstractStructure
public $description;
public $version;
public $paramDescs = array();
public $commandDescs = array();
static public function fromArray($array)
{
@ -24,6 +25,10 @@ class ScriptInfo extends AbstractStructure
{
$object->paramDescs = ScriptSettings::fromArrayOfArray($object->paramDescs);
}
if($object->commandDescs)
{
$object->commandDescs = Command::fromArrayOfArray($object->commandDescs);
}
return $object;
}

View File

@ -39,4 +39,6 @@ class ServerOptions extends AbstractStructure
public $nextUseChangingValidationSeed;
public $clientInputsMaxLatency;
public $keepPlayerSlots;
public $disableHorns;
public $disableServiceAnnounces;
}

View File

@ -67,13 +67,12 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
$scriptInfos = $this->maniaControl->client->getModeScriptInfo();
$pauseExists = false;
/*foreach($scriptInfos['commandDescs'] as $param) {
if($param['Name'] == "Command_ForceWarmUp") {
foreach($scriptInfos->commandDescs as $param) {
if($param->name == "Command_ForceWarmUp") {
$pauseExists = true;
break;
}
}*/ //TODO temp
$pauseExists = true;
}
// Set Pause
if($pauseExists) {

View File

@ -197,11 +197,11 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$this->addVoteMenuItem($itemQuad, 5, 'Vote for Restart-Map');
//Check if Pause exists in current gamemode
$scriptInfos = (array)$this->maniaControl->client->getModeScriptInfo();
$scriptInfos = $this->maniaControl->client->getModeScriptInfo();
$pauseExists = false;
foreach($scriptInfos["commandDescs"] as $param) {
if($param['Name'] == "Command_ForceWarmUp") {
foreach($scriptInfos->commandDescs as $param) {
if($param->name == "Command_ForceWarmUp") {
$pauseExists = true;
break;
}