Send owner name with place info
This commit is contained in:
parent
2a6718b156
commit
d57141f447
@ -89,11 +89,11 @@ foreach ($places as $place) {
|
|||||||
if (!$database->has('locations', ['osmid' => $place['osmid']])) {
|
if (!$database->has('locations', ['osmid' => $place['osmid']])) {
|
||||||
$database->insert('locations', ['osmid' => $place['osmid'], 'teamid' => 0]);
|
$database->insert('locations', ['osmid' => $place['osmid'], 'teamid' => 0]);
|
||||||
}
|
}
|
||||||
$gameinfo = $database->select('locations', ['locationid', 'teamid', 'owneruuid', 'currentlife', 'maxlife'], ['osmid' => $place['osmid']])[0];
|
$gameinfo = $database->select('locations', ['locationid', 'teamid', 'currentlife', 'maxlife'], ['osmid' => $place['osmid']])[0];
|
||||||
// Reset owner info for dead places
|
// Reset owner info for dead places
|
||||||
if ($gameinfo['currentlife'] <= 0) {
|
if ($gameinfo['currentlife'] <= 0) {
|
||||||
$database->update('locations', ['teamid' => 0, 'owneruuid' => null], ['locationid' => $gameinfo['locationid']]);
|
$database->update('locations', ['teamid' => 0, 'owneruuid' => null], ['locationid' => $gameinfo['locationid']]);
|
||||||
$gameinfo = $database->select('locations', ['locationid', 'teamid', 'owneruuid', 'currentlife', 'maxlife'], ['osmid' => $place['osmid']])[0];
|
$gameinfo = $database->select('locations', ['locationid', 'teamid', 'currentlife', 'maxlife'], ['osmid' => $place['osmid']])[0];
|
||||||
}
|
}
|
||||||
$geo['features'][] = array("type" => "Feature",
|
$geo['features'][] = array("type" => "Feature",
|
||||||
"geometry" => [
|
"geometry" => [
|
||||||
|
@ -13,7 +13,12 @@ $data['status'] = 'OK';
|
|||||||
if (!$database->has('locations', ['locationid' => $VARS['locationid']])) {
|
if (!$database->has('locations', ['locationid' => $VARS['locationid']])) {
|
||||||
sendError("No stats found.", true);
|
sendError("No stats found.", true);
|
||||||
}
|
}
|
||||||
$gameinfo = $database->select('locations', ['locationid', 'teamid', 'owneruuid', 'currentlife', 'maxlife'], ['locationid' => $VARS['locationid']])[0];
|
$gameinfo = $database->select('locations', ["[>]players" => ["owneruuid" => "uuid"]], ['locations.locationid', 'locations.teamid', 'locations.owneruuid', 'players.nickname', 'locations.currentlife', 'locations.maxlife'], ['locations.locationid' => $VARS['locationid']])[0];
|
||||||
|
|
||||||
|
if ($gameinfo['owneruuid'] == null) {
|
||||||
|
$gameinfo['nickname'] = null;
|
||||||
|
}
|
||||||
|
$gameinfo['owneruuid'] = "";
|
||||||
|
|
||||||
$data['stats'] = $gameinfo;
|
$data['stats'] = $gameinfo;
|
||||||
echo json_encode($data);
|
echo json_encode($data);
|
@ -24,3 +24,5 @@ define("MUNZEE_SECRET", "");
|
|||||||
|
|
||||||
define("GOOGLEPLAY_PUBLICKEY", "");
|
define("GOOGLEPLAY_PUBLICKEY", "");
|
||||||
define("APP_STORE_SANDBOX", true);
|
define("APP_STORE_SANDBOX", true);
|
||||||
|
|
||||||
|
define("DARKSKY_APIKEY", "");
|
Reference in New Issue
Block a user