Skip to content

Addon: [1.9.16] - Fix combat lockdown, queue init, and array requirement support#796

Merged
Xian55 merged 5 commits intodevfrom
fix/addon-queue-count-validation
Apr 4, 2026
Merged

Addon: [1.9.16] - Fix combat lockdown, queue init, and array requirement support#796
Xian55 merged 5 commits intodevfrom
fix/addon-queue-count-validation

Conversation

@Xian55
Copy link
Copy Markdown
Owner

@Xian55 Xian55 commented Apr 4, 2026

Summary

This PR addresses two bugs discovered during testing and adds a new feature to the requirement DSL.

Bug Fixes

1. Keybinding setup silently fails when login enters combat

  • When a player logs in and immediately enters combat (e.g., logged out in a hostile area), AutoSetupBindingsIfNeeded() silently returned due to InCombatLockdown() with no retry
  • Essential keybindings (targeting, interaction, pet control) were never configured, requiring /reload
  • Fix: Uses BindPad's WaitForEvent("PLAYER_REGEN_ENABLED", ...) to automatically retry once combat ends

2. Bot uses abilities with empty readers after /dcflush

  • When /dcflush is triggered during bot operation, FullReset() clears all reader data (spell book, bindings, textures). The GOAP agent continued running immediately with empty readers
  • Spell:SPELL_CHARGE requirements returned false because SpellBookReader was empty — the bot never attempted Charge
  • Root cause: No reliable mechanism to know when queue-based readers were fully repopulated
  • Fix: Each queue now embeds an expected item count as the first data item using a count marker (QUEUE_COUNT_MARKER = 16,777,000). C# readers extract this count and track received items. AddonReader withholds DataReady.Set() until all three queue readers report receivedCount >= expectedCount, naturally pausing the GOAP agent

Feature: IntVariable Array Support for Requirements

Expanded Spell:, BagItem:, and npcID: requirements to support IntVariable arrays (matching the existing aura array pattern):

  • Spell:VARIABLE with array [100, 6178, 11578] → true if ANY spell ID is known
  • BagItem:VARIABLE:COUNT with array [5512, 5511, 5509] → sums item counts across all IDs
  • npcID:VARIABLE with array [6195, 6196] → true if target matches ANY NPC ID

Example (Warlock healthstones):

"Item_Healthstone_All": [19005, 19004, 5512, 19006, 19007, 5511, 19009, 5509, 19008, 5510, 19011, 19010, 19012, 9421, 19013],
"Requirements": ["BagItem:Item_Healthstone_All"]

Other Improvements

  • PullTargetGoal: Add melee range guard to stop-attack, use stopMoving.Stop() with wait.Until() for reliable pre-pull stops
  • StuckDetector: Refactor to escalating unstuck strategy (jump → nudge → aggressive turn+move), add LoggerMessage source generation
  • GoapAgent: Exclude ToPull targets from targettargetsus check
  • CursorScan: Simplify with Array.Contains()
  • BotHeader.razor: Display reader initialization progress with color-coded status (gray=waiting, orange=loading, green=complete), fix TimeSpan format string crash
  • README.md: Document array support for Spell:, BagItem:, and npcID: requirements

Test plan

  • Start bot normally → verify green reader counts in BotHeader
  • Press Shift+PageDown during bot operation → observe orange progress, then green resume
  • Log in a character in a hostile area while in combat → verify "Bindings deferred" message and auto-retry
  • Test Warlock_32.json healthstone array config → verify BagItem:Item_Healthstone_All detects any healthstone variant
  • Verify Warrior Charge works after single /dcflush (no second flush needed)

🤖 Generated with Claude Code

Xian55 and others added 5 commits April 4, 2026 05:12
- GoapAgent: Exclude targets in ToPull list from targettargetsus check
  to prevent premature combat goal switching during pull phase
- PullTargetGoal: Add melee range guard to stop-attack logic and use
  stopMoving.Stop() with wait.Until() for more reliable pre-pull stops
