dedicated-server-api update
This commit is contained in:
parent
eb5af6ebd1
commit
d16e89d13d
@ -56,6 +56,7 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* @param Connection|string $hostOrConnection
|
* @param Connection|string $hostOrConnection
|
||||||
* @param int $port
|
* @param int $port
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function delete($hostOrConnection, $port=null)
|
static function delete($hostOrConnection, $port=null)
|
||||||
{
|
{
|
||||||
@ -67,7 +68,9 @@ class Connection
|
|||||||
{
|
{
|
||||||
self::$instances[$key]->terminate();
|
self::$instances[$key]->terminate();
|
||||||
unset(self::$instances[$key]);
|
unset(self::$instances[$key]);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -189,7 +192,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function enableCallbacks($enable, $multicall=false)
|
function enableCallbacks($enable=true, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_bool($enable))
|
if(!is_bool($enable))
|
||||||
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
||||||
@ -471,21 +474,40 @@ class Connection
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* Send a text message, possibly localised to a specific login or to everyone, without the server login.
|
||||||
* @see chatSend()
|
* 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
|
||||||
*/
|
*/
|
||||||
function chatSendServerMessage($message, $recipient=null, $multicall=false)
|
function chatSendServerMessage($message, $recipient=null, $multicall=false)
|
||||||
{
|
{
|
||||||
return $this->chatSend($message, $recipient, true, $multicall);
|
$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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @see chatSend()
|
* @see chatSendServerMessage()
|
||||||
*/
|
*/
|
||||||
function chatSendServerMessageToLanguage($messages, $recipient=null, $multicall=false)
|
function chatSendServerMessageToLanguage($messages, $recipient=null, $multicall=false)
|
||||||
{
|
{
|
||||||
return $this->chatSend($messages, $recipient, true, $multicall);
|
return $this->chatSendServerMessage($messages, $recipient, $multicall);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -494,31 +516,24 @@ class Connection
|
|||||||
* @param string|string[][] $message Single string or array of structures {Lang='xx', Text='...'}:
|
* @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
|
* 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 mixed $recipient Login, player object or array; null for all
|
||||||
* @param bool $isServerMessage False to include server login
|
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function chatSend($message, $recipient=null, $isServerMessage=false, $multicall=false)
|
function chatSend($message, $recipient=null, $multicall=false)
|
||||||
{
|
{
|
||||||
$logins = $this->getLogins($recipient, true);
|
$logins = $this->getLogins($recipient, true);
|
||||||
if($logins === false)
|
if($logins === false)
|
||||||
throw new InvalidArgumentException('recipient = '.print_r($recipient, true));
|
throw new InvalidArgumentException('recipient = '.print_r($recipient, true));
|
||||||
|
|
||||||
$method = ucfirst(__FUNCTION__);
|
if(is_array($message))
|
||||||
if(!is_bool($isServerMessage))
|
return $this->execute(ucfirst(__FUNCTION__).'ToLanguage', array($message, $logins), $multicall);
|
||||||
throw new InvalidArgumentException('isServerMessage = '.print_r($isServerMessage, true));
|
|
||||||
if($isServerMessage)
|
|
||||||
$method .= 'ServerMessage';
|
|
||||||
|
|
||||||
if(is_string($message))
|
if(is_string($message))
|
||||||
{
|
{
|
||||||
if($logins === '')
|
if($logins)
|
||||||
return $this->execute($method, array($message), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($message, $logins), $multicall);
|
||||||
return $this->execute($method.'ToLogin', array($message, $logins), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($message), $multicall);
|
||||||
}
|
}
|
||||||
if(is_array($message))
|
|
||||||
return $this->execute($method.'ToLanguage', array($message, $logins), $multicall);
|
|
||||||
// else
|
// else
|
||||||
throw new InvalidArgumentException('message = '.print_r($message, true));
|
throw new InvalidArgumentException('message = '.print_r($message, true));
|
||||||
}
|
}
|
||||||
@ -529,7 +544,7 @@ class Connection
|
|||||||
*/
|
*/
|
||||||
function chatSendToLanguage($messages, $recipient=null, $multicall=false)
|
function chatSendToLanguage($messages, $recipient=null, $multicall=false)
|
||||||
{
|
{
|
||||||
return $this->chatSend($messages, $recipient, false, $multicall);
|
return $this->chatSend($messages, $recipient, $multicall);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -551,7 +566,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function chatEnableManualRouting($enable, $excludeServer=false, $multicall=false)
|
function chatEnableManualRouting($enable=true, $excludeServer=false, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_bool($enable))
|
if(!is_bool($enable))
|
||||||
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
||||||
@ -620,9 +635,9 @@ class Connection
|
|||||||
if(!is_int($variant) || $variant < 0 || $variant > 2)
|
if(!is_int($variant) || $variant < 0 || $variant > 2)
|
||||||
throw new InvalidArgumentException('variant = '.print_r($variant, true));
|
throw new InvalidArgumentException('variant = '.print_r($variant, true));
|
||||||
|
|
||||||
if($logins === '')
|
if($logins)
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($message, $avatar, $variant), $multicall);
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($logins, $message, $avatarLogin, $variant), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($logins, $message, $avatarLogin, $variant), $multicall);
|
||||||
|
return $this->execute(ucfirst(__FUNCTION__), array($message, $avatar, $variant), $multicall);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -648,9 +663,9 @@ class Connection
|
|||||||
if(!is_bool($hideOnClick))
|
if(!is_bool($hideOnClick))
|
||||||
throw new InvalidArgumentException('hideOnClick = '.print_r($hideOnClick, true));
|
throw new InvalidArgumentException('hideOnClick = '.print_r($hideOnClick, true));
|
||||||
|
|
||||||
if($logins === '')
|
if($logins)
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($manialinks, $timeout, $hideOnClick), $multicall);
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($logins, $manialinks, $timeout, $hideOnClick), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($logins, $manialinks, $timeout, $hideOnClick), $multicall);
|
||||||
|
return $this->execute(ucfirst(__FUNCTION__), array($manialinks, $timeout, $hideOnClick), $multicall);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -666,9 +681,9 @@ class Connection
|
|||||||
if($logins === false)
|
if($logins === false)
|
||||||
throw new InvalidArgumentException('recipient = '.print_r($recipient, true));
|
throw new InvalidArgumentException('recipient = '.print_r($recipient, true));
|
||||||
|
|
||||||
if($logins === '')
|
if($logins)
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($logins), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__).'ToLogin', array($logins), $multicall);
|
||||||
|
return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -757,7 +772,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function banAndBlackList($player, $message, $save=false, $multicall=false)
|
function banAndBlackList($player, $message='', $save=false, $multicall=false)
|
||||||
{
|
{
|
||||||
$login = $this->getLogin($player);
|
$login = $this->getLogin($player);
|
||||||
if($login === false)
|
if($login === false)
|
||||||
@ -805,7 +820,7 @@ class Connection
|
|||||||
* @return Structures\PlayerBan[]
|
* @return Structures\PlayerBan[]
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function getBanList($length, $offset)
|
function getBanList($length=-1, $offset=0)
|
||||||
{
|
{
|
||||||
if(!is_int($length))
|
if(!is_int($length))
|
||||||
throw new InvalidArgumentException('length = '.print_r($length, true));
|
throw new InvalidArgumentException('length = '.print_r($length, true));
|
||||||
@ -867,7 +882,7 @@ class Connection
|
|||||||
* @return Structures\Player[]
|
* @return Structures\Player[]
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function getBlackList($length, $offset)
|
function getBlackList($length=-1, $offset=0)
|
||||||
{
|
{
|
||||||
if(!is_int($length))
|
if(!is_int($length))
|
||||||
throw new InvalidArgumentException('length = '.print_r($length, true));
|
throw new InvalidArgumentException('length = '.print_r($length, true));
|
||||||
@ -880,12 +895,12 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Load the black list file with the specified file name.
|
* Load the black list file with the specified file name.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Empty for default filename (blacklist.txt)
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function loadBlackList($filename, $multicall=false)
|
function loadBlackList($filename='', $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($filename))
|
if(!is_string($filename))
|
||||||
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
||||||
@ -896,12 +911,12 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Save the black list in the file with specified file name.
|
* Save the black list in the file with specified file name.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Empty for default filename (blacklist.txt)
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function saveBlackList($filename, $multicall=false)
|
function saveBlackList($filename='', $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($filename))
|
if(!is_string($filename))
|
||||||
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
||||||
@ -962,7 +977,7 @@ class Connection
|
|||||||
* @return array
|
* @return array
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function getGuestList($length, $offset)
|
function getGuestList($length=-1, $offset=0)
|
||||||
{
|
{
|
||||||
if(!is_int($length))
|
if(!is_int($length))
|
||||||
throw new InvalidArgumentException('length = '.print_r($length, true));
|
throw new InvalidArgumentException('length = '.print_r($length, true));
|
||||||
@ -975,12 +990,12 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Load the guest list file with the specified file name.
|
* Load the guest list file with the specified file name.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Empty for default filename (guestlist.txt)
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function loadGuestList($filename, $multicall=false)
|
function loadGuestList($filename='', $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($filename))
|
if(!is_string($filename))
|
||||||
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
||||||
@ -991,12 +1006,12 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Save the guest list in the file with specified file name.
|
* Save the guest list in the file with specified file name.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Empty for default filename (guestlist.txt)
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function saveGuestList($filename, $multicall=false)
|
function saveGuestList($filename='', $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($filename))
|
if(!is_string($filename))
|
||||||
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
||||||
@ -1030,7 +1045,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function getBuddyNotification($player)
|
function getBuddyNotification($player=null)
|
||||||
{
|
{
|
||||||
$login = $this->getLogin($player, true);
|
$login = $this->getLogin($player, true);
|
||||||
if($login === false)
|
if($login === false)
|
||||||
@ -1040,9 +1055,9 @@ class Connection
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the data to the specified file. The filename is relative to the Maps path.
|
* Write the data to the specified file.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Relative to the Maps path
|
||||||
* @param string $data
|
* @param string $data
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
@ -1060,9 +1075,9 @@ class Connection
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the data to the specified file. The filename is relative to the Maps path.
|
* Write the data to the specified file.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Relative to the Maps path
|
||||||
* @param string $localFilename
|
* @param string $localFilename
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
@ -1189,7 +1204,7 @@ class Connection
|
|||||||
* @return Structures\Player[]
|
* @return Structures\Player[]
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function getIgnoreList($length, $offset)
|
function getIgnoreList($length=-1, $offset=0)
|
||||||
{
|
{
|
||||||
if(!is_int($length))
|
if(!is_int($length))
|
||||||
throw new InvalidArgumentException('length = '.print_r($length, true));
|
throw new InvalidArgumentException('length = '.print_r($length, true));
|
||||||
@ -1210,7 +1225,7 @@ class Connection
|
|||||||
* @return int BillId
|
* @return int BillId
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function pay($payee, $amount, $message, $multicall=false)
|
function pay($payee, $amount, $message='', $multicall=false)
|
||||||
{
|
{
|
||||||
$login = $this->getLogin($payee);
|
$login = $this->getLogin($payee);
|
||||||
if($login === false)
|
if($login === false)
|
||||||
@ -1235,7 +1250,7 @@ class Connection
|
|||||||
* @return int BillId
|
* @return int BillId
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function sendBill($payer, $amount, $message, $payee = '', $multicall=false)
|
function sendBill($payer, $amount, $message='', $payee=null, $multicall=false)
|
||||||
{
|
{
|
||||||
$payerLogin = $this->getLogin($payer);
|
$payerLogin = $this->getLogin($payer);
|
||||||
if($payerLogin === false)
|
if($payerLogin === false)
|
||||||
@ -1589,7 +1604,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function customizeQuitDialog($manialink, $sendToServer, $askFavorite, $quitButtonDelay, $multicall=false)
|
function customizeQuitDialog($manialink, $sendToServer='', $askFavorite=true, $quitButtonDelay=0, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($manialink))
|
if(!is_string($manialink))
|
||||||
throw new InvalidArgumentException('manialink = '.print_r($manialink, true));
|
throw new InvalidArgumentException('manialink = '.print_r($manialink, true));
|
||||||
@ -1611,7 +1626,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function keepPlayerSlots($keep, $multicall=false)
|
function keepPlayerSlots($keep=true, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_bool($keep))
|
if(!is_bool($keep))
|
||||||
throw new InvalidArgumentException('keep = '.print_r($keep, true));
|
throw new InvalidArgumentException('keep = '.print_r($keep, true));
|
||||||
@ -1636,7 +1651,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function enableP2PUpload($enable, $multicall=false)
|
function enableP2PUpload($enable=true, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_bool($enable))
|
if(!is_bool($enable))
|
||||||
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
||||||
@ -1661,7 +1676,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function enableP2PDownload($enable, $multicall=false)
|
function enableP2PDownload($enable=true, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_bool($enable))
|
if(!is_bool($enable))
|
||||||
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
||||||
@ -1686,7 +1701,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function allowMapDownload($allow, $multicall=false)
|
function allowMapDownload($allow=true, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_bool($allow))
|
if(!is_bool($allow))
|
||||||
throw new InvalidArgumentException('allow = '.print_r($allow, true));
|
throw new InvalidArgumentException('allow = '.print_r($allow, true));
|
||||||
@ -1839,7 +1854,7 @@ class Connection
|
|||||||
* Returns the token infos for a player.
|
* Returns the token infos for a player.
|
||||||
* @param mixed $player Login or player object
|
* @param mixed $player Login or player object
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return array {int TokenCost, bool CanPayToken}
|
* @return Structures\TokenInfos
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function getDemoTokenInfosForPlayer($player)
|
function getDemoTokenInfosForPlayer($player)
|
||||||
@ -1848,7 +1863,7 @@ class Connection
|
|||||||
if($login === false)
|
if($login === false)
|
||||||
throw new InvalidArgumentException('player = '.print_r($player, true));
|
throw new InvalidArgumentException('player = '.print_r($player, true));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($login));
|
return Structures\TokenInfos::fromArray($this->execute(ucfirst(__FUNCTION__), array($login)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1859,7 +1874,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function disableHorns($disable, $multicall=false)
|
function disableHorns($disable=true, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_bool($disable))
|
if(!is_bool($disable))
|
||||||
throw new InvalidArgumentException('disable = '.print_r($disable, true));
|
throw new InvalidArgumentException('disable = '.print_r($disable, true));
|
||||||
@ -1884,7 +1899,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function disableServiceAnnounces($disable, $multicall=false)
|
function disableServiceAnnounces($disable=true, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_bool($disable))
|
if(!is_bool($disable))
|
||||||
throw new InvalidArgumentException('disable = '.print_r($disable, true));
|
throw new InvalidArgumentException('disable = '.print_r($disable, true));
|
||||||
@ -1909,7 +1924,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function autoSaveReplays($enable, $multicall=false)
|
function autoSaveReplays($enable=true, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_bool($enable))
|
if(!is_bool($enable))
|
||||||
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
||||||
@ -1925,7 +1940,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function autoSaveValidationReplays($enable, $multicall=false)
|
function autoSaveValidationReplays($enable=true, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_bool($enable))
|
if(!is_bool($enable))
|
||||||
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
||||||
@ -2131,6 +2146,7 @@ class Connection
|
|||||||
* Defines the packmask of the server.
|
* 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.
|
* Only maps matching the packmask will be allowed on the server, so that player connecting to it know what to expect.
|
||||||
* Only available when the server is stopped.
|
* Only available when the server is stopped.
|
||||||
|
* Only available in 2011-08-01 API version.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $packMask
|
* @param string $packMask
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
@ -2140,13 +2156,14 @@ class Connection
|
|||||||
function setServerPackMask($packMask, $multicall=false)
|
function setServerPackMask($packMask, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($packMask))
|
if(!is_string($packMask))
|
||||||
throw new InvalidArgumentException('packMask = '.print_r($enable, true));
|
throw new InvalidArgumentException('packMask = '.print_r($packMask, true));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($packMask), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($packMask), $multicall);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the packmask of the server.
|
* Get the packmask of the server.
|
||||||
|
* Only available in 2011-08-01 API version.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getServerPackMask()
|
function getServerPackMask()
|
||||||
@ -2456,7 +2473,7 @@ class Connection
|
|||||||
*/
|
*/
|
||||||
function setModeScriptSettings($settings, $multicall=false)
|
function setModeScriptSettings($settings, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_array($settings))
|
if(!is_array($settings) || !$settings)
|
||||||
throw new InvalidArgumentException('settings = '.print_r($settings, true));
|
throw new InvalidArgumentException('settings = '.print_r($settings, true));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($settings), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($settings), $multicall);
|
||||||
@ -2465,13 +2482,16 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Send commands to the mode script.
|
* Send commands to the mode script.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param mixed[] $commands
|
* @param mixed[] $commands {mixed <command name>, ...}
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function sendModeScriptCommands($commands, $multicall=false)
|
function sendModeScriptCommands($commands, $multicall=false)
|
||||||
{
|
{
|
||||||
|
if(!is_array($commands) || !$commands)
|
||||||
|
throw new InvalidArgumentException('commands = '.print_r($commands, true));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($commands), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($commands), $multicall);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2479,19 +2499,24 @@ class Connection
|
|||||||
* Change the settings and send commands to the mode script.
|
* Change the settings and send commands to the mode script.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param mixed[] $settings {mixed <setting name>, ...}
|
* @param mixed[] $settings {mixed <setting name>, ...}
|
||||||
* @param mixed[] $commands
|
* @param mixed[] $commands {mixed <command name>, ...}
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function setModeScriptSettingsAndCommands($settings, $commands, $multicall=false)
|
function setModeScriptSettingsAndCommands($settings, $commands, $multicall=false)
|
||||||
{
|
{
|
||||||
|
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));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($settings, $commands), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($settings, $commands), $multicall);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current xml-rpc variables of the mode script.
|
* Returns the current xml-rpc variables of the mode script.
|
||||||
* @return array {mixed <setting name>, ...}
|
* @return array {mixed <variable name>, ...}
|
||||||
*/
|
*/
|
||||||
function getModeScriptVariables()
|
function getModeScriptVariables()
|
||||||
{
|
{
|
||||||
@ -2501,13 +2526,16 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Set the xml-rpc variables of the mode script.
|
* Set the xml-rpc variables of the mode script.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param mixed[] $variables
|
* @param mixed[] $variables {mixed <variable name>, ...}
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function setModeScriptVariables($variables, $multicall=false)
|
function setModeScriptVariables($variables, $multicall=false)
|
||||||
{
|
{
|
||||||
|
if(!is_array($variables) || !$variables)
|
||||||
|
throw new InvalidArgumentException('variables = '.print_r($variables, true));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($variables), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($variables), $multicall);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2515,7 +2543,7 @@ class Connection
|
|||||||
* Send an event to the mode script.
|
* Send an event to the mode script.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $event
|
* @param string $event
|
||||||
* @param string $params
|
* @param string|string[] $params
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
@ -2524,29 +2552,22 @@ class Connection
|
|||||||
{
|
{
|
||||||
if(!is_string($event))
|
if(!is_string($event))
|
||||||
throw new InvalidArgumentException('event = '.print_r($event, true));
|
throw new InvalidArgumentException('event = '.print_r($event, true));
|
||||||
if(!is_string($params))
|
|
||||||
throw new InvalidArgumentException('params = '.print_r($params, true));
|
|
||||||
|
|
||||||
|
if(is_string($params))
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($event, $params), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($event, $params), $multicall);
|
||||||
|
if(is_array($params))
|
||||||
|
return $this->execute(ucfirst(__FUNCTION__).'Array', array($event, $params), $multicall);
|
||||||
|
// else
|
||||||
|
throw new InvalidArgumentException('params = '.print_r($params, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send an event to the mode script.
|
* @deprecated
|
||||||
* Only available to Admin.
|
* @see triggerModeScriptEvent()
|
||||||
* @param string $event
|
|
||||||
* @param mixed[] $params
|
|
||||||
* @param bool $multicall
|
|
||||||
* @return bool
|
|
||||||
* @throws InvalidArgumentException
|
|
||||||
*/
|
*/
|
||||||
function triggerModeScriptEventArray($event, $params, $multicall=false)
|
function triggerModeScriptEventArray($event, $params=array(), $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($event))
|
return $this->triggerModeScriptEvent($event, $params, $multicall);
|
||||||
throw new InvalidArgumentException('events = '.print_r($event, true));
|
|
||||||
if(!is_array($params))
|
|
||||||
throw new InvalidArgumentException('params = '.print_r($params, true));
|
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($event, $params), $multicall);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2569,7 +2590,8 @@ class Connection
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the script cloud variables of given object. Only available to Admin.
|
* Set the script cloud variables of given object.
|
||||||
|
* Only available to Admin.
|
||||||
* @param string $arg1
|
* @param string $arg1
|
||||||
* @param string $arg2
|
* @param string $arg2
|
||||||
* @param struct $arg3
|
* @param struct $arg3
|
||||||
@ -3367,7 +3389,7 @@ class Connection
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a struct containing the infos for the map with the specified filename.
|
* Returns a struct containing the infos for the map with the specified filename.
|
||||||
* @param string $filename
|
* @param string $filename Relative to the Maps path
|
||||||
* @return Structures\Map
|
* @return Structures\Map
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
@ -3381,7 +3403,7 @@ class Connection
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a boolean if the map with the specified filename matches the current server settings.
|
* Returns a boolean if the map with the specified filename matches the current server settings.
|
||||||
* @param string $filename
|
* @param string $filename Relative to the Maps path
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
@ -3401,7 +3423,7 @@ class Connection
|
|||||||
* @return Structures\Map[]
|
* @return Structures\Map[]
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function getMapList($length, $offset)
|
function getMapList($length=-1, $offset=0)
|
||||||
{
|
{
|
||||||
if(!is_int($length))
|
if(!is_int($length))
|
||||||
throw new InvalidArgumentException('length = '.print_r($length, true));
|
throw new InvalidArgumentException('length = '.print_r($length, true));
|
||||||
@ -3414,14 +3436,14 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Add the map with the specified filename at the end of the current selection.
|
* Add the map with the specified filename at the end of the current selection.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Relative to the Maps path
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function addMap($filename, $multicall=false)
|
function addMap($filename, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($filename))
|
if(!is_string($filename) || !strlen($filename))
|
||||||
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
||||||
@ -3430,9 +3452,9 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Add the list of maps with the specified filenames at the end of the current selection.
|
* Add the list of maps with the specified filenames at the end of the current selection.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string[] $filenames
|
* @param string[] $filenames Relative to the Maps path
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return int
|
* @return int Number of maps actually added
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function addMapList($filenames, $multicall=false)
|
function addMapList($filenames, $multicall=false)
|
||||||
@ -3446,14 +3468,14 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Remove the map with the specified filename from the current selection.
|
* Remove the map with the specified filename from the current selection.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Relative to the Maps path
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function removeMap($filename, $multicall=false)
|
function removeMap($filename, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($filename))
|
if(!is_string($filename) || !strlen($filename))
|
||||||
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
||||||
@ -3462,9 +3484,9 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Remove the list of maps with the specified filenames from the current selection.
|
* Remove the list of maps with the specified filenames from the current selection.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string[] $filenames
|
* @param string[] $filenames Relative to the Maps path
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return int
|
* @return int Number of maps actually removed
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function removeMapList($filenames, $multicall=false)
|
function removeMapList($filenames, $multicall=false)
|
||||||
@ -3478,14 +3500,14 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Insert the map with the specified filename after the current map.
|
* Insert the map with the specified filename after the current map.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Relative to the Maps path
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function insertMap($filename, $multicall=false)
|
function insertMap($filename, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($filename))
|
if(!is_string($filename) || !strlen($filename))
|
||||||
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
||||||
@ -3494,9 +3516,9 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Insert the list of maps with the specified filenames after the current map.
|
* Insert the list of maps with the specified filenames after the current map.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string[] $filenames
|
* @param string[] $filenames Relative to the Maps path
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return int
|
* @return int Number of maps actually inserted
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function insertMapList($filenames, $multicall=false)
|
function insertMapList($filenames, $multicall=false)
|
||||||
@ -3510,14 +3532,14 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Set as next map the one with the specified filename, if it is present in the selection.
|
* Set as next map the one with the specified filename, if it is present in the selection.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Relative to the Maps path
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function chooseNextMap($filename, $multicall=false)
|
function chooseNextMap($filename, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($filename))
|
if(!is_string($filename) || !strlen($filename))
|
||||||
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
||||||
@ -3526,9 +3548,9 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Set as next maps the list of maps with the specified filenames, if they are present in the selection.
|
* Set as next maps the list of maps with the specified filenames, if they are present in the selection.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param array $filenames
|
* @param array $filenames Relative to the Maps path
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return int
|
* @return int Number of maps actually chosen
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function chooseNextMapList($filenames, $multicall=false)
|
function chooseNextMapList($filenames, $multicall=false)
|
||||||
@ -3542,14 +3564,14 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* 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.
|
* 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.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Relative to the Maps path
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return int
|
* @return int Number of maps in the new list
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function loadMatchSettings($filename, $multicall=false)
|
function loadMatchSettings($filename, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($filename))
|
if(!is_string($filename) || !strlen($filename))
|
||||||
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
||||||
@ -3558,14 +3580,14 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Add a list of maps defined in the playlist with the specified filename at the end of the current selection.
|
* Add a list of maps defined in the playlist with the specified filename at the end of the current selection.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Relative to the Maps path
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return int
|
* @return int Number of maps actually added
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function appendPlaylistFromMatchSettings($filename, $multicall=false)
|
function appendPlaylistFromMatchSettings($filename, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($filename))
|
if(!is_string($filename) || !strlen($filename))
|
||||||
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
||||||
@ -3574,14 +3596,14 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Save the current selection of map in the playlist with the specified filename, as well as the current gameinfos.
|
* Save the current selection of map in the playlist with the specified filename, as well as the current gameinfos.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Relative to the Maps path
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return int
|
* @return int Number of maps in the saved playlist
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function saveMatchSettings($filename, $multicall=false)
|
function saveMatchSettings($filename, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($filename))
|
if(!is_string($filename) || !strlen($filename))
|
||||||
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
||||||
@ -3590,14 +3612,14 @@ class Connection
|
|||||||
/**
|
/**
|
||||||
* Insert a list of maps defined in the playlist with the specified filename after the current map.
|
* Insert a list of maps defined in the playlist with the specified filename after the current map.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param string $filename
|
* @param string $filename Relative to the Maps path
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return int
|
* @return int Number of maps actually inserted
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function insertPlaylistFromMatchSettings($filename, $multicall=false)
|
function insertPlaylistFromMatchSettings($filename, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($filename))
|
if(!is_string($filename) || !strlen($filename))
|
||||||
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
throw new InvalidArgumentException('filename = '.print_r($filename, true));
|
||||||
|
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
|
||||||
@ -3611,7 +3633,7 @@ class Connection
|
|||||||
* @return Structures\PlayerInfo[]
|
* @return Structures\PlayerInfo[]
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function getPlayerList($length, $offset, $compatibility=1)
|
function getPlayerList($length=-1, $offset=0, $compatibility=1)
|
||||||
{
|
{
|
||||||
if(!is_int($length))
|
if(!is_int($length))
|
||||||
throw new InvalidArgumentException('length = '.print_r($length, true));
|
throw new InvalidArgumentException('length = '.print_r($length, true));
|
||||||
@ -3672,19 +3694,16 @@ class Connection
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current rankings for the race in progress.
|
* Returns the current rankings for the match in progress.
|
||||||
* (In trackmania legacy team modes, the scores for the two teams are returned.
|
* In script modes, scores aren't returned.
|
||||||
* In other modes, it's the individual players' scores)
|
* In team modes, the scores for the two teams are returned.
|
||||||
* The ranking returned is a list of structures.
|
* In other modes, it's the individual players' scores.
|
||||||
* Each structure contains the following fields : Login, NickName, PlayerId and Rank.
|
|
||||||
* In addition, for legacy trackmania modes it also contains BestTime, Score, NbrLapsFinished, LadderScore,
|
|
||||||
* and an array BestCheckpoints that contains the checkpoint times for the best race.
|
|
||||||
* @param int $length Maximum number of infos to be returned
|
* @param int $length Maximum number of infos to be returned
|
||||||
* @param int $offset Starting index in the list
|
* @param int $offset Starting index in the list
|
||||||
* @return Structures\PlayerRanking[]
|
* @return Structures\PlayerRanking[]
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function getCurrentRanking($length, $offset)
|
function getCurrentRanking($length=-1, $offset=0)
|
||||||
{
|
{
|
||||||
if(!is_int($length))
|
if(!is_int($length))
|
||||||
throw new InvalidArgumentException('length = '.print_r($length, true));
|
throw new InvalidArgumentException('length = '.print_r($length, true));
|
||||||
@ -3695,11 +3714,9 @@ class Connection
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current ranking for the race in progressof the player with the specified login (or list of comma-separated logins).
|
* Returns the current ranking of the player with the specified login (or list of comma-separated logins) for the match in progress.
|
||||||
* The ranking returned is a list of structures.
|
* In script modes, scores aren't returned.
|
||||||
* Each structure contains the following fields : Login, NickName, PlayerId and Rank.
|
* In other modes, it's the individual players' scores.
|
||||||
* In addition, for legacy trackmania modes it also contains BestTime, Score, NbrLapsFinished, LadderScore,
|
|
||||||
* and an array BestCheckpoints that contains the checkpoint times for the best race.
|
|
||||||
* @param mixed $players Login, player object or array
|
* @param mixed $players Login, player object or array
|
||||||
* @param bool $multicall
|
* @param bool $multicall
|
||||||
* @return Structures\PlayerRanking[]
|
* @return Structures\PlayerRanking[]
|
||||||
@ -3715,8 +3732,8 @@ class Connection
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current winning team for the race in progress. (-1: if not in team mode, or draw match)
|
* Returns the current winning team for the race in progress.
|
||||||
* @return int
|
* @return int -1: if not in team mode or draw match, 0 or 1 otherwise
|
||||||
*/
|
*/
|
||||||
function getCurrentWinnerTeam()
|
function getCurrentWinnerTeam()
|
||||||
{
|
{
|
||||||
@ -3819,7 +3836,7 @@ class Connection
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Pass the login of the spectator.
|
* Pass the login of the spectator.
|
||||||
* A spectator that once was a player keeps his player slot, so that he can go back to race mode.
|
* A spectator that once was a player keeps his player slot, so that he can go back to player mode.
|
||||||
* Calling this function frees this slot for another player to connect.
|
* Calling this function frees this slot for another player to connect.
|
||||||
* Only available to Admin.
|
* Only available to Admin.
|
||||||
* @param mixed $player Login or player object
|
* @param mixed $player Login or player object
|
||||||
@ -3844,7 +3861,7 @@ class Connection
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
function manualFlowControlEnable($enable, $multicall=false)
|
function manualFlowControlEnable($enable=true, $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_bool($enable))
|
if(!is_bool($enable))
|
||||||
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
throw new InvalidArgumentException('enable = '.print_r($enable, true));
|
||||||
@ -3961,7 +3978,6 @@ class Connection
|
|||||||
$login = $this->getLogin($player);
|
$login = $this->getLogin($player);
|
||||||
if($login === false)
|
if($login === false)
|
||||||
return false;
|
return false;
|
||||||
else
|
|
||||||
$logins[] = $login;
|
$logins[] = $login;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ManiaPlanet dedicated server Xml-RPC client
|
||||||
|
*
|
||||||
|
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Maniaplanet\DedicatedServer\Structures;
|
||||||
|
|
||||||
|
class TokenInfos extends AbstractStructure
|
||||||
|
{
|
||||||
|
/** @var int */
|
||||||
|
public $tokenCost;
|
||||||
|
/** @var bool */
|
||||||
|
public $canPayToken;
|
||||||
|
}
|
@ -13,55 +13,169 @@ class FaultException extends Exception
|
|||||||
{
|
{
|
||||||
switch($faultString)
|
switch($faultString)
|
||||||
{
|
{
|
||||||
|
case 'Password incorrect.':
|
||||||
|
case 'Permission denied.':
|
||||||
|
return new AuthenticationException($faultString, $faultCode);
|
||||||
|
case 'not connected to the internet':
|
||||||
|
case 'Not connected to the masterserver.':
|
||||||
|
case 'Not a game server.':
|
||||||
|
case 'Not a server.':
|
||||||
|
case 'Couldn\'t create the fake player.':
|
||||||
|
case 'Only server can receive a callvote':
|
||||||
|
case 'No map currently loaded.':
|
||||||
|
case 'No replay to save':
|
||||||
|
case 'Internal error.':
|
||||||
|
return new UnavailableFeatureException($faultString, $faultCode);
|
||||||
|
case 'You must enable the callbacks to be able to do chat routing.':
|
||||||
|
case 'Chat routing not enabled.':
|
||||||
|
case 'Script cloud disabled.':
|
||||||
|
case 'Already waiting for a vote.':
|
||||||
|
case 'You must stop server first.':
|
||||||
|
return new LockedFeatureException($faultString, $faultCode);
|
||||||
case 'Login or Uid unknown.':
|
case 'Login or Uid unknown.':
|
||||||
case 'Login unknown.':
|
case 'Login unknown.':
|
||||||
return new LoginUnknownException($faultString, $faultCode);
|
return new LoginUnknownException($faultString, $faultCode); //@todo remove this line
|
||||||
case 'Unable to write the playlist file.':
|
//return new UnknownPlayerException($faultString, $faultCode);
|
||||||
return new CouldNotWritePlaylistFileException($faultString, $faultCode);
|
|
||||||
case 'Start index out of bound.':
|
|
||||||
return new StartIndexOutOfBoundException($faultString, $faultCode);
|
|
||||||
case 'Not in script mode.':
|
|
||||||
return new NotInScriptModeException($faultString, $faultCode);
|
|
||||||
case 'Change in progress.':
|
|
||||||
return new ChangeInProgressException($faultString, $faultCode);
|
|
||||||
case 'The player is not a spectator':
|
case 'The player is not a spectator':
|
||||||
case 'The player is not a spectator.':
|
case 'The player is not a spectator.':
|
||||||
return new PlayerIsNotSpectatorException($faultString, $faultCode);
|
return new PlayerIsNotSpectatorException($faultString, $faultCode); //@todo remove this line
|
||||||
|
case 'Not a network player.':
|
||||||
|
case 'Player is not a fake player':
|
||||||
|
return new PlayerStateException($faultString, $faultCode);
|
||||||
case 'Player already ignored.':
|
case 'Player already ignored.':
|
||||||
return new PlayerAlreadyIgnoredException($faultString, $faultCode);
|
return new PlayerAlreadyIgnoredException($faultString, $faultCode); //@todo remove this line
|
||||||
|
case 'Player already black listed.':
|
||||||
|
case 'Player already on guest list.':
|
||||||
|
case 'Map already added.':
|
||||||
|
return new AlreadyInListException($faultString, $faultCode);
|
||||||
|
case 'Login not banned.':
|
||||||
|
return new NotInListException($faultString, $faultCode); //@todo remove this line
|
||||||
case 'Player not ignored.':
|
case 'Player not ignored.':
|
||||||
return new PlayerNotIgnoredException($faultString, $faultCode);
|
return new PlayerNotIgnoredException($faultString, $faultCode); //@todo remove this line
|
||||||
case 'Not in Team mode.':
|
case 'Player not black listed.':
|
||||||
return new NotInTeamModeException($faultString, $faultCode);
|
case 'Player not on guest list.':
|
||||||
|
return new NotInListException($faultString, $faultCode); //@todo remove this line
|
||||||
|
case 'Map not in the selection.':
|
||||||
case 'The map isn\'t in the current selection.':
|
case 'The map isn\'t in the current selection.':
|
||||||
return new MapNotInCurrentSelectionException($faultString, $faultCode);
|
return new MapNotInCurrentSelectionException($faultString, $faultCode); //@todo remove this line
|
||||||
case 'Incompatible map type.':
|
case 'Map not found.':
|
||||||
case 'Map not complete.':
|
return new MapNotFoundException($faultString, $faultCode); //@todo remove this line
|
||||||
return new MapNotCompatibleOrCompleteException($faultString, $faultCode);
|
//return new NotInListException($faultString, $faultCode);
|
||||||
case 'Ladder mode unknown.':
|
case 'Start index out of bound.':
|
||||||
case 'You cannot change the max players count: AllowSpectatorRelays is activated.':
|
return new StartIndexOutOfBoundException($faultString, $faultCode); //@todo remove this line
|
||||||
return new ServerOptionsException($faultString, $faultCode);
|
case 'invalid index':
|
||||||
|
return new IndexOutOfBoundException($faultString, $faultCode);
|
||||||
case 'the next map must be different from the current one.':
|
case 'the next map must be different from the current one.':
|
||||||
return new NextMapException($faultString, $faultCode);
|
return new NextMapException($faultString, $faultCode);
|
||||||
case 'Map not found.':
|
case 'Change in progress.':
|
||||||
return new MapNotFoundException($faultString, $faultCode);
|
return new ChangeInProgressException($faultString, $faultCode);
|
||||||
|
case 'Incompatible map type.':
|
||||||
|
case 'Map not complete.':
|
||||||
|
return new MapNotCompatibleOrCompleteException($faultString, $faultCode); //@todo remove this line
|
||||||
|
case 'The map doesn\'t match the server packmask.':
|
||||||
|
return new InvalidMapException($faultString, $faultCode);
|
||||||
|
case 'Ladder mode unknown.':
|
||||||
|
case 'You cannot change the max players count: AllowSpectatorRelays is activated.':
|
||||||
|
case 'You cannot change the max spectators count: AllowSpectatorRelays is activated.':
|
||||||
|
return new ServerOptionsException($faultString, $faultCode);
|
||||||
|
case 'New mode unknown.':
|
||||||
|
case 'You need to stop the server to change to/from script mode.':
|
||||||
|
return new GameModeException($faultString, $faultCode); //@todo remove this line
|
||||||
|
case 'Not in script mode.':
|
||||||
|
return new NotInScriptModeException($faultString, $faultCode); //@todo remove this line
|
||||||
|
case 'Not in Team mode.':
|
||||||
|
return new NotInTeamModeException($faultString, $faultCode); //@todo remove this line
|
||||||
|
case 'Not in Rounds or Laps mode.':
|
||||||
|
case 'The scores must be decreasing.':
|
||||||
|
return new GameModeException($faultString, $faultCode);
|
||||||
|
case 'Unable to write the black list file.':
|
||||||
|
case 'Unable to write the guest list file.':
|
||||||
|
return new FileException($faultString, $faultCode); //@todo remove this line
|
||||||
|
case 'Unable to write the playlist file.':
|
||||||
|
return new CouldNotWritePlaylistFileException($faultString, $faultCode); //@todo remove this line
|
||||||
|
case 'Could not save file.':
|
||||||
|
case 'Map unknown.':
|
||||||
|
case 'The playlist file does not exist.':
|
||||||
|
case 'Invalid url or file.':
|
||||||
|
case 'Invalid url.':
|
||||||
|
return new FileException($faultString, $faultCode);
|
||||||
}
|
}
|
||||||
|
if(preg_match('~^Unknown setting \'.*\'\.$~iu', $faultString))
|
||||||
|
return new GameModeException($faultString, $faultCode);
|
||||||
|
if(preg_match('~^Couldn\'t load \'.*\'\.$~iu', $faultString))
|
||||||
|
return new FileException($faultString, $faultCode);
|
||||||
|
|
||||||
return new self($faultString, $faultCode);
|
return new self($faultString, $faultCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LoginUnknownException extends FaultException {}
|
class AuthenticationException extends FaultException {}
|
||||||
class CouldNotWritePlaylistFileException extends FaultException {}
|
class UnavailableFeatureException extends FaultException {}
|
||||||
class StartIndexOutOfBoundException extends FaultException {}
|
class LockedFeatureException extends FaultException {}
|
||||||
class NotInScriptModeException extends FaultException {}
|
class UnknownPlayerException extends FaultException {}
|
||||||
class ChangeInProgressException extends FaultException {}
|
class PlayerStateException extends FaultException {}
|
||||||
class PlayerIsNotSpectatorException extends FaultException {}
|
class AlreadyInListException extends FaultException {}
|
||||||
class NotInTeamModeException extends FaultException {}
|
class NotInListException extends FaultException {}
|
||||||
class MapNotInCurrentSelectionException extends FaultException{}
|
class IndexOutOfBoundException extends FaultException {}
|
||||||
class MapNotCompatibleOrCompleteException extends FaultException{}
|
|
||||||
class PlayerAlreadyIgnoredException extends FaultException{}
|
|
||||||
class PlayerNotIgnoredException extends FaultException{}
|
|
||||||
class ServerOptionsException extends FaultException{}
|
|
||||||
class NextMapException extends FaultException{}
|
class NextMapException extends FaultException{}
|
||||||
class MapNotFoundException extends FaultException{}
|
class ChangeInProgressException extends FaultException {}
|
||||||
|
class InvalidMapException extends FaultException{}
|
||||||
|
class GameModeException extends FaultException {}
|
||||||
|
class ServerOptionsException extends FaultException {}
|
||||||
|
class FileException extends FaultException {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @see UnknownPlayerException
|
||||||
|
*/
|
||||||
|
class LoginUnknownException extends UnknownPlayerException {}
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @see FileException
|
||||||
|
*/
|
||||||
|
class CouldNotWritePlaylistFileException extends FileException {}
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @see IndexOutOfBoundException
|
||||||
|
*/
|
||||||
|
class StartIndexOutOfBoundException extends IndexOutOfBoundException {}
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @see GameModeException
|
||||||
|
*/
|
||||||
|
class NotInScriptModeException extends GameModeException {}
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @see PlayerStateException
|
||||||
|
*/
|
||||||
|
class PlayerIsNotSpectatorException extends PlayerStateException {}
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @see AlreadyInListException
|
||||||
|
*/
|
||||||
|
class PlayerAlreadyIgnoredException extends AlreadyInListException {}
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @see NotInListException
|
||||||
|
*/
|
||||||
|
class PlayerNotIgnoredException extends NotInListException {}
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @see GameModeException
|
||||||
|
*/
|
||||||
|
class NotInTeamModeException extends GameModeException {}
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @see NotInListException
|
||||||
|
*/
|
||||||
|
class MapNotInCurrentSelectionException extends NotInListException {}
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @see InvalidMapException
|
||||||
|
*/
|
||||||
|
class MapNotCompatibleOrCompleteException extends InvalidMapException {}
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @see NotInListException
|
||||||
|
*/
|
||||||
|
class MapNotFoundException extends NotInListException {}
|
||||||
|
Loading…
Reference in New Issue
Block a user