From 57e3a67c94c58e7a18b7b0c97f6756f4883de552 Mon Sep 17 00:00:00 2001 From: treeston Date: Wed, 31 May 2017 14:03:48 +0200 Subject: Fix an issue where CanSpawn would never get invoked on creatures without per-guid script. (cherry picked from commit aeaa8ecfabc2885aa24a86ce22034718cb4f62d8) --- src/server/game/Scripting/ScriptMgr.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/server/game/Scripting/ScriptMgr.cpp') diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index b912f51cf9d..72354f47b21 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -1607,7 +1607,10 @@ bool ScriptMgr::CanSpawn(ObjectGuid::LowType spawnId, uint32 entry, CreatureTemp CreatureTemplate const* baseTemplate = sObjectMgr->GetCreatureTemplate(entry); if (!baseTemplate) baseTemplate = actTemplate; - GET_SCRIPT_RET(CreatureScript, (cData ? cData->ScriptId : baseTemplate->ScriptID), tmpscript, true); + uint32 scriptId = baseTemplate->ScriptID; + if (cData && cData->ScriptId) + scriptId = cData->ScriptId; + GET_SCRIPT_RET(CreatureScript, scriptId, tmpscript, true); return tmpscript->CanSpawn(spawnId, entry, baseTemplate, actTemplate, cData, map); } -- cgit v1.2.3