WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Ignoring global cooldown (https://www.wowinterface.com/forums/showthread.php?t=59654)

Benalish 08-25-23 12:43 PM

Ignoring global cooldown
 
Greetings,
I've created an icon that lights up when a spell is ready to use. Sometimes though, the icon blinks (disappears for a moment): I think it's a problem due to the global cooldown. I tried to work around this problem like this:

Lua Code:
  1. local usable, _ = IsUsableSpell(spellName)
  2. local start, duration = GetSpellCooldown(spellName)
  3. local ignore, gcd = GetSpellCooldown(61304)
  4. if (usable) then
  5.      if (duration == 0 and (start < ignore)) or (duration <= gcd) then --ignore global cooldown
  6.           --show icon
  7.      end
  8. else --hide icon
  9. end

Is there a better method?

Benalish 09-07-23 11:48 AM

I'll try to explain better with an example:
- Immolate is active on the target
Lua Code:
  1. usable == true
- The conflagrate is ready
Lua Code:
  1. duration == 0
- I cast Incinerate, and the icon is displayed
- But if I try to cast Incinerate while another Incinerate is in progress, the icon disappears
I wish this last step didn't happen

Can you help me?

Fizzlemizz 09-08-23 11:08 AM

Maybe something along the lines of:

Lua Code:
  1. local usable, _ = IsUsableSpell(spellName)
  2. local start, duration = GetSpellCooldown(spellName)
  3. local ignore, gcd = GetSpellCooldown(61304)
  4. if (usable) then
  5.      if (duration == 0 and (start < ignore)) or (duration <= gcd) then --ignore global cooldown
  6.           --show icon
  7.           Frame.endTime = start + duration
  8.      end
  9. else
  10.       if not Frame.endTime or Frame.endTime <= GetTime() then
  11.           Frame:Hide() -- only if it's not still ticking
  12.       end
  13. end

Benalish 09-09-23 12:58 PM

Perfect!
There's a better method to ignore global cooldown than this?

iLua Code:
  1. if (duration == 0 and (start < ignore)) or (duration <= gcd)

Fizzlemizz 09-09-23 01:28 PM

There is no built in IsOnGCD(...) test so you have to "roll-your-own".


All times are GMT -6. The time now is 03:24 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI