From bd401af0912eca2c938b6dd93fdb7689b9146c89 Mon Sep 17 00:00:00 2001 From: Antonio Martín Berti <15972392+BertiRean@users.noreply.github.com> Date: Tue, 21 Jun 2022 18:26:07 -0300 Subject: Core/Conditions: Added CONDITION_SCENE_IN_PROGRESS, useful for cases where you need phase things when a scene is in progress. (#28011) --- src/server/game/Conditions/ConditionMgr.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (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 27c6f88ba93..f372e282e49 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -148,6 +148,7 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND { "Object TypeMask", true, false, false }, { "BattlePet Species Learned", true, true, true }, { "On Scenario Step", true, false, false }, + { "Scene In Progress", true, false, false }, }; // Checks if object meets the condition @@ -583,6 +584,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const condMeets = step->ID == ConditionValue1; break; } + case CONDITION_SCENE_IN_PROGRESS: + { + if (Player* player = object->ToPlayer()) + condMeets = player->GetSceneMgr().GetActiveSceneCount(ConditionValue1) > 0; + break; + } default: condMeets = false; break; @@ -790,6 +797,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const case CONDITION_SCENARIO_STEP: mask |= GRID_MAP_TYPE_MASK_ALL; break; + case CONDITION_SCENE_IN_PROGRESS: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; default: ABORT_MSG("Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -2623,6 +2633,15 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const } break; } + case CONDITION_SCENE_IN_PROGRESS: + { + if (!sSceneScriptPackageStore.LookupEntry(cond->ConditionValue1)) + { + TC_LOG_ERROR("sql.sql", "%s has non existing SceneScriptPackageId in value1 (%u), skipped.", cond->ToString(true).c_str(), cond->ConditionValue1); + return false; + } + break; + } default: TC_LOG_ERROR("sql.sql", "%s Invalid ConditionType in `condition` table, ignoring.", cond->ToString().c_str()); return false; -- cgit v1.2.3