diff options
author | Antonio MartÃn Berti <15972392+BertiRean@users.noreply.github.com> | 2022-06-21 18:26:07 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-21 23:26:07 +0200 |
commit | bd401af0912eca2c938b6dd93fdb7689b9146c89 (patch) | |
tree | e484bbb5a68c931c84da78d089bd630eb69df819 /src/server/game/Conditions/ConditionMgr.cpp | |
parent | ae6b9e6c41f882f6c0a48a6352b73b3ae098e012 (diff) |
Core/Conditions: Added CONDITION_SCENE_IN_PROGRESS, useful for cases where you need phase things when a scene is in progress. (#28011)
Diffstat (limited to 'src/server/game/Conditions/ConditionMgr.cpp')
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
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; |