Skip to content
Merged
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
34 changes: 33 additions & 1 deletion spec/System/TestImport_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -124,4 +156,4 @@ Implicits: 0]])
end
assert.truthy(found)
end)
end)
end)
7 changes: 4 additions & 3 deletions src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading