From 5c80f5073493a3d31fd4b463891727beb6fe7eb1 Mon Sep 17 00:00:00 2001 From: Treeston Date: Thu, 22 Feb 2018 20:31:42 +0100 Subject: 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 94b5d9bfa1195ad7c32cf51a665b55514dac0938) --- src/server/game/Scripting/ScriptMgr.cpp | 38 --------------------------------- 1 file changed, 38 deletions(-) (limited to 'src/server/game/Scripting/ScriptMgr.cpp') diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index de42459a367..8df91f40ff5 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -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); -- cgit v1.2.3