Add confirmation system to prevent pfUI from using evaluation-only tracking

Problem: Macro conditional evaluations create tracking entries, but
pfUI's AddEffect can fire during these evaluations (before actual cast),
causing it to use incorrect combo point data.

Flow before fix:
1. Macro evaluates [combo:>0] → TrackComboPointCast(0 CP, confirmed=false)
2. Macro evaluates again → TrackComboPointCast(1 CP, confirmed=false)
3. pfUI AddEffect fires → uses tracking (wrong timing!) ✗
4. SPELLCAST_START fires (actual cast)

Flow after fix:
1. Macro evaluates [combo:>0] → TrackComboPointCast(0 CP, confirmed=false)
2. Macro evaluates again → TrackComboPointCast(1 CP, confirmed=false)
3. SPELLCAST_START fires → sets confirmed=true ✓
4. pfUI AddEffect fires → only uses tracking if confirmed=true ✓

Changes:
- Added 'confirmed' field to tracking (default: false)
- SPELLCAST_START sets confirmed=true when spell actually casts
- pfUI AddEffect hook only uses tracking if confirmed=true
- Clear confirmed flag after use to prevent reuse
- Clear on failed/interrupted casts

Debug shows: "Ignoring X tracking (not confirmed - evaluation only)"
when preventing use of evaluation-only data.
This commit is contained in:
Claude
2025-11-16 18:51:57 +00:00
parent 7abb78c54e
commit aedb2684b5
2 changed files with 19 additions and 4 deletions
+9 -2
View File
@@ -206,7 +206,8 @@ function CleveRoids.TrackComboPointCast(spellName)
combo_points = comboPoints,
duration = duration,
cast_time = currentTime,
target = UnitName("target") or "Unknown"
target = UnitName("target") or "Unknown",
confirmed = false -- Will be set to true by SPELLCAST_START
}
-- Also store in spell_tracking for integration with existing system
@@ -414,6 +415,11 @@ function Extension.OnSpellcastStart()
local spellName = arg1
if spellName and CleveRoids.IsComboScalingSpell(spellName) then
CleveRoids.TrackComboPointCast(spellName)
-- Mark this tracking as confirmed (actual cast, not just evaluation)
if CleveRoids.ComboPointTracking[spellName] then
CleveRoids.ComboPointTracking[spellName].confirmed = true
end
end
end
@@ -436,7 +442,8 @@ function Extension.OnSpellcastFailed()
if spellName and CleveRoids.ComboPointTracking[spellName] then
local tracking = CleveRoids.ComboPointTracking[spellName]
if tracking and (GetTime() - tracking.cast_time) < 1 then
-- Recent cast failed, clear it
-- Recent cast failed, clear confirmed flag and the tracking
tracking.confirmed = false
CleveRoids.ComboPointTracking[spellName] = nil
end
end