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
Prevent macro conditional evaluations from overwriting good CP data: Problem: Macros like "[combo:>0 nodebuff]Rip /cast [combo:>0]Rip" evaluate multiple times, calling TrackComboPointCast repeatedly: 1. Check [combo:>0 nodebuff] → TrackComboPointCast(0 CP) 2. Claw lands → player gains 1 CP 3. Check [combo:>0] → TrackComboPointCast(1 CP) 4. Spell casts → pfUI AddEffect fires → uses tracking data If the 0 CP call happens after the 1 CP call, pfUI gets wrong data. Solution: Only update tracking if: - No existing data exists, OR - Existing data is stale (>0.5s), OR - New CP value >= existing CP value This ensures we keep the highest (best) combo point count during rapid macro evaluations, so pfUI always gets the correct duration. Debug: Shows "Ignoring X with Y CP (have Z CP)" when preventing overwrites of better data.
This commit is contained in:
+20
-2
@@ -182,12 +182,30 @@ function CleveRoids.TrackComboPointCast(spellName)
|
||||
|
||||
local comboPoints = CleveRoids.GetComboPoints()
|
||||
local duration = CleveRoids.CalculateComboScaledDuration(spellName, comboPoints)
|
||||
local currentTime = GetTime()
|
||||
|
||||
-- Only update if this is a better (higher CP) value than existing, or if existing is stale
|
||||
local existing = CleveRoids.ComboPointTracking[spellName]
|
||||
if existing then
|
||||
local age = currentTime - existing.cast_time
|
||||
-- Keep existing if it's fresh (<0.5s) and has more combo points
|
||||
if age < 0.5 and existing.combo_points > comboPoints then
|
||||
-- Don't overwrite better data with worse data
|
||||
if CleveRoids.debug then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(
|
||||
string.format("|cff888888CleveRoids:|r ComboTrack: Ignoring %s with %d CP (have %d CP)",
|
||||
spellName, comboPoints, existing.combo_points)
|
||||
)
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- Store the tracking data
|
||||
CleveRoids.ComboPointTracking[spellName] = {
|
||||
combo_points = comboPoints,
|
||||
duration = duration,
|
||||
cast_time = GetTime(),
|
||||
cast_time = currentTime,
|
||||
target = UnitName("target") or "Unknown"
|
||||
}
|
||||
|
||||
@@ -198,7 +216,7 @@ function CleveRoids.TrackComboPointCast(spellName)
|
||||
|
||||
CleveRoids.spell_tracking[spellName].last_combo_points = comboPoints
|
||||
CleveRoids.spell_tracking[spellName].last_duration = duration
|
||||
CleveRoids.spell_tracking[spellName].last_cast_time = GetTime()
|
||||
CleveRoids.spell_tracking[spellName].last_cast_time = currentTime
|
||||
|
||||
-- Debug output
|
||||
if CleveRoids.debug then
|
||||
|
||||
Reference in New Issue
Block a user