View Single Post
09-28-16, 07:18 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
UNIT_AURA fires for all valid units, not just the player. The unit it fires for will be the first argument past the event name itself, and you should check if it is the unit you wish to watch for.

A better method would be to register the event specifically for the player, using
Lua Code:
  1. textframe:RegisterUnitEvent("UNIT_AURA", "player")
Then your addon will only be notified when it fires for your player.
http://wow.gamepedia.com/API_Frame_RegisterUnitEvent

Also, you don't need to use HookScript for a frame that you've created. You know which scripts are set to it, which aren't, and what they do. HookScript is good when dealing with other addons' (or the default UI's) frames when you don't want to overwrite (or possibly overwrite) what scripts are already present.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote