Skip to content

Commit 6afe9c1

Browse files
authored
Merge pull request #1722 from Haselnussbomber/inventorypackets
Add InventoryItem packet handlers
2 parents 28421f9 + 853994c commit 6afe9c1

File tree

4 files changed

+83
-19
lines changed

4 files changed

+83
-19
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using FFXIVClientStructs.FFXIV.Client.Network;
2+
3+
namespace FFXIVClientStructs.FFXIV.Client.Game.Network;
4+
5+
// TODO: remove with HandleUpdateInventorySlotPacket (replaced by InventoryItemPacket)
6+
[GenerateInterop]
7+
[StructLayout(LayoutKind.Explicit, Size = 0x3D)]
8+
public partial struct UpdateInventorySlotPacket {
9+
[FieldOffset(0x00)] public uint ContextId;
10+
[FieldOffset(0x08)] public ushort InventoryType;
11+
[FieldOffset(0x0A)] public short InventorySlot;
12+
[FieldOffset(0x0C)] public int Quantity;
13+
[FieldOffset(0x10)] public uint ItemId;
14+
[FieldOffset(0x18)] public ulong CrafterContentId;
15+
[FieldOffset(0x20)] public byte ItemFlags;
16+
[FieldOffset(0x22)] public ushort Condition;
17+
[FieldOffset(0x24)] public ushort SpiritbondOrCollectability;
18+
[FieldOffset(0x28)] public uint GlamourId;
19+
[FieldOffset(0x2C), FixedSizeArray] internal FixedSizeArray5<short> _materia;
20+
[FieldOffset(0x36), FixedSizeArray] internal FixedSizeArray5<byte> _materiaGrades;
21+
[FieldOffset(0x3B), FixedSizeArray] internal FixedSizeArray2<byte> _stains;
22+
}
23+
24+
/// <remarks> Packet for <see cref="PacketDispatcher.HandleInventoryItemPacket"/> and <see cref="PacketDispatcher.HandleInventoryItemUpdatePacket"/> </remarks>
25+
[GenerateInterop]
26+
[StructLayout(LayoutKind.Explicit, Size = 0x3D)]
27+
public partial struct InventoryItemPacket {
28+
[FieldOffset(0x00)] public uint ContextId;
29+
[FieldOffset(0x08)] public ushort InventoryType;
30+
[FieldOffset(0x0A)] public ushort Slot;
31+
[FieldOffset(0x0C)] public uint Quantity;
32+
[FieldOffset(0x10)] public uint ItemId;
33+
34+
[FieldOffset(0x18)] public ulong CrafterContentId;
35+
[FieldOffset(0x20)] public byte ItemFlags;
36+
37+
[FieldOffset(0x22)] public ushort Condition;
38+
[FieldOffset(0x24)] public ushort SpiritbondOrCollectability;
39+
40+
[FieldOffset(0x28)] public uint GlamourId;
41+
[FieldOffset(0x2C), FixedSizeArray] internal FixedSizeArray5<ushort> _materia;
42+
[FieldOffset(0x36), FixedSizeArray] internal FixedSizeArray5<byte> _materiaGrades;
43+
[FieldOffset(0x3B), FixedSizeArray] internal FixedSizeArray2<byte> _stains;
44+
}
45+
46+
/// <remarks> Packet for <see cref="PacketDispatcher.HandleInventoryItemCurrencyPacket"/> </remarks>
47+
[StructLayout(LayoutKind.Explicit, Size = 0x14)]
48+
public struct InventoryItemCurrencyPacket {
49+
[FieldOffset(0x00)] public uint ContextId;
50+
[FieldOffset(0x04)] public ushort InventoryType;
51+
[FieldOffset(0x06)] public ushort Slot;
52+
[FieldOffset(0x08)] public uint Quantity;
53+
54+
[FieldOffset(0x10)] public uint ItemId;
55+
}
56+
57+
/// <remarks> Packet for <see cref="PacketDispatcher.HandleInventoryItemSymbolicPacket"/> </remarks>
58+
[StructLayout(LayoutKind.Explicit, Size = 0x10)]
59+
public struct InventoryItemSymbolicPacket {
60+
[FieldOffset(0x00)] public uint ContextId;
61+
[FieldOffset(0x04)] public ushort InventoryType;
62+
[FieldOffset(0x06)] public ushort Slot;
63+
[FieldOffset(0x08)] public uint Quantity;
64+
[FieldOffset(0x0C)] public ushort TargetInventoryType;
65+
[FieldOffset(0x0E)] public ushort TargetSlot;
66+
}

FFXIVClientStructs/FFXIV/Client/Game/Network/UpdateInventorySlotPacket.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

FFXIVClientStructs/FFXIV/Client/Network/PacketDispatcher.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,22 @@ public static partial void HandleActorControlPacket(
4545
[MemberFunction("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 40 B8 00 00 00 E0")]
4646
public static partial void HandleEventPlayPacket(GameObjectId objectId, EventId eventId, short scene, ulong sceneFlags, uint* sceneData, byte sceneDataCount);
4747

48+
[Obsolete("Use HandleInventoryItemUpdatePacket")]
4849
[MemberFunction("48 89 5C 24 ?? 57 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 44 24 ?? 0F B7 5A")]
4950
public static partial void HandleUpdateInventorySlotPacket(uint targetId, UpdateInventorySlotPacket* packet);
5051

52+
[MemberFunction("48 89 5C 24 ?? 57 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 44 24 ?? 0F B7 5A")]
53+
public static partial void HandleInventoryItemUpdatePacket(uint targetId, InventoryItemPacket* packet);
54+
55+
[MemberFunction("E8 ?? ?? ?? ?? EB ?? 3D ?? ?? ?? ?? 75 ?? 48 8D 53")]
56+
public static partial void HandleInventoryItemPacket(uint targetId, InventoryItemPacket* packet);
57+
58+
[MemberFunction("E8 ?? ?? ?? ?? EB ?? 83 F8 ?? 75 ?? 48 8D 53")]
59+
public static partial void HandleInventoryItemCurrencyPacket(uint targetId, InventoryItemCurrencyPacket* packet);
60+
61+
[MemberFunction("E8 ?? ?? ?? ?? 48 8B 5B ?? 48 85 DB 0F 85 ?? ?? ?? ?? 4D 85 FF")]
62+
public static partial void HandleInventoryItemSymbolicPacket(uint targetId, InventoryItemSymbolicPacket* packet);
63+
5164
[MemberFunction("48 89 5C 24 ?? 57 48 81 EC ?? ?? ?? ?? 48 8B DA 8B F9 0F B6 92")]
5265
public static partial void HandleSpawnPlayerPacket(uint targetId, SpawnPlayerPacket* packet);
5366

ida/data.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5972,7 +5972,10 @@ classes:
59725972
0x140B8F8A0: HandleActionEffect24Packet
59735973
0x140B8F920: HandleActionEffect32Packet
59745974
0x140B8F9A0: HandleActorControlPacket
5975-
0x140B9F040: HandleUpdateInventorySlotPacket
5975+
0x140B9F040: HandleInventoryItemUpdatePacket
5976+
0x140B9F240: HandleInventoryItemPacket
5977+
0x140B9F330: HandleInventoryItemCurrencyPacket
5978+
0x140B9F3C0: HandleInventoryItemSymbolicPacket
59765979
0x140B9F4E0: HandleInventoryActionAckPacket
59775980
0x140B9F6D0: HandleUpdatePartyPacket
59785981
0x140B9FEB0: HandleUpdateAllianceNormalPacket

0 commit comments

Comments
 (0)