Code:
if not Stuf then return end
local _, class = UnitClass("player")
local b1 = 5
local b2 = 7
local b3 = 8
local HPh = 60 -- Hight of health bar
local HPw = 220 -- Width of health bar
local PWh = 55 -- Hight of power bar
local PWw = 220 -- Width of power bar
local backdrop = {
bgFile = "Interface\\AddOns\\Centurions\\media\\tga\\background_flat",
edgeFile = "Interface\\AddOns\\Centurions\\media\\tga\\glow",
tile = false,
tileSize = 32,
edgeSize = b3,
insets = { left = 5, right = 5, top = 5, bottom = 5}
}
------------------------------------------------------------------------
-- Power Bar / Background Panels
------------------------------------------------------------------------
function CreateHolder1(f, w, h, anchor, parent, parentanchor, x, y)
f:SetWidth(w)
f:SetHeight(h)
f:SetFrameStrata("BACKGROUND",1)
f:SetBackdrop(backdrop)
f:SetBackdropColor(.38,.624,.859,1) --Border 2, Controlls the color
f:SetBackdropBorderColor(0,0,0,0.8) --Border 1, Outer Border
f:SetPoint(anchor, parent, parentanchor, x, y)
-- This creates Border 3
local s = f:CreateTexture(nil, "LOW",nil,-8)
s:SetPoint("TOPLEFT",f,"TOPLEFT",b2,-b2) -- Numbers set's the size of border
s:SetPoint("BOTTOMRIGHT",f,"BOTTOMRIGHT",-b2,b2) -- Number set's the size of border
s:SetTexture(0,0,0,1, true) -- Controlls the color of border in r,g,b,a format
s:SetHorizTile(true)
s:SetVertTile(true)
s.t = t
end
local f = CreateFrame("Frame", "Player_Power", UIParent)
CreateHolder1(f, PWw, PWh, "BOTTOM", UIParent, "BOTTOM", 405, 215)
local f = CreateFrame("Frame", "Target_Power", UIParent)
CreateHolder1(f, PWw, PWh, "BOTTOM", UIParent, "BOTTOM", -405, 215)
if (event == "PLAYER_TARGET_CHANGED") then
if (UnitExists("target")) then
Target_Power:Show()
else
Target_Power:Hide()
end
end
------------------------------------------------------------------------
-- Health Bar 2 / Top Panels
------------------------------------------------------------------------
function CreateHolder1(f, w, h, anchor, parent, parentanchor, x, y)
f:SetWidth(w)
f:SetHeight(h)
f:SetFrameStrata("MEDIUM",-2)
f:SetBackdrop(backdrop)
f:SetBackdropColor(.38,.624,.859,1) --Border 2, Controlls the color
f:SetBackdropBorderColor(0,0,0,0.8) --Border 1, Outer Border
f:SetPoint(anchor, parent, parentanchor, x, y)
-- This creates Border 3
local s = f:CreateTexture(nil, "LOW",nil,-8)
s:SetPoint("TOPLEFT",f,"TOPLEFT",b2,-b2) -- Numbers set's the size of border
s:SetPoint("BOTTOMRIGHT",f,"BOTTOMRIGHT",-b2,b2) -- Number set's the size of border
s:SetTexture(0,0,0,1, true) -- Controlls the color of border in r,g,b,a format
s:SetHorizTile(true)
s:SetVertTile(true)
s.t = t
end
local f = CreateFrame("Frame", "Player_HP2", UIParent)
CreateHolder1(f, HPw, HPh, "BOTTOMLEFT", Player_Power, "BOTTOMLEFT", -15, 15)
local f = CreateFrame("Frame", "Target_HP2", UIParent)
CreateHolder1(f, HPw, HPh, "BOTTOMLEFT", Target_Power, "BOTTOMLEFT", -15, 15)
Basicly custom panels to Stuf Unit frames addon. A strange reason i can't parent panels to that addon. Works perfectly for all my other addons i made panels for. So need to turn panel of when i don't have a target.