mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
feat(Core/Conditions): Implement CONDITION_TYPE_CREATURE_RESPAWN (#9927)
This commit is contained in:
@@ -148,7 +148,8 @@ enum ConditionSourceType
|
||||
CONDITION_SOURCE_TYPE_PHASE = 26, // don't use on 3.3.5a
|
||||
CONDITION_SOURCE_TYPE_GRAVEYARD = 27, // don't use on 3.3.5a
|
||||
CONDITION_SOURCE_TYPE_PLAYER_LOOT_TEMPLATE = 28,
|
||||
CONDITION_SOURCE_TYPE_MAX = 29 // placeholder
|
||||
CONDITION_SOURCE_TYPE_CREATURE_RESPAWN = 29,
|
||||
CONDITION_SOURCE_TYPE_MAX = 30 // placeholder
|
||||
};
|
||||
|
||||
enum RelationType
|
||||
|
||||
@@ -578,7 +578,17 @@ void Creature::Update(uint32 diff)
|
||||
time_t now = time(nullptr);
|
||||
if (m_respawnTime <= now)
|
||||
{
|
||||
bool allowed = !IsAIEnabled || AI()->CanRespawn(); // First check if there are any scripts that object to us respawning
|
||||
|
||||
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_RESPAWN, GetEntry());
|
||||
|
||||
if (!sConditionMgr->IsObjectMeetToConditions(this, conditions))
|
||||
{
|
||||
// Creature should not respawn, reset respawn timer. Conditions will be checked again the next time it tries to respawn.
|
||||
m_respawnTime = time(nullptr) + m_respawnDelay;
|
||||
break;
|
||||
}
|
||||
|
||||
bool allowed = !IsAIEnabled || AI()->CanRespawn(); // First check if there are any scripts that prevent us respawning
|
||||
if (!allowed) // Will be rechecked on next Update call
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user