diff options
| author | Antonio MartÃn Berti <15972392+BertiRean@users.noreply.github.com> | 2022-05-09 14:33:55 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-09 19:33:55 +0200 |
| commit | 5002e5d3524eab201c6c219cd60a9f7d6188ed54 (patch) | |
| tree | d0b17984b57f8126a50c0fd1b162a2f4da93919a /src | |
| parent | 5ba124758790ef7d71eab2dae157bfec5fdd5926 (diff) | |
Core/Conditions: Added CONDITION_SCENARIO_STEP (#27928)
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 21 | ||||
| -rw-r--r-- | src/server/game/Conditions/ConditionMgr.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index e154df64f7a..27c6f88ba93 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -43,6 +43,7 @@ #include "RaceMask.h" #include "Realm.h" #include "ReputationMgr.h" +#include "Scenario.h" #include "ScriptMgr.h" #include "Spell.h" #include "SpellAuras.h" @@ -146,6 +147,7 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND { "Object Entry or Guid", true, true, true }, { "Object TypeMask", true, false, false }, { "BattlePet Species Learned", true, true, true }, + { "On Scenario Step", true, false, false }, }; // Checks if object meets the condition @@ -574,6 +576,13 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const static_cast<uint8>(ConditionValue2)); break; } + case CONDITION_SCENARIO_STEP: + { + if (Scenario const* scenario = object->GetScenario()) + if (ScenarioStepEntry const* step = scenario->GetStep()) + condMeets = step->ID == ConditionValue1; + break; + } default: condMeets = false; break; @@ -778,6 +787,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const case CONDITION_BATTLE_PET_COUNT: mask |= GRID_MAP_TYPE_MASK_PLAYER; break; + case CONDITION_SCENARIO_STEP: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; default: ABORT_MSG("Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -2602,6 +2614,15 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const return false; } break; + case CONDITION_SCENARIO_STEP: + { + if (!sScenarioStepStore.LookupEntry(cond->ConditionValue1)) + { + TC_LOG_ERROR("sql.sql", "%s has non existing ScenarioStep 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 44001f94a5f..501fb351af1 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -110,6 +110,7 @@ enum ConditionTypes CONDITION_OBJECT_ENTRY_GUID = 51, // TypeID entry guid true if object is type TypeID and the entry is 0 or matches entry of the object or matches guid of the object 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_MAX }; |
