Thread Tools Display Modes
12-01-09, 05:57 PM   #1
Tastyfrog
A Deviate Faerie Dragon
Join Date: Mar 2009
Posts: 15
Layout help

I am working on creating my own layout. Right now i am just modding oUF Lily and using bits and pieces from other layouts... However, I am having trouble changing the font.

Here's my layout:
Code:
local statusbar = "Interface\\AddOns\\oUF_tSmooth\\textures\\HalM"
local font = "Interface\\AddOns\\oUF_tSmooth\\textures\\HalM"

local fontString = function(parent, size)
	local fs = parent:CreateFontString(nil, "OVERLAY")
	fs:SetFont("Interface\\AddOns\\oUF_tSmooth\\textures\\HalM", size, "OUTLINE")
	return fs
end
local menu = function(self)
	local unit = self.unit:sub(1, -2)
	local cunit = self.unit:gsub("(.)", string.upper, 1)

	if(unit == "party" or unit == "partypet") then
		ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor", 0, 0)
	elseif(_G[cunit.."FrameDropDown"]) then
		ToggleDropDownMenu(1, nil, _G[cunit.."FrameDropDown"], "cursor", 0, 0)
	end
end

local updateName = function(self, event, unit)
	if(self.unit == unit) then
		local r, g, b, t
		if(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) or not UnitIsConnected(unit)) then
			r, g, b = .6, .6, .6
		elseif(unit == 'pet') then
			t = self.colors.happiness[GetPetHappiness()]
		elseif(UnitIsPlayer(unit)) then
			local _, class = UnitClass(unit)
			t = self.colors.class[class]
		else
			r, g, b = UnitSelectionColor(unit)
		end

		if(t) then
			r, g, b = t[1], t[2], t[3]
		end

		if(r) then
			self.Name:SetTextColor(r, g, b)
		end
	end
end

local updateRIcon = function(self, event)
	local index = GetRaidTargetIndex(self.unit)
	if(index) then
		self.RIcon:SetText(ICON_LIST[index].."22|t")
	else
		self.RIcon:SetText()
	end
end

local shortValue = function(value)
	if value >= 1e6 then
		return ("%.1fm"):format(value / 1e6):gsub("%.?0+([km])$", "%1")
	elseif value >= 1e3 or value <= -1e3 then
		return ("%.1fk"):format(value / 1e3):gsub("%.?0+([km])$", "%1")
	else
		return value
	end
end

local PostCastStart = function(self, event, unit, spell, spellrank, castid)
	self.Name:SetText(spell)
end

local PostCastStop = function(self, event, unit)
	-- Needed as we use it as a general update function.
	if(unit ~= self.unit) then return end
	self.Name:SetText(UnitName(unit))
end

local updateHealth = function(self, event, unit, bar, min, max)
	if(UnitIsDead(unit)) then
		bar:SetValue(0)
		bar.value:SetText"Dead"
	elseif(UnitIsGhost(unit)) then
		bar:SetValue(0)
		bar.value:SetText"Ghost"
	elseif(not UnitIsConnected(unit)) then
		bar.value:SetText"Offline"
	else
		if(not UnitIsFriend('player', unit)) then
			bar.value:SetFormattedText('%s', shortValue(min))
		elseif(min ~= 0 and min ~= max) then
			bar.value:SetFormattedText("-%s", shortValue(max - min))
		else
			bar.value:SetText(max)
		end
	end
	updateName(self, event, unit)
end

local updatePower = function(self, event, unit, bar, min, max)
	if(min == 0 or max == 0 or not UnitIsConnected(unit)) then
		bar.value:SetText()
		bar:SetValue(0)
	elseif(UnitIsDead(unit) or UnitIsGhost(unit)) then
		bar:SetValue(0)
	else
		bar.value:SetFormattedText("%s | ", shortValue(min))
	end
end


local function hookTooltip(self)
	if(self.owner) then
		if(self.owner == 'vehicle' or self.owner == 'pet') then
			GameTooltip:AddLine(format('Cast by %s <%s>', UnitName(self.owner), UnitName('player')))
		elseif(self.owner:match('^partypet[1-4]$')) then
			GameTooltip:AddLine(format('Cast by %s <%s>', UnitName(self.owner), UnitName(format('party%d', self.owner:gsub('^partypet(%d)$', '%1')))))
		elseif(self.owner:match('^raidpet[1-40]$')) then
			GameTooltip:AddLine(format('Cast by %s <%s>', UnitName(self.owner), UnitName(format('raid%d', self.owner:gsub('^raidpet(%d)$', '%1')))))
		else
			GameTooltip:AddLine(format('Cast by %s', UnitName(self.owner)))
		end
	else
		GameTooltip:AddLine(format('Cast by %s', UNKNOWN))
	end

	GameTooltip:Show()
