Casters Classcolor.
Hey fellow Wowiers!
Im currently tracking buffs and debuffs on my raidframes, i would like to try and have my bufficons border colored by the class it is cast from, if that makes sense. Currently the part of the code looks like this were i color the border.. Lua Code:
Tried a couple things but getting errors and my lua knowledge is very limited..have a feeling i need to get this to work with the color function somehow? Lua Code:
Im probably really off here and it makes me feel really dumb :P.. so if anyone could point me in the right direction i'd be thankful! EDIT: If you need more code to be able to help out let me know! thank you. |
You want sth like this.
Lua Code:
Which function you need to call depends on how you created your aura icons. If you used self.Buffs you use postUdateBuff ... etc. Regarding UnitAura check: http://wowprogramming.com/docs/api/UnitAura For the oUF documentation on auras read: https://github.com/haste/oUF/wiki/element---auras I'm currently not sure. It may actually be possible to work with CreateAura instead of PostUpdateIcon because you can extract the unit from element:GetParent().unit. That would look like this for Auras: Lua Code:
The benefit is that CreateIcon is only used once. But I'm not sure if it is sufficient (means if it is called each time a new aura is created, even if an aura existed already for the same index) |
Thanks for the elaborate answer Zork, i really appreciate it!
I'll play around with it and see if i can get it working! :) If it's of any help to easier get this working in my current code, i use oUF_Mlight's way to track auras.. which is based of oUF_Freebgrid. https://github.com/Paojy/oUF_Mlight/...eds/auras2.lua Thanks again! :) |
You have to use PostUpdate as CreateIcon won't update the border color.
You could use the same code as proposed by Zork for Buffs/Debuffs/Auras like that: Code:
local postUpdateAura = function(element, unit, button, index, offset) |
Thanks for the info guys!
What confuses me the most is the structure i have i guess... I can get this to work with my buffs/debuffs that i use for all my UF's but raidframes because i use a different structure there with spellID's and stuff. Now i have a file called auras (this is debuffs on my raidframes) and a file called auras2 (these are buffs on my raidframes). I spawn them in my core layout with Lua Code:
Most of the confusion is if i add the postupdate function in my core or in my aura files? I tried both, im not getting any errors, but the frames are just not being colored(white). Thanks for being awesome. |
I only overflew the code for oUF_Mlight. What you linked in your post is apparently some custom aura element for tank buffs. There is another one for raid debuffs I suppose and the standard oUF auras element in core.lua. I suppose you don't need to change the first two and only want the alter the behavior of the default aura element.
In that case you'll want to change PostUpdateIcon like that: Code:
local PostUpdateIcon = function(icons, unit, icon, index, offset) |
Quote:
Code:
self.freebAuras.PostUpdateIcon = postUpdateAura |
Thanks, im getting somewhere thanks to all your great help! :)
It is kind of working now but i am unfortunately getting errors when trying lfr, haven't had time to test it more... but i've had a full lfr with no error aswell. Mostly i can say that when entering Gara'jals spiritrealm i always got errors. This is how i added it Lua Code:
The error is pointing at Lua Code:
and also this part in oUF\events.lua Lua Code:
Any hints on what the cause might be, because that error doesn't tell me that much im afraid :( |
What is the actual error message?
|
oh, how how can i forget to mention that im sorry :o
Lua Code:
|
caster can be nil if the aura wasn't applied by a unit, or if the unit that applied it does not currently have a valid unit token. Just add a check to make sure caster is non-nil before proceeding with the class lookup.
|
All times are GMT -6. The time now is 08:43 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI