diff --git a/spec/System/TestItemDBControl_spec.lua b/spec/System/TestItemDBControl_spec.lua index 023510bc33..12bf45d294 100644 --- a/spec/System/TestItemDBControl_spec.lua +++ b/spec/System/TestItemDBControl_spec.lua @@ -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) diff --git a/src/Classes/ItemDBControl.lua b/src/Classes/ItemDBControl.lua index c0612ef7c7..1607f350a8 100644 --- a/src/Classes/ItemDBControl.lua +++ b/src/Classes/ItemDBControl.lua @@ -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 diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index e370df57fe..15705a2f85 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -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) @@ -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] diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index 55b3425d02..4a1b846db3 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -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 @@ -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