end

local function postCreate(self, button, icons)
	icons.showDebuffType = true
	icons.disableCooldown = true

	button:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {top = -1, bottom = -1, left = -1, right = -1}})
	button:SetBackdropColor(0, 0, 0)
	button.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93)
	button.icon:SetDrawLayer('ARTWORK')
	button.overlay:SetTexture()

	button.time = fontString(button, 7)
	button.time:SetPoint('BOTTOM', button, 0, -15)
	button.time:SetTextColor(1, 0.2, 0.2)

	button:HookScript('OnEnter', hookTooltip)
end

local function updateTime(self, elapsed)
	self.timeLeft = max(self.timeLeft - elapsed, 0)
	self.time:SetText(self.timeLeft < 90 and floor(self.timeLeft) or '')
	
	if(GameTooltip:IsOwned(self)) then
		GameTooltip:SetUnitAura(self.frame.unit, self:GetID(), self.filter)
		hookTooltip(self)
	end
end

local function postUpdate(self, icons, unit, icon, index)
	local _, _, _, _, dtype, duration, expiration, unitCaster = UnitAura(unit, index, icon.filter)
	if(unitCaster ~= 'player') then
		icon.icon:SetDesaturated(true)
	end
	if(duration and duration > 0 and expiration) then
		icon.timeLeft = expiration - GetTime()
		icon:SetScript('OnUpdate', updateTime)
	else
		icon.time:SetText()
		icon:SetScript('OnUpdate', nil)
	end
icon.time:SetText()
	if(icon.debuff) then
		local color = DebuffTypeColor[dtype] or DebuffTypeColor.none
		icon:SetBackdropColor(color.r * 0.6, color.g * 0.6, color.b * 0.6)
	else
		icon:SetBackdropColor(0,0,0)
	end
end

local function customFilter(icons, unit, icon, name, rank, texture, count, dtype, duration, expiration, owner)
	       local isPlayer
	       if(caster == 'player' or caster == 'vehicle') then
	               isPlayer = true
	       end
		
	       if((icons.onlyShowPlayer and isPlayer) or (not icons.onlyShowPlayer and name)) then
	               icon.isPlayer = isPlayer
	               icon.owner = caster
	               -- We set it to math.huge, because it lasts until cancelled.
	               if(timeLeft == nil) then
	                       icon.timeLeft = math.huge
	               else
	                       icon.timeLeft = timeLeft
	               end
	               return true
	       end
end

local prePosition = function(self, auras, n)
 for i=1, n do
              local icon = auras[i]
               if(not icon:IsShown()) then
                       icon.timeLeft = -1
               end
       end
	table.sort(auras, function(a,b) return (a.timeLeft and a.timeLeft) > (b.timeLeft and b.timeLeft) end)
end

local func = function(self, unit)
	self.menu = menu

	self:SetScript("OnEnter", UnitFrame_OnEnter)
	self:SetScript("OnLeave", UnitFrame_OnLeave)

	self:RegisterForClicks"anyup"
	self:SetAttribute("*type2", "menu")


	self.Health = CreateFrame("StatusBar")
	self.Health:SetStatusBarTexture(statusbar)
	self.Health:SetWidth((unit == "targettarget" and 50 or 149))
	self.Health:SetHeight(9)
	
	self.Health.colorTapping = true
	self.Health.colorReaction = true
	self.Health.colorDisconnected = true
	self.Health.frequentUpdates = true
	self.Health.colorClass = true

	self.Health:SetParent(self)
	self.Health:SetPoint("TOP")

	self.Health.bg = self.Health:CreateTexture(nil, "BORDER")
	self.Health.bg:SetPoint("TOPRIGHT", 1, 1)
	self.Health.bg:SetPoint("BOTTOMLEFT", -1, -1)
	self.Health.bg:SetTexture(statusbar)
	self.Health.bg.multiplier = 0.33

	self.Health.value = fontString(self.Health, 7)
	self.Health.value:SetPoint("RIGHT", -2, -1)
	self.Health.value:SetFontObject(GameFontNormalSmall)
	self.Health.value:SetTextColor(1, 1, 1)


	self.Power = CreateFrame"StatusBar"
	self.Power:SetHeight(1)
	self.Power:SetWidth((unit == "targettarget" and 50 or 149))
	self.Power:SetStatusBarTexture(statusbar)

	self.Power.frequentUpdates = true
	self.Power.colorTapping = true
	self.Power.colorPower = true

	self.Power:SetParent(self)
	self.Power:SetPoint("TOP")
	self.Power:SetPoint("TOP", self.Health, "BOTTOM",0,-1)
	
	self.Power.bg = self.Power:CreateTexture(nil, "BORDER")
	self.Power.bg:SetPoint("TOPRIGHT", 1, 1)
	self.Power.bg:SetPoint("BOTTOMLEFT", -1, -1)
	self.Power.bg:SetTexture(statusbar)
	self.Power.bg.multiplier = 0.33

	self.Power.value = self.Power:CreateFontString(nil, "OVERLAY")
	self.Power.value:SetPoint("RIGHT", self.Health.value, "LEFT", 0, 0)
	self.Power.value:SetFontObject(GameFontNormalSmall)
	self.Power.value:SetTextColor(1, 1, 1)

	self.PostUpdatePower = updatePower

	if(unit ~= 'targettarget') then
		self.Castbar = CreateFrame"StatusBar"
		self.Castbar:SetStatusBarTexture(statusbar)
		self.Castbar:SetStatusBarColor(1, .25, .35, .5)
		self.Castbar:SetParent(self)
		self.Castbar:SetAllPoints(self.Health)
		self.Castbar:SetToplevel(true)
	end

	self.Leader = self:CreateTexture(nil, "OVERLAY")
	self.Leader:SetHeight(16)
	self.Leader:SetWidth(16)
	self.Leader:SetPoint("BOTTOM", self.Health, "TOP", 0, -5)
	self.Leader:SetTexture"Interface\\GroupFrame\\UI-Group-LeaderIcon"

	self.MasterLooter = self:CreateTexture(nil, 'OVERLAY')
	self.MasterLooter:SetHeight(16)
	self.MasterLooter:SetWidth(16)
	self.MasterLooter:SetPoint('LEFT', leader, 'RIGHT')

	self.RIcon = self.Health:CreateFontString(nil, "OVERLAY")
	self.RIcon:SetPoint("LEFT", 2, 4)
	self.RIcon:SetJustifyH"LEFT"
	self.RIcon:SetFontObject(GameFontNormalSmall)
	self.RIcon:SetTextColor(1, 1, 1)
	self:RegisterEvent("RAID_TARGET_UPDATE", updateRIcon)
	table.insert(self.__elements, updateRIcon)

	self.Name = self.Health:CreateFontString(nil, "OVERLAY")
	self.Name:SetPoint("LEFT", ricon, "RIGHT", 0, -5)
	self.Name:SetPoint("RIGHT", self.Power.value, "LEFT")
	self.Name:SetJustifyH"LEFT"
	self.Name:SetFontObject(GameFontNormalSmall)
	self.Name:SetTextColor(1, 1, 1)
	
	if(unit == "player") then
		self.Buffs = CreateFrame('Frame', nil, UIParent)
		self.Buffs:SetPoint('TOPRIGHT', "UIParent", -10, -10)
		self.Buffs:SetHeight(110)
		self.Buffs:SetWidth(400)
		self.Buffs.size = 20
		self.Buffs.spacing = 12
		self.Buffs.initialAnchor = 'TOPRIGHT'
		self.Buffs['growth-x'] = 'LEFT'
		self.Buffs['growth-y'] = 'DOWN'

		self.Debuffs = CreateFrame('Frame', nil, UIParent)
		self.Debuffs:SetPoint('TOPRIGHT', self.Buffs, 'BOTTOMRIGHT', 0, -15)
		self.Debuffs:SetHeight(110)
		self.Debuffs:SetWidth(400)
		self.Debuffs.size = 20
		self.Debuffs.spacing = 12
		self.Debuffs.initialAnchor = 'TOPRIGHT'
		self.Debuffs['growth-x'] = 'LEFT'
		self.Debuffs['growth-y'] = 'DOWN'
	

		BuffFrame:Hide()
		BuffFrame:UnregisterEvent('UNIT_AURA')
		TemporaryEnchantFrame:Hide()
		TemporaryEnchantFrame:SetScript('OnUpdate', nil)
		TicketStatusFrame:EnableMouse(false)
		TicketStatusFrame:SetFrameStrata('BACKGROUND')
	elseif (unit == "focus" or unit == "target") then
		self.Buffs = CreateFrame('Frame', nil, UIParent)
		self.Buffs:SetPoint('TOPLEFT', self.Health, 0, -15)
		self.Buffs:SetHeight(15)
		self.Buffs:SetWidth(400)
		self.Buffs.size = 10
		self.Buffs.spacing = 4
		self.Buffs.initialAnchor = 'TOPLEFT'
		self.Buffs['growth-x'] = 'RIGHT'
		self.Buffs['growth-y'] = 'DOWN'

		self.Debuffs = CreateFrame('Frame', nil, UIParent)
		self.Debuffs:SetPoint('TOPLEFT', self.Buffs, 'BOTTOMLEFT', 0, -15)
		self.Debuffs:SetHeight(15)
		self.Debuffs:SetWidth(400)
		self.Debuffs.size = 10
		self.Debuffs.spacing = 4
		self.Debuffs.initialAnchor = 'TOPLEFT'
		self.Debuffs['growth-x'] = 'RIGHT'
		self.Debuffs['growth-y'] = 'DOWN'
		
		
		self.Buffs.numBuffs = 11
		self.Debuffs.numDebuffs = 11
		else
	end

	if(unit == 'pet') then
		self:RegisterEvent("UNIT_HAPPINESS", updateName)
	end

	if(not unit) then
		self.Range = true
		self.inRangeAlpha = 1
		self.outsideRangeAlpha = .5
	end

	self:SetAttribute('initial-height', 15)
	self:SetAttribute('initial-width', 200)


	-- We inject our fake name element early in the cycle, in-case there is a
	-- spell cast in progress on the unit we target.
	self:RegisterEvent('UNIT_NAME_UPDATE', PostCastStop)
	table.insert(self.__elements, 2, PostCastStop)

	self.PostCastStop = PostCastStop
	self.PostChannelStop = PostCastStop
	self.PreAuraSetPosition = prePosition
	self.PostCreateAuraIcon = postCreate
	self.PostUpdateAuraIcon = postUpdate
	self.CustomAuraFilter = customFilter
	


	return self
end

oUF:RegisterStyle("Lily", func)

--[[
-- oUF does to this for, but only for the first layout registered. I'm mainly
-- adding it here so people know about it, especially since it's required for
-- layouts using different styles between party/partypet/raid/raidpet. It is
-- however smart to execute this function regardless.
--
-- There is a possibility that another layout has been registered before yours.
--]]
oUF:SetActiveStyle"Lily"

-- :Spawn(unit, frame_name, isPet) --isPet is only used on headers.
local focus = oUF:Spawn"focus"
focus:SetPoint("CENTER", 0, -500)
local pet = oUF:Spawn'pet'
pet:SetPoint('CENTER', 0, -450)
local player = oUF:Spawn"player"
player:SetPoint("CENTER", 0, -100)
local target = oUF:Spawn"target"
target:SetPoint("CENTER", 200, 99)
local tot = oUF:Spawn"targettarget"
tot:SetPoint("CENTER", 311, 99)
local party = oUF:Spawn("header", "oUF_Party")
party:SetPoint("TOPLEFT", 30, -30)
party:SetManyAttributes("showParty", true, "yOffset", -25)
party:Show()
and i get this error:
Code:
[2009/12/01 15:53:56-1270-x1]: oUF_tSmooth-o.1\main.lua:164: <unnamed>:SetText(): Font not set
oUF_tSmooth-o.1\main.lua:164: in function `PostUpdateAuraIcon'
oUF-1.3.21\elements\aura.lua:173: in function <Interface\AddOns\oUF\elements\aura.lua:129>
oUF-1.3.21\elements\aura.lua:264: in function `func'
oUF-1.3.21\ouf.lua:506: in function <Interface\AddOns\oUF\ouf.lua:501>
(tail call): ?:
any suggestions?
  Reply With Quote
12-01-09, 07:41 PM   #2
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
Code:
local font = "Interface\\AddOns\\oUF_tSmooth\\textures\\HalM"
thats your problem. Your trying to make your font a texture :P

Also, end the font with .ttf
  Reply With Quote
12-01-09, 08:01 PM   #3
Tastyfrog
A Deviate Faerie Dragon
Join Date: Mar 2009
Posts: 15
wow.. thanks a lot
  Reply With Quote
12-02-09, 06:58 PM   #4
Tastyfrog
A Deviate Faerie Dragon
Join Date: Mar 2009
Posts: 15
Now I am having a problem with auras. If i target someone then hit esc or deselect them, the target unit frame goes away (good), but the auras stay (bad).

heres my current code
Code:
local statusbar = "Interface\\AddOns\\oUF_tSmooth\\textures\\HalM"
local font = "Fonts\\visitor.TTF"

local fontString = function(parent, size)
	local fs = parent:CreateFontString(nil, "OVERLAY")
	fs:SetFont(font, size, "OUTLINE")
	return fs
end
local menu = function(self)
	local unit = self.unit:sub(1, -2)
	local cunit = self.unit:gsub("(.)", string.upper, 1)

	if(unit == "party" or unit == "partypet") then
		ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor", 0, 0)
	elseif(_G[cunit.."FrameDropDown"]) then
		ToggleDropDownMenu(1, nil, _G[cunit.."FrameDropDown"], "cursor", 0, 0)
	end
end
--[[
local updateName = function(self, event, unit)
	if(self.unit == unit) then
		local r, g, b, t
		if(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) or not UnitIsConnected(unit)) then
			r, g, b = .6, .6, .6
		elseif(unit == 'pet') then
			t = self.colors.happiness[GetPetHappiness()]
		elseif(UnitIsPlayer(unit)) then
			local _, class = UnitClass(unit)
			t = self.colors.class[class]
		else
			r, g, b = UnitSelectionColor(unit)
		end

		if(t) then
			r, g, b = t[1], t[2], t[3]
		end

		if(r) then
			self.Name:SetTextColor(r, g, b)
		end
	end
end
]]--
local updateRIcon = function(self, event)
	local index = GetRaidTargetIndex(self.unit)
	if(index) then
		self.RIcon:SetText(ICON_LIST[index].."22|t")
	else
		self.RIcon:SetText()
	end
end

local shortValue = function(value)
	if value >= 1e6 then
		return ("%.1fm"):format(value / 1e6):gsub("%.?0+([km])$", "%1")
	elseif value >= 1e3 or value <= -1e3 then
		return ("%.1fk"):format(value / 1e3):gsub("%.?0+([km])$", "%1")
	else
		return value
	end
end

local PostCastStart = function(self, event, unit, spell, spellrank, castid)
	self.Name:SetText(spell)
end

local PostCastStop = function(self, event, unit)
	-- Needed as we use it as a general update function.
	if(unit ~= self.unit) then return end
	--self.Name:SetText(UnitName(unit))
end
--[[
local updateHealth = function(self, event, unit, bar, min, max)
	if(UnitIsDead(unit)) then
		bar:SetValue(0)
		bar.value:SetText"Dead"
	elseif(UnitIsGhost(unit)) then
		bar:SetValue(0)
		bar.value:SetText"Ghost"
	elseif(not UnitIsConnected(unit)) then
		bar.value:SetText"Offline"
	else
		if(not UnitIsFriend('player', unit)) then
			bar.value:SetFormattedText('%s', shortValue(min))
		elseif(min ~= 0 and min ~= max) then
			bar.value:SetFormattedText("-%s", shortValue(max - min))
		else
			bar.value:SetText(max)
		end
	end
	updateName(self, event, unit)
end

local updatePower = function(self, event, unit, bar, min, max)
	if(min == 0 or max == 0 or not UnitIsConnected(unit)) then
		bar.value:SetText()
		bar:SetValue(0)
	elseif(UnitIsDead(unit) or UnitIsGhost(unit)) then
		bar:SetValue(0)
	else
		bar.value:SetFormattedText("%s | ", shortValue(min))
	end
end
]]--

local function hookTooltip(self)
	if(self.owner) then
		if(self.owner == 'vehicle' or self.owner == 'pet') then
			GameTooltip:AddLine(format('Cast by %s <%s>', UnitName(self.owner), UnitName('player')))
		elseif(self.owner:match('^partypet[1-4]$')) then
			GameTooltip:AddLine(format('Cast by %s <%s>', UnitName(self.owner), UnitName(format('party%d', self.owner:gsub('^partypet(%d)$', '%1')))))
		elseif(self.owner:match('^raidpet[1-40]$')) then
			GameTooltip:AddLine(format('Cast by %s <%s>', UnitName(self.owner), UnitName(format('raid%d', self.owner:gsub('^raidpet(%d)$', '%1')))))
		else
			GameTooltip:AddLine(format('Cast by %s', UnitName(self.owner)))
		end
	else
		GameTooltip:AddLine(format('Cast by %s', UNKNOWN))
	end

	GameTooltip:Show()
end

local function postCreate(self, button, icons)
	icons.showDebuffType = true
	icons.disableCooldown = true

	button:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {top = -1, bottom = -1, left = -1, right = -1}})
	button:SetBackdropColor(0, 0, 0)
	button.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93)
	button.icon:SetDrawLayer('ARTWORK')
	button.overlay:SetTexture()

	button.time = fontString(button, 7)
	button.time:SetPoint('BOTTOMLEFT', button, 0, 0)
	button.time:SetTextColor(1, 0.2, 0.2)

	button:HookScript('OnEnter', hookTooltip)
end

local function updateTime(self, elapsed)
	self.timeLeft = max(self.timeLeft - elapsed, 0)
	self.time:SetText(self.timeLeft < 90 and floor(self.timeLeft) or '')
	
	if(GameTooltip:IsOwned(self)) then
		GameTooltip:SetUnitAura(self.frame.unit, self:GetID(), self.filter)
		hookTooltip(self)
	end
end

local function postUpdate(self, icons, unit, icon, index)
	local _, _, _, _, dtype, duration, expiration, unitCaster = UnitAura(unit, index, icon.filter)
	if(unitCaster ~= 'player') then
		icon.icon:SetDesaturated(true)
	end
	if(duration and duration > 0 and expiration) then
		icon.timeLeft = expiration - GetTime()
		icon:SetScript('OnUpdate', updateTime)
	else
		icon.time:SetText()
		icon:SetScript('OnUpdate', nil)
	end
icon.time:SetText()
	if(icon.debuff) then
		local color = DebuffTypeColor[dtype] or DebuffTypeColor.none
		icon:SetBackdropColor(color.r * 0.6, color.g * 0.6, color.b * 0.6)
	else
		icon:SetBackdropColor(0,0,0)
	end
	
end

local function customFilter(icons, unit, icon, name, rank, texture, count, dtype, duration, expiration, owner)
	       local isPlayer
	       if(caster == 'player' or caster == 'vehicle') then
	               isPlayer = true
	       end
		
	       if((icons.onlyShowPlayer and isPlayer) or (not icons.onlyShowPlayer and name)) then
	               icon.isPlayer = isPlayer
	               icon.owner = caster
	               -- We set it to math.huge, because it lasts until cancelled.
	               if(timeLeft == nil) then
	                       icon.timeLeft = math.huge
	               else
	                       icon.timeLeft = timeLeft
	               end
	               return true
	       end
end

local prePosition = function(self, auras, n)
 for i=1, n do
              local icon = auras[i]
               if(not icon:IsShown()) then
                       icon.timeLeft = -1
               end
       end
	table.sort(auras, function(a,b) return (a.timeLeft and a.timeLeft) > (b.timeLeft and b.timeLeft) end)
end

