You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
$data = [
|
|
"teamid" => null,
|
|
"ownerid" => null,
|
|
"currentlife" => 0,
|
|
"maxlife" => 0,
|
|
"artifacts" => []
|
|
];
|
|
|
|
if ($database->has("locations", ["osmid" => $VARS["id"]])) {
|
|
$gameprops = $database->get("locations", ["teamid", "ownerid", "currentlife", "maxlife"], ["osmid" => $VARS["id"]]);
|
|
foreach ($gameprops as $key => $value) {
|
|
$data[$key] = $value;
|
|
}
|
|
$artifacts = $database->select("artifacts", [
|
|
"[>]locations" => "locationid",
|
|
"[>]items" => "itemid"
|
|
], [
|
|
"artifacts.artuuid (id)", "artifacts.currentlife (energy)", "artifacts.maxlife (maxenergy)", "artifacts.itemid", "items.icon", "items.color"
|
|
], [
|
|
"locations.osmid" => $VARS["id"]
|
|
]);
|
|
$data["artifacts"] = $artifacts;
|
|
}
|
|
|
|
exitWithJson(["status" => "OK", "place" => $data]);
|