Jump to content

[9544][patch]support CONDITION_NOITEM


Guest timmit

Recommended Posts

diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index b887961..f8b041d 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -7389,6 +7389,8 @@ bool PlayerCondition::Meets(Player const * player) const
            return player->HasAura(value1, SpellEffectIndex(value2));
        case CONDITION_ITEM:
            return player->HasItemCount(value1, value2);
+        case CONDITION_NOITEM:
+            return player->!HasItemCount(value1, 1);
        case CONDITION_ITEM_EQUIPPED:
            return player->HasItemOrGemWithIdEquipped(value1,1);
        case CONDITION_ZONEID:
@@ -7484,6 +7486,16 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
            }
            break;
        }
+        case CONDITION_NOITEM:
+        {
+            ItemPrototype const *proto = ObjectMgr::GetItemPrototype(value1);
+            if(!proto)
+            {
+                sLog.outErrorDb("Item condition requires to have non existing item (%u), skipped", value1);
+                return false;
+            }
+            break;
+        }
        case CONDITION_ITEM_EQUIPPED:
        {
            ItemPrototype const *proto = ObjectMgr::GetItemPrototype(value1);
diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h
index 4442f56..d0fb9c5 100644
--- a/src/game/ObjectMgr.h
+++ b/src/game/ObjectMgr.h
@@ -301,6 +301,7 @@ enum ConditionType
    CONDITION_AURA                  = 1,                    // spell_id     effindex
    CONDITION_ITEM                  = 2,                    // item_id      count
    CONDITION_ITEM_EQUIPPED         = 3,                    // item_id      0
+    CONDITION_NOITEM                = 16,                   // item_id      0
    CONDITION_ZONEID                = 4,                    // zone_id      0
    CONDITION_REPUTATION_RANK       = 5,                    // faction_id   min_rank
    CONDITION_TEAM                  = 6,                    // player_team  0,      (469 - Alliance 67 - Horde)
@@ -315,7 +316,7 @@ enum ConditionType
    CONDITION_LEVEL                 = 15,                   // player_level 0, 1 or 2 (0: equal to, 1: equal or higher than, 2: equal or less than)
};

-#define MAX_CONDITION                 16                    // maximum value in ConditionType enum
+#define MAX_CONDITION                 17                    // maximum value in ConditionType enum

struct PlayerCondition
{

Condition necessary for many gossips, which require the absence of the item in the inventory

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use