PHP код:
local _, ns = ...
local oUF = ns.oUF or oUF
local mediaPath = "Interface\\AddOns\\oUF_zp2\\media\\"
local bartexture = mediaPath.."minimalist"
local font, fontsize, flags = mediaPath.."font.ttf", 10, "OUTLINE"
local backdrop = {
bgFile = [=[Interface\Buttons\WHITE8x8]=],
edgeFile = [=[Interface\Buttons\WHITE8x8]=], edgeSize = 1,
insets = {top = 0, bottom = 0, right = 0, left = 0}
}
local oUFMakeBG = function(parent)
local bg = CreateFrame("Frame", nil, parent)
bg:SetPoint('TOPLEFT', parent, 'TOPLEFT', -1, 1)
bg:SetPoint('BOTTOMRIGHT', parent, 'BOTTOMRIGHT', 1, -1)
bg:SetFrameLevel(parent:GetFrameLevel() - 1)
bg:SetBackdrop(backdrop)
bg:SetBackdropColor(0, 0, 0, 0.6)
bg:SetBackdropBorderColor(0, 0, 0, 1)
end
function oUF:CreatePet(self, unit)
if unit~="pet" then return end
self:RegisterForClicks("AnyUp")
self:SetWidth(100)
self:SetHeight(15)
local health = CreateFrame('StatusBar', nil, self)
health:SetStatusBarTexture(bartexture)
health:SetHeight(15)
health:SetPoint('TOPRIGHT', 0, -1.5)
health:SetPoint('TOPLEFT', 0, -1.5)
health.colorClass = true
health.colorTapping = true
health.colorReaction = true
health.bg = health:CreateTexture(nil, 'BORDER')
health.bg:SetAllPoints(health)
health.bg:SetTexture(bartexture)
health.bg:SetAlpha(0.4)
health.raid = health:CreateTexture(nil, 'OVERLAY')
health.raid:SetSize(16, 16)
health.raid:SetPoint('TOP', self, 0, 9)
self.Health = health
oUFMakeBG(health)
end