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
40 changes: 39 additions & 1 deletion spec/System/TestItemTools_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,42 @@ describe("TestItemTools", function()
assert.are.equals(expected, result)
end)
end
end)

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)
7 changes: 4 additions & 3 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.")
Expand Down
Loading