Core/Player: More cleanups to Player::UpdateZone, including correcting an oversight that was causing the last known zone id to not update when leaving map. Closes #20289 for real this time.
This commit is contained in:
1 parent
f3b5ad8c8a
commit
6d2bfac955
2 files changed
+16
-8
No files matched your search
@@ -7394,7 +7394,18 @@ void Player::UpdateArea(uint32 newArea)
|
||||
|
||||
void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
||||
{
|
||||
GetMap()->UpdatePlayerZoneStats(m_zoneUpdateId, newZone);
|
||||
uint32 const oldZone = m_zoneUpdateId;
|
||||
m_zoneUpdateId = newZone;
|
||||
m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL;
|
||||
|
||||
GetMap()->UpdatePlayerZoneStats(oldZone, newZone);
|
||||
|
||||
// call leave script hooks immedately (before updating flags)
|
||||
if (oldZone != newZone)
|
||||
{
|
||||
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
|
||||
sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
|
||||
}
|
||||
|
||||
// group update
|
||||
if (GetGroup())
|
||||
@@ -7416,8 +7427,6 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
||||
WeatherMgr::SendFineWeatherUpdateToPlayer(this);
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerUpdateZone(this, newZone, newArea);
|
||||
|
||||
// in PvP, any not controlled zone (except zone->team == 6, default case)
|
||||
// in PvE, only opposition team capital
|
||||
switch (zone->team)
|
||||
@@ -7465,13 +7474,11 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
||||
|
||||
UpdateZoneDependentAuras(newZone);
|
||||
|
||||
m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL;
|
||||
if (m_zoneUpdateId != newZone)
|
||||
// call enter script hooks after everyting else has processed
|
||||
sScriptMgr->OnPlayerUpdateZone(this, newZone, newArea);
|
||||
if (oldZone != newZone)
|
||||
{
|
||||
m_zoneUpdateId = newZone;
|
||||
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
|
||||
sOutdoorPvPMgr->HandlePlayerEnterZone(this, newZone);
|
||||
sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
|
||||
sBattlefieldMgr->HandlePlayerEnterZone(this, newZone);
|
||||
SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange...
|
||||
if (Guild* guild = GetGuild())
|
||||
|
||||
Reference in new issue
Block a user