mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
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.
This commit is contained in:
+28
-3
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user