Skip to content

Commit 95630aa

Browse files
committed
Fix resource bar border missing, heal absorb bar too small
Resource bar border (BUG #12): - FullFrameRefresh and OnAttributeChanged called non-existent DF:PositionResourceBar(), renamed to DF:ApplyResourceBarLayout() Heal absorb bar (BUG #5): - Add calc:SetHealAbsorbMode(1) so GetHealAbsorbs() returns the full absorb amount instead of subtracting incoming heals (mode 0 default) Performance: - Replace pcall wrappers with nil checks in all three calculator usages (2x damage absorb, 1x heal absorb) — pcall is expensive and these run per-frame every update
1 parent 77060a2 commit 95630aa

3 files changed

Lines changed: 37 additions & 24 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
* Fix pet frames vanishing after reload — pet frame updates were skipped in header mode, so they were never shown after login or `/rl`
1212
* Fix pet frame font crash on non-English clients
1313
* Reduce redundant pet frame updates during startup (throttled from 6 calls to 1-2)
14+
* Fix resource bar border not showing after login/reload — was calling non-existent function
15+
* Fix heal absorb bar showing smaller than actual absorb amount — calculator was subtracting incoming heals from absorb value
16+
* Replace pcall wrappers with nil checks in absorb/heal calculator hot paths for better performance
1417

1518
### New Features
1619
* Debug Console — persistent debug logging system with in-game viewer (`/df debug` to toggle, `/df console` to view). Logs persist across reloads with category filtering, severity levels, and clipboard export

Frames/Bars.lua

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -467,19 +467,21 @@ function DF:UpdateAbsorb(frame, testIndex)
467467

468468
-- Set clamp mode from settings (default to 1 = Missing Health)
469469
local clampMode = db.absorbBarAttachedClampMode or 1
470-
pcall(function() calc:SetDamageAbsorbClampMode(clampMode) end)
471-
470+
if calc.SetDamageAbsorbClampMode then calc:SetDamageAbsorbClampMode(clampMode) end
471+
472472
-- Populate the calculator
473473
UnitGetDetailedHealPrediction(unit, nil, calc)
474-
474+
475475
-- Get clamped absorbs and clamped bool
476-
local getSuccess, result1, result2 = pcall(function() return calc:GetDamageAbsorbs() end)
477-
if getSuccess and result1 then
478-
attachedAbsorbs = result1
479-
isClamped = result2 -- This is a secret bool in M+
476+
if calc.GetDamageAbsorbs then
477+
local result1, result2 = calc:GetDamageAbsorbs()
478+
if result1 then
479+
attachedAbsorbs = result1
480+
isClamped = result2 -- This is a secret bool in M+
481+
end
480482
end
481483
end
482-
484+
483485
-- Create/update overshield glow at max health position
484486
if db.absorbBarShowOvershield then
485487
-- Create glow texture if needed (directly on health bar)
@@ -700,19 +702,21 @@ function DF:UpdateAbsorb(frame, testIndex)
700702

701703
-- Set clamp mode from settings (default to 1 = Missing Health)
702704
local clampMode = db.absorbBarAttachedClampMode or 1
703-
pcall(function() calc:SetDamageAbsorbClampMode(clampMode) end)
704-
705+
if calc.SetDamageAbsorbClampMode then calc:SetDamageAbsorbClampMode(clampMode) end
706+
705707
-- Populate the calculator
706708
UnitGetDetailedHealPrediction(unit, nil, calc)
707-
709+
708710
-- Get clamped absorbs and clamped bool
709-
local getSuccess, result1, result2 = pcall(function() return calc:GetDamageAbsorbs() end)
710-
if getSuccess and result1 then
711-
attachedAbsorbs = result1
712-
isClamped = result2 -- This is a secret bool in M+
711+
if calc.GetDamageAbsorbs then
712+
local result1, result2 = calc:GetDamageAbsorbs()
713+
if result1 then
714+
attachedAbsorbs = result1
715+
isClamped = result2 -- This is a secret bool in M+
716+
end
713717
end
714718
end
715-
719+
716720
local healthOrient = db.healthOrientation or "HORIZONTAL"
717721
local inset = 0
718722
if db.showFrameBorder ~= false then
@@ -1091,15 +1095,21 @@ function DF:UpdateHealAbsorb(frame, testIndex)
10911095
local calc = frame.healAbsorbCalculator
10921096

10931097
-- Set clamp mode: 0 = CurrentHealth (don't go past 0 health)
1094-
pcall(function() calc:SetHealAbsorbClampMode(0) end)
1098+
if calc.SetHealAbsorbClampMode then calc:SetHealAbsorbClampMode(0) end
1099+
-- Set heal absorb mode: 1 = Total (return raw absorb values without
1100+
-- subtracting incoming heals). Default mode 0 reduces heal absorbs by
1101+
-- incoming heal amount, causing the bar to show less than actual absorb.
1102+
if calc.SetHealAbsorbMode then calc:SetHealAbsorbMode(1) end
10951103

10961104
-- Populate the calculator
10971105
UnitGetDetailedHealPrediction(unit, nil, calc)
10981106

10991107
-- Get clamped heal absorbs
1100-
local getSuccess, result1 = pcall(function() return calc:GetHealAbsorbs() end)
1101-
if getSuccess and result1 then
1102-
attachedHealAbsorb = result1
1108+
if calc.GetHealAbsorbs then
1109+
local result = calc:GetHealAbsorbs()
1110+
if result then
1111+
attachedHealAbsorb = result
1112+
end
11031113
end
11041114
end
11051115

Frames/Headers.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,8 @@ function DF:InitializeHeaderChild(frame)
805805
DF:UpdateHighlights(self)
806806
end
807807
-- Resource bar
808-
if DF.PositionResourceBar then
809-
DF:PositionResourceBar(self)
808+
if DF.ApplyResourceBarLayout then
809+
DF:ApplyResourceBarLayout(self)
810810
end
811811
if DF.UpdateResourceBar then
812812
DF:UpdateResourceBar(self)
@@ -4023,9 +4023,9 @@ function DF:FullFrameRefresh(frame)
40234023
if DF.UpdateAllStatusIcons then DF:UpdateAllStatusIcons(frame) end
40244024

40254025
-- Bars
4026-
-- NOTE: PositionResourceBar must be called first to show/hide the bar based on settings
4026+
-- NOTE: ApplyResourceBarLayout must be called first to show/hide the bar based on settings
40274027
-- UpdateResourceBar only updates values for already-visible bars
4028-
if DF.PositionResourceBar then DF:PositionResourceBar(frame) end
4028+
if DF.ApplyResourceBarLayout then DF:ApplyResourceBarLayout(frame) end
40294029
if DF.UpdateResourceBar then DF:UpdateResourceBar(frame) end
40304030
if DF.UpdateAbsorb then DF:UpdateAbsorb(frame) end
40314031
if DF.UpdateHealAbsorb then DF:UpdateHealAbsorb(frame) end

0 commit comments

Comments
 (0)