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>
64 lines
1.9 KiB
C#
64 lines
1.9 KiB
C#
using System.Net;
|
|
using AcDream.Core.Net;
|
|
using AcDream.Core.Net.Messages;
|
|
|
|
namespace AcDream.Core.Net.Tests;
|
|
|
|
/// <summary>
|
|
/// Slice 6.3 — verifies <see cref="WorldSession.SendBuy"/> produces the same
|
|
/// wire bytes <see cref="VendorRequests.BuildBuy"/> does directly, using a
|
|
/// sequence number drawn from <see cref="WorldSession.NextGameActionSequence"/>.
|
|
/// Mirrors <c>WorldSessionChatTests</c>'s <c>GameActionCapture</c> test seam.
|
|
/// </summary>
|
|
public sealed class WorldSessionVendorTests
|
|
{
|
|
private static WorldSession NewSession()
|
|
{
|
|
var ep = new IPEndPoint(IPAddress.Loopback, 65001);
|
|
return new WorldSession(ep);
|
|
}
|
|
|
|
[Fact]
|
|
public void SendBuy_EmitsBytesIdenticalToVendorRequestsBuildBuy()
|
|
{
|
|
using var session = NewSession();
|
|
byte[]? captured = null;
|
|
session.GameActionCapture = body => captured = body;
|
|
|
|
session.SendBuy(
|
|
vendorGuid: 0x40001000u,
|
|
itemGuid: 0x50002000u,
|
|
amount: 3,
|
|
alternateCurrencyId: 0u);
|
|
|
|
byte[] expected = VendorRequests.BuildBuy(
|
|
gameActionSequence: 1,
|
|
vendorGuid: 0x40001000u,
|
|
amount: 3,
|
|
itemGuid: 0x50002000u,
|
|
alternateCurrencyId: 0u);
|
|
|
|
Assert.NotNull(captured);
|
|
Assert.Equal(expected, captured);
|
|
}
|
|
|
|
[Fact]
|
|
public void SendBuy_IncrementsTheSharedGameActionSequenceLikeEveryOtherSend()
|
|
{
|
|
using var session = NewSession();
|
|
byte[]? captured = null;
|
|
session.GameActionCapture = body => captured = body;
|
|
|
|
session.SendTalk("first"); // consumes sequence 1
|
|
session.SendBuy(0x40001000u, 0x50002000u, 1, 0u); // should be sequence 2
|
|
|
|
byte[] expected = VendorRequests.BuildBuy(
|
|
gameActionSequence: 2,
|
|
vendorGuid: 0x40001000u,
|
|
amount: 1,
|
|
itemGuid: 0x50002000u,
|
|
alternateCurrencyId: 0u);
|
|
|
|
Assert.Equal(expected, captured);
|
|
}
|
|
}
|