From a18e7636d2b1efc0e73cc25f65fb7dabd88c1500 Mon Sep 17 00:00:00 2001 From: LocalIdentity Date: Sun, 15 Mar 2026 06:56:47 +1100 Subject: [PATCH] Fix PoB Trader not prioritising local weapon mods The PR #9394 made a change to sort the stat list by weight instead of the meanStatDiff like we had it before. This was prioritising high value mods that contributed a low total sum to the item and was forcing the search to ignore low weight but high value mods like local weapon damage rolls --- src/Classes/TradeQueryGenerator.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Classes/TradeQueryGenerator.lua b/src/Classes/TradeQueryGenerator.lua index d3894e4b3a..29772bead4 100644 --- a/src/Classes/TradeQueryGenerator.lua +++ b/src/Classes/TradeQueryGenerator.lua @@ -916,6 +916,9 @@ function TradeQueryGeneratorClass:FinishQuery() -- Sort by mean Stat diff rather than weight to more accurately prioritize stats that can contribute more table.sort(self.modWeights, function(a, b) + if a.meanStatDiff == b.meanStatDiff then + return math.abs(a.weight) > math.abs(b.weight) + end return a.meanStatDiff > b.meanStatDiff end) @@ -968,9 +971,6 @@ function TradeQueryGeneratorClass:FinishQuery() local effective_max = MAX_FILTERS - num_extra - -- Prioritize top mods by abs(weight) - table.sort(self.modWeights, function(a, b) return math.abs(a.weight) > math.abs(b.weight) end) - local prioritizedMods = {} for _, entry in ipairs(self.modWeights) do if #prioritizedMods < effective_max then