Commit Graph
138 Commits
Author SHA1 Message Date
Claude 30bb3599fb Extend overflow debuff checking to all 32 buff slots
Previously, lib:UnitDebuff() callers only looped through indices 1-16, which
meant overflow debuffs in buff slots 17-32 were never detected.

Changed loop range from 1-16 to 1-32:
- _get_debuff_timeleft() loops (Conditionals.lua:93, 105)
- ValidateUnitDebuff() loop (Conditionals.lua:802)
- Added missing "if not effect then break end" check (Conditionals.lua:804)

How lib:UnitDebuff(unit, index) works:
- Index 1-16: Checks debuff slot, falls back to buff slot at same index
- Index 17-32: No debuff slots exist, so checks buff slots 17-32

Since a debuff can only exist in ONE location (either debuff slot OR buff slot),
checking 1-32 covers all 16 debuff slots + all 32 buff slots efficiently.
2025-11-16 23:47:08 +00:00
Claude c8546df52a Fix debuff overflow detection and duration tracking for combodurations branch
Applied the same overflow bug fixes to the combodurations branch to ensure
compatibility with combo point-scaled debuffs. This fixes three issues:

1. lib:UnitDebuff() (line 799): Fixed UnitBuff() return value capture from 4
   values to 3 values (UnitBuff only returns texture, stacks, spellID). Also
   changed overflow check from only checking static database to checking
   lib:GetDuration() which includes combo durations, learned durations, and
   static durations.

2. SeedUnit() debuff loop (line 837): Changed check from only lib.durations[]
   to lib:GetDuration() so debuffs with learned or combo-scaled durations are
   properly seeded into the tracking system.

3. SeedUnit() buff loop (line 867): Fixed UnitBuff() return value capture from
   4 values to 3, and changed check from only lib.durations[] to
   lib:GetDuration() to properly track overflow debuffs with combo-scaled or
   learned durations.

These fixes ensure that:
- Overflow debuffs like Moonfire are properly detected by [nodebuff:] conditionals
- Duration tracking works for overflow debuffs with combo point scaling (Rip, Rupture)
- Duration tracking works for overflow debuffs with learned durations
- All existing combo point tracking functionality is preserved
2025-11-16 23:28:03 +00:00
Torio 3bc2a224d4 Merge pull request #41 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Protect confirmed tracking from evaluation overwrites
2025-11-16 17:51:02 -05:00
Claude adb079dd1d Protect confirmed tracking from evaluation overwrites
Prevent TrackComboPointCast from overwriting confirmed tracking with
unconfirmed evaluation data. Once DoCast confirms a cast, subsequent
macro evaluations will no longer overwrite the tracking entry.

This fixes the issue where pfUI's second AddEffect call would see
unconfirmed tracking because evaluations overwrote the confirmed data.
2025-11-16 22:50:15 +00:00
Torio 5ca1787f95 Merge pull request #40 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Fix pfUI AddEffect handling multiple calls
2025-11-16 17:47:11 -05:00
Claude ce8f1dcf7d Fix pfUI AddEffect handling multiple calls
Don't clear the confirmed flag after first use since pfUI may call
AddEffect multiple times for the same spell. Instead, rely on the
time-based expiry (0.5s timeout) to prevent stale tracking data.

This fixes the issue where the second AddEffect call would see
unconfirmed tracking and ignore the correct duration.
2025-11-16 22:46:17 +00:00
Torio 456ee38cc8 Merge pull request #39 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
CRITICAL: Add confirmation to DoCast hook
2025-11-16 17:40:25 -05:00
Claude b545f9bb3e CRITICAL: Add confirmation to DoCast hook
The issue: None of the CastSpellByName/CastSpell hooks were firing because
CleveRoid macros go through DoCast, not the standard casting functions.

Evidence from user output:
- Many "ComboTrack: Rip cast with 5 CP" messages ✓ (TrackComboPointCast called)
- NO "[Confirmed]" messages ✗ (no hooks firing)
- "[pfUI AddEffect Hook] Ignoring Rip tracking (not confirmed)" ✗ (never confirmed)

The DoCast integration was calling TrackComboPointCast but NOT setting
confirmed=true, so pfUI would always see unconfirmed tracking data.

Fix: Add confirmation in DoCast hook, just like all the other cast hooks.

