Thread Tools Display Modes
04-07-09, 09:28 AM   #981
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Works a charm, i have somewhat of a talent in not spotting small errors like that.
__________________
All I see is strobe lights blinding me in my hindsight.
 
04-08-09, 03:11 PM   #982
duhwhat
A Wyrmkin Dreamwalker
Join Date: Aug 2008
Posts: 51
Is ":CustomAuraFilter" going to be a debuff black/whitelist for both self and other player/mob auras? http://ixo.no/git/oUF.git/commit/?id...a83ea8758abdaf

I am also looking for advice on how to approach making one of my favorite layouts, which has not been updated recently, compatible with 1.3.
 
04-08-09, 05:18 PM   #983
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by duhwhat View Post
Is ":CustomAuraFilter" going to be a debuff black/whitelist for both self and other player/mob auras? http://ixo.no/git/oUF.git/commit/?id...a83ea8758abdaf

I am also looking for advice on how to approach making one of my favorite layouts, which has not been updated recently, compatible with 1.3.
Basically, yes, its used to filter if you want it shown or not, based on custom filters (hence the name of the function).
 
04-09-09, 03:16 PM   #984
saidin93
A Murloc Raider
Join Date: Apr 2009
Posts: 4
I'm currently using oUF_Nivaya and was wondering what would i have to add to the lua so that its at .1 alpha while out of combat and =100% life/mana, .5 alpha when out of combat and <100% mana/life, .75 alpha when targeting something and 1 alpha while in combat. Is that possible to do? And if possible, show on a mouse over
 
04-09-09, 03:31 PM   #985
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by saidin93 View Post
I'm currently using oUF_Nivaya and was wondering what would i have to add to the lua so that its at .1 alpha while out of combat and =100% life/mana, .5 alpha when out of combat and <100% mana/life, .75 alpha when targeting something and 1 alpha while in combat. Is that possible to do? And if possible, show on a mouse over
That wont be done in customfilters, thats done in postupdate
 
04-09-09, 03:39 PM   #986
saidin93
A Murloc Raider
Join Date: Apr 2009
Posts: 4
Still have no idea how to do it
 
04-10-09, 01:45 AM   #987
Luzzifus
A Warpwood Thunder Caller
 
Luzzifus's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 94
The checks for health values can be done in PostUpdateHealth. Only two of your bunch of cases, you'll get the point I hope:

Code:
local function PostUpdateHealth(self, event, unit, bar, min, max)
  if (unit == 'player') then
    local basealpha = 1
    local c = UnitAffectingCombat(unit)
    if ((max == min) and not c) then basealpha = 0.1  -- max health and not in combat
    elseif ((max ~= min) and not c) then basealpha = 0.5 end -- not max health and not in combat
    oUF_player.SetAlpha(basealpha)
  end

  < more code > 

end
However this is still only executed when the health values are updated. If that doesn't catch all cases involving combat state, you'd have to hook into PLAYER_REGEN_ENABLED and PLAYER_REGEN_DISABLED.
 
04-12-09, 01:16 PM   #988
saidin93
A Murloc Raider
Join Date: Apr 2009
Posts: 4
So i tried what you said but the blizzard default frame showed up and the oUF one just dissapeared
 
04-14-09, 06:59 AM   #989
aojanpera
A Kobold Labourer
Join Date: Apr 2009
Posts: 1
Two separete debuff-areas

Hello!

I'm wondering if it is possible to create two different areas for debuffs. Basically what I'm trying to accomplish is to have two areas for debuffs on my target. One for my own debuffs (I play priest so it would be used to track different DoT's and so on) - and one for the rest (debuffs from other party/raid members ).

I create debuff-frame like this:

Code:
    
    self.Debuffs = CreateFrame("Frame", nil, self)
    self.Debuffs.size = 35
    self.Debuffs:SetHeight(self.Debuffs.size)
    self.Debuffs:SetWidth(self.Debuffs.size * 5)
    self.Debuffs:SetPoint('CENTER', UIParent, 'CENTER', 0, -170)
    self.Debuffs.initialAnchor = "TOPLEFT"
    self.Debuffs["growth-y"] = "UP"
    self.Debuffs.num = 10
    self.Debuffs.spacing = 2
I would then use

Code:
    self.Debuffs.filter = "HARMFUL"
if for the rest of the debuffs and

Code:
    self.Debuffs.filter = "HARMFUL|PLAYER"
for my own.


Can I just create different frames like this:
Code:
self.Debuffs_rest = CreateFrame("Frame", nil, self)
self.Debuffs_mine = CreateFrame("Frame", nil, self)
and then proceed to configure each frame differently (acnhors, size, etc)
 
04-16-09, 08:11 PM   #990
st0nedpenguin
A Deviate Faerie Dragon
 
st0nedpenguin's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2005
Posts: 10
Has something changed in the aura module regarding disableCooldown?

For some reason it doesn't seem to be doing anything for me with the current oUF.
 
04-17-09, 05:56 PM   #991
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
Is there any way I can make my raidgroups go to the right, instead of downwards?

This is what I want:
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
etc

This is what Me and most oUF setups have:
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5

Number = group number.

I tried setting
raidGroup:SetManyAttributes('groupFilter', tostring(i), 'showRaid', true, 'yOffSet', -5) to xOffSet, 5. instead but it didnt work at all.

*EDIT* Nevermind, after some reading and testing I found out I had to add 'POINT', 'LEFT' to the back of it . Works like a charm.

Last edited by sacrife : 04-17-09 at 06:09 PM.
 
04-18-09, 05:33 AM   #992
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Having a peculiar problem I've never run into before... I've got a "ghost" frame where I've anchored my target that always shows up.



Player on left, but I don't have a target at all (nor have I spawned any other frames) and there's a frame on the right. If I select a target it updates and works fine, but once I deselect it the ghost frame just remains with the last known status of the target.

Code:
--locals


--config
local statusTexture = [=[Interface\AddOns\oUF_Pooch\media\HalF]=]
local flatTexture = [=[Interface\AddOns\oUF_Pooch\media\Flat]=]
local backdrop = {
	bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
	insets = {top = -1, left = -1, bottom = 0, right = -1},
}

local height, width = 27, 240

--right-click menu
local function menu(self)
	local unit = string.gsub(self.unit, "(.)", string.upper, 1)
	
	if _G[unit .. "FrameDropDown"] then
		ToggleDropDownMenu(1, nil, _G[unit .. "FrameDropDown"], "cursor")	
	end
end

local function layout(self, unit)
	--enable our right-click menu
	self.menu = menu
	self:RegisterForClicks("AnyUp")
	self:SetAttribute("type2", "menu")
	
	--tooltip stuff
	self:SetScript("OnEnter", UnitFrame_OnEnter)
	self:SetScript("OnLeave", UnitFrame_OnLeave)
	
	--misc frame stuff
	self:SetHeight(height)
	self:SetWidth(width)
	
	self:SetBackdrop(backdrop)
	self:SetBackdropColor(0, 0, 0)
	
	self:SetFrameStrata("LOW")
	
	--creating our status bars
	local hp = CreateFrame("StatusBar")
	hp:SetPoint("TOPRIGHT", self)
	hp:SetPoint("TOPLEFT", self)
	hp:SetStatusBarTexture(statusTexture)
	hp:SetStatusBarColor(.23, .27, .22)
	hp:SetHeight(13)
	hp:SetWidth(width)
	
	self.Health = hp
	self.Health.FrequentUpdates = true
	
	local hpbg = hp:CreateTexture(nil, "BORDER")
	hpbg:SetAllPoints(hp)
	hpbg:SetTexture(statusTexture)
	hpbg:SetVertexColor(.3, .3, .3)
	
	self.Health.bg = hpbg
	

	local power = CreateFrame("StatusBar")
	power:SetPoint("TOPLEFT", self.Health, "BOTTOMLEFT", 0, -1)
	power:SetPoint("TOPRIGHT", self.Health, "BOTTOMRIGHT", 0, -1)
	power:SetStatusBarTexture(flatTexture)
	power:SetStatusBarColor(.51, .5, .34)
	power:SetHeight(3)
	power:SetWidth(width)
	
	local powerbg = power:CreateTexture(nil, "BORDER")
	powerbg:SetAllPoints(power)
	powerbg:SetTexture(.2, .2, .2)
	
	self.Power = power
	self.Power.FrequentUpdates = true
end

oUF:RegisterStyle("Pooch", layout)
oUF:SetActiveStyle("Pooch")

oUF:Spawn("player", "oUF_Player"):SetPoint("CENTER", UIParent, "CENTER", -300, 0)
oUF:Spawn("target", "oUF_Target"):SetPoint("CENTER", UIParent, "CENTER", 300, 0)
Obviously 90% incomplete but I wanted to fix this before digging myself a deeper hole.

edit: I've also ruled out oUF itself as a problem since other layouts work fine.
 
04-18-09, 05:51 AM   #993
Din
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 14
Originally Posted by Waverian View Post
Having a peculiar problem I've never run into before... I've got a "ghost" frame where I've anchored my target that always shows up.
I'm new to oUF myself so take someone else's word over mine, but the problem may be you're creating the Health and Power frames without parenting them to the unitframe itself. So when the frame is hidden by oUF, these bars are not because they are not children.

For example when I create my statusbar, I do
Code:
self.Health = CreateFrame("StatusBar", nil, self)
where the third parameter there (self) sets the parent frame.
 
04-18-09, 05:56 AM   #994
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Originally Posted by Din View Post
I'm new to oUF myself so take someone else's word over mine, but the problem may be you're creating the Health and Power frames without parenting them to the unitframe itself. So when the frame is hidden by oUF, these bars are not because they are not children.

For example when I create my statusbar, I do
Code:
self.Health = CreateFrame("StatusBar", nil, self)
where the third parameter there (self) sets the parent frame.
Ah, that was the problem. Thanks Din.
 
04-21-09, 03:05 PM   #995
Scound
A Murloc Raider
Join Date: Jan 2009
Posts: 5
Error massage when enabling frequnet power update

Well, I get the following errormassage ingame whenever I enable bar.frequent.updates = true in my unitframe layout:

.../oUF/elements/power.lua:46:attempt to call method 'UNIT_MAXMANA' (a nil value)

I am using the latest version of oUF as far as I know.

As I consider myself rather a noob concerning anything with programming, I wanted to ask you guys for a little help. Maybe someone has an idea how to get the smooth energybar going without changing too much of my precious code

Code:
--[[

oUF_Caith

Custom layout for oUF.
Based on Caith's PitBull layout - http://www.bellum-potentiae.de/forum/viewtopic.php?t=3674

ToDo:
Move DK Rune-Frame (central under Player-Character)!!! At this point they spawn at their original Postition
implementation of Raidframes (low priority)
implementation of CastBars for Player, Target and Focus-Target (medium priority)
implementation of RogueFocusBar / DKFocusBar (medium priority)
introduction of improved options
--]]


-- Custom Settings - Modifiable
-- ----------------------------------------------------------------------------

-- Textures/Fonts
local statusbarTexture = "Interface\\AddOns\\oUF_Caith\\media\\armory"
local borderTexture = "Interface\\AddOns\\oUF_Caith\\media\\border"
local font = "Interface\\AddOns\\oUF_Caith\\media\\font.ttf"
local fontSize = 16

-- Global Frame sizes (including: Healthbar, Mana/Energybar, Infobar)
local width,  height  = 275, 50 -- Player and Target
local pwidth, pheight = 200, 20 -- Focus, Party and Party Pet
local twidth, theight = 200, 20 -- Target of Target

-- Colors
-- ClassColor Support beneficial?!?
oUF.colors.class = {
	["DEATHKNIGHT"] = { 196/255,  30/255,  60/255 },
	["DRUID"]       = { 255/255, 125/255,  10/255 },
	["HUNTER"]      = { 171/255, 214/255, 116/255 },
	["MAGE"]        = { 104/255, 205/255, 255/255 },
	["PALADIN"]     = { 245/255, 140/255, 186/255 },
	["PRIEST"]      = { 212/255, 212/255, 212/255 },
	["ROGUE"]       = { 255/255, 243/255,  82/255 },
	--["SHAMAN"]      = {   0/255, 254/255, 255/255 },	-- Caith's Shaman color
	["SHAMAN"]      = {  11/255, 104/255, 255/255 },	-- More traditional Shaman blue
	["WARLOCK"]     = { 148/255, 130/255, 201/255 },
	["WARRIOR"]     = { 199/255, 156/255, 110/255 },
}

oUF.colors.power = {
	['MANA']            = { 104/255, 155/255, 217/255 }, -- Mana
	['RAGE']            = { 231/255,  81/255,  75/255 }, -- Rage
	['FOCUS']           = { 255/255, 209/255,  71/255 }, -- Focus
	['ENERGY']          = { 255/255, 255/255, 255/255 }, -- Energy
	['RUNIC_POWER']     = {   0/255, 209/255, 255/255 }, -- Runic Power
}

local health = {
	[0] = { r = 255/255, g =   0/255, b =   0/255 }, -- Red
	[1] = { r = 255/255, g = 255/255, b =   0/255 },  -- Yellow-ish
	[2] = { r =   0/255, g = 255/255, b =   0/255 }, -- Green
}

local UnitReactionColor = {
	[1] = { 219/255, 48/255,  41/255 }, -- Hated
	[2] = { 219/255, 48/255,  41/255 }, -- Hostile
	[3] = { 219/255, 48/255,  41/255 }, -- Unfriendly
	[4] = { 218/255, 197/255, 92/255 }, -- Neutral
	[5] = { 75/255,  175/255, 76/255 }, -- Friendly
	[6] = { 75/255,  175/255, 76/255 }, -- Honored
	[7] = { 75/255,  175/255, 76/255 }, -- Revered
	[8] = { 75/255,  175/255, 76/255 }, -- Exalted
}
oUF.colors.reaction = UnitReactionColor

--[[
local grey = {0.5, 0.5, 0.5}
local white = {1, 1, 1}
]]

-- Colors on Infobar for Health, Mana/Energy - at the moment only the first entry is actually used
local verbosehp = "|cff00FF00%d|r |cffFFFFFF|||r |cff395A09%d|r"  -- 1234 | 5678 [colored green]
local verbosepp = "|cff5EAEF7%d|r |cffFFFFFF|||r |cff063C82%d|r"  -- 1234 | 5678 [colored blue]
--local verboseep = "|cff5EAEF7%d|r |cffFFFFFF|||r |cff063C82%d|r"  -- 1234 | 5678 [colored white]
--local verboserp = "|cff5EAEF7%d|r |cffFFFFFF|||r |cff063C82%d|r"  -- 1234 | 5678 [colored red]

-- Color Gradient for Target Health-Text in %
local perhp     = "|cff%02x%02x%02x%s%%|r"						  -- 100% [colored gradient]


-- Custom Variables for the Caith-UI
-- ----------------------------------------------------------------------------

local select = select
--local UnitName = UnitName
local UnitLevel = UnitLevel
local UnitClass = UnitClass
local UnitIsDead = UnitIsDead
local UnitIsGhost = UnitIsGhost
local UnitIsPlayer = UnitIsPlayer
local UnitIsTapped = UnitIsTapped
local UnitRace = UnitRace
local UnitReaction = UnitReaction
local UnitPowerType = UnitPowerType
local UnitIsConnected = UnitIsConnected
local UnitIsTappedByPlayer = UnitIsTappedByPlayer
local UnitClassification = UnitClassification
local UnitCreatureType = UnitCreatureType

local playerClass = select(2, UnitClass("player")) -- combopoints for druid/rogue
local playerName = UnitName("player")


-- Custom tags
-- ----------------------------------------------------------------------------

oUF.TagEvents["[verbosehp]"]   = "UNIT_HEALTH UNIT_MAXHEALTH"
oUF.Tags["[verbosehp]"] = function(unit)
	local c, m = UnitHealth(unit), UnitHealthMax(unit) 
	return (c <= 1 or not UnitIsConnected(unit)) and "" or verbosehp:format(c, m) end

oUF.TagEvents["[perhpgrad]"]   = "UNIT_HEALTH UNIT_MAXHEALTH"
oUF.Tags["[perhpgrad]"] = function(unit)
	local v = oUF.Tags["[perhp]"](unit)

	if v < 100 and v > 0 then
		-- Color health percent value in a gradient
		local r, g, b = oUF.ColorGradient(v / 100.00, -- Function expects a decimal
			health[0].r, health[0].g, health[0].b,
			health[1].r, health[1].g, health[1].b,
			health[2].r, health[2].g, health[2].b
		)
		return perhp:format(r * 255, g * 255, b * 255, v)
	end
	return ""
end

oUF.TagEvents["[verbosepp]"]   = "UNIT_MANA UNIT_RAGE UNIT_FOCUS UNIT_ENERGY UNIT_RUNIC_POWER UNIT_MAXMANA UNIT_MAXRAGE UNIT_MAXFOCUS UNIT_MAXENERGY UNIT_MAXRUNIC_POWER"
oUF.Tags["[verbosepp]"] = function(unit) 
	local c, m = UnitMana(unit), UnitManaMax(unit) 
	return (c <= 1 or not UnitIsConnected(unit)) and "" or verbosepp:format(c, m) end

oUF.TagEvents["[verbosename]"] = "UNIT_NAME_UPDATE UNIT_HEALTH UNIT_TARGET"
oUF.Tags["[verbosename]"] = function(unit)
	if unit == "player" then return "" end
	
	local name = "%s |cff%02x%02x%02x%s|r %s"
	local classifications = {
		["worldboss"] = "??",
		["rareelite"] = "%s*+",
		["rare"] = "%s*",
		["elite"] = "%s+",
		["normal"] = "%s",
		["trivial"] = "%s",
	}
	
	local _, c = UnitClass(unit)
	local color = oUF.colors.class[c] or UnitReactionColor[4]
		
	if unit == "target" then
		local cl = UnitClassification(unit)
		local level = classifications[cl] and classifications[cl]:format(UnitLevel(unit)) or UnitLevel(unit)
		local n = UnitName(unit) or ''
		local race = UnitRace(unit) or UnitCreatureType(unit) or ''
		return name:format(level, color[1] * 255, color[2] * 255, color[3] * 255, n, race)
	elseif unit == "targettarget" then
		local n = UnitName(unit) or ''
		if n == playerName then
			return "|cffFFFFFF<< You >>|r"
		else
			return name:format('', color[1] * 255, color[2] * 255, color[3] * 255, n, '')
		end
	else
		local n = UnitName(unit) or ''
		local level = UnitLevel(unit)
		return name:format(level, color[1] * 255, color[2] * 255, color[3] * 255, n, '')
	end
end


-- General Functions / Triggers for optional Deps
-- ----------------------------------------------------------------------------

local menu = function(self)
	local unit = self.unit:sub(1, -2)
	local cunit = self.unit:gsub("(.)", string.upper, 1)

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

local function auraIcon(self, button)
	local t = button:CreateTexture(nil, "OVERLAY")
	t:SetTexture(borderTexture)
	t:SetAllPoints(button)
	t:SetVertexColor(0.25, 0.25, 0.35)
end

local backdrop = {
	bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", 
	insets = {left = -2, right = -2, top = -2, bottom = -2},
}

local function createString(parent, fontSize)
	local fs = parent:CreateFontString(nil, "OVERLAY")
	fs:SetFont(font, fontSize)
	fs:SetShadowColor(0, 0, 0, 0.9)
	fs:SetShadowOffset(1, -1)
	--fs:SetTextColor(1,1,1)
	--fs:SetPoint("RIGHT", -4, 2)
	return fs
end

-- Combat Feedback for Player / Targetframes
local function createCombatFeedback(self, parent)
	if IsAddOnLoaded("oUF_CombatFeedback") then
		local cbft = parent:CreateFontString(nil, "OVERLAY")
		cbft:SetPoint("LEFT", 4, 0)
		cbft:SetFont(font, fontSize + 2)
		cbft:SetShadowColor(0, 0, 0, 0.9)
		cbft:SetShadowOffset(1, -1)
		
		self.CombatFeedbackText = cbft
		self.CombatFeedbackText.maxAlpha = .6
		
		self.CombatFeedbackText.ignoreHeal     = false
		self.CombatFeedbackText.ignoreImmune   = false
		self.CombatFeedbackText.ignoreDamage   = false
		self.CombatFeedbackText.ignoreEnergize = true
		self.CombatFeedbackText.ignoreOther    = true
	end
end

-- Power Spark (Playerframe only)
local function createPowerSpark(parent)
	if IsAddOnLoaded("oUF_PowerSpark") then
		local spark = parent:CreateTexture(nil, "OVERLAY")
		spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
		spark:SetBlendMode("ADD")
		spark:SetVertexColor(1, 1, 1, 0.5)
		spark:SetHeight(parent:GetHeight()*2)
		spark:SetWidth(parent:GetHeight())
		spark.manatick = true
		
		return spark
	end
	
	return nil
end


-- Frame Creation
-- ----------------------------------------------------------------------------

local function createBarFrame(parent, height)
	local bar = CreateFrame("StatusBar")
	bar:SetHeight(height)
	bar:SetStatusBarTexture(statusbarTexture)
	bar:SetParent(parent)
	bar:SetPoint("LEFT")
	bar:SetPoint("RIGHT")
	
	return bar
end
local function createInfoBarFrame(parent)
	local bar = createBarFrame(parent, 20)
	bar:SetStatusBarColor(1, 1, 1, 0.1)
	bar:SetPoint("TOP", parent, "BOTTOM", 0, -10)
	
	return bar
end
local function createHealthBarFrame(parent)
	local bar = createBarFrame(parent, 25)
	--bar:SetStatusBarColor(1, 1, 0)
	bar:SetPoint("TOP", 0, 1)
	bar:SetPoint("LEFT", -1, 0)
	bar:SetPoint("RIGHT", 1, 0)
	
	bar.colorTapping = true
	bar.colorHappiness = true
	bar.colorDisconnected = true
	bar.colorClass = true
	bar.colorClassNPC = false
	bar.colorReaction = true
	bar.frequentUpdates = true
	
	local bg = bar:CreateTexture(nil, "BORDER")
	bg:SetHeight(bar:GetHeight())
	bg:SetWidth(bar:GetWidth())
	bg:SetTexture(0.3, 0.3, 0.3)
	bg:SetPoint("LEFT")
	bg:SetPoint("RIGHT")
	
	bar.bg = bg
	
	return bar
end
local function createPowerBarFrame(parent)
	local bar = createBarFrame(parent, 7)
	--bar:SetStatusBarColor(.25, .25, .35)
	bar:SetPoint("TOP", parent, "BOTTOM", 0, -1)
	bar:SetPoint("LEFT")
	bar:SetPoint("RIGHT")
	
	bar.colorTapping = false
	bar.colorDisconnected = true
	bar.colorPower = true
	bar.frequentUpdates = true
	
	local bg = bar:CreateTexture(nil, "BORDER")
	bg:SetHeight(bar:GetHeight())
	bg:SetWidth(bar:GetWidth())
	bg:SetTexture(0.3, 0.3, 0.3)
	bg:SetPoint("LEFT")
	bg:SetPoint("RIGHT")
	
	bar.bg = bg
	return bar
end

local func = function(settings, self, unit)
	self.unit = unit
	
	self.menu = menu
	self:SetScript("OnEnter", UnitFrame_OnEnter)
	self:SetScript("OnLeave", UnitFrame_OnLeave)
	self:RegisterForClicks("anyup")
	self:SetAttribute("*type2", "menu")
	self:SetBackdrop(backdrop)
	self:SetBackdropColor(0, 0, 0, .9)
	
	-- Player ---------------------------------------------
	if unit == 'player' then
		local ib = createInfoBarFrame(self)		-- Info Bar
		local hp = createHealthBarFrame(self) 	-- Health Bar
		local pp = createPowerBarFrame(hp) 		-- Power Bar
		
		createCombatFeedback(self, hp)			-- Combat Feedback
		
		-- Health Values (Tags)
		local hpv = createString(ib, fontSize)
		hpv:SetPoint("RIGHT", -4, 0)
		hpv.frequentUpdates = 0.1
		self:Tag(hpv, "[status]   [verbosehp]")
		
		-- Power Values (Tags)
		local ppv = createString(ib, fontSize)
		ppv:SetPoint("LEFT", 4, 0)
		ppv.frequentUpdates = 0.1
		self:Tag(ppv, "[verbosepp]")
		
		self.Health = hp
		self.Power = pp
		
		self.Spark = createPowerSpark(pp)
		
		--[[if(class == "DEATHKNIGHT") then
			RuneFrame:SetParent(self)
			RuneFrame:SetScale(0.75)
			RuneFrame:SetPoint("TOPLEFT", self, "BOTTOMLEFT",0 , -3)
		end
		--]]
		
	-- Target ---------------------------------------------
	elseif unit == 'target' then
		local ib = createInfoBarFrame(self)		-- Info Bar
		local hp = createHealthBarFrame(self)	-- Health Bar
		local pp = createPowerBarFrame(hp)		-- Power Bar
		
		createCombatFeedback(self, hp)			-- Combat Feedback
		
		-- Name
		local name = createString(ib, fontSize)
		name:SetPoint("LEFT", 4, 0)
		name:SetJustifyH("LEFT")
		self:Tag(name, "[verbosename]")
		
		-- Health string (absolute)
		local hpv = createString(ib, fontSize)
		hpv:SetPoint("RIGHT", -4, 0)
		hpv.frequentUpdates = 0.1
		self:Tag(hpv, "[status] [verbosehp]")
		
		-- Prevent the name from going through the health values
		name:SetPoint("RIGHT", hpv, "LEFT")
		
		-- Health string (percentage)
		local hpp = createString(hp, fontSize + 2)
		hpp:SetPoint("RIGHT", -4, 0)
		hpp.frequentUpdates = 0.1
		self:Tag(hpp, "[perhpgrad]")
		
		-- Auras
		local auras = CreateFrame("Frame", nil, self)
		auras.size = width / 8
		auras:SetHeight(auras.size * 4)
		auras:SetWidth(width)
		auras:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 2)
		auras.numBuffs = 40
		auras.numDebuffs = 32
		auras.gap = true
		self.Auras = auras
		self.PostCreateAuraIcon = auraIcon
		
		-- Raid Icon TODO: Test
		local ricon = self:CreateTexture(nil, "OVERLAY")
		ricon:SetHeight(24)
		ricon:SetWidth(24)
		ricon:SetPoint("TOPLEFT", self, "TOPRIGHT", 4, 0)
		self.RaidIcon = ricon
		
		-- Combo Points
		--if playerClass == "ROGUE" or playerClass == "DRUID" then
			self.CPoints = createString(self, fontSize + 4)
			self.CPoints:SetPoint("RIGHT", self, "LEFT", -3, 3)
			self.CPoints:SetFont(font, 38, "OUTLINE")
			self.CPoints:SetJustifyH("RIGHT")
		--end
		
		self.Health = hp
		self.Power = pp
	-- TargetTarget ---------------------------------------
	elseif unit == 'targettarget' then
		--local ib = createInfoBarFrame(self)			-- Info Bar
		local hp = createHealthBarFrame(self)		-- Health Bar
		local pp = createPowerBarFrame(hp)			-- Power Bar
		
		--ib:SetHeight(14)
		hp:SetHeight(15)
		hp.bg:SetHeight(15)
		pp:SetHeight(5)
		
		-- Name
		local name = createString(hp, fontSize)
		name:SetPoint("CENTER", 0, 2)
		name:SetJustifyH("CENTER")
		self:Tag(name, "[status] [verbosename]")
		
		self.Health = hp
		self.Power = pp
	-- Pet ---------------------------------------
	elseif unit == 'pet' then --or unit == 'vehicle' then
		--local ib = createInfoBarFrame(self)			-- Info Bar
		local hp = createHealthBarFrame(self)		-- Health Bar
		local pp = createPowerBarFrame(hp)			-- Power Bar
		
		--ib:SetHeight(14)
		hp:SetHeight(15)
		hp.bg:SetHeight(15)
		pp:SetHeight(5)
		
		self.Health = hp
		self.Power = pp
	-- Focus ----------------------------------------------
	elseif unit == "focus" then
		local hp = createHealthBarFrame(self)		-- Health Bar
		local pp = createPowerBarFrame(hp)			-- Power Bar
		
		hp:SetHeight(15)
		hp.bg:SetHeight(15)
		pp:SetHeight(5)
		
		-- Name
		local name = createString(self, fontSize)
		name:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 2)
		self:Tag(name, "[verbosename]")
		
		-- Health Percent
		local hpp = createString(hp, fontSize-2)
		hpp:SetPoint("RIGHT", -4, 2)
		hpp.frequentUpdates = 0.1
		self:Tag(hpp, "[status] [perhpgrad]")
		
		-- Auras
		local auras = CreateFrame("Frame", nil, self)
		local s = pp:GetHeight() + hp:GetHeight()
		auras.size = s
		auras:SetHeight(s)
		auras:SetWidth(s * 4)
		auras:SetPoint("LEFT", self, "RIGHT", 4, 0)
		auras.initialAnchor = "TOPLEFT"
		auras.numBuffs = 1
		auras.numDebuffs = 3
		--self.Auras = auras
		
		self.Health = hp
		self.Power = pp

		self.PostCreateAuraIcon = auraIcon
	-- Party ----------------------------------------------
	elseif not unit then
		local hp = createHealthBarFrame(self)		-- Health Bar
		local pp = createPowerBarFrame(hp)			-- Power Bar
		
		hp:SetHeight(16)
		hp.bg:SetHeight(16)
		pp:SetHeight(4)
		
		-- Name
		local name = createString(self, fontSize)
		name:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 2)
		self:Tag(name, "[verbosename]")
		
		-- Health Deficit
		local hpd = createString(hp, fontSize-2)
		hpd:SetPoint("RIGHT", -4, 2)
		self:Tag(hpd, "[status] [missinghp]")
		
		-- Auras (Debuffs only)
		local debuffs = CreateFrame("Frame", nil, self)
		local s = pp:GetHeight() + hp:GetHeight()
		debuffs.size = s
		debuffs:SetHeight(s)
		debuffs:SetWidth(s * 4)
		debuffs:SetPoint("LEFT", self, "RIGHT", 4, 0)
		debuffs.initialAnchor = "TOPLEFT"
		debuffs.num = 4
		self.Debuffs = debuffs
		self.PostCreateAuraIcon = auraIcon
		
		-- Range Filtering
		self.Range = true
		self.inRangeAlpha = 1
		self.outsideRangeAlpha = .5
		
		self.Health = hp
		self.Power = pp
	end

	--self:SetFrameStrata("BACKGROUND")
	--return self
end

oUF:RegisterStyle("caith", setmetatable({
	["initial-width"] = width,
	["initial-height"] = height,
}, {__call = func}))

oUF:RegisterStyle("caith_ToT", setmetatable({
	["initial-width"] = twidth,
	["initial-height"] = theight,
}, {__call = func}))

oUF:RegisterStyle("caith_Party", setmetatable({
	["initial-width"] = pwidth,
	["initial-height"] = pheight,
}, {__call = func}))

-- ----------------------------------------------------------------------------
-- Player, ToT, Target
-- ----------------------------------------------------------------------------

oUF:SetActiveStyle("caith")

local player = oUF:Spawn("player")
player:SetPoint("BOTTOM", -300, 250)

local target = oUF:Spawn("target")
target:SetPoint("BOTTOM", 300, 250)

oUF:SetActiveStyle("caith_ToT")

local tot = oUF:Spawn("targettarget")
tot:SetPoint("BOTTOM", 0, 250)

local pet = oUF:Spawn("pet")
pet:SetPoint("BOTTOM", tot, "TOP", 0, 5)

--[[
local toggleVehicle = CreateFrame("Frame")
toggleVehicle:RegisterEvent("UNIT_ENTERED_VEHICLE")
toggleVehicle:SetScript("OnEvent", function(self, event, arg1)
	if ( event == "UNIT_ENTERED_VEHICLE" and arg1 == "player" ) then
		local vehicle = oUF:Spawn("vehicle")
		vehicle:SetPoint("BOTTOM", tot, "TOP", 0, 5)
	end
end)
--]]

-- ----------------------------------------------------------------------------
-- Focus, Party, Party Pets
-- ----------------------------------------------------------------------------

oUF:SetActiveStyle("caith_Party")

local focus = oUF:Spawn("focus")
focus:SetPoint("BOTTOMRIGHT", player, "TOPLEFT", -10, 250)

local party = oUF:Spawn("header", "oUF_Party")
party:SetPoint("BOTTOMLEFT", target, "TOPRIGHT", 15, 250)
party:SetAttribute("yOffset", pheight - (pheight * 2)) -- Grow up (does -pheight work?)
party:SetAttribute("showParty", true)

local partypet = oUF:Spawn("header", "oUF_PartyPets", true)
partypet:SetPoint("BOTTOM", party, "TOP", 0, pheight)
partypet:SetAttribute("yOffset", pheight - (pheight * 2)) -- Grow up (does -pheight work?)
partypet:SetAttribute("showParty", true)

local toggleParty = CreateFrame("Frame")
toggleParty:SetScript("OnEvent", function(self)
	if InCombatLockdown() then 
		self:RegisterEvent("PLAYER_REGEN_ENABLED")
	else
		self:UnregisterEvent("PLAYER_REGEN_ENABLED")
		if GetNumRaidMembers() > 0 then
			party:Hide()
			partypet:Hide()
		elseif GetNumPartyMembers() > 0 then
			party:Show()
			partypet:Show()
			
			partypet:SetPoint("BOTTOM", party, "TOP", 0, GetNumPartyMembers() * pheight)
		end
	end
end)
toggleParty:RegisterEvent("PARTY_MEMBERS_CHANGED")
toggleParty:RegisterEvent("PARTY_LEADER_CHANGED")
toggleParty:RegisterEvent("RAID_ROSTER_UPDATE")
toggleParty:RegisterEvent("PLAYER_LOGIN")
I have made the decicive part in the code bold.
Everything is working as intendet as long as the "bar.frequentUpdates" part is not set to true in the powerbar function...

Thanks in advance.
 
04-21-09, 07:09 PM   #996
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
statusbars requires to have self (oUF.<units>) to work.
 
04-22-09, 12:03 AM   #997
kewlbear77
A Kobold Labourer
Join Date: Apr 2009
Posts: 1
Right Click Dropdown menu for Raid Frame

I want to add right click dropdown menu for Raid Frame so I googled a little bit and found codes that p3lim posted on old oUF forum. I added codes as follows:

UnitPopupMenus["RAID_PLAYER"] = { "MUTE", "UNMUTE", "RAID_SILENCE", "RAID_UNSILENCE", "BATTLEGROUND_SILENCE", "BATTLEGROUND_UNSILENCE", "WHISPER", "INSPECT", "ACHIEVEMENTS", "TRADE", "FOLLOW", "DUEL", "RAID_TARGET_ICON", "RAID_LEADER", "RAID_PROMOTE", "RAID_DEMOTE", "LOOT_PROMOTE", "RAID_REMOVE", "PVP_REPORT_AFK", "RAF_SUMMON", "RAF_GRANT_LEVEL", "CANCEL" }
UnitPopupMenus["RAID"] = { "MUTE", "UNMUTE", "RAID_SILENCE", "RAID_UNSILENCE", "BATTLEGROUND_SILENCE", "BATTLEGROUND_UNSILENCE", "RAID_LEADER", "RAID_PROMOTE", "RAID_MAINTANK", "RAID_MAINASSIST", "LOOT_PROMOTE", "RAID_DEMOTE", "RAID_REMOVE", "PVP_REPORT_AFK", "CANCEL" }
local function menu(self)
if(_G[self.unit:gsub("(.)", string.upper, 1).."FrameDropDown"]) then
ToggleDropDownMenu(1, nil, _G[cunit..'FrameDropDown'], 'cursor')
elseif(self.unit:sub(1, -2) == "party" or self.unit:sub(1, -2) == "partypet") then
ToggleDropDownMenu(1, nil, _G['PartyMemberFrame'..self.id..'DropDown'], 'cursor')
elseif(self.unit:match('^raid')) then
self.name = unit
RaidGroupButton_ShowMenu(self)
end
end
And on RaidFrame style function I added

self.menu = menu
self:RegisterForClicks("AnyUp")
self:SetAttribute("*type2", "menu")
However nothing shows when I rightclick raid frame can anyone help me setting up the right click menu showing function?
 
04-22-09, 04:33 AM   #998
Scound
A Murloc Raider
Join Date: Jan 2009
Posts: 5
Originally Posted by p3lim View Post
statusbars requires to have self (oUF.<units>) to work.
care to elaborate a little more, if the answer was to my question?!?

...
Maybe I'm just to dumb to get your point?

Edit:
Ahh, finally got it! I need to reference the unitframe instead of the Healthbar-frame... I will test this sometime today - though thanks for your help .
Got on track by crosschecking this thread: http://www.wowinterface.com/forums/s...d=1#post129957

Last edited by Scound : 04-22-09 at 06:22 AM.
 
04-22-09, 10:55 PM   #999
Dimpf
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jan 2009
Posts: 25
I have a question about how Lua and oUF work in general, I suppose.

I'm concerned about optimizing my layout, and the necessity of doing so. Does Lua parse through the layout and create the frame object each time I target someone, or the ToT changes?

Or, does it only parse it once, create the object, and update it when it changes?

In the first case, doing something like this would be very bad, but it makes for clean readable code:

Code:
self.Health = CreateFrame"StatusBar"
self.Health:SetParent(self)
if (unit == 'player') then
	self.Health:SetWidth(playerHPWidth)
	self.Health:SetHeight(playerHPHeight)
	self.Health:SetPoint("BOTTOM", 0, 12)
	self.Health:SetPoint("LEFT", self.Portrait, "RIGHT", 1, 0)
elseif( unit == 'target') then
	self.Health:SetWidth(playerHPWidth)
	self.Health:SetHeight(playerHPHeight)
...and so on.

I'm hoping it's the latter case.
 
04-23-09, 09:46 AM   #1000
Dessembrae
A Fallenroot Satyr
 
Dessembrae's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 29
Question

NVM, All problems are solved

Last edited by Dessembrae : 04-26-09 at 01:25 PM. Reason: All Problems are Solved
 

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF - Layout discussion


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