feat(vendor): Slice 6b/6c — move-to-use, buy staging, selling; the vendor arc is functionally complete
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
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
C1 an out-of-range Use now approaches first via the existing client-predicted BeginApproach (Pickup's far-range shape mirrored; retail's ItemHolder::UseObject @0x00588A80 has no range check and the dispatch stays immediate). C2 Add-to-List stages into the Buying tab via VendorStagingList (RemoveProfileFromList's two shapes, pc:200497-200537), Buy All sends ONE batched 0x005F and flushes staging on send exactly as retail does (SendShopEvent -> Flush, pc:204075-204076 — not UseDone-gated), and X-close over a non-empty staging list shows retail's confirm string recovered verbatim from the binary data segment (0x007b5bd8) through the existing dialog factory. C3 the Selling tab's list is the sole drop target (retail's single IsAncestorOfMe gate, pc:204229-204246); VendorSellAcceptability ports InqAcceptability with all rejection strings recovered verbatim from the raw data segment; the sell side prices with BuyPrice (retail's inverted naming: what the vendor PAYS) and 0x0060 carries no trailing currency field, unlike Buy. C4 the status-bar reproduction test PASSES against the production toolbar mount — retail's toolbar shows count + name with the split bar and NO price parenthetical (that figure is the vendor row's own cost text); no code change, the live gate referees. C5 pack order verified correct, untouched. Register: AP-161 narrowed to its two pre-existing cosmetic gaps; AP-162 extended over Buy All; AP-164 (non-sellable bitfield unmodeled), AP-165 (DescStackSize for _maxStackSize in the removal test, bounded), AP-166 (purse text + pending-sell highlight cosmetic) filed. Clean-room complete solution: 11,482 passed / 4 skipped / 0 failed. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ab3146ba88
commit
92ea3977b6
18 changed files with 2578 additions and 78 deletions
|
|
@ -124,4 +124,75 @@ public sealed class VendorRequestsTests
|
|||
|
||||
Assert.Equal(viaList, viaSingle);
|
||||
}
|
||||
|
||||
// ---- Slice 6c: BuildSell (0x0060) — no trailing currency field ---------
|
||||
|
||||
[Fact]
|
||||
public void BuildSell_SingleItem_WritesEnvelopeSequenceOpcodeVendorCountAndItemWithNoTrailer()
|
||||
{
|
||||
byte[] body = VendorRequests.BuildSell(
|
||||
gameActionSequence: 9,
|
||||
vendorGuid: 0x40001000u,
|
||||
items: new (int Amount, uint ItemGuid)[] { (1, 0x50002000u) });
|
||||
|
||||
// envelope(4) + seq(4) + opcode(4) + vendorGuid(4) + itemCount(4)
|
||||
// + 1*(amount(4)+guid(4)) = 28. Note: 4 bytes SHORTER than the
|
||||
// equivalent single-item Buy payload (32) — Sell has no trailing
|
||||
// alternateCurrencyId.
|
||||
Assert.Equal(28, body.Length);
|
||||
Assert.Equal(VendorRequests.GameActionEnvelope,
|
||||
BinaryPrimitives.ReadUInt32LittleEndian(body.AsSpan(0)));
|
||||
Assert.Equal(9u,
|
||||
BinaryPrimitives.ReadUInt32LittleEndian(body.AsSpan(4)));
|
||||
Assert.Equal(VendorRequests.SellOpcode,
|
||||
BinaryPrimitives.ReadUInt32LittleEndian(body.AsSpan(8)));
|
||||
Assert.Equal(0x0060u, VendorRequests.SellOpcode);
|
||||
Assert.Equal(0x40001000u,
|
||||
BinaryPrimitives.ReadUInt32LittleEndian(body.AsSpan(12)));
|
||||
Assert.Equal(1u,
|
||||
BinaryPrimitives.ReadUInt32LittleEndian(body.AsSpan(16)));
|
||||
Assert.Equal(1,
|
||||
BinaryPrimitives.ReadInt32LittleEndian(body.AsSpan(20)));
|
||||
Assert.Equal(0x50002000u,
|
||||
BinaryPrimitives.ReadUInt32LittleEndian(body.AsSpan(24)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildSell_MultipleItems_WritesEachAmountGuidPairInOrderWithNoTrailer()
|
||||
{
|
||||
byte[] body = VendorRequests.BuildSell(
|
||||
gameActionSequence: 4,
|
||||
vendorGuid: 0x40001000u,
|
||||
items: new (int Amount, uint ItemGuid)[]
|
||||
{
|
||||
(1, 0x50002000u),
|
||||
(10, 0x50002001u),
|
||||
});
|
||||
|
||||
// 20 + 2*8 = 36.
|
||||
Assert.Equal(36, body.Length);
|
||||
Assert.Equal(2u,
|
||||
BinaryPrimitives.ReadUInt32LittleEndian(body.AsSpan(16)));
|
||||
Assert.Equal(1,
|
||||
BinaryPrimitives.ReadInt32LittleEndian(body.AsSpan(20)));
|
||||
Assert.Equal(0x50002000u,
|
||||
BinaryPrimitives.ReadUInt32LittleEndian(body.AsSpan(24)));
|
||||
Assert.Equal(10,
|
||||
BinaryPrimitives.ReadInt32LittleEndian(body.AsSpan(28)));
|
||||
Assert.Equal(0x50002001u,
|
||||
BinaryPrimitives.ReadUInt32LittleEndian(body.AsSpan(32)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildSell_EmptyList_WritesAZeroCountAndNoItemPairs()
|
||||
{
|
||||
byte[] body = VendorRequests.BuildSell(
|
||||
gameActionSequence: 1,
|
||||
vendorGuid: 0x40001000u,
|
||||
items: Array.Empty<(int Amount, uint ItemGuid)>());
|
||||
|
||||
Assert.Equal(20, body.Length);
|
||||
Assert.Equal(0u,
|
||||
BinaryPrimitives.ReadUInt32LittleEndian(body.AsSpan(16)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,4 +61,70 @@ public sealed class WorldSessionVendorTests
|
|||
|
||||
Assert.Equal(expected, captured);
|
||||
}
|
||||
|
||||
// ---- Slice 6b: the batched "Buy All" SendBuy overload -------------------
|
||||
|
||||
[Fact]
|
||||
public void SendBuy_BatchedOverload_EmitsBytesIdenticalToVendorRequestsBuildBuyWithAList()
|
||||
{
|
||||
using var session = NewSession();
|
||||
byte[]? captured = null;
|
||||
session.GameActionCapture = body => captured = body;
|
||||
|
||||
var items = new (int Amount, uint ItemGuid)[]
|
||||
{
|
||||
(1, 0x50002000u),
|
||||
(10, 0x50002001u),
|
||||
};
|
||||
session.SendBuy(0x40001000u, items, 0u);
|
||||
|
||||
byte[] expected = VendorRequests.BuildBuy(
|
||||
gameActionSequence: 1,
|
||||
vendorGuid: 0x40001000u,
|
||||
items: items,
|
||||
alternateCurrencyId: 0u);
|
||||
|
||||
Assert.NotNull(captured);
|
||||
Assert.Equal(expected, captured);
|
||||
}
|
||||
|
||||
// ---- Slice 6c: SendSell ---------------------------------------------
|
||||
|
||||
[Fact]
|
||||
public void SendSell_EmitsBytesIdenticalToVendorRequestsBuildSell()
|
||||
{
|
||||
using var session = NewSession();
|
||||
byte[]? captured = null;
|
||||
session.GameActionCapture = body => captured = body;
|
||||
|
||||
var items = new (int Amount, uint ItemGuid)[] { (1, 0x50002000u) };
|
||||
session.SendSell(0x40001000u, items);
|
||||
|
||||
byte[] expected = VendorRequests.BuildSell(
|
||||
gameActionSequence: 1,
|
||||
vendorGuid: 0x40001000u,
|
||||
items: items);
|
||||
|
||||
Assert.NotNull(captured);
|
||||
Assert.Equal(expected, captured);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SendSell_IncrementsTheSharedGameActionSequenceLikeEveryOtherSend()
|
||||
{
|
||||
using var session = NewSession();
|
||||
byte[]? captured = null;
|
||||
session.GameActionCapture = body => captured = body;
|
||||
|
||||
session.SendTalk("first"); // consumes sequence 1
|
||||
var items = new (int Amount, uint ItemGuid)[] { (1, 0x50002000u) };
|
||||
session.SendSell(0x40001000u, items); // should be sequence 2
|
||||
|
||||
byte[] expected = VendorRequests.BuildSell(
|
||||
gameActionSequence: 2,
|
||||
vendorGuid: 0x40001000u,
|
||||
items: items);
|
||||
|
||||
Assert.Equal(expected, captured);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue