diff --git a/spec/System/TestImport_spec.lua b/spec/System/TestImport_spec.lua index dffd4291f8..2ea158148e 100644 --- a/spec/System/TestImport_spec.lua +++ b/spec/System/TestImport_spec.lua @@ -70,6 +70,38 @@ describe("TestImport", function() isEquipped(4, "Fulgent Bliss, Small Cluster Jewel") end) + it("imports modifier flags from the 3.29 item API", function() + build.importTab:ImportItem({ + id = "test-item-mod-flags", + frameType = 2, + name = "Test Grip", + typeLine = "Rawhide Gloves", + inventoryId = "Gloves", + ilvl = 10, + properties = { }, + implicitMods = { + { description = "+20 to maximum Life" }, + }, + explicitMods = { + { description = "+10 to maximum Life", flags = { crafted = true } }, + { description = "+11 to maximum Mana", flags = { fractured = true } }, + { description = "+12 to Strength", flags = { mutated = true } }, + }, + }) + + local itemId = build.itemsTab.slots.Gloves.selItemId + local item = build.itemsTab.items[itemId] + local explicitMods = { } + for _, modLine in ipairs(item.explicitModLines) do + explicitMods[modLine.line] = modLine + end + + assert.are.equal("+20 to maximum Life", item.implicitModLines[1].line) + assert.is_true(explicitMods["+10 to maximum Life"].crafted) + assert.is_true(explicitMods["+11 to maximum Mana"].fractured) + assert.is_true(explicitMods["+12 to Strength"].mutated) + end) + function importAndReimportWithOldJewel(shouldDelete) local oldJewel = new("Item", [[Rarity: RARE TEST JEWEL @@ -124,4 +156,4 @@ Implicits: 0]]) end assert.truthy(found) end) -end) \ No newline at end of file +end) diff --git a/src/Classes/ImportTab.lua b/src/Classes/ImportTab.lua index cc1b77ef5f..39ffb7d081 100644 --- a/src/Classes/ImportTab.lua +++ b/src/Classes/ImportTab.lua @@ -1652,12 +1652,13 @@ function ImportTabClass:ImportItem(itemData, slotName, ignoreWeaponSwap) if itemData.explicitMods then for _, itemMod in ipairs(itemData.explicitMods) do local modLine = itemMod.description or itemMod + local flags = itemMod.flags or itemMod for line in modLine:gmatch("[^\n]+") do local modList, extra = modLib.parseMod(line) t_insert(item.explicitModLines, { line = line, extra = extra, mods = modList or { }, - fractured = itemMod.fractured, - crafted = itemMod.crafted, - mutated = itemMod.mutated }) + fractured = flags.fractured, + crafted = flags.crafted, + mutated = flags.mutated }) end end end