16 float const MaxPassengerOffset = 250.0f;
19 bool ShouldMirrorHunterPetOnTransport(
Player const* owner,
Pet const* pet)
28 bool NeedsPassengerOffsetRefresh(
Pet const* pet)
71 init.DisableTransportPathTransformations();
72 init.MoveTo(offset.
X, offset.
Y, offset.
Z,
false,
true);
73 init.SetFacing(offset.
O);
74 init.SetTransportEnter();
78 void ResumeFollowerMotion(
Player* owner,
Pet* pet,
Transport* transport,
bool forceRestart)
89 bool wasFollowing =
false;
92 wasFollowing = charmInfo->IsFollowing();
93 charmInfo->SetIsAtStay(
false);
94 charmInfo->SetIsReturning(
false);
95 charmInfo->SetIsFollowing(
true);
98 if (forceRestart || clearMountedStun || !wasFollowing)
112 if (!owner || !pet || !transport)
120 bool const alreadyOnTransport = pet->
GetTransport() == transport;
122 alreadyOnTransport && NeedsPassengerOffsetRefresh(pet));
123 if (!offsetRefreshed)
125 ResumeFollowerMotion(owner, pet, transport,
false);
129 PassengerOffset const offset = CalculatePetTransportOffset(owner, pet, transport);
134 if (oldTransport != transport)
135 oldTransport->RemovePassenger(pet);
137 RelocatePetToTransportOffset(pet, transport, offset);
139 if (!alreadyOnTransport)
144 bool const petOnOwnerTransport = pet->
GetTransport() == transport;
146 SendTransportEnterSpline(pet, offset);
148 ResumeFollowerMotion(owner, pet, transport,
true);
149 return petOnOwnerTransport;
154 if (!owner || !transport)
158 if (!ShouldMirrorHunterPetOnTransport(owner, pet) || !pet->
IsInWorld())
166 if (!owner || !transport)
170 if (!ShouldMirrorHunterPetOnTransport(owner, pet) || pet->
GetTransport() != transport)
void SetHomePosition(float x, float y, float z, float o)
void SetTransportHomePosition(float x, float y, float z, float o)
void CreatureRelocation(Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail=true)
float GetFollowAngle() const OVERRIDE
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
void Clear(bool reset=true)
void RemoveFlag(uint16 index, uint32 oldFlag)
bool HasFlag(uint16 index, uint32 flag) const
void ClearTransportExitGrace()
void StartTransportExitGrace(uint32 duration)
PetType getPetType() const
bool isControlled() const
void CalculatePassengerPosition(float &x, float &y, float &z, float *o) const
This method transforms supplied transport offsets into global coordinates.
void CalculatePassengerOffset(float &x, float &y, float &z, float *o) const
This method transforms supplied global coordinates into local offsets.
void RemovePassenger(WorldObject *passenger)
void AddPassenger(WorldObject *passenger)
MotionMaster * GetMotionMaster()
CharmInfo * GetCharmInfo()
uint64 GetOwnerGUID() const
float GetTransOffsetX() const
float GetTransOffsetY() const
float GetTransOffsetZ() const
Transport * GetTransport() const
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float angle=0) const
float GetTransOffsetO() const
MovementInfo m_movementInfo
float GetObjectSize() const
bool ShouldResumePetFollowOnTransport(bool ownerHasTransport, bool petOnOwnerTransport, bool petInWorld)
bool BoardOwnerHunterPet(Player *owner, Transport *transport)
bool AttachHunterPetToOwnerTransport(Player *owner, Pet *pet, Transport *transport)
bool ShouldRefreshPetTransportOffset(bool petAlreadyOnOwnerTransport, bool petPassengerOffsetInvalid)
bool ShouldPlacePetNearOwnerOnTransportExit(bool ownerStillOnTransport)
PassengerOffset CalculateFollowerPosition(float ownerX, float ownerY, float ownerZ, float ownerO, float ownerObjectSize, float petObjectSize, float followDistance, float followAngle)
bool ShouldSendTransportEnterSpline(bool petInWorld, bool petOnOwnerTransport, bool offsetRefreshed)
bool ShouldMirrorOwnerPet(bool isHunterPet, bool isControlled, bool isAlive, bool ownerMatches)
void RemoveOwnerHunterPet(Player *owner, Transport *transport)
bool IsPassengerOffsetWithinLimit(float x, float y, float z, float limit)
bool ShouldAttachHunterPetToOwnerTransport(bool ownerHasTransport, bool petIsHunterPet, bool petIsControlled, bool petIsAlive, bool ownerMatches, bool sameMap)
bool ShouldClearMountedPetStunForTransport(bool ownerMounted, bool ownerHasTransport, bool petStunned)
struct MovementInfo::TransportInfo transport
float GetPositionZ() const
float GetOrientation() const
float GetPositionX() const
void GetPosition(float &x, float &y) const
float GetPositionY() const
void Relocate(float x, float y)