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
38 changes: 38 additions & 0 deletions spec/System/TestItemMods_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,44 @@ describe("TetsItemMods", function()
assert.are.equals(0, calcCount)
end)

it("shows custom modifier controls when affix crafting is hidden", function()
build.itemsTab:CreateDisplayItemFromRaw([[
Rarity: RARE
Test Item
Iron Ring
Implicits: 1
Adds 1 to 4 Physical Damage to Attacks
{crafted}+8 to Strength
]])

local controls = build.itemsTab.controls
assert.is_falsy(build.itemsTab.displayItem.crafted)
assert.is_falsy(controls.displayItemSectionAffix:IsShown())
assert.is_true(controls.displayItemSectionCustom:IsShown())
assert.is_true(controls.displayItemAddCustom:IsShown())
assert.is_true(controls.displayItemCustomModifierRemove1:IsShown())
end)

it("shows affix controls for items crafted in Path of Building", function()
build.itemsTab:CreateDisplayItemFromRaw([[
Rarity: RARE
New Item
Cobalt Jewel
Crafted: true
Prefix: None
Prefix: None
Suffix: None
Suffix: None
Quality: 0
LevelReq: 0
Implicits: 0
]])

local controls = build.itemsTab.controls
assert.is_true(controls.displayItemSectionAffix:IsShown())
assert.is_true(controls.displayItemAffix1:IsShown())
end)

it("sorts crafted modifier replacements without retaining the selected modifier", function()
local item = new("Item", [[
Rarity: RARE
Expand Down
6 changes: 4 additions & 2 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,9 @@ holding Shift will put it in the second.]])
end
return h
end})

self.controls.displayItemSectionAffix.shown = function()
return self.displayItem and self.displayItem.crafted
end
for i = 1, maxModCount do
local prev = self.controls["displayItemAffix"..(i-1)] or self.controls.displayItemSectionAffix
local drop, slider
Expand Down Expand Up @@ -980,7 +982,7 @@ holding Shift will put it in the second.]])

-- Section: Custom modifiers
-- if either Custom or Crucible mod buttons are shown, create the control for the list of mods
self.controls.displayItemSectionCustom = new("Control", {"TOPLEFT",self.controls.displayItemSectionAffix,"BOTTOMLEFT"}, {0, 0, 0, function()
self.controls.displayItemSectionCustom = new("Control", {"TOPLEFT",self.controls.displayItemSectionAffix,"BOTTOMLEFT",true}, {0, 0, 0, function()
return (self.controls.displayItemAddCustom:IsShown() or self.controls.displayItemAddCrucible:IsShown()) and 28 + self.displayItem.customCount * 22 or 0
end})
self.controls.displayItemAddCustom = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionCustom,"TOPLEFT"}, {0, 0, 120, 20}, "Add modifier...", function()
Expand Down
Loading