mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Setup/Spawns
* evaluate waypoint paths linked via creature_template_addon
This commit is contained in:
1
setup/sql/updates/1763240934_01.sql
Normal file
1
setup/sql/updates/1763240934_01.sql
Normal file
@@ -0,0 +1 @@
|
||||
UPDATE `aowow_dbversion` SET `sql` = CONCAT(IFNULL(`sql`, ''), ' spawns');
|
||||
@@ -24,7 +24,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript
|
||||
);
|
||||
|
||||
protected $dbcSourceFiles = ['worldmaparea', 'map', 'taxipathnode', 'soundemitters', 'areatrigger', 'areatable'];
|
||||
protected $worldDependency = ['creature', 'creature_addon', 'gameobject', 'gameobject_template', 'vehicle_accessory', 'vehicle_accessory_template', 'script_waypoint', 'waypoints', 'waypoint_data', 'smart_scripts', 'areatrigger_teleport'];
|
||||
protected $worldDependency = ['creature', 'creature_addon', 'creature_template_addon', 'gameobject', 'gameobject_template', 'vehicle_accessory', 'vehicle_accessory_template', 'script_waypoint', 'waypoints', 'waypoint_data', 'smart_scripts', 'areatrigger_teleport'];
|
||||
protected $setupAfter = [['dungeonmap', 'worldmaparea', 'zones'], ['img-maps']];
|
||||
|
||||
private $transports = [];
|
||||
@@ -214,9 +214,11 @@ CLISetup::registerSetup("sql", new class extends SetupScript
|
||||
{
|
||||
// [guid, type, typeId, map, posX, posY [, respawn, spawnMask, phaseMask, areaId, floor, pathId]]
|
||||
return DB::World()->select(
|
||||
'SELECT c.`guid`, ?d AS `type`, c.`id` AS `typeId`, c.`map`, c.`position_x` AS `posX`, c.`position_y` AS `posY`, c.`spawntimesecs` AS `respawn`, c.`spawnMask`, c.`phaseMask`, c.`zoneId` AS `areaId`, IFNULL(ca.`path_id`, 0) AS `pathId`
|
||||
'SELECT c.`guid`, ?d AS `type`, c.`id` AS `typeId`, c.`map`, c.`position_x` AS `posX`, c.`position_y` AS `posY`, c.`spawntimesecs` AS `respawn`, c.`spawnMask`, c.`phaseMask`, c.`zoneId` AS `areaId`, IFNULL(ca.`path_id`, IFNULL(cta.`path_id`, 0)) AS `pathId`
|
||||
FROM creature c
|
||||
LEFT JOIN creature_addon ca ON ca.guid = c.guid',
|
||||
LEFT JOIN creature_addon ca ON ca.guid = c.guid
|
||||
LEFT JOIN creature_template_addon cta ON cta.entry = c.id
|
||||
GROUP BY c.id',
|
||||
Type::NPC
|
||||
);
|
||||
}
|
||||
@@ -277,6 +279,8 @@ CLISetup::registerSetup("sql", new class extends SetupScript
|
||||
{
|
||||
// todo (med): at least `waypoints` can contain paths that do not belong to a creature but get assigned by SmartAI (or script) during runtime
|
||||
// in the future guid should be optional and additional parameters substituting guid should be passed down from NpcPage after SmartAI has been evaluated
|
||||
|
||||
// assume that creature_template_addon data isn't stupid and only creatures with a single spawn are referenced here
|
||||
return DB::World()->select(
|
||||
'SELECT c.`guid`, w.`entry` AS `creatureOrPath`, w.`pointId` AS `point`, c.`zoneId` AS `areaId`, c.`map`, w.`waittime` AS `wait`, w.`location_x` AS `posX`, w.`location_y` AS `posY`
|
||||
FROM creature c
|
||||
@@ -288,7 +292,12 @@ CLISetup::registerSetup("sql", new class extends SetupScript
|
||||
FROM creature c
|
||||
JOIN creature_addon ca ON ca.`guid` = c.`guid`
|
||||
JOIN waypoint_data w ON w.`id` = ca.`path_id`
|
||||
WHERE ca.`path_id` <> 0'
|
||||
WHERE ca.`path_id` <> 0 UNION
|
||||
SELECT c.`guid`, -w.`id` AS `creatureOrPath`, w.`point`, c.`zoneId` AS `areaId`, c.`map`, w.`delay` AS `wait`, w.`position_x` AS `posX`, w.`position_y` AS `posY`
|
||||
FROM creature c
|
||||
JOIN creature_template_addon cta ON cta.`entry` = c.`id`
|
||||
JOIN waypoint_data w ON w.`id` = cta.`path_id`
|
||||
WHERE cta.`path_id` <> 0'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user