/trunk
bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], |
tile = true, |
tileSize = 16, |
--edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], |
edgeFile = '', |
edgeSize = 0, |
insets = { |
left = 0, |
right = 0, |
top = 0, |
bottom = 0 |
} |
edgeSize = 16, |
--insets = {left=4,right=4,top=4,bottom=4}, |
insets = {left=0,right=0,top=0,bottom=0}, |
} |
local framename = 'oUF_Industrial_' |
local frames = {} |
local barwidth = 300 |
local healthtexture = bartexture |
local healthheight = 30 |
local healthheight = 20 |
local healthwidth = barwidth |
local powertexture = bartexture |
local powerheight = 10 |
local powerheight = 20 |
local powerwidth = barwidth |
local textinset = 5 |
local raidcolors = _G.RAID_CLASS_COLORS |
local innerpadding = 1 |
local outerpadding = -1 |
local elementpadding = 1 |
local outerpadding = 1 |
local buffsize = (healthheight + powerheight + innerpadding*3)/2 |
--local buffsize = (healthheight + powerheight + innerpadding*2 + elementpadding)/2 |
local buffsize = healthheight |
local shortclassnames = { |
DEATHKNIGHT = 'DK', |
local showMenu |
local updateHealth |
local updatePower |
local updateHealthInfo |
local updateInfo |
local updatePowerInfo |
local createNormalFrame |
local createPartyFrame |
return '' |
end |
function formatTextLevel (unit) |
local color = GetDifficultyColor(UnitLevel(unit)) |
return ('|cff%02X%02X%02X%s|r'):format(color.r*255, color.g*255, color.b*255, UnitLevel(unit)) |
end |
function formatTextName (unit) |
return ('|cff%s%s|r'):format(UnitIsFriend(unit, 'player') == 1 and '00ff00' or 'ff0000', UnitName(unit)) |
end |
function formatTextLevel (unit) |
local color = GetDifficultyColor(UnitLevel(unit)) |
return ('|cff%02X%02X%02X%s|r'):format(color.r*255, color.g*255, color.b*255, UnitLevel(unit)) |
function formatTextTapped (unit) |
if UnitIsTapped(unit) then |
if UnitIsTappedByPlayer(unit) then |
return '|cff00ff00*|r' |
end |
return '|cffff0000*|r' |
end |
return '' |
end |
function showMenu (self) |
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 |
end |
function updateHealthInfo (self, event, unit) |
function updateInfo (self, event, unit) |
if unit ~= self.unit then return end |
local level = formatTextLevel(unit) |
local name = formatTextName(unit) |
local class = formatTextClass(unit) |
local happiness = formatTextHappiness(unit) |
local level = formatTextLevel(unit) |
local name = formatTextName(unit) |
local tapped = formatTextTapped(unit) |
if happiness ~= '' then |
happiness = happiness .. ' ' |
end |
self.Name:SetText(('%s %s %s%s'):format(level, formatTextClass(unit), happiness, name)) |
self.Name:SetText(('%s%s'):format(name, tapped)) |
self.Info:SetText(('%s %s %s'):format(level, class, happiness)) |
end |
function updatePower (self, event, unit, bar, min, max) |
end |
end |
function updatePowerInfo () |
end |
function createNormalFrame (settings, self, unit) |
local health = CreateFrame('StatusBar', nil, self) |
local power = CreateFrame('StatusBar', nil, self) |
health:SetStatusBarColor(0.75, 0.75, 0.75) |
health.info:SetPoint(ML, health, ML, textinset, 0) |
health.info:SetWidth(healthwidth/2 - textinset) |
--health.info:SetWidth(healthwidth/2 - textinset) |
health.info:SetJustifyH('LEFT') |
health.info:SetFont(textfont, 10) |
health.info:SetTextColor(unpack(textcolor)) |
health.value:SetShadowOffset(1, -1) |
-- powerbar |
power:SetPoint(TL, health, BL, 0, -innerpadding) |
power:SetPoint(TL, health, BL, 0, -elementpadding) |
power:SetWidth(powerwidth) |
power:SetHeight(powerheight) |
power:SetStatusBarTexture(powertexture) |
power.info:SetPoint(ML, power, ML, textinset, 0) |
power.info:SetWidth(powerwidth/2 - textinset) |
--power.info:SetWidth(powerwidth/2 - textinset) |
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:SetPoint(MR, power, MR, -textinset, 0) |
power.value:SetJustifyH('RIGHT') |
power.value:SetFont(textfont, 10) |
power.value:SetTextColor(unpack(textcolor)) |
self:RegisterEvent('UNIT_LOYALTY') |
self:RegisterEvent('UNIT_NAME_UPDATE') |
self.UNIT_LEVEL = updateHealthInfo |
self.UNIT_NAME = updateHealthInfo |
self.UNIT_HAPPINESS = updateHealthInfo |
self.UNIT_CLASSIFICATION_CHANGED = updateHealthInfo |
self.UNIT_COMBAT = updateHealthInfo |
self.UNIT_FACTION = updateHealthInfo |
self.UNIT_FLAGS = updateHealthInfo |
self.UNIT_LEVEL = updateHealthInfo |
self.UNIT_LOYALTY = updateHealthInfo |
self.UNIT_NAME_UPDATE = updateHealthInfo |
self.UNIT_LEVEL = updateInfo |
self.UNIT_NAME = updateInfo |
self.UNIT_HAPPINESS = updateInfo |
self.UNIT_CLASSIFICATION_CHANGED = updateInfo |
self.UNIT_COMBAT = updateInfo |
self.UNIT_FACTION = updateInfo |
self.UNIT_FLAGS = updateInfo |
self.UNIT_LEVEL = updateInfo |
self.UNIT_LOYALTY = updateInfo |
self.UNIT_NAME_UPDATE = updateInfo |
-- buffs |
buffs:SetPoint(TR, self, TL) |
buffs:SetPoint(TR, self, TL, -elementpadding, -elementpadding) |
buffs:SetWidth(barwidth) |
buffs:SetHeight(buffsize) |
buffs.size = buffsize |
buffs['growth-x'] = ML |
buffs['growth-y'] = BC |
debuffs:SetPoint(TL, self, TR) |
debuffs:SetPoint(TL, self, TR, elementpadding, -elementpadding) |
debuffs:SetWidth(barwidth) |
debuffs:SetHeight(buffsize) |
debuffs.size = buffsize |
debuffs['growth-y'] = BC |
-- leader icon |
leader:SetWidth(buffsize) |
leader:SetHeight(buffsize) |
leader:SetPoint(MC, health, TC) |
leader:SetTexture([[Interface\GroupFrame\UI-Group-LeaderIcon]]) |
if unit and not unit:match('pet') then |
leader:SetWidth(buffsize) |
leader:SetHeight(buffsize) |
leader:SetPoint(MC, health, TC) |
leader:SetTexture([[Interface\GroupFrame\UI-Group-LeaderIcon]]) |
self.Leader = leader |
end |
-- range fading |
if not unit then |
self.Info = power.info |
self.Buffs = buffs |
self.Debuffs = debuffs |
self.Leader = leader |
end |
oUF:RegisterStyle('Industrial', setmetatable({ |
['initial-width'] = healthwidth + innerpadding*2, |
['initial-height'] = healthheight + powerheight + innerpadding*3 |
['initial-height'] = healthheight + powerheight + innerpadding*2 + elementpadding |
}, {__call = createNormalFrame})) |
oUF:RegisterSubTypeMapping('UNIT_LEVEL') |
local targettarget = oUF:Spawn('targettarget', framename..'targettarget') |
local party = oUF:Spawn('header', 'oUF_Industrial_party') |
pet:SetPoint(MC, UIParent, MC, 0, -400) |
pet:SetPoint(MC, UIParent, MC, 0, 0) |
player:SetPoint(BC, pet, TC, 0, outerpadding) |
target:SetPoint(BC, player, TC, 0, outerpadding) |
targettarget:SetPoint(BC, target, TC, 0, outerpadding) |