mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 16:38:42 +01:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user