# Changelog

## v1.4.0

### New Features
- **Sequence sound mode:** Configure a list of sounds that play one per hit for multi-hit spells like Rampage. Each successive hit advances through the sound list, creating a combo-style strike sequence. Works with any number of sounds and wraps around when the list is exhausted. Select "Sequence (1 per hit)" in the spell editor's sound mode radio to enable.
- For single-hit spells, sequence mode cycles through sounds across casts (each cast plays the next sound in the list).

### Bug Fixes
- Fix `refreshPresetsFromTemplates` overwriting user-customized sounds on every login/reload. Template refresh now only updates mute data (muteExclusions, muteFIDs) and preserves user sound and multiHitWindow settings.

## v1.3.5

### New Features
- **Multi-hit sound window:** Configurable time window that prevents multi-hit spells (e.g. Rampage, Raging Blow) from playing their replacement sound on every hit. Defaults to 1.5 seconds globally, adjustable per spell in the spell editor or globally in the General tab. Resolves the behavior change from v1.2.0 where name-based config fallback caused all sub-hits to trigger sounds.

### Bug Fixes
- Fix Whirlwind not muting its modern cast sounds. The 5 caster-side FIDs (whoosh sounds) were in ExcludedFIDs as over-shared; added explicit `muteFIDs` to both Whirlwind templates (1680, 190411).
- Set Bladestorm template to a 5-second multi-hit window (non-channeled spell that fires repeated hits over ~4s).

## v1.3.4

### Bug Fixes
- Fix channeled spells (e.g. Tranquility) playing replacement sounds on every tick. Channeled spells now play on `UNIT_SPELLCAST_CHANNEL_START` and suppress all subsequent `UNIT_SPELLCAST_SUCCEEDED` tick events — including sub-spells with different IDs that resolve to the same config via name matching.
- Fix Mark of the Wild echo caused by unmuted original retail sounds playing alongside the replacement. Added `muteFIDs` for the two excluded FIDs (568735, 568917).
- Fix auto-mutes silently inactive on first install or after the Resonance_Data folder restructure — eagerly load Resonance_Data during `OnEnable` when no auto-mute snapshot exists, instead of waiting for Options to be opened.
- Fix multiple template spells across 6 classes whose original sounds were never muted because their FIDs were in ExcludedFIDs (over-shared) with no explicit `muteFIDs`. Affected spells: Shield Slam, Pummel, Rend, Shield Block, Colossus Smash (Warrior), Rapid Fire (Hunter), Greater Invisibility, Shimmer (Mage), Chain Lightning, Ascendance (Shaman), Breath of Fire (Monk), Ravager (Warrior).
- Fix empty auto-mute snapshot (`{}`) incorrectly treated as valid — now checks `next() ~= nil` instead of truthiness.
- Update Bladestorm template to WotLK-era sounds (heroicthrowmissile + FX_Lightning_Impact_Heavy03).

## v1.3.2

### New Features
- **Alerts tab:** Configure alert sounds for combat events with a dropdown + table UI. Select an event type, pick a sound (with autocomplete search), and manage alerts with enable/disable toggles.
  - **Interrupt alert:** Play a sound when your cast is interrupted by an enemy kick or counterspell. Uses `LOSS_OF_CONTROL_ADDED` + `UNIT_SPELLCAST_INTERRUPTED` dual-direction correlation — fully compatible with Midnight 12.0.1 instanced content.
  - **Loss of Control alert:** Play a sound when you are stunned, feared, silenced, or otherwise lose control of your character.
  - **Death alert:** Play a sound when you die.
- **Custom Sounds tab:** Register your own .ogg/.mp3 sound files and use them throughout the addon. Place files in `Interface/AddOns/Resonance_Sounds/`, register them with a display name, and they appear in all sound search autocomplete dropdowns (highlighted in green).
- **Per-spell sound channel:** Override the sound channel for individual spells in the spell editor. Route specific replacement sounds to Master, SFX, Music, Ambience, or Dialog — useful for adjusting relative volume of replacements vs. game sounds.
- **Cast phase triggers:** Choose when spell replacement sounds play — on cast complete, cast bar start (precast), or both with separate sounds for each phase.
- **Sound duration cutoff:** Limit how long a replacement sound plays (in seconds).
- **Sound looping:** Loop a replacement sound continuously or a set number of times.
- **Ambient sound muting:** Mute ambient sounds by zone with per-zone toggles in a new Ambient tab. Includes a search feature to find and mute individual ambient sounds, with expansion/zone info in results.
- **Per-NPC sound muting:** Mute sounds from specific NPCs.
- **Sound autocomplete:** Autocomplete dropdown when selecting replacement sounds, with a redesigned two-line layout showing expansion/zone and FID info.
- **Rogue Shadowstrike** added to class sound templates.

### UI/UX Improvements
- Options panel reorganized into Settings subcategories with dedicated panels and tab headings.
- Redesigned dropdown rows with per-row variable height and inline mute icon button with visual feedback.
- Improved WCAG contrast and color consistency across the UI.
- Sound channel dropdown now uses Blizzard's localized global strings — labels match the game's Sound settings in every language.
- Preset spells deleted by the user no longer auto-repopulate on login. Excluded spells are tracked and skipped during template refresh. Re-applying a class template clears the exclusion list.

### Performance
- **LoadOnDemand data split:** Addon split into Resonance (core) + Resonance_Data, deferring large data tables until options are first opened.
- Memory optimizations: table reuse, deferred snapshots, prefix pools, eliminated string concatenation during search.

### Bug Fixes
- Fix crash when copying AceDB profiles — nil-guard tables that may not exist after profile copy (`mute_file_data_ids`, `spell_config`, etc.).
- Fix custom panels (Spell Sounds, Presets, Ambient) showing empty on first visit — add deferred refresh after initial build to allow WoW's layout pass to complete.
- Fix Resonance_Data not found after addon update — moved to its own folder with BigWigs packager `move-folders` directive.
- Fix CI lint failures — extract only `read_globals` from the WoW API globals file instead of loading the full config.
- Fix UNIT_MODEL_CHANGED spam: cache race/gender key so vocalization mute refreshes only trigger on actual changes (barbershop, Orb of Deception), not on every model update.
- Auto-migrate stale creature vox snapshots on addon upgrade.
- Exclude profession sound FIDs from creature vocalization muting.
- Clear stale mute snapshots on startup.
- Use MAX_MUTE_DEPTH unmutes in all clear functions to properly drain refcount.
- Fixed various UI layout issues (editor overlap, duration anchoring, ambient tab positioning, preview button placement).
- Fixed mojibake caused by UTF-8 arrow character in disabled message.

### Tooling
- Added luacheck and StyLua linting/formatting with CI workflow.
- Cross-platform dev setup docs in README (macOS, Linux apt/pacman, Windows).
- `/res checkfid <id>` diagnostic command to inspect which muting systems affect a given FileDataID.
- `tools/generate_ambient_data.lua` for generating ambient sound data.

### Localization
- All new keys translated across 9 languages (ptBR, deDE, frFR, esES, itIT, ruRU, koKR, zhCN, zhTW).

## v1.2.0

### New Features
- **Mute-only mode:** Mute all sounds from a spell without selecting a replacement. Enable "Mute only" in the spell editor to silence original sounds with nothing playing in their place.
- **Profession sound muting:** Per-profession checkboxes (Alchemy, Blacksmithing, Cooking, etc.) to mute crafting, gathering, and other profession-related sounds. 13 professions, 168 unique sound files.
- **Shared-sounds disclaimer:** General tab now shows a note explaining that some sounds are shared across multiple spells/effects, so muting for one feature may silence them elsewhere.

### Tooling
- `tools/spell_sounds.py --generate-profession-data` generates `data/ProfessionSoundData.lua` from DB2 SkillLine/SkillLineAbility data.

## v1.1.0

### New Features
- **Classic auto-shot sounds (Hunter):** Replace modern bow and gun auto-shot sounds with classic ones. Automatically detects equipped weapon type (bow/crossbow or gun). Toggle in General options (Hunter only).
- **Disable state:** When "Enable Resonance" is unchecked, all General tab controls are now visually disabled and muting options revert to defaults, making it clear the addon is inactive.
- **Version display:** Minimap tooltip now shows the addon version.

### Bug Fixes
- **Revenge** sound mapping corrected — was playing DecisiveStrike.ogg instead of dedicated warrior_revenge sounds.
- **Bladestorm** sound mapping corrected — was playing WhirlwindShort.ogg instead of dedicated warrior_bladestorm sound.
- **Heart Strike** sound mapping corrected — was playing Blood Strike sounds instead of dedicated deathknight_heartstrike sounds.
- **Addon icon** in the AddOns menu now matches the minimap button icon.

### Creature Vocalization Improvements
- Added fidget (idle roars/growls), alert (pre-aggro), and jump sounds to creature vox muting — previously only combat sounds were covered.
- Narrowed spell FID exclusion to player spells only — NPC abilities no longer incorrectly protect their creature's own vox sounds from being muted.
- Total creature vox coverage increased from ~40K to ~61K sound files (+54%).

## v1.0.0

- Initial release.
