Skip to content

Commit 4f97083

Browse files
authored
Fix Comparison Tooltip adding Time Lost Jewel mods to incorrect radiusNodes (#63)
* fix time-lost jewel mods being added when they shouldn't * wording * init flag * move flag to treeTab because it loads sooner
1 parent 6c4bfbb commit 4f97083

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

src/Classes/ItemsTab.lua

+3
Original file line numberDiff line numberDiff line change
@@ -3059,7 +3059,10 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
30593059
for _, compareSlot in pairs(compareSlots) do
30603060
if not main.slotOnlyTooltips or (slot and (slot.nodeId == compareSlot.nodeId or slot.slotName == compareSlot.slotName)) or not slot or slot == compareSlot then
30613061
local selItem = self.items[compareSlot.selItemId]
3062+
-- short term fix for Time-Lost jewel processing
3063+
self.build.treeTab.skipTimeLostJewelProcessing = true
30623064
local output = calcFunc({ repSlotName = compareSlot.slotName, repItem = item ~= selItem and item or nil})
3065+
self.build.treeTab.skipTimeLostJewelProcessing = false
30633066
local header
30643067
if item == selItem then
30653068
header = "^7Removing this item from "..compareSlot.label.." will give you:"

src/Classes/TreeTab.lua

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build)
3131
self.specList[1] = new("PassiveSpec", build, latestTreeVersion)
3232
self:SetActiveSpec(1)
3333
self:SetCompareSpec(1)
34+
self.skipTimeLostJewelProcessing = false
3435

3536
self.anchorControls = new("Control", nil, {0, 0, 0, 20})
3637

src/Modules/CalcSetup.lua

+18-15
Original file line numberDiff line numberDiff line change
@@ -142,23 +142,26 @@ local function setRadiusJewelStats(radiusJewel, radiusJewelStats)
142142
end
143143

144144
local function addStats(jewel, node, spec)
145-
-- reset node stats to base or override for attributes
146-
if spec.hashOverrides and spec.hashOverrides[node.id] then
147-
node.sd = copyTable(spec.hashOverrides[node.id].sd, true)
148-
else
149-
node.sd = copyTable(spec.tree.nodes[node.id].sd, true)
150-
end
145+
-- short term to avoid running the logic on AddItemTooltip
146+
if not spec.build.treeTab.skipTimeLostJewelProcessing then
147+
-- reset node stats to base or override for attributes
148+
if spec.hashOverrides and spec.hashOverrides[node.id] then
149+
node.sd = copyTable(spec.hashOverrides[node.id].sd, true)
150+
else
151+
node.sd = copyTable(spec.tree.nodes[node.id].sd, true)
152+
end
151153

152-
local radiusJewelStats = { }
153-
setRadiusJewelStats(jewel, radiusJewelStats)
154-
for _, stat in ipairs(radiusJewelStats) do
155-
-- the node and stat types match, add sd to node if it's not already there and it's an 'also grant' mod
156-
if not isValueInTable(node.sd, stat.sd) and ((node.type == "Notable" and stat.isNotable) or (node.type == "Normal" and not stat.isNotable))
157-
and stat.toAdd then
158-
t_insert(node.sd, stat.sd)
154+
local radiusJewelStats = { }
155+
setRadiusJewelStats(jewel, radiusJewelStats)
156+
for _, stat in ipairs(radiusJewelStats) do
157+
-- the node and stat types match, add sd to node if it's not already there and it's an 'also grant' mod
158+
if not isValueInTable(node.sd, stat.sd) and ((node.type == "Notable" and stat.isNotable) or (node.type == "Normal" and not stat.isNotable))
159+
and stat.toAdd then
160+
t_insert(node.sd, stat.sd)
161+
end
159162
end
163+
spec.tree:ProcessStats(node)
160164
end
161-
spec.tree:ProcessStats(node)
162165
return node.modList
163166
end
164167

@@ -169,7 +172,7 @@ local function addStatsFromJewelToNode(jewel, node, spec)
169172
-- if the Time-Lost jewel is socketed, add the stat
170173
if itemsTab.activeSocketList then
171174
for _, nodeId in pairs(itemsTab.activeSocketList) do
172-
local _, socketedJewel = itemsTab:GetSocketAndJewelForNodeID(nodeId)
175+
local socketIndex, socketedJewel = itemsTab:GetSocketAndJewelForNodeID(nodeId)
173176
if socketedJewel and socketedJewel.baseName:find("Time%-Lost") == 1 then
174177
return addStats(jewel, node, spec)
175178
end

0 commit comments

Comments
 (0)