All pastes #797773 Raw Edit

Miscellany

public text v1 · immutable
#797773 ·published 2007-11-26 06:57 UTC
rendered paste body
Index: src/game/ItemHandler.cpp
===================================================================
--- src/game/ItemHandler.cpp	(revision 81)
+++ src/game/ItemHandler.cpp	(working copy)
@@ -217,10 +217,7 @@
         WorldPacket data( SMSG_ITEM_QUERY_SINGLE_RESPONSE, 600);        
         data << pProto->ItemId;
         data << pProto->Class;
-
-        // client known only 0 subclass (and 1-2 obsolete subclasses)
-        data << uint32(pProto->Class==ITEM_CLASS_CONSUMABLE && pProto->SubClass==ITEM_SUBCLASS_COMBAT_EFFECT ? 0 : pProto->SubClass);
-
+        data << pProto->SubClass;
         data << uint32(-1);                                 // new 2.0.3, not exist in wdb cache?
         data << Name;
         data << uint8(0x00);                                //pProto->Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name...
Index: src/game/ItemPrototype.h
===================================================================
--- src/game/ItemPrototype.h	(revision 81)
+++ src/game/ItemPrototype.h	(working copy)
@@ -228,11 +228,10 @@
     ITEM_SUBCLASS_FOOD                          = 5,
     ITEM_SUBCLASS_ITEM_ENHANCEMENT              = 6,
     ITEM_SUBCLASS_BANDAGE                       = 7,
-    ITEM_SUBCLASS_CONSUMABLE_OTHER              = 8,
-    ITEM_SUBCLASS_COMBAT_EFFECT                 = 9         // Mangos Custom
+    ITEM_SUBCLASS_CONSUMABLE_OTHER              = 8
 };
 
-#define MAX_ITEM_SUBCLASS_CONSUMABLE              10
+#define MAX_ITEM_SUBCLASS_CONSUMABLE              9
 
 enum ItemSubclassContainer
 {
Index: src/game/SpellHandler.cpp
===================================================================
--- src/game/SpellHandler.cpp	(revision 82)
+++ src/game/SpellHandler.cpp	(working copy)
@@ -64,24 +64,7 @@
         return;
     }
 
-    if (pUser->isInCombat())
-    {
-        uint8 consumable = proto->Class == ITEM_CLASS_CONSUMABLE &&
-            proto->SubClass != ITEM_SUBCLASS_POTION &&
-            proto->SubClass != ITEM_SUBCLASS_SCROLL &&
-            proto->SubClass != ITEM_SUBCLASS_BANDAGE &&
-            proto->SubClass != ITEM_SUBCLASS_ITEM_ENHANCEMENT &&
-            proto->SubClass != ITEM_SUBCLASS_COMBAT_EFFECT;
 
-        uint8 trade_goods = proto->Class == ITEM_CLASS_TRADE_GOODS && proto->SubClass != ITEM_SUBCLASS_EXPLOSIVES;
-        if (consumable || trade_goods ||
-            proto->Class == ITEM_CLASS_KEY || proto->Class == ITEM_CLASS_JUNK)
-        {
-            pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT,pItem,NULL);
-            return;
-        }
-    }
-
     // check also  BIND_WHEN_PICKED_UP for .additem or .additemset case by GM (not binded at adding to inventory)
     if( pItem->GetProto()->Bonding == BIND_WHEN_USE || pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP)
     {
@@ -123,6 +106,12 @@
                 continue;
             }
 
+            if(pUser->isInCombat() && IsNonCombatSpell(spellInfo->Id))
+            {
+                pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT,pItem,NULL);
+                return;
+            }
+
             Spell *spell = new Spell(pUser, spellInfo, (count > 0) , 0);
             spell->m_CastItem = pItem;
             spell->prepare(&targets);