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.
This commit is contained in:
Treeston
2018-02-22 20:31:42 +01:00
parent 3753ec5647
commit 94b5d9bfa1
7 changed files with 45 additions and 74 deletions

View File

@@ -1565,36 +1565,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 = baseTemplate;
for (uint8 diff = uint8(map->GetSpawnMode()); diff > 0;)
{
if (uint32 diffEntry = baseTemplate->DifficultyEntry[diff - 1])
if (CreatureTemplate const* diffTemplate = sObjectMgr->GetCreatureTemplate(diffEntry))
{
actTemplate = diffTemplate;
break;
}
if (diff >= RAID_DIFFICULTY_10MAN_HEROIC && map->IsRaid())
diff -= 2;
else
diff -= 1;
}
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);