WoWInterface SVN oUF_Lyn

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 2 to Rev 3
    Reverse comparison

Rev 2 → Rev 3

trunk/oUF_Lyn/oUF_Lyn.lua
1,14 → 1,12
--[[ TODO:
party
raid
tot hp%
 
--]]
 
local localized, enclass = UnitClass('player')
local texture = [=[Interface\AddOns\oUF_Lyn\texture]=]
local font = [=[Interface\AddOns\oUF_Lyn\Swiss721.ttf]=]
 
local backdrop = {
bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], tile = true, tileSize = 16,
insets = {left = -2, right = -2, top = -2, bottom = -2},
}
 
local colors = setmetatable({
happiness = setmetatable({
[1] = {182/225, 34/255, 32/255},
57,24 → 55,22
end
 
local function PostUpdatePower(self, event, unit, bar, min, max)
if(bar.Text) then
local num, str = UnitPowerType(unit)
local pcolor = colors[str]
local num, str = UnitPowerType(unit)
local pcolor = colors[str]
 
if(min == 0) then
if(min == 0) then
bar.Text:SetText()
elseif(not UnitIsPlayer(unit) or not UnitIsConnected(unit)) then
bar.Text:SetText()
else
if(unit == 'player' and min == max) then
bar.Text:SetText()
elseif(not UnitIsPlayer(unit) or not UnitIsConnected(unit)) then
bar.Text:SetText()
else
if(unit == 'player' and min == max) then
bar.Text:SetText()
else
bar.Text:SetText(min)
end
bar.Text:SetText(min)
end
end
 
if(color) then bar.Text:SetTextColor(unpack(pcolor)) end
end
if(pcolor) then bar.Text:SetTextColor(unpack(pcolor)) end
end
 
local function PostCreateAuraIcon(self, button, icons)
96,7 → 92,7
local function CreateStyle(self, unit)
self.colors = colors
self.menu = menu
self.RegisterForClicks('AnyUp')
self:RegisterForClicks('AnyUp')
self:SetAttribute('type2', 'menu')
self:SetScript('OnEnter', UnitFrame_OnEnter)
self:SetScript('OnLeave', UnitFrame_OnLeave)
104,54 → 100,177
self:SetBackdrop(backdrop)
self:SetBackdropColor(0, 0, 0)
 
self.BarFade = true
self.BarFadeMinAlpha = 0.2
 
self.Health = CreateFrame('StatusBar', nil, self)
self.Health:SetPoint('TOPRIGHT', self)
self.Health.SetPoint('TOPLEFT', self)
self.Health:SetPoint('TOPLEFT', self)
self.Health:SetStatusBarTexture(texture)
self.Health:SetHeight((unit == 'player' or unit == 'target') and 15.5 or 18)
self.Health.colorClass = true
self.Health.colorReaction = true
self.Health.colorDisconnected = true
self.Health.colorTapping = true
 
self.Health.bg = self.Health:CreateTexture(nil, 'BORDER')
self.Health.bg:SetAllPoints(self.Health)
self.Health.bg:SetTexture(texture)
self.Health.bg:SetAlpha(0.3)
 
if(unit == 'pet') then
if(enclass == 'HUNTER') then
self.Health.colorReaction = true
self.Health.colorClass = true
self.Health.colorHappiness = true
end
else
self.Health.Text = self.Health:CreateFontStrin(nil, 'OVERLAY')
self.Health.Text:SetPoint('RIGHT', -2, 2)
self.RaidIcon = self.Health:CreateTexture(nil, 'OVERLAY')
self.RaidIcon:SetPoint('TOP', self, 0, 9)
self.RaidIcon:SetHeight(16)
self.RaidIcon:SetWidth(16)
 
if(unit == 'player' or unit == 'target') then
self:SetAttribute('initial-height', 20)
self:SetAttribute('initial-width', 250)
 
self.Health.Text = self.Health:CreateFontString(nil, 'OVERLAY')
self.Health.Text:SetPoint('RIGHT', 0, 9)
self.Health.Text:SetFont(font, 15, 'OUTLINE')
self.Health.Text:SetTextColor(1, 1, 1)
self.Health.Text:SetShadowOffset(1, -1)
 
self.PostUpdateHealth = PostUpdateHealth
 
self.Power = CreateFrame('StatusBar', nil, self)
self.Power:SetPoint('TOPRIGHT', self.Health, 'BOTTOMRIGHT', 0, -1.45)
self.Power:SetPoint('BOTTOMLEFT', self)
self.Power:SetHeight(3)
self.Power:SetStatusBarTexture(texture)
self.Power.colorDisconnected = true
self.Power.colorTapping = true
self.Power.colorClass = true
self.Power.colorPower = true
 
self.PostUpdatePower = PostUpdatePower
 
self.Power.bg = self.Power:CreateTexture(nil, 'BORDER')
self.Power.bg:SetAllPoints(self.Power)
self.Power.bg:SetTexture(texture)
self.Power.bg:SetAlpha(0.3)
 
self.Power.Text = self.Health:CreateFontString(nil, 'OVERLAY')
self.Power.Text:SetPoint('RIGHT', self.Health.Text, 'BOTTOMRIGHT', 0, -5)
self.Power.Text:SetFont(font, 15, 'OUTLINE')
self.Power.Text:SetTextColor(1, 1, 1)
self.Power.Text:SetShadowOffset(1, -1)
 
self.Castbar = CreateFrame('StatusBar', nil, self)
self.Castbar:SetStatusBarTexture(texture)
self.Castbar:SetHeight(24)
 
if(unit == 'player') then
self.Castbar:SetPoint('CENTER', UIParent, 0, -300)
self.Castbar:SetStatusBarColor(1, 0.5, 0)
self.Castbar:SetWidth(260)
self.Castbar:SetBackdrop(backdrop)
self.Castbar:SetBackdropColor(0, 0, 0, 0.5)
 
self.Castbar.SafeZone = self.Castbar:CreateTexture(nil, 'ARTWORK')
self.Castbar.SafeZone:SetTexture(texture)
self.Castbar.SafeZone:SetVertexColor(0.75, 0.1, 0.1, 0.6)
self.Castbar.SafeZone:SetPoint('TOPRIGHT')
self.Castbar.SafeZone:SetPoint('BOTTOMRIGHT')
else
self.Castbar:SetPoint('CENTER', UIParent, 11, -200)
self.Castbar:SetStatusBarColor(0.8, 0, 0)
self.Castbar:SetWidth(286)
self.Castbar:SetBackdrop({
bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], tile = true, tileSize = 16,
insets = {left = -30, right = -3, top = -3, bottom = -3},
})
self.Castbar:SetBackdropColor(0, 0, 0, 0.5)
 
self.Castbar.Icon = self.Castbar:CreateTexture(nil, 'ARTWORK')
self.Castbar.Icon:SetPoint('RIGHT', self.Castbar, 'LEFT', -3, 0)
self.Castbar.Icon:SetHeight(24)
self.Castbar.Icon:SetWidth(24)
self.Castbar.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
end
 
self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BORDER')
self.Castbar.bg:SetAllPoints(self.Castbar)
self.Castbar.bg:SetTexture(0, 0, 0, 0.6)
 
self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY')
self.Castbar.Text:SetPoint('LEFT', self.Castbar, 2, 0)
self.Castbar.Text:SetFont(font, 11, 'OUTLINE') -- TODO: UPPERCASE
self.Castbar.Text:SetTextColor(1, 1, 1)
self.Castbar.Text:SetShadowOffset(1, -1)
self.Castbar.Text:SetJustifyH('LEFT')
 
self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY')
self.Castbar.Time:SetPoint('RIGHT', self.Castbar, -2, 0)
self.Castbar.Time:SetFont(font, 12, 'OUTLINE') -- TODO: UPPERCASE
self.Castbar.Time:SetTextColor(1, 1, 1)
self.Castbar.Time:SetJustifyH('RIGHT')
end
 
if(unit == 'player' or unit == 'target') then
self:SetAttribute('initial-height', 20)
self:SetAttribute('initial-width', 250)
if(unit == 'player') then
self.Leader = self.Health:CreateTexture(nil, 'OVERLAY')
self.Leader:SetPoint('BOTTOMRIGHT', self, -2, 4)
self.Leader:SetHeight(12)
self.Leader:SetWidth(12)
 
 
-- druidpower
end
 
if(unit == 'target') then
self.Health.colorClass = false
 
self.RaidIcon:SetPoint("RIGHT", self, 30, 0)
self.RaidIcon:SetHeight(24)
self.RaidIcon:SetWidth(24)
 
self.CPoints = self:CreateFontString(nil, 'OVERLAY')
self.CPoints:SetPoint('RIGHT', self, 'LEFT', -10, 0)
self.CPoints:SetFont(font, 38, 'OUTLINE')
self.CPoints:SetTextColor(0, 0.8, 1)
self.CPoints:SetShadowOffset(1, -1)
self.CPoints:SetJustifyH('RIGHT')
self.CPoints.unit = 'player'
 
self.Buffs = CreateFrame('Frame', nil, self)
self.Buffs:SetHeight(22)
self.Buffs:SetWidth(110)
self.Buffs:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', -2, 15)
self.Buffs.initialAnchor = 'BOTTOMLEFT'
self.Buffs.spacing = 2
self.Buffs.size = 22
self.Buffs.num = 20
 
self.Debuffs = CreateFrame('Frame', nil, self)
self.Debuffs:SetHeight(30)
self.Debuffs:SetWidth(198)
self.Debuffs:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', -2, -6)
self.Debuffs.initialAnchor = 'TOPLEFT'
self.Debuffs.spacing = 2
self.Debuffs.size = 22
self.Debuffs['growth-y'] = 'DOWN'
 
-- name + level tag, level colored by class if player, difficulty else
 
self.PostCreateAuraIcon = PostCreateAuraIcon
end
 
if(unit == 'pet' or unit == 'targettarget' or unit == 'focus') then
self:SetAttribute('initial-height', 18)
self:SetAttribute('initial-width', 120)
 
self.BarFade = true
self.BarFadeMinAlpha = 0.2
end
-- tags: %hp + name
 
if(unit == 'targettarget' or unit == 'focus') then
local name = self.Health:CreateFontString(nil, 'OVERLAY')
 
self:Tag(name, '[name][smartlevel]')
if(unit == 'pet' and enclass == 'HUNTER') then
self.Health.colorReaction = true
self.Health.colorClass = true
self.Health.colorHappiness = true
end
end
 
self.disallowVehicleSwap = true
 
return self
end