mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-16 16:56:07 +00:00
feat(Core/Conditions): Implement CONDITION_TYPE_CREATURE_RESPAWN (#9927)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1640860713284766500');
|
||||
|
||||
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 29 AND `SourceEntry` = 12101;
|
||||
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
|
||||
(29, 0, 12101, 0, 0, 13, 0, 2, 3, 3, 1, 0, 0, '', 'Lava Surger only spawn if boss state 3 (Garr) is not DONE.');
|
||||
@@ -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