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.
This commit is contained in:
Kelsi 2026-05-06 07:01:25 -07:00
parent 280fe1e6e8
commit 2119546a7a

View file

@ -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.