Skip to content

Fix countdown OnUpdate formatting syntax - #3

Merged
DanderBot merged 2 commits into
mainfrom
codex/add-countdown-formatting-options-for-buffs-89azzf
Dec 1, 2025
Merged

Fix countdown OnUpdate formatting syntax#3
DanderBot merged 2 commits into
mainfrom
codex/add-countdown-formatting-options-for-buffs-89azzf

Conversation

@DanderBot

Copy link
Copy Markdown
Owner

Summary

  • correct countdown timer OnUpdate logic formatting to resolve syntax error and maintain show/hide behavior

Testing

  • not run (not requested)

Codex Task

@DanderBot
DanderBot merged commit 70a7c78 into main Dec 1, 2025
@DanderBot
DanderBot deleted the codex/add-countdown-formatting-options-for-buffs-89azzf branch February 14, 2026 13:29
DanderBot added a commit that referenced this pull request Apr 9, 2026
Addresses audit finding #3 from _Reference/performance-audit-2026-04.md.
Frames/Update.lua was calling 11 Unit* API functions via the global
environment on every invocation of its hot-path functions. Each global
lookup compiles to a hash table access; caching the function reference
at file scope turns every call site into a pure upvalue access, which
the Lua interpreter compiles to a direct register read.

Matching pattern: Frames/Bars.lua:8-19 already does this for its own
hot-path unit APIs.

Cached functions (each used 1-6 times per UpdateHealthFast /
UpdatePower / UpdateUnitFrame call):

  UnitExists
  UnitClass
  UnitIsConnected
  UnitIsDead
  UnitIsGhost
  UnitHealth
  UnitHealthMax
  UnitHealthMissing
  UnitPower
  UnitPowerMax
  UnitPowerType
  InCombatLockdown  (used in ApplyFrameLayout)

38 existing call sites are affected. No call-site edits needed — Lua
lexical scope resolves every subsequent reference in the file to the
new upvalues automatically. Verified via grep: no shadowing or
reassignment of these names anywhere else in the file.

Expected profile impact (audit projected 5-10% raid CPU savings on
UpdateHealthFast + UpdatePower):

  UpdateHealthFast:  191 us/call  ->  ~160-180 us/call (estimated)
  UpdatePower:       unchanged per-call cost, maybe -5%
  Total raid CPU:    -2-5% (rough projection, raid scale)

The per-call savings are small individually but UpdateHealthFast is
now the #1 CPU consumer after the Dispel refactor landed (27.9% in
the latest 5-man profile, ~10% in the earlier raid profile), so even
a few microseconds per call compound at 100+ calls/sec in raid content.

Verification:
* /reload loads without errors
* Unit health bars still update correctly on damage/heals
* Power bars still track correctly on resource changes
* Dead/ghost/disconnected/out-of-range states still render correctly
* Class color still applies correctly to health bars

Low regression risk — this is a pure identifier caching change with
zero behavior implications. If anything breaks, it's almost certainly
unrelated (but rollback via git reset --hard dispel-fix-complete).
DanderBot added a commit that referenced this pull request Apr 10, 2026
Adds the Targeted List section at the bottom of TargetedSpells.lua.
This is a scaffold only — cast-lifecycle processing and render pipeline
land in subsequent commits. What's in place now:

* File-scope cached Unit APIs (project convention from audit finding #3)
* State tables: activeTargetedListCasts, targetedListRosterNames,
  lazy bar pool + container placeholders
* Two-tier runtime gate: TargetedList_IsGateOpen checks
  DF.RELEASE_CHANNEL so the feature is fully inert on stable releases;
  TargetedList_IsActive additionally checks targetedListEnabled and
  requires a party (not raid, not solo) group.
* DF:TargetedListNeedsCastEvents exposed for the shared NeedsCastEvents
  helper — the cast-event frame stays registered while Targeted List
  is the only active consumer.
* Roster name cache rebuilt on GROUP_ROSTER_UPDATE for O(1) target
  lookup (avoids iterating party1-4 on every cast).
* IsCastTargetingGroupMember filter wired but unused until commit #4.
* Cast lifecycle stubs (ProcessCastStart / OnCastStop /
  OnInterruptibilityChange / ReleaseAllBars) exported via DF._* shims
  so the OnEvent dispatcher can call them without forward-declaration.
* Public DF:InitTargetedList / UpdateTargetedListLayout / ToggleTargetedList
  entry points, all gated.

Shared event frame changes:
* Added UNIT_SPELLCAST_FAILED_QUIET (fixes a long-standing gap where
  some cancelled casts leave dangling personal-display icons too).
* Added UNIT_SPELLCAST_INTERRUPTIBLE / NOT_INTERRUPTIBLE for mid-cast
  border color updates.
* Added LOADING_SCREEN_DISABLED for nameplate cleanup sweep.
* Added GROUP_ROSTER_UPDATE for roster cache rebuild.
* OnEvent dispatcher now routes matching events through the
  Targeted List handlers in addition to the existing group/personal
  handlers.

NeedsCastEvents extended to include the Targeted List consumer, so
the shared event frame turns on/off correctly based on any active
user of cast events.

InitTargetedSpells now calls DF:InitTargetedList() once at addon init.
DanderBot added a commit that referenced this pull request Apr 10, 2026
Replaces the scaffolded stubs with the full cast-lifecycle
implementation. Debug output via DF:Debug("TARGETEDLIST", ...) is
used as a stand-in for visual bars until commit #5 lands the render
pipeline — this lets in-game verification happen against the debug
console without requiring the full rendering work first.

All 13 correctness gotchas from the TS3 cross-reference in
_Reference/targeted-spells-findings.md are handled and tagged inline:

  #1  0.2s delay before reading cast data (start events fire before
      UnitSpellTargetName / duration are populated)
  #2  Cast-ID matching at both pickup (via UnitCastingInfo) and stop
      (via event castGuid) — prevents rapid-restart flicker
  #3  UNIT_SPELLCAST_SUCCEEDED during an active channel is treated
      as a no-op (channel tick, not a stop)
  #4  INTERRUPTED with nil interrupter or a dead caster is treated
      as a normal stop (no interrupter flash)
  #6  Empower spellId/castGuid offset handled (same shape as regular
      start on current retail — documented inline)
  #7  Interrupter lookup via UnitNameFromGUID / UnitClassFromGUID
  #8  Uninterruptible flag from UnitCastingInfo/UnitChannelInfo is
      treated as secret-tainted and only ever fed to
      SetVertexColorFromBoolean (applied in commit #5)
  #9  UNIT_SPELLCAST_INTERRUPTIBLE / NOT_INTERRUPTIBLE overwrite the
      stored uninterruptible field with a clean boolean
  #11 LOADING_SCREEN_DISABLED triggers a full release sweep

Also adds the cast-targeting filter pipeline:

  * TargetedList_IsRelevantCaster filters out non-nameplate units,
    friendly units, and party-member nameplates
  * TargetedList_ReadCastData unifies UnitCastingInfo / UnitChannelInfo
    read paths, handling the positional offset difference for
    castID vs notInterruptible between the two APIs
  * Important-spells filter via C_Spell.IsSpellImportant
  * Hide-own-casts filter
  * Roster name cache used for O(1) target lookup

Event dispatcher extended to route NAME_PLATE_UNIT_ADDED and
UNIT_TARGET through the start handler so new nameplates and mid-cast
target swaps are picked up. UNIT_TARGET also fires an immediate stop
to drop the old tracking — the 0.2s delayed re-pickup recreates it
if the new target is still a party member.

Content-type filter (gotcha #13) is intentionally deferred to
commit #5 since the existing TargetedSpells content-type detection
can be reused rather than duplicated.
Krathe82 pushed a commit to Krathe82/DandersFrames that referenced this pull request Jun 6, 2026
)

Addresses audit finding DanderBot#3 from _Reference/performance-audit-2026-04.md.
Frames/Update.lua was calling 11 Unit* API functions via the global
environment on every invocation of its hot-path functions. Each global
lookup compiles to a hash table access; caching the function reference
at file scope turns every call site into a pure upvalue access, which
the Lua interpreter compiles to a direct register read.

Matching pattern: Frames/Bars.lua:8-19 already does this for its own
hot-path unit APIs.

Cached functions (each used 1-6 times per UpdateHealthFast /
UpdatePower / UpdateUnitFrame call):

  UnitExists
  UnitClass
  UnitIsConnected
  UnitIsDead
  UnitIsGhost
  UnitHealth
  UnitHealthMax
  UnitHealthMissing
  UnitPower
  UnitPowerMax
  UnitPowerType
  InCombatLockdown  (used in ApplyFrameLayout)

38 existing call sites are affected. No call-site edits needed — Lua
lexical scope resolves every subsequent reference in the file to the
new upvalues automatically. Verified via grep: no shadowing or
reassignment of these names anywhere else in the file.

Expected profile impact (audit projected 5-10% raid CPU savings on
UpdateHealthFast + UpdatePower):

  UpdateHealthFast:  191 us/call  ->  ~160-180 us/call (estimated)
  UpdatePower:       unchanged per-call cost, maybe -5%
  Total raid CPU:    -2-5% (rough projection, raid scale)

The per-call savings are small individually but UpdateHealthFast is
now the #1 CPU consumer after the Dispel refactor landed (27.9% in
the latest 5-man profile, ~10% in the earlier raid profile), so even
a few microseconds per call compound at 100+ calls/sec in raid content.

Verification:
* /reload loads without errors
* Unit health bars still update correctly on damage/heals
* Power bars still track correctly on resource changes
* Dead/ghost/disconnected/out-of-range states still render correctly
* Class color still applies correctly to health bars

Low regression risk — this is a pure identifier caching change with
zero behavior implications. If anything breaks, it's almost certainly
unrelated (but rollback via git reset --hard dispel-fix-complete).
Krathe82 pushed a commit to Krathe82/DandersFrames that referenced this pull request Jun 6, 2026
Adds the Targeted List section at the bottom of TargetedSpells.lua.
This is a scaffold only — cast-lifecycle processing and render pipeline
land in subsequent commits. What's in place now:

* File-scope cached Unit APIs (project convention from audit finding DanderBot#3)
* State tables: activeTargetedListCasts, targetedListRosterNames,
  lazy bar pool + container placeholders
* Two-tier runtime gate: TargetedList_IsGateOpen checks
  DF.RELEASE_CHANNEL so the feature is fully inert on stable releases;
  TargetedList_IsActive additionally checks targetedListEnabled and
  requires a party (not raid, not solo) group.
* DF:TargetedListNeedsCastEvents exposed for the shared NeedsCastEvents
  helper — the cast-event frame stays registered while Targeted List
  is the only active consumer.
* Roster name cache rebuilt on GROUP_ROSTER_UPDATE for O(1) target
  lookup (avoids iterating party1-4 on every cast).
* IsCastTargetingGroupMember filter wired but unused until commit DanderBot#4.
* Cast lifecycle stubs (ProcessCastStart / OnCastStop /
  OnInterruptibilityChange / ReleaseAllBars) exported via DF._* shims
  so the OnEvent dispatcher can call them without forward-declaration.
* Public DF:InitTargetedList / UpdateTargetedListLayout / ToggleTargetedList
  entry points, all gated.

Shared event frame changes:
* Added UNIT_SPELLCAST_FAILED_QUIET (fixes a long-standing gap where
  some cancelled casts leave dangling personal-display icons too).
* Added UNIT_SPELLCAST_INTERRUPTIBLE / NOT_INTERRUPTIBLE for mid-cast
  border color updates.
* Added LOADING_SCREEN_DISABLED for nameplate cleanup sweep.
* Added GROUP_ROSTER_UPDATE for roster cache rebuild.
* OnEvent dispatcher now routes matching events through the
  Targeted List handlers in addition to the existing group/personal
  handlers.

NeedsCastEvents extended to include the Targeted List consumer, so
the shared event frame turns on/off correctly based on any active
user of cast events.

InitTargetedSpells now calls DF:InitTargetedList() once at addon init.
Krathe82 pushed a commit to Krathe82/DandersFrames that referenced this pull request Jun 6, 2026
Replaces the scaffolded stubs with the full cast-lifecycle
implementation. Debug output via DF:Debug("TARGETEDLIST", ...) is
used as a stand-in for visual bars until commit DanderBot#5 lands the render
pipeline — this lets in-game verification happen against the debug
console without requiring the full rendering work first.

All 13 correctness gotchas from the TS3 cross-reference in
_Reference/targeted-spells-findings.md are handled and tagged inline:

  #1  0.2s delay before reading cast data (start events fire before
      UnitSpellTargetName / duration are populated)
  DanderBot#2  Cast-ID matching at both pickup (via UnitCastingInfo) and stop
      (via event castGuid) — prevents rapid-restart flicker
  DanderBot#3  UNIT_SPELLCAST_SUCCEEDED during an active channel is treated
      as a no-op (channel tick, not a stop)
  DanderBot#4  INTERRUPTED with nil interrupter or a dead caster is treated
      as a normal stop (no interrupter flash)
  DanderBot#6  Empower spellId/castGuid offset handled (same shape as regular
      start on current retail — documented inline)
  DanderBot#7  Interrupter lookup via UnitNameFromGUID / UnitClassFromGUID
  DanderBot#8  Uninterruptible flag from UnitCastingInfo/UnitChannelInfo is
      treated as secret-tainted and only ever fed to
      SetVertexColorFromBoolean (applied in commit DanderBot#5)
  DanderBot#9  UNIT_SPELLCAST_INTERRUPTIBLE / NOT_INTERRUPTIBLE overwrite the
      stored uninterruptible field with a clean boolean
  DanderBot#11 LOADING_SCREEN_DISABLED triggers a full release sweep

Also adds the cast-targeting filter pipeline:

  * TargetedList_IsRelevantCaster filters out non-nameplate units,
    friendly units, and party-member nameplates
  * TargetedList_ReadCastData unifies UnitCastingInfo / UnitChannelInfo
    read paths, handling the positional offset difference for
    castID vs notInterruptible between the two APIs
  * Important-spells filter via C_Spell.IsSpellImportant
  * Hide-own-casts filter
  * Roster name cache used for O(1) target lookup

Event dispatcher extended to route NAME_PLATE_UNIT_ADDED and
UNIT_TARGET through the start handler so new nameplates and mid-cast
target swaps are picked up. UNIT_TARGET also fires an immediate stop
to drop the old tracking — the 0.2s delayed re-pickup recreates it
if the new target is still a party member.

Content-type filter (gotcha DanderBot#13) is intentionally deferred to
commit DanderBot#5 since the existing TargetedSpells content-type detection
can be reused rather than duplicated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant