Skip to content
Open
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
7 changes: 7 additions & 0 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ local lineFlags = {
["crafted"] = true,
["crucible"] = true,
["custom"] = true,
["disabled"] = true,
["eater"] = true,
["enchant"] = true,
["exarch"] = true,
Expand Down Expand Up @@ -1530,6 +1531,9 @@ function ItemClass:BuildRaw()
if modLine.corruptedRange then
line = "{corruptedRange:" .. round(modLine.corruptedRange, 2) .. "}" .. line
end
if modLine.disabled then
line = "{disabled}" .. line
end
if modLine.crafted then
line = "{crafted}" .. line
end
Expand Down Expand Up @@ -2148,6 +2152,9 @@ function ItemClass:BuildModList()
end
end
local function processModLine(modLine)
if modLine.disabled then
return
end
if self:CheckModLineVariant(modLine) then
-- special section for variant over-ride of pre-modifier item parameters
if modLine.line:find("Requires Class") then
Expand Down
41 changes: 40 additions & 1 deletion src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
26 changes: 22 additions & 4 deletions src/Classes/Tooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/Modules/ItemTools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ function itemLib.formatModLine(modLine, dbMode)
if line:match("^%+?0%%? ") or (line:match(" %+?0%%? ") and not line:match("0 to [1-9]")) or line:match(" 0%-0 ") or line:match(" 0 to 0 ") then -- Hack to hide 0-value modifiers
return
end
if modLine.disabled then
return "^x7F7F7F" .. line

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to add this as a new colour to src/Data/Global.lua?

end
local colorCode
if modLine.extra then
colorCode = colorCodes.UNSUPPORTED
Expand Down
Loading