feat(vendor): Slice 6 buy arc — shop items are real objects, vendor selection is THE selection, and Buy works (0x005F)
Some checks are pending
Headless portability / portable-headless (ubuntu-latest) (push) Waiting to run
Headless portability / portable-headless (windows-latest) (push) Waiting to run
Headless portability / linux-graphical (push) Waiting to run
Headless portability / linux-vulkan (push) Waiting to run

Three ordered pieces in one landing (the shared controller/composition
files carry all three; the internal order was 6.1 -> 6.2 -> 6.3):

6.1 VendorShopItemMaterializer diff-merges the shop list into the live
ClientObjectTable on VendorState transitions (so client-local close and
session teardown retire the entries too) and never claims a guid it did
not add — ACE's UniqueItemsForSale can re-list a guid a player once
held (AP-163 files the collision-skip; no retail counterpart traced).
Right-click examine on shop items now routes through the ordinary
appraisal path — the 5.4 F7c blocker dissolves with the table entries.

6.2 SelectionChangeSource.Vendor: row clicks, auto-select, and examine
all flow through the canonical SelectionState; the status bar and the
existing byte-faithful StackSplitQuantityState slider light up
unmodified. VendorSplitPolicy is the single 0xDC41CB0 mask owner; the
slider VALUE seeds to 1 for exempt items while maxSplitSize keeps the
stack (the splitSize/maxSplitSize distinction, research §B.3).
Selection clears at retail's actual site — VendorItemsUI::RemoveFromShop
(pc:202848), not a CloseVendor-level clear that does not exist.

6.3 BuildBuy (0x005F): vendorGuid, count, (i32 amount, u32 guid) pairs,
and the trailing alternateCurrencyId the REAL client sends
(CM_Vendor::Event_Buy pc:689288) though ACE's reader ignores it.
TryBuy rides the EXISTING J5.2 one-request-at-a-time reservation and
completes on UseDone; the Buy button disables while a request is in
flight. The reconciliation round-trip (money property update, inventory
CreateObject, ApproachVendor refresh -> panel rebuild) is proven by a
synthetic-inbound test against existing machinery — no new owner.

Register: AP-161 narrowed (selection + examine residuals close;
staging/Sell remain; double-click-to-buy confirmed ABSENT from retail
with negative evidence cited — we match retail). AP-162 files the
conscious no-client-side-affordability-precheck deferral.

Clean-room complete solution: 11,368 passed / 4 skipped / 0 failed.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-07 20:28:26 +02:00
parent c884a938e0
commit 97cf873870
19 changed files with 1577 additions and 65 deletions

View file

@ -198,6 +198,56 @@ public sealed class RuntimeVendorLifecycleTests
Assert.Equal(0u, runtime.InventoryOwner.Vendor.VendorId);
}
[Fact]
public void ApproachVendorEvent_MaterializesShopItemsIntoTheOwnedObjectTable()
{
// Slice 6.1: unlike Wire()'s throwaway ClientObjectTable (used by
// the tests above, which only assert on VendorState itself), this
// wires the dispatcher against the SAME table
// RuntimeInventoryState.Objects exposes, so the
// VendorShopItemMaterializer subscription RuntimeInventoryState's
// constructor installs is exercised end-to-end from the real wire
// parse through to ClientObjectTable.
using GameRuntime runtime = Create();
using IDisposable wiring = GameEventWiring.WireAll(
_dispatcher,
runtime.InventoryOwner.Objects,
new CombatState(),
new Spellbook(),
new ChatLog(),
vendor: runtime.InventoryOwner.Vendor);
Dispatch(BuildApproachVendorPayload(
vendorGuid: 0x40001000u,
categories: 0u, minValue: 0u, maxValue: 0u, dealsMagic: false,
buyPrice: 1f, sellPrice: 1f, currencyWcid: 0u, currencyAmount: 0u,
currencyName: "",
items:
[
new VendorItemFixture(
0x50002000u, 1, "Iron Sword", 42u, 0x1234u,
(uint)ItemType.Weapon, 250),
]));
ClientObject? shopItem = runtime.InventoryOwner.Objects.Get(0x50002000u);
Assert.NotNull(shopItem);
Assert.Equal(0x40001000u, shopItem!.ContainerId);
Assert.Equal("Iron Sword", shopItem.Name);
Assert.Equal(1, runtime.InventoryOwner.VendorItems.OwnedCount);
runtime.InventoryOwner.Vendor.Close();
Assert.Null(runtime.InventoryOwner.Objects.Get(0x50002000u));
Assert.Equal(0, runtime.InventoryOwner.VendorItems.OwnedCount);
// Close() is a client-local session end, not full disposal, so only
// the vendor-specific ownership dimensions are asserted here — the
// full IsConverged gate is exercised by DisposingInventoryOwner_
// ClearsTheOpenVendorSession below.
RuntimeInventoryOwnershipSnapshot snapshot = runtime.InventoryOwner.CaptureOwnership();
Assert.Equal(0u, snapshot.VendorId);
Assert.Equal(0, snapshot.MaterializedVendorItemCount);
}
[Fact]
public void VendorId_IsTheLiveActiveVendorIdSeamSource()
{