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

Public Member Functions

 npc_twiggy_flatheadAI (Creature *creature)
 
void Initialize ()
 
void Reset () override
 
void MoveInLineOfSight (Unit *who) override
 
void UpdateAI (uint32 diff) override
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
virtual ~ScriptedAI ()
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &) override
 
void JustDied (Unit *) 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 EnterCombat (Unit *) override
 
void AttackStart (Unit *) override
 
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)
 
Unit * DoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
Player * GetPlayerAtMinimumRange (float minRange)
 
Creature * DoSpawnCreature (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 const * SelectSpell (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 EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void IsSummonedBy (Unit *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted () const
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
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 const * GetBoundary () 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
 
Unit * SelectTarget (SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
 
template<class PREDICATE >
Unit * SelectTarget (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

bool EventInProgress
 
bool EventGrate
 
bool EventBigWill
 
bool ChallengerDown [6]
 
uint8 Wave
 
uint32 WaveTimer
 
uint32 ChallengerChecker
 
ObjectGuid PlayerGUID
 
ObjectGuid AffrayChallenger [6]
 
ObjectGuid BigWill
 
- 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 AISpellInfoType * AISpellInfo
 
- Protected Member Functions inherited from CreatureAI
bool UpdateVictim ()
 
bool UpdateVictimWithGaze ()
 
void SetGazeOn (Unit *target)
 
Creature * DoSummon (uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
Creature * DoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
Creature * DoSummonFlyer (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_twiggy_flathead::npc_twiggy_flatheadAI::npc_twiggy_flatheadAI ( Creature *  creature)
inline
318  : ScriptedAI(creature)
319  {
320  Initialize();
321  }
ScriptedAI(Creature *creature)
Definition: ScriptedCreature.cpp:100
void Initialize()
Definition: zone_the_barrens.cpp:323

+ Here is the call graph for this function:

Member Function Documentation

void npc_twiggy_flathead::npc_twiggy_flatheadAI::Initialize ( void  )
inline
324  {
325  EventInProgress = false;
326  EventGrate = false;
327  EventBigWill = false;
328  WaveTimer = 600000;
329  ChallengerChecker = 0;
330  Wave = 0;
331  PlayerGUID.Clear();
332 
333  for (uint8 i = 0; i < 6; ++i)
334  {
335  AffrayChallenger[i].Clear();
336  ChallengerDown[i] = false;
337  }
338  BigWill.Clear();
339  }
uint32 ChallengerChecker
Definition: zone_the_barrens.cpp:347
ObjectGuid BigWill
Definition: zone_the_barrens.cpp:350
ObjectGuid PlayerGUID
Definition: zone_the_barrens.cpp:348
Definition: hyjalAI.h:43
bool EventInProgress
Definition: zone_the_barrens.cpp:341
uint32 WaveTimer
Definition: zone_the_barrens.cpp:346
bool EventGrate
Definition: zone_the_barrens.cpp:342
bool ChallengerDown[6]
Definition: zone_the_barrens.cpp:344
bool EventBigWill
Definition: zone_the_barrens.cpp:343
void Clear()
Definition: ObjectGuid.h:215
uint8_t uint8
Definition: Define.h:152
ObjectGuid AffrayChallenger[6]
Definition: zone_the_barrens.cpp:349

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_twiggy_flathead::npc_twiggy_flatheadAI::MoveInLineOfSight ( Unit *  who)
inlineoverridevirtual

Reimplemented from CreatureAI.

358  {
359  if (!who || !who->IsAlive() || EventInProgress)
360  return;
361 
362  if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f))
363  if (Player* player = who->ToPlayer())
364  if (player->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE)
365  {
366  PlayerGUID = who->GetGUID();
367  EventInProgress = true;
368  }
369  }
ObjectGuid PlayerGUID
Definition: zone_the_barrens.cpp:348
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.cpp:1663
Player * ToPlayer()
Definition: Object.h:191
bool EventInProgress
Definition: zone_the_barrens.cpp:341
Creature *const me
Definition: CreatureAI.h:71
TypeID GetTypeId() const
Definition: Object.h:113
bool IsAlive() const
Definition: Unit.h:1692
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: ObjectGuid.h:33
Definition: QuestDef.h:113

+ Here is the call graph for this function:

void npc_twiggy_flathead::npc_twiggy_flatheadAI::Reset ( )
inlineoverridevirtual

Reimplemented from ScriptedAI.

353  {
354  Initialize();
355  }
void Initialize()
Definition: zone_the_barrens.cpp:323

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from ScriptedAI.

372  {
373  if (EventInProgress)
374  {
375  Player* warrior = NULL;
376 
377  if (!PlayerGUID.IsEmpty())
379 
380  if (!warrior)
381  return;
382 
383  if (!warrior->IsAlive() && warrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE)
384  {
386  warrior->FailQuest(1719);
387 
388  for (uint8 i = 0; i < 6; ++i) // unsummon challengers
389  {
390  if (!AffrayChallenger[i].IsEmpty())
391  {
393  if (creature && creature->IsAlive())
394  creature->DisappearAndDie();
395  }
396  }
397 
398  if (!BigWill.IsEmpty()) // unsummon bigWill
399  {
401  if (creature && creature->IsAlive())
402  creature->DisappearAndDie();
403  }
404  Reset();
405  }
406 
407  if (!EventGrate && EventInProgress)
408  {
409  float x, y, z;
410  warrior->GetPosition(x, y, z);
411 
412  if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324)
413  {
414  warrior->AreaExploredOrEventHappens(1719);
416 
417  for (uint8 i = 0; i < 6; ++i)
418  {
420  if (!creature)
421  continue;
422  creature->setFaction(35);
426  AffrayChallenger[i] = creature->GetGUID();
427  }
428  WaveTimer = 5000;
429  ChallengerChecker = 1000;
430  EventGrate = true;
431  }
432  }
433  else if (EventInProgress)
434  {
435  if (ChallengerChecker <= diff)
436  {
437  for (uint8 i = 0; i < 6; ++i)
438  {
439  if (!AffrayChallenger[i].IsEmpty())
440  {
442  if ((!creature || (!creature->IsAlive())) && !ChallengerDown[i])
443  {
445  ChallengerDown[i] = true;
446  }
447  }
448  }
449  ChallengerChecker = 1000;
450  } else ChallengerChecker -= diff;
451 
452  if (WaveTimer <= diff)
453  {
454  if (Wave < 6 && !AffrayChallenger[Wave].IsEmpty() && !EventBigWill)
455  {
458  if (creature && (creature->IsAlive()))
459  {
463  creature->setFaction(14);
464  creature->AI()->AttackStart(warrior);
465  ++Wave;
466  WaveTimer = 20000;
467  }
468  }
469  else if (Wave >= 6 && !EventBigWill)
470  {
471  if (Creature* creature = me->SummonCreature(NPC_BIG_WILL, -1722, -4341, 6.12f, 6.26f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 480000))
472  {
473  BigWill = creature->GetGUID();
474  //creature->GetMotionMaster()->MovePoint(0, -1693, -4343, 4.32f);
475  //creature->GetMotionMaster()->MovePoint(1, -1684, -4333, 2.78f);
476  creature->GetMotionMaster()->MovePoint(2, -1682, -4329, 2.79f);
478  EventBigWill = true;
479  WaveTimer = 1000;
480  }
481  }
482  else if (Wave >= 6 && EventBigWill && !BigWill.IsEmpty())
483  {
485  if (!creature || !creature->IsAlive())
486  {
488  Reset();
489  }
490  else if (creature) // Makes BIG WILL attackable.
491  {
495  creature->setFaction(14);
496  creature->AI()->AttackStart(warrior);
497  }
498  }
499  } else WaveTimer -= diff;
500  }
501  }
502  }
Definition: SharedDefines.h:2437
Definition: Unit.h:674
uint32 ChallengerChecker
Definition: zone_the_barrens.cpp:347
ObjectGuid BigWill
Definition: zone_the_barrens.cpp:350
ObjectGuid PlayerGUID
Definition: zone_the_barrens.cpp:348
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
Definition: hyjalAI.h:43
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
Definition: zone_the_barrens.cpp:293
void setFaction(uint32 faction)
Definition: Unit.h:1467
bool EventInProgress
Definition: zone_the_barrens.cpp:341
uint32 WaveTimer
Definition: zone_the_barrens.cpp:346
Creature *const me
Definition: CreatureAI.h:71
void MovePoint(uint32 id, Position const &pos, bool generatePath=true)
Definition: MotionMaster.h:172
bool IsAlive() const
Definition: Unit.h:1692
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:184
G3D::int16 z
Definition: Vector3int16.h:46
bool EventGrate
Definition: zone_the_barrens.cpp:342
CreatureAI * AI() const
Definition: Creature.h:525
void Reset() override
Definition: zone_the_barrens.cpp:352
bool ChallengerDown[6]
Definition: zone_the_barrens.cpp:344
G3D::int16 y
Definition: Vector2int16.h:38
bool EventBigWill
Definition: zone_the_barrens.cpp:343
Position const AffrayChallengerLoc[6]
Definition: zone_the_barrens.cpp:296
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
Definition: zone_the_barrens.cpp:292
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: SharedDefines.h:2425
uint8 Wave
Definition: zone_the_barrens.cpp:345
Definition: UpdateFields.h:109
Definition: zone_the_barrens.cpp:287
Definition: QuestDef.h:113
uint8_t uint8
Definition: Define.h:152
void HandleEmoteCommand(uint32 anim_id)
Definition: Unit.cpp:1444
G3D::int16 x
Definition: Vector2int16.h:37
ObjectGuid AffrayChallenger[6]
Definition: zone_the_barrens.cpp:349
void DisappearAndDie()
Definition: Creature.cpp:256
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:29
Definition: Unit.h:698
bool IsEmpty() const
Definition: ObjectGuid.h:242
Definition: zone_the_barrens.cpp:286
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346
Definition: zone_the_barrens.cpp:290
Definition: zone_the_barrens.cpp:291
Definition: Object.h:54

+ Here is the call graph for this function:

Member Data Documentation

ObjectGuid npc_twiggy_flathead::npc_twiggy_flatheadAI::AffrayChallenger[6]
ObjectGuid npc_twiggy_flathead::npc_twiggy_flatheadAI::BigWill
uint32 npc_twiggy_flathead::npc_twiggy_flatheadAI::ChallengerChecker
bool npc_twiggy_flathead::npc_twiggy_flatheadAI::ChallengerDown[6]
bool npc_twiggy_flathead::npc_twiggy_flatheadAI::EventBigWill
bool npc_twiggy_flathead::npc_twiggy_flatheadAI::EventGrate
bool npc_twiggy_flathead::npc_twiggy_flatheadAI::EventInProgress
ObjectGuid npc_twiggy_flathead::npc_twiggy_flatheadAI::PlayerGUID
uint8 npc_twiggy_flathead::npc_twiggy_flatheadAI::Wave
uint32 npc_twiggy_flathead::npc_twiggy_flatheadAI::WaveTimer

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