TrinityCore
PetAI Class Reference

#include <PetAI.h>

+ Inheritance diagram for PetAI:

Public Member Functions

 PetAI (Creature *creature, uint32 scriptId={})
 
void UpdateAI (uint32) override
 
void KilledUnit (Unit *) override
 
void AttackStart (Unit *target) override
 
void _AttackStart (Unit *target)
 
void MovementInform (uint32 type, uint32 id) override
 
void OwnerAttackedBy (Unit *attacker) override
 
void OwnerAttacked (Unit *target) override
 
void DamageTaken (Unit *attacker, uint32 &, DamageEffectType, SpellInfo const *) override
 
void ReceiveEmote (Player *player, uint32 textEmote) override
 
void JustEnteredCombat (Unit *who) override
 
void JustExitedCombat () override
 
void OnCharmed (bool isNew) override
 
void MoveInLineOfSight (Unit *) override
 
void MoveInLineOfSight_Safe (Unit *)
 
void JustAppeared () override
 
void EnterEvadeMode (EvadeReason) override
 
- Public Member Functions inherited from CreatureAI
 CreatureAI (Creature *creature, uint32 scriptId={})
 
virtual ~CreatureAI ()
 
uint32 GetId () const
 
bool IsEngaged () const
 
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr)
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At ================================= More...
 
void TriggerAlert (Unit const *who) const
 
virtual void EnterEvadeMode (EvadeReason why=EvadeReason::Other)
 
void JustEnteredCombat (Unit *) override
 
virtual void JustStartedThreateningMe (Unit *who)
 
virtual void JustEngagedWith (Unit *)
 
virtual void OnHealthDepleted (Unit *, bool)
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void JustSummonedGameobject (GameObject *)
 
virtual void SummonedGameobjectDespawn (GameObject *)
 
virtual void JustRegisteredDynObject (DynamicObject *)
 
virtual void JustUnregisteredDynObject (DynamicObject *)
 
virtual void JustRegisteredAreaTrigger (AreaTrigger *)
 
virtual void JustUnregisteredAreaTrigger (AreaTrigger *)
 
virtual void SpellHit (WorldObject *, SpellInfo const *)
 
virtual void SpellHitTarget (WorldObject *, SpellInfo const *)
 
virtual void OnSpellCast (SpellInfo const *)
 
virtual void OnSpellFailed (SpellInfo const *)
 
virtual void OnSpellStart (SpellInfo const *)
 
virtual void OnChannelFinished (SpellInfo const *)
 
virtual bool IsEscorted () const
 
virtual void JustAppeared ()
 
virtual void MovementInform (uint32, uint32)
 
void OnCharmed (bool isNew) override
 
virtual void JustReachedHome ()
 
void DoZoneInCombat ()
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *attacker)
 
virtual void OwnerAttacked (Unit *target)
 
void AttackStart (Unit *victim) override
 == Triggered Actions Requested ================== More...
 
virtual void CorpseRemoved (uint32 &)
 == State checks ================================= More...
 
virtual Optional< QuestGiverStatusGetDialogStatus (Player const *player)
 == Gossip system ================================ More...
 
virtual bool OnGossipHello (Player *)
 
virtual bool OnGossipSelect (Player *, uint32, uint32)
 
virtual bool OnGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void OnQuestAccept (Player *, Quest const *)
 
virtual void OnQuestReward (Player *, Quest const *, LootItemType, uint32)
 
virtual void WaypointStarted (uint32, uint32)
 == Waypoints system ============================= More...
 
virtual void WaypointReached (uint32, uint32)
 
virtual void WaypointPathEnded (uint32, uint32)
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields ======================================= More...
 
virtual void OnSpellClick (Unit *, bool)
 
virtual bool CanSeeAlways (WorldObject const *)
 
virtual PlayerAIGetAIForCharmedPlayer (Player *)
 
int32 VisualizeBoundary (Seconds duration, Unit *owner=nullptr, bool fill=false) const
 
virtual bool CheckInRoom ()
 
CreatureBoundary const * GetBoundary () const
 
