Core/Spawning: Actually check spawn group state before processing a respawn. It feels like that is something that should've been noticed at some point.

Also remove CreatureScript::CanSpawn since nobody uses it, and spawn groups do the same thing.

(cherry picked from commit 94b5d9bfa1)
This commit is contained in:
Treeston
2018-02-22 20:31:42 +01:00
committed by funjoker
parent 5e7a11f88d
commit 5c80f50734
7 changed files with 45 additions and 81 deletions

View File

@@ -1599,44 +1599,6 @@ bool ScriptMgr::OnCastItemCombatSpell(Player* player, Unit* victim, SpellInfo co
return tmpscript->OnCastItemCombatSpell(player, victim, spellInfo, item);
}
bool ScriptMgr::CanSpawn(ObjectGuid::LowType spawnId, uint32 entry, CreatureData const* cData, Map const* map)
{
ASSERT(map);
CreatureTemplate const* baseTemplate = sObjectMgr->GetCreatureTemplate(entry);
ASSERT(baseTemplate);
// find out which template we'd be using
CreatureTemplate const* actTemplate = nullptr;
DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(map->GetDifficultyID());
while (!actTemplate && difficultyEntry)
{
int32 idx = CreatureTemplate::DifficultyIDToDifficultyEntryIndex(difficultyEntry->ID);
if (idx == -1)
break;
if (baseTemplate->DifficultyEntry[idx])
{
actTemplate = sObjectMgr->GetCreatureTemplate(baseTemplate->DifficultyEntry[idx]);
break;
}
if (!difficultyEntry->FallbackDifficultyID)
break;
difficultyEntry = sDifficultyStore.LookupEntry(difficultyEntry->FallbackDifficultyID);
}
if (!actTemplate)
actTemplate = baseTemplate;
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);
}
CreatureAI* ScriptMgr::GetCreatureAI(Creature* creature)
{
ASSERT(creature);