Core/Db/Conditions: Add 3rd parameter to CONDITION_ITEM so it can now perform a check if item exists in bank aswell as in equipment.

This commit is contained in:
QAston
2012-02-10 16:47:58 +01:00
parent 05b18ca9ba
commit 586a76e3a0
2 changed files with 7 additions and 4 deletions
+6 -3
View File
@@ -61,7 +61,12 @@ bool Condition::Meets(WorldObject* object, WorldObject* invoker)
case CONDITION_ITEM:
{
if (Player* player = object->ToPlayer())
condMeets = (mConditionValue2 && player->HasItemCount(mConditionValue1, mConditionValue2)) || (!mConditionValue2 && !player->HasItemCount(mConditionValue1, mConditionValue2));//HasItemCount returns false if 0 count is used
{
// don't allow 0 items (it's checked during table load)
ASSERT(mConditionValue2);
bool checkBank = mConditionValue3 ? true : false;
condMeets = player->HasItemCount(mConditionValue1, mConditionValue2, checkBank);
}
break;
}
case CONDITION_ITEM_EQUIPPED:
@@ -1142,8 +1147,6 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
sLog->outErrorDb("Item condition has 0 set for item count in value2 (%u), skipped", cond->mConditionValue2);
return false;
}
if (cond->mConditionValue3)
sLog->outErrorDb("Item condition has useless data in value3 (%u)!", cond->mConditionValue3);
break;
}
case CONDITION_ITEM_EQUIPPED:
+1 -1
View File
@@ -30,7 +30,7 @@ enum ConditionType
{ // value1 value2 value3
CONDITION_NONE = 0, // 0 0 0 always true
CONDITION_AURA = 1, // spell_id effindex use target? true if player (or target, if value3) has aura of spell_id with effect effindex
CONDITION_ITEM = 2, // item_id count 0 true if has #count of item_ids
CONDITION_ITEM = 2, // item_id count bank true if has #count of item_ids (if 'bank' is set it searches in bank slots too)
CONDITION_ITEM_EQUIPPED = 3, // item_id 0 0 true if has item_id equipped
CONDITION_ZONEID = 4, // zone_id 0 0 true if in zone_id
CONDITION_REPUTATION_RANK = 5, // faction_id min_rank 0 true if has min_rank for faction_id