mirror of
https://github.com/slawkens/myaac.git
synced 2025-05-24 22:44:30 +02:00
Nothing important: tabs
This commit is contained in:
parent
45ef390829
commit
ae847ff9a6
@ -52,10 +52,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return string TSPQ version.
|
* @return string TSPQ version.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getTSPQVersion()
|
public function getTSPQVersion()
|
||||||
{
|
{
|
||||||
return $this->documentElement->getAttribute('version');
|
return $this->documentElement->getAttribute('version');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server uptime.
|
* Returns server uptime.
|
||||||
@ -63,10 +63,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return int Uptime.
|
* @return int Uptime.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getUptime()
|
public function getUptime()
|
||||||
{
|
{
|
||||||
return (int) $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('uptime');
|
return (int) $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('uptime');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server IP.
|
* Returns server IP.
|
||||||
@ -74,10 +74,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return string IP.
|
* @return string IP.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getIP()
|
public function getIP()
|
||||||
{
|
{
|
||||||
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('ip');
|
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('ip');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server name.
|
* Returns server name.
|
||||||
@ -85,10 +85,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return string Name.
|
* @return string Name.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('servername');
|
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('servername');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server port.
|
* Returns server port.
|
||||||
@ -96,10 +96,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return int Port.
|
* @return int Port.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getPort()
|
public function getPort()
|
||||||
{
|
{
|
||||||
return (int) $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('port');
|
return (int) $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('port');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server location.
|
* Returns server location.
|
||||||
@ -107,10 +107,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return string Location.
|
* @return string Location.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getLocation()
|
public function getLocation()
|
||||||
{
|
{
|
||||||
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('location');
|
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('location');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server website.
|
* Returns server website.
|
||||||
@ -118,10 +118,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return string Website URL.
|
* @return string Website URL.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getURL()
|
public function getURL()
|
||||||
{
|
{
|
||||||
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('url');
|
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('url');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server attribute.
|
* Returns server attribute.
|
||||||
@ -131,10 +131,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return string Attribute value.
|
* @return string Attribute value.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getServer()
|
public function getServer()
|
||||||
{
|
{
|
||||||
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('server');
|
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('server');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server version.
|
* Returns server version.
|
||||||
@ -142,10 +142,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return string Version.
|
* @return string Version.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getServerVersion()
|
public function getServerVersion()
|
||||||
{
|
{
|
||||||
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('version');
|
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('version');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns dedicated version of client.
|
* Returns dedicated version of client.
|
||||||
@ -153,10 +153,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return string Version.
|
* @return string Version.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getClientVersion()
|
public function getClientVersion()
|
||||||
{
|
{
|
||||||
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('client');
|
return $this->documentElement->getElementsByTagName('serverinfo')->item(0)->getAttribute('client');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns owner name.
|
* Returns owner name.
|
||||||
@ -164,10 +164,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return string Owner name.
|
* @return string Owner name.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getOwner()
|
public function getOwner()
|
||||||
{
|
{
|
||||||
return $this->documentElement->getElementsByTagName('owner')->item(0)->getAttribute('name');
|
return $this->documentElement->getElementsByTagName('owner')->item(0)->getAttribute('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns owner e-mail.
|
* Returns owner e-mail.
|
||||||
@ -175,10 +175,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return string Owner e-mail.
|
* @return string Owner e-mail.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getEMail()
|
public function getEMail()
|
||||||
{
|
{
|
||||||
return $this->documentElement->getElementsByTagName('owner')->item(0)->getAttribute('email');
|
return $this->documentElement->getElementsByTagName('owner')->item(0)->getAttribute('email');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns current amount of players online.
|
* Returns current amount of players online.
|
||||||
@ -186,10 +186,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return int Count of players.
|
* @return int Count of players.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getOnlinePlayers()
|
public function getOnlinePlayers()
|
||||||
{
|
{
|
||||||
return (int) $this->documentElement->getElementsByTagName('players')->item(0)->getAttribute('online');
|
return (int) $this->documentElement->getElementsByTagName('players')->item(0)->getAttribute('online');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns maximum amount of players online.
|
* Returns maximum amount of players online.
|
||||||
@ -197,10 +197,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return int Maximum allowed count of players.
|
* @return int Maximum allowed count of players.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getMaxPlayers()
|
public function getMaxPlayers()
|
||||||
{
|
{
|
||||||
return (int) $this->documentElement->getElementsByTagName('players')->item(0)->getAttribute('max');
|
return (int) $this->documentElement->getElementsByTagName('players')->item(0)->getAttribute('max');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns record of online players.
|
* Returns record of online players.
|
||||||
@ -208,10 +208,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return int Players online record.
|
* @return int Players online record.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getPlayersPeak()
|
public function getPlayersPeak()
|
||||||
{
|
{
|
||||||
return (int) $this->documentElement->getElementsByTagName('players')->item(0)->getAttribute('peak');
|
return (int) $this->documentElement->getElementsByTagName('players')->item(0)->getAttribute('peak');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns number of all monsters on map.
|
* Returns number of all monsters on map.
|
||||||
@ -219,10 +219,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return int Count of monsters.
|
* @return int Count of monsters.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getMonstersCount()
|
public function getMonstersCount()
|
||||||
{
|
{
|
||||||
return (int) $this->documentElement->getElementsByTagName('monsters')->item(0)->getAttribute('total');
|
return (int) $this->documentElement->getElementsByTagName('monsters')->item(0)->getAttribute('total');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns map name.
|
* Returns map name.
|
||||||
@ -230,10 +230,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return string Map name.
|
* @return string Map name.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getMapName()
|
public function getMapName()
|
||||||
{
|
{
|
||||||
return $this->documentElement->getElementsByTagName('map')->item(0)->getAttribute('name');
|
return $this->documentElement->getElementsByTagName('map')->item(0)->getAttribute('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns map author.
|
* Returns map author.
|
||||||
@ -241,10 +241,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return string Mapper name.
|
* @return string Mapper name.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getMapAuthor()
|
public function getMapAuthor()
|
||||||
{
|
{
|
||||||
return $this->documentElement->getElementsByTagName('map')->item(0)->getAttribute('author');
|
return $this->documentElement->getElementsByTagName('map')->item(0)->getAttribute('author');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns map width.
|
* Returns map width.
|
||||||
@ -252,10 +252,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return int Map width.
|
* @return int Map width.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getMapWidth()
|
public function getMapWidth()
|
||||||
{
|
{
|
||||||
return (int) $this->documentElement->getElementsByTagName('map')->item(0)->getAttribute('width');
|
return (int) $this->documentElement->getElementsByTagName('map')->item(0)->getAttribute('width');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns map height.
|
* Returns map height.
|
||||||
@ -263,10 +263,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return int Map height.
|
* @return int Map height.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getMapHeight()
|
public function getMapHeight()
|
||||||
{
|
{
|
||||||
return (int) $this->documentElement->getElementsByTagName('map')->item(0)->getAttribute('height');
|
return (int) $this->documentElement->getElementsByTagName('map')->item(0)->getAttribute('height');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server's Message Of The Day
|
* Returns server's Message Of The Day
|
||||||
@ -275,21 +275,21 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @return string Server MOTD.
|
* @return string Server MOTD.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function getMOTD()
|
public function getMOTD()
|
||||||
{
|
{
|
||||||
// look for text node child
|
// look for text node child
|
||||||
foreach( $this->documentElement->getElementsByTagName('motd')->item(0)->childNodes as $child)
|
foreach( $this->documentElement->getElementsByTagName('motd')->item(0)->childNodes as $child)
|
||||||
{
|
{
|
||||||
if($child->nodeType == XML_TEXT_NODE)
|
if($child->nodeType == XML_TEXT_NODE)
|
||||||
{
|
{
|
||||||
// found
|
// found
|
||||||
return $child->nodeValue;
|
return $child->nodeValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// strange...
|
// strange...
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic PHP5 method.
|
* Magic PHP5 method.
|
||||||
@ -301,77 +301,77 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @throws OutOfBoundsException For non-supported properties.
|
* @throws OutOfBoundsException For non-supported properties.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
public function __get($name)
|
public function __get($name)
|
||||||
{
|
{
|
||||||
switch($name)
|
switch($name)
|
||||||
{
|
{
|
||||||
case 'tspqVersion':
|
case 'tspqVersion':
|
||||||
return $this->getTSPQVersion();
|
return $this->getTSPQVersion();
|
||||||
|
|
||||||
case 'uptime':
|
case 'uptime':
|
||||||
return $this->getUptime();
|
return $this->getUptime();
|
||||||
|
|
||||||
case 'ip':
|
case 'ip':
|
||||||
return $this->getIP();
|
return $this->getIP();
|
||||||
|
|
||||||
case 'name':
|
case 'name':
|
||||||
return $this->getName();
|
return $this->getName();
|
||||||
|
|
||||||
case 'port':
|
case 'port':
|
||||||
return $this->getPort();
|
return $this->getPort();
|
||||||
|
|
||||||
case 'location':
|
case 'location':
|
||||||
return $this->getLocation();
|
return $this->getLocation();
|
||||||
|
|
||||||
case 'url':
|
case 'url':
|
||||||
return $this->getURL();
|
return $this->getURL();
|
||||||
|
|
||||||
case 'server':
|
case 'server':
|
||||||
return $this->getServer();
|
return $this->getServer();
|
||||||
|
|
||||||
case 'serverVersion':
|
case 'serverVersion':
|
||||||
return $this->getServerVersion();
|
return $this->getServerVersion();
|
||||||
|
|
||||||
case 'clientVersion':
|
case 'clientVersion':
|
||||||
return $this->getClientVersion();
|
return $this->getClientVersion();
|
||||||
|
|
||||||
case 'owner':
|
case 'owner':
|
||||||
return $this->getOwner();
|
return $this->getOwner();
|
||||||
|
|
||||||
case 'eMail':
|
case 'eMail':
|
||||||
return $this->getEMail();
|
return $this->getEMail();
|
||||||
|
|
||||||
case 'onlinePlayers':
|
case 'onlinePlayers':
|
||||||
return $this->getOnlinePlayers();
|
return $this->getOnlinePlayers();
|
||||||
|
|
||||||
case 'maxPlayers':
|
case 'maxPlayers':
|
||||||
return $this->getMaxPlayers();
|
return $this->getMaxPlayers();
|
||||||
|
|
||||||
case 'playersPeak':
|
case 'playersPeak':
|
||||||
return $this->getPlayersPeak();
|
return $this->getPlayersPeak();
|
||||||
|
|
||||||
case 'monstersCount':
|
case 'monstersCount':
|
||||||
return $this->getMonstersCount();
|
return $this->getMonstersCount();
|
||||||
|
|
||||||
case 'mapName':
|
case 'mapName':
|
||||||
return $this->getMapName();
|
return $this->getMapName();
|
||||||
|
|
||||||
case 'mapAuthor':
|
case 'mapAuthor':
|
||||||
return $this->getMapAuthor();
|
return $this->getMapAuthor();
|
||||||
|
|
||||||
case 'mapWidth':
|
case 'mapWidth':
|
||||||
return $this->getMapWidth();
|
return $this->getMapWidth();
|
||||||
|
|
||||||
case 'mapHeight':
|
case 'mapHeight':
|
||||||
return $this->getMapHeight();
|
return $this->getMapHeight();
|
||||||
|
|
||||||
case 'motd':
|
case 'motd':
|
||||||
return $this->getMOTD();
|
return $this->getMOTD();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new OutOfBoundsException();
|
throw new OutOfBoundsException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns string representation of XML.
|
* Returns string representation of XML.
|
||||||
@ -380,10 +380,10 @@ class OTS_InfoRespond extends DOMDocument
|
|||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return string String representation of object.
|
* @return string String representation of object.
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
return $this->saveXML();
|
return $this->saveXML();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
@ -40,175 +40,175 @@ class OTS_ServerStatus
|
|||||||
/**
|
/**
|
||||||
* Basic server info.
|
* Basic server info.
|
||||||
*/
|
*/
|
||||||
const REQUEST_BASIC_SERVER_INFO = 1;
|
const REQUEST_BASIC_SERVER_INFO = 1;
|
||||||
/**
|
/**
|
||||||
* Server owner info.
|
* Server owner info.
|
||||||
*/
|
*/
|
||||||
const REQUEST_OWNER_SERVER_INFO = 2;
|
const REQUEST_OWNER_SERVER_INFO = 2;
|
||||||
/**
|
/**
|
||||||
* Server extra info.
|
* Server extra info.
|
||||||
*/
|
*/
|
||||||
const REQUEST_MISC_SERVER_INFO = 4;
|
const REQUEST_MISC_SERVER_INFO = 4;
|
||||||
/**
|
/**
|
||||||
* Players stats info.
|
* Players stats info.
|
||||||
*/
|
*/
|
||||||
const REQUEST_PLAYERS_INFO = 8;
|
const REQUEST_PLAYERS_INFO = 8;
|
||||||
/**
|
/**
|
||||||
* Map info.
|
* Map info.
|
||||||
*/
|
*/
|
||||||
const REQUEST_MAP_INFO = 16;
|
const REQUEST_MAP_INFO = 16;
|
||||||
/**
|
/**
|
||||||
* Extended players info.
|
* Extended players info.
|
||||||
*/
|
*/
|
||||||
const REQUEST_EXT_PLAYERS_INFO = 32;
|
const REQUEST_EXT_PLAYERS_INFO = 32;
|
||||||
/**
|
/**
|
||||||
* Player status info.
|
* Player status info.
|
||||||
*/
|
*/
|
||||||
const REQUEST_PLAYER_STATUS_INFO = 64;
|
const REQUEST_PLAYER_STATUS_INFO = 64;
|
||||||
/**
|
/**
|
||||||
* Server software info.
|
* Server software info.
|
||||||
*/
|
*/
|
||||||
const REQUEST_SERVER_SOFTWARE_INFO = 128;
|
const REQUEST_SERVER_SOFTWARE_INFO = 128;
|
||||||
/**
|
/**
|
||||||
* Basic server respond.
|
* Basic server respond.
|
||||||
*/
|
*/
|
||||||
const RESPOND_BASIC_SERVER_INFO = 0x10;
|
const RESPOND_BASIC_SERVER_INFO = 0x10;
|
||||||
/**
|
/**
|
||||||
* Server owner respond.
|
* Server owner respond.
|
||||||
*/
|
*/
|
||||||
const RESPOND_OWNER_SERVER_INFO = 0x11;
|
const RESPOND_OWNER_SERVER_INFO = 0x11;
|
||||||
/**
|
/**
|
||||||
* Server extra respond.
|
* Server extra respond.
|
||||||
*/
|
*/
|
||||||
const RESPOND_MISC_SERVER_INFO = 0x12;
|
const RESPOND_MISC_SERVER_INFO = 0x12;
|
||||||
/**
|
/**
|
||||||
* Players stats respond.
|
* Players stats respond.
|
||||||
*/
|
*/
|
||||||
const RESPOND_PLAYERS_INFO = 0x20;
|
const RESPOND_PLAYERS_INFO = 0x20;
|
||||||
/**
|
/**
|
||||||
* Map respond.
|
* Map respond.
|
||||||
*/
|
*/
|
||||||
const RESPOND_MAP_INFO = 0x30;
|
const RESPOND_MAP_INFO = 0x30;
|
||||||
/**
|
/**
|
||||||
* Extended players info.
|
* Extended players info.
|
||||||
*/
|
*/
|
||||||
const RESPOND_EXT_PLAYERS_INFO = 0x21;
|
const RESPOND_EXT_PLAYERS_INFO = 0x21;
|
||||||
/**
|
/**
|
||||||
* Player status info.
|
* Player status info.
|
||||||
*/
|
*/
|
||||||
const RESPOND_PLAYER_STATUS_INFO = 0x22;
|
const RESPOND_PLAYER_STATUS_INFO = 0x22;
|
||||||
/**
|
/**
|
||||||
* Server software info.
|
* Server software info.
|
||||||
*/
|
*/
|
||||||
const RESPOND_SERVER_SOFTWARE_INFO = 0x23;
|
const RESPOND_SERVER_SOFTWARE_INFO = 0x23;
|
||||||
/**
|
/**
|
||||||
* Server name.
|
* Server name.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $name;
|
private $name;
|
||||||
/**
|
/**
|
||||||
* Server IP.
|
* Server IP.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $ip;
|
private $ip;
|
||||||
/**
|
/**
|
||||||
* Server port.
|
* Server port.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $port;
|
private $port;
|
||||||
/**
|
/**
|
||||||
* Owner name.
|
* Owner name.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $owner;
|
private $owner;
|
||||||
/**
|
/**
|
||||||
* Owner's e-mail.
|
* Owner's e-mail.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $eMail;
|
private $eMail;
|
||||||
/**
|
/**
|
||||||
* Message of the day.
|
* Message of the day.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $motd;
|
private $motd;
|
||||||
/**
|
/**
|
||||||
* Server location.
|
* Server location.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $location;
|
private $location;
|
||||||
/**
|
/**
|
||||||
* Website URL.
|
* Website URL.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $url;
|
private $url;
|
||||||
/**
|
/**
|
||||||
* Uptime.
|
* Uptime.
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $uptime;
|
private $uptime;
|
||||||
/**
|
/**
|
||||||
* Status version.
|
* Status version.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $version;
|
private $version;
|
||||||
/**
|
/**
|
||||||
* Players online.
|
* Players online.
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $online;
|
private $online;
|
||||||
/**
|
/**
|
||||||
* Maximum players.
|
* Maximum players.
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $max;
|
private $max;
|
||||||
/**
|
/**
|
||||||
* Players peak.
|
* Players peak.
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $peak;
|
private $peak;
|
||||||
/**
|
/**
|
||||||
* Map name.
|
* Map name.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $map;
|
private $map;
|
||||||
/**
|
/**
|
||||||
* Map author.
|
* Map author.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $author;
|
private $author;
|
||||||
/**
|
/**
|
||||||
* Map width.
|
* Map width.
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $width;
|
private $width;
|
||||||
/**
|
/**
|
||||||
* Map height.
|
* Map height.
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $height;
|
private $height;
|
||||||
/**
|
/**
|
||||||
* Players online list.
|
* Players online list.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $players = array();
|
private $players = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server software.
|
* Server software.
|
||||||
@ -224,277 +224,277 @@ class OTS_ServerStatus
|
|||||||
*
|
*
|
||||||
* @param OTS_Buffer $info Information packet.
|
* @param OTS_Buffer $info Information packet.
|
||||||
*/
|
*/
|
||||||
public function __construct(OTS_Buffer $info)
|
public function __construct(OTS_Buffer $info)
|
||||||
{
|
{
|
||||||
// skips packet length
|
// skips packet length
|
||||||
$info->getShort();
|
$info->getShort();
|
||||||
|
|
||||||
while( $info->isValid() )
|
while( $info->isValid() )
|
||||||
{
|
{
|
||||||
switch( $info->getChar() )
|
switch( $info->getChar() )
|
||||||
{
|
{
|
||||||
case self::RESPOND_BASIC_SERVER_INFO:
|
case self::RESPOND_BASIC_SERVER_INFO:
|
||||||
$this->name = $info->getString();
|
$this->name = $info->getString();
|
||||||
$this->ip = $info->getString();
|
$this->ip = $info->getString();
|
||||||
$this->port = (int) $info->getString();
|
$this->port = (int) $info->getString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case self::RESPOND_OWNER_SERVER_INFO:
|
case self::RESPOND_OWNER_SERVER_INFO:
|
||||||
$this->owner = $info->getString();
|
$this->owner = $info->getString();
|
||||||
$this->eMail = $info->getString();
|
$this->eMail = $info->getString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case self::RESPOND_MISC_SERVER_INFO:
|
case self::RESPOND_MISC_SERVER_INFO:
|
||||||
$this->motd = $info->getString();
|
$this->motd = $info->getString();
|
||||||
$this->location = $info->getString();
|
$this->location = $info->getString();
|
||||||
$this->url = $info->getString();
|
$this->url = $info->getString();
|
||||||
|
|
||||||
$uptime = $info->getLong() << 32;
|
$uptime = $info->getLong() << 32;
|
||||||
|
|
||||||
$this->uptime += $info->getLong() + $uptime;
|
$this->uptime += $info->getLong() + $uptime;
|
||||||
$this->version = $info->getString();
|
$this->version = $info->getString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case self::RESPOND_PLAYERS_INFO:
|
case self::RESPOND_PLAYERS_INFO:
|
||||||
$this->online = $info->getLong();
|
$this->online = $info->getLong();
|
||||||
$this->max = $info->getLong();
|
$this->max = $info->getLong();
|
||||||
$this->peak = $info->getLong();
|
$this->peak = $info->getLong();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case self::RESPOND_MAP_INFO:
|
case self::RESPOND_MAP_INFO:
|
||||||
$this->map = $info->getString();
|
$this->map = $info->getString();
|
||||||
$this->author = $info->getString();
|
$this->author = $info->getString();
|
||||||
$this->width = $info->getShort();
|
$this->width = $info->getShort();
|
||||||
$this->height = $info->getShort();
|
$this->height = $info->getShort();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case self::RESPOND_EXT_PLAYERS_INFO:
|
case self::RESPOND_EXT_PLAYERS_INFO:
|
||||||
$count = $info->getLong();
|
$count = $info->getLong();
|
||||||
|
|
||||||
for($i = 0; $i < $count; $i++)
|
for($i = 0; $i < $count; $i++)
|
||||||
{
|
{
|
||||||
$name = $info->getString();
|
$name = $info->getString();
|
||||||
$this->players[$name] = $info->getLong();
|
$this->players[$name] = $info->getLong();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case self::RESPOND_SERVER_SOFTWARE_INFO:
|
case self::RESPOND_SERVER_SOFTWARE_INFO:
|
||||||
$this->softwareName = $info->getString();
|
$this->softwareName = $info->getString();
|
||||||
$this->softwareVersion = $info->getString();
|
$this->softwareVersion = $info->getString();
|
||||||
$this->softwareProtocol = $info->getString();
|
$this->softwareProtocol = $info->getString();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server uptime.
|
* Returns server uptime.
|
||||||
*
|
*
|
||||||
* @return int Uptime.
|
* @return int Uptime.
|
||||||
*/
|
*/
|
||||||
public function getUptime()
|
public function getUptime()
|
||||||
{
|
{
|
||||||
return $this->uptime;
|
return $this->uptime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server IP.
|
* Returns server IP.
|
||||||
*
|
*
|
||||||
* @return string IP.
|
* @return string IP.
|
||||||
*/
|
*/
|
||||||
public function getIP()
|
public function getIP()
|
||||||
{
|
{
|
||||||
return $this->ip;
|
return $this->ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server name.
|
* Returns server name.
|
||||||
*
|
*
|
||||||
* @return string Name.
|
* @return string Name.
|
||||||
*/
|
*/
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server port.
|
* Returns server port.
|
||||||
*
|
*
|
||||||
* @return int Port.
|
* @return int Port.
|
||||||
*/
|
*/
|
||||||
public function getPort()
|
public function getPort()
|
||||||
{
|
{
|
||||||
return $this->port;
|
return $this->port;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server location.
|
* Returns server location.
|
||||||
*
|
*
|
||||||
* @return string Location.
|
* @return string Location.
|
||||||
*/
|
*/
|
||||||
public function getLocation()
|
public function getLocation()
|
||||||
{
|
{
|
||||||
return $this->location;
|
return $this->location;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server website.
|
* Returns server website.
|
||||||
*
|
*
|
||||||
* @return string Website URL.
|
* @return string Website URL.
|
||||||
*/
|
*/
|
||||||
public function getURL()
|
public function getURL()
|
||||||
{
|
{
|
||||||
return $this->url;
|
return $this->url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server version.
|
* Returns server version.
|
||||||
*
|
*
|
||||||
* @return string Version.
|
* @return string Version.
|
||||||
*/
|
*/
|
||||||
public function getServerVersion()
|
public function getServerVersion()
|
||||||
{
|
{
|
||||||
return $this->version;
|
return $this->version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns owner name.
|
* Returns owner name.
|
||||||
*
|
*
|
||||||
* @return string Owner name.
|
* @return string Owner name.
|
||||||
*/
|
*/
|
||||||
public function getOwner()
|
public function getOwner()
|
||||||
{
|
{
|
||||||
return $this->owner;
|
return $this->owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns owner e-mail.
|
* Returns owner e-mail.
|
||||||
*
|
*
|
||||||
* @return string Owner e-mail.
|
* @return string Owner e-mail.
|
||||||
*/
|
*/
|
||||||
public function getEMail()
|
public function getEMail()
|
||||||
{
|
{
|
||||||
return $this->eMail;
|
return $this->eMail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns current amount of players online.
|
* Returns current amount of players online.
|
||||||
*
|
*
|
||||||
* @return int Count of players.
|
* @return int Count of players.
|
||||||
*/
|
*/
|
||||||
public function getOnlinePlayers()
|
public function getOnlinePlayers()
|
||||||
{
|
{
|
||||||
return $this->online;
|
return $this->online;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns maximum amount of players online.
|
* Returns maximum amount of players online.
|
||||||
*
|
*
|
||||||
* @return int Maximum allowed count of players.
|
* @return int Maximum allowed count of players.
|
||||||
*/
|
*/
|
||||||
public function getMaxPlayers()
|
public function getMaxPlayers()
|
||||||
{
|
{
|
||||||
return $this->max;
|
return $this->max;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns record of online players.
|
* Returns record of online players.
|
||||||
*
|
*
|
||||||
* @return int Players online record.
|
* @return int Players online record.
|
||||||
*/
|
*/
|
||||||
public function getPlayersPeak()
|
public function getPlayersPeak()
|
||||||
{
|
{
|
||||||
return $this->peak;
|
return $this->peak;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns map name.
|
* Returns map name.
|
||||||
*
|
*
|
||||||
* @return string Map name.
|
* @return string Map name.
|
||||||
*/
|
*/
|
||||||
public function getMapName()
|
public function getMapName()
|
||||||
{
|
{
|
||||||
return $this->map;
|
return $this->map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns map author.
|
* Returns map author.
|
||||||
*
|
*
|
||||||
* @return string Mapper name.
|
* @return string Mapper name.
|
||||||
*/
|
*/
|
||||||
public function getMapAuthor()
|
public function getMapAuthor()
|
||||||
{
|
{
|
||||||
return $this->author;
|
return $this->author;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns map width.
|
* Returns map width.
|
||||||
*
|
*
|
||||||
* @return int Map width.
|
* @return int Map width.
|
||||||
*/
|
*/
|
||||||
public function getMapWidth()
|
public function getMapWidth()
|
||||||
{
|
{
|
||||||
return $this->width;
|
return $this->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns map height.
|
* Returns map height.
|
||||||
*
|
*
|
||||||
* @return int Map height.
|
* @return int Map height.
|
||||||
*/
|
*/
|
||||||
public function getMapHeight()
|
public function getMapHeight()
|
||||||
{
|
{
|
||||||
return $this->height;
|
return $this->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns server's Message Of The Day
|
* Returns server's Message Of The Day
|
||||||
*
|
*
|
||||||
* @return string Server MOTD.
|
* @return string Server MOTD.
|
||||||
*/
|
*/
|
||||||
public function getMOTD()
|
public function getMOTD()
|
||||||
{
|
{
|
||||||
return $this->motd;
|
return $this->motd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of players currently online.
|
* Returns list of players currently online.
|
||||||
*
|
*
|
||||||
* @return array List of players in format 'name' => level.
|
* @return array List of players in format 'name' => level.
|
||||||
*/
|
*/
|
||||||
public function getPlayers()
|
public function getPlayers()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns software name.
|
* Returns software name.
|
||||||
*
|
*
|
||||||
* @return string Software name.
|
* @return string Software name.
|
||||||
*/
|
*/
|
||||||
public function getSoftwareName()
|
public function getSoftwareName()
|
||||||
{
|
{
|
||||||
return $this->softwareName;
|
return $this->softwareName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns software version.
|
* Returns software version.
|
||||||
*
|
*
|
||||||
* @return string Software version.
|
* @return string Software version.
|
||||||
*/
|
*/
|
||||||
public function getSoftwareVersion()
|
public function getSoftwareVersion()
|
||||||
{
|
{
|
||||||
return $this->softwareVersion;
|
return $this->softwareVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns software protocol.
|
* Returns software protocol.
|
||||||
*
|
*
|
||||||
* @return string Software protocol.
|
* @return string Software protocol.
|
||||||
*/
|
*/
|
||||||
public function getSoftwareProtocol()
|
public function getSoftwareProtocol()
|
||||||
{
|
{
|
||||||
return $this->softwareProtocol;
|
return $this->softwareProtocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic PHP5 method.
|
* Magic PHP5 method.
|
||||||
@ -503,68 +503,68 @@ class OTS_ServerStatus
|
|||||||
* @return mixed Property value.
|
* @return mixed Property value.
|
||||||
* @throws OutOfBoundsException For non-supported properties.
|
* @throws OutOfBoundsException For non-supported properties.
|
||||||
*/
|
*/
|
||||||
public function __get($name)
|
public function __get($name)
|
||||||
{
|
{
|
||||||
switch($name)
|
switch($name)
|
||||||
{
|
{
|
||||||
case 'uptime':
|
case 'uptime':
|
||||||
return $this->getUptime();
|
return $this->getUptime();
|
||||||
|
|
||||||
case 'ip':
|
case 'ip':
|
||||||
return $this->getIP();
|
return $this->getIP();
|
||||||
|
|
||||||
case 'name':
|
case 'name':
|
||||||
return $this->getName();
|
return $this->getName();
|
||||||
|
|
||||||
case 'port':
|
case 'port':
|
||||||
return $this->getPort();
|
return $this->getPort();
|
||||||
|
|
||||||
case 'location':
|
case 'location':
|
||||||
return $this->getLocation();
|
return $this->getLocation();
|
||||||
|
|
||||||
case 'url':
|
case 'url':
|
||||||
return $this->getURL();
|
return $this->getURL();
|
||||||
|
|
||||||
case 'serverVersion':
|
case 'serverVersion':
|
||||||
return $this->getServerVersion();
|
return $this->getServerVersion();
|
||||||
|
|
||||||
case 'owner':
|
case 'owner':
|
||||||
return $this->getOwner();
|
return $this->getOwner();
|
||||||
|
|
||||||
case 'eMail':
|
case 'eMail':
|
||||||
return $this->getEMail();
|
return $this->getEMail();
|
||||||
|
|
||||||
case 'onlinePlayers':
|
case 'onlinePlayers':
|
||||||
return $this->getOnlinePlayers();
|
return $this->getOnlinePlayers();
|
||||||
|
|
||||||
case 'maxPlayers':
|
case 'maxPlayers':
|
||||||
return $this->getMaxPlayers();
|
return $this->getMaxPlayers();
|
||||||
|
|
||||||
case 'playersPeak':
|
case 'playersPeak':
|
||||||
return $this->getPlayersPeak();
|
return $this->getPlayersPeak();
|
||||||
|
|
||||||
case 'mapName':
|
case 'mapName':
|
||||||
return $this->getMapName();
|
return $this->getMapName();
|
||||||
|
|
||||||
case 'mapAuthor':
|
case 'mapAuthor':
|
||||||
return $this->getMapAuthor();
|
return $this->getMapAuthor();
|
||||||
|
|
||||||
case 'mapWidth':
|
case 'mapWidth':
|
||||||
return $this->getMapWidth();
|
return $this->getMapWidth();
|
||||||
|
|
||||||
case 'mapHeight':
|
case 'mapHeight':
|
||||||
return $this->getMapHeight();
|
return $this->getMapHeight();
|
||||||
|
|
||||||
case 'motd':
|
case 'motd':
|
||||||
return $this->getMOTD();
|
return $this->getMOTD();
|
||||||
|
|
||||||
case 'players':
|
case 'players':
|
||||||
return $this->getPlayers();
|
return $this->getPlayers();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new OutOfBoundsException();
|
throw new OutOfBoundsException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user