Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/Classes/TradeQuery.lua
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,20 @@ Highest Weight - Displays the order retrieved from trade]]
-- self:PullPoENinjaCurrencyConversion(self.pbLeague)
end)
self.controls.pbNotice = new("LabelControl", {"BOTTOMRIGHT", nil, "BOTTOMRIGHT"}, {-row_height - pane_margins_vertical - row_vertical_padding, -pane_margins_vertical - row_height - row_vertical_padding, 300, row_height}, "")

-- Add Trade Mode dropdown to the bottom right
self.tradeModeList = {
"Instant Buyout and In Person Trade",
"Instant Buyout Only",
"In Person Trade Only",
"Any"
}
self.pbTradeModeSelectionIndex = 3 -- Default to "In Person Trade Only"
self.controls.tradeModeSelection = new("DropDownControl", {"BOTTOMRIGHT", nil, "BOTTOMRIGHT"}, {-pane_margins_horizontal, -pane_margins_vertical, 220, row_height}, self.tradeModeList, function(index, value)
self.pbTradeModeSelectionIndex = index
end)
self.controls.tradeModeSelection:SetSel(self.pbTradeModeSelectionIndex)
self.controls.tradeModeSelection.enableDroppedWidth = true

-- Realm selection
self.controls.realmLabel = new("LabelControl", {"LEFT", self.controls.setSelect, "RIGHT"}, {18, 0, 20, row_height - 4}, "^7Realm:")
Expand Down Expand Up @@ -844,7 +858,7 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro
local nameColor = slotTbl.unique and colorCodes.UNIQUE or "^7"
controls["name"..row_idx] = new("LabelControl", top_pane_alignment_ref, {0, row_idx*(row_height + row_vertical_padding), 100, row_height - 4}, nameColor..slotTbl.slotName)
controls["bestButton"..row_idx] = new("ButtonControl", { "LEFT", controls["name"..row_idx], "LEFT"}, {100 + 8, 0, 80, row_height}, "Find best", function()
self.tradeQueryGenerator:RequestQuery(activeSlot, { slotTbl = slotTbl, controls = controls, row_idx = row_idx }, self.statSortSelectionList, function(context, query, errMsg)
self.tradeQueryGenerator:RequestQuery(activeSlot, { slotTbl = slotTbl, controls = controls, row_idx = row_idx }, self.statSortSelectionList, self.pbTradeModeSelectionIndex, function(context, query, errMsg)
if errMsg then
self:SetNotice(context.controls.pbNotice, colorCodes.NEGATIVE .. errMsg)
return
Expand Down
8 changes: 6 additions & 2 deletions src/Classes/TradeQueryGenerator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,9 @@ function TradeQueryGeneratorClass:FinishQuery()
-- So apply a modifier to get a reasonable min and hopefully approximate that the query will start out with small upgrades.
local minWeight = megalomaniacSpecialMinWeight or currentStatDiff * 0.5

local tradeModeMap = { "available", "securable", "online", "any" }
local tradeMode = tradeModeMap[self.calcContext.options.tradeModeIndex] or "online"

-- Generate trade query str and open in browser
local filters = 0
local queryTable = {
Expand All @@ -829,7 +832,7 @@ function TradeQueryGeneratorClass:FinishQuery()
}
}
},
status = { option = "online" },
status = { option = tradeMode },
stats = {
{
type = "weight",
Expand Down Expand Up @@ -910,7 +913,7 @@ function TradeQueryGeneratorClass:FinishQuery()
main:ClosePopup()
end

function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callback)
function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, tradeModeIndex, callback)
self.requesterCallback = callback
self.requesterContext = context

Expand Down Expand Up @@ -1029,6 +1032,7 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb
options.sockets = tonumber(controls.sockets.buf)
end
options.statWeights = statWeights
options.tradeModeIndex = tradeModeIndex

self:StartQuery(slot, options)
end)
Expand Down