diff options
| author | Shauren <shauren.trinity@gmail.com> | 2018-09-15 17:55:26 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2018-09-15 17:55:26 +0200 |
| commit | 738f37d3cf45d4e10eda9d44a4cb17079b7bbc1b (patch) | |
| tree | 9db45160ed8a0c68090dec2aebb9b73c9f2ea335 /src/server/game/Conditions | |
| parent | 0f3156d324ff8134171bada01b40f5c23f5c43cc (diff) | |
Core/Maps: Replaced spawnmask with difficulty list
Diffstat (limited to 'src/server/game/Conditions')
| -rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 37 | ||||
| -rw-r--r-- | src/server/game/Conditions/ConditionMgr.h | 5 |
2 files changed, 23 insertions, 19 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 50726b91cad..bad5c195667 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -121,7 +121,8 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND { "Pet type", true, false, false }, { "On Taxi", false, false, false }, { "Quest state mask", true, true, false }, - { "Objective Complete", true, false, false } + { "Objective Complete", true, false, false }, + { "Map Difficulty", true, false, false } }; // Checks if object meets the condition @@ -423,11 +424,6 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const condMeets = player->HasTitle(ConditionValue1); break; } - case CONDITION_SPAWNMASK: - { - condMeets = ((UI64LIT(1) << object->GetMap()->GetSpawnMode()) & ConditionValue1) != 0; - break; - } case CONDITION_UNIT_STATE: { if (Unit* unit = object->ToUnit()) @@ -523,6 +519,11 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const } break; } + case CONDITION_DIFFICULTY_ID: + { + condMeets = object->GetMap()->GetDifficultyID() == ConditionValue1; + break; + } default: condMeets = false; break; @@ -680,9 +681,6 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const case CONDITION_TITLE: mask |= GRID_MAP_TYPE_MASK_PLAYER; break; - case CONDITION_SPAWNMASK: - mask |= GRID_MAP_TYPE_MASK_ALL; - break; case CONDITION_GENDER: mask |= GRID_MAP_TYPE_MASK_PLAYER; break; @@ -722,6 +720,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const case CONDITION_QUEST_OBJECTIVE_COMPLETE: mask |= GRID_MAP_TYPE_MASK_PLAYER; break; + case CONDITION_DIFFICULTY_ID: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; default: ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -2261,15 +2262,10 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const } break; } - case CONDITION_SPAWNMASK: + case CONDITION_SPAWNMASK_DEPRECATED: { - /// @todo: ConditionValue need to be extended to uint64 - if (uint64(cond->ConditionValue1) >= (UI64LIT(1) << MAX_DIFFICULTY)) - { - TC_LOG_ERROR("sql.sql", "%s has non existing SpawnMask in value1 (%u), skipped.", cond->ToString(true).c_str(), cond->ConditionValue1); - return false; - } - break; + TC_LOG_ERROR("sql.sql", "%s using deprecated condition type CONDITION_SPAWNMASK.", cond->ToString(true).c_str()); + return false; } case CONDITION_UNIT_STATE: { @@ -2346,6 +2342,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const case CONDITION_CHARMED: case CONDITION_TAXI: break; + case CONDITION_DIFFICULTY_ID: + if (!sDifficultyStore.LookupEntry(cond->ConditionValue1)) + { + TC_LOG_ERROR("sql.sql", "%s has non existing difficulty 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 a94a14c6f71..f0c711adbbc 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -71,7 +71,7 @@ enum ConditionTypes CONDITION_RACE = 16, // race 0 0 true if player's race is equal to race CONDITION_ACHIEVEMENT = 17, // achievement_id 0 0 true if achievement is complete CONDITION_TITLE = 18, // title id 0 0 true if player has title - CONDITION_SPAWNMASK = 19, // spawnMask 0 0 true if in spawnMask + CONDITION_SPAWNMASK_DEPRECATED = 19, // DEPRECATED CONDITION_GENDER = 20, // gender 0 0 true if player's gender is equal to gender CONDITION_UNIT_STATE = 21, // unitState 0 0 true if unit has unitState CONDITION_MAPID = 22, // map_id 0 0 true if in map_id @@ -101,7 +101,8 @@ enum ConditionTypes CONDITION_TAXI = 46, // 0 0 0 true if player is on taxi CONDITION_QUESTSTATE = 47, // quest_id state_mask 0 true if player is in any of the provided quest states for the quest (1 = not taken, 2 = completed, 8 = in progress, 32 = failed, 64 = rewarded) CONDITION_QUEST_OBJECTIVE_COMPLETE = 48, // ID 0 0 true if player has ID objective complete, but quest not yet rewarded - CONDITION_MAX = 49 // MAX + CONDITION_DIFFICULTY_ID = 49, // Difficulty 0 0 true is map has difficulty id + CONDITION_MAX }; /*! Documentation on implementing a new ConditionSourceType: |
