WoWInterface SVN oUF_Industrial

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 38 to Rev 37
    Reverse comparison

Rev 38 → Rev 37

branches/layout_change_1/Addon.lua
5,28 → 5,25
 
local frame_name = 'oUF_Industrial_'
 
local padding = 0
local padding = 1
local spacing = 0
local margin = 1
local translucency = 1
 
local offset_x = 0
local offset_y = -350
 
local buff_margin = margin / 2
 
local bar_width = 200 - padding * 2
local bar_texture = [[Interface\AddOns\oUF_Industrial\media\textures\statusbar]]
 
local health_width = bar_width
local health_height = 20
local health_height = 15
local health_texture = bar_texture
--local health_color = {0.25, 0.25, 0.25, translucency + translucency/2}
local health_color = {0.5, 0.5, 0.5, translucency + translucency / 2}
 
local power_width = bar_width
local power_height = 20
local power_height = 4
local power_texture = bar_texture
local power_color = {0.5, 1, 0, translucency + translucency / 2}
--local power_color = {128/255, 255/255, 0, translucency + translucency/2}
local power_color = {0.25, 0.5, 1, translucency + translucency / 2}
 
local cast_color = {1, 1, 0, translucency + translucency / 2}
 
57,7 → 54,7
local unit_tapped
local update_health
local update_power
local update_info
local update_name
local create_unitframe
local create_pet_unitframe
local create_party_unitframe
128,7 → 125,7
 
function update_health (frame, event, unit, bar, min, max)
bar.value:SetText(format_value(min))
update_info(frame)
update_name(frame)
end
 
function update_power (frame, event, unit, bar, min, max)
138,15 → 135,19
bar:SetStatusBarColor(colors.r, colors.g, colors.b)
end
bar.value:SetText(format_value(min > 0 and min or ''))
update_info(frame)
update_name(frame)
end
 
function update_info (frame)
function update_name (frame)
local unit = frame.unit
if not UnitExists(unit) then return end
 
frame.Name:SetText(('%s%s'):format(unit_name(unit), unit_tapped(unit)))
frame.Info:SetText(('%s %s'):format(unit_level(unit), unit_threat(unit)))
frame.Name:SetText(('%s %s%s %s'):format(
unit_level(unit),
unit_name(unit),
unit_tapped(unit),
unit_threat(unit)
))
end
 
function create_unitframe (frame, unit)
202,7 → 203,7
power.info:SetShadowColor(0, 0, 0)
power.info:SetShadowOffset(1, -1)
 
power.value:SetPoint(MR, power, MR, -text_inset, 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))
216,19 → 217,19
castbar:SetStatusBarColor(unpack(cast_color))
 
-- buffs
local height = padding + health_height + spacing / 2
local height = padding + health_height + spacing + power_height + padding
local width = health_width
local number = math.floor(width / height) * 2
buffs:SetPoint(BL, frame, TL, 0, buff_margin)
local number = math.floor(width / height)
buffs:SetPoint(TR, frame, TL, -padding / 2, 0)
buffs:SetWidth(width)
buffs:SetHeight(height)
buffs.size = height
buffs.num = number
buffs.initialAnchor = BL
buffs['growth-x'] = 'RIGHT'
buffs['growth-y'] = 'UP'
buffs.initialAnchor = TR
buffs['growth-x'] = 'LEFT'
buffs['growth-y'] = 'DOWN'
 
debuffs:SetPoint(TL, frame, BL, 0, -buff_margin)
debuffs:SetPoint(ML, frame, MR, padding / 2, 0)
debuffs:SetWidth(width)
debuffs:SetHeight(height)
debuffs.size = height
281,92 → 282,62
frame.Threat = threat
end
 
function create_player_unitframe (frame, unit)
function create_pet_unitframe(frame, unit)
create_unitframe(frame, unit)
 
frame.Buffs:ClearAllPoints()
frame.Buffs:SetPoint(TR, frame, TL, -buff_margin, 0)
frame.Buffs.initialAnchor = TR
frame.Buffs['growth-x'] = 'LEFT'
frame.Buffs['growth-y'] = 'DOWN'
end
local happiness = frame.Health:CreateTexture()
happiness:SetPoint(MC, frame, BR)
happiness:SetWidth(16)
happiness:SetHeight(16)
 
