diff --git a/doc/EventAI.txt b/doc/EventAI.txt index 0db39cdb8..c2358897b 100644 --- a/doc/EventAI.txt +++ b/doc/EventAI.txt @@ -88,6 +88,7 @@ Some events such as EVENT_T_AGGRO, EVENT_T_DEATH, EVENT_T_SPAWNED, and EVENT_T_E 25 EVENT_T_SUMMONED_JUST_DIED CreatureId, RepeatMin, RepeatMax Expires after creature with entry = (Param1) is die (Param1 = 0 means all spawns). Will repeat every (Param2) and (Param3). 26 EVENT_T_SUMMONED_JUST_DESPAWN CreatureId, RepeatMin, RepeatMax Expires before creature with entry = (Param1) is despawn (Param1 = 0 means all spawns). Will repeat every (Param2) and (Param3). 27 EVENT_T_MISSING_BUFF SpellID, AmmountInStack, RepeatMin, RepeatMax Expires when a creature not has spell (Param1) auras applied in a stack greater or equal to value provided in (Param2). Will repeat every (Param3) and (Param4). +28 EVENT_T_TARGET_MISSING_BUFF SpellID, AmmountInStack, RepeatMin, RepeatMax Expires when a target unit not has spell (Param1) auras applied in a stack greater or equal to value provided in (Param2). Will repeat every (Param3) and (Param4). ========================================= diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 8dc50d8b4..036aff3d6 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -344,6 +344,20 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax); break; } + case EVENT_T_TARGET_MISSING_BUFF: + { + //Prevent event from occuring on no unit + if (!pActionInvoker) + return false; + + SpellAuraHolder* holder = pActionInvoker->GetSpellAuraHolder(event.buffed.spellId); + if (holder && holder->GetStackAmount() >= event.buffed.amount) + return false; + + //Repeat Timers + pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax); + break; + } default: sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type); break; diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h index 77aa11cb7..7b55fe820 100644 --- a/src/game/CreatureEventAI.h +++ b/src/game/CreatureEventAI.h @@ -61,6 +61,7 @@ enum EventAI_Type EVENT_T_SUMMONED_JUST_DIED = 25, // CreatureId, RepeatMin, RepeatMax EVENT_T_SUMMONED_JUST_DESPAWN = 26, // CreatureId, RepeatMin, RepeatMax EVENT_T_MISSING_BUFF = 27, // Param1 = SpellID, Param2 = Number of time stacked expected, Param3/4 Repeat Min/Max + EVENT_T_TARGET_MISSING_BUFF = 28, // Param1 = SpellID, Param2 = Number of time stacked expected, Param3/4 Repeat Min/Max EVENT_T_END, }; @@ -521,6 +522,7 @@ struct CreatureEventAI_Event // EVENT_T_BUFFED = 23 // EVENT_T_TARGET_BUFFED = 24 // EVENT_T_MISSING_BUFF = 27 + // EVENT_T_TARGET_MISSING_BUFF = 28 struct { uint32 spellId; diff --git a/src/game/CreatureEventAIMgr.cpp b/src/game/CreatureEventAIMgr.cpp index 574c37364..0381052a0 100644 --- a/src/game/CreatureEventAIMgr.cpp +++ b/src/game/CreatureEventAIMgr.cpp @@ -463,6 +463,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case EVENT_T_BUFFED: case EVENT_T_TARGET_BUFFED: case EVENT_T_MISSING_BUFF: + case EVENT_T_TARGET_MISSING_BUFF: { SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.buffed.spellId); if (!pSpell) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 73e8c39e4..92cc1c954 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10492" + #define REVISION_NR "10493" #endif // __REVISION_NR_H__