Now when user casts via CleveRoid macros:
1. DoCast fires → TrackComboPointCast → confirmed=true ✓
2. pfUI AddEffect fires → sees confirmed=true → uses duration ✓
2025-11-16 22:39:17 +00:00
Torio e8cedffe97 Merge pull request #38 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Fix confirmation timing - confirm in cast hooks, not SPELLCAST_START
2025-11-16 17:36:00 -05:00
Claude f404496561 Fix confirmation timing - confirm in cast hooks, not SPELLCAST_START
CRITICAL FIX: For instant-cast spells, pfUI's AddEffect fires before
SPELLCAST_START, so confirmed flag was never set in time.

Event sequence for instant casts:
1. CastSpellByName hook → TrackComboPointCast (confirmed=false)
2. pfUI AddPending
3. SPELLCAST_STOP (instant cast completes)
4. pfUI PersistPending → AddEffect (confirmed still false!) ✗
5. SPELLCAST_START may not fire for instants

Solution: Confirm tracking immediately when cast functions are called:
- CastSpellByName_Hook → confirmed=true
- CastSpell_Hook → confirmed=true
- Hook global CastSpell → confirmed=true
- Hook global UseAction → confirmed=true
- SPELLCAST_START → confirmed=true (backup)

Now pfUI AddEffect (step 4) sees confirmed=true ✓

Added debug output showing:
"[Confirmed] Rip tracking confirmed (CastSpellByName)"

This ensures tracking is confirmed BEFORE pfUI tries to use it.
2025-11-16 22:34:33 +00:00
Torio 43d515fb11 Merge pull request #37 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Claude/improve combodurations 01 g hh5y6d xtx nhoiz dk8b sw3
2025-11-16 13:53:07 -05:00
Claude aedb2684b5 Add confirmation system to prevent pfUI from using evaluation-only tracking
Problem: Macro conditional evaluations create tracking entries, but
pfUI's AddEffect can fire during these evaluations (before actual cast),
causing it to use incorrect combo point data.

Flow before fix:
1. Macro evaluates [combo:>0] → TrackComboPointCast(0 CP, confirmed=false)
2. Macro evaluates again → TrackComboPointCast(1 CP, confirmed=false)
3. pfUI AddEffect fires → uses tracking (wrong timing!) ✗
4. SPELLCAST_START fires (actual cast)

Flow after fix:
1. Macro evaluates [combo:>0] → TrackComboPointCast(0 CP, confirmed=false)
2. Macro evaluates again → TrackComboPointCast(1 CP, confirmed=false)
3. SPELLCAST_START fires → sets confirmed=true ✓
4. pfUI AddEffect fires → only uses tracking if confirmed=true ✓

Changes:
- Added 'confirmed' field to tracking (default: false)
- SPELLCAST_START sets confirmed=true when spell actually casts
- pfUI AddEffect hook only uses tracking if confirmed=true
- Clear confirmed flag after use to prevent reuse
- Clear on failed/interrupted casts

Debug shows: "Ignoring X tracking (not confirmed - evaluation only)"
when preventing use of evaluation-only data.
2025-11-16 18:51:57 +00:00
Claude 7abb78c54e 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.
2025-11-16 18:49:12 +00:00
Torio 3c98627e5a Merge pull request #36 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Fix pfUI AddEffect timing - use name-based tracking instead of ID
2025-11-16 13:43:23 -05:00
Claude c9bd224c2b Fix pfUI AddEffect timing - use name-based tracking instead of ID
CRITICAL TIMING FIX: pfUI's AddEffect fires BEFORE UNIT_CASTEVENT!

Event sequence:
1. CastSpell → Extension hooks → name-based tracking stores 5 CP, 18s ✓
2. pfUI AddPending → GetDuration (base 10s)
3. SPELLCAST_STOP → pfUI AddEffect fires
4. Our AddEffect hook fires (ID tracking doesn't exist yet!) ✗
5. UNIT_CASTEVENT → ID-based tracking created ✓

Solution: Use name-based tracking (available at step 4) instead of
ID-based tracking (not created until step 5).

Changed pfUI AddEffect hook to:
- Use CleveRoids.ComboPointTracking[effect] (name-based)
- Check cast_time < 0.5s to ensure freshness
- This data exists when pfUI calls AddEffect

Now shows: "[pfUI AddEffect Hook] Overriding Rip duration to 18s"
Instead of: "[pfUI AddEffect Hook] Overriding Rip duration to 10s"
2025-11-16 18:41:39 +00:00
Jrc13245 e814a3f8de update real durations 2025-11-16 13:36:08 -05:00
Jrc13245 83b3938d6d update real durations 2025-11-16 13:32:18 -05:00
Torio 5689be77c6 Merge pull request #35 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Claude/improve combodurations 01 g hh5y6d xtx nhoiz dk8b sw3
2025-11-16 13:22:52 -05:00
Claude 3e669a7b7a Fix pfUI integration - use unit names and spell names, not GUIDs/IDs
CRITICAL FIX: pfUI's libdebuff uses completely different data structures:
- Uses unit NAME (not GUID)
- Uses unit LEVEL as a key
- Uses spell NAME (effect, not ID)
- Storage: pflib.objects[unitName][unitLevel][effectName]

Fixed SyncComboDurationToPfUI:
- Convert GUID to unit name (check target, fallback to guidToName map)
- Get unit level from target or default to 0
- Convert spell ID to spell name using SpellInfo()
- Remove rank from spell name to match pfUI's format
- Search both specific level and level 0 (pfUI's fallback)

Fixed AddEffect hook:
- Updated parameters to match pfUI signature: (unit, unitlevel, effect, duration, caster)
- Check spell by name instead of ID
- Map spell name back to ID to find tracking data

This ensures pfUI's cooldown displays show correct combo durations.
2025-11-16 18:20:51 +00:00
Claude d6b4ae3d97 Add direct pfUI duration synchronization for combo spells
After analyzing pfUI's cooldown module, we need to directly sync
combo durations to pfUI's libdebuff.objects storage:

- Added SyncComboDurationToPfUI function to force-update pfUI's
  stored debuff duration after tracking combo spells
- Called from UNIT_CASTEVENT handler after AddEffect
- This ensures pfUI's cooldown display shows the correct combo
  duration (e.g., 28s for 5 CP Rip) instead of base 12s

pfUI's cooldown module is just a display layer - it shows durations
from pfUI.api.libdebuff.objects. By directly updating this storage,
we ensure the correct duration is displayed regardless of timing.
2025-11-16 18:18:41 +00:00
Claude 60bf1741ed Add pfUI cooldown integration for combo-aware durations
Hook into pfUI.api.libdebuff to inject combo-based durations:
- Hook GetDuration: Returns learned combo durations for combo spells
- Hook AddEffect: Injects tracked combo durations when debuffs are applied

This ensures pfUI's cooldown module displays the correct duration
(e.g., 28s for 5 CP Rip instead of base 12s).

Debug messages show when pfUI hooks are triggered in debug mode.
2025-11-16 18:15:33 +00:00
Torio 51f4d056fb Merge pull request #34 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Fix combo point tracking - use name-based tracking as fallback
2025-11-16 13:11:53 -05:00
Claude e7152e3683 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.
2025-11-16 18:04:20 +00:00
Torio f5d393fa0d Merge pull request #33 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Add comprehensive debug tracing for combo duration system
2025-11-16 13:00:28 -05:00
Claude e8e5f7d1f3 Add comprehensive debug tracing for combo duration system
Added debug output at all critical points in the duration tracking flow:
- UNIT_CASTEVENT handler: Shows calculated duration and CP count
- lib:GetDuration: Shows which source provided the duration (learned combo/caster/static)
- lib:AddEffect: Shows what duration was actually stored
- SeedUnit: Shows what duration is used when rescanning debuffs/buffs

This will help diagnose why combo durations aren't being applied correctly.
2025-11-16 17:46:30 +00:00
Torio bff42689f4 Merge pull request #32 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Fix nil comparison error in spell_tracking cleanup loop
2025-11-16 12:39:55 -05:00
Claude bb7cd24761 Fix nil comparison error in spell_tracking cleanup loop
BUGFIX: Core.lua:2253 attempt to compare nil with number

The cleanup loop was checking 'if time > cast.expires' but some entries
in spell_tracking (like combo tracking data) don't have an expires field.

Added nil check: 'if cast.expires and time > cast.expires'

This prevents errors when combo tracking data is in spell_tracking without
an expiration time.
2025-11-16 17:39:16 +00:00
Torio a58ed4166c Merge pull request #31 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Fix debuff conditionals using wrong max duration for combo spells
2025-11-16 12:35:38 -05:00
Claude 7b79b45130 Fix debuff conditionals using wrong max duration for combo spells
CRITICAL FIX: Debuff conditionals like [debuff:Rip<4] were using base
duration (12s) instead of actual combo duration (28s for 5 CP).

**Problem:**
- SeedUnit rescans debuffs on target change/UNIT_AURA events
- It called lib:GetDuration(spellID) without combo awareness
- This overwrote combo-aware durations with base durations
- pfUI cooldown module showed wrong max duration (12s vs 28s)
- Conditional [debuff:Rip<4] triggered at wrong times

**Solution:**
1. Updated lib:GetDuration to accept optional comboPoints parameter
2. Checks CleveRoids_ComboDurations[spellID][cp] FIRST before other sources
3. Priority: combo learned > caster learned > static database
4. SeedUnit now uses highest learned CP duration as fallback
5. When rescanning combo spells, assumes 5 CP if learned

**Benefits:**
- [debuff:Rip<4] now uses actual 28s max duration (5 CP)
- pfUI cooldown displays correct duration
- Conditionals trigger at correct times
- Prevents base duration from overwriting learned duration

**Example:**
Cast Rip with 5 CP (28s), macro refreshes at <4s remaining (24s used)
Previously: Would refresh at <4s of 12s base (8s used) - TOO EARLY!
2025-11-16 17:33:27 +00:00
Torio d902da371b Merge pull request #30 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Add learned combo duration system - saves actual durations per CP
2025-11-16 12:25:59 -05:00
Claude 1172e3377b Add learned combo duration system - saves actual durations per CP
Major enhancement: System now learns actual combo finisher durations and
saves them per combo point level (1-5 CP).

**New SavedVariable:**
- CleveRoids_ComboDurations[spellID][comboPoints] = duration
- Persists between sessions
- Uses learned durations before calculated formulas

**ComboPointTracker.lua:**
- Added GetLearnedComboDuration(spellID, cp) - fetch learned duration
- Updated CalculateComboScaledDurationByID to check learned first
- Falls back to formula if not learned yet

**Utility.lua (libdebuff):**
- UNIT_CASTEVENT handler stores combo points in learnCastTimers
- RAW_COMBATLOG fade handler learns combo durations when spells expire
- Stores learned duration keyed by [spellID][comboPoints]
- Debug message shows "Learned combo spell X at Y CP = Zs"

**Core.lua:**
- New command: /cleveroid combolearn - Show all learned combo durations
- Lists each spell with all learned CP levels (1-5)
- Shows which durations have been learned vs not yet

**Benefits:**
- Debuff conditionals like [debuff:Rip<4] now use ACTUAL max duration
- Accounts for talents that modify finisher durations
- Learns different durations per rank
- More accurate than formulas for edge cases

**Example:**
After casting Rip with 5 CP and letting it expire, system learns:
CleveRoids_ComboDurations[1079][5] = 28
Future casts use 28s instead of calculated 12+4*4
2025-11-16 16:49:30 +00:00
Torio 1c9d6f0505 Merge pull request #29 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Fix combo point tracking - capture CPs before they're consumed
2025-11-16 11:42:12 -05:00
Claude e07afa32d0 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.
2025-11-16 16:41:19 +00:00
Torio 9d2803dbd5 Merge pull request #28 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Add debug output to diagnose ShowComboTracking loading issue
2025-11-16 11:34:56 -05:00
Claude 3704ae0c23 Add debug output to diagnose ShowComboTracking loading issue
Added debug messages to confirm:
1. Whether ShowComboTracking is defined after being created
2. Whether it's successfully exported to global
3. Whether RegisterExtension exists when file loads

This will help identify why ShowComboTracking is nil at runtime.
2025-11-16 16:25:55 +00:00
Torio ea1dd9617c Merge pull request #27 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Fix ShowComboTracking not being defined - restructure file loading
2025-11-16 10:55:31 -05:00
Claude a14fe4ac74 Fix ShowComboTracking not being defined - restructure file loading
CRITICAL FIX: Moved all essential functions BEFORE Extension registration to
ensure they're always available even if Extension system fails.

Changes:
- Moved ShowComboTracking() definition to line 240 (before Extension)
- Moved slash command registration to before Extension
- Export CleveRoids to global BEFORE Extension.RegisterExtension()
- Added safety check: return early if RegisterExtension doesn't exist
- Removed duplicate function definitions at end of file
- Added helpful message when no combo data tracked yet

This ensures /cleveroid combotrack works even if Extension system fails.
2025-11-16 15:53:45 +00:00
Torio 491321d666 Merge pull request #26 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
merge
2025-11-16 10:51:02 -05:00
Claude 18c11eb8b3 Show all available commands when typing /cleveroid
When typing /cleveroid with no arguments, now displays:
1. Current settings (realtime, refresh, debug)
2. All available commands organized by category:
   - Basic commands (realtime, refresh, learn, forget, debug)
   - Immunity tracking commands
   - Combo point tracking commands

Makes it easier for users to discover all available functionality.
2025-11-16 15:49:55 +00:00
Claude 318292854c Fix loading order: ComboPointTracker must load after ExtensionsManager
ComboPointTracker.lua calls CleveRoids.RegisterExtension() but was loading
before ExtensionsManager.lua where that function is defined.

Moved ComboPointTracker.lua to load after ExtensionsManager.lua.

This fixes the 'attempt to call field ShowComboTracking (a nil value)' error.
2025-11-16 15:48:42 +00:00
Torio 0a7ee4dcc0 Merge pull request #25 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Fix combo tracking commands - remove load-time existence checks
2025-11-16 10:45:52 -05:00
Claude 3d6f03336c Fix combo tracking commands - remove load-time existence checks
The combotrack/comboclear commands were checking if functions existed at
file load time, but ComboPointTracker.lua loads after Core.lua, so the
checks always failed. Removed the checks since by runtime (when the user
executes the command) all files will be loaded and functions will exist.

Fixes "Combo point tracking not available" message.
2025-11-16 15:44:24 +00:00
Torio 2ca5113108 Merge pull request #24 from jrc13245/claude/improve-combodurations-01GHh5y6dXtxNhoizDK8bSw3
Improve combo point duration tracking system
2025-11-16 10:33:43 -05:00
Claude 4cf8e07a17 Improve combo point duration tracking system
Major enhancements to the combo point finisher tracking system:

**ComboPointTracker.lua:**
- Added spell ID-based tracking (ComboScalingSpellsByID table)
- All Rupture ranks (1943, 8639, 8640, 11273, 11274, 11275): 8s + 2s per CP
- Kidney Shot ranks (408, 8643): Rank 1: 1s + 1s per CP, Rank 2: 2s + 1s per CP
- Druid Rip ranks (1079, 9492, 9493, 9752, 9894, 9896): 12s + 4s per CP (corrected from 10s + 2s)
- New TrackComboPointCastByID() function for UNIT_CASTEVENT integration
- Initialize spell_tracking table to prevent nil errors
- Consistent debug output using CleveRoids.debug flag

**Utility.lua (libdebuff integration):**
- UNIT_CASTEVENT handler now checks combo scaling spells first
- Calls TrackComboPointCastByID() before normal duration lookup
- Learning system skips combo spells (they're dynamically calculated)
- Improved debug messages distinguish combo spells from regular spells

**Core.lua (console commands):**
- Added /cleveroid combotrack - Display recent combo finisher casts
- Added /cleveroid comboclear - Clear combo tracking data
- Updated help text with combo point tracking section

**README.md:**
- New "Combo Point Scaling" section with examples
- Updated settings documentation with new commands
- Added /cleveroid debug to settings list
- Example macros showing combo point-aware debuff conditionals

This system ensures accurate duration tracking for:
- Rogue: Rupture (8-16s), Kidney Shot (1-6s)
- Druid: Rip (12-28s)

All durations are now calculated based on actual combo points used at cast time.
2025-11-16 15:31:38 +00:00
Torio 4d288cd482 Merge pull request #23 from jrc13245/main
merge
2025-11-16 10:23:13 -05:00
Jrc13245 edfb44edd7 another fix 2025-11-16 10:03:56 -05:00
Jrc13245 68ea467e1a fix gitignore 2025-11-16 10:02:38 -05:00
Jrc13245 03bfa82d87 update readme 2025-11-16 09:59:59 -05:00
Jrc13245 93c73e8d93 update readme 2025-11-16 09:56:54 -05:00
Jrc13245 1610920dda immunity tracking system 2025-11-16 09:46:51 -05:00