mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-23 08:17:47 +01:00
Implement service locator
This commit is contained in:
parent
06b1163a52
commit
ff1d7f2829
101 changed files with 1614 additions and 1436 deletions
|
|
@ -14,26 +14,21 @@ namespace Dalamud.Game.ClientState.Statuses
|
|||
{
|
||||
private const int StatusListLength = 30;
|
||||
|
||||
private readonly Dalamud dalamud;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StatusList"/> class.
|
||||
/// </summary>
|
||||
/// <param name="address">Address of the status list.</param>
|
||||
/// <param name="dalamud">The <see cref="dalamud"/> instance.</param>
|
||||
internal StatusList(IntPtr address, Dalamud dalamud)
|
||||
internal StatusList(IntPtr address)
|
||||
{
|
||||
this.Address = address;
|
||||
this.dalamud = dalamud;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StatusList"/> class.
|
||||
/// </summary>
|
||||
/// <param name="pointer">Pointer to the status list.</param>
|
||||
/// <param name="dalamud">The <see cref="dalamud"/> instance.</param>
|
||||
internal unsafe StatusList(void* pointer, Dalamud dalamud)
|
||||
: this((IntPtr)pointer, dalamud)
|
||||
internal unsafe StatusList(void* pointer)
|
||||
: this((IntPtr)pointer)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -104,13 +99,15 @@ namespace Dalamud.Game.ClientState.Statuses
|
|||
[CanBeNull]
|
||||
public Status CreateStatusReference(IntPtr address)
|
||||
{
|
||||
if (this.dalamud.ClientState.LocalContentId == 0)
|
||||
var clientState = Service<ClientState>.Get();
|
||||
|
||||
if (clientState.LocalContentId == 0)
|
||||
return null;
|
||||
|
||||
if (address == IntPtr.Zero)
|
||||
return null;
|
||||
|
||||
return new Status(address, this.dalamud);
|
||||
return new Status(address);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue