Thread Tools Display Modes
08-11-14, 02:23 AM   #1
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
08-11-14, 10:57 AM   #2
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 223
Originally Posted by Phanx View Post
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
Had a brain fart as I was in a hurry to leave, that is what I was trying to point out. And yes, in my haste I used AND instead of OR.
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » casting bar: attempt to perform arithmetic


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