diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 4888b120d..b20cad06a 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7257,6 +7257,15 @@ bool PlayerCondition::Meets(Player const * player) const if ((!value1 || (player->getRaceMask() & value1)) && (!value2 || (player->getClassMask() & value2))) return true; return false; + case CONDITION_LEVEL: + { + switch(value2) + { + case 0: return player->getLevel() == value1; + case 1: return player->getLevel() >= value1; + case 2: return player->getLevel() <= value1; + } + } default: return false; } @@ -7431,6 +7440,20 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val } break; } + case CONDITION_LEVEL: + { + if (!value1 || value1 > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) + { + sLog.outErrorDb("Level condition has invalid level %u, skipped", value1); + return false; + } + + if (value2 > 2) + { + sLog.outErrorDb("Level condition has invalid argument %u (must be 0..2), skipped", value2); + return false; + } + } case CONDITION_NONE: break; } diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 0286236be..2a978a5ed 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -286,9 +286,10 @@ enum ConditionType CONDITION_ACTIVE_EVENT = 12, // event_id 0 CONDITION_AREA_FLAG = 13, // area_flag area_flag_not CONDITION_RACE_CLASS = 14, // race_mask class_mask + CONDITION_LEVEL = 15, // player_level 0, 1 or 2 (0: equal to, 1: equal or higher than, 2: equal or less than) }; -#define MAX_CONDITION 15 // maximum value in ConditionType enum +#define MAX_CONDITION 16 // maximum value in ConditionType enum struct PlayerCondition { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5cd982e0c..2508f258f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9110" + #define REVISION_NR "9111" #endif // __REVISION_NR_H__