Code/ConditionMgr: cleanup

--HG--
branch : trunk
This commit is contained in:
Rat
2010-10-05 18:07:41 +02:00
parent f733d8b224
commit f745705ef9
2 changed files with 16 additions and 6 deletions

View File

@@ -160,19 +160,19 @@ bool Condition::Meets(Player * player, Unit* invoker)
{
switch (mConditionValue2)
{
case 0:
case LVL_COND_EQ:
condMeets = player->getLevel() == mConditionValue1;
break;
case 1:
case LVL_COND_HIGH:
condMeets = player->getLevel() > mConditionValue1;
break;
case 2:
case LVL_COND_LOW:
condMeets = player->getLevel() < mConditionValue1;
break;
case 3:
case LVL_COND_HIGH_EQ:
condMeets = player->getLevel() >= mConditionValue1;
break;
case 4:
case LVL_COND_LOW_EQ:
condMeets = player->getLevel() <= mConditionValue1;
break;
}
@@ -1265,7 +1265,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
case CONDITION_LEVEL:
{
if (cond->mConditionValue2 > 4)
if (cond->mConditionValue2 >= LVL_COND_MAX)
{
sLog.outErrorDb("Level condition has invalid option (%u), skipped", cond->mConditionValue2);
return false;

View File

@@ -60,6 +60,16 @@ enum ConditionType
CONDITION_MAX = 28 // MAX
};
enum LevelConditionType
{
LVL_COND_EQ = 0,
LVL_COND_HIGH = 1,
LVL_COND_LOW = 2,
LVL_COND_HIGH_EQ = 3,
LVL_COND_LOW_EQ = 4,
LVL_COND_MAX = 5,
};
enum ConditionSourceType
{
CONDITION_SOURCE_TYPE_NONE = 0,//DONE