From 568b6c8edc1355a0180f1d1c1ef6db59ec0ad535 Mon Sep 17 00:00:00 2001 From: outlying Date: Tue, 13 Jan 2026 22:07:28 +0100 Subject: [PATCH 1/2] Only buy button at trader --- Core.lua | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/Core.lua b/Core.lua index 1486016..66afa85 100644 --- a/Core.lua +++ b/Core.lua @@ -357,26 +357,34 @@ end -- Overrides standard function for split dialog -local function OpenFrame(self, maxStack, parent, anchor, anchorTo, stackCount) - - ClearDialog() - dialog = CreateItemSplitterDialog(maxStack) - dialog:ClearAllPoints() - dialog:SetPoint(anchor, parent, anchorTo, 0, 0) +local function OpenFrame(self, maxStack, parent, anchor, anchorTo, stackCount) + + ClearDialog() + dialog = CreateItemSplitterDialog(maxStack) + dialog:ClearAllPoints() + dialog:SetPoint(anchor, parent, anchorTo, 0, 0) dialog.editBox:SetScript("OnEditFocusGained", function(self) C_Timer.After(0.1, function() self:HighlightText() end) end) - dialog.editBox:SetFocus() - + dialog.editBox:SetFocus() + local isGuildBank, bagIndex, slotIndex, forceBankScope = SourceLocation(parent) - - dialog.splitButton:SetScript("OnClick", function() - parent.SplitStack(parent, dialog:GetValue()) -- original behaviour - ClearDialog() - end) - + local isMerchant = MerchantFrame and MerchantFrame:IsVisible() + + if isMerchant then + dialog.autoSplitButton:Hide() + dialog.splitButton:SetText("Buy") + dialog.splitButton:ClearAllPoints() + dialog.splitButton:SetPoint("BOTTOM", dialog, "BOTTOM", 0, 10) + end + + dialog.splitButton:SetScript("OnClick", function() + parent.SplitStack(parent, dialog:GetValue()) -- original behaviour + ClearDialog() + end) + dialog.autoSplitButton:SetScript("OnClick", function () DisableDialog() StartAutomaticSplitSession(isGuildBank, bagIndex, slotIndex, dialog:GetValue(), forceBankScope) From a3227ceee9e2bf60f4fb752ebce1653f3cae7544 Mon Sep 17 00:00:00 2001 From: outlying Date: Tue, 13 Jan 2026 22:19:19 +0100 Subject: [PATCH 2/2] Buy/Sell work --- Core.lua | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/Core.lua b/Core.lua index 66afa85..bb99b06 100644 --- a/Core.lua +++ b/Core.lua @@ -269,9 +269,9 @@ end ]] local function SourceLocation(parent) - local parentName = parent:GetName() - local parentParentName = nil - local parentParentParentName = nil + local parentName = parent:GetName() + local parentParentName = nil + local parentParentParentName = nil if parent:GetParent() and parent:GetParent():GetName() then parentParentName = parent:GetParent():GetName() @@ -285,11 +285,13 @@ local function SourceLocation(parent) local bagIndex = parent:GetParent():GetID() local slotIndex = parent:GetID() local forceBankScope = false - - local locationBagIndex, locationSlotIndex = nil, nil - if parent and parent:GetItemLocation() and parent:GetItemLocation():GetBagAndSlot() then - locationBagIndex, locationSlotIndex = parent:GetItemLocation():GetBagAndSlot() - end + local hasItemLocation = false + + local locationBagIndex, locationSlotIndex = nil, nil + if parent and parent:GetItemLocation() and parent:GetItemLocation():GetBagAndSlot() then + locationBagIndex, locationSlotIndex = parent:GetItemLocation():GetBagAndSlot() + hasItemLocation = locationBagIndex ~= nil and locationSlotIndex ~= nil + end ns.printParentNames(parent) @@ -352,7 +354,7 @@ local function SourceLocation(parent) slotIndex = parent:GetContainerSlotID() end - return isGuildBank, bagIndex, slotIndex, forceBankScope + return isGuildBank, bagIndex, slotIndex, forceBankScope, hasItemLocation end -- Overrides standard function for split dialog @@ -370,18 +372,27 @@ local function OpenFrame(self, maxStack, parent, anchor, anchorTo, stackCount) end) dialog.editBox:SetFocus() - local isGuildBank, bagIndex, slotIndex, forceBankScope = SourceLocation(parent) + local isGuildBank, bagIndex, slotIndex, forceBankScope, hasItemLocation = SourceLocation(parent) local isMerchant = MerchantFrame and MerchantFrame:IsVisible() if isMerchant then dialog.autoSplitButton:Hide() - dialog.splitButton:SetText("Buy") dialog.splitButton:ClearAllPoints() dialog.splitButton:SetPoint("BOTTOM", dialog, "BOTTOM", 0, 10) + if hasItemLocation then + dialog.splitButton:SetText("Sell") + else + dialog.splitButton:SetText("Buy") + end end dialog.splitButton:SetScript("OnClick", function() - parent.SplitStack(parent, dialog:GetValue()) -- original behaviour + local splitValue = dialog:GetValue() + if self and type(self.split) == "function" then + self.split(splitValue) + else + parent.SplitStack(parent, splitValue) -- original behaviour + end ClearDialog() end)