Object/status table update. (#1447)

This commit is contained in:
awgil 2023-10-03 20:41:24 +03:00 committed by GitHub
parent d7a30796ec
commit ee57af709a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View file

@ -23,7 +23,7 @@ namespace Dalamud.Game.ClientState.Objects;
#pragma warning restore SA1015 #pragma warning restore SA1015
internal sealed partial class ObjectTable : IServiceType, IObjectTable internal sealed partial class ObjectTable : IServiceType, IObjectTable
{ {
private const int ObjectTableLength = 596; private const int ObjectTableLength = 599;
private readonly ClientStateAddressResolver address; private readonly ClientStateAddressResolver address;

View file

@ -10,8 +10,6 @@ namespace Dalamud.Game.ClientState.Statuses;
/// </summary> /// </summary>
public sealed unsafe partial class StatusList public sealed unsafe partial class StatusList
{ {
private const int StatusListLength = 30;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="StatusList"/> class. /// Initializes a new instance of the <see cref="StatusList"/> class.
/// </summary> /// </summary>
@ -38,7 +36,7 @@ public sealed unsafe partial class StatusList
/// <summary> /// <summary>
/// Gets the amount of status effect slots the actor has. /// Gets the amount of status effect slots the actor has.
/// </summary> /// </summary>
public int Length => StatusListLength; public int Length => Struct->NumValidStatuses;
private static int StatusSize { get; } = Marshal.SizeOf<FFXIVClientStructs.FFXIV.Client.Game.Status>(); private static int StatusSize { get; } = Marshal.SizeOf<FFXIVClientStructs.FFXIV.Client.Game.Status>();
@ -53,7 +51,7 @@ public sealed unsafe partial class StatusList
{ {
get get
{ {
if (index < 0 || index > StatusListLength) if (index < 0 || index > this.Length)
return null; return null;
var addr = this.GetStatusAddress(index); var addr = this.GetStatusAddress(index);
@ -107,7 +105,7 @@ public sealed unsafe partial class StatusList
/// <returns>The memory address of the party member.</returns> /// <returns>The memory address of the party member.</returns>
public IntPtr GetStatusAddress(int index) public IntPtr GetStatusAddress(int index)
{ {
if (index < 0 || index >= StatusListLength) if (index < 0 || index >= this.Length)
return IntPtr.Zero; return IntPtr.Zero;
return (IntPtr)(this.Struct->Status + (index * StatusSize)); return (IntPtr)(this.Struct->Status + (index * StatusSize));
@ -134,7 +132,7 @@ public sealed partial class StatusList : IReadOnlyCollection<Status>, ICollectio
/// <inheritdoc/> /// <inheritdoc/>
public IEnumerator<Status> GetEnumerator() public IEnumerator<Status> GetEnumerator()
{ {
for (var i = 0; i < StatusListLength; i++) for (var i = 0; i < this.Length; i++)
{ {
var status = this[i]; var status = this[i];