View Single Post
11-13-13, 11:47 PM   #89
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You do not need an OnUpdate script for anything you are doing. If you want to update when you enter/leave combat, register for the events that fire when you enter/leave combat in your OnLoad script:

Code:
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
However, it's probably more logical to just register for the events that fire when your stats change, so your panels will always update themselves when your stats change:

Code:
self:RegisterEvent("COMBAT_RATING_UPDATE")
self:RegisterEvent("MASTERY_UPDATE")
self:RegisterUnitEvent("UNIT_ATTACK", "player")
self:RegisterUnitEvent("UNIT_ATTACK_POWER", "player")
self:RegisterUnitEvent("UNIT_RANGED_ATTACK_POWER", "player")
self:RegisterUnitEvent("UNIT_RANGEDDAMAGE", "player")
self:RegisterUnitEvent("UNIT_RESISTANCES", "player")
self:RegisterUnitEvent("UNIT_SPELL_HASTE", "player")
self:RegisterUnitEvent("UNIT_STATS", "player")
Not all stats need all events, so feel free to tailor the list for the stat(s) your panel(s) is/are actually using, though just leaving all the events shouldn't have any noticable impact.
__________________
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