TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
npc_barnes::npc_barnesAI Struct Reference

Public Member Functions

 npc_barnesAI (Creature *creature)
 
void Initialize ()
 
void Reset () override
 
void StartEvent ()
 
void EnterCombat (Unit *) override
 
void WaypointReached (uint32 waypointId) override
 
void Talk (uint32 count)
 
void PrepareEncounter ()
 
void UpdateAI (uint32 diff) override
 
- Public Member Functions inherited from npc_escortAI
 npc_escortAI (Creature *creature)
 
 ~npc_escortAI ()
 
void AttackStart (Unit *who) override
 
void MoveInLineOfSight (Unit *who) override
 
void JustDied (Unit *) override
 
void JustRespawned () override
 
void ReturnToLastPoint ()
 
void EnterEvadeMode (EvadeReason=EVADE_REASON_OTHER) override
 
virtual void UpdateEscortAI (uint32 diff)
 
void MovementInform (uint32, uint32) override
 
void AddWaypoint (uint32 id, float x, float y, float z, uint32 waitTime=0)
 
bool SetNextWaypoint (uint32 pointId, float x, float y, float z, float orientation)
 
bool SetNextWaypoint (uint32 pointId, bool setPosition=true, bool resetWaypointsOnFail=true)
 
bool GetWaypointPosition (uint32 pointId, float &x, float &y, float &z)
 
virtual void WaypointStart (uint32)
 
void Start (bool isActiveAttacker=true, bool run=false, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=NULL, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
 
void SetRun (bool on=true)
 
void SetEscortPaused (bool on)
 
bool HasEscortState (uint32 escortState)
 
virtual bool IsEscorted () const override
 
void SetMaxPlayerDistance (float newMax)
 
float GetMaxPlayerDistance () const
 
void SetDespawnAtEnd (bool despawn)
 
void SetDespawnAtFar (bool despawn)
 
bool GetAttack () const
 
void SetCanAttack (bool attack)
 
ObjectGuid GetEventStarterGUID () const
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
virtual ~ScriptedAI ()
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &) override
 
void KilledUnit (Unit *) override
 
void JustSummoned (Creature *) override
 
void SummonedCreatureDespawn (Creature *) override
 
void SpellHit (Unit *, SpellInfo const *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void OnPossess (bool)
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoCastSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
void DoPlaySoundToSet (WorldObject *source, uint32 soundId)
 
void DoResetThreat ()
 
float DoGetThreat (Unit *unit)
 
void DoModifyThreatPercent (Unit *unit, int32 pct)
 
void DoTeleportTo (float x, float y, float z, uint32 time=0)
 
void DoTeleportTo (float const pos[4])
 
void DoTeleportPlayer (Unit *unit, float x, float y, float z, float o)
 
void DoTeleportAll (float x, float y, float z, float o)
 
UnitDoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
PlayerGetPlayerAtMinimumRange (float minRange)
 
CreatureDoSpawnCreature (uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
 
bool HealthBelowPct (uint32 pct) const
 
bool HealthAbovePct (uint32 pct) const
 
SpellInfo constSelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, float rangeMin, float rangeMax, SelectEffect effect)
 
void SetEquipmentSlots (bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
 
void SetCombatMovement (bool allowMovement)
 
bool IsCombatMovementAllowed () const
 
bool IsHeroic () const
 
Difficulty GetDifficulty () const
 
bool Is25ManRaid () const
 
template<class T >
const T & DUNGEON_MODE (const T &normal5, const T &heroic10) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25, const T &heroic10, const T &heroic25) const
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr)
 
 CreatureAI (Creature *creature)
 
virtual ~CreatureAI ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At ================================= More...
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void IsSummonedBy (Unit *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void AttackedBy (Unit *)
 
void OnCharmed (bool apply) override
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ================== More...
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields ======================================= More...
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false) const
 
virtual bool CheckInRoom ()
 
CreatureBoundary constGetBoundary () const
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void InitializeAI ()
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectAggroTarget targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectAggroTarget targetType, float dist=0.0f, bool playerOnly=false, int32 aura=0)
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, PREDICATE const &predicate, uint32 maxTargets, SelectAggroTarget targetType)
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void HealDone (Unit *, uint32 &)
 
virtual void SpellInterrupted (uint32, uint32)
 
