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())
|
||||
|
||||
@@ -274,6 +274,7 @@ struct ZoneDynamicInfo
|
||||
#define MAX_FALL_DISTANCE 250000.0f // "unlimited fall" to find VMap ground if it is available, just larger than MAX_HEIGHT - INVALID_HEIGHT
|
||||
#define DEFAULT_HEIGHT_SEARCH 50.0f // default search distance to find height at nearby locations
|
||||
#define MIN_UNLOAD_DELAY 1 // immediate unload
|
||||
#define MAP_INVALID_ZONE 0xFFFFFFFF
|
||||
|
||||
typedef std::map<uint32/*leaderDBGUID*/, CreatureGroup*> CreatureGroupHolderType;
|
||||
|
||||
|
||||
Reference in new issue
Block a user