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.
Port From (https://github.com/TrinityCore/TrinityCore/commit/35e74687c3e1e0e24a0ae0049ff96ede2abdc516)
This commit is contained in:
@@ -148,7 +148,18 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void UpdateZone(uint newZone, uint newArea)
|
public void UpdateZone(uint newZone, uint newArea)
|
||||||
{
|
{
|
||||||
GetMap().UpdatePlayerZoneStats(m_zoneUpdateId, newZone);
|
uint oldZone = m_zoneUpdateId;
|
||||||
|
m_zoneUpdateId = newZone;
|
||||||
|
m_zoneUpdateTimer = 1 * Time.InMilliseconds;
|
||||||
|
|
||||||
|
GetMap().UpdatePlayerZoneStats(oldZone, newZone);
|
||||||
|
|
||||||
|
// call leave script hooks immedately (before updating flags)
|
||||||
|
if (oldZone != newZone)
|
||||||
|
{
|
||||||
|
Global.OutdoorPvPMgr.HandlePlayerLeaveZone(this, m_zoneUpdateId);
|
||||||
|
Global.BattleFieldMgr.HandlePlayerLeaveZone(this, m_zoneUpdateId);
|
||||||
|
}
|
||||||
|
|
||||||
// group update
|
// group update
|
||||||
if (GetGroup())
|
if (GetGroup())
|
||||||
@@ -172,8 +183,6 @@ namespace Game.Entities
|
|||||||
|
|
||||||
GetMap().SendZoneDynamicInfo(newZone, this);
|
GetMap().SendZoneDynamicInfo(newZone, this);
|
||||||
|
|
||||||
Global.ScriptMgr.OnPlayerUpdateZone(this, newZone, newArea);
|
|
||||||
|
|
||||||
// in PvP, any not controlled zone (except zone.team == 6, default case)
|
// in PvP, any not controlled zone (except zone.team == 6, default case)
|
||||||
// in PvE, only opposition team capital
|
// in PvE, only opposition team capital
|
||||||
switch ((ArenaTeams)zone.FactionGroupMask)
|
switch ((ArenaTeams)zone.FactionGroupMask)
|
||||||
@@ -220,13 +229,11 @@ namespace Game.Entities
|
|||||||
|
|
||||||
UpdateZoneDependentAuras(newZone);
|
UpdateZoneDependentAuras(newZone);
|
||||||
|
|
||||||
m_zoneUpdateTimer = 1 * Time.InMilliseconds;
|
// call enter script hooks after everyting else has processed
|
||||||
if (m_zoneUpdateId != newZone)
|
Global.ScriptMgr.OnPlayerUpdateZone(this, newZone, newArea);
|
||||||
|
if (oldZone != newZone)
|
||||||
{
|
{
|
||||||
m_zoneUpdateId = newZone;
|
|
||||||
Global.OutdoorPvPMgr.HandlePlayerLeaveZone(this, m_zoneUpdateId);
|
|
||||||
Global.OutdoorPvPMgr.HandlePlayerEnterZone(this, newZone);
|
Global.OutdoorPvPMgr.HandlePlayerEnterZone(this, newZone);
|
||||||
Global.BattleFieldMgr.HandlePlayerLeaveZone(this, m_zoneUpdateId);
|
|
||||||
Global.BattleFieldMgr.HandlePlayerEnterZone(this, newZone);
|
Global.BattleFieldMgr.HandlePlayerEnterZone(this, newZone);
|
||||||
SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange...
|
SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange...
|
||||||
Guild guild = GetGuild();
|
Guild guild = GetGuild();
|
||||||
|
|||||||
Reference in New Issue
Block a user