# CritMatic

## [v0.5.3.0](https://github.com/InfiniteLoopAlchemist/CritMatic/tree/v0.5.3.0) (2026-04-11)
[Full Changelog](https://github.com/InfiniteLoopAlchemist/CritMatic/compare/v0.5.2.1...v0.5.3.0) 

- docs: note TBC/Wrath/Classic multi-interface support in v0.5.3.0 changelog  
- Merge pull request #18 from Alessandro-Barbieri/patch-1  
    readd TBC version  
- chore: bump to v0.5.3.0  
    Release bundles: tooltip overflow fix (#17), CLEU safety fixes,  
    Reset-by-reference fix, Retail 11.x API shims, dead code removal.  
    See CHANGE_LOG.md for details.  
- chore: delete dead code and CritLog cleanups  
    - Delete IsSpellInSpellbook — zero callers anywhere in the codebase.  
    - Rename CritLog.lua loop variable `frame` to `spellFrame` to avoid  
      shadowing the outer Constructor upvalue.  
    - Hoist scrollContainer:SetVerticalScroll(0) out of the per-spell  
      ipairs loop so it runs once after the loop, not once per entry.  
- fix: Retail 11.x WoW API compatibility shims  
    - Add _GetSpellCooldown shim that tries C_Spell.GetSpellCooldown (new  
      Retail API), falls back to the legacy global. Mirrors the existing  
      _IsAddOnLoaded and _GetAddOnMetadata shim pattern.  
    - Switch spellbook hook to use GetSpellBookItemInfo which returns  
      spellID as a documented return, instead of relying on an accidental  
      3rd return value of GetSpellBookItemName. Also falls through to  
      C_SpellBook.GetSpellBookItemInfo for newer clients, and keeps the  
      legacy select(3) path as final fallback.  
- fix: Reset* handlers no longer mutate shared defaults by reference  
    All Reset*ToDefault functions previously copied subsections of the  
    defaults table by reference. When a user clicked Reset and then edited  
    the setting, they mutated the same table that AceDB uses for defaults,  
    polluting new profiles and making subsequent Resets no-ops.  
    Switched to CopyTable(Critmatic.db.defaults.profile.X) which performs  
    a deep copy and reads from the defaults table AceDB stores on the db  
    object. Scalar assignments (xPos, yPos) just use Critmatic.db.defaults  
    directly since they don't need copying.  
    Same fix applied to the legacy defaults.profile read in  
    CritLog.lua CritLogDefaultPosFrame — now reads from Critmatic.db.defaults  
    for consistency.  
    Also removed the dead `dataCleared = false` field from the defaults  
    table — it was never read or written anywhere else in the codebase.  
- fix: CLEU handler crash paths, operator precedence, dead events  
    - Add parentheses around (player OR pet) source check so destGUID,  
      eventType, and amount filters are actually applied to player-sourced  
      events. Previously the player-source branch bypassed all safety  
      checks due to Lua's and-before-or precedence.  
    - Guard amount with `amount and amount > 0` to handle nil amount from  
      unusual event shapes.  
    - Replace O(N) for-pairs loops over ignoredSpells/ignoredTargets with  
      O(1) hash lookups. Keys are already stored lowercased.  
    - Guard `baseSpellName:lower()` and `strsplit("-", destGUID)` against  
      nil values (real edge cases for uncached spellIDs and environmental  
      damage events).  
    - Add RANGE_DAMAGE to the event extraction elseif and the damage  
      handling branch so ranged crits are actually tracked.  
    - Fall back to "Auto Attack" display name when GetSpellInfo(6603)  
      returns nil on clients that don't resolve the swing spellID.  
    - Raise MAX_HIT from 40000 to 1e9 so Wrath/Retail endgame crits stop  
      being silently dropped. The ceiling stays as a sanity check.  
    - Unregister PLAYER_LOGIN and GROUP_JOINED events that were registered  
      but had no handler.  
- fix: tooltip overflow with StatWeightsClassic (#17)  
    Refactored AddHighestHitsToTooltip so Show() is called once per render  
    instead of inside the per-spell loop, and only when lines were actually  
    added. This fixes crit/hit lines rendering outside the tooltip frame when  
    other tooltip addons (StatWeightsClassic, etc.) are present.  
    Also replaced the module-level spellDataAggregate table with local  
    variables, added early returns on non-spell actions and nil  
    localizedSpellName, and limited the CritMaticData iteration to the  
    current spell only.  
- readd TBC version for good this time  