From ae54e5e213e06cc09233d3b7a69e04a31674a34a Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Thu, 27 Jun 2024 21:39:12 +0200 Subject: [PATCH] Setup/Spawns * restore info on manually moved spawn points * don't use worldmaparea zone dimensions for maps that don't use them --- includes/game.php | 3 ++- setup/tools/sqlgen/spawns.ss.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/game.php b/includes/game.php index 30a57b0c..2b7b3582 100644 --- a/includes/game.php +++ b/includes/game.php @@ -359,7 +359,8 @@ class Game SQRT(POWER(ABS((x.`maxY` - ?d) * 100 / (x.`maxY` - x.`minY`) - 50), 2) + POWER(ABS((x.`maxX` - ?d) * 100 / (x.`maxX` - x.`minX`) - 50), 2)) AS `dist` FROM - (SELECT 0 AS `id`, `areaId`, `mapId`, `right` AS `minY`, `left` AS `maxY`, `top` AS `maxX`, `bottom` AS `minX`, 0 AS `floor`, 0 AS `worldMapAreaId`, `defaultDungeonMapId` FROM ?_worldmaparea wma UNION + (SELECT 0 AS `id`, `areaId`, `mapId`, `right` AS `minY`, `left` AS `maxY`, `top` AS `maxX`, `bottom` AS `minX`, 0 AS `floor`, 0 AS `worldMapAreaId`, `defaultDungeonMapId` FROM ?_worldmaparea wma + WHERE `mapId` IN (0, 1, 530, 571, 603, 580, 564, 595) UNION -- select only for continents or maps that use wma data as floor 0 SELECT dm.`id`, `areaId`, wma.`mapId`, `minY`, `maxY`, `maxX`, `minX`, `floor`, `worldMapAreaId`, `defaultDungeonMapId` FROM ?_worldmaparea wma JOIN ?_dungeonmap dm ON dm.`mapId` = wma.`mapId` WHERE wma.`mapId` NOT IN (0, 1, 530, 571) OR wma.`areaId` = 4395) x LEFT JOIN diff --git a/setup/tools/sqlgen/spawns.ss.php b/setup/tools/sqlgen/spawns.ss.php index 2dea47bd..6407f98c 100644 --- a/setup/tools/sqlgen/spawns.ss.php +++ b/setup/tools/sqlgen/spawns.ss.php @@ -123,7 +123,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript $point = $this->transformPoint($spawn, $type, $notice); - if (!$notice && !$lastOverride) + if ($notice && $lastOverride != $spawn['guid']) { CLI::write($notice, CLI::LOG_INFO); $time->reset(); @@ -289,7 +289,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript } - private function transformPoint(array $point, int $type, ?string $notice = '') : array + private function transformPoint(array $point, int $type, ?string &$notice = '') : array { // npc/object is on a transport -> apply offsets to path of transport // note, that transport DO spawn outside of displayable area maps .. another todo i guess..