AzeorthCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
npc_escortAI Struct Referenceabstract

#include "ScriptedEscortAI.h"

Inheritance diagram for npc_escortAI:
ScriptedAI CreatureAI UnitAI boss_ambassador_hellmaw::boss_ambassador_hellmawAI boss_bjarngrim::boss_bjarngrimAI boss_grand_champion::boss_grand_championAI boss_thorim_lightning_orb::boss_thorim_lightning_orbAI boss_thorim_sif_blizzard::boss_thorim_sif_blizzardAI boss_yoggsaron_cloud::boss_yoggsaron_cloudAI brann_bronzebeard::brann_bronzebeardAI hyjalAI hyjal_trashAI npc_akama_illidan::npc_akama_illidanAI npc_ame::npc_ameAI npc_ancestral_wolf::npc_ancestral_wolfAI npc_apothecary_hanes::npc_Apothecary_HanesAI npc_argent_soldier::npc_argent_soldierAI npc_arthas::npc_arthasAI npc_azure_saboteur::npc_azure_saboteurAI npc_barnes::npc_barnesAI npc_bessy::npc_bessyAI npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI npc_bonker_togglevolt::npc_bonker_togglevoltAI npc_captain_saeed::npc_captain_saeedAI npc_clintar_spirit::npc_clintar_spiritAI npc_cork_gizelton::npc_cork_gizeltonAI npc_corporal_keeshan::npc_corporal_keeshanAI npc_crok_scourgebane::npc_crok_scourgebaneAI npc_custodian_of_time::npc_custodian_of_timeAI npc_daphne_stilwell::npc_daphne_stilwellAI npc_deathstalker_erland::npc_deathstalker_erlandAI npc_earthmender_wilda::npc_earthmender_wildaAI npc_emily::npc_emilyAI npc_engineer_helice::npc_engineer_heliceAI npc_frosthound::npc_frosthoundAI npc_garments_of_quests::npc_garments_of_questsAI npc_general_andorov npc_gilthares::npc_giltharesAI npc_grimstone::npc_grimstoneAI npc_icefang::npc_icefangAI npc_isla_starmane::npc_isla_starmaneAI npc_kaya_flathoof::npc_kaya_flathoofAI npc_kayra_longmane::npc_kayra_longmaneAI npc_koltira_deathweaver::npc_koltira_deathweaverAI npc_kservant::npc_kservantAI npc_kurenai_captive::npc_kurenai_captiveAI npc_lakota_windsong::npc_lakota_windsongAI npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI npc_lurgglbr::npc_lurgglbrAI npc_maghar_captive::npc_maghar_captiveAI npc_magwin::npc_magwinAI npc_maxx_a_million_escort::npc_maxx_a_million_escortAI npc_mimirons_inferno::npc_mimirons_infernoAI npc_mootoo_the_younger::npc_mootoo_the_youngerAI npc_muglash::npc_muglashAI npc_onyx_flamecaller::npc_onyx_flamecallerAI npc_paoka_swiftmountain::npc_paoka_swiftmountainAI npc_plaguehound_tracker::npc_plaguehound_trackerAI npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI npc_prospector_remtravel::npc_prospector_remtravelAI npc_ranger_lilatha npc_ranshalla::npc_ranshallaAI npc_rinji::npc_rinjiAI npc_rocknot::npc_rocknotAI npc_scarlet_miner::npc_scarlet_minerAI npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI npc_taretha::npc_tarethaAI npc_thrall_bfu::npc_thrall_bfuAI npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI npc_tyrion_spybot::npc_tyrion_spybotAI npc_varian_wrynn::npc_varian_wrynnAI npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI npc_wounded_blood_elf::npc_wounded_blood_elfAI violet_hold_trashAI

Public Member Functions

 npc_escortAI (Creature *creature)
 
 ~npc_escortAI () override
 
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 GetWaypointPosition (uint32 pointId, float &x, float &y, float &z)
 
void GenerateWaypointArray (Movement::PointsArray *points)
 
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=nullptr, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
 
void SetRun (bool on=true)
 
void SetEscortPaused (bool on)
 
bool HasEscortState (uint32 escortState)
 
bool IsEscorted () override
 
void SetMaxPlayerDistance (float newMax)
 
float GetMaxPlayerDistance ()
 
void SetDespawnAtEnd (bool despawn)
 
void SetDespawnAtFar (bool despawn)
 
bool GetAttack ()
 
void SetCanAttack (bool attack)
 
ObjectGuid GetEventStarterGUID ()
 
void AddEscortState (uint32 escortState)
 
void RemoveEscortState (uint32 escortState)
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 
void UpdateAI (uint32 diff) 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 MovementInform (uint32, uint32) override
 
void OnPossess (bool)
 
bool IsInRoom (const Position *pos, Axis axis, bool above)
 
void Reset () override
 
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 DoPlayMusic (uint32 soundId, bool zone)
 
void DoAddThreat (Unit *unit, float amount)
 
void DoModifyThreatByPercent (Unit *unit, int32 pct)
 
void DoResetThreat (Unit *unit)
 
void DoResetThreatList ()
 
float DoGetThreat (Unit *unit)
 
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 const * SelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, 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
 
virtual bool CheckEvadeIfOutOfCombatArea () 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
 
PlayerSelectTargetFromPlayerList (float maxdist, uint32 excludeAura=0, bool mustBeInLOS=false) const
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr)
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
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 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 SummonedCreatureDespawnAll ()
 
virtual void SpellHit (Unit *, SpellInfo const *)
 
virtual void SpellHitTarget (Unit *, SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.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 bool BeforeSpellClick (Unit *)
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual bool CanAlwaysBeDetectable (WorldObject const *)
 
virtual void PetStopAttack ()
 
virtual bool CheckInRoom ()
 
CreatureBoundary const * GetBoundary () const
 
void SetBoundary (CreatureBoundary const *boundary, bool negativeBoundaries=false)
 
bool IsInBoundary (Position const *who=nullptr) const
 
virtual void CalculateThreat (Unit *, float &, SpellInfo const *)
 
virtual bool OnTeleportUnreacheablePlayer (Player *)
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void AttackStart (Unit *)
 
virtual void UpdateAI (uint32)=0
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 
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 (SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position=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 position, PREDICATE const &predicate)
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void HealDone (Unit *, uint32 &)
 
void AttackStartCaster (Unit *victim, float dist)
 
SpellCastResult DoAddAuraToAllHostilePlayers (uint32 spellid)
 
SpellCastResult DoCast (uint32 spellId)
 
SpellCastResult DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastSelf (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastToAllHostilePlayers (uint32 spellid, bool triggered=false)
 
SpellCastResult DoCastVictim (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastAOE (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastRandomTarget (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 
float DoGetSpellMaxRange (uint32 spellId, bool positive=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spell)
 
void DoSpellAttackToRandomTargetIfReady (uint32 spell, uint32 threatTablePosition=0, float dist=0.f, bool playerOnly=true)
 
virtual void SummonMovementInform (Creature *, uint32, uint32)
 
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 sQuestComplete (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual void sOnGameEvent (bool, uint16)
 
virtual std::string GetDebugInfo () const
 

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)
 
virtual void MoveInLineOfSight (Unit *)
 
bool _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 

Private Member Functions

bool AssistPlayerInCombatAgainst (Unit *who)
 
bool IsPlayerOrGroupInRange ()
 
void FillPointMovementListForCreature ()
 

Private Attributes

ObjectGuid m_uiPlayerGUID
 
uint32 m_uiWPWaitTimer
 
uint32 m_uiPlayerCheckTimer
 
uint32 m_uiEscortState
 
float MaxPlayerDistance
 
Quest const * m_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 ScriptedAI
enum class  Axis {
  AXIS_X ,
  AXIS_Y
}
 
- Public Types inherited from CreatureAI
enum  EvadeReason {
  EVADE_REASON_NO_HOSTILES ,
  EVADE_REASON_BOUNDARY ,
  EVADE_REASON_SEQUENCE_BREAK ,
  EVADE_REASON_NO_PATH ,
  EVADE_REASON_OTHER
}
 
- Static Public Member Functions inherited from CreatureAI
static bool IsInBounds (CreatureBoundary const &boundary, Position const *who)
 
- Static Public Member Functions inherited from UnitAI
static void FillAISpellInfo ()
 
- Public Attributes inherited from ScriptedAI
Creatureme
 
bool IsFleeing
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
EventMap events
 
CreatureBoundary const * _boundary
 
bool _negateBoundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_escortAI()

npc_escortAI::npc_escortAI ( Creature creature)
explicit
36 : ScriptedAI(creature),
37 m_uiWPWaitTimer(1000),
41 m_pQuestForEscort(nullptr),
43 m_bIsRunning(false),
46 DespawnAtEnd(true),
47 DespawnAtFar(true),
48 ScriptWP(false),
50{}
#define DEFAULT_MAX_PLAYER_DISTANCE
Definition: ScriptedEscortAI.h:24
@ STATE_ESCORT_NONE
Definition: ScriptedEscortAI.h:46
Definition: ScriptedCreature.h:177
float MaxPlayerDistance
Definition: ScriptedEscortAI.h:125
bool m_bCanReturnToStart
Definition: ScriptedEscortAI.h:135
uint32 m_uiPlayerCheckTimer
Definition: ScriptedEscortAI.h:123
uint32 m_uiEscortState
Definition: ScriptedEscortAI.h:124
bool DespawnAtFar
Definition: ScriptedEscortAI.h:137
bool m_bIsActiveAttacker
Definition: ScriptedEscortAI.h:132
uint32 m_uiWPWaitTimer
Definition: ScriptedEscortAI.h:122
bool ScriptWP
Definition: ScriptedEscortAI.h:138
bool m_bCanInstantRespawn
Definition: ScriptedEscortAI.h:134
bool m_bIsRunning
Definition: ScriptedEscortAI.h:133
bool DespawnAtEnd
Definition: ScriptedEscortAI.h:136
bool HasImmuneToNPCFlags
Definition: ScriptedEscortAI.h:139
Quest const * m_pQuestForEscort
Definition: ScriptedEscortAI.h:127

◆ ~npc_escortAI()

npc_escortAI::~npc_escortAI ( )
inlineoverride
56{}

Member Function Documentation

◆ AddEscortState()

◆ AddWaypoint()

void npc_escortAI::AddWaypoint ( uint32  id,
float  x,
float  y,
float  z,
uint32  waitTime = 0 
)
398{
399 Escort_Waypoint t(id, x, y, z, waitTime);
400
401 WaypointList.push_back(t);
402
403 // i think SD2 no longer uses this function
404 ScriptWP = true;
405 /*PointMovement wp;
406 wp.m_uiCreatureEntry = me->GetEntry();
407 wp.m_uiPointId = id;
408 wp.m_fX = x;
409 wp.m_fY = y;
410 wp.m_fZ = z;
411 wp.m_uiWaitTime = WaitTimeMs;
412 PointMovementMap[wp.m_uiCreatureEntry].push_back(wp);*/
413}
Definition: ScriptedEscortAI.h:27
std::list< Escort_Waypoint > WaypointList
Definition: ScriptedEscortAI.h:129

References ScriptWP, and WaypointList.

Referenced by npc_onyx_flamecaller::npc_onyx_flamecallerAI::AddWaypoints(), boss_bjarngrim::boss_bjarngrimAI::boss_bjarngrimAI(), npc_scarlet_miner::npc_scarlet_minerAI::InitWaypoint(), boss_thorim_lightning_orb::boss_thorim_lightning_orbAI::InitWaypoint(), boss_thorim_sif_blizzard::boss_thorim_sif_blizzardAI::InitWaypoint(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::InitWaypoint(), hyjalAI::Retreat(), boss_grand_champion::boss_grand_championAI::SetData(), npc_argent_soldier::npc_argent_soldierAI::SetData(), npc_clintar_spirit::npc_clintar_spiritAI::StartEvent(), boss_anetheron::boss_anetheronAI::UpdateAI(), boss_azgalor::boss_azgalorAI::UpdateAI(), boss_kazrogal::boss_kazrogalAI::UpdateAI(), boss_rage_winterchill::boss_rage_winterchillAI::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), npc_abomination::npc_abominationAI::UpdateAI(), npc_ghoul::npc_ghoulAI::UpdateAI(), npc_necromancer::npc_necromancerAI::UpdateAI(), npc_banshee::npc_bansheeAI::UpdateAI(), npc_crypt_fiend::npc_crypt_fiendAI::UpdateAI(), npc_fel_stalker::npc_fel_stalkerAI::UpdateAI(), npc_frost_wyrm::npc_frost_wyrmAI::UpdateAI(), npc_gargoyle::npc_gargoyleAI::UpdateAI(), hyjal_trashAI::UpdateAI(), violet_hold_trashAI::UpdateAI(), and npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI().

◆ AssistPlayerInCombatAgainst()

bool npc_escortAI::AssistPlayerInCombatAgainst ( Unit who)
private
74{
75 if (!who || !who->GetVictim())
76 {
77 return false;
78 }
79
81 {
82 return false;
83 }
84
85 //experimental (unknown) flag not present
87 {
88 return false;
89 }
90
91 //not a player
93 {
94 return false;
95 }
96
97 if (!who->isInAccessiblePlaceFor(me))
98 {
99 return false;
100 }
101
102 if (!CanAIAttack(who))
103 {
104 return false;
105 }
106
107 // we cannot attack in evade mode
108 if (me->IsInEvadeMode())
109 {
110 return false;
111 }
112
113 // or if enemy is in evade mode
114 if (who->GetTypeId() == TYPEID_UNIT && who->ToCreature()->IsInEvadeMode())
115 {
116 return false;
117 }
118
119 //never attack friendly
120 if (!me->IsValidAttackTarget(who))
121 {
122 return false;
123 }
124
125 //too far away and no free sight?
127 {
128 AttackStart(who);
129 return true;
130 }
131
132 return false;
133}
@ TYPEID_UNIT
Definition: ObjectGuid.h:37
@ REACT_PASSIVE
Definition: Unit.h:1023
@ CREATURE_TYPE_FLAG_CAN_ASSIST
Definition: SharedDefines.h:2679
virtual bool CanAIAttack(Unit const *) const
Definition: UnitAI.h:189
Creature * me
Definition: ScriptedCreature.h:267
float GetMaxPlayerDistance()
Definition: ScriptedEscortAI.h:102
void AttackStart(Unit *who) override
Definition: ScriptedEscortAI.cpp:52
bool HasReactState(ReactStates state) const
Definition: Creature.h:90
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:196
bool IsInEvadeMode() const
Definition: Creature.h:128
uint32 type_flags
Definition: CreatureData.h:216
TypeID GetTypeId() const
Definition: Object.h:121
Creature * ToCreature()
Definition: Object.h:197
bool IsWithinLOSInMap(WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
Definition: Object.cpp:1347
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1321
bool IsValidAttackTarget(Unit const *target) const
Definition: Unit.cpp:13764
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:10564
bool isInAccessiblePlaceFor(Creature const *c) const
Definition: Unit.cpp:4121
Unit * GetVictim() const
Definition: Unit.h:1386

References AttackStart(), UnitAI::CanAIAttack(), CREATURE_TYPE_FLAG_CAN_ASSIST, Unit::GetCharmerOrOwnerPlayerOrPlayerItself(), Creature::GetCreatureTemplate(), GetMaxPlayerDistance(), Object::GetTypeId(), Unit::GetVictim(), Creature::HasReactState(), Unit::isInAccessiblePlaceFor(), Creature::IsInEvadeMode(), Unit::IsValidAttackTarget(), WorldObject::IsWithinDistInMap(), WorldObject::IsWithinLOSInMap(), ScriptedAI::me, REACT_PASSIVE, Object::ToCreature(), CreatureTemplate::type_flags, and TYPEID_UNIT.

Referenced by MoveInLineOfSight().

◆ AttackStart()

void npc_escortAI::AttackStart ( Unit who)
overridevirtual

Reimplemented from ScriptedAI.

Reimplemented in npc_taretha::npc_tarethaAI, npc_mimirons_inferno::npc_mimirons_infernoAI, boss_thorim_lightning_orb::boss_thorim_lightning_orbAI, boss_thorim_sif_blizzard::boss_thorim_sif_blizzardAI, boss_yoggsaron_cloud::boss_yoggsaron_cloudAI, npc_frosthound::npc_frosthoundAI, npc_icefang::npc_icefangAI, npc_koltira_deathweaver::npc_koltira_deathweaverAI, npc_daphne_stilwell::npc_daphne_stilwellAI, violet_hold_trashAI, and boss_ambassador_hellmaw::boss_ambassador_hellmawAI.

53{
54 if (!who)
55 return;
56
57 if (me->Attack(who, true))
58 {
60 if (type == ESCORT_MOTION_TYPE || type == POINT_MOTION_TYPE)
61 {
63 //me->DisableSpline();
64 me->StopMoving();
65 }
66
69 }
70}
@ MOTION_SLOT_ACTIVE
Definition: MotionMaster.h:62
MovementGeneratorType
Definition: MotionMaster.h:36
@ ESCORT_MOTION_TYPE
Definition: MotionMaster.h:55
@ POINT_MOTION_TYPE
Definition: MotionMaster.h:46
bool IsCombatMovementAllowed() const
Definition: ScriptedCreature.h:355
MotionMaster * GetMotionMaster()
Definition: Unit.h:2260
void StopMoving()
Definition: Unit.cpp:16754
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:10233
MovementGeneratorType GetMotionSlotType(int slot) const
Definition: MotionMaster.cpp:825
void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Definition: MotionMaster.cpp:299
void MovementExpired(bool reset=true)
Definition: MotionMaster.h:178

References Unit::Attack(), ESCORT_MOTION_TYPE, Unit::GetMotionMaster(), MotionMaster::GetMotionSlotType(), ScriptedAI::IsCombatMovementAllowed(), ScriptedAI::me, MOTION_SLOT_ACTIVE, MotionMaster::MoveChase(), MotionMaster::MovementExpired(), POINT_MOTION_TYPE, and Unit::StopMoving().

Referenced by AssistPlayerInCombatAgainst(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::AttackedBy(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::AttackStart(), boss_ambassador_hellmaw::boss_ambassador_hellmawAI::AttackStart(), npc_clintar_spirit::npc_clintar_spiritAI::EnterEvadeMode(), npc_akama_illidan::npc_akama_illidanAI::JustSummoned(), MoveInLineOfSight(), npc_lesser_doomguard::npc_lesser_doomguardAI::MoveInLineOfSight(), npc_general_andorov::MoveInLineOfSight(), npc_captain_saeed::npc_captain_saeedAI::MoveInLineOfSight(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_arthas::npc_arthasAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_captain_saeed::npc_captain_saeedAI::UpdateAI(), npc_akama_illidan::npc_akama_illidanAI::UpdateEscortAI(), npc_ranger_lilatha::WaypointReached(), and npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached().

◆ EnterEvadeMode()

void npc_escortAI::EnterEvadeMode ( EvadeReason  = EVADE_REASON_OTHER)
overridevirtual

Reimplemented from CreatureAI.

Reimplemented in npc_cork_gizelton::npc_cork_gizeltonAI, npc_clintar_spirit::npc_clintar_spiritAI, npc_captain_saeed::npc_captain_saeedAI, npc_koltira_deathweaver::npc_koltira_deathweaverAI, npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, npc_varian_wrynn::npc_varian_wrynnAI, npc_thrall_bfu::npc_thrall_bfuAI, npc_onyx_flamecaller::npc_onyx_flamecallerAI, boss_grand_champion::boss_grand_championAI, boss_thorim_lightning_orb::boss_thorim_lightning_orbAI, violet_hold_trashAI, npc_frosthound::npc_frosthoundAI, npc_icefang::npc_icefangAI, and hyjalAI.

202{
205 me->CombatStop(true);
206 me->SetLootRecipient(nullptr);
207
209 {
212 LOG_DEBUG("scripts.ai", "EscortAI has left combat and is now returning to last point");
213 }
214 else
215 {
218 me->SetImmuneToNPC(true);
219 Reset();
220 }
221}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:171
@ STATE_ESCORT_ESCORTING
Definition: ScriptedEscortAI.h:47
@ STATE_ESCORT_RETURNING
Definition: ScriptedEscortAI.h:48
void Reset() override
Definition: ScriptedCreature.h:277
bool HasEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:98
void AddEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:110
void ReturnToLastPoint()
Definition: ScriptedEscortAI.cpp:193
void ClearAllThreat()
Definition: ThreatMgr.cpp:418
void SetLootRecipient(Unit *unit, bool withGroup=true)
Definition: Creature.cpp:1276
void CombatStop(bool includingCast=false)
Definition: Unit.cpp:10389
void SetImmuneToNPC(bool apply, bool keepCombat=false)
Definition: Unit.cpp:13520
void RemoveAllAuras()
Definition: Unit.cpp:5227
ThreatMgr & GetThreatMgr()
Definition: Unit.h:2145
void MoveTargetedHome()
Definition: MotionMaster.cpp:251

References AddEscortState(), ThreatMgr::ClearAllThreat(), Unit::CombatStop(), Unit::GetMotionMaster(), Unit::GetThreatMgr(), HasEscortState(), HasImmuneToNPCFlags, LOG_DEBUG, ScriptedAI::me, MotionMaster::MoveTargetedHome(), Unit::RemoveAllAuras(), ScriptedAI::Reset(), ReturnToLastPoint(), Unit::SetImmuneToNPC(), Creature::SetLootRecipient(), STATE_ESCORT_ESCORTING, and STATE_ESCORT_RETURNING.

Referenced by npc_arthas::npc_arthasAI::DoAction(), npc_cork_gizelton::npc_cork_gizeltonAI::EnterEvadeMode(), npc_clintar_spirit::npc_clintar_spiritAI::EnterEvadeMode(), npc_captain_saeed::npc_captain_saeedAI::EnterEvadeMode(), npc_barnes::npc_barnesAI::UpdateAI(), and boss_ambassador_hellmaw::boss_ambassador_hellmawAI::UpdateAI().

◆ FillPointMovementListForCreature()

void npc_escortAI::FillPointMovementListForCreature ( )
private
416{
417 ScriptPointVector const& movePoints = sScriptSystemMgr->GetPointMoveList(me->GetEntry());
418 if (movePoints.empty())
419 return;
420
421 ScriptPointVector::const_iterator itrEnd = movePoints.end();
422 for (ScriptPointVector::const_iterator itr = movePoints.begin(); itr != itrEnd; ++itr)
423 {
424 Escort_Waypoint point(itr->uiPointId, itr->fX, itr->fY, itr->fZ, itr->uiWaitTime);
425 WaypointList.push_back(point);
426 }
427}
#define sScriptSystemMgr
Definition: ScriptSystem.h:91
std::vector< ScriptPointMove > ScriptPointVector
Definition: ScriptSystem.h:59
uint32 GetEntry() const
Definition: Object.h:109

References Object::GetEntry(), ScriptedAI::me, sScriptSystemMgr, and WaypointList.

Referenced by SetNextWaypoint(), and Start().

◆ GenerateWaypointArray()

void npc_escortAI::GenerateWaypointArray ( Movement::PointsArray points)
586{
587 if (WaypointList.empty())
588 return;
589
590 uint32 startingWaypointId = CurrentWP->id;
591
592 // Flying unit, just fill array
594 {
595 // xinef: first point in vector is unit real position
596 points->clear();
597 points->push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
598 for (std::list<Escort_Waypoint>::const_iterator itr = CurrentWP; itr != WaypointList.end(); ++itr)
599 points->push_back(G3D::Vector3(itr->x, itr->y, itr->z));
600 }
601 else
602 {
603 for (float size = 1.0f; size; size *= 0.5f)
604 {
605 std::vector<G3D::Vector3> pVector;
606 // xinef: first point in vector is unit real position
607 pVector.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
608 uint32 length = (WaypointList.size() - startingWaypointId) * size;
609
610 uint32 cnt = 0;
611 for (std::list<Escort_Waypoint>::const_iterator itr = CurrentWP; itr != WaypointList.end() && cnt <= length; ++itr, ++cnt)
612 pVector.push_back(G3D::Vector3(itr->x, itr->y, itr->z));
613
614 if (pVector.size() > 2) // more than source + dest
615 {
616 G3D::Vector3 middle = (pVector[0] + pVector[pVector.size() - 1]) / 2.f;
617 G3D::Vector3 offset;
618
619 bool continueLoop = false;
620 for (uint32 i = 1; i < pVector.size() - 1; ++i)
621 {
622 offset = middle - pVector[i];
623 if (std::fabs(offset.x) >= 0xFF || std::fabs(offset.y) >= 0xFF || std::fabs(offset.z) >= 0x7F)
624 {
625 // offset is too big, split points
626 continueLoop = true;
627 break;
628 }
629 }
630 if (continueLoop)
631 continue;
632 }
633 // everything ok
634 *points = pVector;
635 break;
636 }
637 }
638}
std::uint32_t uint32
Definition: Define.h:108
MovementFlags
Definition: Unit.h:550
@ MOVEMENTFLAG_DISABLE_GRAVITY
Definition: Unit.h:562
@ MOVEMENTFLAG_CAN_FLY
Definition: Unit.h:576
std::list< Escort_Waypoint >::iterator CurrentWP
Definition: ScriptedEscortAI.h:130
bool HasMovementFlag(uint32 flag) const
Definition: Object.h:322
MovementInfo m_movementInfo
Definition: Object.h:595
float GetPositionZ() const
Definition: Position.h:119
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118

References CurrentWP, Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), MovementInfo::HasMovementFlag(), WorldObject::m_movementInfo, ScriptedAI::me, MOVEMENTFLAG_CAN_FLY, MOVEMENTFLAG_DISABLE_GRAVITY, and WaypointList.

Referenced by UpdateAI().

◆ GetAttack()

bool npc_escortAI::GetAttack ( )
inline

◆ GetEventStarterGUID()

ObjectGuid npc_escortAI::GetEventStarterGUID ( )
inline
108{ return m_uiPlayerGUID; }
ObjectGuid m_uiPlayerGUID
Definition: ScriptedEscortAI.h:121

References m_uiPlayerGUID.

◆ GetMaxPlayerDistance()

float npc_escortAI::GetMaxPlayerDistance ( )
inline

◆ GetPlayerForEscort()

Player * npc_escortAI::GetPlayerForEscort ( )
inlineprotected
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:225

References ObjectAccessor::GetPlayer(), m_uiPlayerGUID, and ScriptedAI::me.

Referenced by npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::EnterCombat(), npc_muglash::npc_muglashAI::EnterCombat(), IsPlayerOrGroupInRange(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), JustDied(), npc_muglash::npc_muglashAI::JustDied(), npc_ame::npc_ameAI::JustDied(), npc_mootoo_the_younger::npc_mootoo_the_youngerAI::JustDied(), npc_bonker_togglevolt::npc_bonker_togglevoltAI::JustDied(), npc_apothecary_hanes::npc_Apothecary_HanesAI::JustDied(), npc_engineer_helice::npc_engineer_heliceAI::JustDied(), npc_maghar_captive::npc_maghar_captiveAI::JustDied(), npc_kurenai_captive::npc_kurenai_captiveAI::JustDied(), npc_captain_saeed::npc_captain_saeedAI::JustDied(), npc_bessy::npc_bessyAI::JustDied(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::JustDied(), npc_isla_starmane::npc_isla_starmaneAI::JustDied(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::JustSummoned(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::JustSummoned(), npc_captain_saeed::npc_captain_saeedAI::MoveInLineOfSight(), npc_daphne_stilwell::npc_daphne_stilwellAI::SummonedCreatureDies(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_lurgglbr::npc_lurgglbrAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::UpdateAI(), npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI::UpdateAI(), npc_tyrion_spybot::npc_tyrion_spybotAI::UpdateAI(), npc_rinji::npc_rinjiAI::UpdateEscortAI(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::UpdateEscortAI(), npc_captain_saeed::npc_captain_saeedAI::WaypointReached(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::WaypointReached(), npc_ranger_lilatha::WaypointReached(), npc_rinji::npc_rinjiAI::WaypointReached(), npc_corporal_keeshan::npc_corporal_keeshanAI::WaypointReached(), npc_deathstalker_erland::npc_deathstalker_erlandAI::WaypointReached(), npc_varian_wrynn::npc_varian_wrynnAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_muglash::npc_muglashAI::WaypointReached(), npc_magwin::npc_magwinAI::WaypointReached(), npc_prospector_remtravel::npc_prospector_remtravelAI::WaypointReached(), npc_kaya_flathoof::npc_kaya_flathoofAI::WaypointReached(), npc_custodian_of_time::npc_custodian_of_timeAI::WaypointReached(), npc_gilthares::npc_giltharesAI::WaypointReached(), npc_lakota_windsong::npc_lakota_windsongAI::WaypointReached(), npc_paoka_swiftmountain::npc_paoka_swiftmountainAI::WaypointReached(), npc_ame::npc_ameAI::WaypointReached(), npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached(), npc_bonker_togglevolt::npc_bonker_togglevoltAI::WaypointReached(), npc_emily::npc_emilyAI::WaypointReached(), npc_apothecary_hanes::npc_Apothecary_HanesAI::WaypointReached(), npc_engineer_helice::npc_engineer_heliceAI::WaypointReached(), npc_frosthound::npc_frosthoundAI::WaypointReached(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::WaypointReached(), npc_maghar_captive::npc_maghar_captiveAI::WaypointReached(), npc_kurenai_captive::npc_kurenai_captiveAI::WaypointReached(), npc_bessy::npc_bessyAI::WaypointReached(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::WaypointReached(), npc_earthmender_wilda::npc_earthmender_wildaAI::WaypointReached(), npc_kservant::npc_kservantAI::WaypointReached(), npc_isla_starmane::npc_isla_starmaneAI::WaypointReached(), npc_kayra_longmane::npc_kayra_longmaneAI::WaypointReached(), and npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::WaypointStart().

◆ GetWaypointPosition()

bool npc_escortAI::GetWaypointPosition ( uint32  pointId,
float &  x,
float &  y,
float &  z 
)
566{
567 ScriptPointVector const& waypoints = sScriptSystemMgr->GetPointMoveList(me->GetEntry());
568 if (waypoints.empty())
569 return false;
570
571 for (ScriptPointVector::const_iterator itr = waypoints.begin(); itr != waypoints.end(); ++itr)
572 {
573 if (itr->uiPointId == pointId)
574 {
575 x = itr->fX;
576 y = itr->fY;
577 z = itr->fZ;
578 return true;
579 }
580 }
581
582 return false;
583}

References Object::GetEntry(), ScriptedAI::me, and sScriptSystemMgr.

◆ HasEscortState()

bool npc_escortAI::HasEscortState ( uint32  escortState)
inline
98{ return (m_uiEscortState & escortState); }

References m_uiEscortState.

Referenced by npc_koltira_deathweaver::npc_koltira_deathweaverAI::AttackStart(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::EnterCombat(), npc_muglash::npc_muglashAI::EnterCombat(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::EnterCombat(), npc_rinji::npc_rinjiAI::EnterCombat(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), EnterEvadeMode(), JustDied(), npc_muglash::npc_muglashAI::JustDied(), npc_engineer_helice::npc_engineer_heliceAI::JustDied(), npc_maghar_captive::npc_maghar_captiveAI::JustDied(), npc_kurenai_captive::npc_kurenai_captiveAI::JustDied(), MoveInLineOfSight(), npc_custodian_of_time::npc_custodian_of_timeAI::MoveInLineOfSight(), MovementInform(), npc_rocknot::npc_rocknotAI::Reset(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::Reset(), npc_varian_wrynn::npc_varian_wrynnAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::Reset(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::Reset(), npc_lurgglbr::npc_lurgglbrAI::Reset(), SetEscortPaused(), Start(), UpdateAI(), npc_barnes::npc_barnesAI::UpdateAI(), npc_corporal_keeshan::npc_corporal_keeshanAI::UpdateAI(), npc_muglash::npc_muglashAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::UpdateAI(), npc_engineer_helice::npc_engineer_heliceAI::UpdateAI(), and npc_rinji::npc_rinjiAI::UpdateEscortAI().

◆ IsEscorted()

bool npc_escortAI::IsEscorted ( )
inlineoverridevirtual

Reimplemented from CreatureAI.

References m_uiEscortState, and STATE_ESCORT_ESCORTING.

◆ IsPlayerOrGroupInRange()

bool npc_escortAI::IsPlayerOrGroupInRange ( )
private
224{
225 if (Player* player = GetPlayerForEscort())
226 {
227 if (Group* group = player->GetGroup())
228 {
229 for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
230 if (Player* member = groupRef->GetSource())
231 if (me->IsWithinDistInMap(member, GetMaxPlayerDistance(), true, false))
232 return true;
233 }
234 else if (me->IsWithinDistInMap(player, GetMaxPlayerDistance(), true, false))
235 return true;
236 }
237
238 return false;
239}
Player * GetPlayerForEscort()
Definition: ScriptedEscortAI.h:114
Definition: Player.h:1046
Definition: Group.h:168
Definition: GroupReference.h:27
GroupReference * next()
Definition: GroupReference.h:36

References GetMaxPlayerDistance(), GetPlayerForEscort(), WorldObject::IsWithinDistInMap(), ScriptedAI::me, and GroupReference::next().

Referenced by UpdateAI().

◆ JustDied()

void npc_escortAI::JustDied ( Unit )
overridevirtual

Reimplemented from ScriptedAI.

Reimplemented in npc_lesser_doomguard::npc_lesser_doomguardAI, npc_frost_wyrm::npc_frost_wyrmAI, hyjal_trashAI, hyjalAI, npc_arthas::npc_arthasAI, npc_muglash::npc_muglashAI, npc_clintar_spirit::npc_clintar_spiritAI, npc_ame::npc_ameAI, npc_argent_soldier::npc_argent_soldierAI, boss_bjarngrim::boss_bjarngrimAI, brann_bronzebeard::brann_bronzebeardAI, violet_hold_trashAI, npc_mootoo_the_younger::npc_mootoo_the_youngerAI, npc_bonker_togglevolt::npc_bonker_togglevoltAI, npc_apothecary_hanes::npc_Apothecary_HanesAI, npc_engineer_helice::npc_engineer_heliceAI, npc_frosthound::npc_frosthoundAI, npc_icefang::npc_icefangAI, boss_ambassador_hellmaw::boss_ambassador_hellmawAI, npc_maghar_captive::npc_maghar_captiveAI, npc_kurenai_captive::npc_kurenai_captiveAI, npc_captain_saeed::npc_captain_saeedAI, npc_bessy::npc_bessyAI, npc_maxx_a_million_escort::npc_maxx_a_million_escortAI, npc_isla_starmane::npc_isla_starmaneAI, boss_anetheron::boss_anetheronAI, boss_azgalor::boss_azgalorAI, boss_kazrogal::boss_kazrogalAI, boss_rage_winterchill::boss_rage_winterchillAI, npc_gargoyle::npc_gargoyleAI, npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, npc_general_andorov, and npc_cork_gizelton::npc_cork_gizeltonAI.

156{
158 return;
159
160 if (Player* player = GetPlayerForEscort())
161 {
162 if (Group* group = player->GetGroup())
163 {
164 for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
165 if (Player* member = groupRef->GetSource())
166 if (member->IsInMap(player) && member->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
167 member->FailQuest(m_pQuestForEscort->GetQuestId());
168 }
169 else
170 {
171 if (player->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
172 player->FailQuest(m_pQuestForEscort->GetQuestId());
173 }
174 }
175}
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:103
uint32 GetQuestId() const
Definition: QuestDef.h:225

References GetPlayerForEscort(), Quest::GetQuestId(), HasEscortState(), m_pQuestForEscort, m_uiPlayerGUID, GroupReference::next(), QUEST_STATUS_INCOMPLETE, and STATE_ESCORT_ESCORTING.

Referenced by npc_cork_gizelton::npc_cork_gizeltonAI::JustDied().

◆ JustRespawned()

void npc_escortAI::JustRespawned ( )
overridevirtual

Reimplemented from CreatureAI.

Reimplemented in npc_rinji::npc_rinjiAI, and npc_cork_gizelton::npc_cork_gizeltonAI.

178{
180
182 SetCombatMovement(true);
183
184 //add a small delay before going to first waypoint, normal in near all cases
185 m_uiWPWaitTimer = 1000;
186
189
190 Reset();
191}
@ STATE_ESCORT_PAUSED
Definition: ScriptedEscortAI.h:49
void SetCombatMovement(bool allowMovement)
Definition: ScriptedCreature.cpp:513
void RemoveEscortState(uint32 escortState)
Definition: ScriptedEscortAI.h:111
uint32 faction
Definition: CreatureData.h:191
void RestoreFaction()
Definition: Unit.cpp:18750
uint32 GetFaction() const
Definition: Unit.h:1496

References CreatureTemplate::faction, Creature::GetCreatureTemplate(), Unit::GetFaction(), ScriptedAI::IsCombatMovementAllowed(), m_uiWPWaitTimer, ScriptedAI::me, RemoveEscortState(), ScriptedAI::Reset(), Unit::RestoreFaction(), ScriptedAI::SetCombatMovement(), STATE_ESCORT_ESCORTING, STATE_ESCORT_PAUSED, and STATE_ESCORT_RETURNING.

Referenced by npc_rinji::npc_rinjiAI::JustRespawned(), and npc_cork_gizelton::npc_cork_gizeltonAI::JustRespawned().

◆ MoveInLineOfSight()

void npc_escortAI::MoveInLineOfSight ( Unit who)
overridevirtual

Reimplemented from CreatureAI.

Reimplemented in npc_taretha::npc_tarethaAI, brann_bronzebeard::brann_bronzebeardAI, npc_mimirons_inferno::npc_mimirons_infernoAI, boss_thorim_lightning_orb::boss_thorim_lightning_orbAI, boss_thorim_sif_blizzard::boss_thorim_sif_blizzardAI, boss_yoggsaron_cloud::boss_yoggsaron_cloudAI, npc_azure_saboteur::npc_azure_saboteurAI, npc_akama_illidan::npc_akama_illidanAI, npc_lesser_doomguard::npc_lesser_doomguardAI, hyjalAI, npc_general_andorov, npc_custodian_of_time::npc_custodian_of_timeAI, violet_hold_trashAI, boss_ambassador_hellmaw::boss_ambassador_hellmawAI, npc_ancestral_wolf::npc_ancestral_wolfAI, and npc_captain_saeed::npc_captain_saeedAI.

136{
137 if (me->GetVictim())
138 return;
139
142 return;
143
144 if (me->CanStartAttack(who))
145 {
147 {
150 }
151 AttackStart(who);
152 }
153}
@ UNIT_STATE_DISTRACTED
Definition: Unit.h:337
@ UNIT_STATE_STUNNED
Definition: Unit.h:328
bool AssistPlayerInCombatAgainst(Unit *who)
Definition: ScriptedEscortAI.cpp:73
bool CanStartAttack(Unit const *u) const
Definition: Creature.cpp:1871
void ClearUnitState(uint32 f)
Definition: Unit.h:1399
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1398
bool isTargetableForAttack(bool checkFakeDeath=true, Unit const *byWho=nullptr) const
Definition: Unit.cpp:13747
void Clear(bool reset=true)
Definition: MotionMaster.h:165

References AssistPlayerInCombatAgainst(), AttackStart(), Creature::CanStartAttack(), MotionMaster::Clear(), Unit::ClearUnitState(), Unit::GetMotionMaster(), Unit::GetVictim(), HasEscortState(), Unit::HasUnitState(), Unit::isInAccessiblePlaceFor(), Unit::isTargetableForAttack(), ScriptedAI::me, STATE_ESCORT_ESCORTING, UNIT_STATE_DISTRACTED, and UNIT_STATE_STUNNED.

Referenced by hyjalAI::MoveInLineOfSight(), boss_ambassador_hellmaw::boss_ambassador_hellmawAI::MoveInLineOfSight(), npc_ancestral_wolf::npc_ancestral_wolfAI::MoveInLineOfSight(), and npc_captain_saeed::npc_captain_saeedAI::MoveInLineOfSight().

◆ MovementInform()

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

Reimplemented from ScriptedAI.

Reimplemented in boss_grand_champion::boss_grand_championAI, and npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI.

328{
329 // xinef: no action allowed if there is no escort
331 return;
332
333 if (moveType == POINT_MOTION_TYPE)
334 {
335 //Combat start position reached, continue waypoint movement
336 if (pointId == POINT_LAST_POINT)
337 {
338 LOG_DEBUG("scripts.ai", "EscortAI has returned to original position before combat");
339
342
343 if (!m_uiWPWaitTimer)
344 m_uiWPWaitTimer = 1;
345 }
346 else if (pointId == POINT_HOME)
347 {
348 LOG_DEBUG("scripts.ai", "EscortAI has returned to original home location and will continue from beginning of waypoint list.");
349
350 CurrentWP = WaypointList.begin();
351 m_uiWPWaitTimer = 1;
352 }
353 }
354 else if (moveType == ESCORT_MOTION_TYPE)
355 {
357 {
358 //Call WP function
362
363 m_uiWPWaitTimer = CurrentWP->WaitTimeMs + 1;
364
365 ++CurrentWP;
366
368 {
373 }
374 }
375 }
376}
@ POINT_HOME
Definition: ScriptedEscortAI.cpp:33
@ POINT_LAST_POINT
Definition: ScriptedEscortAI.cpp:32
virtual void WaypointReached(uint32 pointId)=0
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:320
void SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:3027
bool SetWalk(bool enable) override
Definition: Creature.cpp:3053
float GetOrientation() const
Definition: Position.h:120
void StopMovingOnCurrentPos()
Definition: Unit.cpp:16793
void MoveIdle()
Definition: MotionMaster.cpp:231

References CurrentWP, ESCORT_MOTION_TYPE, Unit::GetMotionMaster(), MotionMaster::GetMotionSlotType(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), HasEscortState(), LOG_DEBUG, m_bIsRunning, m_uiWPWaitTimer, ScriptedAI::me, MOTION_SLOT_ACTIVE, MotionMaster::MoveIdle(), MotionMaster::MovementExpired(), POINT_HOME, POINT_LAST_POINT, POINT_MOTION_TYPE, RemoveEscortState(), Creature::SetHomePosition(), Creature::SetPosition(), Creature::SetWalk(), STATE_ESCORT_ESCORTING, STATE_ESCORT_PAUSED, STATE_ESCORT_RETURNING, Unit::StopMovingOnCurrentPos(), WaypointList, and WaypointReached().

Referenced by boss_grand_champion::boss_grand_championAI::MovementInform(), and npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::MovementInform().

◆ RemoveEscortState()

◆ ReturnToLastPoint()

void npc_escortAI::ReturnToLastPoint ( )
194{
195 float x, y, z, o;
196 me->SetWalk(false);
197 me->GetHomePosition(x, y, z, o);
199}
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:322
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:210

References Creature::GetHomePosition(), Unit::GetMotionMaster(), ScriptedAI::me, MotionMaster::MovePoint(), POINT_LAST_POINT, and Creature::SetWalk().

Referenced by npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), and EnterEvadeMode().

◆ SetCanAttack()

void npc_escortAI::SetCanAttack ( bool  attack)
inline
107{ m_bIsActiveAttacker = attack; }

References m_bIsActiveAttacker.

◆ SetDespawnAtEnd()

void npc_escortAI::SetDespawnAtEnd ( bool  despawn)
inline
104{ DespawnAtEnd = despawn; }

References DespawnAtEnd.

Referenced by boss_grand_champion::boss_grand_championAI::boss_grand_championAI(), boss_thorim_sif_blizzard::boss_thorim_sif_blizzardAI::boss_thorim_sif_blizzardAI(), npc_argent_soldier::npc_argent_soldierAI::npc_argent_soldierAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::npc_crok_scourgebaneAI(), npc_general_andorov::npc_general_andorov(), npc_onyx_flamecaller::npc_onyx_flamecallerAI::npc_onyx_flamecallerAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::Reset(), brann_bronzebeard::brann_bronzebeardAI::Reset(), hyjalAI::Retreat(), npc_akama_illidan::npc_akama_illidanAI::sGossipSelect(), boss_anetheron::boss_anetheronAI::UpdateAI(), boss_azgalor::boss_azgalorAI::UpdateAI(), boss_kazrogal::boss_kazrogalAI::UpdateAI(), boss_rage_winterchill::boss_rage_winterchillAI::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), npc_abomination::npc_abominationAI::UpdateAI(), npc_ghoul::npc_ghoulAI::UpdateAI(), npc_necromancer::npc_necromancerAI::UpdateAI(), npc_banshee::npc_bansheeAI::UpdateAI(), npc_crypt_fiend::npc_crypt_fiendAI::UpdateAI(), npc_fel_stalker::npc_fel_stalkerAI::UpdateAI(), npc_frost_wyrm::npc_frost_wyrmAI::UpdateAI(), npc_gargoyle::npc_gargoyleAI::UpdateAI(), hyjal_trashAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), violet_hold_trashAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), and npc_cork_gizelton::npc_cork_gizeltonAI::UpdateEscortAI().

◆ SetDespawnAtFar()

◆ SetEscortPaused()

void npc_escortAI::SetEscortPaused ( bool  on)
525{
527 return;
528
529 if (on)
531 else
533}

References AddEscortState(), HasEscortState(), RemoveEscortState(), STATE_ESCORT_ESCORTING, and STATE_ESCORT_PAUSED.

Referenced by brann_bronzebeard::brann_bronzebeardAI::DoAction(), npc_arthas::npc_arthasAI::DoAction(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::DoAction(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::DoAction(), npc_ranshalla::npc_ranshallaAI::DoChannelTorchSpell(), npc_muglash::npc_muglashAI::DoWaveSummon(), npc_captain_saeed::npc_captain_saeedAI::EnterEvadeMode(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), npc_crok_scourgebane::npc_crok_scourgebaneAI::SetGUID(), npc_cork_gizelton::npc_cork_gizeltonAI::SetGUID(), npc_captain_saeed::npc_captain_saeedAI::SetGUID(), npc_varian_wrynn::npc_varian_wrynnAI::SetHoldState(), npc_thrall_bfu::npc_thrall_bfuAI::SetHoldState(), npc_general_andorov::sGossipSelect(), npc_thrall_bfu::npc_thrall_bfuAI::SummonedCreatureDies(), npc_barnes::npc_barnesAI::UpdateAI(), npc_corporal_keeshan::npc_corporal_keeshanAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_captain_saeed::npc_captain_saeedAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::UpdateAI(), npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI::UpdateAI(), npc_tyrion_spybot::npc_tyrion_spybotAI::UpdateAI(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::UpdateAI(), npc_grimstone::npc_grimstoneAI::UpdateEscortAI(), npc_cork_gizelton::npc_cork_gizeltonAI::UpdateEscortAI(), npc_ranshalla::npc_ranshallaAI::UpdateEscortAI(), brann_bronzebeard::brann_bronzebeardAI::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_akama_illidan::npc_akama_illidanAI::UpdateEscortAI(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached(), npc_captain_saeed::npc_captain_saeedAI::WaypointReached(), npc_ranshalla::npc_ranshallaAI::WaypointReached(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::WaypointReached(), npc_akama_illidan::npc_akama_illidanAI::WaypointReached(), npc_arthas::npc_arthasAI::WaypointReached(), npc_grimstone::npc_grimstoneAI::WaypointReached(), npc_barnes::npc_barnesAI::WaypointReached(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached(), npc_corporal_keeshan::npc_corporal_keeshanAI::WaypointReached(), npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI::WaypointReached(), npc_tyrion_spybot::npc_tyrion_spybotAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_general_andorov::WaypointReached(), npc_muglash::npc_muglashAI::WaypointReached(), npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached(), npc_crok_scourgebane::npc_crok_scourgebaneAI::WaypointReached(), and npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::WaypointReached().

◆ SetMaxPlayerDistance()

void npc_escortAI::SetMaxPlayerDistance ( float  newMax)
inline
101{ MaxPlayerDistance = newMax; }

References MaxPlayerDistance.

◆ SetNextWaypoint() [1/2]

bool npc_escortAI::SetNextWaypoint ( uint32  pointId,
bool  setPosition = true 
)
542{
543 if (!WaypointList.empty())
544 WaypointList.clear();
545
547
548 if (WaypointList.empty())
549 return false;
550
551 Escort_Waypoint waypoint(0, 0, 0, 0, 0);
552 for (CurrentWP = WaypointList.begin(); CurrentWP != WaypointList.end(); ++CurrentWP)
553 {
554 if (CurrentWP->id == pointId)
555 {
556 if (setPosition)
558 return true;
559 }
560 }
561
562 return false;
563}
void FillPointMovementListForCreature()
Definition: ScriptedEscortAI.cpp:415
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition: Unit.cpp:20055

References CurrentWP, FillPointMovementListForCreature(), Position::GetOrientation(), ScriptedAI::me, Unit::UpdatePosition(), and WaypointList.

◆ SetNextWaypoint() [2/2]

bool npc_escortAI::SetNextWaypoint ( uint32  pointId,
float  x,
float  y,
float  z,
float  orientation 
)
536{
537 me->UpdatePosition(x, y, z, orientation);
538 return SetNextWaypoint(pointId, false);
539}
bool SetNextWaypoint(uint32 pointId, float x, float y, float z, float orientation)
Definition: ScriptedEscortAI.cpp:535

References ScriptedAI::me, SetNextWaypoint(), and Unit::UpdatePosition().

Referenced by brann_bronzebeard::brann_bronzebeardAI::DoAction(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::RollPath(), and SetNextWaypoint().

◆ SetRun()

void npc_escortAI::SetRun ( bool  on = true)
430{
431 if (on)
432 {
433 if (!m_bIsRunning)
434 me->SetWalk(false);
435 else
436 LOG_DEBUG("scripts.ai", "EscortAI attempt to set run mode, but is already running.");
437 }
438 else
439 {
440 if (m_bIsRunning)
441 me->SetWalk(true);
442 else
443 LOG_DEBUG("scripts.ai", "EscortAI attempt to set walk mode, but is already walking.");
444 }
445
446 m_bIsRunning = on;
447}

References LOG_DEBUG, m_bIsRunning, ScriptedAI::me, and Creature::SetWalk().

Referenced by npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_arthas::npc_arthasAI::DoAction(), npc_thrall_bfu::npc_thrall_bfuAI::SummonedCreatureDies(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_arthas::npc_arthasAI::WaypointReached(), npc_scarlet_miner::npc_scarlet_minerAI::WaypointReached(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::WaypointReached(), npc_rinji::npc_rinjiAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_taretha::npc_tarethaAI::WaypointReached(), npc_magwin::npc_magwinAI::WaypointReached(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::WaypointReached(), npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached(), npc_apothecary_hanes::npc_Apothecary_HanesAI::WaypointReached(), npc_maghar_captive::npc_maghar_captiveAI::WaypointReached(), npc_kurenai_captive::npc_kurenai_captiveAI::WaypointReached(), npc_kayra_longmane::npc_kayra_longmaneAI::WaypointReached(), and npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::WaypointStart().

◆ Start()

void npc_escortAI::Start ( bool  isActiveAttacker = true,
bool  run = false,
ObjectGuid  playerGUID = ObjectGuid::Empty,
Quest const *  quest = nullptr,
bool  instantRespawn = false,
bool  canLoopPath = false,
bool  resetWaypoints = true 
)
451{
452 if (me->GetVictim())
453 {
454 LOG_ERROR("entities.unit.ai", "ERROR: EscortAI (script: {}, creature entry: {}) attempts to Start while in combat", me->GetScriptName(), me->GetEntry());
455 return;
456 }
457
459 {
460 LOG_ERROR("entities.unit.ai", "EscortAI (script: {}, creature entry: {}) attempts to Start while already escorting", me->GetScriptName(), me->GetEntry());
461 return;
462 }
463
464 if (!ScriptWP && resetWaypoints) // sd2 never adds wp in script, but tc does
465 {
466 if (!WaypointList.empty())
467 WaypointList.clear();
469 }
470
471 if (WaypointList.empty())
472 {
473 LOG_ERROR("sql.sql", "EscortAI (script: {}, creature entry: {}) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: {}).",
474 me->GetScriptName(), me->GetEntry(), quest ? quest->GetQuestId() : 0);
475 return;
476 }
477
478 //set variables
479 m_bIsActiveAttacker = isActiveAttacker;
480 m_bIsRunning = run;
481
482 m_uiPlayerGUID = playerGUID;
483 m_pQuestForEscort = quest;
484
485 m_bCanInstantRespawn = instantRespawn;
486 m_bCanReturnToStart = canLoopPath;
487
489 LOG_DEBUG("scripts.ai", "EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
490
492 {
495 LOG_DEBUG("scripts.ai", "EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
496 }
497
498 //disable npcflags
500 if (me->IsImmuneToNPC())
501 {
502 HasImmuneToNPCFlags = true;
503 me->SetImmuneToNPC(false);
504 }
505
506 LOG_DEBUG("scripts.ai", "EscortAI started with {} waypoints. ActiveAttacker = {}, Run = {}, PlayerGUID = {}",
508
509 CurrentWP = WaypointList.begin();
510
511 //Set initial speed
512 if (m_bIsRunning)
513 me->SetWalk(false);
514 else
515 me->SetWalk(true);
516
520 me->DisableSpline();
522}
std::uint64_t uint64
Definition: Define.h:107
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
@ UNIT_NPC_FLAG_NONE
Definition: Unit.h:515
@ WAYPOINT_MOTION_TYPE
Definition: MotionMaster.h:39
std::string GetScriptName() const
Definition: Creature.cpp:2914
std::string ToString() const
Definition: ObjectGuid.cpp:47
void DisableSpline()
Definition: Unit.cpp:654
bool IsImmuneToNPC() const
Definition: Unit.h:1683
void ReplaceAllNpcFlags(NPCFlags flags)
Definition: Unit.h:1649
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition: MotionMaster.cpp:817

References AddEscortState(), CurrentWP, Unit::DisableSpline(), ESCORT_MOTION_TYPE, FillPointMovementListForCreature(), MotionMaster::GetCurrentMovementGeneratorType(), Object::GetEntry(), Unit::GetMotionMaster(), MotionMaster::GetMotionSlotType(), Quest::GetQuestId(), Creature::GetScriptName(), Unit::GetVictim(), HasEscortState(), HasImmuneToNPCFlags, Unit::IsImmuneToNPC(), LOG_DEBUG, LOG_ERROR, m_bCanInstantRespawn, m_bCanReturnToStart, m_bIsActiveAttacker, m_bIsRunning, m_pQuestForEscort, m_uiPlayerGUID, ScriptedAI::me, MOTION_SLOT_ACTIVE, MotionMaster::MoveIdle(), MotionMaster::MovementExpired(), Unit::ReplaceAllNpcFlags(), ScriptWP, Unit::SetImmuneToNPC(), Creature::SetWalk(), STATE_ESCORT_ESCORTING, ObjectGuid::ToString(), UNIT_NPC_FLAG_NONE, WAYPOINT_MOTION_TYPE, and WaypointList.

Referenced by boss_bjarngrim::boss_bjarngrimAI::boss_bjarngrimAI(), boss_thorim_lightning_orb::boss_thorim_lightning_orbAI::boss_thorim_lightning_orbAI(), boss_thorim_sif_blizzard::boss_thorim_sif_blizzardAI::boss_thorim_sif_blizzardAI(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::boss_yoggsaron_cloudAI(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::DoAction(), boss_ambassador_hellmaw::boss_ambassador_hellmawAI::DoAction(), npc_taretha::npc_tarethaAI::DoAction(), npc_scarlet_miner::npc_scarlet_minerAI::InitCartQuest(), npc_general_andorov::InitializeAI(), npc_kservant::npc_kservantAI::IsSummonedBy(), npc_custodian_of_time::npc_custodian_of_timeAI::MoveInLineOfSight(), npc_ancestral_wolf::npc_ancestral_wolfAI::npc_ancestral_wolfAI(), npc_frosthound::npc_frosthoundAI::PassengerBoarded(), npc_icefang::npc_icefangAI::PassengerBoarded(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), npc_onyx_flamecaller::npc_onyx_flamecallerAI::Reset(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::Reset(), npc_plaguehound_tracker::npc_plaguehound_trackerAI::Reset(), boss_ambassador_hellmaw::boss_ambassador_hellmawAI::Reset(), hyjalAI::Retreat(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::RollPath(), boss_grand_champion::boss_grand_championAI::SetData(), npc_argent_soldier::npc_argent_soldierAI::SetData(), npc_kurenai_captive::npc_kurenai_captiveAI::SetGUID(), npc_captain_saeed::npc_captain_saeedAI::SetGUID(), npc_akama_illidan::npc_akama_illidanAI::sGossipSelect(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::sQuestAccept(), npc_ranger_lilatha::sQuestAccept(), npc_rinji::npc_rinjiAI::sQuestAccept(), npc_corporal_keeshan::npc_corporal_keeshanAI::sQuestAccept(), npc_muglash::npc_muglashAI::sQuestAccept(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::sQuestAccept(), npc_barnes::npc_barnesAI::StartEvent(), npc_clintar_spirit::npc_clintar_spiritAI::StartEvent(), boss_anetheron::boss_anetheronAI::UpdateAI(), boss_azgalor::boss_azgalorAI::UpdateAI(), boss_kazrogal::boss_kazrogalAI::UpdateAI(), boss_rage_winterchill::boss_rage_winterchillAI::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), npc_abomination::npc_abominationAI::UpdateAI(), npc_ghoul::npc_ghoulAI::UpdateAI(), npc_necromancer::npc_necromancerAI::UpdateAI(), npc_banshee::npc_bansheeAI::UpdateAI(), npc_crypt_fiend::npc_crypt_fiendAI::UpdateAI(), npc_fel_stalker::npc_fel_stalkerAI::UpdateAI(), npc_frost_wyrm::npc_frost_wyrmAI::UpdateAI(), npc_gargoyle::npc_gargoyleAI::UpdateAI(), hyjal_trashAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), violet_hold_trashAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), npc_grimstone::npc_grimstoneAI::UpdateEscortAI(), npc_magwin::npc_magwinAI::UpdateEscortAI(), and npc_cork_gizelton::npc_cork_gizeltonAI::UpdateEscortAI().

◆ UpdateAI()

void npc_escortAI::UpdateAI ( uint32  diff)
overridevirtual

Reimplemented from ScriptedAI.

Reimplemented in npc_rocknot::npc_rocknotAI, npc_barnes::npc_barnesAI, npc_scarlet_miner::npc_scarlet_minerAI, npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI, npc_corporal_keeshan::npc_corporal_keeshanAI, npc_varian_wrynn::npc_varian_wrynnAI, npc_thrall_bfu::npc_thrall_bfuAI, boss_anetheron::boss_anetheronAI, boss_azgalor::boss_azgalorAI, npc_lesser_doomguard::npc_lesser_doomguardAI, boss_kazrogal::boss_kazrogalAI, boss_rage_winterchill::boss_rage_winterchillAI, npc_giant_infernal::npc_giant_infernalAI, npc_abomination::npc_abominationAI, npc_ghoul::npc_ghoulAI, npc_necromancer::npc_necromancerAI, npc_banshee::npc_bansheeAI, npc_crypt_fiend::npc_crypt_fiendAI, npc_fel_stalker::npc_fel_stalkerAI, npc_frost_wyrm::npc_frost_wyrmAI, npc_gargoyle::npc_gargoyleAI, hyjal_trashAI, hyjalAI, npc_arthas::npc_arthasAI, npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, npc_muglash::npc_muglashAI, npc_clintar_spirit::npc_clintar_spiritAI, npc_custodian_of_time::npc_custodian_of_timeAI, npc_ame::npc_ameAI, npc_argent_soldier::npc_argent_soldierAI, boss_grand_champion::boss_grand_championAI, npc_crok_scourgebane::npc_crok_scourgebaneAI, npc_mimirons_inferno::npc_mimirons_infernoAI, violet_hold_trashAI, npc_azure_invader::npc_azure_invaderAI, npc_azure_binder::npc_azure_binderAI, npc_azure_mage_slayer::npc_azure_mage_slayerAI, npc_azure_raider::npc_azure_raiderAI, npc_azure_stalker::npc_azure_stalkerAI, npc_azure_spellbreaker::npc_azure_spellbreakerAI, npc_azure_captain::npc_azure_captainAI, npc_azure_sorceror::npc_azure_sorcerorAI, npc_azure_saboteur::npc_azure_saboteurAI, npc_lurgglbr::npc_lurgglbrAI, npc_frosthound::npc_frosthoundAI, npc_icefang::npc_icefangAI, boss_ambassador_hellmaw::boss_ambassador_hellmawAI, npc_maghar_captive::npc_maghar_captiveAI, npc_captain_saeed::npc_captain_saeedAI, npc_garments_of_quests::npc_garments_of_questsAI, npc_koltira_deathweaver::npc_koltira_deathweaverAI, npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, npc_tyrion_spybot::npc_tyrion_spybotAI, npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI, npc_engineer_helice::npc_engineer_heliceAI, npc_maxx_a_million_escort::npc_maxx_a_million_escortAI, and npc_earthmender_wilda::npc_earthmender_wildaAI.

242{
244 {
245 if (m_uiWPWaitTimer <= diff)
246 {
247 if (CurrentWP == WaypointList.end())
248 {
249 if (DespawnAtEnd)
250 {
252 {
253 float fRetX, fRetY, fRetZ;
254 me->GetRespawnPosition(fRetX, fRetY, fRetZ);
255 me->GetMotionMaster()->MovePoint(POINT_HOME, fRetX, fRetY, fRetZ);
256
257 m_uiWPWaitTimer = 0;
258 return;
259 }
260
262 {
264 me->Respawn();
265 }
266 else
268 }
269
270 // xinef: remove escort state, escort was finished (lack of this line resulted in skipping UpdateEscortAI calls after finished escort)
272 return;
273 }
274
276 {
277 // xinef, start escort if there is no spline active
278 if (me->movespline->Finalized())
279 {
280 Movement::PointsArray pathPoints;
281 GenerateWaypointArray(&pathPoints);
282 me->GetMotionMaster()->MoveSplinePath(&pathPoints);
283 }
284
286 m_uiWPWaitTimer = 0;
287 }
288 }
289 else
290 m_uiWPWaitTimer -= diff;
291 }
292
293 //Check if player or any member of his group is within range
295 {
296 m_uiPlayerCheckTimer += diff;
297 if (m_uiPlayerCheckTimer > 1000)
298 {
300 {
302 {
304 me->Respawn();
305 }
306 else
308
309 return;
310 }
311
313 }
314 }
315
316 UpdateEscortAI(diff);
317}
@ JUST_DIED
Definition: Unit.h:317
std::vector< Vector3 > PointsArray
Definition: MoveSplineInitArgs.h:28
bool IsPlayerOrGroupInRange()
Definition: ScriptedEscortAI.cpp:223
void GenerateWaypointArray(Movement::PointsArray *points)
Definition: ScriptedEscortAI.cpp:585
virtual void WaypointStart(uint32)
Definition: ScriptedEscortAI.h:91
virtual void UpdateEscortAI(uint32 diff)
Definition: ScriptedEscortAI.cpp:319
void setDeathState(DeathState s, bool despawn=false) override
Definition: Creature.cpp:1918
void Respawn(bool force=false)
Definition: Creature.cpp:1989
void GetRespawnPosition(float &x, float &y, float &z, float *ori=nullptr, float *dist=nullptr) const
Definition: Creature.cpp:2816
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition: Creature.cpp:2092
Movement::MoveSpline * movespline
Definition: Unit.h:2438
void MoveSplinePath(Movement::PointsArray *path)
Definition: MotionMaster.cpp:409
bool Finalized() const
Definition: MoveSpline.h:116

References CurrentWP, DespawnAtEnd, DespawnAtFar, Creature::DespawnOrUnsummon(), Movement::MoveSpline::Finalized(), GenerateWaypointArray(), Unit::GetMotionMaster(), Creature::GetRespawnPosition(), Unit::GetVictim(), HasEscortState(), IsPlayerOrGroupInRange(), JUST_DIED, m_bCanInstantRespawn, m_bCanReturnToStart, m_uiPlayerCheckTimer, m_uiPlayerGUID, m_uiWPWaitTimer, ScriptedAI::me, MotionMaster::MovePoint(), Unit::movespline, MotionMaster::MoveSplinePath(), POINT_HOME, RemoveEscortState(), Creature::Respawn(), Creature::setDeathState(), STATE_ESCORT_ESCORTING, STATE_ESCORT_PAUSED, STATE_ESCORT_RETURNING, UpdateEscortAI(), WaypointList, and WaypointStart().

Referenced by hyjalAI::DoOverrun(), npc_daphne_stilwell::npc_daphne_stilwellAI::Update(), npc_rocknot::npc_rocknotAI::UpdateAI(), npc_barnes::npc_barnesAI::UpdateAI(), npc_scarlet_miner::npc_scarlet_minerAI::UpdateAI(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::UpdateAI(), npc_corporal_keeshan::npc_corporal_keeshanAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_anetheron::boss_anetheronAI::UpdateAI(), boss_azgalor::boss_azgalorAI::UpdateAI(), boss_kazrogal::boss_kazrogalAI::UpdateAI(), boss_rage_winterchill::boss_rage_winterchillAI::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), npc_abomination::npc_abominationAI::UpdateAI(), npc_ghoul::npc_ghoulAI::UpdateAI(), npc_necromancer::npc_necromancerAI::UpdateAI(), npc_banshee::npc_bansheeAI::UpdateAI(), npc_crypt_fiend::npc_crypt_fiendAI::UpdateAI(), npc_fel_stalker::npc_fel_stalkerAI::UpdateAI(), npc_frost_wyrm::npc_frost_wyrmAI::UpdateAI(), npc_gargoyle::npc_gargoyleAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_muglash::npc_muglashAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), npc_custodian_of_time::npc_custodian_of_timeAI::UpdateAI(), npc_ame::npc_ameAI::UpdateAI(), npc_argent_soldier::npc_argent_soldierAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), npc_mimirons_inferno::npc_mimirons_infernoAI::UpdateAI(), violet_hold_trashAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), npc_lurgglbr::npc_lurgglbrAI::UpdateAI(), npc_frosthound::npc_frosthoundAI::UpdateAI(), npc_icefang::npc_icefangAI::UpdateAI(), boss_ambassador_hellmaw::boss_ambassador_hellmawAI::UpdateAI(), npc_maghar_captive::npc_maghar_captiveAI::UpdateAI(), npc_captain_saeed::npc_captain_saeedAI::UpdateAI(), npc_garments_of_quests::npc_garments_of_questsAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::UpdateAI(), npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI::UpdateAI(), npc_tyrion_spybot::npc_tyrion_spybotAI::UpdateAI(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::UpdateAI(), npc_engineer_helice::npc_engineer_heliceAI::UpdateAI(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::UpdateAI(), and npc_earthmender_wilda::npc_earthmender_wildaAI::UpdateAI().

◆ UpdateEscortAI()

◆ WaypointReached()

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

Implemented in npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI, boss_grand_champion::boss_grand_championAI, npc_captain_saeed::npc_captain_saeedAI, brann_bronzebeard::brann_bronzebeardAI, violet_hold_trashAI, boss_bjarngrim::boss_bjarngrimAI, npc_ranshalla::npc_ranshallaAI, npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI, npc_akama_illidan::npc_akama_illidanAI, npc_argent_soldier::npc_argent_soldierAI, npc_arthas::npc_arthasAI, npc_azure_saboteur::npc_azure_saboteurAI, npc_grimstone::npc_grimstoneAI, npc_rocknot::npc_rocknotAI, npc_barnes::npc_barnesAI, npc_scarlet_miner::npc_scarlet_minerAI, npc_koltira_deathweaver::npc_koltira_deathweaverAI, npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI, npc_ranger_lilatha, npc_rinji::npc_rinjiAI, npc_corporal_keeshan::npc_corporal_keeshanAI, npc_deathstalker_erland::npc_deathstalker_erlandAI, npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, npc_tyrion_spybot::npc_tyrion_spybotAI, npc_varian_wrynn::npc_varian_wrynnAI, npc_thrall_bfu::npc_thrall_bfuAI, npc_daphne_stilwell::npc_daphne_stilwellAI, npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI, boss_anetheron::boss_anetheronAI, boss_azgalor::boss_azgalorAI, boss_kazrogal::boss_kazrogalAI, boss_rage_winterchill::boss_rage_winterchillAI, npc_giant_infernal::npc_giant_infernalAI, npc_abomination::npc_abominationAI, npc_ghoul::npc_ghoulAI, npc_necromancer::npc_necromancerAI, npc_banshee::npc_bansheeAI, npc_crypt_fiend::npc_crypt_fiendAI, npc_fel_stalker::npc_fel_stalkerAI, npc_frost_wyrm::npc_frost_wyrmAI, npc_gargoyle::npc_gargoyleAI, hyjalAI, npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, npc_taretha::npc_tarethaAI, npc_general_andorov, npc_muglash::npc_muglashAI, npc_magwin::npc_magwinAI, npc_prospector_remtravel::npc_prospector_remtravelAI, npc_cork_gizelton::npc_cork_gizeltonAI, npc_clintar_spirit::npc_clintar_spiritAI, npc_kaya_flathoof::npc_kaya_flathoofAI, npc_custodian_of_time::npc_custodian_of_timeAI, npc_gilthares::npc_giltharesAI, npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI, npc_lakota_windsong::npc_lakota_windsongAI, npc_paoka_swiftmountain::npc_paoka_swiftmountainAI, npc_ame::npc_ameAI, npc_onyx_flamecaller::npc_onyx_flamecallerAI, npc_crok_scourgebane::npc_crok_scourgebaneAI, npc_lurgglbr::npc_lurgglbrAI, npc_mootoo_the_younger::npc_mootoo_the_youngerAI, npc_bonker_togglevolt::npc_bonker_togglevoltAI, npc_emily::npc_emilyAI, npc_apothecary_hanes::npc_Apothecary_HanesAI, npc_plaguehound_tracker::npc_plaguehound_trackerAI, npc_engineer_helice::npc_engineer_heliceAI, npc_frosthound::npc_frosthoundAI, npc_ancestral_wolf::npc_ancestral_wolfAI, npc_wounded_blood_elf::npc_wounded_blood_elfAI, npc_maghar_captive::npc_maghar_captiveAI, npc_kurenai_captive::npc_kurenai_captiveAI, npc_bessy::npc_bessyAI, npc_maxx_a_million_escort::npc_maxx_a_million_escortAI, npc_earthmender_wilda::npc_earthmender_wildaAI, npc_kservant::npc_kservantAI, npc_isla_starmane::npc_isla_starmaneAI, npc_kayra_longmane::npc_kayra_longmaneAI, npc_lesser_doomguard::npc_lesser_doomguardAI, npc_mimirons_inferno::npc_mimirons_infernoAI, boss_thorim_lightning_orb::boss_thorim_lightning_orbAI, boss_thorim_sif_blizzard::boss_thorim_sif_blizzardAI, boss_yoggsaron_cloud::boss_yoggsaron_cloudAI, npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI, npc_icefang::npc_icefangAI, boss_ambassador_hellmaw::boss_ambassador_hellmawAI, and npc_garments_of_quests::npc_garments_of_questsAI.

Referenced by MovementInform().

◆ WaypointStart()

virtual void npc_escortAI::WaypointStart ( uint32  )
inlinevirtual

Member Data Documentation

◆ CurrentWP

std::list<Escort_Waypoint>::iterator npc_escortAI::CurrentWP
private

◆ DespawnAtEnd

bool npc_escortAI::DespawnAtEnd
private

Referenced by SetDespawnAtEnd(), and UpdateAI().

◆ DespawnAtFar

bool npc_escortAI::DespawnAtFar
private

Referenced by SetDespawnAtFar(), and UpdateAI().

◆ HasImmuneToNPCFlags

bool npc_escortAI::HasImmuneToNPCFlags
private

Referenced by EnterEvadeMode(), and Start().

◆ m_bCanInstantRespawn

bool npc_escortAI::m_bCanInstantRespawn
private

Referenced by Start(), and UpdateAI().

◆ m_bCanReturnToStart

bool npc_escortAI::m_bCanReturnToStart
private

Referenced by Start(), and UpdateAI().

◆ m_bIsActiveAttacker

bool npc_escortAI::m_bIsActiveAttacker
private

Referenced by GetAttack(), SetCanAttack(), and Start().

◆ m_bIsRunning

bool npc_escortAI::m_bIsRunning
private

Referenced by MovementInform(), SetRun(), and Start().

◆ m_pQuestForEscort

Quest const* npc_escortAI::m_pQuestForEscort
private

Referenced by JustDied(), and Start().

◆ m_uiEscortState

uint32 npc_escortAI::m_uiEscortState
private

◆ m_uiPlayerCheckTimer

uint32 npc_escortAI::m_uiPlayerCheckTimer
private

Referenced by UpdateAI().

◆ m_uiPlayerGUID

ObjectGuid npc_escortAI::m_uiPlayerGUID
private

◆ m_uiWPWaitTimer

uint32 npc_escortAI::m_uiWPWaitTimer
private

◆ MaxPlayerDistance

float npc_escortAI::MaxPlayerDistance
private

◆ ScriptWP

bool npc_escortAI::ScriptWP
private

Referenced by AddWaypoint(), and Start().

◆ WaypointList