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.
This commit is contained in:
Lukáš
2024-01-25 23:12:06 +01:00
committed by GitHub
parent 4ec2494fc6
commit a07351c4ea
+19
View File
@@ -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