Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions spec/System/TestItemParse_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1358,5 +1358,36 @@
assert.equal(27, spellCrit())
assert.equal(8, spellDamage())
end)


it("does not overwrite existing values when a suffix magnitude mod fails to parse", function()
-- grantedExtraSkill returns (nil) when the skill is missing from gemIdLookup,
-- so parseMod also returns nil (no second value) -> overwriting both modList and extra when the magnitude loop runs
local item = new("Item", [[
Item Class: Rings
Rarity: Rare
Plague Knuckle
Helical Ring
--------
Item Level: 84
--------
{ Implicit Modifier }
50% increased Suffix Modifier magnitudes
--------
{ Suffix Modifier "of !!UNPARSEABLE!!" — 50% Increased }

Check warning on line 1377 in spec/System/TestItemParse_spec.lua

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (UNPARSEABLE)
Grants Level 20 Aspect of !!UNPARSEABLE!! Skill

Check warning on line 1378 in spec/System/TestItemParse_spec.lua

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (UNPARSEABLE)
--------
]])
assert.truthy(item.base)
local aspectLine
for _, modLine in ipairs(item.explicitModLines) do
if modLine.line:find("UNPARSEABLE", 1, true) then

Check warning on line 1384 in spec/System/TestItemParse_spec.lua

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (UNPARSEABLE)
aspectLine = modLine
end
end
assert.truthy(aspectLine)
assert.truthy(aspectLine.modList)
assert.truthy(aspectLine.extra)
end)
end)
end)
8 changes: 5 additions & 3 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1420,9 +1420,11 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
if mod.valueScalar and mod.valueScalar ~= 1 then
local rangedLine = itemLib.applyRange(mod.line, mod.range or 1, mod.valueScalar, 1)
local modList, extra = modLib.parseMod(rangedLine)
mod.displayValueScalar = 1
mod.modList = modList
mod.extra = extra
if modList then
mod.displayValueScalar = 1
mod.modList = modList
mod.extra = extra
end
end
::modMagnitudeContinue::
end
Expand Down
Loading