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.
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.
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.
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.
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.
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.
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!
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
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.
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.
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.
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.
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.
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.
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.