Files
benilla-octo/crates
Sam SungandClaude Opus 5.5 79dc262eea pet cooldown list: every mutation fires ACTIONBAR_UPDATE_COOLDOWN, SPELL_UPDATE_COOLDOWN and PET_BAR_UPDATE_COOLDOWN (0x4b31b0, 0x4bce90), and the SMSG_SPELL_GO pet leg no longer signals PET_BAR_UPDATE (#657)
The pet's cooldown list fired the wrong UI events:
- The `SMSG_SPELL_GO` pet leg bumped `PetBar::bar_signals`, so the pet bar feed fired `PET_BAR_UPDATE` instead of `PET_BAR_UPDATE_COOLDOWN`.
- No change to the pet's list ever fired `ACTIONBAR_UPDATE_COOLDOWN` or `SPELL_UPDATE_COOLDOWN`. Those fired only off the player list's generation.

The stock spellbook's buttons refresh on `SPELL_UPDATE_COOLDOWN`, so a pet-bar press's GCD never swept on the spellbook's pet tab.

**In the reference**, every mutation of the pet's list is followed by `0x4b31b0`, which fires `ACTIONBAR_UPDATE_COOLDOWN` (`0xd8`) and then `SPELL_UPDATE_COOLDOWN` (`0x106`), and then by `0x4bce90`, which fires `PET_BAR_UPDATE_COOLDOWN` (`0x162`). The mutations are:

| Mutation | Insert or clear | Flush |
|---|---|---|
| `SMSG_SPELL_GO` pet leg | `0x6e85f7` | `0x6e85fc`, `0x6e8601` |
| `StartGlobalCooldown` on the pet's list | — | `0x6e2e77`, `0x6e2e8e` |
| A pet-addressed `SMSG_SPELL_COOLDOWN` | — | `0x6e95b0`, `0x6e95b9` |
| The cooldown event and clear packets | — | `0x6e3071`-`0x6e3080` |
| `SMSG_COOLDOWN_CHEAT` | — | `0x6e9712`, `0x6e971c` |

`SMSG_PET_SPELLS` seeds the list with no flush (`0x6e2c60`). Its `SetPet` fires `PET_BAR_UPDATE` on every packet (`0x4bc90c`).

**Changes:**
- **The flush.** `fire_pet_cooldown_events` watches the pet list's generation and fires the three events once per frame it moved, after the bar, the book and the player's action state have pushed. It owns the pet list's events.
- **The feed.** `feed_pet_bar` no longer fires the cooldown event itself, so a natural expiry fires nothing, as on the player's list.
- **The `SMSG_SPELL_GO` pet leg** drops its `bar_signals` bump.
- **`SMSG_PET_SPELLS`** bumps `bar_signals` once per packet, as `SetPet` does, and seeds without moving the generation.
- **Teardown** clears the list without resetting its counters, so a new bar never masks the next flush.
- **Docs.** The `Cooldowns` doc names both lists and their owners.

**Tests:**
- `ui_pet/flush_tests.rs` drives the real handlers:
  - the `SMSG_SPELL_GO` trio with no `PET_BAR_UPDATE`;
  - a stranger's pet;
  - the pet-addressed `SMSG_SPELL_COOLDOWN`;
  - the event, clear and cheat packets;
  - one flush per frame;
  - `SMSG_PET_SPELLS` signalling the bar but never flushing;
  - teardown;
  - natural expiry;
  - a fresh VM;
  - the flush's schedule order.
- `a_pet_gcd_sweeps_the_spellbooks_pet_tab_button` loads the default UI, opens the spellbook's pet tab, presses a pet slot and checks `SpellButton1Cooldown` sweeps 1.5 s.
- The press test now asserts the three events.

Fixes #637

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 03:57:20 +07:00
..