Keep Max Price and Max Level between Trade Queries (#8586)
* Keep Max Price and Max Level between Trade Queries * Fix use of spaces instead of tabs --------- Co-authored-by: LocalIdentity <localidentity2@gmail.com>
This commit is contained in:
@@ -109,7 +109,9 @@ local TradeQueryGeneratorClass = newClass("TradeQueryGenerator", function(self,
|
||||
self.queryTab = queryTab
|
||||
self.itemsTab = queryTab.itemsTab
|
||||
self.calcContext = { }
|
||||
|
||||
self.lastMaxPrice = nil
|
||||
self.lastMaxPriceTypeIndex = nil
|
||||
self.lastMaxLevel = nil
|
||||
end)
|
||||
|
||||
local function fetchStats()
|
||||
@@ -655,7 +657,37 @@ function TradeQueryGeneratorClass:OnFrame()
|
||||
end
|
||||
end
|
||||
|
||||
local currencyTable = {
|
||||
{ name = "Chaos Orb Equivalent", id = nil },
|
||||
{ name = "Chaos Orb", id = "chaos" },
|
||||
{ name = "Divine Orb", id = "divine" },
|
||||
{ name = "Orb of Alchemy", id = "alch" },
|
||||
{ name = "Orb of Alteration", id = "alt" },
|
||||
{ name = "Chromatic Orb", id = "chrome" },
|
||||
{ name = "Exalted Orb", id = "exalted" },
|
||||
{ name = "Blessed Orb", id = "blessed" },
|
||||
{ name = "Cartographer's Chisel", id = "chisel" },
|
||||
{ name = "Gemcutter's Prism", id = "gcp" },
|
||||
{ name = "Jeweller's Orb", id = "jewellers" },
|
||||
{ name = "Orb of Scouring", id = "scour" },
|
||||
{ name = "Orb of Regret", id = "regret" },
|
||||
{ name = "Orb of Fusing", id = "fusing" },
|
||||
{ name = "Orb of Chance", id = "chance" },
|
||||
{ name = "Regal Orb", id = "regal" },
|
||||
{ name = "Vaal Orb", id = "vaal" }
|
||||
}
|
||||
|
||||
function TradeQueryGeneratorClass:StartQuery(slot, options)
|
||||
if self.lastMaxPrice then
|
||||
options.maxPrice = self.lastMaxPrice
|
||||
end
|
||||
if self.lastMaxPriceTypeIndex then
|
||||
options.maxPriceType = currencyTable[self.lastMaxPriceTypeIndex].id
|
||||
end
|
||||
if self.lastMaxLevel then
|
||||
options.maxLevel = self.lastMaxLevel
|
||||
end
|
||||
|
||||
-- Figure out what type of item we're searching for
|
||||
local existingItem = slot and self.itemsTab.items[slot.selItemId]
|
||||
local testItemType = existingItem and existingItem.baseName or "Unset Amulet"
|
||||
@@ -924,12 +956,12 @@ function TradeQueryGeneratorClass:FinishQuery()
|
||||
end
|
||||
end
|
||||
if not options.includeMirrored then
|
||||
queryTable.query.filters.misc_filters = {
|
||||
disabled = false,
|
||||
filters = {
|
||||
mirrored = false,
|
||||
}
|
||||
}
|
||||
queryTable.query.filters.misc_filters = {
|
||||
disabled = false,
|
||||
filters = {
|
||||
mirrored = false,
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
if options.maxPrice and options.maxPrice > 0 then
|
||||
@@ -1075,35 +1107,19 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb
|
||||
end
|
||||
|
||||
-- Add max price limit selection dropbox
|
||||
local currencyTable = {
|
||||
{ name = "Chaos Orb Equivalent", id = nil },
|
||||
{ name = "Chaos Orb", id = "chaos" },
|
||||
{ name = "Divine Orb", id = "divine" },
|
||||
{ name = "Orb of Alchemy", id = "alch" },
|
||||
{ name = "Orb of Alteration", id = "alt" },
|
||||
{ name = "Chromatic Orb", id = "chrome" },
|
||||
{ name = "Exalted Orb", id = "exalted" },
|
||||
{ name = "Blessed Orb", id = "blessed" },
|
||||
{ name = "Cartographer's Chisel", id = "chisel" },
|
||||
{ name = "Gemcutter's Prism", id = "gcp" },
|
||||
{ name = "Jeweller's Orb", id = "jewellers" },
|
||||
{ name = "Orb of Scouring", id = "scour" },
|
||||
{ name = "Orb of Regret", id = "regret" },
|
||||
{ name = "Orb of Fusing", id = "fusing" },
|
||||
{ name = "Orb of Chance", id = "chance" },
|
||||
{ name = "Regal Orb", id = "regal" },
|
||||
{ name = "Vaal Orb", id = "vaal" }
|
||||
}
|
||||
local currencyDropdownNames = { }
|
||||
for _, currency in ipairs(currencyTable) do
|
||||
t_insert(currencyDropdownNames, currency.name)
|
||||
end
|
||||
controls.maxPrice = new("EditControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, {0, 5, 70, 18}, nil, nil, "%D")
|
||||
controls.maxPrice.buf = self.lastMaxPrice and tostring(self.lastMaxPrice) or ""
|
||||
controls.maxPriceType = new("DropDownControl", {"LEFT",controls.maxPrice,"RIGHT"}, {5, 0, 150, 18}, currencyDropdownNames, nil)
|
||||
controls.maxPriceType.selIndex = self.lastMaxPriceTypeIndex or 1
|
||||
controls.maxPriceLabel = new("LabelControl", {"RIGHT",controls.maxPrice,"LEFT"}, {-5, 0, 0, 16}, "^7Max Price:")
|
||||
updateLastAnchor(controls.maxPrice)
|
||||
|
||||
controls.maxLevel = new("EditControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, {0, 5, 100, 18}, nil, nil, "%D")
|
||||
controls.maxLevel.buf = self.lastMaxLevel and tostring(self.lastMaxLevel) or ""
|
||||
controls.maxLevelLabel = new("LabelControl", {"RIGHT",controls.maxLevel,"LEFT"}, {-5, 0, 0, 16}, "Max Level:")
|
||||
updateLastAnchor(controls.maxLevel)
|
||||
|
||||
@@ -1180,10 +1196,13 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb
|
||||
end
|
||||
if controls.maxPrice.buf then
|
||||
options.maxPrice = tonumber(controls.maxPrice.buf)
|
||||
self.lastMaxPrice = options.maxPrice
|
||||
options.maxPriceType = currencyTable[controls.maxPriceType.selIndex].id
|
||||
self.lastMaxPriceTypeIndex = controls.maxPriceType.selIndex
|
||||
end
|
||||
if controls.maxLevel.buf then
|
||||
options.maxLevel = tonumber(controls.maxLevel.buf)
|
||||
self.lastMaxLevel = options.maxLevel
|
||||
end
|
||||
if controls.sockets and controls.sockets.buf then
|
||||
options.sockets = tonumber(controls.sockets.buf)
|
||||
|
||||
Reference in New Issue
Block a user