CurseForge and Overwolf are joining forces!
Awesome More Information
  • 0

    posted a message on oUF pet health
    sometimes have such problem



    I use oUF. How can I fix it?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Hiding bags (aBags)
    Quote from Arrowmaster
    Bagnon...


    I need an addon without GUI (no cargbags)
    Can you advice smth?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Hiding bags (aBags)
    I have some problems with aBags from ALZA UI. I want addon to hide the bag with soulshardes if class = WARLOCK

    by I have this problem
    http://img708.imageshack.us/img708/7099/wowscrnshot021610233646.jpg

    LUA:
    local Spacing = 2
    local Columns = 9
    local NumBankBags = 7
    local BankColumns = 13
    local _, class = UnitClass"player"
    local _G = getfenv(0)
    local bu, con, col, row
    local buttons, bankbuttons = {}, {}
    local firstopened, firstbankopened = 1, 1
    
    
    
    
    
    [B]if(class=="WARLOCK") then
    NumBags = 4
    else
    NumBags = 5
    end[/B]
    
    
    
    --[[ Function to move buttons ]]
    local MoveButtons = function(table, frame, columns)
    	col, row = 0, 0
    	for i = 1, #table do
    		bu = table[i]
    		bu:ClearAllPoints()
    		bu:SetPoint("TOPLEFT", frame, "TOPLEFT", col * (37 + Spacing), -1 * row * (37 + Spacing))
    		bu.SetPoint = dummy
    		if(col > (columns - 2)) then
    			col = 0
    			row = row + 1
    		else
    			col = col + 1
    		end
    	end
    
    	frame:SetHeight((row + (col==0 and 0 or 1)) * (37 + Spacing) + 16)
    	frame:SetWidth(columns * 37 + Spacing * (columns - 1))
    end
    
    --[[ Bags ]]
    local holder = CreateFrame("Button", "aBagsHolder", UIParent)
    holder:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -10, 340)
    holder:SetFrameStrata("HIGH")
    holder:Hide()
    
    CreateBG(holder):SetTexture(0, 0, 0, .7)
    
    local ReanchorButtons = function()
    	if(firstopened==1) then
    		for f = 1, NumBags do
    			con = "ContainerFrame"..f
    			_G[con]:EnableMouse(false)
    			_G[con.."CloseButton"]:Hide()
    			_G[con.."PortraitButton"]:EnableMouse(false)
    
    			for i = 1, 7 do
    				select(i, _G[con]:GetRegions()):SetAlpha(0)
    			end
    
    			for i = GetContainerNumSlots(f-1), 1, -1  do
    				bu = _G[con.."Item"..i]
    				bu:SetFrameStrata("HIGH")
    				tinsert(buttons, bu)
    			end
    		end
    		MoveButtons(buttons, holder, Columns)
    		firstopened = 0
    	end
    	holder:Show()
    end
    
    local money = _G["ContainerFrame1MoneyFrame"]
    money:SetFrameStrata("DIALOG")
    money:SetParent(holder)
    money:ClearAllPoints()
    money:SetPoint("BOTTOMRIGHT", holder, "BOTTOMRIGHT", 12, 2)
    
    --[[ Bank ]]
    local bankholder = CreateFrame("Button", "aBagsBankHolder", UIParent)
    bankholder:SetFrameStrata("HIGH")
    bankholder:Hide()
    
    CreateBG(bankholder):SetTexture(0, 0, 0, .7)
    
    local ReanchorBankButtons = function()
    	if(firstbankopened==1) then
    		for f = 1, 28 do
    			bu = _G["BankFrameItem"..f]
    			bu:SetFrameStrata("HIGH")
    			tinsert(bankbuttons, bu)
    		end
    		_G["BankFrame"]:EnableMouse(false)
    		_G["BankCloseButton"]:Hide()
    
    		for f = 1, 5 do
    			select(f, _G["BankFrame"]:GetRegions()):SetAlpha(0)
    		end
    
    		for f = NumBags + 1, NumBags + NumBankBags, 1 do
    			con = "ContainerFrame"..f
    			_G[con]:EnableMouse(false)
    			_G[con.."CloseButton"]:Hide()
    			_G[con.."PortraitButton"]:EnableMouse(false)
    
    			for i = 1, 7 do
    				select(i, _G[con]:GetRegions()):SetAlpha(0)
    			end
    
    			for i = GetContainerNumSlots(f-1), 1, -1  do
    				bu = _G[con.."Item"..i]
    				bu:SetFrameStrata("HIGH")
    				tinsert(bankbuttons, bu)
    			end
    		end
    		MoveButtons(bankbuttons, bankholder, BankColumns)
    		bankholder:SetPoint("BOTTOMRIGHT", "aBagsHolder", "BOTTOMLEFT", -10 , 0)
    		firstbankopened = 0
    	end
    	bankholder:Show()
    end
    
    local money = _G["BankFrameMoneyFrame"]
    money:SetFrameStrata("DIALOG")
    money:ClearAllPoints()
    money:SetPoint("BOTTOMRIGHT", bankholder, "BOTTOMRIGHT", 12, 2)
    
    --[[ Hiding misc. frames ]]
    _G["BankFramePurchaseInfo"]:Hide()
    _G["BankFramePurchaseInfo"].Show = dummy
    
    for f = 1, 7 do _G["BankFrameBag"..f]:Hide() end
     
    --[[ Show & Hide functions etc ]]
    tinsert(UISpecialFrames, bankholder)
    tinsert(UISpecialFrames, holder)
    
    local CloseBags = function()
    	bankholder:Hide()
    	holder:Hide()
    	for i = 0, 11 do
    		CloseBag(i)
    	end
    end
    
    local OpenBags = function()
    	for i = 0, 11 do
    		OpenBag(i)
    	end
    end
    
    local ToggleBags = function()
    	if(IsBagOpen(0)) then
    		CloseBankFrame()
    		CloseBags()
    	else
    		OpenBags()
    	end
    end
    
    hooksecurefunc(_G["ContainerFrame"..NumBags], "Show", ReanchorButtons)
    hooksecurefunc(_G["ContainerFrame"..NumBags], "Hide", CloseBags)
    hooksecurefunc(BankFrame, "Show", function()
    	OpenBags()
    	ReanchorBankButtons()
    end)
    hooksecurefunc(BankFrame, "Hide", CloseBags)
    
    ToggleBackpack = ToggleBags
    OpenAllBags = ToggleBags
    OpenBackpack = OpenBags
    CloseBackpack = CloseBags
    CloseAllBags = CloseBags


    If I change NumBags from 5 to 4, I have problem as on screenshot
    Can you help me, plz?
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.