[10510] Reimplement aura stack checking EventAI events.

* In consistent with other EVENT_T_TARGET_* apply event
  to current combat target.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
kamikazetg 2010-09-20 13:26:43 +04:00 committed by VladimirMangos
parent 47397ff19b
commit 1544c97525
5 changed files with 29 additions and 31 deletions

View file

@ -83,12 +83,12 @@ Some events such as EVENT_T_AGGRO, EVENT_T_DEATH, EVENT_T_SPAWNED, and EVENT_T_E
18 EVENT_T_TARGET_MANA ManaMax%, ManaMin%, RepeatMin, RepeatMax Expires when current target's Mana is between (Param1) and (Param2). Will repeat every (Param3) and (Param4).
21 EVENT_T_REACHED_HOME NONE Expires when a creature reaches it's home (spawn) location after evade.
22 EVENT_T_RECEIVE_EMOTE EmoteId, Condition, CondValue1, CondValue2 Expires when a creature receives an emote with emote text id (enum TextEmotes) in (Param1). Conditions can be defined (Param2) with optional values (Param3,Param4), see enum ConditionType.
23 EVENT_T_BUFFED SpellID, AmmountInStack, RepeatMin, RepeatMax Expires when a creature has spell (Param1) auras applied in a stack greater or equal to value provided in (Param2). Will repeat every (Param3) and (Param4).
24 EVENT_T_TARGET_BUFFED SpellID, AmmountInStack, RepeatMin, RepeatMax (NOT WORK) Expires when a target unit has spell (Param1) auras applied in a stack greater or equal to value provided in (Param2). Will repeat every (Param3) and (Param4).
23 EVENT_T_AURA SpellID, AmmountInStack, RepeatMin, RepeatMax Expires when a creature has spell (Param1) auras applied in a stack greater or equal to value provided in (Param2). Will repeat every (Param3) and (Param4).
24 EVENT_T_TARGET_AURA SpellID, AmmountInStack, RepeatMin, RepeatMax Expires when the current target unit has spell (Param1) auras applied in a stack greater or equal to value provided in (Param2). Will repeat every (Param3) and (Param4).
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 (NOT WORK) 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).
27 EVENT_T_MISSING_AURA 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_AURA SpellID, AmmountInStack, RepeatMin, RepeatMax Expires when when the current 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).
=========================================

View file

@ -310,7 +310,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
case EVENT_T_REACHED_HOME:
case EVENT_T_RECEIVE_EMOTE:
break;
case EVENT_T_BUFFED:
case EVENT_T_AURA:
{
SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId);
if (!holder || holder->GetStackAmount() < event.buffed.amount)
@ -320,13 +320,12 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax);
break;
}
case EVENT_T_TARGET_BUFFED:
case EVENT_T_TARGET_AURA:
{
//Prevent event from occuring on no unit
if (!pActionInvoker)
if (!m_creature->isInCombat() || !m_creature->getVictim())
return false;
SpellAuraHolder* holder = pActionInvoker->GetSpellAuraHolder(event.buffed.spellId);
SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(event.buffed.spellId);
if(!holder || holder->GetStackAmount() < event.buffed.amount)
return false;
@ -334,7 +333,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax);
break;
}
case EVENT_T_MISSING_BUFF:
case EVENT_T_MISSING_AURA:
{
SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId);
if (holder && holder->GetStackAmount() >= event.buffed.amount)
@ -344,13 +343,12 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax);
break;
}
case EVENT_T_TARGET_MISSING_BUFF:
case EVENT_T_TARGET_MISSING_AURA:
{
//Prevent event from occuring on no unit
if (!pActionInvoker)
if (!m_creature->isInCombat() || !m_creature->getVictim())
return false;
SpellAuraHolder* holder = pActionInvoker->GetSpellAuraHolder(event.buffed.spellId);
SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(event.buffed.spellId);
if (holder && holder->GetStackAmount() >= event.buffed.amount)
return false;
@ -1172,10 +1170,10 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
case EVENT_T_TARGET_HP:
case EVENT_T_TARGET_CASTING:
case EVENT_T_FRIENDLY_HP:
case EVENT_T_BUFFED:
case EVENT_T_TARGET_BUFFED: //FIXME: not work in this way
case EVENT_T_MISSING_BUFF:
case EVENT_T_TARGET_MISSING_BUFF: //FIXME: not work in this way
case EVENT_T_AURA:
case EVENT_T_TARGET_AURA:
case EVENT_T_MISSING_AURA:
case EVENT_T_TARGET_MISSING_AURA:
if (Combat)
ProcessEvent(*i);
break;

View file

@ -56,12 +56,12 @@ enum EventAI_Type
EVENT_T_QUEST_COMPLETE = 20, //
EVENT_T_REACHED_HOME = 21, // NONE
EVENT_T_RECEIVE_EMOTE = 22, // EmoteId, Condition, CondValue1, CondValue2
EVENT_T_BUFFED = 23, // Param1 = SpellID, Param2 = Number of time stacked, Param3/4 Repeat Min/Max
EVENT_T_TARGET_BUFFED = 24, // (NOT WORK) Param1 = SpellID, Param2 = Number of time stacked, Param3/4 Repeat Min/Max
EVENT_T_AURA = 23, // Param1 = SpellID, Param2 = Number of time stacked, Param3/4 Repeat Min/Max
EVENT_T_TARGET_AURA = 24, // Param1 = SpellID, Param2 = Number of time stacked, Param3/4 Repeat Min/Max
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, // (NOT WORK) Param1 = SpellID, Param2 = Number of time stacked expected, Param3/4 Repeat Min/Max
EVENT_T_MISSING_AURA = 27, // Param1 = SpellID, Param2 = Number of time stacked expected, Param3/4 Repeat Min/Max
EVENT_T_TARGET_MISSING_AURA = 28, // Param1 = SpellID, Param2 = Number of time stacked expected, Param3/4 Repeat Min/Max
EVENT_T_END,
};
@ -519,10 +519,10 @@ struct CreatureEventAI_Event
uint32 conditionValue1;
uint32 conditionValue2;
} receive_emote;
// EVENT_T_BUFFED = 23
// EVENT_T_TARGET_BUFFED = 24
// EVENT_T_MISSING_BUFF = 27
// EVENT_T_TARGET_MISSING_BUFF = 28
// EVENT_T_AURA = 23
// EVENT_T_TARGET_AURA = 24
// EVENT_T_MISSING_AURA = 27
// EVENT_T_TARGET_MISSING_AURA = 28
struct
{
uint32 spellId;

View file

@ -460,10 +460,10 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
}
case EVENT_T_BUFFED:
case EVENT_T_TARGET_BUFFED:
case EVENT_T_MISSING_BUFF:
case EVENT_T_TARGET_MISSING_BUFF:
case EVENT_T_AURA:
case EVENT_T_TARGET_AURA:
case EVENT_T_MISSING_AURA:
case EVENT_T_TARGET_MISSING_AURA:
{
SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.buffed.spellId);
if (!pSpell)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10509"
#define REVISION_NR "10510"
#endif // __REVISION_NR_H__