/trunk
Make a layout for the party. |
Make a layout for the raid. |
Support raid target icons. |
local barwidth = 300 |
local healthtexture = bartexture |
local healthheight = 20 |
local healthheight = 30 |
local healthwidth = barwidth |
local powertexture = bartexture |
local powerheight = 20 |
local powerheight = 5 |
local powerwidth = barwidth |
local textinset = 5 |
local innerpadding = 1 |
local elementpadding = 1 |
local outerpadding = 1 |
local outerpadding = 5 |
--local buffsize = (healthheight + powerheight + innerpadding*2 + elementpadding)/2 |
local buffsize = healthheight |
local buffsize = (healthheight + elementpadding + powerheight)/2 |
local shortclassnames = { |
DEATHKNIGHT = 'DK', |
local updatePower |
local updateInfo |
local updatePowerInfo |
local createNormalFrame |
local createDefaultFrame |
local createPartyFrame |
-- text display |
if unit ~= self.unit then return end |
local class = select(2, UnitClass(unit)) |
local color = raidcolors[class] |
--[[local color = raidcolors[class] |
if color then |
bar:SetStatusBarColor(color.r, color.g, color.b) |
end |
end]] |
bar:SetStatusBarColor(0.25, 0.25, 0.25) |
if UnitIsDead(unit) then |
bar:SetValue(0) |
end |
end |
function updateInfo (self, event, unit) |
if unit ~= self.unit then return end |
local class = formatTextClass(unit) |
local happiness = formatTextHappiness(unit) |
local level = formatTextLevel(unit) |
local name = formatTextName(unit) |
local tapped = formatTextTapped(unit) |
self.Name:SetText(('%s%s'):format(name, tapped)) |
self.Info:SetText(('%s %s'):format(level, happiness)) |
end |
function updatePower (self, event, bar, unit, min, max) |
--bar:SetStatusBarColor(255/255, 128/255, 0) |
--bar:SetStatusBarColor(0, 128/255, 255/255) |
bar:SetStatusBarColor(128/255, 255/255, 0) |
if min == 0 then |
bar.value:SetText(0) |
else |
end |
end |
function createNormalFrame (settings, self, unit) |
function updateInfo (self, event, unit) |
if unit ~= self.unit then return end |
if unit == 'player' or unit == 'pet' then |
self.Name:SetText() |
else |
local class = formatTextClass(unit) |
local happiness = formatTextHappiness(unit) |
local level = formatTextLevel(unit) |
local name = formatTextName(unit) |
local tapped = formatTextTapped(unit) |
self.Name:SetText(('%s %s %s%s %s'):format(level, class, name, tapped, happiness)) |
end |
end |
function createDefaultFrame (settings, self, unit) |
local bg = self:CreateTexture(nil, 'OVERLAY') |
local health = CreateFrame('StatusBar', nil, self) |
local power = CreateFrame('StatusBar', nil, self) |
health.value:SetTextColor(unpack(textcolor)) |
health.value:SetShadowColor(0, 0, 0) |
health.value:SetShadowOffset(1, -1) |
health.value:Hide() |
-- powerbar |
power:SetPoint(TL, health, BL, 0, -elementpadding) |
power:SetWidth(powerwidth) |
power:SetHeight(powerheight) |
power:SetStatusBarTexture(powertexture) |
power.colorType = true |
--power.colorType = true |
power.info:SetPoint(ML, power, ML, textinset, 0) |
power.info:SetJustifyH('LEFT') |
power.info:SetShadowColor(0, 0, 0) |
power.info:SetShadowOffset(1, -1) |
power.value:SetPoint(MR, power, MR, -textinset, 0) |
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) |
power.value:Hide() |
-- frame |
self:SetScript('OnEnter', UnitFrame_OnEnter) |
self:SetScript('OnLeave', UnitFrame_OnLeave) |
self:SetScript('OnEnter', function(self) |
health.value:Show() |
power.value:Show() |
end) |
self:SetScript('OnLeave', function(self) |
health.value:Hide() |
power.value:Hide() |
end) |
self:RegisterForClicks('anyup') |
self:SetAttribute('type2', 'menu') |
self.UNIT_NAME_UPDATE = updateInfo |
-- buffs |
buffs:SetPoint(TR, self, TL, -elementpadding, -elementpadding) |
buffs:SetPoint(BL, self, TL, 0, elementpadding) |
buffs:SetWidth(barwidth) |
buffs:SetHeight(buffsize) |
buffs.size = buffsize |
buffs.num = math.floor(barwidth / buffs.size + 0.5) |
buffs.initialAnchor = TR |
buffs['growth-x'] = ML |
buffs['growth-y'] = BC |
buffs.initialAnchor = BL |
buffs['growth-x'] = MR |
buffs['growth-y'] = TC |
debuffs:SetPoint(TL, self, TR, elementpadding, -elementpadding) |
debuffs:SetPoint(TL, self, BL, 0, -elementpadding) |
debuffs:SetWidth(barwidth) |
debuffs:SetHeight(buffsize) |
debuffs.size = buffsize |
debuffs['growth-y'] = BC |
-- leader icon |
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 |
leader:SetWidth(buffsize) |
leader:SetHeight(buffsize) |
leader:SetPoint(MC, health, TC) |
leader:SetTexture([[Interface\GroupFrame\UI-Group-LeaderIcon]]) |
-- range fading |
if not unit then |
self.Info = power.info |
self.Buffs = buffs |
self.Debuffs = debuffs |
self.Leader = leader |
end |
function createPetFrame (settings, self, unit) |
createDefaultFrame(settings, self, unit) |
self.Health:SetWidth(healthwidth/2) |
self.Power:SetWidth(powerwidth/2) |
self.Name:Hide() |
self.Info:Hide() |
self.Buffs = nil |
self.Debuffs = nil |
self.Leader:Hide() |
self.Leader = nil |
self:UnregisterEvent('UNIT_LEVEL') |
self:UnregisterEvent('UNIT_NAME') |
self:UnregisterEvent('UNIT_HAPPINESS') |
self:UnregisterEvent('UNIT_CLASSIFICATION_CHANGED') |
self:UnregisterEvent('UNIT_COMBAT') |
self:UnregisterEvent('UNIT_FACTION') |
self:UnregisterEvent('UNIT_FLAGS') |
self:UnregisterEvent('UNIT_LEVEL') |
self:UnregisterEvent('UNIT_LOYALTY') |
self:UnregisterEvent('UNIT_NAME_UPDATE') |
end |
function createTargettargetFrame (settings, self, unit) |
createDefaultFrame(settings, self, unit) |
self:SetScript('OnEnter', nil) |
self:SetScript('OnLeave', nil) |
self.Health:SetWidth(healthwidth/2) |
self.Power:SetWidth(powerwidth/2) |
self.Buffs = nil |
self.Debuffs = nil |
end |
oUF:RegisterStyle('Industrial', setmetatable({ |
['initial-width'] = healthwidth + innerpadding*2, |
['initial-height'] = healthheight + powerheight + innerpadding*2 + elementpadding |
}, {__call = createNormalFrame})) |
}, {__call = createDefaultFrame})) |
oUF:RegisterStyle('Industrial-Pet', setmetatable({ |
['initial-width'] = healthwidth/2 + innerpadding*2, |
['initial-height'] = healthheight + powerheight + innerpadding*2 + elementpadding |
}, {__call = createPetFrame})) |
oUF:RegisterStyle('Industrial-Targettarget', setmetatable({ |
['initial-width'] = healthwidth/2 + innerpadding*2, |
['initial-height'] = healthheight + powerheight + innerpadding*2 + elementpadding |
}, {__call = createTargettargetFrame})) |
oUF:RegisterSubTypeMapping('UNIT_LEVEL') |
oUF:SetActiveStyle('Industrial') |
oUF:SetActiveStyle('Industrial-Pet') |
local pet = oUF:Spawn('pet', framename..'pet') |
oUF:SetActiveStyle('Industrial-Targettarget') |
local targettarget = oUF:Spawn('targettarget', framename..'targettarget') |
oUF:SetActiveStyle('Industrial') |
local player = oUF:Spawn('player', framename..'player') |
local target = oUF:Spawn('target', framename..'target') |
local targettarget = oUF:Spawn('targettarget', framename..'targettarget') |
local party = oUF:Spawn('header', 'oUF_Industrial_party') |
pet:SetPoint(MC, UIParent, MC, 0, -370) |
player:SetPoint(BC, pet, TC, 0, outerpadding) |
target:SetPoint(BC, player, TC, 0, outerpadding) |
targettarget:SetPoint(BC, target, TC, 0, outerpadding) |
player:SetPoint(MR, UIParent, MC, -outerpadding/2, -300) |
pet:SetPoint(MR, player, ML, -outerpadding, 0) |
target:SetPoint(ML, UIParent, MC, outerpadding/2, -300) |
targettarget:SetPoint(ML, target, MR, outerpadding, 0) |
party:SetPoint(MC, UIParent, MC, -400, -300) |
party:SetManyAttributes( |
'showParty', 'true', |