Thread Tools Display Modes
12-21-09, 08:00 AM   #1
Aesh
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Nov 2009
Posts: 11
Need some help with my Layout,

as i say on page of my layout, i am still padawan and learn how oUF works.
Sometimes i understand what i do sometimes not.
But here is a problem what i completely dont understand what i need to do ,all code seems ok, but i missing something , and i dont know what i am missing.i spend 2 days to make ouf swing to work.No luck.

At last i put this piece of code bottom and under of every line ,(or most of them) again no succes .I am sure this is very easy thing but i am not able to catch it . sorry for bad english.An so sorry if its very long
God i hate my stupidity.
code used by me to support oUF_swing

Code:
if unit=="player" and playerClass=="HUNTER" then
            if IsAddOnLoaded("oUF_Swing") then
			
			self.Swing = CreateFrame("StatusBar", nil, self)
			self.Swing:SetPoint("CENTER", UIParent, "CENTER", 0, -1)			
			self.Swing:SetStatusBarTexture(bartex)
			self.Swing:SetStatusBarColor(0.75, 0.75, 0.75)
			self.Swing:SetHeight(3)
			self.Swing:SetWidth(220)
			self.Swing.disableMelee = true
			self.Swing:SetFrameLevel(1)
			
			self.Swing.Text = self.Swing:CreateFontString(nil, "OVERLAY")
			self.Swing.Text:SetFont(font, fontsize-3, "OUTLINE")			
			self.Swing.Text:SetPoint("CENTER", self.Swing, 0, -10)
            end
		end
code of layout.

Code:
--[[
	
	oUF_Experiment

	Author:		Young Padawan Aesh who learning how to use force. All credits goes to Master Jedi's which names is Bottom.
	Credits:	Master Jedi Dawn who create that beatiful layout , and give me permission to make modifications and release this layout.
                Master Jedi p3lim for party toggle function and druid mana
				Master Jedi Lyn for oUF_Lyn
				Master Jedi Maneut for oUF_Maneut
				Master Jedi Neal for a way to get those borders around all frames!

--]]



---configs --
---------------------------------------------------
local petCastBar_x = 0
local petCastBar_y = -420 -- pet cast bar positions

local playerCastBar_x = 0
local playerCastBar_y = -365 -- player castbar positions

local targetCastBar_x = 0
local targetCastBar_y = -290 -- target castbar positions

local focusCastBar_x = 0
local focusCastBar_y = -210 -- focus castbar positions

local fontsize = 14 -- fontsize for everything else
local raidfontsize = 10 -- raid fontsize

--local disableparty = false -- not implemented
local disableraid = false -- true disable raid frames 

local DisableBuffs = false -- true disable self buff bars.

-- color and alpha for frameborders --
-----------------------------------------

local color_rb = 0.65	-- default 0.00 
local color_gb = 0.65	-- default 0.00
local color_bb = 0.65	-- default 0.00
local alpha_fb = 0.90	-- default 0.35


-- Font, textures --
---------------------------------------------------------------------------

local font = "Interface\\AddOns\\oUF_Experiment\\font\\font.ttf"
local bartex = "Interface\\AddOns\\oUF_Experiment\\media\\texturedark"
local bartex2 = "Interface\\AddOns\\oUF_Experiment\\media\\texturelight"
local frameborder = "Interface\\AddOns\\oUF_Experiment\\media\\frameborder"

-- borders positions --
local BottomRightBorder_x = 4 
local BottomRightBorder_y = -4

local BottomLeftBorder_x = -4
local BottomLeftBorder_y = -4

local TopRightBorder_x = 4
local TopRightBorder_y = 4

local TopLeftBorder_x = -4
local TopLeftBorder_y = 4


--WARNİNG!! MINE AREA -- Do not step if you dont know what todo!! 50 DKP minus --
-- Locals --
---------------------------------------------------------------------------

local select = select
local UnitClass = UnitClass
local UnitIsDead = UnitIsDead
local UnitIsPVP = UnitIsPVP
local UnitIsGhost = UnitIsGhost
local UnitIsPlayer = UnitIsPlayer
local UnitReaction = UnitReaction
local UnitIsConnected = UnitIsConnected
local UnitCreatureType = UnitCreatureType
local UnitClassification = UnitClassification
local UnitReactionColor = UnitReactionColor
local RAID_CLASS_COLORS = RAID_CLASS_COLORS


-- Class Color --
--------------------------------------------------------------

local playerClass = select(2, UnitClass("player"))

-- change  colors --
---------------------------------------------------------------------------

oUF.colors.happiness = {
	[1] = {182/225, 34/255, 32/255},	-- unhappy
	[2] = {220/225, 180/225, 52/225},	-- content
	[3] = {143/255, 194/255, 32/255},	-- happy
}

-- right click --
---------------------------------------------------------------------------
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

 
--Shorting everything above 9999, i.e. 10000 -> 10k and above 999 in raidframes
---------------------------------------------------------------------------

local numberize = function(v)
	if v <= 9999 then return v end
	if v >= 1000000 then
		local value = string.format("%.1fm", v/1000000)
		return value
	elseif v >= 10000 then
		local value = string.format("%.1fk", v/1000)
		return value
	end
end

local numberize_raid = function(v)
	if v <= 999 then return v end
	if v >= 1000000 then
		local value = string.format("%.1fm", v/1000000)
		return value
	elseif v >= 1000 then
		local value = string.format("%.1fk", v/1000)
		return value
	end
end



-- level update --
---------------------------------------------------------------------------
local updateLevel = function(self, unit, name)
	local lvl = UnitLevel(unit)
	local typ = UnitClassification(unit)
	
	local color = GetQuestDifficultyColor(lvl)  
        
	if lvl <= 0 then	lvl = "??" end
            
	if typ=="worldboss" then
	    self.Level:SetText("|cffff0000"..lvl.."b|r")
	elseif typ=="rareelite" then
	    self.Level:SetText(lvl.."r+")
		self.Level:SetTextColor(color.r, color.g, color.b)
	elseif typ=="elite" then
	    self.Level:SetText(lvl.."+")
		self.Level:SetTextColor(color.r, color.g, color.b)
	elseif typ=="rare" then
		self.Level:SetText(lvl.."r")
		self.Level:SetTextColor(color.r, color.g, color.b)
	else
		if UnitIsConnected(unit) == 1 then
			self.Level:SetText(lvl)
		else
			self.Level:SetText("??")
		end
		if(not UnitIsPlayer(unit)) then  
			self.Level:SetTextColor(color.r, color.g, color.b)
		else
			local _, class = UnitClass(unit) 
			color = self.colors.class[class] 
			self.Level:SetTextColor(color[1], color[2], color[3])  
		end			
	end
end


-- name update --
---------------------------------------------------------------------------
local updateName = function(self, event, unit)
	if(self.unit ~= unit) then return end

	local name = UnitName(unit)
		self.Name:SetText(name)	

	if unit=="targettarget" then
		local totName = UnitName(unit)
		local pName = UnitName("player")
	else
		self.Name:SetTextColor(1,1,1)
	end
	   
    if unit=="target" then -- Show level value on targets only
		updateLevel(self, unit, name)      
    end

    if(self:GetParent():GetName():match"oUF_Raid") then -- Shorting Names in Raidframes
	self.Name:SetText(string.sub(name,1,4))
    end
end



-- health update --
---------------------------------------------------------------------------
local updateHealth = function(self, event, unit, bar, min, max)  
    local cur, maxhp = min, max
    local missing = maxhp-cur
    
    local d = floor(cur/maxhp*100)
    
	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"D/C"
    elseif
        bar.value:SetText" " then
        
        
    	elseif(unit == "player") then
		if(min ~= max) then
			bar.value:SetText("|cffB62220".."-"..numberize(missing) .."|r." .."|cff9EBF56"..numberize(cur) .."|r.".. d.."%")
		else
			bar.value:SetText(" ")
		end
	elseif(unit == "targettarget") then
		bar.value:SetText(d.."%")

    	elseif(unit == "target") then
		if(d < 100) then
			bar.value:SetText("|cffB62220".."-"..numberize(missing) .."|r." .."|cff9EBF56"..numberize(cur) .."|r.".. d.."%")
		else
			bar.value:SetText("|cff9EBF56"..numberize(cur))
		end

	elseif(self:GetParent():GetName():match"oUF_Raid") then
		if(d < 100) then
			bar.value:SetText("|cffFFFFFF".."-"..numberize_raid(missing))
		else
			bar.value:SetText(" ")
		end

	elseif(min == max) then
        if unit == "pet" then
			bar.value:SetText(" ")
		end
    else
        if((max-min) < max) then
			if unit == "pet" then
				bar.value:SetText("|cffB62220".."-"..missing)
			end
	    end
    end

    self:UNIT_NAME_UPDATE(event, unit)
end

-- druid mana --
---------------------------------------------------------------------------
local function UpdateDruidPower(self)
	local ptype = UnitPowerType("player")
	if(ptype ~= 0) then
		local min = UnitPower("player",0)
		local max = UnitPowerMax("player",0)
		
		self.DruidPower:SetMinMaxValues(0, max)
		self.DruidPower:SetValue(min)
		self.DruidPower:SetStatusBarColor(unpack(self.colors.power["MANA"]))

		self.DruidPower.percent:SetText(min.." . "..max.." . "..floor(min / max * 100).."%")
				if color then
					self.DruidPower.percent:SetTextColor(0.76, 0.94, 0.96)
				else
					self.DruidPower.percent:SetTextColor(0.76, 0.94, 0.96)					
				end
		if(min ~= max) then
			self.DruidPower:SetMinMaxValues(0, max)
			self.DruidPower:SetValue(min)
			self.DruidPower:SetAlpha(0.8)
		else
			self.DruidPower:SetAlpha(0)
		end

	else
		local min = UnitPower("player",3)
		local max = UnitPowerMax("player",3)

		self.DruidPower:SetStatusBarColor(unpack(self.colors.power["ENERGY"]))
		self.DruidPower.percent:SetText()
		self.DruidPower:SetAlpha(0)
	end
end

-- power update --
---------------------------------------------------------------------------
local updatePower = function(self, event, unit, bar, min, max)  
	if UnitIsPlayer(unit)==nil then 
		bar.value:SetText()
	else
		local _, ptype = UnitPowerType(unit)
		local color = oUF.colors.power[ptype]
		if(min==0) then 
			bar.value:SetText()
		elseif(UnitIsDead(unit) or UnitIsGhost(unit)) then
			bar:SetValue(0)
		elseif(not UnitIsConnected(unit)) then
			bar.value:SetText()
		elseif unit=="player" then 
			if((max-min) > 0) then
	            bar.value:SetText(min)
				if color then
					bar.value:SetTextColor(color[1], color[2], color[3])
				else
					bar.value:SetTextColor(0.76, 0.94, 0.96)
				end
			elseif(min==max) then
				bar.value:SetText("")
	        else
				bar.value:SetText(min)
				if color then
					bar.value:SetTextColor(color[1], color[2], color[3])
				else
					bar.value:SetTextColor(0.76, 0.94, 0.96)
				end
			end
        else
			if((max-min) > 0) then
				bar.value:SetText(min)
				if color then
					bar.value:SetTextColor(color[1], color[2], color[3])
				else
					bar.value:SetTextColor(0.76, 0.94, 0.96)
				end
			else
				bar.value:SetText(min)
				if color then
					bar.value:SetTextColor(color[1], color[2], color[3])
				else
					bar.value:SetTextColor(0.76, 0.94, 0.96)
				end
			end
		end
	end
end

-- weaponenchant borders. --
-----------------------------------------------------------------------
local enchantIcon = function(self, button, icons)

    button.icon:SetTexCoord(.07, .93, .07, .93)
	button.icon:SetPoint("TOPLEFT", button, "TOPLEFT", 1, -1)
	button.icon:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 1)
    
	button.overlay:SetTexture(frameborder)
	button.overlay:SetTexCoord(0, 1, 0, 1)
	button.overlay.Hide = function(self) self:SetVertexColor(0.5, 0.5, 0.5) end
    
    button.cd:SetReverse()
	button.cd:SetPoint("TOPLEFT", button, "TOPLEFT", 2, -2) 
	button.cd:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2)   
end

-- aura reskin --
---------------------------------------------------------------------------
local auraIcon = function(self, button, icons)
	icons.showDebuffType = true -- show debuff border type color  
    
	button.icon:SetTexCoord(.07, .93, .07, .93)
	button.icon:SetPoint("TOPLEFT", button, "TOPLEFT", 1, -1)
	button.icon:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 1)
	
	button.overlay:SetTexture(frameborder)
	button.overlay:SetTexCoord(0, 1, 0, 1)
	button.overlay.Hide = function(self) self:SetVertexColor(0.5, 0.5, 0.5) end
	
	button.cd:SetReverse()
	button.cd:SetPoint("TOPLEFT", button, "TOPLEFT", 2, -2) 
	button.cd:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2)     
end 

--- Mirror Timers Border hide--

MirrorTimer1Border:Hide()
MirrorTimer2Border:Hide()
MirrorTimer3Border:Hide()


-- MoveableFrames support for raid and party --
-- Founded after hours of searching and reading  --
-- credits goes to Bruners and Derkyle --
-- This is maybe not better way but after some testing seems to work :)--
--[[ - disabled-- because of oUF_MovableFrames --
local eventFrame = CreateFrame("Frame", nil, UIParent)
eventFrame:RegisterEvent("PLAYER_LOGIN")

eventFrame:SetScript("OnEvent", function(self, event, ...)
	if event == "PLAYER_LOGIN" then
		if IsAddOnLoaded("oUF_MoveableFrames") then
          oUF_MoveableFrames_HEADER("oUF_Raid1", "Raid Frames") 
          oUF_MoveableFrames_HEADER("oUF_Party", "Party Frames")
		end
	end
end)
--]]

 -- Layout --
---------------------------------------------------------------------------

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

	self:SetScript("OnEnter", UnitFrame_OnEnter)
	self:SetScript("OnLeave", UnitFrame_OnLeave)    
	self:RegisterForClicks"anyup"
	self:SetAttribute("*type2", "menu")
	self.disallowVehicleSwap = true
    
	-- background --
	----------------------------------------------------------------------------
	self:SetBackdrop{
	bgFile = "Interface\\ChatFrame\\ChatFrameBackground", tile = true, tileSize = 16,
	insets = {left = -2, right = -2, top = -2, bottom = -2},
	}
	self:SetBackdropColor(0,0,0,0.7) -- and color the backgrounds
    local hgwdb = 13 --- border resize.
    
	
	-- border --
	--------------------------------------------------------------------------	
	local TopLeft = self:CreateTexture(nil, "OVERLAY")
	TopLeft:SetTexture(frameborder)
	TopLeft:SetTexCoord(0, 1/3, 0, 1/3)
	TopLeft:SetPoint("TOPLEFT", self, TopLeftBorder_x, TopLeftBorder_y)
	TopLeft:SetWidth(hgwdb) TopLeft:SetHeight(hgwdb)
	TopLeft:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

	local TopRight = self:CreateTexture(nil, "OVERLAY")
	TopRight:SetTexture(frameborder)
	TopRight:SetTexCoord(2/3, 1, 0, 1/3)
	TopRight:SetPoint("TOPRIGHT", self, TopRightBorder_x, TopRightBorder_y)
	TopRight:SetWidth(hgwdb) TopRight:SetHeight(hgwdb)
	TopRight:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

	local BottomLeft = self:CreateTexture(nil, "OVERLAY")
	BottomLeft:SetTexture(frameborder)
	BottomLeft:SetTexCoord(0, 1/3, 2/3, 1)
	BottomLeft:SetPoint("BOTTOMLEFT", self, BottomLeftBorder_x, BottomLeftBorder_y)
	BottomLeft:SetWidth(hgwdb) BottomLeft:SetHeight(hgwdb)
	BottomLeft:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

	local BottomRight = self:CreateTexture(nil, "OVERLAY")
	BottomRight:SetTexture(frameborder)
	BottomRight:SetTexCoord(2/3, 1, 2/3, 1)
	BottomRight:SetPoint("BOTTOMRIGHT", self, BottomRightBorder_x, BottomRightBorder_y)
	BottomRight:SetWidth(hgwdb) BottomRight:SetHeight(hgwdb)
	BottomRight:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

	local TopEdge = self:CreateTexture(nil, "OVERLAY")
	TopEdge:SetTexture(frameborder)
	TopEdge:SetTexCoord(1/3, 2/3, 0, 1/3)
	TopEdge:SetPoint("TOPLEFT", TopLeft, "TOPRIGHT")
	TopEdge:SetPoint("TOPRIGHT", TopRight, "TOPLEFT")
	TopEdge:SetHeight(hgwdb)
	TopEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
		
	local BottomEdge = self:CreateTexture(nil, "OVERLAY")
	BottomEdge:SetTexture(frameborder)
	BottomEdge:SetTexCoord(1/3, 2/3, 2/3, 1)
	BottomEdge:SetPoint("BOTTOMLEFT", BottomLeft, "BOTTOMRIGHT")
	BottomEdge:SetPoint("BOTTOMRIGHT", BottomRight, "BOTTOMLEFT")
	BottomEdge:SetHeight(hgwdb)
	BottomEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
		
	local LeftEdge = self:CreateTexture(nil, "OVERLAY")
	LeftEdge:SetTexture(frameborder)
	LeftEdge:SetTexCoord(0, 1/3, 1/3, 2/3)
	LeftEdge:SetPoint("TOPLEFT", TopLeft, "BOTTOMLEFT")
	LeftEdge:SetPoint("BOTTOMLEFT", BottomLeft, "TOPLEFT")
	LeftEdge:SetWidth(hgwdb)
	LeftEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
		
	local RightEdge = self:CreateTexture(nil, "OVERLAY")
	RightEdge:SetTexture(frameborder)
	RightEdge:SetTexCoord(2/3, 1, 1/3, 2/3)
	RightEdge:SetPoint("TOPRIGHT", TopRight, "BOTTOMRIGHT")
	RightEdge:SetPoint("BOTTOMRIGHT", BottomRight, "TOPRIGHT")
	RightEdge:SetWidth(hgwdb)
	RightEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
	
	-- healthbar --
	-----------------------------------------------------------
	self.Health = CreateFrame"StatusBar"
	self.Health:SetStatusBarTexture(bartex)
    self.Health:SetParent(self)
	self.Health:SetPoint"TOP"
	self.Health:SetPoint"LEFT"
	self.Health:SetPoint"RIGHT"
	self.Health:SetFrameLevel(1)
	self.Health.frequentUpdates = true
	
          
	-- healthbar background --
	-----------------------------------------------------------
	self.Health.bg = self.Health:CreateTexture(nil, "BORDER")
	self.Health.bg:SetAllPoints(self.Health)
	self.Health.bg:SetTexture(bartex)
	self.Health.bg:SetAlpha(0.40)

	
	
	-- healthbar text --
	----------------------------------------------------------------
	self.Health.value = self.Health:CreateFontString(nil, "OVERLAY")
	self.Health.value:SetPoint("RIGHT", 0, 13)
	self.Health.value:SetFont(font, fontsize, "THINOUTLINE")
	self.Health.value:SetTextColor(1,1,1)
	self.Health.value:SetShadowOffset(0, 0)

	
	-- healthbar functions --
	---------------------------------------
	self.Health.colorClass = true
	self.Health.colorReaction = true 
	self.Health.colorDisconnected = true 
	self.Health.colorTapping = true  
	self.PostUpdateHealth = updateHealth   

	
	-- powerbar --
	---------------------------------------------
	self.Power = CreateFrame"StatusBar"
	self.Power:SetStatusBarTexture(bartex2)
	self.Power:SetParent(self)
	self.Power:SetPoint"LEFT"
	self.Power:SetPoint"RIGHT"
	self.Power:SetPoint("TOP", self.Health, "BOTTOM", 0, -1) 
	self.Power.frequentUpdates = true
	self.Power:SetFrameLevel(1)

	
	-- powerbar background --
	--------------------------------------------------------------
    
	self.Power.bg = self.Power:CreateTexture(nil, "BORDER")
	self.Power.bg:SetAllPoints(self.Power)
	self.Power.bg:SetTexture(bartex2)
	self.Power.bg:SetAlpha(0.40)  

	
	-- powerbar text --
	---------------------------------------------------------------
    
	self.Power.value = self.Power:CreateFontString(nil, "OVERLAY")
    self.Power.value:SetPoint("TOPLEFT", self.Health, 0, 0)
	self.Power.value:SetFont(font, fontsize, "THINOUTLINE")
	self.Power.value:SetTextColor(1, 1, 1)
	self.Power.value:SetShadowOffset(0, 0)
    self.Power.value:Show()
    
    
	-- powerbar functions --
	-----------------------------------------
    
	self.Power.colorTapping = true 
	self.Power.colorDisconnected = true 
	self.Power.colorClass = true 
	self.Power.colorPower = true 
	self.Power.colorHappiness = false  
	self.PostUpdatePower = updatePower  

	
	-- names --
	----------------------------------------------------------
    
	self.Name = self.Health:CreateFontString(nil, "OVERLAY")
    self.Name:SetPoint("TOPLEFT", self.Health, 0, 0)
    self.Name:SetJustifyH("LEFT")
	self.Name:SetFont(font, fontsize, "THINOUTLINE")
	self.Name:SetShadowOffset(0, 0)
    self.UNIT_NAME_UPDATE = updateName

	
	-- level --
	---------------------------------------------------------
    
	self.Level = self.Health:CreateFontString(nil, "OVERLAY")
	self.Level:SetPoint("TOPLEFT", self.Health, 0, 0)
	self.Level:SetJustifyH("LEFT")
	self.Level:SetFont(font, fontsize, "THINOUTLINE")
    self.Level:SetTextColor(1,1,1)
	self.Level:SetShadowOffset(0, 0)
	self.UNIT_LEVEL = updateLevel

    
    
-- oUF_ReadyCheck support
	------------------------------------------------------------------	
    if unit=="player" or (self:GetParent():GetName():match"oUF_Party") or (self:GetParent():GetName():match"oUF_Raid") then
		self.ReadyCheck = self.Health:CreateTexture(nil, "OVERLAY")
		self.ReadyCheck:SetPoint("CENTER", self, "CENTER")
		self.ReadyCheck:SetHeight(20)
		self.ReadyCheck:SetWidth(20)
    end
    
	-- Combat Feedback for all frames --
	----------------------------------------------------------	
    
	local cbft = self.Health:CreateFontString(nil, "OVERLAY")
    cbft:SetPoint("CENTER", self.Health, "CENTER", 0, -5)
    cbft:SetFontObject(GameFontNormal)
    self.CombatFeedbackText = cbft	
    self.CombatFeedbackText:SetFont(font, 14, "THINOUTLINE")	


	-- oUF_SpellRange,oUF_Smooth,oUF_MoveableFrames support.
	----------------------------------------------------------------------------------------------------------------	
    
    if(unit) or (self:GetParent():GetName():match"oUF_Raid") or (self:GetParent():GetName():match"oUF_Party") then
        
		self.SpellRange = true; -- fadeout if units are out of range
		self.inRangeAlpha = 1.0; -- Frame alpha when in range
		self.outsideRangeAlpha = 0.5; -- Frame alpha when out of range
		self.Power.Smooth = true
		self.Health.Smooth = true
        --self.MoveableFrames = true -- disabled 
    end
   
   ---- oUF_DebuffHighlight support - highlight --
   -----------------------------------------------------------------------------------------------------------    
	
    if (unit) or (self:GetParent():GetName():match"oUF_Raid") or (self:GetParent():GetName():match"oUF_Party")  then
		self.DebuffHighlight = self:CreateTexture(nil, "OVERLAY")
		self.DebuffHighlight:SetPoint("TOPLEFT",self,"TOPLEFT",-1, 1)
		self.DebuffHighlight:SetPoint("BOTTOMRIGHT",self,"BOTTOMRIGHT",1, -1)
		self.DebuffHighlight:SetTexture(frameborder)
		self.DebuffHighlight:SetVertexColor(0, 0, 0, 0)
		self.DebuffHighlight:SetBlendMode("BLEND")
		self.DebuffHighlightAlpha = 0.30
		self.DebuffHighlightFilter = true
    end    
    
       --[[ 
        --Ouf Healcomm Support-- not tested --
        self.HealCommBar = CreateFrame("StatusBar", nil, self.Health)
        self.HealCommBar:SetHeight(0)
        self.HealCommBar:SetWidth(0)
        self.HealCommBar:SetStatusBarTexture(self.Health:GetStatusBarTexture():GetTexture())
        self.HealCommBar:SetStatusBarColor(0, 1, 0, 0.25)
        self.HealCommBar:SetPoint("CENTER", self.Health, "CENTER")
        self.HealCommText = self.Health:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmallRight")
        self.HealCommText:SetTextColor(0, 1, 0)
        self.HealCommText:SetPoint("RIGHT", health, "LEFT", -5, 0)
	    -- optional routine override to format the text display
        self.HealCommTextFormat = shortVal
        self.HealCommOthersOnly = false
        
        self.allowHealCommOverflow = true -- show overhealing
    --]]

    
	-- raid target icons for all frames
	------------------------------------------------------------------------------------------------------------------------------------------------------
    
	if (unit) or (self:GetParent():GetName():match"oUF_Raid") or (self:GetParent():GetName():match"oUF_Party")  then    
		self.RaidIcon = self.Health:CreateTexture(nil, "OVERLAY")
		self.RaidIcon:SetHeight(20)
		self.RaidIcon:SetWidth(20)
		self.RaidIcon:SetPoint("CENTER", self, 0, 21)
		self.RaidIcon:SetTexture"Interface\\TargetingFrame\\UI-RaidTargetingIcons"
	end
	
	
	-- player --
	------------------------------------------------------------
    
	if unit=="player" then		
		self.Name:Hide() -- hiding self name
		self.Power.value:Show()
		self.Power.value:SetPoint("TOPLEFT", self.Health, 0, -25)
		self.Power.value:SetJustifyH("LEFT")
		self.Level:Hide() --hiding self level
		self.Health.value:SetFont(font, 16, "OUTLINE")
		self.ignoreBanzai = true
		--self.ignoreDruidHots = true
		self.BarFade = true	
        
        --Buffs--        
		if(unit=="player" and DisableBuffs==false) then
        
            BuffFrame:Hide()
            TemporaryEnchantFrame:Hide()
        
	    -- Player buffs will replace standart frames--
            self.Buffs = CreateFrame("Frame", nil, self) 
            self.Buffs:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", -30, 3)
            self.Buffs.initialAnchor = "TOPRIGHT"
            self.Buffs["growth-x"] = "LEFT"
            self.Buffs["growth-y"] = "DOWN"
            self.Buffs.size = 35 -- size
            self.Buffs:SetHeight(self.Buffs.size)
            self.Buffs:SetWidth(self.Buffs.size*16)
            self.Buffs.num = 40 -- numbers
            self.Buffs.spacing = 4
        
        -- Debuffs --
        
            self.Debuffs = CreateFrame("Frame", nil, self)
            self.Debuffs:SetPoint("TOP", self.Buffs, "BOTTOM", 0, -55)
            self.Debuffs.initialAnchor = "TOPRIGHT"
            self.Debuffs.size = 35 --size
            self.Debuffs:SetHeight(self.Debuffs.size)
            self.Debuffs:SetWidth(self.Debuffs.size*16)
            self.Debuffs["growth-x"] = "LEFT"
            self.Debuffs["growth-y"] = "DOWN"
            self.Debuffs.num = 40 -- numbers
            self.Debuffs.spacing = 4
        
         --- ouf weapon enchant --
   
        
            if IsAddOnLoaded("oUF_WeaponEnchant") then
                self.Enchant = CreateFrame("Frame", nil, self)
                self.Enchant.size = 35
                self.Enchant:SetHeight(self.Enchant.size)
                self.Enchant:SetWidth(self.Enchant.size*2)
                self.Enchant:SetPoint("BOTTOMLEFT", Minimap, 0, -70)
                self.Enchant.spacing = 4
                self.Enchant.initialAnchor = "TOPLEFT"
                self.Enchant["growth-x"] = "RIGHT"
                self.Enchant.showCD = false
            end
        end
        
		-- Combat icon --
		------------------------------------------------------------
        if unit=="player" or unit=="target" then  
        
            self.Combat = self.Health:CreateTexture(nil, "OVERLAY")
            self.Combat:SetHeight(12)
            self.Combat:SetWidth(12)
            self.Combat:SetPoint("TOPLEFT", self, 22, 17)	
            self.Combat:SetTexture("Interface\\CharacterFrame\\UI-StateIcon")
            self.Combat:SetTexCoord(0.58, 0.90, 0.08, 0.41)
        end
		
		-- leader,masterloot,asistant icon--
		---------------------------------------------------------------
        
        if unit=="player" or unit=="target" or (self:GetParent():GetName():match"oUF_Party") or (self:GetParent():GetName():match"oUF_Raid") then
        
            self.Leader = self.Health:CreateTexture(nil, "OVERLAY")
            self.Leader:SetHeight(13)
            self.Leader:SetWidth(13)
            self.Leader:SetPoint("BOTTOMLEFT", self, 0, -2)
            self.Leader:SetTexture"Interface\\GroupFrame\\UI-Group-LeaderIcon"
        
            self.MasterLooter = self.Health:CreateTexture(nil, "OVERLAY")
            self.MasterLooter:SetHeight(13)
            self.MasterLooter:SetWidth(13)
            self.MasterLooter:SetPoint("BOTTOMLEFT", self, -1, 10)
        
            self.Assistant = self.Health:CreateTexture(nil, "OVERLAY")
            self.Assistant:SetHeight(13)
            self.Assistant:SetWidth(13)
            self.Assistant:SetPoint("BOTTOMLEFT",self, 0, -2)
        end        
	        
        -- resting icon --
        if unit=="player" then
            self.Resting = self.Health:CreateTexture(nil, "OVERLAY")
            self.Resting:SetHeight(14)
            self.Resting:SetWidth(14)
            self.Resting:SetPoint('TOPLEFT', self, 0, 2)
            self.Resting:SetTexture("Interface\\CharacterFrame\\UI-StateIcon")
            self.Resting:SetTexCoord(0, 0.5, 0, 0.4)
        
        --LFD icon for player --
            self.LFDRole = self.Health:CreateTexture(nil, "OVERLAY")
            self.LFDRole:SetHeight(18)
            self.LFDRole:SetWidth(18)
            self.LFDRole:SetPoint("BOTTOMRIGHT", self, 24, 0)
            self.LFDRole:SetTexture("Interface\LFGFrame\UI-LFG-ICON-PORTRAITROLES")
            self.LFDRole:SetTexCoord(0, 0.5, 0, 0.4)
        end
        
        -- swing support -- not working dont know why 
        if unit=="player" and playerClass=="HUNTER" then
            if IsAddOnLoaded("oUF_Swing") then
			
			self.Swing = CreateFrame("StatusBar", nil, self)
			self.Swing:SetPoint("CENTER", UIParent, "CENTER", 0, -1)			
			self.Swing:SetStatusBarTexture(bartex)
			self.Swing:SetStatusBarColor(0.75, 0.75, 0.75)
			self.Swing:SetHeight(3)
			self.Swing:SetWidth(220)
			self.Swing.disableMelee = true
			self.Swing:SetFrameLevel(1)
			
			self.Swing.Text = self.Swing:CreateFontString(nil, "OVERLAY")
			self.Swing.Text:SetFont(font, fontsize-3, "OUTLINE")			
			self.Swing.Text:SetPoint("CENTER", self.Swing, 0, -10)
            end
		end
    end
	
    -- pet --
	---------------------------------------
    
	if unit=="pet" then
    
		self.Power.value:Hide() 
		self.Level:Hide() 
		self.Name:Show()
		self.Name:SetPoint("TOPLEFT", self.Health, 0, -25)
		self.Name:SetWidth(95)
		self.Health.value:SetFont(font, 12, "THINOUTLINE")
		self.ignoreDruidHots = true
		self.BarFade = true
		
		if playerClass=="HUNTER" then
			self.Health.colorReaction = false
			self.Health.colorClass = false
			self.Health.colorHappiness = true  
		end
	end

	
	-- target --
	---------------------------------------
    
    if unit=="target"  then
    
		self.Power.value:Hide() 
		self.Level:SetPoint("TOPLEFT", self.Health, 0, -25)
		self.Name:SetPoint("TOPLEFT", self.Level, "TOPRIGHT", 3, 0)
		self.Name:SetWidth(200)			
	    self.Health.value:SetFont(font, 16, "THINOUTLINE")
	
		--self.ignoreDruidHots = true
		
		
		-- combo points -- 
		-------------------------------------------------------
        if playerClass == "ROGUE" or playerClass == "DRUID" then
    
            self.CPoints = self:CreateFontString(nil, "OVERLAY")
            self.CPoints:SetPoint("RIGHT", self, "RIGHT", 35, 0)
            self.CPoints:SetFont(font, 28, "THINOUTLINE")
            self.CPoints:SetTextColor(1, 0.81, 0)
            self.CPoints:SetShadowOffset(0, 0)
            self.CPoints:SetJustifyH"RIGHT"
	
        end
        
		-- auras --
		---------------------------------------------------
        
		self.Auras = CreateFrame("Frame", nil, self)
		self.Auras.size = 30
		self.Auras.gap = true
		self.Auras:SetHeight(self.Auras.size)
		self.Auras:SetWidth(self.Auras.size * 7)
		self.Auras:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, -40)
		self.Auras.initialAnchor = "TOPLEFT"
        self.Auras["growth-x"] = "RIGHT"
		self.Auras["growth-y"] = "DOWN"
		self.Auras.numBuffs = 40
		self.Auras.numDebuffs = 40
		self.Auras.spacing = 3
    
    end

	-- target of target ,focus and focus target -- 
	--------------------------------------------------------------------

	if unit=="targettarget" or unit=="focus" or unit=="focustarget" then
    
	  self.Power.value:Hide() -- hiding targettarget focus and focus target value
	  self.Name:SetPoint("TOPLEFT", self.Health, 0, -25)
	  self.Name:SetWidth(80)
      self.Health.value:SetFont(font, 16, "THINOUTLINE")
	  self.ignoreDruidHots = true
      
	end
    
	
	-- player,target,pet and focus castbar  --
	-------------------------------------------------------------------	
    
	if unit == "player" or unit =="target" or unit =="focus" or unit == "pet" then
    
	    self.Castbar = CreateFrame("StatusBar", nil, self)
	    self.Castbar:SetStatusBarTexture(bartex)
	    		
		if(unit == "player") then
			local _, class = UnitClass(unit) 
			color = self.colors.class[class] 
			self.Castbar:SetStatusBarColor(color[1], color[2], color[3]) 
			self.Castbar:SetHeight(16)
			self.Castbar:SetWidth(220)

			self.Castbar:SetBackdrop{
				bgFile = "Interface\\ChatFrame\\ChatFrameBackground", tile = true, tileSize = 16,
				insets = {left = -2, right = -2, top = -2, bottom = -2}}

			self.Castbar.SafeZone = self.Castbar:CreateTexture(nil,"OVERLAY")
			self.Castbar.SafeZone:SetTexture(bartex)
			self.Castbar.SafeZone:SetVertexColor(0.75,0.1,0.1,0.6)
			self.Castbar.SafeZone:SetPoint("TOPRIGHT")
			self.Castbar.SafeZone:SetPoint("BOTTOMRIGHT")
            
			self.Castbar:SetPoint("CENTER", UIParent, "CENTER", playerCastBar_x, playerCastBar_y)
            
		else
			self.Castbar:SetStatusBarColor(0.80, 0.01, 0)
			self.Castbar:SetHeight(16)
			self.Castbar:SetWidth(220)
			
			self.Castbar:SetBackdrop{
				bgFile = "Interface\\ChatFrame\\ChatFrameBackground", tile = true, tileSize = 16,
				insets = {left = -2, right = -2, top = -2, bottom = -2}}
                
			self.Castbar:SetPoint("CENTER", UIParent, "CENTER", targetCastBar_x, targetCastBar_y)
            
            if (unit == "focus") then
                self.Castbar:SetStatusBarColor(1, 0.38, 0.01)
                self.Castbar:SetPoint("CENTER", UIParent, "CENTER", focusCastBar_x, focusCastBar_y)
            end
            
            if (unit == "pet") then
                self.Castbar:SetStatusBarColor(0.55, 0.87, 0.51)
                self.Castbar:SetPoint("CENTER", UIParent, "CENTER", petCastBar_x, petCastBar_y)
            end
		end
        
		    self.Castbar:SetBackdropColor(0, 0, 0, 0.5)
		
		    self.Castbar.Text = self.Castbar:CreateFontString(nil, "OVERLAY")
	    	self.Castbar.Text:SetPoint("LEFT", self.Castbar, 0, -20)
	    	self.Castbar.Text:SetFont(font, fontsize, "THINOUTLINE")
		    self.Castbar.Text:SetShadowOffset(0, 0)
	    	self.Castbar.Text:SetTextColor(1, 1, 1)
	    	self.Castbar.Text:SetJustifyH("LEFT")

	    	self.Castbar.Time = self.Castbar:CreateFontString(nil, "OVERLAY")
	    	self.Castbar.Time:SetPoint("RIGHT", self.Castbar, 0, -20)
	    	self.Castbar.Time:SetFont(font, fontsize, "THINOUTLINE")
	    	self.Castbar.Time:SetTextColor(1, 1, 1)
	    	self.Castbar.Time:SetJustifyH("RIGHT")
					
			
			-- Castbar frameborder --
			-------------------------------------------------------------
            
			local TopLeft = self.Castbar:CreateTexture(nil, "OVERLAY")
			TopLeft:SetTexture(frameborder)
			TopLeft:SetTexCoord(0, 1/3, 0, 1/3)
			TopLeft:SetPoint("TOPLEFT", -3, 3)
			TopLeft:SetWidth(14) TopLeft:SetHeight(14)
			TopLeft:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
	
			local TopRight = self.Castbar:CreateTexture(nil, "OVERLAY")
			TopRight:SetTexture(frameborder)
			TopRight:SetTexCoord(2/3, 1, 0, 1/3)
			TopRight:SetPoint("TOPRIGHT", 3, 3)
			TopRight:SetWidth(14) TopRight:SetHeight(14)
			TopRight:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

			local BottomLeft = self.Castbar:CreateTexture(nil, "OVERLAY")
			BottomLeft:SetTexture(frameborder)
			BottomLeft:SetTexCoord(0, 1/3, 2/3, 1)
			BottomLeft:SetPoint("BOTTOMLEFT", -3, -3)
			BottomLeft:SetWidth(14) BottomLeft:SetHeight(14)
			BottomLeft:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

			local BottomRight = self.Castbar:CreateTexture(nil, "OVERLAY")
			BottomRight:SetTexture(frameborder)
			BottomRight:SetTexCoord(2/3, 1, 2/3, 1)
			BottomRight:SetPoint("BOTTOMRIGHT", 3, -3)
			BottomRight:SetWidth(14) BottomRight:SetHeight(14)
			BottomRight:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

			local TopEdge = self.Castbar:CreateTexture(nil, "OVERLAY")
			TopEdge:SetTexture(frameborder)
			TopEdge:SetTexCoord(1/3, 2/3, 0, 1/3)
			TopEdge:SetPoint("TOPLEFT", TopLeft, "TOPRIGHT")
			TopEdge:SetPoint("TOPRIGHT", TopRight, "TOPLEFT")
			TopEdge:SetHeight(14)
			TopEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
		
			local BottomEdge = self.Castbar:CreateTexture(nil, "OVERLAY")
			BottomEdge:SetTexture(frameborder)
			BottomEdge:SetTexCoord(1/3, 2/3, 2/3, 1)
			BottomEdge:SetPoint("BOTTOMLEFT", BottomLeft, "BOTTOMRIGHT")
			BottomEdge:SetPoint("BOTTOMRIGHT", BottomRight, "BOTTOMLEFT")
			BottomEdge:SetHeight(14)
			BottomEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
		
			local LeftEdge = self.Castbar:CreateTexture(nil, "OVERLAY")
			LeftEdge:SetTexture(frameborder)
			LeftEdge:SetTexCoord(0, 1/3, 1/3, 2/3)
			LeftEdge:SetPoint("TOPLEFT", TopLeft, "BOTTOMLEFT")
			LeftEdge:SetPoint("BOTTOMLEFT", BottomLeft, "TOPLEFT")
			LeftEdge:SetWidth(14)
			LeftEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
		
			local RightEdge = self.Castbar:CreateTexture(nil, "OVERLAY")
			RightEdge:SetTexture(frameborder)
			RightEdge:SetTexCoord(2/3, 1, 1/3, 2/3)
			RightEdge:SetPoint("TOPRIGHT", TopRight, "BOTTOMRIGHT")
			RightEdge:SetPoint("BOTTOMRIGHT", BottomRight, "TOPRIGHT")
			RightEdge:SetWidth(14)
			RightEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
	end

	
	-- party -- 
	---------------------------------------
    
	if (self:GetParent():GetName():match"oUF_Party") then
      
	    self.Power.value:Hide() -- hiding party power value
	    self.Name:SetPoint("TOPLEFT", self.Health, 0, -25)
	    self.Name:SetWidth(150)
	    self.Health:SetFrameLevel(2)
	    self.Power:SetFrameLevel(2)

	    self.ignoreDruidHots = true
		
        --lfd icon --
        
        self.LFDRole = self.Health:CreateTexture(nil, "OVERLAY")
		self.LFDRole:SetHeight(18)
		self.LFDRole:SetWidth(18)
		self.LFDRole:SetPoint("RIGHT", self, 24, 0)
		self.LFDRole:SetTexture("Interface\LFGFrame\UI-LFG-ICON-PORTRAITROLES")
		self.LFDRole:SetTexCoord(0, 0.5, 0, 0.4)
        
		-- auras --
		--------------------------------------------------------
        
		self.Auras = CreateFrame("Frame", nil, self) -- auras
		self.Auras.buffFilter= "HELPFUL|RAID"
		self.Auras.size = 20
		self.Auras.gap = true
		self.Auras:SetHeight(self.Auras.size)
		self.Auras:SetWidth(self.Auras.size * 7)
		self.Auras:SetPoint("BOTTOMLEFT", self, "TOPLEFT", -2, 7)
		self.Auras.initialAnchor = "BOTTOMLEFT"
		self.Auras.numBuffs = 4
		self.Auras.numDebuffs = 3
		self.Auras.spacing = 3

	end

	
	-- partypets
	---------------------------------------
    
	if (unit and unit:find("partypet%d")) then
	  
        self.Power.value:Hide() -- hiding partypets power value
        self.Name:SetPoint("TOPLEFT", self.Health, 0, -25)
        self.Name:SetWidth(95)
        self.Health:SetFrameLevel(1)
        self.Power:SetFrameLevel(1)
        self.Health.value:SetFont(font, 12, "OUTLINE")
	
        self.ignoreDruidHots = true
	
		
		-- auras
		------------------------------------------------------
        
		self.Auras = CreateFrame("Frame", nil, self) 
		self.Auras.buffFilter= "HELPFUL|RAID"
		self.Auras.size = 18
		self.Auras.gap = true
		self.Auras:SetHeight(self.Auras.size)
		self.Auras:SetWidth(self.Auras.size * 4)
		self.Auras:SetPoint("BOTTOMLEFT", self, "TOPLEFT", -2, 7)
		self.Auras.initialAnchor = "BOTTOMLEFT"
		self.Auras.numBuffs = 4
		self.Auras.numDebuffs = 2
		self.Auras.spacing = 3
	end


	
	-- Raid -- 
	---------------------------------------
    
	if (self:GetParent():GetName():match"oUF_Raid") then
    
        self.Power:Hide() 
        self.Health:SetFrameLevel(2) 
        self.Power:SetFrameLevel(2)
        self.Power.value:Hide() 
        self.Name:SetFont(font, raidfontsize, "THINOUTLINE")
        self.Name:SetPoint("TOPLEFT", self.Health, 2, -2)
        self.Health.value:SetFont(font, raidfontsize, "THINOUTLINE")
        self.Health.value:SetPoint("BOTTOM", self.Health, 2, 2)
    
        
		-- Combat Feedback for raid --
		----------------------------------------------------------------------------------
        
		self.CombatFeedbackText:SetFont(font, 10, "THINOUTLINE")
        self.CombatFeedbackText:SetPoint("CENTER", self.Health, "CENTER", 0, 0)
		self.CombatFeedbackText.ignoreImmune = true -- ignore 'immune' reports
		self.CombatFeedbackText.ignoreDamage = true -- ignore damage hits, blocks, misses, parries etc.
		self.CombatFeedbackText.ignoreEnergize = true -- ignore energize events
		self.CombatFeedbackText.ignoreOther = true  -- ignore everything else	 

    end		

	
	-- fading for party and raid --
	-----------------------------------------------------------------------------------------------
    
	if (not unit or unit:find("partypet%d") or unit == "pet") then     -- fadeout if units are out of range

		self.Range = true -- true to make party/raid frames fade out if not in your range
		self.inRangeAlpha = 1.0 -- what alpha if IN range
		self.outsideRangeAlpha = 0.5 -- the alpha it will fade out to if not in range
    end
	
	-- custom aura textures --
	---------------------------------------------------------
    
	self.PostCreateAuraIcon = auraIcon
	self.SetAuraPosition = auraOffset
    self.PostCreateEnchantIcon = enchantIcon
    self.PostUpdateEnchantIcons = enchantUpdateIcons
    
    
    -- this sections is a part of  hard learning , fix taint error 
    -- frame sizes -- forgotten druid mana bar.lol, total mess --
   
    -------------------------.---------------------------------------------------------------------------------------------------------------
    
	if unit=="player" or unit == "target" then
		self:SetAttribute ("initial-height", 20)
		self:SetAttribute("initial-width", 220)
		self.Health:SetHeight(14)
		self.Power:SetHeight(5)
       
       -- Druid Mana bar--
		if unit=="player" and playerClass=="DRUID" then
			self:SetAttribute ("initial-height", 23)
			self.Power.value:SetPoint("TOPLEFT", self.Health, 0, -28)
		
			self.DruidPower = CreateFrame"StatusBar"
			self.DruidPower:SetStatusBarTexture(bartex2)
			self.DruidPower:SetPoint("TOPLEFT", self.Power,"BOTTOMLEFT", 0, -1)
			self.DruidPower:SetHeight(3)
			self.DruidPower:SetWidth(143)
			self.DruidPower.Smooth = true
			self.DruidPower:SetFrameLevel(1)
	
			self.DruidPower.bg = self.DruidPower:CreateTexture(nil, "BORDER")
			self.DruidPower.bg:SetAllPoints(self.DruidPower)
			self.DruidPower.bg:SetTexture(bartex2)
            self.DruidPower.bg:SetWidth(143)
			self.DruidPower.bg:SetAlpha(0.40)
			
			self.DruidPower.percent = self.DruidPower:CreateFontString(nil, "OVERLAY")
			self.DruidPower.percent:SetPoint("TOPRIGHT", self.Health, 0, -28)				
			self.DruidPower.percent:SetFont(font, fontsize-3, "THINOUTLINE")
			self.DruidPower.percent:SetTextColor(1,1,1)
			self.DruidPower.percent:SetShadowOffset(0, 0)

			self:RegisterEvent("UNIT_MANA", UpdateDruidPower)
			self:RegisterEvent("UNIT_ENERGY", UpdateDruidPower)
			self:RegisterEvent("PLAYER_LOGIN", UpdateDruidPower)
        end
        
        
	elseif unit=="targettarget" or unit=="focus" or unit=="focustarget" or unit=="pet" or (unit and unit:find("partypet%d")) then
		self:SetAttribute("initial-height", 20 )
		self:SetAttribute("initial-width", 84)
		self.Health:SetHeight(14)
		self.Power:SetHeight(5)
        
    elseif(self:GetParent():GetName():match"oUF_Party") then
        self:SetAttribute("initial-height", 20) 
        self:SetAttribute("initial-width", 200) 
	    self.Health:SetWidth(180)
	    self.Power:SetWidth(180)
      
	elseif(self:GetParent():GetName():match"oUF_Raid") then
		self:SetAttribute("initial-height", 45)
		self:SetAttribute("initial-width", 45)
		self.Health:SetHeight(45)
		self.Power:SetHeight(45)
    end
end    

-- Frames Spawn --
------------------------------------------------------------------------

-- normal frames --
------------------------------------------------------------------------
oUF:RegisterStyle("oUF_Experiment", func)
oUF:SetActiveStyle("oUF_Experiment")

local player = oUF:Spawn("player", "oUF_Player")
player:SetPoint("TOPLEFT", 20, -25)

local target = oUF:Spawn("target", "oUF_Target")
target:SetPoint("TOPLEFT", 320, -25) 

local pet = oUF:Spawn("pet", "oUF_Pet")
pet:SetPoint("TOPLEFT", player, 0, -55)

local tot = oUF:Spawn("targettarget", "oUF_TargetTarget")
tot:SetPoint("LEFT", target, 300, 0)

local focus	= oUF:Spawn("focus", "oUF_Focus")
focus:SetPoint("TOPRIGHT", player, 0, -55)

local focustarget = oUF:Spawn("focustarget", "oUF_FocusTarget")
focustarget:SetPoint("BOTTOM", focus, 0, -85) 
 
    
-- party --
---------------------------------------------------------------------


local party = oUF:Spawn("header", "oUF_Party")
party:SetManyAttributes("showParty", true, "yOffset", -150)
party:SetPoint("TOPLEFT", player, 0, -250)
party:Show()


-- partypets -- all credits goes to Master Jedi Dawn 
---------------------------------------------------------------------

local pets = {} 
pets[1] = oUF:Spawn("partypet1", "oUF_PartyPet1") 
pets[1]:SetPoint("TOPLEFT", player, 0, -170) 
pets[2] = oUF:Spawn("partypet2", "oUF_PartyPet2") 
pets[2]:SetPoint("TOPLEFT", pets[1] , 0, -170) 
pets[3] = oUF:Spawn("partypet3", "oUF_PartyPet3") 
pets[3]:SetPoint("TOPLEFT", pets[2] , 0, -170)
pets[4] = oUF:Spawn("partypet4", "oUF_PartyPet4") 
pets[4]:SetPoint("TOPLEFT", pets[3] , 0, -170)  

--raid--
-----------------------------------------------------------------------

local raid = {}
    if disableraid == false then	
        for i = 1, 8 do
	        local raidgroup = oUF:Spawn("header", "oUF_Raid"..i)
	        raidgroup:SetManyAttributes("groupFilter", i, "showRaid", true, "yOffSet", -12, "point", "TOP")
            table.insert(raid, raidgroup)
            if(i==1) then
		    raidgroup:SetPoint("LEFT", 20, -120)
	        else
            raidgroup:SetPoint("TOPLEFT", raid[i-1], "TOPRIGHT", 12, 0)
        end
	end
