OregonCore  revision 3611e8a-git
Your Favourite TBC server
CreatureEventAI.h File Reference
#include "Common.h"
#include "Creature.h"
#include "CreatureAI.h"
#include "Unit.h"

Go to the source code of this file.

Classes

struct  StringTextData
 
struct  CreatureEventAI_Action
 
struct  CreatureEventAI_Event
 
struct  CreatureEventAI_Summon
 
struct  CreatureEventAIHolder
 
class  CreatureEventAI
 

Macros

#define EVENT_UPDATE_TIME   500
 
#define MAX_ACTIONS   3
 
#define MAX_PHASE   32
 

Typedefs

typedef UNORDERED_MAP< int32, StringTextDataCreatureEventAI_TextMap
 
typedef UNORDERED_MAP< uint32, std::vector< CreatureEventAI_Event > > CreatureEventAI_Event_Map
 
typedef UNORDERED_MAP< uint32, CreatureEventAI_SummonCreatureEventAI_Summon_Map
 

Enumerations

enum  EventAI_Type {
  EVENT_T_TIMER = 0, EVENT_T_TIMER_OOC = 1, EVENT_T_HP = 2, EVENT_T_MANA = 3,
  EVENT_T_AGGRO = 4, EVENT_T_KILL = 5, EVENT_T_DEATH = 6, EVENT_T_EVADE = 7,
  EVENT_T_SPELLHIT = 8, EVENT_T_RANGE = 9, EVENT_T_OOC_LOS = 10, EVENT_T_SPAWNED = 11,
  EVENT_T_TARGET_HP = 12, EVENT_T_TARGET_CASTING = 13, EVENT_T_FRIENDLY_HP = 14, EVENT_T_FRIENDLY_IS_CC = 15,
  EVENT_T_FRIENDLY_MISSING_BUFF = 16, EVENT_T_SUMMONED_UNIT = 17, EVENT_T_TARGET_MANA = 18, EVENT_T_QUEST_ACCEPT = 19,
  EVENT_T_QUEST_COMPLETE = 20, EVENT_T_REACHED_HOME = 21, EVENT_T_RECEIVE_EMOTE = 22, EVENT_T_BUFFED = 23,
  EVENT_T_TARGET_BUFFED = 24, EVENT_T_SUMMONED_JUST_DIED = 25, EVENT_T_SUMMONED_JUST_DESPAWN = 26, EVENT_T_MISSING_AURA = 27,
  EVENT_T_TARGET_MISSING_AURA = 28, EVENT_T_END
}
 
enum  EventAI_ActionType {
  ACTION_T_NONE = 0, ACTION_T_TEXT = 1, ACTION_T_SET_FACTION = 2, ACTION_T_MORPH_TO_ENTRY_OR_MODEL = 3,
  ACTION_T_SOUND = 4, ACTION_T_EMOTE = 5, ACTION_T_RANDOM_SAY = 6, ACTION_T_RANDOM_YELL = 7,
  ACTION_T_RANDOM_TEXTEMOTE = 8, ACTION_T_RANDOM_SOUND = 9, ACTION_T_RANDOM_EMOTE = 10, ACTION_T_CAST = 11,
  ACTION_T_SUMMON = 12, ACTION_T_THREAT_SINGLE_PCT = 13, ACTION_T_THREAT_ALL_PCT = 14, ACTION_T_QUEST_EVENT = 15,
  ACTION_T_CAST_EVENT = 16, ACTION_T_SET_UNIT_FIELD = 17, ACTION_T_SET_UNIT_FLAG = 18, ACTION_T_REMOVE_UNIT_FLAG = 19,
  ACTION_T_AUTO_ATTACK = 20, ACTION_T_COMBAT_MOVEMENT = 21, ACTION_T_SET_PHASE = 22, ACTION_T_INC_PHASE = 23,
  ACTION_T_EVADE = 24, ACTION_T_FLEE_FOR_ASSIST = 25, ACTION_T_QUEST_EVENT_ALL = 26, ACTION_T_CAST_EVENT_ALL = 27,
  ACTION_T_REMOVEAURASFROMSPELL = 28, ACTION_T_RANGED_MOVEMENT = 29, ACTION_T_RANDOM_PHASE = 30, ACTION_T_RANDOM_PHASE_RANGE = 31,
  ACTION_T_SUMMON_ID = 32, ACTION_T_KILLED_MONSTER = 33, ACTION_T_SET_INST_DATA = 34, ACTION_T_SET_INST_DATA64 = 35,
  ACTION_T_UPDATE_TEMPLATE = 36, ACTION_T_DIE = 37, ACTION_T_ZONE_COMBAT_PULSE = 38, ACTION_T_CALL_FOR_HELP = 39,
  ACTION_T_SET_SHEATH = 40, ACTION_T_FORCE_DESPAWN = 41, ACTION_T_SET_INVINCIBILITY_HP_LEVEL = 42, ACTION_T_MOUNT_TO_ENTRY_OR_MODEL = 43,
  ACTION_T_CHANCED_TEXT = 44, ACTION_T_SET_AGGRESSIVE = 102, ACTION_T_ATTACK_START_PULSE = 103, ACTION_T_SUMMON_GO = 104,
  ACTION_T_END = 105
}
 
enum  Target {
  TARGET_T_SELF = 0, TARGET_T_HOSTILE, TARGET_T_HOSTILE_SECOND_AGGRO, TARGET_T_HOSTILE_LAST_AGGRO,
  TARGET_T_HOSTILE_RANDOM, TARGET_T_HOSTILE_RANDOM_NOT_TOP, TARGET_T_ACTION_INVOKER, TARGET_T_HOSTILE_WPET,
  TARGET_T_HOSTILE_WPET_SECOND_AGGRO, TARGET_T_HOSTILE_WPET_LAST_AGGRO, TARGET_T_HOSTILE_WPET_RANDOM, TARGET_T_HOSTILE_WPET_RANDOM_NOT_TOP,
  TARGET_T_ACTION_INVOKER_WPET, TARGET_T_END
}
 
enum  CastFlags {
  CAST_INTURRUPT_PREVIOUS = 0x01, CAST_TRIGGERED = 0x02, CAST_FORCE_CAST = 0x04, CAST_NO_MELEE_IF_OOM = 0x08,
  CAST_FORCE_TARGET_SELF = 0x10, CAST_AURA_NOT_PRESENT = 0x20
}
 
enum  EventFlags {
  EFLAG_REPEATABLE = 0x01, EFLAG_NORMAL = 0x02, EFLAG_HEROIC = 0x04, EFLAG_RESERVED_3 = 0x08,
  EFLAG_RESERVED_4 = 0x10, EFLAG_RESERVED_5 = 0x20, EFLAG_RESERVED_6 = 0x40, EFLAG_DEBUG_ONLY = 0x80
}
 
enum  SpawnedEventMode { SPAWNED_EVENT_ALWAY = 0, SPAWNED_EVENT_MAP = 1, SPAWNED_EVENT_ZONE = 2 }
 

Macro Definition Documentation

#define EVENT_UPDATE_TIME   500
#define MAX_PHASE   32

Typedef Documentation

Definition at line 557 of file CreatureEventAI.h.

Enumeration Type Documentation

enum CastFlags
Enumerator
CAST_INTURRUPT_PREVIOUS 
CAST_TRIGGERED 
CAST_FORCE_CAST 
CAST_NO_MELEE_IF_OOM 
CAST_FORCE_TARGET_SELF 
CAST_AURA_NOT_PRESENT 

Definition at line 150 of file CreatureEventAI.h.

151 {
152  CAST_INTURRUPT_PREVIOUS = 0x01, //Interrupt any spell casting
153  CAST_TRIGGERED = 0x02, //Triggered (this makes spell cost zero mana and have no cast time)
154  CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
155  CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
156  CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself
157  CAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell
158 };
Enumerator
ACTION_T_NONE 
ACTION_T_TEXT 
ACTION_T_SET_FACTION 
ACTION_T_MORPH_TO_ENTRY_OR_MODEL 
ACTION_T_SOUND 
ACTION_T_EMOTE 
ACTION_T_RANDOM_SAY 
ACTION_T_RANDOM_YELL 
ACTION_T_RANDOM_TEXTEMOTE 
ACTION_T_RANDOM_SOUND 
ACTION_T_RANDOM_EMOTE 
ACTION_T_CAST 
ACTION_T_SUMMON 
ACTION_T_THREAT_SINGLE_PCT 
ACTION_T_THREAT_ALL_PCT 
ACTION_T_QUEST_EVENT 
ACTION_T_CAST_EVENT 
ACTION_T_SET_UNIT_FIELD 
ACTION_T_SET_UNIT_FLAG 
ACTION_T_REMOVE_UNIT_FLAG 
ACTION_T_AUTO_ATTACK 
ACTION_T_COMBAT_MOVEMENT 
ACTION_T_SET_PHASE 
ACTION_T_INC_PHASE 
ACTION_T_EVADE 
ACTION_T_FLEE_FOR_ASSIST 
ACTION_T_QUEST_EVENT_ALL 
ACTION_T_CAST_EVENT_ALL 
ACTION_T_REMOVEAURASFROMSPELL 
ACTION_T_RANGED_MOVEMENT 
ACTION_T_RANDOM_PHASE 
ACTION_T_RANDOM_PHASE_RANGE 
ACTION_T_SUMMON_ID 
ACTION_T_KILLED_MONSTER 
ACTION_T_SET_INST_DATA 
ACTION_T_SET_INST_DATA64 
ACTION_T_UPDATE_TEMPLATE 
ACTION_T_DIE 
ACTION_T_ZONE_COMBAT_PULSE 
ACTION_T_CALL_FOR_HELP 
ACTION_T_SET_SHEATH 
ACTION_T_FORCE_DESPAWN 
ACTION_T_SET_INVINCIBILITY_HP_LEVEL 
ACTION_T_MOUNT_TO_ENTRY_OR_MODEL 
ACTION_T_CHANCED_TEXT 
ACTION_T_SET_AGGRESSIVE 
ACTION_T_ATTACK_START_PULSE 
ACTION_T_SUMMON_GO 
ACTION_T_END 

Definition at line 68 of file CreatureEventAI.h.

69 {
70  ACTION_T_NONE = 0, // No action
71  ACTION_T_TEXT = 1, // TextId1, optionally -TextId2, optionally -TextId3(if -TextId2 exist). If more than just -TextId1 is defined, randomize. Negative values.
72  ACTION_T_SET_FACTION = 2, // FactionId (or 0 for default)
73  ACTION_T_MORPH_TO_ENTRY_OR_MODEL = 3, // Creature_template entry(param1) OR ModelId (param2) (or 0 for both to demorph)
74  ACTION_T_SOUND = 4, // SoundId
75  ACTION_T_EMOTE = 5, // EmoteId
76  ACTION_T_RANDOM_SAY = 6, // UNUSED
77  ACTION_T_RANDOM_YELL = 7, // UNUSED
78  ACTION_T_RANDOM_TEXTEMOTE = 8, // UNUSED
79  ACTION_T_RANDOM_SOUND = 9, // SoundId1, SoundId2, SoundId3 (-1 in any field means no output if randomed that field)
80  ACTION_T_RANDOM_EMOTE = 10, // EmoteId1, EmoteId2, EmoteId3 (-1 in any field means no output if randomed that field)
81  ACTION_T_CAST = 11, // SpellId, Target, CastFlags
82  ACTION_T_SUMMON = 12, // CreatureID, Target, Duration in ms
83  ACTION_T_THREAT_SINGLE_PCT = 13, // Threat%, Target
84  ACTION_T_THREAT_ALL_PCT = 14, // Threat%
85  ACTION_T_QUEST_EVENT = 15, // QuestID, Target
86  ACTION_T_CAST_EVENT = 16, // QuestID, SpellId, Target - must be removed as hack?
87  ACTION_T_SET_UNIT_FIELD = 17, // Field_Number, Value, Target
88  ACTION_T_SET_UNIT_FLAG = 18, // Flags (may be more than one field OR'd together), Target
89  ACTION_T_REMOVE_UNIT_FLAG = 19, // Flags (may be more than one field OR'd together), Target
90  ACTION_T_AUTO_ATTACK = 20, // AllowAttackState (0 = stop attack, anything else means continue attacking)
91  ACTION_T_COMBAT_MOVEMENT = 21, // AllowCombatMovement (0 = stop combat based movement, anything else continue attacking)
92  ACTION_T_SET_PHASE = 22, // Phase
93  ACTION_T_INC_PHASE = 23, // Value (may be negative to decrement phase, should not be 0)
94  ACTION_T_EVADE = 24, // No Params
95  ACTION_T_FLEE_FOR_ASSIST = 25, // No Params
96  ACTION_T_QUEST_EVENT_ALL = 26, // QuestID
97  ACTION_T_CAST_EVENT_ALL = 27, // CreatureId, SpellId
98  ACTION_T_REMOVEAURASFROMSPELL = 28, // Target, Spellid
99  ACTION_T_RANGED_MOVEMENT = 29, // Distance, Angle
100  ACTION_T_RANDOM_PHASE = 30, // PhaseId1, PhaseId2, PhaseId3
101  ACTION_T_RANDOM_PHASE_RANGE = 31, // PhaseMin, PhaseMax
102  ACTION_T_SUMMON_ID = 32, // CreatureId, Target, SpawnId
103  ACTION_T_KILLED_MONSTER = 33, // CreatureId, Target
104  ACTION_T_SET_INST_DATA = 34, // Field, Data
105  ACTION_T_SET_INST_DATA64 = 35, // Field, Target
106  ACTION_T_UPDATE_TEMPLATE = 36, // Entry, Team
107  ACTION_T_DIE = 37, // No Params
108  ACTION_T_ZONE_COMBAT_PULSE = 38, // No Params
109  ACTION_T_CALL_FOR_HELP = 39, // Radius
110  ACTION_T_SET_SHEATH = 40, // Sheath (0-passive,1-melee,2-ranged)
111  ACTION_T_FORCE_DESPAWN = 41, // No Params
112  ACTION_T_SET_INVINCIBILITY_HP_LEVEL = 42, // MinHpValue, format(0-flat,1-percent from max health)
113  ACTION_T_MOUNT_TO_ENTRY_OR_MODEL = 43, // Creature_template entry(param1) OR ModelId (param2) (or 0 for both to unmount)
114  ACTION_T_CHANCED_TEXT = 44, // Chance to display the text, TextId1, optionally TextId2. If more than just -TextId1 is defined, randomize. Negative values.
115 
116  ACTION_T_SET_AGGRESSIVE = 102, //Apply
117  ACTION_T_ATTACK_START_PULSE = 103, //Distance
118  ACTION_T_SUMMON_GO = 104, //GameObjectID, DespawnTime in ms
119 
120  ACTION_T_END = 105,
121 };
Enumerator
EVENT_T_TIMER 
EVENT_T_TIMER_OOC 
EVENT_T_HP 
EVENT_T_MANA 
EVENT_T_AGGRO 
EVENT_T_KILL 
EVENT_T_DEATH 
EVENT_T_EVADE 
EVENT_T_SPELLHIT 
EVENT_T_RANGE 
EVENT_T_OOC_LOS 
EVENT_T_SPAWNED 
EVENT_T_TARGET_HP 
EVENT_T_TARGET_CASTING 
EVENT_T_FRIENDLY_HP 
EVENT_T_FRIENDLY_IS_CC 
EVENT_T_FRIENDLY_MISSING_BUFF 
EVENT_T_SUMMONED_UNIT 
EVENT_T_TARGET_MANA 
EVENT_T_QUEST_ACCEPT 
EVENT_T_QUEST_COMPLETE 
EVENT_T_REACHED_HOME 
EVENT_T_RECEIVE_EMOTE 
EVENT_T_BUFFED 
EVENT_T_TARGET_BUFFED 
EVENT_T_SUMMONED_JUST_DIED 
EVENT_T_SUMMONED_JUST_DESPAWN 
EVENT_T_MISSING_AURA 
EVENT_T_TARGET_MISSING_AURA 
EVENT_T_END 

Definition at line 33 of file CreatureEventAI.h.

34 {
35  EVENT_T_TIMER = 0, // InitialMin, InitialMax, RepeatMin, RepeatMax
36  EVENT_T_TIMER_OOC = 1, // InitialMin, InitialMax, RepeatMin, RepeatMax
37  EVENT_T_HP = 2, // HPMax%, HPMin%, RepeatMin, RepeatMax
38  EVENT_T_MANA = 3, // ManaMax%,ManaMin% RepeatMin, RepeatMax
39  EVENT_T_AGGRO = 4, // NONE
40  EVENT_T_KILL = 5, // RepeatMin, RepeatMax
41  EVENT_T_DEATH = 6, // NONE
42  EVENT_T_EVADE = 7, // NONE
43  EVENT_T_SPELLHIT = 8, // SpellID, School, RepeatMin, RepeatMax
44  EVENT_T_RANGE = 9, // MinDist, MaxDist, RepeatMin, RepeatMax
45  EVENT_T_OOC_LOS = 10, // NoHostile, MaxRnage, RepeatMin, RepeatMax
46  EVENT_T_SPAWNED = 11, // Condition, CondValue1
47  EVENT_T_TARGET_HP = 12, // HPMax%, HPMin%, RepeatMin, RepeatMax
48  EVENT_T_TARGET_CASTING = 13, // RepeatMin, RepeatMax
49  EVENT_T_FRIENDLY_HP = 14, // HPDeficit, Radius, RepeatMin, RepeatMax
50  EVENT_T_FRIENDLY_IS_CC = 15, // DispelType, Radius, RepeatMin, RepeatMax
51  EVENT_T_FRIENDLY_MISSING_BUFF = 16, // SpellId, Radius, RepeatMin, RepeatMax
52  EVENT_T_SUMMONED_UNIT = 17, // CreatureId, RepeatMin, RepeatMax
53  EVENT_T_TARGET_MANA = 18, // ManaMax%, ManaMin%, RepeatMin, RepeatMax
54  EVENT_T_QUEST_ACCEPT = 19, // QuestID
55  EVENT_T_QUEST_COMPLETE = 20, //
56  EVENT_T_REACHED_HOME = 21, // NONE
57  EVENT_T_RECEIVE_EMOTE = 22, // EmoteId, Condition, CondValue1, CondValue2
58  EVENT_T_BUFFED = 23, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 Repeat Min/Max
59  EVENT_T_TARGET_BUFFED = 24, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 Repeat Min/Max
60  EVENT_T_SUMMONED_JUST_DIED = 25, // CreatureId, RepeatMin, RepeatMax
61  EVENT_T_SUMMONED_JUST_DESPAWN = 26, // CreatureId, RepeatMin, RepeatMax
62  EVENT_T_MISSING_AURA = 27, // Param1 = SpellID, Param2 = Number of time stacked expected, Param3/4 Repeat Min/Max
63  EVENT_T_TARGET_MISSING_AURA = 28, // Param1 = SpellID, Param2 = Number of time stacked expected, Param3/4 Repeat Min/Max
64 
66 };
enum EventFlags
Enumerator
EFLAG_REPEATABLE 
EFLAG_NORMAL 
EFLAG_HEROIC 
EFLAG_RESERVED_3 
EFLAG_RESERVED_4 
EFLAG_RESERVED_5 
EFLAG_RESERVED_6 
EFLAG_DEBUG_ONLY 

