PHP код:
local bartexture = [=[Interface\AddOns\oUF_zp\media\minimalist.tga]=]
local text_xd = {
font = "Interface\\AddOns\\oUF_zp\\media\\font.ttf",
fontsize = 11,
flags = "OUTLINE"
}
oUF.Tags['[zppartyInfo]'] = function(u)
local _, class = UnitClass(u)
if UnitIsDead(u) then
return hex(oUF.colors.class[class]).."RIP|r"
elseif UnitIsGhost(u) then
return hex(oUF.colors.class[class]).."Gho|r"
elseif not UnitIsConnected(u) then
return hex(oUF.colors.class[class]).."D/C|r"
else
return " "
end
end
oUF.TagEvents['[zppartyInfo]'] = 'UNIT_HEALTH'
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
local updateHealth = function(self, event, unit, bar)
local r, g, b, t
if(UnitIsPlayer(unit)) then
local _, class = UnitClass(unit)
t = oUF.colors.class[class]
else
r, g, b = .1, .8, .3
end
if(t) then
r, g, b = t[1], t[2], t[3]
end
bar:SetStatusBarColor(r, g, b)
end
local function shortval(value)
if(value >= 1e6) then
return string.format('%.1fm', value / 1e6)
elseif(value >= 1e4) then
return string.format('%.1fk', value / 1e3)
elseif value >= 1e3 then
return string.format('%.1fk', value / 1e3)
else
return value
end
end
oUF.Tags['zp:health'] = function(u)
return shortval(UnitHealth(u))
end
oUF.TagEvents['zp:health'] = 'UNIT_HEALTH'
oUF.Tags['zp:name'] = function(u)
return string.lower(UnitName(u))
end
oUF.TagEvents['zp:name'] = 'UNIT_NAME_UPDATE'
local func = function(self, unit)
--if(self:GetParent():GetName():match"oUF_Party") then
self:SetWidth(150)
self:SetHeight(20)
self:SetScript("OnEnter", UnitFrame_OnEnter)
self:SetScript("OnLeave", UnitFrame_OnLeave)
self:RegisterForClicks("AnyUp")
self:SetAttribute("type2", "menu")
local hp = CreateFrame("StatusBar", nil, self)
hp:SetAllPoints(self)
hp:SetStatusBarTexture(texture)
hp.frequentUpdates = true
local hpbg = hp:CreateTexture(nil, "BACKGROUND")
hpbg:SetAllPoints(hp)
hpbg:SetTexture(bartexture)
hpbg:SetAlpha(0.3)
local info = hp:CreateFontString(nil, "OVERLAY")
info:SetPoint("LEFT", hp)
info:SetPoint("RIGHT", hp)
info:SetFont(text_xd.font, text_xd.fontsize)
info:SetShadowOffset(1, -1)
info:SetTextColor(1, 1, 1)
self:Tag(info, 'zppartyInfo')
oUFMakeBG(hp)
end
----------------------------------------
oUF:RegisterStyle("zpparty", func)
oUF:SetActiveStyle("zpparty")
local party = oUF:Spawn("header", "oUF_Party")
party:SetAttribute("showParty", true)
party:SetAttribute("showRaid", true)
party:SetAttribute("columnSpacing", 10)
party:SetAttribute("unitsPerColumn", 1)
party:SetAttribute("maxColumns", 4)
party:SetAttribute("columnAnchorPoint", "LEFT")
party:SetAttribute("xOffset", -10)
party:SetPoint('CENTER', UIParent, 'CENTER', -1, 0)
party:Show()