- StuckDetector: Refactor to escalating unstuck strategy (jump → nudge
  → aggressive turn+move), use IsMoving property backed by AddonBits,
  reduce MIN_RANGE_DIFF to 1f, add LoggerMessage source generation
- CursorScan: Simplify cursor matching with Array.Contains()
- ConfigurableInput: Remove unused methods

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When a player logs in and immediately enters combat (e.g., logged out in
a hostile area), AutoSetupBindingsIfNeeded() previously returned silently
due to InCombatLockdown() with no retry mechanism. This left essential
keybindings (targeting, interaction, pet control) never configured,
requiring a manual /reload to fix.

Now uses BindPad's existing WaitForEvent("PLAYER_REGEN_ENABLED", ...)
to automatically retry binding setup once combat ends. Prints a chat
message so the user knows bindings were deferred.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When /dcflush is triggered during bot operation, the C# side calls
FullReset() which clears all reader data. Previously, the GOAP agent
continued running immediately with empty readers, causing Spell:
requirements to fail silently — the bot would never attempt abilities
like Charge until a second flush or /reload.

Root cause: the C# side had no reliable way to know when queue-based
readers (SpellBook, KeyBindings, ActionBarTextures) were fully
repopulated after a reset.

Solution: Each queue now embeds an expected item count as the first item
in the data stream using a count marker (QUEUE_COUNT_MARKER = 16,777,000).
The C# readers extract this count and track received items. IsInitialized
is true only when receivedCount >= expectedCount.

AddonReader now withholds DataReady.Set() after FullReset until all three
queue-based readers report IsInitialized, naturally pausing the GOAP agent
until data is fully repopulated.

Lua changes:
- DataToColor.lua: Add QUEUE_COUNT_MARKER constant, push count header
  in InitSpellBookQueue()
- SetupDefaultBindings.lua: Push count header in InitBindingQueue()
- ActionBarTextures.lua: Push count header in InitActionBarTextureQueue()

C# changes:
- AddonTicks.cs: Add QUEUE_COUNT_MARKER constant
- SpellBookReader/KeyBindingsReader/ActionBarTextureReader: Detect count
  headers, track expectedCount/receivedCount, expose public properties
- AddonReader: Gate DataReady on reader initialization after FullReset,
  add logging for pause/resume timing

Frontend changes:
- BotHeader.razor: Display reader initialization progress with color-coded
  status (gray=waiting, orange=loading, green=complete), add Textures column

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…arrays

Previously, Spell:, BagItem:, and npcID: requirements could only resolve
IntVariables to a single int value. For non-aura array variables (e.g.
multiple healthstone item IDs), only the first element was used.

Now these requirements check the intArrayVariables dictionary first. When
the variable maps to an array with multiple values:

- Spell:VARIABLE — returns true if ANY spell ID in the array is known
  in the spellbook (useful for spell rank ranges)
- BagItem:VARIABLE:COUNT — sums item counts across ALL IDs in the array
  (useful for items with multiple ranks like Healthstones)
- npcID:VARIABLE — returns true if target matches ANY NPC ID in the
  array (useful for NPC variant groups)

Add Warlock_32.json example config demonstrating Item_Healthstone_All
array variable with 15 healthstone item IDs across all ranks.

Update README.md to document array support for all three requirements.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… count headers

Lua changes in this release:
- AutoSetupBindingsIfNeeded defers to PLAYER_REGEN_ENABLED when in combat
- InitSpellBookQueue/InitBindingQueue/InitActionBarTextureQueue now push
  QUEUE_COUNT_MARKER + expectedCount as the first queue item for reliable
  C# reader initialization tracking

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Xian55 Xian55 added bugfix This pull request fixes an issue. enhancement This pull request implements a new feature. ai Artificial Intelligence tool has been contributed. documentation Improvements or additions to documentation labels Apr 4, 2026
@Xian55 Xian55 merged commit 5b13335 into dev Apr 4, 2026
1 check passed
@Xian55 Xian55 deleted the fix/addon-queue-count-validation branch April 4, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Artificial Intelligence tool has been contributed. bugfix This pull request fixes an issue. documentation Improvements or additions to documentation enhancement This pull request implements a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant