From c1df555e1691d788918845f95252358f25e54bb5 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 1 Jun 2023 02:33:46 +0200 Subject: Core/Graveyards: Drop Faction column and replace it with conditions (#28965) --- src/server/game/Conditions/ConditionMgr.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/server/game/Conditions/ConditionMgr.cpp') 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(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; -- cgit v1.2.3