mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-20 06:59:46 -04:00
Core/Unit: SendTeleportPacket corrections
This commit is contained in:
@@ -1929,12 +1929,14 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
// near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing
|
||||
if (!GetSession()->PlayerLogout())
|
||||
{
|
||||
Position oldPos = GetPosition();
|
||||
Position newPosition(x, y, z, orientation);
|
||||
if (HasUnitMovementFlag(MOVEMENTFLAG_HOVER))
|
||||
z += GetFloatValue(UNIT_FIELD_HOVERHEIGHT);
|
||||
Relocate(x, y, z, orientation);
|
||||
newPosition.m_positionZ += GetFloatValue(UNIT_FIELD_HOVERHEIGHT);
|
||||
|
||||
UpdatePosition(newPosition, true);
|
||||
SendTeleportAckPacket();
|
||||
SendTeleportPacket(oldPos); // this automatically relocates to oldPos in order to broadcast the packet in the right place
|
||||
SendTeleportPacket();
|
||||
UpdateObjectVisibility();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -13809,26 +13809,18 @@ void Unit::NearTeleportTo(Position const& pos, bool casting /*= false*/)
|
||||
}
|
||||
else
|
||||
{
|
||||
SendTeleportPacket(pos);
|
||||
UpdatePosition(pos, true);
|
||||
SendTeleportPacket();
|
||||
UpdateObjectVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::SendTeleportPacket(Position const& pos)
|
||||
void Unit::SendTeleportPacket()
|
||||
{
|
||||
Position oldPos = { GetPositionX(), GetPositionY(), GetPositionZMinusOffset(), GetOrientation() };
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
Relocate(&pos);
|
||||
|
||||
WorldPacket data2(MSG_MOVE_TELEPORT, 38);
|
||||
data2 << GetPackGUID();
|
||||
BuildMovementPacket(&data2);
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
Relocate(&oldPos);
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
Relocate(&pos);
|
||||
SendMessageToSet(&data2, false);
|
||||
WorldPacket data(MSG_MOVE_TELEPORT, 38);
|
||||
data << GetPackGUID();
|
||||
BuildMovementPacket(&data);
|
||||
SendMessageToSet(&data, false);
|
||||
}
|
||||
|
||||
bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool teleport)
|
||||
|
||||
@@ -1620,7 +1620,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
|
||||
void NearTeleportTo(Position const& pos, bool casting = false);
|
||||
void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false) { NearTeleportTo(Position(x, y, z, orientation), casting); }
|
||||
void SendTeleportPacket(Position const& pos);
|
||||
void SendTeleportPacket();
|
||||
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport = false);
|
||||
// returns true if unit's position really changed
|
||||
virtual bool UpdatePosition(const Position &pos, bool teleport = false);
|
||||
|
||||
Reference in New Issue
Block a user