dedicated server api update

This commit is contained in:
kremsy 2014-05-08 19:33:27 +02:00
parent aefa91fc15
commit 554abe77da
12 changed files with 373 additions and 0 deletions

View File

@ -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 FileDesc extends AbstractStructure
{
/** @var string */
public $fileName;
/** @var string */
public $checksum;
}

View File

@ -0,0 +1,20 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class ForcedSkin extends AbstractStructure
{
/** @var string */
public $orig;
/** @var string */
public $name;
/** @var string */
public $checksum;
/** @var string */
public $url;
}

View File

@ -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 LadderLimits extends AbstractStructure
{
/** @var float */
public $ladderServerLimitMin;
/** @var float */
public $ladderServerLimitMax;
}

View File

@ -0,0 +1,36 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class LadderStats extends AbstractStructure
{
/** @var float */
public $lastMatchScore;
/** @var int */
public $nbrMatchWins;
/** @var int */
public $nbrMatchDraws;
/** @var int */
public $nbrMatchLosses;
/** @var string */
public $teamName;
/** @var ZoneRanking[] */
public $playerRankings;
/** @var array */
public $teamRankings;
/**
* @return LadderStats
*/
static function fromArray($array)
{
$object = parent::fromArray($array);
$object->playerRankings = ZoneRanking::fromArrayOfArray($object->playerRankings);
return $object;
}
}

View File

@ -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 PlayerAnswer extends Player
{
/** @var int */
public $playerId;
/** @var int */
public $result;
}

View File

@ -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 PlayerBan extends Player
{
/** @var string */
public $clientName;
/** @var string */
public $iPAddress;
}

View File

@ -0,0 +1,72 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class PlayerDetailedInfo extends Player
{
/** @var string */
public $nickName;
/** @var int */
public $playerId;
/** @var int */
public $teamId;
/** @var string */
public $path;
/** @var string */
public $language;
/** @var string */
public $clientVersion;
/** @var string */
public $clientTitleVersion;
/** @var string */
public $iPAddress;
/** @var int */
public $downloadRate;
/** @var int */
public $uploadRate;
/** @var bool */
public $isSpectator;
/** @var bool */
public $isInOfficialMode;
/** @var bool */
public $isReferee;
/** @var FileDesc */
public $avatar;
/** @var Skin[] */
public $skins;
/** @var LadderStats */
public $ladderStats;
/** @var int */
public $hoursSinceZoneInscription;
/** @var string */
public $broadcasterLogin;
/** @var string[] */
public $allies = array();
/** @var string */
public $clubLink;
/**
* @return string[]
*/
function getArrayFromPath()
{
return explode('|', $this->path);
}
/**
* @return PlayerDetailedInfo
*/
static public function fromArray($array)
{
$object = parent::fromArray($array);
$object->avatar = FileDesc::fromArray($object->avatar);
$object->skins = Skin::fromArrayOfArray($object->skins);
$object->ladderStats = LadderStats::fromArray($object->ladderStats);
return $object;
}
}

View File

@ -0,0 +1,87 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class PlayerInfo extends Player
{
/** @var string */
public $nickName;
/** @var int */
public $playerId;
/** @var int */
public $teamId;
/** @var bool */
public $isSpectator;
/** @var bool */
public $isInOfficialMode;
/** @var int */
public $ladderRanking;
/** @var int */
public $spectatorStatus;
/** @var int */
public $flags;
//Flags details
/** @var int */
public $forceSpectator;
/** @var bool */
public $isReferee;
/** @var bool */
public $isPodiumReady;
/** @var bool */
public $isUsingStereoscopy;
/** @var bool */
public $isManagedByAnOtherServer;
/** @var bool */
public $isServer;
/** @var bool */
public $hasPlayerSlot;
/** @var bool */
public $isBroadcasting;
/** @var bool */
public $hasJoinedGame;
//SpectatorStatus details
/** @var bool */
public $spectator;
/** @var bool */
public $temporarySpectator;
/** @var bool */
public $pureSpectator;
/** @var bool */
public $autoTarget;
/** @var int */
public $currentTargetId;
/**
* @return PlayerInfo
*/
static public function fromArray($array)
{
$object = parent::fromArray($array);
//Detail flags
$object->forceSpectator = $object->flags % 10; // 0, 1 or 2
$object->isReferee = (bool) (intval($object->flags / 10) % 10);
$object->isPodiumReady = (bool) (intval($object->flags / 100) % 10);
$object->isUsingStereoscopy = (bool) (intval($object->flags / 1000) % 10);
$object->isManagedByAnOtherServer = (bool) (intval($object->flags / 10000) % 10);
$object->isServer = (bool) (intval($object->flags / 100000) % 10);
$object->hasPlayerSlot = (bool) (intval($object->flags / 1000000) % 10);
$object->isBroadcasting = (bool) (intval($object->flags / 10000000) % 10);
$object->hasJoinedGame = (bool) (intval($object->flags / 100000000) % 10);
//Details spectatorStatus
$object->spectator = (bool) ($object->spectatorStatus % 10);
$object->temporarySpectator = (bool) (intval($object->spectatorStatus / 10) % 10);
$object->pureSpectator = (bool) (intval($object->spectatorStatus / 100) % 10);
$object->autoTarget = (bool) (intval($object->spectatorStatus / 1000) % 10);
$object->currentTargetId = intval($object->spectatorStatus / 10000);
return $object;
}
}

View File

@ -0,0 +1,22 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class PlayerNetInfo extends Player
{
/** @var string */
public $iPAddress;
/** @var int */
public $stateUpdateLatency;
/** @var int */
public $stateUpdatePeriod;
/** @var int */
public $latestNetworkActivity;
/** @var float */
public $packetLossRate;
}

View File

@ -0,0 +1,28 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class PlayerRanking extends Player
{
/** @var string */
public $nickName;
/** @var int */
public $playerId;
/** @var int */
public $rank;
/** @var int */
public $bestTime;
/** @var int[] */
public $bestCheckpoints;
/** @var int */
public $score;
/** @var int */
public $nbrLapsFinished;
/** @var float */
public $ladderScore;
}

View File

@ -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 Tag extends AbstractStructure
{
/** @var string */
public $name;
/** @var string */
public $value;
}

View File

@ -0,0 +1,28 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class ZoneRanking extends AbstractStructure
{
/** @var string */
public $path;
/** @var float */
public $score;
/** @var int */
public $ranking;
/** @var int */
public $totalCount;
/**
* @return string[]
*/
function getArrayFromPath()
{
return explode('|', $this->path);
}
}