local func = function(self, unit)
	self.menu = menu

	self:SetScript("OnEnter", UnitFrame_OnEnter)
	self:SetScript("OnLeave", UnitFrame_OnLeave)

	self:RegisterForClicks"anyup"
	self:SetAttribute("*type2", "menu")


	self.Health = CreateFrame("StatusBar")
	self.Health:SetStatusBarTexture(statusbar)
	self.Health:SetWidth((unit == "targettarget" and 50 or 149))
	self.Health:SetHeight(11)
	
	self.Health.colorTapping = true
	self.Health.colorReaction = true
	self.Health.colorDisconnected = true
	self.Health.frequentUpdates = true
	self.Health.colorClass = true

	self.Health:SetParent(self)
	self.Health:SetPoint("TOP")

	self.Health.bg = self.Health:CreateTexture(nil, "BORDER")
	self.Health.bg:SetPoint("TOPRIGHT", 1, 1)
	self.Health.bg:SetPoint("BOTTOMLEFT", -1, -1)
	self.Health.bg:SetTexture(statusbar)
	self.Health.bg.multiplier = 0.33

	self.Health.value = fontString(self.Health, 7)
	self.Health.value:SetPoint("TOPRIGHT", 5, 5)
	self:Tag(self.Health.value, (unit ~= "targettarget" and "[hp] : [perchp] : [pp]" or "[perchp]"))


	self.Power = CreateFrame"StatusBar"
	self.Power:SetHeight(1)
	self.Power:SetWidth((unit == "targettarget" and 50 or 149))
	self.Power:SetStatusBarTexture(statusbar)


	self.Power.colorTapping = true
	self.Power.colorPower = true

	self.Power:SetParent(self)
	self.Power:SetPoint("TOP")
	self.Power:SetPoint("TOP", self.Health, "BOTTOM",0,-1)
	
	self.Power.bg = self.Power:CreateTexture(nil, "BORDER")
	self.Power.bg:SetPoint("TOPRIGHT", 1, 1)
	self.Power.bg:SetPoint("BOTTOMLEFT", -1, -1)
	self.Power.bg:SetTexture(statusbar)
	self.Power.bg.multiplier = 0.33


	if(unit ~= 'targettarget') then
		self.Castbar = CreateFrame"StatusBar"
		self.Castbar:SetStatusBarTexture(statusbar)
		self.Castbar:SetStatusBarColor(1, .25, .35, .5)
		self.Castbar:SetParent(self)
		self.Castbar:SetAllPoints(self.Health)
		self.Castbar:SetToplevel(true)
	end

	self.Leader = self:CreateTexture(nil, "OVERLAY")
	self.Leader:SetHeight(16)
	self.Leader:SetWidth(16)
	self.Leader:SetPoint("BOTTOM", self.Health, "TOP", 0, -5)
	self.Leader:SetTexture"Interface\\GroupFrame\\UI-Group-LeaderIcon"

	self.MasterLooter = self:CreateTexture(nil, 'OVERLAY')
	self.MasterLooter:SetHeight(16)
	self.MasterLooter:SetWidth(16)
	self.MasterLooter:SetPoint('LEFT', leader, 'RIGHT')

	self.RIcon = self.Health:CreateFontString(nil, "OVERLAY")
	self.RIcon:SetPoint("LEFT", 2, 4)
	self.RIcon:SetJustifyH"LEFT"
	self.RIcon:SetFontObject(GameFontNormalSmall)
	self.RIcon:SetTextColor(1, 1, 1)
	self:RegisterEvent("RAID_TARGET_UPDATE", updateRIcon)
	table.insert(self.__elements, updateRIcon)

	self.Info = fontString(self.Health, 7)
	self.Info:SetPoint("TOPLEFT", self.Health, "TOPLEFT", -5, 5)
	self:Tag(self.Info, "[NameMedium] [lvl][shortclassification] [status]")
		
	if(unit == "player") then
		self.Buffs = CreateFrame('Frame', nil, UIParent)
		self.Buffs:SetPoint('TOPRIGHT', "UIParent", -10, -10)
		self.Buffs:SetHeight(110)
		self.Buffs:SetWidth(400)
		self.Buffs.size = 20
		self.Buffs.spacing = 12
		self.Buffs.initialAnchor = 'TOPRIGHT'
		self.Buffs['growth-x'] = 'LEFT'
		self.Buffs['growth-y'] = 'DOWN'

		self.Debuffs = CreateFrame('Frame', nil, UIParent)
		self.Debuffs:SetPoint('TOPRIGHT', self.Buffs, 'BOTTOMRIGHT', 0, -15)
		self.Debuffs:SetHeight(110)
		self.Debuffs:SetWidth(400)
		self.Debuffs.size = 20
		self.Debuffs.spacing = 12
		self.Debuffs.initialAnchor = 'TOPRIGHT'
		self.Debuffs['growth-x'] = 'LEFT'
		self.Debuffs['growth-y'] = 'DOWN'
	

		BuffFrame:Hide()
		BuffFrame:UnregisterEvent('UNIT_AURA')
		TemporaryEnchantFrame:Hide()
		TemporaryEnchantFrame:SetScript('OnUpdate', nil)
		TicketStatusFrame:EnableMouse(false)
		TicketStatusFrame:SetFrameStrata('BACKGROUND')
	elseif (unit == "focus" or unit == "target") then
		self.Buffs = CreateFrame('Frame', nil, UIParent)
		self.Buffs:SetPoint('TOPLEFT', self.Health, 0, -15)
		self.Buffs:SetHeight(15)
		self.Buffs:SetWidth(400)
		self.Buffs.size = 10
		self.Buffs.spacing = 4
		self.Buffs.initialAnchor = 'TOPLEFT'
		self.Buffs['growth-x'] = 'RIGHT'
		self.Buffs['growth-y'] = 'DOWN'

		self.Debuffs = CreateFrame('Frame', nil, UIParent)
		self.Debuffs:SetPoint('TOPLEFT', self.Buffs, 'BOTTOMLEFT', 0, -15)
		self.Debuffs:SetHeight(15)
		self.Debuffs:SetWidth(400)
		self.Debuffs.size = 10
		self.Debuffs.spacing = 4
		self.Debuffs.initialAnchor = 'TOPLEFT'
		self.Debuffs['growth-x'] = 'RIGHT'
		self.Debuffs['growth-y'] = 'DOWN'
		
		
		self.Buffs.numBuffs = 11
		self.Debuffs.numDebuffs = 11
		else
	end


	self:SetAttribute('initial-height', 15)
	self:SetAttribute('initial-width', 151)


	-- We inject our fake name element early in the cycle, in-case there is a
	-- spell cast in progress on the unit we target.
	self:RegisterEvent('UNIT_NAME_UPDATE', PostCastStop)
	table.insert(self.__elements, 2, PostCastStop)

	self.PostCastStop = PostCastStop
	self.PostChannelStop = PostCastStop
	self.PreAuraSetPosition = prePosition
	self.PostCreateAuraIcon = postCreate
	self.PostUpdateAuraIcon = postUpdate
	self.CustomAuraFilter = customFilter
	


	return self
