Thread Tools Display Modes
08-15-10, 03:31 PM   #1
Elen'
A Murloc Raider
 
Elen''s Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 8
Lag problem with Target's castbar when ToT is me

Hi,
I have a problem with my layout.

When my target casts a spell and I am his target, the FPS fall.

May be you can help-me?

The Lua error report:
Date: 2010-08-15 23:29:02
ID: 1
Error occured in: Global
Count: 1
Message: ..\AddOns\oUF\elements\castbar.lua line 39:
<unnamed>:SetText(): Font not set
Debug:
[C]: ?
[C]: SetText()
oUF\elements\castbar.lua:39:
oUF\elements\castbar.lua:15
oUF\elements\castbar.lua:417: func()
oUF\ouf.lua:320: UpdateAllElements()
oUF\ouf.lua:98:
oUF\ouf.lua:94
The castbar code:
Code:
	------------------------------------------------
	-- CASTBAR


	-- BAR --
		self.Castbar = CreateFrame('StatusBar', nil, self)
		self.Castbar:SetFrameStrata('MEDIUM')
		if unit == 'player' or unit == 'target' then 
			self.Castbar:SetWidth(235)
			self.Castbar:SetHeight(20)
			self.Castbar:SetPoint("CENTER", self.Health, "CENTER")
			self.Castbar:SetStatusBarTexture(statusbar)
			self.Castbar:SetStatusBarColor(0.8, 0.8, 0.8)
		end
		if unit == 'pet' then 
			self.Castbar:SetWidth(95)
			self.Castbar:SetHeight(20)
			self.Castbar:SetPoint("CENTER", UIParent, 'CENTER', -460, -153)
			self.Castbar:SetStatusBarTexture(statusbar)
			self.Castbar:SetStatusBarColor(0.8, 0.8, 0.8)
		end

	-- TEXT --
		self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY')
		if unit == 'player' then
			self.Castbar.Text:SetFont(font, 10, '')
			self.Castbar.Text:SetPoint('LEFT', self.Castbar,'LEFT',5, 0)
			self.Castbar.Text:SetWidth(160)
			self.Castbar.Text:SetTextColor(1,1,1)
			self.Castbar.Text:SetJustifyH('LEFT')
		end
		if unit == 'target' then
			self.Castbar.Text:SetFont(font, 10, '')
			self.Castbar.Text:SetPoint('RIGHT', self.Castbar,'RIGHT', -5, 0)
			self.Castbar.Text:SetWidth(160)
			self.Castbar.Text:SetTextColor(1,1,1)
			self.Castbar.Text:SetJustifyH('RIGHT')
		end
		if unit == 'pet' then
			self.Castbar.Text:SetFont(font, 8, '')
			self.Castbar.Text:SetPoint('RIGHT', self.Castbar,'RIGHT', 0, 0)
			self.Castbar.Text:SetShadowOffset(1, -1) 
			self.Castbar.Text:SetWidth(90)
			self.Castbar.Text:SetTextColor(1,1,1)
			self.Castbar.Text:SetJustifyH('RIGHT')
		end

	-- TIME --
		self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY') 
		if unit == 'player' then
			self.Castbar.Time:SetFont(font, 10, '')
			self.Castbar.Time:SetPoint('RIGHT', self.Castbar,'RIGHT',30, 0)
			self.Castbar.Time:SetShadowOffset(1, -1) 
			self.Castbar.Time:SetWidth(50)
			self.Castbar.Time:SetTextColor(1,1,1)
			self.Castbar.Time:SetJustifyH('LEFT')
		end
		if unit == 'target' then
			self.Castbar.Time:SetFont(font, 10, '')
			self.Castbar.Time:SetPoint('LEFT', self.Castbar,'LEFT',-30, 0)
			self.Castbar.Time:SetShadowOffset(1, -1) 
			self.Castbar.Time:SetWidth(50)
			self.Castbar.Time:SetTextColor(1,1,1)
			self.Castbar.Time:SetJustifyH('RIGHT')
		end
		if unit == 'pet' then
			self.Castbar.Time:SetFont(font, 8, '')
			self.Castbar.Time:SetPoint('LEFT', self.Castbar,'LEFT',-33, 0)
			self.Castbar.Time:SetShadowOffset(1, -1) 
			self.Castbar.Time:SetWidth(50)
			self.Castbar.Time:SetTextColor(1,1,1)
			self.Castbar.Time:SetJustifyH('RIGHT')
		end

