feat(net): D.2b-B B-Wire — ParseViewContents (0x0196)
GameEvents.ParseViewContents parses the ViewContents GameEvent payload: containerGuid + count + [guid, containerType]×count. Records ViewContentsEntry and ViewContents added. 3 unit tests added in GameEventsInventoryTests.cs (two-entry, zero-count, truncated). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
79c0374d53
commit
43afcc2adb
2 changed files with 68 additions and 0 deletions
|
|
@ -358,6 +358,29 @@ public static class GameEvents
|
|||
BinaryPrimitives.ReadUInt32LittleEndian(payload.Slice(8)));
|
||||
}
|
||||
|
||||
/// <summary>0x0196 ViewContents: full contents list of a container you opened.
|
||||
/// Layout (ACE GameEventViewContents.cs): containerGuid, count, [guid, containerType]×count.
|
||||
/// Client consumer: ClientUISystem::OnViewContents (PackableList<ContentProfile>).</summary>
|
||||
public readonly record struct ViewContentsEntry(uint Guid, uint ContainerType);
|
||||
public readonly record struct ViewContents(uint ContainerGuid, System.Collections.Generic.IReadOnlyList<ViewContentsEntry> Items);
|
||||
|
||||
public static ViewContents? ParseViewContents(ReadOnlySpan<byte> payload)
|
||||
{
|
||||
if (payload.Length < 8) return null;
|
||||
uint containerGuid = BinaryPrimitives.ReadUInt32LittleEndian(payload);
|
||||
uint count = BinaryPrimitives.ReadUInt32LittleEndian(payload.Slice(4));
|
||||
int pos = 8;
|
||||
if ((long)payload.Length - pos < (long)count * 8) return null;
|
||||
var items = new ViewContentsEntry[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
uint guid = BinaryPrimitives.ReadUInt32LittleEndian(payload.Slice(pos)); pos += 4;
|
||||
uint type = BinaryPrimitives.ReadUInt32LittleEndian(payload.Slice(pos)); pos += 4;
|
||||
items[i] = new ViewContentsEntry(guid, type);
|
||||
}
|
||||
return new ViewContents(containerGuid, items);
|
||||
}
|
||||
|
||||
// ── Other small-payload events ──────────────────────────────────────────
|
||||
|
||||
/// <summary>0x01C7 UseDone: the Use/UseWithTarget completion signal (WeenieError code).</summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue