|
|
|
@ -7,18 +7,16 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (empty($VARS["id"])) {
|
|
|
|
|
$accountid = getRequestUser()->getUID();
|
|
|
|
|
$player = new Player(getRequestUser());
|
|
|
|
|
} else {
|
|
|
|
|
$accountid = $VARS["id"];
|
|
|
|
|
$player = new Player(new User($VARS["id"]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($database->has("players", ["accountid" => $accountid])) {
|
|
|
|
|
$profile = $database->get("players", ["accountid (id)", "nickname (name)", "level", "energy", "maxenergy", "teamid"], ["accountid" => $accountid]);
|
|
|
|
|
if ($player->exists()) {
|
|
|
|
|
exitWithJson([
|
|
|
|
|
"status" => "OK",
|
|
|
|
|
"profile" => $player->toArray()
|
|
|
|
|
]);
|
|
|
|
|
} else {
|
|
|
|
|
sendJsonResp($Strings->get("Player does not exist.", false), "ERROR");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exitWithJson([
|
|
|
|
|
"status" => "OK",
|
|
|
|
|
"profile" => $profile
|
|
|
|
|
]);
|
|
|
|
|
}
|