Jump to content

[8581] Heirloom armor type downgrade fix


Guest Antonio593

Recommended Posts

The problem is that Mail heirloom armor is supposed to downgrade to Leather for Hunter/Shaman and Plate Mail downgrades to Mail for Paladins and Warriors.

My code below accomplishes just that. My mangos version is 8407, but nothing has changed in this area recently as far as I can tell.

Now, I have no idea how hacky or efficient this code is and would appreciate any help in improving it. Especially the part where I check to see if it's a heirloom item. Is there a better way to check? (I just copied the part from another section.)

in player.cpp

@@ -10128,20 +10128,31 @@ uint8 Player::CanUseItem( Item *pItem, bool not_loading ) const
                return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;

            if (pItem->GetSkill() != 0)
            {
                if (GetSkillValue( pItem->GetSkill() ) == 0)
-                    return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
+                 {
+                     ScalingStatDistributionEntry const *ssd = pProto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(pProto->ScalingStatDistribution) : 0;
+                     if (ssd) //This line and above checks to see if it's an heirloom item in a weird way
+                     {
+                         //Heirlooms: Mail downgrades to leather and Plate Mail to Mail for certain classes only.
+                         if (pItem->GetSkill() == SKILL_MAIL && (getClass() == CLASS_HUNTER || getClass() == CLASS_SHAMAN))
+                             return EQUIP_ERR_OK;
+                         if (pItem->GetSkill() == SKILL_PLATE_MAIL && (getClass() == CLASS_PALADIN || getClass() == CLASS_WARRIOR))
+                             return EQUIP_ERR_OK;
+                     }
+                     return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
+                 }
            }

            if (pProto->RequiredSkill != 0)
            {
                if (GetSkillValue( pProto->RequiredSkill ) == 0)

Link to comment
Share on other sites

Hm SkillLineAbility.dbc looks pretty huge to me, my dbc viewer says mail (skillID 413 to my knowledge) is etry #6826 for example.

May i suggest instead that if the player can't already wear the armor class that you look through SkillRaceClassInfo.dbc and check if he may learn it later?

That's at worst 240 entries, SkillRaceClassInfoEntry.skillId and SkillRaceClassInfoEntry.classMask seem to be what we're looking for if a player can't wear mail/plate yet.

-edit-

seems there's two entries for plate and mail in SkillRaceClassInfo.dbc, one with the classMask that have the skill from the beginning, and one with classMask matching classes that can learn it at level 40.

Link to comment
Share on other sites

That's probably no bad idea either...

On the other side, checking 6k entries may not be as dramatic as it looks at first...unless there's lots of people toggling armor pieces (including a heirloom) all the time to see which stats they like better.

(Also, i don't have 2000+ friends that want to play with me anyway, but others seem to :eek:)

Link to comment
Share on other sites

×
×
  • 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