Thread Tools Display Modes
12-07-13, 12:09 PM   #1
RooR
A Deviate Faerie Dragon
Join Date: May 2013
Posts: 19
oUF phanx editing help

I really like the option with the custom healthbar color but it is possible to change the background color to the regular health color from green to red and keep the custom color on the front.

/edit And i would like to change the size of the name font and the amount of auras (all of them) shown out of combat if that is possible. Already found something below "elseif unit == "target" then" but it wont help me

Last edited by RooR : 12-07-13 at 07:41 PM.
  Reply With Quote
12-07-13, 10:30 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by RooR View Post
change the background color to the regular health color from green to red and keep the custom color on the front.
1. Set the health color mode to "by health".
2. Functions.lua, add the line in green:

Code:
------------------------------------------------------------------------
--	Health
------------------------------------------------------------------------

function ns.PostUpdateHealth(bar, unit, cur, max)
	[...]

	bar:SetStatusBarColor(unpack(config.healthColor))

	local color
	if UnitIsPlayer(unit) then
		local _, class = UnitClass(unit)
		color = colors.class[class]
Originally Posted by RooR View Post
change the size of the name font
Frames.lua, change the numbers in green to whatever you want:
Code:
	---------------------------
	-- Name text, Level text --
	---------------------------
	if unit == "target" or unit == "focus" then
		self.Level = ns.CreateFontString(self.overlay, 16, "LEFT")
		self.Level:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", 2, -3)

		self:Tag(self.Level, "[difficulty][level][shortclassification]")

		self.Name = ns.CreateFontString(self.overlay, 20, "LEFT")
		self.Name:SetPoint("BOTTOMLEFT", self.Level, "BOTTOMRIGHT", 0, -1)
		self.Name:SetPoint("BOTTOMRIGHT", self.Threat or self.Health, self.Threat and "BOTTOMLEFT" or "TOPRIGHT", self.Threat and -8 or -2, self.Threat and 0 or -4)

		self:Tag(self.Name, "[unitcolor][name]")
	elseif unit ~= "player" and not strmatch(unit, "pet") then
		self.Name = ns.CreateFontString(self.overlay, 20, "LEFT")
		self.Name:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", 2, -4)
		self.Name:SetPoint("BOTTOMRIGHT", self.Health, "TOPRIGHT", -2, -4)

		self:Tag(self.Name, "[unitcolor][name]")
	end
The first one is for the target/focus frames. The second one is for all other frames with names (party, arena, boss, etc).

Originally Posted by RooR View Post
the amount of auras (all of them) shown out of combat
Not the most efficient method, but:

Auras.lua, add the line in green for each unit you want to unfilter auras out of combat:
Code:
ns.CustomAuraFilters = {
	player = function(self, unit, iconFrame, name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, isCastByPlayer, value1, value2, value3)
		if not InCombatLockdown() then return true end
Frames.lua, find all the lines like this (the part in yellow can vary, so just search for the ["num"] part):
Code:
self.Buffs["num"] = floor((FRAME_WIDTH + GAP) / (FRAME_HEIGHT + GAP))
...and change the value to 40:
Code:
self.Buffs["num"] = 40
The max number of buffs to show will be set to 40 always (not just in combat) but this shouldn't really matter since there shouldn't be too many buffs allowed by the filter in combat anyway.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-08-13, 01:02 AM   #3
RooR
A Deviate Faerie Dragon
Join Date: May 2013
Posts: 19
Thanks man the stuff wiht font and buffs worked but idk if i did somethign wrong wiht the healthbar thingy.. Ill try to explain it better like my gird has dark class colored healthbars but the background is colored like my health status (green,orange,red) when theres incoming damage. I can include a picture but i hope u know how i mean it.

By the way thanks for all your time making all those awesome addons.

Last edited by RooR : 12-08-13 at 01:07 AM.
  Reply With Quote
12-08-13, 02:10 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Did you remember to use the in-game option to set your health bar coloring mode to "by health" ? You need to do that in addition to adding the line of code I posted, or you will not see the result you want. Afterward, oUF will color the bar and its background along a gradient according the unit's health whenever it changes, and immediately after each update, oUF_Phanx will re-color the foreground (but not the background) according to your custom color, so you will have a gray foreground (or whatever color you had set) and a health-based gradient (green / yellow / orange / red) background. If that is not what you want, please be more specific and/or show me an MS Paint mockup to illustrate.

(Also, as for Grid, unless you are using a third-party plugin there is no way to make the foreground and background colors for the health bar independent of each other, and there is no way to color anything along a green-red gradient based on health. If you are using a third-party plugin, and you want me to know what it does so I can tell you how to emulate it in oUF_Phanx, you're going to have to actually post its name.)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 12-08-13 at 02:12 AM.
  Reply With Quote
12-08-13, 10:31 AM   #5
RooR
A Deviate Faerie Dragon
Join Date: May 2013
Posts: 19
yea thats how i want it i forgot to add im using grid2 so explaining it witt that example was pretty bad on my part. I did changed it "by health", do i have to add the line after a specific line. I tried it between different lines after the end prefix and above the "local color if UnitIsPlayer(unit) then" but when it corrupts it shows all indicators on the frame and when it doesnt it just wont do anything. Sry for bothering you

Code:
function ns.PostUpdateHealth(bar, unit, cur, max)
	if not UnitIsConnected(unit) then

		bar:SetStatusBarColor(unpack(config.healthColor))

		local color = colors.disconnected
		local power = bar.__owner.Power
		if power then
			power:SetValue(0)
			if power.value then
				power.value:SetText(nil)
			end

Last edited by RooR : 12-08-13 at 03:00 PM.
  Reply With Quote
12-08-13, 07:35 PM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I showed you where to add it...

Inside the function that starts with this:
Code:
function ns.PostUpdateHealth(bar, unit, cur, max)
There are lines that look like this:
Code:
	local color
	if UnitIsPlayer(unit) then
Right before them, add this:
Code:
	bar:SetStatusBarColor(unpack(config.healthColor))
If that is "corrupting" or otherwise breaking something, you're getting a Lua error. Copy and paste the error here. If you don't see one, that means you have the display of errors turned off; go turn it on under Interface Options > Help.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-08-13, 07:45 PM   #7
RooR
A Deviate Faerie Dragon
Join Date: May 2013
Posts: 19
Yea did that as first becasue thats what i read out of your post. Got an error Got several errors which one should i post ?

Code:
Message: Interface\AddOns\oUF_Phanx\Functions.lua:110: attempt to index global 'config' (a nil value)
Time: 12/09/13 02:43:02
Count: 1
Stack: [C]: ?
Interface\AddOns\oUF_Phanx\Functions.lua:110: in function <Interface\AddOns\oUF_Phanx\Functions.lua:84>
(tail call): ?
(tail call): ?
(tail call): ?
Interface\AddOns\oUF_Phanx\Functions.lua:541: in function <Interface\AddOns\oUF_Phanx\Functions.lua:517>

Locals:
Here the Health Function where i added it.

Code:
------------------------------------------------------------------------
--	Health
------------------------------------------------------------------------

function ns.PostUpdateHealth(bar, unit, cur, max)
	if not UnitIsConnected(unit) then

		local color = colors.disconnected
		local power = bar.__owner.Power
		if power then
			power:SetValue(0)
			if power.value then
				power.value:SetText(nil)
			end
		end
		bar:SetValue(0) -- 5.2: UnitHealth sometimes returns > 0 for dead units???
		return bar.value:SetFormattedText("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, PLAYER_OFFLINE)
	elseif UnitIsDeadOrGhost(unit) then
		local color = colors.disconnected
		local power = bar.__owner.Power
		if power then
			power:SetValue(0)
			if power.value then
				power.value:SetText(nil)
			end
		end
		bar:SetValue(0) -- 5.2: UnitHealth sometimes returns > 0 for dead units???
		return bar.value:SetFormattedText("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, UnitIsGhost(unit) and GHOST or DEAD)
	end

	bar:SetStatusBarColor(unpack(config.healthColor))

	local color
	if UnitIsPlayer(unit) then
		local _, class = UnitClass(unit)
		color = colors.class[class]
	elseif UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) then
		color = colors.tapped
	elseif UnitIsEnemy(unit, "player") then
		color = colors.reaction[1]
	else
		color = colors.reaction[UnitReaction(unit, "player") or 5] or colors.reaction[5]
	end

	-- HEALER: deficit, percent on mouseover
	-- OTHER:  percent, current on mouseover

	if cur < max then
		if ns.GetPlayerRole() == "HEALER" and UnitCanAssist("player", unit) then
			if bar.__owner.isMouseOver and not strmatch(unit, "party%d") then
				-- don't change text on party frames, it's annoying for click-cast or mouseover healing
				bar.value:SetFormattedText("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, si(UnitHealth(unit)))
			else
				bar.value:SetFormattedText("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, si(UnitHealth(unit) - UnitHealthMax(unit)))
			end
		elseif bar.__owner.isMouseOver then
			bar.value:SetFormattedText("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, si(UnitHealth(unit)))
		else
			bar.value:SetFormattedText("|cff%02x%02x%02x%d%%|r", color[1] * 255, color[2] * 255, color[3] * 255, floor(UnitHealth(unit) / UnitHealthMax(unit) * 100 + 0.5))
		end
	elseif bar.__owner.isMouseOver then
		bar.value:SetFormattedText("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, si(UnitHealthMax(unit)))
	else
		bar.value:SetText(nil)
	end
end

Last edited by RooR : 12-08-13 at 08:01 PM.
  Reply With Quote
12-08-13, 08:40 PM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Change "config" to "ns.config"
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-08-13, 10:39 PM   #9
RooR
A Deviate Faerie Dragon
Join Date: May 2013
Posts: 19
Worked flawlessly, thanks for your time and the awesome addons.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF phanx healthbar background


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