Jump to content

[patch]Enchants and gems requiring skill


Auntie Mangos

Recommended Posts

  • 40 years later...

What bug does the patch fix? What features does the patch add?

When u make your jewelcrafting skill to 350 you can use gems of this type http://www.wowhead.com/item=42142 , but when you unlearn jc you can still use the item with this gem and u shouldn't be able to use the item and when u relog item should go into your mail. Same thing is for enchants from BS, enchanting, leatherworking and tailoring.

For which repository revision was the patch created?

Don't remember witch revision i made patch for but works with 9842.

Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

Don't find any

Who has been writing this patch? Please include either forum user names or email addresses.

Me.

diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h
index e71b630..b0d9908 100644
--- a/src/game/DBCfmt.h
+++ b/src/game/DBCfmt.h
@@ -88,11 +88,11 @@ const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char SpellCastTimefmt[]="nixx";
const char SpellDurationfmt[]="niii";
const char SpellDifficultyfmt[]="niiii";
const char SpellEntryfmt[]="niiiiiiiiiixixixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiixxxxxxi";
const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx";
-const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiixxx";
+const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiiiix";
const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";
const char SpellRadiusfmt[]="nfxf";
const char SpellRangefmt[]="nffffxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char SpellRuneCostfmt[]="niiii";
const char SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixiiixxiiiiiiii";
diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
index e71b630..b0d9908 100644
--- a/src/game/DBCStructure.h
+++ b/src/game/DBCStructure.h
@@ -1570,12 +1570,12 @@ struct SpellItemEnchantmentEntry
    //uint32      descriptionFlags;                         // 30 name flags
    uint32      aura_id;                                    // 31       m_itemVisual
    uint32      slot;                                       // 32       m_flags
    uint32      GemID;                                      // 33       m_src_itemID
    uint32      EnchantmentCondition;                       // 34       m_condition_id
-    //uint32      requiredSkill;                            // 35       m_requiredSkillID
-    //uint32      requiredSkillValue;                       // 36       m_requiredSkillRank
+    uint32      requiredSkill;                            // 35       m_requiredSkillID
+    uint32      requiredSkillValue;                       // 36       m_requiredSkillRank
                                                            // 37       new in 3.1
};

struct SpellItemEnchantmentConditionEntry
{
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index c636f07..e45c09c 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -10283,10 +10290,23 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
                        CanUnequipItem(uint16(INVENTORY_SLOT_BAG_0) << 8 | EQUIPMENT_SLOT_OFFHAND,false) !=  EQUIP_ERR_OK ||
                        CanStoreItem( NULL_BAG, NULL_SLOT, off_dest, offItem, false ) !=  EQUIP_ERR_OK ))
                        return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_INVENTORY_FULL;
                }
            }
+             for(uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
+            {
+                uint32 enchant_id = pItem->GetEnchantmentId(EnchantmentSlot(enchant_slot));
+                if(!enchant_id)
+                    continue;
+
+                SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
+                if(!enchantEntry)
+                    continue;
+
+                if(GetSkillValue(enchantEntry->requiredSkill) < enchantEntry->requiredSkillValue)
+                    return EQUIP_ERR_CANT_EQUIP_SKILL;
+            }
            dest = ((INVENTORY_SLOT_BAG_0 << 8) | eslot);
            return EQUIP_ERR_OK;
        }
    }

For gems required skill can be checked without including requiredSkil and requiredSkillValue but for enchants didn't find a way

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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