castbar: event-driven rewrite on ClassicAPI C_Spell + nampower events

Drive the cast bar from cast lifecycle events instead of polling C_Spell
every frame. OnUpdate now only animates a stamped start/end and fades out;
all state transitions come from events:

- player: vanilla SPELLCAST_START / _STOP / _FAILED / _INTERRUPTED /
  _CHANNEL_START / _CHANNEL_STOP, plus nampower SPELL_START_SELF (the only
  signal for a chained same-spell recast, which never runs the client cast
  path) and SPELL_DELAYED_SELF for pushback (applied from its delayMs arg).
- non-player (target/focus): nampower SPELL_START_OTHER / SPELL_FAILED_OTHER
  + PLAYER_TARGET_CHANGED / PLAYER_FOCUS_CHANGED.

Data comes from ClassicAPI's C_Spell.UnitCastingInfo / UnitChannelInfo
(player exact; other units from the SMSG_SPELL_START cache). SPELL_START_*
re-polls are deferred one frame so ClassicAPI's packet co-hook has stamped
before the read. SPELLCAST_CHANNEL_STOP only clears when a channel is shown,
so a lagged channel-stop doesn't wipe a following cast's bar.

Remove the now-unused CASTBAR_EVENT_* constants from compat/vanilla.lua.
This commit is contained in:
Brues
2026-06-25 22:26:17 -05:00
parent 96fd486187
commit 822c873132
2 changed files with 216 additions and 149 deletions
-5
View File
@@ -2,11 +2,6 @@
setfenv(1, pfUI:GetEnvironment())
-- [[ Constants ]]--
CASTBAR_EVENT_CAST_DELAY = "SPELLCAST_DELAYED"
CASTBAR_EVENT_CHANNEL_DELAY = "SPELLCAST_CHANNEL_UPDATE"
CASTBAR_EVENT_CAST_START = "SPELLCAST_START"
CASTBAR_EVENT_CHANNEL_START = "SPELLCAST_CHANNEL_START"
EVENTS_MINIMAP_ZONE_UPDATE = {"PLAYER_ENTERING_WORLD", "MINIMAP_ZONE_CHANGED"}
MICRO_BUTTONS = {