From 2119546a7a9fa8b66281b3d5bc0ca0a7c131b97b Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 07:01:25 -0700 Subject: [PATCH] fix(npc): truncate over-long NPC name/modelPath at SQL limits creature_template.name is varchar(100) in AzerothCore. Edited creature JSON could carry longer names that would either fail the INSERT or silently truncate. Cap name at 100 and modelPath at 1024 on load. --- tools/editor/npc_spawner.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/editor/npc_spawner.cpp b/tools/editor/npc_spawner.cpp index 0585511f..659a5450 100644 --- a/tools/editor/npc_spawner.cpp +++ b/tools/editor/npc_spawner.cpp @@ -149,6 +149,10 @@ bool NpcSpawner::loadFromFile(const std::string& path) { CreatureSpawn s; s.name = js.value("name", ""); s.modelPath = js.value("model", ""); + // creature_template.name is varchar(100); modelPath is internal + // but capped to keep export sane. Trim instead of dropping. + if (s.name.size() > 100) s.name.resize(100); + if (s.modelPath.size() > 1024) s.modelPath.resize(1024); s.displayId = js.value("displayId", 0u); s.orientation = js.value("orientation", 0.0f); // Normalise orientation to [0, 360) for consistent gizmo behaviour.