end

-- party toggle in raid -- All Credits goes to Master Jedi Dawn
------------------------------------------------------------

local partyToggle = CreateFrame("Frame")
partyToggle:RegisterEvent("PLAYER_LOGIN")
partyToggle:RegisterEvent("RAID_ROSTER_UPDATE")
partyToggle:RegisterEvent("PARTY_LEADER_CHANGED")
partyToggle:RegisterEvent("PARTY_MEMBER_CHANGED")
partyToggle:SetScript("OnEvent", function(self)
        if(InCombatLockdown()) then
            self:RegisterEvent("PLAYER_REGEN_ENABLED")
        else
            self:UnregisterEvent("PLAYER_REGEN_ENABLED") 
            
            if(GetNumRaidMembers() > 5) then
            party:Hide()
            for i,v in ipairs(raid) do v:Show()end
            pets[1]:Disable()
            pets[2]:Disable()
            pets[3]:Disable()
            pets[4]:Disable()
            
            else
        
            party:Show()
            for i,v in ipairs(raid) do v:Hide()end		
            pets[1]:Enable()
            pets[2]:Enable()
            pets[3]:Enable()
            pets[4]:Enable()
        end
    end
end)
  Reply With Quote
12-21-09, 08:24 AM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Do you have optional dependency on oUF_Swing? Based on a quick look at it's code it doesn't attempt to figure out if it was loaded before or after the layout.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
12-21-09, 08:47 AM   #3
Aesh
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Nov 2009
Posts: 11
AHHHHH,GOD I hate myself , and love you HASTE.
**** i was sure i forget something important, and sure this is very easy thing.BUT THIS .... going to kill myself.
  Reply With Quote
