Commit Graph
547 Commits
Author SHA1 Message Date
Mathih13andClaude Opus 5.5 cfd5fd2c8a fix: stop shift-click opening the stack splitter on vendor bundles (#751)
- Shift-clicking water or arrows at a vendor takes one bundle, as 1.12.1 does
- Drop the merchant comments that restate the code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 04:54:20 +07:00
Sam SungandClaude Opus 5.5 f22ec0016c EditBox caret keys, selection and focus blink follow 1.12.1 (#750)
Several EditBox keys differed from 1.12.1:
- Up/Down did nothing in a multi-line box;
- Home/End went to the text's ends;
- `HighlightText` and Ctrl+A moved the caret;
- focus did not restart the blink;
- a non-digit kept a numeric box's selection;
- Option+Up could not recall chat history on a Mac.

In 1.12.1, Up/Down move a wrapped row, keeping the letter column (`0x77cb20`), or recall history in a single-line box with any modifier but Shift. Home/End stop at a newline (`0x77c980`, `0x77c9f0`). `HighlightText` writes only the selection (`0x77cca0`), and Shift extends by `0x77cd10`. Focus restarts the blink (`0x77dd68`), and Insert deletes the selection before its digit test (`0x77bf41`).

benilla now does each. Down onto the last row lands at the end, and history stays shell-style, both deviations.

Tests cover each key, in the engine and the stock mail and ticket boxes.

Fixes #735
Fixes #736
Fixes #737
Fixes #738
Fixes #745
Fixes #747

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 10:56:03 +07:00
Sam SungandClaude Opus 5.5 be9e3d8aac Keys are named by the active layout, as 1.12.1 names them (#748)
Letter and punctuation keys were named by their US position, so on AZERTY the key labelled Z bound as W, and Ctrl+A sat on the key labelled Q.

1.12.1 on Windows names a key from the VK its layout produced. `VK_A`–`VK_Z` and digits are named as themselves, and other keys by `MapVirtualKeyA` (`0x42da39`); a key with no character is dropped (`0x42da49`). The EditBox's Ctrl chords switch on that same name (`0x77b1fb`). The Mac client names keys by `KeyTranslate`.

Now:
- Windows takes the same path through `MapVirtualKeyExW`.
- The Mac names keys through the current layout, or the ASCII-capable layout it pairs with.
- Linux follows one documented rule.
- Bindings, Key Bindings capture and Ctrl/Cmd+A/C/X/V all follow the layout.
- A character above U+00FF names its key, as a deviation.

Tests cover AZERTY, Hebrew, Greek, Lithuanian, Turkish, Bulgarian, Hungarian and Dvorak names, layout switches and chords.

Fixes #621
Fixes #746

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 09:55:26 +07:00
Sam SungandClaude Opus 5.5 e9f0e89a0b EditBox events fire from each box's flush, as 1.12.1 orders them (#734)
EditBox events fired from hoisted drains before any OnUpdate, OnTextChanged before OnCursorChanged, and only on an edit.

In 1.12.1:
- Each box's update `0x77a790` fires its own `OnUpdate` and then its flush `0x77d3e0`, and a key-down or click flushes first (`0x77b1e2`, `0x77b819`).
- The flush runs off dirty bits in `[E+0x31c]`: relayout on bit 0, then `OnCursorChanged` on bit 2, then `OnTextChanged`.
- The ctor sets bit 0, so a box fires at its first show. Every text-region re-seat raises bits 0–2 (`0x77ba7f`), so a resize, new insets, `SetMultiLine` or a font change fires it again.

benilla now keeps the same bits and flushes each box in the walk and at its keys and clicks. So typing DELETE and pressing Enter in one frame enables the popup's button, as in 1.12.1.

Tests cover the order, first show, re-seats, a key's flush and no-op moves.

Fixes #724
Fixes #727

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 07:38:38 +07:00
Mathih13andClaude Opus 5.5 87f65faffd fix: stamp the chat log and FrameXML.log in local time (#723)
The reference stamps each log line from GetLocalTime (0x65a871); benilla stamped UTC. Unix reads
localtime_r, Windows calls GetLocalTime. Built and tested on macOS; the unix path type-checked for
x86_64 Linux and the Windows path for x86_64-pc-windows-msvc in a scratch crate.

Fixes #586

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 07:21:57 +07:00
Sam SungandClaude Opus 5.5 4772489aad Arriving bodies composite off the main thread and show once dressed (#732)
A crowd of arriving players was composited in one frame, on the main thread, under the archive lock: 40 geared looks took 76–115 ms.

In 1.12.1 an unforced full composite never waits on its section loads (`0x44b430`), and a unit whose first composite is pending is not drawn: ShouldRender `0x607da0` feeds the draw flag `0x710c50`, and the flag goes to the mount model when mounted. It appears dressed once the composite is done.

Now an arriving body composites on the async pool, one task per look, reading outside the lock. The body, and its mount, are built once the atlas lands. Arriving now costs the main thread 0.26–0.45 ms for 40 looks. The appear fade runs from arrival, as `FadeTo` is armed at create.

A re-dress, a rig heal and the glue and dressing-room previews stay in the frame. Baked NPC skins are unchanged.

Fixes #609

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 20:14:10 +07:00
Sam SungandClaude Sonnet 5.5 15e83f2483 Ghost and underwater ambience beds resolve by their reference names (#731)
A ghost heard no ambience. The ghost bed was looked up as a SoundEntries row named "Ghost", which does not exist, so it fell back to kit 0. The underwater bed was a hard-coded row.

At init, 1.12.1's `0x4609b0` walks SoundEntries from the last row down. It keeps the rows whose names match `"Ghost (DONOTRENAME)"` (`0x836444`) and `"Underwater (DONOTRENAME)"` (`0x836428`) exactly and case-sensitively (`0x64a480`, a `strncmp` through the NUL). In the install those are rows 4160 (`GhostState.wav`) and 4209.

The catalog now resolves both beds once, the same way, and the ambience selector takes them from it, with order and fades unchanged.

Tests cover the install's two rows, the exact-name match, the walk order, a ghost selecting its bed over water, and an unresolved bed staying silent.

Fixes #721

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 19:43:09 +07:00
Sam SungandClaude Sonnet 5.5 7e117809b2 /errors: the selected error is copyable, in a read-only EditBox (#730)
`/errors` showed the selected error in a FontString, so a player could not select or copy the message and traceback they came to report.

The detail pane now hosts a multi-line EditBox the way stock `MailFrame.xml` hosts the mail body:
- `autoFocus="false"`, so the keyboard stays with the game until a click;
- Escape clears focus;
- a mouse-enabled scroll child that focuses the box on a click below its text;
- `ScrollingEdit_OnTextChanged` for the range, since the box is as tall as its text.

The box is read-only: an edit is undone on `OnTextChanged`. Focus selects all, so Ctrl+C copies the whole error, and a new error arriving keeps the selection. The text keeps its font, its 6/6 inset and its 270 wrap.

Tests cover the whole text in the box, the undone edits, select-all and copy, a click below the text, Escape, and the range over a long traceback.

Fixes #703

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 19:18:52 +07:00
Sam SungandClaude Opus 5.5 f2e71ccebd A multi-line EditBox grows with its text; a Lua-made box draws its text (#729)
A multi-line EditBox kept its authored height, so a scroll frame around a long mail body or ticket had no range. A box made in Lua with no template never placed its text, so it drew nothing.

In 1.12.1, the flush's relayout sets a multi-line box's height to its insets plus its wrapped text height, or one line when empty (`0x77d4d0` at `0x77d8ad`). Every resize, including the first layout, re-seats the text at the top-left inset (`0x77a8d0` → `0x77b8c0`). `SetTextInsets`, `GetTextInsets`, `SetMultiLine` and a font change re-seat it too.

benilla now does the same. A focused multi-line box's caret and text are clipped only by a scroll frame, as the reference clips neither.

Tests cover growth and shrink, the stock mail and ticket scroll ranges, each re-seat trigger, a Lua box's first layout, and the caret in an empty box and after a trailing newline.

Fixes #722
Fixes #726

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 18:37:30 +07:00
Sam SungandClaude Opus 5.5 4c18c23c94 Ambience beds stream from the archive, opened off the main thread (#725)
An ambience change read and decoded the whole bed on the main thread, about 40 ms a swap. 1.12.1 opens the bed as a looping FMOD stream that reads the archive through its file callbacks (`0x460b54` → `0x7a54d0`, `FSOUND_Stream_Open` at `0x7a5525`).

Now:
- MPQ files open for in-place reads, one sector at a time.
- The bed streams from the archive, opened on the IO pool. A newer swap drops an open still in flight.
- kira moves to 0.12.4 on symphonia 0.6. 0.5 sized PCM frames from `nBlockAlign`, which 98 stereo WAVs store as 2, so a streamed bed fell silent halfway.
- A fork patch stops a stream at its last packet instead of spinning.
- A sector that inflates short is refused.

Tests cover a bed's true length, a seamless loop, an off-thread open, the stop at the last packet and the refusal.

Fixes #700
Fixes #8

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 17:22:42 +07:00
Sam SungandClaude Sonnet 5.5 cd34ab77d2 /errors: put Clear and Close in the panel art's sockets (#720)
The `/errors` window wears the ClassTrainer panel art, but its Clear and Close buttons sat at y −455, below the art, and its detail pane ran to −442, into the button sockets.

On that art the class trainer lays out (`Blizzard_TrainerUI.xml`, `ClassTrainer_SetToClassTrainer`):
- a 296×184 list at (−67, −96) from the top right, with 11 rows;
- a 119-tall detail pane 8 below the list, ending at −407;
- Train and Exit, 80×22, centred at (224, −420) and (305, −420).

The log now uses those frames: Clear and Close sit in the sockets, the detail ends above them, and the list shows 11 rows, not 13.

The new test lays out the stock trainer and the log in one UI and checks that each log frame equals the trainer's, with the buttons inside the window. It fails on the old layout.

Fixes #698

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 15:31:35 +07:00
Sam SungandClaude Opus 5.5 2b700e6b0d gates: drop the player build that the player tests already compile (#719)
The land chain compiled the player build twice: `cargo build -p benilla --no-default-features`,
then `cargo test -p benilla-formats -p benilla-app --no-default-features --lib`. The test build
already compiles every line of the no-`dev` graph but the `benilla` launcher, a 17-line shim with
no `dev` seam, and `benilla-app` has no `cfg(not(test))` code, so the first step added only the
shim and a link: about two of a chain's twelve minutes. It goes from `gates.sh` and CI, and
`player-tests` carries its comment.

`check.sh` no longer says a full chain before land makes the land free: main moves in between, so
the chain ran twice.

Test: this land's own chain runs the new `gates.sh`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 14:02:12 +07:00
c03ca1e4be Percentage spell costs use the reference power bases (#646)
Percentage costs took their share of the max pool, so Bloodrage cost 20% of max health. The reference's basis table (`0x612c50`, reached from `GetPowerCost` `0x6e31b0`) reads the caster's fields:

| power type | basis |
|---|---|
| health | base health (`UNIT_FIELD_BASE_HEALTH`, 163) |
| mana | base mana (162) |
| rage | 1000 |
| focus, energy | 100 |
| anything else | 0 |

`cost_basis` now holds that table, and `power_cost_at` reads through it for the tooltip, the press-path gate and the action bar. The spell tooltip's rebuild inputs watch base health in place of max health, for the player and the pet. Tests pin each type's basis, and Bloodrage on real data: "337 Health" at level 60, whatever the gear.

Fixes #604

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Sam <samuv.eth@gmail.com>
2026-09-30 13:50:40 +07:00
Sam SungandClaude Opus 5.5 010e41e600 unit getters: chained tokens like raid3target answer their unit (#716)
The `Unit*` getters and `SpellCanTargetUnit` answered nil for chained tokens like `raid3target` or `party1target`, so a raid-assist addon's main-tank frame stayed empty.

Every getter and `SpellCanTargetUnit` resolves its token through `0x515970` and then reads the guid's object (`0x468460`); see `UnitHealth 0x517511`/`0x51752d` and `SpellCanTargetUnit 0x6e6d3a`.

A token with target hops now resolves to a guid in the VM and reads a per-guid snapshot. A new feed pushes one for each held unit a chain ends on. `SpellCanTargetUnit` keeps its verdicts by guid. The three target, target-of-target and NPC snapshot builders are folded into one.

Tests: `UnitName`/`UnitHealth("raid3target")` and `UnitExists("pettarget")` answer the chained unit, `SpellCanTargetUnit("party1target")` answers its verdict, and plain tokens are unchanged.

Fixes #693
Fixes #694

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 13:19:48 +07:00
Sam SungandClaude Opus 5.5 29c1ec6f0a party: a roster packet updates each member's online bit (#714)
A roster packet set a member's online bit only for someone new. So a member with a pet who logged off out of view kept answering `UnitExists("partypet1")` and `UnitBuff("party1", i)`, and the party pet's `UNIT_PET` fired on online flips.

The reference's list handler reseats every member through `0x4e82d0`. That keeps the saved record and sets bit 0 from the row's non-zero status byte (`0x4e8361`-`0x4e837b`; raid twin `0x4ba947`-`0x4ba960`). `UNIT_PET` fires only when the stats diff sees the pet guid move (`0x5e57e9`).

Each list now sets every known member's online bit. The `UNIT_PET` edge follows the pet guid unfiltered, and the no-object `UnitIsConnected` reads the record (`0x517dd3`).

Test: a status-only offline list clears the pet and buffs with no `UNIT_PET`, and an online list restores them.

Fixes #666
Fixes #665

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 13:02:47 +07:00
2b16219357 Spell descriptions resolve $b, $f, $F, $i, $q, $u and $v (#622)
Spell descriptions printed `$b`, `$f`, `$F`, `$i`, `$q`, `$u` and `$v` raw. The reference's expander resolves each from Spell.dbc:

| token | column |
|---|---|
| `$b` | EffectPointsPerComboPoint |
| `$f`/`$F` | DmgMultiplier |
| `$i` | MaxAffectedTargets |
| `$q` | EffectMiscValue |
| `$u` | StackAmount |
| `$v` | MaxTargetLevel |

`$b` chops toward zero. `$f` prints one decimal, and `$F` rounds half away from zero, both after the scale and in double precision. The integer arms print a signed `%d`.

This change reads the new columns and adds the arms. `$f` and `$F` keep keying the `$l` plural, under the recorded deviation. Tests pin each arm, the schema's float columns and every shipped use of the six letters. Chain Heal now reads "Each jump is 50% as effective".

Fixes #593

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Sam <samuv.eth@gmail.com>
2026-09-30 12:36:29 +07:00
Sam SungandClaude Opus 5.5 5b3c2a98d4 pet bar: PickupPetAction needs the pet in view (#709)
`PickupPetAction` lifted a pet action onto the cursor while the pet was out of the client's view, because the pickup gate read an unstreamed pet's missing flags as "not possessed".

The reference's `PickupPetAction` (`0x4be180`) looks the pet up first (`0x4be1f7`). With no object it returns at once (`0x4be1fe`), and only then does it test `UNIT_FLAG_POSSESSED` (`0x4be20a`).

The gate now needs the pet's object before the possessed test, and three comments that cited a mid-instruction address now cite these.

Tests: with the pet out of view, a pickup lifts nothing and a held action stays on the cursor. An in-view pet still lifts, and a possessed one does not.

Fixes #688

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 11:49:14 +07:00
Sam SungandClaude Opus 5.5 4ae99c0609 raid roster: every raid roster packet fires RAID_ROSTER_UPDATE (#708)
`RAID_ROSTER_UPDATE` fired only when a member's guid, rank, subgroup or online bit moved. A raid list that changed only a death, or an identical re-send, fired nothing, so the raid pullouts and addons listening on it went stale.

After each raid `SMSG_GROUP_LIST` rebuild, the reference's raid roster writer `0x4ba5f0` signals `RAID_ROSTER_UPDATE` whenever no member name is pending (`0x4babdf`-`0x4babef`). A list without the raid flag signals only when it drops a held raid (`0x4ba57b`).

`GroupState` now counts these per list, and the feed fires one event per list since its last look, as #691 does for `PARTY_MEMBERS_CHANGED`. The key compare stays as the edge for world entry, which fills our own row.

Test: with the default UI and `Blizzard_RaidUI` loaded, a death-only raid list turns the pullout row red.

Fixes #690

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 10:58:27 +07:00
Sam SungandClaude Opus 5.5 0a920b52fe unit tokens: party1target and other target chains resolve (#706)
`TargetUnit`, `AssistUnit`, `SpellTargetUnit`, `CheckInteractDistance` and `CanInspect` ignored target chains. `party1target`, `pettarget` and `raid3target` named nobody.

The reference's resolver `0x515970` takes a base token, then any number of `target` hops over held units' `UNIT_FIELD_TARGET` (`0x5159d3`-`0x515a2c`). Every one of these verbs resolves through it.

Changes:
- The app and the VM now share one parser, `parse_unit_token`.
- The reach map behind the two range verbs is keyed by guid, filled after the aura feed, and read through the VM's resolver.
- `ObjectStore::is_unit` replaces two private copies of the same test.
- Side effect: the reach feed's new order puts a few feeds after `feed_auras` where their order was undeclared before.

Tests: every chain form, a broken chain, junk after a hop and case folding. `TargetUnit("party1target")` works from Lua.

Fixes #669

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 10:20:16 +07:00
Sam SungandClaude Opus 5.5 602c30389a spell range: two running units get GetMinMaxRange's moving bonus (#702)
A warrior chasing a running mob was refused Hamstring at 6-7 yd with "Out of range.", where 1.12.1 lets it go out.

After both arms, `GetMinMaxRange 0x6e3480` adds 2.6667 yd (`[0x811914]`) to the max when all of these hold (`0x6e3648`-`0x6e36a2`):
- the caster and the target unit both move, with a bit of `0x200d` set;
- both run faster than twice their walk speed (`0x5fc350`);
- the row is melee, or the target is a player.

On the melee row, the auto-attack target stands in when no unit is passed.

`min_max_range` now takes each unit's motion and adds the bonus. Every caller passes what its reference call site passes. The ambiguity ceiling rises by the 11 pairs this adds, with the reason beside it.

Test: Hamstring goes out at 7.5 yd with both units running and is refused standing still.

Fixes #678

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 09:59:17 +07:00
Sam SungandClaude Opus 5.5 79cb3b670d PARTY_MEMBERS_CHANGED fires once per SMSG_GROUP_LIST, whatever the list changes, an empty list and an identical one included: GroupState counts the lists and the feed answers each (0x5e6a40, 0x5e6b3c, 0x5e6c61) (#691)
The party feed fired `PARTY_MEMBERS_CHANGED` only when the list of member guids changed. So an `SMSG_GROUP_LIST` that moved only a member's status, flags or subgroup, the leader or the loot method fired nothing. In particular, when a member out of view logged off, the stock party frame never repainted: their bars stayed coloured and their pet frame stayed up.

**The reference.** `SMSG_GROUP_LIST`'s handler `0x5e6a40` fires `PARTY_MEMBERS_CHANGED` (`0x5e6c61 mov ecx,0xda`, `0x5e6c66 call 0x703e50`) after its member loop on every path, party and raid alike. An empty list jumps straight there (`0x5e6b3c`). Nothing compares against the previous roster, and there is no `ret` before it.

**Changes:**
- `GroupState` counts every applied list, including the all-zero leave list and an identical re-send.
- The feed fires `PARTY_MEMBERS_CHANGED` once per list since its last look, in the same place after the unit and pet snapshots.
- A fresh VM gets one catch-up event if any list landed this session.
- The `/partytest` sandbox counts the lists its intents would be answered with.
- `PARTY_LEADER_CHANGED` and `PARTY_LOOT_METHOD_CHANGED` keep their compares, as `0x4e8250` and `0x4e86f0` do.

**Tests** (in `feed.rs`, each firing the event):
- a status-only list;
- a leader-only list and a loot-only list;
- an identical list;
- three lists in one drain, firing three;
- an empty list;
- a fresh VM's catch-up;
- the sandbox's intents.

`the_stock_party_frame_greys_a_member_who_logs_off_out_of_view` loads the default UI. After a status-only offline list, `PartyMemberFrame1ManaBar` reads `(0.5, 0.5, 0.5)` and the pet frame hides.

Fixes #667

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 08:18:47 +07:00
Sam SungandClaude Opus 5.5 7623cbae11 pet bar: 0x4bcf70 is one predicate, asked by GetPetActionsUsable, every press and order, Dismiss, both autocast toggles and the drag's writes, so an unusable pet greys the bar and does nothing (#687)
No pet-bar verb asked whether the pet's actions were usable. So a stunned, feared or confused pet, a pet out of view, a pet that is not yours, or a charmed player still did all of this:
- pressed, latched Stay, Follow and the reactions, and swept the GCD;
- sent `CMSG_PET_ACTION` and flipped autocast;
- showed `GetPetActionsUsable()` as 1, which kept the stock bar in colour.

`0x4bcf70` is the reference's one predicate. It returns 0 in any of these cases:
- the active player does not resolve (`0x4bcf92`);
- the player is charmed (`0x4bcf98`-`0x4bcfa4`);
- the player's far-sight guid (`PLAYER_FARSIGHT`) is set and is not the pet (`0x4bcfbf`-`0x4bd012`);
- the pet guid does not resolve to a unit (`0x4bd034`-`0x4bd03d`);
- the pet's charmed-by guid, else its summoned-by guid, is not the player (`0x4bd03f`-`0x4bd067`);
- the pet is stunned, confused or fleeing (`0x4bd06f`-`0x4bd08b`);
- bar-state bit 27 is set (`0x4bd08d`).

These callers ask it:
- `GetPetActionsUsable` (`0x4be0b3`);
- the dispatcher behind `CastPetAction`, the orders and Dismiss (`0x4bd1f2`, before its type switch);
- `TogglePetAutocast` (`0x4bcbcf`);
- the pet book's toggle (`0x4bccce`);
- the bar write used by the drag's drop and the pickup's blank (`0x4bc9d0`).

Changes:
- `ui_pet/usable.rs` builds `0x4bcf70` once. The bar's feed pushes it as `GetPetActionsUsable`. `PetPress::press` asks it first, before the aura cancel.
- Both autocast drains, Dismiss and the drag's two writes ask it too. A pickup still lifts the action onto the cursor, as the reference does.
- The spell arm's later player and pet lookups, and the Attack arm's null branch, repeat the predicate's, so their dead handling goes.
- `arm_pet_gcd`'s doc now names the three places the pet's GCD starts: the press (`0x4bd36e`), a pet-addressed `SMSG_SPELL_COOLDOWN` (`0x6e9598`) and the generic cast send (`0x6e58fb`).

Tests:
- `ui_pet/usable_tests.rs` tries each of 11 exits alone, and 5 usable lookalikes, against `GetPetActionsUsable`, a spell press, the orders, both autocast toggles, Dismiss and the drag.
- A stock-UI test loads the default UI. A stunned pet's icon desaturates, and a click sends nothing until the stun ends.
- The three press tests that pinned ungated sends are flipped.

Fixes #672
Fixes #673
Fixes #674

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 07:45:16 +07:00
Sam SungandClaude Opus 5.5 8f6d337ad6 party and raid tokens: UnitIsConnected answers 1 for a held member whatever the roster status byte says, and reads the record's online bit only with no object (0x517d50, 0x517daf, 0x517dd3) (#686)
`member_unit_state` built a `partyN` or `raidN` view, then replaced `is_connected` with the roster status byte's online bit on both legs, the held leg included. So a member who went link-dead while still in view read disconnected at once, and their frame's power bar went grey.

`UnitIsConnected 0x517d50` looks the unit up in the object manager (`0x517da6`). A held unit answers 1 (`0x517daf`). Only with no object does it read the record's `+0x08 & 1` (`0x517dd3`), which `SMSG_GROUP_LIST` sets from the member's status (`0x4e836e`-`0x4e837b`).

The held leg keeps `snapshot`'s value, and only the no-object leg reads the roster's online bit.

Tests (through `feed_party` and the Lua getter):
- a held member reads connected whatever the status byte says, for `party1` and `raid1`;
- a held member going offline reads connected until the object leaves, then nil;
- an unheld member with the bit clear reads nil, and with it set reads 1.

Fixes #647

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 07:10:56 +07:00
Sam SungandClaude Opus 5.5 47794e489c pet cooldown list: Cooldowns::add drops the records that have run out before it appends, so neither list outgrows its live records, and the drop fires no flush (#685)
`Cooldowns::add` appended a record for every tracked insert and never dropped one. Only `prune` removed fully elapsed records, and it ran on the player's list alone. So the pet's list kept a record for every pet GCD and every pet `SMSG_SPELL_GO` recovery for the whole session, and each pet-bar and pet-book read walked all of them.

`add` now prunes fully elapsed, not-on-hold records before it pushes. The list is bounded by its live records plus the one being added. This holds for the pet's list and the player's alike, without a new system or any schedule change.

The prune keeps its contract:
- it moves `expiry_epoch`, never `generation`, so the pet list's flush fires once for the insert and nothing for the prune;
- reads skip elapsed records already, so no reader sees a difference;
- the player's per-frame prune in `ui_action/state.rs` stays, for an expiry that arrives with no insert.

Tests:
- `an_insert_bounds_the_list_by_its_live_records_plus_itself` checks the bound after each of 30 inserts on a synthetic clock.
- `an_insert_keeps_a_running_and_a_parked_record_and_changes_no_read`.
- In the pet rig, after 40 elapsed pet presses, one more press leaves only the live records. That insert fires its one flush, and the bar's reads of the records that stay are unchanged.

Fixes #656

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 06:59:03 +07:00
Sam SungandClaude Opus 5.5 3a613971bb UnitCreatureType answers the one resolver's type for every unit, so a cat-form druid or a Ghost Wolf shaman is a Beast: the snapshot takes the form, then the template, then the race (0x605570, 0x51a2bc) (#681)
`UnitCreatureType` read only a creature's template type, and fell back to "Humanoid" for a player. The form stage was not built. So a druid in cat, bear, travel or aquatic form and a shaman in Ghost Wolf all answered "Humanoid", where 1.12.1 answers "Beast".

`UnitCreatureType 0x51a280` names the type the resolver `0x605570` returns, and 0 names nil (`0x51a2c3`). The resolver tries three stages in order:
1. **Form:** the form byte (`UNIT_FIELD_BYTES_1` byte 2) indexes `SpellShapeshiftForm.dbc` column 12, which applies only above 0 (`0x60559a`).
2. **Template:** else the cached creature record (`0x6055a8`).
3. **Race:** else the race's `ChrRaces.dbc` type (`0x6055ca`).

A token naming no unit answers nil (`0x51a2b8`). The unit tooltip's level line takes the type only for a non-player (`0x52a4a6`).

Changes:
- `ui_unit::snapshot` sets `creature_type_name` for every unit through the shared `CreatureTypeSources::of`: players, creatures, pets and group tokens alike. `enrich_unit` no longer sets it.
- `UnitCreatureType` reads that field, with no fallback.
- The feeds at Bevy's parameter limit carry the sources in a `SnapshotTables` param.
- A player's tooltip level line is unchanged, since it reads race and class.

Behaviour that now matches the reference beyond the issue:
- a held pet, `partypetN` and `raidpetN` answer their template's type rather than nil;
- a party member in a form reads the form's type;
- a roster member with no object, and the pre-arrival player seat, answer nil.

Tests:
- `the_shipped_forms_name_a_beast_or_fall_through_to_the_race` reads the real `SpellShapeshiftForm.dbc`.
- `unit_creature_type_names_the_form_before_the_race_and_a_creature_its_template` runs `feed_units` and asks the Lua binding.
- Mouseover, party, raid and pet feeders each have a test.
- `a_players_level_line_ignores_the_snapshots_creature_type`.

Fixes #641

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 06:20:12 +07:00
Sam SungandClaude Opus 5.5 9d4b3420f3 pet bar: a spell press with no Spell.dbc record, no active player object or no pet object sends nothing and arms nothing, as the spell arm's exits do (0x4bd2e7-0x4bd34f) (#660)
A pet-bar spell press sent `CMSG_PET_ACTION` even when the spell's `Spell.dbc` record or the pet object did not resolve. So with the pet out of the client's view, which leaves the bar standing on its guid from `SMSG_PET_SPELLS`, a press still made the server cast. In the reference the press does nothing there.

**The reference.** The pet bar's spell arm (types 1-5 through the jump table at `0x4bd4d0`, the arm at `0x4bd240`) first handles the aura cancel (`0x4bd242`-`0x4bd2ad`). It then leaves for the epilogue `0x4bd4c6`, with no GCD and no send, in any of these cases:
- the id is past `[0xc0d78c]` (`0x4bd2e7`-`0x4bd2ed`);
- the id has no record (`0x4bd2f3`-`0x4bd2fe`);
- the active player does not resolve (`0x4bd304`-`0x4bd324`);
- the pet guid `[0xb714a0]` does not resolve to a unit (`0x4bd346`-`0x4bd34f`).

The reaction arm (`0x4bd391`) and the command arm (`0x4bd3a3`) take none of these exits.

**Changes.**
- `PetPress::press` returns, with no send, no latch and no GCD, from a spell-slot press whose record, player object or pet object is unresolved. The exit comes after the aura cancel, as in the reference.
- `arm_pet_gcd` is now called only for a resolved press, so the two guards are one.

**Tests** (`ui_pet/press_tests.rs`):
- a press with no pet object, no catalog row or no player object sends nothing;
- the aura cancel needs no player object;
- Follow, Stay and a reaction still send with the pet unheld;
- Attack still sends at the selection with the pet unheld.

Fixes #638

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 05:49:04 +07:00
Sam SungandClaude Opus 5.5 6a36d8c351 world pick: while no word carries flag 0x20, a unit the active player possesses is no candidate, beside the active player, so the cursor and click reach the unit behind it (0x480610, 0x48064f-0x480674) (#659)
The world pick dropped only the active player. A unit you possess stayed a candidate, so under a Mind Control or an Eye of Kilrogg it highlighted under the cursor and a click selected it.

`0x480610`, the pick's unit and player filter, applies two exclusions whenever the pick flags lack `0x20`:
- the active player (`0x480638` → `0x480676`);
- a unit with `UNIT_FIELD_FLAGS & 0x01000000` (`UNIT_FLAG_POSSESSED`, `0x48064f`) whose `UNIT_FIELD_CHARMEDBY`, else `UNIT_FIELD_CREATEDBY`, is the active player (`0x480658`-`0x480674`).

Outside targeting the flags always lack `0x20`. `0x481050` ORs it only for a word that can bind yourself.

Changes:
- `TargetHoverState::excludes` holds both exclusions under the `PicksSelf` gate. `is_candidate` asks it on the posed pass and on the box path, so the two separate self skips are gone.
- The possession test moves to `target::relations::is_possessed_by`. The pet bar's `possessing` now wraps it.

Tests:
- `a_unit_you_possess_lets_the_pick_through_to_the_one_behind`: Mind Control, an Eye of Kilrogg, and a unit charmed by you but created by another, outside targeting and under an enemy word. The rear unit wins, and under a `0x20` word the possessed unit is the pick again.
- `a_lone_unit_you_possess_is_no_pick_at_all`.
- `a_unit_you_do_not_possess_keeps_the_pick`, with five controls.
- `possession_is_the_flag_and_the_charmer_else_the_creator`.

Fixes #649

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 04:49:08 +07:00
Sam SungandClaude Opus 5.5 3a0728cde2 ground-targeting cursor: the range verdict takes GetMinMaxRange's bounds, so a range talent (op 5) and the caster's reaches reach it (0x6e6810, 0x6e3480) (#658)
The ground-targeting cursor's range verdict compared the caster-to-point distance against the `SpellRange` row's raw min and max. A range talent therefore never reached it: with Arctic Reach, Blizzard read out of range past its base 30 yd.

**In the reference**, `CheckGroundPointInRange 0x6e6810` takes its bounds from `GetMinMaxRange` (`0x6e68b0`, null target at `0x6e6879`). That applies spell-mod op 5 to the max (`0x6e3744`) and, on a melee row, sums the caster's reach with the auto-attack target's. The compare (`0x6e68b5`-`0x6e68d3`) is inclusive at both bounds and fails on an unordered result. The GameObject leg of `SpellCanTargetUnit 0x6e6460` runs the same compare (`0x6e67d6`-`0x6e6802`) with the object as target, which reads as none.

**Changes:**
- `ground_point_in_range` takes its `(min, max)` from `SpellModifiers::min_max_range`, with no explicit target and with the caster's and the auto-attack target's reach. It compares `min² <= d² <= max²`.
- The terrain arm and the GameObject leg share one `RangeCall`, built once per frame.
- `BindChecks` gains the caster's reach and the auto-attack target's reach.
- Some ground spells do use the melee row (Earthshaker, Kadrak's Flag and a few quest spells), so the reaches are passed, not defaulted.

**Tests** (in `cursor.rs`):
- `a_range_talent_moves_the_ground_verdict`: Arctic Reach's cells on Blizzard's family bits put 33 yd in and 37 yd out, with the boundaries at 35.9 and 36.1. A family mismatch does not apply.
- `the_melee_row_reads_the_casters_reaches`.
- `the_terrain_verdict_reads_the_range_talent_and_the_casters_reaches` and `the_object_leg_reads_the_range_talent`, both through `drive_targeting_cursor`.
- The mirror test gains inclusive-bound and NaN cases.

Fixes #653

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 04:31:13 +07:00
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
Sam SungandClaude Opus 5.5 840719fc98 spell bind: BindTarget's party and raid arms ask 0x606c20 and 0x606d20 and CanAssist, so a group member binds Power Word: Shield, the Blessings and the Seals, and the world pick shares the party predicate (#655)
The binder cleared the targeting word's party bit `0x8` (implicit target 35) and raid bit `0x4` (targets 57 and 61) only for the caster, so no group member ever bound these spells. Affected spells:
- Power Word: Shield;
- the Blessings of Protection, Salvation and Sacrifice;
- Amplify Magic, Dampen Magic, Divine Intervention;
- every Greater Blessing;
- Seal of Protection and Seal of Sacrifice.

With a party member selected, they fell back to you or raised a cursor whose click bound nothing.

**The reference.** `BindTarget 0x6e5b40`'s party arm (`6e5cad`-`6e5cec`) asks `0x606c20(caster, unit)` and then `CanAssist 0x6066f0`. Its raid arm (`6e5cf1`-`6e5d2f`) asks `0x606d20` and `CanAssist`. The two predicates differ only in their membership call:
- The unit itself answers true.
- Otherwise both units need `UNIT_FIELD_FLAGS & 0x8`.
- Each side's controlling player is `0x606170`: charmer, else creator, else itself, and it must be a player.
- Either controller being you makes the answer the other's membership, tried both ways round.
- Membership is `0x4e7f70` for `0x606c20`: you or one of the four party slots. It is `0x4918e0` for `0x606d20`: that, or a raid roster row (`0x4baee0`).

**Changes:**
- `spell/group_relation.rs` builds both predicates as `TargetRelations::in_party` and `in_group`, over one controller helper.
- `GroupRoster` holds the party slots and the raid roster, and is published from `GroupState` before the input pass. No cast or hover system reads `GroupState` itself, so there are no new schedule orders.
- The binder's party and raid arms clear their bits for an assistable group member.
- The world pick's party leg (`4806b8`) shares `in_party`.

**Tests:**
- `group_relation.rs` covers the roster and each predicate leg: both player-controlled, pets through their owner, and the mirror.
- `the_shipped_party_and_raid_spells_bind_a_party_member` runs 11 real `Spell.dbc` rows.
- `the_press_the_click_and_the_hover_bind_the_same_group_members` runs 8 candidates through the party and raid words on the press, `SpellTargetUnit` and `SpellCanTargetUnit`, fed through the real `GroupState` publish. The candidates are a party member, a raid-only member, a stranger, pets, a friendly creature, the other faction and yourself.

Fixes #648

🤖 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:36:20 +07:00
Sam SungandClaude Opus 5.5 3b3ae850fa spell range: min_max_range takes the unit target and the auto-attack target apart, so a tooltip no longer pads a ranged spell by the swing target's reach (#654)
`min_max_range` took one `target_reach` that served two roles: the melee arm's fallback to the auto-attack target and the ranged arm's explicit target. The ranged arm padded whenever it was `Some`. The tooltip passed the auto-attack target's reach, so while you swung, every ranged spell's tooltip read its row plus both reaches: Fireball read "38 yd range" where 1.12.1 reads 35.

`GetMinMaxRange 0x6e3480` counts its target (`[ebx+0x10]`) only when it is a unit (`0x6e34e1`-`0x6e34f9`).
- **Melee arm** (`0x6e3552`-`0x6e3594`): with no unit target, it falls back to the caster's auto-attack target (`0x6e356a`), then to the caster's own reach.
- **Ranged arm:** pads only for a non-null target (`0x6e35d8`, `0x6e35ec`). The max always takes the pad, and the min only when nonzero.

What each caller passes:

| Caller | Call site | Target |
|---|---|---|
| Tooltip | `0x52e9c2` | none |
| `ActionHasRange` | `0x4e5852` | none |
| The cast check and `IsActionInRange` | through `CanTargetUnit 0x6e4440` → `0x6e47b0` | the bound or selected target |

Changes:
- `min_max_range` takes `RangeTargets { target, attack_target }`.
- The melee arm reads the target, else the attack target, else the caster. The ranged arm pads for the target alone.
- Each caller passes what its reference call site passes. The action button's two verbs are now two calls: `has_range` with no target and `in_range` with the selected one.
- `min_max_range_reads_reach` narrows to melee rows. The tooltip safety net then counts 813 reach-dependent views instead of 10,298, so starting to swing no longer rebuilds every ranged tooltip.

Tests:
- `ranges.rs`: `the_ranged_arm_pads_only_for_the_explicit_target`, `the_melee_arm_falls_back_from_the_target_to_the_attack_target_to_the_caster`, and the narrowed exactness test.
- `range_cell_on_real_data` reads Fireball as "35 yd range" and Charge as "8-25 yd range" with an auto-attack target present.
- `cast_range_refusal_follows_the_two_compares` covers a bound target's pad.
- `a_ranged_button_pads_its_range_by_the_selected_target_alone`.

Fixes #643

🤖 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:09:50 +07:00
Sam SungandClaude Sonnet 5.5 ec5083f471 world pick: while a spell targets, a unit or player the word cannot take is no candidate, so the pick reaches the one behind it (0x481050, 0x480610) (#652)
While a spell was targeting, the world pick admitted every unit and player. A unit the spell could not take, standing in front of one it could, took the hover and the click:
- a hostile or dead unit in front of a friend under a heal;
- a living player standing on a corpse under Resurrection;
- any unit in front of a chest under a lock word.

In the reference, both world picks build their flags through `0x481050`. While targeting (`4810f1`-`481187`):
- a word with unit bits (`0x6e6180`, `& 0x878e`) adds units and players (`0x18`);
- three relation flags follow: party `0x10000` (`0x6e61e0`, `& 0x40c`), assist `0x20000` (`0x6e6200`, `& 0x500`) and attack `0x40000` (`0x6e6210`, `& 0x480`);
- a dead-target word (`& 0x8600`) adds `0x200040`, and any other adds `0x100000`;
- `0x6e6240` (`0x8000`) adds assist, and `0x6e6250` (`0x200`) adds attack.

`0x480610` then drops a unit or player candidate when:
- none of the relations the flags ask for holds (`480686`): `0x606c20`, `CanAssist 0x6066f0` or `CanAttack 0x606980`, toward the active player;
- its liveness is not the one asked for (`4806fd`, signed `UNIT_FIELD_HEALTH` above 0);
- it has `UNIT_FIELD_FLAGS & 0x100` (`480737`).

A word with no unit bits puts no unit in the pick at all (`0x480780`'s unit and player arms need `0x8` and `0x10`).

- `spell/targeting/pick.rs`: `PickFlags::of(word)` builds the flags as `0x481050` does, and `PickFlags::admits` applies the three legs.
- `0x606c20` is built here, from the published party slots.
- `TargetHoverState::is_candidate` routes units and players through it on both the posed pass and the box fallback. The press latches the same pick.
- `CanAssist` and `CanAttack` toward a candidate become `TargetRelations::assistable` and `attackable`, shared with the binder's arms. The binder's behaviour is unchanged.
- The alive test is `bind_gates::unit_alive`.

Tests:
- `pick.rs` covers the flag table, each relation, Resurrection, the enemy corpse word, `0x100`, the caster, and `0x606c20` for self, a party member, pets and a stranger.
- `hover.rs` stands two units on the cursor's ray. The rear unit wins when the front one is refused. A lone refused unit gives no pick, and a word with no unit bits picks no unit. The press latches the rear unit.
- Outside targeting the front unit still wins.

Fixes #464

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 02:10:24 +07:00
Sam SungandClaude Opus 5.5 4573596e27 UnitIsConnected answers 1 for every held unit: snapshot sets it, so the pet frame's power bar reads the pet's power instead of a grey maximum (#651)
`ui_unit::snapshot` builds a held unit's view and left `is_connected` at its default, false. Each feed that calls it had to set the field afterwards. The pet feed did not, so `UnitIsConnected("pet")` answered nil for a live pet. The stock `UnitFrameManaBar_Update` (`UnitFrame.lua`) then took its disconnected branch, and the pet frame's mana, focus or energy bar read full and grey. The mouseover feed had the same gap.

`UnitIsConnected` (`0x517d50`) looks the unit up in the object manager (`0x517da6`, typemask 8), and any held unit answers 1 (`0x517daf`). The roster record's online bit is read only when no object is held.

- `snapshot` now sets `is_connected` itself.
- The per-feed overrides for player, target, targettarget, npc, our own raid row and the held party pet go.
- The party feed's record-derived value for its members stays.
- The pet frame tests build their pet through the real `snapshot` rather than pushing the flag by hand.

Test: `a_held_pet_reads_connected_and_its_stock_power_bar_shows_its_power` loads the default UI and runs the real `feed_pet_unit` with a held focus pet. It checks that `UnitIsConnected("pet")` is 1 and that `PetFrameManaBar` reads 45 of 80 in the focus colour.

Fixes #642

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 01:49:11 +07:00
Sam SungandClaude Opus 5.5 44fb6e5e43 spell tooltip feed: each pushed view records what it read, and a change of the player's state rebuilds only the views that read it (#650)
Every spell-tooltip invalidation rebuilt every view the feed had ever pushed. The remembered set only grows: the book, every talent rank and trainer service, and every aura ever seen. So in a long session each of these frame-hitched for 1.5 to 4 ms:
- a crit or dodge change;
- a worn-slot change;
- a target swap while auto-attacking;
- a spell-modifier packet;
- a reagent cast.

The reference builds a tooltip at the hover (`0x52e610`) and keeps nothing. benilla pushes views ahead of the hover, so it has to know what each view was built from.

Each pushed view now records, as it is built, the inputs it read: the `$z` home area, the form line, the worn slots the equipped-item search reads, and so on. Each record sits at the line that reads the input.

The inputs:
- the `$z` home area;
- the form line (a spell with `Stances`);
- the worn slots the equipped-item search reads, each slot's item, template and broken state, and the disarm flag;
- the chance line's percentage (`Effect[0]` 20, 22, 23, 78);
- the combat reach the range cell reads;
- the skill lines the `$`-tokens scale by, the spell's own and those of each spell it cross-references;
- the modifier family-flag bits of the spell and of those it cross-references;
- the reagents it lists;
- the player's level, base mana, max health and max power where the cost or cast cell reads them;
- the ranged attack time the cooldown cell pads by.

The feed diffs those inputs frame to frame and rebuilds only the views whose recorded reads intersect what moved. A class-family change still rebuilds everything, and the pet's own inputs still rebuild the pet views.

The feed moves out of `ui_tooltip/mod.rs` into `spell_feed.rs` (the builder and the system) and `spell_deps.rs` (the records and the diff). `TokenContext::home_area` becomes a closure, so a `$z` read is recorded exactly.

Measured in release on the real data with 2,000 remembered ids, per forced change:
- crit or dodge: 3.3 ms → 26-38 µs;
- one worn slot: 3.5 ms → ~100 µs;
- one modifier cell: 3.5 ms → ~60 µs;
- all 64 modifier bits: 3.5 ms → ~0.6 ms;
- reach: 3.3 ms → 1.3 ms, still high because the range cell also pads ranged rows by reach (#643);
- a quiet frame: unchanged.

The bench is `ui_tooltip/bench.rs`, `#[ignore]`d.

Tests:
- `deps_tests.rs`, the safety net, builds all 22,357 real views. For each input it moves the input alone and fails on any view that changed without having recorded it, naming the spell and the input.
- It also moves everything each view did not record at once, from both sides.
- It pokes every player-store field (and every pet-store field for the pet views) to discover reads mechanically.
- It enumerates the equipment slot states the item search distinguishes.
- `feed_tests.rs` drives `feed_spell_tooltips` itself. A dodge change re-pushes only the dodge chance-line view, and a modifier cell only its family's views.

Fixes #535

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 01:22:18 +07:00
Sam SungandClaude Opus 5.5 e071b8ded3 partypetN and raidpetN unit snapshots: the getters read the held pet or its owner's record, UNIT_PET fires with the owner's token, and the stock party pet frame shows (#644)
The first half of #448 taught the unit-token resolver `partypetN` and `raidpetN`. The per-token unit snapshot that `UnitExists`, `UnitName`, `UnitHealth` and the other getters read still pushed neither. So the stock party pet frames never showed: `PartyMemberFrame_UpdatePet` shows the pet frame on `UnitExists("partypet"..id)`, and `SHOW_PARTY_PETS` defaults to `"1"`.

In the reference:
- **`UnitExists`** (`0x515fb0`) answers 1 for a unit the client holds. It also answers 1, through the roster fallback, for a party member's pet guid cached behind the owner's online bit (`0x4e80a0`) and for a raid row's pet (`0x4bafd0`, gated on the row's online bit at `0x4bb040`), with no object at all.
- **The getters** read, in order: the live descriptor, the party or raid record (`0x496400`), then the pet record (`0x496420`). The pet record holds health `+0xdc`, max health `+0xde`, power type `+0xd8`, and power and max power `+0xe0`/`+0xe2`, the power divided as the live path does.
  - `UnitIsConnected` is 1 on any pet-record hit (`0x517dfb`).
  - `UnitLevel` and the dead and ghost predicates have no pet leg.
- **Events:** the unit-token router `0x515c50` fires each unit event once per token naming the unit, `partypet%d` and `raidpet%d` included. The stats handler `0x5e5720` fires `UNIT_PET` for the owner on the pet-guid bit.

Changes:
- `ui_party/pets.rs` pushes a snapshot per `partypetN` and `raidpetN`. It comes from the pet's store while held, else from the owner's record, and the existing transitions fire each token's `UNIT_*` events.
- `UNIT_PET` fires with the owner's token when that owner's pet guid changes. The feed's change gate now watches the members' pet stores.
- The despawn snapshot copies the pet's cached name into the member's record (`0x5f0a63`-`0x5f0a70`), so `UnitName("partypetN")` answers for a pet out of view.
- `partypet1..4` get portrait slots. A held pet bakes like `"pet"`. An unheld one that the owner's record names shows `TemporaryPortrait-Pet` (`0x525cb0`).

Tests:
- `ui_party/pets.rs` covers the held-pet and record getters, an offline owner, `UNIT_PET` off the record and off a held member's `SUMMON`, and `UNIT_HEALTH` with the pet's token.
- It also covers raid rows with an offline row's pet.
- `the_stock_party_frame_shows_and_hides_its_pet_frame` loads the default UI and checks that `PartyMemberFrame1PetFrame` shows and hides on dismiss.
- Two portrait tests cover the slots and the stand-in.

Fixes #448

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 00:02:42 +07:00
Sam SungandClaude Opus 5.5 8ef62da6ac spell bind: BindTarget's unit gates run ahead of the relation arms at the press, the click and the hover, through one creature-type resolver (#640)
The spell target binder went straight to the relation checks and tested none of `BindTarget`'s unit gates. So:
- a heal with a dead friendly player selected was sent at the corpse and refused by the server;
- Hibernate, Banish or Turn Undead at the wrong creature type was sent and refused, instead of refusing locally with "Invalid target";
- a self-excluding spell with yourself selected bound you.

`BindTarget 0x6e5b40` refuses a unit silently, before any relation arm, when any of these holds:
- the unit is the caster and the spell has `AttributesEx & 0x80000` (`6e5bd8`-`6e5bf7`);
- the unit has `UNIT_FIELD_FLAGS & 0x10000` (`6e5c1d`);
- the spell's `TargetCreatureType` mask excludes the unit's type (`6e5c26`-`6e5c53`). A zero mask admits every unit. Otherwise a unit of type 0 is refused and a typed one needs bit `type - 1`;
- the unit is dead (signed `UNIT_FIELD_HEALTH` not above 0), unless `UNIT_DYNAMIC_FLAGS & 0x20`, a word in `0x8600` or `AttributesEx2 & 1` admits it (`6e5c5f`-`6e5c8b`);
- the unit is alive and the word has `0x400` (`6e5ca2`).

A refused selection falls to the player behind `autoSelfCast`, then to the enemy-word refusal or the cursor. `SpellCanTargetUnit 0x6e6460` runs the same five gates (`6e6507`-`6e65ab`).

- `spell/bind_gates.rs` holds the five gates. `cast_target::unit_binds` is the one predicate for the selection, the `autoSelfCast` fallback, the cursor's click, `SpellTargetUnit` and the hover verdict. The cursor's separate `excludes_caster` checks fold into it.
- The dead test now matches the reference, which catches a corpse whose create block sent no health. The `0x400` bit is now cleared by a dead unit's bind (`6e5d89`, `6e5ddb`), where before any non-self candidate cleared it.
- `creature_type.rs` is the one `0x605570`, reading these in order:
  - the form's `SpellShapeshiftForm` creature type;
  - the creature template's type, by `OBJECT_FIELD_ENTRY`;
  - `ChrRaces`'s type.
  The minimap's tracking dots used their own copy, keyed by the guid's entry bits and missing the fall-through past the form. They now call the shared resolver.
- `SpellDisplay` reads `TargetCreatureType` (column 14).

Tests:
- `bind_gates.rs` has a truth table per gate. Its `ladder` module drives `resolve_cast_target` through:
  - a dead heal target, with `autoSelfCast` on and off;
  - Hibernate at the wrong type;
  - a self-excluding spell;
  - the `0x10000` flag;
  - the `0x402` word.
- `the_press_the_click_and_the_hover_bind_the_same_units` runs one table through all three paths.
- `real_spell_catalog_reads_the_bind_gate_columns` pins the real rows for Hibernate, Banish, Turn Undead, Mind Control, Bloodlust and Revive.

Fixes #449

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 23:31:30 +07:00
Sam SungandClaude Opus 5.5 0e04e54fbf pet bar: a spell press starts the pet's global cooldown on the pet's list, as 1.12.1's spell arm does before it sends (#636)
A pet-bar spell press armed no global cooldown on the pet's list. Claw or Firebolt sent `CMSG_PET_ACTION`, and no slot on the pet bar swept, so the bar looked ready while the pet could not cast. Only a spell with its own recovery timer, such as Bite, showed a sweep.

In the reference, the pet bar's spell arm (`0x4bd240` in `0x4bd1d0`) first handles two cases that skip the cooldown:
- A spell that is a live aura on the pet sends the cancel and returns.
- A possessed unit, or a spell with `AttributesEx4 & 0x20` (`0x4bd355`, `0x4bd35e`), takes the generic cast entry `0x6e4b60`.

Every other press calls `StartGlobalCooldown 0x6e2de0(spellId, 1)` (`0x4bd367`-`0x4bd36e`) before the `0x175` send. That call applies the spell's own `StartRecoveryCategory`/`StartRecoveryTime` pair, under spell-mod op 21, into the pet's list (`0xcecaec + 0x18`). This press is the only place the pet's GCD starts, because the `SMSG_SPELL_GO` pet leg inserts none (`0x6e85f7`).

Changes:
- `SpellDisplay` reads `AttributesEx4` (column 10).
- `PetPress::press` arms the pet list's GCD through the existing `Cooldowns::start_gcd`, with the player's modifier tables. It skips the arm for the cases above and for an unresolved record or pet object (`0x4bd2fe`, `0x4bd34f`).
- The feed's cooldown diff then fires `PET_BAR_UPDATE_COOLDOWN`.

In the shipped `Spell.dbc` the pair is 133/1500 for most pet spells (later Claw ranks, Bite, Lash of Pain, Torment, Suffering) and 133/1000 for Firebolt and Claw rank 1. A real-data test pins both values.

Tests:
- `ui_pet/press_tests.rs` presses through `PetPress::press_slot` and covers:
  - the GCD across the slots sharing the category, read back through `GetPetActionCooldown`;
  - no pair;
  - possessed;
  - `AttributesEx4 & 0x20`;
  - the aura cancel;
  - no pet object;
  - op 21.
- `real_pet_spells_carry_the_gcd_pair_and_ex4_reads_column_10` reads the real `Spell.dbc`.

Fixes #589

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 22:11:40 +07:00
Sam SungandClaude Opus 5.5 66340800a9 unit tokens: partypetN and raidpetN resolve to the member's held pet, tested before party and raid, and the reach feeds cover them (#635)
`UnitTokens::resolve` had no arm for `partypetN` or `raidpetN`. `"partypet1"` fell into the `party` arm and failed to parse `pet1`, and `"raidpet1"` did the same in the `raid` arm. As a result, the stock TARGETPARTYPET1-4 bindings, the pet half of the TARGETPARTYMEMBER toggle, `TargetUnit`, `AssistUnit` and `SpellTargetUnit` all did nothing on a party or raid pet.

The reference's resolver `0x515970` tests `partypet` before `party` (`0x515a9a`) and `raidpet` before `raid` (`0x515b1c`):
- `partypetN` (`0x491930` → `0x4e81d0`) takes the Nth party slot's member. It names that member's `CHARM`, else its `SUMMON`, while the member is held. Otherwise it names the pet guid on the party record, behind the member's online bit (`0x4e8221`-`0x4e8230`).
- `raidpetN` (`0x491960`) does the same for the Nth raid row, bounded by the raid count, with no online test.

Changes:
- The two arms resolve through the existing `GroupState::party_pet_guid` and `raid_pet_guid`, then the object manager.
- The reference's `partypetN` has no bound. Here an index outside 1-4 names nobody, as it does for `partyN`.
- The four group arms now share one digit parse, `slot_number`, which is digits-only as the reference's is. So `"party+1"` no longer resolves.
- `reach_tokens` now covers the pet tokens, so `CheckInteractDistance`, `CanInspect` and `SpellCanTargetUnit` measure them.
- The token tables `ui_aura` kept privately now live in `ui_party` beside `PARTY_TOKENS` and `RAID_TOKENS`.

Tests:
- `ui_unit.rs`'s `group_pet_tokens` covers the order against `party`/`raid`, case folding, the bounds, charm-else-summon, the record leg and its online bit, raid rows and the reach feed.
- `target/script.rs` adds `target_unit_selects_a_party_pet`.

This is the resolver half of #448. The per-token unit snapshot that `UnitExists`, `UnitName` and `UnitHealth` read does not push the pet tokens yet, so the party pet frames stay hidden until that half lands.

Part of #448

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 21:36:15 +07:00
Sam SungandClaude Opus 5.5 f768cf3e60 CastSpellByName's onSelf and CastSpell's third argument cast the spell at the player, the pet book's at the player too, read through GetBoolOrDefault as the reference does (#634)
`CastSpellByName(name, onSelf)` dropped its second argument, and `CastSpell(slot, book, onSelf)` read only two. So a self-cast macro line such as `CastSpellByName("Power Word: Fortitude", 1)` buffed the selected friend instead of you. With no friendly target and `autoSelfCast` off, it did not cast at all.

In the reference, `CastSpellByName` (`0x4b4ab0`) reads its second argument through `GetBoolOrDefault(L, 2, 0)` (`0x4b4aea`-`0x4b4af1`). `CastSpell` (`0x4b42f0`) reads its third the same way (`0x4b4333`-`0x4b433c`). When the value is nonzero, the active player's guid replaces the selection as the guid handed to the dispatcher `0x4b3300` (`0x4b4afa`, `0x4b4345`). The player's book then binds it through `ArmCast`'s explicit-guid leg (`0x6e5393`). The pet book sends it as `CMSG_PET_ACTION`'s target (`0x4b34ce`).

- `ScriptCall::CastSpell` and `CastPetSpell` now carry `on_self`, read with `binding_abi::bool_or_default`. That is not Lua truthiness: `"0"`, `"false"` and `0.5` are false; `"yes"`, `"on"` and `1` are true.
- The action bar's self-bind swap is now `CastContext::self_bound`, which `UseAction`'s `onSelf` and the two script casts share. `ui_spellbook::cast_spell` applies it and hands `on_self` to the attack pick.
- The pet book's `CMSG_PET_ACTION` aims at the player under `onSelf`.

Tests:
- `cast_spell_by_name_reads_on_self_as_the_reference_coerces_it` and `cast_spell_reads_on_self_from_its_third_argument` cover the coercion.
- `on_self_casts_at_the_player_and_leaves_the_selection`, `on_self_binds_the_player_where_the_selection_is_not_assistable` and `a_pet_book_cast_on_self_aims_at_the_player` check the wire target through `apply_script_calls`.

Fixes #446

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 21:11:47 +07:00
Sam SungandClaude Opus 5.5 666300c6a5 doodad anim gate: a meshed host is drawn only while its fade sphere intersects the world camera's frustum, like a meshless one (#633)
A meshed doodad counted as drawn whenever one of its parts had a `Visibility` other than `Hidden`. Bevy's frustum culling writes only `ViewVisibility`, so a doodad behind the camera kept an `Inherited` part and went on animating and ticking its particles.

The reference animates (`0x714260`) and ticks (`0x718960`) only the M2 scene's worklist, which `0x707680` builds. A doodad is admitted to that worklist only after the 6-plane frustum test `0x683700`.

`gate_doodad_anim` now also tests a meshed host's fade sphere against the world camera's frustum. That sphere is the doodad's world bounding sphere, fixed at spawn. A meshless host already had the same test, and both branches now share one closure. The `Visibility` term stays, because it carries the fade, exterior and room verdicts.

Test: `a_meshed_host_outside_the_frustum_is_parked`. Two meshed hosts with `Inherited` parts sit one behind the camera and one ahead of it. Only the host behind is parked.

Fixes #619

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 20:35:20 +07:00
Sam SungandClaude Opus 5.5 cd441385c7 zone music: a start that plays nothing leaves the pump armed, so the next frame retries with a fresh pick, and a bad path warns once (#632)
The zone music pump cleared its due time before asking for a track, and a zone-music change started its track inline with nothing armed behind it. So a start that played nothing left the zone silent until the next change. Any of these did it: no kit for the phase, or a weighted pick landing on a file the install does not ship. The Crossroads (and every area on its kit) ships 1 of its 4 tracks, Alterac Valley's kit 6 of 8, and Everlook's has no night kit.

In the reference, the pump `0x460040` calls the start `0x460240` whenever no stream is live and the due time `[0x836400]` is `-1` or past. The start returns without writing `[0x836400]` on every failure path (`0x46024b`, `0x46025f`, `0x46027b`-`0x460282`, `0x4602a4`), so the next tick retries with a fresh pick (`0x45bb70`). Now:
- `pump_zone_music` spends the deadline only when a stream opened;
- `begin_zone_music` arms a retry (`Some(now)`, the change's `-1`) when neither the intro nor the zone track started;
- a path that cannot play warns once, not once per retry.

`a_pick_that_lands_on_a_missing_file_is_retried_until_one_plays`, `a_zone_change_whose_start_fails_keeps_the_pump_armed` and `a_phase_with_no_kit_stays_armed_until_the_other_phase_has_one` fail without the change. Four more pin the edges: warn once, a started change arms nothing, no row drops the deadline, a failed intro falls through unstamped. Built and gated on macOS.

Fixes #64

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 20:05:34 +07:00
Sam SungandClaude Opus 5.5 06f9cc93df char create: the CharBaseInfo guard requires every shipped race/class pair and lets a patch add more, as the class-list builder lists every row (#631)
`CharCreateCatalog::load`'s misparse guard demanded each race's `CharBaseInfo` classes equal the shipped set exactly. A patch that adds a race/class row therefore failed the load, and without the catalog the create screen is disabled and the glue preview stands no body. 1.12.1's class-list builder (`0x4706b0`) lists every `CharBaseInfo` row for the selected race, skipping only Dwarf+Mage (`0x4706e3`-`0x4706ec`), so the patched class appears there.

The guard, now `shipped_combos_present`, requires every shipped pair to be present and lets extra pairs through, so a misparse that loses a row still refuses. `a_patched_combo_passes_the_guard_and_a_lost_one_does_not` fails under the old exact-match rule. Built and gated on macOS.

Fixes #617

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 19:52:19 +07:00
Sam SungandClaude Opus 5.5 6e9e5e995d ui_dialog_verbs: a battleground's run time is the time since its status plus the wire's elapsed ms, read forwards so no Instant precedes the clock's origin (#630)
`GetBattlefieldInstanceRunTime`'s stamp was set backwards, as `now - Duration::from_millis(elapsed_ms)`, with `elapsed_ms` the u32 from `SMSG_BATTLEFIELD_STATUS`'s in-progress tuple. On Windows, std's `Instant` is a `Duration` from the performance counter's origin, so a run longer than the machine's uptime panics there. On macOS and Linux the subtraction cannot panic.

The stamp is now the status's arrival and the wire span, and `run_time_ms` reads `now.saturating_duration_since(at) + elapsed`. That is the old value everywhere the old one did not panic, taken forwards the way the queue's time waited is. `a_run_longer_than_any_uptime_reads_forwards` pins a 49.7-day run, and the status-handler test now also checks that the stamp runs on after the status. Built and gated on macOS; the Windows target was not built.

Fixes #627

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 19:34:39 +07:00
Sam SungandClaude Opus 5.5 57f33aa620 guild roster: zone and class keys order a miss after every name and NaN days get a place, so the comparator is a total order (#629)
The guild roster's zone and class keys went through `abstaining`, which answered `Equal` whenever either value was empty. So `"" = "Mage"` and `"" = "Warrior"` while `"Mage" < "Warrior"`: not a total order, and since Rust 1.81 `sort_unstable_by` may panic on one. The feed writes `""` for any class or zone id with no name. In the same comparator, the both-offline arm ordered `last_online_days`, a wire float, with `partial_cmp().unwrap_or(Equal)`, so a NaN equalled everything.

The reference's class arm (`0x4d0e25`-`0x4d0e2f`, `ChrClasses`) and zone arm (`0x4d0e9f`-`0x4d0ea5`, `AreaTable`) jump to `0x4d0efd` when either row is missing: a tie that passes to the next key. Now:
- `misses_last` compares two resolved names as before;
- two misses tie, so the next key decides, as in the reference;
- a miss orders after every name, marked as a deviation, since no total order can tie there;
- the offline arm uses `f32::total_cmp`.

`every_key_is_a_total_order_over_mixed_rows` checks antisymmetry and transitivity for Zone, Class and Online over 24 mixed rows, a NaN included. `sorting_a_mixed_roster_puts_misses_after_hits` checks the sorted order. Both fail with the old arms, as does `the_online_tiebreak_and_the_dbc_miss_order`. Built and gated on macOS.

Fixes #614

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 19:25:44 +07:00
Sam SungandClaude Opus 5.5 45825b0609 ui_battlefield: a queued battleground's time waited is the time since the status plus the wire's waited ms, computed forwards so no Instant precedes the clock's origin (#628)
A queued battleground's time waited was computed backwards: `*at - Duration::from_millis(waited)`, with `waited` the server's u32 milliseconds. On Windows, std's `Instant` is a `Duration` from the performance counter's origin, near boot, so a wait longer than the machine's uptime panics there. On macOS and Linux, `Instant` is a signed timespec and the subtraction cannot panic; the issue's platform note overstated that.

The time waited is now taken forwards, as `now.saturating_duration_since(*at) + waited`. That is the same value the reference's `[slot+0x1c] = now − Δ`, read back as `now − stamp`, gives, and the old formula's value everywhere it did not panic. `a_waited_span_longer_than_any_uptime_reads_forwards` pins a 49.7-day wait reading forwards and saturating at the getter's u32. `the_slot_view_reduces_the_clocks` still gives 7 000 ms for 5 s waited plus 2 s since. Built and gated on macOS; the Windows target was not built.

Fixes #615

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 19:17:58 +07:00
Sam SungandClaude Opus 5.5 61f17d46c3 who_sort: the class, race and zone arms order a miss after every resolved name and tie two misses, a total order sort_by can take (#626)
`dbc_name_cmp`, behind the who list's class, race and zone keys, answered `Equal` whenever either name was empty. So `"" = "Mage"` and `"" = "Warrior"` while `"Mage" < "Warrior"`: not a total order, and since Rust 1.81 `slice::sort_by` may panic on one. Empty names are real input, since `who_row` writes `""` for any id with no name.

The reference's arms (`0x5ada7b`, `0x5adadf`, `0x5adb40`) look both ids up and, when either row is missing, jump to the chain loop's continue label (`0x5adbb2`, from `0x5adab6`): a tie. Its `qsort` tolerates that; ours cannot. Now:
- two resolved names compare as before;
- two misses tie, so the next key decides, as in the reference;
- a miss orders after every resolved name. That case is marked as a deviation, since no total order can tie there.

`the_dbc_arms_are_a_total_order` checks antisymmetry and transitivity over a mixed 21-row set for each key. It fails with the old arm, as do `an_unresolved_dbc_name_sorts_after_the_resolved_ones` and `sorting_a_mixed_list_puts_misses_last_without_panicking`. Built and gated on macOS.

Fixes #620

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 19:08:28 +07:00
Sam SungandClaude Opus 5.5 b065554f4b config.toml saves one quiet second after a change, not only on the exit frame, and a unit test resolves no state folder unless it pins BENILLA_HOME (#625)
`save_config` was registered only on the exit frame, so its "one quiet second" leg never ran, and a crash or kill lost every setting changed in the session. 1.12.1's `SaveConfig` (`0x63d980`) also writes on entering the world (`0x46b6f6`) and on leaving it (`0x490c35`-`0x490c64`), not only at shutdown (`0x63daf0`).

- `save_config_when_quiet` runs in `Last`, before `OnAppExit`, after every `Update` writer of the registry. It saves once the registry has been dirty for one quiet second (`SAVE_QUIET`).
- `save_config_on_exit` keeps the exit-frame flush, unchanged.
- `write_config` is the atomic write both share.
- Under `cfg(test)`, `local_state::home()` resolves nothing unless `BENILLA_HOME` is pinned. The quiet save gives tests a write path they never had, and it could otherwise reach the primary checkout's real `benilla-config/`. The resolution tests read `resident_home()`.

`a_change_saves_after_one_quiet_second_with_no_exit` fails without the quiet registration. `a_test_without_an_override_has_no_state_folder` fails without the test guard. Built and gated on macOS.

Fixes #618

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 18:50:38 +07:00
Sam SungandClaude Opus 5.5 b26f7c1f20 terrain_stream: a placement or WMO prop whose model load failed is retired as resolved, so it stops counting as pending and the loading screen clears (#624)
A placement whose model load failed (a file missing from the chain, or a model the parser rejects) stayed unspawned for ever. The spawner treats `m2s.get(h) == None` as "still loading", the progress count holds it as pending, and `scene_ready` needs zero pending, so the loading screen never cleared.

`spawn_loaded_placements` now first retires any unspawned placement (M2 or WMO root) or WMO prop whose handle's `LoadState` is `Failed`. A retired entry spawns nothing, is flagged spawned, and leaves `pending_spawns`, with one warning naming the path. That is the same fallback the WDT load already takes. Handles that are still loading keep waiting. WMO groups read inline in the WMO loader, so the root's state covers them.

`a_failed_model_load_retires_the_placement` and `a_failed_prop_load_retires_the_prop` load unresolvable paths through a real `AssetServer`. Both fail with the failure check removed. Built and gated on macOS. What draws in place of a missing model stays #330.

Fixes #616

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 18:34:03 +07:00
Sam SungandClaude Opus 5.5 5d25ac9286 entities: a torn-down net unit gets no new visual work (attach, rebuild, re-dress, re-seat, held items), so no command lands on a despawned unit (#623)
A unit torn down (out of range or destroyed) before its visual was built still got one built, and the build's plain entity commands could apply after `apply_despawn_fade` had despawned it. That chain is unordered against the attach chain, and Bevy's default error handler panics.

The reference frees the object at once on destroy (`0x4674a0`, `0x465ec0` → `0x464920`), and only an already-built model fades (`0x672df0`). So a torn-down unit now gets no new visual work: `Without<DespawnFade>` on the queries of `attach_entity_visuals`, `refresh_live_display`, `heal_rig_starved`, `redress_player_looks`, `reseat_mounts` and `attach_held_items`.

`a_torn_down_unit_is_not_built` drives the real `attach_entity_visuals`, despawns the torn-down unit between the system's run and its command flush, and panics with "Entity despawned" on `insert<AppliedMount>` without the filter. `a_torn_down_starved_unit_is_not_rebuilt` covers the heal path. Built and gated on macOS.

Fixes #612

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 18:20:17 +07:00
d4c280d2b1 Caps Lock remapped to Escape (X11 caps:escape) acts as Escape on Linux, as in the real client (#602)
- On Linux a key the keyboard layout remaps (X11's caps:escape) acts as the key it is remapped to, as in the real client
- A layout-moved named key also acts as that key on Windows, where the reference reads the layout's virtual key; macOS keeps its physical table

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Sam <samuv.eth@gmail.com>
2026-09-29 17:19:26 +07:00