Code/ConditionMgr: added condition_NOITEM (26) value1: item.entry value2: 0/1 if 1 it searches player's bank too

--HG--
branch : trunk
This commit is contained in:
Rat
2010-09-30 22:41:19 +02:00
parent 84a29b2d35
commit 0857c18af8
2 changed files with 15 additions and 1 deletions

View File

@@ -165,6 +165,9 @@ bool Condition::Meets(Player * player, Unit* invoker)
case CONDITION_SPELL:
condMeets = player->HasSpell(mConditionValue1);
break;
case CONDITION_NOITEM:
condMeets = !player->HasItemCount(mConditionValue1, 1, mConditionValue2 ? true : false);
break;
default:
condMeets = false;
refId = 0;
@@ -1249,6 +1252,16 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
sLog.outErrorDb("Spell condition has useless data in value2 (%u)!", cond->mConditionValue2);
break;
}
case CONDITION_NOITEM:
{
ItemPrototype const *proto = sObjectMgr.GetItemPrototype(cond->mConditionValue1);
if (!proto)
{
sLog.outErrorDb("NoItem condition has non existing item (%u), skipped", cond->mConditionValue1);
return false;
}
break;
}
case CONDITION_AREAID:
case CONDITION_INSTANCE_DATA:
break;

View File

@@ -55,7 +55,8 @@ enum ConditionType
CONDITION_AREAID = 23, // area_id 0 +referenceID true if in area_id
CONDITION_ITEM_TARGET = 24, // ItemRequiredTargetType, TargetEntry, 0
CONDITION_SPELL = 25, // spell_id 0 +referenceID true if knows spell
CONDITION_MAX = 26 // MAX
CONDITION_NOITEM = 26, // item_id bank +referenceID true if player does not have any of the item (if 'bank' is set it searches in bank slots too)
CONDITION_MAX = 27 // MAX
};
enum ConditionSourceType