Skip to content

Fix crash when an item grants a skill below its lowest defined level - #2543

Open
juddisjudd wants to merge 1 commit into
PathOfBuildingCommunity:devfrom
juddisjudd:fix/granted-skill-lowest-level
Open

juddisjudd wants to merge 1 commit into
PathOfBuildingCommunity:devfrom
juddisjudd:fix/granted-skill-lowest-level

Conversation

@juddisjudd

Copy link
Copy Markdown

Description of the problem being solved:

getGrantedSkillLevel returns level 1 when no level at or below the item's level qualifies. Since the 0.5.5 export (#2505), some granted skills define only higher levels. Pinnacle of Power, granted by Adonia's Ego, has only level 20. This has two effects:

  • Equipping Adonia's Ego sets the granted Pinnacle of Power gem to level 1, which has no level data.
  • A build saved with that gem at level 20, as builds saved with the older data have it, errors in CalcSetup.lua at grantedEffect.levels[level].levelRequirement (attempt to index a nil value). The whole build then fails to calculate.

This change falls back to the lowest level the skill defines, so Pinnacle of Power gets level 20.

Steps taken to verify a working solution:

  • Headless at ce566ea: equip Adonia's Ego on a level 70 character. Pinnacle of Power gets level 1. Setting it to 20, as an older save has it, and recalculating errors at CalcSetup.lua:2167.
  • Same steps with this change: Pinnacle of Power gets level 20, and the build recalculates without error.
  • 10 saved guide and ladder builds with Adonia's Ego failed to calculate at ce566ea. With this change all 10 load, and their Combined DPS is within 4% of what 1bcdb48 (before Export 0.5.5 data and update trade data #2505) gives them.

Link to a build that showcases this PR:

No public link. Any build saved before #2505 with Adonia's Ego equipped reproduces it.

Before screenshot:

CalcSetup.lua:2167: attempt to index a nil value; the build shows no stats.

After screenshot:

The build calculates, with Pinnacle of Power at level 20.

getGrantedSkillLevel falls back to level 1 when no level at or below the
item's level qualifies. The 0.5.5 export defines some granted skills only
at higher levels: Pinnacle of Power, granted by Adonia's Ego, has only
level 20. levels[1] is then nil and CalcSetup errors while setting the
gem's requirements, so any build with the wand fails to calculate. Fall
back to the lowest level the skill defines instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant