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

Claude/improve combodurations 01 g hh5y6d xtx nhoiz dk8b sw3
This commit is contained in:
Torio
2025-11-16 13:53:07 -05:00
committed by GitHub
2 changed files with 39 additions and 6 deletions
+29 -4
View File
@@ -181,13 +181,32 @@ 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(),
target = UnitName("target") or "Unknown"
cast_time = currentTime,
target = UnitName("target") or "Unknown",
confirmed = false -- Will be set to true by SPELLCAST_START
}
-- Also store in spell_tracking for integration with existing system
@@ -197,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
@@ -395,6 +414,11 @@ function Extension.OnSpellcastStart()
local spellName = arg1
if spellName and CleveRoids.IsComboScalingSpell(spellName) then
CleveRoids.TrackComboPointCast(spellName)
-- Mark this tracking as confirmed (actual cast, not just evaluation)
if CleveRoids.ComboPointTracking[spellName] then
CleveRoids.ComboPointTracking[spellName].confirmed = true
end
end
end
@@ -417,7 +441,8 @@ function Extension.OnSpellcastFailed()
if spellName and CleveRoids.ComboPointTracking[spellName] then
local tracking = CleveRoids.ComboPointTracking[spellName]
if tracking and (GetTime() - tracking.cast_time) < 1 then
-- Recent cast failed, clear it
-- Recent cast failed, clear confirmed flag and the tracking
tracking.confirmed = false
CleveRoids.ComboPointTracking[spellName] = nil
end
end
+10 -2
View File
@@ -155,14 +155,22 @@ function Extension.HookPfUILibdebuff()
-- Use name-based tracking which is populated BEFORE pfUI's AddEffect
if CleveRoids.ComboPointTracking and CleveRoids.ComboPointTracking[effect] then
local tracking = CleveRoids.ComboPointTracking[effect]
if tracking.duration and (GetTime() - tracking.cast_time) < 0.5 then
-- Only use tracking if it's confirmed (actual cast, not just evaluation)
if tracking.duration and tracking.confirmed and (GetTime() - tracking.cast_time) < 0.5 then
duration = tracking.duration
-- Clear confirmed flag after use to prevent reuse
tracking.confirmed = false
if CleveRoids.debug then
DEFAULT_CHAT_FRAME:AddMessage(
string.format("|cff00ff00[pfUI AddEffect Hook]|r Overriding %s duration to %ds (from name tracking)",
string.format("|cff00ff00[pfUI AddEffect Hook]|r Overriding %s duration to %ds (from confirmed tracking)",
effect, duration)
)
end
elseif CleveRoids.debug and tracking.duration and not tracking.confirmed then
DEFAULT_CHAT_FRAME:AddMessage(
string.format("|cffaaaa00[pfUI AddEffect Hook]|r Ignoring %s tracking (not confirmed - evaluation only)",
effect)
)
end
end
end