mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 20:33:40 +01:00
move actor offset constants to a separate class
This commit is contained in:
parent
9d2114ed4b
commit
4d54166602
1 changed files with 56 additions and 26 deletions
|
|
@ -8,48 +8,78 @@ using Dalamud.Game.ClientState.Actors;
|
|||
|
||||
namespace Dalamud.Game.ClientState.Structs
|
||||
{
|
||||
public class ActorOffsets
|
||||
{
|
||||
public const int Name = 0x30;
|
||||
public const int ActorId = 116;
|
||||
public const int DataId = 128;
|
||||
public const int OwnerId = 132;
|
||||
public const int ObjectKind = 140;
|
||||
public const int SubKind = 141;
|
||||
public const int IsFriendly = 142;
|
||||
public const int YalmDistanceFromPlayerX = 144;
|
||||
public const int PlayerTargetStatus = 145;
|
||||
public const int YalmDistanceFromPlayerY = 146;
|
||||
public const int Position = 160;
|
||||
public const int Rotation = 176;
|
||||
public const int Customize = 0x17B8;
|
||||
public const int PlayerCharacterTargetActorId = 0x1F0;
|
||||
public const int BattleNpcTargetActorId = 0x17F8;
|
||||
public const int CompanyTag = 0x17D0;
|
||||
public const int NameId = 0x1868;
|
||||
public const int CurrentWorld = 0x1884;
|
||||
public const int HomeWorld = 0x1886;
|
||||
public const int CurrentHp = 0x1898;
|
||||
public const int MaxHp = 0x189C;
|
||||
public const int CurrentMp = 0x18A0;
|
||||
public const int MaxMp = 0x18AA;
|
||||
public const int ClassJob = 6358;
|
||||
public const int Level = 6360;
|
||||
public const int UIStatusEffects = 0x1958;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Native memory representation of a FFXIV actor.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Actor {
|
||||
[FieldOffset(0x30)] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 30)]
|
||||
[FieldOffset(ActorOffsets.Name)] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 30)]
|
||||
public string Name;
|
||||
|
||||
[FieldOffset(116)] public int ActorId;
|
||||
[FieldOffset(128)] public int DataId;
|
||||
[FieldOffset(132)] public int OwnerId;
|
||||
[FieldOffset(140)] public ObjectKind ObjectKind;
|
||||
[FieldOffset(141)] public byte SubKind;
|
||||
[FieldOffset(142)] public bool IsFriendly;
|
||||
[FieldOffset(144)] public byte YalmDistanceFromPlayerX; // Demo says one of these is x distance
|
||||
[FieldOffset(145)] public byte PlayerTargetStatus; // This is some kind of enum
|
||||
[FieldOffset(146)] public byte YalmDistanceFromPlayerY; // and the other is z distance
|
||||
[FieldOffset(160)] public Position3 Position;
|
||||
[FieldOffset(176)] public float Rotation; // Rotation around the vertical axis (yaw), from -pi to pi radians
|
||||
[FieldOffset(ActorOffsets.ActorId)] public int ActorId;
|
||||
[FieldOffset(ActorOffsets.DataId)] public int DataId;
|
||||
[FieldOffset(ActorOffsets.OwnerId)] public int OwnerId;
|
||||
[FieldOffset(ActorOffsets.ObjectKind)] public ObjectKind ObjectKind;
|
||||
[FieldOffset(ActorOffsets.SubKind)] public byte SubKind;
|
||||
[FieldOffset(ActorOffsets.IsFriendly)] public bool IsFriendly;
|
||||
[FieldOffset(ActorOffsets.YalmDistanceFromPlayerX)] public byte YalmDistanceFromPlayerX; // Demo says one of these is x distance
|
||||
[FieldOffset(ActorOffsets.PlayerTargetStatus)] public byte PlayerTargetStatus; // This is some kind of enum
|
||||
[FieldOffset(ActorOffsets.YalmDistanceFromPlayerY)] public byte YalmDistanceFromPlayerY; // and the other is z distance
|
||||
[FieldOffset(ActorOffsets.Position)] public Position3 Position;
|
||||
[FieldOffset(ActorOffsets.Rotation)] public float Rotation; // Rotation around the vertical axis (yaw), from -pi to pi radians
|
||||
|
||||
[FieldOffset(0x17B8)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] public byte[] Customize;
|
||||
[FieldOffset(ActorOffsets.Customize)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] public byte[] Customize;
|
||||
|
||||
[FieldOffset(0x1F0)] public int PlayerCharacterTargetActorId;
|
||||
[FieldOffset(0x17F8)] public int BattleNpcTargetActorId;
|
||||
[FieldOffset(ActorOffsets.PlayerCharacterTargetActorId)] public int PlayerCharacterTargetActorId;
|
||||
[FieldOffset(ActorOffsets.BattleNpcTargetActorId)] public int BattleNpcTargetActorId;
|
||||
|
||||
// This field can't be correctly aligned, so we have to cut it manually.
|
||||
[FieldOffset(0x17d0)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
|
||||
[FieldOffset(ActorOffsets.CompanyTag)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
|
||||
public byte[] CompanyTag;
|
||||
|
||||
[FieldOffset(0x1868)] public int NameId;
|
||||
[FieldOffset(0x1884)] public byte CurrentWorld;
|
||||
[FieldOffset(0x1886)] public byte HomeWorld;
|
||||
[FieldOffset(0x1898)] public int CurrentHp;
|
||||
[FieldOffset(0x189C)] public int MaxHp;
|
||||
[FieldOffset(0x18A0)] public int CurrentMp;
|
||||
[FieldOffset(ActorOffsets.NameId)] public int NameId;
|
||||
[FieldOffset(ActorOffsets.CurrentWorld)] public byte CurrentWorld;
|
||||
[FieldOffset(ActorOffsets.HomeWorld)] public byte HomeWorld;
|
||||
[FieldOffset(ActorOffsets.CurrentHp)] public int CurrentHp;
|
||||
[FieldOffset(ActorOffsets.MaxHp)] public int MaxHp;
|
||||
[FieldOffset(ActorOffsets.CurrentMp)] public int CurrentMp;
|
||||
// This value is weird. It seems to change semi-randomly between 0 and 10k, definitely
|
||||
// in response to mp-using events, but it doesn't often have a value and the changing seems
|
||||
// somewhat arbitrary.
|
||||
[FieldOffset(0x18AA)] public int MaxMp;
|
||||
[FieldOffset(6358)] public byte ClassJob;
|
||||
[FieldOffset(6360)] public byte Level;
|
||||
[FieldOffset(0x1958)][MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public StatusEffect[] UIStatusEffects;
|
||||
[FieldOffset(ActorOffsets.MaxMp)] public int MaxMp;
|
||||
[FieldOffset(ActorOffsets.ClassJob)] public byte ClassJob;
|
||||
[FieldOffset(ActorOffsets.Level)] public byte Level;
|
||||
[FieldOffset(ActorOffsets.UIStatusEffects)][MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public StatusEffect[] UIStatusEffects;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue