added typhinting ladderstat in player object
This commit is contained in:
parent
790dbeb0a2
commit
30945a17e6
@ -1,3 +1,7 @@
|
|||||||
|
###v0.162###
|
||||||
|
#Additions
|
||||||
|
- added typhinting ladderStat in Player object
|
||||||
|
|
||||||
###v0.161###
|
###v0.161###
|
||||||
#Additions
|
#Additions
|
||||||
- added admin chatcommand //uptime which displays the time since when the server is running
|
- added admin chatcommand //uptime which displays the time since when the server is running
|
||||||
|
@ -5,6 +5,7 @@ namespace ManiaControl\Players;
|
|||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Utils\ClassUtil;
|
use ManiaControl\Utils\ClassUtil;
|
||||||
use ManiaControl\Utils\Formatter;
|
use ManiaControl\Utils\Formatter;
|
||||||
|
use Maniaplanet\DedicatedServer\Structures\LadderStats;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Player Model Class
|
* Player Model Class
|
||||||
@ -17,55 +18,56 @@ class Player {
|
|||||||
/*
|
/*
|
||||||
* Public Properties
|
* Public Properties
|
||||||
*/
|
*/
|
||||||
public $index = -1;
|
public $index = -1;
|
||||||
public $pid = -1;
|
public $pid = -1;
|
||||||
public $login = null;
|
public $login = null;
|
||||||
public $nickname = null;
|
public $nickname = null;
|
||||||
public $rawNickname = null;
|
public $rawNickname = null;
|
||||||
public $path = null;
|
public $path = null;
|
||||||
public $authLevel = 0;
|
public $authLevel = 0;
|
||||||
public $language = null;
|
public $language = null;
|
||||||
public $avatar = null;
|
public $avatar = null;
|
||||||
public $allies = array();
|
public $allies = array();
|
||||||
public $clubLink = null;
|
public $clubLink = null;
|
||||||
public $teamId = -1;
|
public $teamId = -1;
|
||||||
public $isOfficial = null;
|
public $isOfficial = null;
|
||||||
public $ladderScore = -1.;
|
public $ladderScore = -1.;
|
||||||
public $ladderRank = -1;
|
public $ladderRank = -1;
|
||||||
public $ladderStats = null;
|
/** @var LadderStats $ladderStats */
|
||||||
public $joinTime = -1;
|
public $ladderStats = null;
|
||||||
public $ipAddress = null;
|
public $joinTime = -1;
|
||||||
public $isConnected = true;
|
public $ipAddress = null;
|
||||||
public $clientVersion = null;
|
public $isConnected = true;
|
||||||
public $downloadRate = -1;
|
public $clientVersion = null;
|
||||||
public $uploadRate = -1;
|
public $downloadRate = -1;
|
||||||
public $skins = null;
|
public $uploadRate = -1;
|
||||||
|
public $skins = null;
|
||||||
public $daysSinceZoneInscription = -1;
|
public $daysSinceZoneInscription = -1;
|
||||||
|
|
||||||
//Flags details
|
//Flags details
|
||||||
public $forcedSpectatorState = 0;
|
public $forcedSpectatorState = 0;
|
||||||
public $isReferee = false;
|
public $isReferee = false;
|
||||||
public $isPodiumReady = false;
|
public $isPodiumReady = false;
|
||||||
public $isUsingStereoscopy = false;
|
public $isUsingStereoscopy = false;
|
||||||
public $isManagedByAnOtherServer = false;
|
public $isManagedByAnOtherServer = false;
|
||||||
public $isServer = false;
|
public $isServer = false;
|
||||||
public $hasPlayerSlot = false;
|
public $hasPlayerSlot = false;
|
||||||
public $isBroadcasting = false;
|
public $isBroadcasting = false;
|
||||||
public $hasJoinedGame = false;
|
public $hasJoinedGame = false;
|
||||||
|
|
||||||
//SpectatorStatus details
|
//SpectatorStatus details
|
||||||
public $isSpectator = false;
|
public $isSpectator = false;
|
||||||
public $isTemporarySpectator = false;
|
public $isTemporarySpectator = false;
|
||||||
public $isPureSpectator = false;
|
public $isPureSpectator = false;
|
||||||
public $autoTarget = false;
|
public $autoTarget = false;
|
||||||
public $currentTargetId = 0;
|
public $currentTargetId = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Private properties
|
* Private properties
|
||||||
*/
|
*/
|
||||||
/** @var ManiaControl $maniaControl */
|
/** @var ManiaControl $maniaControl */
|
||||||
private $maniaControl = null;
|
private $maniaControl = null;
|
||||||
private $cache = array();
|
private $cache = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Player
|
* Construct a new Player
|
||||||
@ -75,7 +77,7 @@ class Player {
|
|||||||
*/
|
*/
|
||||||
public function __construct(ManiaControl $maniaControl, $connected) {
|
public function __construct(ManiaControl $maniaControl, $connected) {
|
||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
$this->isConnected = (bool)$connected;
|
$this->isConnected = (bool) $connected;
|
||||||
if ($connected) {
|
if ($connected) {
|
||||||
$this->joinTime = time();
|
$this->joinTime = time();
|
||||||
}
|
}
|
||||||
@ -89,9 +91,9 @@ class Player {
|
|||||||
*/
|
*/
|
||||||
public static function parseLogin($player) {
|
public static function parseLogin($player) {
|
||||||
if (is_object($player) && property_exists($player, 'login')) {
|
if (is_object($player) && property_exists($player, 'login')) {
|
||||||
return (string)$player->login;
|
return (string) $player->login;
|
||||||
}
|
}
|
||||||
return (string)$player;
|
return (string) $player;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -235,14 +237,14 @@ class Player {
|
|||||||
public function updatePlayerFlags($flags) {
|
public function updatePlayerFlags($flags) {
|
||||||
//Detail flags
|
//Detail flags
|
||||||
$this->forcedSpectatorState = $flags % 10; // 0, 1 or 2
|
$this->forcedSpectatorState = $flags % 10; // 0, 1 or 2
|
||||||
$this->isReferee = (bool)(intval($flags / 10) % 10);
|
$this->isReferee = (bool) (intval($flags / 10) % 10);
|
||||||
$this->isPodiumReady = (bool)(intval($flags / 100) % 10);
|
$this->isPodiumReady = (bool) (intval($flags / 100) % 10);
|
||||||
$this->isUsingStereoscopy = (bool)(intval($flags / 1000) % 10);
|
$this->isUsingStereoscopy = (bool) (intval($flags / 1000) % 10);
|
||||||
$this->isManagedByAnOtherServer = (bool)(intval($flags / 10000) % 10);
|
$this->isManagedByAnOtherServer = (bool) (intval($flags / 10000) % 10);
|
||||||
$this->isServer = (bool)(intval($flags / 100000) % 10);
|
$this->isServer = (bool) (intval($flags / 100000) % 10);
|
||||||
$this->hasPlayerSlot = (bool)(intval($flags / 1000000) % 10);
|
$this->hasPlayerSlot = (bool) (intval($flags / 1000000) % 10);
|
||||||
$this->isBroadcasting = (bool)(intval($flags / 10000000) % 10);
|
$this->isBroadcasting = (bool) (intval($flags / 10000000) % 10);
|
||||||
$this->hasJoinedGame = (bool)(intval($flags / 100000000) % 10);
|
$this->hasJoinedGame = (bool) (intval($flags / 100000000) % 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -252,10 +254,10 @@ class Player {
|
|||||||
*/
|
*/
|
||||||
public function updateSpectatorStatus($spectatorStatus) {
|
public function updateSpectatorStatus($spectatorStatus) {
|
||||||
//Details spectatorStatus
|
//Details spectatorStatus
|
||||||
$this->isSpectator = (bool)($spectatorStatus % 10);
|
$this->isSpectator = (bool) ($spectatorStatus % 10);
|
||||||
$this->isTemporarySpectator = (bool)(intval($spectatorStatus / 10) % 10);
|
$this->isTemporarySpectator = (bool) (intval($spectatorStatus / 10) % 10);
|
||||||
$this->isPureSpectator = (bool)(intval($spectatorStatus / 100) % 10);
|
$this->isPureSpectator = (bool) (intval($spectatorStatus / 100) % 10);
|
||||||
$this->autoTarget = (bool)(intval($spectatorStatus / 1000) % 10);
|
$this->autoTarget = (bool) (intval($spectatorStatus / 1000) % 10);
|
||||||
$this->currentTargetId = intval($spectatorStatus / 10000);
|
$this->currentTargetId = intval($spectatorStatus / 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user