View Single Post
07-23-13, 02:52 PM   #15
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Niketa View Post
I was thinking to reduce some of the variables could I register the LOOT_OPENED event to a new frame if the CLEU finds a match like I do to enable the functionality for only raid leaders anyway? Or is having too many different event handler frames bad practice?
There's no reason to create multiple frames to handle events. It's trivial to handle multiple events on the same frame. If you can explain better why you think this would be needed or useful, or why you think your current code can't handle this, then we can be more specific, but in general, it's not needed or useful.

Originally Posted by Niketa View Post
I have my CLEU if statement dependent on UnitAffectingCombat("player") too.
You should really just post your entire, actual code. Posting only random snippets out of context just leads to confusion, frustration, and wasted time for everyone.

That said, checking UnitAffectingCombat every time CLEU fires is really wasteful. If you only want to respond to CLEU events while you're in combat, then you should only register for the CLEU event while you're in combat. Instead of registering for CLEU right away, register for PLAYER_REGEN_DISABLED and PLAYER_REGEN_ENABLED instead. When PLD fires, that means you entered combat, so register CLEU. When PRE fires, that means you left combat, so unregister CLEU. This way, you frame will simply not receive CLEU events when you don't want them.
__________________
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