Thread Tools Display Modes
11-10-10, 04:42 AM   #1
gratzner
A Murloc Raider
 
gratzner's Avatar
Join Date: Nov 2010
Posts: 5
Added oUF_Alekk, lost my oUF castbars

Hello.

I'm really new to the oUF addon files and but i saw some hunter using it and thought i'd give it a go.

Although i've only been using for about 1 week i am really satisfied, i neve thought messing around with the LUA files would be this much fun.

But now i've run into some problems.

I downloaded the MONO UI suite and started with that. I've modified it a little bit, added some more addons that i fel i wanted and needed.
I was never really happy with the unitframes that comes with the latest edition of MONO UI.
After som digging i found oUF_Alekk wich to me looked really nice and was exactly something i was looking for.
Said and done, i downloaded oUF_Alekk and added it to the rest of my addons.
And it works great and looks great. Possibly the best unitframes i've had.

But... BUT... i when i added oUF_Alekk i lost oUF castbars for some reason
I really really want those castbars because i had made them perfectly in line with the rest of the UI.

So.. anyone who understand why this happend?
It seems like oUF cannot find the castbars any longer, i have looked in the LUA files but i really dont know what to look for.
The castbars have gone back to blizzard original

Please help me with this.
I've been looking for a suite with oUF and oUF_Alekk in the same addon pack but i havent found one yet sadly.

Please help!


In short... i miss the castbars, and i would really like to add them... but i dont know where i do that im afraid :/
__________________
Mooooooo

Last edited by gratzner : 11-10-10 at 05:42 AM.
  Reply With Quote
11-10-10, 06:11 AM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
https://github.com/haste/oUF/wiki/element---casting-bar has a example of how to add a casting bar to "your" layout.

(sent from my phone)
__________________
「貴方は1人じゃないよ」
  Reply With Quote
11-11-10, 06:01 AM   #3
kawe
A Cyclonian
 
kawe's Avatar
Join Date: Sep 2009
Posts: 40
adding castbar

Originally Posted by haste View Post
https://github.com/haste/oUF/wiki/element---casting-bar has a example of how to add a casting bar to "your" layout.

(sent from my phone)

i tried to insert the code into this oUF layout; not working

Code:
local FONT = [=[Interface\AddOns\oUF_Senomar\calibri.ttf]=]
local FONTSIZE = 13
local HEIGHT = 26
local HEALTHHEIGHT = 21
local TEXTURE = [=[Interface\AddOns\oUF_Senomar\minimalist]=]
local BACKDROP = {
	bgFile = TEXTURE, insets = {top = -1, bottom = -1, left = -1, right = -1}
}
local _, playerclass = UnitClass("player")

local function ShortenValue(value)
	if(value >= 1e6) then
		return ('%.2fm'):format(value / 1e6):gsub('%.?0+([km])$', '%1')
	elseif(value >= 1e4) then
		return ('%.1fk'):format(value / 1e3):gsub('%.?0+([km])$', '%1')
	else
		return value
	end
end

oUF.Tags['seno:health'] = function(u)
	local min, max = UnitHealth(u), UnitHealthMax(u)
	local status = not UnitIsConnected(u) and 'Offline' or UnitIsGhost(u) and 'Ghost' or UnitIsDead(u) and 'Dead'

	if(status) then
		return status
	elseif(u == 'target' and UnitCanAttack('player', u)) then
		return ('%s || %d|cff0090ff%%|r'):format(ShortenValue(min), min / max * 100)
	elseif(u == 'target') then
		local power = UnitPower(u)
		local pmin = ""
		if(power > 0 and not UnitIsDeadOrGhost(u)) then
			local _, type = UnitPowerType(u)
			local colors = _COLORS.power
			pmin = ('%s%s|r'):format(Hex(colors[type] or colors['RUNES']), ShortenValue(power)) .. ' | '
		end
		return pmin .. ('%s'):format(ShortenValue(min), ShortenValue(min))
	elseif(u == 'player' and min ~= max) then
		return ('|cffff8080-%s|r || %s'):format(ShortenValue((min - max)*-1), ShortenValue(min))
	elseif(u == 'player') then
		return max
	elseif(min ~= max) then
		return ShortenValue(min)
	else
		return ShortenValue(max)
	end
end

oUF.Tags['seno:power'] = function(u)
	local power = UnitPower(u)
	if(power > 0 and not UnitIsDeadOrGhost(u)) then
		local _, type = UnitPowerType(u)
		local colors = _COLORS.power
		return ('%s%d|r'):format(Hex(colors[type] or colors['RUNES']), power)
	end
end

oUF.Tags['seno:druid'] = function(u)
	local min, max = UnitPower(u, 0), UnitPowerMax(u, 0)
	if(UnitPowerType(u) ~= 0 and min ~= max) then
		return ('|cff0090ff%d%%|r'):format(min / max * 100)
	end
