Skip to content
Merged
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
27 changes: 18 additions & 9 deletions spec/System/TestAbyssTimelessJewel_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -415,20 +415,29 @@ describe("Abyss timeless jewels", function()
controls.searchButton.onClick()
assert.are.equal(1, #build.timelessData.searchResults)

local protectedOption
for index, option in ipairs(controls.protectAllocatedSelect.list) do
if option.label == baseNodeName then
controls.protectAllocatedSelect.selIndex = index
protectedOption = option
local protectBox
local boxIndex = 1
while controls["protectAllocatedBox" .. boxIndex] do
if controls["protectAllocatedBox" .. boxIndex].label == baseNodeName then
protectBox = controls["protectAllocatedBox" .. boxIndex]
break
end
boxIndex = boxIndex + 1
end
assert.are.equal(baseNodeName, controls.protectAllocatedSelect:GetSelValue().label)
assert.is_truthy(protectBox, "Expected a protection checkbox for " .. baseNodeName)
local tooltip = new("Tooltip"):Tooltip()
controls.protectAllocatedSelect.tooltipFunc(tooltip, "DROP", controls.protectAllocatedSelect.selIndex, protectedOption)
protectBox.tooltipFunc(tooltip)
assert.is_true(#tooltip.lines > 0)
assert.are.same(spec.tree.nodes[53884].sd, protectedOption.descriptions)
controls.protectAllocatedButtonAdd.onClick()
local tooltipText = {}
for _, line in ipairs(tooltip.lines) do
table.insert(tooltipText, line.text or "")
end
tooltipText = table.concat(tooltipText, "\n")
for _, line in ipairs(spec.tree.nodes[53884].sd) do
assert.is_truthy(tooltipText:find(line, 1, true), "Expected tooltip to describe " .. line)
end
protectBox.state = true
protectBox.changeFunc(true)
local _, requiredAscendancyYAfterAdd = controls.abyssAscendancySelect:GetPos()
assert.are.equal(requiredAscendancyY, requiredAscendancyYAfterAdd)
controls.searchButton.onClick()
Expand Down
11 changes: 8 additions & 3 deletions src/Classes/CheckBoxControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function CheckBoxClass:CheckBoxControl(anchor, rect, label, changeFunc, tooltipT
self:TooltipHost(tooltipText)
self.label = label
self.labelWidth = DrawStringWidth(self.width - 4, "VAR", label or "") + 5
self.labelRight = false
self.changeFunc = changeFunc
self.state = initialState
return self
Expand All @@ -25,10 +26,12 @@ function CheckBoxClass:IsMouseOver()
local width, height = self:GetSize()
local cursorX, cursorY = GetCursorPos()

-- move x left by label width, increase width by label width
-- Include the label in the clickable area.
local label = self:GetProperty("label")
if label then
x = x - self.labelWidth
if not self.labelRight then
x = x - self.labelWidth
end
width = width + self.labelWidth
end
return cursorX >= x and cursorY >= y and cursorX < x + width and cursorY < y + height
Expand Down Expand Up @@ -76,7 +79,9 @@ function CheckBoxClass:Draw(viewPort, noTooltip)
SetDrawColor(0.33, 0.33, 0.33)
end
local label = self:GetProperty("label")
if label then
if label and self.labelRight then
DrawString(x + self.width + 5, y + 2, nil, size - 4, "VAR", label)
elseif label then
DrawString(x - 5, y + 2, "RIGHT_X", size - 4, "VAR", label)
end
if mOver and not noTooltip then
Expand Down
50 changes: 28 additions & 22 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4925,11 +4925,28 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth)
tooltip:AddSeparator(14)
tooltip:AddLine(14, colorCodes.TIP.."Tip: Press Ctrl+D"..itemTabHint.." to enable the display of stat differences.")
return
elseif not (base.flask or base.tincture) then
tooltip:AddLine(14, colorCodes.TIP .. "Tip: Press Ctrl+D" .. itemTabHint .. " to disable the display of stat differences.")
end
self:AddItemStatDifferences(tooltip, item, base, slot)

if launch.devModeAlt then
-- Modifier debugging info
tooltip:AddSeparator(10)
for _, mod in ipairs(modList) do
tooltip:AddLine(14, "^7" .. modLib.formatMod(mod))
end
end
end

---@param tooltip Tooltip
---@param item Item
---@param base any
function ItemsTabClass:AddItemStatDifferences(tooltip, item, base, slot)
local calcFunc, calcBase = self.build.calcsTab:GetMiscCalculator()
if base.flask then
-- Special handling for flasks
local stats = { }
local stats = {}
local flaskData = item.flaskData
local modDB = self.build.calcsTab.mainEnv.modDB
local output = self.build.calcsTab.mainOutput
Expand Down Expand Up @@ -4964,28 +4981,28 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth)

-- LocalLifeFlaskAdditionalLifeRecovery flask mods
if flaskData.lifeAdditional > 0 and not self.build.configTab.input.conditionFullLife then
local totalAdditionalAmount = (flaskData.lifeAdditional/100) * flaskData.lifeTotal * output.LifeRecoveryRateMod
local additionalGrad = (lifeDur/10) * totalAdditionalAmount
local totalAdditionalAmount = (flaskData.lifeAdditional / 100) * flaskData.lifeTotal * output.LifeRecoveryRateMod
local additionalGrad = (lifeDur / 10) * totalAdditionalAmount
local leftoverDur = 10 - lifeDur
local leftoverAmount = totalAdditionalAmount - additionalGrad

if inst > 0 then
if grad > 0 then
t_insert(stats, s_format("^8Life recovered: ^7%d ^8(^7%d^8 instantly, plus ^7%d ^8over^7 %.2fs^8, and an additional ^7%d ^8over subsequent ^7%.2fs^8)",
inst + grad + totalAdditionalAmount, inst, grad + additionalGrad, lifeDur, leftoverAmount, leftoverDur))
inst + grad + totalAdditionalAmount, inst, grad + additionalGrad, lifeDur, leftoverAmount, leftoverDur))
else
lifeDur = 0
t_insert(stats, s_format("^8Life recovered: ^7%d ^8(^7%d^8 instantly, and an additional ^7%d ^8over ^7%.2fs^8)",
inst + totalAdditionalAmount, inst, totalAdditionalAmount, 10))
inst + totalAdditionalAmount, inst, totalAdditionalAmount, 10))
end
else
t_insert(stats, s_format("^8Life recovered: ^7%d ^8(^7%d ^8over ^7%.2fs^8, and an additional ^7%d ^8over subsequent ^7%.2fs^8)",
grad + totalAdditionalAmount, grad + additionalGrad, lifeDur, leftoverAmount, leftoverDur))
grad + totalAdditionalAmount, grad + additionalGrad, lifeDur, leftoverAmount, leftoverDur))
end
else
if inst > 0 and grad > 0 then
t_insert(stats, s_format("^8Life recovered: ^7%d ^8(^7%d^8 instantly, plus ^7%d ^8over^7 %.2fs^8)", inst + grad, inst, grad, lifeDur))
-- modifiers to recovery amount or duration
-- modifiers to recovery amount or duration
elseif inst + grad ~= flaskData.lifeTotal or (inst == 0 and lifeDur ~= flaskData.duration) then
if inst > 0 then
lifeDur = 0
Expand Down Expand Up @@ -5137,7 +5154,7 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth)
self.build:AddStatComparesToTooltip(tooltip, calcBase, output, header)
elseif base.tincture then
-- Special handling for tinctures
local stats = { }
local stats = {}
local tinctureData = item.tinctureData
local modDB = self.build.calcsTab.mainEnv.modDB
local output = self.build.calcsTab.mainOutput
Expand Down Expand Up @@ -5174,15 +5191,13 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth)
else
self:UpdateSockets()
-- Build sorted list of slots to compare with
local compareSlots = { }
local compareSlots = {}
for slotName, slot in pairs(self.slots) do
if self:IsItemValidForSlot(item, slotName) and not slot.inactive and (not slot.weaponSet or slot.weaponSet == (self.activeItemSet.useSecondWeaponSet and 2 or 1)) and slot.shown() then
t_insert(compareSlots, slot)
end
end

tooltip:AddLine(14, colorCodes.TIP .. "Tip: Press Ctrl+D"..itemTabHint.." to disable the display of stat differences.")

local function getReplacedItemAndOutput(compareSlot)
local selItem = self.items[compareSlot.selItemId]
local override = { repSlotName = compareSlot.slotName, repItem = item ~= selItem and item or nil }
Expand All @@ -5198,9 +5213,9 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth)
end
local header
if item == selItem then
header = "^7Removing this item from "..compareSlot.label.." will give you:"
header = "^7Removing this item from " .. compareSlot.label .. " will give you:"
else
header = string.format("^7Equipping this item in %s will give you:%s", compareSlot.label or compareSlot.slotName, selItem and "\n(replacing "..colorCodes[selItem.rarity]..selItem.name.."^7)" or "")
header = string.format("^7Equipping this item in %s will give you:%s", compareSlot.label or compareSlot.slotName, selItem and "\n(replacing " .. colorCodes[selItem.rarity] .. selItem.name .. "^7)" or "")
end
self.build:AddStatComparesToTooltip(tooltip, calcBase, output, header)
end
Expand Down Expand Up @@ -5281,15 +5296,6 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth)
for _, slotEntry in ipairs(slots) do
addCompareForSlot(slotEntry.compareSlot, slotEntry.selItem, slotEntry.output)
end

end

if launch.devModeAlt then
-- Modifier debugging info
tooltip:AddSeparator(10)
for _, mod in ipairs(modList) do
tooltip:AddLine(14, "^7"..modLib.formatMod(mod))
end
end
end

Expand Down
8 changes: 7 additions & 1 deletion src/Classes/PassiveTreeView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,8 @@ function PassiveTreeViewClass:AddNodeName(tooltip, node, build)
end
end

function PassiveTreeViewClass:AddNodeTooltip(tooltip, node, build)
---@param returnEarly boolean? Whether the function should stop after writing the mod info, before any allocation-specific info
function PassiveTreeViewClass:AddNodeTooltip(tooltip, node, build, returnEarly)
local fontSizeBig = main.showFlavourText and 18 or 16
self.skillTooltip:Clear()
tooltip.center = true
Expand Down Expand Up @@ -1632,6 +1633,7 @@ function PassiveTreeViewClass:AddNodeTooltip(tooltip, node, build)
end
end


-- Reminder text
if node.reminderText then
tooltip:AddSeparator(14)
Expand All @@ -1648,6 +1650,10 @@ function PassiveTreeViewClass:AddNodeTooltip(tooltip, node, build)
end
end

if returnEarly then
return
end

-- Tattoo Editing
if node and (node.isTattoo
or (node.type == "Normal" and (node.dn == "Strength" or node.dn == "Dexterity" or node.dn == "Intelligence"))
Expand Down
Loading
Loading