/** * Returns a hydrated mapzone object for abstract coords $x and $y * @param $x * @param $y * @return Mapzone */ public function getMapzoneFromAbstract($x, $y) { $query = "SELECT * FROM game.mapzone WHERE x=" . $x . " AND y=" . $y . ";"; $this->db->setQuery($query); $this->db->query(); $loadObj = $this->db->loadObject(); $mapzone = new Mapzone($loadObj->id); $mapzone->setDb($this->db); $mapzone->load(); return $mapzone; }
/** * @param Mapzone $mz * @return Array|TradegoodToken */ public function searchZoneForTradegoodTokens(Mapzone $mz) { $tokens = []; $query = 'SELECT id FROM tradegoodtoken WHERE mapzone=' . $mz->getId() . ';'; $this->db->setQuery($query); $this->db->query(); $loadObj = $this->db->loadObjectList(); foreach ($loadObj as $obj) { $tgt = new TradegoodToken($obj->id); $tgt->setDb($this->db); $tgt->load(); $tokens[] = $tgt; } return $tokens; }