diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 16 | ||||
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.h | 27 |
2 files changed, 28 insertions, 15 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index c5e3d26b00a..5fc7240cb9c 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -56,7 +56,8 @@ char const* ConditionMgr::StaticSourceTypeData[CONDITION_SOURCE_TYPE_MAX] = "SmartScript", "Npc Vendor", "Spell Proc", - "Phase Def" + "Terrain Swap", + "Phase" }; ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[CONDITION_MAX] = @@ -99,8 +100,9 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND { "Distance", true, true, true }, { "Alive", false, false, false }, { "Health Value", true, true, false }, - { "Health Pct", true, true, false }, - { "Realm Achievement", true, false, false } + { "Health Pct", true, true, false }, + { "Realm Achievement", true, false, false }, + { "Terrain Swap", true, false, false } }; // Checks if object meets the condition @@ -2065,14 +2067,6 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } break; } - case CONDITION_TERRAIN_SWAP: - { - if (cond->ConditionValue2) - TC_LOG_ERROR("sql.sql", "Terrain swap condition has useless data in value2 (%u)!", cond->ConditionValue2); - if (cond->ConditionValue3) - TC_LOG_ERROR("sql.sql", "Terrain swap condition has useless data in value3 (%u)!", cond->ConditionValue3); - break; - } case CONDITION_TITLE: { CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(cond->ConditionValue1); diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 26c958cd92e..f2d27afb5f3 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -31,6 +31,23 @@ class WorldObject; class LootTemplate; struct Condition; +/*! Documentation on implementing a new ConditionType: + Step 1: Check for the lowest free ID. Look for CONDITION_UNUSED_XX in the enum. + Then define the new condition type. + + Step 2: Determine and map the parameters for the new condition type. + + Step 3: Add a case block to ConditionMgr::isConditionTypeValid with the new condition type + and validate the parameters. + + Step 4: Define the maximum available condition targets in ConditionMgr::GetMaxAvailableConditionTargets. + + Step 5: Define the grid searcher mask in Condition::GetSearcherTypeMaskForCondition. + + Step 6: Add a case block to ConditionMgr::Meets with the new condition type. + + Step 7: Define condition name and expected condition values in ConditionMgr::StaticConditionTypeData. +*/ enum ConditionTypes { // value1 value2 value3 CONDITION_NONE = 0, // 0 0 0 always true @@ -81,7 +98,7 @@ enum ConditionTypes Step 1: Check for the lowest free ID. Look for CONDITION_SOURCE_TYPE_UNUSED_XX in the enum. Then define the new source type. - Step 2: Determine and map the parameters for the new condition type. + Step 2: Determine and map the parameters for the new condition source type. Step 3: Add a case block to ConditionMgr::isSourceTypeValid with the new condition type and validate the parameters. @@ -91,18 +108,20 @@ enum ConditionTypes Step 5: Define the maximum available condition targets in ConditionMgr::GetMaxAvailableConditionTargets. + Step 6: Define ConditionSourceType Name in ConditionMgr::StaticSourceTypeData. + The following steps only apply if your condition can be grouped: - Step 6: Determine how you are going to store your conditions. You need to add a new storage container + Step 7: Determine how you are going to store your conditions. You need to add a new storage container for it in ConditionMgr class, along with a function like: ConditionList GetConditionsForXXXYourNewSourceTypeXXX(parameters...) The above function should be placed in upper level (practical) code that actually checks the conditions. - Step 7: Implement loading for your source type in ConditionMgr::LoadConditions. + Step 8: Implement loading for your source type in ConditionMgr::LoadConditions. - Step 8: Implement memory cleaning for your source type in ConditionMgr::Clean. + Step 9: Implement memory cleaning for your source type in ConditionMgr::Clean. */ enum ConditionSourceType { |