diff options
author | megamage <none@none> | 2009-04-11 23:07:07 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-04-11 23:07:07 -0500 |
commit | 0010f7ffe38c0432eb337746d71c7129fe74b64b (patch) | |
tree | 330a1d3c51a97c286f09ebb87f715ac8fa4b362a /src/game/Player.cpp | |
parent | dda2fdff33a6d12d6e8f2913fbb439d9b670890f (diff) |
[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
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r-- | src/game/Player.cpp | 71 |
1 files changed, 14 insertions, 57 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 2bfe2dadc33..ae39fee5324 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -340,7 +340,8 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa m_atLoginFlags = AT_LOGIN_NONE; - m_dontMove = false; + mSemaphoreTeleport_Near = false; + mSemaphoreTeleport_Far = false; pTrader = 0; ClearTrade(); @@ -467,8 +468,6 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa m_isActive = true; - m_farsightVision = false; - m_runes = NULL; m_lastFallTime = 0; @@ -1645,9 +1644,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati m_movementInfo.t_time = 0; } - SetSemaphoreTeleport(true); - - // The player was ported to another map and looses the duel immediatly. + // The player was ported to another map and looses the duel immediately. // We have to perform this check before the teleport, otherwise the // ObjectAccessor won't find the flag. if (duel && GetMapId()!=mapid) @@ -1662,25 +1659,6 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if ((GetMapId() == mapid) && (!m_transport)) { - // prepare zone change detect - uint32 old_zone = GetZoneId(); - - // near teleport - if(!GetSession()->PlayerLogout()) - { - WorldPacket data; - BuildTeleportAckMsg(&data, x, y, z, orientation); - GetSession()->SendPacket(&data); - SetPosition( x, y, z, orientation, true); - } - else - // this will be used instead of the current location in SaveToDB - m_teleport_dest = WorldLocation(mapid, x, y, z, orientation); - - SetFallInformation(0, z); - - //BuildHeartBeatMsg(&data); - //SendMessageToSet(&data, true); if (!(options & TELE_TO_NOT_UNSUMMON_PET)) { //same map, only remove pet if out of range for new position @@ -1691,30 +1669,19 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if(!(options & TELE_TO_NOT_LEAVE_COMBAT)) CombatStop(); - if (!(options & TELE_TO_NOT_UNSUMMON_PET)) - { - // resummon pet - if (pet) - ResummonPetTemporaryUnSummonedIfAny(); - } - - uint32 newzone, newarea; - GetZoneAndAreaId(newzone,newarea); + // this will be used instead of the current location in SaveToDB + m_teleport_dest = WorldLocation(mapid, x, y, z, orientation); + SetFallInformation(0, z); + // code for finish transfer called in WorldSession::HandleMovementOpcodes() + // at client packet MSG_MOVE_TELEPORT_ACK + SetSemaphoreTeleportNear(true); + // near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing if(!GetSession()->PlayerLogout()) { - // don't reset teleport semaphore while logging out, otherwise m_teleport_dest won't be used in Player::SaveToDB - SetSemaphoreTeleport(false); - - UpdateZone(newzone,newarea); - } - - // new zone - if(old_zone != newzone) - { - // honorless target - if(pvpInfo.inHostileArea) - CastSpell(this, 2479, true); + WorldPacket data; + BuildTeleportAckMsg(&data, x, y, z, orientation); + GetSession()->SendPacket(&data); } } else @@ -1726,10 +1693,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // Check enter rights before map getting to avoid creating instance copy for player // this check not dependent from map instance copy and same for all instance copies of selected map if (!MapManager::Instance().CanPlayerEnter(mapid, this)) - { - SetSemaphoreTeleport(false); return false; - } // If the map is not created, assume it is possible to enter it. // It will be created in the WorldPortAck. @@ -1814,10 +1778,8 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP | AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING); // move packet sent by client always after far teleport - // SetPosition(final_x, final_y, final_z, final_o, true); - SetDontMove(true); - // code for finish transfer to new map called in WorldSession::HandleMoveWorldportAckOpcode at client packet + SetSemaphoreTeleportFar(true); } else return false; @@ -5468,11 +5430,6 @@ void Player::removeActionButton(uint8 button) sLog.outDetail( "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow() ); } -void Player::SetDontMove(bool dontMove) -{ - m_dontMove = dontMove; -} - bool Player::SetPosition(float x, float y, float z, float orientation, bool teleport) { // prevent crash when a bad coord is sent by the client |