/trunk
local _G = _G |
local TL, TC, TR = 'TOPLEFT', 'TOP', 'TOPRIGHT' |
local ML, MC, MR = 'LEFT', 'CENTER', 'RIGHT' |
local BL, BC, BR = 'BOTTOMLEFT', 'BOTTOM', 'BOTTOMRIGHT' |
local frames = {} |
local frame_name = 'oUF_Industrial_' |
local frame_backdrop = { |
bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], |
tile = true, |
tileSize = 16, |
edgeFile = '', |
edgeSize = 16, |
insets = {left=0,right=0,top=0,bottom=0}, |
} |
local frame_backdrop_color = {0, 0, 0, 1} |
local padding = 1 |
local margin = 5 |
local padding = 5 |
local spacing = 1 |
local margin = 3 |
local bar_width = 300 |
local bar_height = 15 |
local bar_width = 300 - padding * 2 |
local bar_texture = [[Interface\AddOns\oUF_Industrial\media\textures\statusbar]] |
local health_width = bar_width |
local power_height = 2 |
local power_texture = bar_texture |
local buff_size = health_height + power_height + padding |
local buff_size = (padding * 2 + spacing + health_height + power_height) / 2 |
local text_padding = 5 |
local text_inset = 3 |
local text_font = _G.GameFontNormal:GetFont() |
local text_color = {1, 1, 1} |
} |
local show_menu |
local formattedtext_class |
local formattedtext_happiness |
local formattedtext_level |
local formattedtext_name |
local formattedtext_tapped |
local unit_class |
local unit_happiness |
local unit_level |
local unit_name |
local unit_tapped |
local update_health |
local update_power |
local update_name |
end |
end |
function formattedtext_class (unit) |
function unit_class (unit) |
local class = select(2, UnitClass(unit)) |
local color = RAID_CLASS_COLORS[class] |
return color and ('|cff%02X%02X%02X%s|r'):format(color.r*255, color.g*255, color.b*255, shortclassnames[class]) or '' |
end |
function formattedtext_happiness (unit) |
function unit_happiness (unit) |
if unit == 'pet' then |
local happiness = GetPetHappiness() |
if happiness then |
end |
end |
function formattedtext_level (unit) |
function unit_level (unit) |
local color = GetDifficultyColor(UnitLevel(unit)) |
return color and ('|cff%02X%02X%02X%s|r'):format(color.r*255, color.g*255, color.b*255, UnitLevel(unit)) |
end |
function formattedtext_name (unit) |
function unit_name (unit) |
return ('|cff%s%s|r'):format(UnitIsFriend(unit, 'player') == 1 and '00ff00' or 'ff0000', UnitName(unit)) |
end |
function formattedtext_tapped (unit) |
function unit_tapped (unit) |
if UnitIsTapped(unit) then |
if UnitIsTappedByPlayer(unit) then |
return '|cff00ff00*|r' |
function update_name (frame, event, unit) |
if unit ~= frame.unit or not UnitExists(unit) then return end |
local class = formattedtext_class(unit) |
local happiness = formattedtext_happiness(unit) |
local level = formattedtext_level(unit) |
local name = formattedtext_name(unit) |
local tapped = formattedtext_tapped(unit) |
local class = unit_class(unit) |
local happiness = unit_happiness(unit) |
local level = unit_level(unit) |
local name = unit_name(unit) |
local tapped = unit_tapped(unit) |
frame.Name:SetText(('%s %s %s%s %s'):format(level, class, name, tapped, happiness)) |
end |
health:SetStatusBarTexture(health_texture) |
health:SetStatusBarColor(0.75, 0.75, 0.75) |
health.info:SetPoint(ML, health, ML, text_padding, 0) |
health.info:SetPoint(ML, health, ML, text_inset, 0) |
health.info:SetJustifyH('LEFT') |
health.info:SetFont(text_font, 10) |
health.info:SetTextColor(unpack(text_color)) |
health.info:SetShadowColor(0, 0, 0) |
health.info:SetShadowOffset(1, -1) |
health.value:SetPoint(MR, health, MR, -text_padding, 0) |
health.value:SetPoint(MR, health, MR, -text_inset, 0) |
health.value:SetJustifyH('RIGHT') |
health.value:SetFont(text_font, 10) |
health.value:SetTextColor(unpack(text_color)) |
power:SetHeight(power_height) |
power:SetStatusBarTexture(power_texture) |
power.info:SetPoint(ML, power, ML, text_padding, 0) |
power.info:SetPoint(ML, power, ML, text_inset, 0) |
power.info:SetJustifyH('LEFT') |
power.info:SetFont(text_font, 10) |
power.info:SetTextColor(unpack(text_color)) |
power.info:SetShadowColor(0, 0, 0) |
power.info:SetShadowOffset(1, -1) |
power.value:SetPoint(MR, health.value, ML, -text_padding, 0) |
power.value:SetPoint(MR, health.value, ML, -text_inset, 0) |
power.value:SetJustifyH('RIGHT') |
power.value:SetFont(text_font, 10) |
power.value:SetTextColor(unpack(text_color)) |