feat(B.5): InteractRequests.BuildPickUp — PutItemInContainer 0x0019

TDD: failing test first (CS0117 on BuildPickUp + PutItemInContainerOpcode),
then implementation. Wire layout matches ACE GameActionPutItemInContainer:
0xF7B1 envelope + seq + 0x0019 opcode + itemGuid + containerGuid + placement
(24 bytes). For F-key ground-pickup, caller passes player's server guid as
containerGuid; Task 2 (GameWindow wiring) will handle that dispatch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-14 15:01:24 +02:00
parent 86440ff04a
commit e8a20f26c7
2 changed files with 57 additions and 0 deletions

View file

@ -29,6 +29,7 @@ public static class InteractRequests
public const uint UseOpcode = 0x0036u;
public const uint UseWithTargetOpcode = 0x0035u;
public const uint TeleToLifestoneOpcode = 0x0063u;
public const uint PutItemInContainerOpcode = 0x0019u;
/// <summary>
/// Use an object: click a door, loot a corpse, talk to an NPC,
@ -73,4 +74,36 @@ public static class InteractRequests
BinaryPrimitives.WriteUInt32LittleEndian(body.AsSpan(8), TeleToLifestoneOpcode);
return body;
}
/// <summary>
/// Pick up a ground item or move an item between containers. The
/// server places the item in <paramref name="containerGuid"/> at
/// the given <paramref name="placement"/> slot (pass 0 to let the
/// server choose). For F-key ground-pickup, pass the player's own
/// server guid as <paramref name="containerGuid"/>.
///
/// <para>
/// Wire layout (ACE GameActionPutItemInContainer.Handle):
/// <code>
/// u32 0xF7B1
/// u32 gameActionSequence
/// u32 0x0019 // PutItemInContainer
/// u32 itemGuid // server guid of the item
/// u32 containerGuid // destination container (player or bag)
/// i32 placement // 0 = server picks slot
/// </code>
/// </para>
/// </summary>
public static byte[] BuildPickUp(
uint gameActionSequence, uint itemGuid, uint containerGuid, int placement)
{
byte[] body = new byte[24];
BinaryPrimitives.WriteUInt32LittleEndian(body, GameActionEnvelope);
BinaryPrimitives.WriteUInt32LittleEndian(body.AsSpan(4), gameActionSequence);
BinaryPrimitives.WriteUInt32LittleEndian(body.AsSpan(8), PutItemInContainerOpcode);
BinaryPrimitives.WriteUInt32LittleEndian(body.AsSpan(12), itemGuid);
BinaryPrimitives.WriteUInt32LittleEndian(body.AsSpan(16), containerGuid);
BinaryPrimitives.WriteInt32LittleEndian (body.AsSpan(20), placement);
return body;
}
}