folderstructure change

This commit is contained in:
kremsy
2014-02-18 15:54:02 +01:00
committed by Steffen Schröder
parent 043c85fa97
commit 570b32fff8
109 changed files with 1 additions and 0 deletions

View File

@ -0,0 +1,56 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
abstract class AbstractStructure
{
static public function fromArray($array)
{
if(!is_array($array))
return $array;
$object = new static;
foreach($array as $key => $value)
$object->{lcfirst($key)} = $value;
return $object;
}
static public function fromArrayOfArray($array)
{
if(!is_array($array))
return $array;
$result = array();
foreach($array as $key => $value)
$result[$key] = static::fromArray($value);
return $result;
}
static public function getPropertyFromArray($array, $property)
{
return array_map(get_called_class().'::extractProperty', $array, array_fill(0, count($array), $property));
}
static protected function extractProperty($element, $property)
{
if(!is_a($element, get_called_class()) || !property_exists($element, $property))
throw new \InvalidArgumentException('property '.$property.' does not exists in class: '.get_called_class());
return $element->$property;
}
function toArray()
{
$out = array();
foreach(get_object_vars($this) as $key => $value)
$out[ucfirst($key)] = $value;
return $out;
}
}
?>

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 Bill extends AbstractStructure
{
const STATE_CREATING_TRANSACTION = 1;
const STATE_ISSUED = 2;
const STATE_VALIDATING_PAYMENT = 3;
const STATE_PAYED = 4;
const STATE_REFUSED = 5;
const STATE_ERROR = 6;
public $state;
public $stateName;
public $transactionId;
}
?>

View File

@ -0,0 +1,18 @@
<?php
/**
* @version $Revision: $:
* @author $Author: $:
* @date $Date: $:
*/
namespace Maniaplanet\DedicatedServer\Structures;
class Command extends AbstractStructure
{
public $name;
public $desc;
public $type;
public $default;
}
?>

View File

@ -0,0 +1,47 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class GameInfos extends AbstractStructure
{
/**
* Game Modes
*/
const GAMEMODE_SCRIPT = 0;
const GAMEMODE_ROUNDS = 1;
const GAMEMODE_TIMEATTACK = 2;
const GAMEMODE_TEAM = 3;
const GAMEMODE_LAPS = 4;
const GAMEMODE_CUP = 5;
const GAMEMODE_STUNTS = 6;
public $gameMode;
public $scriptName;
public $nbMaps;
public $chatTime;
public $finishTimeout;
public $allWarmUpDuration;
public $disableRespawn;
public $forceShowAllOpponents;
public $roundsPointsLimit;
public $roundsForcedLaps;
public $roundsUseNewRules;
public $roundsPointsLimitNewRules;
public $teamPointsLimit;
public $teamMaxPoints;
public $teamUseNewRules;
public $teamPointsLimitNewRules;
public $timeAttackLimit;
public $timeAttackSynchStartPeriod;
public $lapsNbLaps;
public $lapsTimeLimit;
public $cupPointsLimit;
public $cupRoundsPerMap;
public $cupNbWinners;
public $cupWarmUpDuration;
}
?>

View File

@ -0,0 +1,17 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class LobbyInfo extends AbstractStructure
{
public $isLobby;
public $lobbyPlayers;
public $lobbyMaxPlayers;
public $lobbyPlayersLevel;
}
?>

View File

@ -0,0 +1,27 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class Map extends AbstractStructure
{
public $uId;
public $name;
public $fileName;
public $author;
public $environnement;
public $mood;
public $bronzeTime;
public $silverTime;
public $goldTime;
public $authorTime;
public $copperPrice;
public $lapRace;
public $nbLaps;
public $nbCheckpoints;
public $mapType;
public $mapStyle;
}

View File

@ -0,0 +1,18 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class Mod extends AbstractStructure
{
public $env;
public $url;
function toArray()
{
return array('Env'=>$this->env,'Url'=>$this->url);
}
}

View File

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

View File

@ -0,0 +1,27 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class NetworkStats extends AbstractStructure
{
public $uptime;
public $nbrConnection;
public $meanConnectionTime;
public $meanNbrPlayer;
public $recvNetRate;
public $sendNetRate;
public $totalReceivingSize;
public $totalSendingSize;
public $playerNetInfos;
static public function fromArray($array)
{
$object = parent::fromArray($array);
$object->playerNetInfos = Player::fromArrayOfArray($object->playerNetInfos);
return $object;
}
}

View File

