Thread Tools Display Modes
01-20-11, 05:48 AM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Help needed generating raid debuff icon

What I want to achieve is this


UNIT_AURA
http://wowprogramming.com/docs/api/UnitAura
http://www.wowwiki.com/API_UnitAura

Blizzard informations (3.3.0)
As great as having source ids on this is, it'd be really nice to be able to get the same ids
from UnitAura(). I get no end of complaints about how the vehicle debuffs aren't showing as theirs.
While I haven't seen the vehicle fights in Ulduar yet, if they're anything like the Malygos fight
I"m sure I won't stop hearing this complaint.

I know this is sorta a wish list thing but it does seem like a natural progression of giving us
that info with the combat log that the UI should be able to have access to it for usage by frames.

With this in mind, we're making the following change to UnitAura, UnitBuff, and UnitDebuff:

name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable = UnitAura("unit", index or ["name", "rank"][, "filter"]) name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable = UnitBuff("unit", index or ["name", "rank"][, "filter"]) name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable = UnitDebuff("unit", index or ["name", "rank"][, "filter"])

The isMine return value has been changed to caster, where caster is the unit token of the unit that applied the aura. This works for all unit tokens, including "pet" and its incarnations, "focus", and "target".

Most importantly, if the aura was applied by a unit that does not have a token (for instance, a vehicle) but is controlled by one that does (the player), this function will return the token of the unit's controller. In other words, if I'm a shaman and I cast Totem of Wrath, which applies the Totem of Wrath buff, the buff will return the "player" token as its caster unit because totems don't have their own unit tokens.

Auras will also be sorted by the game code in a similar fashion such that the first n auras returned by the unit aura functions will be auras applied by either the player or a unit the player controls or owns (e.g. vehicles, pets, totems).

EDIT: I previously stated the "caster" return for the new UnitAura functions could not be an arena unit token. This is incorrect. The new UnitAura functions will return "arena" tokens when appropriate.
Everything is done except the aura icon display.

What I want is display a maximum of one debuff icon per raid member.

Debuffs that can be dispelled will make the frame glow in debuff color, that is enough for me I think.

But I'm looking for a solution to track raid unit aura icons that fullfill the following conditions:
- debuff
- casted something that is not a player
- duration < 30 seconds

I don't want to work with a debuff table list but if nothing else is helpful a whitelist is the only solution I can think of. Maybe it is the best solutuin anyway.

I know some of you tried sth like that already. Maybe we can share some ideas.

My current idea is to grab all the possible auras find the caster and check for UnitIsPlayer(caster). This should give me all possible aura icons that I can collect in a table.

But how is the way from having that table to displaying the icon? At first I thought I could do this with the default oUF functions but I think it is better to register the UNIT_AURA event myself and do the check internal.

Some suggestions are welcome.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 01-20-11 at 05:56 AM.
  Reply With Quote
01-20-11, 06:10 AM   #2
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
On enable create aura frame for each unit -> position/style, register function to UNIT_AURA with a while loop checking UnitAura, if aura info meets conditions -> update icon/border -> show. Good game?
  Reply With Quote
01-20-11, 11:43 AM   #3
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
IMHO, a whitelist is the easiest and most bulletproof way. Bulletproof, mainly in terms of being most exact and easily adjustable.

I'm not sure why you want to avoid a whitelist TABLE but "grab all the possible auras find the caster ... in a TABLE". Especially not with all the additional checking of conditions you want going on.

You don't need conditions, if you just check for a few white-listed auras, only.

You could check out my layout (slim preferably, nivea's is a little less up to date) if you need a whitelist to start with.

note: I'm using the same table for buffs and debuffs, since I also use it to filter party and arena frames. It also contains PvP related auras. You could easily strip those of for an even shorter list, though.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
01-21-11, 01:33 PM   #4
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Thx.

Result:


Code-Snippets:

CONFIG
lua Code:
  1. --RAID
  2.     raid = {
  3.       auras = {
  4.         --put every single spellid here that you want to be tracked, be it buff or debuff doesn't matter
  5.         --maximum number of icons displayed at a time = 1
  6.         --this is for important boss mechanics only, this is not for tracking healing HOTs etc
  7.         spelllist = {          
  8.           --test
  9.           32407,                    
  10.           --CATACLYSM RAIDS                    
  11.           --maloriak
  12.           92980, --ice bomb
  13.           77786, --red phase consuming flames          
  14.         },
  15.         show            = true,
  16.         disableCooldown = true,
  17.         showBuffType    = false,
  18.         showDebuffType  = false,
  19.         size            = 20,
  20.       },
  21.  
  22.     },



FUNCTIONS

lua Code:
  1. --fill the whitelist table automatically with all the spellids
  2.   local whitelist = {}
  3.   for i,spellid in pairs(cfg.units.raid.auras.spelllist) do
  4.     local spell = GetSpellInfo(spellid)
  5.     if spell then whitelist[spell] = true end
  6.     --if spell then table.insert(whitelist,spell,true) end
  7.   end
  8.  
  9.   --custom aura filter
  10.   local customFilter = function(icons, unit, icon, name, rank, texture, count, dtype, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID)
  11.     if(whitelist[name]) then return true end
  12.   end
  13.  
  14.   --create aura func
  15.   local createAuras = function(self)
  16.     local f = CreateFrame("Frame", nil, self)
  17.     f.size = self.cfg.auras.size
  18.     f.num = 1
  19.     f:SetHeight(f.size)
  20.     f:SetWidth(f.size)
  21.     f:SetPoint("CENTER", self, "CENTER", 0, 0)
  22.     f.initialAnchor = "TOPLEFT"
  23.     f["growth-x"] = "RIGHT"
  24.     f["growth-y"] = "DOWN"
  25.     f.spacing = -f.size
  26.     f.disableCooldown = self.cfg.auras.disableCooldown
  27.     f.showDebuffType  = self.cfg.auras.showDebuffType
  28.     f.showBuffType    = self.cfg.auras.showBuffType
  29.     f.CustomFilter = customFilter
  30.     self.Auras = f
  31.   end
  32.  
  33.   --aura icon func
  34.   local createAuraIcon = function(icons, button)
  35.     local bw = button:GetWidth()
  36.     if button.cd then
  37.       button.cd:SetPoint("TOPLEFT", 1, -1)
  38.       button.cd:SetPoint("BOTTOMRIGHT", -1, 1)
  39.       button.count:SetParent(button.cd)
  40.     end
  41.     button.count:ClearAllPoints()
  42.     button.count:SetPoint("TOPRIGHT", 4, 4)
  43.     button.count:SetTextColor(0.9,0.9,0.9)
  44.     button.count:SetFont(cfg.font,bw/1.8,"THINOUTLINE")
  45.     button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
  46.     button.overlay:SetTexture("Interface\\AddOns\\rTextures\\aura_square")
  47.     button.overlay:SetTexCoord(0,1,0,1)
  48.     button.overlay:SetPoint("TOPLEFT", -1, 1)
  49.     button.overlay:SetPoint("BOTTOMRIGHT", 1, -1)
  50.     button.overlay:SetVertexColor(0,0,0,1)
  51.     button.overlay:Show()
  52.     button.overlay.Hide = function() end  
  53.  
  54.   end

CALL
lua Code:
  1. --auras
  2.     if self.cfg.auras.show then
  3.       createAuras(self)      
  4.       self.Auras.PostCreateIcon = createAuraIcon
  5.     end

If more that one aura is found at a time they will overlay each other.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
01-21-11, 07:02 PM   #5
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
I used the following to colour the unit frame backdrop and/or display a debuff icon:

https://github.com/Evilpaul/oUF_EP/b...fHighlight.lua

I configured the raid frames to highlight the backdrop for all debuff types, but to only show icons that the current character could remove.

backdrop: https://github.com/Evilpaul/oUF_EP/b...common.lua#L62
icon: https://github.com/Evilpaul/oUF_EP/b...EPRaid.lua#L32


Feel free to grab any of the code you may find useful.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Help needed generating raid debuff icon


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