View Single Post
08-11-14, 02:23 AM   #15
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by SDPhantom View Post
I try to include target if you happen to be targeting yourself. Same with including focus if you have focus on yourself. With varying extents, this is what UnitIsUnit() is checking for.
There's no reason to check UnitIsUnit here. If you're targeting yourself and cast a spell, then you'll get two events for the same spellcast -- one for the "player" unit, and one for the "target" unit. In this case, though, you only want to run your function once per spellcast (since you're not modifying the target castbar too) so you should just ignore the event for the "target" unit.

Code:
if unit ~= "player" or unit ~= self.unit then return end
__________________
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