end

oUF:RegisterStyle("Lily", func)

--[[
-- oUF does to this for, but only for the first layout registered. I'm mainly
-- adding it here so people know about it, especially since it's required for
-- layouts using different styles between party/partypet/raid/raidpet. It is
-- however smart to execute this function regardless.
--
-- There is a possibility that another layout has been registered before yours.
--]]
oUF:SetActiveStyle"Lily"

-- :Spawn(unit, frame_name, isPet) --isPet is only used on headers.
local focus = oUF:Spawn"focus"
focus:SetPoint("CENTER", 0, -500)
local pet = oUF:Spawn'pet'
pet:SetPoint('CENTER', 0, -450)
local player = oUF:Spawn"player"
player:SetPoint("CENTER", 0, -100)
local target = oUF:Spawn"target"
target:SetPoint("CENTER", 200, 99)
local tot = oUF:Spawn"targettarget"
tot:SetPoint("CENTER", 311, 99)
local party = oUF:Spawn("header", "oUF_Party")
party:SetPoint("TOPLEFT", 30, -30)
party:SetManyAttributes("showParty", true, "yOffset", -25)
party:Show()
any suggestions?
  Reply With Quote
12-02-09, 08:14 PM   #5
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
lua Code:
  1. CreateFrame('Frame', nil, UIParent)
equals: Create a frame without a name that's parented to UIParent. You'll want to use self instead, which is a reference to your frame.

You might want to take a look at oUF_Lily over at github as well.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
12-03-09, 02:43 AM   #6
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
What haste is going to tell you is that your main frames need to anchor "self".

Code:
self.Health = CreateFrame("StatusBar",nil,self)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
12-03-09, 05:25 PM   #7
Tastyfrog
A Deviate Faerie Dragon
Join Date: Mar 2009
Posts: 15
Yeah, i got that. Thanks for the help
  Reply With Quote
12-13-09, 12:33 AM   #8
Tastyfrog
A Deviate Faerie Dragon
Join Date: Mar 2009
Posts: 15
Im back for more help.
How could I invert a bar texture? like make all black parts white and all white parts black.
  Reply With Quote
12-13-09, 02:46 AM   #9
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
Just change the color of your bg and the color of your statusbar ?
Post a screen of what you want to do, because it's not really explicit right now.
  Reply With Quote
12-13-09, 01:47 PM   #10
Tastyfrog
A Deviate Faerie Dragon
Join Date: Mar 2009
Posts: 15
Heres a image http://dl.dropbox.com/u/28223/Screen...44.26%20AM.PNG
The bar on the left is the original and the one on the left is it inverted.
  Reply With Quote
12-13-09, 02:38 PM   #11
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
Just do as i said above.
Give your statusbar bg the original statusbar color and your statusbar the bg original color.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Layout help


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off