diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index d3ffb571c..26a61b899 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -14,6 +14,7 @@ local m_min = math.min local m_ceil = math.ceil local m_floor = math.floor local m_modf = math.modf +local buySimilar = LoadModule("Classes/CompareBuySimilar") local rarityDropList = { { label = colorCodes.NORMAL.."Normal", rarity = "NORMAL" }, @@ -409,6 +410,15 @@ holding Shift will put it in the second.]]) self:SetDisplayItem() end) + self.controls.displayItemBuySimilar = new("ButtonControl", + { "LEFT", self.controls.removeDisplayItem, "RIGHT", true }, + { 8, 0, 100, 20 }, "Buy similar", function() + local itemSlot = self:GetComparisonSlotNameForItem(self.displayItem) + buySimilar.openPopup(self.displayItem, itemSlot, self.build) + end) + self.controls.displayItemBuySimilar.shown = function() + return self.displayItem + end -- Section: Variant(s) self.controls.displayItemSectionVariant = new("Control", {"TOPLEFT",self.controls.addDisplayItem,"BOTTOMLEFT"}, {0, 8, 0, function() diff --git a/src/Classes/TradeHelpers.lua b/src/Classes/TradeHelpers.lua index 228f244e1..a0961d38c 100644 --- a/src/Classes/TradeHelpers.lua +++ b/src/Classes/TradeHelpers.lua @@ -168,6 +168,10 @@ end ---@return number? value returned if the mod is an option and uses values. e.g. timeless jewel function M.findTradeHash(item, modLine, modType, isDesecrated) local formattedLine = M.formatDatabaseText(modLine) + -- hack for belt implicits not matching. TODO: use stat_descriptions instead, which define what + -- description is the canonical form that is used on the trade site, either by assuming it's the + -- first one, or one with a marker called "canonical_line" + formattedLine = formattedLine:gsub("Has # Charm Slots", "Has # Charm Slot") -- the data export splits some mods into different parts, even though they -- are technically just one stat. we handle that here local isUnique = item.rarity == "UNIQUE" or item.rarity == "RELIC" @@ -252,8 +256,8 @@ function M.findTradeHash(item, modLine, modType, isDesecrated) end end end - -- essence mods don't seem to have spawn weights and are tested last - for _, dbMod in pairs(data.itemMods.Item) do + -- essence and emotion mods don't seem to have spawn weights and are tested last + for _, dbMod in pairs(item.affixes) do local tradeHashMaybe = findStat(dbMod, true) if tradeHashMaybe then return tradeHashMaybe