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
12 changes: 12 additions & 0 deletions spec/System/TestItemParse_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,18 @@ describe("TestItemParse", function()
assert.truthy(item.explicitModLines[1].custom)
end)

it("crafted", function()
local item = new("Item", raw("{crafted}+8 to Strength"))
assert.truthy(item.explicitModLines[1].crafted)
end)

it("preserves crafted mod lines when rebuilding raw text", function()
local item = new("Item", raw("+8 to Strength"))
item.explicitModLines[1].crafted = true
item:BuildAndParseRaw()
assert.truthy(item.explicitModLines[1].crafted)
end)

it("enchant", function()
local item = new("Item", raw("+8 to Strength (enchant)"))
assert.are.equals(1, #item.enchantModLines)
Expand Down
8 changes: 8 additions & 0 deletions src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,14 @@ function ImportTabClass:ImportItem(itemData, slotName)
end
end
end
if itemData.craftedMods then
for _, line in ipairs(itemData.craftedMods) do
for line in line:gmatch("[^\n]+") do
local modList, extra = modLib.parseMod(line)
t_insert(item.explicitModLines, { line = line, extra = extra, mods = modList or { }, crafted = true })
end
end
end

if itemData.grantedSkills then
for _, grantedSkillInfo in ipairs(itemData.grantedSkills) do
Expand Down
5 changes: 4 additions & 1 deletion src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ local ItemClass = newClass("Item", function(self, raw, rarity, highQuality)
end)

local lineFlags = {
["custom"] = true, ["fractured"] = true, ["desecrated"] = true, ["mutated"] = true, ["enchant"] = true, ["implicit"] = true, ["rune"] = true, ["unscalable"] = true
["custom"] = true, ["crafted"] = true, ["fractured"] = true, ["desecrated"] = true, ["mutated"] = true, ["enchant"] = true, ["implicit"] = true, ["rune"] = true, ["unscalable"] = true
}

local function baseHasImplicitLine(base, line)
Expand Down Expand Up @@ -1363,6 +1363,9 @@ function ItemClass:BuildRaw()
if modLine.mutated then
line = "{mutated}" .. line
end
if modLine.crafted then
line = "{crafted}" .. line
end
if modLine.unscalable then
line = "{unscalable}" .. line
end
Expand Down
1 change: 1 addition & 0 deletions src/Data/Global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ colorCodes = {
GEMINFO = "^x6F9A98",
PROPHECY = "^xB54BFF",
CURRENCY = "^xAA9E82",
CRAFTED = "^xB8DAF1",
ENCHANTED = "^xB8DAF1",
CUSTOM = "^x5CF0BB",
SOURCE = "^x88FFFF",
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/ItemTools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ function itemLib.formatModLine(modLine, dbMode)
line = line .. " ^1'" .. modLine.extra .. "'"
end
else
colorCode = (modLine.enchant and colorCodes.ENCHANTED) or (modLine.fractured and colorCodes.FRACTURED) or (modLine.mutated and colorCodes.MUTATED) or (modLine.custom and (not modLine.desecrated and colorCodes.CUSTOM)) or colorCodes.MAGIC
colorCode = (modLine.crafted and colorCodes.CRAFTED) or (modLine.enchant and colorCodes.ENCHANTED) or (modLine.fractured and colorCodes.FRACTURED) or (modLine.mutated and colorCodes.MUTATED) or (modLine.custom and (not modLine.desecrated and colorCodes.CUSTOM)) or colorCodes.MAGIC
end
return colorCode..line
end
Expand Down
Loading