Last edited by Elen' : 08-15-10 at 03:35 PM.
  Reply With Quote
08-15-10, 03:37 PM   #2
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Could you post your full layout, please?

I want to make sure you are not spawning a castbar for units other than player, target and pet.
  Reply With Quote
08-15-10, 04:51 PM   #3
Elen'
A Murloc Raider
 
Elen''s Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 8
The full layout:

Code:
------------------------------------------------------------------------------------------------
-- TEXTURES & FONT
------------------------------------------------------------------------------------------------

local statusbar = "Interface\\AddOns\\oUF_Elen\\media\\statusbar.tga"
local font = "Interface\\AddOns\\oUF_Elen\\media\\font.ttf"
local buffborder = "Interface\\AddOns\\oUF_Elen\\media\\buffborder.tga"
local backdrop = {
	bgFile = "Interface\\AddOns\\oUF_Elen\\media\\back.tga",
	insets = {top = -1.3, left = -1.3, bottom = -16.3, right = -1.3},
}
local totbackdrop = {
	bgFile = "Interface\\AddOns\\oUF_Elen\\media\\back.tga",
	insets = {top = -1.3, left = -1.3, bottom = -6.3, right = -1.3},
}
local pettarbackdrop = {
	bgFile = "Interface\\AddOns\\oUF_Elen\\media\\back.tga",
	insets = {top = -1.3, left = -1.3, bottom = -1.3, right = -1.3},
}
local statusbarback = {
	bgFile = "Interface\\AddOns\\oUF_Elen\\media\\statusbar.tga",
	insets = {top = 0, left = 0, bottom = 0, right = 0},
}


------------------------------------------------------------------------------------------------
-- PLAYERCLASS
------------------------------------------------------------------------------------------------

local playerClass = string.upper(select(2, UnitClass('player')))


------------------------------------------------------------------------------------------------
-- TAGS (thx to Sigyn)
------------------------------------------------------------------------------------------------

oUF.Tags["My_perhp"] = function(unit)

	local curhp, maxhp = UnitHealth(unit), UnitHealthMax(unit);

	if ((maxhp > 0) and (curhp < maxhp)) then

		return math.floor(curhp / maxhp * 100 + 0.5);

	end

end;
oUF.TagEvents["My_perhp"] = oUF.TagEvents.perhp;

oUF.Tags["My_curhp"] = function(unit)

	local curhp = UnitHealth(unit);

	if (curhp >= 1e6) then

		return string.format("%.1fm", curhp / 1e6);

	elseif (curhp >= 1e3) then

		return string.format("%.1fk", curhp / 1e3);

	else

		return curhp;

	end

end;
oUF.TagEvents["My_curhp"] = oUF.TagEvents.perhp;

oUF.Tags["My_maxhp"] = function(unit)

	local curhp = UnitHealthMax(unit);

	if (curhp >= 1e6) then

		return string.format("%.1fm", curhp / 1e6);

	elseif (curhp >= 1e3) then

		return string.format("%.1fk", curhp / 1e3);

	else

		return curhp;

	end

end;
oUF.TagEvents["My_maxhp"] = oUF.TagEvents.perhp;


------------------------------------------------------------------------------------------------
-- MENU
------------------------------------------------------------------------------------------------

local function menu(self)
	ToggleDropDownMenu(1, nil, _G[string.gsub(self.unit, '^.', string.upper)..'FrameDropDown'], 'cursor')
end


------------------------------------------------------------------------------------------------
-- MASTERLOOT UPDATE
------------------------------------------------------------------------------------------------

local function UpdateMasterLooter(self)
	self.MasterLooter:ClearAllPoints()
	if((UnitInParty(self.unit) or UnitInRaid(self.unit)) and UnitIsPartyLeader(self.unit)) then
		self.MasterLooter:SetPoint('RIGHT', self.Leader, 'LEFT')
	else
		self.MasterLooter:SetPoint('BOTTOM', self.Health, 'TOPRIGHT', 0, 11)
	end
end


------------------------------------------------------------------------------------------------
-- HIDE PARTY FRAME (taken from HidePartyFrame)
------------------------------------------------------------------------------------------------

local frame = CreateFrame("FRAME", "HPFAddonFrame");
frame:RegisterEvent("PLAYER_ENTERING_WORLD");
local function eventHandler(self, event, ...)
  for i=1, MAX_PARTY_MEMBERS, 1 do
	getglobal("PartyMemberFrame" .. i):UnregisterAllEvents();
	getglobal("PartyMemberFrame" .. i):Hide();
  end
  UIParent:UnregisterEvent("RAID_ROSTER_UPDATE");

end
frame:SetScript("OnEvent", eventHandler);


------------------------------------------------------------------------------------------------
-- BUFFBORDER
------------------------------------------------------------------------------------------------

local PostCreateIcon = function(this, aura)

  aura.overlay:SetTexture(buffborder)

  aura.overlay:SetTexCoord(0.955, 0.05, 0.95, 0.04)

end


------------------------------------------------------------------------------------------------
-- LAYOUT
------------------------------------------------------------------------------------------------