12-21-09, 09:34 AM   #4
Aesh
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Nov 2009
Posts: 11
ok swing problem solved but i have another problem with layout.
not sure this is a right place to ask for that.but i think problem is layout.
because i tested most of laoyuts here with weapon enchant support some of its works some not.


Code:
if IsAddOnLoaded("oUF_WeaponEnchant") then
                self.Enchant = CreateFrame("Frame", nil, self)
                self.Enchant.size = 35
                self.Enchant:SetHeight(self.Enchant.size)
                self.Enchant:SetWidth(self.Enchant.size*2)
                self.Enchant:SetPoint("BOTTOMLEFT", Minimap, 0, -70)
                self.Enchant.spacing = 4
                self.Enchant.initialAnchor = "TOPLEFT"
                self.Enchant["growth-x"] = "RIGHT"
                self.Enchant.showCD = false
            end
      end
this is the code for support ouf_enchant code.

but when i set self.Enchant.showCD = true , weapon enchant showing 40d 30d or something like these numbers ,

found a way in forums.
when i edited ouf_weapon enchnant line 134
Code:
icon.cd:SetCooldown(now, mainHandExpiration)
to
Code:
icon.cd:SetCooldown(now, mainHandExpiration/1000)
and line 157
Code:
icon.cd:SetCooldown(now, offHandExpiration)
to
Code:
icon.cd:SetCooldown(now, offHandExpiration/1000)
then i am getting right numbers.But i dont need to edit plugin,
what is the proper way to do this? i need to add something in layout ?
show me my error.
  Reply With Quote
12-21-09, 11:50 AM   #5
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
It's an error in the plug-in.
__________________
「貴方は1人じゃないよ」
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Need some help with my Layout,


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