From a07351c4ea7014fff7ff6917c14512a9a970b699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1?= <46632393+luskanek@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:12:06 +0100 Subject: [PATCH] reduced-actionbar: switch bags via drag-drop to bag frame icon allow to pick up or replace a bag from a bag slot by clicking on the portrait of a container frame. --- mods/reduced-actionbar.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mods/reduced-actionbar.lua b/mods/reduced-actionbar.lua index 5d94f8e..5e87868 100644 --- a/mods/reduced-actionbar.lua +++ b/mods/reduced-actionbar.lua @@ -1,3 +1,5 @@ +local _G = ShaguTweaks.GetGlobalEnv() + local module = ShaguTweaks:register({ title = "Reduced Actionbar Size", description = "Reduces the actionbar size by removing several items such as the bag panel and microbar", @@ -6,6 +8,18 @@ local module = ShaguTweaks:register({ enabled = nil, }) +local function ReplaceBag() + local id = this:GetID() + if id ~= 0 then + id = ContainerIDToInventoryID(id) + if CursorHasItem() then + PutItemInBag(id) + else + PickupBagFromSlot(id) + end + end +end + module.enable = function(self) -- general function to hide textures and frames local function hide(frame, texture) @@ -135,4 +149,9 @@ module.enable = function(self) local pet_offset = PetActionBarFrame:IsVisible() and 40 or 0 CastingBarFrame:SetPoint("BOTTOM", anchor, "TOP", 0, 10 + pet_offset) end + + -- enable picking up/replacing bags by clicking on the container frame portrait + for i = 1, 5 do + _G["ContainerFrame" .. i .. "PortraitButton"]:SetScript("OnClick", ReplaceBag) + end end