local Layout = function(self, unit)
	self.colors = colors
		self.menu = menu
		self:RegisterForClicks('AnyUp')
		self:SetAttribute('*type2', 'menu')
		self:SetScript('OnEnter', UnitFrame_OnEnter)
		self:SetScript('OnLeave', UnitFrame_OnLeave)

		if (unit == 'player' or unit == 'target') then
			self:SetAttribute('initial-height', 20)
			self:SetAttribute('initial-width', 235)
		end
		if (unit == 'targettarget' or unit == 'focus') then
			self:SetAttribute('initial-height', 17)
			self:SetAttribute('initial-width', 78)
		end
		if (unit == 'targettargettarget' or unit == 'focustarget') then
			self:SetAttribute('initial-height', 10)
			self:SetAttribute('initial-width', 78)
		end
		if (unit == 'focustarget') then
			self:SetAttribute('initial-height', 10)
			self:SetAttribute('initial-width', 78)
		end
		if (unit == 'pet') then
			self:SetAttribute('initial-height', 20)
			self:SetAttribute('initial-width', 95)
		end
		if (unit == 'pettarget') then
			self:SetAttribute('initial-height', 10)
			self:SetAttribute('initial-width', 95)
		end


	------------------------------------------------
	-- BACK


		back = CreateFrame('StatusBar', nil, self)
		back:SetPoint('TOPRIGHT', self)
		back:SetPoint('TOPLEFT', self)
		back:SetFrameStrata('BACKGROUND')
		if (unit == 'player' or unit == 'target' or unit =='pet') then
			back:SetBackdrop(backdrop)
			back:SetBackdropColor(0.05, 0.05, 0.05)
			back:SetHeight(20)
		end
		if (unit == 'targettarget' or unit == 'focus') then
			back:SetBackdrop(totbackdrop)
			back:SetBackdropColor(0.05, 0.05, 0.05)
			back:SetHeight(17)
		end
		if (unit == 'targettargettarget') then
			back:Hide() -- [REPLACE 'Show' BY 'Hide' TO HIDE]
			back:SetBackdrop(pettarbackdrop)
			back:SetBackdropColor(0.05, 0.05, 0.05)
			back:SetHeight(10)
		end
		if (unit == 'focustarget') then
			back:Show() -- [REPLACE 'Show' BY 'Hide' TO HIDE]
			back:SetBackdrop(pettarbackdrop)
			back:SetBackdropColor(0.05, 0.05, 0.05)
			back:SetHeight(10)
		end
		if (unit == 'pettarget') then
			back:SetBackdrop(pettarbackdrop)
			back:SetBackdropColor(0.05, 0.05, 0.05)
			back:SetHeight(10)
		end


	------------------------------------------------
	-- STATUSBAR


	-- HEALTH BAR --

		self.Health = CreateFrame('StatusBar', nil, self)
		self.Health:SetBackdrop(statusbarback)
		self.Health:SetBackdropColor(0.18,0.18,0.18)
		self.Health:SetFrameStrata('LOW')
		self.Health:SetPoint('TOPRIGHT', self)
		self.Health:SetPoint('TOPLEFT', self)
		self.Health:SetStatusBarTexture(statusbar)
		self.Health:SetStatusBarColor(0.28,0.28,0.28)
		self.Health.frequentUpdates = true
		self.Health.Smooth = true
		self.Health.colorThreat = true
		if (unit == 'player' or unit == 'target') then
			self.Health:SetHeight(20)
			self.Health.colorClasse = false
		end
		if (unit == 'targettarget' or unit == 'focus') then
			self.Health:SetHeight(17)
			self.Health.colorClass = true
		end
		if (unit == 'targettargettarget') then
			self.Health:Hide() -- [REPLACE 'Show' BY 'Hide' TO HIDE]
			self.Health:SetHeight(10)
			self.Health.colorClass = true
		end
		if (unit == 'focustarget') then
			self.Health:Show() -- [REPLACE 'Show' BY 'Hide' TO HIDE]
			self.Health:SetHeight(10)
			self.Health.colorClass = true
		end
		if (unit == 'pet') then
			self.Health:SetHeight(20)
			self.Health.colorClasse = false
		end
		if (unit == 'pettarget') then
			self.Health:SetHeight(10)
			self.Health.colorClasse = true
		end

	-- POWER BAR --

		self.Power = CreateFrame('StatusBar', nil, self)
		self.Power:SetBackdrop(statusbarback)
		self.Power:SetBackdropColor(0.165,0.165,0.165)
		self.Power:SetFrameStrata('LOW')
		self.Power:SetPoint('TOPRIGHT', self.Health, 'BOTTOMRIGHT', 0, -1)
		self.Power:SetPoint('TOPLEFT', self.Health, 'BOTTOMLEFT', 0, -1)
		self.Power:SetStatusBarTexture(statusbar)
		self.Power:SetStatusBarColor(0.28,0.28,0.28)
		self.Power.frequentUpdates = 1
		self.Power.Smooth = true
		if (unit == 'player' or unit == 'target') then
			self.Power:SetHeight(6)
			self.Power.colorClass = true
		end
		if (unit == 'targettarget' or unit == 'focus') then
			self.Power:SetHeight(4)
			self.Power.colorClass = false
		end
		if (unit == 'pet') then
			self.Power:SetHeight(6)
			self.Power.colorClass = true
		end

	-- BLANK BAR --

		if (unit == 'player' or unit == 'target') then		
			self.Blank = CreateFrame('StatusBar', nil, self)
			self.Blank:SetFrameStrata('LOW')
			self.Blank:SetPoint('TOPRIGHT', self.Power, 'BOTTOMRIGHT', 0, -1)
			self.Blank:SetPoint('TOPLEFT', self.Power, 'BOTTOMLEFT', 0, -1)
			self.Blank:SetStatusBarTexture(statusbar)
			self.Blank:SetHeight(7)
			self.Blank.Smooth = true
		end
		if (unit == 'pet') then		
			self.Blank = CreateFrame('StatusBar', nil, self)
			self.Blank:SetFrameStrata('LOW')
			self.Blank:SetPoint('TOPRIGHT', self.Power, 'BOTTOMRIGHT', 0, -1)
			self.Blank:SetPoint('TOPLEFT', self.Power, 'BOTTOMLEFT', 0, -1)
			self.Blank:SetStatusBarTexture(statusbar)
			self.Blank:SetHeight(7)
			self.Blank.Smooth = true
		end

	------------------------------------------------
	-- TEXTS


	-- HEALTH --

		self.Health.Text = self.Health:CreateFontString(nil, 'OVERLAY') 
		self.Health.Text:SetFont(font, 10, 'THINOUTLINE')
		self:Tag(self.Health.Text,'[My_curhp] / [My_maxhp]|r')
		self.Health.Text:SetShadowOffset(1, -1) 
		self.Health.Text.frequentUpdates = true
		if unit == 'player' then
			self.Health.Text:SetJustifyH('RIGHT')
			self.Health.Text:SetPoint('LEFT',self.Blank,'LEFT',0,-2)
		end
		if unit == 'target' then
			self.Health.Text:SetJustifyH('LEFT')
			self.Health.Text:SetPoint('RIGHT',self.Blank,'RIGHT',0,-2)
		end
		if unit == 'pet' then
			self.Health.Text:SetFont(font, 8, 'THINOUTLINE')
			self.Health.Text:SetJustifyH('LEFT')
			self.Health.Text:SetPoint('RIGHT',self.Blank,'RIGHT',0,-1)

		end

		local healthpercent = self.Health:CreateFontString(nil, 'OVERLAY') 
		healthpercent:SetFont(font, 15, '')
		self:Tag(healthpercent,'[My_perhp]|r')
		healthpercent:SetShadowOffset(1, -1) 
		healthpercent.frequentUpdates = true
		if unit == 'player' then
			healthpercent:SetJustifyH('CENTER')
			healthpercent:SetPoint('CENTER',self)
		end
		if unit == 'target' then
			healthpercent:SetJustifyH('CENTER')
			healthpercent:SetPoint('CENTER',self)
		end

	-- POWER --

		self.Power.Text = self.Health:CreateFontString(nil, 'OVERLAY') 
		self.Power.Text:SetFont(font, 10, 'THINOUTLINE')
		self:Tag(self.Power.Text,'[raidcolor] [curpp]|r')
		self.Power.Text:SetShadowOffset(1, -1) 
		self.Power.Text.frequentUpdates = true
		if unit == 'player' then
			self.Power.Text:SetJustifyH('RIGHT')
			self.Power.Text:SetPoint('RIGHT',self.Blank,'RIGHT',0,-2)
		end
		if unit == 'target' then
			self.Power.Text:SetJustifyH('LEFT')
			self.Power.Text:SetPoint('LEFT',self.Blank,'LEFT',0,-2)
		end
		if unit == 'pet' then
			self.Power.Text:SetFont(font, 8, 'THINOUTLINE')
			self.Power.Text:SetJustifyH('LEFT')
			self.Power.Text:SetPoint('LEFT',self.Blank,'LEFT',0,-1)
		end

	-- NAME --

		self.Info = self.Health:CreateFontString(nil, 'OVERLAY')
		self.Info:SetShadowOffset(1, -1)
		self.Info:SetAlpha(1)
		if unit == 'player' then
			self.Info:SetFont(font, 16, 'THINOUTLINE')
			self:Tag(self.Info,'[raidcolor] [name]' )
			self.Info:SetJustifyH('LEFT')
			self.Info:SetPoint('TOPLEFT',self.Blank,'BOTTOMLEFT',-7,-5)
		end
		if unit == 'target' then
			self.Info:SetFont(font, 16, 'THINOUTLINE')
			self:Tag(self.Info,'[raidcolor] [name]' )
			self.Info:SetJustifyH('RIGHT')
			self.Info:SetPoint('TOPRIGHT',self.Blank,'BOTTOMRIGHT',3,-5)
		end
		if unit == 'targettarget' or unit == 'focus' then
			self.Info:SetFont(font, 10, '')
			self:Tag(self.Info,'[name]' )
			self.Info:SetJustifyH('CENTER')
			self.Info:SetPoint('CENTER',self)
		end
		if unit == 'targettargettarget' then
			self.Info:SetFont(font, 8, '')
			self:Tag(self.Info,'[name]' )
			self.Info:SetJustifyH('CENTER')
			self.Info:SetPoint('CENTER',self.Health, 'CENTER')
		end
		if unit == 'focustarget' then
			self.Info:SetFont(font, 8, '')
			self:Tag(self.Info,'[name]' )
			self.Info:SetJustifyH('CENTER')
			self.Info:SetPoint('CENTER',self.Health, 'CENTER')
		end
		if unit == 'pet' then
			self.Info:SetFont(font, 12, 'THINOUTLINE')
			self:Tag(self.Info,'[raidcolor] [name]' )
			self.Info:SetJustifyH('RIGHT')
			self.Info:SetPoint('TOPRIGHT',self.Blank,'BOTTOMRIGHT',0,-5)
		end
		if unit == 'pettarget' then
			self.Info:SetFont(font, 8, '')
			self:Tag(self.Info,'[name]' )
			self.Info:SetJustifyH('CENTER')
			self.Info:SetPoint('CENTER',self.Health,'CENTER')
		end

	------------------------------------------------
	-- BUFFS & DEBUFFS


		if unit == 'player' then
			self.Debuffs = CreateFrame('Frame', nil, self)
			self.Debuffs.size = 4.5 * 4.5
			self.Debuffs.spacing = 6.5
			self.Debuffs:SetWidth(200)
			self.Debuffs:SetHeight(5)
			self.Debuffs.initialAnchor = 'BOTTOMRIGHT'
			self.Debuffs['growth-x'] = 'LEFT'
			self.Debuffs['growth-y'] = 'UP'
			self.Debuffs.showDebuffType = true
			self.Debuffs.num = 5
			self.Debuffs.filter = false
			self.Debuffs:SetPoint('BOTTOMRIGHT',self.Health,'TOPRIGHT',0,8.5)
			self.Debuffs.PostCreateIcon = PostCreateIcon

		end


		if unit == 'target' then
			self.Buffs = CreateFrame('Frame', nil, self)
			self.Buffs.size = 4.5 * 4.5
			self.Buffs.spacing = 6.5
			self.Buffs:SetWidth(200)
			self.Buffs:SetHeight(5)
			self.Buffs.initialAnchor = 'BOTTOMLEFT'
			self.Buffs['growth-x'] = 'RIGHT'
			self.Buffs['growth-y'] = 'UP'
			self.Buffs.showBuffType = true
			self.Buffs.num = 5
			self.Buffs.filter = false
			self.Buffs:SetPoint('BOTTOMLEFT',self.Health,'TOPLEFT',0,8.5)
			self.Buffs.PostCreateIcon = PostCreateIcon

		end

	------------------------------------------------
	-- ICONS


	-- LEADER --
		if unit == 'player' then
			self.Leader = self.Health:CreateTexture(nil, 'OVERLAY')
			self.Leader:SetPoint('LEFT', self, 1,0 )
			self.Leader:SetHeight(14)
			self.Leader:SetWidth(14)
		end
		if unit == 'target' then
			self.Leader = self.Health:CreateTexture(nil, 'OVERLAY')
			self.Leader:SetPoint('RIGHT', self, -1,0 )
			self.Leader:SetHeight(14)
			self.Leader:SetWidth(14)
		end

	-- MASTERLOOTER --
		if unit == 'player' then
			self.MasterLooter = self.Health:CreateTexture(nil, 'OVERLAY')
			self.MasterLooter:SetPoint('LEFT', self, 15,0 )
			self.MasterLooter:SetHeight(11)
			self.MasterLooter:SetWidth(11)
		end
		if unit == 'target' then
			self.MasterLooter = self.Health:CreateTexture(nil, 'OVERLAY')
			self.MasterLooter:SetPoint('RIGHT', self, -15,0 )
			self.MasterLooter:SetHeight(11)
			self.MasterLooter:SetWidth(11)
		end
		
	-- PVP FLAG --
		if unit == 'player' then
			self.PvP = self.Health:CreateTexture(nil, 'OVERLAY')
			self.PvP:SetPoint('RIGHT', self, 5, -5)
			self.PvP:SetHeight(25)
			self.PvP:SetWidth(25)
		end
		if unit == 'target' then
			self.PvP = self.Health:CreateTexture(nil, 'OVERLAY')
			self.PvP:SetPoint('LEFT', self, 5,-5)
			self.PvP:SetHeight(25)
			self.PvP:SetWidth(25)
		end

	-- LFD ROLE --
		if unit == 'player' then
			self.LFDRole = self.Health:CreateTexture(nil, "OVERLAY")
			self.LFDRole:SetPoint('RIGHT', self, -5, 0)
			self.LFDRole:SetHeight(12)
			self.LFDRole:SetWidth(12)
		end
		if unit == 'target' then
			self.LFDRole = self.Health:CreateTexture(nil, "OVERLAY")
			self.LFDRole:SetPoint('LEFT', self, 5, 0)
			self.LFDRole:SetHeight(12)
			self.LFDRole:SetWidth(12)
		end


	------------------------------------------------
	-- CASTBAR


	-- BAR --
		self.Castbar = CreateFrame('StatusBar', nil, self)
		self.Castbar:SetFrameStrata('MEDIUM')
		if unit == 'player' or unit == 'target' then 
			self.Castbar:SetWidth(235)
			self.Castbar:SetHeight(20)
			self.Castbar:SetPoint("CENTER", self.Health, "CENTER")
			self.Castbar:SetStatusBarTexture(statusbar)
			self.Castbar:SetStatusBarColor(0.8, 0.8, 0.8)
		end
		if unit == 'pet' then 
			self.Castbar:SetWidth(95)
			self.Castbar:SetHeight(20)
			self.Castbar:SetPoint("CENTER", UIParent, 'CENTER', -460, -153)
			self.Castbar:SetStatusBarTexture(statusbar)
			self.Castbar:SetStatusBarColor(0.8, 0.8, 0.8)
		end

	-- TEXT --
		self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY')
		if unit == 'player' then
			self.Castbar.Text:SetFont(font, 10, '')
			self.Castbar.Text:SetPoint('LEFT', self.Castbar,'LEFT',5, 0)
			self.Castbar.Text:SetWidth(160)
			self.Castbar.Text:SetTextColor(1,1,1)
			self.Castbar.Text:SetJustifyH('LEFT')
		end
		if unit == 'target' then
			self.Castbar.Text:SetFont(font, 10, '')
			self.Castbar.Text:SetPoint('RIGHT', self.Castbar,'RIGHT', -5, 0)
			self.Castbar.Text:SetWidth(160)
			self.Castbar.Text:SetTextColor(1,1,1)
			self.Castbar.Text:SetJustifyH('RIGHT')
		end
		if unit == 'pet' then
			self.Castbar.Text:SetFont(font, 8, '')
			self.Castbar.Text:SetPoint('RIGHT', self.Castbar,'RIGHT', 0, 0)
			self.Castbar.Text:SetShadowOffset(1, -1) 
			self.Castbar.Text:SetWidth(90)
			self.Castbar.Text:SetTextColor(1,1,1)
			self.Castbar.Text:SetJustifyH('RIGHT')
		end

	-- TIME --
		self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY') 
		if unit == 'player' then
			self.Castbar.Time:SetFont(font, 10, '')
			self.Castbar.Time:SetPoint('RIGHT', self.Castbar,'RIGHT',30, 0)
			self.Castbar.Time:SetShadowOffset(1, -1) 
			self.Castbar.Time:SetWidth(50)
			self.Castbar.Time:SetTextColor(1,1,1)
			self.Castbar.Time:SetJustifyH('LEFT')
		end
		if unit == 'target' then
			self.Castbar.Time:SetFont(font, 10, '')
			self.Castbar.Time:SetPoint('LEFT', self.Castbar,'LEFT',-30, 0)
			self.Castbar.Time:SetShadowOffset(1, -1) 
			self.Castbar.Time:SetWidth(50)
			self.Castbar.Time:SetTextColor(1,1,1)
			self.Castbar.Time:SetJustifyH('RIGHT')
		end
		if unit == 'pet' then
			self.Castbar.Time:SetFont(font, 8, '')
			self.Castbar.Time:SetPoint('LEFT', self.Castbar,'LEFT',-33, 0)
			self.Castbar.Time:SetShadowOffset(1, -1) 
			self.Castbar.Time:SetWidth(50)
			self.Castbar.Time:SetTextColor(1,1,1)
			self.Castbar.Time:SetJustifyH('RIGHT')
		end


	------------------------------------------------
	-- TOTEMBAR

		if IsAddOnLoaded("oUF_TotemBar") and unit == "player" and playerClass == "SHAMAN" then
			self.TotemBar = {}
			self.TotemBar.Destroy = true
			for i = 1, 4 do
				self.TotemBar[i] = CreateFrame("StatusBar", nil, self)
				self.TotemBar[i]:SetHeight(7)
				self.TotemBar[i]:SetWidth(235/4 - 0.85)
				if (i == 1) then
					self.TotemBar[i]:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 285, -20)
				else
					self.TotemBar[i]:SetPoint("TOPLEFT", self.TotemBar[i-1], "TOPRIGHT", 1, 0)
				end
				self.TotemBar[i]:SetStatusBarTexture(statusbar)
				self.TotemBar[i]:SetBackdrop(statusbarback)
				self.TotemBar[i]:SetBackdropColor(0, 0, 0)
				self.TotemBar[i]:SetMinMaxValues(0, 1)

				self.TotemBar[i].bg = self.TotemBar[i]:CreateTexture(nil, "BORDER")
				self.TotemBar[i].bg:SetAllPoints(self.TotemBar[i])
				self.TotemBar[i].bg:SetTexture(statusbar)
				self.TotemBar[i].bg.multiplier = 0.3
			end
		end
