Add getplace API
This commit is contained in:
parent
e3a325028d
commit
2d50f7a723
26
api/actions/getplace.php
Normal file
26
api/actions/getplace.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?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"], ["currentlife", "maxlife", "itemid"]);
|
||||
$data["artifacts"] = $artifacts;
|
||||
}
|
||||
|
||||
exitWithJson(["status" => "OK", "place" => $data]);
|
@ -59,6 +59,12 @@ $APIS = [
|
||||
"radius (optional)" => "numeric"
|
||||
]
|
||||
],
|
||||
"getplace" => [
|
||||
"load" => "getplace.php",
|
||||
"vars" => [
|
||||
"id" => "/[0-9]+/"
|
||||
]
|
||||
],
|
||||
"getchat" => [
|
||||
"load" => "getchat.php",
|
||||
"vars" => [
|
||||
|
Loading…
x
Reference in New Issue
Block a user