void AttackStartCaster (Unit *victim, float dist)
 
void DoCast (uint32 spellId)
 
void DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
void DoCastVictim (uint32 spellId, bool triggered=false)
 
void DoCastAOE (uint32 spellId, bool triggered=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spellId)
 
virtual void sGossipHello (Player *)
 
virtual void sGossipSelect (Player *, uint32, uint32)
 
virtual void sGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void sQuestAccept (Player *, Quest const *)
 
virtual void sQuestSelect (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual bool sOnDummyEffect (Unit *, uint32, SpellEffIndex)
 
virtual void sOnGameEvent (bool, uint16)
 

Public Attributes

InstanceScriptinstance
 
ObjectGuid m_uiSpotlightGUID
 
uint32 TalkCount
 
uint32 TalkTimer
 
uint32 WipeTimer
 
uint32 m_uiEventId
 
bool PerformanceReady
 
bool RaidWiped
 
- Public Attributes inherited from ScriptedAI
bool IsFleeing
 

Additional Inherited Members

- Public Types inherited from CreatureAI
enum  EvadeReason { EVADE_REASON_NO_HOSTILES, EVADE_REASON_BOUNDARY, EVADE_REASON_SEQUENCE_BREAK, EVADE_REASON_OTHER }
 
- Static Public Member Functions inherited from UnitAI
static void FillAISpellInfo ()
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- Protected Member Functions inherited from npc_escortAI
PlayerGetPlayerForEscort ()
 
- Protected Member Functions inherited from CreatureAI
bool UpdateVictim ()
 
bool UpdateVictimWithGaze ()
 
void SetGazeOn (Unit *target)
 
CreatureDoSummon (uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummonFlyer (uint32 entry, WorldObject *obj, float flightZ, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
bool CheckBoundary (Position const *who=nullptr) const
 
void SetBoundary (CreatureBoundary const *boundary)
 
bool _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
CreatureBoundary const_boundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Constructor & Destructor Documentation

npc_barnes::npc_barnesAI::npc_barnesAI ( Creature creature)
inline
131  : npc_escortAI(creature)
132  {
133  Initialize();
134  RaidWiped = false;
135  m_uiEventId = 0;
136  instance = creature->GetInstanceScript();
137  }
npc_escortAI(Creature *creature)
Definition: ScriptedEscortAI.cpp:37
uint32 m_uiEventId
Definition: karazhan.cpp:157
InstanceScript * GetInstanceScript()
Definition: Object.cpp:1540
InstanceScript * instance
Definition: karazhan.cpp:150
void Initialize()
Definition: karazhan.cpp:139
bool RaidWiped
Definition: karazhan.cpp:160

+ Here is the call graph for this function:

Member Function Documentation

void npc_barnes::npc_barnesAI::EnterCombat ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

180 { }
void npc_barnes::npc_barnesAI::Initialize ( void  )
inline
140  {
142 
143  TalkCount = 0;
144  TalkTimer = 2000;
145  WipeTimer = 5000;
146 
147  PerformanceReady = false;
148  }
uint32 TalkCount
Definition: karazhan.cpp:154
ObjectGuid m_uiSpotlightGUID
Definition: karazhan.cpp:152
void Clear()
Definition: ObjectGuid.h:215
uint32 WipeTimer
Definition: karazhan.cpp:156
bool PerformanceReady
Definition: karazhan.cpp:159
uint32 TalkTimer
Definition: karazhan.cpp:155

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_barnes::npc_barnesAI::PrepareEncounter ( )
inline
247  {
248  TC_LOG_DEBUG("scripts", "Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId);
249  uint8 index = 0;
250  uint8 count = 0;
251 
252  switch (m_uiEventId)
253  {
254  case EVENT_OZ:
255  index = 0;
256  count = 4;
257  break;
258  case EVENT_HOOD:
259  index = 4;
260  count = index+1;
261  break;
262  case EVENT_RAJ:
263  index = 5;
264  count = index+1;
265  break;
266  }
267 
268  for (; index < count; ++index)
269  {
270  uint32 entry = ((uint32)Spawns[index][0]);
271  float PosX = Spawns[index][1];
272 
274  {
275  // In case database has bad flags
276  creature->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
277  creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
278  }
279  }
280 
281  RaidWiped = false;
282  }
#define SPAWN_Z
Definition: karazhan.cpp:120
uint32 m_uiEventId
Definition: karazhan.cpp:157
Definition: Unit.h:674
Definition: Common.h:98
Definition: karazhan.h:62
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: Creature.h:467
Creature *const me
Definition: CreatureAI.h:71
#define SPAWN_O
Definition: karazhan.cpp:122
#define SPAWN_Y
Definition: karazhan.cpp:121
Definition: karazhan.h:63
uint32_t uint32
Definition: Define.h:150
Definition: UpdateFields.h:109
Definition: Common.h:103
Definition: karazhan.h:64
bool RaidWiped
Definition: karazhan.cpp:160
uint8_t uint8
Definition: Define.h:152
uint32_t uint32
Definition: g3dmath.h:168
Spawns
Definition: hyjalAI.cpp:36
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346
Definition: Object.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_barnes::npc_barnesAI::Reset ( )
inlineoverridevirtual

Reimplemented from ScriptedAI.

163  {
164  Initialize();
165 
167  }
uint32 m_uiEventId
Definition: karazhan.cpp:157
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:51
Definition: karazhan.h:39
InstanceScript * instance
Definition: karazhan.cpp:150
void Initialize()
Definition: karazhan.cpp:139

+ Here is the call graph for this function:

void npc_barnes::npc_barnesAI::StartEvent ( )
inline
170  {
172 
173  //resets count for this event, in case earlier failed
174  if (m_uiEventId == EVENT_OZ)
176 
177  Start(false, false);
178  }
uint32 m_uiEventId
Definition: karazhan.cpp:157
Definition: karazhan.h:30
void Start(bool isActiveAttacker=true, bool run=false, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=NULL, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
Definition: ScriptedEscortAI.cpp:438
Definition: karazhan.h:62
InstanceScript * instance
Definition: karazhan.cpp:150
Definition: InstanceScript.h:59
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:52
Definition: karazhan.h:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_barnes::npc_barnesAI::Talk ( uint32  count)
inline
215  {
216  int32 text = 0;
217 
218  switch (m_uiEventId)
219  {
220  case EVENT_OZ:
221  if (OzDialogue[count].textid)
222  text = OzDialogue[count].textid;
223  if (OzDialogue[count].timer)
224  TalkTimer = OzDialogue[count].timer;
225  break;
226 
227  case EVENT_HOOD:
228  if (HoodDialogue[count].textid)
229  text = HoodDialogue[count].textid;
230  if (HoodDialogue[count].timer)
231  TalkTimer = HoodDialogue[count].timer;
232  break;
233 
234  case EVENT_RAJ:
235  if (RAJDialogue[count].textid)
236  text = RAJDialogue[count].textid;
237  if (RAJDialogue[count].timer)
238  TalkTimer = RAJDialogue[count].timer;
239  break;
240  }
241 
242  if (text)
243  CreatureAI::Talk(text);
244  }
uint32 m_uiEventId
Definition: karazhan.cpp:157
Definition: karazhan.h:62
uint32 timer
Definition: karazhan.cpp:82
static Dialogue OzDialogue[]
Definition: karazhan.cpp:85
Definition: karazhan.h:63
int32_t int32
Definition: Define.h:146
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
static Dialogue RAJDialogue[]
Definition: karazhan.cpp:101
Definition: karazhan.h:64
static Dialogue HoodDialogue[]
Definition: karazhan.cpp:93
uint32 TalkTimer
Definition: karazhan.cpp:155
int32 textid
Definition: karazhan.cpp:81

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_barnes::npc_barnesAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from npc_escortAI.

285  {
287 
289  {
290  if (TalkTimer <= diff)
291  {
292  if (TalkCount > 3)
293  {
295  pSpotlight->DespawnOrUnsummon();
296 
297  SetEscortPaused(false);
298  return;
299  }
300 
301  Talk(TalkCount);
302  ++TalkCount;
303  } else TalkTimer -= diff;
304  }
305 
306  if (PerformanceReady)
307  {
308  if (!RaidWiped)
309  {
310  if (WipeTimer <= diff)
311  {
312  Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
313  if (PlayerList.isEmpty())
314  return;
315 
316  RaidWiped = true;
317  for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
318  {
319  if (i->GetSource()->IsAlive() && !i->GetSource()->IsGameMaster())
320  {
321  RaidWiped = false;
322  break;
323  }
324  }
325 
326  if (RaidWiped)
327  {
328  RaidWiped = true;
329  EnterEvadeMode();
330  return;
331  }
332 
333  WipeTimer = 15000;
334  } else WipeTimer -= diff;
335  }
336  }
337  }
uint32 TalkCount
Definition: karazhan.cpp:154
Map * GetMap() const
Definition: Object.h:543
ObjectGuid m_uiSpotlightGUID
Definition: karazhan.cpp:152
void Talk(uint32 count)
Definition: karazhan.cpp:214
Definition: Creature.h:467
void EnterEvadeMode(EvadeReason=EVADE_REASON_OTHER) override
Definition: ScriptedEscortAI.cpp:187
iterator begin()
Definition: MapRefManager.h:37
Creature *const me
Definition: CreatureAI.h:71
void UpdateAI(uint32 diff) override
Definition: ScriptedEscortAI.cpp:227
Definition: LinkedList.h:141
bool isEmpty() const
Definition: LinkedList.h:102
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
PlayerList const & GetPlayers() const
Definition: Map.h:433
Definition: MapRefManager.h:26
void SetEscortPaused(bool on)
Definition: ScriptedEscortAI.cpp:507
uint32 WipeTimer
Definition: karazhan.cpp:156
bool RaidWiped
Definition: karazhan.cpp:160
Definition: ScriptedEscortAI.h:49
bool PerformanceReady
Definition: karazhan.cpp:159
uint32 TalkTimer
Definition: karazhan.cpp:155
bool HasEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:96
iterator end()
Definition: MapRefManager.h:38

+ Here is the call graph for this function:

void npc_barnes::npc_barnesAI::WaypointReached ( uint32  waypointId)
inlineoverridevirtual

Implements npc_escortAI.

183  {
184  switch (waypointId)
185  {
186  case 0:
187  DoCast(me, SPELL_TUXEDO, false);
189  break;
190  case 4:
191  TalkCount = 0;
192  SetEscortPaused(true);
193 
194  if (Creature* spotlight = me->SummonCreature(NPC_SPOTLIGHT,
195  me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f,
197  {
198  spotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
199  spotlight->CastSpell(spotlight, SPELL_SPOTLIGHT, false);
200  m_uiSpotlightGUID = spotlight->GetGUID();
201  }
202  break;
203  case 8:
205  PerformanceReady = true;
206  break;
207  case 9:
210  break;
211  }
212  }
Definition: karazhan.cpp:57
uint32 TalkCount
Definition: karazhan.cpp:154
Definition: karazhan.cpp:42
Definition: karazhan.h:45
Definition: karazhan.h:46
ObjectGuid m_uiSpotlightGUID
Definition: karazhan.cpp:152
Definition: Creature.h:467
Creature *const me
Definition: CreatureAI.h:71
virtual ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:93
Definition: karazhan.cpp:41
InstanceScript * instance
Definition: karazhan.cpp:150
void DoUseDoorOrButton(ObjectGuid guid, uint32 withRestoreTime=0, bool useAlternativeState=false)
Definition: InstanceScript.cpp:407
float GetPositionY() const
Definition: Position.h:105
float GetPositionZ() const
Definition: Position.h:106
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
void SetEscortPaused(bool on)
Definition: ScriptedEscortAI.cpp:507
Definition: UpdateFields.h:109
void PrepareEncounter()
Definition: karazhan.cpp:246
bool PerformanceReady
Definition: karazhan.cpp:159
float GetPositionX() const
Definition: Position.h:104
Definition: Unit.h:698
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346
Definition: Object.h:54

+ Here is the call graph for this function:

Member Data Documentation

InstanceScript* npc_barnes::npc_barnesAI::instance
uint32 npc_barnes::npc_barnesAI::m_uiEventId
ObjectGuid npc_barnes::npc_barnesAI::m_uiSpotlightGUID
bool npc_barnes::npc_barnesAI::PerformanceReady
bool npc_barnes::npc_barnesAI::RaidWiped
uint32 npc_barnes::npc_barnesAI::TalkCount
uint32 npc_barnes::npc_barnesAI::TalkTimer
uint32 npc_barnes::npc_barnesAI::WipeTimer

The documentation for this struct was generated from the following file: