TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
npc_escortAI Struct Referenceabstract

#include <ScriptedEscortAI.h>

Public Member Functions

 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
 
void UpdateAI (uint32 diff) 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 WaypointReached (uint32 pointId)=0
 
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 Reset () override
 
void EnterCombat (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)
 
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)
 

Protected Member Functions

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)
 

Private Member Functions

bool AssistPlayerInCombat (Unit *who)
 
bool IsPlayerOrGroupInRange ()
 
void FillPointMovementListForCreature ()
 
void AddEscortState (uint32 escortState)
 
void RemoveEscortState (uint32 escortState)
 

Private Attributes

ObjectGuid m_uiPlayerGUID
 
uint32 m_uiWPWaitTimer
 
uint32 m_uiPlayerCheckTimer
 
uint32 m_uiEscortState
 
float MaxPlayerDistance
 
Quest constm_pQuestForEscort
 
std::list< Escort_WaypointWaypointList
 
std::list< Escort_Waypoint >
::iterator 
CurrentWP
 
bool m_bIsActiveAttacker
 
bool m_bIsRunning
 
bool m_bCanInstantRespawn
 
bool m_bCanReturnToStart
 
bool DespawnAtEnd
 
bool DespawnAtFar
 
bool ScriptWP
 
bool HasImmuneToNPCFlags
 

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 ()
 
- Public Attributes inherited from ScriptedAI
bool IsFleeing
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
CreatureBoundary const_boundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Constructor & Destructor Documentation

npc_escortAI::npc_escortAI ( Creature creature)
explicit
37  : ScriptedAI(creature),
38  m_uiWPWaitTimer(2500),
43  m_bIsActiveAttacker(true),
44  m_bIsRunning(false),
45  m_bCanInstantRespawn(false),
46  m_bCanReturnToStart(false),
47  DespawnAtEnd(true),
48  DespawnAtFar(true),
49  ScriptWP(false),
50  HasImmuneToNPCFlags(false)
51 { }
uint32 m_uiEscortState
Definition: ScriptedEscortAI.h:122
bool m_bIsActiveAttacker
Definition: ScriptedEscortAI.h:130
ScriptedAI(Creature *creature)
Definition: ScriptedCreature.cpp:100
uint32 m_uiPlayerCheckTimer
Definition: ScriptedEscortAI.h:121
arena_t NULL
Definition: jemalloc_internal.h:624
bool HasImmuneToNPCFlags
Definition: ScriptedEscortAI.h:137
bool DespawnAtEnd
Definition: ScriptedEscortAI.h:134
bool DespawnAtFar
Definition: ScriptedEscortAI.h:135
Quest const * m_pQuestForEscort
Definition: ScriptedEscortAI.h:125
float MaxPlayerDistance
Definition: ScriptedEscortAI.h:123
Definition: ScriptedEscortAI.h:46
bool m_bCanInstantRespawn
Definition: ScriptedEscortAI.h:132
bool ScriptWP
Definition: ScriptedEscortAI.h:136
bool m_bIsRunning
Definition: ScriptedEscortAI.h:131
uint32 m_uiWPWaitTimer
Definition: ScriptedEscortAI.h:120
bool m_bCanReturnToStart
Definition: ScriptedEscortAI.h:133
#define DEFAULT_MAX_PLAYER_DISTANCE
Definition: ScriptedEscortAI.h:24
npc_escortAI::~npc_escortAI ( )
inline
56 { }

Member Function Documentation

void npc_escortAI::AddEscortState ( uint32  escortState)
inlineprivate
116 { m_uiEscortState |= escortState; }
uint32 m_uiEscortState
Definition: ScriptedEscortAI.h:122

+ Here is the caller graph for this function:

void npc_escortAI::AddWaypoint ( uint32  id,
float  x,
float  y,
float  z,
uint32  waitTime = 0 
)
386 {
387  Escort_Waypoint t(id, x, y, z, waitTime);
388 
389  WaypointList.push_back(t);
390 
391  // i think SD2 no longer uses this function
392  ScriptWP = true;
393  /*PointMovement wp;
394  wp.m_uiCreatureEntry = me->GetEntry();
395  wp.m_uiPointId = id;
396  wp.m_fX = x;
397  wp.m_fY = y;
398  wp.m_fZ = z;
399  wp.m_uiWaitTime = WaitTimeMs;
400  PointMovementMap[wp.m_uiCreatureEntry].push_back(wp);*/
401 }
std::list< Escort_Waypoint > WaypointList
Definition: ScriptedEscortAI.h:127
Definition: ScriptedEscortAI.h:26
G3D::int16 z
Definition: Vector3int16.h:46
bool ScriptWP
Definition: ScriptedEscortAI.h:136
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the caller graph for this function:

bool npc_escortAI::AssistPlayerInCombat ( Unit who)
private
70 {
71  if (!who || !who->GetVictim())
72  return false;
73 
74  //experimental (unknown) flag not present
76  return false;
77 
78  //not a player
80  return false;
81 
82  //never attack friendly
83  if (me->IsFriendlyTo(who))
84  return false;
85 
86  //too far away and no free sight?
88  {
89  //already fighting someone?
90  if (!me->GetVictim())
91  {
92  AttackStart(who);
93  return true;
94  }
95  else
96  {
97  who->SetInCombatWith(me);
98  me->AddThreat(who, 0.0f);
99  return true;
100  }
101  }
102 
103  return false;
104 }
Unit * EnsureVictim() const
Definition: Unit.h:1381
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
Definition: Unit.cpp:10691
void AttackStart(Unit *who) override
Definition: ScriptedEscortAI.cpp:53
bool IsWithinLOSInMap(WorldObject const *obj) const
Definition: Object.cpp:1584
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.cpp:1663
Creature *const me
Definition: CreatureAI.h:71
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
Definition: SharedDefines.h:3668
Unit * GetVictim() const
Definition: Unit.h:1379
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:7170
float GetMaxPlayerDistance() const
Definition: ScriptedEscortAI.h:100
void SetInCombatWith(Unit *enemy)
Definition: Unit.cpp:9840
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:7560
uint32 type_flags
Definition: Creature.h:117

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_escortAI::AttackStart ( Unit who)
overridevirtual

Reimplemented from ScriptedAI.

Reimplemented in npc_highlord_darion_mograine::npc_highlord_darion_mograineAI, npc_arthas::npc_arthasAI, and npc_icefang::npc_icefangAI.

54 {
55  if (!who)
56  return;
57 
58  if (me->Attack(who, true))
59  {
62 
64  me->GetMotionMaster()->MoveChase(who);
65  }
66 }
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:7222
void MoveChase(Unit *target, float dist=0.0f, float angle=0.0f)
Definition: MotionMaster.cpp:241
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition: MotionMaster.cpp:663
bool IsCombatMovementAllowed() const
Definition: ScriptedCreature.h:261
Creature *const me
Definition: CreatureAI.h:71
void MovementExpired(bool reset=true)
Definition: MotionMaster.h:151
Definition: MotionMaster.h:46

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_escortAI::EnterEvadeMode ( EvadeReason  = EVADE_REASON_OTHER)
overridevirtual

Reimplemented from CreatureAI.

Reimplemented in npc_highlord_darion_mograine::npc_highlord_darion_mograineAI, npc_icefang::npc_icefangAI, npc_onyx_flamecaller::npc_onyx_flamecallerAI, npc_ancestral_wolf::npc_ancestral_wolfAI, and hyjalAI.

188 {
189  me->RemoveAllAuras();
190  me->DeleteThreatList();
191  me->CombatStop(true);
193 
195  {
198  TC_LOG_DEBUG("scripts", "EscortAI has left combat and is now returning to last point");
199  }
200  else
201  {
205  Reset();
206  }
207 }
void RemoveAllAuras()
Definition: Unit.cpp:3920
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
void MoveTargetedHome()
Definition: MotionMaster.cpp:201
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
bool HasImmuneToNPCFlags
Definition: ScriptedEscortAI.h:137
Definition: ScriptedEscortAI.h:47
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void SetLootRecipient(Unit *unit)
Definition: Creature.cpp:993
Creature *const me
Definition: CreatureAI.h:71
void AddEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:116
void Reset() override
Definition: ScriptedCreature.h:192
Definition: Unit.h:682
void DeleteThreatList()
Definition: Unit.cpp:10700
Definition: UpdateFields.h:109
Definition: ScriptedEscortAI.h:48
void ReturnToLastPoint()
Definition: ScriptedEscortAI.cpp:180
void CombatStop(bool includingCast=false)
Definition: Unit.cpp:7371
bool HasEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:96

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_escortAI::FillPointMovementListForCreature ( )
private
404 {
405  ScriptPointVector const& movePoints = sScriptSystemMgr->GetPointMoveList(me->GetEntry());
406  if (movePoints.empty())
407  return;
408 
409  ScriptPointVector::const_iterator itrEnd = movePoints.end();
410  for (ScriptPointVector::const_iterator itr = movePoints.begin(); itr != itrEnd; ++itr)
411  {
412  Escort_Waypoint point(itr->uiPointId, itr->fX, itr->fY, itr->fZ, itr->uiWaitTime);
413  WaypointList.push_back(point);
414  }
415 }
std::list< Escort_Waypoint > WaypointList
Definition: ScriptedEscortAI.h:127
Creature *const me
Definition: CreatureAI.h:71
Definition: ScriptedEscortAI.h:26
#define sScriptSystemMgr
Definition: ScriptSystem.h:93
uint32 GetEntry() const
Definition: Object.h:107
std::vector< ScriptPointMove > ScriptPointVector
Definition: ScriptSystem.h:60

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool npc_escortAI::GetAttack ( ) const
inline
104 { return m_bIsActiveAttacker; }//used in EnterEvadeMode override
bool m_bIsActiveAttacker
Definition: ScriptedEscortAI.h:130

+ Here is the caller graph for this function:

ObjectGuid npc_escortAI::GetEventStarterGUID ( ) const
inline
106 { return m_uiPlayerGUID; }
ObjectGuid m_uiPlayerGUID
Definition: ScriptedEscortAI.h:119
float npc_escortAI::GetMaxPlayerDistance ( ) const
inline
100 { return MaxPlayerDistance; }
float MaxPlayerDistance
Definition: ScriptedEscortAI.h:123

+ Here is the caller graph for this function:

Player* npc_escortAI::GetPlayerForEscort ( )
inlineprotected
Creature *const me
Definition: CreatureAI.h:71
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:184
ObjectGuid m_uiPlayerGUID
Definition: ScriptedEscortAI.h:119

+ Here is the call graph for this function:

bool npc_escortAI::GetWaypointPosition ( uint32  pointId,
float &  x,
float &  y,
float &  z 
)
565 {
566  ScriptPointVector const& waypoints = sScriptSystemMgr->GetPointMoveList(me->GetEntry());
567  if (waypoints.empty())
568  return false;
569 
570  for (ScriptPointVector::const_iterator itr = waypoints.begin(); itr != waypoints.end(); ++itr)
571  {
572  if (itr->uiPointId == pointId)
573  {
574  x = itr->fX;
575  y = itr->fY;
576  z = itr->fZ;
577  return true;
578  }
579  }
580 
581  return false;
582 }
Creature *const me
Definition: CreatureAI.h:71
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
#define sScriptSystemMgr
Definition: ScriptSystem.h:93
uint32 GetEntry() const
Definition: Object.h:107
std::vector< ScriptPointMove > ScriptPointVector
Definition: ScriptSystem.h:60
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the call graph for this function:

bool npc_escortAI::HasEscortState ( uint32  escortState)
inline
96 { return (m_uiEscortState & escortState) != 0; }
uint32 m_uiEscortState
Definition: ScriptedEscortAI.h:122

+ Here is the caller graph for this function:

virtual bool npc_escortAI::IsEscorted ( ) const
inlineoverridevirtual

Reimplemented from CreatureAI.

uint32 m_uiEscortState
Definition: ScriptedEscortAI.h:122
Definition: ScriptedEscortAI.h:47
bool npc_escortAI::IsPlayerOrGroupInRange ( )
private
210 {
211  if (Player* player = GetPlayerForEscort())
212  {
213  if (Group* group = player->GetGroup())
214  {
215  for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
216  if (Player* member = groupRef->GetSource())
217  if (me->IsWithinDistInMap(member, GetMaxPlayerDistance()))
218  return true;
219  }
220  else if (me->IsWithinDistInMap(player, GetMaxPlayerDistance()))
221  return true;
222  }
223 
224  return false;
225 }
Player * GetPlayerForEscort()
Definition: ScriptedEscortAI.h:109
arena_t NULL
Definition: jemalloc_internal.h:624
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.cpp:1663
Creature *const me
Definition: CreatureAI.h:71
float GetMaxPlayerDistance() const
Definition: ScriptedEscortAI.h:100
Definition: Group.h:191
Definition: GroupReference.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_escortAI::JustDied ( Unit )
overridevirtual

Reimplemented from ScriptedAI.

Reimplemented in npc_bonker_togglevolt::npc_bonker_togglevoltAI, npc_mootoo_the_younger::npc_mootoo_the_youngerAI, npc_gargoyle::npc_gargoyleAI, npc_frost_wyrm::npc_frost_wyrmAI, npc_thassarian::npc_thassarianAI, npc_maxx_a_million_escort::npc_maxx_a_million_escortAI, npc_argent_soldier::npc_argent_soldierAI, npc_bessy::npc_bessyAI, npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, npc_kurenai_captive::npc_kurenai_captiveAI, npc_isla_starmane::npc_isla_starmaneAI, npc_arthas::npc_arthasAI, npc_icefang::npc_icefangAI, npc_engineer_helice::npc_engineer_heliceAI, npc_lesser_doomguard::npc_lesser_doomguardAI, npc_muglash::npc_muglashAI, npc_disciple_of_naralex::npc_disciple_of_naralexAI, boss_ambassador_hellmaw::boss_ambassador_hellmawAI, hyjalAI, npc_willix::npc_willixAI, npc_maghar_captive::npc_maghar_captiveAI, boss_azgalor::boss_azgalorAI, boss_anetheron::boss_anetheronAI, boss_kazrogal::boss_kazrogalAI, boss_rage_winterchill::boss_rage_winterchillAI, npc_apothecary_hanes::npc_Apothecary_HanesAI, npc_injured_goblin::npc_injured_goblinAI, and hyjal_trashAI.

143 {
145  return;
146 
147  if (Player* player = GetPlayerForEscort())
148  {
149  if (Group* group = player->GetGroup())
150  {
151  for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
152  if (Player* member = groupRef->GetSource())
153  if (member->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
154  member->FailQuest(m_pQuestForEscort->GetQuestId());
155  }
156  else
157  {
158  if (player->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
159  player->FailQuest(m_pQuestForEscort->GetQuestId());
160  }
161  }
162 }
Player * GetPlayerForEscort()
Definition: ScriptedEscortAI.h:109
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: ScriptedEscortAI.h:47
Quest const * m_pQuestForEscort
Definition: ScriptedEscortAI.h:125
uint32 GetQuestId() const
Definition: QuestDef.h:304
ObjectGuid m_uiPlayerGUID
Definition: ScriptedEscortAI.h:119
Definition: QuestDef.h:113
bool HasEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:96
Definition: Group.h:191
Definition: GroupReference.h:27

+ Here is the call graph for this function:

void npc_escortAI::JustRespawned ( )
overridevirtual

Reimplemented from CreatureAI.

165 {
167 
169  SetCombatMovement(true);
170 
171  //add a small delay before going to first waypoint, normal in near all cases
172  m_uiWPWaitTimer = 2500;
173 
175  me->RestoreFaction();
176 
177  Reset();
178 }
uint32 m_uiEscortState
Definition: ScriptedEscortAI.h:122
uint32 getFaction() const
Definition: Unit.h:1466
bool IsCombatMovementAllowed() const
Definition: ScriptedCreature.h:261
uint32 faction
Definition: Creature.h:97
Creature *const me
Definition: CreatureAI.h:71
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
Definition: ScriptedEscortAI.h:46
void RestoreFaction()
Definition: Unit.cpp:14277
void SetCombatMovement(bool allowMovement)
Definition: ScriptedCreature.cpp:382
void Reset() override
Definition: ScriptedCreature.h:192
uint32 m_uiWPWaitTimer
Definition: ScriptedEscortAI.h:120

+ Here is the call graph for this function:

void npc_escortAI::MoveInLineOfSight ( Unit who)
overridevirtual

Reimplemented from CreatureAI.

Reimplemented in npc_highlord_darion_mograine::npc_highlord_darion_mograineAI, npc_kservant::npc_kservantAI, npc_custodian_of_time::npc_custodian_of_timeAI, npc_skywing::npc_skywingAI, npc_lesser_doomguard::npc_lesser_doomguardAI, hyjalAI, and boss_ambassador_hellmaw::boss_ambassador_hellmawAI.

107 {
109  {
111  return;
112 
113  if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
114  return;
115 
116  if (me->IsHostileTo(who))
117  {
118  float fAttackRadius = me->GetAttackDistance(who);
119  if (me->IsWithinDistInMap(who, fAttackRadius) && me->IsWithinLOSInMap(who))
120  {
121  if (!me->GetVictim())
122  {
123  // Clear distracted state on combat
125  {
127  me->GetMotionMaster()->Clear();
128  }
129 
130  AttackStart(who);
131  }
132  else if (me->GetMap()->IsDungeon())
133  {
134  who->SetInCombatWith(me);
135  me->AddThreat(who, 0.0f);
136  }
137  }
138  }
139  }
140 }
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
Definition: Unit.cpp:10691
Definition: Unit.h:562
void AttackStart(Unit *who) override
Definition: ScriptedEscortAI.cpp:53
Map * GetMap() const
Definition: Object.h:543
void Clear(bool reset=true)
Definition: MotionMaster.h:138
bool IsWithinLOSInMap(WorldObject const *obj) const
Definition: Object.cpp:1584
#define CREATURE_Z_ATTACK_RANGE
Definition: Creature.h:459
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
bool IsDungeon() const
Definition: Map.h:395
Definition: ScriptedEscortAI.h:47
float GetDistanceZ(WorldObject const *obj) const
Definition: Object.cpp:1546
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.cpp:1663
void ClearUnitState(uint32 f)
Definition: Unit.h:1396
Creature *const me
Definition: CreatureAI.h:71
Definition: Unit.h:553
float GetAttackDistance(Unit const *player) const
Definition: Creature.cpp:1586
Unit * GetVictim() const
Definition: Unit.h:1379
bool isInAccessiblePlaceFor(Creature const *c) const
Definition: Unit.cpp:2956
bool CanFly() const override
Definition: Creature.h:500
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:7165
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
bool AssistPlayerInCombat(Unit *who)
Definition: ScriptedEscortAI.cpp:69
bool HasEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:96
bool isTargetableForAttack(bool checkFakeDeath=true) const
Definition: Unit.cpp:9987
void SetInCombatWith(Unit *enemy)
Definition: Unit.cpp:9840

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_escortAI::MovementInform ( uint32  moveType,
uint32  pointId 
)
overridevirtual

Reimplemented from CreatureAI.

324 {
326  return;
327 
328  //Combat start position reached, continue waypoint movement
329  if (pointId == POINT_LAST_POINT)
330  {
331  TC_LOG_DEBUG("scripts", "EscortAI has returned to original position before combat");
332 
335 
336  if (!m_uiWPWaitTimer)
337  m_uiWPWaitTimer = 1;
338  }
339  else if (pointId == POINT_HOME)
340  {
341  TC_LOG_DEBUG("scripts", "EscortAI has returned to original home location and will continue from beginning of waypoint list.");
342 
343  CurrentWP = WaypointList.begin();
344  m_uiWPWaitTimer = 1;
345  }
346  else
347  {
348  //Make sure that we are still on the right waypoint
349  if (CurrentWP->id != pointId)
350  {
351  TC_LOG_ERROR("misc", "TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry());
352  return;
353  }
354 
355  TC_LOG_DEBUG("scripts", "EscortAI Waypoint %u reached", CurrentWP->id);
356 
357  //Call WP function
359 
360  m_uiWPWaitTimer = CurrentWP->WaitTimeMs + 1;
361 
362  ++CurrentWP;
363  }
364 }
std::list< Escort_Waypoint > WaypointList
Definition: ScriptedEscortAI.h:127
Definition: ScriptedEscortAI.cpp:34
void RemoveEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:117
Definition: ScriptedEscortAI.cpp:33
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: ScriptedEscortAI.h:47
Creature *const me
Definition: CreatureAI.h:71
std::list< Escort_Waypoint >::iterator CurrentWP
Definition: ScriptedEscortAI.h:128
bool m_bIsRunning
Definition: ScriptedEscortAI.h:131
uint32 m_uiWPWaitTimer
Definition: ScriptedEscortAI.h:120
Definition: ScriptedEscortAI.h:48
bool SetWalk(bool enable)
Definition: Unit.cpp:15800
uint32 GetEntry() const
Definition: Object.h:107
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: MotionMaster.h:46
bool HasEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:96
virtual void WaypointReached(uint32 pointId)=0

+ Here is the call graph for this function:

void npc_escortAI::RemoveEscortState ( uint32  escortState)
inlineprivate
117 { m_uiEscortState &= ~escortState; }
uint32 m_uiEscortState
Definition: ScriptedEscortAI.h:122

+ Here is the caller graph for this function:

void npc_escortAI::ReturnToLastPoint ( )
181 {
182  float x, y, z, o;
183  me->GetHomePosition(x, y, z, o);
185 }
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
Definition: ScriptedEscortAI.cpp:33
Creature *const me
Definition: CreatureAI.h:71
void MovePoint(uint32 id, Position const &pos, bool generatePath=true)
Definition: MotionMaster.h:172
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:672

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_escortAI::SetCanAttack ( bool  attack)
inline
105 { m_bIsActiveAttacker = attack; }
bool m_bIsActiveAttacker
Definition: ScriptedEscortAI.h:130

+ Here is the caller graph for this function:

void npc_escortAI::SetDespawnAtEnd ( bool  despawn)
inline
102 { DespawnAtEnd = despawn; }
bool DespawnAtEnd
Definition: ScriptedEscortAI.h:134

+ Here is the caller graph for this function:

void npc_escortAI::SetDespawnAtFar ( bool  despawn)
inline
103 { DespawnAtFar = despawn; }
bool DespawnAtFar
Definition: ScriptedEscortAI.h:135

+ Here is the caller graph for this function:

void npc_escortAI::SetEscortPaused ( bool  on)
508 {
510  return;
511 
512  if (on)
514  else
516 }
void RemoveEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:117
Definition: ScriptedEscortAI.h:47
void AddEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:116
Definition: ScriptedEscortAI.h:49
bool HasEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:96

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_escortAI::SetMaxPlayerDistance ( float  newMax)
inline
99 { MaxPlayerDistance = newMax; }
float MaxPlayerDistance
Definition: ScriptedEscortAI.h:123
bool npc_escortAI::SetNextWaypoint ( uint32  pointId,
float  x,
float  y,
float  z,
float  orientation 
)
519 {
520  me->UpdatePosition(x, y, z, orientation);
521  return SetNextWaypoint(pointId, false, true);
522 }
Creature *const me
Definition: CreatureAI.h:71
bool SetNextWaypoint(uint32 pointId, float x, float y, float z, float orientation)
Definition: ScriptedEscortAI.cpp:518
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition: Unit.cpp:15454
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the call graph for this function:

bool npc_escortAI::SetNextWaypoint ( uint32  pointId,
bool  setPosition = true,
bool  resetWaypointsOnFail = true 
)
525 {
526  if (!WaypointList.empty())
527  WaypointList.clear();
528 
530 
531  if (WaypointList.empty())
532  return false;
533 
534  size_t const size = WaypointList.size();
535  Escort_Waypoint waypoint(0, 0, 0, 0, 0);
536  do
537  {
538  waypoint = WaypointList.front();
539  WaypointList.pop_front();
540  if (waypoint.id == pointId)
541  {
542  if (setPosition)
544 
545  CurrentWP = WaypointList.begin();
546  return true;
547  }
548  }
549  while (!WaypointList.empty());
550 
551  // we failed.
552  // we reset the waypoints in the start; if we pulled any, reset it again
553  if (resetWaypointsOnFail && size != WaypointList.size())
554  {
555  if (!WaypointList.empty())
556  WaypointList.clear();
557 
559  }
560 
561  return false;
562 }
std::list< Escort_Waypoint > WaypointList
Definition: ScriptedEscortAI.h:127
void FillPointMovementListForCreature()
Definition: ScriptedEscortAI.cpp:403
Creature *const me
Definition: CreatureAI.h:71
Definition: ScriptedEscortAI.h:26
float GetOrientation() const
Definition: Position.h:107
std::list< Escort_Waypoint >::iterator CurrentWP
Definition: ScriptedEscortAI.h:128
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition: Unit.cpp:15454
static float waypoint[6][3]
Definition: boss_alar.cpp:50

+ Here is the call graph for this function:

void npc_escortAI::SetRun ( bool  on = true)
418 {
419  if (on)
420  {
421  if (!m_bIsRunning)
422  me->SetWalk(false);
423  else
424  TC_LOG_DEBUG("scripts", "EscortAI attempt to set run mode, but is already running.");
425  }
426  else
427  {
428  if (m_bIsRunning)
429  me->SetWalk(true);
430  else
431  TC_LOG_DEBUG("scripts", "EscortAI attempt to set walk mode, but is already walking.");
432  }
433 
434  m_bIsRunning = on;
435 }
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Creature *const me
Definition: CreatureAI.h:71
bool m_bIsRunning
Definition: ScriptedEscortAI.h:131
bool SetWalk(bool enable)
Definition: Unit.cpp:15800

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_escortAI::Start ( bool  isActiveAttacker = true,
bool  run = false,
ObjectGuid  playerGUID = ObjectGuid::Empty,
Quest const quest = NULL,
bool  instantRespawn = false,
bool  canLoopPath = false,
bool  resetWaypoints = true 
)
Todo:
get rid of this many variables passed in function.
439 {
440  if (me->GetVictim())
441  {
442  TC_LOG_ERROR("misc", "TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry());
443  return;
444  }
445 
447  {
448  TC_LOG_ERROR("scripts", "EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry());
449  return;
450  }
451 
452  if (!ScriptWP && resetWaypoints) // sd2 never adds wp in script, but tc does
453  {
454  if (!WaypointList.empty())
455  WaypointList.clear();
457  }
458 
459  if (WaypointList.empty())
460  {
461  TC_LOG_ERROR("scripts", "EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).",
462  me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0);
463  return;
464  }
465 
466  //set variables
467  m_bIsActiveAttacker = isActiveAttacker;
468  m_bIsRunning = run;
469 
470  m_uiPlayerGUID = playerGUID;
471  m_pQuestForEscort = quest;
472 
473  m_bCanInstantRespawn = instantRespawn;
474  m_bCanReturnToStart = canLoopPath;
475 
477  TC_LOG_DEBUG("scripts", "EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
478 
480  {
483  TC_LOG_DEBUG("scripts", "EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
484  }
485 
486  //disable npcflags
489  {
490  HasImmuneToNPCFlags = true;
492  }
493 
494  TC_LOG_DEBUG("scripts", "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, %s", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID.ToString().c_str());
495 
496  CurrentWP = WaypointList.begin();
497 
498  //Set initial speed
499  if (m_bIsRunning)
500  me->SetWalk(false);
501  else
502  me->SetWalk(true);
503 
505 }
bool m_bIsActiveAttacker
Definition: ScriptedEscortAI.h:130
void MoveIdle()
Definition: MotionMaster.cpp:185
std::list< Escort_Waypoint > WaypointList
Definition: ScriptedEscortAI.h:127
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
void FillPointMovementListForCreature()
Definition: ScriptedEscortAI.cpp:403
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition: MotionMaster.cpp:663
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
bool HasImmuneToNPCFlags
Definition: ScriptedEscortAI.h:137
uint64_t uint64
Definition: g3dmath.h:170
Definition: ScriptedEscortAI.h:47
Creature *const me
Definition: CreatureAI.h:71
void AddEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:116
Quest const * m_pQuestForEscort
Definition: ScriptedEscortAI.h:125
bool m_bCanInstantRespawn
Definition: ScriptedEscortAI.h:132
Unit * GetVictim() const
Definition: Unit.h:1379
std::list< Escort_Waypoint >::iterator CurrentWP
Definition: ScriptedEscortAI.h:128
#define UI64FMTD
Definition: Define.h:137
bool ScriptWP
Definition: ScriptedEscortAI.h:136
Definition: Unit.h:734
bool m_bIsRunning
Definition: ScriptedEscortAI.h:131
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
Definition: Unit.h:682
ObjectGuid m_uiPlayerGUID
Definition: ScriptedEscortAI.h:119
std::string GetScriptName() const
Definition: Creature.cpp:2422
Definition: UpdateFields.h:109
bool SetWalk(bool enable)
Definition: Unit.cpp:15800
Definition: UpdateFields.h:135
bool m_bCanReturnToStart
Definition: ScriptedEscortAI.h:133
uint32 GetEntry() const
Definition: Object.h:107
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
void SetUInt64Value(uint16 index, uint64 value)
Definition: Object.cpp:1017
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
void MovementExpired(bool reset=true)
Definition: MotionMaster.h:151
Definition: MotionMaster.h:39
bool HasEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:96
std::string ToString() const
Definition: ObjectGuid.cpp:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_escortAI::UpdateAI ( uint32  diff)
overridevirtual

Reimplemented from ScriptedAI.

Reimplemented in npc_gargoyle::npc_gargoyleAI, npc_scarlet_miner::npc_scarlet_minerAI, npc_frost_wyrm::npc_frost_wyrmAI, npc_garments_of_quests::npc_garments_of_questsAI, npc_fel_stalker::npc_fel_stalkerAI, npc_mimirons_inferno::npc_mimirons_infernoAI, npc_crypt_fiend::npc_crypt_fiendAI, npc_thassarian::npc_thassarianAI, npc_banshee::npc_bansheeAI, npc_earthmender_wilda::npc_earthmender_wildaAI, npc_necromancer::npc_necromancerAI, npc_rocknot::npc_rocknotAI, npc_ghoul::npc_ghoulAI, npc_maxx_a_million_escort::npc_maxx_a_million_escortAI, npc_taretha::npc_tarethaAI, npc_highlord_darion_mograine::npc_highlord_darion_mograineAI, npc_arthas::npc_arthasAI, npc_argent_soldier::npc_argent_soldierAI, npc_lurgglbr::npc_lurgglbrAI, npc_abomination::npc_abominationAI, npc_kurenai_captive::npc_kurenai_captiveAI, npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, npc_giant_infernal::npc_giant_infernalAI, npc_demolitionist_legoso::npc_demolitionist_legosoAI, npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI, npc_icefang::npc_icefangAI, npc_engineer_helice::npc_engineer_heliceAI, npc_koltira_deathweaver::npc_koltira_deathweaverAI, npc_muglash::npc_muglashAI, npc_custodian_of_time::npc_custodian_of_timeAI, npc_barnes::npc_barnesAI, npc_skywing::npc_skywingAI, npc_lesser_doomguard::npc_lesser_doomguardAI, generic_vehicleAI_toc5::generic_vehicleAI_toc5AI, npc_grimstone::npc_grimstoneAI, npc_disciple_of_naralex::npc_disciple_of_naralexAI, npc_maghar_captive::npc_maghar_captiveAI, npc_scarlet_trainee::npc_scarlet_traineeAI, hyjalAI, boss_azgalor::boss_azgalorAI, npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI, npc_ruul_snowhoof::npc_ruul_snowhoofAI, boss_anetheron::boss_anetheronAI, boss_kazrogal::boss_kazrogalAI, boss_rage_winterchill::boss_rage_winterchillAI, npc_injured_goblin::npc_injured_goblinAI, and hyjal_trashAI.

228 {
229  //Waypoint Updating
231  {
232  if (m_uiWPWaitTimer <= diff)
233  {
234  //End of the line
235  if (CurrentWP == WaypointList.end())
236  {
237  if (DespawnAtEnd)
238  {
239  TC_LOG_DEBUG("scripts", "EscortAI reached end of waypoints");
240 
242  {
243  float fRetX, fRetY, fRetZ;
244  me->GetRespawnPosition(fRetX, fRetY, fRetZ);
245 
246  me->GetMotionMaster()->MovePoint(POINT_HOME, fRetX, fRetY, fRetZ);
247 
248  m_uiWPWaitTimer = 0;
249 
250  TC_LOG_DEBUG("scripts", "EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
251  return;
252  }
253 
255  {
257  me->Respawn();
258  }
259  else
261 
262  return;
263  }
264  else
265  {
266  TC_LOG_DEBUG("scripts", "EscortAI reached end of waypoints with Despawn off");
267 
268  return;
269  }
270  }
271 
273  {
275  TC_LOG_DEBUG("scripts", "EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
276 
278 
279  m_uiWPWaitTimer = 0;
280  }
281  }
282  else
283  m_uiWPWaitTimer -= diff;
284  }
285 
286  //Check if player or any member of his group is within range
288  {
289  if (m_uiPlayerCheckTimer <= diff)
290  {
292  {
293  TC_LOG_DEBUG("scripts", "EscortAI failed because player/group was to far away or not found");
294 
296  {
298  me->Respawn();
299  }
300  else
302 
303  return;
304  }
305 
306  m_uiPlayerCheckTimer = 1000;
307  }
308  else
309  m_uiPlayerCheckTimer -= diff;
310  }
311 
312  UpdateEscortAI(diff);
313 }
void DespawnOrUnsummon(uint32 msTimeToDespawn=0)
Definition: Creature.cpp:1774
uint32 m_uiPlayerCheckTimer
Definition: ScriptedEscortAI.h:121
std::list< Escort_Waypoint > WaypointList
Definition: ScriptedEscortAI.h:127
Definition: Unit.h:542
Definition: ScriptedEscortAI.cpp:34
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: ScriptedEscortAI.h:47
bool DespawnAtEnd
Definition: ScriptedEscortAI.h:134
bool DespawnAtFar
Definition: ScriptedEscortAI.h:135
Creature *const me
Definition: CreatureAI.h:71
void MovePoint(uint32 id, Position const &pos, bool generatePath=true)
Definition: MotionMaster.h:172
void setDeathState(DeathState s) override
Definition: Creature.cpp:1624
bool m_bCanInstantRespawn
Definition: ScriptedEscortAI.h:132
Unit * GetVictim() const
Definition: Unit.h:1379
std::list< Escort_Waypoint >::iterator CurrentWP
Definition: ScriptedEscortAI.h:128
virtual void UpdateEscortAI(uint32 diff)
Definition: ScriptedEscortAI.cpp:315
virtual void WaypointStart(uint32)
Definition: ScriptedEscortAI.h:89
void GetRespawnPosition(float &x, float &y, float &z, float *ori=nullptr, float *dist=nullptr) const
Definition: Creature.cpp:2355
void Respawn(bool force=false)
Definition: Creature.cpp:1697
ObjectGuid m_uiPlayerGUID
Definition: ScriptedEscortAI.h:119
uint32 m_uiWPWaitTimer
Definition: ScriptedEscortAI.h:120
bool IsPlayerOrGroupInRange()
Definition: ScriptedEscortAI.cpp:209
Definition: ScriptedEscortAI.h:48
Definition: ScriptedEscortAI.h:49
bool m_bCanReturnToStart
Definition: ScriptedEscortAI.h:133
bool HasEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:96
bool IsEmpty() const
Definition: ObjectGuid.h:242

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_escortAI::UpdateEscortAI ( uint32  diff)
virtual
virtual void npc_escortAI::WaypointReached ( uint32  pointId)
pure virtual

Implemented in npc_bonker_togglevolt::npc_bonker_togglevoltAI, npc_mootoo_the_younger::npc_mootoo_the_youngerAI, npc_gargoyle::npc_gargoyleAI, npc_scarlet_miner::npc_scarlet_minerAI, npc_frost_wyrm::npc_frost_wyrmAI, npc_garments_of_quests::npc_garments_of_questsAI, npc_fel_stalker::npc_fel_stalkerAI, npc_crok_scourgebane::npc_crok_scourgebaneAI, npc_mimirons_inferno::npc_mimirons_infernoAI, npc_crypt_fiend::npc_crypt_fiendAI, violet_hold_trashAI, npc_thassarian::npc_thassarianAI, npc_banshee::npc_bansheeAI, npc_necromancer::npc_necromancerAI, npc_earthmender_wilda::npc_earthmender_wildaAI, npc_rocknot::npc_rocknotAI, npc_demolitionist_legoso::npc_demolitionist_legosoAI, npc_ghoul::npc_ghoulAI, npc_maxx_a_million_escort::npc_maxx_a_million_escortAI, npc_akuno::npc_akunoAI, npc_taretha::npc_tarethaAI, npc_lurgglbr::npc_lurgglbrAI, npc_bessy::npc_bessyAI, npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI, npc_abomination::npc_abominationAI, npc_argent_soldier::npc_argent_soldierAI, npc_kurenai_captive::npc_kurenai_captiveAI, npc_highlord_darion_mograine::npc_highlord_darion_mograineAI, npc_arthas::npc_arthasAI, npc_giant_infernal::npc_giant_infernalAI, npc_isla_starmane::npc_isla_starmaneAI, npc_ranshalla::npc_ranshallaAI, npc_OOX17::npc_OOX17AI, npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI, npc_magwin::npc_magwinAI, npc_icefang::npc_icefangAI, npc_kayra_longmane::npc_kayra_longmaneAI, npc_brann_hos::npc_brann_hosAI, npc_kservant::npc_kservantAI, npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, npc_wounded_blood_elf::npc_wounded_blood_elfAI, npc_engineer_helice::npc_engineer_heliceAI, npc_koltira_deathweaver::npc_koltira_deathweaverAI, npc_onyx_flamecaller::npc_onyx_flamecallerAI, npc_muglash::npc_muglashAI, npc_lesser_doomguard::npc_lesser_doomguardAI, npc_blastmaster_emi_shortfuse::npc_blastmaster_emi_shortfuseAI, npc_skywing::npc_skywingAI, npc_morridune::npc_morriduneAI, generic_vehicleAI_toc5::generic_vehicleAI_toc5AI, npc_plaguehound_tracker::npc_plaguehound_trackerAI, npc_custodian_of_time::npc_custodian_of_timeAI, npc_grimstone::npc_grimstoneAI, npc_barnes::npc_barnesAI, npc_ancestral_wolf::npc_ancestral_wolfAI, npc_scarlet_trainee::npc_scarlet_traineeAI, npc_disciple_of_naralex::npc_disciple_of_naralexAI, hyjalAI, npc_maghar_captive::npc_maghar_captiveAI, npc_gilthares::npc_giltharesAI, npc_apothecary_hanes::npc_Apothecary_HanesAI, npc_shadowfang_prisoner::npc_shadowfang_prisonerAI, boss_azgalor::boss_azgalorAI, boss_anetheron::boss_anetheronAI, boss_kazrogal::boss_kazrogalAI, boss_rage_winterchill::boss_rage_winterchillAI, boss_ambassador_hellmaw::boss_ambassador_hellmawAI, npc_ruul_snowhoof::npc_ruul_snowhoofAI, npc_oox09hl::npc_oox09hlAI, npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI, npc_emily::npc_emilyAI, npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI, npc_deathstalker_erland::npc_deathstalker_erlandAI, npc_ranger_lilatha::npc_ranger_lilathaAI, npc_willix::npc_willixAI, and npc_injured_goblin::npc_injured_goblinAI.

+ Here is the caller graph for this function:

virtual void npc_escortAI::WaypointStart ( uint32  )
inlinevirtual

Member Data Documentation

std::list<Escort_Waypoint>::iterator npc_escortAI::CurrentWP
private
bool npc_escortAI::DespawnAtEnd
private
bool npc_escortAI::DespawnAtFar
private
bool npc_escortAI::HasImmuneToNPCFlags
private
bool npc_escortAI::m_bCanInstantRespawn
private
bool npc_escortAI::m_bCanReturnToStart
private
bool npc_escortAI::m_bIsActiveAttacker
private
bool npc_escortAI::m_bIsRunning
private
Quest const* npc_escortAI::m_pQuestForEscort
private
uint32 npc_escortAI::m_uiEscortState
private
uint32 npc_escortAI::m_uiPlayerCheckTimer
private
ObjectGuid npc_escortAI::m_uiPlayerGUID
private
uint32 npc_escortAI::m_uiWPWaitTimer
private
float npc_escortAI::MaxPlayerDistance
private
bool npc_escortAI::ScriptWP
private
std::list<Escort_Waypoint> npc_escortAI::WaypointList
private

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