Core/WorldStates: Allow setting "hidden" field of SMSG_UPDATE_WORLD_STATE
Port From (https://github.com/TrinityCore/TrinityCore/commit/de26cafbbe1b355b69ec871f4fee0704a3ef29a5)
This commit is contained in:
@@ -601,7 +601,7 @@ namespace Game.Maps
|
||||
|
||||
public void DoUpdateWorldState(uint worldStateId, int value)
|
||||
{
|
||||
Global.WorldStateMgr.SetValue(worldStateId, value, instance);
|
||||
Global.WorldStateMgr.SetValue(worldStateId, value, false, instance);
|
||||
}
|
||||
|
||||
// Send Notify to all players in instance
|
||||
|
||||
@@ -584,7 +584,7 @@ namespace Game.Maps
|
||||
|
||||
public Dictionary<int, int> GetWorldStateValues() { return _worldStateValues; }
|
||||
|
||||
public void SetWorldStateValue(int worldStateId, int value)
|
||||
public void SetWorldStateValue(int worldStateId, int value, bool hidden)
|
||||
{
|
||||
int oldValue = _worldStateValues.LookupByKey(worldStateId);
|
||||
_worldStateValues[worldStateId] = value;
|
||||
@@ -597,6 +597,7 @@ namespace Game.Maps
|
||||
UpdateWorldState updateWorldState = new();
|
||||
updateWorldState.VariableID = (uint)worldStateId;
|
||||
updateWorldState.Value = value;
|
||||
updateWorldState.Hidden = hidden;
|
||||
updateWorldState.Write();
|
||||
|
||||
foreach (var player in GetPlayers())
|
||||
|
||||
@@ -896,8 +896,8 @@ namespace Game
|
||||
LoadWorldStates();
|
||||
|
||||
// TODO: this is temporary until custom world states are purged from old world state saved values
|
||||
Global.WorldStateMgr.SetValue(WorldStates.WarModeHordeBuffValue, (int)GetWorldState(WorldStates.WarModeHordeBuffValue), null);
|
||||
Global.WorldStateMgr.SetValue(WorldStates.WarModeAllianceBuffValue, (int)GetWorldState(WorldStates.WarModeAllianceBuffValue), null);
|
||||
Global.WorldStateMgr.SetValue(WorldStates.WarModeHordeBuffValue, (int)GetWorldState(WorldStates.WarModeHordeBuffValue), false, null);
|
||||
Global.WorldStateMgr.SetValue(WorldStates.WarModeAllianceBuffValue, (int)GetWorldState(WorldStates.WarModeAllianceBuffValue), false, null);
|
||||
|
||||
Global.ObjectMgr.LoadPhases();
|
||||
|
||||
@@ -1258,8 +1258,8 @@ namespace Game
|
||||
|
||||
public void SetForcedWarModeFactionBalanceState(int team, int reward = 0)
|
||||
{
|
||||
Global.WorldStateMgr.SetValue(WorldStates.WarModeHordeBuffValue, 10 + (team == TeamId.Alliance ? reward : 0), null);
|
||||
Global.WorldStateMgr.SetValue(WorldStates.WarModeAllianceBuffValue, 10 + (team == TeamId.Horde ? reward : 0), null);
|
||||
Global.WorldStateMgr.SetValue(WorldStates.WarModeHordeBuffValue, 10 + (team == TeamId.Alliance ? reward : 0), false, null);
|
||||
Global.WorldStateMgr.SetValue(WorldStates.WarModeAllianceBuffValue, 10 + (team == TeamId.Horde ? reward : 0), false, null);
|
||||
|
||||
// save to db
|
||||
SetWorldState(WorldStates.WarModeHordeBuffValue, Global.WorldStateMgr.GetValue(WorldStates.WarModeHordeBuffValue, null));
|
||||
@@ -2533,8 +2533,8 @@ namespace Game
|
||||
outnumberedFactionReward = 5;
|
||||
}
|
||||
|
||||
Global.WorldStateMgr.SetValue(WorldStates.WarModeHordeBuffValue, 10 + (dominantFaction == TeamId.Alliance ? outnumberedFactionReward : 0), null);
|
||||
Global.WorldStateMgr.SetValue(WorldStates.WarModeAllianceBuffValue, 10 + (dominantFaction == TeamId.Horde ? outnumberedFactionReward : 0), null);
|
||||
Global.WorldStateMgr.SetValue(WorldStates.WarModeHordeBuffValue, 10 + (dominantFaction == TeamId.Alliance ? outnumberedFactionReward : 0), false, null);
|
||||
Global.WorldStateMgr.SetValue(WorldStates.WarModeAllianceBuffValue, 10 + (dominantFaction == TeamId.Horde ? outnumberedFactionReward : 0), false, null);
|
||||
|
||||
// save to db
|
||||
SetWorldState(WorldStates.WarModeHordeBuffValue, Global.WorldStateMgr.GetValue(WorldStates.WarModeHordeBuffValue, null));
|
||||
|
||||
@@ -160,17 +160,17 @@ namespace Game
|
||||
return map.GetWorldStateValue(worldStateId);
|
||||
}
|
||||
|
||||
public void SetValue(WorldStates worldStateId, int value, Map map)
|
||||
public void SetValue(WorldStates worldStateId, int value, bool hidden, Map map)
|
||||
{
|
||||
SetValue((int)worldStateId, value, map);
|
||||
SetValue((int)worldStateId, value, hidden, map);
|
||||
}
|
||||
|
||||
public void SetValue(uint worldStateId, int value, Map map)
|
||||
public void SetValue(uint worldStateId, int value, bool hidden, Map map)
|
||||
{
|
||||
SetValue((int)worldStateId, value, map);
|
||||
SetValue((int)worldStateId, value, hidden, map);
|
||||
}
|
||||
|
||||
public void SetValue(int worldStateId, int value, Map map)
|
||||
public void SetValue(int worldStateId, int value, bool hidden, Map map)
|
||||
{
|
||||
WorldStateTemplate worldStateTemplate = GetWorldStateTemplate(worldStateId);
|
||||
if (worldStateTemplate == null || worldStateTemplate.MapIds.Empty())
|
||||
@@ -185,6 +185,7 @@ namespace Game
|
||||
UpdateWorldState updateWorldState = new();
|
||||
updateWorldState.VariableID = (uint)worldStateId;
|
||||
updateWorldState.Value = value;
|
||||
updateWorldState.Hidden = hidden;
|
||||
Global.WorldMgr.SendGlobalMessage(updateWorldState);
|
||||
return;
|
||||
}
|
||||
@@ -192,7 +193,7 @@ namespace Game
|
||||
if (!worldStateTemplate.MapIds.Contains(map.GetId()))
|
||||
return;
|
||||
|
||||
map.SetWorldStateValue(worldStateId, value);
|
||||
map.SetWorldStateValue(worldStateId, value, hidden);
|
||||
}
|
||||
|
||||
public Dictionary<int, int> GetInitialWorldStatesForMap(Map map)
|
||||
|
||||
Reference in New Issue
Block a user