Download
(4 Kb)
Download
Updated: 10-18-10 01:00 PM
Addon for:
oUF.
Pictures
File Info
Updated:10-18-10 01:00 PM
Created:unknown
Downloads:27,215
Favorites:168
MD5:
oUF Debuff Highlight  Popular! (More than 5000 hits)
Version: r50-release
by: Ammo [More]
This is an addon that adds Debuff Highlighting to the oUF unitframes.

Whenever a unit has a debuff it will highlight the frame in the debuff color. This can be done either on
the unitframe background or a specially created frame for the task.

To use this in your oUF layout you will need one of the following:

Code:
self.DebuffHighlightBackdrop = true
This will let oUF_DebuffHighlight know to use the backdrop for debuff highlighting. The original color and alpha
of the backdrop and backdrop border will be stored and whenever the unit needs highlighting it will color the
backdrop and backdrop border in corresponding color and set the alpha. When the debuff is gone the original
color and alpha will be restored.

The other option to add Debuff Highlighting is to provide a texture (or other UI type that supports :SetVertexcolor)
on your unit frame.

Code:
local dbh = self:CreateTexture(nil, "OVERLAY")
dbh:SetAllPoints(self)
dbh:SetTexture("SomeKindOfTexturepath")
dbh:SetBlendMode("ADD")
dbh:SetVertexColor(0,0,0,0) -- set alpha to 0 to hide the texture
self.DebuffHighlight = dbh
Be warned, your healthbar is probably the best place to create a full glow texture:
Code:
local dbh = hp:CreateTexture(nil, "OVERLAY")
Because all your unit UI elements will be covering your unitframe (self) most likely.

This frame will now be used with :SetVertexColor() to highlight debuffs.

You can control the alpha of the debuff highlight on backdrop or debuffhighlight frame by setting:

Code:
self.DebuffHighlightAlpha = .5
The default value is .5 for the highlight frame and 1 for the backdrop.

If you only want to highlight debuffs that you can cure:

Code:
self.DebuffHighlightFilter = true
This is off by default.

If you want to use the actual texture of the debuff to show instead of coloring the frame do the following:

Create the self.DebuffHighlight texture and positionit, make sure it's visible (alpha not set to 0):

Code:
local dbh = hp:CreateTexture(nil, "OVERLAY")
dbh:SetWidth(32)
dbh:SetHeight(32)
dbh:SetPoint("CENTER", self, "CENTER")
self.DebuffHighlight = dbh
And set:

Code:
self.DebuffHighlightUseTexture = true

Enjoy

-Ammo
r50-release
- fix proper debuff color per class thanks elv22

r48-release
- 4.0 toc
- add option to only color backdropborder or backdrop or backdrop&border

r44-release
- 3.1 compatible release

r41-release
- fixes for nil errors now uses AddElement

r36-release
- Wotlk update

r79326
- Update for latest oUF

r72358
- Fixes issue with not highlighting a debuff if all previous debuffs had no type.

r72075
- Fix debuffhighlight not working for units that don't have buffs/debuff display enabled
- Add support for using the debuff icon texture instead of coloring a frame

r72066
- Only highlight units that the player can interact with for curing

r72056
- Initial upload to wowinterface
Archived Files (4)
File Name
Version
Size
Author
Date
r48-release
3kB
Ammo
10-16-10 08:06 AM
r44-release
3kB
Ammo
04-30-09 05:12 AM
r41-release
4kB
Ammo
01-06-09 07:00 AM
r36-release
4kB
Ammo
12-23-08 05:48 AM


Post A Reply Comment Options
Unread 06-26-09, 09:11 AM  
Ammo
Premium Member
AddOn Author - Click to view AddOns

Forum posts: 17
File comments: 137
Uploads: 26
Originally posted by NarusegawaNaru
Hi, thanks anyway. I duplicated the addon, did a search replace on "DebuffHighlight" for "HOTHightlight" and then just changed your UnitAura's checking to only check for specific spells, and force a single color.

