mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Dynamic Creature/Go spawning:
- True blizzlike creature spawn/respawn behavior - new creature = new object
- Toggleable spawn groups (with C++/SAI/command options to use them)
- Custom feature: dynamic spawn rate scaling. Accelerates respawn rate based on players in the zone.
- Backward compatibility mode (set via group and for summons)
to support creatures/gos that currently don't work well with this
(this should be removed once the exceptions are fixed)
Fixes and closes #2858
Tags #8661 as fixable.
Fixes and closes #13787
Fixes #15222.
(cherry picked from commit 59db2eeea0)
This commit is contained in:
@@ -1600,16 +1600,40 @@ bool ScriptMgr::OnCastItemCombatSpell(Player* player, Unit* victim, SpellInfo co
|
||||
return tmpscript->OnCastItemCombatSpell(player, victim, spellInfo, item);
|
||||
}
|
||||
|
||||
bool ScriptMgr::CanSpawn(ObjectGuid::LowType spawnId, uint32 entry, CreatureTemplate const* actTemplate, CreatureData const* cData, Map const* map)
|
||||
bool ScriptMgr::CanSpawn(ObjectGuid::LowType spawnId, uint32 entry, CreatureData const* cData, Map const* map)
|
||||
{
|
||||
ASSERT(actTemplate);
|
||||
|
||||
ASSERT(map);
|
||||
CreatureTemplate const* baseTemplate = sObjectMgr->GetCreatureTemplate(entry);
|
||||
if (!baseTemplate)
|
||||
baseTemplate = actTemplate;
|
||||
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;
|
||||
if (cData && cData->scriptId)
|
||||
scriptId = cData->scriptId;
|
||||
|
||||
GET_SCRIPT_RET(CreatureScript, scriptId, tmpscript, true);
|
||||
return tmpscript->CanSpawn(spawnId, entry, baseTemplate, actTemplate, cData, map);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user