aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/CreatureEventAI.cpp33
-rw-r--r--src/game/CreatureEventAI.h11
-rw-r--r--src/game/CreatureEventAIMgr.cpp14
3 files changed, 57 insertions, 1 deletions
diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp
index 000d59fac28..3d83b2c4fb4 100644
--- a/src/game/CreatureEventAI.cpp
+++ b/src/game/CreatureEventAI.cpp
@@ -275,8 +275,8 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.summon_unit.repeatMin,event.summon_unit.repeatMax);
+ break;
}
- break;
case EVENT_T_TARGET_MANA:
{
if (!m_creature->isInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->GetMaxPower(POWER_MANA))
@@ -294,6 +294,34 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
case EVENT_T_REACHED_HOME:
case EVENT_T_RECEIVE_EMOTE:
break;
+ case EVENT_T_BUFFED:
+ {
+ //Note: checked only aura for effect 0, if need check aura for effect 1/2 then
+ // possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx)
+ Aura* aura = m_creature->GetAura(event.buffed.spellId,0);
+ if(!aura || aura->GetStackAmount() < event.buffed.amount)
+ return false;
+
+ //Repeat Timers
+ pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax);
+ break;
+ }
+ case EVENT_T_TARGET_BUFFED:
+ {
+ //Prevent event from occuring on no unit
+ if (!pActionInvoker)
+ return false;
+
+ //Note: checked only aura for effect 0, if need check aura for effect 1/2 then
+ // possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx)
+ Aura* aura = pActionInvoker->GetAura(event.buffed.spellId,0);
+ if(!aura || aura->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;
@@ -853,6 +881,9 @@ void CreatureEventAI::JustDied(Unit* killer)
if ((*i).Event.event_type == EVENT_T_DEATH)
ProcessEvent(*i, killer);
}
+
+ // reset phase after any death state events
+ Phase = 0;
}
void CreatureEventAI::KilledUnit(Unit* victim)
diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h
index d94ceeeac18..db9cb680670 100644
--- a/src/game/CreatureEventAI.h
+++ b/src/game/CreatureEventAI.h
@@ -56,6 +56,8 @@ 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_END,
};
@@ -507,6 +509,15 @@ struct CreatureEventAI_Event
uint32 conditionValue1;
uint32 conditionValue2;
} receive_emote;
+ // EVENT_T_BUFFED = 23
+ // EVENT_T_TARGET_BUFFED = 24
+ struct
+ {
+ uint32 spellId;
+ uint32 amount;
+ uint32 repeatMin;
+ uint32 repeatMax;
+ } buffed;
// RAW
struct
diff --git a/src/game/CreatureEventAIMgr.cpp b/src/game/CreatureEventAIMgr.cpp
index 0a6fb8bdb59..643a5a3212a 100644
--- a/src/game/CreatureEventAIMgr.cpp
+++ b/src/game/CreatureEventAIMgr.cpp
@@ -378,6 +378,20 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
}
+ case EVENT_T_BUFFED:
+ case EVENT_T_TARGET_BUFFED:
+ {
+ SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.buffed.spellId);
+ if (!pSpell)
+ {
+ sLog.outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
+ continue;
+ }
+ if (temp.buffed.repeatMax < temp.buffed.repeatMin)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ break;
+ }
+
default:
sLog.outErrorDb("CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i);
break;