Fix an issue where CanSpawn would never get invoked on creatures without per-guid script.

This commit is contained in:
treeston
2017-05-31 14:03:48 +02:00
parent 302a039b7c
commit aeaa8ecfab

View File

@@ -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);
}