Code/ConditionMgr: added CONDITION_DRUNKENSTATE, true if player is drunk enough. sober(0), tipsy(1), drunk(2), smashed(3)

--HG--
branch : trunk
This commit is contained in:
Rat
2010-10-11 23:35:55 +02:00
parent adf0abc90c
commit 5ee2c83835
2 changed files with 15 additions and 1 deletions

View File

@@ -176,6 +176,11 @@ bool Condition::Meets(Player * player, Unit* invoker)
}
break;
}
case CONDITION_DRUNKENSTATE:
{
condMeets = (uint32)Player::GetDrunkenstateByValue(player->GetDrunkValue()) >= mConditionValue1;
break;
}
default:
condMeets = false;
refId = 0;
@@ -1270,6 +1275,15 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
break;
}
case CONDITION_DRUNKENSTATE:
{
if (cond->mConditionValue1 > DRUNKEN_SMASHED)
{
sLog.outErrorDb("DrunkState condition has invalid state (%u), skipped", cond->mConditionValue1);
return false;
}
break;
}
case CONDITION_AREAID:
case CONDITION_INSTANCE_DATA:
break;

View File

@@ -37,7 +37,7 @@ enum ConditionType
CONDITION_SKILL = 7, // skill_id skill_value +referenceID true if has skill_value for skill_id
CONDITION_QUESTREWARDED = 8, // quest_id 0 +referenceID true if quest_id was rewarded before
CONDITION_QUESTTAKEN = 9, // quest_id 0, +referenceID true while quest active
CONDITION_UNUSED_1 = 10, // currently unused
CONDITION_DRUNKENSTATE = 10, // DrunkenState 0, +referenceID true if player is drunk enough
CONDITION_NO_AURA = 11, // spell_id effindex +referenceID true if does not have aura of spell_id with effect effindex
CONDITION_ACTIVE_EVENT = 12, // event_id 0 +referenceID true if event is active
CONDITION_INSTANCE_DATA = 13, // entry data +referenceID true if data is set in current instance