Commit Graph

80 Commits

Author SHA1 Message Date
Sam Sung d5e37dd975 Every deviation names its reason, and a gate keeps it so (#2868)
`docs/METHOD.md` asks each deviation to name the reference fact and why benilla differs. About 130 `Deviation:` comments gave no reason, and the Warden comment lost its reason when the refusal became a read-past.

- `scripts/genmap.sh --check`, now a gate, fails a `Deviation:` comment without "because" and a `Deviates` row without a Why.
- `scripts/deviation-why.allow` lists the 43 comments whose change recorded no reason. It only shrinks: an entry that gains its reason, or is new against main's copy, fails.
- About 190 comments that gave their reason in other words now say "because", with their meaning kept.
- Nine reasons, the Warden one among them, come back from the commits and pull requests that made them.

Tested by the gate on the full tree, and by its failure on a comment with no reason and on a stale entry.

Fixes #2856
Fixes #2857

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 06:23:34 +07:00
Sam Sung 24cd215ba6 The cast getters read live; a refused reagent line shows at its answer (#2818)
The cast state's getters read a copy a feed pushed once a frame, and a refused cast line that missed the item cache retried at frame time, so both lagged their packets.

**Reference**
- IsCurrentAction, IsAutoRepeatAction, SpellIsTargeting, SpellStopCasting and the targeting word's checks read the cast state at the call (`0x4e54c1`, `0x6e48e0`, `0xcecac0`).
- A reagent or totem refusal that misses the cache registers `ShowItemCastFailure` (`0x6e1e82`-`0x6e1ea4`, `0x6e29b0`). The item's answer shows it, with UNKNOWN on a refusal (`0x6e2a49`). With no item word no line ever shows (`0x55be5d`).

**Changed**
- The getters read through the host, and `feed_cast_reports` is gone.
- The refused line rides the item cache's callback list.
- The "Missing reagent" fallback that 1.12.1 never shows is removed.

**Tests:** the line between its neighbours for a record and for a refusal, the getters between packets, no line with no item word.

Part of #2168 and #2217.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 00:06:35 +07:00
Sam Sung d12054da65 Death, logout and the taxi flag read live and signal at their packets (#2796)
Three windows still answered from a copy a feed refreshed once a frame, and fired their events there.

**Reference**
- The cursor's control gate reads our unit's taxi bit at the call (`0x494b97`-`0x494ba6`).
- PLAYER_CAMPING, PLAYER_QUITING, LOGOUT_CANCEL and the logout-failed line are raised by their packets' handlers (`0x5aaf17`, `0x5aaf72`, `0x5aaf26`).
- The death signals fire at their packets, and the corpse range is checked each frame (`0x492130`).

**Changed**
- The taxi gate reads the flag off our object.
- The logout replies go on the notice lane at their handlers.
- The death getters (GetCorpseRecoveryDelay and the rest) read live, and the death signals fire at their packets.
- `feed_on_taxi`, `feed_logout` and `feed_death` are gone.

The fake world server logs a session before answering its authentication, which a loaded test run read behind.

**Tests:** each getter read between two feeds, and each event between its neighbouring packets' events.

Part of #2168 and #2217.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 11:55:07 +07:00
Sam Sung 289b0ec5f6 Tooltips, spell targeting and the mouseover read live at the call (#2767)
Spell and aura tooltips, `SpellCanTargetUnit` and the `"mouseover"` getters read a copy pushed once a frame. A listener inside a packet saw the last frame's values, and `GetRaidTargetIndex("mouseover")` was always nil.

Reference: the setters build the view at the call (`0x52e610`, `0x52f880`). `SpellCanTargetUnit` reads the unit and range at the call (`0x6e6d00` → `0x6e6460`). A reagent's record answer rebuilds a shown spell tooltip (`0x52f820`).

Changed:
- the setters build through the call host;
- the frame feed and its re-push machinery are gone;
- targeting and the mouseover read live;
- a reagent's answer rebuilds the shown tooltip.

The hover's guard rows cite the cache callbacks that rebuild it inside packets.

Tests: a trainer listener's `SetSpell` reads its own packet's cost. Also covered: `SpellCanTargetUnit` out of range, the mouseover mark, the reagent rebuild, and the pet and aura views.

Part of #2168.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 18:54:06 +07:00
Sam Sung 53bc8245b7 Every item action sends ahead of its cursor clear's and lock's signals (#2759)
Every item action queued its packet for after its Lua call, so the cursor clear's and the lock's listeners ran before the packet went out. In 1.12.1 each sends first, then clears or locks. Examples: `AutoEquipCursorItem` (send at `0x5e1757`, clear at `0x5e1763`), the split (`0x4f9e43`, then `0x4f9e4f`), `DeleteCursorItem` (`0x4898a3`, `0x4898af`), the bank and sale arms (`0x4fa305`, then the lock at `0x4fa312`), and the merchant sell (`0x4fb7a7`, `0x4fb7b3`).

Every item send now goes to the host in place, ahead of its clear's or lock's signals, and `Model::item_calls` is gone. The projectile unlock is decided once, from the item's record (`0x5d9f30`). A set refused with no control plays no pickup sound (`0x494b8d`).

Tests cover 16 paths, in the order each sends and signals. Each fails on main.

Fixes #2752

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 14:01:42 +07:00
Sam Sung 09c276fe97 Bag and item reads answer as of their packet; logout reads no player (#2728)
Bag and item reads now answer as of the listener's own packet, not the frame's end, and the logout reads what 1.12.1 has there.

- The bag getters read the player's bags, the bank and the keyring live. Item and container writes go into the view log, so a listener sees its packet's slots, stacks and bags.
- The loot close's two unlocks fire at its packet (`0x48f2bd`, `0x4c1d36`). A wrong-bag refusal names the bag its packet found (`0x5e3a1e` → `0x5ede00`).
- At logout the object manager goes before PLAYER_LOGOUT fires (`0x46771e`, `0x490c2a`). The inventory getters then answer nothing with no active player (`0x4944a0` → `0x4c8c56`). `UnitName("player")` keeps the character's name.
- The item tooltip feed follows record changes by cursor. The suffix template is copied after the frame's Lua.

Each change has a test that fails without it. flip_readiness falls to 92 rows.

Fixes #2725
Refs #2168
Refs #2217

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 01:52:03 +07:00
Sam Sung 71c9adb0e9 Lua arguments coerce and gate as the client reads them (#2622)
Lua arguments are read the way the client reads them:
- numeric strings go through the VM's own number coercion instead of Rust's parse, truncating through `_ftol` where the bytes do (SetGuildRecruitmentMode `0x4a008f`, SetWorldDetail `0x488e0a`, the compare-item and model verbs)
- `debugstack` takes numeric-string levels, ports the level window's wrapping arithmetic, prints `(tail call): ?` below level 0, and joins leftover arguments top-down (`0x703760`)
- SendAddonMessage returns first with no player object (`0x49f94b`)
- the four sell-cursor verbs gate on targeting and repair mode before their arguments (`0x4fbab7`, `0x4fbac9`)
- SetPortraitTexture checks the token after blanking; 13 unit predicates take any value, and three more check the token

Each fix has a test that fails without it.

Fixes #2501
Fixes #2502
Fixes #2527
Fixes #2529
Fixes #2530
Fixes #2532

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 01:58:50 +07:00
Sam Sung 9e4d240811 Cursor pickups gate on control; ammo slot, indestructible items, clicks (#2571)
Four cursor and button defects, each with a test that fails on main:

- RegisterForClicks stops at the first non-string (`0x78268f`).
- The pickup verbs (`0x4f9b87`, `0x4c7345`, `0x4f9fdb`) and every cursor setter gate on player control as the reference does (the item setter also allows a taxi flight). While feared, a player can no longer drag, split or buy into bags.
- Both destroy paths read the item record's flags at the call. Bit 0x20 refuses with ERR_ITEM_CANT_BE_DESTROYED, and an uncached record raises no popup (`0x495370`, `0x4953ac`).
- The ammo slot takes a drop. Projectiles load by entry, other items auto-equip, and an empty hand lifts the loaded ammo and sends SET_AMMO 0 (`0x4c73a6`–`0x4c7646`).

Also, the merchant toggle-off matches a held preview by entry (`0x4fb811`), and previews play the item display's grab and put-down sounds (`0x495154`, `0x49526a`).

Fixes #2468
Fixes #2469
Fixes #2470
Fixes #2471

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 23:39:06 +07:00
Sam Sung 15dd7b524c Item requirements, lock openers and sets read live as of their packet (#2496)
The item requirement state, lock openers and set blocks were read from frame-final copies pushed by feeds, so a listener saw the frame's last level, skills and bags, not its own packet's.

Now the requirement checks (`0x5eaae0`, `0x5ea930`), the known-spell test (`0x60c740`), the lock openers (`0x5da5e0`) and the set blocks (`0x52d8a0`) read the player and bags live, as of each packet. With no player held, the getters answer the reference's fixed values: GetQuestGreenRange 0 (`0x4e17f8`), GetComboPoints 0 (`0x51a261`), and the item tooltip hidden (`0x52b699`). The tooltip build asks for its creator, charter and set-member names inside the build (`0x52e204`, `0x52b93b`, `0x52df4b`). The merchant's buyback and repair reads are as of the packet too.

Four feeds are gone, including feed_player_req. Tests in `lanes/requirement_live_tests.rs` fail on main. READS_FRAME_FINAL 60 → 56.

Part of #2217

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 22:04:49 +07:00
Sam Sung fe4b12bc2d The merchant and flight map read live; their events fire at packets (#2461)
The merchant and the flight map answered from VM copies pushed at frame end, and their events fired from frame-end feeds. In 1.12.1 the merchant getters read the vendor's rows at the call (`0x4fb130`, `0x4fb580`), and a close leaves no rows (`0x4fae22`). The flight map's slots are built inside `SMSG_SHOWTAXINODES` (`0x4dc380`), with each fare read at the call.

Now both read live through the call host. `MERCHANT_SHOW`, `MERCHANT_UPDATE`, the buy and sell lines, `TAXIMAP_OPENED` with its tutorial, and the taxi replies fire on lanes at their handlers. A vendor row's item query names the vendor and a buy-back row's names 0 (`0x4faf05`, `0x4fb3f0`). A new flight path closes the gossip (`0x5e3e68`). Buy-back names carry their suffix (`0x5d8bc0`).

Tests: live rows, fares and repair costs; each event's place; byte-exact query goldens. All fail on main.

Part of #2217

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 14:58:32 +07:00
Sam Sung b584e833eb Cooldown and cast events fire at each packet's place, as 1.12.1's do (#2414)
In 1.12.1 the cooldown and cast handlers write state, then fire their events, at each packet's own place. `SPELL_COOLDOWN` (`0x6e9460`) adds its records and then fires the cooldown pair. The cast result's pop (`0x6e741a` → `0x6e4940`) runs before `SPELLCAST_STOP`. The getters (`0x6e2ea0`, `0x6e2ed0`) read the live list. benilla raised cooldown events once a frame, from counter edges, and its cast getters read a frame-end view.

Now the player's cooldown list logs each write and signal per packet, and a lane replays them in order, with the call host lent. The four cooldown getters read the list live. Cast views are logged per packet, and a listener's own cast stays visible through later packets' views.

The tests cover two cooldown packets in one frame, cast start and stop in one frame, an early-stopped drain, a worn item's cooldown and a failed cast. Each fails without the change.

Part of #2217

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 20:50:15 +07:00
Sam Sung 9619157d47 Unit tokens resolve against the live objects, as 1.12.1's do (#2401)
Unit tokens resolved through a target map pushed per frame. So a listener of an earlier packet resolved `targettarget` as the frame ended. A pet's events fired under the frame's final pet tokens. A held unit that no token covered answered "Unknown Being".

1.12.1 resolves a token inside the call (`0x515970`): player, pet (our charm, else summon), every `target` hop from the held unit's `UNIT_FIELD_TARGET` (`0x515a1c`), and party and raid pets from the member's descriptor. `SignalUnitEvent` lists the tokens when it signals (`0x515e50`, `0x515c50`). `UnitName` names any held unit (`0x609210`).

These now read live through the call host, through one derivation shared with the snapshot. The target, mouseover, npc and roster globals stay client state. The event fan-out uses the same derivation.

Tests: 29 token forms agree live against snapshot, plus the three cases that fail on main.

Part of #2217

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 17:27:39 +07:00
Sam Sung bc8413b400 Item getters read the live item and name cache, as 1.12.1's do (#2375)
Item getters answered from a copy the VM took at the frame's start. So a script reading an item right after a packet changed it saw the old count, link or durability, and an auction name the cache already held answered nil.

1.12.1 reads the item object in the call (`0x4c055d`, `0x4ae68e`), and the auction getter asks the name cache, waiting only on a miss.

The bag, bank, inspect, trade, mail, auction and `GetItemInfo` getters now read the live item and the name cache through the call host. The copy remains only as the fallback. Auction name waits outlive a `/reload` and signal the new VM, since no reload cancels them.

Tests: an agreement test over every bag, the bank, inspect, trade and mail, including a rolled and enchanted item; live counts; a cached name; a wait across a new VM.

Part of #2202
Fixes #2364

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 06:30:31 +07:00
Sam Sung 39f6ba866d Getters ask for missing records inside their call, as 1.12.1's do (#2366)
The Lua getters' record asks go out inside their call, on a miss, as 1.12.1's do. The query reaches the wire in call order, with the reference's owner guid.

- **The getters:** summon confirm, battlefield position, ammo texture and quality, item cooldown, `SetBagItem`/`SetInventoryItem`, trainer, quest item, craft, trade skill and the quest log lookups. Each uses its own callback and dedupe (`0x48b6e1`, `0x4ac118`, `0x4c83bc`, `0x6e2efb`, `0x4d907e`, `0x5017ce`, `0x4f75dd`, `0x4fdb90`, `0x4e05d1`).
- **The owner guid:** the player for ammo, the active player for cooldown, `0xb0000000:spell` (the taught spell for trainers) for craft, trainer and trade skill, the partner for trade, 0 for the quest log.
- **Window show** asks nothing; only the getters do (`0x4f60c0`, `0x4d7d40`).

Byte-exact goldens pin the query bodies, and each getter has an in-call order test.

Part of #2202

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 02:33:57 +07:00
Sam Sung 5050ba7eb2 Attack, selection and death signal in place, as in 1.12.1 (#2299)
In 1.12.1, attack, selection and death run their steps and signal their events in place. benilla queued several of them for later in the frame.

- The right-click select, StartAttack's own select (`0x5eccaa`) and the engine's selection writers now signal in place. A teardown reports its StopAttack before `PET_BAR_UPDATE` (`0x493a08`).
- StartAttack sets the attack target locally at its send (`0x5ecd51` → `0x47bf70`). A seated player stands before the swing (`0x5ecc9b`).
- A right-click that falls out of the attack arm greets (`0x60c257` → `0x60c270`).
- Your own death runs `0x5e99b0`'s steps in order, inside its update packet, then signals `PLAYER_DEAD` (`0x6058ae`).
- Every Lua verb's refusal shows inside its call.

Tests go through the packets and the calls, and fail on main.

Part of #2271
Fixes #2287
Fixes #2268
Fixes #2114
Fixes #2009
Fixes #2207
Fixes #2289

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 23:55:39 +07:00
Sam Sung 38cdd6401e Cursor, equip, bank and vendor verbs gate and wait as 1.12.1 does (#2298)
The cursor, equip, container and vendor verbs gated, waited and sent differently from 1.12.1.

- A swap that asks the bind-on-equip question keeps the item held, and asks inside the call (`0x5e0c40`). An uncached record parks the equip and replays it when the record arrives (`0x5e0dbe`, `0x5e17a0`, `0x5e1020`). `USE_BIND_CONFIRM` fires inside the use (`0x5d9222`).
- A split stack is equipped or swapped whole, since `0x5e1480` and `0x4c7300` never read the split count.
- An enchant on an uncached item gates on zeroed fields (`0x495d60`).
- Bank slots read empty to the container and inventory verbs while no banker is open (`0x6228a0`).
- A vendor row dropped on a bank bag buys into it (`0x4f9f32`), and `CMSG_BUY_ITEM` ends with 1 (`0x4fb933`).

Tests go through the verbs and fail on main. The vendor golden is byte-exact.

Fixes #2249
Fixes #2251
Fixes #2250
Fixes #2246
Fixes #2248
Fixes #2247
Fixes #2227

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 23:25:40 +07:00
Sam Sung ebe0b272d0 UI textures load and widget methods check receivers as 1.12.1 does (#2283)
UI texture loading and widget method calls now follow 1.12.1.

- A UI texture's decoder is chosen by its extension (`0x449e16`), not by the file's content. A refused BLP draws green (`0x44a50e`). A TGA side below 8 fails (`0x58ab40`). A refused TGA minimap mask draws white.
- Portraits, `SetCursor` and drag icons open only `.blp` (`0x525e0f`, `0x449610`), and so do the tabard emblem cells (`0x50338a`).
- `SetPortraitToTexture` takes a Texture object and ignores a bad path (`0x48d780`).
- Every widget method checks its receiver first: a table, then an object, then the class. A bad receiver raises the reference's own lines. The 8 of 481 methods that skip it at the bytes are exempt. Texture arguments to the portrait and taxi globals, `AddFontStrings`' FontStrings and `SetBuybackItem`'s slot are checked the same way.

A test asserts that every reference method is wrapped.

Fixes #1685
Fixes #2100
Fixes #2099
Fixes #2203
Fixes #2125

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 10:17:03 +07:00
Sam Sung 09c44a47a6 Item links, suffixes, makers and wrapped items follow 1.12.1 (#2274)
The item Lua API answers links, suffixes, makers and repair costs as 1.12.1 does.
- `GetInventoryItemLink`, `GetContainerItemLink` and `GetTradePlayerItemLink` answer nothing for an empty slot, and a white, nameless link for an uncached item (`0x4c8c56`, `0x52ae00`).
- Inspected crafted gear shows its maker line, read from the slot's creator (`0x5333cd`, `0x52e1d5`).
- `GetItemInfo` names an item with its link's random suffix through `ITEM_SUFFIX_TEMPLATE`, and keeps signed link numbers (`0x5d8b00`, `0x842d4c`); every item name uses that one format.
- A gift-wrapped item hides the roll of the item inside and costs nothing to repair (`0x5d8bc9`, `0x5da387`).

Tests pin each address. Built on macOS.

Fixes #2174
Fixes #2175
Fixes #1543
Fixes #282
Fixes #1160

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 06:55:02 +07:00
Sam Sung 533d3ce5a1 Bag, cursor and doll verbs follow 1.12.1 and send inside their call (#2253)
The bag, cursor and paper-doll verbs follow 1.12.1 and send inside their call (Part of #2202).
- `EquipCursorItem` acts only on a held item (`0x489660`).
- The enchant pick exits silently on a miss and tests the charter flag first (`0x495d60`, `0x495e05`, `0x5da2e3`).
- `PutItemInBag` and `PutItemInBackpack` follow the bag worker: a vendor row buys into the bag, and a backpack item dropped on the backpack cancels (`0x4c7c00`).
- A world click drops a held vendor row or bar item on every leg (`0x492c90`).
- Bank bags are no bags to the container verbs until the bank opens (`0x4f93e0`).
- A bag item with template page text reads as readable (`0x5d9e10`).

A vendor row the list no longer holds, and the backpack's 0x71 bound (`0x4f990f`), are recorded Deviations. Tests pin each address. Built on macOS.

Fixes #2155
Fixes #2154
Fixes #2153
Fixes #152
Fixes #151
Fixes #149
Fixes #146

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 21:19:38 +07:00
Sam Sung b493903e54 Trainer, taxi and merchant windows act as 1.12.1's do (#2233)
The trainer, flight-master and merchant windows now follow 1.12.1, and their verbs act inside their call (Part of #2202).
- **`IsTalentTrainer`** answers 1 with no trainer open (`0x4d8ed0`).
- **The trade-skill and learn-spell queries** read each service spell's effects (`0x4d9f70`).
- **`GetTrainerServiceAbilityReq`** counts a known higher rank as met (`0x4d96e0`).
- **Trainer rows** sort as the client's one persistent list, with a case-sensitive compare. The order is pinned against the client's own sort, run in benilla-re's emulator.
- **`CloseTaxiMap` and `TakeTaxiNode`** act in the call. A map with fewer than two known nodes shows `ERR_TAXINOPATHS` and opens nothing (`0x5ecf39`).
- **Buying an item a quest needs** shows its progress line (`0x5dced0`).
- **The merchant's sale and drop verbs** send as `0x4fb760` does.

Tests pin each address. Built on macOS.

Fixes #1272
Fixes #213
Fixes #212
Fixes #166
Fixes #2148
Fixes #2147
Fixes #1804

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:22:46 +07:00
Sam Sung aa25486d78 Loot verbs, packets and auto-loot act where 1.12.1 acts (#2209)
Loot went wrong:
- Takes, closes and master gives queued, then ran in a fixed order.
- The last row closed a frame late.
- Auto-loot opened before it swept, read Shift when the loot arrived, and looted over an open window.
- `GetNumLootItems` counted taken rows, and a response for an object the client lacked opened a window.

The reference:
- `LootSlot` is the confirm form (`0x4c2e70`). A row click takes after its `<OnClick>` (`0x4c1867`). `CloseLoot` zeroes only the source (`0x4c1da0`).
- `SMSG_LOOT_REMOVED` closes an empty window in the packet (`0x4c1f8d`).
- The sweep runs before `LOOT_OPENED` (`0x4c1ed3`, `0x4c2240`). Each interaction stores the byte (`0x5df460`), and `CanLootNow` refuses an open session (`0x5ec1e1`).
- A missing object shows `ERR_LOOT_DIDNT_KILL` (`0x5ebb3f`).

Each fact is tested against its address, with the stock `LootFrame` for the replacing window.

Part of #2202

Fixes #2167
Fixes #2181
Fixes #2180
Fixes #2190
Fixes #1228
Fixes #784
Fixes #2189
Fixes #72

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 00:10:48 +07:00
Sam Sung 591358af1b Auction lists sort, count down and refuse sells as 1.12.1's do (#2193)
Auction lists went wrong:
- They kept the server's order until a header click, and re-sorted every frame.
- Time Left, High Bidder, Lvl and Seller sorted on the wrong keys, and names matched case.
- Time left froze at arrival, and expired rows stayed.
- The sell slot took items 1.12.1 refuses.

The reference:
- World entry seeds eight-key sort stacks (`0x4cc236`). A page sorts once, when its last item record lands (`0x4cc9e8`).
- The comparator `0x4cd940` and the CRT `qsort` (`0x73f727`) order the rows, ties included.
- Time left counts down from the deadline, and rows 10 s past it leave the lists (`0x4cdfe0`).
- The sell slot refuses in `0x4ce362`'s order.

benilla now has one CRT `qsort`, which the frame batches, macros, guild roster and addon list share. Each fact is tested against its address.

Fixes #260
Fixes #428
Fixes #253
Fixes #254
Fixes #255
Fixes #256
Fixes #1539
Fixes #258
Fixes #1524
Fixes #2191

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 19:18:37 +07:00
Sam Sung 86ef431dec Verbs apply inside their call, and packet events fire in wire order (#2184)
A verb called from Lua, or a packet's event, applied a frame later, after the call or handler had returned. 1.12.1 applies each verb inside its call and fires each event at its packet.

What changed:
- Verbs apply inside the call: targeting, item picks, refused casts' log lines.
- A packet's chat items and field notices fire in wire order.
- Combat, unghost and death-tutorial events fire at their packets.
- Signals raised while something waits are replayed with the lock and cursor state they had.
- Loot picks and bind confirms are one call-ordered queue. `LOOT_BIND_CONFIRM` fires before its slot is stored (`0x4c290f`, `0x4c2917`).
- A forked script no longer panics on a lend, and two comments now match the reference.

Each order is tested against its address.

Fixes #1993
Fixes #2045
Fixes #2051
Fixes #1419
Fixes #2016
Fixes #1987
Fixes #1237
Fixes #2139
Fixes #797
Fixes #2094

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 16:20:34 +07:00
Sam Sung 47db337f09 Spell cooldowns insert and fire at 1.12.1's sites (#2166)
Cooldown events fired on each record insert. 1.12.1 fires them at its flush sites (`0x4b31b0`). Several inserts also took values the reference doesn't.

- The insert (`0x6e12c0`) and StartCooldown (`0x6e2c60`) now fire nothing. Each packet and cast site flushes once.
- `SMSG_SPELL_COOLDOWN` timers go through op 11, the ranged pad and op 21 (`0x6e9460`).
- An item's game-object cooldown uses its block's category, else the spell's. It waits for the item record and inserts nothing for entry 0 (`0x6e8425`).
- Initial-spells cooldowns are held and back-dated through StartCooldown.
- A NOT_READY with argument 0, and every failed cast, clear the spell's records and flush.
- Bag, worn and tooltip queries ask for a missing item record. Its landing flushes (`0x6e2f70`).

Tests pin each flush site and insert value.

Fixes #2060
Fixes #679
Fixes #2061
Fixes #2063
Fixes #2064
Fixes #2066
Fixes #2076
Fixes #2077

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 10:42:40 +07:00
Sam Sung fcb42ab40a Script calls apply inside their verb, in one ordered VM pass (#2143)
In 1.12.1 a verb's effect applies inside the call, whether from a click, `OnUpdate` or an event handler. Here, calls from `OnUpdate` and handlers queued until the next lend, so `TargetByName(name)` then `UnitName("target")` read the old target.

- Every system that runs Lua lends the call host around its body, in one ordered VM pass; the cross-entry queue is gone.
- Seams that changed units through `Commands` queue unit edits, flushed ahead of their readers, so sync points stay at 54 (main: 53).
- Late drains apply before the paint; a CVar or follow ask lands the same frame.
- The actionable ambiguity ceiling falls from 3079 to 1750.

Tests: an `OnUpdate` cast and a handler's cast arm inside the call, three same-frame drains, and a census that each schedule flushes after every edit user.

Lua run inside an engine turn still waits for the turn's end.

Part of #1993

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 03:43:48 +07:00
Sam Sung 275feba882 Macros sort, hold ids and bind pet spells as 1.12.1's do (#2126)
Macros were held by index and kept in creation order:

- A sort or delete moved what a bar slot held.
- `EditMacro` trimmed and capped differently and returned nothing.
- `CastSpellByName` took the wrong quoted span.
- A macro casting a pet spell never bound the pet's book.

Reference: each scope sorts by the CRT `qsort` with `_strnicmp` (`0x73f727`, `0x4f0e10`). Slots hold the macro id, with bit 24 set for a character macro, and `DeleteMacro` clears every slot holding it (`0x4e5d10`). `EditMacro` returns the index after the re-sort. The quoted name ends at the next quote (`0x4efef0`). Names bind the player's book, then the pet's (`0x4b3bc0`).

Changed: the table, the slots, the cursor and the saved files follow these, and tests pin each. Bar slots an earlier build saved for character macros are rewritten once to the new ids.

Fixes #1502
Fixes #1505
Fixes #1187
Fixes #196
Fixes #197

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 00:23:45 +07:00
Sam Sung 9950c469a8 Item tooltips draw 1.12.1's lines for every source (#2050)
The item tooltip setters (bag, inventory, link, merchant, trade, mail, bank, petition) draw the lines 1.12.1's builder draws:
- spell lines for every trigger, and "Already known" by the taught spell;
- PvP rank and medal, zone and map, the gendered reputation label;
- a recipe's product and reagents, and a charter's signatures;
- a link's enchant, and a trade item's proposed enchant;
- the creator, and a second click on the same link hiding the tooltip;
- the merchant price and repair cost.

Charges and durability come from the object, the block or the template, as `0x52d9bd` and `0x52cca8` choose, so a link, a loot row or a merchant item shows no durability line. Tests pin each line and its gate.

Fixes #153
Fixes #154
Fixes #283
Fixes #1183
Fixes #1497
Fixes #1498
Fixes #1501
Fixes #1551
Fixes #1552
Fixes #1564
Fixes #1565
Fixes #1569
Fixes #1571
Fixes #1572
Fixes #1838

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 13:58:25 +07:00
Sam Sung c0e301eaec A Lua cast arms inside its call, through a host lent to the VM (#1992)
A Lua cast was queued for a later frame, so on the next line of the same script `SpellIsTargeting()` read the old state and `SpellTargetUnit` found nothing to bind, as FuBar_CorkFu and SmartRes do.

In 1.12.1 `CastSpellByName` reaches `ArmCastTargets 0x6e5250` through direct calls (`0x4b4ab0` → `0x4b3300` → `0x6e5a90` → `0x6e4b60`), and `SpellIsTargeting` (`0x6e6cd0`) reads the word the arm stores.

The input pass and key bindings now lend the engine's call host to the VM around each script. The 20 verbs that queued apply inside the call, each under its own input events, and `CURRENT_SPELL_CAST_CHANGED` fires there. Calls an unhosted entry leaves apply at the next lend's start. The one unsafe lend is in `script/host.rs`.

Tests: CorkFu's and SmartRes's lines arm and bind in the call; a refused cast does not arm; every routed verb runs with a host lent.

Fixes #447

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 01:52:31 +07:00
andi79h-claude 9969b8459b A moved bar item takes its green border along and leaves none behind (#1977)
The reference answers IsEquippedAction for the slot's action at call
time (0x4e74e0, the worn-slot walker 0x622270), so the in-place
ACTIONBAR_SLOT_CHANGED of a pickup reads nil for the emptied slot and a
place reads the moved item's own answer. The VM answers from the app's
per-slot states instead, which the cursor verbs left where they were:
the pickup's handler read the lifted item's equipped flag off the empty
slot and drew the green border there, and the app's re-feed fires no
event ActionButton_Update answers, so it stayed. A spell placed over a
worn item read the item's border the same way.

The pickup now drops the slot's state with the action; a lifted bar
item carries its state on the cursor (CursorAction.state, beside count
and consumable) and the place writes it with the slot; any other placed
action waits for the re-feed instead of reading the displaced occupant's.

Verified: cargo fmt --check, clippy -D warnings for benilla-ui and
benilla-app, cargo test -p benilla-ui --tests (2669 lib tests, the new
an_equipped_items_green_border_moves_with_it among them),
cargo test -p benilla-app --lib (5088). Built on macOS only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 14:56:50 +07:00
Sam Sung 88eaf16799 GetContainerNumSlots and GetBagName answer on 1.12.1's bag ranges (#1968)
Both verbs answered whatever the container snapshot held, so the keyring, the bank and the backpack answered as ordinary bags.

1.12.1: `GetContainerNumSlots` (`0x4f9560`) answers 16 for the backpack, 24 for the bank, the bag's size for 1-10 and 0 for anything else, the keyring included (`0x4f95fb`). `GetBagName` (`0x4fa670`) answers `BACKPACK_TOOLTIP` for the backpack (`0x4fa6f0`), the bag item's name for 1-10, and nil for the bank, the keyring and the rest (`0x4fa712`).

Now both apply those ranges, the backpack is named by its global, and the snapshot no longer carries English names for the backpack, bank and keyring. A test pins every range. The keyring stays readable through `GetKeyRingSize` and the item verbs.

Found in Thorsten42/manila@a9fffcb5df.

Fixes #1967
Fixes #372

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Thorsten42 <3400178+Thorsten42@users.noreply.github.com>
2026-10-19 10:10:28 +07:00
Sam Sung d9926c6be1 StatusBar bits, index usage lines, stack names and cursors follow 1.12.1 (#1959)
Ten differences from 1.12.1 in the UI core.

- StatusBar range and value follow `0x783270`/`0x7832d0` (a reversed pair collapses, a value before a range is dropped); the health watchers set both each update; the fill draws once both are set, its coordinates built from scratch (`0x7833c0`).
- A full collection runs before PLAYER_LOGIN (`0x490941`); the addon harness runs the client's world-entry cascade.
- Every index argument raises its own usage line (`0x6f34d0`, then the binding's literal).
- Strata, layer and frame-type names match whole (`0x6ee32c`); stack lines name unnamed functions by global (`0x6fbf90`).
- SetCursor takes a custom file (`0x523c40`); EditBox accepts OnInputLanguageChanged (`0x77a40d`).
- debugprofilestop answers milliseconds (a Deviation: multi-core 1.12.1 returns cycles).

A byte audit re-derived every address.

Fixes #1178
Fixes #1915
Fixes #1917
Fixes #1908
Fixes #1839
Fixes #1869
Fixes #1170
Fixes #1105
Fixes #1186
Fixes #1952

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 02:48:36 +07:00
Sam Sung 57384551de Widget methods, chat-frame state and line fades follow 1.12.1 (#1949)
Widget methods 1.12.1 has were missing or differed.

- EditBox IsAutoFocus, IsMultiLine, IsNumeric and IsPassword; ColorSelect GetColorHSV and SetColorHSV (`0x7bbc80`, `0x7bbd60`).
- AddMessage with no colour takes the frame font's colour.
- ScrollingMessageFrame: the write slot and the four line-position methods; the cached lines-shown, at-top and at-bottom state its readers use (`0x788440`); a relayout on resize (`0x788310`); OnMessageScrollChanged (`0x788a9a`); SetTimeVisible and SetFadeDuration usage, unclamped; each line fading on its own countdowns (`0x7884c1`).
- GetFramerate averages the last 30 frames (`0x672700`).
- SetCursor takes the eight named cursors in any case, with its usage line; custom cursor files are still to do.
- SimpleHTML links get buttons, so OnHyperlinkClick fires.

A byte audit re-derived every address.

Fixes #1518
Fixes #1520
Fixes #1506
Fixes #1519
Fixes #1883
Fixes #1682
Fixes #1538
Refs #1186

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 23:43:30 +07:00
Sam Sung 91803130c6 Item tooltips rebuild in place when a cache they asked answers (#1515)
A shown item tooltip whose line waited on a cache kept missing that line until something re-ran `OnEnter`. Examples are a lock's key, a "made by" name and a set member. Bags re-run it every frame; trade slots, `ItemRefTooltip` and addon tooltips never do.

1.12.1 registers `CGTooltip::OnCacheAnswer` (`0x52e530`) on every record, name, petition and item-name miss, with the tooltip as cookie. On each answer it rebuilds from the inputs the last build kept (`0x52b6cc`–`0x52b70a`), reading the live object, and sizes the plate (`0x52e5ac`). A clear zeroes the kept entry (`0x5300dd`), so a cleared tooltip stays down.

Every item `Set*` now goes through one build that keeps its inputs and records its misses. Each answer rebuilds whatever the tooltip keeps by then; compare asks stack and builder asks deduplicate, as in the reference.

Tests cover each cache and a cleared tooltip.

Fixes #1452

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 21:21:02 +07:00
Sam Sung bc52e8a7f4 Item tooltips show the lock's key or skill line and a gift's giver (#1454)
Item tooltips lacked the lock's sub-line and a wrapped gift's giver.

The reference: the lock check (`0x52bd57`) takes the Lock row's slots in place. The first slot picks the arm: a key names its item in white (`0x52bf30`), and a skill names the LockType and the required value, coloured by the walk at `0x5da5e0`. A blank LockType name prints blank; only a missing row reads `UNKNOWN` (`0x52bede`). A wrapped item (flag `0x8`) prints `ITEM_WRAPPED_BY` with `GIFTCREATOR`, from the object or, for the trade partner's slots, from the block (`0x534559`, `0x534574`). Real lockboxes use locks whose first slot is empty, so they show no sub-line, as in 1.12.

The rows keep all eight slots, and both trade sides carry the wrapped word and the giver. Tests cover each arm, a blank name, and gifts in bags and trade.

Fixes #1440
Fixes #1441

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 14:26:56 +07:00
Sam Sung ff3dbc9416 Worn items answer their cooldown; a spent charged item drops it (#1447)
`GetInventoryItemCooldown` answered `(0, 0, 1)` for every slot, so worn trinkets had no cooldown spiral. A charged item at 0 charges kept its cooldown.

In 1.12.1, `0x4c8a60` answers the item cooldown query (`0x6e2ed0`) for the active player's slot. It needs a use spell in the template's first block (`0x4c8b47`) and a charge left on a charged template (`0x4c8b55`). Anything else answers `(0, 0, 0)`. `SetBagItem` and `SetInventoryItem` take the plain leg for a spent charged item (`0x5347e3`, `0x53318a`), as does `GetContainerItemCooldown` (`0x4f9a48`).

Now the verb answers from the worn slot's cooldown under those gates. The slot feeds read `ITEM_FIELD_SPELL_CHARGES[0]`, and a held item with no use spell answers enable 0, as the query leaves it.

Tests: the verb's gates and errors, the spent-charge rule over five cases, and the container triple.

Fixes #1439
Fixes #1442

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 13:20:24 +07:00
Sam Sung 8a545a6682 Tooltips colour Locked by the lock check and show Cooldown remaining (#1444)
An item tooltip's Locked line was always red, and no tooltip drew "Cooldown remaining".

- In 1.12.1, the lock check `0x5da5e0` colours Locked (`0x52bdde`): red when nothing opens it, the skill ramp `0x529fa0` for a known open-lock spell, green for a held key or an empty lock. benilla now feeds Lock.dbc and the player's openers and runs the same check.
- The spell builder draws the line when its recovery is at least a minute (`0x52f537`). The item builder draws it with no floor (`0x52e0fd`) for `SetBagItem`, `SetInventoryItem` and the `SetAction` item leg, which are the three setters that pass a cooldown. Worn items now carry theirs, and the line counts down while hovered.

Tests: each colour and ramp edge, the unit and rounding, the spell floor, and the line order.

Fixes #1024
Fixes #1017

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 12:40:37 +07:00
Sam Sung 99458b32a8 Protected calls pass tainted code only inside an input event (#1388)
The protected-action gate (`0x494a50`) now runs its input arms. Tags 2, 4 and 10 pass tainted code only under an input flag:
- the edit box's Enter (`[0xcf4dc4]`);
- a button's click or double-click (`[0xcf4da0]`);
- a running binding.
Without one they refuse silently. This covers casts through `TryCastSpell`, the pet actions, `SpellStop*`, `SpellTargetUnit`, item targeting, `TargetNearest*` and `AttackTarget`, and `ReloadUI`.

Branches the reference runs before the gate still run when the cast is refused: aura and form cancels, and the bind-on-use and soulstone legs. Queued calls replay the input events they ran under, around their own events too. So a TAB-driven `PLAYER_TARGET_CHANGED` handler casts as in 1.12.1.

`SetEuropeanNumbers` now also swaps separators in tooltip lines, both message frame classes (at show for scrolling ones), SimpleHTML, chat bubbles and nameplates.

Tests: a 30-verb census, and the stock buttons, bindings, `/cast`, spellbook and macros.

Fixes #1354
Fixes #1355

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 03:25:42 +07:00
Sam Sung 7b608671a6 Item objects notify the action bar and trade as 1.12.1's handlers do (#1366)
Nothing listened to the player's item objects after they changed. Action and trade slots diffed snapshots, so an addon missed restacks, enchants and destroys.

- **The seam.** `item_watch` emits one notice per reference handler run, in wire order. The handlers are destroy `0x5d8660`, stack `0x5d9400`, charges, entry, enchant `0x5d9a90`, record `0x5d8440`, seats `0x4f8db0`/`0x4f90d0`/`0x4f8ec0` and visible items `0x5dee30`.
- **Action bar.** Each notice recounts every item slot holding the entry and fires `ACTIONBAR_SLOT_CHANGED`, with no change test (`0x4e5c70`, 16 callers). Arrival recounts quietly, then fires slot 0 (`0x5dea50`). The per-frame poll is gone.
- **Trade.** Our slot re-sends or clears its item and fires `TRADE_PLAYER_ITEM_CHANGED` (`0x4bfb10`, `0x4bfb60`). Slot 7's enchant spell signals its side and names the enchantment (`0x4bf2b0`). `ClickTradeButton` refuses bound, quest and bag items (`0x4bfeb5`).

Tests cover every watcher, consumer order and refusal.

Fixes #1064
Fixes #1062
Fixes #1063
Fixes #1041

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 01:54:27 +07:00
Sam Sung 14ae72269d Cooldown reads, GCD after an event, lost control as 1.12.1 has them (#1348)
Cooldown reads, the GCD after an event, and lost control, as 1.12.1 has them:

- A cooldown held until an event (Stealth, Shadowform) reads start now, duration 1 ms, enable 0 (`0x6e1503`, `0x6e1517`). Enable stays 0 once a held leg sets it, and the Lua getters answer the call's own time for a held start.
- An item's own category overrides its spell's (`0x6e1457`).
- `SMSG_COOLDOWN_EVENT` restarts the GCD from the event, which shares the recovery start (`0x6e15d8`, `0x6e185a`).
- While control is lost, spells, macros, spell-less items and forms grey unless the spell's immunity scan exempts it (`0x6e3dc3`–`0x6e3e4c`).
- Every self create gives control back (`0x5dea50` → `0x5fa600(1)`), firing `PLAYER_CONTROL_GAINED` when it was lost.

Each change has a test that fails without it.

Fixes #1296
Fixes #1297
Fixes #1298
Fixes #754

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 21:47:41 +07:00
Sam Sung c49c201176 CVars refuse what 1.12.1's callbacks refuse; Lua arguments and numerals (#1286)
CVars and Lua arguments, each against the client's code:

- A CVar row carries the reference's refusing callback, run before the value is stored (`CVar::Set`, 0x63df7d): the video rows, six camera rows, `farclip` (NaN passes, as 0x688d40's unordered compare lets it), `frillDensity`, `gxTripleBuffer` (0 or 1, 0x63afe0) and `gxRefresh` (the 11 rates at 0x8645e0).
- `RegisterCVar` creates at most 30 CVars per process (0x488b25); `GetCVar` and `GetCVarDefault` raise their usage lines.
- `Minimap:SetMaskTexture`, `CloseLoot(1)` (ERR_LOOT_NO_UI, 0x48f27b) and the onSelf of `UseContainerItem`/`UseInventoryItem` follow the client.
- Lua's numeral reader has no hex and takes `d` as an exponent, as the client's strtod (0x4112d1).

Each has a test that fails without it.

Fixes #558
Fixes #559
Fixes #567
Fixes #696
Fixes #988
Fixes #989
Fixes #1025
Fixes #302
Fixes #366
Fixes #1275

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 15:20:23 +07:00
Sam Sung 994f9f9610 reference/ vendors benilla-re's tables at a pinned commit (#1282)
`reference/` held benilla's own copies of the reference's tables, some derived by its own scripts from older inputs: the fire-site table kept one event id where a site fires two, and credited glue-screen sites to in-game events.

Now `reference/` is benilla-re's tables at the commit `reference/PIN` names, byte for byte: bindings, events, glue events, messages, event arguments, verb events, the glue surface, the Lua globals, chat types and groups, and CVars. `scripts/sync-reference.py` copies them, and its `--check` runs in the gates and in CI. Four generators and nine old files go, and every reader moves to the new columns.

New tests hold the chat type, chat group and CVar tables to the copies; the CVar rows already filed are listed as known.

Fixes #245
Fixes #960
Part of #244

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 11:09:45 +07:00
Sam Sung a96977e759 Gradients tint per vertex; a layer's textures sort by handle (#1101)
On the stock credits screen the fades drew as solid black boxes over the text, and the black bars covered the borders.

A texture's gradient now tints its four vertices over the texel (0x77f910, TL BL TR BR). A gradient alone draws nothing, and any vertex-colour write collapses it (0x77f750).

A layer batch sorts its quads by texture handle at End (0x7731a0), with an exact port of the client's qsort. Its tie order was checked against the client's own code. The client's handles are heap addresses, so different textures rank by a creation stamp that follows allocation order. That is a narrowed Deviation.

Extract costs what it did before. The options window's ground dim moves to BORDER to keep its look.

Tests cover the gradient, the sort and the stock credits frame.

Fixes #874
Fixes #1095
Fixes #1092

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 10:30:07 +07:00
Sam Sung a7f331efdf Item use follows the client: bag store, bar equip, BoE hold, control (#1086)
Five item-use paths differed from 1.12.1's bytes:
- PutItemInBag swapped a worn item instead of storing it (0x4c7d44), and sent a bag into itself (0x4c7cea).
- UseSoulstone skipped the cast cancel before its use (0x48ae6b → 0x6e4940).
- The bar's equip left a held item on the cursor; it now runs 0x5e1840 → SetCursorItem.
- The bind-on-equip confirm emptied the cursor; the item now stays held under the question (0x5e16ce).
- Item use ignored loss of control. The dispatcher's requirement and control gates (0x5d8e0e, 0x5d8eaa), the equip and SetCursorItem gates, the fear/charm exemption (0x6e9d70) and the trade-window refusal (0x1b4) now apply. They read our own character's control only (0x5fa600).

Tests cover each path and gate.

Fixes #1057
Fixes #1075
Fixes #1078
Fixes #1076
Fixes #1077

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 05:30:39 +07:00
Sam Sung d3ac9f75bf Verbs raise their events in place; feeds push only server changes (#1085)
Verb events fired from app feeds a frame late; 1.12.1 signals inside the call.

Now each verb raises its events in place. Feeds push only what their own server source changed, so a verb's write is never rolled back.

Also, from the bytes:
- The score board waits on pending names (0x4aa216).
- The recruitment cascade runs inside its verb.
- Seven mail verbs share the request lock 0xb6efc8; the mailbox keeps its inbox across a close.
- StartAuction runs its gates, sends the attached guid and empties the slot in the call.
- The tradeskill repeat counts, disarms and resets as 0x4fd7b0 and 0x4fc750 do.
- Quest folds carry across a /reload.

Tests cover each event's timing and the feed rule.

Fixes #1008
Fixes #1009
Fixes #1010
Fixes #1045
Fixes #1046
Fixes #1047
Fixes #1050
Fixes #1051
Fixes #1059

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 03:54:00 +07:00
Sam Sung 0b4b3ddc2c Item locks held per item at the client's own lock and unlock sites (#1074)
Item locks came from pending-op bookkeeping, so unlocks reached the wrong items or none.

Now a lock is a bit per item guid, set by LockItem (0x4953e0) and lifted by UnlockItem (0x495420) at the client's own sites:
- pickups, places, swaps, the delete and the wrap;
- UseContainerItem's arms, taken in the call in 0x4fa0e0's order (bank, deposit, sell, equip, open);
- the watchers: a seat's guid changing, an arrival, a restack;
- the inventory and sell refusals, loot closes, the bind-confirm cancel, the revive.
Readers refuse a locked item where the client does (0x4f9e76, 0x5d8d32, 0x4fa1cd, 0x4fa4bf). Ammo equips by class and unlocks.

A /reload carries the locks and the cursor, minus what the sweep's loot, mail and auction legs unlock. A despawned item loses its lock.

Tests cover each site, reader, watcher and the reload.

Fixes #1033
Fixes #242
Fixes #228
Fixes #354
Fixes #227

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 03:02:43 +07:00
Sam Sung 79842423f2 Cursor verbs follow the client's arms: bar, bags, doll and trade (#1042)
The cursor verbs follow the client's arms, on top of the primitives from #1038:

- **Action bar.** PickupAction places only what the bar can take (`0x4e615d`) and picks up over anything else. Bar spells and macros lift with their own setters, so `CursorHasSpell` sees them. Dropping the slot's own action, or a spell its macro or item casts (`0x4e5a50`), only clears the cursor.
- **Bags and doll.** Clicks pick up over a held spell, macro or coins, and clear a held bar item (`0x4f9de9`, `0x4f9f41`). A misfit doll drop auto-equips (`0x4c78ef`).
- **Trade.** A slot click swaps the old item back (`0x4c0036`). An offered item stays locked until the server closes the trade, and the close fires the unlocks between its two signals.
- `SplitContainerItem` refuses a count outside the stack.

Fixes #1031
Fixes #1032
Fixes #1034
Fixes #1035
Fixes #1036
Fixes #1037
Fixes #156

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 22:24:24 +07:00
Sam Sung eb63c8861b Cursor runs on ClearCursor and the setters' own event tails (#1038)
The cursor now runs on the client's two primitives. `ClearCursor(a,b)` (`0x495190`) cancels an armed gift wrap, then runs the payload's arm (an item's unlock fires `ITEM_LOCK_CHANGED`; coins fire `PLAYER_MONEY`), then the grid hide and `CURSOR_UPDATE`. Each setter runs that clear first, then its own tail (`0x494b60`, `0x4950f0`, `0x494d20`, `0x494f80`, `0x494e20`, `0x495010`). Every pickup, place, split, sale, trade, mail and auction path goes through them. So a `CURSOR_UPDATE` handler reads the emptied cursor, and `PickupSpell`/`PickupMacro`/`PickupPetAction`/`SplitContainerItem` clear what is held instead of refusing.

An item attached to mail or an auction stays locked until it leaves the slot (`0x4adef0`). Attaching to an occupied slot puts the old item back on the cursor.

Event-order tests cover each setter, the coin clear, and the attach lock and swap.

Fixes #1011
Fixes #1012
Fixes #1006
Fixes #1007
Part of #156

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 20:47:20 +07:00
Sam Sung bb82dd1ac8 Lua getters answer the reference's miss shapes; tooltip setters' flag (#1030)
Lua bindings answer the reference's shapes on misses, bad indices and tooltips:

- Indexed getters push their full miss tuple (`GetCraftInfo`, `GetPetActionInfo`, the trainer requirements and others). Indices go through `ftol` and an unsigned compare, so a negative misses instead of raising. Verified slot readers keep their own raises (`IsInventoryItemLocked`, `0x4c8520`).
- The eight GameTooltip setters return the builder's refresh flag, gated as `0x53267c` gates it, so a hovered cooldown tooltip refreshes. `LOCKED` follows the item object (`0x52bdb3`).
- Quality goes through the InventoryType gate (-1), and a pending template shows the question-mark icon.
- `GetLootSlotInfo` returns four values. `SetSpell`, `CreateMacro`, `JoinChannelByName`, `GetQuestReward` and the shapeshift and trade-skill filters raise or answer as the reference does.
- The shape gate probes each getter's miss legs through an argument ladder.

Fixes #145
Fixes #993
Fixes #994
Fixes #995
Fixes #996
Fixes #997
Fixes #998
Fixes #1016

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 20:28:35 +07:00
Sam Sung aba120cdcb Lua verbs fire their events before returning, in the reference's order (#1015)
In 1.12.1 an event a Lua verb raises runs its handlers before the verb returns: `SignalEvent` (`0x703e50`) walks the listeners in place. About 35 benilla binding sites queued theirs for a later drain instead.

- Verbs now raise inside `tick::verb` steps, and the events fire as each step's model borrow drops. A step follows the reference's split wherever it signals before changing state a getter reads: the money pickup, bag pickup and place, merchant grab, repair cursor, item use, action and pet-bar pickup and drop.
- The grid events fire before `CURSOR_UPDATE`, and a clear's unlock before both, as at `0x4952b3`/`0x495455`. `ITEM_LOCK_CHANGED` carries no arguments.
- `pending_events` is host-only now.

Tests pin handler order per family, nesting from a handler, and the order changes.

Fixes #999
Fixes #582

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:14:10 +07:00
Sam Sung 720dcf8188 Lua bindings return 1/nil and the reference's value counts (#1000)
Lua bindings now return what 1.12.1 pushes, in type and count:

- Flags are 1 or nil, never a Lua boolean. This covers `SetInventoryItem`/`SetBagItem` hasCooldown, `GetQuestLogLeaderBoard` finished, `GetContainerItemInfo` locked/readable, `AtTop`/`AtBottom`, `IsOwned` and `SetAlphaGradient`.
- Eleven verbs whose handlers end `xor eax,eax` return nothing. That covers `PickupAction`, `PlaceAction`, `PickupSpell`, `PickupInventoryItem`, `EquipCursorItem`, `SplitContainerItem`, `PickupMacro`, `DeleteMacro`, `ResetChatColors` and others.
- The miss tuples: `GetInboxHeaderInfo` gives 13 values (`0x4aeff0`), `GetInboxText` four nils, and `GetQuestLogLeaderBoard` three.
- `GetTrainerServiceDescription` is nil with no text (`0x4d9d44`). `GetZonePVPInfo`'s faction is `""`, not nil (`0x48d633`).

The boolean gates now probe every global and widget method.

Fixes #442
Fixes #574
Fixes #577
Fixes #578
Fixes #822
Fixes #823
Fixes #872

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 15:01:32 +07:00