From e7152e368364cdf97dd78145ede7039a3d23c197 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 16 Nov 2025 18:04:20 +0000 Subject: [PATCH] Fix combo point tracking - use name-based tracking as fallback The issue: UNIT_CASTEVENT fires AFTER combo points are consumed, so GetComboPoints() returns 0. The lastComboPoints fallback wasn't always set in time. Solution: When TrackComboPointCastByID sees 0 combo points, it now: 1. First tries lastComboPoints (OnUpdate tracking) 2. If still 0, checks name-based tracking data from extension hooks (which captured the CP count BEFORE the spell was cast) 3. Uses the CP count if the cast was within the last 0.5 seconds This ensures we always get the correct combo point count for duration calculation, regardless of timing. --- ComboPointTracker.lua | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/ComboPointTracker.lua b/ComboPointTracker.lua index 2fa97f7..445850c 100644 --- a/ComboPointTracker.lua +++ b/ComboPointTracker.lua @@ -217,9 +217,34 @@ function CleveRoids.TrackComboPointCastByID(spellID, targetGUID) -- Get current combo points, but if they're 0 (already consumed), use last known value local comboPoints = CleveRoids.GetComboPoints() - if comboPoints == 0 and CleveRoids.lastComboPoints > 0 then - comboPoints = CleveRoids.lastComboPoints - CleveRoids.lastComboPoints = 0 -- Reset after using + + -- If combo points are 0, try multiple fallback sources + if comboPoints == 0 then + -- First, try lastComboPoints + if CleveRoids.lastComboPoints > 0 then + comboPoints = CleveRoids.lastComboPoints + CleveRoids.lastComboPoints = 0 -- Reset after using + else + -- Second, check if name-based tracking has recent data for this spell + local spellName = SpellInfo(spellID) + if spellName then + -- Remove rank info for comparison + local baseName = string.gsub(spellName, "%s*%(Rank %d+%)", "") + if CleveRoids.ComboPointTracking[spellName] then + local tracking = CleveRoids.ComboPointTracking[spellName] + if tracking.combo_points and tracking.combo_points > 0 and + (GetTime() - tracking.cast_time) < 0.5 then -- Within last 0.5 seconds + comboPoints = tracking.combo_points + end + elseif CleveRoids.ComboPointTracking[baseName] then + local tracking = CleveRoids.ComboPointTracking[baseName] + if tracking.combo_points and tracking.combo_points > 0 and + (GetTime() - tracking.cast_time) < 0.5 then + comboPoints = tracking.combo_points + end + end + end + end end local duration = CleveRoids.CalculateComboScaledDurationByID(spellID, comboPoints)