Can we get Global Cooldown time info for our spells/abilitys/itmes?
I would like to enhance spells, abilitys and itmes tooltips with information about their Global Cooldown (GC), and get GC time (if i'm right GC depends of haste and for monks GC time cut, so it's not static value).
And then I would like to add GC countdown timer near Player Portrait and if possible even on Enemy Player Target Portrait (but that part could be tricky and not accurate because of ping and unknown haste). Accordion to this article's comments: http://www.wowhead.com/spell=61304/global-cooldown we can get GC info right after we use an ability, with this code for example: Lua Code:
Lua Code:
As well, there are some debuffs that makes your GC time, very long, and i would like to dynamically update tooltips as well. Could you please give my your thoughts, and advises how I can make it most effective, stable and optimized, and how can i build such a table (how can I run GetSpellCooldown(index) right after spell/ability/item cast with correct index and add it's data to my table)? |
Well, assuming you only care about your own spells, then rather than hand-maintaining a list of spells that are on the GCD, you can just scan the spellbook for spells with a cooldown, and assume everything else is on the GCD:
lua Code:
lua Code:
lua Code:
Note that the ID and name from the GetSpellBookItem* functions may not be the real ID and/or name of the spell, in cases where the spell changes based on spec, talents, or other conditions. Doing a reverse lookup on the provided name with GetSpellInfo will get you correct information at any given time. Then to get the actual GCD time, you only need to look at the current cooldown of one spell; it doesn't matter which one, so the above code just picks one basically at random. If you only need to know the GCD at any given moment, and don't need a list of spells, it's even easier: lua Code:
Items are slightly trickier, but as long as you know the GCD you can just compare the cooldown of the item to find out if the item is on the GCD or has its own cooldown. You could alternatively use tooltip parsing but that may not always be accurate. Trying to guess the GCD of enemy players is probably a lost cause. |
All times are GMT -6. The time now is 09:43 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI