Skip to content

feat: Health-based fading — fade frames above configurable health threshold - #6

Closed
X-Steeve wants to merge 1 commit into
DanderBot:mainfrom
X-Steeve:feature/health-based-fading
Closed

feat: Health-based fading — fade frames above configurable health threshold#6
X-Steeve wants to merge 1 commit into
DanderBot:mainfrom
X-Steeve:feature/health-based-fading

Conversation

@X-Steeve

Copy link
Copy Markdown
Contributor

Summary

Adds a Health Threshold Fading option: frames or elements can be faded when a unit's health is above a configurable threshold (e.g. 100% or 80%). This helps highlight damaged units and reduce visual clutter from full-health ones.

Main changes

New module Features/HealthFade.lua

  • Detects "above threshold" via a hidden health bar whose OnValueChanged receives the resolved value (safe with secret health).
  • UpdateHealthFade / UpdatePetHealthFade to update fade state.
  • DF:GetHealthFadeAlpha(frame, elementKey) for per-element alpha, used by ElementAppearance.lua.

Integration in the appearance pipeline (ElementAppearance.lua)

  • Priority order: Aggro → Dead/Offline → Health Threshold Fade → Out of Range → Normal.
  • Frame-level mode: single alpha for the whole frame (healthFadeAlpha).
  • Element-specific mode (hfElementSpecific): per-element alpha (health bar, background, name/health text, auras, icons, dispel overlay, power bar, missing buff, defensive icon, targeted spell, my buff indicator).

Options (Config.lua, Options.lua)

  • Enable, threshold (50–100%), "Cancel Fade on Dispellable Debuff" (hfCancelOnDispel).
  • Frame alpha and per-element alpha sliders.
  • Fading page copy button extended to health-fade settings (healthFade, hf).

Core (Frames/Core.lua)

  • In SetHealthBarValue, a hidden bar dfHealthCheckBar is created and receives the same percentage; its OnValueChanged updates dfComputedAboveThreshold and triggers UpdateHealthFade.

Range (Features/Range.lua)

  • Range check loop also calls UpdateHealthFade / UpdatePetHealthFade so fade state stays in sync with the range timer.

Export / Debug / Test

  • ExportCategories.lua: all health-fade fields added to export.
  • Debug/PerformanceTest.lua: "Health Threshold Fade" checkbox to include/exclude the feature in perf tests.
  • TestMode/TestMode.lua: health-based fading supported in test mode (fullHealthFade*, fh*) so frame-level and element-specific behaviour can be previewed.

Files changed

Area Files
Config / TOC / Export Config.lua, DandersFrames.toc, ExportCategories.lua
Features Features/ElementAppearance.lua, Features/HealthFade.lua (new), Features/Range.lua
Frames Frames/Core.lua
Options Options/Options.lua
Debug / Test Debug/PerformanceTest.lua, TestMode/TestMode.lua

@riyuk

riyuk commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

using OnValueChanged to get a resolved number out of a secret value works right now, but if blizzard changes that behavior (as intended) this would break everything.

cool idea but imo very risky for something that could break with any patch

@X-Steeve X-Steeve closed this Feb 17, 2026
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
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.
DanderBot pushed a commit that referenced this pull request Jul 11, 2026
… inside the button subtree

onUpdateMode=disabled propagates through the whole subtree, so an OnUpdate/
AnimationGroup on a button descendant installs but never ticks. The prior note
claimed the opposite (the probe only checked SetScript/Play don't error). Point
to the external-driver pattern (DF.Border ensureDriver, secretRect -> UIParent).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants