Skip to content
Open
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
23 changes: 23 additions & 0 deletions spec/System/TestItemDBControl_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,27 @@ describe("ItemDBControl", function()
assert.are.equal(item.raw, itemsTab.displayRaw)
assert.is_true(itemsTab.displayIsUnique)
end)

it("appends typed Wickerman filters after Grafts", function()
local item = new("Item"):Item("")
item.base = { }
for _, dbType in ipairs({ "RARE", "UNIQUE" }) do
local control = new("ItemDBControl"):ItemDBControl(nil, { 0, 0, 100, 100 }, { }, { list = { } }, dbType)
item.type = "Graft"
control.controls.slot:SelByValue("Graft 1")
assert.are.equal("Graft 1", control.slotList[control.controls.slot.selIndex])
assert.is_true(control:DoesItemMatchFilters(item))
control.controls.slot:SelByValue("Graft 2")
assert.are.equal("Graft 2", control.slotList[control.controls.slot.selIndex])
local lastIndex = control.controls.slot.selIndex
for _, slotName in ipairs({ "Wickerman Head", "Wickerman Torso", "Wickerman Upper Limb", "Wickerman Lower Limb" }) do
control.controls.slot:SelByValue(slotName)
assert.are.equal(lastIndex + 1, control.controls.slot.selIndex)
assert.is_false(control:DoesItemMatchFilters(item))
item.type = slotName
assert.is_true(control:DoesItemMatchFilters(item))
lastIndex = control.controls.slot.selIndex
end
end
end)
end)
5 changes: 4 additions & 1 deletion src/Classes/ItemDBControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ function ItemDBClass:ItemDBControl(anchor, rect, itemsTab, db, dbType)
self.leaguesAndTypesLoaded = false
self.leagueList = { "Any league", "No league" }
self.typeList = { "Any type", "Armour", "Jewellery", "One Handed Melee", "Two Handed Melee" }
self.slotList = { "Any slot", "Weapon 1", "Weapon 2", "Helmet", "Body Armour", "Gloves", "Boots", "Amulet", "Ring", "Belt", "Jewel", "Flask", "Graft 1", "Graft 2" }
self.slotList = { "Any slot", "Weapon 1", "Weapon 2", "Helmet", "Body Armour", "Gloves", "Boots", "Amulet", "Ring", "Belt", "Jewel", "Flask", "Graft 1", "Graft 2",
-- Wickerman (3.30)
"Wickerman Head", "Wickerman Torso", "Wickerman Upper Limb", "Wickerman Lower Limb"
}
local baseY = dbType == "RARE" and -22 or -62
self.controls.slot = new("DropDownControl"):DropDownControl({"BOTTOMLEFT",self,"TOPLEFT"}, {0, baseY, 179, 18}, self.slotList, function(index, value)
self.listBuildFlag = true
Expand Down
17 changes: 16 additions & 1 deletion src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,20 @@ function ItemsTabClass:ItemsTab(build)
end
end

-- Wickerman (3.30): keep the equipment controls together after the existing slots.
self.controls.wickermanHeader = new("LabelControl"):LabelControl({"TOPLEFT",prevSlot,"BOTTOMLEFT"}, {0, 8, 0, 16}, "^7Wickerman:")
self.controls.wickermanHeader.shown = function()
return self.build.spec.treeVersion:find("3_30")
end
prevSlot = self.controls.wickermanHeader
for _, slotName in ipairs({ "Wickerman Head", "Wickerman Torso", "Wickerman Upper Limb", "Wickerman Lower Limb" }) do
local slot = new("ItemSlotControl"):ItemSlotControl({"TOPLEFT",prevSlot,"BOTTOMLEFT"}, 0, 2, self, slotName, (slotName:gsub("^Wickerman ", "")))
slot.shown = self.controls.wickermanHeader.shown
addSlot(slot)
end

-- Passive tree dropdown controls
self.controls.specSelect = new("DropDownControl"):DropDownControl({"TOPLEFT",prevSlot,"BOTTOMLEFT"}, {0, 8, 216, 20}, nil, function(index, value)
self.controls.specSelect = new("DropDownControl"):DropDownControl({"TOPLEFT",prevSlot,"BOTTOMLEFT",true}, {0, 8, 216, 20}, nil, function(index, value)
if self.build.treeTab.specList[index] then
self.build.modFlag = true
self.build.treeTab:SetActiveSpec(index)
Expand Down Expand Up @@ -1724,6 +1736,9 @@ function ItemsTabClass:UpdateSockets()

-- Update the state of the active socket controls
self.lastSlot = self.slots[baseSlots[#baseSlots]]
if self.controls.wickermanHeader and self.controls.wickermanHeader:IsShown() then
self.lastSlot = self.slots["Wickerman Lower Limb"]
end
for index, nodeId in ipairs(activeSocketList) do
self.sockets[nodeId].label = "Socket #"..index
self.lastSlot = self.sockets[nodeId]
Expand Down
5 changes: 4 additions & 1 deletion src/Modules/CalcSetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,8 @@ function calcs.initEnv(build, mode, override, specEnv)
if not build.spec.treeVersion:find("3_27") then
goto continue
end
elseif slotName:match("^Wickerman ") and not env.spec.treeVersion:find("3_30") then
goto continue
end
-- ignore item in Ring 3 if The Unseen Hand is not allocated
if slotName == "Ring 3" and not env.initialNodeModDB:Flag(nil, "AdditionalRingSlot") then
Expand Down Expand Up @@ -1288,7 +1290,8 @@ function calcs.initEnv(build, mode, override, specEnv)
if item.classRestriction then
env.itemModDB.conditions[item.title:gsub(" ", "")] = item.classRestriction
end
if item.type ~= "Jewel" and item.type ~= "Flask" and item.type ~= "Tincture" and item.type ~= "Graft" then
if item.type ~= "Jewel" and item.type ~= "Flask" and item.type ~= "Tincture" and item.type ~= "Graft"
and item.type ~= "Wickerman Head" and item.type ~= "Wickerman Torso" and item.type ~= "Wickerman Upper Limb" and item.type ~= "Wickerman Lower Limb" then
-- Update item counts
local key
if item.rarity == "UNIQUE" or item.rarity == "RELIC" then
Expand Down
Loading