Skip to content

Commit 6d43d9c

Browse files
committed
Add "Buy similar" button to display item controls
1 parent a82a33b commit 6d43d9c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/Classes/ItemsTab.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ local m_min = math.min
1414
local m_ceil = math.ceil
1515
local m_floor = math.floor
1616
local m_modf = math.modf
17+
local buySimilar = LoadModule("Classes/CompareBuySimilar")
1718

1819
local rarityDropList = {
1920
{ label = colorCodes.NORMAL.."Normal", rarity = "NORMAL" },
@@ -409,6 +410,15 @@ holding Shift will put it in the second.]])
409410
self:SetDisplayItem()
410411
end)
411412

413+
self.controls.displayItemBuySimilar = new("ButtonControl",
414+
{ "LEFT", self.controls.removeDisplayItem, "RIGHT", true },
415+
{ 8, 0, 100, 20 }, "Buy similar", function()
416+
local itemSlot = self:GetComparisonSlotNameForItem(self.displayItem)
417+
buySimilar.openPopup(self.displayItem, itemSlot, self.build)
418+
end)
419+
self.controls.displayItemBuySimilar.shown = function()
420+
return self.displayItem
421+
end
412422
-- Section: Variant(s)
413423

414424
self.controls.displayItemSectionVariant = new("Control", {"TOPLEFT",self.controls.addDisplayItem,"BOTTOMLEFT"}, {0, 8, 0, function()

0 commit comments

Comments
 (0)