Thread Tools Display Modes
08-25-23, 12:43 PM   #1
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 122
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?

Last edited by Benalish : 08-25-23 at 02:07 PM.
  Reply With Quote
09-07-23, 11:48 AM   #2
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 122
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?
  Reply With Quote
09-08-23, 11:08 AM   #3
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,813
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
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
09-09-23, 12:58 PM   #4
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 122
Perfect!
There's a better method to ignore global cooldown than this?

iLua Code:
  1. if (duration == 0 and (start < ignore)) or (duration <= gcd)
  Reply With Quote
09-09-23, 01:28 PM   #5
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,813
There is no built in IsOnGCD(...) test so you have to "roll-your-own".
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Ignoring global cooldown

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off