mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-29 18:56:02 +00:00
performance tweaks for bags
the whole bag thing needs a rewrite
This commit is contained in:
+278
-243
@@ -1,46 +1,6 @@
|
||||
pfUI:RegisterModule("bags", function ()
|
||||
|
||||
-- remove this function to avoid vertexcolor updates on item buttons
|
||||
function SetItemButtonNormalTextureVertexColor () return end
|
||||
|
||||
pfUI.bag = CreateFrame("Frame", "pfBag")
|
||||
pfUI.bag:SetFrameStrata("HIGH")
|
||||
pfUI.bag:SetPoint("BOTTOMLEFT", pfUI.chat.right, "BOTTOMLEFT", 0, 0)
|
||||
pfUI.bag:SetPoint("BOTTOMRIGHT", pfUI.chat.right, "BOTTOMRIGHT", 0, 0)
|
||||
pfUI.bag:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.bag:Hide()
|
||||
|
||||
pfUI.bag.bagframe = CreateFrame("Frame", "pfBagBags", pfUI.bag)
|
||||
pfUI.bag.bagframe:SetFrameStrata("MEDIUM")
|
||||
pfUI.bag.bagframe:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.bag.bagframe:Hide()
|
||||
|
||||
pfUI.bank = CreateFrame("Frame", "pfBank")
|
||||
pfUI.bank:SetFrameStrata("HIGH")
|
||||
pfUI.bank:SetPoint("BOTTOMLEFT", pfUI.chat.left, "BOTTOMLEFT", 0, 0)
|
||||
pfUI.bank:SetPoint("BOTTOMRIGHT", pfUI.chat.left, "BOTTOMRIGHT", 0, 0)
|
||||
pfUI.bank:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.bank:Hide()
|
||||
|
||||
pfUI.bank.bagframe = CreateFrame("Frame", "pfBankBags", pfUI.bank)
|
||||
pfUI.bank.bagframe:SetFrameStrata("MEDIUM")
|
||||
pfUI.bank.bagframe:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.bank.bagframe:Hide()
|
||||
|
||||
for i=1, 6 do
|
||||
local bag = getglobal("BankFrameBag" .. i)
|
||||
bag:SetNormalTexture(nil)
|
||||
bag:SetPushedTexture(nil)
|
||||
bag:SetBackdrop(
|
||||
{ bgFile = texture, tile = false, tileSize = pfUI_config.unitframes.buff_size,
|
||||
edgeFile = "Interface\\AddOns\\pfUI\\img\\border_col", edgeSize = 8,
|
||||
insets = { left = 0, right = 0, top = 0, bottom = 0}
|
||||
})
|
||||
bag:SetBackdropBorderColor(.3,.3,.3,1)
|
||||
end
|
||||
|
||||
tinsert(UISpecialFrames,"pfBag");
|
||||
|
||||
-- overwrite some bag functions
|
||||
function OpenAllBags()
|
||||
if pfUI.bag:IsShown() then
|
||||
pfUI.bag:Hide()
|
||||
@@ -74,8 +34,23 @@ pfUI:RegisterModule("bags", function ()
|
||||
end
|
||||
end
|
||||
|
||||
function ToggleBag() end
|
||||
function ToggleBag()
|
||||
return
|
||||
end
|
||||
|
||||
-- avoid vertexcolor updates on item buttons
|
||||
function SetItemButtonNormalTextureVertexColor () return end
|
||||
|
||||
-- bags
|
||||
pfUI.bag = CreateFrame("Frame", "pfBag")
|
||||
pfUI.bag:SetFrameStrata("HIGH")
|
||||
pfUI.bag:SetPoint("BOTTOMLEFT", pfUI.chat.right, "BOTTOMLEFT", 0, 0)
|
||||
pfUI.bag:SetPoint("BOTTOMRIGHT", pfUI.chat.right, "BOTTOMRIGHT", 0, 0)
|
||||
pfUI.bag:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.bag.button_size = (pfUI.bag:GetWidth() - pfUI_config.bars.border*3) / 10 - pfUI_config.bars.border
|
||||
pfUI.bag:Hide()
|
||||
|
||||
-- bag parents
|
||||
for i=1, 5 do
|
||||
pfUI.bag[i] = CreateFrame("Frame")
|
||||
pfUI.bag[i]:SetID(i-1)
|
||||
@@ -83,13 +58,141 @@ pfUI:RegisterModule("bags", function ()
|
||||
pfUI.bag[i]:SetAllPoints(pfUI.bag)
|
||||
end
|
||||
|
||||
for i=6, 12 do
|
||||
pfUI.bank[i] = CreateFrame("Frame")
|
||||
pfUI.bank[i]:SetID(i-1)
|
||||
pfUI.bank[i]:SetParent(pfUI.bank)
|
||||
pfUI.bank[i]:SetAllPoints(pfUI.bank)
|
||||
-- bag overview panel
|
||||
pfUI.bag.bagframe = CreateFrame("Frame", "pfBagBags", pfUI.bag)
|
||||
pfUI.bag.bagframe:SetFrameStrata("MEDIUM")
|
||||
pfUI.bag.bagframe:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.bag.bagframe:Hide()
|
||||
|
||||
function pfUI.bag:UpdateBag(arg1)
|
||||
if not pfUI.bag.initialized then
|
||||
pfUI.bag.initialized = "yes"
|
||||
pfUI.bag:SetupPositions()
|
||||
return
|
||||
end
|
||||
|
||||
for i=1, GetContainerNumSlots(arg1) do
|
||||
local f = getglobal("ContainerFrame" .. arg1 + 1 .. "Item" .. i)
|
||||
if f then
|
||||
local texture, itemCount, locked, quality, readable = GetContainerItemInfo(arg1, i);
|
||||
f:SetNormalTexture(nil)
|
||||
|
||||
f:SetBackdrop(
|
||||
{ bgFile = texture, tile = false, tileSize = pfUI_config.unitframes.buff_size,
|
||||
edgeFile = "Interface\\AddOns\\pfUI\\img\\border_col", edgeSize = 8,
|
||||
insets = { left = 0, right = 0, top = 0, bottom = 0}
|
||||
})
|
||||
|
||||
if quality and quality > 1 then
|
||||
f:SetBackdropBorderColor(GetItemQualityColor(quality))
|
||||
else
|
||||
f:SetBackdropBorderColor(.3,.3,.3,1)
|
||||
end
|
||||
|
||||
SetItemButtonCount(getglobal("ContainerFrame" .. arg1 + 1 .. "Item" .. i), itemCount);
|
||||
if ( texture ) then
|
||||
local cooldown = getglobal(getglobal("ContainerFrame" .. arg1 + 1 .. "Item" .. i):GetName().."Cooldown");
|
||||
local start, duration, enable = GetContainerItemCooldown(arg1, getglobal("ContainerFrame" .. arg1 + 1 .. "Item" .. i):GetID());
|
||||
CooldownFrame_SetTimer(cooldown, start, duration, enable);
|
||||
if ( duration > 0 and enable == 0 ) then
|
||||
SetItemButtonTextureVertexColor(button, 0.4, 0.4, 0.4);
|
||||
end
|
||||
getglobal("ContainerFrame" .. arg1 + 1 .. "Item" .. i .. "Cooldown"):Show();
|
||||
else
|
||||
getglobal("ContainerFrame" .. arg1 + 1 .. "Item" .. i .. "Cooldown"):Hide();
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function pfUI.bag:SetupPositions()
|
||||
-- setup bag positions
|
||||
local x = -1
|
||||
local y = 0
|
||||
local x_max = 10
|
||||
pfUI.bag.button_size = (pfUI.bag:GetWidth() - pfUI_config.bars.border*3) / 10 - pfUI_config.bars.border
|
||||
|
||||
for i=0, NUM_BAG_SLOTS do
|
||||
pfUI.bag:UpdateBag(i)
|
||||
end
|
||||
|
||||
for j=1, 5 do
|
||||
for i=1, GetContainerNumSlots(j-1) do
|
||||
x = x + 1
|
||||
if x >= x_max then y = y + 1; x = 0 end
|
||||
getglobal("ContainerFrame" .. j).size = GetContainerNumSlots(j-1)
|
||||
local f = getglobal("ContainerFrame" .. j .. "Item" .. i)
|
||||
f:SetParent(pfUI.bag[j])
|
||||
f:SetID(i)
|
||||
f:SetPoint("TOPLEFT", pfUI.bag, "TOPLEFT", pfUI_config.bars.border*2 + x*pfUI.bag.button_size + x*pfUI_config.bars.border, -pfUI_config.bars.border*2 - y*pfUI.bag.button_size - y * pfUI_config.bars.border - 17)
|
||||
f:Show()
|
||||
f:SetHeight(pfUI.bag.button_size)
|
||||
f:SetWidth(pfUI.bag.button_size)
|
||||
|
||||
getglobal("ContainerFrame" .. j .. "Item" .. i .. "Count"):SetPoint("BOTTOMLEFT", 0,0)
|
||||
getglobal("ContainerFrame" .. j .. "Item" .. i .. "Count"):SetFont("Interface\\AddOns\\pfUI\\fonts\\arial.ttf", pfUI_config.global.font_size, "OUTLINE")
|
||||
|
||||
for i,v in ipairs({f:GetRegions()}) do
|
||||
if i == 4 then v:SetAlpha(0) end
|
||||
end
|
||||
end
|
||||
end
|
||||
y = y + 1
|
||||
pfUI.bag:SetHeight( y * pfUI.bag.button_size + y * pfUI_config.bars.border + pfUI_config.bars.border*3 + 17 + 17)
|
||||
|
||||
-- setup bag overview panel
|
||||
pfUI.bag.bagframe:SetPoint("BOTTOMLEFT", pfUI.bag, "TOPLEFT", 0, pfUI_config.bars.border)
|
||||
pfUI.bag.bagframe:SetWidth(3 * pfUI_config.bars.border + 4*(pfUI_config.bars.border+pfUI.bag.button_size))
|
||||
pfUI.bag.bagframe:SetHeight(pfUI.bag.button_size + 2 * (pfUI_config.bars.border*2))
|
||||
|
||||
for i=0, 3 do
|
||||
local bag = getglobal("CharacterBag" .. i .. "Slot")
|
||||
bag:ClearAllPoints()
|
||||
bag:SetParent(pfUI.bag.bagframe)
|
||||
bag:SetWidth(pfUI.bag.button_size)
|
||||
bag:SetHeight(pfUI.bag.button_size)
|
||||
bag:SetNormalTexture(nil)
|
||||
bag:SetPushedTexture(nil)
|
||||
bag:SetBackdrop(
|
||||
{ bgFile = texture, tile = false, tileSize = pfUI_config.unitframes.buff_size,
|
||||
edgeFile = "Interface\\AddOns\\pfUI\\img\\border_col", edgeSize = 8,
|
||||
insets = { left = 0, right = 0, top = 0, bottom = 0}
|
||||
})
|
||||
|
||||
bag:SetBackdropBorderColor(.3,.3,.3,1)
|
||||
bag.SetBackdrop = function () return end
|
||||
|
||||
bag:SetPoint("TOPLEFT", pfUI.bag.bagframe, "TOPLEFT", pfUI_config.bars.border*2 + i*pfUI.bag.button_size + i*pfUI_config.bars.border, -pfUI_config.bars.border*2)
|
||||
bag:SetAlpha(1)
|
||||
bag:Show()
|
||||
end
|
||||
end
|
||||
|
||||
-- close pfUI.bag on escape
|
||||
tinsert(UISpecialFrames,"pfBag");
|
||||
|
||||
pfUI.bag:SetScript("OnShow", function ()
|
||||
pfUI.bag:SetupPositions()
|
||||
end)
|
||||
|
||||
-- bag events (all necessary?)
|
||||
pfUI.bag:RegisterEvent("BAG_UPDATE");
|
||||
pfUI.bag:SetScript("OnEvent", function()
|
||||
pfUI.bag:UpdateBag(arg1)
|
||||
end)
|
||||
|
||||
-- bag money display
|
||||
pfUI.bag.money = CreateFrame("Frame", "pfUIBagsMoney", pfUI.bag, "SmallMoneyFrameTemplate")
|
||||
pfUI.bag.money:ClearAllPoints()
|
||||
pfUI.bag.money:SetPoint("TOPRIGHT", pfUI.bag, "TOPRIGHT", -13, -6)
|
||||
pfUIBagsMoneyGoldButton:SetFont("Interface\\AddOns\\pfUI\\fonts\\arial.ttf", pfUI_config.global.font_size, "OUTLINE")
|
||||
for i,v in ipairs({pfUIBagsMoneyGoldButton:GetRegions()}) do if i == 1 then v:SetHeight(10); v:SetWidth(10) end end
|
||||
pfUIBagsMoneySilverButton:SetFont("Interface\\AddOns\\pfUI\\fonts\\arial.ttf", pfUI_config.global.font_size, "OUTLINE")
|
||||
for i,v in ipairs({pfUIBagsMoneySilverButton:GetRegions()}) do if i == 1 then v:SetHeight(10); v:SetWidth(10) end end
|
||||
pfUIBagsMoneyCopperButton:SetFont("Interface\\AddOns\\pfUI\\fonts\\arial.ttf", pfUI_config.global.font_size, "OUTLINE")
|
||||
for i,v in ipairs({pfUIBagsMoneyCopperButton:GetRegions()}) do if i == 1 then v:SetHeight(10); v:SetWidth(10) end end
|
||||
|
||||
-- bag close button
|
||||
pfUI.bag.close = CreateFrame("Button")
|
||||
pfUI.bag.close:SetParent(pfUI.bag)
|
||||
pfUI.bag.close:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
||||
@@ -124,6 +227,7 @@ pfUI:RegisterModule("bags", function ()
|
||||
end
|
||||
end)
|
||||
|
||||
-- bag search
|
||||
pfUI.bag.search = CreateFrame("Frame", pfUI.bag)
|
||||
pfUI.bag.search:SetParent(pfUI.bag)
|
||||
pfUI.bag.search:SetHeight(15)
|
||||
@@ -208,229 +312,160 @@ pfUI:RegisterModule("bags", function ()
|
||||
end
|
||||
end)
|
||||
|
||||
pfUI.bag.money = CreateFrame("Frame", "pfUIBagsMoney", pfUI.bag, "SmallMoneyFrameTemplate")
|
||||
pfUI.bag.money:ClearAllPoints()
|
||||
pfUI.bag.money:SetPoint("TOPRIGHT", pfUI.bag, "TOPRIGHT", -13, -6)
|
||||
pfUIBagsMoneyGoldButton:SetFont("Interface\\AddOns\\pfUI\\fonts\\arial.ttf", pfUI_config.global.font_size, "OUTLINE")
|
||||
for i,v in ipairs({pfUIBagsMoneyGoldButton:GetRegions()}) do if i == 1 then v:SetHeight(10); v:SetWidth(10) end end
|
||||
pfUIBagsMoneySilverButton:SetFont("Interface\\AddOns\\pfUI\\fonts\\arial.ttf", pfUI_config.global.font_size, "OUTLINE")
|
||||
for i,v in ipairs({pfUIBagsMoneySilverButton:GetRegions()}) do if i == 1 then v:SetHeight(10); v:SetWidth(10) end end
|
||||
pfUIBagsMoneyCopperButton:SetFont("Interface\\AddOns\\pfUI\\fonts\\arial.ttf", pfUI_config.global.font_size, "OUTLINE")
|
||||
for i,v in ipairs({pfUIBagsMoneyCopperButton:GetRegions()}) do if i == 1 then v:SetHeight(10); v:SetWidth(10) end end
|
||||
pfUI.bag:RegisterEvent("BAG_UPDATE");
|
||||
pfUI.bag:RegisterEvent("BAG_CLOSED");
|
||||
pfUI.bag:RegisterEvent("BAG_OPEN");
|
||||
pfUI.bag:RegisterEvent("BAG_UPDATE_COOLDOWN");
|
||||
pfUI.bag:RegisterEvent("ITEM_LOCK_CHANGED");
|
||||
pfUI.bag:RegisterEvent("UPDATE_INVENTORY_ALERTS")
|
||||
pfUI.bag:SetScript("OnEvent", function()
|
||||
local x = -1
|
||||
local y = 0
|
||||
local x_max = 10
|
||||
-- bank
|
||||
pfUI.bank = CreateFrame("Frame", "pfBank")
|
||||
pfUI.bank:SetFrameStrata("HIGH")
|
||||
pfUI.bank:SetPoint("BOTTOMLEFT", pfUI.chat.left, "BOTTOMLEFT", 0, 0)
|
||||
pfUI.bank:SetPoint("BOTTOMRIGHT", pfUI.chat.left, "BOTTOMRIGHT", 0, 0)
|
||||
pfUI.bank:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.bank:Hide()
|
||||
|
||||
local button_size = (this:GetWidth() - pfUI_config.bars.border*3) / x_max - pfUI_config.bars.border
|
||||
pfUI.bank.bagframe = CreateFrame("Frame", "pfBankBags", pfUI.bank)
|
||||
pfUI.bank.bagframe:SetFrameStrata("MEDIUM")
|
||||
pfUI.bank.bagframe:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.bank.bagframe:Hide()
|
||||
|
||||
pfUI.bag.bagframe:SetPoint("BOTTOMLEFT", pfUI.bag, "TOPLEFT", 0, pfUI_config.bars.border)
|
||||
pfUI.bag.bagframe:SetWidth(3 * pfUI_config.bars.border + 4*(pfUI_config.bars.border+button_size))
|
||||
pfUI.bag.bagframe:SetHeight(button_size + 2 * (pfUI_config.bars.border*2))
|
||||
-- skin the bank-bag overview
|
||||
for i=1, 6 do
|
||||
local bag = getglobal("BankFrameBag" .. i)
|
||||
bag:SetNormalTexture(nil)
|
||||
bag:SetPushedTexture(nil)
|
||||
bag:SetBackdrop(
|
||||
{ bgFile = texture, tile = false, tileSize = pfUI_config.unitframes.buff_size,
|
||||
edgeFile = "Interface\\AddOns\\pfUI\\img\\border_col", edgeSize = 8,
|
||||
insets = { left = 0, right = 0, top = 0, bottom = 0}
|
||||
})
|
||||
bag:SetBackdropBorderColor(.3,.3,.3,1)
|
||||
end
|
||||
|
||||
for i=0, 3 do
|
||||
local bag = getglobal("CharacterBag" .. i .. "Slot")
|
||||
bag:ClearAllPoints()
|
||||
bag:SetParent(pfUI.bag.bagframe)
|
||||
bag:SetWidth(button_size)
|
||||
bag:SetHeight(button_size)
|
||||
bag:SetNormalTexture(nil)
|
||||
bag:SetPushedTexture(nil)
|
||||
bag:SetBackdrop(
|
||||
{ bgFile = texture, tile = false, tileSize = pfUI_config.unitframes.buff_size,
|
||||
edgeFile = "Interface\\AddOns\\pfUI\\img\\border_col", edgeSize = 8,
|
||||
insets = { left = 0, right = 0, top = 0, bottom = 0}
|
||||
})
|
||||
|
||||
bag:SetBackdropBorderColor(.3,.3,.3,1)
|
||||
bag.SetBackdrop = function () return end
|
||||
|
||||
bag:SetPoint("TOPLEFT", pfUI.bag.bagframe, "TOPLEFT", pfUI_config.bars.border*2 + i*button_size + i*pfUI_config.bars.border, -pfUI_config.bars.border*2)
|
||||
bag:SetAlpha(1)
|
||||
bag:Show()
|
||||
end
|
||||
|
||||
|
||||
for j=1, 5 do
|
||||
for i=1, GetContainerNumSlots(j-1) do
|
||||
x = x + 1
|
||||
if x >= x_max then y = y + 1; x = 0 end
|
||||
|
||||
getglobal("ContainerFrame" .. j).size = GetContainerNumSlots(j-1)
|
||||
f = getglobal("ContainerFrame" .. j .. "Item" .. i)
|
||||
f:SetParent(pfUI.bag[j])
|
||||
f:SetID(i)
|
||||
f:SetPoint("TOPLEFT", pfUI.bag, "TOPLEFT", pfUI_config.bars.border*2 + x*button_size + x*pfUI_config.bars.border, -pfUI_config.bars.border*2 - y*button_size - y * pfUI_config.bars.border - 17)
|
||||
f:Show()
|
||||
f:SetHeight(button_size)
|
||||
f:SetWidth(button_size)
|
||||
local texture, itemCount, locked, quality, readable = GetContainerItemInfo(j-1, i);
|
||||
f:SetNormalTexture(nil)
|
||||
|
||||
f:SetBackdrop(
|
||||
{ bgFile = texture, tile = false, tileSize = pfUI_config.unitframes.buff_size,
|
||||
edgeFile = "Interface\\AddOns\\pfUI\\img\\border_col", edgeSize = 8,
|
||||
insets = { left = 0, right = 0, top = 0, bottom = 0}
|
||||
})
|
||||
if quality and quality > 1 then
|
||||
f:SetBackdropBorderColor(GetItemQualityColor(quality))
|
||||
else
|
||||
f:SetBackdropBorderColor(.3,.3,.3,1)
|
||||
end
|
||||
|
||||
SetItemButtonCount(getglobal("ContainerFrame" .. j .. "Item" .. i), itemCount);
|
||||
if ( texture ) then
|
||||
local cooldown = getglobal(getglobal("ContainerFrame" .. j .. "Item" .. i):GetName().."Cooldown");
|
||||
local start, duration, enable = GetContainerItemCooldown(j-1, getglobal("ContainerFrame" .. j .. "Item" .. i):GetID());
|
||||
CooldownFrame_SetTimer(cooldown, start, duration, enable);
|
||||
if ( duration > 0 and enable == 0 ) then
|
||||
SetItemButtonTextureVertexColor(button, 0.4, 0.4, 0.4);
|
||||
end
|
||||
getglobal("ContainerFrame" .. j .. "Item" .. i .. "Cooldown"):Show();
|
||||
else
|
||||
getglobal("ContainerFrame" .. j .. "Item" .. i .. "Cooldown"):Hide();
|
||||
end
|
||||
|
||||
getglobal("ContainerFrame" .. j .. "Item" .. i .. "Count"):SetPoint("BOTTOMLEFT", 0,0)
|
||||
getglobal("ContainerFrame" .. j .. "Item" .. i .. "Count"):SetFont("Interface\\AddOns\\pfUI\\fonts\\arial.ttf", pfUI_config.global.font_size, "OUTLINE")
|
||||
|
||||
for i,v in ipairs({f:GetRegions()}) do
|
||||
-- 2 is stack count
|
||||
if i == 4 then v:SetAlpha(0) end
|
||||
end
|
||||
end
|
||||
end
|
||||
y = y + 1
|
||||
pfUI.bag:SetHeight( y * button_size + y * pfUI_config.bars.border + pfUI_config.bars.border*3 + 17 + 17)
|
||||
end)
|
||||
for i=6, 12 do
|
||||
pfUI.bank[i] = CreateFrame("Frame")
|
||||
pfUI.bank[i]:SetID(i-1)
|
||||
pfUI.bank[i]:SetParent(pfUI.bank)
|
||||
pfUI.bank[i]:SetAllPoints(pfUI.bank)
|
||||
end
|
||||
|
||||
pfUI.bank:RegisterEvent("BAG_UPDATE");
|
||||
pfUI.bank:RegisterEvent("BANKFRAME_OPENED");
|
||||
pfUI.bank:RegisterEvent("BANKFRAME_CLOSED");
|
||||
pfUI.bank:RegisterEvent("BAG_UPDATE_COOLDOWN");
|
||||
pfUI.bank:RegisterEvent("ITEM_LOCK_CHANGED");
|
||||
pfUI.bank:RegisterEvent("UPDATE_INVENTORY_ALERTS")
|
||||
pfUI.bank:RegisterEvent("BANKFRAME_OPENED");
|
||||
pfUI.bank:RegisterEvent("PLAYERBANKSLOTS_CHANGED");
|
||||
pfUI.bank:RegisterEvent("PLAYERBANKBAGSLOTS_CHANGED");
|
||||
pfUI.bank:SetScript("OnEvent", function()
|
||||
BankFrame:SetWidth(.1)
|
||||
BankFrame:SetHeight(.1)
|
||||
BankFrame:SetAlpha(0)
|
||||
if event == "BANKFRAME_OPENED" then pfUI.bank:Show(); pfUI.bag:Show() end
|
||||
if event == "BANKFRAME_CLOSED" then pfUI.bank:Hide(); HideUIPanel(this) end
|
||||
|
||||
if event == "BANKFRAME_OPENED" then pfUI.bank:Show(); pfUI.bag:Show() end
|
||||
if event == "BANKFRAME_CLOSED" then pfUI.bank:Hide(); HideUIPanel(this) end
|
||||
if not pfUI.bank:IsShown() and pfUI.bank.initialized then
|
||||
message("ignore")
|
||||
pfUI.bank.initialized = "yes"
|
||||
return
|
||||
end
|
||||
|
||||
local x = -1
|
||||
local y = 0
|
||||
local x_max = 10
|
||||
BankFrame:SetWidth(.1)
|
||||
BankFrame:SetHeight(.1)
|
||||
BankFrame:SetAlpha(0)
|
||||
|
||||
local button_size = (this:GetWidth() - pfUI_config.bars.border*3) / x_max - pfUI_config.bars.border
|
||||
local x = -1
|
||||
local y = 0
|
||||
local x_max = 10
|
||||
|
||||
-- put bagslots into pfUI bagslot frame
|
||||
pfUI.bank.bagframe:SetPoint("BOTTOMLEFT", pfUI.bank, "TOPLEFT", 0, pfUI_config.bars.border)
|
||||
pfUI.bank.bagframe:SetWidth(3 * pfUI_config.bars.border + 6*(pfUI_config.bars.border+button_size))
|
||||
pfUI.bank.bagframe:SetHeight(button_size + 2 * (pfUI_config.bars.border*2))
|
||||
local button_size = (this:GetWidth() - pfUI_config.bars.border*3) / x_max - pfUI_config.bars.border
|
||||
|
||||
BankFramePurchaseButton:SetParent(pfUI.bank.bagframe)
|
||||
BankFramePurchaseButton:SetAlpha(1)
|
||||
BankFramePurchaseButton:SetWidth(button_size)
|
||||
BankFramePurchaseButton:SetHeight(button_size)
|
||||
BankFramePurchaseButton:SetPoint("RIGHT", pfUI.bank.bagframe, "RIGHT", -pfUI_config.bars.border*2, 0)
|
||||
BankFramePurchaseButton:SetText("+")
|
||||
BankFramePurchaseButton:SetBackdrop(pfUI.backdrop)
|
||||
BankFramePurchaseButton:SetNormalTexture(nil)
|
||||
BankFramePurchaseButton:SetPushedTexture(nil)
|
||||
if BankFramePurchaseInfo:IsShown() then
|
||||
pfUI.bank.bagframe:SetWidth(pfUI.bank.bagframe:GetWidth() + button_size + pfUI_config.bars.border)
|
||||
-- put bagslots into pfUI bagslot frame
|
||||
pfUI.bank.bagframe:SetPoint("BOTTOMLEFT", pfUI.bank, "TOPLEFT", 0, pfUI_config.bars.border)
|
||||
pfUI.bank.bagframe:SetWidth(3 * pfUI_config.bars.border + 6*(pfUI_config.bars.border+button_size))
|
||||
pfUI.bank.bagframe:SetHeight(button_size + 2 * (pfUI_config.bars.border*2))
|
||||
|
||||
BankFramePurchaseButton:SetParent(pfUI.bank.bagframe)
|
||||
BankFramePurchaseButton:SetAlpha(1)
|
||||
BankFramePurchaseButton:SetWidth(button_size)
|
||||
BankFramePurchaseButton:SetHeight(button_size)
|
||||
BankFramePurchaseButton:SetPoint("RIGHT", pfUI.bank.bagframe, "RIGHT", -pfUI_config.bars.border*2, 0)
|
||||
BankFramePurchaseButton:SetText("+")
|
||||
BankFramePurchaseButton:SetBackdrop(pfUI.backdrop)
|
||||
BankFramePurchaseButton:SetNormalTexture(nil)
|
||||
BankFramePurchaseButton:SetPushedTexture(nil)
|
||||
if BankFramePurchaseInfo:IsShown() then
|
||||
pfUI.bank.bagframe:SetWidth(pfUI.bank.bagframe:GetWidth() + button_size + pfUI_config.bars.border)
|
||||
end
|
||||
|
||||
for i=1, 6 do
|
||||
local bag = getglobal("BankFrameBag" .. i)
|
||||
bag:ClearAllPoints()
|
||||
bag:SetParent(pfUI.bank.bagframe)
|
||||
bag:SetWidth(button_size)
|
||||
bag:SetHeight(button_size)
|
||||
bag:SetNormalTexture(nil)
|
||||
bag:SetPushedTexture(nil)
|
||||
bag:SetBackdrop(
|
||||
{ bgFile = texture, tile = false, tileSize = pfUI_config.unitframes.buff_size,
|
||||
edgeFile = "Interface\\AddOns\\pfUI\\img\\border_col", edgeSize = 8,
|
||||
insets = { left = 0, right = 0, top = 0, bottom = 0}
|
||||
})
|
||||
bag:SetBackdropBorderColor(.3,.3,.3,1)
|
||||
bag.SetBackdrop = function () return end
|
||||
|
||||
bag:SetPoint("TOPLEFT", pfUI.bank.bagframe, "TOPLEFT", pfUI_config.bars.border*2 + (i-1)*button_size + (i-1)*pfUI_config.bars.border, -pfUI_config.bars.border*2)
|
||||
bag:SetAlpha(1)
|
||||
end
|
||||
|
||||
for j=5, 11 do
|
||||
local frame, container = nil
|
||||
if j == 5 then
|
||||
frame = "BankFrame"
|
||||
container = -1
|
||||
else
|
||||
frame = "ContainerFrame" .. j
|
||||
container = j - 1
|
||||
end
|
||||
|
||||
for i=1, 6 do
|
||||
local bag = getglobal("BankFrameBag" .. i)
|
||||
bag:ClearAllPoints()
|
||||
bag:SetParent(pfUI.bank.bagframe)
|
||||
bag:SetWidth(button_size)
|
||||
bag:SetHeight(button_size)
|
||||
bag:SetNormalTexture(nil)
|
||||
bag:SetPushedTexture(nil)
|
||||
bag:SetBackdrop(
|
||||
{ bgFile = texture, tile = false, tileSize = pfUI_config.unitframes.buff_size,
|
||||
edgeFile = "Interface\\AddOns\\pfUI\\img\\border_col", edgeSize = 8,
|
||||
insets = { left = 0, right = 0, top = 0, bottom = 0}
|
||||
})
|
||||
bag:SetBackdropBorderColor(.3,.3,.3,1)
|
||||
bag.SetBackdrop = function () return end
|
||||
for i=1, GetContainerNumSlots(container) do
|
||||
x = x + 1
|
||||
if x >= x_max then y = y + 1; x = 0 end
|
||||
getglobal(frame).size = GetContainerNumSlots(j-1)
|
||||
f = getglobal(frame .. "Item" .. i)
|
||||
if j == 5 then f:SetParent(pfUI.bank[12]) else f:SetParent(pfUI.bank[j]) end
|
||||
f:Show()
|
||||
f:SetID(i)
|
||||
f:SetPoint("TOPLEFT", pfUI.bank, "TOPLEFT", pfUI_config.bars.border*2 + x*button_size + x*pfUI_config.bars.border, -pfUI_config.bars.border*2 - y*button_size - y * pfUI_config.bars.border)
|
||||
f:SetAlpha(1)
|
||||
f:SetHeight(button_size)
|
||||
f:SetWidth(button_size)
|
||||
local texture, itemCount, locked, quality, readable = GetContainerItemInfo(container, i);
|
||||
f:SetNormalTexture(nil)
|
||||
|
||||
bag:SetPoint("TOPLEFT", pfUI.bank.bagframe, "TOPLEFT", pfUI_config.bars.border*2 + (i-1)*button_size + (i-1)*pfUI_config.bars.border, -pfUI_config.bars.border*2)
|
||||
bag:SetAlpha(1)
|
||||
end
|
||||
|
||||
for j=5, 11 do
|
||||
local frame, container = nil
|
||||
if j == 5 then
|
||||
frame = "BankFrame"
|
||||
container = -1
|
||||
f:SetBackdrop(
|
||||
{ bgFile = texture, tile = false, tileSize = pfUI_config.unitframes.buff_size,
|
||||
edgeFile = "Interface\\AddOns\\pfUI\\img\\border_col", edgeSize = 8,
|
||||
insets = { left = 0, right = 0, top = 0, bottom = 0}
|
||||
})
|
||||
if quality and quality > 1 then
|
||||
f:SetBackdropBorderColor(GetItemQualityColor(quality))
|
||||
else
|
||||
frame = "ContainerFrame" .. j
|
||||
container = j - 1
|
||||
f:SetBackdropBorderColor(.3,.3,.3,1)
|
||||
end
|
||||
|
||||
for i=1, GetContainerNumSlots(container) do
|
||||
x = x + 1
|
||||
if x >= x_max then y = y + 1; x = 0 end
|
||||
getglobal(frame).size = GetContainerNumSlots(j-1)
|
||||
f = getglobal(frame .. "Item" .. i)
|
||||
if j == 5 then f:SetParent(pfUI.bank[12]) else f:SetParent(pfUI.bank[j]) end
|
||||
f:Show()
|
||||
f:SetID(i)
|
||||
f:SetPoint("TOPLEFT", pfUI.bank, "TOPLEFT", pfUI_config.bars.border*2 + x*button_size + x*pfUI_config.bars.border, -pfUI_config.bars.border*2 - y*button_size - y * pfUI_config.bars.border)
|
||||
f:SetAlpha(1)
|
||||
f:SetHeight(button_size)
|
||||
f:SetWidth(button_size)
|
||||
local texture, itemCount, locked, quality, readable = GetContainerItemInfo(container, i);
|
||||
f:SetNormalTexture(nil)
|
||||
|
||||
f:SetBackdrop(
|
||||
{ bgFile = texture, tile = false, tileSize = pfUI_config.unitframes.buff_size,
|
||||
edgeFile = "Interface\\AddOns\\pfUI\\img\\border_col", edgeSize = 8,
|
||||
insets = { left = 0, right = 0, top = 0, bottom = 0}
|
||||
})
|
||||
if quality and quality > 1 then
|
||||
f:SetBackdropBorderColor(GetItemQualityColor(quality))
|
||||
else
|
||||
f:SetBackdropBorderColor(.3,.3,.3,1)
|
||||
end
|
||||
|
||||
SetItemButtonCount(getglobal(frame .. "Item" .. i), itemCount);
|
||||
if ( texture ) then
|
||||
local cooldown = getglobal(getglobal(frame .. "Item" .. i):GetName().."Cooldown");
|
||||
if cooldown then
|
||||
local start, duration, enable = GetContainerItemCooldown(container, getglobal(frame .. "Item" .. i):GetID());
|
||||
CooldownFrame_SetTimer(cooldown, start, duration, enable);
|
||||
if ( duration > 0 and enable == 0 ) then
|
||||
SetItemButtonTextureVertexColor(button, 0.4, 0.4, 0.4);
|
||||
end
|
||||
SetItemButtonCount(getglobal(frame .. "Item" .. i), itemCount);
|
||||
if ( texture ) then
|
||||
local cooldown = getglobal(getglobal(frame .. "Item" .. i):GetName().."Cooldown");
|
||||
if cooldown then
|
||||
local start, duration, enable = GetContainerItemCooldown(container, getglobal(frame .. "Item" .. i):GetID());
|
||||
CooldownFrame_SetTimer(cooldown, start, duration, enable);
|
||||
if ( duration > 0 and enable == 0 ) then
|
||||
SetItemButtonTextureVertexColor(button, 0.4, 0.4, 0.4);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
getglobal(frame .. "Item" .. i .. "Count"):SetPoint("BOTTOMLEFT", 0,0)
|
||||
getglobal(frame .. "Item" .. i .. "Count"):SetFont("Interface\\AddOns\\pfUI\\fonts\\arial.ttf", pfUI_config.global.font_size, "OUTLINE")
|
||||
getglobal(frame .. "Item" .. i .. "Count"):SetPoint("BOTTOMLEFT", 0,0)
|
||||
getglobal(frame .. "Item" .. i .. "Count"):SetFont("Interface\\AddOns\\pfUI\\fonts\\arial.ttf", pfUI_config.global.font_size, "OUTLINE")
|
||||
|
||||
for i,v in ipairs({f:GetRegions()}) do
|
||||
-- 2 is stack count
|
||||
for i,v in ipairs({f:GetRegions()}) do
|
||||
if i == 4 then v:SetAlpha(0) end
|
||||
if j == 5 and i == 1 then v:SetAlpha(0) end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
y = y + 1
|
||||
pfUI.bank:SetHeight( y * button_size + y * pfUI_config.bars.border + pfUI_config.bars.border*3 + 17)
|
||||
end)
|
||||
end
|
||||
y = y + 1
|
||||
pfUI.bank:SetHeight( y * button_size + y * pfUI_config.bars.border + pfUI_config.bars.border*3 + 17)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user