Skip to content

Commit e36171c

Browse files
committed
Fix Cord Belt anoint comparison slot
1 parent 63d42a8 commit e36171c

2 files changed

Lines changed: 43 additions & 4 deletions

File tree

spec/System/TestItemTools_spec.lua

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,42 @@ describe("TestItemTools", function()
4545
assert.are.equals(expected, result)
4646
end)
4747
end
48-
end)
48+
49+
it("uses the displayed item slot for anoint comparison tooltips", function()
50+
if not common.classes.ItemsTab then
51+
LoadModule("Classes/ItemsTab")
52+
end
53+
local item = new("Item", [[
54+
Rarity: Rare
55+
Dire Thread
56+
Cord Belt
57+
Can be Anointed
58+
]])
59+
local overrides = { }
60+
local fakeItemsTab = setmetatable({
61+
displayItem = item,
62+
build = {
63+
spec = { allocNodes = { } },
64+
calcsTab = {
65+
GetMiscCalculator = function()
66+
return function(override)
67+
table.insert(overrides, override)
68+
return { }
69+
end
70+
end,
71+
},
72+
AddStatComparesToTooltip = function()
73+
return 1
74+
end,
75+
},
76+
}, common.classes.ItemsTab)
77+
local tooltip = {
78+
AddLine = function() end,
79+
}
80+
81+
fakeItemsTab:AppendAnointTooltip(tooltip, { id = 1, dn = "Acrimony" })
82+
83+
assert.are.equals("Belt", overrides[1].repSlotName)
84+
assert.are.equals("Belt", overrides[2].repSlotName)
85+
end)
86+
end)

src/Classes/ItemsTab.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2405,7 +2405,7 @@ function ItemsTabClass:anointItem(node)
24052405
return item
24062406
end
24072407

2408-
---Appends tooltip information for anointing a new passive tree node onto the currently editing amulet
2408+
---Appends tooltip information for anointing a new passive tree node onto the currently editing item
24092409
---@param tooltip table @The tooltip to append into
24102410
---@param node table @The passive tree node that will be anointed, or nil to remove the current anoint.
24112411
function ItemsTabClass:AppendAnointTooltip(tooltip, node, actionText)
@@ -2439,8 +2439,9 @@ function ItemsTabClass:AppendAnointTooltip(tooltip, node, actionText)
24392439
header = "^7"..actionText.." nothing will give you: "
24402440
end
24412441
local calcFunc = self.build.calcsTab:GetMiscCalculator()
2442-
local outputBase = calcFunc({ repSlotName = "Amulet", repItem = self.displayItem })
2443-
local outputNew = calcFunc({ repSlotName = "Amulet", repItem = self:anointItem(node) })
2442+
local repSlotName = self.displayItem.base and self.displayItem.base.type or "Amulet"
2443+
local outputBase = calcFunc({ repSlotName = repSlotName, repItem = self.displayItem })
2444+
local outputNew = calcFunc({ repSlotName = repSlotName, repItem = self:anointItem(node) })
24442445
local numChanges = self.build:AddStatComparesToTooltip(tooltip, outputBase, outputNew, header)
24452446
if node and numChanges == 0 then
24462447
tooltip:AddLine(14, "^7"..actionText.." "..node.dn.." changes nothing.")

0 commit comments

Comments
 (0)