mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[7648] Resolve problems with expected fall damage at near teleport.
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.
This commit is contained in:
parent
55e1cc16d1
commit
199c09640d
9 changed files with 87 additions and 101 deletions
|
|
@ -39,6 +39,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();
|
||||
|
||||
|
|
@ -57,7 +61,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);
|
||||
|
|
@ -77,7 +81,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
|
||||
|
|
@ -114,7 +117,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;
|
||||
|
|
@ -156,8 +158,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 )
|
||||
|
|
@ -165,7 +211,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 */
|
||||
|
|
@ -183,9 +233,6 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
|||
if (!MaNGOS::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)
|
||||
{
|
||||
|
|
@ -249,7 +296,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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue