forked from julianperrott/WowClassicGrindBot
-
-
Notifications
You must be signed in to change notification settings - Fork 175
Addon: [1.9.0] - Refactor Input System with Modifier Key Support and Auto-Detection #739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…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]>
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Shift,Ctrl, andAltmodifiers throughout the input pipelineKeyboardLayoutComponentshowing all keybindings with validation statusChanges
DataToColor Addon Changes (v1.8.1 → v1.9.0)
NUMBER_OF_FRAMES: 108 → 111)SetupDefaultBindings.luafor automated keybinding configuration/dcbindings,/dcactionsClearAllQueues()method for comprehensive state flushScheduleAutoSetup()for deferred auto-setup of bindings on loginIsVanilla()helper for version detectionDataToColor:PS()function for spellbook spell placement by name prefixSetupRequirements()with camera, graphics, and display settings:SecureActionButtonTemplatepatch)*type*,*macrotext-NAME) for custom actionsInput System Refactoring
ModifierKeyflags enum (None,Shift,Ctrl,Alt) inSharedLibConfigurableInputto usePressRandomWithModifier()for modifier-aware key pressesInputWindowsNativewith keyboard layout translation viaTranslateKeyForLayout()PressModifiersDown()/ReleaseModifiersUp()WowProcessInputwith newPressRandomWithModifier()methodKeyReaderrefactoring to parse and resolve modifiers from bindingsAction Bar Auto-Detection
ActionBarTextureReader- Reads texture IDs from action bar slots (24-bit encoded)ActionBarMacroReader- Reads macro name hashes using DJB2 algorithmActionBarSlotValidator- Validates action bar configuration against class profileActionBarTextures.lua,ActionBarMacros.luaDatabase Improvements
SpellIconDB→IconDB(handles all action bar icons, not just spells)spellIdToTexture,spellNameToTexturesfor O(1) lookupsGetFamilyTextures()for dynamic icon spells (Aspects, Auras)FrozenDictionaryandFrozenSetfor zero-allocation lookupsKeyBindingsReaderto track game keybindings with change eventsFrontend Enhancements
KeyboardLayoutComponent.razor- Full keyboard visualization with:Talents.razor- Dedicated talents page with full talent treesTalentTreeComponentwith spell icon integrationSpellBookComponentwith thread-safe hash-based cachingGoapGoalViewto display resolved keybindings and fix pyramid indentationData Files
spelliconmap.jsonfor all game versions (TBC, Wrath, Cata, SoM, MoP)iconnames.jsonwith ~6500 icon names (expanded from ~1700)Files Changed
ConfigurableInput.cs,InputWindowsNative.cs,WowProcessInput.cs,KeyReader.cs,ModifierKey.csActionBarMacroReader.cs,ActionBarTextureReader.cs,ActionBarSlotValidator.csIconDB.cs,ItemDB.cs,TalentDB.cs,KeyBindingsReader.csKeyboardLayoutComponent.razor,Talents.razor,TalentTreeComponent.razor,GoapGoalView.razorActionBarMacros.lua,ActionBarTextures.lua,SetupDefaultBindings.luaTesting
Shift-1,Ctrl-F, etc.)Media
Actionbar / Keybind issues

Detect missing abilitites

Talents

Keybindings



Spellbook

GoapGoal

🤖 Generated with Claude Code