CDM: Change cd ready glow function to also check for is spell usable#454
CDM: Change cd ready glow function to also check for is spell usable#454JuJuFX-dev wants to merge 2 commits into
Conversation
|
hey! this is awesome and i really appreciate it, but while functional it has performance impacts that i'm not willing to compromise on at this time. Unconditional polling like this is something I try to avoid at all costs unless the feature is absolutely essential. if you can find a way to do this without impacting performance then I would be happy to add it! |
|
hey! thank you for the feedback. I will start working on a less performance impacting solution and come back to you asap. |
… showing wrong glows
Hey, I just uploaded a new version with performance improvements and an improved function for the check. Feel free to check it out. If I get some more time, I’ll keep working on it and see if there’s still room for further optimization. |
Summary
The CD Ready Glow (
pixelGlowReady/buttonGlowReady) previously activatedwhenever a spell came off cooldown, regardless of whether the player had enough
resources to cast it. This caused the glow to fire even when e.g. Fury was too
low, which was misleading.
Changes
EllesmereUICdmHooks.luaonly — two targeted edits, no other changes.1. Deferred
IsSpellUsablecheck on CD state change (SetDesaturated hook)The existing
pixelGlowReady/buttonGlowReadyblock now uses the sameone-frame defer pattern already used by
hiddenOnCD/hiddenReadyabove it.C_Spell.IsSpellUsable()is called one frame afterSetDesaturatedfires,once the API has settled out of Blizzard's secure CDM chain. The glow only
starts if the spell is both off cooldown and usable.
2. Resource polling in the BuffTicker (10 Hz)
SetDesaturatedonly fires on cooldown state changes, not when resources drainmid-fight (e.g. Fury falling below spell cost between casts). A lightweight
IsSpellUsablepoll has been added to the existing BuffTicker loop, directlyafter the existing stale
_activeGlowOncleanup block. This stops the glowimmediately when resources run out and restarts it when they recover.
Why
IsSpellUsableinstead ofGetSpellPowerCostGetSpellPowerCostreturnscost = 0for proc-based spells (e.g. Void Ray),making it unreliable for resource gating.
C_Spell.IsSpellUsable()correctlyreflects the game's own castability judgement for all spell types.
Behaviour
IsSpellUsablereturnsnil(unknown to the API) are unaffectedRecreated the pull request cause of some problems with forked and local repo.