From 2b390d43c1ad75b24bc7cd75457f2dea66153523 Mon Sep 17 00:00:00 2001 From: xoxorwr Date: Sat, 29 Aug 2026 20:19:04 +0000 Subject: [PATCH 1/2] Apply changes from https://github.com/PathOfBuildingCommunity/PathOfBuilding/pull/10083 --- spec/System/TestItemParse_spec.lua | 12 ++++++ spec/System/TestItemParse_spec.lua.rej | 13 ++++++ src/Classes/Item.lua | 2 +- src/Classes/Item.lua.rej | 19 +++++++++ src/Classes/ItemsTab.lua | 21 ++++++++++ src/Classes/ItemsTab.lua.rej | 35 ++++++++++++++++ src/Classes/Tooltip.lua.rej | 57 ++++++++++++++++++++++++++ src/Data/Global.lua | 1 + src/Modules/ItemTools.lua.rej | 10 +++++ 9 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 spec/System/TestItemParse_spec.lua.rej create mode 100644 src/Classes/Item.lua.rej create mode 100644 src/Classes/ItemsTab.lua.rej create mode 100644 src/Classes/Tooltip.lua.rej create mode 100644 src/Modules/ItemTools.lua.rej diff --git a/spec/System/TestItemParse_spec.lua b/spec/System/TestItemParse_spec.lua index 0cb526a9ad..eec927c38b 100644 --- a/spec/System/TestItemParse_spec.lua +++ b/spec/System/TestItemParse_spec.lua @@ -1296,6 +1296,18 @@ describe("TestAdvancedItemParse #item", function() assert.are.equals(221, chaosDamageInc()) end) + it("does not apply disabled modifier magnitude", function() + local item = new("Item", [[ + Rarity: UNIQUE + Magnitude Test + Plate Vest + Implicits: 1 + {range:0.5}+(10-20) to maximum Life + {disabled}100% increased Implicit Modifier magnitudes + ]]) + assert.are.equals(1, item.implicitModLines[1].valueScalar) + end) + it("scales properly using old Eyes of the Greatwolf line", function() build.itemsTab:CreateDisplayItemFromRaw([[ Rarity: UNIQUE diff --git a/spec/System/TestItemParse_spec.lua.rej b/spec/System/TestItemParse_spec.lua.rej new file mode 100644 index 0000000000..2370cd802f --- /dev/null +++ b/spec/System/TestItemParse_spec.lua.rej @@ -0,0 +1,13 @@ +diff a/spec/System/TestItemParse_spec.lua b/spec/System/TestItemParse_spec.lua (rejected hunks) +@@ -341,6 +341,11 @@ describe("TestItemParse", function() + assert.are.same({ "life", "physical_damage" }, item.explicitModLines[1].modTags) + end) + ++ it("ignores disabled modifiers in item conditions", function() ++ local item = new("Item", raw("{disabled}+100 to maximum Life")) ++ assert.is_false(item:FindModifierSubstring("life", "body armour")) ++ end) ++ + it("variant", function() + local item = new("Item", raw([[ + Selected Variant: 2 diff --git a/src/Classes/Item.lua b/src/Classes/Item.lua index eb7c95794c..15f276dc2f 100644 --- a/src/Classes/Item.lua +++ b/src/Classes/Item.lua @@ -278,7 +278,7 @@ function ItemClass:FindModifierSubstring(substring, itemSlotName) else currentVariant = true end - if currentVariant then + if not v.disabled and currentVariant then if v.line:lower():find(substring) and not v.line:lower():find(substring .. " modifier") then local excluded = false if data.itemTagSpecialExclusionPattern[substring] and data.itemTagSpecialExclusionPattern[substring][itemSlotName] then diff --git a/src/Classes/Item.lua.rej b/src/Classes/Item.lua.rej new file mode 100644 index 0000000000..11da0c1d89 --- /dev/null +++ b/src/Classes/Item.lua.rej @@ -0,0 +1,19 @@ +diff a/src/Classes/Item.lua b/src/Classes/Item.lua (rejected hunks) +@@ -950,7 +950,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) + modList, extra = modLib.parseMod(rangedLine) + end + end +- local lineLower = line:lower() ++ local lineLower = modLine.disabled and "" or line:lower() + -- \d+% increased/reduced explicit/implicit/ *tags* modifier magnitudes + local modMagnitudePattern = { "(%d+)%% ([ir][ne][cd][ru][ec][ae][sd]e?d?) ?([%a%s]*) modifier magnitudes", + -- \d+% increased/reduced effect of suffixes/prefixes +@@ -1019,7 +1019,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) + enchantment = "enchant", + } + for _, pattern in ipairs(modMagnitudePattern) do +- if rangedLine:lower():find(pattern) then ++ if not modLine.disabled and rangedLine:lower():find(pattern) then + local rangedLine = itemLib.applyRange(line, modLine.range or main.defaultItemAffixQuality or 1, catalystScalar, modLine.corruptedRange) + local amount, increaseOrDecrease, modTagsString = rangedLine:lower():match(pattern) + local multiplier diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index 81b5fad9bd..5b6469873b 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -1396,6 +1396,27 @@ function ItemsTabClass:Draw(viewPort, inputEvents) if self.displayItem then local x, y = self.controls.displayItemTooltipAnchor:GetPos() self.displayItemTooltip:Draw(x, y, nil, nil, viewPort) + + -- Toggle mods + local cursorX, cursorY = GetCursorPos() + for _, line in ipairs(self.displayItemTooltip.lines) do + if line.modLine and line.bounds then + local b = line.bounds + if cursorX >= b.x and cursorX <= b.x + b.width and cursorY >= b.y and cursorY <= b.y + b.height then + SetDrawColor(1, 1, 1, 0.15) + DrawImage(nil, b.x, b.y, b.width, b.height) + SetDrawColor(1, 1, 1) + + for id, event in ipairs(inputEvents) do + if event.type == "KeyDown" and event.key:match("BUTTON") then + inputEvents[id] = nil + self:ToggleDisplayItemModLine(line.modLine) + break + end + end + end + end + end end self:UpdateSockets() diff --git a/src/Classes/ItemsTab.lua.rej b/src/Classes/ItemsTab.lua.rej new file mode 100644 index 0000000000..f62ab07ac1 --- /dev/null +++ b/src/Classes/ItemsTab.lua.rej @@ -0,0 +1,35 @@ +diff a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua (rejected hunks) +@@ -1869,6 +1890,21 @@ function ItemsTabClass:UpdateDisplayItemTooltip() + self.displayItemTooltip.center = true + end + ++function ItemsTabClass:ToggleDisplayItemModLine(modLine) ++ if not self.displayItem or not modLine then ++ return ++ end ++ modLine.disabled = not modLine.disabled ++ self.displayItem:BuildAndParseRaw() ++ self:UpdateDisplayItemTooltip() ++ self:UpdateDisplayItemRangeLines() ++ self:UpdateCustomControls() ++ if self.displayItem.crafted then ++ self:UpdateAffixControls() ++ end ++ self.build.buildFlag = true ++end ++ + function ItemsTabClass:UpdateSocketControls() + local sockets = self.displayItem.sockets + for i = 1, #sockets - self.displayItem.abyssalSocketCount do +@@ -4324,7 +4360,10 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth) + if modList[1] then + for _, modLine in ipairs(modList) do + if item:CheckModLineVariant(modLine) then +- tooltip:AddLine(fontSizeBig, itemLib.formatModLine(modLine, dbMode), "FONTIN SC") ++ local formatted = itemLib.formatModLine(modLine, dbMode) ++ if formatted then ++ tooltip:AddLine(fontSizeBig, formatted, "FONTIN SC", modLine) ++ end + end + end + tooltip:AddSeparator(10) diff --git a/src/Classes/Tooltip.lua.rej b/src/Classes/Tooltip.lua.rej new file mode 100644 index 0000000000..ba8ebfdcf9 --- /dev/null +++ b/src/Classes/Tooltip.lua.rej @@ -0,0 +1,57 @@ +diff a/src/Classes/Tooltip.lua b/src/Classes/Tooltip.lua (rejected hunks) +@@ -84,7 +84,7 @@ function TooltipClass:CheckForUpdate(...) + end + end + +-function TooltipClass:AddLine(size, text, font) ++function TooltipClass:AddLine(size, text, font, modLine) + if text then + local fontToUse + if main.showFlavourText then +@@ -100,10 +100,10 @@ function TooltipClass:AddLine(size, text, font) + end + if self.maxWidth then + for _, wrappedLine in ipairs(main:WrapString(line, size, self.maxWidth - H_PAD)) do +- t_insert(self.lines, { size = size, text = wrappedLine, block = #self.blocks, font = fontToUse, center = self.center }) ++ t_insert(self.lines, { size = size, text = wrappedLine, block = #self.blocks, font = fontToUse, center = self.center, modLine = modLine }) + end + else +- t_insert(self.lines, { size = size, text = line, block = #self.blocks, font = fontToUse, center = self.center }) ++ t_insert(self.lines, { size = size, text = line, block = #self.blocks, font = fontToUse, center = self.center, modLine = modLine }) + end + end + end +@@ -294,7 +294,12 @@ function TooltipClass:CalculateColumns(ttY, ttX, ttH, ttW, viewPort) + local lineX = lineCentered and (x + ttW / 2) or (x + (H_PAD / 2)) + local lineAlign = lineCentered and "CENTER_X" or "LEFT" + +- t_insert(drawStack, {lineX, y, lineAlign, data.size, font, data.text}) ++ local stackEntry = {lineX, y, lineAlign, data.size, font, data.text} ++ if data.modLine and data.modLine.disabled then ++ stackEntry.strikethrough = true ++ end ++ t_insert(drawStack, stackEntry) ++ data.bounds = { x = x + (H_PAD / 2), y = y, width = ttW - H_PAD, height = data.size + 2 } + y = y + data.size + 2 + + -- track max width for extra columns +@@ -595,6 +600,19 @@ function TooltipClass:Draw(x, y, w, h, viewPort) + end + else + DrawString(unpack(line)) ++ if line.strikethrough then ++ local textX = line[1] ++ local textY = line[2] ++ local align = line[3] ++ local size = line[4] ++ local font = line[5] ++ local text = line[6] ++ local textW = DrawStringWidth(size, font, text) ++ local strikeX = align == "CENTER_X" and (textX - textW / 2) or textX ++ local strikeY = textY + size / 2 ++ SetDrawColor(0.75, 0.75, 0.75, 0.35) ++ DrawImage(nil, strikeX, strikeY, textW, 1.0) ++ end + end + end + diff --git a/src/Data/Global.lua b/src/Data/Global.lua index c97368fede..da43f115aa 100644 --- a/src/Data/Global.lua +++ b/src/Data/Global.lua @@ -19,6 +19,7 @@ colorCodes = { CUSTOM = "^x5CF0BB", SOURCE = "^x88FFFF", UNSUPPORTED = "^xF05050", + DISABLED = "^x7F7F7F", WARNING = "^xFF9922", TIP = "^x80A080", FIRE = "^xB97123", diff --git a/src/Modules/ItemTools.lua.rej b/src/Modules/ItemTools.lua.rej new file mode 100644 index 0000000000..1ff4a2c6db --- /dev/null +++ b/src/Modules/ItemTools.lua.rej @@ -0,0 +1,10 @@ +diff a/src/Modules/ItemTools.lua b/src/Modules/ItemTools.lua (rejected hunks) +@@ -355,7 +355,7 @@ function itemLib.formatModLine(modLine, dbMode) + return + end + if modLine.disabled then +- return "^x7F7F7F" .. line ++ return colorCodes.DISABLED .. line + end + local colorCode + if modLine.extra then From 14281d138fd4df11fa2b36264297a1dfc4e921ef Mon Sep 17 00:00:00 2001 From: LocalIdentity Date: Sun, 30 Aug 2026 08:58:33 +1000 Subject: [PATCH 2/2] Fix port --- spec/System/TestItemMods_spec.lua | 64 ++++++++++++++++++++++++++ spec/System/TestItemParse_spec.lua | 9 +++- spec/System/TestItemParse_spec.lua.rej | 13 ------ src/Classes/Item.lua | 33 +++++++++++-- src/Classes/Item.lua.rej | 19 -------- src/Classes/ItemsTab.lua | 17 ++++++- src/Classes/ItemsTab.lua.rej | 35 -------------- src/Classes/Tooltip.lua | 32 +++++++++++-- src/Classes/Tooltip.lua.rej | 57 ----------------------- src/Modules/ItemTools.lua | 5 +- src/Modules/ItemTools.lua.rej | 10 ---- 11 files changed, 147 insertions(+), 147 deletions(-) delete mode 100644 spec/System/TestItemParse_spec.lua.rej delete mode 100644 src/Classes/Item.lua.rej delete mode 100644 src/Classes/ItemsTab.lua.rej delete mode 100644 src/Classes/Tooltip.lua.rej delete mode 100644 src/Modules/ItemTools.lua.rej diff --git a/spec/System/TestItemMods_spec.lua b/spec/System/TestItemMods_spec.lua index 7137e28264..a2797f2e73 100644 --- a/spec/System/TestItemMods_spec.lua +++ b/spec/System/TestItemMods_spec.lua @@ -40,6 +40,70 @@ describe("TetsItemMods", function() assert.are.equals(2, legacyLines) end) + it("toggles modifiers from the display item tooltip", function() + build.itemsTab:CreateDisplayItemFromRaw([[ + Rarity: Rare + Toggle Test + Ring + Implicits: 0 + +100 to maximum Life + ]]) + local item = build.itemsTab.displayItem + + assert.are.equals(100, item.baseModList:Sum("BASE", nil, "Life")) + build.itemsTab:ToggleDisplayItemModLine(item.explicitModLines[1]) + + item = build.itemsTab.displayItem + assert.is_true(item.explicitModLines[1].disabled) + assert.are.equals(0, item.baseModList:Sum("BASE", nil, "Life")) + assert.are.equals(colorCodes.DISABLED.."+100 to maximum Life", itemLib.formatModLine(item.explicitModLines[1])) + local tooltipModLine + for _, line in ipairs(build.itemsTab.displayItemTooltip.lines) do + if line.text and line.text:find("+100 to maximum Life", 1, true) then + tooltipModLine = line.modLine + break + end + end + assert.are.equals(item.explicitModLines[1], tooltipModLine) + + build.itemsTab:ToggleDisplayItemModLine(item.explicitModLines[1]) + assert.is_nil(build.itemsTab.displayItem.explicitModLines[1].disabled) + assert.are.equals(100, build.itemsTab.displayItem.baseModList:Sum("BASE", nil, "Life")) + end) + + it("preserves disabled rune modifiers when rebuilding an item", function() + build.itemsTab:CreateDisplayItemFromRaw([[ + Test Wand + Runic Fork + Sockets: S + Rune: Perfect Storm Rune + LevelReq: 1 + Implicits: 1 + {enchant}{rune}Gain 12% of Damage as Extra Lightning Damage + 200% increased effect of Socketed Runes + ]]) + local item = build.itemsTab.displayItem + local runeModLine + for _, modLine in ipairs(item.runeModLines) do + if modLine.line == "Gain 12% of Damage as Extra Lightning Damage" then + runeModLine = modLine + break + end + end + assert.is_not_nil(runeModLine) + assert.are.equals(3, runeModLine.displayValueScalar) + + build.itemsTab:ToggleDisplayItemModLine(runeModLine) + + for _, modLine in ipairs(build.itemsTab.displayItem.runeModLines) do + if modLine.line == runeModLine.line then + assert.is_true(modLine.disabled) + return + end + end + assert(false, "Disabled rune modifier not found after rebuilding item") + end) + it("shows a fallback tooltip when an item's base is no longer supported", function() local item = new("Item"):Item([[ Rarity: Unique diff --git a/spec/System/TestItemParse_spec.lua b/spec/System/TestItemParse_spec.lua index eec927c38b..37f90839c6 100644 --- a/spec/System/TestItemParse_spec.lua +++ b/spec/System/TestItemParse_spec.lua @@ -375,6 +375,11 @@ describe("TestItemParse", function() assert.are.equals("~price 1 chaos", item.note) end) + it("ignores disabled modifiers in item conditions", function() + local item = new("Item"):Item(raw("{disabled}+100 to maximum Life")) + assert.is_false(item:FindModifierSubstring("life", "body armour")) + end) + it("Rune level requirements", function() local item = new("Item"):Item([[ Test Wand @@ -1297,10 +1302,10 @@ describe("TestAdvancedItemParse #item", function() end) it("does not apply disabled modifier magnitude", function() - local item = new("Item", [[ + local item = new("Item"):Item([[ Rarity: UNIQUE Magnitude Test - Plate Vest + Arcane Raiment Implicits: 1 {range:0.5}+(10-20) to maximum Life {disabled}100% increased Implicit Modifier magnitudes diff --git a/spec/System/TestItemParse_spec.lua.rej b/spec/System/TestItemParse_spec.lua.rej deleted file mode 100644 index 2370cd802f..0000000000 --- a/spec/System/TestItemParse_spec.lua.rej +++ /dev/null @@ -1,13 +0,0 @@ -diff a/spec/System/TestItemParse_spec.lua b/spec/System/TestItemParse_spec.lua (rejected hunks) -@@ -341,6 +341,11 @@ describe("TestItemParse", function() - assert.are.same({ "life", "physical_damage" }, item.explicitModLines[1].modTags) - end) - -+ it("ignores disabled modifiers in item conditions", function() -+ local item = new("Item", raw("{disabled}+100 to maximum Life")) -+ assert.is_false(item:FindModifierSubstring("life", "body armour")) -+ end) -+ - it("variant", function() - local item = new("Item", raw([[ - Selected Variant: 2 diff --git a/src/Classes/Item.lua b/src/Classes/Item.lua index 15f276dc2f..54808bb8a7 100644 --- a/src/Classes/Item.lua +++ b/src/Classes/Item.lua @@ -76,6 +76,7 @@ end local lineFlags = { ["crafted"] = true, ["custom"] = true, + ["disabled"] = true, ["enchant"] = true, ["fractured"] = true, ["implicit"] = true, @@ -994,7 +995,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) end end - local lineLower = line:lower() + local lineLower = modLine.disabled and "" or line:lower() -- \d+% increased/reduced explicit/implicit/ *tags* modifier magnitudes local modMagnitudePattern = { "(%d+)%% ([ir][ne][cd][ru][ec][ae][sd]e?d?) ?([%a%s]*) modifier magnitudes", -- \d+% increased/reduced effect of suffixes/prefixes @@ -1126,17 +1127,15 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) if self.base then if self.base.weapon or self.base.armour or self.base.tags.wand or self.base.tags.staff or self.base.tags.sceptre or self.itemSocketCount > 0 then local shouldFixRunesOnItem = #self.runes == 0 + local canRebuildRunes if not shouldFixRunesOnItem and #self.runeModLines > 0 then - local canRebuildRunes = true + canRebuildRunes = true for _, rune in ipairs(self.runes) do if rune ~= "None" and not data.itemMods.Runes[rune] then canRebuildRunes = false break end end - if canRebuildRunes then - self:UpdateRunes() - end end local function getRuneLineParts(modLine) @@ -1151,6 +1150,24 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) return strippedModLine, values end + if canRebuildRunes then + local disabledRuneLines = { } + for _, modLine in ipairs(self.runeModLines) do + if modLine.disabled then + local strippedModLine = getRuneLineParts(modLine.line) + disabledRuneLines[strippedModLine] = (disabledRuneLines[strippedModLine] or 0) + 1 + end + end + self:UpdateRunes() + for _, modLine in ipairs(self.runeModLines) do + local strippedModLine = getRuneLineParts(modLine.line) + if (disabledRuneLines[strippedModLine] or 0) > 0 then + modLine.disabled = true + disabledRuneLines[strippedModLine] -= 1 + end + end + end + local function compareRuneValueSets(a, b) for i = 1, math.max(#a, #b) do local aVal = a[i] or 0 @@ -1639,6 +1656,9 @@ function ItemClass:BuildRaw() if modLine.mutated then line = "{mutated}" .. line end + if modLine.disabled then + line = "{disabled}" .. line + end if modLine.crafted then line = "{crafted}" .. line end @@ -2316,6 +2336,9 @@ function ItemClass:BuildModList() end end local function processModLine(modLine) + if modLine.disabled then + return + end local variantCount = self:GetModLineVariantCount(modLine) if variantCount > 0 then -- special section for variant over-ride of pre-modifier item parameters diff --git a/src/Classes/Item.lua.rej b/src/Classes/Item.lua.rej deleted file mode 100644 index 11da0c1d89..0000000000 --- a/src/Classes/Item.lua.rej +++ /dev/null @@ -1,19 +0,0 @@ -diff a/src/Classes/Item.lua b/src/Classes/Item.lua (rejected hunks) -@@ -950,7 +950,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) - modList, extra = modLib.parseMod(rangedLine) - end - end -- local lineLower = line:lower() -+ local lineLower = modLine.disabled and "" or line:lower() - -- \d+% increased/reduced explicit/implicit/ *tags* modifier magnitudes - local modMagnitudePattern = { "(%d+)%% ([ir][ne][cd][ru][ec][ae][sd]e?d?) ?([%a%s]*) modifier magnitudes", - -- \d+% increased/reduced effect of suffixes/prefixes -@@ -1019,7 +1019,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) - enchantment = "enchant", - } - for _, pattern in ipairs(modMagnitudePattern) do -- if rangedLine:lower():find(pattern) then -+ if not modLine.disabled and rangedLine:lower():find(pattern) then - local rangedLine = itemLib.applyRange(line, modLine.range or main.defaultItemAffixQuality or 1, catalystScalar, modLine.corruptedRange) - local amount, increaseOrDecrease, modTagsString = rangedLine:lower():match(pattern) - local multiplier diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index 5b6469873b..ac20fda674 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -1908,6 +1908,21 @@ function ItemsTabClass:UpdateDisplayItemTooltip() self.displayItemTooltip.center = true end +function ItemsTabClass:ToggleDisplayItemModLine(modLine) + if not self.displayItem or not modLine then + return + end + modLine.disabled = not modLine.disabled + self.displayItem:BuildAndParseRaw() + self:UpdateDisplayItemTooltip() + self:UpdateDisplayItemRangeLines() + self:UpdateCustomControls() + if self.displayItem.crafted then + self:UpdateAffixControls() + end + self.build.buildFlag = true +end + function ItemsTabClass:UpdateClusterJewelControls() local item = self.displayItem @@ -3693,7 +3708,7 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth) formattedModLine = itemLib.formatModLine(modLine, dbMode) end for _ = 1, variantCount do - tooltip:AddLine(fontSizeBig, formattedModLine, "FONTIN SC", bg) + tooltip:AddLine(fontSizeBig, formattedModLine, "FONTIN SC", bg, modLine) end -- Show mods from granted passives diff --git a/src/Classes/ItemsTab.lua.rej b/src/Classes/ItemsTab.lua.rej deleted file mode 100644 index f62ab07ac1..0000000000 --- a/src/Classes/ItemsTab.lua.rej +++ /dev/null @@ -1,35 +0,0 @@ -diff a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua (rejected hunks) -@@ -1869,6 +1890,21 @@ function ItemsTabClass:UpdateDisplayItemTooltip() - self.displayItemTooltip.center = true - end - -+function ItemsTabClass:ToggleDisplayItemModLine(modLine) -+ if not self.displayItem or not modLine then -+ return -+ end -+ modLine.disabled = not modLine.disabled -+ self.displayItem:BuildAndParseRaw() -+ self:UpdateDisplayItemTooltip() -+ self:UpdateDisplayItemRangeLines() -+ self:UpdateCustomControls() -+ if self.displayItem.crafted then -+ self:UpdateAffixControls() -+ end -+ self.build.buildFlag = true -+end -+ - function ItemsTabClass:UpdateSocketControls() - local sockets = self.displayItem.sockets - for i = 1, #sockets - self.displayItem.abyssalSocketCount do -@@ -4324,7 +4360,10 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth) - if modList[1] then - for _, modLine in ipairs(modList) do - if item:CheckModLineVariant(modLine) then -- tooltip:AddLine(fontSizeBig, itemLib.formatModLine(modLine, dbMode), "FONTIN SC") -+ local formatted = itemLib.formatModLine(modLine, dbMode) -+ if formatted then -+ tooltip:AddLine(fontSizeBig, formatted, "FONTIN SC", modLine) -+ end - end - end - tooltip:AddSeparator(10) diff --git a/src/Classes/Tooltip.lua b/src/Classes/Tooltip.lua index 127b7f0af9..937b963782 100644 --- a/src/Classes/Tooltip.lua +++ b/src/Classes/Tooltip.lua @@ -116,7 +116,7 @@ function TooltipClass:CheckForUpdate(...) end end -function TooltipClass:AddLine(size, text, font, background) +function TooltipClass:AddLine(size, text, font, background, modLine) if text then local fontToUse if main.showFlavourText then @@ -142,10 +142,10 @@ function TooltipClass:AddLine(size, text, font, background) end end if activeColour then wrappedLine = wrappedLine .. "^7" end - t_insert(self.lines, { size = size, text = wrappedLine, block = #self.blocks, font = fontToUse, center = self.center, background = background }) + t_insert(self.lines, { size = size, text = wrappedLine, block = #self.blocks, font = fontToUse, center = self.center, background = background, modLine = modLine }) end else - t_insert(self.lines, { size = size, text = line, block = #self.blocks, font = fontToUse, center = self.center, background = background }) + t_insert(self.lines, { size = size, text = line, block = #self.blocks, font = fontToUse, center = self.center, background = background, modLine = modLine }) end end end @@ -426,7 +426,13 @@ function TooltipClass:CalculateColumns(ttY, ttX, ttH, ttW, viewPort) local lineX = lineCentered and (x + ttW / 2) or (x + (H_PAD / 2)) local lineAlign = lineCentered and "CENTER_X" or "LEFT" - t_insert(drawStack, {lineX, y, lineAlign, data.size, font, data.text, background = data.background}) + local stackEntry = {lineX, y, lineAlign, data.size, font, data.text, background = data.background} + if data.modLine then + stackEntry.tooltipLine = data + stackEntry.bounds = { x = x + (H_PAD / 2), y = y, width = ttW - H_PAD, height = data.size + 2 } + stackEntry.strikethrough = data.modLine.disabled + end + t_insert(drawStack, stackEntry) y = y + data.size + 2 -- track max width for extra columns @@ -476,6 +482,10 @@ function TooltipClass:CalculateColumns(ttY, ttX, ttH, ttW, viewPort) -- "LEFT" aligned text and images (NOTE: "RIGHT" aligned does not seem to exist) line[xIdx] = origX - oldBaseX + newBaseX end + if line.bounds then + line.bounds.x = line.bounds.x - oldBaseX + newBaseX + line.bounds.width = extraColumnWidth - H_PAD + end -- Resize separators/dividers (technically unlikely to appear in extra columns, but just in case) if not isText then @@ -564,6 +574,9 @@ function TooltipClass:Draw(x, y, w, h, viewPort) -- Image, Separators, etc. have 5 entries and `x` at `[1]` line[1] = line[1] + offsetX end + if line.bounds then + line.bounds.x = line.bounds.x + offsetX + end end end @@ -717,6 +730,9 @@ function TooltipClass:Draw(x, y, w, h, viewPort) end end else + if line.tooltipLine then + line.tooltipLine.bounds = line.bounds + end -- Draw background if specified, used for gem mod lines and desecrated mods on items. local bg = line.background if bg then @@ -748,6 +764,14 @@ function TooltipClass:Draw(x, y, w, h, viewPort) -- Draw text line DrawString(unpack(line)) + if line.strikethrough then + local prevR, prevG, prevB, prevA = GetDrawColor() + local textW = DrawStringWidth(line[4], line[5], line[6]) + local strikeX = line[3] == "CENTER_X" and line[1] - textW / 2 or line[1] + SetDrawColor(0.75, 0.75, 0.75, 0.35) + DrawImage(nil, strikeX, line[2] + line[4] / 2, textW, 1) + SetDrawColor(prevR, prevG, prevB, prevA) + end end end diff --git a/src/Classes/Tooltip.lua.rej b/src/Classes/Tooltip.lua.rej deleted file mode 100644 index ba8ebfdcf9..0000000000 --- a/src/Classes/Tooltip.lua.rej +++ /dev/null @@ -1,57 +0,0 @@ -diff a/src/Classes/Tooltip.lua b/src/Classes/Tooltip.lua (rejected hunks) -@@ -84,7 +84,7 @@ function TooltipClass:CheckForUpdate(...) - end - end - --function TooltipClass:AddLine(size, text, font) -+function TooltipClass:AddLine(size, text, font, modLine) - if text then - local fontToUse - if main.showFlavourText then -@@ -100,10 +100,10 @@ function TooltipClass:AddLine(size, text, font) - end - if self.maxWidth then - for _, wrappedLine in ipairs(main:WrapString(line, size, self.maxWidth - H_PAD)) do -- t_insert(self.lines, { size = size, text = wrappedLine, block = #self.blocks, font = fontToUse, center = self.center }) -+ t_insert(self.lines, { size = size, text = wrappedLine, block = #self.blocks, font = fontToUse, center = self.center, modLine = modLine }) - end - else -- t_insert(self.lines, { size = size, text = line, block = #self.blocks, font = fontToUse, center = self.center }) -+ t_insert(self.lines, { size = size, text = line, block = #self.blocks, font = fontToUse, center = self.center, modLine = modLine }) - end - end - end -@@ -294,7 +294,12 @@ function TooltipClass:CalculateColumns(ttY, ttX, ttH, ttW, viewPort) - local lineX = lineCentered and (x + ttW / 2) or (x + (H_PAD / 2)) - local lineAlign = lineCentered and "CENTER_X" or "LEFT" - -- t_insert(drawStack, {lineX, y, lineAlign, data.size, font, data.text}) -+ local stackEntry = {lineX, y, lineAlign, data.size, font, data.text} -+ if data.modLine and data.modLine.disabled then -+ stackEntry.strikethrough = true -+ end -+ t_insert(drawStack, stackEntry) -+ data.bounds = { x = x + (H_PAD / 2), y = y, width = ttW - H_PAD, height = data.size + 2 } - y = y + data.size + 2 - - -- track max width for extra columns -@@ -595,6 +600,19 @@ function TooltipClass:Draw(x, y, w, h, viewPort) - end - else - DrawString(unpack(line)) -+ if line.strikethrough then -+ local textX = line[1] -+ local textY = line[2] -+ local align = line[3] -+ local size = line[4] -+ local font = line[5] -+ local text = line[6] -+ local textW = DrawStringWidth(size, font, text) -+ local strikeX = align == "CENTER_X" and (textX - textW / 2) or textX -+ local strikeY = textY + size / 2 -+ SetDrawColor(0.75, 0.75, 0.75, 0.35) -+ DrawImage(nil, strikeX, strikeY, textW, 1.0) -+ end - end - end - diff --git a/src/Modules/ItemTools.lua b/src/Modules/ItemTools.lua index 920982b547..9914a561b2 100644 --- a/src/Modules/ItemTools.lua +++ b/src/Modules/ItemTools.lua @@ -335,6 +335,9 @@ function itemLib.formatModLine(modLine, dbMode, skipUnsupported) if itemLib.isZeroValueLine(line) then -- Hack to hide 0-value modifiers return end + if modLine.disabled then + return colorCodes.DISABLED .. line + end local colorCode if modLine.extra and not skipUnsupported then colorCode = colorCodes.UNSUPPORTED @@ -378,4 +381,4 @@ itemLib.wiki = { return key == itemLib.wiki.key end, triggered = false -} \ No newline at end of file +} diff --git a/src/Modules/ItemTools.lua.rej b/src/Modules/ItemTools.lua.rej deleted file mode 100644 index 1ff4a2c6db..0000000000 --- a/src/Modules/ItemTools.lua.rej +++ /dev/null @@ -1,10 +0,0 @@ -diff a/src/Modules/ItemTools.lua b/src/Modules/ItemTools.lua (rejected hunks) -@@ -355,7 +355,7 @@ function itemLib.formatModLine(modLine, dbMode) - return - end - if modLine.disabled then -- return "^x7F7F7F" .. line -+ return colorCodes.DISABLED .. line - end - local colorCode - if modLine.extra then