mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
feat: CreateStatusListReference, move CreateStatusReference to static
This commit is contained in:
parent
d00a9827d7
commit
c611a97ab5
1 changed files with 40 additions and 19 deletions
|
|
@ -57,10 +57,49 @@ namespace Dalamud.Game.ClientState.Statuses
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var addr = this.GetStatusAddress(index);
|
var addr = this.GetStatusAddress(index);
|
||||||
return this.CreateStatusReference(addr);
|
return CreateStatusReference(addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a reference to an FFXIV actor status list.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="address">The address of the status list in memory.</param>
|
||||||
|
/// <returns>The status object containing the requested data.</returns>
|
||||||
|
public static StatusList? CreateStatusListReference(IntPtr address)
|
||||||
|
{
|
||||||
|
// The use case for CreateStatusListReference and CreateStatusReference to be static is so
|
||||||
|
// fake status lists can be generated. Since they aren't exposed as services, it's either
|
||||||
|
// here or somewhere else.
|
||||||
|
var clientState = Service<ClientState>.Get();
|
||||||
|
|
||||||
|
if (clientState.LocalContentId == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (address == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return new StatusList(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a reference to an FFXIV actor status.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="address">The address of the status effect in memory.</param>
|
||||||
|
/// <returns>The status object containing the requested data.</returns>
|
||||||
|
public static Status? CreateStatusReference(IntPtr address)
|
||||||
|
{
|
||||||
|
var clientState = Service<ClientState>.Get();
|
||||||
|
|
||||||
|
if (clientState.LocalContentId == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (address == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return new Status(address);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the address of the party member at the specified index of the party list.
|
/// Gets the address of the party member at the specified index of the party list.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -73,24 +112,6 @@ namespace Dalamud.Game.ClientState.Statuses
|
||||||
|
|
||||||
return (IntPtr)(this.Struct->Status + (index * StatusSize));
|
return (IntPtr)(this.Struct->Status + (index * StatusSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a reference to an FFXIV actor status.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="address">The address of the status effect in memory.</param>
|
|
||||||
/// <returns>The status object containing the requested data.</returns>
|
|
||||||
public Status? CreateStatusReference(IntPtr address)
|
|
||||||
{
|
|
||||||
var clientState = Service<ClientState>.Get();
|
|
||||||
|
|
||||||
if (clientState.LocalContentId == 0)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (address == IntPtr.Zero)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return new Status(address);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue