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

(cherry picked from commit aeaa8ecfab)
This commit is contained in:
treeston
2017-05-31 14:03:48 +02:00
committed by funjoker
parent 803012cc40
commit 57e3a67c94

View File

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