From b1df4f434d990a08224172ede905088f6baf2597 Mon Sep 17 00:00:00 2001 From: Peechey <92683202+Peechey@users.noreply.github.com> Date: Sat, 18 Jan 2025 21:51:31 -0600 Subject: [PATCH 1/4] fix time-lost jewel mods being added when they shouldn't --- src/Modules/CalcSetup.lua | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index b1425913..790544e0 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -142,23 +142,26 @@ local function setRadiusJewelStats(radiusJewel, radiusJewelStats) end local function addStats(jewel, node, spec) - -- reset node stats to base or override for attributes - if spec.hashOverrides and spec.hashOverrides[node.id] then - node.sd = copyTable(spec.hashOverrides[node.id].sd, true) - else - node.sd = copyTable(spec.tree.nodes[node.id].sd, true) - end + -- short term to avoid running the logic on AddItemTooltip + if not spec.build.itemsTab.skipTimeLostJewelProcessed then + -- reset node stats to base or override for attributes + if spec.hashOverrides and spec.hashOverrides[node.id] then + node.sd = copyTable(spec.hashOverrides[node.id].sd, true) + else + node.sd = copyTable(spec.tree.nodes[node.id].sd, true) + end - local radiusJewelStats = { } - setRadiusJewelStats(jewel, radiusJewelStats) - for _, stat in ipairs(radiusJewelStats) do - -- the node and stat types match, add sd to node if it's not already there and it's an 'also grant' mod - if not isValueInTable(node.sd, stat.sd) and ((node.type == "Notable" and stat.isNotable) or (node.type == "Normal" and not stat.isNotable)) - and stat.toAdd then - t_insert(node.sd, stat.sd) + local radiusJewelStats = { } + setRadiusJewelStats(jewel, radiusJewelStats) + for _, stat in ipairs(radiusJewelStats) do + -- the node and stat types match, add sd to node if it's not already there and it's an 'also grant' mod + if not isValueInTable(node.sd, stat.sd) and ((node.type == "Notable" and stat.isNotable) or (node.type == "Normal" and not stat.isNotable)) + and stat.toAdd then + t_insert(node.sd, stat.sd) + end end + spec.tree:ProcessStats(node) end - spec.tree:ProcessStats(node) return node.modList end @@ -169,7 +172,7 @@ local function addStatsFromJewelToNode(jewel, node, spec) -- if the Time-Lost jewel is socketed, add the stat if itemsTab.activeSocketList then for _, nodeId in pairs(itemsTab.activeSocketList) do - local _, socketedJewel = itemsTab:GetSocketAndJewelForNodeID(nodeId) + local socketIndex, socketedJewel = itemsTab:GetSocketAndJewelForNodeID(nodeId) if socketedJewel and socketedJewel.baseName:find("Time%-Lost") == 1 then return addStats(jewel, node, spec) end From 3e537481fa17bb9a27978fa0891c6d60148dbe88 Mon Sep 17 00:00:00 2001 From: Peechey <92683202+Peechey@users.noreply.github.com> Date: Sat, 18 Jan 2025 21:52:51 -0600 Subject: [PATCH 2/4] wording --- src/Classes/ItemsTab.lua | 3 +++ src/Modules/CalcSetup.lua | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index 3eb4af4e..e550a714 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -3059,7 +3059,10 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode) for _, compareSlot in pairs(compareSlots) do if not main.slotOnlyTooltips or (slot and (slot.nodeId == compareSlot.nodeId or slot.slotName == compareSlot.slotName)) or not slot or slot == compareSlot then local selItem = self.items[compareSlot.selItemId] + -- short term fix for Time-Lost jewel processing + self.skipTimeLostJewelProcessing = true local output = calcFunc({ repSlotName = compareSlot.slotName, repItem = item ~= selItem and item or nil}) + self.skipTimeLostJewelProcessed = false local header if item == selItem then header = "^7Removing this item from "..compareSlot.label.." will give you:" diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index 790544e0..696068da 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -143,7 +143,7 @@ end local function addStats(jewel, node, spec) -- short term to avoid running the logic on AddItemTooltip - if not spec.build.itemsTab.skipTimeLostJewelProcessed then + if not spec.build.itemsTab.skipTimeLostJewelProcessing then -- reset node stats to base or override for attributes if spec.hashOverrides and spec.hashOverrides[node.id] then node.sd = copyTable(spec.hashOverrides[node.id].sd, true) From 8a8ddc89a3aa02517f1e7d95c5d12a406ece256a Mon Sep 17 00:00:00 2001 From: Peechey <92683202+Peechey@users.noreply.github.com> Date: Sat, 18 Jan 2025 22:10:13 -0600 Subject: [PATCH 3/4] init flag --- src/Classes/ItemsTab.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index e550a714..a4b50f96 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -96,6 +96,7 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro self.orderedSlots = { } self.slotOrder = { } self.initSockets = true + self.skipTimeLostJewelProcessing = false self.slotAnchor = new("Control", {"TOPLEFT",self,"TOPLEFT"}, {96, 76, 310, 0}) local prevSlot = self.slotAnchor local function addSlot(slot) From 884c1b9294f275dbee56a0fee97bd29672ff638f Mon Sep 17 00:00:00 2001 From: Peechey <92683202+Peechey@users.noreply.github.com> Date: Sat, 18 Jan 2025 22:30:57 -0600 Subject: [PATCH 4/4] move flag to treeTab because it loads sooner --- src/Classes/ItemsTab.lua | 5 ++--- src/Classes/TreeTab.lua | 1 + src/Modules/CalcSetup.lua | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index a4b50f96..3ea7e433 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -96,7 +96,6 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro self.orderedSlots = { } self.slotOrder = { } self.initSockets = true - self.skipTimeLostJewelProcessing = false self.slotAnchor = new("Control", {"TOPLEFT",self,"TOPLEFT"}, {96, 76, 310, 0}) local prevSlot = self.slotAnchor local function addSlot(slot) @@ -3061,9 +3060,9 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode) if not main.slotOnlyTooltips or (slot and (slot.nodeId == compareSlot.nodeId or slot.slotName == compareSlot.slotName)) or not slot or slot == compareSlot then local selItem = self.items[compareSlot.selItemId] -- short term fix for Time-Lost jewel processing - self.skipTimeLostJewelProcessing = true + self.build.treeTab.skipTimeLostJewelProcessing = true local output = calcFunc({ repSlotName = compareSlot.slotName, repItem = item ~= selItem and item or nil}) - self.skipTimeLostJewelProcessed = false + self.build.treeTab.skipTimeLostJewelProcessing = false local header if item == selItem then header = "^7Removing this item from "..compareSlot.label.." will give you:" diff --git a/src/Classes/TreeTab.lua b/src/Classes/TreeTab.lua index 05eed819..e1996601 100644 --- a/src/Classes/TreeTab.lua +++ b/src/Classes/TreeTab.lua @@ -31,6 +31,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) self.specList[1] = new("PassiveSpec", build, latestTreeVersion) self:SetActiveSpec(1) self:SetCompareSpec(1) + self.skipTimeLostJewelProcessing = false self.anchorControls = new("Control", nil, {0, 0, 0, 20}) diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index 696068da..c0843d18 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -143,7 +143,7 @@ end local function addStats(jewel, node, spec) -- short term to avoid running the logic on AddItemTooltip - if not spec.build.itemsTab.skipTimeLostJewelProcessing then + if not spec.build.treeTab.skipTimeLostJewelProcessing then -- reset node stats to base or override for attributes if spec.hashOverrides and spec.hashOverrides[node.id] then node.sd = copyTable(spec.hashOverrides[node.id].sd, true)