[10433] Implement EVENT_T_MISSING_BUFF for self buff check

Also added amount spell stack checks at loading
for EVENT_T_BUFFED and EVENT_T_TARGET_BUFFED.
This commit is contained in:
VladimirMangos 2010-09-02 05:43:20 +04:00
parent acd0716297
commit 8dfeb61200
5 changed files with 31 additions and 8 deletions

View file

@ -78,7 +78,7 @@ Some events such as EVENT_T_AGGRO, EVENT_T_DEATH, EVENT_T_SPAWNED, and EVENT_T_E
13 EVENT_T_TARGET_CASTING RepeatMin, RepeatatMax Expires when the current target is casting a spell. Will repeat every (Param1) and (Param2).
14 EVENT_T_FRIENDLY_HP HPDeficit, Radius, RepeatMin, RepeatMax Expires when a friendly unit in radius has at least (Param1) HP missing. Will repeat every (Param3) and (Param4).
15 EVENT_T_FRIENDLY_IS_CC DispelType, Radius, RepeatMin, RepeatMax Expires when a friendly unit is crowd controlled within the given radius (Param2). Will repeat every (Param3) and (Param4).
16 EVENT_T_MISSING_BUFF SpellId, Radius, RepeatMin, RepeatMax Expires when a friendly unit is missing aura(s) given by a spell (Param1) within radius (Param2). Will repeat every (Param3) and (Param4).
16 EVENT_T_FRIENDLY_MISSING_BUFF SpellId, Radius, RepeatMin, RepeatMax Expires when a friendly unit is missing aura(s) given by a spell (Param1) within radius (Param2). Will repeat every (Param3) and (Param4).
17 EVENT_T_SUMMONED_UNIT CreatureId, RepeatMin, RepeatMax Expires after creature with entry = (Param1) is spawned (Param1 = 0 means all spawns). Will repeat every (Param2) and (Param3).
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.
@ -87,6 +87,7 @@ Some events such as EVENT_T_AGGRO, EVENT_T_DEATH, EVENT_T_SPAWNED, and EVENT_T_E
24 EVENT_T_TARGET_BUFFED SpellID, AmmountInStack, RepeatMin, RepeatMax 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).
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).
=========================================

View file

@ -334,6 +334,16 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax);
break;
}
case EVENT_T_MISSING_BUFF:
{
SpellAuraHolder* holder = m_creature->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;

View file

@ -56,10 +56,11 @@ 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, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 Repeat Min/Max
EVENT_T_BUFFED = 23, // Param1 = SpellID, Param2 = Number of time stacked, Param3/4 Repeat Min/Max
EVENT_T_TARGET_BUFFED = 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_END,
};
@ -519,6 +520,7 @@ struct CreatureEventAI_Event
} receive_emote;
// EVENT_T_BUFFED = 23
// EVENT_T_TARGET_BUFFED = 24
// EVENT_T_MISSING_BUFF = 27
struct
{
uint32 spellId;
@ -526,7 +528,6 @@ struct CreatureEventAI_Event
uint32 repeatMin;
uint32 repeatMax;
} buffed;
// RAW
struct
{

View file

@ -385,10 +385,15 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
case EVENT_T_FRIENDLY_MISSING_BUFF:
{
SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.spell_hit.spellId);
SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.friendly_buff.spellId);
if (!pSpell)
{
sLog.outErrorDb("CreatureEventAI: Creature %u has nonexistent SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
sLog.outErrorDb("CreatureEventAI: Creature %u has nonexistent SpellID(%u) defined in event %u.", temp.creature_id, temp.friendly_buff.spellId, i);
continue;
}
if (temp.friendly_buff.radius <= 0)
{
sLog.outErrorDb("CreatureEventAI: Creature %u has wrong radius (%u) for EVENT_T_FRIENDLY_MISSING_BUFF defined in event %u.", temp.creature_id, temp.friendly_buff.radius, i);
continue;
}
if (temp.friendly_buff.repeatMax < temp.friendly_buff.repeatMin)
@ -457,11 +462,17 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case EVENT_T_BUFFED:
case EVENT_T_TARGET_BUFFED:
case EVENT_T_MISSING_BUFF:
{
SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.buffed.spellId);
if (!pSpell)
{
sLog.outErrorDb("CreatureEventAI: Creature %u has nonexistent SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
sLog.outErrorDb("CreatureEventAI: Creature %u has nonexistent SpellID(%u) defined in event %u.", temp.creature_id, temp.buffed.spellId, i);
continue;
}
if (temp.buffed.amount < 1)
{
sLog.outErrorDb("CreatureEventAI: Creature %u has wrong spell stack size (%u) defined in event %u.", temp.creature_id, temp.buffed.amount, i);
continue;
}
if (temp.buffed.repeatMax < temp.buffed.repeatMin)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10432"
#define REVISION_NR "10433"
#endif // __REVISION_NR_H__