aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortreeston <treeston.mmoc@gmail.com>2017-05-31 14:03:48 +0200
committertreeston <treeston.mmoc@gmail.com>2017-05-31 14:03:48 +0200
commitaeaa8ecfabc2885aa24a86ce22034718cb4f62d8 (patch)
tree0f606b1f39536b5888760e6012d74b4964bbe20c
parent302a039b7c1034ad0be67b1895565caf95853c2b (diff)
Fix an issue where CanSpawn would never get invoked on creatures without per-guid script.
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index 276054b1567..62be21d19b6 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -1568,7 +1568,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);
}