From 7b924a197e9814a0e0bf91cb0478e3926e31738a Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Mon, 17 Jun 2024 13:36:45 +0200 Subject: [PATCH] Mapper/Spawns * do not try to place spawns assigned by instanced map <=> zoneId association. They have (0,0) as coordinates --- includes/basetype.class.php | 10 +++++----- pages/zone.php | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/basetype.class.php b/includes/basetype.class.php index 8f821965..8d187a0e 100644 --- a/includes/basetype.class.php +++ b/includes/basetype.class.php @@ -566,10 +566,10 @@ trait spawnHelper $this->spawnResult[SPAWNINFO_SHORT] = new StdClass; // first get zone/floor with the most spawns - if ($res = DB::Aowow()->selectRow('SELECT areaId, floor FROM ?_spawns WHERE type = ?d AND typeId = ?d AND posX > 0 AND posY > 0 GROUP BY areaId, floor ORDER BY count(1) DESC LIMIT 1', self::$type, $this->id)) + if ($res = DB::Aowow()->selectRow('SELECT `areaId`, `floor` FROM ?_spawns WHERE `type` = ?d AND `typeId` = ?d AND `posX` > 0 AND `posY` > 0 GROUP BY `areaId`, `floor` ORDER BY COUNT(1) DESC LIMIT 1', self::$type, $this->id)) { // get relevant spawn points - $points = DB::Aowow()->select('SELECT posX, posY FROM ?_spawns WHERE type = ?d AND typeId = ?d AND areaId = ?d AND floor = ?d AND posX > 0 AND posY > 0', self::$type, $this->id, $res['areaId'], $res['floor']); + $points = DB::Aowow()->select('SELECT `posX`, `posY` FROM ?_spawns WHERE `type` = ?d AND `typeId` = ?d AND `areaId` = ?d AND `floor` = ?d AND `posX` > 0 AND `posY` > 0', self::$type, $this->id, $res['areaId'], $res['floor']); $spawns = []; foreach ($points as $p) $spawns[] = [$p['posX'], $p['posY']]; @@ -585,7 +585,7 @@ trait spawnHelper $wpSum = []; $wpIdx = 0; $worldPos = []; - $spawns = DB::Aowow()->select("SELECT * FROM ?_spawns WHERE type = ?d AND typeId = ?d AND posX > 0 AND posY > 0", self::$type, $this->id); + $spawns = DB::Aowow()->select("SELECT * FROM ?_spawns WHERE `type` = ?d AND `typeId` = ?d AND `posX` > 0 AND `posY` > 0", self::$type, $this->id); if (!$spawns) return; @@ -751,7 +751,7 @@ trait spawnHelper private function createZoneSpawns() // [zoneId1, zoneId2, ..] for locations-column in listview { - $res = DB::Aowow()->selectCol("SELECT typeId AS ARRAY_KEY, GROUP_CONCAT(DISTINCT areaId) FROM ?_spawns WHERE type = ?d AND typeId IN (?a) GROUP BY typeId", self::$type, $this->getfoundIDs()); + $res = DB::Aowow()->selectCol("SELECT `typeId` AS ARRAY_KEY, GROUP_CONCAT(DISTINCT `areaId`) FROM ?_spawns WHERE `type` = ?d AND `typeId` IN (?a) AND `posX` > 0 AND `posY` > 0 GROUP BY `typeId`", self::$type, $this->getfoundIDs()); foreach ($res as &$r) { $r = explode(',', $r); @@ -767,7 +767,7 @@ trait spawnHelper if (self::$type == Type::SOUND) return; - $res = DB::Aowow()->select('SELECT areaId, floor, typeId, posX, posY FROM ?_spawns WHERE type = ?d AND typeId IN (?a) AND posX > 0 AND posY > 0', self::$type, $this->getFoundIDs()); + $res = DB::Aowow()->select('SELECT `areaId`, `floor`, `typeId`, `posX`, `posY` FROM ?_spawns WHERE `type` = ?d AND `typeId` IN (?a) AND `posX` > 0 AND `posY` > 0', self::$type, $this->getFoundIDs()); $spawns = []; foreach ($res as $data) { diff --git a/pages/zone.php b/pages/zone.php index 4e56cf08..e6565bbf 100644 --- a/pages/zone.php +++ b/pages/zone.php @@ -173,9 +173,9 @@ class ZonePage extends GenericPage } // we cannot fetch spawns via lists. lists are grouped by entry - $oSpawns = DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, Type::OBJECT); - $cSpawns = DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, Type::NPC); - $aSpawns = User::isInGroup(U_GROUP_STAFF) ? DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, Type::AREATRIGGER) : []; + $oSpawns = DB::Aowow()->select('SELECT * FROM ?_spawns WHERE `areaId` = ?d AND `type` = ?d AND `posX` > 0 AND `posY` > 0', $this->typeId, Type::OBJECT); + $cSpawns = DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND `type` = ?d AND `posX` > 0 AND `posY` > 0', $this->typeId, Type::NPC); + $aSpawns = User::isInGroup(U_GROUP_STAFF) ? DB::Aowow()->select('SELECT * FROM ?_spawns WHERE `areaId` = ?d AND `type` = ?d AND `posX` > 0 AND `posY` > 0', $this->typeId, Type::AREATRIGGER) : []; $conditions = [Cfg::get('SQL_LIMIT_NONE'), ['s.areaId', $this->typeId]]; if (!User::isInGroup(U_GROUP_STAFF))