@@ -12821,14 +12821,15 @@ bool Unit::CanSwim() const
1282112821
1282212822void Unit::NearTeleportTo (Position const & pos, bool casting /* = false*/ )
1282312823{
12824- DisableSpline ();
12825- if (GetTypeId () == TYPEID_PLAYER)
12824+ if (Player* player = ToPlayer ())
1282612825 {
1282712826 WorldLocation target (GetMapId (), pos);
12828- ToPlayer () ->TeleportTo (target, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | (casting ? TELE_TO_SPELL : 0 ));
12827+ player ->TeleportTo (target, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | (casting ? TELE_TO_SPELL : 0 ));
1282912828 }
1283012829 else
1283112830 {
12831+ DisableSpline ();
12832+ GetMotionMaster ()->InterruptOnTeleport ();
1283212833 SendTeleportPacket (pos);
1283312834 UpdatePosition (pos, true );
1283412835 UpdateObjectVisibility ();
@@ -12865,7 +12866,7 @@ void Unit::SendTeleportPacket(Position const& pos, bool teleportingTransport /*=
1286512866
1286612867 WorldPacket moveUpdateTeleport (MSG_MOVE_TELEPORT, 38 );
1286712868 moveUpdateTeleport << GetPackGUID ();
12868- Unit* broadcastSource = this ;
12869+ Unit::BuildMovementPacket (pos, transportPos, teleportMovementInfo, &moveUpdateTeleport) ;
1286912870
1287012871 if (IsMovedByClient ())
1287112872 {
@@ -12876,13 +12877,11 @@ void Unit::SendTeleportPacket(Position const& pos, bool teleportingTransport /*=
1287612877 Unit::BuildMovementPacket (pos, transportPos, teleportMovementInfo, &moveTeleport);
1287712878 playerMover->SendDirectMessage (&moveTeleport);
1287812879
12879- broadcastSource = playerMover;
12880+ // Broadcast the packet to everyone except self.
12881+ SendMessageToSet (&moveUpdateTeleport, playerMover);
1288012882 }
12881-
12882- Unit::BuildMovementPacket (pos, transportPos, teleportMovementInfo, &moveUpdateTeleport);
12883-
12884- // Broadcast the packet to everyone except self.
12885- broadcastSource->SendMessageToSet (&moveUpdateTeleport, false );
12883+ else
12884+ SendMessageToSet (&moveUpdateTeleport, true );
1288612885}
1288712886
1288812887bool Unit::UpdatePosition (float x, float y, float z, float orientation, bool teleport)
0 commit comments