From 1b3237c35afab69486adc7467a3df20b6478e6ad Mon Sep 17 00:00:00 2001 From: Mickael Cagnion Date: Thu, 20 Mar 2025 15:52:48 +0100 Subject: [PATCH 1/2] [PATCH 1/2] Keep Max Price and Max Level between Trade Queries --- src/Classes/TradeQueryGenerator.lua | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Classes/TradeQueryGenerator.lua b/src/Classes/TradeQueryGenerator.lua index 194e761963..6537a39d51 100644 --- a/src/Classes/TradeQueryGenerator.lua +++ b/src/Classes/TradeQueryGenerator.lua @@ -98,7 +98,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() @@ -569,6 +571,16 @@ function TradeQueryGeneratorClass:OnFrame() end 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 "Diamond" @@ -945,11 +957,14 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb 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) @@ -1001,10 +1016,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) From ba406f7963d415d2ecb046a02f4d78f2579044fd Mon Sep 17 00:00:00 2001 From: LocalIdentity Date: Fri, 6 Jun 2025 22:54:19 +1000 Subject: [PATCH 2/2] [PATCH 2/2] Fix use of spaces instead of tabs --- src/Classes/TradeQueryGenerator.lua | 39 +++++++++++++++-------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Classes/TradeQueryGenerator.lua b/src/Classes/TradeQueryGenerator.lua index 6537a39d51..b9ce061093 100644 --- a/src/Classes/TradeQueryGenerator.lua +++ b/src/Classes/TradeQueryGenerator.lua @@ -570,6 +570,20 @@ function TradeQueryGeneratorClass:OnFrame() end end +local currencyTable = { + { name = "Relative", id = nil }, + { name = "Exalted Orb", id = "exalted" }, + { name = "Chaos Orb", id = "chaos" }, + { name = "Divine Orb", id = "divine" }, + { name = "Orb of Augmentation", id = "aug" }, + { name = "Orb of Transmutation", id = "transmute" }, + { name = "Regal Orb", id = "regal" }, + { name = "Vaal Orb", id = "vaal" }, + { name = "Annulment Orb", id = "annul" }, + { name = "Orb of Alchemy", id = "alch" }, + { name = "Mirror of Kalandra", id = "mirror" } +} + function TradeQueryGeneratorClass:StartQuery(slot, options) if self.lastMaxPrice then options.maxPrice = self.lastMaxPrice @@ -842,12 +856,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 @@ -939,19 +953,6 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb end -- Add max price limit selection dropbox - local currencyTable = { - { name = "Relative", id = nil }, - { name = "Exalted Orb", id = "exalted" }, - { name = "Chaos Orb", id = "chaos" }, - { name = "Divine Orb", id = "divine" }, - { name = "Orb of Augmentation", id = "aug" }, - { name = "Orb of Transmutation", id = "transmute" }, - { name = "Regal Orb", id = "regal" }, - { name = "Vaal Orb", id = "vaal" }, - { name = "Annulment Orb", id = "annul" }, - { name = "Orb of Alchemy", id = "alch" }, - { name = "Mirror of Kalandra", id = "mirror" } - } local currencyDropdownNames = { } for _, currency in ipairs(currencyTable) do t_insert(currencyDropdownNames, currency.name)