Skip to content

Commit b05b2ae

Browse files
authored
Fix item modifier classification on character import (#9993)
1 parent d54c7aa commit b05b2ae

2 files changed

Lines changed: 37 additions & 4 deletions

File tree

spec/System/TestImport_spec.lua

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,38 @@ describe("TestImport", function()
7070
isEquipped(4, "Fulgent Bliss, Small Cluster Jewel")
7171
end)
7272

73+
it("imports modifier flags from the 3.29 item API", function()
74+
build.importTab:ImportItem({
75+
id = "test-item-mod-flags",
76+
frameType = 2,
77+
name = "Test Grip",
78+
typeLine = "Rawhide Gloves",
79+
inventoryId = "Gloves",
80+
ilvl = 10,
81+
properties = { },
82+
implicitMods = {
83+
{ description = "+20 to maximum Life" },
84+
},
85+
explicitMods = {
86+
{ description = "+10 to maximum Life", flags = { crafted = true } },
87+
{ description = "+11 to maximum Mana", flags = { fractured = true } },
88+
{ description = "+12 to Strength", flags = { mutated = true } },
89+
},
90+
})
91+
92+
local itemId = build.itemsTab.slots.Gloves.selItemId
93+
local item = build.itemsTab.items[itemId]
94+
local explicitMods = { }
95+
for _, modLine in ipairs(item.explicitModLines) do
96+
explicitMods[modLine.line] = modLine
97+
end
98+
99+
assert.are.equal("+20 to maximum Life", item.implicitModLines[1].line)
100+
assert.is_true(explicitMods["+10 to maximum Life"].crafted)
101+
assert.is_true(explicitMods["+11 to maximum Mana"].fractured)
102+
assert.is_true(explicitMods["+12 to Strength"].mutated)
103+
end)
104+
73105
function importAndReimportWithOldJewel(shouldDelete)
74106
local oldJewel = new("Item", [[Rarity: RARE
75107
TEST JEWEL
@@ -124,4 +156,4 @@ Implicits: 0]])
124156
end
125157
assert.truthy(found)
126158
end)
127-
end)
159+
end)

src/Classes/ImportTab.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,12 +1652,13 @@ function ImportTabClass:ImportItem(itemData, slotName, ignoreWeaponSwap)
16521652
if itemData.explicitMods then
16531653
for _, itemMod in ipairs(itemData.explicitMods) do
16541654
local modLine = itemMod.description or itemMod
1655+
local flags = itemMod.flags or itemMod
16551656
for line in modLine:gmatch("[^\n]+") do
16561657
local modList, extra = modLib.parseMod(line)
16571658
t_insert(item.explicitModLines, { line = line, extra = extra, mods = modList or { },
1658-
fractured = itemMod.fractured,
1659-
crafted = itemMod.crafted,
1660-
mutated = itemMod.mutated })
1659+
fractured = flags.fractured,
1660+
crafted = flags.crafted,
1661+
mutated = flags.mutated })
16611662
end
16621663
end
16631664
end

0 commit comments

Comments
 (0)