Skip to content

Commit 20b7fe2

Browse files
Add feature to view all mods sliders on Uniques by default (config to turn it off) (#9187)
* add option to view all item affixes sans dropdown Signed-off-by: Justin Stitt <[email protected]> * fix rare items Signed-off-by: Justin Stitt <[email protected]> --------- Signed-off-by: Justin Stitt <[email protected]> Co-authored-by: LocalIdentity <[email protected]>
1 parent 1d36787 commit 20b7fe2

File tree

2 files changed

+58
-5
lines changed

2 files changed

+58
-5
lines changed

src/Classes/ItemsTab.lua

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -908,13 +908,21 @@ holding Shift will put it in the second.]])
908908

909909
-- Section: Modifier Range
910910
self.controls.displayItemSectionRange = new("Control", {"TOPLEFT",self.controls.displayItemSectionCustom,"BOTTOMLEFT"}, {0, 0, 0, function()
911-
return self.displayItem.rangeLineList[1] and 28 or 0
911+
if not self.displayItem or not self.displayItem.rangeLineList[1] then
912+
return 0
913+
end
914+
if main.showAllItemAffixes and self.displayItem.rarity == "UNIQUE" then
915+
local count = #self.displayItem.rangeLineList
916+
return count * 22 + 4
917+
else
918+
return 28
919+
end
912920
end})
913921
self.controls.displayItemRangeLine = new("DropDownControl", {"TOPLEFT",self.controls.displayItemSectionRange,"TOPLEFT"}, {0, 0, 350, 18}, nil, function(index, value)
914922
self.controls.displayItemRangeSlider.val = self.displayItem.rangeLineList[index].range
915923
end)
916924
self.controls.displayItemRangeLine.shown = function()
917-
return self.displayItem and self.displayItem.rangeLineList[1] ~= nil
925+
return self.displayItem and self.displayItem.rangeLineList[1] ~= nil and not (main.showAllItemAffixes and self.displayItem.rarity == "UNIQUE")
918926
end
919927
self.controls.displayItemRangeSlider = new("SliderControl", {"LEFT",self.controls.displayItemRangeLine,"RIGHT"}, {8, 0, 100, 18}, function(val)
920928
self.displayItem.rangeLineList[self.controls.displayItemRangeLine.selIndex].range = val
@@ -923,6 +931,34 @@ holding Shift will put it in the second.]])
923931
self:UpdateCustomControls()
924932
end)
925933

934+
for i = 1, 20 do
935+
local prevControl = i == 1 and self.controls.displayItemSectionRange or self.controls["displayItemStackedRangeLine"..(i-1)]
936+
937+
self.controls["displayItemStackedRangeLine"..i] = new("LabelControl", {"TOPLEFT",prevControl,"TOPLEFT"}, {0, function()
938+
return i == 1 and 2 or 22
939+
end, 350, 14}, function()
940+
if self.displayItem and self.displayItem.rangeLineList[i] then
941+
return "^7" .. self.displayItem.rangeLineList[i].line
942+
end
943+
return ""
944+
end)
945+
self.controls["displayItemStackedRangeLine"..i].shown = function()
946+
return main.showAllItemAffixes and self.displayItem and self.displayItem.rarity == "UNIQUE" and self.displayItem.rangeLineList[i] ~= nil
947+
end
948+
949+
self.controls["displayItemStackedRangeSlider"..i] = new("SliderControl", {"LEFT",self.controls["displayItemStackedRangeLine"..i],"RIGHT"}, {8, 0, 100, 18}, function(val)
950+
if self.displayItem and self.displayItem.rangeLineList[i] then
951+
self.displayItem.rangeLineList[i].range = val
952+
self.displayItem:BuildAndParseRaw()
953+
self:UpdateDisplayItemTooltip()
954+
self:UpdateCustomControls()
955+
end
956+
end)
957+
self.controls["displayItemStackedRangeSlider"..i].shown = function()
958+
return self.controls["displayItemStackedRangeLine"..i]:IsShown()
959+
end
960+
end
961+
926962
-- Tooltip anchor
927963
self.controls.displayItemTooltipAnchor = new("Control", {"TOPLEFT",self.controls.displayItemSectionRange,"BOTTOMLEFT"})
928964

@@ -1879,8 +1915,11 @@ end
18791915
function ItemsTabClass:UpdateDisplayItemRangeLines()
18801916
if self.displayItem and self.displayItem.rangeLineList[1] then
18811917
wipeTable(self.controls.displayItemRangeLine.list)
1882-
for _, modLine in ipairs(self.displayItem.rangeLineList) do
1918+
for i, modLine in ipairs(self.displayItem.rangeLineList) do
18831919
t_insert(self.controls.displayItemRangeLine.list, modLine.line)
1920+
if self.controls["displayItemStackedRangeSlider"..i] then
1921+
self.controls["displayItemStackedRangeSlider"..i].val = modLine.range
1922+
end
18841923
end
18851924
self.controls.displayItemRangeLine.selIndex = 1
18861925
self.controls.displayItemRangeSlider.val = self.displayItem.rangeLineList[1].range

src/Modules/Main.lua

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ function main:Init()
113113
self.showPublicBuilds = true
114114
self.showFlavourText = true
115115
self.showAnimations = true
116-
self.errorReadingSettings = false
116+
self.errorReadingSettings = false
117+
self.showAllItemAffixes = false
117118

118119
if not SetDPIScaleOverridePercent then SetDPIScaleOverridePercent = function(scale) end end
119120

@@ -654,9 +655,12 @@ function main:LoadSettings(ignoreBuild)
654655
if node.attrib.showFlavourText then
655656
self.showFlavourText = node.attrib.showFlavourText == "true"
656657
end
657-
if node.attrib.showAnimations then
658+
if node.attrib.showAnimations then
658659
self.showAnimations = node.attrib.showAnimations == "true"
659660
end
661+
if node.attrib.showAllItemAffixes then
662+
self.showAllItemAffixes = node.attrib.showAllItemAffixes == "true"
663+
end
660664
if node.attrib.dpiScaleOverridePercent then
661665
self.dpiScaleOverridePercent = tonumber(node.attrib.dpiScaleOverridePercent) or 0
662666
SetDPIScaleOverridePercent(self.dpiScaleOverridePercent)
@@ -790,6 +794,7 @@ function main:SaveSettings()
790794
showPublicBuilds = tostring(self.showPublicBuilds),
791795
showFlavourText = tostring(self.showFlavourText),
792796
showAnimations = tostring(self.showAnimations),
797+
showAllItemAffixes = tostring(self.showAllItemAffixes),
793798
dpiScaleOverridePercent = tostring(self.dpiScaleOverridePercent),
794799
} })
795800
local res, errMsg = common.xml.SaveXMLFile(setXML, self.userPath.."Settings.xml")
@@ -998,6 +1003,12 @@ function main:OpenOptionsPopup()
9981003
self.showAnimations = state
9991004
end)
10001005

1006+
nextRow()
1007+
controls.showAllItemAffixes = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Show all item affixes sliders:", function(state)
1008+
self.showAllItemAffixes = state
1009+
end)
1010+
controls.showAllItemAffixes.tooltipText = "Display all item affix slots as a stacked list instead of hiding them in dropdowns"
1011+
10011012
nextRow()
10021013
drawSectionHeader("build", "Build-related options")
10031014

@@ -1088,6 +1099,7 @@ function main:OpenOptionsPopup()
10881099
controls.showPublicBuilds.state = self.showPublicBuilds
10891100
controls.showFlavourText.state = self.showFlavourText
10901101
controls.showAnimations.state = self.showAnimations
1102+
controls.showAllItemAffixes.state = self.showAllItemAffixes
10911103
local initialNodePowerTheme = self.nodePowerTheme
10921104
local initialColorPositive = self.colorPositive
10931105
local initialColorNegative = self.colorNegative
@@ -1109,6 +1121,7 @@ function main:OpenOptionsPopup()
11091121
local initialShowPublicBuilds = self.showPublicBuilds
11101122
local initialShowFlavourText = self.showFlavourText
11111123
local initialShowAnimations = self.showAnimations
1124+
local initialShowAllItemAffixes = self.showAllItemAffixes
11121125
local initialDpiScaleOverridePercent = self.dpiScaleOverridePercent
11131126

11141127
-- last line with buttons has more spacing
@@ -1164,6 +1177,7 @@ function main:OpenOptionsPopup()
11641177
self.showPublicBuilds = initialShowPublicBuilds
11651178
self.showFlavourText = initialShowFlavourText
11661179
self.showAnimations = initialShowAnimations
1180+
self.showAllItemAffixes = initialShowAllItemAffixes
11671181
self.dpiScaleOverridePercent = initialDpiScaleOverridePercent
11681182
SetDPIScaleOverridePercent(self.dpiScaleOverridePercent)
11691183
main:ClosePopup()

0 commit comments

Comments
 (0)