@ -0,0 +1,97 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class Player extends AbstractStructure
{
public $playerId;
public $login;
public $nickName;
public $teamId;
public $path;
public $language;
public $clientVersion;
public $clientName;
public $iPAddress;
public $downloadRate;
public $uploadRate;
public $isSpectator;
public $isInOfficialMode;
public $avatar;
public $skins;
public $ladderStats;
public $hoursSinceZoneInscription;
public $onlineRights;
public $rank;
public $bestTime;
public $bestCheckpoints;
public $score;
public $nbrLapsFinished;
public $ladderScore;
public $stateUpdateLatency;
public $stateUpdatePeriod;
public $latestNetworkActivity;
public $packetLossRate;
public $spectatorStatus;
public $ladderRanking;
public $flags;
public $isConnected = true;
public $allies = array();
public $clubLink;
//Flags details
public $forceSpectator;
public $isReferee;
public $isPodiumReady;
public $isUsingStereoscopy;
public $isManagedByAnOtherServer;
public $isServer;
public $hasPlayerSlot;
public $isBroadcasting;
public $hasJoinedGame;
//SpectatorStatus details
public $spectator;
public $temporarySpectator;
public $pureSpectator;
public $autoTarget;
public $currentTargetId;
function getArrayFromPath()
{
return explode('|', $this->path);
}
/**
* @return Player
*/
static public function fromArray($array)
{
$object = parent::fromArray($array);
$object->skins = Skin::fromArrayOfArray($object->skins);
//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,37 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class ScriptInfo extends AbstractStructure
{
public $name;
public $compatibleMapTypes;
public $description;
public $version;
public $paramDescs = array();
public $commandDescs = array();
static public function fromArray($array)
{
$object = parent::fromArray($array);
if($object->paramDescs)
{
$object->paramDescs = ScriptSettings::fromArrayOfArray($object->paramDescs);
}
if($object->commandDescs)
{
$object->commandDescs = Command::fromArrayOfArray($object->commandDescs);
}
return $object;
}
}
?>

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;
final class ScriptSettings extends AbstractStructure
{
public $name;
public $desc;
public $type;
public $default;
}
?>

View File

@ -0,0 +1,44 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class ServerOptions extends AbstractStructure
{
public $name;
public $comment;
public $password;
public $passwordForSpectator;
public $hideServer;
public $currentMaxPlayers;
public $nextMaxPlayers;
public $currentMaxSpectators;
public $nextMaxSpectators;
public $isP2PUpload;
public $isP2PDownload;
public $currentLadderMode;
public $nextLadderMode;
public $ladderServerLimitMax;
public $ladderServerLimitMin;
public $currentVehicleNetQuality;
public $nextVehicleNetQuality;
public $currentCallVoteTimeOut;
public $nextCallVoteTimeOut;
public $callVoteRatio;
public $allowMapDownload;
public $autoSaveReplays;
public $autoSaveValidationReplays;
public $refereePassword;
public $refereeMode;
public $currentUseChangingValidationSeed;
public $useChangingValidationSeed;
public $nextUseChangingValidationSeed;
public $clientInputsMaxLatency;
public $keepPlayerSlots;
public $disableHorns;
public $disableServiceAnnounces;
}

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 Skin extends AbstractStructure
{
public $orig;
public $name;
public $checksum;
public $url;
}

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 Status extends AbstractStructure
{
const UNKNOWN = 0;
const WAITING = 1;
const LAUNCHING = 2;
const SYNCHRONIZATION = 3;
const PLAY = 4;
const EXITING = 6;
public $code;
public $name;
}

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 SystemInfos extends AbstractStructure
{
public $publishedIp;
public $port;
public $p2PPort;
public $titleId;
public $serverLogin;
public $serverPlayerId;
public $connectionDownloadRate;
public $connectionUploadRate;
public $isServer;
public $isDedicated;
}
?>

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 Team extends AbstractStructure
{
public $name;
public $zonePath;
public $city;
public $emblemUrl;
public $huePrimary;
public $hueSecondary;
public $rGB;
public $clubLinkUrl;
}
?>

View File

@ -0,0 +1,18 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class Version extends AbstractStructure
{
public $name;
public $titleId;
public $version;
public $build;
public $apiVersion;
}
?>

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 Vote extends AbstractStructure
{
const STATE_NEW = 'NewVote';
const STATE_CANCELLED = 'VoteCancelled';
const STATE_PASSED = 'VotePassed';
const STATE_FAILED = 'VoteFailed';
public $status;
public $callerLogin;
public $cmdName;
public $cmdParam;
}
?>

View File

@ -0,0 +1,31 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Structures;
class VoteRatio extends AbstractStructure
{
const COMMAND_SCRIPT_SETTINGS = 'SetModeScriptSettingsAndCommands';
const COMMAND_NEXT_MAP = 'NextMap';
const COMMAND_JUMP_MAP = 'JumpToMapIndex';
const COMMAND_SET_NEXT_MAP = 'SetNextMapIndex';
const COMMAND_RESTART_MAP = 'RestartMap';
const COMMAND_TEAM_BALANCE = 'AutoTeamBalance';
const COMMAND_KICK = 'Kick';
const COMMAND_BAN = 'Ban';
public $command;
public $param;
public $ratio;
public function __construct($command = null, $ratio = null)
{
$this->command = $command;
$this->ratio = $ratio;
}
}
?>