2014-01-16 16:56:24 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* ManiaPlanet dedicated server Xml-RPC client
|
|
|
|
*
|
|
|
|
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Maniaplanet\DedicatedServer;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dedicated Server Connection Instance
|
|
|
|
* Methods returns nothing if $multicall = true
|
|
|
|
*/
|
|
|
|
class Connection
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
/**
|
|
|
|
* @var Connection[]
|
|
|
|
*/
|
|
|
|
static protected $instances = array();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* XML-RPC client instance
|
|
|
|
* @var Xmlrpc\GbxRemote
|
|
|
|
*/
|
2014-01-16 16:56:24 +01:00
|
|
|
protected $xmlrpcClient;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $host
|
|
|
|
* @param int $port
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $timeout (in ms)
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $user
|
|
|
|
* @param string $password
|
|
|
|
* @return Connection
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
static function factory($host = '127.0.0.1', $port = 5000, $timeout = 50, $user = 'SuperAdmin', $password = 'SuperAdmin')
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
$key = $host.':'.$port;
|
|
|
|
if(!isset(self::$instances[$key]))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
|
|
|
self::$instances[$key] = new self($host, $port, $timeout, $user, $password);
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
return self::$instances[$key];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $host
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param int $port
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
static function delete($host, $port)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
$key = $host.':'.$port;
|
2014-01-16 16:56:24 +01:00
|
|
|
if(isset(self::$instances[$key]))
|
|
|
|
{
|
|
|
|
self::$instances[$key]->terminate();
|
|
|
|
unset(self::$instances[$key]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-19 00:32:34 +02:00
|
|
|
/**
|
|
|
|
* Change client timeouts
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $read read timeout (in ms), null or 0 to leave unchanged
|
|
|
|
* @param int $write write timeout (in ms), null or 0 to leave unchanged
|
2014-04-19 00:32:34 +02:00
|
|
|
*/
|
|
|
|
function setTimeouts($read=null, $write=null)
|
|
|
|
{
|
|
|
|
$this->xmlrpcClient->setTimeouts($read, $write);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return int Network idle time in seconds
|
|
|
|
*/
|
|
|
|
function getIdleTime()
|
|
|
|
{
|
|
|
|
return $this->xmlrpcClient->getIdleTime();
|
|
|
|
}
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
|
|
|
* @param string $host
|
|
|
|
* @param int $port
|
|
|
|
* @param int $timeout
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $user
|
|
|
|
* @param string $password
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
protected function __construct($host, $port, $timeout, $user, $password)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
$this->xmlrpcClient = new Xmlrpc\GbxRemote($host, $port, array('open' => $timeout));
|
|
|
|
$this->authenticate($user, $password);
|
|
|
|
$this->setApiVersion('2013-04-16');
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Close the current socket connexion
|
|
|
|
* Never call this method, use instead DedicatedApi::delete($host, $port)
|
|
|
|
*/
|
|
|
|
protected function terminate()
|
|
|
|
{
|
|
|
|
$this->xmlrpcClient->terminate();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
*
|
|
|
|
* Read a Call back on the DedicatedServer and call the method if handle
|
|
|
|
* @param array $methods if empty, every methods will be called on call back, otherwise only the method declared inside. The metho name must be the name of the interface's method
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function executeCallbacks()
|
|
|
|
{
|
2014-04-19 00:32:34 +02:00
|
|
|
return $this->xmlrpcClient->getCallbacks();
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the calls in queue and return the result
|
2014-05-08 19:32:14 +02:00
|
|
|
* TODO Prendre en compte les retours du mutliQuery (via un handler ?)
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function executeMulticall()
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
$this->xmlrpcClient->multiquery();
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Add a call in queur. It will be executed by the next Call from the user to executemulticall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $methodName
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $authLevel
|
|
|
|
* @param array $params
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
protected function execute($methodName, $params = array(), $multicall = false)
|
2014-01-20 09:24:17 +01:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
if($multicall)
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
$this->xmlrpcClient->addCall($methodName, $params);
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
else
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-04-19 00:32:34 +02:00
|
|
|
return $this->xmlrpcClient->query($methodName, $params);
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Given the name of a method, return an array of legal signatures.
|
|
|
|
* Each signature is an array of strings.
|
|
|
|
* The first item of each signature is the return type, and any others items are parameter types.
|
|
|
|
* @param string $methodName
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function methodSignature($methodName)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute('system.methodSignature', array($methodName));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Change the password for the specified login/user.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $username
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $password
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function changeAuthPassword($username, $password)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($password))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('password = '.print_r($password, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
if($username != 'User' && $username != 'Admin' && $username != 'SuperAdmin')
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('username = '.print_r($username, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($username, $password), false);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allow the GameServer to call you back.
|
|
|
|
* @param bool $enable
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function enableCallbacks($enable, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array((bool) $enable), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the wanted api.
|
|
|
|
* @param string $version
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setApiVersion($version, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array((string) $version), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns a struct with the Name, Version, Build and ApiVersion of the application remotely controled.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\Version
|
2014-05-08 19:32:14 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getVersion()
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
$result = $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
return Structures\Version::fromArray($result);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
function authenticate($username, $password)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($username, $password), false);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Call a vote for a cmd. The command is a XML string corresponding to an XmlRpc request.
|
|
|
|
* You can additionally specifiy specific parameters for this vote: a ratio, a time out
|
|
|
|
* and who is voting. Special timeout values: a timeout of '0' means default, '1' means
|
|
|
|
* indefinite; a ratio of '-1' means default; Voters values: '0' means only active players,
|
|
|
|
* '1' means any player, '2' is for everybody, pure spectators included.
|
|
|
|
* @param Structures\Vote $vote
|
|
|
|
* @param double $ratio -1 means default, else ration should be between 0 and 1
|
|
|
|
* @param int $timeout time to vote in millisecondes, '0' means default
|
|
|
|
* @param int $voters Voters values: '0' means only active players, '1' means any player, '2' is for everybody, pure spectators included
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function callVote(Structures\Vote $vote, $ratio = 0.5, $timeout = 0, $voters = 1, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(is_null($vote))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('vote must be set');
|
|
|
|
}
|
|
|
|
if(!is_float($ratio))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('ratio = '.print_r($ratio, true));
|
|
|
|
}
|
|
|
|
if(!is_int($timeout))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('timeout = '.print_r($timeout, true));
|
|
|
|
}
|
|
|
|
if(!is_int($voters))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('voters = '.print_r($voters, true));
|
|
|
|
}
|
|
|
|
if(!is_array($vote->cmdParam))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('vote->cmdParam = '.print_r($vote->cmdParam, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
$tmpCmd = Xmlrpc\Request::encode($vote->cmdName, $vote->cmdName);
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'Ex', array($tmpCmd, $ratio, $timeout, $voters), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Call a vote to kick a player.
|
|
|
|
* You can additionally specifiy specific parameters for this vote: a ratio, a time out
|
|
|
|
* and who is voting. Special timeout values: a timeout of '0' means default, '1' means
|
|
|
|
* indefinite; a ratio of '-1' means default; Voters values: '0' means only active players,
|
|
|
|
* '1' means any player, '2' is for everybody, pure spectators included.
|
|
|
|
* @param Structures\Player|string $player Structures\Player or string
|
|
|
|
* @param double $ratio -1 means default, else ration should be between 0 and 1
|
|
|
|
* @param int $timeout time to vote in millisecondes, '0' means default
|
|
|
|
* @param int $voters Voters values: '0' means only active players, '1' means any player, '2' is for everybody, pure spectators included
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function callVoteKick($player, $ratio = 0.5, $timeout = 0, $voters = 1, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
|
|
|
if(!is_float($ratio))
|
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('ratio = '.print_r($ratio, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($timeout))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('timeout = '.print_r($timeout, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
if(!is_int($voters))
|
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('voters = '.print_r($voters, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$tmpCmd = Xmlrpc\Request::encode('Kick', array($login));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute('CallVoteEx', array($tmpCmd, $ratio, $timeout, $voters), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Call a vote to ban a player.
|
|
|
|
* You can additionally specifiy specific parameters for this vote: a ratio, a time out
|
|
|
|
* and who is voting. Special timeout values: a timeout of '0' means default, '1' means
|
|
|
|
* indefinite; a ratio of '-1' means default; Voters values: '0' means only active players,
|
|
|
|
* '1' means any player, '2' is for everybody, pure spectators included.
|
|
|
|
* @param Structures\Player|string $player
|
|
|
|
* @param double $ratio -1 means default, else ration should be between 0 and 1
|
|
|
|
* @param int $timeout time to vote in millisecondes, '0' means default
|
|
|
|
* @param int $voters Voters values: '0' means only active players, '1' means any player, '2' is for everybody, pure spectators included
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function callVoteBan($player, $ratio = 0.6, $timeout = 0, $voters = 1, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
|
|
|
if(!is_float($ratio))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('ratio = '.print_r($ratio, true));
|
|
|
|
}
|
|
|
|
if(!is_int($timeout))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('timeout = '.print_r($timeout, true));
|
|
|
|
}
|
|
|
|
if(!is_int($voters))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('voters = '.print_r($voters, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
$tmpCmd = Xmlrpc\Request::encode('Ban', array($login));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute('CallVoteEx', array($tmpCmd, $ratio, $timeout, $voters), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Call a vote to restart the current Map.
|
|
|
|
* You can additionally specifiy specific parameters for this vote: a ratio, a time out
|
|
|
|
* and who is voting. Special timeout values: a timeout of '0' means default, '1' means
|
|
|
|
* indefinite; a ratio of '-1' means default; Voters values: '0' means only active players,
|
|
|
|
* '1' means any player, '2' is for everybody, pure spectators included.
|
|
|
|
* @param double $ratio -1 means default, else ration should be between 0 and 1
|
|
|
|
* @param int $timeout time to vote in millisecondes, '0' means default
|
|
|
|
* @param int $voters Voters values: '0' means only active players, '1' means any player, '2' is for everybody, pure spectators included
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function callVoteRestartMap($ratio = 0.5, $timeout = 0, $voters = 1, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_float($ratio))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('ratio = '.print_r($ratio, true));
|
|
|
|
}
|
|
|
|
if(!is_int($timeout))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('timeout = '.print_r($timeout, true));
|
|
|
|
}
|
|
|
|
if(!is_int($voters))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('voters = '.print_r($voters, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
$tmpCmd = Xmlrpc\Request::encode('RestartMap', array());
|
|
|
|
|
|
|
|
return $this->execute('CallVoteEx', array($tmpCmd, $ratio, $timeout, $voters), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Call a vote to go to the next Map.
|
|
|
|
* You can additionally specifiy specific parameters for this vote: a ratio, a time out
|
|
|
|
* and who is voting. Special timeout values: a timeout of '0' means default, '1' means
|
|
|
|
* indefinite; a ratio of '-1' means default; Voters values: '0' means only active players,
|
|
|
|
* '1' means any player, '2' is for everybody, pure spectators included.
|
|
|
|
* @param double $ratio -1 means default, else ration should be between 0 and 1
|
|
|
|
* @param int $timeout time to vote in millisecondes, '0' means default
|
|
|
|
* @param int $voters Voters values: '0' means only active players, '1' means any player, '2' is for everybody, pure spectators included
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function callVoteNextMap($ratio = 0.5, $timeout = 0, $voters = 1, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_float($ratio))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('ratio = '.print_r($ratio, true));
|
|
|
|
}
|
|
|
|
if(!is_int($timeout))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('timeout = '.print_r($timeout, true));
|
|
|
|
}
|
|
|
|
if(!is_int($voters))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('voters = '.print_r($voters, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
$tmpCmd = Xmlrpc\Request::encode('NextMap', array());
|
|
|
|
|
|
|
|
return $this->execute('CallVoteEx', array($tmpCmd, $ratio, $timeout, $voters), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Used internaly by game.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
protected function internalCallVote($multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cancel the current vote.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function cancelVote($multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the vote currently in progress.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The returned structure is { CallerLogin, CmdName, CmdParam }.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\Vote
|
|
|
|
*/
|
|
|
|
function getCurrentCallVote()
|
|
|
|
{
|
|
|
|
return Structures\Vote::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a new timeout for waiting for votes. A zero value disables callvote.
|
|
|
|
* Requires a map restart to be taken into account
|
|
|
|
* @param int $timeout time to vote in millisecondes, '0' disables callvote
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setCallVoteTimeOut($timeout, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($timeout))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('timeout = '.print_r($timeout, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($timeout), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current and next timeout for waiting for votes.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields 'CurrentValue' and 'NextValue'.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getCallVoteTimeOut()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new default ratio for passing a vote.
|
2014-05-08 19:32:14 +02:00
|
|
|
* Must lie between 0 and 1.
|
|
|
|
* @param double $ratio
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setCallVoteRatio($ratio, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if($ratio !== -1. && !(is_float($ratio) && $ratio >= 0 && $ratio <= 1))
|
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('ratio = '.print_r($ratio, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($ratio), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current default ratio for passing a vote.
|
2014-05-08 19:32:14 +02:00
|
|
|
* This value lies between 0 and 1.
|
|
|
|
* @return double
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getCallVoteRatio()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set new ratios for passing specific votes.
|
|
|
|
* The parameter is an array of associative arrays
|
|
|
|
* {string votecommand, double ratio}, ratio is in [0,1] or -1. for vote disabled.
|
|
|
|
* @example setCallVoteRatios(array(array('Command' => 'Kick', 'Ratio' => -1. ));
|
|
|
|
* @param array $ratios
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setCallVoteRatios(array $ratios, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->setCallVoteRatiosEx(true, $ratios, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the current ratios for passing votes.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function getCallVoteRatios()
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set the ratios list for passing specific votes, extended version with parameters matching.
|
|
|
|
* The parameters, a boolean ReplaceAll (or else, only modify specified ratios, leaving the previous ones unmodified)
|
|
|
|
* and an array of structs {string Command, string Param, double Ratio},
|
|
|
|
* ratio is in [0,1] or -1 for vote disabled.
|
|
|
|
* Param is matched against the vote parameters to make more specific ratios, leave empty to match all votes for the command.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param bool $replaceAll
|
|
|
|
* @param array[array[]]|Structures\VoteRatio[] $ratios
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setCallVoteRatiosEx($replaceAll, array $ratios, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_array($ratios))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('ratios = '.print_r($ratios, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach($ratios as $i => $ratio)
|
|
|
|
{
|
|
|
|
if($ratio instanceof Structures\VoteRatio)
|
|
|
|
{
|
|
|
|
$ratios[$i] = $ratio->toArray();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(!is_array($ratio) && !array_key_exists('Command', $ratio) && !array_key_exists('Ratio', $ratio))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('ratios['.$i.'] = '.print_r($ratio, true));
|
|
|
|
}
|
|
|
|
if(!is_string($ratio['Command']))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('ratios['.$i.'][Command] = '.print_r($ratios['Command'], true));
|
|
|
|
}
|
|
|
|
if($ratio['Ratio'] !== -1. && !(is_float($ratio['Ratio']) && $ratio['Ratio'] >= 0 && $ratio['Ratio'] <= 1))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('ratios['.$i.'][Ratio] = '.print_r($ratio['Ratio'], true));
|
|
|
|
}
|
|
|
|
if(array_key_exists('Param', $ratio) && !is_string($ratio['Param']))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('ratios['.$i.'][Param] = '.print_r($ratio['Param'], true));
|
|
|
|
}
|
|
|
|
elseif(!array_key_exists('Param', $ratio))
|
|
|
|
{
|
|
|
|
$ratio['Param'] = '';
|
|
|
|
$ratios[$i] = $ratio;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($replaceAll, $ratios), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the current ratios for passing votes, extended version with parameters matching.
|
|
|
|
* @return Structures\VoteRatio[]
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getCallVoteRatiosEx()
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return Structures\VoteRatio::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Send a localised text message to specied clients.
|
|
|
|
* The parameter is an array of structures {Lang='??', Text='...'}.
|
|
|
|
* If no matching language is found, the last text in the array is used.
|
|
|
|
* @param array $messages
|
|
|
|
* @param Structures\Player|string|mixed[] $receiver Structures\Player(s) who will receive the message, put null to send the message to everyone
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function chatSendServerMessageToLanguage(array $messages, $receiver = null, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_array($messages))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('messages = '.print_r($messages, true));
|
|
|
|
}
|
|
|
|
if(is_null($receiver))
|
|
|
|
{
|
|
|
|
$receiverString = '';
|
|
|
|
}
|
|
|
|
else if(!($receiverString = $this->getLogins($receiver)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('receiver = '.print_r($receiver, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($messages, $receiverString), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Send a text message without the server login to everyone if players is null.
|
|
|
|
* Players can be a Structures\Player object or an array of Structures\Player
|
|
|
|
* @param string $message
|
|
|
|
* @param Structures\Player|string|mixed[] $receiver Structures\Player(s) who will receive the message, put null to send the message to everyone
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function chatSendServerMessage($message, $receiver = null, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($message))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
$params = array($message);
|
|
|
|
$method = 'ChatSendServerMessage';
|
|
|
|
if(!is_null($receiver))
|
|
|
|
{
|
|
|
|
if(!($logins = $this->getLogins($receiver)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('receiver = '.print_r($receiver, true));
|
|
|
|
}
|
|
|
|
$params[] = $logins;
|
|
|
|
$method .= 'ToLogin';
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->execute($method, $params, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Send a localised text message to selected clients.
|
|
|
|
* The parameter is an array of structures {Lang='??', Text='...'}.
|
|
|
|
* If no matching language is found, the last text in the array is used.
|
|
|
|
* @param array $messages
|
|
|
|
* @param Structures\Player|string|mixed[] $receiver Structures\Player(s) who will receive the message, put null to send the message to everyone
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function chatSendToLanguage(array $messages, $receiver = null, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_array($messages)) throw new InvalidArgumentException('messages = '.print_r($messages, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
if($receiver == null)
|
|
|
|
{
|
|
|
|
$receiverString = '';
|
|
|
|
}
|
|
|
|
else if(!($receiverString = $this->getLogins($receiver)))
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
throw new InvalidArgumentException('receiver = '.print_r($receiver, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-05-08 19:32:14 +02:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($messages, $receiverString), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Send a text message to every Structures\Player or the a specified player(s).
|
|
|
|
* If Structures\Player is null, the message will be delivered to every Structures\Player
|
|
|
|
* @param string $message
|
|
|
|
* @param Structures\Player|string|mixed[] $receiver Structures\Player(s) who will receive the message, put null to send the message to everyone
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function chatSend($message, $receiver, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($message)) throw new InvalidArgumentException('message = '.print_r($message, true));
|
|
|
|
|
|
|
|
$params = array($message);
|
|
|
|
$method = 'ChatSend';
|
|
|
|
if(!is_null($receiver))
|
|
|
|
{
|
|
|
|
if(!($logins = $this->getLogins($receiver)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('players = '.print_r($receiver, true));
|
|
|
|
}
|
|
|
|
$params[] = $logins;
|
|
|
|
$method .= 'ToLogin';
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->execute($method, $params, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the last chat lines. Maximum of 40 lines.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getChatLines()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* The chat messages are no longer dispatched to the players, they only go to the rpc callback
|
|
|
|
* and the controller has to manually forward them. The second (optional) parameter allows all
|
|
|
|
* messages from the server to be automatically forwarded.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $enable
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param bool $serverAutomaticForward
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function chatEnableManualRouting($enable, $serverAutomaticForward = false, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
if(!is_bool($serverAutomaticForward))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('serverAutomaticForward = '.print_r($serverAutomaticForward, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable, $serverAutomaticForward), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* (Text, SenderLogin, DestLogin) Send a text message to the specified DestLogin (or everybody if empty)
|
|
|
|
* on behalf of SenderLogin. DestLogin can be a single login or a list of comma-separated logins.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available if manual routing is enabled.
|
|
|
|
* @param string $message
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param Structures\Player|string $sender
|
|
|
|
* @param Structures\Player|string $receiver
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function chatForwardToLogin($message, $sender, $receiver = null, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($message))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
if(!($senderLogin = $this->getLogin($sender)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('sender must be set');
|
|
|
|
}
|
|
|
|
$receiverLogin = $this->getLogin($receiver) ? : '';
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($message, $senderLogin, $receiverLogin), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Display a notice on the client with the specified UId.
|
|
|
|
* The parameters are :
|
|
|
|
* the Uid of the client to whom the notice is sent,
|
|
|
|
* the text message to display,
|
|
|
|
* the UId of the avatar to display next to it (or '255' for no avatar),
|
|
|
|
* an optional 'max duration' in seconds (default: 3).
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $message
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param Structures\Player|string|mixed[] $receiver
|
|
|
|
* @param Structures\Player|string $player
|
|
|
|
* @param int $variant 0, 1 or 2
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function sendNotice($receiver, $message, $player = null, $variant = 0, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($message))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$params = array();
|
|
|
|
$method = 'SendNotice';
|
|
|
|
if(!is_null($receiver))
|
|
|
|
{
|
|
|
|
if(!($login = $this->getLogins($receiver)))
|
|
|
|
throw new InvalidArgumentException('receiver = '.print_r($receiver, true));
|
|
|
|
else $params[] = $login;
|
|
|
|
|
|
|
|
$method .= 'ToLogin';
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
$params[] = $message;
|
|
|
|
$params[] = $this->getLogin($player) ? : '';
|
|
|
|
$params[] = $variant;
|
|
|
|
return $this->execute($method, $params, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Display a manialink page on the client of the specified Structures\Player(s).
|
|
|
|
* The first parameter is the login of the player,
|
|
|
|
* the other are identical to 'SendDisplayManialinkPage'.
|
|
|
|
* The players can be an object of player Type or an array of Structures\Player object
|
|
|
|
* @param null|Structures\Player|string|mixed[] $playerLogin
|
|
|
|
* @param string $manialink
|
|
|
|
* @param int $timeout
|
|
|
|
* @param bool $hideOnClick
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function sendDisplayManialinkPage($players, $manialink, $timeout, $hideOnClick, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
$params = array();
|
|
|
|
$method = 'SendDisplayManialinkPage';
|
|
|
|
if(!is_null($players))
|
|
|
|
{
|
|
|
|
if(!($login = $this->getLogins($players))) throw new InvalidArgumentException('players = '.print_r($players, true));
|
|
|
|
else $params[] = $login;
|
|
|
|
|
|
|
|
$method .= 'ToLogin';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!is_string($manialink))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('manialink = '.print_r($manialink, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($timeout))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('timeout = '.print_r($timeout, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_bool($hideOnClick))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('hideOnClick = '.print_r($hideOnClick, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
$params[] = $manialink;
|
|
|
|
$params[] = $timeout;
|
|
|
|
$params[] = $hideOnClick;
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute($method, $params, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Hide the displayed manialink page on the client with the specified login.
|
|
|
|
* Login can be a single login or a list of comma-separated logins.
|
|
|
|
* @param null|Structures\Player|string|mixed[] $players
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:32:14 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function sendHideManialinkPage($players = null, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
$params = array();
|
|
|
|
$method = 'SendHideManialinkPage';
|
|
|
|
if(!is_null($players))
|
|
|
|
{
|
|
|
|
if(!($login = $this->getLogins($players))) throw new InvalidArgumentException('players = '.print_r($players, true));
|
|
|
|
else $params[] = $login;
|
|
|
|
|
|
|
|
$method .= 'ToLogin';
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute($method, $params, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns the latest results from the current manialink page,
|
|
|
|
* as an array of structs {string Login, int PlayerId, int Result}
|
|
|
|
* Result==0 -> no answer, Result>0.... -> answer from the player.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getManialinkPageAnswers()
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-04-19 00:32:34 +02:00
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Opens a link in the client with the specified players.
|
|
|
|
* The parameters are the login of the client to whom the link to open is sent, the link url, and the 'LinkType'
|
|
|
|
* (0 in the external browser, 1 in the internal manialink browser).
|
|
|
|
* Login can be a single login or a list of comma-separated logins. Only available to
|
|
|
|
* @param Structures\Player|string|mixed[] $player
|
|
|
|
* @param string $link
|
|
|
|
* @param int $linkType
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function sendOpenLink($player, $link, $linkType, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogins($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($link))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('link = '.print_r($link, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if($linkType !== 0 && $linkType !== 1)
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('linkType = '.print_r($linkType, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-04-19 00:32:34 +02:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute('SendOpenLinkToLogin', array($login, $link, $linkType), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Kick the player with an optional message.
|
|
|
|
* @param Structures\Player|string $playerLogin
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $message
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function kick($player, $message = '', $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($message))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute('Kick', array($login, $message), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Ban the player with an optional message.
|
|
|
|
* @param Structures\Player|string $player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $message
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function ban($player, $message = '', $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($message))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute('Ban', array($login, $message), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Ban the player with a message.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Add it to the black list, and optionally save the new list.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param Structures\Player|string $player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $message
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param bool $saveList
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function banAndBlackList($player, $message, $saveList = false, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
|
|
|
if(!is_string($message) || !$message)
|
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
if(!is_bool($saveList))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('saveList = '.print_r($saveList, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login, $message, $saveList), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Unban the player
|
|
|
|
* @param Structures\Player|string $player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function unBan($player, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clean the ban list of the server.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function cleanBanList($multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns the list of banned players. This method takes two parameters.
|
|
|
|
* The first parameter specifies the maximum number of infos to be returned,
|
|
|
|
* the second one the starting index in the list. The list is an array of structures.
|
|
|
|
* Each structure contains the following fields : Login, ClientName and IPAddress.
|
|
|
|
* @param int $length specifies the maximum number of infos to be returned
|
|
|
|
* @param int $offset specifies the starting index in the list
|
|
|
|
* @return Structures\Player[] The list is an array of Structures\Player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function getBanList($length, $offset)
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($length)) throw new InvalidArgumentException('length = '.print_r($length, true));
|
|
|
|
if(!is_int($offset)) throw new InvalidArgumentException('offset = '.print_r($offset, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
$result = $this->execute(ucfirst(__FUNCTION__), array($length, $offset));
|
|
|
|
return Structures\Player::fromArrayOfArray($result);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Blacklist the player
|
|
|
|
* @param Structures\Player|string $player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function blackList($player, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* UnBlackList the player
|
|
|
|
* @param Structures\Player|string $player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function unBlackList($player, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clean the blacklist of the server.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function cleanBlackList($multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the list of blacklisted players.
|
2014-05-08 19:32:14 +02:00
|
|
|
* This method takes two parameters.
|
|
|
|
* The first parameter specifies the maximum number of infos to be returned,
|
|
|
|
* the second one the starting index in the list. The list is an array of structures.
|
|
|
|
* Each structure contains the following fields : Login.
|
|
|
|
* @param int $length specifies the maximum number of infos to be returned
|
|
|
|
* @param int $offset specifies the starting index in the list
|
|
|
|
* @return Structures\Player[] The list is an array of structures. Each structure contains the following fields : Login.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function getBlackList($length, $offset)
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($length)) throw new InvalidArgumentException('length = '.print_r($length, true));
|
|
|
|
if(!is_int($offset)) throw new InvalidArgumentException('offset = '.print_r($offset, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
$result = $this->execute(ucfirst(__FUNCTION__), array($length, $offset));
|
|
|
|
return Structures\Player::fromArrayOfArray($result);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load the black list file with the specified file name.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $filename blackList file name
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function loadBlackList($filename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($filename)) throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save the black list in the file with specified file name.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $filename blackList filename
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function saveBlackList($filename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($filename)) throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Add the player to the guest list.
|
|
|
|
* @param Structures\Player|string $player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function addGuest($player, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Remove the player from the guest list.
|
|
|
|
* @param Structures\Player|string $player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function removeGuest($player, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clean the guest list of the server.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function cleanGuestList($multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the list of players on the guest list.
|
2014-05-08 19:32:14 +02:00
|
|
|
* This method takes two parameters.
|
|
|
|
* The first parameter specifies the maximum number of infos to be returned,
|
|
|
|
* the second one the starting index in the list. The list is an array of structures.
|
|
|
|
* Each structure contains the following fields : Login.
|
|
|
|
* @param int $length specifies the maximum number of infos to be returned
|
|
|
|
* @param int $offset specifies the starting index in the list
|
|
|
|
* @return Structures\Player[] The list is an array of structures. Each structure contains the following fields : Login.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function getGuestList($length, $offset)
|
|
|
|
{
|
|
|
|
if(!is_int($length))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('length = '.print_r($length, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($offset))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('offset = '.print_r($offset, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
$result = $this->execute(ucfirst(__FUNCTION__), array($length, $offset));
|
|
|
|
return Structures\Player::fromArrayOfArray($result);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
*
|
2014-01-16 16:56:24 +01:00
|
|
|
* Load the guest list file with the specified file name.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $filename blackList file name
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function loadGuestList($filename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save the guest list in the file with specified file name.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $filename blackList file name
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function saveGuestList($filename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether buddy notifications should be sent in the chat.
|
2014-05-08 19:32:14 +02:00
|
|
|
* login is the login of the player, or '' for global setting,
|
|
|
|
* enabled is the value.
|
|
|
|
* @param null|Structures\Player|string $player the player, or null for global setting
|
|
|
|
* @param bool $enable the value.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setBuddyNotification($player, $enable, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$player = $this->getLogin($player) ? : '';
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($player, $enable), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Gets whether buddy notifications are enabled for login, or '' to get the global setting.
|
|
|
|
* @param null|Structures\Player|string $player the player, or null for global setting
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function getBuddyNotification($player)
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
$player = $this->getLogin($player) ? : '';
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($player));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Write the data to the specified file. The filename is relative to the Tracks path
|
|
|
|
* @param string $filename The file to be written
|
|
|
|
* @param string $localFilename The file to be read to obtain the data
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function writeFile($filename, $localFilename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
if(!file_exists($localFilename))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('localFilename = '.print_r($localFilename, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
$inputData = file_get_contents($localFilename);
|
|
|
|
$data = new Xmlrpc\Base64($inputData);
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename, $data), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Write the data to the specified file. The filename is relative to the Tracks path
|
|
|
|
* @param string $filename The file to be written
|
|
|
|
* @param string $data the data to be written
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function writeFileFromString($filename, $data, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($filename))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
$data = new Xmlrpc\Base64($data);
|
|
|
|
|
|
|
|
return $this->execute('WriteFile', array($filename, $data), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Send the data to the specified player.
|
|
|
|
* Login can be a single login or a list of comma-separated logins.
|
|
|
|
* @param Structures\Player|string|mixed[] $players
|
|
|
|
* @param string $filename
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function tunnelSendData($players, $filename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogins($players)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('players = '.print_r($players, true));
|
|
|
|
}
|
|
|
|
if(!file_exists($filename))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
$inputData = file_get_contents($filename);
|
|
|
|
$data = new Xmlrpc\Base64($inputData);
|
|
|
|
|
|
|
|
return $this->execute('TunnelSendDataToLogin', array($login, $data), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Send the data to the specified player.
|
|
|
|
* Login can be a single login or a list of comma-separated logins.
|
|
|
|
* @param Structures\Player|string|mixed[] $players
|
|
|
|
* @param string $data
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function tunnelSendDataFromString($players, $data, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogins($players)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('players = '.print_r($players, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
$data = new Xmlrpc\Base64($data);
|
|
|
|
|
|
|
|
return $this->execute('TunnelSendDataToLogin', array($login, $data), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Just log the parameters and invoke a callback.
|
|
|
|
* Can be used to talk to other xmlrpc clients connected, or to make custom votes.
|
|
|
|
* If used in a callvote, the first parameter will be used as the vote message on the clients.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $message the message to log
|
|
|
|
* @param string $callback optionnal callback name
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function dedicatedEcho($message, $callback = '', $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($message))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($callback))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('callback = '.print_r($callback, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute('Echo', array($message, $callback), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Ignore the specified Structures\Player.
|
|
|
|
* @param Structures\Player|string $player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function ignore($player, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Unignore the specified player.
|
|
|
|
* @param Structures\Player|string $player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function unIgnore($player, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clean the ignore list of the server.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function cleanIgnoreList($multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns the list of ignored players. This method takes two parameters.
|
|
|
|
* The first parameter specifies the maximum number of infos to be returned,
|
|
|
|
* the second one the starting index in the list. The list is an array of structures.
|
|
|
|
* Each structure contains the following fields : Login.
|
|
|
|
* @param int $length specifies the maximum number of infos to be returned
|
|
|
|
* @param int $offset specifies the starting index in the list
|
|
|
|
* @return Structures\Player[] The list is an array of structures. Each structure contains the following fields : Login.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function getIgnoreList($length, $offset)
|
|
|
|
{
|
|
|
|
if(!is_int($length))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('length = '.print_r($length, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($offset))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('offset = '.print_r($offset, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
$result = $this->execute(ucfirst(__FUNCTION__), array($length, $offset));
|
|
|
|
return Structures\Player::fromArrayOfArray($result);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Pay coppers from the server account to a player, returns the BillId.
|
|
|
|
* This method takes three parameters:
|
|
|
|
* Login of the payee,
|
|
|
|
* Coppers to pay and
|
|
|
|
* Label to send with the payment.
|
|
|
|
* The creation of the transaction itself may cost coppers,
|
|
|
|
* so you need to have coppers on the server account.
|
|
|
|
* @param Structures\Player|string $player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param int $amount
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $label
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return int The Bill Id
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function pay($player, $amount, $label, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($amount) || $amount < 1)
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('amount = '.print_r($amount, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
if(!is_string($label))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('label = '.print_r($label, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login, $amount, $label), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a bill, send it to a player, and return the BillId.
|
2014-05-08 19:32:14 +02:00
|
|
|
* This method takes four parameters:
|
|
|
|
* LoginFrom of the payer,
|
|
|
|
* Coppers the player has to pay,
|
|
|
|
* Label of the transaction and
|
|
|
|
* optional LoginTo of the payee (if empty string, then the server account is used).
|
|
|
|
* The creation of the transaction itself may cost coppers,
|
|
|
|
* so you need to have coppers on the server account.
|
|
|
|
* @param Structures\Player|string $fromPlayer
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param int $amount
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $label
|
|
|
|
* @param Structures\Player|string|null $toPlayer
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function sendBill($fromPlayer, $amount, $label, $toPlayer = null, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($amount) || $amount < 1)
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('amount = '.print_r($amount, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
if(!is_string($label))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('label = '.print_r($label, true));
|
|
|
|
}
|
|
|
|
if(!($from = $this->getLogin($fromPlayer)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('fromPlayer must be set');
|
|
|
|
}
|
|
|
|
|
|
|
|
$to = $this->getLogin($toPlayer) ? : '';
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($from, $amount, $label, $to), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current state of a bill.
|
2014-05-08 19:32:14 +02:00
|
|
|
* This method takes one parameter, the BillId.
|
|
|
|
* Returns a struct containing
|
|
|
|
* State, StateName and TransactionId.
|
|
|
|
* Possible enum values are: CreatingTransaction, Issued, ValidatingPayement, Payed, Refused, Error.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param int $billId
|
|
|
|
* @return Structures\Bill
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function getBillState($billId)
|
|
|
|
{
|
|
|
|
if(!is_int($billId))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('billId = '.print_r($billId, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
$result = $this->execute(ucfirst(__FUNCTION__), array($billId));
|
|
|
|
return Structures\Bill::fromArray($result);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current number of planets on the server account.
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
function getServerPlanets()
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute('GetServerPlanets');
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get some system infos.
|
|
|
|
* Return a struct containing:
|
|
|
|
* PublishedIp, Port, P2PPort, ServerLogin, ServerPlayerId
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\SystemInfos
|
|
|
|
*/
|
|
|
|
function getSystemInfo()
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
$result = $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
return Structures\SystemInfos::fromArray($result);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Sets up- and download speed for the server in kbps.
|
|
|
|
* @param int $downloadRate the download rate in kbps
|
|
|
|
* @param int $uploadRate the upload rate in kbps
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setConnectionRates($downloadRate, $uploadRate, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($downloadRate))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('downloadRate = '.print_r($downloadRate, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($uploadRate))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('uploadRate = '.print_r($uploadRate, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($downloadRate, $uploadRate), $multicall);
|
|
|
|
}
|
2014-04-19 00:32:34 +02:00
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
2014-04-19 00:32:34 +02:00
|
|
|
* Returns the list of tags and associated values set on this server.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The list is an array of structures {string Name, string Value}.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getServerTags()
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-04-19 00:32:34 +02:00
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a tag and its value on the server. This method takes two parameters.
|
|
|
|
* The first parameter specifies the name of the tag, and the second one its value.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $key
|
|
|
|
* @param string $value
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setServerTag($key, $value, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($key))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('key = '.print_r($key, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($value))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('value = '.print_r($value, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($key, $value), $multicall);
|
|
|
|
}
|
2014-04-19 00:32:34 +02:00
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
2014-04-19 00:32:34 +02:00
|
|
|
* Unset the tag with the specified name on the server.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $key
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function unsetServerTag($key, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($key))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('key = '.print_r($key, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($key), $multicall);
|
|
|
|
}
|
2014-04-19 00:32:34 +02:00
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
2014-04-19 00:32:34 +02:00
|
|
|
* Reset all tags on the server.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function resetServerTags($multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new server name in utf8 format.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $serverName
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setServerName($serverName, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($serverName))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('serverName = '.print_r($serverName, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($serverName), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the server name in utf8 format.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function getServerName()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new server comment in utf8 format.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $serverComment
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setServerComment($serverComment, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($serverComment))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('serverComment = '.print_r($serverComment, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($serverComment), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the server comment in utf8 format.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function getServerComment()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set whether the server should be hidden from the public server list
|
|
|
|
* (0 = visible, 1 = always hidden, 2 = hidden from nations).
|
|
|
|
* @param int $visibility
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setHideServer($visibility, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if($visibility !== 0 && $visibility !== 1 && $visibility !== 2)
|
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('visibility = '.print_r($visibility, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($visibility), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get whether the server wants to be hidden from the public server list.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return string
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getHideServer()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this is a relay server.
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
function isRelayServer()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new password for the server.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $serverPassword
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setServerPassword($serverPassword, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($serverPassword))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('serverPassword = '.print_r($serverPassword, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($serverPassword), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the server password if called as Admin or Super Admin, else returns if a password is needed or not.
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the server name in utf8 format.
|
|
|
|
* @return bool|string
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getServerPassword()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new password for the spectator mode.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $serverPassword
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setServerPasswordForSpectator($serverPassword, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($serverPassword))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('serverPassword = '.print_r($serverPassword, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($serverPassword), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the password for spectator mode if called as Admin or Super Admin, else returns if a password is needed or not.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool|string
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getServerPasswordForSpectator()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new maximum number of players.
|
|
|
|
* Requires a map restart to be taken into account.
|
|
|
|
* @param int $maxPlayers
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setMaxPlayers($maxPlayers, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($maxPlayers))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('maxPlayers = '.print_r($maxPlayers, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($maxPlayers), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current and next maximum number of players allowed on server.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getMaxPlayers()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new maximum number of spectators.
|
|
|
|
* Requires a map restart to be taken into account.
|
|
|
|
* @param int $maxSpectators
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setMaxSpectators($maxSpectators, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($maxSpectators))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('maxPlayers = '.print_r($maxSpectators, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($maxSpectators), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the current and next maximum number of spectators allowed on server.
|
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getMaxSpectators()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Declare if the server is a lobby, the number and maximum number of players currently managed by it, and the average level of the players.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param bool $isLobby
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $lobbyPlayers
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param int $maxPlayers
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param double $lobbyPlayersLevel
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setLobbyInfo($isLobby, $lobbyPlayers, $maxPlayers, $lobbyPlayersLevel, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($isLobby))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('isLobby = '.print_r($isLobby, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
if(!is_int($lobbyPlayers))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('lobbyPlayers = '.print_r($lobbyPlayers, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($maxPlayers))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('maxPlayers = '.print_r($maxPlayers, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
if(!is_double($lobbyPlayersLevel))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('lobbyPlayersLevel = '.print_r($lobbyPlayersLevel, true));
|
|
|
|
}
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($isLobby, $lobbyPlayers, $maxPlayers, $lobbyPlayersLevel), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-19 00:32:34 +02:00
|
|
|
* Get whether the server if a lobby, the number and maximum number of players currently managed by it.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains 4 fields IsLobby, LobbyPlayers, LobbyMaxPlayers, and LobbyPlayersLevel.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\LobbyInfo
|
|
|
|
*/
|
|
|
|
function getLobbyInfo()
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
$result = $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
return Structures\LobbyInfo::fromArray($result);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-04-19 00:32:34 +02:00
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
2014-04-19 00:32:34 +02:00
|
|
|
* Customize the clients 'leave server' dialog box.
|
2014-05-08 19:32:14 +02:00
|
|
|
* Parameters are: ManialinkPage, SendToServer url '#qjoin=login@title',
|
|
|
|
* ProposeAddToFavorites and DelayQuitButton (in milliseconds).
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $manialinkPage
|
|
|
|
* @param string $sendToServer
|
|
|
|
* @param bool $proposeAddToFavorites
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function customizeQuitDialog($manialinkPage, $sendToServer, $proposeAddToFavorites, $delayQuitButton, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($manialinkPage))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('manialinkPage = '.print_r($manialinkPage, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($sendToServer))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('sendToServer = '.print_r($sendToServer, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
if(!is_bool($proposeAddToFavorites))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('proposeAddToFavorites = '.print_r($proposeAddToFavorites, true));
|
|
|
|
}
|
|
|
|
if(!is_int($delayQuitButton))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('delayQuitButton = '.print_r($delayQuitButton, true));
|
|
|
|
}
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($manialinkPage, $sendToServer, $proposeAddToFavorites, $delayQuitButton), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set whether, when a player is switching to spectator, the server should still consider him a player
|
|
|
|
* and keep his player slot, or not. Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $keep
|
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:28:45 +02:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function keepPlayerSlots($keep, $multicall = false)
|
2014-05-08 19:28:45 +02:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_bool($keep))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('keep = '.print_r($keep, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($keep), $multicall);
|
2014-05-08 19:28:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get whether the server keeps player slots when switching to spectator.
|
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function isKeepingPlayerSlots()
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Enable or disable peer-to-peer upload from server.
|
|
|
|
* @param bool $enable
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function enableP2PUpload($enable, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_bool($enable))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns if the peer-to-peer upload from server is enabled.
|
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function isP2PUpload()
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Enable or disable peer-to-peer download from server.
|
|
|
|
* @param bool $enable
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function enableP2PDownload($enable, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_bool($enable))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns if the peer-to-peer download from server is enabled.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function isP2PDownload()
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Allow clients to download maps from the server.
|
|
|
|
* @param bool $allow
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function allowMapDownload($allow, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_bool($allow))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('allow = '.print_r($allow, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($allow), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns if clients can download maps from the server.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function isMapDownloadAllowed()
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Enable the autosaving of all replays (vizualisable replays with all players,
|
|
|
|
* but not validable) on the server.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $enable
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function autoSaveReplays($enable, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
|
|
|
}
|
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
/**
|
|
|
|
* Returns if autosaving of all replays is enabled on the server.
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
function isAutoSaveReplaysEnabled()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
|
|
|
* Enable the autosaving on the server of validation replays, every time a player makes a new time.
|
|
|
|
* @param bool $enable
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function autoSaveValidationReplays($enable, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if autosaving of validation replays is enabled on the server.
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
function isAutoSaveValidationReplaysEnabled()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Saves the current replay (vizualisable replays with all players, but not validable).
|
2014-05-08 19:32:14 +02:00
|
|
|
* Pass a filename, or '' for an automatic filename.
|
|
|
|
* @param string $filename
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function saveCurrentReplay($filename = '', $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Saves a replay with the ghost of all the players' best race.
|
2014-05-08 19:32:14 +02:00
|
|
|
* First parameter is the player object(or null for all players),
|
|
|
|
* Second parameter is the filename, or '' for an automatic filename.
|
|
|
|
* @param null|Structures\Player|string $player the player (or null for all players)
|
|
|
|
* @param string $filename is the filename, or '' for an automatic filename
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function saveBestGhostsReplay($player = null, $filename = '', $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
$playerLogin = $this->getLogin($player) ? : '';
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($playerLogin, $filename), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a replay containing the data needed to validate the current best time of the player.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The parameter is the login of the player.
|
|
|
|
* @param Structures\Player|string $player
|
2014-04-19 00:32:34 +02:00
|
|
|
* @return string
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function getValidationReplay($player)
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
2014-04-19 00:32:34 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login))->scalar;
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a new ladder mode between ladder disabled (0) and forced (1).
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $mode
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setLadderMode($mode, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if($mode !== 0 && $mode !== 1)
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('mode = '.print_r($mode, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($mode), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current and next ladder mode on server.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getLadderMode()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the ladder points limit for the players allowed on this server.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields LadderServerLimitMin and LadderServerLimitMax.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getLadderServerLimits()
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set the network vehicle quality to Fast (0) or High (1).
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $quality
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setVehicleNetQuality($quality, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if($quality !== 0 && $quality !== 1)
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('quality = '.print_r($quality, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($quality), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current and next network vehicle quality on server.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getVehicleNetQuality()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set new server options using the struct passed as parameters. This struct must contain the following fields :
|
|
|
|
* Name, Comment, Password, PasswordForSpectator, NextMaxPlayers, NextMaxSpectators, IsP2PUpload, IsP2PDownload,
|
|
|
|
* NextLadderMode, NextVehicleNetQuality, NextCallVoteTimeOut, CallVoteRatio, AllowMapDownload, AutoSaveReplays,
|
|
|
|
*
|
|
|
|
* and optionally for forever:
|
|
|
|
* RefereePassword, RefereeMode, AutoSaveValidationReplays, HideServer, UseChangingValidationSeed,
|
|
|
|
* ClientInputsMaxLatency, KeepPlayerSlots.
|
|
|
|
*
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
2014-05-08 19:32:14 +02:00
|
|
|
* A change of NextMaxPlayers, NextMaxSpectators, NextLadderMode, NextVehicleNetQuality, NextCallVoteTimeOut
|
|
|
|
* or UseChangingValidationSeed requires a map restart to be taken into account.
|
|
|
|
* @param array $options
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setServerOptions(array $options, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_array($options) || !array_key_exists('Name', $options) || !array_key_exists('Comment', $options)
|
|
|
|
|| !array_key_exists('Password', $options) || !array_key_exists('PasswordForSpectator', $options)
|
|
|
|
|| !array_key_exists('NextCallVoteTimeOut', $options) || !array_key_exists('CallVoteRatio', $options)
|
|
|
|
|| (array_key_exists('IsP2PUpload', $options) xor array_key_exists('IsP2PDownload', $options))
|
|
|
|
|| (array_key_exists('NextMaxPlayer', $options) xor array_key_exists('NextMaxSpectator', $options))
|
|
|
|
|| (array_key_exists('RefereePassword', $options) xor array_key_exists('RefereeMode', $options)))
|
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('options = '.print_r($options, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($options), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns a struct containing the server options:
|
|
|
|
* Name, Comment, Password, PasswordForSpectator, CurrentMaxPlayers, NextMaxPlayers, CurrentMaxSpectators,
|
|
|
|
* NextMaxSpectators, KeepPlayerSlots, IsP2PUpload, IsP2PDownload, CurrentLadderMode, NextLadderMode,
|
|
|
|
* CurrentVehicleNetQuality, NextVehicleNetQuality, CurrentCallVoteTimeOut, NextCallVoteTimeOut, CallVoteRatio,
|
|
|
|
* AllowMapDownload, AutoSaveReplays, RefereePassword, RefereeMode, AutoSaveValidationReplays, HideServer,
|
|
|
|
* CurrentUseChangingValidationSeed, NextUseChangingValidationSeed, ClientInputsMaxLatency.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\ServerOptions
|
2014-05-08 19:32:14 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getServerOptions()
|
|
|
|
{
|
|
|
|
return Structures\ServerOptions::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set whether the players can choose their side or if the teams are forced by the server (using ForcePlayerTeam()).
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param bool $enable
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setForcedTeams($enable, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether the players can choose their side or if the teams are forced by the server.
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
function getForcedTeams()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Defines the packmask of the server. Can be 'United', 'Nations', 'Sunrise', 'Original',
|
|
|
|
* or any of the environment names. (Only maps matching the packmask will be
|
|
|
|
* allowed on the server, so that player connecting to it know what to expect.)
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available when the server is stopped.
|
|
|
|
* @param string $packMask
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setServerPackMask($packMask, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($packMask))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('packMask = '.print_r($packMask, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($packMask), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the packmask of the server.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function getServerPackMask()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set the mods to apply on the clients. Parameters:
|
|
|
|
* Override, if true even the maps with a mod will be overridden by the server setting;
|
|
|
|
* Mods, an array of structures [{EnvName, Url}, ...].
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param bool $override
|
|
|
|
* @param array $mods
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setForcedMods($override, $mods, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($override))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('override = '.print_r($override, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(is_array($mods))
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
$modList = array();
|
|
|
|
foreach($mods as $mod)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($mod instanceof Structures\Mod)) throw new InvalidArgumentException('mods = '.print_r($mods, true));
|
|
|
|
else $modList[] = $mod->toArray();
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
}
|
2014-05-08 19:32:14 +02:00
|
|
|
elseif($mods instanceof Structures\Mod) $modList = array($mods->toArray());
|
|
|
|
else throw new InvalidArgumentException('mods = '.print_r($mods, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($override, $modList), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the mods settings.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return array the first value is a boolean which indicate if the mods override existing mods, the second is an array of objet of Structures\Mod type
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getForcedMods()
|
|
|
|
{
|
|
|
|
$result = $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
$result['Mods'] = Structures\Mod::fromArrayOfArray($result['Mods']);
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set the music to play on the clients. Parameters:
|
|
|
|
* Override, if true even the maps with a custom music will be overridden by the server setting,
|
|
|
|
* UrlOrFileName for the music.
|
|
|
|
* Requires a map restart to be taken into account
|
|
|
|
* @param bool $override
|
|
|
|
* @param string $music
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setForcedMusic($override, $music, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($override))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('override = '.print_r($override, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($music))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('music = '.print_r($music, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($override, $music), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the music setting.
|
|
|
|
* @return Structures\Music
|
|
|
|
*/
|
|
|
|
function getForcedMusic()
|
|
|
|
{
|
|
|
|
return Structures\Music::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Defines a list of remappings for player skins. It expects a list of structs Orig, Name, Checksum, Url.
|
|
|
|
* Orig is the name of the skin to remap, or '*' for any other. Name, Checksum, Url define the skin to use.
|
|
|
|
* (They are optional, you may set value '' for any of those. All 3 null means same as Orig).
|
2014-01-16 16:56:24 +01:00
|
|
|
* Will only affect players connecting after the value is set.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param Structures\Skin[] $skins
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setForcedSkins(array $skins, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_array($skins))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('skins = '.print_r($skins, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
$skinParameter = array();
|
|
|
|
foreach($skins as $key => $skin)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if($skin instanceof Structures\Skin)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
$skinParameter[$key] = array();
|
|
|
|
$skinParameter[$key]['Orig'] = $skin->orig;
|
|
|
|
$skinParameter[$key]['Name'] = $skin->name;
|
|
|
|
$skinParameter[$key]['Checksum'] = $skin->checksum;
|
|
|
|
$skinParameter[$key]['Url'] = $skin->url;
|
|
|
|
}
|
|
|
|
elseif(!is_array($skin) || !array_key_exists('Orig', $skin) && !array_key_exists('Name', $skin) && !array_key_exists('Checksum',
|
|
|
|
$skin) && !array_key_exists('Url', $skin))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('skins['.$key.'] = '.print_r($skins[$key], true));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$skinParameter[$key] = $skin;
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($skinParameter), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current forced skins.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return Structures\Skin[]
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getForcedSkins()
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return Structures\Skin::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the last error message for an internet connection.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function getLastConnectionErrorMessage()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new password for the referee mode.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $refereePassword
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setRefereePassword($refereePassword, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($refereePassword))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('refereePassword = '.print_r($refereePassword, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($refereePassword), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the password for referee mode if called as Admin or Super Admin,
|
|
|
|
* else returns if a password is needed or not.
|
|
|
|
* @return bool|string
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getRefereePassword()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set the referee validation mode. 0 = validate the top3 players, 1 = validate all players. Only available to Admin.
|
|
|
|
* @param int $refereeMode
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setRefereeMode($refereeMode, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if($refereeMode !== 0 && $refereeMode !== 1)
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('refereeMode = '.print_r($refereeMode, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($refereeMode), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the referee validation mode.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool|string
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getRefereeMode()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set whether the game should use a variable validation seed or not.
|
|
|
|
* Requires a map restart to be taken into account.
|
|
|
|
* @param bool $enable
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setUseChangingValidationSeed($enable, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current and next value of UseChangingValidationSeed.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getUseChangingValidationSeed()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the maximum time the server must wait for inputs from the clients before dropping data, or '0' for auto-adaptation.
|
2014-05-08 19:32:14 +02:00
|
|
|
* Only used by ShootMania. Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param int $latency
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setClientInputsMaxLatency($latency, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($latency))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('latency = '.print_r($latency, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($latency), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the current ClientInputsMaxLatency. Only used by ShootMania.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
function getClientInputsMaxLatency()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether the server is in warm-up phase or not.
|
|
|
|
* @param bool $enable
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setWarmUp($enable, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether the server is in warm-up phase.
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
function getWarmUp()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the current rules script.
|
|
|
|
* TODO Check if correct
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function getModeScriptText()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set the rules script and restart.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
2014-05-08 19:32:14 +02:00
|
|
|
* TODO Check if correct
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $script
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setModeScriptText($script, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($script), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the xml-rpc variables of the mode script.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function getModeScriptVariables()
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:28:45 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set the variables of the rules script. Only available to Admin.
|
|
|
|
* @param array $variables
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setModeScriptVariables($variables, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($variables), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Send an event to the mode script. Only available to Admin.
|
|
|
|
* @param string $param1
|
|
|
|
* @param string $param2
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function triggerModeScriptEvent($param1, $param2, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($param1))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('param1 = '.print_r($param1, true));
|
|
|
|
}
|
|
|
|
if(!is_string($param2))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('param2 = '.print_r($param2, true));
|
|
|
|
}
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($param1, $param2), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Send an event to the mode script. Only available to Admin.
|
|
|
|
* @param string $param1
|
|
|
|
* @param mixed[] $param2
|
2014-05-08 19:28:45 +02:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function triggerModeScriptEventArray($param1, $param2, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($param1))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('param1 = '.print_r($param1, true));
|
|
|
|
}
|
|
|
|
if(!is_array($param2))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('param2 = '.print_r($param2, true));
|
|
|
|
}
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($param1, $param2), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns the description of the current rules script,
|
|
|
|
* as a structure containing: Name, CompatibleTypes,
|
|
|
|
* Description and the settings available.
|
|
|
|
* @return Structures\ScriptInfo
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function getModeScriptInfo()
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return Structures\ScriptInfo::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns the current parameters of the mode script.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function getModeScriptSettings()
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-04-19 00:32:34 +02:00
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set the parameters of the rules script. Only available to Admin.
|
|
|
|
* @param array $rules
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setModeScriptSettings($rules, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($rules), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-04-19 00:32:34 +02:00
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Send commands to the mode script.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param array $commands
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function sendModeScriptCommands(array $commands, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($commands), $multicall);
|
2014-05-08 19:28:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Change the settings and send commands to the mode script.
|
2014-05-08 19:28:45 +02:00
|
|
|
* Only available to Admin.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param array $settings
|
|
|
|
* @param array $commands
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setModeScriptSettingsAndCommands(array $settings, array $commands, $multicall = false)
|
2014-05-08 19:28:45 +02:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($settings, $commands), $multicall);
|
2014-05-08 19:28:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Restarts the map, with an optional boolean parameter DontClearCupScores (only available in cup mode).
|
|
|
|
* @param bool $dontClearCupScores
|
2014-05-08 19:28:45 +02:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:32:14 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:28:45 +02:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function restartMap($dontClearCupScores = false, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($dontClearCupScores))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('dontClearCupScores = '.print_r($dontClearCupScores, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($dontClearCupScores), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Switch to next map, with an optional boolean parameter DontClearCupScores (only available in cup mode).
|
|
|
|
* @param bool $dontClearCupScores
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:32:14 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function nextMap($dontClearCupScores = false, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($dontClearCupScores))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('dontClearCupScores = '.print_r($dontClearCupScores, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($dontClearCupScores), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Attempt to balance teams. Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function autoTeamBalance()
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stop the server.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function stopServer($multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* In Rounds or Laps mode, force the end of round without waiting for all players to giveup/finish.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function forceEndRound($multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set new game settings using the struct passed as parameters.
|
2014-05-08 19:32:14 +02:00
|
|
|
* This struct must contain the following fields :
|
|
|
|
* GameMode, ChatTime, RoundsPointsLimit, RoundsUseNewRules, RoundsForcedLaps, TimeAttackLimit,
|
|
|
|
* TimeAttackSynchStartPeriod, TeamPointsLimit, TeamMaxPoints, TeamUseNewRules, LapsNbLaps, LapsTimeLimit,
|
|
|
|
* FinishTimeout, and optionally: AllWarmUpDuration, DisableRespawn, ForceShowAllOpponents, RoundsPointsLimitNewRules,
|
|
|
|
* TeamPointsLimitNewRules, CupPointsLimit, CupRoundsPerMap, CupNbWinners, CupWarmUpDuration.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
|
|
|
* @param Structures\GameInfos $gameInfos
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setGameInfos(Structures\GameInfos $gameInfos, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($gameInfos->toArray()), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Optional parameter for compatibility:
|
|
|
|
* struct version (0 = united, 1 = forever).
|
|
|
|
* Returns a struct containing the current game settings, ie:
|
|
|
|
* GameMode, ChatTime, NbMap, RoundsPointsLimit, RoundsUseNewRules, RoundsForcedLaps,
|
|
|
|
* TimeAttackLimit, TimeAttackSynchStartPeriod, TeamPointsLimit, TeamMaxPoints, TeamUseNewRules,
|
|
|
|
* LapsNbLaps, LapsTimeLimit, FinishTimeout,
|
|
|
|
* additionally for version 1: AllWarmUpDuration, DisableRespawn, ForceShowAllOpponents, RoundsPointsLimitNewRules,
|
|
|
|
* TeamPointsLimitNewRules, CupPointsLimit, CupRoundsPerMap, CupNbWinners, CupWarmUpDuration.
|
|
|
|
* @param int $compatibility
|
2014-05-08 19:28:45 +02:00
|
|
|
* @return Structures\GameInfos
|
2014-05-08 19:32:14 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:28:45 +02:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function getCurrentGameInfo($compatibility = 1)
|
2014-05-08 19:28:45 +02:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if($compatibility !== 1 && $compatibility != 0)
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('compatibility = '.print_r($compatibility, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
return Structures\GameInfos::fromArray($this->execute(ucfirst(__FUNCTION__), array($compatibility)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Optional parameter for compatibility:
|
|
|
|
* struct version (0 = united, 1 = forever).
|
|
|
|
* Returns a struct containing the game settings for the next map, ie:
|
|
|
|
* GameMode, ChatTime, NbMap, RoundsPointsLimit, RoundsUseNewRules, RoundsForcedLaps,
|
|
|
|
* TimeAttackLimit, TimeAttackSynchStartPeriod, TeamPointsLimit, TeamMaxPoints, TeamUseNewRules,
|
|
|
|
* LapsNbLaps, LapsTimeLimit, FinishTimeout,
|
|
|
|
* additionally for version 1: AllWarmUpDuration, DisableRespawn, ForceShowAllOpponents, RoundsPointsLimitNewRules,
|
|
|
|
* TeamPointsLimitNewRules, CupPointsLimit, CupRoundsPerMap, CupNbWinners, CupWarmUpDuration.
|
|
|
|
* @param int $compatibility
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\GameInfos
|
2014-05-08 19:32:14 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function getNextGameInfo($compatibility = 1)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if($compatibility !== 1 && $compatibility != 0)
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('compatibility = '.print_r($compatibility, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
return Structures\GameInfos::fromArray($this->execute(ucfirst(__FUNCTION__), array($compatibility)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Optional parameter for compatibility: struct version (0 = united, 1 = forever).
|
|
|
|
* Returns a struct containing two other structures,
|
|
|
|
* the first containing the current game settings and the second the game settings for next map.
|
|
|
|
* The first structure is named CurrentGameInfos and the second NextGameInfos.
|
|
|
|
* @param int $compatibility
|
|
|
|
* @return Structures\GameInfos[]
|
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function getGameInfos($compatibility = 1)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if($compatibility !== 1 && $compatibility != 0)
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('compatibility = '.print_r($compatibility, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
return Structures\GameInfos::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($compatibility)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a new game mode between Rounds (0), TimeAttack (1), Team (2), Laps (3), Stunts (4) and Cup (5).
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $gameMode
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setGameMode($gameMode, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($gameMode) && ($gameMode < 0 || $gameMode > 5))
|
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('gameMode = '.print_r($gameMode, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($gameMode), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current game mode.
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
function getGameMode()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a new chat time value in milliseconds (actually 'chat time' is the duration of the end race podium, 0 means no podium displayed.).
|
|
|
|
* @param int $chatTime
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setChatTime($chatTime, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($chatTime))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('chatTime = '.print_r($chatTime, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($chatTime), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the current and next chat time. The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getChatTime()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a new finish timeout (for rounds/laps mode) value in milliseconds.
|
|
|
|
* 0 means default. 1 means adaptative to the duration of the map.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $finishTimeout
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setFinishTimeout($finishTimeout, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($finishTimeout))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('chatTime = '.print_r($finishTimeout, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($finishTimeout), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the current and next FinishTimeout. The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getFinishTimeout()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set whether to enable the automatic warm-up phase in all modes.
|
2014-05-08 19:32:14 +02:00
|
|
|
* 0 = no, otherwise it's the duration of the phase, expressed in number of rounds (in rounds/team mode),
|
|
|
|
* or in number of times the gold medal time (other modes).
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $warmUpDuration
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setAllWarmUpDuration($warmUpDuration, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($warmUpDuration))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('warmUpDuration = '.print_r($warmUpDuration, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($warmUpDuration), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get whether the automatic warm-up phase is enabled in all modes. The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getAllWarmUpDuration()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set whether to disallow players to respawn.
|
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param bool $disableRespawn
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setDisableRespawn($disableRespawn, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_bool($disableRespawn))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('disableRespawn = '.print_r($disableRespawn, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($disableRespawn), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get whether players are disallowed to respawn. The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getDisableRespawn()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set whether to override the players preferences and always display all opponents
|
|
|
|
* 0=no override, 1=show all, other value=minimum number of opponents.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $forceShowAllOpponents
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setForceShowAllOpponents($forceShowAllOpponents, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($forceShowAllOpponents))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('forceShowAllOpponents = '.print_r($forceShowAllOpponents, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($forceShowAllOpponents), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get whether players are forced to show all opponents. The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getForceShowAllOpponents()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a new rules script name for script mode. Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param string $scriptName
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setScriptName($scriptName, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($scriptName), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the current and next rules script name for script mode.
|
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getScriptName()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a new time limit for time attack mode.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $timeAttackLimit
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setTimeAttackLimit($timeAttackLimit, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($timeAttackLimit))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('timeAttackLimit = '.print_r($timeAttackLimit, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($timeAttackLimit), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the current and next time limit for time attack mode. The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getTimeAttackLimit()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a new synchronized start period for time attack mode.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $timeAttackSynchPeriod
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setTimeAttackSynchStartPeriod($timeAttackSynchPeriod, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($timeAttackSynchPeriod))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('timeAttackSynchPeriod = '.print_r($timeAttackSynchPeriod, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($timeAttackSynchPeriod), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the current and synchronized start period for time attack mode.
|
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getTimeAttackSynchStartPeriod()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a new time limit for laps mode.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $lapsTimeLimit
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setLapsTimeLimit($lapsTimeLimit, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($lapsTimeLimit))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('lapsTimeLimit = '.print_r($lapsTimeLimit, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($lapsTimeLimit), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the current and next time limit for laps mode.
|
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getLapsTimeLimit()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a new number of laps for laps mode.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $nbLaps
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setNbLaps($nbLaps, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($nbLaps))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('nbLaps = '.print_r($nbLaps, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($nbLaps), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Get the current and next number of laps for laps mode.
|
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getNbLaps()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a new number of laps for rounds mode
|
|
|
|
* 0 = default, use the number of laps from the maps,
|
|
|
|
* otherwise forces the number of rounds for multilaps maps.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $roundForcedLaps
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setRoundForcedLaps($roundForcedLaps, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($roundForcedLaps))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('roundForcedLaps = '.print_r($roundForcedLaps, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($roundForcedLaps), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current and next number of laps for rounds mode.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getRoundForcedLaps()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a new points limit for rounds mode (value set depends on UseNewRulesRound).
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $roundPointsLimit
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setRoundPointsLimit($roundPointsLimit, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($roundPointsLimit))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('roundPointsLimit = '.print_r($roundPointsLimit, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($roundPointsLimit), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current and next points limit for rounds mode (values returned depend on UseNewRulesRound).
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getRoundPointsLimit()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set the points used for the scores in rounds mode.
|
|
|
|
* Points is an array of decreasing integers for the players from the first to last.
|
|
|
|
* And you can add an optional boolean to relax the constraint checking on the scores.
|
|
|
|
* @param array $roundCustomPoints
|
|
|
|
* @param bool $relaxChecking
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setRoundCustomPoints(array $roundCustomPoints, $relaxChecking = false, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_array($roundCustomPoints))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('roundCustomPoints = '.print_r($roundCustomPoints, true));
|
|
|
|
}
|
|
|
|
if(!is_bool($relaxChecking))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('relaxChecking = '.print_r($relaxChecking, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($roundCustomPoints, $relaxChecking), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Gets the points used for the scores in rounds mode.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getRoundCustomPoints()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set the points used for the scores in rounds mode.
|
|
|
|
* Points is an array of decreasing integers for the players from the first to last.
|
|
|
|
* And you can add an optional boolean to relax the constraint checking on the scores.
|
|
|
|
* @param bool $useNewRulesRound
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setUseNewRulesRound($useNewRulesRound, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_bool($useNewRulesRound))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('useNewRulesRound = '.print_r($useNewRulesRound, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($useNewRulesRound), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Gets the points used for the scores in rounds mode.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getUseNewRulesRound()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new points limit for team mode (value set depends on UseNewRulesTeam).
|
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $teamPointsLimit
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setTeamPointsLimit($teamPointsLimit, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($teamPointsLimit))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('teamPointsLimit = '.print_r($teamPointsLimit, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($teamPointsLimit), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current and next points limit for team mode (values returned depend on UseNewRulesTeam).
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getTeamPointsLimit()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new number of maximum points per round for team mode.
|
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $maxPointsTeam
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setMaxPointsTeam($maxPointsTeam, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($maxPointsTeam))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('maxPointsTeam = '.print_r($maxPointsTeam, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($maxPointsTeam), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current and next number of maximum points per round for team mode.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getMaxPointsTeam()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set if new rules are used for team mode.
|
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param bool $useNewRulesTeam
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setUseNewRulesTeam($useNewRulesTeam, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_bool($useNewRulesTeam))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('useNewRulesTeam = '.print_r($useNewRulesTeam, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($useNewRulesTeam), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get if the new rules are used for team mode (Current and next values).
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getUseNewRulesTeam()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the points needed for victory in Cup mode.
|
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $pointsLimit
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setCupPointsLimit($pointsLimit, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($pointsLimit))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('pointsLimit = '.print_r($pointsLimit, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($pointsLimit), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the points needed for victory in Cup mode.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getCupPointsLimit()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the number of rounds before going to next map in Cup mode.
|
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $roundsPerMap
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setCupRoundsPerMap($roundsPerMap, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($roundsPerMap))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('roundsPerMap = '.print_r($roundsPerMap, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($roundsPerMap), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the number of rounds before going to next map in Cup mode.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getCupRoundsPerMap()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set whether to enable the automatic warm-up phase in Cup mode.
|
2014-05-08 19:32:14 +02:00
|
|
|
* 0 = no, otherwise it's the duration of the phase, expressed in number of rounds.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $warmUpDuration
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setCupWarmUpDuration($warmUpDuration, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($warmUpDuration))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('warmUpDuration = '.print_r($warmUpDuration, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($warmUpDuration), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get whether the automatic warm-up phase is enabled in Cup mode.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getCupWarmUpDuration()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the number of winners to determine before the match is considered over.
|
2014-05-08 19:28:45 +02:00
|
|
|
* Requires a map restart to be taken into account.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param int $nbWinners
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function setCupNbWinners($nbWinners, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($nbWinners))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('nbWinners = '.print_r($nbWinners, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($nbWinners), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:28:45 +02:00
|
|
|
* Get the number of winners to determine before the match is considered over.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct returned contains two fields CurrentValue and NextValue.
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
function getCupNbWinners()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current map index in the selection, or -1 if the map is no longer in the selection.
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
function getCurrentMapIndex()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the map index in the selection that will be played next (unless the current one is restarted...)
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
function getNextMapIndex()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the map index in the selection that will be played next (unless the current one is restarted...)
|
|
|
|
* @param int $nextMapIndex
|
|
|
|
* @param bool $multicall
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
function setNextMapIndex($nextMapIndex, $multicall = false)
|
|
|
|
{
|
|
|
|
if(!is_int($nextMapIndex))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('nextMapIndex = '.print_r($nextMapIndex, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($nextMapIndex), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Immediately jumps to the map designated by the index in the selection
|
|
|
|
* @param int $nextMapIndex
|
|
|
|
* @param bool $multicall
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
function jumpToMapIndex($mapIndex, $multicall = false)
|
|
|
|
{
|
|
|
|
if(!is_int($mapIndex))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('mapIndex = '.print_r($mapIndex, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($mapIndex), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set Team names and colors. Only available to Admin.
|
|
|
|
* @param string $teamName1
|
|
|
|
* @param float $teamColor1
|
|
|
|
* @param string $team1Country
|
|
|
|
* @param string $teamName2
|
|
|
|
* @param float $teamColor2
|
|
|
|
* @param string $team2Country
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
* @deprecated since version 2013-04-11
|
|
|
|
*/
|
|
|
|
function setTeamInfo($teamName1, $teamColor1, $team1Country, $teamName2, $teamColor2, $team2Country, $multicall = false)
|
|
|
|
{
|
|
|
|
if(!is_float($teamColor1))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('teamColor1 = '.print_r($teamColor1, true));
|
|
|
|
}
|
|
|
|
if(!is_float($teamColor2))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('teamColor2 = '.print_r($teamColor2, true));
|
|
|
|
}
|
|
|
|
if(!is_string($teamName1))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('teamName1 = '.print_r($teamName1, true));
|
|
|
|
}
|
|
|
|
if(!is_string($teamName2))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('teamName2 = '.print_r($teamName2, true));
|
|
|
|
}
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__),
|
|
|
|
array('unused', 0., 'World', $teamName1, $teamColor1, $team1Country, $teamName2, $teamColor2, $team2Country),
|
|
|
|
$multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return Team info for a given clan (0 = no clan, 1, 2).
|
|
|
|
* The structure contains: name, zonePath, city, emblemUrl, huePrimary, hueSecondary, rGB, clubLinkUrl.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param int $teamId
|
|
|
|
* @return Structures\Team
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function getTeamInfo($teamId)
|
|
|
|
{
|
|
|
|
if(!is_int($teamId))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('teamId = '.print_r($teamId, true));
|
|
|
|
}
|
|
|
|
return Structures\Team::fromArray($this->execute(ucfirst(__FUNCTION__), array($teamId)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the clublinks to use for the two clans.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $team1ClubLink
|
|
|
|
* @param string $team2ClubLink
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function setForcedClubLinks($team1ClubLink, $team2ClubLink, $multicall = false)
|
|
|
|
{
|
|
|
|
if(!is_string($team1ClubLink))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('team1ClubLink = '.print_r($team1ClubLink, true));
|
|
|
|
}
|
|
|
|
if(!is_string($team2ClubLink))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('team2ClubLink = '.print_r($team2ClubLink, true));
|
|
|
|
}
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($team1ClubLink, $team2ClubLink), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the forced clublinks.
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
function getForcedClubLinks()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* (debug tool) Connect a fake player to the server and returns the login.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return string
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function connectFakePlayer($multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* (debug tool) Disconnect a fake player, or all the fake players if login is '*'.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $fakePlayerLogin
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function disconnectFakePlayer($fakePlayerLogin, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($fakePlayerLogin))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('fakePlayerLogin = '.print_r($fakePlayerLogin, true));
|
|
|
|
}
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($fakePlayerLogin), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-04-19 00:32:34 +02:00
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns the token infos for a player.
|
|
|
|
* The returned structure is { TokenCost, CanPayToken }.
|
|
|
|
* @param Structures\Player|string $player
|
|
|
|
* @return array
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function getDemoTokenInfosForPlayer($player)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
return (object) $this->execute(ucfirst(__FUNCTION__), array($login));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Disable player horns. Only available to Admin.
|
|
|
|
* @param bool $disable
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function disableHorns($disable, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_bool($disable))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('disable = '.print_r($disable, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($disable), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns whether the horns are disabled.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function areHornsDisabled()
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Disable the automatic mesages when a player connects/disconnects from the server.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param bool $disable
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function disableServiceAnnounces($disable = true, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_bool($disable))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('disable = '.print_r($disable, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($disable), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns whether the automatic mesages are disabled.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function areServiceAnnouncesDisabled()
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a struct containing the infos for the current map.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct contains the following fields : Name, UId, FileName,
|
|
|
|
* Author, Environnement, Mood, BronzeTime, SilverTime, GoldTime,
|
|
|
|
* AuthorTime, CopperPrice, LapRace, NbLaps and NbCheckpoints.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\Map
|
|
|
|
*/
|
|
|
|
function getCurrentMapInfo()
|
|
|
|
{
|
|
|
|
return Structures\Map::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a struct containing the infos for the next map.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct contains the following fields : Name, UId, FileName,
|
|
|
|
* Author, Environnement, Mood, BronzeTime, SilverTime, GoldTime,
|
|
|
|
* AuthorTime, CopperPrice, LapRace, NbLaps and NbCheckpoints.
|
|
|
|
* (NbLaps and NbCheckpoints are also present but always set to -1)
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\Map
|
|
|
|
*/
|
|
|
|
function getNextMapInfo()
|
|
|
|
{
|
|
|
|
return Structures\Map::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a struct containing the infos for the map with the specified filename.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The struct contains the following fields : Name, UId, FileName,
|
|
|
|
* Author, Environnement, Mood, BronzeTime, SilverTime, GoldTime,
|
|
|
|
* AuthorTime, CopperPrice, LapRace, NbLaps and NbCheckpoints.
|
|
|
|
* (NbLaps and NbCheckpoints are also present but always set to -1)
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $filename
|
|
|
|
* @return Structures\Map
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function getMapInfo($filename)
|
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
$temp = $this->execute(ucfirst(__FUNCTION__), array($filename));
|
|
|
|
return Structures\Map::fromArray($temp);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a boolean if the map with the specified filename matches the current server settings.
|
|
|
|
* @param string $filename
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function checkMapForCurrentServerParams($filename)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a list of maps among the current selection of the server.
|
2014-05-08 19:32:14 +02:00
|
|
|
* This method take two parameters.
|
|
|
|
* The first parameter specifies the maximum number of infos to be returned,
|
|
|
|
* the second one the starting index in the selection.
|
|
|
|
* The list is an array of structures. Each structure contains the following fields : Name, UId, FileName, Environnement, Author, GoldTime and CopperPrice.
|
|
|
|
* @param int $length specifies the maximum number of infos to be returned
|
|
|
|
* @param int $offset specifies the starting index in the list
|
|
|
|
* @return Structures\Map[] The list is an array of Map
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function getMapList($length, $offset)
|
|
|
|
{
|
|
|
|
if(!is_int($length))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('length = '.print_r($length, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($offset))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('offset = '.print_r($offset, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return Structures\Map::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($length, $offset)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add the map with the specified filename at the end of the current selection.
|
|
|
|
* @param string $filename
|
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function addMap($filename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Add the list of maps with the specified filename at the end of the current selection.
|
|
|
|
* @param array $filenames
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function addMapList(array $filenames, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_array($filenames))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filenames = '.print_r($filenames, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filenames), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the map with the specified filename from the current selection.
|
|
|
|
* @param string $filename
|
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function removeMap($filename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the list of maps with the specified filenames from the current selection.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The list of maps to remove is an array of strings.
|
|
|
|
* @param array $filenames
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function removeMapList(array $filenames, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_array($filenames))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filenames = '.print_r($filenames, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filenames), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert the map with the specified filename after the current map.
|
|
|
|
* @param string $filename
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function insertMap($filename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert the list of maps with the specified filenames after the current map.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The list of maps to remove is an array of strings.
|
|
|
|
* @param array $filenames
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function insertMapList(array $filenames, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_array($filenames))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filenames = '.print_r($filenames, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filenames), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set as next map the one with the specified filename, if it is present in the selection.
|
|
|
|
* @param string $filename
|
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function chooseNextMap($filename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set as next maps the list of maps with the specified filenames, if they are present in the selection.
|
2014-05-08 19:32:14 +02:00
|
|
|
* The list of maps to remove is an array of strings.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param array $filenames
|
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function chooseNextMapList(array $filenames, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_array($filenames))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filenames = '.print_r($filenames, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filenames), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Set a list of maps defined in the playlist with the specified filename
|
|
|
|
* as the current selection of the server, and load the gameinfos from the same file.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $filename
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function loadMatchSettings($filename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a list of maps defined in the playlist with the specified filename at the end of the current selection.
|
|
|
|
* @param string $filename
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function appendPlaylistFromMatchSettings($filename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save the current selection of map in the playlist with the specified filename, as well as the current gameinfos.
|
|
|
|
* @param string $filename
|
|
|
|
* @param bool $multicall
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function saveMatchSettings($filename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert a list of maps defined in the playlist with the specified filename after the current map.
|
|
|
|
* @param string $filename
|
2014-05-08 19:28:45 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function insertPlaylistFromMatchSettings($filename, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns the list of players on the server. This method take two parameters.
|
|
|
|
* The first parameter specifies the maximum number of infos to be returned,
|
|
|
|
* the second one the starting index in the list,
|
|
|
|
* an optional 3rd parameter is used for compatibility: struct version (0 = united, 1 = forever, 2 = forever, including the servers).
|
|
|
|
* The list is an array of Structures\Player.
|
|
|
|
* LadderRanking is 0 when not in official mode,
|
|
|
|
* Flags = ForceSpectator(0,1,2) + IsReferee * 10 + IsPodiumReady * 100 + IsUsingStereoscopy * 1000 +
|
|
|
|
* IsManagedByAnOtherServer * 10000 + IsServer * 100000 + HasPlayerSlot * 1000000
|
|
|
|
* SpectatorStatus = Spectator + TemporarySpectator * 10 + PureSpectator * 100 + AutoTarget * 1000 + CurrentTargetId * 10000
|
|
|
|
* @param int $length specifies the maximum number of infos to be returned
|
|
|
|
* @param int $offset specifies the starting index in the list
|
|
|
|
* @param int $compatibility
|
|
|
|
* @return Structures\Player[] The list is an array of Structures\Player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function getPlayerList($length, $offset, $compatibility = 1)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($length))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('length = '.print_r($length, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($offset))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('offset = '.print_r($offset, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
if(!is_int($compatibility))
|
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('compatibility = '.print_r($compatibility, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return Structures\Player::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($length, $offset, $compatibility)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns a object of type Structures\Player containing the infos on the player with the specified login,
|
|
|
|
* with an optional parameter for compatibility: struct version (0 = united, 1 = forever).
|
|
|
|
* The structure is identical to the ones from GetPlayerList. Forever PlayerInfo struct is:
|
|
|
|
* Login, NickName, PlayerId, TeamId, SpectatorStatus, LadderRanking, and Flags.
|
|
|
|
* LadderRanking is 0 when not in official mode,
|
|
|
|
* Flags = ForceSpectator(0,1,2) + IsReferee * 10 + IsPodiumReady * 100 + IsUsingStereoscopy * 1000 +
|
|
|
|
* IsManagedByAnOtherServer * 10000 + IsServer * 100000 + HasPlayerSlot * 1000000
|
|
|
|
* SpectatorStatus = Spectator + TemporarySpectator * 10 + PureSpectator * 100 + AutoTarget * 1000 + CurrentTargetId * 10000
|
|
|
|
* @param int $playerLogin
|
|
|
|
* @param int $compatibility
|
|
|
|
* @return Structures\Player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function getPlayerInfo($playerLogin, $compatibility = 1)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($playerLogin))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('playerLogin = '.print_r($playerLogin, true));
|
|
|
|
}
|
|
|
|
if(!is_int($compatibility))
|
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('compatibility = '.print_r($compatibility, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return Structures\Player::fromArray($this->execute(ucfirst(__FUNCTION__), array($playerLogin, $compatibility)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns an object of type Structures\Player containing the infos on the player with the specified login.
|
|
|
|
* The structure contains the following fields :
|
|
|
|
* Login, NickName, PlayerId, TeamId, IPAddress, DownloadRate, UploadRate, Language, IsSpectator,
|
|
|
|
* IsInOfficialMode, a structure named Avatar, an array of structures named Skins, a structure named LadderStats,
|
|
|
|
* HoursSinceZoneInscription and OnlineRights (0: nations account, 3: united account).
|
|
|
|
* Each structure of the array Skins contains two fields Environnement and a struct PackDesc.
|
|
|
|
* Each structure PackDesc, as well as the struct Avatar, contains two fields FileName and Checksum.
|
|
|
|
* @param int $playerLogin
|
|
|
|
* @return Structures\Player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function getDetailedPlayerInfo($playerLogin)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_string($playerLogin))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('playerLogin = '.print_r($playerLogin, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return Structures\Player::fromArray($this->execute(ucfirst(__FUNCTION__), array($playerLogin)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns an object of Structures\Player type containing the infos on the player with the specified login.
|
|
|
|
* The structure contains the following fields : Login, NickName, PlayerId, TeamId, IPAddress, DownloadRate, UploadRate,
|
|
|
|
* Language, IsSpectator, IsInOfficialMode, a structure named Avatar, an array of structures named Skins, a structure named LadderStats,
|
|
|
|
* HoursSinceZoneInscription and OnlineRights (0: nations account, 3: united account).
|
|
|
|
* Each structure of the array Skins contains two fields Environnement and a struct PackDesc.
|
|
|
|
* Each structure PackDesc, as well as the struct Avatar, contains two fields FileName and Checksum.
|
|
|
|
* @param int $compatibility
|
|
|
|
* @return Structures\Player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function getMainServerPlayerInfo($compatibility = 1)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($compatibility))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('compatibility = '.print_r($compatibility, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return Structures\Player::fromArray($this->execute(ucfirst(__FUNCTION__), array($compatibility)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current rankings for the race in progress.
|
2014-05-08 19:32:14 +02:00
|
|
|
* (in team mode, the scores for the two teams are returned.
|
|
|
|
* In other modes, it's the individual players' scores) This method take two parameters.
|
|
|
|
* The first parameter specifies the maximum number of infos to be returned,
|
|
|
|
* the second one the starting index in the ranking.
|
|
|
|
* The ranking returned is a list of Structures\Player.
|
|
|
|
* It also contains an array BestCheckpoints that contains the checkpoint times for the best race.
|
|
|
|
* @param int $length specifies the maximum number of infos to be returned
|
|
|
|
* @param int $offset specifies the starting index in the list
|
|
|
|
* @return Structures\Player[] The list is an array of Structures\Player.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function getCurrentRanking($length, $offset)
|
|
|
|
{
|
|
|
|
if(!is_int($length))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('length = '.print_r($length, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($offset))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('offset = '.print_r($offset, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return Structures\Player::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($length, $offset)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current ranking for the race in progressof the player with the specified login (or list of comma-separated logins).
|
2014-05-08 19:32:14 +02:00
|
|
|
* The ranking returned is a list of structures that contains the following fields :
|
|
|
|
* Login, NickName, PlayerId, Rank, BestTime, Score, NbrLapsFinished and LadderScore.
|
|
|
|
* It also contains an array BestCheckpoints that contains the checkpoint times for the best race.
|
|
|
|
* @param Structures\Player|Structures\Player[] $player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return Structures\Player[] The list is an array of Structures\Player.
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function getCurrentRankingForLogin($player = null)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
$login = $this->getLogin($player) ? : '';
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return Structures\Player::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($login)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current winning team for the race in progress. (-1: if not in team mode, or draw match)
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return int -1, 0 or 1
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function getCurrentWinnerTeam()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Force the scores of the current game. Only available in rounds and team mode.
|
|
|
|
* You have to pass an array of structs {int PlayerId, int Score}. And a boolean SilentMode -
|
|
|
|
* if true, the scores are silently updated (only available for SuperAdmin), allowing an external controller to do its custom counting...
|
|
|
|
* @param array $scores
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function forceScores(array $scores, $silentMode = false, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_array($scores))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('scores = '.print_r($scores, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for($i = 0; $i < count($scores); $i++)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_int($scores[$i]['PlayerId']))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('score['.$i.'][\'PlayerId\'] = '.print_r($scores[$i]['PlayerId'], true));
|
|
|
|
}
|
|
|
|
if(!is_int($scores[$i]['Score']))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('score['.$i.'][\'Score\'] = '.print_r($scores[$i]['Score'], true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($scores, $silentMode), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Force the team of the player. Only available in team mode. You have to pass the login and the team number (0 or 1).
|
|
|
|
* @param Structures\Player|string $player
|
|
|
|
* @param int $teamNumber
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function forcePlayerTeam($player, $teamNumber, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
|
|
|
if($teamNumber !== 0 && $teamNumber !== 1)
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('teamNumber = '.print_r($teamNumber, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute('ForcePlayerTeam', array($login, $teamNumber), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Force the spectating status of the player.
|
2014-05-08 19:32:14 +02:00
|
|
|
* You have to pass the login and the spectator mode
|
|
|
|
* (0: user selectable, 1: spectator, 2: player, 3: spectator but keep selectable).
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param Structures\Player|string $player
|
|
|
|
* @param int $spectatorMode
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function forceSpectator($player, $spectatorMode, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
|
|
|
if(array_search($spectatorMode, range(0, 3), true) === false)
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('spectatorMode = '.print_r($spectatorMode, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute('ForceSpectator', array($login, $spectatorMode), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Force spectators to look at a specific player. You have to pass the login of the spectator (or '' for all) and
|
|
|
|
* the login of the target (or '' for automatic), and an integer for the camera type to use (-1 = leave unchanged, 0 = replay, 1 = follow, 2 = free).
|
|
|
|
* @param Structures\Player|string $player
|
|
|
|
* @param Structures\Player|string $target
|
|
|
|
* @param int $cameraType
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function forceSpectatorTarget($player, $target, $cameraType, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($playerLogin = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
|
|
|
if(!($targetLogin = $this->getLogin($target)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('target must be set');
|
|
|
|
}
|
|
|
|
if($cameraType !== -1 && $cameraType !== 0 && $cameraType !== 1 && $cameraType !== 2)
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('cameraType = '.print_r($cameraType, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute('ForceSpectatorTarget', array($playerLogin, $targetLogin, $cameraType), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Pass the login of the spectator. A spectator that once was a player keeps his player slot, so that he can go back to race mode.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Calling this function frees this slot for another player to connect.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param Structures\Player|string $player
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function spectatorReleasePlayerSlot($player, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!($login = $this->getLogin($player)))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('player must be set');
|
|
|
|
}
|
|
|
|
return $this->execute('SpectatorReleasePlayerSlot', array($login), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enable control of the game flow: the game will wait for the caller to validate state transitions.
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param bool $flowControlEnable
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function manualFlowControlEnable($flowControlEnable, $multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(!is_bool($flowControlEnable))
|
|
|
|
{
|
|
|
|
throw new InvalidArgumentException('flowControlEnable = '.print_r($flowControlEnable, true));
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($flowControlEnable), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allows the game to proceed.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function manualFlowControlProceed($multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns whether the manual control of the game flow is enabled. 0 = no, 1 = yes by the xml-rpc client making the call, 2 = yes, by some other xml-rpc client.
|
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function manualFlowControlIsEnabled()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns the transition that is currently blocked, or '' if none. (That's exactly the value last received by the callback.)
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function manualFlowControlGetCurTransition()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current match ending condition.
|
2014-05-08 19:32:14 +02:00
|
|
|
* Return values are: 'Playing', 'ChangeMap' or 'Finished'.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return string
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function checkEndMatchCondition()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns an object Structures\NetworkStats.
|
|
|
|
* The structure contains the following fields : Uptime, NbrConnection, MeanConnectionTime, MeanNbrPlayer,
|
|
|
|
* RecvNetRate, SendNetRate, TotalReceivingSize, TotalSendingSize and an array of structures named PlayerNetInfos.
|
|
|
|
* Each structure of the array PlayerNetInfos is a Structures\Player object contains the following fields : Login, IPAddress, LastTransferTime, DeltaBetweenTwoLastNetState, PacketLossRate.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\NetworkStats
|
|
|
|
*/
|
|
|
|
function getNetworkStats()
|
|
|
|
{
|
|
|
|
return Structures\NetworkStats::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Start a server on lan, using the current configuration.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function startServerLan($multicall = false)
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Start a server on internet using the 'Login' and 'Password' specified in the struct passed as parameters.
|
|
|
|
* @param array $ids
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function startServerInternet($multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:32:14 +02:00
|
|
|
* Returns the current status of the server.
|
|
|
|
* @return Structures\Status
|
|
|
|
*/
|
|
|
|
function getStatus()
|
|
|
|
{
|
|
|
|
return Structures\Status::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Quit the application.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
function quitGame($multicall = false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
2014-05-08 19:32:14 +02:00
|
|
|
/**
|
|
|
|
* Returns the path of the game datas directory.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function gameDataDirectory()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the path of the maps directory.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function getMapsDirectory()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the path of the skins directory.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function getSkinsDirectory()
|
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
}
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
|
|
|
* Returns the login of the given player
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param mixed $player Structures\Player or string
|
|
|
|
* @return string
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
private function getLogin($player)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(is_string($player)) return $player;
|
|
|
|
if($player instanceof Structures\Player) return $player->login;
|
|
|
|
return null;
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns logins of given players
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param mixed $player Structures\Player or string or array
|
|
|
|
* @return string
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:32:14 +02:00
|
|
|
private function getLogins($players)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(is_array($players))
|
|
|
|
{
|
|
|
|
$logins = array();
|
|
|
|
foreach($players as $player)
|
|
|
|
{
|
2014-05-08 19:32:14 +02:00
|
|
|
if(($login = $this->getLogin($player))) $logins[] = $login;
|
|
|
|
else return null;
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return implode(',', $logins);
|
|
|
|
}
|
2014-05-08 19:32:14 +02:00
|
|
|
return $this->getLogin($players);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-05-08 19:32:14 +02:00
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Exception Dedicated to Invalid Argument Error on Request Call
|
|
|
|
*/
|
2014-04-19 00:32:34 +02:00
|
|
|
class InvalidArgumentException extends \Exception {}
|
2014-05-08 19:32:14 +02:00
|
|
|
|
|
|
|
?>
|