void SetBoundary (CreatureBoundary const *boundary, bool negativeBoundaries=false)
 
bool IsInBoundary (Position const *who=nullptr) const
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void AttackStart (Unit *victim)
 
virtual void UpdateAI (uint32 diff)=0
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool isNew)
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid const &, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectTargetMethod targetType, uint32 offset, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 offset, PREDICATE const &predicate)
 
virtual void JustEnteredCombat (Unit *)
 
virtual void JustExitedCombat ()
 
virtual void OnDespawn ()
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellInfo const *)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void HealDone (Unit *, uint32 &)
 
virtual void SpellInterrupted (uint32, uint32)
 
void AttackStartCaster (Unit *victim, float dist)
 
SpellCastResult DoCast (uint32 spellId)
 
SpellCastResult DoCast (Unit *victim, uint32 spellId, CastSpellExtraArgs const &args={})
 
SpellCastResult DoCastSelf (uint32 spellId, CastSpellExtraArgs const &args={})
 
SpellCastResult DoCastVictim (uint32 spellId, CastSpellExtraArgs const &args={})
 
SpellCastResult DoCastAOE (uint32 spellId, CastSpellExtraArgs const &args={})
 
bool DoSpellAttackIfReady (uint32 spellId)
 
virtual void OnGameEvent (bool, uint16)
 
virtual std::string GetDebugInfo () const
 

Static Public Member Functions

static int32 Permissible (Creature const *creature)
 
- Static Public Member Functions inherited from CreatureAI
static void DoZoneInCombat (Creature *creature)
 
static bool IsInBounds (CreatureBoundary const &boundary, Position const *who)
 
- Static Public Member Functions inherited from UnitAI
static void FillAISpellInfo ()
 

Private Member Functions

bool NeedToStop ()
 
void StopAttack ()
 
void UpdateAllies ()
 
UnitSelectNextTarget (bool allowAutoSelect) const
 
void HandleReturnMovement ()
 
void DoAttack (Unit *target, bool chase)
 
bool CanAttack (Unit *target)
 
void ClearCharmInfoFlags ()
 

Private Attributes

TimeTracker _tracker
 
GuidSet _allySet
 
uint32 _updateAlliesTimer
 

Additional Inherited Members

- Static Public Attributes inherited from UnitAI
static std::unordered_map< std::pair< uint32, Difficulty >, AISpellInfoTypeAISpellInfo
 
- Protected Member Functions inherited from CreatureAI
bool UpdateVictim ()
 
