Skip to content

Commit fe8aa5f

Browse files
github-actions[bot]JustinStittLocalIdentity
authored
[pob1-port] Add feature to view all mods sliders on Uniques by default (config to turn it off) (#1592)
* Apply changes from PathOfBuildingCommunity/PathOfBuilding#9187 * Fix merge conflicts * PR#1593 changes Merged the changes from the other PR into this one --------- Co-authored-by: JustinStitt <[email protected]> Co-authored-by: LocalIdentity <[email protected]>
1 parent c2b9fe1 commit fe8aa5f

File tree

2 files changed

+56
-3
lines changed

2 files changed

+56
-3
lines changed

src/Classes/ItemsTab.lua

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

815815
-- Section: Modifier Range
816816
self.controls.displayItemSectionRange = new("Control", {"TOPLEFT",self.controls.displayItemSectionCustom,"BOTTOMLEFT"}, {0, 0, 0, function()
817-
return self.displayItem.rangeLineList[1] and 28 or 0
817+
if not self.displayItem or not self.displayItem.rangeLineList[1] then
818+
return 0
819+
end
820+
if main.showAllItemAffixes and self.displayItem.rarity == "UNIQUE" then
821+
local count = #self.displayItem.rangeLineList
822+
return count * 22 + 4
823+
else
824+
return 28
825+
end
818826
end})
819827
self.controls.displayItemRangeLine = new("DropDownControl", {"TOPLEFT",self.controls.displayItemSectionRange,"TOPLEFT"}, {0, 0, 350, 18}, nil, function(index, value)
820828
self.controls.displayItemRangeSlider.val = self.displayItem.rangeLineList[index].range
821829
end)
822830
self.controls.displayItemRangeLine.shown = function()
823-
return self.displayItem and self.displayItem.rangeLineList[1] ~= nil
831+
return self.displayItem and self.displayItem.rangeLineList[1] ~= nil and not (main.showAllItemAffixes and self.displayItem.rarity == "UNIQUE")
824832
end
825833
self.controls.displayItemRangeSlider = new("SliderControl", {"LEFT",self.controls.displayItemRangeLine,"RIGHT"}, {8, 0, 100, 18}, function(val)
826834
self.displayItem.rangeLineList[self.controls.displayItemRangeLine.selIndex].range = val
@@ -829,6 +837,34 @@ holding Shift will put it in the second.]])
829837
self:UpdateCustomControls()
830838
end)
831839

840+
for i = 1, 20 do
841+
local baseControl = i == 1 and self.controls.displayItemSectionRange or self.controls["displayItemStackedRangeSlider"..(i-1)]
842+
843+
self.controls["displayItemStackedRangeSlider"..i] = new("SliderControl", {"TOPLEFT",baseControl,"TOPLEFT"}, {0, function()
844+
return i == 1 and 2 or 22
845+
end, 100, 18}, function(val)
846+
if self.displayItem and self.displayItem.rangeLineList[i] then
847+
self.displayItem.rangeLineList[i].range = val
848+
self.displayItem:BuildAndParseRaw()
849+
self:UpdateDisplayItemTooltip()
850+
self:UpdateCustomControls()
851+
end
852+
end)
853+
self.controls["displayItemStackedRangeLine"..i] = new("LabelControl", {"LEFT",self.controls["displayItemStackedRangeSlider"..i],"RIGHT"}, {8, -2, 350, 14}, function()
854+
if self.displayItem and self.displayItem.rangeLineList[i] then
855+
return "^7" .. self.displayItem.rangeLineList[i].line
856+
end
857+
return ""
858+
end)
859+
self.controls["displayItemStackedRangeSlider"..i].shown = function()
860+
return main.showAllItemAffixes and self.displayItem and self.displayItem.rarity == "UNIQUE" and self.displayItem.rangeLineList[i] ~= nil
861+
end
862+
863+
self.controls["displayItemStackedRangeLine"..i].shown = function()
864+
return self.controls["displayItemStackedRangeSlider"..i]:IsShown()
865+
end
866+
end
867+
832868
-- Tooltip anchor
833869
self.controls.displayItemTooltipAnchor = new("Control", {"TOPLEFT",self.controls.displayItemSectionRange,"BOTTOMLEFT"})
834870

@@ -1793,7 +1829,10 @@ end
17931829
function ItemsTabClass:UpdateDisplayItemRangeLines()
17941830
if self.displayItem and self.displayItem.rangeLineList[1] then
17951831
wipeTable(self.controls.displayItemRangeLine.list)
1796-
for _, modLine in ipairs(self.displayItem.rangeLineList) do
1832+
for i, modLine in ipairs(self.displayItem.rangeLineList) do
1833+
if self.controls["displayItemStackedRangeSlider"..i] then
1834+
self.controls["displayItemStackedRangeSlider"..i].val = modLine.range
1835+
end
17971836
-- primarily for Against the Darkness // a way to cut down on really long modLines, gsub could be updated for others
17981837
t_insert(self.controls.displayItemRangeLine.list, (modLine.line:gsub(" Passive Skills in Radius also grant", ":")))
17991838
end

src/Modules/Main.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ function main:Init()
112112
--self.showPublicBuilds = true
113113
self.showFlavourText = true
114114
self.showAnimations = true
115+
self.showAllItemAffixes = true
115116
self.errorReadingSettings = false
116117

117118
if not SetDPIScaleOverridePercent then SetDPIScaleOverridePercent = function(scale) end end
@@ -658,6 +659,9 @@ function main:LoadSettings(ignoreBuild)
658659
if node.attrib.showAnimations then
659660
self.showAnimations = node.attrib.showAnimations == "true"
660661
end
662+
if node.attrib.showAllItemAffixes then
663+
self.showAllItemAffixes = node.attrib.showAllItemAffixes == "true"
664+
end
661665
if node.attrib.dpiScaleOverridePercent then
662666
self.dpiScaleOverridePercent = tonumber(node.attrib.dpiScaleOverridePercent) or 0
663667
SetDPIScaleOverridePercent(self.dpiScaleOverridePercent)
@@ -791,6 +795,7 @@ function main:SaveSettings()
791795
--showPublicBuilds = tostring(self.showPublicBuilds),
792796
showFlavourText = tostring(self.showFlavourText),
793797
showAnimations = tostring(self.showAnimations),
798+
showAllItemAffixes = tostring(self.showAllItemAffixes),
794799
dpiScaleOverridePercent = tostring(self.dpiScaleOverridePercent)
795800
} })
796801
local res, errMsg = common.xml.SaveXMLFile(setXML, self.userPath.."Settings.xml")
@@ -998,6 +1003,12 @@ function main:OpenOptionsPopup()
9981003
controls.showAnimations = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Show Animations:", function(state)
9991004
self.showAnimations = state
10001005
end)
1006+
1007+
nextRow()
1008+
controls.showAllItemAffixes = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Show all item affixes sliders:", function(state)
1009+
self.showAllItemAffixes = state
1010+
end)
1011+
controls.showAllItemAffixes.tooltipText = "Display all item affix slots as a stacked list instead of hiding them in dropdowns"
10011012

10021013
nextRow()
10031014
drawSectionHeader("build", "Build-related options")
@@ -1089,6 +1100,7 @@ function main:OpenOptionsPopup()
10891100
--controls.showPublicBuilds.state = self.showPublicBuilds
10901101
controls.showFlavourText.state = self.showFlavourText
10911102
controls.showAnimations.state = self.showAnimations
1103+
controls.showAllItemAffixes.state = self.showAllItemAffixes
10921104
local initialNodePowerTheme = self.nodePowerTheme
10931105
local initialColorPositive = self.colorPositive
10941106
local initialColorNegative = self.colorNegative
@@ -1110,6 +1122,7 @@ function main:OpenOptionsPopup()
11101122
--local initialShowPublicBuilds = self.showPublicBuilds
11111123
local initialShowFlavourText = self.showFlavourText
11121124
local initialShowAnimations = self.showAnimations
1125+
local initialShowAllItemAffixes = self.showAllItemAffixes
11131126
local initialDpiScaleOverridePercent = self.dpiScaleOverridePercent
11141127

11151128
-- last line with buttons has more spacing
@@ -1165,6 +1178,7 @@ function main:OpenOptionsPopup()
11651178
self.showPublicBuilds = initialShowPublicBuilds
11661179
self.showFlavourText = initialShowFlavourText
11671180
self.showAnimations = initialShowAnimations
1181+
self.showAllItemAffixes = initialShowAllItemAffixes
11681182
self.dpiScaleOverridePercent = initialDpiScaleOverridePercent
11691183
SetDPIScaleOverridePercent(self.dpiScaleOverridePercent)
11701184
main:ClosePopup()

0 commit comments

Comments
 (0)