Core/Movement: Fixed near teleports, big thanks to @Trista who basically figured this out on his own.

This commit is contained in:
Subv committed 2012-12-23 08:09:56 -05:00
1 parent 621a249188
commit 143340b38c
4 files changed
+15 -11

No files matched your search

@@ -2067,15 +2067,6 @@ uint8 Player::GetChatTag() const
return tag;
}
void Player::SendTeleportPacket(Position &oldPos)
{
WorldPacket data2(MSG_MOVE_TELEPORT, 38);
data2.append(GetPackGUID());
BuildMovementPacket(&data2);
Relocate(&oldPos);
SendMessageToSet(&data2, false);
}
void Player::SendTeleportAckPacket()
{
WorldPacket data(MSG_MOVE_TELEPORT_ACK, 41);
-1
View File
@@ -1947,7 +1947,6 @@ class Player : public Unit, public GridObject<Player>
void SendMessageToSetInRange(WorldPacket* data, float dist, bool self, bool own_team_only);
void SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr);
void SendTeleportPacket(Position &oldPos);
void SendTeleportAckPacket();
Corpse* GetCorpse() const;
+14 -1
View File
@@ -17325,10 +17325,23 @@ void Unit::NearTeleportTo(float x, float y, float z, float orientation, bool cas
else
{
UpdatePosition(x, y, z, orientation, true);
SendMovementFlagUpdate();
Position pos; // dummy, not used for creatures.
SendTeleportPacket(pos);
}
}
void Unit::SendTeleportPacket(Position& oldPos)
{
WorldPacket data2(MSG_MOVE_TELEPORT, 38);
data2.append(GetPackGUID());
BuildMovementPacket(&data2);
if (GetTypeId() == TYPEID_PLAYER)
Relocate(&oldPos);
SendMessageToSet(&data2, false);
}
bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool teleport)
{
// prevent crash when a bad coord is sent by the client
+1
View File
@@ -1592,6 +1592,7 @@ class Unit : public WorldObject
void SendSpellDamageImmune(Unit* target, uint32 spellId);
void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false);
void SendTeleportPacket(Position& oldPos);
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport = false);
// returns true if unit's position really changed
bool UpdatePosition(const Position &pos, bool teleport = false) { return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }