Core/Players: reduce excessive casting of spell_area spells by casting them only when zone and area ids actually change

This commit is contained in:
Ovahlord
2020-09-26 19:38:49 +02:00
parent 175d84495e
commit 941194018d

View File

@@ -7235,7 +7235,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
// recent client version not send leave/join channel packets for built-in local channels
UpdateLocalChannels(newZone);
UpdateZoneDependentAuras(newZone);
if (oldZone != newZone)
UpdateZoneDependentAuras(newZone);
// call enter script hooks after everyting else has processed
sScriptMgr->OnPlayerUpdateZone(this, newZone, newArea);
@@ -24858,6 +24859,10 @@ void Player::UpdateAreaDependentAuras(uint32 newArea)
++iter;
}
// UpdateZoneDependentAuras takes care of zone specific auras so skip excessive casting if the area Id is the same as its parent.
if (m_zoneUpdateId == newArea)
return;
// some auras applied at subzone enter
SpellAreaForAreaMapBounds saBounds = sSpellMgr->GetSpellAreaForAreaMapBounds(newArea);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)