Skip to content

Commit

Permalink
Add DrawDataContainer.LoadGearsetData (#1277)
Browse files Browse the repository at this point in the history
* Add DrawDataContainer.LoadGearsetData

Co-authored-by: Cordelia <[email protected]>

* Add RaptureGearsetModule.EquipGearsetInternal

Co-authored-by: Cordelia <[email protected]>

* Fix namespace

---------

Co-authored-by: Cordelia <[email protected]>
  • Loading branch information
Haselnussbomber and CordeliaMist authored Jan 20, 2025
1 parent b668052 commit 7a768af
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using FFXIVClientStructs.FFXIV.Client.Game.Network;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;

Expand Down Expand Up @@ -70,6 +71,9 @@ public ref EquipmentModelId Equipment(EquipmentSlot slot) {
[MemberFunction("E8 ?? ?? ?? ?? EB 50 44 8B 03")]
public partial void SetGlasses(int index, ushort id);

[MemberFunction("48 89 5C 24 ?? 55 56 57 41 54 41 55 41 56 41 57 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 84 24 ?? ?? ?? ?? 44 0F B6 B9")]
public partial void LoadGearsetData(PacketPlayerGearsetData* gearsetData);

public enum EquipmentSlot : uint {
Head = 0,
Body = 1,
Expand Down Expand Up @@ -200,3 +204,11 @@ public struct EquipmentModelId {

[FieldOffset(0), CExportIgnore] public ulong Value;
}

[StructLayout(LayoutKind.Explicit, Size = 4)]
public struct LegacyEquipmentModelId {
[FieldOffset(0)] public ushort Id;
[FieldOffset(2)] public byte Variant;
[FieldOffset(3)] public byte Stain;
// Second Stain id is stored separately
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using FFXIVClientStructs.FFXIV.Client.Game.Character;

namespace FFXIVClientStructs.FFXIV.Client.Game.Network;

[GenerateInterop]
[StructLayout(LayoutKind.Explicit, Size = 0x46)]
public partial struct PacketPlayerGearsetData {
// Stores the weapon data. Includes both dyes in the data. </summary>
[FieldOffset(0x00)] public WeaponModelId MainhandWeaponData;
[FieldOffset(0x08)] public WeaponModelId OffhandWeaponData;
[FieldOffset(0x10)] public byte CrestBitField; // A Bitfield:: ShieldCrest == 1, HeadCrest == 2, Chest Crest == 4
[FieldOffset(0x11)] public byte JobId; // Job ID associated with the gearset change.
[FieldOffset(0x12)] private byte Unk12; // Flicks from 0 to 128 (anywhere inbetween), have yet to associate what it is linked to. Remains the same when flicking between gearsets of the same job.
[FieldOffset(0x13)] private byte Unk13; // I have never seen this be anything other than 0.
[FieldOffset(0x14), FixedSizeArray] internal FixedSizeArray10<LegacyEquipmentModelId> _equipmentModelIds;
[FieldOffset(0x3C), FixedSizeArray] internal FixedSizeArray10<byte> _equipmentSecondaryDyes;
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public unsafe partial struct RaptureGearsetModule {
[MemberFunction("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F9 41 0F B6 F0 48 8D 0D")]
public partial int EquipGearset(int gearsetId, byte glamourPlateId = 0);

[MemberFunction("40 55 53 56 57 41 57 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 85 ?? ?? ?? ?? 4C 63 FA")]
public partial int EquipGearsetInternal(int gearsetId, byte glamourPlateId = 0);

/// <summary>
/// Save the player's current inventory to a new gearset at the next possible ID.
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions ida/data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ functions:
0x140A03370: ProcessPacketPlayerStateFlags
0x140A03390: ProcessPacketPlayerClassInfo
0x140A034C0: ProcessPacketPlayerBlueMageActions
0x140A034E0: ProcessPacketPlayerGearsetData
0x140A03520: ProcessPacketUpdateRecastTimes
0x140A03570: ProcessPacketActorSetPos
0x140A03590: ProcessPacketActorMove
Expand Down Expand Up @@ -8394,6 +8395,7 @@ classes:
base: Client::Game::Character::ContainerInterface
funcs:
# 0x1413171F0: ctor # inlined at 0x1408CF5D2
0x140842F50: LoadGearsetData
0x140843E20: LoadWeapon
0x140844AE0: HideWeapons
0x1408454C0: LoadEquipment
Expand Down

0 comments on commit 7a768af

Please sign in to comment.