mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
[7648] Resolve problems with expected fall damage at near teleport. Author: VladimirMangos
Move near teleport landing code to WorldSession::HandleMoveTeleportAck.
This make Player::TeleportTo code working in same way for both far/near teleports.
Move mSemaphoreTeleport from WorldObject to Player and merge with DoNotMove (using 2 fields for far/near teleport flag).
Skip movement packets until landing confirmation for near teleport from client.
--HG--
branch : trunk
This commit is contained in:
@@ -41,6 +41,10 @@ void WorldSession::HandleMoveWorldportAckOpcode( WorldPacket & /*recv_data*/ )
|
||||
|
||||
void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
{
|
||||
// ignore unexpected far teleports
|
||||
if(!GetPlayer()->IsBeingTeleportedFar())
|
||||
return;
|
||||
|
||||
// get the teleport destination
|
||||
WorldLocation &loc = GetPlayer()->GetTeleportDest();
|
||||
|
||||
@@ -59,7 +63,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
if(GetPlayer()->m_InstanceValid == false && !mInstance)
|
||||
GetPlayer()->m_InstanceValid = true;
|
||||
|
||||
GetPlayer()->SetSemaphoreTeleport(false);
|
||||
GetPlayer()->SetSemaphoreTeleportFar(false);
|
||||
|
||||
// relocate the player to the teleport destination
|
||||
GetPlayer()->SetMapId(loc.mapid);
|
||||
@@ -79,7 +83,6 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
{
|
||||
sLog.outDebug("WORLD: teleport of player %s (%d) to location %d,%f,%f,%f,%f failed", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.mapid, loc.x, loc.y, loc.z, loc.o);
|
||||
// teleport the player home
|
||||
GetPlayer()->SetDontMove(false);
|
||||
if(!GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()))
|
||||
{
|
||||
// the player must always be able to teleport home
|
||||
@@ -116,7 +119,6 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
if(!_player->InBattleGround())
|
||||
{
|
||||
// short preparations to continue flight
|
||||
GetPlayer()->SetDontMove(false);
|
||||
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
|
||||
flight->Initialize(*GetPlayer());
|
||||
return;
|
||||
@@ -158,8 +160,52 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
|
||||
// resummon pet
|
||||
GetPlayer()->ResummonPetTemporaryUnSummonedIfAny();
|
||||
}
|
||||
|
||||
GetPlayer()->SetDontMove(false);
|
||||
void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,8+4);
|
||||
|
||||
sLog.outDebug("MSG_MOVE_TELEPORT_ACK");
|
||||
uint64 guid;
|
||||
uint32 flags, time;
|
||||
|
||||
recv_data >> guid;
|
||||
recv_data >> flags >> time;
|
||||
DEBUG_LOG("Guid " I64FMTD,guid);
|
||||
DEBUG_LOG("Flags %u, time %u",flags, time/IN_MILISECONDS);
|
||||
|
||||
Unit *mover = _player->m_mover;
|
||||
Player *plMover = mover->GetTypeId()==TYPEID_PLAYER ? (Player*)mover : NULL;
|
||||
|
||||
if(!plMover || !plMover->IsBeingTeleportedNear())
|
||||
return;
|
||||
|
||||
if(guid != plMover->GetGUID())
|
||||
return;
|
||||
|
||||
plMover->SetSemaphoreTeleportNear(false);
|
||||
|
||||
uint32 old_zone = plMover->GetZoneId();
|
||||
|
||||
WorldLocation const& dest = plMover->GetTeleportDest();
|
||||
|
||||
plMover->SetPosition(dest.x, dest.y, dest.z, dest.o, true);
|
||||
|
||||
uint32 newzone, newarea;
|
||||
plMover->GetZoneAndAreaId(newzone,newarea);
|
||||
plMover->UpdateZone(newzone,newarea);
|
||||
|
||||
// new zone
|
||||
if(old_zone != newzone)
|
||||
{
|
||||
// honorless target
|
||||
if(plMover->pvpInfo.inHostileArea)
|
||||
plMover->CastSpell(plMover, 2479, true);
|
||||
}
|
||||
|
||||
// resummon pet
|
||||
GetPlayer()->ResummonPetTemporaryUnSummonedIfAny();
|
||||
}
|
||||
|
||||
void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
||||
@@ -167,7 +213,11 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
||||
uint32 opcode = recv_data.GetOpcode();
|
||||
//sLog.outDebug("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
|
||||
|
||||
if(GetPlayer()->GetDontMove())
|
||||
Unit *mover = _player->m_mover;
|
||||
Player *plMover = mover->GetTypeId()==TYPEID_PLAYER ? (Player*)mover : NULL;
|
||||
|
||||
// ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck
|
||||
if(plMover && plMover->IsBeingTeleported())
|
||||
return;
|
||||
|
||||
/* extract packet */
|
||||
@@ -185,9 +235,6 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
||||
if (!Trinity::IsValidMapCoord(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o))
|
||||
return;
|
||||
|
||||
Unit *mover = _player->m_mover;
|
||||
Player *plMover = mover->GetTypeId()==TYPEID_PLAYER ? (Player*)mover : NULL;
|
||||
|
||||
/* handle special cases */
|
||||
if (movementInfo.flags & MOVEMENTFLAG_ONTRANSPORT)
|
||||
{
|
||||
@@ -251,7 +298,6 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
||||
plMover->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
|
||||
plMover->m_movementInfo = movementInfo;
|
||||
plMover->SetUnitMovementFlags(movementInfo.flags);
|
||||
|
||||
plMover->UpdateFallInformationIfNeed(movementInfo,recv_data.GetOpcode());
|
||||
|
||||
if(plMover->isMovingOrTurning())
|
||||
|
||||
Reference in New Issue
Block a user