/trunk
local frames = {} |
local bartexture = [[Interface\Addons\oUF_Industrial\media\textures\statusbar]] |
local barheight = 25 |
local barheight = 15 |
local barwidth = 300 |
local healthtexture = bartexture |
local healthheight = 10 |
local healthheight = 30 |
local healthwidth = barwidth |
local powertexture = bartexture |
local raidcolors = _G.RAID_CLASS_COLORS |
local buffsize = 33 |
local innerpadding = 1 |
local outerpadding = 1 |
local buffsize = (healthheight + powerheight + innerpadding*3)/2 |
local pethappiness = {':<',':|',':3'} |
local shortclassnames = { |
DEATHKNIGHT = 'DK', |
DRUID = 'DR', |
HUNTER = 'HT', |
MAGE = 'MG', |
PALADIN = 'PL', |
PRIEST = 'PR', |
ROGUE = 'RG', |
SHAMAN = 'SH', |
WARLOCK = 'WL', |
WARRIOR = 'WR', |
} |
-- functions |
local showMenu |
local updateHealth |
local updatePowerInfo |
local createNormalFrame |
-- text display |
local formatTextClass |
local formatTextHappiness |
local formatTextLevel |
local formatTextRace |
local formatTextTapped |
function formatTextClass (unit) |
local class = select(2, UnitClass(unit)) |
local color = RAID_CLASS_COLORS[class] |
return ('|cff%02X%02X%02X%s|r'):format(color.r*255, color.g*255, color.b*255, shortclassnames[class]) |
end |
function showMenu (self) |
local unit = self.unit:sub(1, -2) |
local cunit = self.unit:gsub("(.)", string.upper, 1) |
end |
function updateHealth (self, event, unit, bar, min, max) |
if not unit == self.unit then return end |
if unit ~= self.unit then return end |
local class = select(2, UnitClass(unit)) |
local color = raidcolors[class] |
--local color = raidcolors[class] |
bar:SetStatusBarColor(color.r, color.g, color.b) |
--bar:SetStatusBarColor(color.r, color.g, color.b) |
if UnitIsDead(unit) then |
bar:SetValue(0) |
end |
function updateHealthInfo (self, event, unit) |
if not unit == self.unit then return end |
if unit ~= self.unit then return end |
local level = UnitLevel(unit) |
local name = UnitName(unit) |
local happiness = ' ' |
if unit == pet then |
if unit == 'pet' then |
happpiness = GetPetHappiness() and happinesstext[GetPetHappiness()]..' ' |
end |
self.Name:SetText(('%s %s%s'):format(level, happiness, name:sub(1, 20))) |
self.Name:SetText(('%s %s %s%s'):format(level, formatTextClass(unit), happiness, name:sub(1, 20))) |
end |
function updatePowerInfo () |
health:SetWidth(healthwidth) |
health:SetHeight(healthheight) |
health:SetStatusBarTexture(healthtexture) |
health:SetStatusBarColor(0.75, 0.75, 0.75) |
health.info:SetPoint(ML, health, ML, textinset, 0) |
health.info:SetWidth(healthwidth/2 - textinset) |
health.info:SetJustifyH('LEFT') |
health.info:SetFont(textfont, 10) |
health.info:SetTextColor(unpack(textcolor)) |
health.info:SetShadowColor(0, 0, 0) |
health.info:SetShadowOffset(1, -1) |
health.value:SetPoint(MR, health, MR, -textinset, 0) |
health.value:SetJustifyH('RIGHT') |
health.value:SetFont(textfont, 10) |
health.value:SetTextColor(unpack(textcolor)) |
health.value:SetShadowColor(0, 0, 0) |
health.value:SetShadowOffset(1, -1) |
-- powerbar |
power:SetPoint(TL, health, BL, 0, -innerpadding) |
power.info:SetJustifyH('LEFT') |
power.info:SetFont(textfont, 10) |
power.info:SetTextColor(unpack(textcolor)) |
power.info:SetShadowColor(0, 0, 0) |
power.info:SetShadowOffset(1, -1) |
power.value:SetPoint(MR, health.value, ML, -textinset, 0) |
power.value:SetJustifyH('RIGHT') |
power.value:SetFont(textfont, 10) |
power.value:SetTextColor(unpack(textcolor)) |
power.value:SetShadowColor(0, 0, 0) |
power.value:SetShadowOffset(1, -1) |
-- frame |
self:SetScript('OnEnter', UnitFrame_OnEnter) |