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
26 changes: 26 additions & 0 deletions spec/System/TestItemParse_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,32 @@ describe("TestAdvancedItemParse #item", function()
}, lines(item.explicitModLines))
end)

it("keeps saved rolls on their lines for a unique saved out of stat order", function()
loadBuildFromXML([[
<PathOfBuilding>
<Build level="1" targetVersion="3_0" className="Scion" ascendClassName="None" mainSocketGroup="1"/>
<Items activeItemSet="1">
<Item id="1">
Rarity: UNIQUE
Geofri's Sanctuary
Elegant Ringmail
Implicits: 0
{range:0.2}+(60-70) to maximum Life
{range:0.9}(50-75)% increased Armour and Energy Shield
<ModRange id="1" range="0.2"/>
<ModRange id="2" range="0.9"/>
</Item>
<ItemSet id="1"/>
</Items>
</PathOfBuilding>]])

local ranges = { }
for _, modLine in ipairs(build.itemsTab.items[1].explicitModLines) do
ranges[modLine.line] = modLine.range
end
assert.are.equals(0.9, ranges["(50-75)% increased Armour and Energy Shield"])
end)

it("keeps the selected value from advanced-copy enum ranges", function()
local item = new("Item"):Item([[
Rarity: Unique
Expand Down
8 changes: 6 additions & 2 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,9 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
-- assume an item to be an advanced copy format if either has mod roll information, a modifier
-- line with a range, or advanced copy lines
self.advancedCopy = false
-- Only in-game advanced copy text (with "{ ... }" modifier headers) is re-sorted into stat order.
-- Text written by PoB keeps its line order, which the ModRange entries of saved builds refer to.
local hasModifierHeaders = false
self.modMagnitudeMods = {}
local implicitLines = 0
self.variantList = nil
Expand Down Expand Up @@ -574,6 +577,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
elseif line:match("^{ ") then
-- We're parsing advanced copy/paste format
self.advancedCopy = true
hasModifierHeaders = true
linePrefix = ""
linePostfix = ""
self.crafted = true
Expand Down Expand Up @@ -1357,7 +1361,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
::continue::
l = l + 1
end
if self.advancedCopy and (self.rarity == "UNIQUE" or self.rarity == "RELIC") then
if hasModifierHeaders and (self.rarity == "UNIQUE" or self.rarity == "RELIC") then
if not uniqueModStatOrder then
uniqueModStatOrder = { exact = { }, normalised = { } }
for _, mod in pairs(data.itemMods.ItemExclusive) do
Expand Down Expand Up @@ -1468,7 +1472,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
end
end
end
if self.advancedCopy and #self.explicitModLines > 1 then
if hasModifierHeaders and #self.explicitModLines > 1 then
sortCraftedModLines(self.explicitModLines)
end
self.affixLimit = 0
Expand Down
Loading