From d96d040831b2c4e8312d5b8370c395dc4127bd86 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 06:53:47 -0700 Subject: [PATCH] fix(sql): substitute generic displayId for NPCs with displayId=0 A creature_template row with modelid1=0 spawns an invisible NPC in-game. Fall back to 11707 (a generic humanoid) on export so "Creature"-named placeholder spawns are at least usable; the user can edit the displayId after. --- tools/editor/sql_exporter.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/editor/sql_exporter.cpp b/tools/editor/sql_exporter.cpp index c314cb3b..d9d254e4 100644 --- a/tools/editor/sql_exporter.cpp +++ b/tools/editor/sql_exporter.cpp @@ -67,6 +67,11 @@ bool SQLExporter::exportCreatures(const std::vector& spawns, uint32_t unitFlags = 0; if (!s.hostile) unitFlags |= 0x02; // NON_ATTACKABLE + // displayId=0 results in an invisible NPC in-game. Fall back to + // 11707 (a generic humanoid) so the export is at least usable; + // the user can fix it after if they meant something else. + uint32_t displayId = s.displayId == 0 ? 11707 : s.displayId; + f << "INSERT INTO `creature_template` " << "(`entry`, `name`, `minlevel`, `maxlevel`, `minhealth`, `maxhealth`, " << "`mana`, `armor`, `mindmg`, `maxdmg`, `faction`, `npcflag`, " @@ -79,7 +84,7 @@ bool SQLExporter::exportCreatures(const std::vector& spawns, << s.minDamage << ", " << s.maxDamage << ", " << s.faction << ", " << npcFlags << ", " << unitFlags << ", " - << s.displayId << ", " + << displayId << ", " << s.scale << ") ON DUPLICATE KEY UPDATE `name`='" << escapeSql(s.name) << "';\n"; }