Skip to content

Commit 35d9ff6

Browse files
committed
Timeless Jewel Finder: Intelligent batching
Instead of fixed batch size of 4 it's now automatically sized to include similar power jewels.
1 parent dfb6ce3 commit 35d9ff6

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/Classes/TreeTab.lua

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,18 +2010,18 @@ function TreeTabClass:FindTimelessJewel()
20102010
controls.searchTradeButton = new("ButtonControl", { "BOTTOMRIGHT", controls.searchResults, "TOPRIGHT" }, { 0, -5, 170, 20 }, "Copy Trade URL", function()
20112011
local seedTrades = {}
20122012
local startRow = controls.searchResults.selIndex or 1
2013-
local endRow = startRow + m_floor(10 / ((timelessData.sharedResults.conqueror.id == 1) and 3 or 1))
20142013
if controls.searchResults.highlightIndex then
20152014
startRow = m_min(controls.searchResults.selIndex, controls.searchResults.highlightIndex)
2016-
endRow = m_max(controls.searchResults.selIndex, controls.searchResults.highlightIndex)
20172015
end
2016+
-- query complexity limit appears to be 188
2017+
local endRow = startRow + m_floor(188 / ((timelessData.sharedResults.conqueror.id == 1) and 3 or 1))
20182018

2019-
local seedCount = m_min(#timelessData.searchResults - startRow, endRow - startRow) + 1
2019+
local seedCount = m_min(#timelessData.searchResults - startRow, endRow - startRow)
20202020
-- update if not highlighted already
20212021

20222022
local prevSearch = controls.searchTradeButton.lastSearch
2023-
if prevSearch and prevSearch[1] == startRow and prevSearch[2] == seedCount then
2024-
startRow = endRow + 1
2023+
if prevSearch and prevSearch[1] == startRow then
2024+
startRow = prevSearch[2] + 1
20252025
if (startRow > #timelessData.searchResults) then
20262026
return
20272027
end
@@ -2031,11 +2031,17 @@ function TreeTabClass:FindTimelessJewel()
20312031
controls.searchResults.selIndex = startRow
20322032
controls.searchResults.highlightIndex = endRow
20332033

2034-
controls.searchTradeButton.lastSearch = {startRow, seedCount}
2034+
controls.searchTradeButton.lastSearch = {startRow, endRow}
20352035

20362036
for i = startRow, startRow + seedCount - 1 do
20372037
local result = timelessData.searchResults[i]
20382038

2039+
if result.total / timelessData.searchResults[startRow].total < 0.998 then
2040+
controls.searchResults.highlightIndex = i - 1
2041+
controls.searchTradeButton.lastSearch = {startRow, i - 1}
2042+
break
2043+
end
2044+
20392045
local conquerorKeystoneTradeIds = data.timelessJewelTradeIDs[timelessData.jewelType.id].keystone
20402046
local conquerorTradeIds = { conquerorKeystoneTradeIds[1], conquerorKeystoneTradeIds[2], conquerorKeystoneTradeIds[3] }
20412047
if timelessData.sharedResults.conqueror.id > 1 then

0 commit comments

Comments
 (0)