end

oUF:RegisterStyle('Elen', Layout)
oUF:SetActiveStyle('Elen')

oUF:Spawn('player', 'oUF_Player'):SetPoint('CENTER',UIParent,'CENTER', -285, -153)
oUF:Spawn('target', 'oUF_Target'):SetPoint('CENTER',UIParent,'CENTER', 285, -153)
oUF:Spawn('focus', 'oUF_Focus'):SetPoint('CENTER',UIParent,'CENTER', -364, -120)
oUF:Spawn('focustarget', 'oUF_FocusTarget'):SetPoint('CENTER',UIParent,'CENTER', -364, -100)
oUF:Spawn('targettarget', 'oUF_TOT'):SetPoint('CENTER',UIParent,'CENTER', 364, -120)
oUF:Spawn('targettargettarget', 'oUF_TOTT'):SetPoint('CENTER',UIParent,'CENTER', 364, -100)
oUF:Spawn('pet', 'oUF_Pet'):SetPoint('CENTER',UIParent,'CENTER', -460, -153)
oUF:Spawn('pettarget', 'oUF_Pettarget'):SetPoint('CENTER',UIParent,'CENTER', -460, -130)
  Reply With Quote
08-15-10, 05:09 PM   #4
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
You are spawning a castbar for all units (player, target, focus, focustarget, targettarget, targettargettarget, pet and pettarget).

You are only configuring the castbar for the units : player, target and pet.

Try only spawning the castbar for the units you want a castbar for. It should get rid of the errors you are seeing.
  Reply With Quote
08-15-10, 05:17 PM   #5
Elen'
A Murloc Raider
 
Elen''s Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 8
Perfect ! That work thanx
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Lag problem with Target's castbar when ToT is me


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