mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Add some Write options to ActorEquipment.
This commit is contained in:
parent
af11267400
commit
44bbf546f6
1 changed files with 36 additions and 13 deletions
|
|
@ -16,19 +16,19 @@ namespace Penumbra.GameData.Structs
|
||||||
public const int EquipmentSlots = 10;
|
public const int EquipmentSlots = 10;
|
||||||
public const int WeaponSlots = 2;
|
public const int WeaponSlots = 2;
|
||||||
|
|
||||||
public ActorWeapon MainHand;
|
public ActorWeapon MainHand;
|
||||||
public ActorWeapon OffHand;
|
public ActorWeapon OffHand;
|
||||||
public ActorArmor Head;
|
public ActorArmor Head;
|
||||||
public ActorArmor Body;
|
public ActorArmor Body;
|
||||||
public ActorArmor Hands;
|
public ActorArmor Hands;
|
||||||
public ActorArmor Legs;
|
public ActorArmor Legs;
|
||||||
public ActorArmor Feet;
|
public ActorArmor Feet;
|
||||||
public ActorArmor Ears;
|
public ActorArmor Ears;
|
||||||
public ActorArmor Neck;
|
public ActorArmor Neck;
|
||||||
public ActorArmor Wrists;
|
public ActorArmor Wrists;
|
||||||
public ActorArmor RFinger;
|
public ActorArmor RFinger;
|
||||||
public ActorArmor LFinger;
|
public ActorArmor LFinger;
|
||||||
public ushort IsSet; // Also fills struct size to 56, a multiple of 8.
|
public ushort IsSet; // Also fills struct size to 56, a multiple of 8.
|
||||||
|
|
||||||
public ActorEquipment()
|
public ActorEquipment()
|
||||||
=> Clear();
|
=> Clear();
|
||||||
|
|
@ -123,5 +123,28 @@ namespace Penumbra.GameData.Structs
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public unsafe void WriteBytes( byte[] array, int offset = 0 )
|
||||||
|
{
|
||||||
|
fixed( ActorWeapon* data = &MainHand )
|
||||||
|
{
|
||||||
|
Marshal.Copy( new IntPtr( data ), array, offset, 56 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] ToBytes()
|
||||||
|
{
|
||||||
|
var ret = new byte[56];
|
||||||
|
WriteBytes( ret );
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public unsafe void FromBytes( byte[] array, int offset = 0 )
|
||||||
|
{
|
||||||
|
fixed( ActorWeapon* data = &MainHand )
|
||||||
|
{
|
||||||
|
Marshal.Copy( array, offset, new IntPtr( data ), 56 );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue