mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
fix(Core/Players): Update the player's zone and area only after update the player's position server-side (#9419)
This commit is contained in:
@@ -190,6 +190,8 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
|
|||||||
m_areaUpdateId = 0;
|
m_areaUpdateId = 0;
|
||||||
m_team = TEAM_NEUTRAL;
|
m_team = TEAM_NEUTRAL;
|
||||||
|
|
||||||
|
m_needZoneUpdate = false;
|
||||||
|
|
||||||
m_nextSave = SavingSystemMgr::IncreaseSavingMaxValue(1);
|
m_nextSave = SavingSystemMgr::IncreaseSavingMaxValue(1);
|
||||||
m_additionalSaveTimer = 0;
|
m_additionalSaveTimer = 0;
|
||||||
m_additionalSaveMask = 0;
|
m_additionalSaveMask = 0;
|
||||||
|
|||||||
@@ -1806,6 +1806,7 @@ public:
|
|||||||
void UpdatePvP(bool state, bool _override = false);
|
void UpdatePvP(bool state, bool _override = false);
|
||||||
void UpdateZone(uint32 newZone, uint32 newArea);
|
void UpdateZone(uint32 newZone, uint32 newArea);
|
||||||
void UpdateArea(uint32 newArea);
|
void UpdateArea(uint32 newArea);
|
||||||
|
void SetNeedZoneUpdate(bool needUpdate) { m_needZoneUpdate = needUpdate; }
|
||||||
|
|
||||||
void UpdateZoneDependentAuras(uint32 zone_id); // zones
|
void UpdateZoneDependentAuras(uint32 zone_id); // zones
|
||||||
void UpdateAreaDependentAuras(uint32 area_id); // subzones
|
void UpdateAreaDependentAuras(uint32 area_id); // subzones
|
||||||
@@ -2869,6 +2870,8 @@ public:
|
|||||||
|
|
||||||
uint8 m_grantableLevels;
|
uint8 m_grantableLevels;
|
||||||
|
|
||||||
|
bool m_needZoneUpdate;
|
||||||
|
|
||||||
[[nodiscard]] AchievementMgr* GetAchievementMgr() const { return m_achievementMgr; }
|
[[nodiscard]] AchievementMgr* GetAchievementMgr() const { return m_achievementMgr; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -1115,6 +1115,15 @@ bool Player::UpdatePosition(float x, float y, float z, float orientation,
|
|||||||
if (!Unit::UpdatePosition(x, y, z, orientation, teleport))
|
if (!Unit::UpdatePosition(x, y, z, orientation, teleport))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Update player zone if needed
|
||||||
|
if (m_needZoneUpdate)
|
||||||
|
{
|
||||||
|
uint32 newZone, newArea;
|
||||||
|
GetZoneAndAreaId(newZone, newArea);
|
||||||
|
UpdateZone(newZone, newArea);
|
||||||
|
m_needZoneUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetGroup())
|
if (GetGroup())
|
||||||
SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
|
SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
|
||||||
|
|
||||||
|
|||||||
@@ -522,10 +522,9 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket& recv_data)
|
|||||||
|
|
||||||
LOG_DEBUG("network", "WORLD: Recvd ZONE_UPDATE: %u", newZone);
|
LOG_DEBUG("network", "WORLD: Recvd ZONE_UPDATE: %u", newZone);
|
||||||
|
|
||||||
// use server size data
|
// use server side data, but only after update the player position. See Player::UpdatePosition().
|
||||||
uint32 newzone, newarea;
|
GetPlayer()->SetNeedZoneUpdate(true);
|
||||||
GetPlayer()->GetZoneAndAreaId(newzone, newarea);
|
|
||||||
GetPlayer()->UpdateZone(newzone, newarea);
|
|
||||||
//GetPlayer()->SendInitWorldStates(true, newZone);
|
//GetPlayer()->SendInitWorldStates(true, newZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user