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:
@@ -61,7 +61,12 @@ bool Condition::Meets(WorldObject* object, WorldObject* invoker)
|
|||||||
case CONDITION_ITEM:
|
case CONDITION_ITEM:
|
||||||
{
|
{
|
||||||
if (Player* player = object->ToPlayer())
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case CONDITION_ITEM_EQUIPPED:
|
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);
|
sLog->outErrorDb("Item condition has 0 set for item count in value2 (%u), skipped", cond->mConditionValue2);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (cond->mConditionValue3)
|
|
||||||
sLog->outErrorDb("Item condition has useless data in value3 (%u)!", cond->mConditionValue3);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CONDITION_ITEM_EQUIPPED:
|
case CONDITION_ITEM_EQUIPPED:
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ enum ConditionType
|
|||||||
{ // value1 value2 value3
|
{ // value1 value2 value3
|
||||||
CONDITION_NONE = 0, // 0 0 0 always true
|
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_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_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_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
|
CONDITION_REPUTATION_RANK = 5, // faction_id min_rank 0 true if has min_rank for faction_id
|
||||||
|
|||||||
Reference in New Issue
Block a user