Core/WorldStates: Migrate conditions and criteria to new worldstate api

Port From (https://github.com/TrinityCore/TrinityCore/commit/7029b78cab620b861818fab4f94c7810caf109de)
This commit is contained in:
hondacrx
2022-06-27 15:54:38 -04:00
parent 9422b62dca
commit e5d325bf82
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -1812,7 +1812,7 @@ namespace Game.Achievements
return false; return false;
break; break;
case ModifierTreeType.PlayersRealmWorldState: // 108 case ModifierTreeType.PlayersRealmWorldState: // 108
if (Global.WorldMgr.GetWorldState(reqValue) != secondaryAsset) if (Global.WorldStateMgr.GetValue((int)reqValue, referencePlayer.GetMap()) != secondaryAsset)
return false; return false;
break; break;
case ModifierTreeType.TimeBetween: // 109 case ModifierTreeType.TimeBetween: // 109
+1 -1
View File
@@ -83,7 +83,7 @@ namespace Game.Conditions
break; break;
case ConditionTypes.WorldState: case ConditionTypes.WorldState:
{ {
condMeets = ConditionValue2 == Global.WorldMgr.GetWorldState(ConditionValue1); condMeets = Global.WorldStateMgr.GetValue((int)ConditionValue1, map) == ConditionValue2;
break; break;
} }
case ConditionTypes.RealmAchievement: case ConditionTypes.RealmAchievement:
+2 -2
View File
@@ -1668,7 +1668,7 @@ namespace Game
} }
case ConditionTypes.WorldState: case ConditionTypes.WorldState:
{ {
if (Global.WorldMgr.GetWorldState((WorldStates)cond.ConditionValue1) == 0) if (Global.WorldStateMgr.GetWorldStateTemplate((int)cond.ConditionValue1) == null)
{ {
Log.outError(LogFilter.Sql, "{0} has non existing world state in value1 ({1}), skipped.", cond.ToString(true), cond.ConditionValue1); Log.outError(LogFilter.Sql, "{0} has non existing world state in value1 ({1}), skipped.", cond.ToString(true), cond.ConditionValue1);
return false; return false;
@@ -2772,7 +2772,7 @@ namespace Game
case WorldStateExpressionValueType.WorldState: case WorldStateExpressionValueType.WorldState:
{ {
uint worldStateId = buffer.ReadUInt32(); uint worldStateId = buffer.ReadUInt32();
value = (int)Global.WorldMgr.GetWorldState(worldStateId); value = Global.WorldStateMgr.GetValue((int)worldStateId, player.GetMap());
break; break;
} }
case WorldStateExpressionValueType.Function: case WorldStateExpressionValueType.Function:
+1 -1
View File
@@ -247,7 +247,7 @@ namespace Game.Entities
{ {
if (area != null) if (area != null)
{ {
if (InBattleground() || area.HasFlag(AreaFlags.Combat) || (area.PvpCombatWorldStateID != -1 && Global.WorldMgr.GetWorldState((WorldStates)area.PvpCombatWorldStateID) != 0)) if (InBattleground() || area.HasFlag(AreaFlags.Combat) || (area.PvpCombatWorldStateID != -1 && Global.WorldStateMgr.GetValue(area.PvpCombatWorldStateID, GetMap()) != 0))
pvpInfo.IsInHostileArea = true; pvpInfo.IsInHostileArea = true;
else if (IsWarModeLocalActive() || area.HasFlag(AreaFlags.Unk3)) else if (IsWarModeLocalActive() || area.HasFlag(AreaFlags.Unk3))
{ {