diff options
Diffstat (limited to 'src/game/Item.cpp')
-rw-r--r-- | src/game/Item.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/game/Item.cpp b/src/game/Item.cpp index d1a5612b95c..00f271ca89e 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -726,6 +726,36 @@ bool Item::CanBeTraded(bool mail) const return true; } + +bool Item::HasEnchantRequiredSkill(const Player *pPlayer) const +{ + + // Check all enchants for required skill + for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot) + if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot))) + if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id)) + if (enchantEntry->requiredSkill && pPlayer->GetSkillValue(enchantEntry->requiredSkill) < enchantEntry->requiredSkillValue) + return false; + + return true; +} + + +uint32 Item::GetEnchantRequiredLevel() const +{ + + uint32 level = 0; + + // Check all enchants for required level + for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot) + if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot))) + if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id)) + if (enchantEntry->requiredLevel > level) + level = enchantEntry->requiredLevel; + + return level; +} + bool Item::IsBoundByEnchant() const { // Check all enchants for soulbound @@ -741,6 +771,10 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const { ItemPrototype const* proto = GetProto(); + //Lava Lash + if (spellInfo->Id==60103 && spellInfo->EquippedItemClass==ITEM_CLASS_WEAPON) + return true; + if (spellInfo->EquippedItemClass != -1) // -1 == any item class { // Special case - accept vellum for armor/weapon requirements |