Thread Tools Display Modes
11-13-11, 10:07 AM   #1
kniny
A Kobold Labourer
Join Date: Nov 2011
Posts: 1
requesting some help

Hey guys. I'm long time user of wow interface and first time poster. I started using oUF and tried to learn how to customize things. I couldn't really grasp the whole code thing, so I need some help. I'm using skaarjs layout which I really love, just need a few adjustments.
-fixing the pvp trinket in arena, doesn't show when its being used.
-filtering target/focus buffs to only show dispellable buffs
-displaying party frames while in arena/battle grounds along with raid frame

I tried changing these things myself, messing around with it for awhile and never got it to work.
Code:
local name, ns = ...
local cfg = ns.cfg
local _, class = UnitClass('player')

local backdrop = {
    bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
    insets = {top = 0, left = 0, bottom = 0, right = 0},
}

local backdrop2 = {
    bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
    insets = {top = -1, left = -1, bottom = -1, right = -1},
}

local framebd = {
    edgeFile = cfg.glowTex, edgeSize = 5,
    bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
    insets = {left = 3, right = 3, top = 3, bottom = 3}
}

local OnEnter = function(self)
    UnitFrame_OnEnter(self)
    self.Highlight:Show()	
end

local OnLeave = function(self)
    UnitFrame_OnLeave(self)
    self.Highlight:Hide()	
end

local ChangedTarget = function(self)
    if UnitIsUnit('target', self.unit) then
        self.TargetBorder:Show()
    else
        self.TargetBorder:Hide()
    end
end

local FocusTarget = function(self)
    if UnitIsUnit('focus', self.unit) then
        self.FocusHighlight:Show()
    else
        self.FocusHighlight:Hide()
    end
end

local dropdown = CreateFrame('Frame', name .. 'DropDown', UIParent, 'UIDropDownMenuTemplate')

local function menu(self)
	dropdown:SetParent(self)
	return ToggleDropDownMenu(1, nil, dropdown, 'cursor', 0, 0)
end

local init = function(self)
	local unit = self:GetParent().unit
	local menu, name, id

	if(not unit) then
		return
	end

	if(UnitIsUnit(unit, "player")) then
		menu = "SELF"
    elseif(UnitIsUnit(unit, "vehicle")) then
		menu = "VEHICLE"
	elseif(UnitIsUnit(unit, "pet")) then
		menu = "PET"
	elseif(UnitIsPlayer(unit)) then
		id = UnitInRaid(unit)
		if(id) then
			menu = "RAID_PLAYER"
			name = GetRaidRosterInfo(id)
		elseif(UnitInParty(unit)) then
			menu = "PARTY"
		else
			menu = "PLAYER"
		end
	else
		menu = "TARGET"
		name = RAID_TARGET_ICON
	end

	if(menu) then
		UnitPopup_ShowMenu(self, menu, unit, name, id)
	end
end

UIDropDownMenu_Initialize(dropdown, init, 'MENU')

local framebackdrop = function(parent, anchor) 
    local frame = CreateFrame("Frame", nil, parent)
    frame:SetFrameStrata("LOW")
    frame:SetPoint("TOPLEFT", anchor, "TOPLEFT", -4, 4)
    frame:SetPoint("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", 4, -4)
    frame:SetBackdrop(framebd)
    frame:SetBackdropColor(.05, .05, .05, 1)
    frame:SetBackdropBorderColor(0, 0, 0)
    return frame
end

ns.bd = framebackdrop

local fixStatusbar = function(bar)
    bar:GetStatusBarTexture():SetHorizTile(false)
    bar:GetStatusBarTexture():SetVertTile(false)
end

local createStatusbar = function(parent, tex, layer, height, width, r, g, b, alpha)
    local bar = CreateFrame"StatusBar"
    bar:SetParent(parent)
    if height then
        bar:SetHeight(height)
    end
    if width then
        bar:SetWidth(width)
    end
    bar:SetStatusBarTexture(tex, layer)
    bar:SetStatusBarColor(r, g, b, alpha)
    fixStatusbar(bar)
    return bar
end

local fs = function(parent, layer, font, fontsiz, outline, r, g, b, justify)
    local string = parent:CreateFontString(nil, layer)
    string:SetFont(font, fontsiz, outline)
    string:SetShadowOffset(cfg.shadowoffsetX, cfg.shadowoffsetY)
    string:SetTextColor(r, g, b)
    if justify then
        string:SetJustifyH(justify)
    end
    return string
end

local updateEclipse = function(element, unit)
    if element.hasSolarEclipse then
        element.bd:SetBackdropBorderColor(1, .6, 0)
        element.bd:SetBackdropColor(1, .6, 0)
    elseif element.hasLunarEclipse then
        element.bd:SetBackdropBorderColor(0, .4, 1)
        element.bd:SetBackdropColor(0, .4, 1)
    else
        element.bd:SetBackdropBorderColor(0, 0, 0)
        element.bd:SetBackdropColor(0, 0, 0)
    end
end

local PostAltUpdate = function(self, min, cur, max)
    local per = math.floor((cur/max)*100)		
	if per < 30 then
		self:SetStatusBarColor(0, 1, 0)
	elseif per < 60 then
		self:SetStatusBarColor(1, 1, 0)
	else
		self:SetStatusBarColor(1, 0, 0)
	end
end

local GetTime = GetTime
local floor, fmod = floor, math.fmod
local day, hour, minute = 86400, 3600, 60

local FormatTime = function(s)
    if s >= day then
        return format("%dd", floor(s/day + 0.5))
    elseif s >= hour then
        return format("%dh", floor(s/hour + 0.5))
    elseif s >= minute then
        return format("%dm", floor(s/minute + 0.5))
    end

    return format("%d", fmod(s, minute))
end

local CreateAuraTimer = function(self,elapsed)
    self.elapsed = (self.elapsed or 0) + elapsed

    if self.elapsed < .2 then return end
    self.elapsed = 0

    local timeLeft = self.expires - GetTime()
    if timeLeft <= 0 then
        self.remaining:SetText(nil)
    else
        self.remaining:SetText(FormatTime(timeLeft))
    end
end

local auraIcon = function(auras, button)
    local c = button.count
    c:ClearAllPoints()
    c:SetPoint(unpack(cfg.count_pos))
    c:SetFontObject(nil)
    c:SetFont(cfg.font, cfg.fontsize, "Outlinemonochrome")
    c:SetTextColor(.8, .8, .8)
    auras.disableCooldown = true
    button.icon:SetTexCoord(.1, .9, .1, .9)
    button.bg = ns.bd(button, button)
    auras.showDebuffType = true
    button.overlay:SetTexture(cfg.buttonTex)
    button.overlay:SetPoint("TOPLEFT", button, "TOPLEFT", -2, 2)
    button.overlay:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2)
    button.overlay:SetTexCoord(0, 1, 0.02, 1)
    button.overlay.Hide = function(self) self:SetVertexColor(0.33, 0.59, 0.33) end
    button.overlay:Hide()	
    local remaining = fs(button, "OVERLAY", cfg.font, cfg.fontsize, "Outlinemonochrome", .8, .8, .8)
    remaining:SetPoint(unpack(cfg.remaining_pos))
    button.remaining = remaining
