Skip to content

Commit 07429bf

Browse files
committed
change in person selection to be a dropdown of the ones that are on the trade site
1 parent fec4aa7 commit 07429bf

2 files changed

Lines changed: 27 additions & 9 deletions

File tree

src/Classes/TradeQuery.lua

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,22 @@ You can click this button to enter your POESESSID.
278278
on trade site to work on other leagues and realms)]]
279279

280280
-- Buyout selection
281-
self.controls.includeInPerson = new("CheckBoxControl", { "TOPRIGHT", self.controls.poesessidButton, "BOTTOMRIGHT" },
282-
{ 0, row_vertical_padding, row_height }, "Include in person:", function(state) end,
283-
"This includes in person offers in the search results.", false)
281+
self.tradeTypes = {
282+
"Instant buyout",
283+
"Instant buyout and in person",
284+
"In person (online in league)",
285+
"In person (online)",
286+
"Any",
287+
}
288+
289+
self.controls.tradeTypeSelection = new("DropDownControl", { "TOPLEFT", self.controls.poesessidButton, "BOTTOMLEFT" },
290+
{ 0, row_vertical_padding, 188, row_height }, self.tradeTypes, function(index, value)
291+
self.tradeTypeIndex = index
292+
end)
293+
-- remember previous choice
294+
self.controls.tradeTypeSelection:SetSel(self.tradeTypeIndex or 1)
284295

285-
-- Fetches Box
296+
-- Fetches Box
286297
self.maxFetchPerSearchDefault = 2
287298
self.controls.fetchCountEdit = new("EditControl", {"TOPRIGHT", nil, "TOPRIGHT"}, {-12, 19, 154, row_height}, "", "Fetch Pages", "%D", 3, function(buf)
288299
self.maxFetchPages = m_min(m_max(tonumber(buf) or self.maxFetchPerSearchDefault, 1), 10)

src/Classes/TradeQueryGenerator.lua

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,16 @@ function TradeQueryGeneratorClass:FinishQuery()
10031003
-- This Stat diff value will generally be higher than the weighted sum of the same item, because the stats are all applied at once and can thus multiply off each other.
10041004
-- So apply a modifier to get a reasonable min and hopefully approximate that the query will start out with small upgrades.
10051005
local minWeight = megalomaniacSpecialMinWeight or currentStatDiff * 0.5
1006-
1006+
1007+
-- what the trade site API uses for the above
1008+
self.tradeTypes = {
1009+
"securable",
1010+
"available",
1011+
"onlineleague",
1012+
"online",
1013+
"any",
1014+
}
1015+
local selectedTradeType = self.tradeTypes[self.tradeTypeIndex]
10071016
-- Generate trade query str and open in browser
10081017
local filters = 0
10091018
local queryTable = {
@@ -1016,7 +1025,7 @@ function TradeQueryGeneratorClass:FinishQuery()
10161025
}
10171026
}
10181027
},
1019-
status = { option = self.includeInPerson and "available" or "securable" },
1028+
status = { option = selectedTradeType },
10201029
stats = {
10211030
{
10221031
type = "weight",
@@ -1302,9 +1311,7 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb
13021311
controls.generateQuery = new("ButtonControl", { "BOTTOM", nil, "BOTTOM" }, {-45, -10, 80, 20}, "Execute", function()
13031312
main:ClosePopup()
13041313

1305-
if context.controls.includeInPerson then
1306-
self.includeInPerson = context.controls.includeInPerson.state
1307-
end
1314+
self.tradeTypeIndex = context.controls.tradeTypeSelection.selIndex
13081315

13091316
if controls.includeMirrored then
13101317
self.lastIncludeMirrored, options.includeMirrored = controls.includeMirrored.state, controls.includeMirrored.state

0 commit comments

Comments
 (0)