diff --git a/spec/System/TestItemTools_spec.lua b/spec/System/TestItemTools_spec.lua index ab7c6785e0..40224f2627 100644 --- a/spec/System/TestItemTools_spec.lua +++ b/spec/System/TestItemTools_spec.lua @@ -45,4 +45,42 @@ describe("TestItemTools", function() assert.are.equals(expected, result) end) end -end) \ No newline at end of file + + it("uses the displayed item slot for anoint comparison tooltips", function() + if not common.classes.ItemsTab then + LoadModule("Classes/ItemsTab") + end + local item = new("Item", [[ +Rarity: Rare +Dire Thread +Cord Belt +Can be Anointed +]]) + local overrides = { } + local fakeItemsTab = setmetatable({ + displayItem = item, + build = { + spec = { allocNodes = { } }, + calcsTab = { + GetMiscCalculator = function() + return function(override) + table.insert(overrides, override) + return { } + end + end, + }, + AddStatComparesToTooltip = function() + return 1 + end, + }, + }, common.classes.ItemsTab) + local tooltip = { + AddLine = function() end, + } + + fakeItemsTab:AppendAnointTooltip(tooltip, { id = 1, dn = "Acrimony" }) + + assert.are.equals("Belt", overrides[1].repSlotName) + assert.are.equals("Belt", overrides[2].repSlotName) + end) +end) diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index 3825af2d33..7504b71526 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -2405,7 +2405,7 @@ function ItemsTabClass:anointItem(node) return item end ----Appends tooltip information for anointing a new passive tree node onto the currently editing amulet +---Appends tooltip information for anointing a new passive tree node onto the currently editing item ---@param tooltip table @The tooltip to append into ---@param node table @The passive tree node that will be anointed, or nil to remove the current anoint. function ItemsTabClass:AppendAnointTooltip(tooltip, node, actionText) @@ -2439,8 +2439,9 @@ function ItemsTabClass:AppendAnointTooltip(tooltip, node, actionText) header = "^7"..actionText.." nothing will give you: " end local calcFunc = self.build.calcsTab:GetMiscCalculator() - local outputBase = calcFunc({ repSlotName = "Amulet", repItem = self.displayItem }) - local outputNew = calcFunc({ repSlotName = "Amulet", repItem = self:anointItem(node) }) + local repSlotName = self.displayItem.base and self.displayItem.base.type or "Amulet" + local outputBase = calcFunc({ repSlotName = repSlotName, repItem = self.displayItem }) + local outputNew = calcFunc({ repSlotName = repSlotName, repItem = self:anointItem(node) }) local numChanges = self.build:AddStatComparesToTooltip(tooltip, outputBase, outputNew, header) if node and numChanges == 0 then tooltip:AddLine(14, "^7"..actionText.." "..node.dn.." changes nothing.")