Merge pull request #38 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3

Fix confirmation timing - confirm in cast hooks, not SPELLCAST_START
This commit is contained in:
Torio
2025-11-16 17:36:00 -05:00
committed by GitHub
+67
View File
@@ -391,6 +391,45 @@ function Extension.OnLoad()
if CastSpellByName then
Extension.Hook("CastSpellByName", "CastSpellByName_Hook")
end
-- Hook global CastSpell and UseAction for confirmation
if _G.CastSpell then
local originalCastSpell = _G.CastSpell
_G.CastSpell = function(id, bookType)
-- Call original first
originalCastSpell(id, bookType)
-- Confirm tracking for combo spells
local spellName = GetSpellName(id, bookType)
if spellName and CleveRoids.IsComboScalingSpell(spellName) and
CleveRoids.ComboPointTracking[spellName] then
CleveRoids.ComboPointTracking[spellName].confirmed = true
end
end
end
if _G.UseAction then
local originalUseAction = _G.UseAction
_G.UseAction = function(slot, target, button)
-- Call original first
originalUseAction(slot, target, button)
-- Try to determine spell name from action slot
if not GetActionText(slot) and IsCurrentAction(slot) then
local spellName = GetActionText(slot)
if not spellName then
-- Try to get from tooltip
GameTooltip:SetAction(slot)
spellName = GameTooltipTextLeft1:GetText()
end
if spellName and CleveRoids.IsComboScalingSpell(spellName) and
CleveRoids.ComboPointTracking[spellName] then
CleveRoids.ComboPointTracking[spellName].confirmed = true
end
end
end
end
end
-- Update combo points on relevant events
@@ -418,6 +457,12 @@ function Extension.OnSpellcastStart()
-- Mark this tracking as confirmed (actual cast, not just evaluation)
if CleveRoids.ComboPointTracking[spellName] then
CleveRoids.ComboPointTracking[spellName].confirmed = true
if CleveRoids.debug then
DEFAULT_CHAT_FRAME:AddMessage(
string.format("|cff00ff00[Confirmed]|r %s tracking confirmed (SPELLCAST_START)",
spellName)
)
end
end
end
end
@@ -457,6 +502,17 @@ end
function Extension.CastSpellByName_Hook(spellName, onSelf)
if spellName and CleveRoids.IsComboScalingSpell(spellName) then
CleveRoids.TrackComboPointCast(spellName)
-- Confirm the tracking immediately - this only fires on actual casts
if CleveRoids.ComboPointTracking[spellName] then
CleveRoids.ComboPointTracking[spellName].confirmed = true
if CleveRoids.debug then
DEFAULT_CHAT_FRAME:AddMessage(
string.format("|cff00ff00[Confirmed]|r %s tracking confirmed (CastSpellByName)",
spellName)
)
end
end
end
end
@@ -464,6 +520,17 @@ end
function Extension.CastSpell_Hook(spellName)
if spellName and CleveRoids.IsComboScalingSpell(spellName) then
CleveRoids.TrackComboPointCast(spellName)
-- Confirm the tracking immediately - this only fires on actual casts
if CleveRoids.ComboPointTracking[spellName] then
CleveRoids.ComboPointTracking[spellName].confirmed = true
if CleveRoids.debug then
DEFAULT_CHAT_FRAME:AddMessage(
string.format("|cff00ff00[Confirmed]|r %s tracking confirmed (CleveRoids.CastSpell)",
spellName)
)
end
end
end
end