|
|
|
@ -18,6 +18,7 @@ class Player {
|
|
|
|
|
private $lastping = 0;
|
|
|
|
|
private $stealth = true;
|
|
|
|
|
public $stats = null;
|
|
|
|
|
private $badges = [];
|
|
|
|
|
|
|
|
|
|
public function __construct(\User $user) {
|
|
|
|
|
global $database;
|
|
|
|
@ -39,6 +40,8 @@ class Player {
|
|
|
|
|
$this->lastping = strtotime($profile["lastping"]);
|
|
|
|
|
$this->stealth = $profile["stealth"] == true;
|
|
|
|
|
$this->exists = true;
|
|
|
|
|
|
|
|
|
|
$this->badges = $database->select("player_badges", ["[>]badges" => "badgeid"], ["id", "name", "desc", "icon", "color", "background", "gotdate (date)"], ["accountid" => $user->getUID()]);
|
|
|
|
|
} else {
|
|
|
|
|
$this->exists = false;
|
|
|
|
|
}
|
|
|
|
@ -48,6 +51,10 @@ class Player {
|
|
|
|
|
return $this->exists;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getBadges(): array {
|
|
|
|
|
return $this->badges;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function toArray(): array {
|
|
|
|
|
//"accountid (id)", "nickname (name)", "level", "energy", "maxenergy", "teamid"
|
|
|
|
|
return [
|
|
|
|
@ -56,7 +63,8 @@ class Player {
|
|
|
|
|
"level" => floor($this->level),
|
|
|
|
|
"energy" => $this->energy->getEnergy(),
|
|
|
|
|
"maxenergy" => $this->energy->getMaxEnergy(),
|
|
|
|
|
"teamid" => $this->getTeamID()
|
|
|
|
|
"teamid" => $this->getTeamID(),
|
|
|
|
|
"badges" => $this->getBadges()
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|