Skip to content

Commit e7622d5

Browse files
mcagnionclaude
andcommitted
Fix stat comparison for radius jewels (timeless, Thread of Hope, etc.)
- Fix stat diff tooltip for removing equipped radius jewels: use jewelRadiusIndex instead of hardcoded radius, revert conquered nodes via removeNodes/addNodes override with hashOverrides support - Fix stat diff for removing Thread of Hope / Impossible Escape: remove nodes only reachable through the jewel and their transitive dependents Ported onto upstream PathOfBuildingCommunity#9744 sort-based compareSlot loop: override logic now lives inside getReplacedItemAndOutput() instead of the old inline for loop. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 521e8aa commit e7622d5

1 file changed

Lines changed: 49 additions & 1 deletion

File tree

src/Classes/ItemsTab.lua

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4021,7 +4021,55 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
40214021

40224022
local function getReplacedItemAndOutput(compareSlot)
40234023
local selItem = self.items[compareSlot.selItemId]
4024-
local output = calcFunc({ repSlotName = compareSlot.slotName, repItem = item ~= selItem and item or nil })
4024+
local override = { repSlotName = compareSlot.slotName, repItem = item ~= selItem and item or nil }
4025+
-- When removing a timeless jewel, also revert conquered nodes to originals
4026+
if compareSlot.nodeId and item == selItem and selItem
4027+
and selItem.jewelData and selItem.jewelData.conqueredBy then
4028+
override.removeNodes = { }
4029+
override.addNodes = { }
4030+
local socketNode = self.build.spec.nodes[compareSlot.nodeId]
4031+
local radiusIndex = selItem.jewelRadiusIndex
4032+
if socketNode and socketNode.nodesInRadius and radiusIndex and socketNode.nodesInRadius[radiusIndex] then
4033+
for nodeId in pairs(socketNode.nodesInRadius[radiusIndex]) do
4034+
local specNode = self.build.spec.nodes[nodeId]
4035+
local origNode = self.build.spec.hashOverrides[nodeId] or self.build.spec.tree.nodes[nodeId]
4036+
if specNode and origNode and specNode.conqueredBy
4037+
and self.build.spec.allocNodes[nodeId] then
4038+
override.removeNodes[specNode] = true
4039+
override.addNodes[origNode] = true
4040+
end
4041+
end
4042+
end
4043+
end
4044+
-- When removing an intuitiveLeapLike jewel, also remove nodes only reachable through it
4045+
if compareSlot.nodeId and item == selItem and selItem and selItem.jewelData
4046+
and (selItem.jewelData.intuitiveLeapLike or selItem.jewelData.impossibleEscapeKeystone) then
4047+
override.removeNodes = override.removeNodes or { }
4048+
local spec = self.build.spec
4049+
local nodesToRemove = spec:NodesInIntuitiveLeapLikeRadius(spec.nodes[compareSlot.nodeId])
4050+
for _, node in ipairs(nodesToRemove) do
4051+
if not node.connectedToStart then
4052+
override.removeNodes[node] = true
4053+
end
4054+
end
4055+
-- Also remove transitive dependents
4056+
local queue = { }
4057+
for node in pairs(override.removeNodes) do
4058+
t_insert(queue, node)
4059+
end
4060+
local i = 1
4061+
while i <= #queue do
4062+
local node = queue[i]
4063+
for _, dep in ipairs(node.depends or { }) do
4064+
if not override.removeNodes[dep] then
4065+
override.removeNodes[dep] = true
4066+
t_insert(queue, dep)
4067+
end
4068+
end
4069+
i = i + 1
4070+
end
4071+
end
4072+
local output = calcFunc(override)
40254073
return selItem, output
40264074
end
40274075
local function addCompareForSlot(compareSlot, selItem, output)

0 commit comments

Comments
 (0)