aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp17
-rw-r--r--src/server/game/Conditions/ConditionMgr.h5
2 files changed, 19 insertions, 3 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 2aa97eb2d48..3eb9ffeed35 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -116,6 +116,7 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND
{ "On Taxi", false, false, false },
{ "Quest state mask", true, true, false },
{ "Quest objective progress", true, true, true },
+ { "Map difficulty", true, false, false },
{ "Is Gamemaster", true, false, false }
};
@@ -514,7 +515,11 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const
}
break;
}
-
+ case CONDITION_DIFFICULTY_ID:
+ {
+ condMeets = object->GetMap()->GetDifficulty() == ConditionValue1;
+ break;
+ }
case CONDITION_GAMEMASTER:
{
if (Player* player = object->ToPlayer())
@@ -716,6 +721,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const
case CONDITION_QUEST_OBJECTIVE_PROGRESS:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
+ case CONDITION_DIFFICULTY_ID:
+ mask |= GRID_MAP_TYPE_MASK_ALL;
+ break;
case CONDITION_GAMEMASTER:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
@@ -2326,6 +2334,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const
}
break;
}
+ case CONDITION_DIFFICULTY_ID:
+ if (cond->ConditionValue1 >= MAX_DIFFICULTY)
+ {
+ TC_LOG_ERROR("sql.sql", "%s has non existing difficulty in value1 (%u), skipped.", cond->ToString(true).c_str(), cond->ConditionValue1);
+ return false;
+ }
+ break;
case CONDITION_IN_WATER:
case CONDITION_CHARMED:
case CONDITION_TAXI:
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index c8b8c775268..a658573c57b 100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -84,8 +84,9 @@ 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_PROGRESS = 48, // quest_id objectiveIndex objectiveCount true if player has reached the specified objectiveCount quest progress for the objectiveIndex for the specified quest
- CONDITION_GAMEMASTER = 49, // canBeGM 0 0 true if player is gamemaster (or can be gamemaster)
- CONDITION_MAX = 50 // MAX
+ CONDITION_DIFFICULTY_ID = 49, // Difficulty 0 0 true is map has difficulty id
+ CONDITION_GAMEMASTER = 50, // canBeGM 0 0 true if player is gamemaster (or can be gamemaster)
+ CONDITION_MAX
};
/*! Documentation on implementing a new ConditionSourceType: