[11849] Implement Condition CONDITION_SKILL_BELOW to be able to check if a player has a skill lower than a given value

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Schmoozerd 2011-11-27 19:11:16 +01:00
parent 9eb96b7811
commit e19943b907
2 changed files with 9 additions and 0 deletions

View file

@ -7654,6 +7654,11 @@ bool PlayerCondition::Meets(Player const * player) const
return false; return false;
} }
case CONDITION_SKILL_BELOW:
if (value2 == 1)
return !player->HasSkill(value1);
else
return player->HasSkill(value1) && player->GetBaseSkillValue(value1) < value2;
default: default:
return false; return false;
} }
@ -7744,6 +7749,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
break; break;
} }
case CONDITION_SKILL: case CONDITION_SKILL:
case CONDITION_SKILL_BELOW:
{ {
SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(value1); SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(value1);
if (!pSkill) if (!pSkill)

View file

@ -367,6 +367,9 @@ enum ConditionType
// True when player can learn ability (using min skill value from SkillLineAbility). // True when player can learn ability (using min skill value from SkillLineAbility).
// Item_id can be defined in addition, to check if player has one (1) item in inventory or bank. // Item_id can be defined in addition, to check if player has one (1) item in inventory or bank.
// When player has spell or has item (when defined), condition return false. // When player has spell or has item (when defined), condition return false.
CONDITION_SKILL_BELOW = 29, // skill_id skill_value
// True if player has skill skill_id and skill less than (and not equal) skill_value (for skill_value > 1)
// If skill_value == 1, then true if player has not skill skill_id
}; };
struct PlayerCondition struct PlayerCondition