aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-06-26 12:18:45 +0200
committerShauren <shauren.trinity@gmail.com>2022-06-26 12:18:45 +0200
commit7029b78cab620b861818fab4f94c7810caf109de (patch)
treeaeeb642ea754d33dcbdd527e0875d4bab3168c90 /src
parent743308267fe18677f07878a8d4814ef800660661 (diff)
Core/WorldStates: Migrate conditions and criteria to new worldstate api
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Achievements/CriteriaHandler.cpp2
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp9
-rw-r--r--src/server/game/Entities/Player/Player.cpp2
3 files changed, 7 insertions, 6 deletions
diff --git a/src/server/game/Achievements/CriteriaHandler.cpp b/src/server/game/Achievements/CriteriaHandler.cpp
index 9fb6b3b19b7..92390429997 100644
--- a/src/server/game/Achievements/CriteriaHandler.cpp
+++ b/src/server/game/Achievements/CriteriaHandler.cpp
@@ -2226,7 +2226,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6
return false;
break;
case ModifierTreeType::PlayersRealmWorldState: // 108
- if (sWorld->getWorldState(reqValue) != secondaryAsset)
+ if (sWorldStateMgr->GetValue(reqValue, referencePlayer->GetMap()) != int32(secondaryAsset))
return false;
break;
case ModifierTreeType::TimeBetween: // 109
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index c90ae6673b8..d40dfef63e1 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -39,8 +39,8 @@
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "PhasingHandler.h"
-#include "Player.h"
#include "Pet.h"
+#include "Player.h"
#include "RaceMask.h"
#include "Realm.h"
#include "ReputationMgr.h"
@@ -51,6 +51,7 @@
#include "SpellMgr.h"
#include "World.h"
#include "WorldSession.h"
+#include "WorldStateMgr.h"
#include <random>
#include <sstream>
@@ -218,7 +219,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const
break;
case CONDITION_WORLD_STATE:
{
- condMeets = ConditionValue2 == sWorld->getWorldState(ConditionValue1);
+ condMeets = sWorldStateMgr->GetValue(ConditionValue1, map) == int32(ConditionValue2);
break;
}
case CONDITION_REALM_ACHIEVEMENT:
@@ -2562,7 +2563,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const
}
case CONDITION_WORLD_STATE:
{
- if (!sWorld->getWorldState(cond->ConditionValue1))
+ if (!sWorldStateMgr->GetWorldStateTemplate(cond->ConditionValue1))
{
TC_LOG_ERROR("sql.sql", "%s has non existing world state in value1 (%u), skipped.", cond->ToString(true).c_str(), cond->ConditionValue1);
return false;
@@ -3600,7 +3601,7 @@ int32 EvalSingleValue(ByteBuffer& buffer, Player const* player)
case WorldStateExpressionValueType::WorldState:
{
uint32 worldStateId = buffer.read<uint32>();
- value = sWorld->getWorldState(worldStateId);
+ value = sWorldStateMgr->GetValue(worldStateId, player->GetMap());
break;
}
case WorldStateExpressionValueType::Function:
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 5394a667d6c..ac8228c2be4 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -7338,7 +7338,7 @@ void Player::UpdateHostileAreaState(AreaTableEntry const* area)
{
if (area)
{
- if (InBattleground() || area->Flags[0] & AREA_FLAG_COMBAT || (area->PvpCombatWorldStateID != -1 && sWorld->getWorldState(area->PvpCombatWorldStateID) != 0))
+ if (InBattleground() || area->Flags[0] & AREA_FLAG_COMBAT || (area->PvpCombatWorldStateID != -1 && sWorldStateMgr->GetValue(area->PvpCombatWorldStateID, GetMap()) != 0))
pvpInfo.IsInHostileArea = true;
else if (IsWarModeLocalActive() || (area->Flags[0] & AREA_FLAG_UNK3))
{