This repository has been archived on 2024-07-18. You can view files and clone it, but cannot push or open issues or pull requests.
lwb5/scripts/game/beta5/moving/library/getLocation.inc

27 lines
522 B
PHP
Raw Normal View History

2016-01-10 11:01:49 +01:00
<?php
class beta5_moving_getLocation {
function beta5_moving_getLocation($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
// Get a moving object's current location
function run($oid) {
$q = $this->db->query(
"SELECT w.location FROM waypoint w,moving_object o "
. "WHERE o.id=$oid AND w.move_id=$oid AND w.until_eta<=o.time_left "
. "ORDER BY w.until_eta DESC LIMIT 1"
);
if (!($q && dbCount($q) == 1)) {
return null;
}
list($loc) = dbFetchArray($q);
return $loc;
}
}
?>