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:38:15 +02:00
|
|
|
const API_2011_08_01 = '2011-08-01';
|
|
|
|
const API_2011_10_06 = '2011-10-06';
|
|
|
|
const API_2012_06_19 = '2012-06-19';
|
|
|
|
const API_2013_04_16 = '2013-04-16';
|
|
|
|
|
|
|
|
/** @var Connection[] */
|
|
|
|
protected static $instances = array();
|
|
|
|
/** @var int[] */
|
|
|
|
private static $levels = array(
|
|
|
|
null => -1,
|
|
|
|
'User' => 0,
|
|
|
|
'Admin' => 1,
|
|
|
|
'SuperAdmin' => 2
|
|
|
|
);
|
2014-06-12 15:39:50 +02:00
|
|
|
/** @var callable[] */
|
|
|
|
private $multicallHandlers = array();
|
2014-05-08 19:38:15 +02:00
|
|
|
|
|
|
|
/** @var Xmlrpc\GbxRemote */
|
2014-01-16 16:56:24 +01:00
|
|
|
protected $xmlrpcClient;
|
2014-05-08 19:38:15 +02:00
|
|
|
/** @var string */
|
|
|
|
protected $user;
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $host
|
|
|
|
* @param int $port
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param int $timeout (in s)
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $user
|
|
|
|
* @param string $password
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param string $apiVersion
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Connection
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
static function factory($host='127.0.0.1', $port=5000, $timeout=5, $user='SuperAdmin', $password='SuperAdmin', $apiVersion=self::API_2013_04_16)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
$key = $host.':'.$port;
|
|
|
|
if(!isset(self::$instances[$key]))
|
2014-05-08 19:38:15 +02:00
|
|
|
self::$instances[$key] = new self($host, $port, $timeout);
|
|
|
|
self::$instances[$key]->authenticate($user, $password);
|
|
|
|
self::$instances[$key]->setApiVersion($apiVersion);
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
return self::$instances[$key];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param Connection|string $hostOrConnection
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param int $port
|
2014-05-13 17:37:35 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
static function delete($hostOrConnection, $port=null)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if($hostOrConnection instanceof Connection)
|
|
|
|
$key = array_search($hostOrConnection, self::$instances);
|
|
|
|
else
|
|
|
|
$key = $hostOrConnection.':'.$port;
|
2014-01-16 16:56:24 +01:00
|
|
|
if(isset(self::$instances[$key]))
|
|
|
|
{
|
|
|
|
self::$instances[$key]->terminate();
|
|
|
|
unset(self::$instances[$key]);
|
2014-05-13 17:37:35 +02:00
|
|
|
return true;
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-05-13 17:37:35 +02:00
|
|
|
return false;
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
2014-04-19 00:32:34 +02:00
|
|
|
/**
|
|
|
|
* Change client timeouts
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param int $read read timeout (in ms), 0 to leave unchanged
|
|
|
|
* @param int $write write timeout (in ms), 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:38:15 +02:00
|
|
|
protected function __construct($host, $port, $timeout)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$this->xmlrpcClient = new Xmlrpc\GbxRemote($host, $port, $timeout);
|
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:38:15 +02:00
|
|
|
* Return pending callbacks
|
|
|
|
* @return mixed[]
|
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-06-12 15:39:50 +02:00
|
|
|
* @return mixed[]
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
|
|
|
function executeMulticall()
|
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
$responses = $this->xmlrpcClient->multiquery();
|
|
|
|
foreach($responses as $i => &$response)
|
|
|
|
if(!($response instanceof Xmlrpc\FaultException) && is_callable($this->multicallHandlers[$i]))
|
|
|
|
$response = call_user_func($this->multicallHandlers[$i], $response);
|
|
|
|
$this->multicallHandlers = array();
|
|
|
|
return $responses;
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Add a call in queue. 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:38:15 +02:00
|
|
|
* @param mixed[] $params
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool|callable $multicall True to queue the request or false to execute it immediately
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return mixed
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2017-04-13 22:59:41 +02:00
|
|
|
public 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-06-12 15:39:50 +02:00
|
|
|
{
|
2014-01-16 16:56:24 +01:00
|
|
|
$this->xmlrpcClient->addCall($methodName, $params);
|
2014-06-12 15:39:50 +02:00
|
|
|
$this->multicallHandlers[] = $multicall;
|
|
|
|
}
|
2014-01-16 16:56:24 +01:00
|
|
|
else
|
2014-04-19 00:32:34 +02:00
|
|
|
return $this->xmlrpcClient->query($methodName, $params);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Allow user authentication by specifying a login and a password, to gain access to the set of functionalities corresponding to this authorization level.
|
|
|
|
* @param string $user
|
|
|
|
* @param string $password
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function authenticate($user, $password)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($user) || !isset(self::$levels[$user]))
|
|
|
|
throw new InvalidArgumentException('user = '.print_r($user, true));
|
|
|
|
if(self::$levels[$this->user] >= self::$levels[$user])
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if(!is_string($password))
|
|
|
|
throw new InvalidArgumentException('password = '.print_r($password, true));
|
|
|
|
|
|
|
|
$res = $this->execute(ucfirst(__FUNCTION__), array($user, $password));
|
|
|
|
if($res)
|
|
|
|
$this->user = $user;
|
|
|
|
return $res;
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Change the password for the specified login/user.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to SuperAdmin.
|
|
|
|
* @param string $user
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $password
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function changeAuthPassword($user, $password, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($user) || !isset(self::$levels[$user]))
|
|
|
|
throw new InvalidArgumentException('user = '.print_r($user, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($password))
|
|
|
|
throw new InvalidArgumentException('password = '.print_r($password, true));
|
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($user, $password), $multicall);
|
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:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function enableCallbacks($enable=true, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_bool($enable))
|
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($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:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setApiVersion($version, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($version))
|
|
|
|
throw new InvalidArgumentException('version = '.print_r($version, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($version), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns a struct with the Name, TitleId, Version, Build and ApiVersion of the application remotely controlled.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\Version
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getVersion($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('Version'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\Version::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
/**
|
|
|
|
* Returns the current status of the server.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\Status
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getStatus($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('Status'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\Status::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Quit the application.
|
|
|
|
* Only available to SuperAdmin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function quitGame($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Call a vote for a command.
|
|
|
|
* You can additionally supply specific parameters for this vote: a ratio, a time out and who is voting.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param Structures\Vote $vote
|
|
|
|
* @param float $ratio In range [0,1] or -1 for default ratio
|
|
|
|
* @param int $timeout In milliseconds, 0 for default timeout, 1 for indefinite
|
|
|
|
* @param int $voters 0: active players, 1: any player, 2: everybody including pure spectators
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function callVote($vote, $ratio=-1., $timeout=0, $voters=1, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!($vote instanceof Structures\Vote && $vote->isValid()))
|
|
|
|
throw new InvalidArgumentException('vote = '.print_r($vote, true));
|
|
|
|
if(!Structures\VoteRatio::isRatio($ratio))
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('ratio = '.print_r($ratio, true));
|
|
|
|
if(!is_int($timeout))
|
|
|
|
throw new InvalidArgumentException('timeout = '.print_r($timeout, true));
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($voters) || $voters < 0 || $voters > 2)
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('voters = '.print_r($voters, true));
|
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
$xml = Xmlrpc\Request::encode($vote->cmdName, $vote->cmdParam, false);
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'Ex', array($xml, $ratio, $timeout, $voters), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Call a vote to kick a player.
|
|
|
|
* You can additionally supply specific parameters for this vote: a ratio, a time out and who is voting.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player A player object or a login
|
|
|
|
* @param float $ratio In range [0,1] or -1 for default ratio
|
|
|
|
* @param int $timeout In milliseconds, 0 for default timeout, 1 for indefinite
|
|
|
|
* @param int $voters 0: active players, 1: any player, 2: everybody including pure spectators
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
$vote = new Structures\Vote(Structures\VoteRatio::COMMAND_KICK, array($login));
|
|
|
|
return $this->callVote($vote, $ratio, $timeout, $voters, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Call a vote to ban a player.
|
|
|
|
* You can additionally supply specific parameters for this vote: a ratio, a time out and who is voting.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player A player object or a login
|
|
|
|
* @param float $ratio In range [0,1] or -1 for default ratio
|
|
|
|
* @param int $timeout In milliseconds, 0 for default timeout, 1 for indefinite
|
|
|
|
* @param int $voters 0: active players, 1: any player, 2: everybody including pure spectators
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
$vote = new Structures\Vote(Structures\VoteRatio::COMMAND_BAN, array($login));
|
|
|
|
return $this->callVote($vote, $ratio, $timeout, $voters, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Call a vote to restart the current map.
|
|
|
|
* You can additionally supply specific parameters for this vote: a ratio, a time out and who is voting.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param float $ratio In range [0,1] or -1 for default ratio
|
|
|
|
* @param int $timeout In milliseconds, 0 for default timeout, 1 for indefinite
|
|
|
|
* @param int $voters 0: active players, 1: any player, 2: everybody including pure spectators
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
$vote = new Structures\Vote(Structures\VoteRatio::COMMAND_RESTART_MAP);
|
|
|
|
return $this->callVote($vote, $ratio, $timeout, $voters, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Call a vote to go to the next map.
|
|
|
|
* You can additionally supply specific parameters for this vote: a ratio, a time out and who is voting.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param float $ratio In range [0,1] or -1 for default ratio
|
|
|
|
* @param int $timeout In milliseconds, 0 for default timeout, 1 for indefinite
|
|
|
|
* @param int $voters 0: active players, 1: any player, 2: everybody including pure spectators
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
$vote = new Structures\Vote(Structures\VoteRatio::COMMAND_NEXT_MAP);
|
|
|
|
return $this->callVote($vote, $ratio, $timeout, $voters, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cancel the current vote.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:38:15 +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-06-12 15:39:50 +02:00
|
|
|
* @param $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\Vote
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCurrentCallVote($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('Vote'));
|
2014-01-16 16:56:24 +01:00
|
|
|
return Structures\Vote::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set a new timeout for waiting for votes.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param int $timeout In milliseconds, 0 to disable votes
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setCallVoteTimeOut($timeout, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($timeout))
|
|
|
|
throw new InvalidArgumentException('timeout = '.print_r($timeout, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($timeout), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current and next timeout for waiting for votes.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCallVoteTimeOut($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new default ratio for passing a vote.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param float $ratio In range [0,1] or -1 to disable votes
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setCallVoteRatio($ratio, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!Structures\VoteRatio::isRatio($ratio))
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('ratio = '.print_r($ratio, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($ratio), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current default ratio for passing a vote.
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return float
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCallVoteRatio($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set the ratios list for passing specific votes, extended version with parameters matching.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param Structures\VoteRatio[] $ratios
|
|
|
|
* @param bool $replaceAll True to override the whole ratios list or false to modify only specified ratios
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setCallVoteRatios($ratios, $replaceAll=true, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_array($ratios))
|
|
|
|
throw new InvalidArgumentException('ratios = '.print_r($ratios, true));
|
|
|
|
foreach($ratios as $i => &$ratio)
|
|
|
|
{
|
|
|
|
if(!($ratio instanceof Structures\VoteRatio && $ratio->isValid()))
|
|
|
|
throw new InvalidArgumentException('ratios['.$i.'] = '.print_r($ratios, true));
|
|
|
|
$ratio = $ratio->toArray();
|
|
|
|
}
|
|
|
|
if(!is_bool($replaceAll))
|
|
|
|
throw new InvalidArgumentException('replaceAll = '.print_r($replaceAll, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'Ex', array($replaceAll, $ratios), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* @deprecated
|
|
|
|
* @see setCallVoteRatios()
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setCallVoteRatiosEx($replaceAll, $ratios, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->setCallVoteRatios($ratios, $replaceAll, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get the current ratios for passing votes, extended version with parameters matching.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\VoteRatio[]
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCallVoteRatios($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'Ex', array(), $this->structHandler('VoteRatio', true));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\VoteRatio::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__).'Ex'));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* @deprecated
|
|
|
|
* @see getCallVoteRatios()
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCallVoteRatiosEx($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->getCallVoteRatios($multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-13 17:37:35 +02:00
|
|
|
* Send a text message, possibly localised to a specific login or to everyone, without the server login.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param string|string[][] $message Single string or array of structures {Lang='xx', Text='...'}:
|
|
|
|
* if no matching language is found, the last text in the array is used
|
|
|
|
* @param mixed $recipient Login, player object or array; null for all
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function chatSendServerMessage($message, $recipient=null, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
$logins = $this->getLogins($recipient, true);
|
|
|
|
if($logins === false)
|
|
|
|
throw new InvalidArgumentException('recipient = '.print_r($recipient, true));
|
|
|
|
|
|
|
|
if(is_array($message))
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'ToLanguage', array($message, $logins), $multicall);
|
|
|
|
if(is_string($message))
|
|
|
|
{
|
|
|
|
if($logins)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($message, $logins), $multicall);
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($message), $multicall);
|
|
|
|
}
|
|
|
|
// else
|
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* @deprecated
|
2014-05-13 17:37:35 +02:00
|
|
|
* @see chatSendServerMessage()
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function chatSendServerMessageToLanguage($messages, $recipient=null, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
return $this->chatSendServerMessage($messages, $recipient, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Send a text message, possibly localised to a specific login or to everyone.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param string|string[][] $message Single string or array of structures {Lang='xx', Text='...'}:
|
|
|
|
* if no matching language is found, the last text in the array is used
|
|
|
|
* @param mixed $recipient Login, player object or array; null for all
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function chatSend($message, $recipient=null, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$logins = $this->getLogins($recipient, true);
|
|
|
|
if($logins === false)
|
|
|
|
throw new InvalidArgumentException('recipient = '.print_r($recipient, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-13 17:37:35 +02:00
|
|
|
if(is_array($message))
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'ToLanguage', array($message, $logins), $multicall);
|
2014-05-08 19:38:15 +02:00
|
|
|
if(is_string($message))
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
if($logins)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($message, $logins), $multicall);
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($message), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-05-08 19:38:15 +02:00
|
|
|
// else
|
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* @deprecated
|
|
|
|
* @see chatSend()
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function chatSendToLanguage($messages, $recipient=null, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
return $this->chatSend($messages, $recipient, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the last chat lines. Maximum of 40 lines.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return string[]
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getChatLines($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +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.
|
|
|
|
* Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $enable
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param bool $excludeServer Allows all messages from the server to be automatically forwarded.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function chatEnableManualRouting($enable=true, $excludeServer=false, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_bool($excludeServer))
|
|
|
|
throw new InvalidArgumentException('excludeServer = '.print_r($excludeServer, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable, $excludeServer), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Send a message to the specified recipient (or everybody if empty) on behalf of sender.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available if manual routing is enabled.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $message
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param mixed $sender Login or player object
|
|
|
|
* @param mixed $recipient Login, player object or array; empty for all
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function chatForward($message, $sender, $recipient=null, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($message))
|
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
$senderLogin = $this->getLogin($sender);
|
|
|
|
if($senderLogin === false)
|
|
|
|
throw new InvalidArgumentException('sender = '.print_r($sender, true));
|
|
|
|
$recipientLogins = $this->getLogins($recipient, true);
|
|
|
|
if($recipientLogins === false)
|
|
|
|
throw new InvalidArgumentException('recipient = '.print_r($recipient, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($message, $senderLogin, $recipientLogins), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @deprecated
|
|
|
|
* @see chatForward()
|
|
|
|
*/
|
|
|
|
function chatForwardToLogin($message, $sender, $recipient=null, $multicall=false)
|
|
|
|
{
|
|
|
|
return $this->chatForward($message, $sender, $recipient, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Display a notice on all clients.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $recipient Login, player object or array; empty for all
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $message
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param mixed $avatar Login or player object whose avatar will be displayed; empty for none
|
|
|
|
* @param int $variant 0: normal, 1: sad, 2: happy
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function sendNotice($recipient, $message, $avatar=null, $variant=0, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$logins = $this->getLogins($recipient, true);
|
|
|
|
if($logins === false)
|
|
|
|
throw new InvalidArgumentException('recipient = '.print_r($recipient, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($message))
|
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
2014-05-08 19:38:15 +02:00
|
|
|
$avatarLogin = $this->getLogin($avatar, true);
|
|
|
|
if($avatarLogin === false)
|
|
|
|
throw new InvalidArgumentException('avatar = '.print_r($avatar, true));
|
|
|
|
if(!is_int($variant) || $variant < 0 || $variant > 2)
|
|
|
|
throw new InvalidArgumentException('variant = '.print_r($variant, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-13 17:37:35 +02:00
|
|
|
if($logins)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($logins, $message, $avatarLogin, $variant), $multicall);
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($message, $avatar, $variant), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Display a manialink page on all clients.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $recipient Login, player object or array; empty for all
|
|
|
|
* @param string $manialinks XML string
|
|
|
|
* @param int $timeout Seconds before autohide, 0 for permanent
|
|
|
|
* @param bool $hideOnClick Hide as soon as the user clicks on a page option
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function sendDisplayManialinkPage($recipient, $manialinks, $timeout=0, $hideOnClick=false, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$logins = $this->getLogins($recipient, true);
|
|
|
|
if($logins === false)
|
|
|
|
throw new InvalidArgumentException('recipient = '.print_r($recipient, true));
|
|
|
|
if(!is_string($manialinks))
|
|
|
|
throw new InvalidArgumentException('manialinks = '.print_r($manialinks, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($timeout))
|
|
|
|
throw new InvalidArgumentException('timeout = '.print_r($timeout, true));
|
|
|
|
if(!is_bool($hideOnClick))
|
|
|
|
throw new InvalidArgumentException('hideOnClick = '.print_r($hideOnClick, true));
|
|
|
|
|
2014-05-13 17:37:35 +02:00
|
|
|
if($logins)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($logins, $manialinks, $timeout, $hideOnClick), $multicall);
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($manialinks, $timeout, $hideOnClick), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Hide the displayed manialink page.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $recipient Login, player object or array; empty for all
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function sendHideManialinkPage($recipient=null, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$logins = $this->getLogins($recipient, true);
|
|
|
|
if($logins === false)
|
|
|
|
throw new InvalidArgumentException('recipient = '.print_r($recipient, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-13 17:37:35 +02:00
|
|
|
if($logins)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($logins), $multicall);
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +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.
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return Structures\PlayerAnswer[]
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getManialinkPageAnswers($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('PlayerAnswer', true));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\PlayerAnswer::fromArrayOfArray($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:38:15 +02:00
|
|
|
* Opens a link in the client with the specified login.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $recipient Login, player object or array
|
|
|
|
* @param string $link URL to open
|
|
|
|
* @param int $linkType 0: in the external browser, 1: in the internal manialink browser
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function sendOpenLink($recipient, $link, $linkType, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$logins = $this->getLogins($recipient);
|
|
|
|
if($logins === false)
|
|
|
|
throw new InvalidArgumentException('recipient = '.print_r($recipient, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($link))
|
|
|
|
throw new InvalidArgumentException('link = '.print_r($link, true));
|
|
|
|
if($linkType !== 0 && $linkType !== 1)
|
|
|
|
throw new InvalidArgumentException('linkType = '.print_r($linkType, true));
|
2014-04-19 00:32:34 +02:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($logins, $link, $linkType), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
2017-03-31 21:30:34 +02:00
|
|
|
/**
|
|
|
|
* Prior to loading next map, execute SendToServer url '#qjoin=login@title'
|
|
|
|
* Only available to Admin.
|
|
|
|
* Available since ManiaPlanet 4
|
|
|
|
* @param $link
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function sendToServerAfterMatchEnd($link, $multicall = false){
|
|
|
|
if(!is_string($link))
|
|
|
|
throw new InvalidArgumentException('link = '.print_r($link, true));
|
|
|
|
|
|
|
|
$link = str_replace("maniaplanet://", "", $link);
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($link), $multicall);
|
|
|
|
}
|
2017-03-31 22:07:00 +02:00
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Kick the player with the specified login, with an optional message.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player Login or player object
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $message
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function kick($player, $message='', $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($message))
|
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login, $message), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Ban the player with the specified login, with an optional message.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player Login or player object
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $message
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function ban($player, $message='', $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($message))
|
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login, $message), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Ban the player with the specified login, 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:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player Login or player object
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $message
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param bool $save
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function banAndBlackList($player, $message='', $save=false, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
|
|
|
if(!is_string($message))
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_bool($save))
|
|
|
|
throw new InvalidArgumentException('save = '.print_r($save, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($player, $message, $save), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Unban the player with the specified login.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player Login or player object
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function unBan($player, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clean the ban list of the server.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
* Returns the list of banned players.
|
|
|
|
* @param int $length Maximum number of infos to be returned
|
|
|
|
* @param int $offset Starting index in the list
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\PlayerBan[]
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getBanList($length=-1, $offset=0, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +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-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($length, $offset), $this->structHandler('PlayerBan', true));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\PlayerBan::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($length, $offset)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Blacklist the player with the specified login.
|
|
|
|
* Only available to SuperAdmin.
|
|
|
|
* @param mixed $player Login or player object
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function blackList($player, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* UnBlackList the player with the specified login.
|
|
|
|
* Only available to SuperAdmin.
|
|
|
|
* @param mixed $player Login or player object
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function unBlackList($player, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clean the blacklist of the server.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to SuperAdmin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
* @param int $length Maximum number of infos to be returned
|
|
|
|
* @param int $offset Starting index in the list
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\Player[]
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getBlackList($length=-1, $offset=0, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +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-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($length, $offset), $this->structHandler('Player', true));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\Player::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($length, $offset)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load the black list file with the specified file name.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Empty for default filename (blacklist.txt)
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function loadBlackList($filename='', $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($filename))
|
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
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:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Empty for default filename (blacklist.txt)
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function saveBlackList($filename='', $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($filename))
|
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Add the player with the specified login on the guest list.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player Login or player object
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function addGuest($player, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Remove the player with the specified login from the guest list.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player Login or player object
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function removeGuest($player, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clean the guest list of the server.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
* @param int $length Maximum number of infos to be returned
|
|
|
|
* @param int $offset Starting index in the list
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\Player[]
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getGuestList($length=-1, $offset=0, $multicall=false)
|
2014-01-16 16:56:24 +01: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-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($length, $offset), $this->structHandler('Player', true));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\Player::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($length, $offset)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load the guest list file with the specified file name.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Empty for default filename (guestlist.txt)
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function loadGuestList($filename='', $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
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:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Empty for default filename (guestlist.txt)
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function saveGuestList($filename='', $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
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:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player Login or player object; empty for global setting
|
|
|
|
* @param bool $enable
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setBuddyNotification($player, $enable, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player, true);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_bool($enable))
|
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login, $enable), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Gets whether buddy notifications are enabled.
|
|
|
|
* @param mixed $player Login or player object; empty for global setting
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getBuddyNotification($player=null, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player, true);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-13 17:37:35 +02:00
|
|
|
* Write the data to the specified file.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Relative to the Maps path
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param string $data
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function writeFile($filename, $data, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($data))
|
|
|
|
throw new InvalidArgumentException('data = '.print_r($data, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
$data = new Xmlrpc\Base64($data);
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename, $data), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-13 17:37:35 +02:00
|
|
|
* Write the data to the specified file.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Relative to the Maps path
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param string $localFilename
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function writeFileFromFile($filename, $localFilename, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!file_exists($localFilename))
|
|
|
|
throw new InvalidArgumentException('localFilename = '.print_r($localFilename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
$contents = file_get_contents($localFilename);
|
|
|
|
return $this->writeFile($filename, $contents, $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Send the data to the specified player. Login can be a single login or a list of comma-separated logins.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $recipient Login, player object or array
|
|
|
|
* @param string $data
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function tunnelSendData($recipient, $data, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$logins = $this->getLogins($recipient);
|
|
|
|
if($logins === false)
|
|
|
|
throw new InvalidArgumentException('recipient = '.print_r($recipient, true));
|
|
|
|
if(!is_string($data))
|
|
|
|
throw new InvalidArgumentException('data = '.print_r($data, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
$data = new Xmlrpc\Base64($data);
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($logins, $data), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Send the data to the specified player. Login can be a single login or a list of comma-separated logins.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $recipient Login or player object or array
|
|
|
|
* @param string $filename
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function tunnelSendDataFromFile($recipient, $filename, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!file_exists($filename))
|
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
$contents = file_get_contents($filename);
|
|
|
|
return $this->tunnelSendData($recipient, $contents, $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:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $message
|
|
|
|
* @param string $callback
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function dedicatedEcho($message, $callback='', $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($message))
|
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
|
|
|
if(!is_string($callback))
|
|
|
|
throw new InvalidArgumentException('callback = '.print_r($callback, true));
|
|
|
|
|
|
|
|
return $this->execute('Echo', array($message, $callback), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Ignore the player with the specified login.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player Login or player object
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function ignore($player, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Unignore the player with the specified login.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player Login or player object
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function unIgnore($player, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clean the ignore list of the server.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
* Returns the list of ignored players.
|
|
|
|
* @param int $length Maximum number of infos to be returned
|
|
|
|
* @param int $offset Starting index in the list
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\Player[]
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getIgnoreList($length=-1, $offset=0, $multicall=false)
|
2014-01-16 16:56:24 +01: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-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($length, $offset), $this->structHandler('Player', true));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\Player::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($length, $offset)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Pay planets from the server account to a player.
|
|
|
|
* The creation of the transaction itself may cost planets, so you need to have planets on the server account.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $payee Login or player object
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param int $amount
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param string $message
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int BillId
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function pay($payee, $amount, $message='', $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($payee);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('payee = '.print_r($payee, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($amount) || $amount < 1)
|
|
|
|
throw new InvalidArgumentException('amount = '.print_r($amount, true));
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($message))
|
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login, $amount, $message), $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:38:15 +02:00
|
|
|
* The creation of the transaction itself may cost planets, so you need to have planets on the server account.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $payer Login or player object
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param int $amount
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param string $message
|
|
|
|
* @param mixed $payee Login or player object; empty for server account
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int BillId
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function sendBill($payer, $amount, $message='', $payee=null, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$payerLogin = $this->getLogin($payer);
|
|
|
|
if($payerLogin === false)
|
|
|
|
throw new InvalidArgumentException('payer = '.print_r($payer, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($amount) || $amount < 1)
|
|
|
|
throw new InvalidArgumentException('amount = '.print_r($amount, true));
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($message))
|
|
|
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
|
|
|
$payeeLogin = $this->getLogin($payee, true);
|
|
|
|
if($payeeLogin === false)
|
|
|
|
throw new InvalidArgumentException('payee = '.print_r($payee, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($payerLogin, $amount, $message, $payeeLogin), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current state of a bill.
|
|
|
|
* @param int $billId
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\Bill
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getBillState($billId, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($billId))
|
|
|
|
throw new InvalidArgumentException('billId = '.print_r($billId, true));
|
|
|
|
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($billId), $this->structHandler('Bill'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\Bill::fromArray($this->execute(ucfirst(__FUNCTION__), array($billId)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current number of planets on the server account.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return int
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getServerPlanets($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get some system infos, including connection rates (in kbps).
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\SystemInfos
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getSystemInfo($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('SystemInfos'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\SystemInfos::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set the download and upload rates (in kbps).
|
|
|
|
* @param int $downloadRate
|
|
|
|
* @param int $uploadRate
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setConnectionRates($downloadRate, $uploadRate, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($downloadRate))
|
|
|
|
throw new InvalidArgumentException('downloadRate = '.print_r($downloadRate, true));
|
|
|
|
if(!is_int($uploadRate))
|
|
|
|
throw new InvalidArgumentException('uploadRate = '.print_r($uploadRate, true));
|
|
|
|
|
|
|
|
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-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return Structures\Tag[]
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getServerTags($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('Tag', true));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\Tag::fromArrayOfArray($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:38:15 +02:00
|
|
|
* Set a tag and its value on the server.
|
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:38:15 +02:00
|
|
|
function setServerTag($key, $value, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($key))
|
|
|
|
throw new InvalidArgumentException('key = '.print_r($key, true));
|
|
|
|
if(!is_string($value))
|
|
|
|
throw new InvalidArgumentException('value = '.print_r($value, true));
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
function unsetServerTag($key, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($key))
|
|
|
|
throw new InvalidArgumentException('key = '.print_r($key, true));
|
2014-05-08 19:38:15 +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:38:15 +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:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $name
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setServerName($name, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($name))
|
|
|
|
throw new InvalidArgumentException('name = '.print_r($name, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($name), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the server name in utf8 format.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return string
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getServerName($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new server comment in utf8 format.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $comment
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setServerComment($comment, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($comment))
|
|
|
|
throw new InvalidArgumentException('comment = '.print_r($comment, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($comment), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the server comment in utf8 format.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return string
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getServerComment($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set whether the server should be hidden from the public server list.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param int $visibility 0: visible, 1: always hidden, 2: hidden from nations
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setHideServer($visibility, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($visibility) || $visibility < 0 || $visibility > 2)
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('visibility = '.print_r($visibility, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($visibility), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get whether the server wants to be hidden from the public server list.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getHideServer($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this is a relay server.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function isRelayServer($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new password for the server.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $password
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setServerPassword($password, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($password))
|
|
|
|
throw new InvalidArgumentException('password = '.print_r($password, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($password), $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-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return string|bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getServerPassword($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new password for the spectator mode.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $password
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setServerPasswordForSpectator($password, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($password))
|
|
|
|
throw new InvalidArgumentException('password = '.print_r($password, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($password), $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-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return string|bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getServerPasswordForSpectator($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new maximum number of players.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
|
|
|
* @param int $maxPlayers
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setMaxPlayers($maxPlayers, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($maxPlayers))
|
|
|
|
throw new InvalidArgumentException('maxPlayers = '.print_r($maxPlayers, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($maxPlayers), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current and next maximum number of players allowed on server.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getMaxPlayers($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new maximum number of spectators.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
|
|
|
* @param int $maxSpectators
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setMaxSpectators($maxSpectators, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($maxSpectators))
|
2014-05-08 19:38:15 +02:00
|
|
|
throw new InvalidArgumentException('maxSpectators = '.print_r($maxSpectators, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($maxSpectators), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get the current and next maximum number of Spectators allowed on server.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getMaxSpectators($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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:38:15 +02:00
|
|
|
* @param int $currentPlayers
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param int $maxPlayers
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param float $averageLevel
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setLobbyInfo($isLobby, $currentPlayers, $maxPlayers, $averageLevel, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($isLobby))
|
|
|
|
throw new InvalidArgumentException('isLobby = '.print_r($isLobby, true));
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($currentPlayers))
|
|
|
|
throw new InvalidArgumentException('currentPlayers = '.print_r($currentPlayers, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_int($maxPlayers))
|
|
|
|
throw new InvalidArgumentException('maxPlayers = '.print_r($maxPlayers, true));
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_float($averageLevel))
|
|
|
|
throw new InvalidArgumentException('averageLevel = '.print_r($averageLevel, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($isLobby, $currentPlayers, $maxPlayers, $averageLevel), $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-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\LobbyInfo
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getLobbyInfo($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('LobbyInfo'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\LobbyInfo::fromArray($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-04-19 00:32:34 +02:00
|
|
|
* Customize the clients 'leave server' dialog box.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param string $manialink
|
|
|
|
* @param string $sendToServer Server URL, eg. '#qjoin=login@title'
|
|
|
|
* @param bool $askFavorite
|
|
|
|
* @param int $quitButtonDelay In milliseconds
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function customizeQuitDialog($manialink, $sendToServer='', $askFavorite=true, $quitButtonDelay=0, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($manialink))
|
|
|
|
throw new InvalidArgumentException('manialink = '.print_r($manialink, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($sendToServer))
|
|
|
|
throw new InvalidArgumentException('sendToServer = '.print_r($sendToServer, true));
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_bool($askFavorite))
|
|
|
|
throw new InvalidArgumentException('askFavorite = '.print_r($askFavorite, true));
|
|
|
|
if(!is_int($quitButtonDelay))
|
|
|
|
throw new InvalidArgumentException('quitButtonDelay = '.print_r($quitButtonDelay, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($manialink, $sendToServer, $askFavorite, $quitButtonDelay), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +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-13 17:37:35 +02:00
|
|
|
function keepPlayerSlots($keep=true, $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:38:15 +02:00
|
|
|
* Get whether the server keeps player slots when switching to spectator.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function isKeepingPlayerSlots($multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-05-08 19:38:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-05-08 19:38:15 +02:00
|
|
|
* Enable or disable peer-to-peer upload from server.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param bool $enable
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function enableP2PUpload($enable=true, $multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns if the peer-to-peer upload from server is enabled.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function isP2PUpload($multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-05-08 19:38:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-05-08 19:38:15 +02:00
|
|
|
* Enable or disable peer-to-peer download for server.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param bool $enable
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function enableP2PDownload($enable=true, $multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns if the peer-to-peer download for server is enabled.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function isP2PDownload($multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-05-08 19:38:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allow clients to download maps from the server.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param bool $allow
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function allowMapDownload($allow=true, $multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
|
|
|
if(!is_bool($allow))
|
|
|
|
throw new InvalidArgumentException('allow = '.print_r($allow, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($allow), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if clients can download maps from the server.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function isMapDownloadAllowed($multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-05-08 19:38:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the path of the game datas directory.
|
|
|
|
* Only available to Admin.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return string
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function gameDataDirectory($multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), array($this, 'stripBom'));
|
|
|
|
return $this->stripBom($this->execute(ucfirst(__FUNCTION__)));
|
2014-05-08 19:38:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the path of the maps directory.
|
|
|
|
* Only available to Admin.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return string
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getMapsDirectory($multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), array($this, 'stripBom'));
|
|
|
|
return $this->stripBom($this->execute(ucfirst(__FUNCTION__)));
|
2014-05-08 19:38:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the path of the skins directory.
|
|
|
|
* Only available to Admin.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return string
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getSkinsDirectory($multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), array($this, 'stripBom'));
|
|
|
|
return $this->stripBom($this->execute(ucfirst(__FUNCTION__)));
|
2014-05-08 19:38:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @deprecated since version 2013-04-11
|
|
|
|
* Set Team names and colors.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $name1
|
|
|
|
* @param float $color1
|
|
|
|
* @param string $path1
|
|
|
|
* @param string $name2
|
|
|
|
* @param float $color2
|
|
|
|
* @param string $path2
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function setTeamInfo($name1, $color1, $path1, $name2, $color2, $path2, $multicall=false)
|
|
|
|
{
|
|
|
|
if(!is_string($name1))
|
|
|
|
throw new InvalidArgumentException('name1 = '.print_r($name1, true));
|
|
|
|
if(!is_float($color1))
|
|
|
|
throw new InvalidArgumentException('color1 = '.print_r($color1, true));
|
|
|
|
if(!is_string($path1))
|
|
|
|
throw new InvalidArgumentException('path1 = '.print_r($path1, true));
|
|
|
|
if(!is_string($name2))
|
|
|
|
throw new InvalidArgumentException('name2 = '.print_r($name2, true));
|
|
|
|
if(!is_float($color2))
|
|
|
|
throw new InvalidArgumentException('color2 = '.print_r($color2, true));
|
|
|
|
if(!is_string($path2))
|
|
|
|
throw new InvalidArgumentException('path2 = '.print_r($path2, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array('unused', 0., 'World', $name1, $color1, $path1, $name2, $color2, $path2), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return info for a given team.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param int $team 0: no clan, 1 or 2
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\Team
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getTeamInfo($team, $multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
|
|
|
if(!is_int($team) || $team < 0 || $team > 2)
|
|
|
|
throw new InvalidArgumentException('team = '.print_r($team, true));
|
|
|
|
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($team), $this->structHandler('Team'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\Team::fromArray($this->execute(ucfirst(__FUNCTION__), array($team)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the clublinks to use for the two teams.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $team1
|
|
|
|
* @param string $team2
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function setForcedClubLinks($team1, $team2, $multicall=false)
|
|
|
|
{
|
|
|
|
if(!is_string($team1))
|
|
|
|
throw new InvalidArgumentException('team1 = '.print_r($team1, true));
|
|
|
|
if(!is_string($team2))
|
|
|
|
throw new InvalidArgumentException('team2 = '.print_r($team2, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($team1, $team2), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the forced clublinks.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return string[]
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getForcedClubLinks($multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-05-08 19:38:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* (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:38:15 +02:00
|
|
|
function connectFakePlayer($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* (debug tool) Disconnect a fake player.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $login Fake player login or '*' for all
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function disconnectFakePlayer($login, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($login))
|
|
|
|
throw new InvalidArgumentException('login = '.print_r($login, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns the token infos for a player.
|
|
|
|
* @param mixed $player Login or player object
|
|
|
|
* @param bool $multicall
|
2014-05-13 17:37:35 +02:00
|
|
|
* @return Structures\TokenInfos
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getDemoTokenInfosForPlayer($player, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
|
|
|
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $this->structHandler('TokenInfos'));
|
2014-05-13 17:37:35 +02:00
|
|
|
return Structures\TokenInfos::fromArray($this->execute(ucfirst(__FUNCTION__), array($login)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +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-13 17:37:35 +02:00
|
|
|
function disableHorns($disable=true, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($disable), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns whether the horns are disabled.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function areHornsDisabled($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +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-13 17:37:35 +02:00
|
|
|
function disableServiceAnnounces($disable=true, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($disable), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns whether the automatic mesages are disabled.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function areServiceAnnouncesDisabled($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Enable the autosaving of all replays (vizualisable replays with all players, but not validable) on the server.
|
|
|
|
* Only available to SuperAdmin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $enable
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function autoSaveReplays($enable=true, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
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.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to SuperAdmin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $enable
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function autoSaveValidationReplays($enable=true, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
|
|
|
}
|
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
/**
|
|
|
|
* Returns if autosaving of all replays is enabled on the server.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function isAutoSaveReplaysEnabled($multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-05-08 19:38:15 +02:00
|
|
|
}
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-01-16 16:56:24 +01:00
|
|
|
* Returns if autosaving of validation replays is enabled on the server.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function isAutoSaveValidationReplaysEnabled($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Saves the current replay (vizualisable replays with all players, but not validable).
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $filename Empty for automatic filename
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function saveCurrentReplay($filename='', $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
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:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player Login or player object; empty for all
|
|
|
|
* @param string $filename Empty for automatic filename
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function saveBestGhostsReplay($player=null, $filename='', $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player, true);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
if(!is_string($filename))
|
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login, $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:38:15 +02:00
|
|
|
* @param mixed $player Login or player object
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-04-19 00:32:34 +02:00
|
|
|
* @return string
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getValidationReplay($player, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
|
|
|
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), function ($v) { return $v->scalar; });
|
2014-04-19 00:32:34 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login))->scalar;
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set a new ladder 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:38:15 +02:00
|
|
|
* @param int $mode 0: disabled, 1: forced
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setLadderMode($mode, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if($mode !== 0 && $mode !== 1)
|
|
|
|
throw new InvalidArgumentException('mode = '.print_r($mode, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($mode), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-01-16 16:56:24 +01:00
|
|
|
* Get the current and next ladder mode on server.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getLadderMode($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-01-16 16:56:24 +01:00
|
|
|
* Get the ladder points limit for the players allowed on this server.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\LadderLimits
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getLadderServerLimits($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('LadderLimits'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\LadderLimits::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set the network vehicle quality.
|
|
|
|
* 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:38:15 +02:00
|
|
|
* @param int $quality 0: fast, 1: high
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setVehicleNetQuality($quality, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if($quality !== 0 && $quality !== 1)
|
|
|
|
throw new InvalidArgumentException('quality = '.print_r($quality, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($quality), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-01-16 16:56:24 +01:00
|
|
|
* Get the current and next network vehicle quality on server.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getVehicleNetQuality($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set new server options using the struct passed as parameters.
|
|
|
|
* Mandatory fields:
|
2014-07-19 21:50:54 +02:00
|
|
|
* Name, Comment, Password, PasswordForSpectator, NextCallVoteTimeOut and CallVoteRatio.
|
2014-05-20 15:20:16 +02:00
|
|
|
* Ignored fields:
|
|
|
|
* LadderServerLimitMin, LadderServerLimitMax and those starting with Current.
|
|
|
|
* All other fields are optional and can be set to null to be ignored.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
2014-05-20 15:20:16 +02:00
|
|
|
* A change of any field starting with Next requires a map restart to be taken into account.
|
|
|
|
* @param Structures\ServerOptions $options
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setServerOptions($options, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-20 15:20:16 +02:00
|
|
|
if(!($options instanceof Structures\ServerOptions && $options->isValid()))
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('options = '.print_r($options, true));
|
|
|
|
|
2014-05-20 15:20:16 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($options->toSetterArray()), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns a struct containing the server options
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\ServerOptions
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getServerOptions($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('ServerOptions'));
|
2014-01-16 16:56:24 +01:00
|
|
|
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:38:15 +02:00
|
|
|
function setForcedTeams($enable, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
2014-05-08 19:38:15 +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.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getForcedTeams($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Defines the packmask of the server.
|
|
|
|
* 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.
|
2014-05-13 17:37:35 +02:00
|
|
|
* Only available in 2011-08-01 API version.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param string $packMask
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setServerPackMask($packMask, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($packMask))
|
2014-05-13 17:37:35 +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.
|
2014-05-13 17:37:35 +02:00
|
|
|
* Only available in 2011-08-01 API version.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return string
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getServerPackMask($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set the mods to apply on the clients.
|
|
|
|
* 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:38:15 +02:00
|
|
|
* @param bool $override If true, even the maps with a mod will be overridden by the server setting
|
|
|
|
* @param Structures\Mod|Structures\Mod[] $mods Array of structures [{string Env, string Url}, ...]
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setForcedMods($override, $mods, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($override))
|
|
|
|
throw new InvalidArgumentException('override = '.print_r($override, true));
|
|
|
|
if(is_array($mods))
|
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
foreach($mods as $i => &$mod)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!($mod instanceof Structures\Mod))
|
|
|
|
throw new InvalidArgumentException('mods['.$i.'] = '.print_r($mod, true));
|
|
|
|
$mod = $mod->toArray();
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
}
|
2014-05-08 19:38:15 +02:00
|
|
|
elseif($mods instanceof Structures\Mod)
|
|
|
|
$mods = array($mods->toArray());
|
|
|
|
else
|
|
|
|
throw new InvalidArgumentException('mods = '.print_r($mods, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($override, $mods), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the mods settings.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return array {bool Override, Structures\Mod[] Mods}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getForcedMods($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), function ($v) {
|
|
|
|
$v['Mods'] = Structures\Mod::fromArrayOfArray($v['Mods']);
|
|
|
|
return $v;
|
|
|
|
});
|
2014-01-16 16:56:24 +01:00
|
|
|
$result = $this->execute(ucfirst(__FUNCTION__));
|
|
|
|
$result['Mods'] = Structures\Mod::fromArrayOfArray($result['Mods']);
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set the music to play on the clients.
|
|
|
|
* Only available to Admin.
|
|
|
|
* Requires a map restart to be taken into account.
|
|
|
|
* @param bool $override If true, even the maps with a custom music will be overridden by the server setting
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param string $music Url or filename relative to the GameData path
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setForcedMusic($override, $music, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($override))
|
|
|
|
throw new InvalidArgumentException('override = '.print_r($override, true));
|
|
|
|
if(!is_string($music))
|
|
|
|
throw new InvalidArgumentException('music = '.print_r($music, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
if(!preg_match('~^.+?://~', $music))
|
|
|
|
$music = $this->secureUtf8($music);
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($override, $music), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the music setting.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\Music
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getForcedMusic($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('Music'));
|
2014-01-16 16:56:24 +01:00
|
|
|
return Structures\Music::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Defines a list of remappings for player skins.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Will only affect players connecting after the value is set.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param Structures\ForcedSkin|Structures\ForcedSkin[] $skins 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 (you may set value '' for any of those, all 3 null means same as Orig).
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setForcedSkins($skins, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(is_array($skins))
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
foreach($skins as $i => &$skin)
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!($skin instanceof Structures\ForcedSkin))
|
|
|
|
throw new InvalidArgumentException('skins['.$i.'] = '.print_r($skin, true));
|
|
|
|
$skin = $skin->toArray();
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-05-08 19:38:15 +02:00
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-05-08 19:38:15 +02:00
|
|
|
elseif($skins instanceof Structures\ForcedSkin)
|
|
|
|
$skins = array($skins->toArray());
|
|
|
|
else
|
|
|
|
throw new InvalidArgumentException('skins = '.print_r($skins, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($skins), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current forced skins.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\ForcedSkin[]
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getForcedSkins($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('ForcedSkin', true));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\ForcedSkin::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the last error message for an internet connection.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return string
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getLastConnectionErrorMessage($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-01-16 16:56:24 +01:00
|
|
|
* Set a new password for the referee mode.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $password
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setRefereePassword($password, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($password))
|
|
|
|
throw new InvalidArgumentException('password = '.print_r($password, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($password), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get the password for referee mode if called as Admin or Super Admin, else returns if a password is needed or not.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return string|bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getRefereePassword($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set the referee validation mode.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param int $mode 0: validate the top3 players, 1: validate all players
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setRefereeMode($mode, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if($mode !== 0 && $mode !== 1)
|
|
|
|
throw new InvalidArgumentException('mode = '.print_r($mode, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($mode), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-01-16 16:56:24 +01:00
|
|
|
* Get the referee validation mode.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getRefereeMode($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-01-16 16:56:24 +01:00
|
|
|
* Set whether the game should use a variable validation seed or not.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Requires a map restart to be taken into account.
|
|
|
|
* @param bool $enable
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setUseChangingValidationSeed($enable, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-01-16 16:56:24 +01:00
|
|
|
* Get the current and next value of UseChangingValidationSeed.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool[] {bool CurrentValue, bool NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getUseChangingValidationSeed($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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:38:15 +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:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setClientInputsMaxLatency($latency, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($latency))
|
|
|
|
throw new InvalidArgumentException('latency = '.print_r($latency, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($latency), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get the current ClientInputsMaxLatency.
|
|
|
|
* Only used by ShootMania.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return int
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getClientInputsMaxLatency($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether the server is in warm-up phase or not.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $enable
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setWarmUp($enable, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($enable))
|
|
|
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether the server is in warm-up phase.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getWarmUp($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get the current mode script.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return string
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getModeScriptText($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set the mode script and restart.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $script
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setModeScriptText($script, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($script))
|
|
|
|
throw new InvalidArgumentException('script = '.print_r($script, true));
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($script), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns the description of the current mode script.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\ScriptInfo
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getModeScriptInfo($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('ScriptInfo'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\ScriptInfo::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns the current settings of the mode script.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return array {mixed <setting name>, ...}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getModeScriptSettings($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Change the settings of the mode script.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed[] $settings {mixed <setting name>, ...}
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setModeScriptSettings($settings, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
if(!is_array($settings) || !$settings)
|
2014-05-08 19:38:15 +02:00
|
|
|
throw new InvalidArgumentException('settings = '.print_r($settings, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($settings), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Send commands to the mode script.
|
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param mixed[] $commands {mixed <command name>, ...}
|
2014-05-08 19:28:45 +02:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function sendModeScriptCommands($commands, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
if(!is_array($commands) || !$commands)
|
|
|
|
throw new InvalidArgumentException('commands = '.print_r($commands, true));
|
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($commands), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Change the settings and send commands to the mode script.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed[] $settings {mixed <setting name>, ...}
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param mixed[] $commands {mixed <command name>, ...}
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setModeScriptSettingsAndCommands($settings, $commands, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
if(!is_array($settings) || !$settings)
|
|
|
|
throw new InvalidArgumentException('settings = '.print_r($settings, true));
|
|
|
|
if(!is_array($commands) || !$commands)
|
|
|
|
throw new InvalidArgumentException('commands = '.print_r($commands, true));
|
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($settings, $commands), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns the current xml-rpc variables of the mode script.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-13 17:37:35 +02:00
|
|
|
* @return array {mixed <variable name>, ...}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getModeScriptVariables($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $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:38:15 +02:00
|
|
|
* Set the xml-rpc variables of the mode script.
|
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param mixed[] $variables {mixed <variable name>, ...}
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setModeScriptVariables($variables, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
if(!is_array($variables) || !$variables)
|
|
|
|
throw new InvalidArgumentException('variables = '.print_r($variables, true));
|
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($variables), $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:38:15 +02:00
|
|
|
* Send an event to the mode script.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Only available to Admin.
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param string $event
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string|string[] $params
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function triggerModeScriptEvent($event, $params='', $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($event))
|
2017-04-13 22:59:41 +02:00
|
|
|
throw new InvalidArgumentException('event name must be a string: event = '.print_r($event, true));
|
2014-05-08 19:38:15 +02:00
|
|
|
|
2014-05-13 17:37:35 +02:00
|
|
|
if(is_string($params))
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($event, $params), $multicall);
|
2017-04-13 22:59:41 +02:00
|
|
|
|
|
|
|
if(is_array($params)){
|
|
|
|
foreach($params as $param){
|
|
|
|
if(!is_string($param)){
|
|
|
|
throw new InvalidArgumentException('argument must be a string: param = '.print_r($param, true));
|
|
|
|
}
|
|
|
|
}
|
2014-05-13 17:37:35 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__).'Array', array($event, $params), $multicall);
|
2017-04-13 22:59:41 +02:00
|
|
|
}
|
|
|
|
|
2014-05-13 17:37:35 +02:00
|
|
|
// else
|
2017-04-13 22:59:41 +02:00
|
|
|
throw new InvalidArgumentException('argument must be string or string[]: params = '.print_r($params, true));
|
2014-05-08 19:28:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-13 17:37:35 +02:00
|
|
|
* @deprecated
|
|
|
|
* @see triggerModeScriptEvent()
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function triggerModeScriptEventArray($event, $params=array(), $multicall=false)
|
2014-05-08 19:28:45 +02:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
return $this->triggerModeScriptEvent($event, $params, $multicall);
|
2014-05-08 19:38:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the script cloud variables of given object.
|
|
|
|
* Only available to Admin.
|
2014-05-20 15:20:16 +02:00
|
|
|
* @param string $type
|
|
|
|
* @param string $id
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param bool $multicall
|
2014-06-12 15:39:50 +02:00
|
|
|
* @return array {mixed <variable name>, ...}
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-20 15:20:16 +02:00
|
|
|
function getScriptCloudVariables($type, $id, $multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
2014-05-20 15:20:16 +02:00
|
|
|
if(!is_string($type))
|
|
|
|
throw new InvalidArgumentException('type = '.print_r($type, true));
|
|
|
|
if(!is_string($id))
|
|
|
|
throw new InvalidArgumentException('id = '.print_r($id, true));
|
2014-05-08 19:38:15 +02:00
|
|
|
|
2014-05-20 15:20:16 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($type, $id), $multicall);
|
2014-05-08 19:28:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-13 17:37:35 +02:00
|
|
|
* Set the script cloud variables of given object.
|
|
|
|
* Only available to Admin.
|
2014-05-20 15:20:16 +02:00
|
|
|
* @param string $type
|
|
|
|
* @param string $id
|
|
|
|
* @param mixed[] $variables {mixed <variable name>, ...}
|
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-20 15:20:16 +02:00
|
|
|
function setScriptCloudVariables($type, $id, $variables, $multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
2014-05-20 15:20:16 +02:00
|
|
|
if(!is_string($type))
|
|
|
|
throw new InvalidArgumentException('type = '.print_r($type, true));
|
|
|
|
if(!is_string($id))
|
|
|
|
throw new InvalidArgumentException('id = '.print_r($id, true));
|
|
|
|
if(!is_array($variables) || !$variables)
|
|
|
|
throw new InvalidArgumentException('variables = '.print_r($variables, true));
|
2014-05-08 19:38:15 +02:00
|
|
|
|
2014-05-20 15:20:16 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($type, $id, $variables), $multicall);
|
2014-05-08 19:38:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Restarts the map.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param bool $dontClearCupScores Only available in legacy cup mode
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
function restartMap($dontClearCupScores=false, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($dontClearCupScores))
|
|
|
|
throw new InvalidArgumentException('dontClearCupScores = '.print_r($dontClearCupScores, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($dontClearCupScores), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Switch to next map.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param bool $dontClearCupScores Only available in legacy cup mode
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function nextMap($dontClearCupScores=false, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_bool($dontClearCupScores))
|
|
|
|
throw new InvalidArgumentException('dontClearCupScores = '.print_r($dontClearCupScores, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($dontClearCupScores), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Attempt to balance teams.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function autoTeamBalance($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stop the server.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to SuperAdmin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
* In legacy Rounds or Laps mode, force the end of round without waiting for all players to giveup/finish.
|
|
|
|
* Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
* Only available to Admin.
|
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:38:15 +02:00
|
|
|
function setGameInfos($gameInfos, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!($gameInfos instanceof Structures\GameInfos))
|
|
|
|
throw new InvalidArgumentException('gameInfos = '.print_r($gameInfos, true));
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($gameInfos->toArray()), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns a struct containing the current game settings.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\GameInfos
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCurrentGameInfo($multicall=false)
|
2014-05-08 19:38:15 +02:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('GameInfos'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\GameInfos::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns a struct containing the game settings for the next map.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\GameInfos
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getNextGameInfo($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('GameInfos'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\GameInfos::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns a struct containing two other structures, the first containing the current game settings and the second the game settings for next map.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\GameInfos[] {Structures\GameInfos CurrentGameInfos, Structures\GameInfos NextGameInfos}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getGameInfos($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('GameInfos', true));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\GameInfos::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set a new game 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:38:15 +02:00
|
|
|
* @param int $gameMode 0: Script, 1: Rounds, 2: TimeAttack, 3: Team, 4: Laps, 5: Cup, 6: Stunt
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setGameMode($gameMode, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($gameMode) || $gameMode < 0 || $gameMode > 6)
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('gameMode = '.print_r($gameMode, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($gameMode), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-08 23:11:20 +02:00
|
|
|
* @deprecated since version 2022-03-21
|
2014-01-16 16:56:24 +01:00
|
|
|
* Get the current game mode.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return int
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getGameMode($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set a new chat time value (actually the duration of the podium).
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param int $chatTime In milliseconds, 0: no podium displayed
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setChatTime($chatTime, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($chatTime))
|
|
|
|
throw new InvalidArgumentException('chatTime = '.print_r($chatTime, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($chatTime), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get the current and next chat time.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getChatTime($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set a new finish timeout value for legacy laps and rounds based modes.
|
|
|
|
* 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:38:15 +02:00
|
|
|
* @param int $timeout In milliseconds, 0: default, 1: adaptative to the map duration
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setFinishTimeout($timeout, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($timeout))
|
|
|
|
throw new InvalidArgumentException('timeout = '.print_r($timeout, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($timeout), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get the current and next FinishTimeout.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getFinishTimeout($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set whether to enable the automatic warm-up phase in all modes.
|
2014-05-08 19:38:15 +02:00
|
|
|
* 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:38:15 +02:00
|
|
|
* @param int $duration 0: disable, number of rounds in rounds based modes, number of times the gold medal time otherwise
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setAllWarmUpDuration($duration, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($duration))
|
|
|
|
throw new InvalidArgumentException('duration = '.print_r($duration, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($duration), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get whether the automatic warm-up phase is enabled in all modes.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getAllWarmUpDuration($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set whether to disallow players to respawn.
|
2014-05-08 19:38:15 +02:00
|
|
|
* 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:38:15 +02:00
|
|
|
* @param bool $disable
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setDisableRespawn($disable, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($disable), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get whether players are disallowed to respawn.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool[] {bool CurrentValue, bool NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getDisableRespawn($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set whether to override the players preferences and always display all opponents.
|
|
|
|
* 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:38:15 +02:00
|
|
|
* @param int $opponents 0: no override, 1: show all, else: minimum number of opponents
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setForceShowAllOpponents($opponents, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($opponents))
|
|
|
|
throw new InvalidArgumentException('opponents = '.print_r($opponents, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($opponents), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get whether players are forced to show all opponents.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getForceShowAllOpponents($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set a new mode 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:38:15 +02:00
|
|
|
* @param string $script
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setScriptName($script, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($script))
|
|
|
|
throw new InvalidArgumentException('script = '.print_r($script, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$script = $this->secureUtf8($script);
|
2014-05-08 19:38:15 +02:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($script), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get the current and next mode script name for script mode.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return string[] {string CurrentValue, string NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getScriptName($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), array($this, 'stripBom'));
|
|
|
|
return $this->stripBom($this->execute(ucfirst(__FUNCTION__)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set a new time limit for legacy time attack 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:38:15 +02:00
|
|
|
* @param int $limit In milliseconds
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setTimeAttackLimit($limit, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($limit))
|
|
|
|
throw new InvalidArgumentException('limit = '.print_r($limit, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($limit), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get the current and next time limit for legacy time attack mode.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getTimeAttackLimit($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set a new synchronized start period for legacy time attack 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:38:15 +02:00
|
|
|
* @param int $synch
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setTimeAttackSynchStartPeriod($synch, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($synch))
|
|
|
|
throw new InvalidArgumentException('synch = '.print_r($synch, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($synch), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get the current and synchronized start period for legacy time attack mode.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getTimeAttackSynchStartPeriod($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set a new time limit for legacy laps 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:38:15 +02:00
|
|
|
* @param int $limit
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setLapsTimeLimit($limit, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($limit))
|
|
|
|
throw new InvalidArgumentException('limit = '.print_r($limit, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($limit), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get the current and next time limit for legacy laps mode.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getLapsTimeLimit($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set a new number of laps for legacy laps 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:38:15 +02:00
|
|
|
* @param int $laps
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setNbLaps($laps, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($laps))
|
|
|
|
throw new InvalidArgumentException('laps = '.print_r($laps, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($laps), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get the current and next number of laps for legacy laps mode.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getNbLaps($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set a new number of laps for legacy rounds 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:38:15 +02:00
|
|
|
* @param int $laps 0: map default
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setRoundForcedLaps($laps, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($laps))
|
|
|
|
throw new InvalidArgumentException('laps = '.print_r($laps, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($laps), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current and next number of laps for rounds mode.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getRoundForcedLaps($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set a new points limit for legacy rounds mode (value set depends on UseNewRulesRound).
|
|
|
|
* 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:38:15 +02:00
|
|
|
* @param int $limit
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setRoundPointsLimit($limit, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($limit))
|
|
|
|
throw new InvalidArgumentException('limit = '.print_r($limit, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($limit), $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-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getRoundPointsLimit($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set the points used for the scores in legacy rounds mode.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param int[] $points Array of decreasing integers for the players from the first to last
|
|
|
|
* @param bool $relax True to relax the constraint checking on the scores
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setRoundCustomPoints($points, $relax=false, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_array($points))
|
|
|
|
throw new InvalidArgumentException('points = '.print_r($points, true));
|
|
|
|
if(!is_bool($relax))
|
|
|
|
throw new InvalidArgumentException('relax = '.print_r($relax, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($points, $relax), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Gets the points used for the scores in legacy rounds mode.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[]
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getRoundCustomPoints($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Set if new rules are used for legacy rounds mode.
|
|
|
|
* Only available to Admin.
|
|
|
|
* Requires a map restart to be taken into account.
|
|
|
|
* @param bool $newRules
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setUseNewRulesRound($newRules, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_bool($newRules))
|
|
|
|
throw new InvalidArgumentException('newRules = '.print_r($newRules, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($newRules), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get if the new rules are used for legacy rounds mode (Current and next values).
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool[] {bool CurrentValue, bool NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getUseNewRulesRound($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new points limit for team mode (value set depends on UseNewRulesTeam).
|
2014-05-08 19:38:15 +02:00
|
|
|
* 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:38:15 +02:00
|
|
|
* @param int $limit
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setTeamPointsLimit($limit, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($limit))
|
|
|
|
throw new InvalidArgumentException('limit = '.print_r($limit, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($limit), $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-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getTeamPointsLimit($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new number of maximum points per round for team mode.
|
2014-05-08 19:38:15 +02:00
|
|
|
* 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:38:15 +02:00
|
|
|
* @param int $max
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setMaxPointsTeam($max, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($max))
|
|
|
|
throw new InvalidArgumentException('max = '.print_r($max, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($max), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current and next number of maximum points per round for team mode.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getMaxPointsTeam($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set if new rules are used for team mode.
|
2014-05-08 19:38:15 +02:00
|
|
|
* 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:38:15 +02:00
|
|
|
* @param bool $newRules
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setUseNewRulesTeam($newRules, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_bool($newRules))
|
|
|
|
throw new InvalidArgumentException('newRules = '.print_r($newRules, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($newRules), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get if the new rules are used for team mode (Current and next values).
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return bool[] {bool CurrentValue, bool NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getUseNewRulesTeam($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the points needed for victory in Cup mode.
|
2014-05-08 19:38:15 +02:00
|
|
|
* 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:38:15 +02:00
|
|
|
* @param int $limit
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setCupPointsLimit($limit, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($limit))
|
|
|
|
throw new InvalidArgumentException('limit = '.print_r($limit, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($limit), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the points needed for victory in Cup mode.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCupPointsLimit($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the number of rounds before going to next map in Cup mode.
|
2014-05-08 19:38:15 +02:00
|
|
|
* 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:38:15 +02:00
|
|
|
* @param int $rounds
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setCupRoundsPerMap($rounds, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($rounds))
|
|
|
|
throw new InvalidArgumentException('rounds = '.print_r($rounds, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($rounds), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the number of rounds before going to next map in Cup mode.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCupRoundsPerMap($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set whether to enable the automatic warm-up phase in Cup mode.
|
2014-05-08 19:38:15 +02:00
|
|
|
* 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:38:15 +02:00
|
|
|
* @param int $duration Number of rounds, 0: no warm-up
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setCupWarmUpDuration($duration, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($duration))
|
|
|
|
throw new InvalidArgumentException('duration = '.print_r($duration, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($duration), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get whether the automatic warm-up phase is enabled in Cup mode.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCupWarmUpDuration($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the number of winners to determine before the match is considered over.
|
2014-05-08 19:32:14 +02:00
|
|
|
* Only available to Admin.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Requires a map restart to be taken into account.
|
|
|
|
* @param int $winners
|
2014-05-08 19:32:14 +02:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setCupNbWinners($winners, $multicall=false)
|
2014-05-08 19:32:14 +02:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($winners))
|
|
|
|
throw new InvalidArgumentException('winners = '.print_r($winners, true));
|
2014-05-08 19:32:14 +02:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($winners), $multicall);
|
2014-05-08 19:32:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Get the number of winners to determine before the match is considered over.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int[] {int CurrentValue, int NextValue}
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCupNbWinners($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns the current map index in the selection, or -1 if the map is no longer in the selection.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCurrentMapIndex($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $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:38:15 +02:00
|
|
|
* Returns the map index in the selection that will be played next (unless the current one is restarted...)
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getNextMapIndex($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Sets the map index in the selection that will be played next (unless the current one is restarted...)
|
|
|
|
* @param int $index
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setNextMapIndex($index, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($index))
|
|
|
|
throw new InvalidArgumentException('index = '.print_r($index, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($index), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Sets the map in the selection that will be played next (unless the current one is restarted...)
|
|
|
|
* @param string $ident
|
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function setNextMapIdent($ident, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($ident))
|
|
|
|
throw new InvalidArgumentException('ident = '.print_r($ident, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($ident), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Immediately jumps to the map designated by the index in the selection.
|
|
|
|
* @param int $index
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function jumpToMapIndex($index, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_int($index))
|
|
|
|
throw new InvalidArgumentException('index = '.print_r($index, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($index), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Immediately jumps to the map designated by its identifier (it must be in the selection).
|
|
|
|
* @param string $ident
|
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function jumpToMapIdent($ident, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_string($ident))
|
|
|
|
throw new InvalidArgumentException('ident = '.print_r($ident, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($ident), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a struct containing the infos for the current map.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\Map
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCurrentMapInfo($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('Map'));
|
2014-01-16 16:56:24 +01:00
|
|
|
return Structures\Map::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a struct containing the infos for the next map.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\Map
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getNextMapInfo($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('Map'));
|
2014-01-16 16:56:24 +01:00
|
|
|
return Structures\Map::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a struct containing the infos for the map with the specified filename.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Relative to the Maps path
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\Map
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getMapInfo($filename, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $this->structHandler('Map'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\Map::fromArray($this->execute(ucfirst(__FUNCTION__), array($filename)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a boolean if the map with the specified filename matches the current server settings.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Relative to the Maps path
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function checkMapForCurrentServerParams($filename, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_string($filename))
|
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a list of maps among the current selection of the server.
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param int $length Maximum number of infos to be returned
|
|
|
|
* @param int $offset Starting index in the list
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\Map[]
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getMapList($length=-1, $offset=0, $multicall=false)
|
2014-01-16 16:56:24 +01: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-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($length, $offset), $this->structHandler('Map', true));
|
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.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Relative to the Maps path
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function addMap($filename, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
if(!is_string($filename) || !strlen($filename))
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Add the list of maps with the specified filenames at the end of the current selection.
|
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string[] $filenames Relative to the Maps path
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-13 17:37:35 +02:00
|
|
|
* @return int Number of maps actually added
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function addMapList($filenames, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_array($filenames))
|
|
|
|
throw new InvalidArgumentException('filenames = '.print_r($filenames, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filenames = $this->secureUtf8($filenames);
|
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.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Relative to the Maps path
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function removeMap($filename, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
if(!is_string($filename) || !strlen($filename))
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
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:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string[] $filenames Relative to the Maps path
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-13 17:37:35 +02:00
|
|
|
* @return int Number of maps actually removed
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function removeMapList($filenames, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_array($filenames))
|
|
|
|
throw new InvalidArgumentException('filenames = '.print_r($filenames, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filenames = $this->secureUtf8($filenames);
|
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.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Relative to the Maps path
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function insertMap($filename, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
if(!is_string($filename) || !strlen($filename))
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
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:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string[] $filenames Relative to the Maps path
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param bool $multicall
|
2014-05-13 17:37:35 +02:00
|
|
|
* @return int Number of maps actually inserted
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function insertMapList($filenames, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_array($filenames))
|
|
|
|
throw new InvalidArgumentException('filenames = '.print_r($filenames, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filenames = $this->secureUtf8($filenames);
|
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.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Relative to the Maps path
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:32:14 +02:00
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function chooseNextMap($filename, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
if(!is_string($filename) || !strlen($filename))
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
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:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-20 15:20:16 +02:00
|
|
|
* @param string[] $filenames Relative to the Maps path
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-13 17:37:35 +02:00
|
|
|
* @return int Number of maps actually chosen
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function chooseNextMapList($filenames, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_array($filenames))
|
|
|
|
throw new InvalidArgumentException('filenames = '.print_r($filenames, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filenames = $this->secureUtf8($filenames);
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filenames), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +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.
|
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Relative to the Maps path
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param bool $multicall
|
2014-05-13 17:37:35 +02:00
|
|
|
* @return int Number of maps in the new list
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function loadMatchSettings($filename, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
if(!is_string($filename) || !strlen($filename))
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
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.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Relative to the Maps path
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param bool $multicall
|
2014-05-13 17:37:35 +02:00
|
|
|
* @return int Number of maps actually added
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function appendPlaylistFromMatchSettings($filename, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
if(!is_string($filename) || !strlen($filename))
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
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.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Relative to the Maps path
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
2014-05-13 17:37:35 +02:00
|
|
|
* @return int Number of maps in the saved playlist
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function saveMatchSettings($filename, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
if(!is_string($filename) || !strlen($filename))
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
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.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-05-13 17:37:35 +02:00
|
|
|
* @param string $filename Relative to the Maps path
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param bool $multicall
|
2014-05-13 17:37:35 +02:00
|
|
|
* @return int Number of maps actually inserted
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function insertPlaylistFromMatchSettings($filename, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-13 17:37:35 +02:00
|
|
|
if(!is_string($filename) || !strlen($filename))
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
2014-06-12 15:39:50 +02:00
|
|
|
$filename = $this->secureUtf8($filename);
|
2014-01-16 16:56:24 +01:00
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns the list of players on the server.
|
|
|
|
* @param int $length Maximum number of infos to be returned
|
|
|
|
* @param int $offset Starting index in the list
|
|
|
|
* @param int $compatibility 0: united, 1: forever, 2: forever including servers
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\PlayerInfo[]
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getPlayerList($length=-1, $offset=0, $compatibility=1, $multicall=false)
|
2014-01-16 16:56:24 +01: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-05-08 19:38:15 +02:00
|
|
|
if(!is_int($compatibility) || $compatibility < 0 || $compatibility > 2)
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('compatibility = '.print_r($compatibility, true));
|
|
|
|
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($length, $offset, $compatibility), $this->structHandler('PlayerInfo', true));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\PlayerInfo::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($length, $offset, $compatibility)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns a struct containing the infos on the player with the specified login.
|
|
|
|
* @param mixed $player Login or player object
|
|
|
|
* @param int $compatibility 0: united, 1: forever
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\PlayerInfo
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getPlayerInfo($player, $compatibility=1, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
|
|
|
if($compatibility !== 0 && $compatibility !== 1)
|
2014-01-16 16:56:24 +01:00
|
|
|
throw new InvalidArgumentException('compatibility = '.print_r($compatibility, true));
|
|
|
|
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login, $compatibility), $this->structHandler('PlayerInfo'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\PlayerInfo::fromArray($this->execute(ucfirst(__FUNCTION__), array($login, $compatibility)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns a struct containing the infos on the player with the specified login.
|
|
|
|
* @param mixed $player Login or player object
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\PlayerDetailedInfo
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getDetailedPlayerInfo($player, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login), $this->structHandler('PlayerDetailedInfo'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\PlayerDetailedInfo::fromArray($this->execute(ucfirst(__FUNCTION__), array($login)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns a struct containing the player infos of the game server
|
|
|
|
* (ie: in case of a basic server, itself; in case of a relay server, the main server)
|
|
|
|
* @param int $compatibility 0: united, 1: forever
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\PlayerInfo
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getMainServerPlayerInfo($compatibility=1, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_int($compatibility))
|
|
|
|
throw new InvalidArgumentException('compatibility = '.print_r($compatibility, true));
|
|
|
|
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($compatibility), $this->structHandler('PlayerInfo'));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\PlayerInfo::fromArray($this->execute(ucfirst(__FUNCTION__), array($compatibility)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-13 17:37:35 +02:00
|
|
|
* Returns the current rankings for the match in progress.
|
|
|
|
* In script modes, scores aren't returned.
|
|
|
|
* In team modes, the scores for the two teams are returned.
|
|
|
|
* In other modes, it's the individual players' scores.
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param int $length Maximum number of infos to be returned
|
|
|
|
* @param int $offset Starting index in the list
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return Structures\PlayerRanking[]
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCurrentRanking($length=-1, $offset=0, $multicall=false)
|
2014-01-16 16:56:24 +01: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-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($length, $offset), $this->structHandler('PlayerRanking', true));
|
2014-05-08 19:38:15 +02:00
|
|
|
return Structures\PlayerRanking::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($length, $offset)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-13 17:37:35 +02:00
|
|
|
* Returns the current ranking of the player with the specified login (or list of comma-separated logins) for the match in progress.
|
|
|
|
* In script modes, scores aren't returned.
|
|
|
|
* In other modes, it's the individual players' scores.
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param mixed $players Login, player object or array
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return Structures\PlayerRanking[]
|
2014-01-16 16:56:24 +01:00
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function getCurrentRankingForLogin($players, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$logins = $this->getLogins($players);
|
|
|
|
if($logins === false)
|
|
|
|
throw new InvalidArgumentException('players = '.print_r($players, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($logins), $this->structHandler('PlayerRanking', true));
|
|
|
|
return Structures\PlayerRanking::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($logins)));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-13 17:37:35 +02:00
|
|
|
* Returns the current winning team for the race in progress.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-13 17:37:35 +02:00
|
|
|
* @return int -1: if not in team mode or draw match, 0 or 1 otherwise
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getCurrentWinnerTeam($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Force the scores of the current game.
|
|
|
|
* Only available in rounds and team mode.
|
|
|
|
* Only available to Admin/SuperAdmin.
|
|
|
|
* @param int[][] $scores Array of structs {int PlayerId, int Score}
|
|
|
|
* @param bool $silent True to update silently (only available for SuperAdmin)
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function forceScores($scores, $silent, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(!is_array($scores))
|
|
|
|
throw new InvalidArgumentException('scores = '.print_r($scores, true));
|
2014-05-08 19:38:15 +02:00
|
|
|
foreach($scores as $i => $score)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_array($score))
|
|
|
|
throw new InvalidArgumentException('score['.$i.'] = '.print_r($score, true));
|
|
|
|
if(!isset($score['PlayerId']) || !is_int($score['PlayerId']))
|
|
|
|
throw new InvalidArgumentException('score['.$i.']["PlayerId"] = '.print_r($score, true));
|
|
|
|
if(!isset($score['Score']) || !is_int($score['Score']))
|
|
|
|
throw new InvalidArgumentException('score['.$i.']["Score"] = '.print_r($score, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-05-08 19:38:15 +02:00
|
|
|
if(!is_bool($silent))
|
|
|
|
throw new InvalidArgumentException('silent = '.print_r($silent, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($scores, $silent), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Force the team of the player.
|
|
|
|
* Only available in team mode.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player Login or player object
|
|
|
|
* @param int $team 0 or 1
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function forcePlayerTeam($player, $team, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
|
|
|
if($team !== 0 && $team !== 1)
|
|
|
|
throw new InvalidArgumentException('team = '.print_r($team, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login, $team), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Force the spectating status of the player.
|
|
|
|
* Only available to Admin.
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param mixed $player Login or player object
|
|
|
|
* @param int $mode 0: user selectable, 1: spectator, 2: player, 3: spectator but keep selectable
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function forceSpectator($player, $mode, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
|
|
|
if(!is_int($mode) || $mode < 0 || $mode > 3)
|
|
|
|
throw new InvalidArgumentException('mode = '.print_r($mode, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($login, $mode), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Force spectators to look at a specific player.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $spectator Login or player object; empty for all
|
|
|
|
* @param mixed $target Login or player object; empty for automatic
|
|
|
|
* @param int $camera -1: leave unchanged, 0: replay, 1: follow, 2: free
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function forceSpectatorTarget($spectator, $target, $camera, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$spectatorLogin = $this->getLogin($spectator, true);
|
|
|
|
if($spectatorLogin === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($spectator, true));
|
|
|
|
$targetLogin = $this->getLogin($target, true);
|
|
|
|
if($targetLogin === false)
|
|
|
|
throw new InvalidArgumentException('target = '.print_r($target, true));
|
|
|
|
if(!is_int($camera) || $camera < -1 || $camera > 2)
|
|
|
|
throw new InvalidArgumentException('camera = '.print_r($camera, true));
|
2014-01-16 16:56:24 +01:00
|
|
|
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($spectatorLogin, $targetLogin, $camera), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Pass the login of the spectator.
|
2014-05-13 17:37:35 +02:00
|
|
|
* A spectator that once was a player keeps his player slot, so that he can go back to player mode.
|
2014-01-16 16:56:24 +01:00
|
|
|
* Calling this function frees this slot for another player to connect.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param mixed $player Login or player object
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
2014-05-08 19:38:15 +02:00
|
|
|
* @throws InvalidArgumentException
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function spectatorReleasePlayerSlot($player, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), 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:38:15 +02:00
|
|
|
* Only available to Admin.
|
|
|
|
* @param bool $enable
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
2014-05-13 17:37:35 +02:00
|
|
|
function manualFlowControlEnable($enable=true, $multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array($enable), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allows the game to proceed.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to Admin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:38:15 +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:38:15 +02:00
|
|
|
* Returns whether the manual control of the game flow is enabled.
|
|
|
|
* Only available to Admin.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return int 0: no, 1: yes by the xml-rpc client making the call, 2: yes by some other xml-rpc client
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function manualFlowControlIsEnabled($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns the transition that is currently blocked, or '' if none.
|
|
|
|
* (That's exactly the value last received by the callback.)
|
|
|
|
* Only available to Admin.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return string
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function manualFlowControlGetCurTransition($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current match ending condition.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-05-08 19:38:15 +02:00
|
|
|
* @return string 'Playing', 'ChangeMap' or 'Finished'
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function checkEndMatchCondition($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Returns a struct containing the networks stats of the server.
|
|
|
|
* Only available to SuperAdmin.
|
2014-06-12 15:39:50 +02:00
|
|
|
* @param bool $multicall
|
2014-01-16 16:56:24 +01:00
|
|
|
* @return Structures\NetworkStats
|
|
|
|
*/
|
2014-06-12 15:39:50 +02:00
|
|
|
function getNetworkStats($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-06-12 15:39:50 +02:00
|
|
|
if($multicall)
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('NetworkStats'));
|
2014-01-16 16:56:24 +01:00
|
|
|
return Structures\NetworkStats::fromArray($this->execute(ucfirst(__FUNCTION__)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Start a server on lan, using the current configuration.
|
2014-05-08 19:38:15 +02:00
|
|
|
* Only available to SuperAdmin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function startServerLan($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-05-08 19:38:15 +02:00
|
|
|
* Start a server on internet, using the current configuration.
|
|
|
|
* Only available to SuperAdmin.
|
2014-01-16 16:56:24 +01:00
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
function startServerInternet($multicall=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
|
|
}
|
|
|
|
|
2014-05-20 15:20:16 +02:00
|
|
|
/**
|
|
|
|
* Join the server on lan.
|
|
|
|
* Only available on client.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $host IPv4 with optionally a port (eg. '192.168.1.42:2350')
|
|
|
|
* @param string $password
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function joinServerLan($host, $password='', $multicall=false)
|
|
|
|
{
|
|
|
|
if(!is_string($host))
|
|
|
|
throw new InvalidArgumentException('host = '.print_r($host, true));
|
|
|
|
if(!is_string($password))
|
|
|
|
throw new InvalidArgumentException('password = '.print_r($password, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(array('Server' => $host, 'ServerPassword' => $password)), $multicall);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Join the server on internet.
|
|
|
|
* Only available on client.
|
|
|
|
* Only available to Admin.
|
|
|
|
* @param string $host Server login or IPv4 with optionally a port (eg. '192.168.1.42:2350')
|
|
|
|
* @param string $password
|
|
|
|
* @param bool $multicall
|
|
|
|
* @return bool
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
function joinServerInternet($host, $password='', $multicall=false)
|
|
|
|
{
|
|
|
|
if(!is_string($host))
|
|
|
|
throw new InvalidArgumentException('host = '.print_r($host, true));
|
|
|
|
if(!is_string($password))
|
|
|
|
throw new InvalidArgumentException('password = '.print_r($password, true));
|
|
|
|
|
|
|
|
return $this->execute(ucfirst(__FUNCTION__), array(array('Server' => $host, 'ServerPassword' => $password)), $multicall);
|
|
|
|
}
|
|
|
|
|
2014-01-16 16:56:24 +01:00
|
|
|
/**
|
|
|
|
* Returns the login of the given player
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param mixed $player
|
|
|
|
* @return string|bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
private function getLogin($player, $allowEmpty=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
if(is_object($player))
|
|
|
|
{
|
|
|
|
if(property_exists($player, 'login'))
|
|
|
|
$player = $player->login;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(empty($player))
|
|
|
|
return $allowEmpty ? '' : false;
|
|
|
|
if(is_string($player))
|
|
|
|
return $player;
|
|
|
|
return false;
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns logins of given players
|
2014-05-08 19:38:15 +02:00
|
|
|
* @param mixed $players
|
|
|
|
* @return string|bool
|
2014-01-16 16:56:24 +01:00
|
|
|
*/
|
2014-05-08 19:38:15 +02:00
|
|
|
private function getLogins($players, $allowEmpty=false)
|
2014-01-16 16:56:24 +01:00
|
|
|
{
|
|
|
|
if(is_array($players))
|
|
|
|
{
|
|
|
|
$logins = array();
|
|
|
|
foreach($players as $player)
|
|
|
|
{
|
2014-05-08 19:38:15 +02:00
|
|
|
$login = $this->getLogin($player);
|
|
|
|
if($login === false)
|
|
|
|
return false;
|
2014-05-13 17:37:35 +02:00
|
|
|
$logins[] = $login;
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return implode(',', $logins);
|
|
|
|
}
|
2014-05-08 19:38:15 +02:00
|
|
|
return $this->getLogin($players, $allowEmpty);
|
2014-01-16 16:56:24 +01:00
|
|
|
}
|
2014-06-12 15:39:50 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string|string[] $str
|
|
|
|
* @return string|string[]
|
|
|
|
*/
|
|
|
|
private function stripBom($str)
|
|
|
|
{
|
|
|
|
if(is_string($str))
|
|
|
|
return str_replace("\xEF\xBB\xBF", '', $str);
|
|
|
|
return array_map(array($this, 'stripBom'), $str);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string|string[] $filename
|
|
|
|
* @return string|string[]
|
|
|
|
*/
|
|
|
|
private function secureUtf8($filename)
|
|
|
|
{
|
|
|
|
if(is_string($filename))
|
|
|
|
{
|
|
|
|
$filename = $this->stripBom($filename);
|
2015-02-24 10:26:46 +01:00
|
|
|
if(preg_match('/[^\x09\x0A\x0D\x20-\x7E]/', $filename))
|
|
|
|
return "\xEF\xBB\xBF".$filename;
|
|
|
|
return $filename;
|
2014-06-12 15:39:50 +02:00
|
|
|
}
|
|
|
|
return array_map(array($this, 'secureUtf8'), $filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $struct
|
|
|
|
* @param bool $array
|
|
|
|
* @return callable
|
|
|
|
*/
|
|
|
|
private function structHandler($struct, $array=false)
|
|
|
|
{
|
|
|
|
return array('\\'.__NAMESPACE__.'\Structures\\'.$struct, 'fromArray'.($array ? 'OfArray' : ''));
|
|
|
|
}
|
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 {}
|