aboutsummaryrefslogtreecommitdiff
path: root/src/game/Item.cpp
diff options
context:
space:
mode:
authorRat <none@none>2010-06-04 23:24:48 +0200
committerRat <none@none>2010-06-04 23:24:48 +0200
commit1426c2970f42a2d065198806f750bf5dd28d580b (patch)
treee3247fb0f1770ab214e412e0f2d6edc5b91ec8f4 /src/game/Item.cpp
parent5ca00bc14d38c5ad49f0ab4500af52e645133826 (diff)
HIGHLY EXPERIMENTAL - USE AT YOUR OWN RISK
implemented Condition System all systems should work like before after applying the sql converter you won't be able to apply any Updatepacks (<=up30) so do updates before this this revesion is not threated as stable! --HG-- branch : trunk
Diffstat (limited to 'src/game/Item.cpp')
-rw-r--r--src/game/Item.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/game/Item.cpp b/src/game/Item.cpp
index 4cfd9484f9f..5c2d94d399b 100644
--- a/src/game/Item.cpp
+++ b/src/game/Item.cpp
@@ -26,6 +26,7 @@
#include "ItemEnchantmentMgr.h"
#include "SpellMgr.h"
#include "ScriptMgr.h"
+#include "ConditionMgr.h"
void AddItemsSetItem(Player*player,Item *item)
{
@@ -824,18 +825,19 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
bool Item::IsTargetValidForItemUse(Unit* pUnitTarget)
{
- ItemRequiredTargetMapBounds bounds = objmgr.GetItemRequiredTargetMapBounds(GetProto()->ItemId);
-
- if (bounds.first == bounds.second)
+ ConditionList conditions = sConditionMgr.GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_ITEM_REQUIRED_TARGET, GetProto()->ItemId);
+ if (conditions.empty())
return true;
if (!pUnitTarget)
return false;
- for (ItemRequiredTargetMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
- if (itr->second.IsFitToRequirements(pUnitTarget))
+ for (ConditionList::const_iterator itr = conditions.begin(); itr != conditions.end(); ++itr)
+ {
+ ItemRequiredTarget *irt = new ItemRequiredTarget((ItemRequiredTargetType)(*itr)->mConditionValue1, (*itr)->mConditionValue2);
+ if (irt->IsFitToRequirements(pUnitTarget))
return true;
-
+ }
return false;
}