end

local PostUpdateIcon
do
    local playerUnits = {
        player = true,
        pet = true,
        vehicle = true,
    }

    PostUpdateIcon = function(icons, unit, icon, index, offset)
        local name, _, _, _, dtype, duration, expirationTime, unitCaster = UnitAura(unit, index, icon.filter)

        local texture = icon.icon
        if playerUnits[icon.owner] or UnitIsFriend('player', unit) or not icon.debuff then
            texture:SetDesaturated(false)
        else
            texture:SetDesaturated(true)
        end

        if duration and duration > 0 then
            icon.remaining:Show()
        else
            icon.remaining:Hide()
        end
		
        icon.duration = duration
        icon.expires = expirationTime
        icon:SetScript("OnUpdate", CreateAuraTimer)
    end
end

local CustomFilter = function(icons, ...)
    local _, icon, name, _, _, _, _, _, _, caster = ...

    local isPlayer

    if (caster == 'player' or caster == 'vechicle') then
        isPlayer = true
    end

    if((icons.onlyShowPlayer and isPlayer) or (not icons.onlyShowPlayer and name)) then
        icon.isPlayer = isPlayer
        icon.owner = caster
        return true
    end
end

local UpdateAuraTrackerTime = function(self, elapsed)
	if self.active then
		self.timeleft = self.timeleft - elapsed
		if self.timeleft <= 5 then
			self.text:SetTextColor(1, 0, 0) 
		else
			self.text:SetTextColor(1, 1, 1) 
		end
		if self.timeleft <= 0 then
			self.icon:SetTexture('')
			self.text:SetText('')
		end	
		self.text:SetFormattedText('%.1f', self.timeleft)
	end
end

local PostUpdateHealth = function(health, unit)
	if(UnitIsDead(unit)) then
		health:SetValue(0)
	elseif(UnitIsGhost(unit)) then
		health:SetValue(0)
	elseif not (UnitIsConnected(unit)) then
	    health:SetValue(0)
	end
end

local CreateAuraIndicator = function(self)
	self.indicator = {}
	for i, v in pairs(cfg.indicators) do
		self.indicator[i] = CreateFrame('Frame', nil, self.Health)
		self.indicator[i]:SetSize(5, 5)
		self.indicator[i]:SetPoint(unpack(v))
		self.indicator[i]:SetFrameStrata('HIGH')
		self.indicator[i]:Hide()
		self.indicator[i].tex = self.indicator[i]:CreateTexture(nil, 'OVERLAY')
		self.indicator[i].tex:SetAllPoints(self.indicator[i])
		self.indicator[i].tex:SetTexture(cfg.texture)
		self.indicator[i]:SetBackdrop(backdrop2)
		self.indicator[i]:SetBackdropColor(0, 0, 0, 1)
	end
end

local UpdateAuraIndicator = function(self, event, unit)
	if self.unit ~= unit then return end
	for i, v in pairs(cfg.auraindicator) do
		if class == v.class then
			if UnitAura(unit, i) then
				self.indicator[v.point]:Show()
				self.indicator[v.point].tex:SetVertexColor(unpack(v.color))
			else
				self.indicator[v.point]:Hide()
			end
		end
	end
end


local channelingTicks = {
	-- warlock
	[GetSpellInfo(1120)] = 6, -- drain soul
	[GetSpellInfo(689)] = 3, -- drain life
	[GetSpellInfo(5740)] = 4, -- rain of fire
	[GetSpellInfo(79268)] = 4, -- soul harvest
	-- druid
	[GetSpellInfo(740)] = 4, -- Tranquility
	[GetSpellInfo(16914)] = 10, -- Hurricane
	-- priest
	[GetSpellInfo(15407)] = 3, -- mind flay
	[GetSpellInfo(48045)] = 5, -- mind sear
	[GetSpellInfo(47540)] = 2, -- penance
	-- mage
	[GetSpellInfo(5143)] = 5, -- arcane missiles
	[GetSpellInfo(10)] = 5, -- blizzard
	[GetSpellInfo(12051)] = 4, -- evocation
}

local ticks = {}

local setBarTicks = function(castBar, ticknum)
	if ticknum and ticknum > 0 then
		local delta = castBar:GetWidth() / ticknum
		for k = 1, ticknum do
			if not ticks[k] then
				ticks[k] = castBar:CreateTexture(nil, 'OVERLAY')
				ticks[k]:SetTexture(cfg.texture)
				ticks[k]:SetVertexColor(0.6, 0.6, 0.6)
				ticks[k]:SetWidth(1)
				ticks[k]:SetHeight(21)
			end
			ticks[k]:ClearAllPoints()
			ticks[k]:SetPoint('CENTER', castBar, 'LEFT', delta * k, 0 )
			ticks[k]:Show()
		end
	else
		for k, v in pairs(ticks) do
			v:Hide()
		end
	end
end

local OnCastbarUpdate = function(self, elapsed)
	local currentTime = GetTime()
	if self.casting or self.channeling then
		local parent = self:GetParent()
		local duration = self.casting and self.duration + elapsed or self.duration - elapsed
		if (self.casting and duration >= self.max) or (self.channeling and duration <= 0) then
			self.casting = nil
			self.channeling = nil
			return
		end
		if parent.unit == 'player' then
			if self.delay ~= 0 then
				self.Time:SetFormattedText('%.1f | %.1f |cffff0000|%.1f|r', self.max - duration, self.max, self.delay )
			else
				self.Time:SetFormattedText('%.1f | %.1f', duration, self.max)
				self.Lag:SetFormattedText('%d ms', self.SafeZone.timeDiff * 1000)
			end
		else
			self.Time:SetFormattedText('%.1f | %.1f', duration, self.casting and self.max + self.delay or self.max - self.delay)
		end
		self.duration = duration
		self:SetValue(duration)
		self.Spark:SetPoint('CENTER', self, 'LEFT', (duration / self.max) * self:GetWidth(), 0)
	elseif self.fadeOut then
		self.Spark:Hide()
		local alpha = self:GetAlpha() - 0.02
		if alpha > 0 then
			self:SetAlpha(alpha)
		else
			self.fadeOut = nil
			self:Hide()
		end
	end
end

local OnCastSent = function(self, event, unit)
	if self.unit ~= unit or not self.Castbar.SafeZone then return end
	self.Castbar.SafeZone.sendTime = GetTime()
end

local PostCastStart = function(self, unit)
	self:SetAlpha(1.0)
	self.Spark:Show()
	self:SetStatusBarColor(unpack(self.casting and self.CastingColor or self.ChannelingColor))
	if self.casting then
		self.cast = true
	else
		self.cast = false
	end
	if unit == 'vehicle' then
		self.SafeZone:Hide()
		self.Lag:Hide()
	elseif unit == 'player' then
		local sf = self.SafeZone
		sf.timeDiff = GetTime() - sf.sendTime
		sf.timeDiff = sf.timeDiff > self.max and self.max or sf.timeDiff
		sf:SetWidth(self:GetWidth() * sf.timeDiff / self.max)
		sf:Show()
		self.Lag:Show()
		if self.casting then
			setBarTicks(self, 0)
		else
			local spell = UnitChannelInfo(unit)
			self.channelingTicks = channelingTicks[spell] or 0
			setBarTicks(self, self.channelingTicks)
		end
	end
	if unit ~= 'player' then
        if self.interrupt then
            self.Backdrop:SetBackdropBorderColor(1, .9, .4)
            self.Backdrop:SetBackdropColor(1, .9, .4)
			self.IBackdrop:SetBackdropBorderColor(1, .9, .4)
			self.IBackdrop:SetBackdropColor(1, .9, .4)
        else
            self.Backdrop:SetBackdropBorderColor(0, 0, 0)
            self.Backdrop:SetBackdropColor(0, 0, 0)
			self.IBackdrop:SetBackdropBorderColor(0, 0, 0)
            self.IBackdrop:SetBackdropColor(0, 0, 0)
        end
    end
end

local PostCastStop = function(self, unit)
	if not self.fadeOut then
		self:SetStatusBarColor(unpack(self.CompleteColor))
		self.fadeOut = true
	end
	self:SetValue(self.cast and self.max or 0)
	self:Show()
end

local PostCastFailed = function(self, event, unit)
	self:SetStatusBarColor(unpack(self.FailColor))
	self:SetValue(self.max)
	if not self.fadeOut then
		self.fadeOut = true
	end
	self:Show()
end

local castbar = function(self, unit)
    if (unit == 'player' or unit == 'target' or unit == 'focus' or unit == 'arena') then
		local cb = createStatusbar(self, cfg.texture, nil, nil, nil, 1, 1, 1, 1)
        cb:SetToplevel(true)
		
		local cbbg = cb:CreateTexture(nil, "BACKGROUND")
        cbbg:SetAllPoints(cb)
        cbbg:SetTexture(cfg.texture)
        cbbg:SetVertexColor(.05,.05,.05)

		cb.Time = fs(cb, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
		cb.Time:SetPoint("RIGHT", cb, -2, 0)
		
		cb.Text = fs(cb, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1, "LEFT")
        cb.Text:SetPoint("LEFT", cb, 2, 0)
        cb.Text:SetPoint("RIGHT", cb.Time, "LEFT")

		cb.CastingColor = {cfg.Color.Castbar.r, cfg.Color.Castbar.g, cfg.Color.Castbar.b}
		cb.CompleteColor = {0.12, 0.86, 0.15}
		cb.FailColor = {1.0, 0.09, 0}
		cb.ChannelingColor = {0.32, 0.3, 1}

		cb.Icon = cb:CreateTexture(nil, 'ARTWORK')
		cb.Icon:SetPoint("TOPRIGHT", cb, "TOPLEFT", -4, 0)
        cb.Icon:SetTexCoord(.1, .9, .1, .9)

		if unit == 'player' then
			cb:SetPoint(unpack(cfg.player_cb_pos))
			cb:SetWidth(cfg.player_cb_Width)
            cb:SetHeight(cfg.player_cb_Height)
			cb.Icon:SetSize(cfg.player_cb_Height, cfg.player_cb_Height)
			cb.SafeZone = cb:CreateTexture(nil, 'BORDER')
			cb.SafeZone:SetTexture(cfg.texture)
			cb.SafeZone:SetVertexColor(.8,.11,.15)
			cb.Lag = fs(cb, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
			cb.Lag:SetPoint('BOTTOMRIGHT', 0, -3)
			cb.Lag:SetJustifyH('RIGHT')
			self:RegisterEvent('UNIT_SPELLCAST_SENT', OnCastSent)
		elseif unit == 'target' then
			cb:SetPoint(unpack(cfg.target_cb_pos))
			cb:SetWidth(cfg.target_cb_Width)
            cb:SetHeight(cfg.target_cb_Height)
			cb.Icon:SetSize(cfg.target_cb_Height, cfg.target_cb_Height)
		elseif unit == 'focus' then
			cb:SetPoint(unpack(cfg.focus_cb_pos))
			cb:SetWidth(cfg.focus_cb_Width)
            cb:SetHeight(cfg.focus_cb_Height)
			cb.Icon:SetSize(cfg.focus_cb_Height, cfg.focus_cb_Height)
		else
			cb:SetPoint(unpack(cfg.arena_cb_pos))
			cb:SetWidth(cfg.arena_cb_Width)
            cb:SetHeight(cfg.arena_cb_Height)
			cb.Icon:SetSize(cfg.arena_cb_Height, cfg.arena_cb_Height)
		end

		cb.Spark = cb:CreateTexture(nil,'OVERLAY')
		cb.Spark:SetBlendMode('Add')
		cb.Spark:SetHeight(cb:GetHeight() * 2)
		cb.Spark:SetWidth(20)
		cb.Spark:SetVertexColor(1, 1, 1)

		cb.OnUpdate = OnCastbarUpdate
		cb.PostCastStart = PostCastStart
		cb.PostChannelStart = PostCastStart
		cb.PostCastStop = PostCastStop
		cb.PostChannelStop = PostCastStop
		cb.PostCastFailed = PostCastFailed
		cb.PostCastInterrupted = PostCastFailed
		cb.bg = cbbg
		cb.Backdrop = ns.bd(cb, cb)
		cb.IBackdrop = ns.bd(cb, cb.Icon)
		self.Castbar = cb

	end
end

local createRaidIcon = function(self)
	ricon = self.Health:CreateTexture(nil, "OVERLAY")
	ricon:SetTexture(cfg.raidIcons)
	self.RaidIcon = ricon
end
    
local Resurrect = function(self) 
    res = CreateFrame('Frame', nil, self)
	res:SetSize(22, 22)
	res:SetPoint('CENTER', self)
	res:SetFrameStrata'HIGH'
    res:SetBackdrop(backdrop2)
    res:SetBackdropColor(.2, .6, 1)
    res.icon = res:CreateTexture(nil, 'OVERLAY')
	res.icon:SetTexture[[Interface\Icons\Spell_Holy_Resurrection]]
	res.icon:SetTexCoord(.1, .9, .1, .9)
    res.icon:SetAllPoints(res)
	self.ResurrectIcon = res
end

local Shared = function(self, unit)

    self.menu = menu

    self:SetScript("OnEnter", OnEnter)
    self:SetScript("OnLeave", OnLeave)
    self:RegisterForClicks"AnyUp"

    self.framebd = ns.bd(self, self)

    local h = createStatusbar(self, cfg.texture, nil, nil, nil, cfg.Color.Health.r, cfg.Color.Health.g, cfg.Color.Health.b, 1)
    h:SetPoint"TOP"
    h:SetPoint"LEFT"
    h:SetHeight(cfg.height*cfg.health_height)
   
    h.frequentUpdates = true
	
	if cfg.Smooth then
       h.Smooth = true
	end

    local hbg = h:CreateTexture(nil, "BORDER")
    hbg:SetAllPoints(h)
    hbg:SetTexture(cfg.texture)
	hbg:SetTexture(.05,.05,.05)
	hbg.multiplier = .2
	
	h.bg = hbg
    self.Health = h
	h.PostUpdate = PostUpdateHealth

    if not (unit == "targettarget" or unit == "pet" or unit == "focustarget") then
        local p = createStatusbar(self, cfg.texture, nil, cfg.height*-(cfg.health_height-.95), nil, 1, 1, 1, 1)
        p:SetPoint"LEFT"
        p:SetPoint"RIGHT"
        p:SetPoint"BOTTOM" 
		
        p.frequentUpdates = true
        
	    if cfg.Smooth then
            p.Smooth = true
	    end

        local pbg = p:CreateTexture(nil, "BORDER")
        pbg:SetAllPoints(p)
        pbg:SetTexture(cfg.texture)
        p.colorClass = true
        pbg.multiplier = .2
	
        p.bg = pbg
        self.Power = p
    end
	
    local hl = h:CreateTexture(nil, "OVERLAY")
    hl:SetAllPoints(self)
    hl:SetTexture([=[Interface\Buttons\WHITE8x8]=])
    hl:SetVertexColor(1,1,1,.1)
    hl:SetBlendMode("ADD")
    hl:Hide()
    self.Highlight = hl
	
	local l = h:CreateTexture(nil, "OVERLAY")
	l:SetPoint("BOTTOMRIGHT", h, "TOPLEFT", 13, -6)
	if (unit == "raid") then
       l:SetSize(14, 14)
	else
       l:SetSize(16, 16)
	end
       self.Leader = l

    local ml = h:CreateTexture(nil, 'OVERLAY')
	if (unit == "raid") then
	   ml:SetPoint("BOTTOMRIGHT", h, "TOPLEFT", 23, -5)
       ml:SetSize(12, 12)
    else
	   ml:SetPoint('LEFT', l, 'RIGHT')
	   ml:SetSize(14, 14)
	end
       self.MasterLooter = ml

	local a = h:CreateTexture(nil, "OVERLAY")
    a:SetPoint("BOTTOMRIGHT", h, "TOPLEFT", 13, -6)
	if (unit == "raid") then
       a:SetSize(14, 14)
	else
       a:SetSize(16, 16)
	end
	   self.Assistant = a

	local rc = h:CreateTexture(nil, "OVERLAY")
	rc:SetSize(14, 14)
	if (unit == "raid") then
	   rc:SetPoint("BOTTOM", h)
	else
       rc:SetPoint("CENTER", h)
	end
	   self.ReadyCheck = rc
	
	createRaidIcon(self)

	if cfg.focus then
	   local ModKey = 'Shift'
       local MouseButton = 1
       local key = ModKey .. '-type' .. (MouseButton or '')
	   if(self.unit == 'focus') then
	      self:SetAttribute(key, 'macro')
		  self:SetAttribute('macrotext', '/clearfocus')
	    else
		  self:SetAttribute(key, 'focus')
	    end
	end

    if cfg.castbars then
       castbar(self, unit)
	   PetCastingBarFrame:UnregisterAllEvents()
	   PetCastingBarFrame.Show = function() end
	   PetCastingBarFrame:Hide()
    end
	
	self:SetScale(cfg.scale)
	 
end

local UnitSpecific = {
    player = function(self, ...)
        Shared(self, ...)
		
		self:SetSize(cfg.width, cfg.height)
		
		if cfg.portraits then
            self.Portrait = CreateFrame("PlayerModel", nil, self)
			self.Portrait:SetSize(56, 52)
            self.Portrait:SetPoint("TOPRIGHT", self, "TOPLEFT", -5, 0)
            self.PorBackdrop = ns.bd(self, self.Portrait)
        end
		
		local name = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        name:SetPoint("LEFT", self.Health, 4, 0)
        name:SetJustifyH"LEFT"
		self:Tag(name, '[skaarj:lvl] [skaarj:color][long:name]')
		
		local htext = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        htext:SetPoint("RIGHT", self.Health, -2, 0)
		htext.frequentUpdates = .1
        self:Tag(htext, '[skaarj:hp][skaarj:pp]')
		
		self.RaidIcon:SetSize(25, 25)
	    self.RaidIcon:SetPoint("TOP", self.Health, 0, 15)
		
		if cfg.auras then 
            local d = CreateFrame("Frame", nil, self)
            d:SetHeight(cfg.height)
            d:SetWidth(cfg.width)
            d:SetPoint("BOTTOMLEFT", self, "TOPLEFT")
            d.spacing = 4.5
            d.size = 26
            d.initialAnchor = "TOPLEFT"
            d["growth-y"] = "UP"

            d.PostCreateIcon = auraIcon
            d.PostUpdateIcon = PostUpdateIcon
            d.CustomFilter = CustomFilter

            self.Debuffs = d
            self.Debuffs.num = 16 
        end
		
		local ct = self.Health:CreateTexture(nil, 'OVERLAY')
        ct:SetSize(20, 20)
        ct:SetPoint('CENTER', self.Health, 0, 0)
        self.Combat = ct

		local r = fs(self.Health, "OVERLAY", cfg.symbol, 15, "OUTLINE", 1, 1, 1)
	    r:SetPoint("BOTTOMLEFT", 0, -10)
	    r:SetText("|cff5F9BFFR|r")
	    self.Resting = r
		
		local PvP = self.Health:CreateTexture(nil, 'OVERLAY')
        PvP:SetSize(28, 28)
        PvP:SetPoint('BOTTOMLEFT', self.Health, 'TOPRIGHT', -15, -20)
        self.PvP = PvP

        if (class == "DEATHKNIGHT" or class == "WARLOCK" or class == "PALADIN" or class == "DRUID" or class == "ROGUE") then
            local c
            if class == "DEATHKNIGHT" then 
                c = 6 
            elseif  class == "DRUID" or class == "ROGUE" then
                c = 5
			else
                c = 3			
            end

            local b = CreateFrame("Frame", nil, self)
            b:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -1)
            b:SetSize((cfg.width+1)/c - 1, 6)

            local i = c
            for index = 1, c do
                b[i] = createStatusbar(b, cfg.texture, nil, 6, (cfg.width+1)/c-1, 1, 1, 1, 1)

                if class == "WARLOCK" then
                    local color = self.colors.power["SOUL_SHARDS"]
                    b[i]:SetStatusBarColor(color[1], color[2], color[3])
                elseif class == "PALADIN" then
                    local color = self.colors.power["HOLY_POWER"]
                    b[i]:SetStatusBarColor(color[1], color[2], color[3])
				else
				    local color = self.colors.class[class]
                    b[i]:SetStatusBarColor(color[1], color[2], color[3])
                end 

                if i == c then
                    b[i]:SetPoint("TOPLEFT", b, "TOPLEFT")
                else
                    b[i]:SetPoint("RIGHT", b[i+1], "LEFT", -1, 0)
                end

                b[i].bg = b[i]:CreateTexture(nil, "BACKGROUND")
                b[i].bg:SetAllPoints(b[i])
                b[i].bg:SetTexture(cfg.texture)
                b[i].bg.multiplier = .2

                b[i].bd = ns.bd(b[i], b[i])
                i=i-1
            end

            if class == "DEATHKNIGHT" then
                b[3], b[4], b[5], b[6] = b[5], b[6], b[3], b[4]
                self.Runes = b
            elseif class == "WARLOCK" then
                self.SoulShards = b
            elseif class == "PALADIN" then
                self.HolyPower = b
			elseif class == "DRUID" or class == "ROGUE" then
			    self.CPoints = b
            end
        end
        
        if class == "DRUID" then
            local ebar = CreateFrame("Frame", nil, self)
            ebar:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -1)
            ebar:SetSize(cfg.width, 6)
            ebar.bd = ns.bd(ebar, ebar)

            local lbar = createStatusbar(ebar, cfg.texture, nil, 6, cfg.width, 0, .4, 1, 1)
            lbar:SetPoint("LEFT", ebar, "LEFT")
            ebar.LunarBar = lbar

            local sbar = createStatusbar(ebar, cfg.texture, nil, 6, cfg.width, 1, .6, 0, 1)
            sbar:SetPoint("LEFT", lbar:GetStatusBarTexture(), "RIGHT")
            ebar.SolarBar = sbar

            ebar.Spark = sbar:CreateTexture(nil, "OVERLAY")
            ebar.Spark:SetTexture[[Interface\CastingBar\UI-CastingBar-Spark]]
            ebar.Spark:SetBlendMode("ADD")
            ebar.Spark:SetAlpha(0.5)
            ebar.Spark:SetHeight(26)
            ebar.Spark:SetPoint("LEFT", sbar:GetStatusBarTexture(), "LEFT", -15, 0)

            self.EclipseBar = ebar
            self.EclipseBar.PostUnitAura = updateEclipse
        end

            if cfg.TotemBar and class == "SHAMAN" then
            self.TotemBar = {}
            self.TotemBar.Destroy = true
            for i = 1, 4 do
                self.TotemBar[i] = createStatusbar(self, cfg.texture, nil, 6, (cfg.width+1)/4-1, 1, 1, 1, 1)

                if (i == 1) then
                    self.TotemBar[i]:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -2)
                else
                    self.TotemBar[i]:SetPoint("RIGHT", self.TotemBar[i-1], "LEFT", -1, 0)
                end
                self.TotemBar[i]:SetBackdrop(backdrop)
                self.TotemBar[i]:SetBackdropColor(0.5, 0.5, 0.5)
                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(cfg.texture)
                self.TotemBar[i].bg.multiplier = 0.3

                self.TotemBar[i].bd = ns.bd(self, self.TotemBar[i])
            end
        end
        
	    if cfg.ThreatBar then
	        self.ThreatBar = CreateFrame("StatusBar", self:GetName()..'_ThreatBar', UIParent)
	        self.ThreatBar:SetPoint('CENTER', UIParent, 0, -211)
			self.ThreatBar:SetSize(229, 10)
	
	        self.ThreatBar:SetStatusBarTexture(cfg.texture)
	        self.ThreatBar:SetBackdrop(backdrop)
	        self.ThreatBar:SetBackdropColor(0, 0, 0, 0)
			
	        self.ThreatBar.Text = fs(self.ThreatBar, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
	        self.ThreatBar.Text:SetPoint("CENTER", self.ThreatBar, 0, 0)
	
	        self.ThreatBar.bg = ns.bd(self.ThreatBar, self.ThreatBar)
			
	        self.ThreatBar.useRawThreat = false
		end
		
		if cfg.gcd then
			self.GCD = CreateFrame("StatusBar", self:GetName().."_GCD", self)
			self.GCD:SetSize(229, 10)
		    self.GCD:SetPoint('BOTTOM', self.ThreatBar, 'TOP', 0, 2)
		    self.GCD:SetStatusBarTexture(cfg.texture)
		    self.GCD:SetStatusBarColor(0.55, 0.57, 0.61)
			self.GCD.bd = ns.bd(self.GCD, self.GCD)
		end
		
		if cfg.Swing then
            self.Swing = CreateFrame("Frame", nil, self)
            self.Swing:SetPoint('BOTTOM', self.GCD, 'TOP', 0, 2)
            self.Swing.texture = cfg.texture
			self.Swing.color = {cfg.Color.Swing.r, cfg.Color.Swing.g, cfg.Color.Swing.b, 1}
			self.Swing:SetSize(229, 10)
			
			self.Swing.disableMelee = false
			self.Swing.disableRanged = false
		end	

        if cfg.Experience and UnitLevel("player") < MAX_PLAYER_LEVEL then
            self.Experience = createStatusbar(self, cfg.texture, nil, 10, cfg.width, 0, .7, 1, 1)
            self.Experience:SetPoint('TOP', self, 'BOTTOM', 0, -8)

            self.Experience.Tooltip = true
			
			if cfg.ThreatBar then	
		        self.Experience.Threat = true
		    end

            self.Experience.Rested = createStatusbar(self, cfg.texture, nil, nil, nil, 0, .4, 1, .6)
            self.Experience.Rested:SetAllPoints(self.Experience)
            self.Experience.Rested:SetBackdrop(backdrop)
            self.Experience.Rested:SetBackdropColor(0, 0, 0)

            self.Experience.bg = self.Experience.Rested:CreateTexture(nil, 'BORDER')
            self.Experience.bg:SetAllPoints(self.Experience)
            self.Experience.bg:SetTexture(cfg.texture)
            self.Experience.bg:SetVertexColor(.1, .1, .1)

            self.Experience.bd = ns.bd(self.Experience, self.Experience)

        end
		
		if cfg.Reputation and UnitLevel("player") == MAX_PLAYER_LEVEL  then	
		    local Reputation = createStatusbar(self, cfg.texture, nil, 10, cfg.width, 0, .7, 1, 1)
		    Reputation:SetPoint('TOP', self, 'BOTTOM', 0, -8)
	
		    local bg = Reputation:CreateTexture(nil, 'BORDER')
		    bg:SetAllPoints(Reputation)
            bg:SetTexture(cfg.texture)
            bg:SetVertexColor(.1, .1, .1)
		
		    Reputation.Backdrop = ns.bd(Reputation, Reputation)

		    self.Reputation = Reputation
	    end
		
	    if cfg.AltPowerBar then
	       local altp = createStatusbar(self, cfg.texture, nil, 10, 229, 1, 1, 1, .8)
           altp:SetPoint('TOP', self.ThreatBar, 'BOTTOM', 0, -9)
           altp.bg = altp:CreateTexture(nil, 'BORDER')
           altp.bg:SetAllPoints(altp)
           altp.bg:SetTexture(cfg.texture)
           altp.bg:SetVertexColor(.05, .05, .05)
           altp.bd = ns.bd(altp, altp)

           altp.Text = fs(altp, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
           altp.Text:SetPoint("CENTER")
           self:Tag(altp.Text, "[skaarj:altpower]")

           altp.PostUpdate = PostAltUpdate
           self.AltPowerBar = altp
	    end
    end,

    target = function(self, ...)
        Shared(self, ...)
		
		self:SetSize(cfg.width, cfg.height)
		
		if cfg.portraits then
            self.Portrait = CreateFrame("PlayerModel", nil, self)
            self.Portrait:SetSize(56, 52)
            self.Portrait:SetPoint("TOPLEFT", self, "TOPRIGHT", 5, 0)
            self.PorBackdrop = ns.bd(self, self.Portrait)
        end
		
		local name = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        name:SetPoint("LEFT", self.Health, 4, 0)
        name:SetJustifyH"LEFT"
		self:Tag(name, '[skaarj:lvl] [skaarj:color][long:name]')

		local htext = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        htext:SetPoint("RIGHT", self.Health, -2, 0)
		htext.frequentUpdates = .1
        self:Tag(htext, '[skaarj:hp][skaarj:pp]')
		
		self.RaidIcon:SetSize(25, 25)
	    self.RaidIcon:SetPoint("TOP", self.Health, 0, 15)
		
		if cfg.SpellRange then
	       self.SpellRange = {
	       insideAlpha = 1,
           outsideAlpha = 0.5}
	    end
		
		if cfg.auras then
		    if cfg.portraits then
			    local a = CreateFrame("Frame", nil, self)
                a:SetHeight(cfg.height)
                a:SetWidth(cfg.width)
                a:SetPoint("BOTTOMLEFT", self, "TOPLEFT")
                a.spacing = 4.5
                a.gap = true
                a.size = 26
                a.initialAnchor = "TOPLEFT"
			    a["growth-y"] = "UP"

                a.PostCreateIcon = auraIcon
                a.PostUpdateIcon = PostUpdateIcon
                a.CustomFilter = CustomFilter

                self.Auras = a
                self.Auras.numDebuffs = 14
                self.Auras.numBuffs = 9
			
			else
			
                local b = CreateFrame("Frame", nil, self)
                b:SetHeight(cfg.height)
                b:SetWidth(110)
                b.initialAnchor = "TOPLEFT"
                b.spacing = 3
                b.num = 8
                b["growth-x"] = "RIGHT"
                b["growth-y"] = "DOWN"
                b:SetPoint("TOPLEFT", self, "TOPRIGHT", 5, -1)
                b.size = 26

                b.PostCreateIcon = auraIcon
                b.PostUpdateIcon = PostUpdateIcon

                self.Buffs = b
			self.Buffs.num = 8
                self.Buffs.CustomFilter = oUF_BuffFilter_Buffs

                local d = CreateFrame("Frame", nil, self)
                d:SetHeight(cfg.height)
                d:SetWidth(cfg.width)
                d:SetPoint("BOTTOMLEFT", self, "TOPLEFT")
                d.spacing = 4.5
                d.size = 26
                d.initialAnchor = "TOPLEFT"
			    d["growth-y"] = "UP"
                d.onlyShowPlayer = cfg.onlyShowPlayer

                d.PostCreateIcon = auraIcon
                d.PostUpdateIcon = PostUpdateIcon
                d.CustomFilter = CustomFilter

                self.Debuffs = d
                self.Debuffs.num = 16
			self.Debuffs.CustomFilter = oUF_BuffFilter_Debuffs
		    end
        end
		
		local q = fs(self.Health, "OVERLAY", cfg.font, 22, cfg.fontflag, 1, 1, 1)
	    q:SetPoint('CENTER', self.Health,'BOTTOM', 0, -3)
	    q:SetText("|cff8AFF30!|r")
	    self.QuestIcon = q

        local ph = self.Health:CreateTexture(nil, 'OVERLAY')
        ph:SetSize(24, 24)
        ph:SetPoint('CENTER', self.Health, 'BOTTOMLEFT', 3, -3)
        self.PhaseIcon = ph
		
		local PvP = self.Health:CreateTexture(nil, 'OVERLAY')
        PvP:SetSize(28, 28)
        PvP:SetPoint('BOTTOMLEFT', self.Health, 'TOPRIGHT', -15, -20)
        self.PvP = PvP
    end,

    focus = function(self, ...)
        Shared(self, ...)
		
		self:SetSize(cfg.width, cfg.height)
		
		local name = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        name:SetPoint("LEFT", self.Health, 4, 0)
        name:SetJustifyH"LEFT"
		self:Tag(name, '[skaarj:lvl] [skaarj:color][long:name]')
		
		local htext = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        htext:SetPoint("RIGHT", self.Health, -2, 0)
		htext.frequentUpdates = .1
        self:Tag(htext, '[skaarj:hp][skaarj:pp]')
		
		self.RaidIcon:SetSize(25, 25)
	    self.RaidIcon:SetPoint("TOP", self.Health, 0, 15)
		
		if cfg.SpellRange then
	       self.SpellRange = {
	       insideAlpha = 1,
           outsideAlpha = 0.5}
	    end
		
        if cfg.auras then 
            local a = CreateFrame("Frame", nil, self)
                a:SetHeight(cfg.height)
                a:SetWidth(cfg.width)
                a:SetPoint("BOTTOMLEFT", self, "TOPLEFT")
                a.spacing = 4.5
                a.gap = true
                a.size = 26
                a.initialAnchor = "TOPLEFT"
			    a["growth-y"] = "UP"

                a.PostCreateIcon = auraIcon
                a.PostUpdateIcon = PostUpdateIcon
                a.CustomFilter = CustomFilter

                self.Auras = a
                self.Auras.numDebuffs = 14
                self.Auras.numBuffs = 9
        end
    end,

	boss = function(self, ...)
        Shared(self, ...)
		
	    self:SetSize(cfg.party_width, cfg.party_height)
		
		local name = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        name:SetPoint("LEFT", self.Health, 4, 0)
        name:SetJustifyH"LEFT"
		self:Tag(name, '[skaarj:color][long:name]')
		
		local htext = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        htext:SetPoint("RIGHT", self.Health, -2, 0)
		htext.frequentUpdates = true
        self:Tag(htext, '[party:hp]')
		
		self.RaidIcon:SetSize(20, 20)
	    self.RaidIcon:SetPoint("TOP", self.Health, 0, 10)

    end,

    pet = function(self, ...)
        Shared(self, ...)
		
		self:SetSize(cfg.pet_width, cfg.pet_height)
		
		local name = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        name:SetPoint("CENTER", self.Health)
		self:Tag(name, '[skaarj:color][short:name]')
	    
		self.RaidIcon:SetSize(20, 20)
	    self.RaidIcon:SetPoint("TOP", self.Health, 0, 10)
		
		if cfg.SpellRange then
	       self.SpellRange = {
	       insideAlpha = 1,
           outsideAlpha = 0.5}
	    end
    end,

    targettarget = function(self, ...)
	    Shared(self, ...)
				 
	    self:SetSize(cfg.pet_width, cfg.pet_height)
		
		local name = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        name:SetPoint("CENTER", self.Health)
		self:Tag(name, '[skaarj:color][short:name]')
		
		self.RaidIcon:SetSize(20, 20)
	    self.RaidIcon:SetPoint("TOP", self.Health, 0, 10)
		
		if cfg.SpellRange then
	       self.SpellRange = {
	       insideAlpha = 1,
           outsideAlpha = 0.5}
	    end
    end,
	
	party = function(self, ...)
		Shared(self, ...)
		
		local lfd = fs(self.Health, "OVERLAY", cfg.symbol, 14, OUTLINE, 1, 1, 1)
		lfd:SetPoint("LEFT", self.Health, 4, 0)
		lfd:SetJustifyH"LEFT"
	    self:Tag(lfd, '[skaarj:LFD]')
		
		local name = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        name:SetPoint("LEFT", lfd, "RIGHT", 0, 0)
        name:SetJustifyH"LEFT"
		self:Tag(name, ' [skaarj:color][short:name] [skaarj:lvl]')
		
		local htext = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        htext:SetPoint("RIGHT", self.Health, -2, 0)
		htext.frequentUpdates = true
        self:Tag(htext, '[party:hp]')
		
		self.RaidIcon:SetSize(20, 20)
	    self.RaidIcon:SetPoint("TOP", self.Health, 0, 10)
		
		CreateAuraIndicator(self)
		Resurrect(self)
		
		if cfg.SpellRange then
	       self.SpellRange = {
	       insideAlpha = 1,
           outsideAlpha = 0.5}
	    end
		
		if cfg.auras then
           local d = CreateFrame("Frame", nil, self)
           d:SetHeight(cfg.height)
           d:SetWidth(100)
           d:SetPoint("TOPLEFT", self, "TOPRIGHT", 5, -1)
           d.spacing = 3
           d.size = 27
           d.initialAnchor = "TOPLEFT"

           d.PostCreateIcon = auraIcon
           d.PostUpdateIcon = PostUpdateIcon
           d.CustomFilter = CustomFilter

           self.Debuffs = d
           self.Debuffs.num = 3
	    end
		
		local ph = self.Health:CreateTexture(nil, 'OVERLAY')
        ph:SetSize(24, 24)
        ph:SetPoint('CENTER', self.Health, 'BOTTOMLEFT', 3, -3)
        self.PhaseIcon = ph

	    self:RegisterEvent('UNIT_AURA', UpdateAuraIndicator)
		self:RegisterEvent('PLAYER_TARGET_CHANGED', UpdateAuraIndicator)	
    end,
	
	arena = function(self, ...)
		Shared(self, ...)
		
		self:SetSize(cfg.party_width, cfg.party_height)
		
		local name = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        name:SetPoint("LEFT", self.Health, 4, 0)
        name:SetJustifyH"LEFT"
		self:Tag(name, '[skaarj:color][long:name]')
		
		local htext = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        htext:SetPoint("RIGHT", self.Health, -2, 0)
		htext.frequentUpdates = true
        self:Tag(htext, '[party:hp]')
		
		self.RaidIcon:SetSize(25, 25)
	    self.RaidIcon:SetPoint("TOP", self.Health, 0, 15)
		
		if cfg.SpellRange then
	       self.SpellRange = {
	       insideAlpha = 1,
           outsideAlpha = 0.5}
	    end
		
		local Trinket = CreateFrame("Frame", nil, self)
		Trinket:SetHeight(cfg.party_height)
		Trinket:SetWidth(cfg.party_height)
		Trinket:SetPoint('TOPRIGHT', self, 'TOPLEFT', -5, 0)
		Trinket.trinketUseAnnounce = true
		Trinket.trinketUpAnnounce = true

		self.Trinket = Trinket
		Trinket.bd = ns.bd(Trinket, Trinket)
		
		self.AuraTracker = CreateFrame('Frame', nil, self)
		self.AuraTracker:SetAllPoints(self.Trinket)
		self.AuraTracker:SetFrameStrata('HIGH')
		self.AuraTracker.icon = self.AuraTracker:CreateTexture(nil, 'ARTWORK')
		self.AuraTracker.icon:SetAllPoints(self.AuraTracker)
		self.AuraTracker.icon:SetTexCoord(0.07,0.93,0.07,0.93)
		self.AuraTracker.text = self.AuraTracker:CreateFontString(nil, 'OVERLAY', 'NumberFontNormal')
		self.AuraTracker.text:SetPoint('CENTER', self.AuraTracker, 0, 0)
		self.AuraTracker:SetScript('OnUpdate', UpdateAuraTrackerTime)
		
    end,

    raid = function(self, ...)
		Shared(self, ...)
		
		local name = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
		name:SetPoint("LEFT", self.Health, 5, 5)
	    name:SetJustifyH"LEFT"
	    self:Tag(name, '[skaarj:color][veryshort:name]')

        local htext = fs(self.Health, "OVERLAY", cfg.font, cfg.fontsize, cfg.fontflag, 1, 1, 1)
        htext:SetPoint("RIGHT", self.Health, 0, -8)
		htext.frequentUpdates = true
        self:Tag(htext, '[skaarj:info]')		
		
		local lfd = fs(self.Health, "OVERLAY", cfg.symbol, 12, OUTLINE, 1, 1, 1)
		lfd:SetPoint("TOPRIGHT", 0, 0)
	    self:Tag(lfd, '[skaarj:LFD]')	
		
		self.RaidIcon:SetSize(14, 14)
	    self.RaidIcon:SetPoint("TOP", self.Health, 2, 7)
		
		if cfg.SpellRange then
	       self.SpellRange = {
	       insideAlpha = 1,
           outsideAlpha = 0.5}
	    end	
		
	    if cfg.RaidDebuffs then
	       self.RaidDebuffs = CreateFrame('Frame', nil, self)
	       self.RaidDebuffs:SetSize(22, 22)
	       self.RaidDebuffs:SetPoint('CENTER', self)
	       self.RaidDebuffs:SetFrameStrata'HIGH'
	
	       self.RaidDebuffs:SetBackdrop(backdrop2)
	
	       self.RaidDebuffs.icon = self.RaidDebuffs:CreateTexture(nil, 'OVERLAY')
	       self.RaidDebuffs.icon:SetTexCoord(.1,.9,.1,.9)
	       self.RaidDebuffs.icon:SetAllPoints(self.RaidDebuffs)
	
	       self.RaidDebuffs.time = self.RaidDebuffs:CreateFontString(nil, 'OVERLAY')
	       self.RaidDebuffs.time:SetFont(cfg.font, cfg.fontsize, 'OUTLINE')
	       self.RaidDebuffs.time:SetPoint('TOPLEFT', self.RaidDebuffs, 'TOPLEFT', 0, 0)
	       self.RaidDebuffs.time:SetTextColor(1, 1, 1)
	
	       self.RaidDebuffs.count = self.RaidDebuffs:CreateFontString(nil, 'OVERLAY')
	       self.RaidDebuffs.count:SetFont(cfg.font, cfg.fontsize, 'OUTLINE')
	       self.RaidDebuffs.count:SetPoint('BOTTOMRIGHT', self.RaidDebuffs, 'BOTTOMRIGHT', 2, 0)
	       self.RaidDebuffs.count:SetTextColor(1, 1, 1)
	    end

		local tborder = CreateFrame("Frame", nil, self)
        tborder:SetPoint("TOPLEFT", self, "TOPLEFT")
        tborder:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT")
        tborder:SetBackdrop(backdrop2)
        tborder:SetBackdropColor(.8, .8, .8, 1)
        tborder:SetFrameLevel(1)
        tborder:Hide()
        self.TargetBorder = tborder
		
		local fborder = CreateFrame("Frame", nil, self)
        fborder:SetPoint("TOPLEFT", self, "TOPLEFT")
        fborder:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT")
        fborder:SetBackdrop(backdrop2)
        fborder:SetBackdropColor(.6, .8, 0, 1)
        fborder:SetFrameLevel(1)
        fborder:Hide()
        self.FocusHighlight = fborder
	
		CreateAuraIndicator(self)
		Resurrect(self)

	    if cfg.healcomm then
		    local mhpb = CreateFrame('StatusBar', nil, self.Health)
		    mhpb:SetPoint('TOPLEFT', self.Health:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
		    mhpb:SetPoint('BOTTOMLEFT', self.Health:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
		    mhpb:SetWidth(65)
		    mhpb:SetStatusBarTexture(cfg.texture)
		    mhpb:SetStatusBarColor(0, 1, 0.5, 0.4)

		    local ohpb = CreateFrame('StatusBar', nil, self.Health)
		    ohpb:SetPoint('TOPLEFT', mhpb:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
		    ohpb:SetPoint('BOTTOMLEFT', mhpb:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
		    ohpb:SetWidth(65)
		    ohpb:SetStatusBarTexture(cfg.texture)
		    ohpb:SetStatusBarColor(0, 1, 0, 0.4)

		    self.HealPrediction = {
			    myBar = mhpb,
			    otherBar = ohpb,
			    maxOverflow = 1,
		    }
	    end
	    
		self:RegisterEvent('PLAYER_TARGET_CHANGED', ChangedTarget)
        self:RegisterEvent('RAID_ROSTER_UPDATE', ChangedTarget)
		self:RegisterEvent('PLAYER_FOCUS_CHANGED', FocusTarget)
        self:RegisterEvent('RAID_ROSTER_UPDATE', FocusTarget)
		self:RegisterEvent('UNIT_AURA', UpdateAuraIndicator)
		self:RegisterEvent('PLAYER_TARGET_CHANGED', UpdateAuraIndicator)
    end,
}

UnitSpecific.focustarget = UnitSpecific.pet
UnitSpecific.tank = UnitSpecific.party

oUF:RegisterStyle("Skaarj", Shared)

for unit,layout in next, UnitSpecific do
    oUF:RegisterStyle('Skaarj - ' .. unit:gsub("^%l", string.upper), layout)
end

local spawnHelper = function(self, unit, ...)
    if(UnitSpecific[unit]) then
        self:SetActiveStyle('Skaarj - ' .. unit:gsub("^%l", string.upper))
    elseif(UnitSpecific[unit:match('[^%d]+')]) then 
        self:SetActiveStyle('Skaarj - ' .. unit:match('[^%d]+'):gsub("^%l", string.upper))
    else
        self:SetActiveStyle'Skaarj'
    end

    local object = self:Spawn(unit)
    object:SetPoint(...)
    return object
end

oUF:Factory(function(self)

    spawnHelper(self, "player", "CENTER", cfg.unit_positions.Player.x, cfg.unit_positions.Player.y)
    spawnHelper(self, "target", "CENTER", cfg.unit_positions.Target.x, cfg.unit_positions.Target.y)
    spawnHelper(self, "targettarget", "RIGHT", self.units.target, cfg.unit_positions.Targettarget.x, cfg.unit_positions.Targettarget.y)
    spawnHelper(self, "focus", "CENTER", cfg.unit_positions.Focus.x, cfg.unit_positions.Focus.y)
    spawnHelper(self, "focustarget", "LEFT", self.units.focus, cfg.unit_positions.Focustarget.x, cfg.unit_positions.Focustarget.y)
    spawnHelper(self, "pet", "LEFT", self.units.player, cfg.unit_positions.Pet.x, cfg.unit_positions.Pet.y)

    if cfg.bossframes then
	    for i = 1, MAX_BOSS_FRAMES do
            spawnHelper(self,'boss' .. i, "RIGHT", cfg.unit_positions.Boss.x, cfg.unit_positions.Boss.y - (40 * i))
        end
    end
	
	if cfg.arena then
	    self:SetActiveStyle'Skaarj - Arena'
	    for i = 1, 5 do
		    spawnHelper(self, 'arena' .. i, "RIGHT", cfg.unit_positions.Arena.x, cfg.unit_positions.Arena.y - (65 * i))
	    end
	end
	
    if cfg.showparty then
  
    self:SetActiveStyle'Skaarj - Party'
  
    for i = 1, 4 do
			local party = "PartyMemberFrame" .. i
			local frame = _G[party]

			frame:UnregisterAllEvents()
			frame.Show = function() end
			frame:Hide()

			_G[party .. "HealthBar"]:UnregisterAllEvents()
			_G[party .. "ManaBar"]:UnregisterAllEvents()
		end

    local party = self:SpawnHeader('oUF_Party', nil, 'solo,party'
	,'showPlayer',false,'showSolo',false,"showParty",true,"yOffset", -10,
	'oUF-initialConfigFunction', ([[
            self:SetWidth(%d)
            self:SetHeight(%d)
            ]]):format(cfg.party_width, cfg.party_height))
        party:SetPoint("LEFT", UIParent, cfg.unit_positions.Party.x, cfg.unit_positions.Party.y)
    end
	
	if cfg.showtank then
	
	self:SetActiveStyle'Skaarj - Tank'
	
	local tank = self:SpawnHeader('oUF_MainTank', nil, 'raid',
			'oUF-initialConfigFunction', ([[
				self:SetWidth(%d)
				self:SetHeight(%d)
			]]):format(cfg.party_width, cfg.party_height),
			'showRaid', true,
			'groupFilter', 'MAINTANK',
			'yOffset', 10,
			'point' , 'BOTTOM'
			)
		tank:SetPoint("LEFT", UIParent, cfg.unit_positions.Tank.x, cfg.unit_positions.Tank.y)
	end
	
	if cfg.disableRaidFrameManager then
	    CompactRaidFrameManager:UnregisterAllEvents()
        CompactRaidFrameManager:HookScript("OnShow", function(s) s:Hide() end)
        CompactRaidFrameManager:Hide()
    
        CompactRaidFrameContainer:UnregisterAllEvents()
        CompactRaidFrameContainer:HookScript("OnShow", function(s) s:Hide() end)
        CompactRaidFrameContainer:Hide()
    end 
	
	if cfg.showRaid then
	
	self:SetActiveStyle'Skaarj - Raid'
	
	local raid = oUF:SpawnHeader(nil, nil, 'solo,party,raid',
    'oUF-initialConfigFunction', ([[
    self:SetWidth(%d)
    self:SetHeight(%d)
    ]]):format(cfg.raid_width, cfg.raid_height),
    'showPlayer', false,
    'showSolo', false,
    'showParty', false,
    'showRaid', true,
    'xoffset', 5,
    'yOffset', -5,
    'point', "TOP",
    'groupFilter', '1,2,3,4,5,6,7,8',
    'groupingOrder', '1,2,3,4,5,6,7,8',
    'groupBy', 'GROUP',
    'maxColumns', 8,
    'unitsPerColumn', 5,
    'columnSpacing', 5,
    'columnAnchorPoint', "LEFT"
)
    raid:SetPoint("TOPLEFT", UIParent, "TOPLEFT", cfg.unit_positions.Raid.x, cfg.unit_positions.Raid.y)
	end
  end)

I think this is the only code i need to upload. like I said I'm still very new to this and was unsuccessful. appreciate the help guys
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » requesting some 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