aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Martín Berti <15972392+BertiRean@users.noreply.github.com>2022-06-21 18:26:07 -0300
committerGitHub <noreply@github.com>2022-06-21 23:26:07 +0200
commitbd401af0912eca2c938b6dd93fdb7689b9146c89 (patch)
treee484bbb5a68c931c84da78d089bd630eb69df819
parentae6b9e6c41f882f6c0a48a6352b73b3ae098e012 (diff)
Core/Conditions: Added CONDITION_SCENE_IN_PROGRESS, useful for cases where you need phase things when a scene is in progress. (#28011)
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp19
-rw-r--r--src/server/game/Conditions/ConditionMgr.h1
2 files changed, 20 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;
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index 501fb351af1..1408bbe77f5 100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -111,6 +111,7 @@ enum ConditionTypes
CONDITION_TYPE_MASK = 52, // TypeMask 0 0 true if object is type object's TypeMask matches provided TypeMask
CONDITION_BATTLE_PET_COUNT = 53, // SpecieId count ComparisonType true if player has `count` of battle pet species
CONDITION_SCENARIO_STEP = 54, // ScenarioStepId 0 0 true if player is at scenario with current step equal to ScenarioStepID
+ CONDITION_SCENE_IN_PROGRESS = 55, // SceneScriptPackageId 0 0 true if player is playing a scene with ScriptPackageId equal to given value
CONDITION_MAX
};