Skip to content
Merged
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
51 changes: 50 additions & 1 deletion spec/System/TestItemTools_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,53 @@ describe("TestItemTools", function()
assert.are.equals(0.5, item.rangeLineList[1].range)
assert.are.equals(0, item.baseModList:Sum("BASE", nil, "PowerChargesMax"))
end)
end)

it("uses the displayed item slot for anoint comparison tooltips", function()
if not common.classes.ItemsTab then
LoadModule("Classes/ItemsTab")
end

local function assertAnointUsesSlot(rawItem, expectedSlot)
local item = new("Item", rawItem)
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 = "Abasement" })

assert.are.equals(expectedSlot, overrides[1].repSlotName)
assert.are.equals(expectedSlot, overrides[2].repSlotName)
end

assertAnointUsesSlot([[
Rarity: Rare
Dire Thread
Plate Belt
Can be Anointed
]], "Belt")
assertAnointUsesSlot([[
Rarity: Rare
Spark Loop
Ruby Ring
Can be Anointed
]], "Ring 1")
end)
end)
7 changes: 4 additions & 3 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2292,7 +2292,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 @@ -2326,8 +2326,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:GetPrimarySlot()
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