Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration option for showing tooltips for all slots #4292

Merged
merged 1 commit into from
May 28, 2022
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
26 changes: 14 additions & 12 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2858,19 +2858,21 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
end)

-- Add comparisons for each slot
for _, slot in pairs(compareSlots) do
local selItem = self.items[slot.selItemId]
local storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
local output = calcFunc({ repSlotName = slot.slotName, repItem = item ~= selItem and item }, {})
GlobalCache.useFullDPS = storedGlobalCacheDPSView
local header
if item == selItem then
header = "^7Removing this item from "..slot.label.." will give you:"
else
header = string.format("^7Equipping this item in %s will give you:%s", slot.label, selItem and "\n(replacing "..colorCodes[selItem.rarity]..selItem.name.."^7)" or "")
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]
local storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
local output = calcFunc({ repSlotName = compareSlot.slotName, repItem = item ~= selItem and item }, {})
GlobalCache.useFullDPS = storedGlobalCacheDPSView
local header
if item == selItem then
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, selItem and "\n(replacing "..colorCodes[selItem.rarity]..selItem.name.."^7)" or "")
end
self.build:AddStatComparesToTooltip(tooltip, calcBase, output, header)
end
self.build:AddStatComparesToTooltip(tooltip, calcBase, output, header)
end
end

Expand Down
12 changes: 12 additions & 0 deletions src/Modules/Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ the "Releases" section of the GitHub page.]])
self.decimalSeparator = "."
self.showTitlebarName = true
self.showWarnings = true
self.slotOnlyTooltips = true

local ignoreBuild
if arg[1] then
Expand Down Expand Up @@ -524,6 +525,9 @@ function main:LoadSettings(ignoreBuild)
if node.attrib.showWarnings then
self.showWarnings = node.attrib.showWarnings == "true"
end
if node.attrib.slotOnlyTooltips then
self.slotOnlyTooltips = node.attrib.slotOnlyTooltips == "true"
end
end
end
end
Expand Down Expand Up @@ -576,6 +580,7 @@ function main:SaveSettings()
defaultCharLevel = tostring(self.defaultCharLevel or 1),
lastExportWebsite = self.lastExportWebsite,
showWarnings = tostring(self.showWarnings),
slotOnlyTooltips = tostring(self.slotOnlyTooltips),
} })
local res, errMsg = common.xml.SaveXMLFile(setXML, self.userPath.."Settings.xml")
if not res then
Expand Down Expand Up @@ -708,10 +713,15 @@ function main:OpenOptionsPopup()
controls.showWarnings = new("CheckBoxControl", {"TOPLEFT",nil,"TOPLEFT"}, defaultLabelPlacementX, currentY, 20, "^7Show build warnings:", function(state)
self.showWarnings = state
end)
nextRow()
controls.slotOnlyTooltips = new("CheckBoxControl", {"TOPLEFT",nil,"TOPLEFT"}, defaultLabelPlacementX, currentY, 20, "^7Show tooltips only for affected slots:", function(state)
self.slotOnlyTooltips = state
end)

controls.betaTest.state = self.betaTest
controls.titlebarName.state = self.showTitlebarName
controls.showWarnings.state = self.showWarnings
controls.slotOnlyTooltips.state = self.slotOnlyTooltips
local initialNodePowerTheme = self.nodePowerTheme
local initialThousandsSeparatorDisplay = self.showThousandsSeparators
local initialTitlebarName = self.showTitlebarName
Expand All @@ -721,6 +731,7 @@ function main:OpenOptionsPopup()
local initialDefaultGemQuality = self.defaultGemQuality or 0
local initialDefaultCharLevel = self.defaultCharLevel or 1
local initialshowWarnings = self.showWarnings
local initialSlotOnlyTooltips = self.slotOnlyTooltips

-- last line with buttons has more spacing
nextRow(1.5)
Expand Down Expand Up @@ -759,6 +770,7 @@ function main:OpenOptionsPopup()
self.defaultGemQuality = initialDefaultGemQuality
self.defaultCharLevel = initialDefaultCharLevel
self.showWarnings = initialshowWarnings
self.slotOnlyTooltips = initialSlotOnlyTooltips
main:ClosePopup()
end)
nextRow(1.5)
Expand Down