end

oUF.TagEvents['seno:shards'] = 'UNIT_POWER'
oUF.Tags['seno:shards'] = function(u) return UnitPower(u, SPELL_POWER_SOUL_SHARDS) end

oUF.Tags['pvp'] = function(u)
local running = IsPVPTimerRunning()
	if(UnitIsPVP(u) and not running) then
		return '|cffff0000+|r'
	elseif(running) then
		local timer = GetPVPTimer() / 1e3
		return ('|cffff0000%d:%02d|r'):format(timer / 60, timer % 60)
	end	
end

oUF.TagEvents['seno:name'] = 'UNIT_NAME_UPDATE UNIT_REACTION UNIT_FACTION'
oUF.Tags['seno:name'] = function(u)
	local reaction = UnitReaction(u, 'player')

	local r, g, b = 1, 1, 1
	if((UnitIsTapped(u) and not UnitIsTappedByPlayer(u)) or not UnitIsConnected(u)) then
		r, g, b = 3/5, 3/5, 3/5
	elseif(not UnitIsPlayer(u) and reaction) then
		r, g, b = unpack(_COLORS.reaction[reaction])
	elseif(UnitFactionGroup(u) and UnitIsEnemy(u, 'player') and UnitIsPVP(u)) then
		r, g, b = 1, 0, 0
	end

	return ('%s%s|r'):format(Hex(r, g, b), UnitName(u))
end

local f = CreateFrame"Frame"
f.peticon = nil
f:RegisterEvent('PET_ATTACK_START')
f:RegisterEvent('PET_ATTACK_STOP')
f:SetScript('OnEvent', function(self, e) if e == 'PET_ATTACK_START' then self.peticon:Show() else self.peticon:Hide() end end)

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

local function PostUpdatePower(element, unit, min, max)
	element:GetParent().Health:SetHeight(max ~= 0 and HEALTHHEIGHT or HEIGHT)
end

local function PostCreateAura(element, button)
	button:SetBackdrop(BACKDROP)
	button:SetBackdropColor(0, 0, 0)
	button.cd:SetReverse()
	button.icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
	button.icon:SetDrawLayer('ARTWORK')
end

local function PostUpdateDebuff(element, unit, button, index)
	if(UnitIsFriend('player', unit) or button.isPlayer) then
		local _, _, _, _, type = UnitAura(unit, index, button.filter)
		local color = DebuffTypeColor[type] or DebuffTypeColor.none

		button:SetBackdropColor(color.r * 3/5, color.g * 3/5, color.b * 3/5)
		button.icon:SetDesaturated(false)
	else
		button:SetBackdropColor(0, 0, 0)
		button.icon:SetDesaturated(true)
	end
end

local buffFilter = {
	[GetSpellInfo(47236)] = true, -- Demonic Pact
	[GetSpellInfo(77746)] = true, -- Totemic Wrath
	[GetSpellInfo(8227)] = true, -- Flametongue Totem
}

local function customFilter(icons, unit, icon, name)
	if(buffFilter[name] and (playerclass == 'WARLOCK' or playerclass == 'PRIEST' or playerclass == 'MAGE')) then return true end
end

Castbar.CustomTimeText = function(self, duration)
	if self.casting then
		self.Time:SetFormattedText("%.1f", self.max - duration)
	elseif self.channeling then
		self.Time:SetFormattedText("%.1f", duration)
	end
end

local Castbar = CreateFrame("StatusBar", nil, self)
Castbar:SetSize(20, 20)
Castbar:SetPoint('TOP')
Castbar:SetPoint('LEFT')
Castbar:SetPoint('RIGHT')

-- Add a background
local Background = Castbar:CreateTexture(nil, 'BACKGROUND')
Background:SetAllPoints(Castbar)
Background:SetTexture(1, 1, 1, .5)

-- Add a spark
local Spark = Castbar:CreateTexture(nil, "OVERLAY")
Spark:SetSize(20, 20)
Spark:SetBlendMode("ADD")

-- Add a timer
local Time = Castbar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
Time:SetPoint("RIGHT", Castbar)

-- Add spell text
local Text = Castbar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
Text:SetPoint("LEFT", Castbar)

-- Add spell icon
local Icon = Castbar:CreateTexture(nil, "OVERLAY")
Icon:SetSize(20, 20)
Icon:SetPoint("TOPLEFT", Castbar, "TOPLEFT")

-- Register it with oUF
self.Castbar = Castbar
self.Castbar.bg = Background
self.Castbar.Spark = Spark
self.Castbar.Time = Time
self.Castbar.Text = Text
self.Castbar.Icon = Icon
self.Castbar.SafeZone = SafeZone

end

local UnitSpecific = {
	player = function(self)
		local buffs = CreateFrame('Frame', nil, self)
		buffs:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -4)
		buffs:SetSize(110, 44)
		buffs.num = 10
		buffs.size = 18
		buffs.spacing = 3
		buffs.initialAnchor = 'TOPLEFT'
		buffs['growth-y'] = 'DOWN'
		buffs.PostCreateIcon = PostCreateAura
		buffs.CustomFilter = customFilter
		self.Buffs = buffs

		local leader = self.Health:CreateTexture(nil, 'OVERLAY')
		leader:SetPoint('TOPLEFT', self, 0, 8)
		leader:SetSize(16, 16)
		self.Leader = leader

		local assistant = self.Health:CreateTexture(nil, 'OVERLAY')
		assistant:SetPoint('TOPLEFT', self, 0, 8)
		assistant:SetSize(16, 16)
		self.Assistant = assistant

		local info = self.Health:CreateFontString(nil, 'OVERLAY')
		info:SetFont(FONT, FONTSIZE)
		info:SetShadowColor(0, 0, 0)
		info:SetShadowOffset(1, -1)
		info:SetPoint('CENTER')
		self:Tag(info, '[pvp]')
		
		--[[
		local debuffs = CreateFrame('Frame', nil, self)
		debuffs.spacing = 10
		debuffs:SetSize(180, 200)
		debuffs.initialAnchor = 'BOTTOMLEFT'
		debuffs.PostCreateIcon = PostCreateAura
		debuffs:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 10, 10)
		debuffs.num = 18
		debuffs.size = 28
		debuffs['growth-y'] = 'UP'
		debuffs['growth-x'] = 'RIGHT'
		debuffs.PostUpdateIcon = PostUpdateDebuff
		self.Debuffs = debuffs
		]]--
		
		--self:SetAttribute('initial-width', 170)
		self:SetWidth(170)
	end,
	target = function(self)
		local buffs = CreateFrame('Frame', nil, self)
		buffs:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -4)
		buffs:SetSize(110, 44)
		buffs.num = 10
		buffs.size = 18
		buffs.spacing = 3
		buffs.initialAnchor = 'TOPLEFT'
		buffs['growth-y'] = 'DOWN'
		buffs.PostCreateIcon = PostCreateAura
		self.Buffs = buffs

		local cpoints = self:CreateFontString(nil, 'OVERLAY', 'SubZoneTextFont')
		cpoints:SetPoint('RIGHT', self, 'LEFT', -9, 0)
		cpoints:SetJustifyH('RIGHT')
		self:Tag(cpoints, '|cffffffff[cpoints]|r')

		self.Power.PostUpdate = PostUpdatePower
		self:SetWidth(210)
	end,
	pet = function(self)
		self:SetWidth(90)

		f.peticon = CreateFrame("Frame",nil,self)
		f.peticon:SetBackdrop(BACKDROP)
		f.peticon:SetBackdropColor(0, 0, 0)
		f.peticon:SetFrameStrata("BACKGROUND")
		f.peticon:SetSize(18, 18)
		local t = f.peticon:CreateTexture(nil,"BACKGROUND")
		t:SetTexture('Interface\\Icons\\Ability_GhoulFrenzy')
		t:SetTexCoord(0.08, 0.92, 0.08, 0.92)
		t:SetDrawLayer('ARTWORK')
		t:SetAllPoints(f.peticon)
		f.peticon.texture = t
		f.peticon:SetPoint("TOPLEFT",-22, 0)
		f.peticon:Hide()
	end,
	targettarget = function(self)
		self:SetWidth(170)
	end,
	focus = function(self)
		self:SetWidth(170)
	end,
}

local function Shared(self, unit)
	self.colors.power.MANA = {0, 144/255, 1}

	self:RegisterForClicks('AnyDown')
	self:SetScript('OnEnter', UnitFrame_OnEnter)
	self:SetScript('OnLeave', UnitFrame_OnLeave)

	self:SetBackdrop(BACKDROP)
	self:SetBackdropColor(0, 0, 0)

	self:SetHeight(HEIGHT)

	local health = CreateFrame('StatusBar', nil, self)
	health:SetStatusBarTexture(TEXTURE)
	health:SetStatusBarColor(0.1, 0.1, 0.1)
	health.frequentUpdates = true
	self.Health = health

	local healthBG = health:CreateTexture(nil, 'BORDER')
	healthBG:SetAllPoints()
	
	if(unit == 'player' or unit == 'pet') then
		healthBG:SetTexture(0.75, 0.1, 0.1)
	else
		healthBG:SetTexture(1/3, 1/3, 1/3)
	end

	local healthValue = health:CreateFontString(nil, 'OVERLAY')
	healthValue:SetFont(FONT, FONTSIZE)
	healthValue:SetShadowColor(0, 0, 0)
	healthValue:SetShadowOffset(1, -1)
	healthValue:SetPoint('RIGHT', health, -2, 0)
	healthValue:SetJustifyH('RIGHT')
	healthValue.frequentUpdates = 1/4
	self:Tag(healthValue, '[seno:health]')

	if(unit == 'player' or unit == 'target' or unit == 'pet') then
		local power = CreateFrame('StatusBar', nil, self)
		power:SetPoint('BOTTOMRIGHT')
		power:SetPoint('BOTTOMLEFT')
		power:SetPoint('TOP', health, 'BOTTOM', 0, -1)
		power:SetStatusBarTexture(TEXTURE)
		power.frequentUpdates = true
		self.Power = power

		power.colorClass = true
		power.colorTapping = true
		power.colorDisconnected = true
		power.colorReaction = unit ~= 'pet'
		power.colorHappiness = unit == 'pet'
		power.colorPower = unit == 'pet'

		local powerBG = power:CreateTexture(nil, 'BORDER')
		powerBG:SetAllPoints()
		powerBG:SetTexture(TEXTURE)
		powerBG.multiplier = 1/3
		power.bg = powerBG

		if(unit ~= 'target') then
			local powerValue = health:CreateFontString(nil, 'OVERLAY')
			powerValue:SetFont(FONT, FONTSIZE)
			powerValue:SetShadowColor(0, 0, 0)
			powerValue:SetShadowOffset(1, -1)
			powerValue:SetPoint('LEFT', health, 2, 0)
			powerValue:SetJustifyH('LEFT')
			powerValue.frequentUpdates = 0.1
			if (unit == 'player' and playerclass == 'WARLOCK') then
				self:Tag(powerValue, '[seno:power< ][seno:shards][seno:druid]')
			else
				self:Tag(powerValue, '[seno:power< ][seno:druid]')
			end
		end

		local raidicon = health:CreateTexture(nil, 'OVERLAY')
		raidicon:SetPoint('TOP', self, 0, 8)
		raidicon:SetSize(16, 16)
		self.RaidIcon = raidicon

		health:SetHeight(HEALTHHEIGHT)
		health:SetPoint('TOPRIGHT')
		health:SetPoint('TOPLEFT')

		self.menu = SpawnMenu
	end

	if(unit == 'focus' or unit:find('target')) then
		local name = health:CreateFontString(nil, 'OVERLAY')
		name:SetFont(FONT, FONTSIZE)
		name:SetShadowColor(0, 0, 0)
		name:SetShadowOffset(1, -1)
		name:SetPoint('LEFT', health, 2, 0)
		name:SetPoint('RIGHT', healthValue, 'LEFT')
		name:SetJustifyH('LEFT')
		if unit == 'target' then
			self:Tag(name, '[difficulty][plus][level] [seno:name< ][|cff0090ff>rare<|r]')
		else
			self:Tag(name, '[seno:name< ][|cff0090ff>rare<|r]')
		end

		local debuffs = CreateFrame('Frame', nil, self)
		debuffs.spacing = 3
		debuffs:SetSize(110, 44)
		debuffs.initialAnchor = 'TOPRIGHT'
		debuffs.PostCreateIcon = PostCreateAura
		debuffs:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -4)
		debuffs.num = 10
		debuffs.size = 18
		debuffs['growth-y'] = 'DOWN'
		debuffs['growth-x'] = 'LEFT'
		debuffs.PostUpdateIcon = PostUpdateDebuff
		self.Debuffs = debuffs

		if(unit ~= 'target') then
			debuffs.num = 5
			health:SetAllPoints()
		end

		if(unit == 'focus') then
			debuffs.onlyShowPlayer = true
			debuffs.size = 24
		end

	end

	if(UnitSpecific[unit]) then
		return UnitSpecific[unit](self)
	end
end

oUF.colors.power.MANA = {0, 144/255, 1}

oUF:RegisterStyle('seno', Shared)

oUF:Factory(function(self)
	self:SetActiveStyle('seno')
	self:Spawn('player'):SetPoint('CENTER', -220, -300)
	self:Spawn('pet'):SetPoint('CENTER', -370, -300)
	self:Spawn('focus'):SetPoint('CENTER', 500, -300)
	self:Spawn('target'):SetPoint('CENTER', 0, -300)
	self:Spawn('targettarget'):SetPoint('CENTER', 220, -300)
end)
  Reply With Quote
11-11-10, 06:09 AM   #4
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
You put the code nowhere it could possibly run.
You should learn a little bit before trying to tweak some layouts.
Where you put the code don't even make sense.
  Reply With Quote
11-11-10, 06:12 AM   #5
kawe
A Cyclonian
 
kawe's Avatar
Join Date: Sep 2009
Posts: 40
Originally Posted by Rostok View Post
You put the code nowhere it could possibly run.
You should learn a little bit before trying to tweak some layouts.
Where you put the code don't even make sense.

i know but codes changed from 1.3x -> 1.4 -> and now 1.5> i can understand basics but getting to knowing a lanquage is a diff thing

is there a program or editor which can make it a little easier?
  Reply With Quote
11-11-10, 04:32 PM   #6
gratzner
A Murloc Raider
 
gratzner's Avatar
Join Date: Nov 2010
Posts: 5
Kawe: Have you tried SciTE? It's a great editor of LUA files that displayes everything just like in Visual Studio (C#, C++) i.e.

SciTE-WowInterface is the full name i believe. Although im struggling with the castbars aswell, even in SciTE
__________________
Mooooooo
  Reply With Quote
11-11-10, 04:39 PM   #7
kawe
A Cyclonian
 
kawe's Avatar
Join Date: Sep 2009
Posts: 40
can give it a try, thx
  Reply With Quote
11-11-10, 05:53 PM   #8
gratzner
A Murloc Raider
 
gratzner's Avatar
Join Date: Nov 2010
Posts: 5
If you'r successful with those castbars let me know please
__________________
Mooooooo
  Reply With Quote
11-12-10, 03:25 AM   #9
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
Putting the code in the file has nothing to do with the text-editor you use.
Really, putting castbars in isn't difficult when you understand the code you're looking at.
Really, download some layouts which provide castbars and learn how they're doing it.
  Reply With Quote
11-14-10, 07:22 PM   #10
kawe
A Cyclonian
 
kawe's Avatar
Join Date: Sep 2009
Posts: 40
Originally Posted by gratzner View Post
If you'r successful with those castbars let me know please

hehe, simple castbar added successfully

full code (green text = code from ouf_lilly and don't forget to create texture file or just copy texture map from lily)

Code:
local FONT = [=[Interface\AddOns\oUF_Senomar\calibri.ttf]=]
local FONTSIZE = 13
local HEIGHT = 26
local HEALTHHEIGHT = 21
local TEXTURE = [=[Interface\AddOns\oUF_Senomar\minimalist]=]
local BACKDROP = {
	bgFile = TEXTURE, insets = {top = -1, bottom = -1, left = -1, right = -1}
}
local _, playerclass = UnitClass("player")

local function ShortenValue(value)
	if(value >= 1e6) then
		return ('%.2fm'):format(value / 1e6):gsub('%.?0+([km])$', '%1')
	elseif(value >= 1e4) then
		return ('%.1fk'):format(value / 1e3):gsub('%.?0+([km])$', '%1')
	else
		return value
	end
end

oUF.Tags['seno:health'] = function(u)
	local min, max = UnitHealth(u), UnitHealthMax(u)
	local status = not UnitIsConnected(u) and 'Offline' or UnitIsGhost(u) and 'Ghost' or UnitIsDead(u) and 'Dead'

	if(status) then
		return status
	elseif(u == 'target' and UnitCanAttack('player', u)) then
		return ('%s || %d|cff0090ff%%|r'):format(ShortenValue(min), min / max * 100)
	elseif(u == 'target') then
		local power = UnitPower(u)
		local pmin = ""
		if(power > 0 and not UnitIsDeadOrGhost(u)) then
			local _, type = UnitPowerType(u)
			local colors = _COLORS.power
			pmin = ('%s%s|r'):format(Hex(colors[type] or colors['RUNES']), ShortenValue(power)) .. ' | '
		end
		return pmin .. ('%s'):format(ShortenValue(min), ShortenValue(min))
	elseif(u == 'player' and min ~= max) then
		return ('|cffff8080-%s|r || %s'):format(ShortenValue((min - max)*-1), ShortenValue(min))
	elseif(u == 'player') then
		return max
	elseif(min ~= max) then
		return ShortenValue(min)
	else
		return ShortenValue(max)
	end
end

oUF.Tags['seno:power'] = function(u)
	local power = UnitPower(u)
	if(power > 0 and not UnitIsDeadOrGhost(u)) then
		local _, type = UnitPowerType(u)
		local colors = _COLORS.power
		return ('%s%d|r'):format(Hex(colors[type] or colors['RUNES']), power)
	end
end

oUF.Tags['seno:druid'] = function(u)
	local min, max = UnitPower(u, 0), UnitPowerMax(u, 0)
	if(UnitPowerType(u) ~= 0 and min ~= max) then
		return ('|cff0090ff%d%%|r'):format(min / max * 100)
	end
end

oUF.TagEvents['seno:shards'] = 'UNIT_POWER'
oUF.Tags['seno:shards'] = function(u) return UnitPower(u, SPELL_POWER_SOUL_SHARDS) end

oUF.Tags['pvp'] = function(u)
local running = IsPVPTimerRunning()
	if(UnitIsPVP(u) and not running) then
		return '|cffff0000+|r'
	elseif(running) then
		local timer = GetPVPTimer() / 1e3
		return ('|cffff0000%d:%02d|r'):format(timer / 60, timer % 60)
	end	
end

oUF.TagEvents['seno:name'] = 'UNIT_NAME_UPDATE UNIT_REACTION UNIT_FACTION'
oUF.Tags['seno:name'] = function(u)
	local reaction = UnitReaction(u, 'player')

	local r, g, b = 1, 1, 1
	if((UnitIsTapped(u) and not UnitIsTappedByPlayer(u)) or not UnitIsConnected(u)) then
		r, g, b = 3/5, 3/5, 3/5
	elseif(not UnitIsPlayer(u) and reaction) then
		r, g, b = unpack(_COLORS.reaction[reaction])
	elseif(UnitFactionGroup(u) and UnitIsEnemy(u, 'player') and UnitIsPVP(u)) then
		r, g, b = 1, 0, 0
	end

	return ('%s%s|r'):format(Hex(r, g, b), UnitName(u))
end

local f = CreateFrame"Frame"
f.peticon = nil
f:RegisterEvent('PET_ATTACK_START')
f:RegisterEvent('PET_ATTACK_STOP')
f:SetScript('OnEvent', function(self, e) if e == 'PET_ATTACK_START' then self.peticon:Show() else self.peticon:Hide() end end)

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

local PostCastStart = function(Castbar, unit, spell, spellrank)
	Castbar:GetParent().Name:SetText('×' .. spell)
end

local PostCastStop = function(Castbar, unit)
	local self = Castbar:GetParent()
	self.Name:SetText(UnitName(self.realUnit or unit))
end

local PostCastStopUpdate = function(self, event, unit)
	if(unit ~= self.unit) then return end
	return PostCastStop(self.Castbar, unit)
end


local function PostUpdatePower(element, unit, min, max)
	element:GetParent().Health:SetHeight(max ~= 0 and HEALTHHEIGHT or HEIGHT)
end

local function PostCreateAura(element, button)
	button:SetBackdrop(BACKDROP)
	button:SetBackdropColor(0, 0, 0)
	button.cd:SetReverse()
	button.icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
	button.icon:SetDrawLayer('ARTWORK')
end

local function PostUpdateDebuff(element, unit, button, index)
	if(UnitIsFriend('player', unit) or button.isPlayer) then
		local _, _, _, _, type = UnitAura(unit, index, button.filter)
		local color = DebuffTypeColor[type] or DebuffTypeColor.none

		button:SetBackdropColor(color.r * 3/5, color.g * 3/5, color.b * 3/5)
		button.icon:SetDesaturated(false)
	else
		button:SetBackdropColor(0, 0, 0)
		button.icon:SetDesaturated(true)
	end
end

local buffFilter = {
	[GetSpellInfo(13159)] = true, -- AotP
	[GetSpellInfo(13165)] = true, -- AotH
	[GetSpellInfo(3045)] = true, -- Rapid Fire
	[GetSpellInfo(34477)] = true, -- Misdirection
	[GetSpellInfo(53760)] = true, -- Flask of Endless Rage
	[GetSpellInfo(57325)] = true, -- Well Fed
	[GetSpellInfo(57399)] = true, -- Well Fed (fish meal)
	[GetSpellInfo(2565)] = true, -- Shield Block
	[GetSpellInfo(23920)] = true, -- Spell Reflection
	[GetSpellInfo(6673)] = true, -- Battle shout
	[GetSpellInfo(469)] = true, -- Commanding shout
	[GetSpellInfo(12975)] = true, -- Last stand
	[GetSpellInfo(871)] = true, -- Shield Wall
	[GetSpellInfo(55694)] = true, -- Enraged Regeneration
	[GetSpellInfo(5171)] = true, -- SnD
	[GetSpellInfo(13750)] = true, -- Adrenaline Rush
	[GetSpellInfo(13877)] = true, -- Blade Fury
	[GetSpellInfo(1126)] = true, -- Mark of the Wild
	[GetSpellInfo(29166)] = true, -- Innervate
	[GetSpellInfo(50334)] = true, -- Berserk
	[GetSpellInfo(61336)] = true, -- Survival Instincts
	[GetSpellInfo(22842)] = true, -- Frenzied Regeneration
	[GetSpellInfo(22812)] = true, -- Barkskin
	[GetSpellInfo(71586)] = true, -- Hardened Skin


}

local function customFilter(icons, unit, icon, name)
	if(buffFilter[name] and (playerclass == 'HUNTER' or playerclass == 'WARRIOR' or playerclass == 'DRUID' or playerclass == 'ROGUE')) then return true end
end

local UnitSpecific = {
	player = function(self)
		local buffs = CreateFrame('Frame', nil, self)
		buffs:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 20)
		buffs:SetSize(110, 44)
		buffs.num = 10
		buffs.size = 19
		buffs.spacing = 3
		buffs.initialAnchor = 'TOPLEFT'
		buffs['growth-y'] = 'UP'
		buffs.PostCreateIcon = PostCreateAura
		self.Buffs = buffs
		buffs.CustomFilter = customFilter
				     
	      BuffFrame:Hide() 

		
		local leader = self.Health:CreateTexture(nil, 'OVERLAY')
		leader:SetPoint('TOPRIGHT', self, 0, 8)
		leader:SetSize(16, 16)
		self.Leader = leader

		local assistant = self.Health:CreateTexture(nil, 'OVERLAY')
		assistant:SetPoint('TOPRIGHT', self, 0, 8)
		assistant:SetSize(16, 16)
		self.Assistant = assistant

		local info = self.Health:CreateFontString(nil, 'OVERLAY')
		info:SetFont(FONT, FONTSIZE)
		info:SetShadowColor(0, 0, 0)
		info:SetShadowOffset(1, -1)
		info:SetPoint('CENTER')
		self:Tag(info, '[pvp]')
		
		
		local debuffs = CreateFrame('Frame', nil, self)
		debuffs.spacing = 10
		debuffs:SetSize(180, 200)
		debuffs.initialAnchor = 'BOTTOMLEFT'
		debuffs.PostCreateIcon = PostCreateAura
		debuffs:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', -100, 350)
		debuffs.num = 18
		debuffs.size = 48
		debuffs['growth-y'] = 'UP'
		debuffs['growth-x'] = 'RIGHT'
		debuffs.PostUpdateIcon = PostUpdateDebuff
		self.Debuffs = debuffs
		
		
		--self:SetAttribute('initial-width', 170)
		self:SetWidth(203)
	end,
	target = function(self)
		local cpoints = self:CreateFontString(nil, 'OVERLAY', 'SubZoneTextFont')
		cpoints:SetPoint('RIGHT', self, 'LEFT', -9, 0)
		cpoints:SetJustifyH('RIGHT')
		self:Tag(cpoints, '|cffffffff[cpoints]|r')

		self.Power.PostUpdate = PostUpdatePower
		self:SetWidth(190)
	end,
			
		focus = function(self)
		self:SetWidth(175)
	end,
}

local function Shared(self, unit)
	self.colors.power.MANA = {0, 144/255, 1}

	self:RegisterForClicks('AnyDown')
	self:SetScript('OnEnter', UnitFrame_OnEnter)
	self:SetScript('OnLeave', UnitFrame_OnLeave)

	self:SetBackdrop(BACKDROP)
	self:SetBackdropColor(0, 0, 0)

	self:SetHeight(HEIGHT)

	local health = CreateFrame('StatusBar', nil, self)
	health:SetStatusBarTexture(TEXTURE)
	health:SetStatusBarColor(0.1, 0.1, 0.1)
	health.frequentUpdates = true
	self.Health = health

	local healthBG = health:CreateTexture(nil, 'BORDER')
	healthBG:SetAllPoints()
	
	if(unit == 'player' or unit == 'pet') then
		healthBG:SetTexture(0.75, 0.1, 0.1)
	else
		healthBG:SetTexture(1/3, 1/3, 1/3)
	end

	local healthValue = health:CreateFontString(nil, 'OVERLAY')
	healthValue:SetFont(FONT, FONTSIZE)
	healthValue:SetShadowColor(0, 0, 0)
	healthValue:SetShadowOffset(1, -1)
	healthValue:SetPoint('RIGHT', health, -2, 0)
	healthValue:SetJustifyH('RIGHT')
	healthValue.frequentUpdates = 1/4
	self:Tag(healthValue, '[seno:health]')

	local Castbar = CreateFrame("StatusBar", nil, self)
	Castbar:SetStatusBarTexture(TEXTURE)
	Castbar:SetStatusBarColor(1, .1, .1, .5)
	Castbar:SetAllPoints(healthBG)
	Castbar:SetToplevel(true)
	Castbar:GetStatusBarTexture():SetHorizTile(false)

	self.Castbar = Castbar


	if(unit == 'player' or unit == 'target' or unit == 'pet') then
		local power = CreateFrame('StatusBar', nil, self)
		power:SetPoint('BOTTOMRIGHT')
		power:SetPoint('BOTTOMLEFT')
		power:SetPoint('TOP', health, 'BOTTOM', 0, -1)
		power:SetStatusBarTexture(TEXTURE)
		power.frequentUpdates = true
		self.Power = power

		power.colorClass = true
		power.colorTapping = true
		power.colorDisconnected = true
		power.colorReaction = unit ~= 'pet'
		power.colorHappiness = unit == 'pet'
		power.colorPower = unit == 'pet'

		local powerBG = power:CreateTexture(nil, 'BORDER')
		powerBG:SetAllPoints()
		powerBG:SetTexture(TEXTURE)
		powerBG.multiplier = 1/3
		power.bg = powerBG

		if(unit ~= 'target') then
			local powerValue = health:CreateFontString(nil, 'OVERLAY')
			powerValue:SetFont(FONT, FONTSIZE)
			powerValue:SetShadowColor(0, 0, 0)
			powerValue:SetShadowOffset(1, -1)
			powerValue:SetPoint('LEFT', health, 2, 0)
			powerValue:SetJustifyH('LEFT')
			powerValue.frequentUpdates = 0.1
			if (unit == 'player' and playerclass == 'WARLOCK') then
				self:Tag(powerValue, '[seno:power< ][seno:shards][seno:druid]')
			else
				self:Tag(powerValue, '[seno:power< ][seno:druid]')
			end
		end

		local raidicon = health:CreateTexture(nil, 'OVERLAY')
		raidicon:SetPoint('TOP', self, 0, 8)
		raidicon:SetSize(16, 16)
		self.RaidIcon = raidicon

		health:SetHeight(HEALTHHEIGHT)
		health:SetPoint('TOPRIGHT')
		health:SetPoint('TOPLEFT')

		self.menu = SpawnMenu
	end

	if(unit == 'focus' or unit:find('target')) then
		local name = health:CreateFontString(nil, 'OVERLAY')
		name:SetFont(FONT, FONTSIZE)
		name:SetShadowColor(0, 0, 0)
		name:SetShadowOffset(1, -1)
		name:SetPoint('LEFT', health, 2, 0)
		name:SetPoint('RIGHT', healthValue, 'LEFT')
		name:SetJustifyH('LEFT')
		if unit == 'target' then
			self:Tag(name, '[difficulty][plus][level] [seno:name< ][|cff0090ff>rare<|r]')
		else
			self:Tag(name, '[seno:name< ][|cff0090ff>rare<|r]')
		end

		local debuffs = CreateFrame('Frame', nil, self)
		debuffs.spacing = 3
		debuffs:SetSize(110, 44)
		debuffs.initialAnchor = 'BOTTOMLEFT'
		debuffs.PostCreateIcon = PostCreateAura
		debuffs:SetPoint('LEFT', self, 'BOTTOMLEFT', 0, -5)
		debuffs.num = 10
		debuffs.size = 24
		debuffs['growth-y'] = 'DOWN'
		debuffs['growth-x'] = 'RIGHT'
		debuffs.PostUpdateIcon = PostUpdateDebuff
		self.Debuffs = debuffs

		if(unit ~= 'target') then
			debuffs.num = 10
			debuffs:SetPoint('TOPRIGHT', self, 'RIGHT', 0, 5)
			debuffs['growth-y'] = 'DOWN'
			debuffs['growth-x'] = 'RIGHT'
			health:SetAllPoints()
		end

		if(unit == 'target') then
			debuffs.onlyShowPlayer = true
			debuffs.size = 24
		end

	end

	if(UnitSpecific[unit]) then
		return UnitSpecific[unit](self)
	end
