Skip to content

Commit 5724a11

Browse files
LocalIdentityLocalIdentity
andauthored
Fix Fractured mods not importing on items (#1110)
Adds back the removed lines from #6 Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 83739cf commit 5724a11

4 files changed

Lines changed: 25 additions & 2 deletions

File tree

spec/System/TestItemParse_spec.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ describe("TestItemParse", function()
146146
assert.truthy(item.mirrored)
147147
item = new("Item", raw("Corrupted"))
148148
assert.truthy(item.corrupted)
149+
item = new("Item", raw("Fractured Item"))
150+
assert.truthy(item.fractured)
149151
item = new("Item", raw("Crafted: true"))
150152
assert.truthy(item.crafted)
151153
item = new("Item", raw("Unreleased: true"))
@@ -179,6 +181,13 @@ describe("TestItemParse", function()
179181
assert.truthy(item.enchantModLines[1].enchant)
180182
assert.truthy(item.enchantModLines[1].implicit)
181183
end)
184+
185+
it("fractured", function()
186+
local item = new("Item", raw("{fractured}+8 to Strength"))
187+
assert.truthy(item.explicitModLines[1].fractured)
188+
item = new("Item", raw("+8 to Strength (fractured)"))
189+
assert.truthy(item.explicitModLines[1].fractured)
190+
end)
182191

183192
it("implicit", function()
184193
local item = new("Item", raw("+8 to Strength (implicit)"))

src/Classes/ImportTab.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,7 @@ function ImportTabClass:ImportItem(itemData, slotName)
898898
end
899899
item.mirrored = itemData.mirrored
900900
item.corrupted = itemData.corrupted
901+
item.fractured = itemData.fractured
901902
if itemData.sockets and itemData.sockets[1] then
902903
item.sockets = { }
903904
item.itemSocketCount = 0
@@ -953,6 +954,14 @@ function ImportTabClass:ImportItem(itemData, slotName)
953954
end
954955
end
955956
end
957+
if itemData.fracturedMods then
958+
for _, line in ipairs(itemData.fracturedMods) do
959+
for line in line:gmatch("[^\n]+") do
960+
local modList, extra = modLib.parseMod(line)
961+
t_insert(item.explicitModLines, { line = line, extra = extra, mods = modList or { }, fractured = true })
962+
end
963+
end
964+
end
956965
if itemData.explicitMods then
957966
for _, line in ipairs(itemData.explicitMods) do
958967
for line in line:gmatch("[^\n]+") do

src/Classes/Item.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ local ItemClass = newClass("Item", function(self, raw, rarity, highQuality)
5757
end)
5858

5959
local lineFlags = {
60-
["custom"] = true, ["enchant"] = true, ["implicit"] = true, ["rune"] = true,
60+
["custom"] = true, ["fractured"] = true, ["enchant"] = true, ["implicit"] = true, ["rune"] = true,
6161
}
6262

6363
-- Special function to store unique instances of modifier on specific item slots
@@ -381,6 +381,8 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
381381
self.mirrored = true
382382
elseif line == "Corrupted" then
383383
self.corrupted = true
384+
elseif line == "Fractured Item" then
385+
self.fractured = true
384386
elseif line == "Requirements:" then
385387
-- nothing to do
386388
else
@@ -1140,6 +1142,9 @@ function ItemClass:BuildRaw()
11401142
if modLine.custom then
11411143
line = "{custom}" .. line
11421144
end
1145+
if modLine.fractured then
1146+
line = "{fractured}" .. line
1147+
end
11431148
if modLine.variantList then
11441149
local varSpec
11451150
for varId in pairs(modLine.variantList) do

src/Modules/ItemTools.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ function itemLib.formatModLine(modLine, dbMode)
330330
line = line .. " ^1'" .. modLine.extra .. "'"
331331
end
332332
else
333-
colorCode = (modLine.enchant and colorCodes.ENCHANTED) or (modLine.custom and colorCodes.CUSTOM) or colorCodes.MAGIC
333+
colorCode = (modLine.enchant and colorCodes.ENCHANTED) or (modLine.fractured and colorCodes.FRACTURED) or (modLine.custom and colorCodes.CUSTOM) or colorCodes.MAGIC
334334
end
335335
return colorCode..line
336336
end

0 commit comments

Comments
 (0)