diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d6c0ad626..11cc7251b 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -10116,10 +10116,42 @@ uint8 Player::CanUseItem( Item *pItem, bool not_loading ) const if ((pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0) return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM; - if (pItem->GetSkill() != 0) + if (uint32 item_use_skill = pItem->GetSkill()) { - if (GetSkillValue( pItem->GetSkill() ) == 0) - return EQUIP_ERR_NO_REQUIRED_PROFICIENCY; + if (GetSkillValue(item_use_skill) == 0) + { + // armor items with scaling stats can downgrade armor skill reqs if related class can learn armor use at some level + if (pProto->Class != ITEM_CLASS_ARMOR) + return EQUIP_ERR_NO_REQUIRED_PROFICIENCY; + + ScalingStatDistributionEntry const *ssd = pProto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(pProto->ScalingStatDistribution) : NULL; + if (!ssd) + return EQUIP_ERR_NO_REQUIRED_PROFICIENCY; + + bool allowScaleSkill = false; + for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i) + { + SkillLineAbilityEntry const *skillInfo = sSkillLineAbilityStore.LookupEntry(i); + if (!skillInfo) + continue; + + if (skillInfo->skillId != item_use_skill) + continue; + + // can't learn + if (skillInfo->classmask && (skillInfo->classmask & getClassMask()) == 0) + continue; + + if (skillInfo->racemask && (skillInfo->racemask & getRaceMask()) == 0) + continue; + + allowScaleSkill = true; + break; + } + + if (!allowScaleSkill) + return EQUIP_ERR_NO_REQUIRED_PROFICIENCY; + } } if (pProto->RequiredSkill != 0) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3978d0357..d0b3bd387 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8580" + #define REVISION_NR "8581" #endif // __REVISION_NR_H__