Remove unnecesary item enchants checks

By Az@zel
Closes issue #382

--HG--
branch : trunk
This commit is contained in:
Spp
2010-01-30 20:48:23 +01:00
parent ba59411178
commit aee31b9164
3 changed files with 0 additions and 32 deletions
-23
View File
@@ -727,29 +727,6 @@ bool Item::CanBeTraded(bool mail) const
return true; 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 bool Item::IsBoundByEnchant() const
{ {
// Check all enchants for soulbound // Check all enchants for soulbound
-3
View File
@@ -250,9 +250,6 @@ class TRINITY_DLL_SPEC Item : public Object
void SetInTrade(bool b = true) { mb_in_trade = b; } void SetInTrade(bool b = true) { mb_in_trade = b; }
bool IsInTrade() const { return mb_in_trade; } bool IsInTrade() const { return mb_in_trade; }
bool HasEnchantRequiredSkill(const Player *pPlayer) const;
uint32 GetEnchantRequiredLevel() const;
bool IsFitToSpellRequirements(SpellEntry const* spellInfo) const; bool IsFitToSpellRequirements(SpellEntry const* spellInfo) const;
bool IsTargetValidForItemUse(Unit* pUnitTarget); bool IsTargetValidForItemUse(Unit* pUnitTarget);
bool IsLimitedToAnotherMapOrZone( uint32 cur_mapId, uint32 cur_zoneId) const; bool IsLimitedToAnotherMapOrZone( uint32 cur_mapId, uint32 cur_zoneId) const;
-6
View File
@@ -10890,12 +10890,6 @@ uint8 Player::CanUseItem( Item *pItem, bool not_loading ) const
if (getLevel() < pProto->RequiredLevel) if (getLevel() < pProto->RequiredLevel)
return EQUIP_ERR_CANT_EQUIP_LEVEL_I; return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
if (getLevel() < pItem->GetEnchantRequiredLevel())
return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
if (!pItem->HasEnchantRequiredSkill(this))
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
return EQUIP_ERR_OK; return EQUIP_ERR_OK;
} }
} }