AzeorthCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
MotionMaster Class Reference

#include "MotionMaster.h"

Public Member Functions

 MotionMaster (Unit *unit)
 
 ~MotionMaster ()
 
void Initialize ()
 
void InitDefault ()
 
bool empty () const
 
int size () const
 
_Ty top () const
 
_Ty GetMotionSlot (int slot) const
 
uint8 GetCleanFlags () const
 
void DirectDelete (_Ty curr)
 
void DelayedDelete (_Ty curr)
 
void UpdateMotion (uint32 diff)
 
void Clear (bool reset=true)
 
void MovementExpired (bool reset=true)
 
void MovementExpiredOnSlot (MovementSlot slot, bool reset=true)
 
void MoveIdle ()
 
void MoveTargetedHome ()
 
void MoveRandom (float wanderDistance=0.0f)
 
void MoveFollow (Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
 
void MoveChase (Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
 
void MoveChase (Unit *target, float dist, float angle)
 
void MoveChase (Unit *target, float dist)
 
void MoveCircleTarget (Unit *target)
 
void MoveBackwards (Unit *target, float dist)
 
void MoveConfused ()
 
void MoveFleeing (Unit *enemy, uint32 time=0)
 
void MovePoint (uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
 
void MovePoint (uint32 id, float x, float y, float z, bool generatePath=true, bool forceDestination=true, MovementSlot slot=MOTION_SLOT_ACTIVE, float orientation=0.0f)
 
void MoveSplinePath (Movement::PointsArray *path)
 
void MoveLand (uint32 id, Position const &pos, float speed=0.0f)
 
void MoveLand (uint32 id, float x, float y, float z, float speed=0.0f)
 
void MoveTakeoff (uint32 id, Position const &pos, float speed=0.0f)
 
void MoveTakeoff (uint32 id, float x, float y, float z, float speed=0.0f)
 
void MoveCharge (float x, float y, float z, float speed=SPEED_CHARGE, uint32 id=EVENT_CHARGE, const Movement::PointsArray *path=nullptr, bool generatePath=false, float orientation=0.0f, ObjectGuid targetGUID=ObjectGuid::Empty)
 
void MoveCharge (PathGenerator const &path, float speed=SPEED_CHARGE, ObjectGuid targetGUID=ObjectGuid::Empty)
 
void MoveKnockbackFrom (float srcX, float srcY, float speedXY, float speedZ)
 
void MoveJumpTo (float angle, float speedXY, float speedZ)
 
void MoveJump (Position const &pos, float speedXY, float speedZ, uint32 id=0)
 
void MoveJump (float x, float y, float z, float speedXY, float speedZ, uint32 id=0, Unit const *target=nullptr)
 
void MoveFall (uint32 id=0, bool addFlagForNPC=false)
 
void MoveSeekAssistance (float x, float y, float z)
 
void MoveSeekAssistanceDistract (uint32 timer)
 
void MoveTaxiFlight (uint32 path, uint32 pathnode)
 
void MoveDistract (uint32 time)
 
void MovePath (uint32 path_id, bool repeatable)
 
void MoveRotate (uint32 time, RotateDirection direction)
 
MovementGeneratorType GetCurrentMovementGeneratorType () const
 
MovementGeneratorType GetMotionSlotType (int slot) const
 
uint32 GetCurrentSplineId () const
 
void propagateSpeedChange ()
 
void ReinitializeMovement ()
 
bool GetDestination (float &x, float &y, float &z)
 

Private Types

typedef MovementGenerator_Ty
 
typedef std::vector< _TyExpireList
 

Private Member Functions

void pop ()
 
bool needInitTop () const
 
void InitTop ()
 
void Mutate (MovementGenerator *m, MovementSlot slot)
 
void DirectClean (bool reset)
 
void DelayedClean ()
 
void DirectExpire (bool reset)
 
void DirectExpireSlot (MovementSlot slot, bool reset)
 
void DelayedExpire ()
 

Private Attributes

ExpireList_expList
 
_Ty Impl [MAX_MOTION_SLOT]
 
int _top
 
Unit_owner
 
bool _needInit [MAX_MOTION_SLOT]
 
uint8 _cleanFlag
 

Detailed Description

Member Typedef Documentation

◆ _Ty

◆ ExpireList

typedef std::vector<_Ty> MotionMaster::ExpireList
private

Constructor & Destructor Documentation

◆ MotionMaster()

MotionMaster::MotionMaster ( Unit unit)
inlineexplicit
133 : _expList(nullptr), _top(-1), _owner(unit), _cleanFlag(MMCF_NONE)
134 {
135 for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
136 {
137 Impl[i] = nullptr;
138 _needInit[i] = true;
139 }
140 }
std::uint8_t uint8
Definition: Define.h:110
@ MMCF_NONE
Definition: MotionMaster.h:69
@ MAX_MOTION_SLOT
Definition: MotionMaster.h:64
int _top
Definition: MotionMaster.h:258
Unit * _owner
Definition: MotionMaster.h:259
bool _needInit[MAX_MOTION_SLOT]
Definition: MotionMaster.h:260
ExpireList * _expList
Definition: MotionMaster.h:256
_Ty Impl[MAX_MOTION_SLOT]
Definition: MotionMaster.h:257
uint8 _cleanFlag
Definition: MotionMaster.h:261

References _needInit, Impl, and MAX_MOTION_SLOT.

◆ ~MotionMaster()

MotionMaster::~MotionMaster ( )
92{
93 // clear ALL movement generators (including default)
94 while (!empty())
95 {
96 MovementGenerator* curr = top();
97 pop();
98 if (curr && !isStatic(curr))
99 delete curr; // Skip finalizing on delete, it might launch new movement
100 }
101}
bool isStatic(MovementGenerator *movement)
Definition: MotionMaster.cpp:67
_Ty top() const
Definition: MotionMaster.h:148
void pop()
Definition: MotionMaster.h:115
bool empty() const
Definition: MotionMaster.h:146
Definition: MovementGenerator.h:30

References empty(), isStatic(), pop(), and top().

Member Function Documentation

◆ Clear()

void MotionMaster::Clear ( bool  reset = true)
inline
166 {
168 {
169 if (reset)
171 else
172 _cleanFlag &= ~MMCF_RESET;
173 DelayedClean();
174 }
175 else
176 DirectClean(reset);
177 }
@ MMCF_RESET
Definition: MotionMaster.h:71
@ MMCF_UPDATE
Definition: MotionMaster.h:70
void DelayedClean()
Definition: MotionMaster.cpp:163
void DirectClean(bool reset)
Definition: MotionMaster.cpp:145

References _cleanFlag, DelayedClean(), DirectClean(), MMCF_RESET, and MMCF_UPDATE.

Referenced by PetAI::_stopAttack(), Unit::CleanupBeforeRemoveFromMap(), boss_grand_champion::boss_grand_championAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), Spell::EffectSummonType(), npc_zulian_prowler::npc_zulian_prowlerAI::EnterCombat(), boss_jeklik::EnterEvadeMode(), npc_argent_captainAI::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), npc_pet_gen_argent_pony_bridle::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), boss_halazzi::boss_halazziAI::EnterPhase(), boss_zuljin::boss_zuljinAI::EnterPhase(), UtherBatteredHiltEvent::Execute(), npc_hallows_end_soh::FinishEvent(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), spell_q11919_q11940_drake_hunt::spell_q11919_q11940_drake_hunt_AuraScript::HandleEffectRemove(), spell_item_toxic_wasteling::HandleJump(), AuraEffect::HandleModPossessPet(), spell_item_enchanted_broom_periodic::HandlePeriodicTick(), WorldSession::HandlePetActionHelper(), PetAI::HandleReturnMovement(), spell_gen_ayamiss_swarmer_loop::HandleScript(), npc_bone_spike::npc_bone_spikeAI::IsSummonedBy(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::JustReachedHome(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::MoveInLineOfSight(), PetAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), boss_four_horsemen::boss_four_horsemenAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), MoveTargetedHome(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnApply(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnRemove(), NPCStaveQuestAI::PrepareForEncounter(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_pet_gen_gnomish_flame_turret::Reset(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), Unit::SetCharmedBy(), SmartAI::SetCombatMove(), Unit::setDeathState(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::SetGUID(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), FollowerAI::StartFollow(), SmartAI::StopFollow(), Spell::SummonGuardian(), boss_nightbane::boss_nightbaneAI::TakeOff(), Pet::Update(), boss_quartermaster_zigris::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_nightbane::boss_nightbaneAI::UpdateAI(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), npc_janalai_hatcher::npc_janalai_hatcherAI::UpdateAI(), boss_archimonde::boss_archimondeAI::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), npc_frost_wyrm::npc_frost_wyrmAI::UpdateAI(), npc_gargoyle::npc_gargoyleAI::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), npc_twilight_volunteer::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), boss_omor_the_unscarred::boss_omor_the_unscarredAI::UpdateAI(), boss_warchief_kargath_bladefist::boss_warchief_kargath_bladefistAI::UpdateAI(), boss_high_botanist_freywinn::boss_high_botanist_freywinnAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), npc_pet_gen_toxic_wasteling::UpdateAI(), and PetAI::UpdateAI().

◆ DelayedClean()

void MotionMaster::DelayedClean ( )
private
164{
165 while (size() > 1)
166 {
167 MovementGenerator* curr = top();
168 pop();
169 if (curr) DelayedDelete(curr);
170 }
171}
int size() const
Definition: MotionMaster.h:147
void DelayedDelete(_Ty curr)
Definition: MotionMaster.cpp:856

References DelayedDelete(), pop(), size(), and top().

Referenced by Clear().

◆ DelayedDelete()

void MotionMaster::DelayedDelete ( _Ty  curr)
857{
858 LOG_DEBUG("movement.motionmaster", "Unit (Entry {}) is trying to delete its updating MG (Type {})!", _owner->GetEntry(), curr->GetMovementGeneratorType());
859 if (isStatic(curr))
860 return;
861 if (!_expList)
862 _expList = new ExpireList();
863 _expList->push_back(curr);
864}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:171
uint32 GetEntry() const
Definition: Object.h:109
std::vector< _Ty > ExpireList
Definition: MotionMaster.h:255

References _expList, _owner, Object::GetEntry(), MovementGenerator::GetMovementGeneratorType(), isStatic(), and LOG_DEBUG.

Referenced by DelayedClean(), DelayedExpire(), and Mutate().

◆ DelayedExpire()

void MotionMaster::DelayedExpire ( )
private
194{
195 if (size() > 1)
196 {
197 MovementGenerator* curr = top();
198 pop();
199 if (curr) DelayedDelete(curr);
200 }
201
202 while (!empty() && !top())
203 --_top;
204}

References _top, DelayedDelete(), empty(), pop(), size(), and top().

Referenced by MovementExpired().

◆ DirectClean()

void MotionMaster::DirectClean ( bool  reset)
private
146{
147 while (size() > 1)
148 {
149 MovementGenerator* curr = top();
150 pop();
151 if (curr) DirectDelete(curr);
152 }
153
154 if (empty())
155 return;
156
157 if (needInitTop())
158 InitTop();
159 else if (reset)
160 top()->Reset(_owner);
161}
void InitTop()
Definition: MotionMaster.cpp:842
void DirectDelete(_Ty curr)
Definition: MotionMaster.cpp:848
bool needInitTop() const
Definition: MotionMaster.h:125
virtual void Reset(Unit *)=0

References _owner, DirectDelete(), empty(), InitTop(), needInitTop(), pop(), MovementGenerator::Reset(), size(), and top().

Referenced by Clear().

◆ DirectDelete()

void MotionMaster::DirectDelete ( _Ty  curr)
849{
850 if (isStatic(curr))
851 return;
852 curr->Finalize(_owner);
853 delete curr;
854}

References _owner, MovementGenerator::Finalize(), and isStatic().

Referenced by DirectClean(), DirectExpire(), DirectExpireSlot(), Initialize(), Mutate(), and UpdateMotion().

◆ DirectExpire()

void MotionMaster::DirectExpire ( bool  reset)
private
174{
175 if (size() > 1)
176 {
177 MovementGenerator* curr = top();
178 pop();
179 if (curr) DirectDelete(curr);
180 }
181
182 while (!empty() && !top())
183 --_top;
184
185 if (empty())
186 Initialize();
187 else if (needInitTop())
188 InitTop();
189 else if (reset)
190 top()->Reset(_owner);
191}
void Initialize()
Definition: MotionMaster.cpp:72

References _owner, _top, DirectDelete(), empty(), Initialize(), InitTop(), needInitTop(), pop(), MovementGenerator::Reset(), size(), and top().

Referenced by MovementExpired().

◆ DirectExpireSlot()

void MotionMaster::DirectExpireSlot ( MovementSlot  slot,
bool  reset 
)
private
207{
208 if (size() > 1)
209 {
210 MovementGenerator* curr = Impl[slot];
211
212 // pussywizard: clear slot AND decrease top immediately to avoid crashes when referencing null top in DirectDelete
213 Impl[slot] = nullptr;
214 while (!empty() && !top())
215 --_top;
216
217 if (curr) DirectDelete(curr);
218 }
219
220 while (!empty() && !top())
221 --_top;
222
223 if (empty())
224 Initialize();
225 else if (needInitTop())
226 InitTop();
227 else if (reset)
228 top()->Reset(_owner);
229}

References _owner, _top, DirectDelete(), empty(), Impl, Initialize(), InitTop(), needInitTop(), MovementGenerator::Reset(), size(), and top().

Referenced by MovementExpiredOnSlot().

◆ empty()

◆ GetCleanFlags()

uint8 MotionMaster::GetCleanFlags ( ) const
inline
159{ return _cleanFlag; }

References _cleanFlag.

◆ GetCurrentMovementGeneratorType()

MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType ( ) const
818{
819 if (empty())
820 return IDLE_MOTION_TYPE;
821
822 return top()->GetMovementGeneratorType();
823}
@ IDLE_MOTION_TYPE
Definition: MotionMaster.h:37
virtual MovementGeneratorType GetMovementGeneratorType()=0

References empty(), MovementGenerator::GetMovementGeneratorType(), IDLE_MOTION_TYPE, and top().

Referenced by GuardAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), boss_volkhan::boss_volkhanAI::GoToAnvil(), npc_commandscript::HandleNpcUnFollowCommand(), WorldSession::HandleSetRaidDifficultyOpcode(), IsMutualChase(), SmartAI::JustReachedHome(), SmartAI::MovepointReached(), SplineHandler::operator()(), SmartAI::SetCombatMove(), Unit::SetSpeed(), npc_escortAI::Start(), FollowerAI::StartFollow(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI(), npc_concentrated_ball::npc_concentrated_ballAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ GetCurrentSplineId()

uint32 MotionMaster::GetCurrentSplineId ( ) const
835{
836 if (empty())
837 return 0;
838
839 return top()->GetSplineId();
840}
virtual uint32 GetSplineId() const
Definition: MovementGenerator.h:43

References empty(), MovementGenerator::GetSplineId(), and top().

Referenced by SplineHandler::operator()().

◆ GetDestination()

bool MotionMaster::GetDestination ( float &  x,
float &  y,
float &  z 
)
867{
869 return false;
870
871 G3D::Vector3 const& dest = _owner->movespline->FinalDestination();
872 x = dest.x;
873 y = dest.y;
874 z = dest.z;
875 return true;
876}
Movement::MoveSpline * movespline
Definition: Unit.h:2708
bool Finalized() const
Definition: MoveSpline.h:116
Vector3 FinalDestination() const
Definition: MoveSpline.h:120

References _owner, Movement::MoveSpline::FinalDestination(), Movement::MoveSpline::Finalized(), and Unit::movespline.

Referenced by misc_commandscript::HandleMovegensCommand().

◆ GetMotionSlot()

_Ty MotionMaster::GetMotionSlot ( int  slot) const
inline
154 {
155 ASSERT(slot >= 0);
156 return Impl[slot];
157 }
#define ASSERT
Definition: Errors.h:68

References ASSERT, and Impl.

Referenced by HomeMovementGenerator< Creature >::_setTargetLocation(), and misc_commandscript::HandleMovegensCommand().

◆ GetMotionSlotType()

◆ InitDefault()

void MotionMaster::InitDefault ( )
87{
89}
@ MOTION_SLOT_IDLE
Definition: MotionMaster.h:61
MovementGenerator * SelectMovementGenerator(Unit *unit)
Definition: CreatureAISelector.cpp:92
void Mutate(MovementGenerator *m, MovementSlot slot)
Definition: MotionMaster.cpp:728

References _owner, MOTION_SLOT_IDLE, Mutate(), and FactorySelector::SelectMovementGenerator().

Referenced by Initialize(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::JustReachedHome(), Unit::RemoveCharmedBy(), and Creature::Respawn().

◆ Initialize()

◆ InitTop()

void MotionMaster::InitTop ( )
private
843{
845 _needInit[_top] = false;
846}
virtual void Initialize(Unit *)=0

References _needInit, _owner, _top, MovementGenerator::Initialize(), and top().

Referenced by DirectClean(), DirectExpire(), DirectExpireSlot(), and UpdateMotion().

◆ MoveBackwards()

void MotionMaster::MoveBackwards ( Unit target,
float  dist 
)
322{
323 if (!target)
324 {
325 return;
326 }
327
328 Position const& pos = target->GetPosition();
329 float angle = target->GetAngle(_owner);
330 G3D::Vector3 point;
331 point.x = pos.m_positionX + dist * cosf(angle);
332 point.y = pos.m_positionY + dist * sinf(angle);
333 point.z = pos.m_positionZ;
334
335 if (!_owner->GetMap()->CanReachPositionAndGetValidCoords(_owner, point.x, point.y, point.z, true, true))
336 {
337 return;
338 }
339
341 init.MoveTo(point.x, point.y, point.z, false);
342 init.SetFacing(target);
343 init.SetOrientationInversed();
344 init.Launch();
345}
Map * GetMap() const
Definition: Object.h:517
Definition: Position.h:28
float m_positionZ
Definition: Position.h:58
float m_positionX
Definition: Position.h:56
float m_positionY
Definition: Position.h:57
void GetPosition(float &x, float &y) const
Definition: Position.h:122
float GetAngle(const Position *pos) const
Definition: Position.cpp:77
bool CanReachPositionAndGetValidCoords(WorldObject const *source, PathGenerator *path, float &destX, float &destY, float &destZ, bool failOnCollision=true, bool failOnSlopes=true) const
Check if a given source can reach a specific point following a path and normalize the coords....
Definition: Map.cpp:3806
Definition: MoveSplineInit.h:71

References _owner, Map::CanReachPositionAndGetValidCoords(), Position::GetAngle(), WorldObject::GetMap(), Position::GetPosition(), Movement::MoveSplineInit::Launch(), Position::m_positionX, Position::m_positionY, Position::m_positionZ, Movement::MoveSplineInit::MoveTo(), Movement::MoveSplineInit::SetFacing(), and Movement::MoveSplineInit::SetOrientationInversed().

Referenced by CreatureAI::MoveBackwardsChecks(), and boss_quartermaster_zigris::SpellHitTarget().

◆ MoveCharge() [1/2]

void MotionMaster::MoveCharge ( float  x,
float  y,
float  z,
float  speed = SPEED_CHARGE,
uint32  id = EVENT_CHARGE,
const Movement::PointsArray path = nullptr,
bool  generatePath = false,
float  orientation = 0.0f,
ObjectGuid  targetGUID = ObjectGuid::Empty 
)
587{
588 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
590 return;
591
592 if (Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE)
593 return;
594
596 {
597 LOG_DEBUG("movement.motionmaster", "Player ({}) charge point (X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), x, y, z);
598 Mutate(new PointMovementGenerator<Player>(id, x, y, z, speed, orientation, path, generatePath, generatePath, targetGUID), MOTION_SLOT_CONTROLLED);
599 }
600 else
601 {
602 LOG_DEBUG("movement.motionmaster", "Creature ({}) charge point (X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), x, y, z);
603 Mutate(new PointMovementGenerator<Creature>(id, x, y, z, speed, orientation, path, generatePath, generatePath, targetGUID), MOTION_SLOT_CONTROLLED);
604 }
605}
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
@ UNIT_FLAG_DISABLE_MOVE
Definition: Unit.h:450
@ MOTION_SLOT_CONTROLLED
Definition: MotionMaster.h:63
@ DISTRACT_MOTION_TYPE
Definition: MotionMaster.h:48
TypeID GetTypeId() const
Definition: Object.h:121
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
std::string ToString() const
Definition: ObjectGuid.cpp:47
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:1478
Definition: PointMovementGenerator.h:26

References _owner, DISTRACT_MOTION_TYPE, Object::GetGUID(), Object::GetTypeId(), Unit::HasUnitFlag(), Impl, LOG_DEBUG, MOTION_SLOT_CONTROLLED, Mutate(), ObjectGuid::ToString(), TYPEID_PLAYER, and UNIT_FLAG_DISABLE_MOVE.

Referenced by boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), npc_saurfang_event::npc_saurfang_eventAI::DoAction(), boss_professor_putricide::boss_professor_putricideAI::DoAction(), npc_living_mojo::npc_living_mojoAI::DoAction(), npc_akama_illidan::npc_akama_illidanAI::DoAction(), Spell::EffectCharge(), Spell::EffectChargeDest(), boss_professor_putricide::boss_professor_putricideAI::EnterEvadeMode(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), spell_the_lich_king_valkyr_target_search::spell_the_lich_king_valkyr_target_search_SpellScript::HandleScript(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), MoveCharge(), npc_kinetic_bomb::npc_kinetic_bombAI::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_hadronox::boss_hadronoxAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), and npc_iron_watcher::npc_iron_watcherAI::UpdateAI().

◆ MoveCharge() [2/2]

void MotionMaster::MoveCharge ( PathGenerator const &  path,
float  speed = SPEED_CHARGE,
ObjectGuid  targetGUID = ObjectGuid::Empty 
)
608{
609 G3D::Vector3 dest = path.GetActualEndPosition();
610
611 MoveCharge(dest.x, dest.y, dest.z, speed, EVENT_CHARGE_PREPATH, nullptr, false, 0.0f, targetGUID);
612
613 // Charge movement is not started when using EVENT_CHARGE_PREPATH
615 init.MovebyPath(path.GetPath());
616 init.SetVelocity(speed);
617 init.Launch();
618}
#define EVENT_CHARGE_PREPATH
Definition: boss_icecrown_gunship_battle.cpp:102
void MoveCharge(float x, float y, float z, float speed=SPEED_CHARGE, uint32 id=EVENT_CHARGE, const Movement::PointsArray *path=nullptr, bool generatePath=false, float orientation=0.0f, ObjectGuid targetGUID=ObjectGuid::Empty)
Definition: MotionMaster.cpp:586

References _owner, EVENT_CHARGE_PREPATH, PathGenerator::GetActualEndPosition(), PathGenerator::GetPath(), Movement::MoveSplineInit::Launch(), Movement::MoveSplineInit::MovebyPath(), MoveCharge(), and Movement::MoveSplineInit::SetVelocity().

◆ MoveChase() [1/3]

void MotionMaster::MoveChase ( Unit target,
float  dist 
)
inline
205{ MoveChase(target, ChaseRange(dist)); }
Definition: MotionMaster.h:82
void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Definition: MotionMaster.cpp:299

References MoveChase().

Referenced by MoveChase().

◆ MoveChase() [2/3]

void MotionMaster::MoveChase ( Unit target,
float  dist,
float  angle 
)
inline
204{ MoveChase(target, ChaseRange(dist), ChaseAngle(angle)); }
Definition: MotionMaster.h:95

References MoveChase().

Referenced by MoveChase().

◆ MoveChase() [3/3]

void MotionMaster::MoveChase ( Unit target,
std::optional< ChaseRange dist = {},
std::optional< ChaseAngle angle = {} 
)
300{
301 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
302 // ignore movement request if target not exist
303 if (!target || target == _owner || _owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
304 return;
305
306 //_owner->ClearUnitState(UNIT_STATE_FOLLOW);
308 {
309 LOG_DEBUG("movement.motionmaster", "Player ({}) chase to {} ({})",
310 _owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString());
312 }
313 else
314 {
315 LOG_DEBUG("movement.motionmaster", "Creature ({}) chase to {} ({})",
316 _owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString());
318 }
319}
@ MOTION_SLOT_ACTIVE
Definition: MotionMaster.h:62
Definition: TargetedMovementGenerator.h:39

References _owner, Object::GetGUID(), Object::GetTypeId(), Unit::HasUnitFlag(), LOG_DEBUG, MOTION_SLOT_ACTIVE, Mutate(), ObjectGuid::ToString(), TYPEID_PLAYER, and UNIT_FLAG_DISABLE_MOVE.

Referenced by UnitAI::AttackStart(), FollowerAI::AttackStart(), boss_priestess_lackey_commonAI::AttackStart(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::AttackStart(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::AttackStart(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::AttackStart(), boss_malygos::boss_malygosAI::AttackStart(), boss_illidan_stormrage::boss_illidan_stormrageAI::AttackStart(), ArcherAI::AttackStart(), npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_alyson_antille::boss_alyson_antilleAI::AttackStart(), boss_gazakrothAI::AttackStart(), boss_slither::boss_slitherAI::AttackStart(), npc_zelfrax::npc_zelfraxAI::AttackStart(), boss_magus_telestra::boss_magus_telestraAI::AttackStart(), boss_razorscale::boss_razorscaleAI::AttackStart(), boss_high_nethermancer_zerevor::boss_high_nethermancer_zerevorAI::AttackStart(), boss_lady_malande::boss_lady_malandeAI::AttackStart(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::AttackStart(), boss_olm_the_summoner::boss_olm_the_summonerAI::AttackStart(), boss_krosh_firehand::boss_krosh_firehandAI::AttackStart(), npc_millhouse_manastorm::npc_millhouse_manastormAI::AttackStart(), boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::AttackStart(), UnitAI::AttackStartCaster(), boss_thorim::boss_thorimAI::DamageTaken(), boss_skadi::boss_skadiAI::DoAction(), PetAI::DoAttack(), ScriptedAI::DoStartMovement(), boss_halazzi::boss_halazziAI::EnterPhase(), boss_zuljin::boss_zuljinAI::EnterPhase(), RestoreAttack::Execute(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), npc_zelfrax::npc_zelfraxAI::MovementInform(), Unit::PetSpellFail(), Unit::RemoveCharmedBy(), Resurrect(), npc_anubarak_spike::npc_anubarak_spikeAI::SelectNewTarget(), SmartAI::SetCombatMove(), SmartAI::SetForcedCombatMove(), boss_volkhan::boss_volkhanAI::SpellHitTarget(), npc_nerubian_burrower::npc_nerubian_burrowerAI::SpellHitTarget(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_quartermaster_zigris::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_selin_fireheart::boss_selin_fireheartAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UpdateAI(), boss_headless_horseman::UpdateAI(), npc_frost_wyrm::npc_frost_wyrmAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_lady_vashj::boss_lady_vashjAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), boss_omor_the_unscarred::boss_omor_the_unscarredAI::UpdateAI(), boss_nazan::boss_nazanAI::UpdateAI(), boss_warchief_kargath_bladefist::boss_warchief_kargath_bladefistAI::UpdateAI(), boss_high_botanist_freywinn::boss_high_botanist_freywinnAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ MoveCircleTarget()

void MotionMaster::MoveCircleTarget ( Unit target)
348{
349 if (!target)
350 {
351 return;
352 }
353
354 Position pos;
355 if (!target->GetMeleeAttackPoint(_owner, pos))
356 {
357 return;
358 }
359
361 init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), false);
362 init.SetWalk(true);
363 init.SetFacing(target);
364 init.Launch();
365}
float GetPositionZ() const
Definition: Position.h:119
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
bool GetMeleeAttackPoint(Unit *attacker, Position &pos)
Definition: Unit.cpp:3040

References _owner, Unit::GetMeleeAttackPoint(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Movement::MoveSplineInit::Launch(), Movement::MoveSplineInit::MoveTo(), Movement::MoveSplineInit::SetFacing(), and Movement::MoveSplineInit::SetWalk().

Referenced by CreatureAI::MoveCircleChecks().

◆ MoveConfused()

void MotionMaster::MoveConfused ( )
282{
283 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
285 return;
286
288 {
289 LOG_DEBUG("movement.motionmaster", "Player ({}) move confused", _owner->GetGUID().ToString());
291 }
292 else
293 {
294 LOG_DEBUG("movement.motionmaster", "Creature ({}) move confused", _owner->GetGUID().ToString());
296 }
297}
Definition: ConfusedMovementGenerator.h:28

References _owner, Object::GetGUID(), Object::GetTypeId(), Unit::HasUnitFlag(), LOG_DEBUG, MOTION_SLOT_CONTROLLED, Mutate(), ObjectGuid::ToString(), TYPEID_PLAYER, and UNIT_FLAG_DISABLE_MOVE.

Referenced by Unit::SetConfused().

◆ MoveDistract()

void MotionMaster::MoveDistract ( uint32  time)
707{
709 return;
710
711 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
713 return;
714
715 /*if (_owner->GetTypeId() == TYPEID_PLAYER)
716 {
717 LOG_DEBUG("movement.motionmaster", "Player ({}) distracted (timer: {})", _owner->GetGUID().ToString(), timer);
718 }
719 else
720 {
721 LOG_DEBUG("movement.motionmaster", "Creature ({}) (timer: {})", _owner->GetGUID().ToString(), timer);
722 }*/
723
726}
Definition: IdleMovementGenerator.h:50

References _owner, Unit::HasUnitFlag(), Impl, MOTION_SLOT_CONTROLLED, Mutate(), and UNIT_FLAG_DISABLE_MOVE.

Referenced by Spell::EffectDistract(), and CreatureAI::TriggerAlert().

◆ MoveFall()

void MotionMaster::MoveFall ( uint32  id = 0,
bool  addFlagForNPC = false 
)
546{
547 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
549 return;
550
551 // use larger distance for vmap height search than in most other cases
553 if (tz <= INVALID_HEIGHT)
554 {
555 LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveFall: unable retrive a proper height at map {} (x: {}, y: {}, z: {}).",
557 return;
558 }
559
560 // Abort too if the ground is very near
561 if (std::fabs(_owner->GetPositionZ() - tz) < 0.1f)
562 return;
563
565 {
569 }
570 else if (_owner->GetTypeId() == TYPEID_UNIT && addFlagForNPC) // pussywizard
571 {
577 }
578
580 init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz + _owner->GetHoverHeight());
581 init.SetFall();
582 init.Launch();
584}
@ TYPEID_UNIT
Definition: ObjectGuid.h:37
@ MOVEMENTFLAG_MASK_MOVING
Definition: Unit.h:585
@ MOVEMENTFLAG_FLYING
Definition: Unit.h:577
@ MOVEMENTFLAG_CAN_FLY
Definition: Unit.h:576
@ MOVEMENTFLAG_FALLING
Definition: Unit.h:564
#define MAX_FALL_DISTANCE
Definition: Map.h:165
#define INVALID_HEIGHT
Definition: Map.h:164
Seconds GetGameTime()
Definition: GameTime.cpp:38
Player * ToPlayer()
Definition: Object.h:195
void SetFallTime(uint32 newFallTime)
Definition: Object.h:328
float GetMapHeight(float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
Definition: Object.cpp:3034
MovementInfo m_movementInfo
Definition: Object.h:595
void SetFallInformation(uint32 time, float z)
Definition: Player.h:2284
float GetHoverHeight() const
Definition: Unit.h:2655
void AddUnitMovementFlag(uint32 f)
Definition: Unit.h:2540
void SendMovementFlagUpdate(bool self=false)
Definition: Unit.cpp:17646
void RemoveUnitMovementFlag(uint32 f)
Definition: Unit.h:2541
uint32 GetId() const
Definition: Map.h:378
Definition: PointMovementGenerator.h:73

References _owner, Unit::AddUnitMovementFlag(), GameTime::GetGameTime(), Unit::GetHoverHeight(), Map::GetId(), WorldObject::GetMap(), WorldObject::GetMapHeight(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::GetTypeId(), Unit::HasUnitFlag(), INVALID_HEIGHT, Movement::MoveSplineInit::Launch(), LOG_DEBUG, WorldObject::m_movementInfo, MAX_FALL_DISTANCE, MOTION_SLOT_CONTROLLED, MOVEMENTFLAG_CAN_FLY, MOVEMENTFLAG_FALLING, MOVEMENTFLAG_FLYING, MOVEMENTFLAG_MASK_MOVING, Movement::MoveSplineInit::MoveTo(), Mutate(), Unit::RemoveUnitMovementFlag(), Unit::SendMovementFlagUpdate(), Movement::MoveSplineInit::SetFall(), Player::SetFallInformation(), MovementInfo::SetFallTime(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, and UNIT_FLAG_DISABLE_MOVE.

Referenced by Unit::_ExitVehicle(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), Totem::InitSummon(), boss_ayamiss::JustDied(), Player::KillPlayer(), spell_chapter5_light_of_dawn_aura::spell_chapter5_light_of_dawn_aura_AuraScript::OnRemove(), Creature::setDeathState(), npc_wild_wyrm::npc_wild_wyrmAI::SpellHit(), boss_krick::boss_krickAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), and npc_pet_gen_wind_rider_cub::UpdateAI().

◆ MoveFleeing()

void MotionMaster::MoveFleeing ( Unit enemy,
uint32  time = 0 
)
658{
659 if (!enemy)
660 return;
661
662 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
664 return;
665
667 {
668 LOG_DEBUG("movement.motionmaster", "Player ({}) flee from {} ({})",
669 _owner->GetGUID().ToString(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetGUID().ToString());
671 }
672 else
673 {
674 LOG_DEBUG("movement.motionmaster", "Creature ({}) flee from {} ({}) {}",
675 _owner->GetGUID().ToString(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetGUID().ToString(), time ? " for a limited time" : "");
676 if (time)
678 else
680 }
681}
Definition: FleeingMovementGenerator.h:25
Definition: FleeingMovementGenerator.h:48

References _owner, Object::GetGUID(), Object::GetTypeId(), Unit::HasUnitFlag(), LOG_DEBUG, MOTION_SLOT_CONTROLLED, Mutate(), ObjectGuid::ToString(), TYPEID_PLAYER, and UNIT_FLAG_DISABLE_MOVE.

Referenced by Unit::SetFeared(), and boss_headless_horseman_head::SpellHit().

◆ MoveFollow()

void MotionMaster::MoveFollow ( Unit target,
float  dist,
float  angle,
MovementSlot  slot = MOTION_SLOT_ACTIVE 
)
368{
369 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
370 // ignore movement request if target not exist
371 if (!target || target == _owner || _owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
372 {
373 return;
374 }
375
376 //_owner->AddUnitState(UNIT_STATE_FOLLOW);
378 {
379 LOG_DEBUG("movement.motionmaster", "Player ({}) follow to {} ({})",
380 _owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString());
381 Mutate(new FollowMovementGenerator<Player>(target, dist, angle), slot);
382 }
383 else
384 {
385 LOG_DEBUG("movement.motionmaster", "Creature ({}) follow to {} ({})",
386 _owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString());
387 Mutate(new FollowMovementGenerator<Creature>(target, dist, angle), slot);
388 }
389}
Definition: TargetedMovementGenerator.h:75

References _owner, Object::GetGUID(), Object::GetTypeId(), Unit::HasUnitFlag(), LOG_DEBUG, Mutate(), ObjectGuid::ToString(), TYPEID_PLAYER, and UNIT_FLAG_DISABLE_MOVE.

Referenced by npc_argent_captainAI::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), Spell::EffectSummonType(), npc_shay_leafrunner::npc_shay_leafrunnerAI::EnterEvadeMode(), npc_argent_captainAI::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), npc_burning_spirit::npc_burning_spiritAI::EnterEvadeMode(), npc_mrfloppy::npc_mrfloppyAI::EnterEvadeMode(), npc_pet_gen_argent_pony_bridle::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), boss_halazzi::boss_halazziAI::EnterPhase(), startFollow::Execute(), npc_dark_iron_guzzler::FindNextKeg(), spell_q11919_q11940_drake_hunt::spell_q11919_q11940_drake_hunt_AuraScript::HandleEffectRemove(), AuraEffect::HandleModPossessPet(), npc_commandscript::HandleNpcFollowCommand(), spell_item_enchanted_broom_periodic::HandlePeriodicTick(), WorldSession::HandlePetActionHelper(), PetAI::HandleReturnMovement(), spell_item_draenic_pale_ale::HandleSummon(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), npc_pet_dk_dancing_rune_weapon::npc_pet_dk_dancing_rune_weaponAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), npc_burning_spirit::npc_burning_spiritAI::IsSummonedBy(), npc_spirit_shade::npc_spirit_shadeAI::IsSummonedBy(), boss_auriaya::boss_auriayaAI::JustSummoned(), npc_frosthound::npc_frosthoundAI::JustSummoned(), boss_mekgineer_steamrigger::boss_mekgineer_steamriggerAI::JustSummoned(), boss_ichoron::boss_ichoronAI::JustSummoned(), boss_xevozz::boss_xevozzAI::JustSummoned(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::JustSummoned(), boss_vexallus::boss_vexallusAI::JustSummoned(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::JustSummoned(), boss_supremus::boss_supremusAI::JustSummoned(), boss_archimonde::boss_archimondeAI::JustSummoned(), npc_fel_guard_hound::npc_fel_guard_houndAI::MovementInform(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), npc_kernobee::OnQuestAccept(), Unit::PetSpellFail(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_assembly_lightning::npc_assembly_lightningAI::Reset(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), Unit::SetCharmedBy(), SmartAI::SetFollow(), FollowerAI::SetFollowPaused(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_death_knight_initiate::npc_death_knight_initiateAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), npc_shay_leafrunner::npc_shay_leafrunnerAI::SpellHit(), boss_ionar::boss_ionarAI::Split(), npc_shay_leafrunner::npc_shay_leafrunnerAI::sQuestAccept(), FollowerAI::StartFollow(), Spell::SummonGuardian(), Pet::Update(), SimpleCharmedAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), boss_halazzi::boss_halazziAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_elder_kekek::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_doomfire_targetting::npc_doomfire_targettingAI::UpdateAI(), npc_voidtraveler::npc_voidtravelerAI::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_gen_toxic_wasteling::UpdateAI(), FollowerAI::UpdateAI(), npc_demonic_vapor::npc_demonic_vaporAI::UpdateAI(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::UpdateAI(), npc_xt002_boombot::npc_xt002_boombotAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ MoveIdle()

void MotionMaster::MoveIdle ( )

Should be preceded by MovementExpired or Clear if there's an overlying movementgenerator active

232{
234 if (empty() || !isStatic(top()))
236}
MovementGenerator * GetIdleMovementGenerator()
Definition: MotionMaster.cpp:35

References empty(), GetIdleMovementGenerator(), isStatic(), MOTION_SLOT_IDLE, Mutate(), and top().

Referenced by PetAI::_stopAttack(), npc_nexus_lord::npc_nexus_lordAI::AttackStart(), ArcherAI::AttackStart(), npc_mograine::npc_mograineAI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_twilight_volunteer::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), npc_anubarak_spike::npc_anubarak_spikeAI::DoAction(), npc_power_spark::npc_power_sparkAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), PetAI::DoAttack(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ScriptedAI::DoStartNoMovement(), GuardAI::EnterEvadeMode(), npc_hallows_end_soh::FinishEvent(), CreatureGroup::FormationReset(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), spell_item_toxic_wasteling::HandleJump(), WorldSession::HandlePetActionHelper(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), Creature::Motion_Initialize(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::MoveInLineOfSight(), PetAI::MovementInform(), boss_bug_trio::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), boss_four_horsemen::boss_four_horsemenAI::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), boss_nefarian::PathEndReached(), SmartAI::PausePath(), NPCStaveQuestAI::PrepareForEncounter(), PretendToDie(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), Unit::SetCharmedBy(), SmartAI::SetCombatMove(), Unit::setDeathState(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_forest_frog::npc_forest_frogAI::SpellHit(), npc_shay_leafrunner::npc_shay_leafrunnerAI::SpellHit(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), npc_escortAI::Start(), FollowerAI::StartFollow(), SmartAI::StopFollow(), SmartAI::StopPath(), boss_jedoga_shadowseeker::SummonedCreatureDies(), Pet::Update(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_archimonde::boss_archimondeAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_high_botanist_freywinn::boss_high_botanist_freywinnAI::UpdateAI(), and npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI().

◆ MoveJump() [1/2]

void MotionMaster::MoveJump ( float  x,
float  y,
float  z,
float  speedXY,
float  speedZ,
uint32  id = 0,
Unit const *  target = nullptr 
)
526{
527 LOG_DEBUG("movement.motionmaster", "Unit ({}) jump to point (X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), x, y, z);
528
529 if (speedXY <= 0.1f)
530 return;
531
532 float moveTimeHalf = speedZ / Movement::gravity;
533 float max_height = -Movement::computeFallElevation(moveTimeHalf, false, -speedZ);
534
536 init.MoveTo(x, y, z);
537 init.SetParabolic(max_height, 0);
538 init.SetVelocity(speedXY);
539 if (target)
540 init.SetFacing(target);
541 init.Launch();
543}
double gravity
Definition: MovementUtil.cpp:24
float computeFallElevation(float t_passed, bool isSafeFall, float start_velocity=0.0f)
Definition: MovementUtil.cpp:60

References _owner, Movement::computeFallElevation(), Object::GetGUID(), Movement::gravity, Movement::MoveSplineInit::Launch(), LOG_DEBUG, MOTION_SLOT_CONTROLLED, Movement::MoveSplineInit::MoveTo(), Mutate(), Movement::MoveSplineInit::SetFacing(), Movement::MoveSplineInit::SetParabolic(), Movement::MoveSplineInit::SetVelocity(), and ObjectGuid::ToString().

◆ MoveJump() [2/2]

void MotionMaster::MoveJump ( Position const &  pos,
float  speedXY,
float  speedZ,
uint32  id = 0 
)
inline

◆ MoveJumpTo()

void MotionMaster::MoveJumpTo ( float  angle,
float  speedXY,
float  speedZ 
)
512{
513 //this function may make players fall below map
515 return;
516
517 float x, y, z;
518
519 float moveTimeHalf = speedZ / Movement::gravity;
520 float dist = 2 * moveTimeHalf * speedXY;
521 _owner->GetClosePoint(x, y, z, _owner->GetObjectSize(), dist, angle);
522 MoveJump(x, y, z, speedXY, speedZ);
523}
bool GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
Definition: Object.cpp:2647
float GetObjectSize() const
Definition: Object.cpp:2719

References _owner, WorldObject::GetClosePoint(), WorldObject::GetObjectSize(), Object::GetTypeId(), Movement::gravity, MoveJump(), and TYPEID_PLAYER.

Referenced by Unit::JumpTo(), and npc_engineer_helice::OnQuestAccept().

◆ MoveKnockbackFrom()

void MotionMaster::MoveKnockbackFrom ( float  srcX,
float  srcY,
float  speedXY,
float  speedZ 
)
486{
487 //this function may make players fall below map
489 return;
490
491 if (speedXY <= 0.1f)
492 return;
493
494 Position dest = _owner->GetPosition();
495 float moveTimeHalf = speedZ / Movement::gravity;
496 float dist = 2 * moveTimeHalf * speedXY;
497 float max_height = -Movement::computeFallElevation(moveTimeHalf, false, -speedZ);
498
499 // Use a mmap raycast to get a valid destination.
500 _owner->MovePositionToFirstCollision(dest, dist, _owner->GetRelativeAngle(srcX, srcY) + float(M_PI));
501
503 init.MoveTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ());
504 init.SetParabolic(max_height, 0);
505 init.SetOrientationFixed(true);
506 init.SetVelocity(speedXY);
507 init.Launch();
509}
void MovePositionToFirstCollision(Position &pos, float dist, float angle)
Definition: Object.cpp:2806
float GetRelativeAngle(const Position *pos) const
Definition: Position.h:197

References _owner, Movement::computeFallElevation(), Position::GetPosition(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Position::GetRelativeAngle(), Object::GetTypeId(), Movement::gravity, Movement::MoveSplineInit::Launch(), MOTION_SLOT_CONTROLLED, WorldObject::MovePositionToFirstCollision(), Movement::MoveSplineInit::MoveTo(), Mutate(), Movement::MoveSplineInit::SetOrientationFixed(), Movement::MoveSplineInit::SetParabolic(), Movement::MoveSplineInit::SetVelocity(), and TYPEID_PLAYER.

Referenced by Unit::KnockbackFrom().

◆ MoveLand() [1/2]

void MotionMaster::MoveLand ( uint32  id,
float  x,
float  y,
float  z,
float  speed = 0.0f 
)
450{
451 Position pos = {x, y, z, 0.0f};
452 MoveLand(id, pos, speed);
453}
void MoveLand(uint32 id, Position const &pos, float speed=0.0f)
Definition: MotionMaster.cpp:425

References MoveLand().

◆ MoveLand() [2/2]

void MotionMaster::MoveLand ( uint32  id,
Position const &  pos,
float  speed = 0.0f 
)
426{
427 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
429 return;
430
431 float x, y, z;
432 pos.GetPosition(x, y, z);
433
434 LOG_DEBUG("movement.motionmaster", "Creature (Entry: {}) landing point (ID: {} X: {} Y: {} Z: {})", _owner->GetEntry(), id, x, y, z);
435
437 init.MoveTo(x, y, z);
438
439 if (speed > 0.0f)
440 {
441 init.SetVelocity(speed);
442 }
443
444 init.SetAnimation(Movement::ToGround);
445 init.Launch();
447}
@ ToGround
Definition: MoveSplineInit.h:34

References _owner, Object::GetEntry(), Position::GetPosition(), Unit::HasUnitFlag(), Movement::MoveSplineInit::Launch(), LOG_DEBUG, MOTION_SLOT_ACTIVE, Movement::MoveSplineInit::MoveTo(), Mutate(), Movement::MoveSplineInit::SetAnimation(), Movement::MoveSplineInit::SetVelocity(), Movement::ToGround, and UNIT_FLAG_DISABLE_MOVE.

Referenced by npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrmAI::DoAction(), boss_taldaram::DoAction(), FrostwyrmLandEvent::Execute(), spell_svalna_revive_champion::spell_svalna_revive_champion_SpellScript::Land(), MoveLand(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), boss_nefarian::PathEndReached(), boss_razorscale::boss_razorscaleAI::SpellHit(), boss_onyxia::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), and boss_malygos::boss_malygosAI::UpdateAI().

◆ MovementExpired()

void MotionMaster::MovementExpired ( bool  reset = true)
inline
179 {
181 {
182 if (reset)
184 else
185 _cleanFlag &= ~MMCF_RESET;
187 }
188 else
189 DirectExpire(reset);
190 }
void DirectExpire(bool reset)
Definition: MotionMaster.cpp:173
void DelayedExpire()
Definition: MotionMaster.cpp:193

References _cleanFlag, DelayedExpire(), DirectExpire(), MMCF_RESET, and MMCF_UPDATE.

Referenced by npc_escortAI::AttackStart(), SmartAI::AttackStart(), npc_mograine::npc_mograineAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), go_commandscript::DoTeleport(), boss_volkhan::boss_volkhanAI::GoToAnvil(), misc_commandscript::HandleAppearCommand(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoTicketCommand(), go_commandscript::HandleGoZoneXYCommand(), misc_commandscript::HandleGroupSummonCommand(), WorldSession::HandleMoveWorldportAck(), npc_commandscript::HandleNpcUnFollowCommand(), tele_commandscript::HandleTeleCommand(), tele_commandscript::HandleTeleGroupCommand(), Player::LeaveBattleground(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), SmartAI::PausePath(), PretendToDie(), Unit::RemoveCharmedBy(), WorldSession::SendDoFlight(), Unit::SetConfused(), Unit::SetFeared(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), npc_escortAI::Start(), SmartAI::StopPath(), Player::TeleportTo(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI(), npc_pet_gen_toxic_wasteling::UpdateAI(), and UpdateMotion().

◆ MovementExpiredOnSlot()

void MotionMaster::MovementExpiredOnSlot ( MovementSlot  slot,
bool  reset = true 
)
inline
193 {
194 // xinef: cannot be used during motion update!
195 if (!(_cleanFlag & MMCF_UPDATE))
196 DirectExpireSlot(slot, reset);
197 }
void DirectExpireSlot(MovementSlot slot, bool reset)
Definition: MotionMaster.cpp:206

References _cleanFlag, DirectExpireSlot(), and MMCF_UPDATE.

Referenced by PetAI::DoAttack(), and Unit::RemoveCharmedBy().

◆ MovePath()

void MotionMaster::MovePath ( uint32  path_id,
bool  repeatable 
)
759{
760 if (!path_id)
761 return;
762
763 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
765 return;
766
767 //We set waypoint movement as new default movement generator
768 // clear ALL movement generators (including default)
769 /*while (!empty())
770 {
771 MovementGenerator *curr = top();
772 curr->Finalize(*_owner);
773 pop();
774 if (!isStatic(curr))
775 delete curr;
776 }*/
777
778 //_owner->GetTypeId() == TYPEID_PLAYER ?
779 //Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)):
781
782 LOG_DEBUG("movement.motionmaster", "{} ({}) start moving over path(Id:{}, repeatable: {})",
783 _owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", _owner->GetGUID().ToString(), path_id, repeatable ? "YES" : "NO");
784}
Definition: WaypointMovementGenerator.h:50

References _owner, Object::GetGUID(), Object::GetTypeId(), Unit::HasUnitFlag(), LOG_DEBUG, MOTION_SLOT_IDLE, Mutate(), ObjectGuid::ToString(), TYPEID_PLAYER, and UNIT_FLAG_DISABLE_MOVE.

Referenced by boss_ayamiss::DamageTaken(), adyen_the_lightbringer::adyen_the_lightbringerAI::DoAction(), anchorite_karja::anchorite_karjaAI::DoAction(), exarch_orelis::exarch_orelisAI::DoAction(), boss_jeklik::EnterCombat(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::HandleExtraEvent(), boss_sartharion_shadron::boss_sartharion_shadronAI::HandleExtraEvent(), boss_sartharion_vesperon::boss_sartharion_vesperonAI::HandleExtraEvent(), spell_gen_ayamiss_swarmer_loop::HandleScript(), boss_gahzranka::boss_gahzrankaAI::IsSummonedBy(), SmartAI::JustReachedHome(), boss_hadronox::boss_hadronoxAI::JustSummoned(), boss_the_beast::boss_thebeastAI::Reset(), boss_bug_trio::Reset(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::Reset(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::SetData(), boss_the_beast::boss_thebeastAI::SetData(), npc_eastvale_peasent::SetData(), npc_thassarian2::npc_thassarian2AI::sGossipSelect(), npc_varian_wrynn::npc_varian_wrynnAI::SpawnWave(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), boss_gyth::boss_gythAI::UpdateAI(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_cameron::UpdateAI(), npc_eastvale_peasent::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_grand_magister_rommath::npc_grand_magister_rommathAI::UpdateAI(), npc_harrison_jones::npc_harrison_jonesAI::UpdateAI(), boss_headless_horseman::UpdateAI(), npc_pos_leader_second::npc_pos_leader_secondAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), and socrethar::socretharAI::UpdateAI().

◆ MovePoint() [1/2]

void MotionMaster::MovePoint ( uint32  id,
const Position pos,
bool  generatePath = true,
bool  forceDestination = true 
)
inline
211 { MovePoint(id, pos.m_positionX, pos.m_positionY, pos.m_positionZ, generatePath, forceDestination, MOTION_SLOT_ACTIVE, pos.GetOrientation()); }
float GetOrientation() const
Definition: Position.h:120
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:210

References Position::GetOrientation(), Position::m_positionX, Position::m_positionY, Position::m_positionZ, MOTION_SLOT_ACTIVE, and MovePoint().

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::AttackStart(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::AttackStart(), boss_isalien::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), npc_apothecary_genericAI::DoAction(), npc_chained_spirit::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), npc_hover_disk::npc_hover_diskAI::DoAction(), boss_skadi_grauf::boss_skadi_graufAI::DoAction(), boss_nazan::boss_nazanAI::DoAction(), boss_ayamiss::EnterCombat(), FollowerAI::EnterEvadeMode(), VehicleDespawnEvent::Execute(), OrcMoveEvent::Execute(), UtherBatteredHiltEvent::Execute(), SlaveRunEvent::Execute(), DelayedMovementEvent::Execute(), DaranavanMoveEvent::Execute(), npc_hallows_end_soh::FinishEvent(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), spell_apothecary_lingering_fumes::HandleAfterCast(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), misc_commandscript::HandleComeToMeCommand(), spell_q12589_shoot_rjr::spell_q12589_shoot_rjr_SpellScript::HandleDummy(), spell_q11520_discovering_your_roots::HandleDummy(), boss_malygos::boss_malygosAI::HandleIntroSpeech(), PetAI::HandleReturnMovement(), boss_eck::boss_eckAI::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), npc_wintergarde_gryphon::IsSummonedBy(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::IsSummonedBy(), npc_frost_wyrm::npc_frost_wyrmAI::JustDied(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), npc_gargoyle::npc_gargoyleAI::JustDied(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::JustSummoned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::JustSummoned(), npc_kalecgos_kj::npc_kalecgos_kjAI::JustSummoned(), boss_captain_skarloc::boss_captain_skarlocAI::JustSummoned(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::JustSummoned(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_akama_shade::npc_akamaAI::JustSummoned(), npc_creature_generator_akama::npc_creature_generator_akamaAI::JustSummoned(), boss_fathomlord_karathress::boss_fathomlord_karathressAI::JustSummoned(), boss_lady_vashj::boss_lady_vashjAI::JustSummoned(), npc_rinji::npc_rinjiAI::JustSummoned(), npc_maghar_captive::npc_maghar_captiveAI::JustSummoned(), boss_ayamiss::JustSummoned(), CreatureGroup::LeaderMoveTo(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), boss_jedoga_shadowseeker::MovementInform(), MovePoint(), npc_cameron::MoveTheChildren(), boss_four_horsemen::boss_four_horsemenAI::MoveToCorner(), npc_zelfrax::npc_zelfraxAI::MoveToDock(), npc_concentrated_ball::npc_concentrated_ballAI::MoveToNextPoint(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_omen::npc_omenAI::npc_omenAI(), npc_pos_after_first_boss::npc_pos_after_first_bossAI::npc_pos_after_first_bossAI(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_oculus_drake::npc_oculus_drakeAI::PassengerBoarded(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::PickNewLocation(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), boss_kalec::boss_kalecAI::Reset(), npc_janalai_hatchling::npc_janalai_hatchlingAI::Reset(), npc_zulian_prowler::npc_zulian_prowlerAI::Reset(), boss_jedoga_shadowseeker::Reset(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::Reset(), npc_xt002_boombot::npc_xt002_boombotAI::Reset(), npc_released_offspring_harkoa::npc_released_offspring_harkoaAI::Reset(), SmartAI::ReturnToLastOOCPos(), npc_escortAI::ReturnToLastPoint(), boss_selin_fireheart::boss_selin_fireheartAI::SelectNearestCrystal(), boss_sartharion::boss_sartharionAI::SendLavaWaves(), gunship_npc_AI::SetData(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::SetData(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_akama_illidan::npc_akama_illidanAI::sGossipSelect(), npc_varian_wrynn::npc_varian_wrynnAI::SpawnWave(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::SpellHit(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::SpellHit(), npc_saurfang_event::npc_saurfang_eventAI::SpellHit(), npc_forest_frog::npc_forest_frogAI::SpellHit(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::SpellHit(), npc_wild_wyrm::npc_wild_wyrmAI::SpellHit(), boss_attumen::boss_attumenAI::SpellHitTarget(), npc_pet_gen_fetch_ball::SpellHitTarget(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), npc_stillpine_capitive::npc_stillpine_capitiveAI::StartMoving(), boss_vazruden_the_herald::boss_vazruden_the_heraldAI::SummonedCreatureDies(), boss_jedoga_shadowseeker::SummonedCreatureDies(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave(), boss_nightbane::boss_nightbaneAI::TakeOff(), npc_escortAI::UpdateAI(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_majordomo::boss_majordomoAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_nightbane::boss_nightbaneAI::UpdateAI(), npc_eye_of_acherus::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::UpdateAI(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalec::boss_kalecAI::UpdateAI(), npc_singularity::npc_singularityAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_grand_magister_rommath::npc_grand_magister_rommathAI::UpdateAI(), npc_akilzon_eagle::npc_akilzon_eagleAI::UpdateAI(), npc_janalai_hatcher::npc_janalai_hatcherAI::UpdateAI(), npc_forest_frog::npc_forest_frogAI::UpdateAI(), npc_harrison_jones::npc_harrison_jonesAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_elder_kekek::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_doomfire_targetting::npc_doomfire_targettingAI::UpdateAI(), npc_gargoyle::npc_gargoyleAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), npc_shay_leafrunner::npc_shay_leafrunnerAI::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), npc_twilight_volunteer::UpdateAI(), npc_taldaram_flamesphere::UpdateAI(), npc_xerestrasza::npc_xerestraszaAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_pos_after_first_boss::npc_pos_after_first_bossAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_power_spark::npc_power_sparkAI::UpdateAI(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), boss_volkhan::boss_volkhanAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), npc_ulduar_emergency_fire_bot::npc_ulduar_emergency_fire_botAI::UpdateAI(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_preparations_for_war_vehicle::UpdateAI(), npc_shandy_dalaran::npc_shandy_dalaranAI::UpdateAI(), npc_minigob_manabonk::npc_minigob_manabonkAI::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::UpdateAI(), npc_venture_co_straggler::npc_venture_co_stragglerAI::UpdateAI(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), npc_akama_shade::npc_akamaAI::UpdateAI(), boss_lady_vashj::boss_lady_vashjAI::UpdateAI(), boss_nazan::boss_nazanAI::UpdateAI(), boss_warchief_kargath_bladefist::boss_warchief_kargath_bladefistAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), boss_wrath_scryer_soccothrates::boss_wrath_scryer_soccothratesAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_tooga::npc_toogaAI::UpdateFollowerAI(), and npc_emily::npc_emilyAI::WaypointReached().

◆ MovePoint() [2/2]

void MotionMaster::MovePoint ( uint32  id,
float  x,
float  y,
float  z,
bool  generatePath = true,
bool  forceDestination = true,
MovementSlot  slot = MOTION_SLOT_ACTIVE,
float  orientation = 0.0f 
)
392{
393 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
395 return;
396
398 {
399 LOG_DEBUG("movement.motionmaster", "Player ({}) targeted point (Id: {} X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), id, x, y, z);
400 Mutate(new PointMovementGenerator<Player>(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot);
401 }
402 else
403 {
404 LOG_DEBUG("movement.motionmaster", "Creature ({}) targeted point (ID: {} X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), id, x, y, z);
405 Mutate(new PointMovementGenerator<Creature>(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot);
406 }
407}

References _owner, Object::GetGUID(), Object::GetTypeId(), Unit::HasUnitFlag(), LOG_DEBUG, Mutate(), ObjectGuid::ToString(), TYPEID_PLAYER, and UNIT_FLAG_DISABLE_MOVE.

◆ MoveRandom()

void MotionMaster::MoveRandom ( float  wanderDistance = 0.0f)
239{
240 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
242 return;
243
244 if (_owner->GetTypeId() == TYPEID_UNIT)
245 {
246 LOG_DEBUG("movement.motionmaster", "Creature ({}) start moving random", _owner->GetGUID().ToString());
248 }
249}
Definition: RandomMovementGenerator.h:32

References _owner, Object::GetGUID(), Object::GetTypeId(), Unit::HasUnitFlag(), LOG_DEBUG, MOTION_SLOT_IDLE, Mutate(), ObjectGuid::ToString(), TYPEID_UNIT, and UNIT_FLAG_DISABLE_MOVE.

Referenced by SACActivateEvent::Execute(), spell_item_enchanted_broom_periodic::HandlePeriodicTick(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), boss_sartharion::boss_sartharionAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_lady_vashj::boss_lady_vashjAI::JustSummoned(), boss_kaelthas::boss_kaelthasAI::JustSummoned(), boss_mechano_lord_capacitus::boss_mechano_lord_capacitusAI::JustSummoned(), boss_ebonroc::boss_ebonrocAI::MovementInform(), npc_collapsing_star::npc_collapsing_starAI::npc_collapsing_starAI(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_ulduar_saronite_vapors::npc_ulduar_saronite_vaporsAI::npc_ulduar_saronite_vaporsAI(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::OnCreatureCreate(), npc_brew_bubble::Reset(), npc_infernal_attacker::npc_infernal_attackerAI::Reset(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), npc_cameron::UpdateAI(), npc_shay_leafrunner::npc_shay_leafrunnerAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), and boss_yoggsaron_death_orb::boss_yoggsaron_death_orbAI::UpdateAI().

◆ MoveRotate()

void MotionMaster::MoveRotate ( uint32  time,
RotateDirection  direction 
)
787{
788 if (!time)
789 return;
790
792}
Definition: IdleMovementGenerator.h:34

References MOTION_SLOT_ACTIVE, and Mutate().

◆ MoveSeekAssistance()

void MotionMaster::MoveSeekAssistance ( float  x,
float  y,
float  z 
)
621{
622 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
624 return;
625
627 {
628 LOG_ERROR("movement.motionmaster", "Player ({}) attempt to seek assistance", _owner->GetGUID().ToString());
629 }
630 else
631 {
632 LOG_DEBUG("movement.motionmaster", "Creature ({}) seek assistance (X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), x, y, z);
634 _owner->CastStop(0, false);
637 }
638}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
@ REACT_PASSIVE
Definition: Unit.h:1023
void SetReactState(ReactStates st)
Definition: Creature.h:88
Creature * ToCreature()
Definition: Object.h:197
void CastStop(uint32 except_spellid=0, bool withInstant=true)
Definition: Unit.cpp:1409
bool AttackStop()
Definition: Unit.cpp:11212
Definition: PointMovementGenerator.h:62

References _owner, Unit::AttackStop(), Unit::CastStop(), Object::GetGUID(), Object::GetTypeId(), Unit::HasUnitFlag(), LOG_DEBUG, LOG_ERROR, MOTION_SLOT_ACTIVE, Mutate(), REACT_PASSIVE, Creature::SetReactState(), Object::ToCreature(), ObjectGuid::ToString(), TYPEID_PLAYER, and UNIT_FLAG_DISABLE_MOVE.

Referenced by Creature::DoFleeToGetAssistance().

◆ MoveSeekAssistanceDistract()

void MotionMaster::MoveSeekAssistanceDistract ( uint32  timer)
641{
642 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
644 return;
645
647 {
648 LOG_ERROR("movement.motionmaster", "Player ({}) attempt to call distract after assistance", _owner->GetGUID().ToString());
649 }
650 else
651 {
652 LOG_DEBUG("movement.motionmaster", "Creature ({}) is distracted after assistance call (Time: {})", _owner->GetGUID().ToString(), time);
654 }
655}
Definition: IdleMovementGenerator.h:65

References _owner, Object::GetGUID(), Object::GetTypeId(), Unit::HasUnitFlag(), LOG_DEBUG, LOG_ERROR, MOTION_SLOT_ACTIVE, Mutate(), ObjectGuid::ToString(), TYPEID_PLAYER, and UNIT_FLAG_DISABLE_MOVE.

Referenced by AssistanceMovementGenerator::Finalize().

◆ MoveSplinePath()

void MotionMaster::MoveSplinePath ( Movement::PointsArray path)

◆ MoveTakeoff() [1/2]

void MotionMaster::MoveTakeoff ( uint32  id,
float  x,
float  y,
float  z,
float  speed = 0.0f 
)
480{
481 Position pos = {x, y, z, 0.0f};
482 MoveTakeoff(id, pos, speed);
483}
void MoveTakeoff(uint32 id, Position const &pos, float speed=0.0f)
Definition: MotionMaster.cpp:455

References MoveTakeoff().

◆ MoveTakeoff() [2/2]

void MotionMaster::MoveTakeoff ( uint32  id,
Position const &  pos,
float  speed = 0.0f 
)

◆ MoveTargetedHome()

void MotionMaster::MoveTargetedHome ( )
252{
253 Clear(false);
254
256 {
257 LOG_DEBUG("movement.motionmaster", "Creature ({}) targeted home", _owner->GetGUID().ToString());
259 }
261 {
263 // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
265 return;
266
267 LOG_DEBUG("movement.motionmaster", "Pet or controlled creature ({}) targeting home", _owner->GetGUID().ToString());
268 Unit* target = _owner->ToCreature()->GetCharmerOrOwner();
269 if (target)
270 {
271 LOG_DEBUG("movement.motionmaster", "Following {} ({})", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString());
273 }
274 }
275 else
276 {
277 LOG_ERROR("movement.motionmaster", "Player ({}) attempt targeted home", _owner->GetGUID().ToString());
278 }
279}
#define PET_FOLLOW_DIST
Definition: PetDefines.h:193
@ UNIT_STATE_EVADE
Definition: Unit.h:346
Definition: Unit.h:1290
void ClearUnitState(uint32 f)
Definition: Unit.h:1399
Unit * GetCharmerOrOwner() const
Definition: Unit.h:2063
virtual float GetFollowAngle() const
Definition: Unit.h:2660
ObjectGuid GetCharmerOrOwnerGUID() const
Definition: Unit.h:2046
void Clear(bool reset=true)
Definition: MotionMaster.h:165
Definition: HomeMovementGenerator.h:26

References _owner, Clear(), Unit::ClearUnitState(), Unit::GetCharmerOrOwner(), Unit::GetCharmerOrOwnerGUID(), Unit::GetFollowAngle(), Object::GetGUID(), Object::GetTypeId(), Unit::HasUnitFlag(), LOG_DEBUG, LOG_ERROR, MOTION_SLOT_ACTIVE, Mutate(), PET_FOLLOW_DIST, Object::ToCreature(), ObjectGuid::ToString(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_FLAG_DISABLE_MOVE, and UNIT_STATE_EVADE.

Referenced by npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), adyen_the_lightbringer::adyen_the_lightbringerAI::DoAction(), anchorite_karja::anchorite_karjaAI::DoAction(), exarch_orelis::exarch_orelisAI::DoAction(), npc_argent_captainAI::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), hyjalAI::EnterEvadeMode(), NpcRunToHome::Execute(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::FinishQuest(), wp_commandscript::HandleWpUnLoadCommand(), boss_aeonus::boss_aeonusAI::InitializeAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_nightbane::boss_nightbaneAI::Reset(), boss_arlokk::boss_arlokkAI::Reset(), kaylaan_the_lost::kaylaan_the_lostAI::ResetDeathblowEvent(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::SetData(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::UpdateAI(), npc_shandy_dalaran::npc_shandy_dalaranAI::UpdateAI(), socrethar::socretharAI::UpdateAI(), and npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI().

◆ MoveTaxiFlight()

void MotionMaster::MoveTaxiFlight ( uint32  path,
uint32  pathnode 
)
684{
686 {
687 if (path < sTaxiPathNodesByPath.size())
688 {
689 LOG_DEBUG("movement.motionmaster", "{} taxi to (Path {} node {})", _owner->GetName(), path, pathnode);
691 mgen->LoadPath(_owner->ToPlayer());
693 }
694 else
695 {
696 LOG_ERROR("movement.motionmaster", "{} attempt taxi to (not existed Path {} node {})",
697 _owner->GetName(), path, pathnode);
698 }
699 }
700 else
701 {
702 LOG_ERROR("movement.motionmaster", "Creature ({}) attempt taxi to (Path {} node {})", _owner->GetGUID().ToString(), path, pathnode);
703 }
704}
TaxiPathNodesByPath sTaxiPathNodesByPath
Definition: DBCStores.cpp:182
std::string const & GetName() const
Definition: Object.h:446
Definition: WaypointMovementGenerator.h:103
void LoadPath(Player *player)
Definition: WaypointMovementGenerator.cpp:296

References _owner, Object::GetGUID(), WorldObject::GetName(), Object::GetTypeId(), FlightPathMovementGenerator::LoadPath(), LOG_DEBUG, LOG_ERROR, MOTION_SLOT_CONTROLLED, Mutate(), sTaxiPathNodesByPath, Object::ToPlayer(), ObjectGuid::ToString(), and TYPEID_PLAYER.

Referenced by WorldSession::SendDoFlight().

◆ Mutate()

void MotionMaster::Mutate ( MovementGenerator m,
MovementSlot  slot 
)
private
729{
730 while (MovementGenerator* curr = Impl[slot])
731 {
732 bool delayed = (_top == slot && (_cleanFlag & MMCF_UPDATE));
733
734 // pussywizard: clear slot AND decrease top immediately to avoid crashes when referencing null top in DirectDelete
735 Impl[slot] = nullptr;
736 while (!empty() && !top())
737 --_top;
738
739 if (delayed)
740 DelayedDelete(curr);
741 else
742 DirectDelete(curr);
743 }
744
745 if (_top < slot)
746 _top = slot;
747
748 Impl[slot] = m;
749 if (_top > slot)
750 _needInit[slot] = true;
751 else
752 {
753 _needInit[slot] = false;
754 m->Initialize(_owner);
755 }
756}

References _cleanFlag, _needInit, _owner, _top, DelayedDelete(), DirectDelete(), empty(), Impl, MovementGenerator::Initialize(), MMCF_UPDATE, and top().

Referenced by InitDefault(), MoveCharge(), MoveChase(), MoveConfused(), MoveDistract(), MoveFall(), MoveFleeing(), MoveFollow(), MoveIdle(), MoveJump(), MoveKnockbackFrom(), MoveLand(), MovePath(), MovePoint(), MoveRandom(), MoveRotate(), MoveSeekAssistance(), MoveSeekAssistanceDistract(), MoveSplinePath(), MoveTakeoff(), MoveTargetedHome(), and MoveTaxiFlight().

◆ needInitTop()

bool MotionMaster::needInitTop ( ) const
inlineprivate
126 {
127 if (empty())
128 return false;
129 return _needInit[_top];
130 }

References _needInit, _top, and empty().

Referenced by DirectClean(), DirectExpire(), DirectExpireSlot(), and UpdateMotion().

◆ pop()

void MotionMaster::pop ( )
inlineprivate
116 {
117 if (empty())
118 return;
119
120 Impl[_top] = nullptr;
121 while (!empty() && !top())
122 --_top;
123 }

References _top, empty(), Impl, and top().

Referenced by DelayedClean(), DelayedExpire(), DirectClean(), DirectExpire(), Initialize(), and ~MotionMaster().

◆ propagateSpeedChange()

void MotionMaster::propagateSpeedChange ( )
795{
796 /*Impl::container_type::iterator it = Impl::c.begin();
797 for (; it != end(); ++it)
798 {
799 (*it)->unitSpeedChanged();
800 }*/
801 for (int i = 0; i <= _top; ++i)
802 {
803 if (Impl[i])
805 }
806}
virtual void unitSpeedChanged()
Definition: MovementGenerator.h:45

References _top, Impl, and MovementGenerator::unitSpeedChanged().

Referenced by Unit::propagateSpeedChange(), and npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI().

◆ ReinitializeMovement()

void MotionMaster::ReinitializeMovement ( )
809{
810 for (int i = 0; i <= _top; ++i)
811 {
812 if (Impl[i])
813 Impl[i]->Reset(_owner);
814 }
815}

References _owner, _top, Impl, and MovementGenerator::Reset().

Referenced by WorldSession::HandleMoveTeleportAck(), and Unit::NearTeleportTo().

◆ size()

int MotionMaster::size ( ) const
inline
147{ return _top + 1; }

References _top.

Referenced by DelayedClean(), DelayedExpire(), DirectClean(), DirectExpire(), and DirectExpireSlot().

◆ top()

◆ UpdateMotion()

void MotionMaster::UpdateMotion ( uint32  diff)
104{
105 if (!_owner)
106 return;
107
108 ASSERT(!empty());
109
111
113 if (!top()->Update(_owner, diff))
114 {
115 _cleanFlag &= ~MMCF_UPDATE;
117 }
118 else
119 _cleanFlag &= ~MMCF_UPDATE;
120
121 if (_expList)
122 {
123 for (size_t i = 0; i < _expList->size(); ++i)
124 {
125 MovementGenerator* mg = (*_expList)[i];
126 DirectDelete(mg);
127 }
128
129 delete _expList;
130 _expList = nullptr;
131
132 if (empty())
133 Initialize();
134 else if (needInitTop())
135 InitTop();
136 else if (_cleanFlag & MMCF_RESET)
137 top()->Reset(_owner);
138
139 _cleanFlag &= ~MMCF_RESET;
140 }
141
142 _cleanFlag &= ~MMCF_INUSE;
143}
@ MMCF_INUSE
Definition: MotionMaster.h:72
void Update(uint32 diff)
Definition: WeatherMgr.cpp:152
void MovementExpired(bool reset=true)
Definition: MotionMaster.h:178

References _cleanFlag, _expList, _owner, ASSERT, DirectDelete(), empty(), Initialize(), InitTop(), MMCF_INUSE, MMCF_RESET, MMCF_UPDATE, MovementExpired(), needInitTop(), MovementGenerator::Reset(), and top().

Referenced by Unit::Update().

Member Data Documentation

◆ _cleanFlag

uint8 MotionMaster::_cleanFlag
private

◆ _expList

ExpireList* MotionMaster::_expList
private

Referenced by DelayedDelete(), and UpdateMotion().

◆ _needInit

bool MotionMaster::_needInit[MAX_MOTION_SLOT]
private

◆ _owner

◆ _top

◆ Impl