feat(net): D.2b-B B-Wire — register ViewContents + InventoryPutObjectIn3D/SaveFailed/CloseGroundContainer
Register four previously-unwired GameEvent handlers after InventoryPutObjInContainer: - ViewContents (0x0196): iterates ParseViewContents entries and calls items.RecordMembership(entry.Guid, containerId) for each — so the object table is correct before the container-open UI mounts. - InventoryPutObjectIn3D (0x019A): calls items.MoveItem(guid, 0u) to unparent a dropped item from its container (it's now a ground object). - InventoryServerSaveFailed (0x00A0): parse + log; rollback behavior deferred to B-Drag (acdream has no speculative moves yet). - CloseGroundContainer (0x0052): parse + log; no table change needed (the container-open view is UI-only). Two dispatcher tests cover ViewContents membership and Put3D unparenting. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d97d84d7ca
commit
3a9c188233
2 changed files with 75 additions and 0 deletions
|
|
@ -535,4 +535,39 @@ public sealed class GameEventWiringTests
|
|||
Assert.Equal(1500, player!.Properties.Ints[5]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_ViewContents_RecordsMembershipInClientObjectTable()
|
||||
{
|
||||
var (d, items, _, _, _) = MakeAll();
|
||||
|
||||
// containerGuid 0xC9 + 2 entries
|
||||
byte[] payload = new byte[8 + 2 * 8];
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(0), 0x500000C9u);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(4), 2u);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(8), 0x50000A01u);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(12), 0u);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(16), 0x50000A02u);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(20), 1u);
|
||||
|
||||
var env = GameEventEnvelope.TryParse(WrapEnvelope(GameEventType.ViewContents, payload));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
Assert.Equal(0x500000C9u, items.Get(0x50000A01u)!.ContainerId);
|
||||
Assert.Equal(0x500000C9u, items.Get(0x50000A02u)!.ContainerId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_InventoryPutObjectIn3D_UnparentsFromContainer()
|
||||
{
|
||||
var (d, items, _, _, _) = MakeAll();
|
||||
items.RecordMembership(0x50000A01u, containerId: 0x500000C9u);
|
||||
|
||||
byte[] payload = new byte[4];
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload, 0x50000A01u);
|
||||
var env = GameEventEnvelope.TryParse(WrapEnvelope(GameEventType.InventoryPutObjectIn3D, payload));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
Assert.Equal(0u, items.Get(0x50000A01u)!.ContainerId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue