Entity/AI

* store and display StringIds
 * unify storage of AI/Scripts for NPCs and Objects
 * store and display StringIds and AI/Scripts from individual spawns in
   mapper tooltip and infobox
This commit is contained in:
Sarjuuk 2025-12-29 19:23:00 +01:00
parent 9db943e8f4
commit 2b3b9de8bc
9 changed files with 124 additions and 24 deletions

View file

@ -551,7 +551,6 @@ CREATE TABLE `aowow_creature` (
`vehicleId` mediumint(8) unsigned NOT NULL DEFAULT 0,
`minGold` mediumint(8) unsigned NOT NULL DEFAULT 0,
`maxGold` mediumint(8) unsigned NOT NULL DEFAULT 0,
`aiName` varchar(50) NOT NULL DEFAULT '',
`healthMin` int(10) unsigned NOT NULL DEFAULT 1,
`healthMax` int(10) unsigned NOT NULL DEFAULT 1,
`manaMin` int(10) unsigned NOT NULL DEFAULT 1,
@ -568,7 +567,8 @@ CREATE TABLE `aowow_creature` (
`mechanicImmuneMask` int(10) unsigned NOT NULL DEFAULT 0,
`schoolImmuneMask` int(10) unsigned NOT NULL DEFAULT 0,
`flagsExtra` int(10) unsigned NOT NULL DEFAULT 0,
`scriptName` varchar(50) NOT NULL DEFAULT '',
`ScriptOrAI` varchar(64) DEFAULT NULL,
`StringId` varchar(64) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_name` (`name_loc0`),
KEY `difficultyEntry1` (`difficultyEntry1`),
@ -1628,7 +1628,8 @@ CREATE TABLE `aowow_objects` (
`auraSpell` mediumint(8) unsigned NOT NULL DEFAULT 0,
`triggeredSpell` mediumint(8) unsigned NOT NULL DEFAULT 0,
`miscInfo` varchar(128) NOT NULL,
`ScriptOrAI` varchar(64) NOT NULL,
`ScriptOrAI` varchar(64) DEFAULT NULL,
`StringId` varchar(64) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_name` (`name_loc0`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@ -2555,6 +2556,8 @@ CREATE TABLE `aowow_spawns` (
`posX` float unsigned NOT NULL,
`posY` float unsigned NOT NULL,
`pathId` int(10) unsigned NOT NULL DEFAULT 0,
`ScriptName` varchar(64) DEFAULT NULL,
`StringId` varchar(64) DEFAULT NULL,
PRIMARY KEY (`guid`,`type`,`floor`),
KEY `type_idx` (`typeId`,`type`),
KEY `zone_idx` (`areaId`),

View file

@ -71,7 +71,7 @@ UNLOCK TABLES;
LOCK TABLES `aowow_dbversion` WRITE;
/*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */;
INSERT INTO `aowow_dbversion` VALUES (1764798162,0,NULL,NULL);
INSERT INTO `aowow_dbversion` VALUES (1767026730,0,NULL,NULL);
/*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */;
UNLOCK TABLES;

View file

@ -0,0 +1,18 @@
ALTER TABLE `aowow_spawns`
ADD COLUMN `ScriptName` varchar(64) DEFAULT NULL AFTER `pathId`,
ADD COLUMN `StringId` varchar(64) DEFAULT NULL AFTER `ScriptName`
;
ALTER TABLE `aowow_objects`
MODIFY COLUMN `ScriptOrAI` varchar(64) DEFAULT NULL,
ADD COLUMN `StringId` varchar(64) DEFAULT NULL AFTER `ScriptOrAI`
;
ALTER TABLE `aowow_creature`
DROP COLUMN `aiName`,
DROP COLUMN `scriptName`,
ADD COLUMN `ScriptOrAI` varchar(64) DEFAULT NULL AFTER `flagsExtra`,
ADD COLUMN `StringId` varchar(64) DEFAULT NULL AFTER `ScriptOrAI`
;
UPDATE `aowow_dbversion` SET `sql` = CONCAT(IFNULL(`sql`, ''), ' creature objects spawns');

View file

@ -61,7 +61,6 @@ CLISetup::registerSetup("sql", new class extends SetupScript
PetSpellDataId,
VehicleId,
mingold, maxgold,
AIName,
(CASE ct.exp WHEN 0 THEN min.basehp0 WHEN 1 THEN min.basehp1 ELSE min.basehp2 END) * ct.HealthModifier AS healthMin,
(CASE ct.exp WHEN 0 THEN max.basehp0 WHEN 1 THEN max.basehp1 ELSE max.basehp2 END) * ct.HealthModifier AS healthMax,
min.basemana * ct.ManaModifier AS manaMin,
@ -73,7 +72,8 @@ CLISetup::registerSetup("sql", new class extends SetupScript
mechanic_immune_mask,
spell_school_immune_mask,
flags_extra,
ScriptName
NULLIF(IF(ScriptName <> "", ScriptName, AIName), ""),
StringId
FROM creature_template ct
JOIN creature_classlevelstats min ON ct.unit_class = min.class AND ct.minlevel = min.level
JOIN creature_classlevelstats max ON ct.unit_class = max.class AND ct.maxlevel = max.level

View file

@ -53,7 +53,8 @@ CLISetup::registerSetup("sql", new class extends SetupScript
IF(`type` = 3, CONCAT_WS(" ", data4, data5, data2), -- miscInfo: loot v
IF(`type` = 25, CONCAT_WS(" ", data2, data3, 0),
IF(`type` = 23, CONCAT_WS(" ", data0, data1, data2), "")))), -- miscInfo: meetingStone
IF(ScriptName <> "", ScriptName, AIName)
NULLIF(IF(ScriptName <> "", ScriptName, AIName), ""),
StringId
FROM gameobject_template go
LEFT JOIN gameobject_template_addon goa ON go.entry = goa.entry
LEFT JOIN gameobject_template_locale gtl2 ON go.entry = gtl2.entry AND gtl2.`locale` = "frFR"

View file

@ -212,9 +212,9 @@ CLISetup::registerSetup("sql", new class extends SetupScript
private function creature() : array
{
// [guid, type, typeId, map, posX, posY [, respawn, spawnMask, phaseMask, areaId, floor, pathId]]
// [guid, type, typeId, map, posX, posY [, respawn, spawnMask, phaseMask, areaId, floor, pathId, ScriptName, StringId]]
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`, IFNULL(cta.`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`, NULLIF(`ScriptName`, "") AS "ScriptName", NULLIF(`StringId`, "") AS "StringId"
FROM creature c
LEFT JOIN creature_addon ca ON ca.guid = c.guid
LEFT JOIN creature_template_addon cta ON cta.entry = c.id',
@ -224,9 +224,9 @@ CLISetup::registerSetup("sql", new class extends SetupScript
private function gameobject() : array
{
// [guid, type, typeId, map, posX, posY [, respawn, spawnMask, phaseMask, areaId, floor, pathId]]
// [guid, type, typeId, map, posX, posY [, respawn, spawnMask, phaseMask, areaId, floor, pathId, ScriptName, StringId]]
return DB::World()->select(
'SELECT `guid`, ?d AS `type`, `id` AS `typeId`, `map`, `position_x` AS `posX`, `position_y` AS `posY`, `spawntimesecs` AS `respawn`, `spawnMask`, `phaseMask`, `zoneId` AS `areaId`
'SELECT `guid`, ?d AS `type`, `id` AS `typeId`, `map`, `position_x` AS `posX`, `position_y` AS `posY`, `spawntimesecs` AS `respawn`, `spawnMask`, `phaseMask`, `zoneId` AS `areaId`, NULLIF(`ScriptName`, "") AS "ScriptName", NULLIF(`StringId`, "") AS "StringId"
FROM gameobject',
Type::OBJECT
);
@ -234,7 +234,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript
private function soundemitter() : array
{
// [guid, type, typeId, map, posX, posY [, respawn, spawnMask, phaseMask, areaId, floor, pathId]]
// [guid, type, typeId, map, posX, posY [, respawn, spawnMask, phaseMask, areaId, floor, pathId, ScriptName, StringId]]
return DB::Aowow()->select(
'SELECT `id` AS `guid`, ?d AS `type`, `soundId` AS `typeId`, `mapId` AS `map`, `posX`, `posY`
FROM dbc_soundemitters',
@ -244,7 +244,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript
private function areatrigger() : array
{
// [guid, type, typeId, map, posX, posY [, respawn, spawnMask, phaseMask, areaId, floor, pathId]]
// [guid, type, typeId, map, posX, posY [, respawn, spawnMask, phaseMask, areaId, floor, pathId, ScriptName, StringId]]
$base = DB::Aowow()->select(
'SELECT `id` AS `guid`, ?d AS `type`, `id` AS `typeId`, `mapId` AS `map`, `posX`, `posY`
FROM dbc_areatrigger',