function create_target_unitframe (frame, unit)
create_unitframe(frame, unit)
 
frame.Buffs:ClearAllPoints()
frame.Buffs:SetPoint(TL, frame, TR, buff_margin, 0)
frame.Buffs.initialAnchor = TL
frame.Buffs['growth-x'] = 'RIGHT'
frame.Buffs['growth-y'] = 'DOWN'
 
frame.Debuffs:ClearAllPoints()
frame.Debuffs:SetPoint(TL, frame, BL, 0, -buff_margin)
frame.Debuffs.initialAnchor = TL
frame.Debuffs['growth-x'] = 'RIGHT'
frame.Debuffs['growth-y'] = 'DOWN'
frame.Happiness = happiness
end
 
function create_targettarget_unitframe (frame, unit)
function create_party_unitframe (frame, unit)
create_unitframe(frame, unit)
 
frame.Power:SetHeight(0)
-- out of range fading
frame.Range = true
frame.inRangeAlpha = 1
frame.outsideRangeAlpha = 0.5
 
frame:SetAttribute('initial-height', frame.Health:GetHeight() + padding)
local buffs = frame.Buffs
 
frame.Power = nil
frame.PostUpdatePower = nil
frame.Buffs = nil
frame.Debuffs = nil
local size = 16
local width = power_width
local height = size
local number = math.floor(width / size)
buffs:SetPoint(TL, frame, BL, 0, -padding / 2)
buffs:SetWidth(width)
buffs:SetHeight(height)
buffs.size = size
buffs.num = number
buffs.initialAnchor = TL
buffs['growth-x'] = 'RIGHT'
buffs['growth-y'] = 'BOTTOM'
end
 
function create_pet_unitframe(frame, unit)
create_unitframe(frame, unit)
 
frame.Power:SetHeight(0)
 
frame:SetAttribute('initial-height', frame.Health:GetHeight() + padding)
 
local happiness = frame.Health:CreateTexture(nil, 'OVERLAY')
happiness:SetPoint(MC, frame, TL)
happiness:SetWidth(16)
happiness:SetHeight(16)
 
frame.Power = nil
frame.PostUpdatePower = nil
frame.Buffs = nil
frame.Debuffs = nil
frame.Happiness = happiness
end
 
function target_onupdate (frame)
-- the default ouf .+target updating is .5 seconds, I'd like it instant
frame:PLAYER_ENTERING_WORLD('OnTargetUpdate')
end
 
oUF:RegisterStyle('Industrial-player', create_player_unitframe)
oUF:RegisterStyle('Industrial-target', create_target_unitframe)
oUF:RegisterStyle('Industrial-targettarget', create_targettarget_unitframe)
oUF:RegisterStyle('Industrial', create_unitframe)
oUF:RegisterStyle('Industrial-pet', create_pet_unitframe)
 
oUF:SetActiveStyle('Industrial-player')
oUF:SetActiveStyle('Industrial-pet')
local pet = oUF:Spawn('pet', frame_name..'pet')
oUF:SetActiveStyle('Industrial')
local player = oUF:Spawn('player', frame_name..'player')
 
oUF:SetActiveStyle('Industrial-target')
local target = oUF:Spawn('target', frame_name..'target')
 
oUF:SetActiveStyle('Industrial-targettarget')
local targettarget = oUF:Spawn('targettarget', frame_name..'targettarget')
 
oUF:SetActiveStyle('Industrial-pet')
local pet = oUF:Spawn('pet', frame_name..'pet')
 
targettarget:SetScript('OnUpdate', target_onupdate)
 
player:SetPoint(MR, UIParent, MC, -offset_x - margin / 2, offset_y)
target:SetPoint(ML, UIParent, MC, offset_x + margin / 2, offset_y)
targettarget:SetPoint(BL, target, TL, 0, margin)
pet:SetPoint(BL, player, TL, 0, margin)
pet:SetPoint(MC, UIParent, MC, 0, -305)
player:SetPoint(BC, pet, TC, 0, margin)
target:SetPoint(BC, player, TC, 0, margin)
targettarget:SetPoint(BC, target, TC, 0, margin)
 
RuneFrame:Hide()