mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[8581] Implement downgrade armor proficiency for items with scaled stats.
Original patch provided by Antonio593.
This commit is contained in:
parent
140b0d59bc
commit
2e2d1013d4
2 changed files with 36 additions and 4 deletions
|
|
@ -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)
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8580"
|
||||
#define REVISION_NR "8581"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue