Skip to content

Conversation

@Xian55
Copy link
Owner

@Xian55 Xian55 commented Jan 28, 2026

Summary

This PR introduces a comprehensive refactoring of the input system with full modifier key support (Shift, Ctrl, Alt), automatic action bar slot detection, and significant UI improvements including a new keyboard layout visualizer and dedicated talents page.

Key Features

  • Modifier Key Support - Full support for Shift, Ctrl, and Alt modifiers throughout the input pipeline
  • Auto-Detection of Action Bar Slots - Automatically detect spells, macros, trinkets, food/drink by texture and hash matching
  • Keyboard Layout Visualization - New KeyboardLayoutComponent showing all keybindings with validation status
  • Dedicated Talents Page - Full talent tree display with spell icons and rank badges
  • IconDB with O(1) Lookups - Reverse indexes for efficient spell-to-texture resolution
  • BindPad Integration - Fixes secure macro button compatibility with TBC Classic 2.5.5+

Changes

DataToColor Addon Changes (v1.8.1 → v1.9.0)

  • Version bump to 1.9.0 with expanded frame count (NUMBER_OF_FRAMES: 108 → 111)
  • Add new data slots for keybindings (106), textures (107), and macros (108)
  • Add SetupDefaultBindings.lua for automated keybinding configuration
  • Add new slash commands: /dcbindings, /dcactions
  • Add ClearAllQueues() method for comprehensive state flush
  • Add ScheduleAutoSetup() for deferred auto-setup of bindings on login
  • Add IsVanilla() helper for version detection
  • Add DataToColor:PS() function for spellbook spell placement by name prefix
  • Improve SetupRequirements() with camera, graphics, and display settings:
    • Camera following style, smooth tracking, follow speed
    • Anti-aliasing disabled, VSync off, render scale 100%
    • Glow effect disabled for cleaner pixel reading
  • Fix spellbook grouping: Group by base spell name instead of texture to handle spells sharing icons
  • Use BindPad addon for secure macro buttons (fixes Blizzard's SecureActionButtonTemplate patch)
  • Wildcard attributes (*type*, *macrotext-NAME) for custom actions

Input System Refactoring

  • Add ModifierKey flags enum (None, Shift, Ctrl, Alt) in SharedLib
  • Update ConfigurableInput to use PressRandomWithModifier() for modifier-aware key presses
  • Enhance InputWindowsNative with keyboard layout translation via TranslateKeyForLayout()
  • Add modifier injection helpers PressModifiersDown() / ReleaseModifiersUp()
  • Refactor WowProcessInput with new PressRandomWithModifier() method
  • Major KeyReader refactoring to parse and resolve modifiers from bindings

Action Bar Auto-Detection

  • Add ActionBarTextureReader - Reads texture IDs from action bar slots (24-bit encoded)
  • Add ActionBarMacroReader - Reads macro name hashes using DJB2 algorithm
  • Add ActionBarSlotValidator - Validates action bar configuration against class profile
  • New Lua modules: ActionBarTextures.lua, ActionBarMacros.lua
  • Auto-detect trinkets, food/drink, and shoot actions via equipment texture matching
  • Support for form-changing spells (Cat Form, Bear Form, Stances) with dynamic texture handling

Database Improvements

  • Rename SpellIconDBIconDB (handles all action bar icons, not just spells)
  • Add reverse indexes: spellIdToTexture, spellNameToTextures for O(1) lookups
  • Add GetFamilyTextures() for dynamic icon spells (Aspects, Auras)
  • Use FrozenDictionary and FrozenSet for zero-allocation lookups
  • Add KeyBindingsReader to track game keybindings with change events

Frontend Enhancements

  • Add KeyboardLayoutComponent.razor - Full keyboard visualization with:
    • Function keys, number row, QWERTY layout, numpad
    • Color-coded binding status (green=set, yellow=missing, purple=configured)
    • Spell icons on action bar keys
    • Validation summaries and setup buttons
  • Add Talents.razor - Dedicated talents page with full talent trees
  • Update TalentTreeComponent with spell icon integration
  • Add SpellBookComponent with thread-safe hash-based caching
  • Update GoapGoalView to display resolved keybindings and fix pyramid indentation

Data Files

  • Add spelliconmap.json for all game versions (TBC, Wrath, Cata, SoM, MoP)
  • Add iconnames.json with ~6500 icon names (expanded from ~1700)
  • Update class profiles for correct spell names and modifier support

Files Changed

Area Files
Input System ConfigurableInput.cs, InputWindowsNative.cs, WowProcessInput.cs, KeyReader.cs, ModifierKey.cs
Action Bar Detection ActionBarMacroReader.cs, ActionBarTextureReader.cs, ActionBarSlotValidator.cs
Database IconDB.cs, ItemDB.cs, TalentDB.cs, KeyBindingsReader.cs
Frontend KeyboardLayoutComponent.razor, Talents.razor, TalentTreeComponent.razor, GoapGoalView.razor
Addon ActionBarMacros.lua, ActionBarTextures.lua, SetupDefaultBindings.lua

Testing

  • Verify modifier key combinations work in-game (Shift-1, Ctrl-F, etc.)
  • Test auto-detection of action bar slots after placing spells
  • Validate trinket/food/drink detection with different equipment
  • Check keyboard layout component shows correct binding status
  • Test talent tree display for all classes
  • Verify BindPad integration works on TBC Classic 2.5.5+

Media

Actionbar / Keybind issues
image

Detect missing abilitites
image

Talents
image

Keybindings
image
image
image

Spellbook
image

GoapGoal
image

🤖 Generated with Claude Code

Xian55 and others added 18 commits January 26, 2026 00:54
…ueue flush fixes

## Input System Overhaul

### Modifier Key Support
- Add ModifierKey enum (SharedLib) with Shift, Ctrl, Alt flags
- Add PressRandomWithModifier() to WowProcessInput for key+modifier combinations
- Update ConfigurableInput.PressRandom(KeyAction) to use modifiers when present
- Fix all fast-press methods (PressFastInteract, PressApproachOnCooldown,
  PressFastLastTarget, PressDismount) to respect modifier keys
- Fix InteractMouseOver() to use InteractMouseoverModifier property
- Add centralized PressFlushKey() method for SHIFT-PAGEDOWN flush hotkey
- Update logging to include modifier prefix in key press messages

### KeyBindings System (New)
- Add BindingID enum with all WoW binding identifiers (movement, targeting,
  combat, interaction, action bars, custom actions)
- Add KeyBindingsReader to decode binding data from addon
- Add SetupDefaultBindings.lua for reading and setting WoW keybindings
- Create secure buttons for custom actions (StopAttack, ClearTarget, Config, Flush)
  using SecureActionButtonTemplate (same technique as BindPad)
- Auto-setup essential bindings on addon load if missing
- Add /dcbindings and /dcactions slash commands

### Action Bar Validation (New)
- Add ActionBarSlotValidator for validating spell placement on action bars
- Add ActionBarTextureReader to read action bar slot textures from addon
- Add SpellIconDB for spell name to texture ID mapping
- Add HasDynamicIcon() to skip validation for Hunter Aspects and Paladin Auras
  (these change texture when active)
- Add IsActiveFormSpell() to skip validation for form spells when in that form
- Support macros (lowercase names convention) in validation - check for empty slots

### Queue Flush Fix
- Add TimedQueue:clear() method in Collections.lua to properly reset queues
- Add DataToColor:ClearAllQueues() to clear all TimedQueues on flush
- Call ClearAllQueues() in FushState() to prevent stale queue items
- This fixes the issue where first queue elements were missing after Init State

### HeadlessServer Improvements
- Replace text command flush with PressFlushKey() hotkey
- Add KeyBindingsReader to InitState() waiting loop
- Remove unused ExecGameCommand and AddonConfigurator dependencies

### Frontend Updates
- Add Init State button to KeyboardLayoutComponent (next to Sync Actionbar)

### Addon Changes
- Increase NUMBER_OF_FRAMES to 111 (add binding and texture queue slots)
- Add bindingQueue and actionBarTextureQueue
- Add ActionBarTextures.lua for reading action bar slot textures
- Improve SetupRequirements() with better CVar settings (camera, graphics)
- Fix PopulateSpellBookInfo() to group by base spell name, not texture
  (fixes spells with same icon but different abilities)

### Code Cleanup
- Remove InputSimulator (was using SendInput, now all via PostMessage)
- Remove BindPad addon (replaced by secure button system)
- Remove TextCopy dependency
- Refactor KeyReader to use keybindings instead of hardcoded key mappings
- Add keyboard layout translation in InputWindowsNative for OEM keys

### Naming Fix
- Rename FOCUSTARGET to TARGETFOCUS to match WoW's actual binding name
Display 18x18 pixel spell icons next to talent names using SpellIconDB.
Also fixed wowhead tooltip attribute from item= to spell=.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- SpellBookReader: Add Hash property and snapshot array for thread-safe iteration
- SpellBookComponent: Subscribe to AddonDataChanged, only re-render when hash changes
- Replace non-functional Refresh button with InitButton component
- Pre-allocate List capacity to avoid reallocations

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Enhance action bar slot tooltips with real-time information from readers:
- Spell cost (mana, rage, energy, etc.)
- Cooldown remaining when active
- "Active" when spell is being cast
- "Not Usable" when conditions aren't met

Co-Authored-By: Claude Opus 4.5 <[email protected]>
When KeyAction uses slot-based auto-detection without explicit Key property,
resolve and display the actual key binding from KeyBindingsReader instead
of showing empty brackets.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Remove nested table structure that caused compounding padding on child
rows. Child rows now render as direct siblings with CSS-based indentation.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add TextureId field to Item struct for icon lookup
- ItemDB: Add GetFoodTextures/GetDrinkTextures methods
- KeyReader: Add ResolveFromItemAlias to find consumables on action bar
- ItemExtractor: Extract IconFileDataID from item.csv
- ReadDBC_CSV: Refactor to CLI with version/build/extractor selection
- Update items.json for all versions with TextureId data

Food/Drink KeyActions now auto-detect their action bar slot when
Key/Slot properties are not specified, by matching item textures.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add TryGetTexture() to ItemDB for looking up item textures by ID
- Add EquipmentReader static reference to KeyReader for equipment access
- Extend IsItemAlias() to recognize Trinket 1, Trinket 2, and Shoot
- Update ResolveFromItemAlias() to detect equipment-based items by:
  - Reading item ID from equipment slot (Trinket_1=13, Trinket_2=14, Ranged=18)
  - Looking up the item's texture ID in ItemDB
  - Finding matching action bar slot via texture matching
- Add Trinket 1/2 and Shoot to HasDynamicIcon() to skip validation

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Addon changes:
- Add ActionBarMacros.lua: Sends macro name hashes using DJB2 hash (24-bit)
- Expose SlotToIndex/IndexToSlot mappings for reuse
- Add DataToColor:PS() function for spellbook spell placement by name prefix
- Register ActionBarMacros.lua in all TOC files

Core changes:
- Add ActionBarMacroReader: Decodes macro name hashes from addon pixels
- Add macro resolution priority in KeyReader (before spell texture matching)
- Cache MacroActions in ClassConfiguration for efficient re-resolution
- Handle macro changes in BotController with automatic key re-resolution
- Fix ActionBarPopulator to use PS() for ranked spell placement

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Blizzard patched SecureActionButtonTemplate macrotext in recent clients,
breaking dynamically created secure buttons. BindPad's button works due
to its initialization approach.

Changes:
- Add BindPad addon as bundled dependency
- Update SetupDefaultBindings.lua to use BindPadMacro button
- Use wildcard attributes (*type*, *macrotext-NAME) for custom actions
- Bindings use format: CLICK BindPadMacro:actionName

Custom actions (ClearTarget, StopAttack, Config, Flush) now work in
TBC Classic 2.5.5 and other modern Classic clients.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The old names were misleading - these handle ALL action bar icons,
not just spell icons. Changes:

- SpellIconExtractor.cs -> IconExtractor.cs
- SpellIconDB.cs -> IconDB.cs
- Extractor command: "spellicon" -> "icon"
- Output ALL icons from Interface\Icons\ (~6500 vs ~1700)
- Update all consumers to use new IconDB name
- Fix Mage profiles to use correct spell name "Conjure Water"

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Replace chained string.Equals() calls with FrozenSet.Contains() for
IsItemAlias() and HasDynamicIcon() methods, providing O(1) lookups
with case-insensitive comparison.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Build spellIdToTexture and spellNameToTextures indexes during
initialization to replace O(n×m) iterations in GetIconUrlForSpell
and GetTexturesForSpellName with O(1) dictionary lookups.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Spells like Hunter Aspects and Paladin Auras change their action bar
texture when active. This precomputes all textures for each spell family
during initialization, enabling O(1) slot detection regardless of which
family member's texture is currently displayed.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add GetTalentTreesForClass method to TalentDB for retrieving all talents
- Create new /Talents page showing complete talent trees with rank badges
- Spent talents display green rank badges, unspent appear greyed out
- Remove TalentTreeComponent from Swag page
- Add Talents navigation item to sidebar

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@Xian55 Xian55 added documentation Improvements or additions to documentation refactor This ticket concerns the possible simplification of code/data. enhancement This pull request implements a new feature. breaking change labels Jan 28, 2026
@Xian55 Xian55 merged commit 1d9edae into dev Jan 28, 2026
1 check passed
@Xian55 Xian55 deleted the refactor/input-system branch January 28, 2026 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change documentation Improvements or additions to documentation enhancement This pull request implements a new feature. refactor This ticket concerns the possible simplification of code/data.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants