mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Fix combo point tracking - capture CPs before they're consumed
CRITICAL FIX: Combo points were showing as 0 because UNIT_CASTEVENT fires AFTER the finisher consumes them. Solution: - Added CleveRoids.lastComboPoints to store the last known CP count - UpdateComboPoints() continuously monitors and stores CP when > 0 - OnUpdate handler keeps lastComboPoints up-to-date every frame - Also update on PLAYER_TARGET_CHANGED, UNIT_AURA, PLAYER_COMBO_POINTS - TrackComboPointCastByID() uses stored value if current is 0 - Resets stored value after use to prevent reuse Now correctly tracks: Rip at 5 CP = 28s, Rupture at 5 CP = 16s, etc.
This commit is contained in:
+40
-2
@@ -10,6 +10,7 @@ local CleveRoids = _G.CleveRoids or {}
|
||||
-- Initialize combo point tracking table
|
||||
CleveRoids.ComboPointTracking = CleveRoids.ComboPointTracking or {}
|
||||
CleveRoids.spell_tracking = CleveRoids.spell_tracking or {}
|
||||
CleveRoids.lastComboPoints = CleveRoids.lastComboPoints or 0 -- Track last known CP count
|
||||
|
||||
-- Define spells that scale with combo points by SPELL ID and their duration formulas
|
||||
-- Duration = base + (combo_points - 1) * increment
|
||||
@@ -50,6 +51,14 @@ function CleveRoids.GetComboPoints()
|
||||
return GetComboPoints("player", "target") or 0
|
||||
end
|
||||
|
||||
-- Update stored combo points (call this frequently)
|
||||
function CleveRoids.UpdateComboPoints()
|
||||
local current = CleveRoids.GetComboPoints()
|
||||
if current > 0 then
|
||||
CleveRoids.lastComboPoints = current
|
||||
end
|
||||
end
|
||||
|
||||
-- Function to check if a spell scales with combo points
|
||||
function CleveRoids.IsComboScalingSpell(spellName)
|
||||
if not spellName then return false end
|
||||
@@ -187,7 +196,13 @@ function CleveRoids.TrackComboPointCastByID(spellID, targetGUID)
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 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
|
||||
end
|
||||
|
||||
local duration = CleveRoids.CalculateComboScaledDurationByID(spellID, comboPoints)
|
||||
|
||||
if not duration then return nil end
|
||||
@@ -297,17 +312,40 @@ function Extension.OnLoad()
|
||||
Extension.RegisterEvent("SPELLCAST_STOP", "OnSpellcastStop")
|
||||
Extension.RegisterEvent("SPELLCAST_FAILED", "OnSpellcastFailed")
|
||||
Extension.RegisterEvent("SPELLCAST_INTERRUPTED", "OnSpellcastInterrupted")
|
||||
|
||||
Extension.RegisterEvent("PLAYER_TARGET_CHANGED", "OnTargetChanged")
|
||||
Extension.RegisterEvent("UNIT_AURA", "OnUnitAura")
|
||||
Extension.RegisterEvent("PLAYER_COMBO_POINTS", "OnComboPointsChanged")
|
||||
|
||||
-- Set up OnUpdate to track combo points
|
||||
Extension.internal.frame:SetScript("OnUpdate", function()
|
||||
CleveRoids.UpdateComboPoints()
|
||||
end)
|
||||
|
||||
-- Hook the spell cast functions if they exist
|
||||
if CleveRoids.CastSpell then
|
||||
Extension.Hook("CleveRoids.CastSpell", "CastSpell_Hook")
|
||||
end
|
||||
|
||||
|
||||
if CastSpellByName then
|
||||
Extension.Hook("CastSpellByName", "CastSpellByName_Hook")
|
||||
end
|
||||
end
|
||||
|
||||
-- Update combo points on relevant events
|
||||
function Extension.OnTargetChanged()
|
||||
CleveRoids.UpdateComboPoints()
|
||||
end
|
||||
|
||||
function Extension.OnUnitAura()
|
||||
if arg1 == "target" or arg1 == "player" then
|
||||
CleveRoids.UpdateComboPoints()
|
||||
end
|
||||
end
|
||||
|
||||
function Extension.OnComboPointsChanged()
|
||||
CleveRoids.UpdateComboPoints()
|
||||
end
|
||||
|
||||
-- Event handlers
|
||||
function Extension.OnSpellcastStart()
|
||||
-- Track combo points at cast start for channeled combo spells
|
||||
|
||||
Reference in New Issue
Block a user