View Single Post
11-01-08, 09:27 AM   #5
lieandswell
A Cyclonian
 
lieandswell's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 45
Originally Posted by HyperGig View Post
This can't be the best way to do this right?
You used to have to use OnUpdate to make sure you always had the right time, especially for when buffs got refreshed, but it's not necessary anymore. There is a different way.

You can use an OnEvent function to call UnitBuff whenever any of the SPELL_AURA events in COMBAT_LOG_EVENT_UNFILTERED match the buff/unit you're looking for. Use that to set the duration and time left on the status bar. Then, have an OnUpdate that makes the bar smaller according to its own internal time counter using the local timeElapsed value supplied by OnUpdate. Whenever some adustment needs to happen -- the buff gets dispelled or refreshed, for example -- the OnEvent will re-calibrate the bar.

I hope that makes sense. It sounds more complicated, and does require more coding, but it's less work for the cpu overall because you're only doing math on local variables in the OnUpdate function. Blizz even said on the WoW UI forums that calling UnitBuff in an OnUpdate would probably be too much of a performance hit.
  Reply With Quote