All pastes #797764 Raw Edit

Miscellany

public text v1 · immutable
#797764 ·published 2007-11-26 06:38 UTC
rendered paste body
Index: game/SpellHandler.cpp
===================================================================
--- game/SpellHandler.cpp	(revision 82)
+++ 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);