Definition at line 160 of file CreatureEventAI.h.

161 {
162  EFLAG_REPEATABLE = 0x01, //Event repeats
163  EFLAG_NORMAL = 0x02, //Event only occurs in Normal instance difficulty
164  EFLAG_HEROIC = 0x04, //Event only occurs in Heroic instance difficulty
165  EFLAG_RESERVED_3 = 0x08,
166  EFLAG_RESERVED_4 = 0x10,
167  EFLAG_RESERVED_5 = 0x20,
168  EFLAG_RESERVED_6 = 0x40,
169  EFLAG_DEBUG_ONLY = 0x80, //Event only occurs in debug build
170 };
Enumerator
SPAWNED_EVENT_ALWAY 
SPAWNED_EVENT_MAP 
SPAWNED_EVENT_ZONE 

Definition at line 172 of file CreatureEventAI.h.

enum Target
Enumerator
TARGET_T_SELF 
TARGET_T_HOSTILE 
TARGET_T_HOSTILE_SECOND_AGGRO 
TARGET_T_HOSTILE_LAST_AGGRO 
TARGET_T_HOSTILE_RANDOM 
TARGET_T_HOSTILE_RANDOM_NOT_TOP 
TARGET_T_ACTION_INVOKER 
TARGET_T_HOSTILE_WPET 
TARGET_T_HOSTILE_WPET_SECOND_AGGRO 
TARGET_T_HOSTILE_WPET_LAST_AGGRO 
TARGET_T_HOSTILE_WPET_RANDOM 
TARGET_T_HOSTILE_WPET_RANDOM_NOT_TOP 
TARGET_T_ACTION_INVOKER_WPET 
TARGET_T_END 

Definition at line 123 of file CreatureEventAI.h.

124 {
125  //Self (me)
126  TARGET_T_SELF = 0, //Self cast
127 
128  //Hostile targets (if pet then returns pet owner)
129  TARGET_T_HOSTILE, //Our current target (ie: highest aggro)
130  TARGET_T_HOSTILE_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks)
131  TARGET_T_HOSTILE_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for)
132  TARGET_T_HOSTILE_RANDOM, //Just any random target on our threat list
133  TARGET_T_HOSTILE_RANDOM_NOT_TOP, //Any random target except top threat
134 
135  //Invoker targets (if pet then returns pet owner)
136  TARGET_T_ACTION_INVOKER, //Unit who caused this Event to occur (only works for EVENT_T_AGGRO, EVENT_T_KILL, EVENT_T_DEATH, EVENT_T_SPELLHIT, EVENT_T_OOC_LOS, EVENT_T_FRIENDLY_HP, EVENT_T_FRIENDLY_IS_CC, EVENT_T_FRIENDLY_MISSING_BUFF)
137 
138  //Hostile targets (including pets)
139  TARGET_T_HOSTILE_WPET, //Current target (can be a pet)
140  TARGET_T_HOSTILE_WPET_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks)
141  TARGET_T_HOSTILE_WPET_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for)
142  TARGET_T_HOSTILE_WPET_RANDOM, //Just any random target on our threat list
143  TARGET_T_HOSTILE_WPET_RANDOM_NOT_TOP, //Any random target except top threat
144 
146 
148 };