aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXanadu <none@none>2010-03-18 17:58:27 +0100
committerXanadu <none@none>2010-03-18 17:58:27 +0100
commit59e0d42260921d8d0d7d94ccdef78a4fcc149fbc (patch)
treeabfc9850add4896ca1541d373670e1003adc0579 /src
parent302af79bc250257c61f78e489986eaa1f20292c7 (diff)
Added (blizzlike) packet broadcast to near teleport. Thanks to Zor and nalimleinad (AKA anonymous colleague #1) for research.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Player.cpp15
-rw-r--r--src/game/Player.h3
-rw-r--r--src/game/SpellEffects.cpp2
-rw-r--r--src/game/Unit.cpp24
-rw-r--r--src/game/Vehicle.cpp2
5 files changed, 17 insertions, 29 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index d53d61581c1..25d57128664 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -1640,7 +1640,16 @@ uint8 Player::chatTag() const
return 0;
}
-void Player::SendTeleportAckMsg()
+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);
data.append(GetPackGUID());
@@ -1777,8 +1786,8 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
Position oldPos;
GetPosition(&oldPos);
Relocate(x, y, z, orientation);
- SendTeleportAckMsg();
- Relocate(&oldPos);
+ SendTeleportAckPacket();
+ SendTeleportPacket(oldPos); // this automatically relocates to oldPos in order to broadcast the packet in the right place
}
}
else
diff --git a/src/game/Player.h b/src/game/Player.h
index d39f381f016..13cda2117c2 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1825,7 +1825,8 @@ class Player : public Unit, public GridObject<Player>
void SendMessageToSetInRange(WorldPacket *data, float fist, bool self);// overwrite Object::SendMessageToSetInRange
void SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only);
- void SendTeleportAckMsg();
+ void SendTeleportPacket(Position &oldPos);
+ void SendTeleportAckPacket();
static void DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars = true);
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 98c6109a07a..a6d32aed07a 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -3898,7 +3898,7 @@ void Spell::EffectDistract(uint32 /*i*/)
{
// For players just turn them
unitTarget->ToPlayer()->SetPosition(unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), angle, false);
- unitTarget->ToPlayer()->SendTeleportAckMsg();
+ unitTarget->ToPlayer()->SendTeleportAckPacket();
}
else
{
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 18a16d12ec4..c11bff030c1 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -15990,7 +15990,7 @@ void Unit::ExitVehicle()
if (GetTypeId() == TYPEID_PLAYER)
{
//this->ToPlayer()->SetClientControl(this, 1);
- this->ToPlayer()->SendTeleportAckMsg();
+ this->ToPlayer()->SendTeleportAckPacket();
this->ToPlayer()->SetFallInformation(0, GetPositionZ());
}
WorldPacket data;
@@ -16109,31 +16109,9 @@ void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool ca
this->ToPlayer()->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0));
else
{
- WorldPacket data;
- /*data.Initialize(MSG_MOVE_TELEPORT, 30);
- data.append(GetPackGUID());
- data << uint32(GetUnitMovementFlags());
- data << uint16(0); // Probably walk flags here
- data << getMSTime(); // time
- data << x; // destination coords
- data << y;
- data << z;
- data << orientation;
- data << uint32 (0);
- // Other information here: jumping angle etc
- SendMessageToSet(&data, false);*/
-
// FIXME: this interrupts spell visual
DestroyForNearbyPlayers();
-
SetPosition(x, y, z, orientation, true);
- //ObjectAccessor::UpdateObjectVisibility(this);
-
- //WorldPacket data;
- // Work strange for many spells: triggered active mover set for targeted player to creature
- //BuildTeleportAckMsg(&data, x, y, z, orientation);
- //BuildHeartBeatMsg(&data);
- //SendMessageToSet(&data, false);
}
}
diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp
index 07c0f32a6e8..f25816ff121 100644
--- a/src/game/Vehicle.cpp
+++ b/src/game/Vehicle.cpp
@@ -341,7 +341,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
}
//if(unit->GetTypeId() == TYPEID_PLAYER)
- // unit->ToPlayer()->SendTeleportAckMsg();
+ // unit->ToPlayer()->SendTeleportAckPacket();
//unit->SendMovementFlagUpdate();
return true;