I then just added it to my layout, so I use 1 overlay texture for debuffs, and a second one (that doesn't overlap with the debuff one) for the HOT one. :-)

Thanks for this addon though. ^_^
Ah yeah, woops. I was thinking combatfeedback when I answered, sorry Your solution is the way to go

-Ammo
Ammo is offline Report comment to moderator  
Reply With Quote
Unread 08-24-09, 02:30 AM  
Subere
A Cyclonian
AddOn Author - Click to view AddOns

Forum posts: 41
File comments: 22
Uploads: 1
Has anyone had any issues getting this working lately with the Pitbull-esque glow texture?

I tried messing around for a bit with no success, though verifying the texture was loaded and in the proper place. I also tried installing Ammo's layout just to see if it worked and had no luck.
Subere is offline Report comment to moderator  
Reply With Quote
Unread 09-11-09, 01:07 PM  
Xark
A Deviate Faerie Dragon

Forum posts: 14
File comments: 63
Uploads: 0
hey

sry, i am a total lua noob.... in which file i have to put "self.DebuffHighlightFilter = true" for filtering the debuffs?

thx xark
Xark is offline Report comment to moderator  
Reply With Quote
Unread 10-17-10, 10:45 AM  
Elv22
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 6
File comments: 485
Uploads: 6
Update

Hi there, I went ahead and updated this myself when I was on the PTR, because some classes like paladin, shaman, druid don't get dispel magic unless they are a healer spec, this can cause the debuff highlight to become inaccurate. I went ahead and made it so we check everytime you fill in new talent points, respec, ect.. it checks if you have a certain talent point in your spec in order to show magic for a few select classes.

Paladin: You need Sacred Cleansing
Shaman: You need Improved Cleanse Spirit
Druid: You need natures cure

Code:
if not oUF then return end
 
local playerClass = select(2,UnitClass("player"))
local CanDispel = {
	PRIEST = { Magic = true, Disease = true, },
	SHAMAN = { Magic = false, Curse = true, },
	PALADIN = { Magic = false, Poison = true, Disease = true, },
	MAGE = { Curse = true, },
	DRUID = { Magic = false, Curse = true, Poison = true, }
}
local dispellist = CanDispel[playerClass] or {}
local origColors = {}
local origBorderColors = {}
local origPostUpdateAura = {}
 
local function GetDebuffType(unit, filter)
	if not UnitCanAssist("player", unit) then return nil end
	local i = 1
	while true do
		local _, _, texture, _, debufftype = UnitAura(unit, i, "HARMFUL")
		if not texture then break end
		if debufftype and not filter or (filter and dispellist[debufftype]) then
			return debufftype, texture
		end
		i = i + 1
	end
end

-- Return true if the talent matching the name of the spell given by (Credit Pitbull4)
-- spellid has at least one point spent in it or false otherwise
function CheckForKnownTalent(spellid)
	local wanted_name = GetSpellInfo(spellid)
	if not wanted_name then return nil end
	local num_tabs = GetNumTalentTabs()
	for t=1, num_tabs do
		local num_talents = GetNumTalents(t)
		for i=1, num_talents do
			local name_talent, _, _, _, current_rank = GetTalentInfo(t,i)
			if name_talent and (name_talent == wanted_name) then
				if current_rank and (current_rank > 0) then
					return true
				else
					return false
				end
			end
		end
	end
	return false
end

local function CheckSpec(self, event, levels)
	-- Not interested in gained points from leveling	
	if event == "CHARACTER_POINTS_CHANGED" and levels > 0 then return end
	
	--Check for certain talents to see if we can dispel magic or not
	if playerClass == "PALADIN" then
		--Check to see if we have the 'Sacred Cleansing' talent.
		if CheckForKnownTalent(53551) then
			dispellist.Magic = true
		else
			dispellist.Magic = false	
		end
	elseif playerClass == "SHAMAN" then
		--Check to see if we have the 'Improved Cleanse Spirit' talent.
		if CheckForKnownTalent(77130) then
			dispellist.Magic = true
		else
			dispellist.Magic = false	
		end
	elseif playerClass == "DRUID" then
		--Check to see if we have the 'Nature's Cure' talent.
		if CheckForKnownTalent(88423) then
			dispellist.Magic = true
		else
			dispellist.Magic = false	
		end
	end
end
 
local function Update(object, event, unit)
	if object.unit ~= unit  then return end
	local debuffType, texture  = GetDebuffType(unit, object.DebuffHighlightFilter)
	if debuffType then
		local color = DebuffTypeColor[debuffType]
		if object.DebuffHighlightBackdrop then
			object:SetBackdropColor(color.r, color.g, color.b, object.DebuffHighlightAlpha or 1)
		elseif object.DebuffHighlightUseTexture then
			object.DebuffHighlight:SetTexture(texture)
		else
			object.DebuffHighlight:SetVertexColor(color.r, color.g, color.b, object.DebuffHighlightAlpha or .5)
		end
	else
		if object.DebuffHighlightBackdrop then
			local color = origColors[object]
			object:SetBackdropColor(color.r, color.g, color.b, color.a)
			color = origBorderColors[object]
			object:SetBackdropBorderColor(color.r, color.g, color.b, color.a)
		elseif object.DebuffHighlightUseTexture then
			object.DebuffHighlight:SetTexture(nil)
		else
			local color = origColors[object]
			object.DebuffHighlight:SetVertexColor(color.r, color.g, color.b, color.a)
		end
	end
end
 
local function Enable(object)
	-- if we're not highlighting this unit return
	if not object.DebuffHighlightBackdrop and not object.DebuffHighlight then
		return
	end
	-- if we're filtering highlights and we're not of the dispelling type, return
	if object.DebuffHighlightFilter and not CanDispel[playerClass] then
		return
	end
 
	-- make sure aura scanning is active for this object
	object:RegisterEvent("UNIT_AURA", Update)
	object:RegisterEvent("PLAYER_TALENT_UPDATE", CheckSpec)
	object:RegisterEvent("CHARACTER_POINTS_CHANGED", CheckSpec)
	
	if object.DebuffHighlightBackdrop then
		local r, g, b, a = object:GetBackdropColor()
		origColors[object] = { r = r, g = g, b = b, a = a}
		r, g, b, a = object:GetBackdropBorderColor()
		origBorderColors[object] = { r = r, g = g, b = b, a = a}
	elseif not object.DebuffHighlightUseTexture then -- color debuffs
		-- object.DebuffHighlight
		local r, g, b, a = object.DebuffHighlight:GetVertexColor()
		origColors[object] = { r = r, g = g, b = b, a = a}
	end
 
	return true
end
 
local function Disable(object)
	if object.DebuffHighlightBackdrop or object.DebuffHighlight then
		object:UnregisterEvent("UNIT_AURA", Update)
		object:UnregisterEvent("PLAYER_TALENT_UPDATE", CheckSpec)
		object:UnregisterEvent("CHARACTER_POINTS_CHANGED", CheckSpec)
	end
end
 
oUF:AddElement('DebuffHighlight', Update, Enable, Disable)
 
for i, frame in ipairs(oUF.objects) do Enable(frame) end
Last edited by Elv22 : 10-17-10 at 10:47 AM.
Elv22 is offline Report comment to moderator  
Reply With Quote
Unread 10-17-10, 11:37 AM  
drakull
A Cyclonian
 
drakull's Avatar
AddOn Author - Click to view AddOns

Forum posts: 49
File comments: 58
Uploads: 1
The "CanDispel" table is not updated to 4.0.
Code:
local CanDispel = {
	PRIEST = { Magic = true, Disease = true, },
	SHAMAN = { Poison = true, Disease = true, Curse = true, },
	PALADIN = { Magic = true, Poison = true, Disease = true, },
	MAGE = { Curse = true, },
	DRUID = { Curse = true, Poison = true, }
}
I think this is the right one for 4.0:
Code:
local CanDispel = {
	PRIEST = { Magic = true, Disease = true },
	SHAMAN = { Magic = true, Curse = true },
	PALADIN = { Magic = true, Poison = true, Disease = true },
	MAGE = { Curse = true },
	DRUID = { Magic = true, Curse = true, Poison = true }
}
Great addon btw.

Edit: took too long to post. Elv22 was faster.
Last edited by drakull : 10-17-10 at 11:39 AM.
drakull is offline Report comment to moderator  
Reply With Quote
Unread 10-28-10, 04:36 AM  
monkie
A Kobold Labourer

Forum posts: 0
File comments: 1
Uploads: 0
I currently have borders around my health and power frames. For some reason the backdrop/backdrop border doesn't get highlighted properly and sometimes don't show up at all. But if i get rid of the borders it works fine. Any help would be appreciated. Thx
monkie is offline Report comment to moderator  
Reply With Quote
Unread 11-17-10, 03:44 AM  
Ammo
Premium Member
AddOn Author - Click to view AddOns

Forum posts: 17
File comments: 137
Uploads: 26
Originally posted by monkie
I currently have borders around my health and power frames. For some reason the backdrop/backdrop border doesn't get highlighted properly and sometimes don't show up at all. But if i get rid of the borders it works fine. Any help would be appreciated. Thx
might be a bug on my side or something weird on your side could you provide a link to your oUF layou?
Ammo is offline Report comment to moderator  
Reply With Quote
Unread 11-23-10, 10:27 PM  
Xposed
A Kobold Labourer

Forum posts: 0
File comments: 5
Uploads: 0
Quick question..
Does it matter what unitframe your using? Also, i'm new at this but what do you do to make the health frame light up when a debuff is on you?
Xposed is offline Report comment to moderator  
Reply With Quote
Unread 12-15-10, 07:18 AM  
drakull
A Cyclonian
 
drakull's Avatar
AddOn Author - Click to view AddOns

Forum posts: 49
File comments: 58
Uploads: 1
Originally posted by monkie
I currently have borders around my health and power frames. For some reason the backdrop/backdrop border doesn't get highlighted properly and sometimes don't show up at all. But if i get rid of the borders it works fine. Any help would be appreciated. Thx
Yeah, it used to work just fine but since cata went live I've seeing some weird behaviours. Sometimes the debuffhighlight texture shows up with wrong colors (red or white mostly) and sometimes it does not shows at all.

Here's the code for my layout's raid frame:
lua Code:
  1. if IsAddOnLoaded("oUF_DebuffHighlight") then
  2.     local dbh = self.Health:CreateTexture(nil, "OVERLAY")
  3.     dbh:SetAllPoints(self.Health)
  4.     dbh:SetTexture(cfg.glowTexture)
  5.     dbh:SetBlendMode("ADD")
  6.     dbh:SetVertexColor(0,0,0,0) -- set alpha to 0 to hide the texture
  7.     self.DebuffHighlight = dbh
  8.     self.DebuffHighlightAlpha = 0.8
  9.     self.DebuffHighlightFilter = true
  10. end
Last edited by drakull : 12-15-10 at 07:27 AM.
drakull is offline Report comment to moderator  
Reply With Quote
Unread 02-27-11, 04:37 AM  
ylarion
A Defias Bandit

Forum posts: 3
File comments: 27
Uploads: 0
On a german client i cannot get my resto shaman to highlight magic debuffs. If i change the value in the CanDispel to true it works, but somehow the Talentcheck doesnt seem to work.
ylarion is offline Report comment to moderator  
Reply With Quote
Unread 03-02-11, 04:27 PM  
memnoch
A Kobold Labourer

Forum posts: 1
File comments: 17
Uploads: 0
I would guess the first is correct. Each class doesn't list every ailment. The ones that have falses have talents associated with adding the ability to cure that particular ailment.

Originally posted by drakull
The "CanDispel" table is not updated to 4.0.
Code:
local CanDispel = {
	PRIEST = { Magic = true, Disease = true, },
	SHAMAN = { Poison = true, Disease = true, Curse = true, },
	PALADIN = { Magic = true, Poison = true, Disease = true, },
	MAGE = { Curse = true, },
	DRUID = { Curse = true, Poison = true, }
}
I think this is the right one for 4.0:
Code:
local CanDispel = {
	PRIEST = { Magic = true, Disease = true },
	SHAMAN = { Magic = true, Curse = true },
	PALADIN = { Magic = true, Poison = true, Disease = true },
	MAGE = { Curse = true },
	DRUID = { Magic = true, Curse = true, Poison = true }
}
Great addon btw.

Edit: took too long to post. Elv22 was faster.
memnoch is offline Report comment to moderator  
Reply With Quote
Unread 03-02-11, 04:40 PM  
ylarion
A Defias Bandit

Forum posts: 3
File comments: 27
Uploads: 0
And these talent checks do not work currently for me (german client)
ylarion is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: