Core/WorldStates: Fixed thread unsafe access to realm wide world states

This commit is contained in:
Shauren
2026-03-31 21:39:33 +02:00
parent 28a73b6e0f
commit b1f3448cf9
23 changed files with 254 additions and 223 deletions
+4 -6
View File
@@ -7428,7 +7428,7 @@ uint32 Player::GetCurrencyMaxQuantity(CurrencyTypesEntry const* currency, bool o
uint32 maxQuantity = currency->MaxQty;
if (currency->MaxQtyWorldStateID)
maxQuantity = sWorldStateMgr->GetValue(currency->MaxQtyWorldStateID, GetMap());
maxQuantity = WorldStateMgr::GetValue(currency->MaxQtyWorldStateID, GetMap());
uint32 increasedCap = 0;
if (currency->GetFlags().HasFlag(CurrencyTypesFlags::DynamicMaximum))
@@ -7716,7 +7716,7 @@ void Player::UpdateHostileAreaState(AreaTableEntry const* area)
{
if (area)
{
if (InBattleground() || area->GetFlags().HasFlag(AreaFlags::CombatZone) || (area->PvpCombatWorldStateID != -1 && sWorldStateMgr->GetValue(area->PvpCombatWorldStateID, GetMap()) != 0))
if (InBattleground() || area->GetFlags().HasFlag(AreaFlags::CombatZone) || (area->PvpCombatWorldStateID != -1 && WorldStateMgr::GetValue(area->PvpCombatWorldStateID, GetMap()) != 0))
pvpInfo.IsInHostileArea = true;
else if (IsWarModeLocalActive() || (area->GetFlags().HasFlag(AreaFlags::EnemiesPvPFlagged)))
{
@@ -9232,9 +9232,7 @@ void Player::SendUpdateWorldState(uint32 variable, uint32 value, bool hidden /*=
SendDirectMessage(worldstate.Write());
}
// TODO - InitWorldStates should NOT always send the same states
// Some should keep the same value between different zoneIds and areaIds on the same map
void Player::SendInitWorldStates(uint32 zoneId, uint32 areaId)
void Player::SendInitWorldStates(uint32 zoneId, uint32 areaId) const
{
uint32 mapId = GetMapId();
@@ -9245,7 +9243,7 @@ void Player::SendInitWorldStates(uint32 zoneId, uint32 areaId)
packet.AreaID = zoneId;
packet.SubareaID = areaId;
sWorldStateMgr->FillInitialWorldStates(packet, GetMap(), areaId);
WorldStateMgr::FillInitialWorldStates(packet, GetMap(), areaId);
SendDirectMessage(packet.Write());
}