CreatureDoSummon (uint32 entry, Position const &pos, Milliseconds despawnTime=30s, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, Milliseconds despawnTime=30s, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummonFlyer (uint32 entry, WorldObject *obj, float flightZ, float radius=5.0f, Milliseconds despawnTime=30s, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
void EngagementStart (Unit *who)
 
void EngagementOver ()
 
virtual void MoveInLineOfSight (Unit *)
 
bool _EnterEvadeMode (EvadeReason why=EvadeReason::Other)
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
CreatureBoundary const * _boundary
 
bool _negateBoundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Definition at line 29 of file PetAI.h.

Constructor & Destructor Documentation

◆ PetAI()

PetAI::PetAI ( Creature creature,
uint32  scriptId = {} 
)
explicit

Definition at line 47 of file PetAI.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ _AttackStart()

void PetAI::_AttackStart ( Unit target)

Definition at line 257 of file PetAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AttackStart()

void PetAI::AttackStart ( Unit target)
overridevirtual

Reimplemented from UnitAI.

Definition at line 245 of file PetAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanAttack()

bool PetAI::CanAttack ( Unit target)
private

Definition at line 473 of file PetAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearCharmInfoFlags()

void PetAI::ClearCharmInfoFlags ( )
private

Definition at line 640 of file PetAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DamageTaken()

void PetAI::DamageTaken ( Unit attacker,
uint32 ,
DamageEffectType  ,
SpellInfo const *   
)
inlineoverridevirtual

Reimplemented from UnitAI.

Definition at line 45 of file PetAI.h.

+ Here is the call graph for this function:

◆ DoAttack()

void PetAI::DoAttack ( Unit target,
bool  chase 
)
private

Definition at line 400 of file PetAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnterEvadeMode()

void PetAI::EnterEvadeMode ( EvadeReason  )
inlineoverridevirtual

Reimplemented from CreatureAI.

Definition at line 57 of file PetAI.h.

◆ HandleReturnMovement()

void PetAI::HandleReturnMovement ( )
private

Definition at line 352 of file PetAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ JustAppeared()

void PetAI::JustAppeared ( )
inlineoverridevirtual

Reimplemented from CreatureAI.

Definition at line 56 of file PetAI.h.

◆ JustEnteredCombat()

void PetAI::JustEnteredCombat ( Unit who)
inlineoverridevirtual

Reimplemented from UnitAI.

Definition at line 47 of file PetAI.h.

+ Here is the call graph for this function:

◆ JustExitedCombat()

void PetAI::JustExitedCombat ( )
inlineoverridevirtual

Reimplemented from UnitAI.

Definition at line 48 of file PetAI.h.

+ Here is the call graph for this function:

◆ KilledUnit()

void PetAI::KilledUnit ( Unit victim)
overridevirtual

Reimplemented from CreatureAI.

Definition at line 224 of file PetAI.cpp.

+ Here is the call graph for this function:

◆ MoveInLineOfSight()

void PetAI::MoveInLineOfSight ( Unit )
inlineoverridevirtual

Reimplemented from CreatureAI.

Definition at line 54 of file PetAI.h.

◆ MoveInLineOfSight_Safe()

void PetAI::MoveInLineOfSight_Safe ( Unit )
inline

Definition at line 55 of file PetAI.h.

◆ MovementInform()

void PetAI::MovementInform ( uint32  type,
uint32  id 
)
overridevirtual

Reimplemented from CreatureAI.

Reimplemented in npc_snufflenose_gopher::npc_snufflenose_gopherAI.

Definition at line 440 of file PetAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NeedToStop()

bool PetAI::NeedToStop ( )
private

Definition at line 561 of file PetAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnCharmed()

void PetAI::OnCharmed ( bool  isNew)
overridevirtual

Reimplemented from UnitAI.

Definition at line 632 of file PetAI.cpp.

+ Here is the call graph for this function:

◆ OwnerAttacked()

void PetAI::OwnerAttacked ( Unit target)
overridevirtual

Reimplemented from CreatureAI.

Definition at line 287 of file PetAI.cpp.

+ Here is the call graph for this function:

◆ OwnerAttackedBy()

void PetAI::OwnerAttackedBy ( Unit attacker)
overridevirtual

Reimplemented from CreatureAI.

Definition at line 267 of file PetAI.cpp.

+ Here is the call graph for this function:

◆ Permissible()

int32 PetAI::Permissible ( Creature const *  creature)
static

Definition at line 35 of file PetAI.cpp.

+ Here is the call graph for this function:

◆ ReceiveEmote()

void PetAI::ReceiveEmote ( Player player,
uint32  textEmote 
)
overridevirtual

Reimplemented from CreatureAI.

Definition at line 535 of file PetAI.cpp.

+ Here is the call graph for this function:

◆ SelectNextTarget()

Unit * PetAI::SelectNextTarget ( bool  allowAutoSelect) const
private

Definition at line 308 of file PetAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StopAttack()

void PetAI::StopAttack ( )
private

Definition at line 575 of file PetAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateAI()

void PetAI::UpdateAI ( uint32  diff)
overridevirtual

Implements UnitAI.

Reimplemented in npc_snufflenose_gopher::npc_snufflenose_gopherAI.

Definition at line 55 of file PetAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateAllies()

void PetAI::UpdateAllies ( )
private

Definition at line 592 of file PetAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _allySet

GuidSet PetAI::_allySet
private

Definition at line 71 of file PetAI.h.

◆ _tracker

TimeTracker PetAI::_tracker
private

Definition at line 70 of file PetAI.h.

◆ _updateAlliesTimer

uint32 PetAI::_updateAlliesTimer
private

Definition at line 72 of file PetAI.h.


The documentation for this class was generated from the following files: