Skip to content

Commit d5e938f

Browse files
authored
Add total minimum weights parameter and logic to timeless jewel finder to filter out results that are below this value (#8787)
1 parent f1a6ca5 commit d5e938f

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/Classes/TreeTab.lua

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,6 +1916,17 @@ function TreeTabClass:FindTimelessJewel()
19161916
tooltip:Clear()
19171917
tooltip:AddLine(16, "^7Click this button to generate new fallback node weights, replacing your old ones.")
19181918
end
1919+
controls.totalMinimumWeightLabel = new("LabelControl", {"TOPRIGHT", nil, "TOPLEFT"}, {405, 250, 0, 16}, "^7Total Minimum Weight:")
1920+
controls.totalMinimumWeight = new("EditControl", {"LEFT", controls.totalMinimumWeightLabel, "RIGHT"}, {10, 0, 60, 18}, "", nil, "%D", nil, function(val)
1921+
local num = tonumber(val)
1922+
timelessData.totalMinimumWeight = num or nil
1923+
self.build.modFlag = true
1924+
end)
1925+
controls.totalMinimumWeight.tooltipFunc = function(tooltip, mode, index, value)
1926+
tooltip:Clear()
1927+
tooltip:AddLine(16, "^7Optional: Only show results where total weight meets or exceeds this value.")
1928+
end
1929+
19191930

19201931
controls.searchListButton = new("ButtonControl", {"TOPLEFT", nil, "TOPLEFT"}, {12, 250, 106, 20}, "^7Desired Nodes", function()
19211932
if controls.searchListFallback.shown then
@@ -1964,7 +1975,7 @@ function TreeTabClass:FindTimelessJewel()
19641975
controls.searchListFallback.enabled = false
19651976
controls.searchListFallback:SetText(timelessData.searchListFallback and timelessData.searchListFallback or "")
19661977

1967-
controls.searchResultsLabel = new("LabelControl", { "TOPLEFT", nil, "TOPRIGHT" }, { -450, 250, 0, 16 }, "^7Search Results:")
1978+
controls.searchResultsLabel = new("LabelControl", { "TOPLEFT", nil, "TOPRIGHT" }, { -390, 250, 0, 16 }, "^7Results:")
19681979
controls.searchResults = new("TimelessJewelListControl", { "TOPLEFT", nil, "TOPRIGHT" }, { -450, 275, 438, 200 }, self.build)
19691980
controls.searchTradeLeagueSelect = new("DropDownControl", { "BOTTOMRIGHT", controls.searchResults, "TOPRIGHT" }, { -175, -5, 140, 20 }, nil, function(_, value)
19701981
self.timelessJewelLeagueSelect = value
@@ -2359,7 +2370,9 @@ function TreeTabClass:FindTimelessJewel()
23592370
end
23602371
local searchResultsIdx = 1
23612372
for seedMatch, seedData in pairs(resultNodes) do
2362-
if seedWeights[seedMatch] > 0 then
2373+
-- filter out the results so that only the ones that beat the total minimum weight parameter remain in search results
2374+
local passesMin = (not timelessData.totalMinimumWeight) or (seedWeights[seedMatch] >= timelessData.totalMinimumWeight)
2375+
if seedWeights[seedMatch] > 0 and passesMin then
23632376
timelessData.searchResults[searchResultsIdx] = { label = seedMatch .. ":" }
23642377
if timelessData.jewelType.id == 1 or timelessData.jewelType.id == 3 then
23652378
-- Glorious Vanity [100-8000], Brutal Restraint [500-8000]

0 commit comments

Comments
 (0)