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

Public Member Functions

 npc_train_wreckerAI (Creature *creature)
 
GameObjectVerifyTarget () const
 
void UpdateAI (uint32 diff) override
 
void MovementInform (uint32, uint32 id) override
 
- Public Member Functions inherited from NullCreatureAI
 NullCreatureAI (Creature *c)
 
void MoveInLineOfSight (Unit *) override
 
void AttackStart (Unit *) override
 
void EnterEvadeMode (EvadeReason) override
 
void OnCharmed (bool) override
 
- 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 EnterCombat (Unit *)
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (Unit *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SpellHit (Unit *, SpellInfo const *)
 
virtual void SpellHitTarget (Unit *, SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted () const
 
virtual void JustRespawned ()
 
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 Reset ()
 
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 DamageTaken (Unit *, uint32 &)
 
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)
 

Private Attributes

bool _isSearching
 
uint8 _nextAction
 
uint32 _timer
 
ObjectGuid _target
 

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 NullCreatureAI
static int Permissible (const Creature *)
 
- Static Public Member Functions inherited from UnitAI
static void FillAISpellInfo ()
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- 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_train_wrecker::npc_train_wreckerAI::npc_train_wreckerAI ( Creature creature)
inline
2412 : NullCreatureAI(creature), _isSearching(true), _nextAction(0), _timer(1 * IN_MILLISECONDS) { }
bool _isSearching
Definition: npcs_special.cpp:2504
NullCreatureAI(Creature *c)
Definition: PassiveAI.cpp:24
uint32 _timer
Definition: npcs_special.cpp:2506
Definition: Common.h:103
uint8 _nextAction
Definition: npcs_special.cpp:2505

Member Function Documentation

void npc_train_wrecker::npc_train_wreckerAI::MovementInform ( uint32  ,
uint32  id 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

2496  {
2497  if (id == MOVEID_CHASE)
2499  else if (id == MOVEID_JUMP)
2501  }
Definition: npcs_special.cpp:2401
Definition: npcs_special.cpp:2400
Definition: npcs_special.cpp:2396
uint8 _nextAction
Definition: npcs_special.cpp:2505
Definition: npcs_special.cpp:2397
void npc_train_wrecker::npc_train_wreckerAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from NullCreatureAI.

2424  {
2425  if (_isSearching)
2426  {
2427  if (diff < _timer)
2428  _timer -= diff;
2429  else
2430  {
2431  if (GameObject* target = me->FindNearestGameObject(GO_TOY_TRAIN, 15.0f))
2432  {
2433  _isSearching = false;
2434  _target = target->GetGUID();
2435  me->SetWalk(true);
2436  me->GetMotionMaster()->MovePoint(MOVEID_CHASE, target->GetNearPosition(3.0f, target->GetAngle(me)));
2437  }
2438  else
2439  _timer = 3 * IN_MILLISECONDS;
2440  }
2441  }
2442  else
2443  {
2444  switch (_nextAction)
2445  {
2446  case EVENT_DO_JUMP:
2447  if (GameObject* target = VerifyTarget())
2448  me->GetMotionMaster()->MoveJump(*target, 5.0, 10.0, MOVEID_JUMP);
2449  _nextAction = 0;
2450  break;
2451  case EVENT_DO_FACING:
2452  if (GameObject* target = VerifyTarget())
2453  {
2454  me->SetFacingTo(target->GetOrientation());
2456  _timer = 1.5 * IN_MILLISECONDS;
2458  }
2459  else
2460  _nextAction = 0;
2461  break;
2462  case EVENT_DO_WRECK:
2463  if (diff < _timer)
2464  {
2465  _timer -= diff;
2466  break;
2467  }
2468  if (GameObject* target = VerifyTarget())
2469  {
2470  me->CastSpell(target, SPELL_WRECK_TRAIN, false);
2471  target->AI()->DoAction(ACTION_WRECKED);
2472  _timer = 2 * IN_MILLISECONDS;
2474  }
2475  else
2476  _nextAction = 0;
2477  break;
2478  case EVENT_DO_DANCE:
2479  if (diff < _timer)
2480  {
2481  _timer -= diff;
2482  break;
2483  }
2487  _nextAction = 0;
2488  break;
2489  default:
2490  break;
2491  }
2492  }
2493  }
void DespawnOrUnsummon(uint32 msTimeToDespawn=0)
Definition: Creature.cpp:1774
Definition: UpdateFields.h:136
GameObject * VerifyTarget() const
Definition: npcs_special.cpp:2414
GameObject * FindNearestGameObject(uint32 entry, float range) const
Definition: Object.cpp:2452
Definition: npcs_special.cpp:2398
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
bool _isSearching
Definition: npcs_special.cpp:2504
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Definition: SharedDefines.h:2444
Definition: npcs_special.cpp:2401
Definition: npcs_special.cpp:2403
Definition: SharedDefines.h:2467
ObjectGuid _target
Definition: npcs_special.cpp:2507
Definition: npcs_special.cpp:2399
Creature *const me
Definition: CreatureAI.h:71
void MovePoint(uint32 id, Position const &pos, bool generatePath=true)
Definition: MotionMaster.h:172
void MoveJump(Position const &pos, float speedXY, float speedZ, uint32 id=EVENT_JUMP, bool hasOrientation=false, uint32 arrivalSpellId=0, ObjectGuid const &arrivalSpellTargetGuid=ObjectGuid::Empty)
Definition: MotionMaster.h:184
Definition: npcs_special.cpp:2392
Definition: npcs_special.cpp:2400
Definition: GameObject.h:880
void SetFacingTo(float ori)
Definition: Unit.cpp:15777
uint32 _timer
Definition: npcs_special.cpp:2506
Definition: npcs_special.cpp:2396
Definition: Common.h:103
bool SetWalk(bool enable)
Definition: Unit.cpp:15800
void HandleEmoteCommand(uint32 anim_id)
Definition: Unit.cpp:1444
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr)
Definition: Creature.cpp:407
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
uint8 _nextAction
Definition: npcs_special.cpp:2505
Definition: npcs_special.cpp:2394
Definition: npcs_special.cpp:2397
Definition: npcs_special.cpp:2395

+ Here is the call graph for this function:

GameObject* npc_train_wrecker::npc_train_wreckerAI::VerifyTarget ( ) const
inline
2415  {
2417  return target;
2420  return nullptr;
2421  }
void DespawnOrUnsummon(uint32 msTimeToDespawn=0)
Definition: Creature.cpp:1774
ObjectGuid _target
Definition: npcs_special.cpp:2507
Creature *const me
Definition: CreatureAI.h:71
Definition: GameObject.h:880
Definition: SharedDefines.h:2424
Definition: Common.h:103
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:143
void HandleEmoteCommand(uint32 anim_id)
Definition: Unit.cpp:1444

+ Here is the call graph for this function:

Member Data Documentation

bool npc_train_wrecker::npc_train_wreckerAI::_isSearching
private
uint8 npc_train_wrecker::npc_train_wreckerAI::_nextAction
private
ObjectGuid npc_train_wrecker::npc_train_wreckerAI::_target
private
uint32 npc_train_wrecker::npc_train_wreckerAI::_timer
private

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