Core/Unit: SendTeleportPacket corrections

This commit is contained in:
ccrs
2017-05-02 14:57:10 +02:00
parent 17579f8d91
commit 6fe4d37f8d
3 changed files with 13 additions and 19 deletions
+6 -4
View File
@@ -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
+6 -14
View File
@@ -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)
+1 -1
View File
@@ -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);