end

oUF.colors.power.MANA = {0, 144/255, 1}

oUF:RegisterStyle('seno', Shared)

oUF:Factory(function(self)
	self:SetActiveStyle('seno')
	self:Spawn('player'):SetPoint('CENTER', -220, -300)
	self:Spawn('pet'):SetPoint('CENTER', -370, -300)
	self:Spawn('focus'):SetPoint('CENTER', 500, -300)
	self:Spawn('target'):SetPoint('CENTER', 0, -300)
	self:Spawn('targettarget'):SetPoint('CENTER', 220, -300)
end)

Last edited by kawe : 11-14-10 at 07:27 PM.
  Reply With Quote
11-16-10, 04:22 AM   #11
gratzner
A Murloc Raider
 
gratzner's Avatar
Join Date: Nov 2010
Posts: 5
Are you supposed to add this to the oUF core file?

I thought i had to use the LUA files in the "elements" folder such as the castbar LUA file?
__________________
Mooooooo
  Reply With Quote
11-16-10, 04:40 AM   #12
kawe
A Cyclonian
 
kawe's Avatar
Join Date: Sep 2009
Posts: 40
Originally Posted by gratzner View Post
Are you supposed to add this to the oUF core file?

I thought i had to use the LUA files in the "elements" folder such as the castbar LUA file?

noooo :P


dont touch the core file! u just add the code to ouf_alekk! the core file just SUPPORTS other ouf layouts. just look at top of the code i posted; it says ouf_senomar and thats just a LAYOUT i use -> there are tons of it but there is only 1 core file, in my case newest version oUF 1.5.4
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Added oUF_Alekk, lost oUF_Mono :(

Thread Tools
Display Modes

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