-------------------
--BagBuddy Frames--
-------------------
-- The parent frame of BagBuddy
local frame = CreateFrame("Frame", "BagBuddy", UIParent)
frame:SetSize(425, 425)
frame:SetPoint("CENTER", UIParent, "CENTER")
-- The Body frame of BagBuddy (the border itself)
frame.body = frame:CreateTexture("BagBuddy_Body", "BORDER")
frame.body:SetPoint("TOPLEFT")
frame.body:SetTexture("Interface\\BankFrame\\UI-BankFrame")
-- Making BagBuddy movable
frame:EnableMouse(true)
frame:SetMovable(true)
frame:SetClampedToScreen(true)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", frame.StartMoving)
frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
-- The icon(portrait) texture of BagBuddy
frame.icon = frame:CreateTexture("BagBuddy_Icon", "BACKGROUND")
frame.icon:SetSize(60, 60)
frame.icon:SetPoint("TOPLEFT", 7, -6)
frame.icon:SetTexture("Interface\\Icons\\INV_Misc_EngGizmos_17")
SetPortraitToTexture(frame.icon, "Interface\\Icons\\INV_Misc_EngGizmos_17")
-- The title fontstring of BagBuddy.
frame.title = frame:CreateFontString("BagBuddy_Title", "OVERLAY", "GameFontNormal")
frame.title:SetPoint("TOP", 0, -18)
frame.title:SetText("BagBuddy")
-- The close button for BagBuddy.
frame.close = CreateFrame("Button", "BagBuddy_Close", frame, "UIPanelCloseButton")
frame.close:SetPoint("TOPRIGHT", -22, -8)
-----------------------
--BagBuddy Loop Items--
-----------------------
frame.items = {}
for idx = 1, 28 do
local item = CreateFrame("Button", "BagBuddy_Item" .. idx, frame, "SecureActionButtonTemplate")
item:SetSize(37, 37)
item:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2")
item:SetPushedTexture("Interface\\Buttons\\UI-Quickslot-Depress")
item:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square", "ADD")
do local tex = item:GetNormalTexture()
tex:ClearAllPoints()
tex:SetPoint("CENTER", 0, -1)
tex:SetSize(64, 64)
end
item.icon = item:CreateTexture("$parentIconTexture", "BORDER")
item.count = item:CreateFontString("$parentCount", "BORDER", "NumberFontNormal")
item.coun:SetPoint("BOTTOMRIGHT", -5, 2)
item.count:SetJustifyH("RIGHT")
item.count:Hide()
item.glow = item:CreateTexture("$parentGlow", "OVERLAY")
item.glow:SetPoint("CENTER")
item.glow:SetSize(70, 70)
item.glow:SetTexture("Interface\\Buttons\\UI-ActionButton-Border")
item.glow:SetBlendMode("ADD")
item.glow:SetAlpha(0.6)
frame.items[idx] = item
if idx == 1 then
item:SetPoint("TOPLEFT", 40, -73)
elseif idx == 8 or idx == 15 or idx == 22 then
item:SetPoint("TOPLEFT", frame.items[idx - 7], "BOTTOMLEFT", 0, -7)
else
item:SetPoint("TOPLEFT", frame.items[idx - 1], "TOPRIGHT", 12, 0)
end
end