Core/WorldStates: Skip sending SMSG_UPDATE_WORLD_STATE when value does not change

Port From (https://github.com/TrinityCore/TrinityCore/commit/db79e29121b74dc62da1b68cf1e25fb8e31ffbdf)
This commit is contained in:
hondacrx
2022-07-09 12:46:08 -04:00
parent fca1e3d98a
commit aae75ce85d
2 changed files with 16 additions and 2 deletions
+8 -1
View File
@@ -175,7 +175,14 @@ namespace Game
WorldStateTemplate worldStateTemplate = GetWorldStateTemplate(worldStateId);
if (worldStateTemplate == null || worldStateTemplate.MapIds.Empty())
{
int oldValue = _realmWorldStateValues.LookupByKey(worldStateId);
int oldValue = 0;
if (!_realmWorldStateValues.TryAdd(worldStateId, 0))
{
oldValue = _realmWorldStateValues[worldStateId];
if (oldValue == value)
return;
}
_realmWorldStateValues[worldStateId] = value;
if (worldStateTemplate != null)