mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 12:47:07 +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_team = TEAM_NEUTRAL;
|
||||
|
||||
m_needZoneUpdate = false;
|
||||
|
||||
m_nextSave = SavingSystemMgr::IncreaseSavingMaxValue(1);
|
||||
m_additionalSaveTimer = 0;
|
||||
m_additionalSaveMask = 0;
|
||||
|
||||
@@ -1806,6 +1806,7 @@ public:
|
||||
void UpdatePvP(bool state, bool _override = false);
|
||||
void UpdateZone(uint32 newZone, uint32 newArea);
|
||||
void UpdateArea(uint32 newArea);
|
||||
void SetNeedZoneUpdate(bool needUpdate) { m_needZoneUpdate = needUpdate; }
|
||||
|
||||
void UpdateZoneDependentAuras(uint32 zone_id); // zones
|
||||
void UpdateAreaDependentAuras(uint32 area_id); // subzones
|
||||
@@ -2869,6 +2870,8 @@ public:
|
||||
|
||||
uint8 m_grantableLevels;
|
||||
|
||||
bool m_needZoneUpdate;
|
||||
|
||||
[[nodiscard]] AchievementMgr* GetAchievementMgr() const { return m_achievementMgr; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -1115,6 +1115,15 @@ bool Player::UpdatePosition(float x, float y, float z, float orientation,
|
||||
if (!Unit::UpdatePosition(x, y, z, orientation, teleport))
|
||||
return false;
|
||||
|
||||
// Update player zone if needed
|
||||
if (m_needZoneUpdate)
|
||||
{
|
||||
uint32 newZone, newArea;
|
||||
GetZoneAndAreaId(newZone, newArea);
|
||||
UpdateZone(newZone, newArea);
|
||||
m_needZoneUpdate = false;
|
||||
}
|
||||
|
||||
if (GetGroup())
|
||||
SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
|
||||
|
||||
|
||||
@@ -522,10 +522,9 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket& recv_data)
|
||||
|
||||
LOG_DEBUG("network", "WORLD: Recvd ZONE_UPDATE: %u", newZone);
|
||||
|
||||
// use server size data
|
||||
uint32 newzone, newarea;
|
||||
GetPlayer()->GetZoneAndAreaId(newzone, newarea);
|
||||
GetPlayer()->UpdateZone(newzone, newarea);
|
||||
// use server side data, but only after update the player position. See Player::UpdatePosition().
|
||||
GetPlayer()->SetNeedZoneUpdate(true);
|
||||
|
||||
//GetPlayer()->SendInitWorldStates(true, newZone);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user