Skip to content

Commit ebfe128

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 f7cc078 commit ebfe128

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
@@ -2009,18 +2009,18 @@ function TreeTabClass:FindTimelessJewel()
20092009
controls.searchTradeButton = new("ButtonControl", { "BOTTOMRIGHT", controls.searchResults, "TOPRIGHT" }, { 0, -5, 170, 20 }, "Copy Trade URL", function()
20102010
local seedTrades = {}
20112011
local startRow = controls.searchResults.selIndex or 1
2012-
local endRow = startRow + m_floor(10 / ((timelessData.sharedResults.conqueror.id == 1) and 3 or 1))
20132012
if controls.searchResults.highlightIndex then
20142013
startRow = m_min(controls.searchResults.selIndex, controls.searchResults.highlightIndex)
2015-
endRow = m_max(controls.searchResults.selIndex, controls.searchResults.highlightIndex)
20162014
end
2015+
-- query complexity limit appears to be 188
2016+
local endRow = startRow + m_floor(188 / ((timelessData.sharedResults.conqueror.id == 1) and 3 or 1))
20172017

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

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

2033-
controls.searchTradeButton.lastSearch = {startRow, seedCount}
2033+
controls.searchTradeButton.lastSearch = {startRow, endRow}
20342034

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

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

0 commit comments

Comments
 (0)