Send more data to the client, auto-reset dead places
This commit is contained in:
parent
1c356dbe87
commit
96c381109c
BIN
database.mwb
BIN
database.mwb
Binary file not shown.
BIN
database.mwb.bak
BIN
database.mwb.bak
Binary file not shown.
@ -8,7 +8,7 @@ if (is_empty($VARS['user'])) {
|
|||||||
sendError("Missing data.", true);
|
sendError("Missing data.", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$stats = $database->select('players', ['level', 'energy', 'maxenergy', 'lastping'], ['uuid' => file_get_contents("https://sso.netsyms.com/api/getguid.php?user=" . $VARS['user'])])[0];
|
$stats = $database->select('players', ['level', 'energy', 'maxenergy', 'teamid', 'lastping'], ['uuid' => file_get_contents("https://sso.netsyms.com/api/getguid.php?user=" . $VARS['user'])])[0];
|
||||||
|
|
||||||
|
|
||||||
$out = [];
|
$out = [];
|
||||||
|
@ -82,7 +82,12 @@ 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', ['teamid', 'owneruuid'], ['osmid' => $place['osmid']])[0];
|
$gameinfo = $database->select('locations', ['locationid', 'teamid', 'owneruuid', 'currentlife', 'maxlife'], ['osmid' => $place['osmid']])[0];
|
||||||
|
// Reset owner info for dead places
|
||||||
|
if ($gameinfo['currentlife'] <= 0) {
|
||||||
|
$database->update('locations', ['teamid' => 0, 'owneruuid' => null], ['locationid' => $gameinfo['locationid']]);
|
||||||
|
$gameinfo = $database->select('locations', ['locationid', 'teamid', 'owneruuid', 'currentlife', 'maxlife'], ['osmid' => $place['osmid']])[0];
|
||||||
|
}
|
||||||
$geo['features'][] = array("type" => "Feature",
|
$geo['features'][] = array("type" => "Feature",
|
||||||
"geometry" => [
|
"geometry" => [
|
||||||
"type" => "Point",
|
"type" => "Point",
|
||||||
@ -98,7 +103,7 @@ foreach ($places as $place) {
|
|||||||
"amenity" => ($place['amenity'] == '' ? null : $place['amenity']),
|
"amenity" => ($place['amenity'] == '' ? null : $place['amenity']),
|
||||||
"historic" => ($place['historic'] == '' ? null : $place['historic']),
|
"historic" => ($place['historic'] == '' ? null : $place['historic']),
|
||||||
"tourism" => ($place['tourism'] == '' ? null : $place['tourism']),
|
"tourism" => ($place['tourism'] == '' ? null : $place['tourism']),
|
||||||
"gameinfo" => ['teamid' => $gameinfo['teamid'], 'owneruuid' => $gameinfo['owneruuid']]
|
"gameinfo" => $gameinfo//['teamid' => $gameinfo['teamid'], 'owneruuid' => $gameinfo['owneruuid']]
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user