Rewrite getprofile to use Player class

master
Skylar Ittner 5 years ago
parent 92df403312
commit 395552b8f1

@ -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
]);
}
Loading…
Cancel
Save