aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Conditions/ConditionMgr.cpp
diff options
context:
space:
mode:
authorJeremy <Golrag@users.noreply.github.com>2023-06-01 02:33:46 +0200
committerGitHub <noreply@github.com>2023-06-01 02:33:46 +0200
commitc1df555e1691d788918845f95252358f25e54bb5 (patch)
tree81d3d1ee68e1bde92495e59b6fa3b30294593eaa /src/server/game/Conditions/ConditionMgr.cpp
parentb8b416f85d50cc9849e4cba7d62681f6ae60be31 (diff)
Core/Graveyards: Drop Faction column and replace it with conditions (#28965)
Diffstat (limited to 'src/server/game/Conditions/ConditionMgr.cpp')
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 5156a33ff13..0ebf2c0f807 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -1033,6 +1033,7 @@ bool ConditionMgr::CanHaveSourceGroupSet(ConditionSourceType sourceType)
sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT ||
sourceType == CONDITION_SOURCE_TYPE_NPC_VENDOR ||
sourceType == CONDITION_SOURCE_TYPE_PHASE ||
+ sourceType == CONDITION_SOURCE_TYPE_GRAVEYARD ||
sourceType == CONDITION_SOURCE_TYPE_AREATRIGGER ||
sourceType == CONDITION_SOURCE_TYPE_TRAINER_SPELL ||
sourceType == CONDITION_SOURCE_TYPE_OBJECT_ID_VISIBILITY);
@@ -1457,6 +1458,9 @@ void ConditionMgr::LoadConditions(bool isReload)
case CONDITION_SOURCE_TYPE_PHASE:
valid = addToPhases(cond);
break;
+ case CONDITION_SOURCE_TYPE_GRAVEYARD:
+ valid = addToGraveyardData(cond);
+ break;
case CONDITION_SOURCE_TYPE_AREATRIGGER:
{
AreaTriggerConditionContainerStore[{ cond->SourceGroup, cond->SourceEntry }].push_back(cond);
@@ -1715,6 +1719,18 @@ bool ConditionMgr::addToPhases(Condition* cond) const
return false;
}
+bool ConditionMgr::addToGraveyardData(Condition* cond) const
+{
+ if (GraveyardData* graveyard = const_cast<GraveyardData*>(sObjectMgr->FindGraveyardData(cond->SourceEntry, cond->SourceGroup)))
+ {
+ graveyard->Conditions.push_back(cond);
+ return true;
+ }
+
+ TC_LOG_ERROR("sql.sql", "{}, Graveyard {} does not have ghostzone {}.", cond->ToString(), cond->SourceEntry, cond->SourceGroup);
+ return false;
+}
+
bool ConditionMgr::isSourceTypeValid(Condition* cond) const
{
switch (cond->SourceType)
@@ -2088,9 +2104,9 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) const
case CONDITION_SOURCE_TYPE_SMART_EVENT:
break;
case CONDITION_SOURCE_TYPE_GRAVEYARD:
- if (!sObjectMgr->GetWorldSafeLoc(cond->SourceEntry))
+ if (!sObjectMgr->FindGraveyardData(cond->SourceEntry, cond->SourceGroup))
{
- TC_LOG_ERROR("sql.sql", "{} SourceEntry in `condition` table, does not exist in WorldSafeLocs.db2, ignoring.", cond->ToString());
+ TC_LOG_ERROR("sql.sql", "{} SourceEntry in `condition` table, does not exist in `graveyard_zone`, ignoring.", cond->ToString());
return false;
}
break;