mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-16 04:47:45 +01:00
Implement service locator
This commit is contained in:
parent
06b1163a52
commit
ff1d7f2829
101 changed files with 1614 additions and 1436 deletions
|
|
@ -3,6 +3,8 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using JetBrains.Annotations;
|
||||
using Serilog;
|
||||
|
||||
|
|
@ -12,21 +14,20 @@ namespace Dalamud.Game.ClientState.Buddy
|
|||
/// This collection represents the buddies present in your squadron or trust party.
|
||||
/// It does not include the local player.
|
||||
/// </summary>
|
||||
[PluginInterface]
|
||||
[InterfaceVersion("1.0")]
|
||||
public sealed partial class BuddyList
|
||||
{
|
||||
private const uint InvalidObjectID = 0xE0000000;
|
||||
|
||||
private readonly Dalamud dalamud;
|
||||
private readonly ClientStateAddressResolver address;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BuddyList"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">The <see cref="dalamud"/> instance.</param>
|
||||
/// <param name="addressResolver">Client state address resolver.</param>
|
||||
internal BuddyList(Dalamud dalamud, ClientStateAddressResolver addressResolver)
|
||||
internal BuddyList(ClientStateAddressResolver addressResolver)
|
||||
{
|
||||
this.dalamud = dalamud;
|
||||
this.address = addressResolver;
|
||||
|
||||
Log.Verbose($"Buddy list address 0x{this.address.BuddyList.ToInt64():X}");
|
||||
|
|
@ -151,13 +152,15 @@ namespace Dalamud.Game.ClientState.Buddy
|
|||
[CanBeNull]
|
||||
public BuddyMember CreateBuddyMemberReference(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;
|
||||
|
||||
var buddy = new BuddyMember(address, this.dalamud);
|
||||
var buddy = new BuddyMember(address);
|
||||
if (buddy.ObjectId == InvalidObjectID)
|
||||
return null;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Game.ClientState.Resolvers;
|
||||
using JetBrains.Annotations;
|
||||
|
|
@ -11,16 +12,12 @@ namespace Dalamud.Game.ClientState.Buddy
|
|||
/// </summary>
|
||||
public unsafe class BuddyMember
|
||||
{
|
||||
private Dalamud dalamud;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BuddyMember"/> class.
|
||||
/// </summary>
|
||||
/// <param name="address">Buddy address.</param>
|
||||
/// <param name="dalamud">Dalamud instance.</param>
|
||||
internal BuddyMember(IntPtr address, Dalamud dalamud)
|
||||
internal BuddyMember(IntPtr address)
|
||||
{
|
||||
this.dalamud = dalamud;
|
||||
this.Address = address;
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +38,7 @@ namespace Dalamud.Game.ClientState.Buddy
|
|||
/// This iterates the actor table, it should be used with care.
|
||||
/// </remarks>
|
||||
[CanBeNull]
|
||||
public GameObject Actor => this.dalamud.ClientState.Objects.SearchByID(this.ObjectId);
|
||||
public GameObject GameObject => Service<ObjectTable>.Get().SearchByID(this.ObjectId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current health of this buddy.
|
||||
|
|
@ -61,17 +58,17 @@ namespace Dalamud.Game.ClientState.Buddy
|
|||
/// <summary>
|
||||
/// Gets the Mount data related to this buddy. It should only be used with companion buddies.
|
||||
/// </summary>
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.Mount> MountData => new(this.DataID, this.dalamud);
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.Mount> MountData => new(this.DataID);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Pet data related to this buddy. It should only be used with pet buddies.
|
||||
/// </summary>
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.Pet> PetData => new(this.DataID, this.dalamud);
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.Pet> PetData => new(this.DataID);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Trust data related to this buddy. It should only be used with battle buddies.
|
||||
/// </summary>
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.DawnGrowMember> TrustData => new(this.DataID, this.dalamud);
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.DawnGrowMember> TrustData => new(this.DataID);
|
||||
|
||||
private FFXIVClientStructs.FFXIV.Client.Game.UI.Buddy.BuddyMember* Struct => (FFXIVClientStructs.FFXIV.Client.Game.UI.Buddy.BuddyMember*)this.Address;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,10 @@ using Dalamud.Game.ClientState.Keys;
|
|||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
using Dalamud.Game.ClientState.Party;
|
||||
using Dalamud.Game.Network.Internal;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using JetBrains.Annotations;
|
||||
using Serilog;
|
||||
|
||||
|
|
@ -19,9 +22,10 @@ namespace Dalamud.Game.ClientState
|
|||
/// <summary>
|
||||
/// This class represents the state of the game client at the time of access.
|
||||
/// </summary>
|
||||
[PluginInterface]
|
||||
[InterfaceVersion("1.0")]
|
||||
public sealed class ClientState : IDisposable
|
||||
{
|
||||
private readonly Dalamud dalamud;
|
||||
private readonly ClientStateAddressResolver address;
|
||||
private readonly Hook<SetupTerritoryTypeDelegate> setupTerritoryTypeHook;
|
||||
|
||||
|
|
@ -31,43 +35,42 @@ namespace Dalamud.Game.ClientState
|
|||
/// Initializes a new instance of the <see cref="ClientState"/> class.
|
||||
/// Set up client state access.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">Dalamud instance.</param>
|
||||
/// <param name="startInfo">StartInfo of the current Dalamud launch.</param>
|
||||
/// <param name="scanner">Sig scanner.</param>
|
||||
internal ClientState(Dalamud dalamud, DalamudStartInfo startInfo, SigScanner scanner)
|
||||
internal ClientState()
|
||||
{
|
||||
this.dalamud = dalamud;
|
||||
this.address = new ClientStateAddressResolver();
|
||||
this.address.Setup(scanner);
|
||||
this.address.Setup();
|
||||
|
||||
Log.Verbose("===== C L I E N T S T A T E =====");
|
||||
|
||||
this.ClientLanguage = startInfo.Language;
|
||||
this.ClientLanguage = Service<DalamudStartInfo>.Get().Language;
|
||||
|
||||
this.Objects = new ObjectTable(dalamud, this.address);
|
||||
Service<ObjectTable>.Set(this.address);
|
||||
|
||||
this.Fates = new FateTable(dalamud, this.address);
|
||||
Service<FateTable>.Set(this.address);
|
||||
|
||||
this.PartyList = new PartyList(dalamud, this.address);
|
||||
Service<PartyList>.Set(this.address);
|
||||
|
||||
this.BuddyList = new BuddyList(dalamud, this.address);
|
||||
Service<BuddyList>.Set(this.address);
|
||||
|
||||
this.JobGauges = new JobGauges(this.address);
|
||||
Service<JobGauges>.Set(this.address);
|
||||
|
||||
this.KeyState = new KeyState(this.address, scanner.Module.BaseAddress);
|
||||
Service<KeyState>.Set(this.address);
|
||||
|
||||
this.GamepadState = new GamepadState(this.address);
|
||||
Service<GamepadState>.Set(this.address);
|
||||
|
||||
this.Condition = new Condition(this.address);
|
||||
Service<Condition>.Set(this.address);
|
||||
|
||||
this.Targets = new Targets(dalamud, this.address);
|
||||
Service<TargetManager>.Set(this.address);
|
||||
|
||||
Log.Verbose($"SetupTerritoryType address 0x{this.address.SetupTerritoryType.ToInt64():X}");
|
||||
|
||||
this.setupTerritoryTypeHook = new Hook<SetupTerritoryTypeDelegate>(this.address.SetupTerritoryType, this.SetupTerritoryTypeDetour);
|
||||
|
||||
dalamud.Framework.OnUpdateEvent += this.FrameworkOnOnUpdateEvent;
|
||||
dalamud.NetworkHandlers.CfPop += this.NetworkHandlersOnCfPop;
|
||||
var framework = Service<Framework>.Get();
|
||||
framework.OnUpdateEvent += this.FrameworkOnOnUpdateEvent;
|
||||
|
||||
var networkHandlers = Service<NetworkHandlers>.Get();
|
||||
networkHandlers.CfPop += this.NetworkHandlersOnCfPop;
|
||||
}
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
|
||||
|
|
@ -93,56 +96,11 @@ namespace Dalamud.Game.ClientState
|
|||
/// </summary>
|
||||
public event EventHandler<Lumina.Excel.GeneratedSheets.ContentFinderCondition> CfPop;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the table of all present actors.
|
||||
/// </summary>
|
||||
public ObjectTable Objects { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the table of all present fates.
|
||||
/// </summary>
|
||||
public FateTable Fates { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the language of the client.
|
||||
/// </summary>
|
||||
public ClientLanguage ClientLanguage { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the class facilitating Job Gauge data access.
|
||||
/// </summary>
|
||||
public JobGauges JobGauges { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the class facilitating party list data access.
|
||||
/// </summary>
|
||||
public PartyList PartyList { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the class facilitating buddy list data access.
|
||||
/// </summary>
|
||||
public BuddyList BuddyList { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets access to the keypress state of keyboard keys in game.
|
||||
/// </summary>
|
||||
public KeyState KeyState { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets access to the button state of gamepad buttons in game.
|
||||
/// </summary>
|
||||
public GamepadState GamepadState { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets access to client conditions/player state. Allows you to check if a player is in a duty, mounted, etc.
|
||||
/// </summary>
|
||||
public Condition Condition { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the class facilitating target data access.
|
||||
/// </summary>
|
||||
public Targets Targets { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current Territory the player resides in.
|
||||
/// </summary>
|
||||
|
|
@ -152,7 +110,7 @@ namespace Dalamud.Game.ClientState
|
|||
/// Gets the local player character, if one is present.
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
public PlayerCharacter LocalPlayer => this.Objects[0] as PlayerCharacter;
|
||||
public PlayerCharacter LocalPlayer => Service<ObjectTable>.Get()[0] as PlayerCharacter;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content ID of the local character.
|
||||
|
|
@ -169,7 +127,7 @@ namespace Dalamud.Game.ClientState
|
|||
/// </summary>
|
||||
public void Enable()
|
||||
{
|
||||
this.GamepadState.Enable();
|
||||
Service<GamepadState>.Get().Enable();
|
||||
this.setupTerritoryTypeHook.Enable();
|
||||
}
|
||||
|
||||
|
|
@ -179,10 +137,9 @@ namespace Dalamud.Game.ClientState
|
|||
public void Dispose()
|
||||
{
|
||||
this.setupTerritoryTypeHook.Dispose();
|
||||
this.GamepadState.Dispose();
|
||||
|
||||
this.dalamud.Framework.OnUpdateEvent -= this.FrameworkOnOnUpdateEvent;
|
||||
this.dalamud.NetworkHandlers.CfPop += this.NetworkHandlersOnCfPop;
|
||||
Service<GamepadState>.Get().Dispose();
|
||||
Service<Framework>.Get().OnUpdateEvent -= this.FrameworkOnOnUpdateEvent;
|
||||
Service<NetworkHandlers>.Get().CfPop -= this.NetworkHandlersOnCfPop;
|
||||
}
|
||||
|
||||
private IntPtr SetupTerritoryTypeDetour(IntPtr manager, ushort terriType)
|
||||
|
|
@ -202,7 +159,8 @@ namespace Dalamud.Game.ClientState
|
|||
|
||||
private void FrameworkOnOnUpdateEvent(Framework framework)
|
||||
{
|
||||
if (this.Condition.Any() && this.lastConditionNone == true)
|
||||
var condition = Service<Condition>.Get();
|
||||
if (condition.Any() && this.lastConditionNone == true)
|
||||
{
|
||||
Log.Debug("Is login");
|
||||
this.lastConditionNone = false;
|
||||
|
|
@ -210,7 +168,7 @@ namespace Dalamud.Game.ClientState
|
|||
this.Login?.Invoke(this, null);
|
||||
}
|
||||
|
||||
if (!this.Condition.Any() && this.lastConditionNone == false)
|
||||
if (!condition.Any() && this.lastConditionNone == false)
|
||||
{
|
||||
Log.Debug("Is logout");
|
||||
this.lastConditionNone = true;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Game.ClientState.Resolvers;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Memory;
|
||||
|
|
@ -12,17 +13,13 @@ namespace Dalamud.Game.ClientState.Fates
|
|||
/// </summary>
|
||||
public unsafe partial class Fate : IEquatable<Fate>
|
||||
{
|
||||
private Dalamud dalamud;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Fate"/> class.
|
||||
/// </summary>
|
||||
/// <param name="address">The address of this fate in memory.</param>
|
||||
/// <param name="dalamud">Dalamud instance.</param>
|
||||
internal Fate(IntPtr address, Dalamud dalamud)
|
||||
internal Fate(IntPtr address)
|
||||
{
|
||||
this.Address = address;
|
||||
this.dalamud = dalamud;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -49,10 +46,12 @@ namespace Dalamud.Game.ClientState.Fates
|
|||
/// <returns>True or false.</returns>
|
||||
public static bool IsValid(Fate fate)
|
||||
{
|
||||
var clientState = Service<ClientState>.Get();
|
||||
|
||||
if (fate == null)
|
||||
return false;
|
||||
|
||||
if (fate.dalamud.ClientState.LocalContentId == 0)
|
||||
if (clientState.LocalContentId == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -87,7 +86,7 @@ namespace Dalamud.Game.ClientState.Fates
|
|||
/// <summary>
|
||||
/// Gets game data linked to this Fate.
|
||||
/// </summary>
|
||||
public Lumina.Excel.GeneratedSheets.Fate GameData => this.dalamud.Data.GetExcelSheet<Lumina.Excel.GeneratedSheets.Fate>().GetRow(this.FateId);
|
||||
public Lumina.Excel.GeneratedSheets.Fate GameData => Service<DataManager>.Get().GetExcelSheet<Lumina.Excel.GeneratedSheets.Fate>().GetRow(this.FateId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time this <see cref="Fate"/> started.
|
||||
|
|
@ -132,6 +131,6 @@ namespace Dalamud.Game.ClientState.Fates
|
|||
/// <summary>
|
||||
/// Gets the territory this <see cref="Fate"/> is located in.
|
||||
/// </summary>
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.TerritoryType> TerritoryType => new(this.Struct->TerritoryID, this.dalamud);
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.TerritoryType> TerritoryType => new(this.Struct->TerritoryID);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using JetBrains.Annotations;
|
||||
using Serilog;
|
||||
|
||||
|
|
@ -10,20 +12,19 @@ namespace Dalamud.Game.ClientState.Fates
|
|||
/// <summary>
|
||||
/// This collection represents the currently available Fate events.
|
||||
/// </summary>
|
||||
[PluginInterface]
|
||||
[InterfaceVersion("1.0")]
|
||||
public sealed partial class FateTable
|
||||
{
|
||||
private readonly Dalamud dalamud;
|
||||
private readonly ClientStateAddressResolver address;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FateTable"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">The <see cref="dalamud"/> instance.</param>
|
||||
/// <param name="addressResolver">Client state address resolver.</param>
|
||||
internal FateTable(Dalamud dalamud, ClientStateAddressResolver addressResolver)
|
||||
internal FateTable(ClientStateAddressResolver addressResolver)
|
||||
{
|
||||
this.address = addressResolver;
|
||||
this.dalamud = dalamud;
|
||||
|
||||
Log.Verbose($"Fate table address 0x{this.address.FateTablePtr.ToInt64():X}");
|
||||
}
|
||||
|
|
@ -110,13 +111,15 @@ namespace Dalamud.Game.ClientState.Fates
|
|||
[CanBeNull]
|
||||
internal unsafe Fate CreateFateReference(IntPtr offset)
|
||||
{
|
||||
if (this.dalamud.ClientState.LocalContentId == 0)
|
||||
var clientState = Service<ClientState>.Get();
|
||||
|
||||
if (clientState.LocalContentId == 0)
|
||||
return null;
|
||||
|
||||
if (offset == IntPtr.Zero)
|
||||
return null;
|
||||
|
||||
return new Fate(offset, this.dalamud);
|
||||
return new Fate(offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Game.ClientState.Keys
|
||||
|
|
@ -8,6 +10,8 @@ namespace Dalamud.Game.ClientState.Keys
|
|||
/// <summary>
|
||||
/// Wrapper around the game keystate buffer, which contains the pressed state for all keyboard keys, indexed by virtual vkCode.
|
||||
/// </summary>
|
||||
[PluginInterface]
|
||||
[InterfaceVersion("1.0")]
|
||||
public class KeyState
|
||||
{
|
||||
// The array is accessed in a way that this limit doesn't appear to exist
|
||||
|
|
@ -20,9 +24,10 @@ namespace Dalamud.Game.ClientState.Keys
|
|||
/// Initializes a new instance of the <see cref="KeyState"/> class.
|
||||
/// </summary>
|
||||
/// <param name="addressResolver">The ClientStateAddressResolver instance.</param>
|
||||
/// <param name="moduleBaseAddress">The base address of the main process module.</param>
|
||||
public KeyState(ClientStateAddressResolver addressResolver, IntPtr moduleBaseAddress)
|
||||
public KeyState(ClientStateAddressResolver addressResolver)
|
||||
{
|
||||
var moduleBaseAddress = Service<SigScanner>.Get().Module.BaseAddress;
|
||||
|
||||
this.bufferBase = moduleBaseAddress + Marshal.ReadInt32(addressResolver.KeyboardState);
|
||||
|
||||
Log.Verbose($"Keyboard state buffer address 0x{this.bufferBase.ToInt64():X}");
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ using System.Collections.Generic;
|
|||
using Dalamud.Game.ClientState.Objects.Enums;
|
||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using JetBrains.Annotations;
|
||||
using Serilog;
|
||||
|
||||
|
|
@ -13,21 +15,20 @@ namespace Dalamud.Game.ClientState.Objects
|
|||
/// <summary>
|
||||
/// This collection represents the currently spawned FFXIV game objects.
|
||||
/// </summary>
|
||||
[PluginInterface]
|
||||
[InterfaceVersion("1.0")]
|
||||
public sealed partial class ObjectTable
|
||||
{
|
||||
private const int ObjectTableLength = 424;
|
||||
|
||||
private readonly Dalamud dalamud;
|
||||
private readonly ClientStateAddressResolver address;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ObjectTable"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">The <see cref="dalamud"/> instance.</param>
|
||||
/// <param name="addressResolver">Client state address resolver.</param>
|
||||
internal ObjectTable(Dalamud dalamud, ClientStateAddressResolver addressResolver)
|
||||
internal ObjectTable(ClientStateAddressResolver addressResolver)
|
||||
{
|
||||
this.dalamud = dalamud;
|
||||
this.address = addressResolver;
|
||||
|
||||
Log.Verbose($"Object table address 0x{this.address.ObjectTable.ToInt64():X}");
|
||||
|
|
@ -99,7 +100,9 @@ namespace Dalamud.Game.ClientState.Objects
|
|||
[CanBeNull]
|
||||
public unsafe GameObject CreateObjectReference(IntPtr address)
|
||||
{
|
||||
if (this.dalamud.ClientState.LocalContentId == 0)
|
||||
var clientState = Service<ClientState>.Get();
|
||||
|
||||
if (clientState.LocalContentId == 0)
|
||||
return null;
|
||||
|
||||
if (address == IntPtr.Zero)
|
||||
|
|
@ -109,11 +112,11 @@ namespace Dalamud.Game.ClientState.Objects
|
|||
var objKind = (ObjectKind)obj->ObjectKind;
|
||||
return objKind switch
|
||||
{
|
||||
ObjectKind.Player => new PlayerCharacter(address, this.dalamud),
|
||||
ObjectKind.BattleNpc => new BattleNpc(address, this.dalamud),
|
||||
ObjectKind.EventObj => new EventObj(address, this.dalamud),
|
||||
ObjectKind.Companion => new Npc(address, this.dalamud),
|
||||
_ => new GameObject(address, this.dalamud),
|
||||
ObjectKind.Player => new PlayerCharacter(address),
|
||||
ObjectKind.BattleNpc => new BattleNpc(address),
|
||||
ObjectKind.EventObj => new EventObj(address),
|
||||
ObjectKind.Companion => new Npc(address),
|
||||
_ => new GameObject(address),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,8 @@ namespace Dalamud.Game.ClientState.Objects.Types
|
|||
/// Set up a new BattleNpc with the provided memory representation.
|
||||
/// </summary>
|
||||
/// <param name="address">The address of this actor in memory.</param>
|
||||
/// <param name="dalamud">A dalamud reference needed to access game data in Resolvers.</param>
|
||||
internal BattleNpc(IntPtr address, Dalamud dalamud)
|
||||
: base(address, dalamud)
|
||||
internal BattleNpc(IntPtr address)
|
||||
: base(address)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,8 @@ namespace Dalamud.Game.ClientState.Objects.SubKinds
|
|||
/// Set up a new EventObj with the provided memory representation.
|
||||
/// </summary>
|
||||
/// <param name="address">The address of this event object in memory.</param>
|
||||
/// <param name="dalamud">A dalamud reference.</param>
|
||||
internal EventObj(IntPtr address, Dalamud dalamud)
|
||||
: base(address, dalamud)
|
||||
internal EventObj(IntPtr address)
|
||||
: base(address)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,8 @@ namespace Dalamud.Game.ClientState.Objects.SubKinds
|
|||
/// Set up a new NPC with the provided memory representation.
|
||||
/// </summary>
|
||||
/// <param name="address">The address of this actor in memory.</param>
|
||||
/// <param name="dalamud">A dalamud reference needed to access game data in Resolvers.</param>
|
||||
internal Npc(IntPtr address, Dalamud dalamud)
|
||||
: base(address, dalamud)
|
||||
internal Npc(IntPtr address)
|
||||
: base(address)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,21 +15,20 @@ namespace Dalamud.Game.ClientState.Objects.SubKinds
|
|||
/// This represents a player character.
|
||||
/// </summary>
|
||||
/// <param name="address">The address of this actor in memory.</param>
|
||||
/// <param name="dalamud">A dalamud reference needed to access game data in Resolvers.</param>
|
||||
internal PlayerCharacter(IntPtr address, Dalamud dalamud)
|
||||
: base(address, dalamud)
|
||||
internal PlayerCharacter(IntPtr address)
|
||||
: base(address)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current <see cref="ExcelResolver{T}">world</see> of the character.
|
||||
/// </summary>
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.World> CurrentWorld => new(this.Struct->Character.CurrentWorld, this.Dalamud);
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.World> CurrentWorld => new(this.Struct->Character.CurrentWorld);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the home <see cref="ExcelResolver{T}">world</see> of the character.
|
||||
/// </summary>
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.World> HomeWorld => new(this.Struct->Character.HomeWorld, this.Dalamud);
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.World> HomeWorld => new(this.Struct->Character.HomeWorld);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the target actor ID of the PlayerCharacter.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Dalamud.Game.ClientState.Objects
|
||||
|
|
@ -8,19 +10,18 @@ namespace Dalamud.Game.ClientState.Objects
|
|||
/// <summary>
|
||||
/// Get and set various kinds of targets for the player.
|
||||
/// </summary>
|
||||
public sealed unsafe class Targets
|
||||
[PluginInterface]
|
||||
[InterfaceVersion("1.0")]
|
||||
public sealed unsafe class TargetManager
|
||||
{
|
||||
private readonly Dalamud dalamud;
|
||||
private readonly ClientStateAddressResolver address;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Targets"/> class.
|
||||
/// Initializes a new instance of the <see cref="TargetManager"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">The Dalamud instance.</param>
|
||||
/// <param name="addressResolver">The ClientStateAddressResolver instance.</param>
|
||||
internal Targets(Dalamud dalamud, ClientStateAddressResolver addressResolver)
|
||||
internal TargetManager(ClientStateAddressResolver addressResolver)
|
||||
{
|
||||
this.dalamud = dalamud;
|
||||
this.address = addressResolver;
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +36,7 @@ namespace Dalamud.Game.ClientState.Objects
|
|||
[CanBeNull]
|
||||
public GameObject Target
|
||||
{
|
||||
get => this.dalamud.ClientState.Objects.CreateObjectReference((IntPtr)Struct->Target);
|
||||
get => Service<ObjectTable>.Get().CreateObjectReference((IntPtr)Struct->Target);
|
||||
set => this.SetTarget(value);
|
||||
}
|
||||
|
||||
|
|
@ -45,7 +46,7 @@ namespace Dalamud.Game.ClientState.Objects
|
|||
[CanBeNull]
|
||||
public GameObject MouseOverTarget
|
||||
{
|
||||
get => this.dalamud.ClientState.Objects.CreateObjectReference((IntPtr)Struct->MouseOverTarget);
|
||||
get => Service<ObjectTable>.Get().CreateObjectReference((IntPtr)Struct->MouseOverTarget);
|
||||
set => this.SetMouseOverTarget(value);
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +56,7 @@ namespace Dalamud.Game.ClientState.Objects
|
|||
[CanBeNull]
|
||||
public GameObject FocusTarget
|
||||
{
|
||||
get => this.dalamud.ClientState.Objects.CreateObjectReference((IntPtr)Struct->FocusTarget);
|
||||
get => Service<ObjectTable>.Get().CreateObjectReference((IntPtr)Struct->FocusTarget);
|
||||
set => this.SetFocusTarget(value);
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +66,7 @@ namespace Dalamud.Game.ClientState.Objects
|
|||
[CanBeNull]
|
||||
public GameObject PreviousTarget
|
||||
{
|
||||
get => this.dalamud.ClientState.Objects.CreateObjectReference((IntPtr)Struct->PreviousTarget);
|
||||
get => Service<ObjectTable>.Get().CreateObjectReference((IntPtr)Struct->PreviousTarget);
|
||||
set => this.SetPreviousTarget(value);
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +76,7 @@ namespace Dalamud.Game.ClientState.Objects
|
|||
[CanBeNull]
|
||||
public GameObject SoftTarget
|
||||
{
|
||||
get => this.dalamud.ClientState.Objects.CreateObjectReference((IntPtr)Struct->SoftTarget);
|
||||
get => Service<ObjectTable>.Get().CreateObjectReference((IntPtr)Struct->SoftTarget);
|
||||
set => this.SetSoftTarget(value);
|
||||
}
|
||||
|
||||
|
|
@ -14,16 +14,15 @@ namespace Dalamud.Game.ClientState.Objects.Types
|
|||
/// This represents a battle character.
|
||||
/// </summary>
|
||||
/// <param name="address">The address of this character in memory.</param>
|
||||
/// <param name="dalamud">Dalamud itself.</param>
|
||||
internal BattleChara(IntPtr address, Dalamud dalamud)
|
||||
: base(address, dalamud)
|
||||
internal BattleChara(IntPtr address)
|
||||
: base(address)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current status effects.
|
||||
/// </summary>
|
||||
public StatusList StatusList => new(&this.Struct->StatusManager, this.Dalamud);
|
||||
public StatusList StatusList => new(&this.Struct->StatusManager);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the chara is currently casting.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using Dalamud.Game.ClientState.Objects.Enums;
|
|||
using Dalamud.Game.ClientState.Resolvers;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Memory;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Dalamud.Game.ClientState.Objects.Types
|
||||
{
|
||||
|
|
@ -18,9 +17,8 @@ namespace Dalamud.Game.ClientState.Objects.Types
|
|||
/// This represents a non-static entity.
|
||||
/// </summary>
|
||||
/// <param name="address">The address of this character in memory.</param>
|
||||
/// <param name="dalamud">Dalamud itself.</param>
|
||||
internal Character(IntPtr address, Dalamud dalamud)
|
||||
: base(address, dalamud)
|
||||
internal Character(IntPtr address)
|
||||
: base(address)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +65,7 @@ namespace Dalamud.Game.ClientState.Objects.Types
|
|||
/// <summary>
|
||||
/// Gets the ClassJob of this Chara.
|
||||
/// </summary>
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.ClassJob> ClassJob => new(this.Struct->ClassJob, this.Dalamud);
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.ClassJob> ClassJob => new(this.Struct->ClassJob);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the level of this Chara.
|
||||
|
|
|
|||
|
|
@ -17,11 +17,9 @@ namespace Dalamud.Game.ClientState.Objects.Types
|
|||
/// Initializes a new instance of the <see cref="GameObject"/> class.
|
||||
/// </summary>
|
||||
/// <param name="address">The address of this game object in memory.</param>
|
||||
/// <param name="dalamud">Dalamud itself.</param>
|
||||
internal GameObject(IntPtr address, Dalamud dalamud)
|
||||
internal GameObject(IntPtr address)
|
||||
{
|
||||
this.Address = address;
|
||||
this.Dalamud = dalamud;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -59,10 +57,12 @@ namespace Dalamud.Game.ClientState.Objects.Types
|
|||
/// <returns>True or false.</returns>
|
||||
public static bool IsValid(GameObject? actor)
|
||||
{
|
||||
var clientState = Service<ClientState>.Get();
|
||||
|
||||
if (actor is null)
|
||||
return false;
|
||||
|
||||
if (actor.Dalamud.ClientState.LocalContentId == 0)
|
||||
if (clientState.LocalContentId == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -158,7 +158,7 @@ namespace Dalamud.Game.ClientState.Objects.Types
|
|||
/// This iterates the actor table, it should be used with care.
|
||||
/// </remarks>
|
||||
[CanBeNull]
|
||||
public virtual GameObject TargetObject => this.Dalamud.ClientState.Objects.SearchByID(this.TargetObjectId);
|
||||
public virtual GameObject TargetObject => Service<ObjectTable>.Get().SearchByID(this.TargetObjectId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the underlying structure.
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using JetBrains.Annotations;
|
||||
using Serilog;
|
||||
|
||||
|
|
@ -11,22 +13,21 @@ namespace Dalamud.Game.ClientState.Party
|
|||
/// <summary>
|
||||
/// This collection represents the actors present in your party or alliance.
|
||||
/// </summary>
|
||||
[PluginInterface]
|
||||
[InterfaceVersion("1.0")]
|
||||
public sealed unsafe partial class PartyList
|
||||
{
|
||||
private const int GroupLength = 8;
|
||||
private const int AllianceLength = 20;
|
||||
|
||||
private readonly Dalamud dalamud;
|
||||
private readonly ClientStateAddressResolver address;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PartyList"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">The <see cref="dalamud"/> instance.</param>
|
||||
/// <param name="addressResolver">Client state address resolver.</param>
|
||||
internal PartyList(Dalamud dalamud, ClientStateAddressResolver addressResolver)
|
||||
internal PartyList(ClientStateAddressResolver addressResolver)
|
||||
{
|
||||
this.dalamud = dalamud;
|
||||
this.address = addressResolver;
|
||||
|
||||
Log.Verbose($"Group manager address 0x{this.address.GroupManager.ToInt64():X}");
|
||||
|
|
@ -114,13 +115,15 @@ namespace Dalamud.Game.ClientState.Party
|
|||
[CanBeNull]
|
||||
public PartyMember CreatePartyMemberReference(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 PartyMember(address, this.dalamud);
|
||||
return new PartyMember(address);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -144,13 +147,15 @@ namespace Dalamud.Game.ClientState.Party
|
|||
[CanBeNull]
|
||||
public PartyMember CreateAllianceMemberReference(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 PartyMember(address, this.dalamud);
|
||||
return new PartyMember(address);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Game.ClientState.Resolvers;
|
||||
using Dalamud.Game.ClientState.Statuses;
|
||||
|
|
@ -15,17 +16,13 @@ namespace Dalamud.Game.ClientState.Party
|
|||
/// </summary>
|
||||
public unsafe class PartyMember
|
||||
{
|
||||
private Dalamud dalamud;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PartyMember"/> class.
|
||||
/// </summary>
|
||||
/// <param name="address">Address of the party member.</param>
|
||||
/// <param name="dalamud">Dalamud itself.</param>
|
||||
internal PartyMember(IntPtr address, Dalamud dalamud)
|
||||
internal PartyMember(IntPtr address)
|
||||
{
|
||||
this.Address = address;
|
||||
this.dalamud = dalamud;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -36,7 +33,7 @@ namespace Dalamud.Game.ClientState.Party
|
|||
/// <summary>
|
||||
/// Gets a list of buffs or debuffs applied to this party member.
|
||||
/// </summary>
|
||||
public StatusList Statuses => new(&this.Struct->StatusManager, this.dalamud);
|
||||
public StatusList Statuses => new(&this.Struct->StatusManager);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the position of the party member.
|
||||
|
|
@ -60,7 +57,7 @@ namespace Dalamud.Game.ClientState.Party
|
|||
/// This iterates the actor table, it should be used with care.
|
||||
/// </remarks>
|
||||
[CanBeNull]
|
||||
public GameObject GameObject => this.dalamud.ClientState.Objects.SearchByID(this.ObjectId);
|
||||
public GameObject GameObject => Service<ObjectTable>.Get().SearchByID(this.ObjectId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current HP of this party member.
|
||||
|
|
@ -85,12 +82,12 @@ namespace Dalamud.Game.ClientState.Party
|
|||
/// <summary>
|
||||
/// Gets the territory this party member is located in.
|
||||
/// </summary>
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.TerritoryType> Territory => new(this.Struct->TerritoryType, this.dalamud);
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.TerritoryType> Territory => new(this.Struct->TerritoryType);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the World this party member resides in.
|
||||
/// </summary>
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.World> World => new(this.Struct->HomeWorld, this.dalamud);
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.World> World => new(this.Struct->HomeWorld);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the displayname of this party member.
|
||||
|
|
@ -105,7 +102,7 @@ namespace Dalamud.Game.ClientState.Party
|
|||
/// <summary>
|
||||
/// Gets the classjob of this party member.
|
||||
/// </summary>
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.ClassJob> ClassJob => new(this.Struct->ClassJob, this.dalamud);
|
||||
public ExcelResolver<Lumina.Excel.GeneratedSheets.ClassJob> ClassJob => new(this.Struct->ClassJob);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the level of this party member.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using Dalamud.Data;
|
||||
using Lumina.Excel;
|
||||
|
||||
namespace Dalamud.Game.ClientState.Resolvers
|
||||
|
|
@ -8,16 +9,12 @@ namespace Dalamud.Game.ClientState.Resolvers
|
|||
/// <typeparam name="T">The type of Lumina sheet to resolve.</typeparam>
|
||||
public class ExcelResolver<T> where T : ExcelRow
|
||||
{
|
||||
private readonly Dalamud dalamud;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ExcelResolver{T}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the classJob.</param>
|
||||
/// <param name="dalamud">The Dalamud instance.</param>
|
||||
internal ExcelResolver(uint id, Dalamud dalamud)
|
||||
internal ExcelResolver(uint id)
|
||||
{
|
||||
this.dalamud = dalamud;
|
||||
this.Id = id;
|
||||
}
|
||||
|
||||
|
|
@ -29,6 +26,6 @@ namespace Dalamud.Game.ClientState.Resolvers
|
|||
/// <summary>
|
||||
/// Gets GameData linked to this excel row.
|
||||
/// </summary>
|
||||
public T GameData => this.dalamud.Data.GetExcelSheet<T>().GetRow(this.Id);
|
||||
public T GameData => Service<DataManager>.Get().GetExcelSheet<T>().GetRow(this.Id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Game.ClientState.Resolvers;
|
||||
using JetBrains.Annotations;
|
||||
|
|
@ -11,16 +12,12 @@ namespace Dalamud.Game.ClientState.Statuses
|
|||
/// </summary>
|
||||
public unsafe class Status
|
||||
{
|
||||
private Dalamud dalamud;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Status"/> class.
|
||||
/// </summary>
|
||||
/// <param name="address">Status address.</param>
|
||||
/// <param name="dalamud">Dalamud instance.</param>
|
||||
internal Status(IntPtr address, Dalamud dalamud)
|
||||
internal Status(IntPtr address)
|
||||
{
|
||||
this.dalamud = dalamud;
|
||||
this.Address = address;
|
||||
}
|
||||
|
||||
|
|
@ -37,7 +34,7 @@ namespace Dalamud.Game.ClientState.Statuses
|
|||
/// <summary>
|
||||
/// Gets the GameData associated with this status.
|
||||
/// </summary>
|
||||
public Lumina.Excel.GeneratedSheets.Status GameData => new ExcelResolver<Lumina.Excel.GeneratedSheets.Status>(this.Struct->StatusID, this.dalamud).GameData;
|
||||
public Lumina.Excel.GeneratedSheets.Status GameData => new ExcelResolver<Lumina.Excel.GeneratedSheets.Status>(this.Struct->StatusID).GameData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the parameter value of the status.
|
||||
|
|
@ -66,7 +63,7 @@ namespace Dalamud.Game.ClientState.Statuses
|
|||
/// This iterates the actor table, it should be used with care.
|
||||
/// </remarks>
|
||||
[CanBeNull]
|
||||
public GameObject SourceActor => this.dalamud.ClientState.Objects.SearchByID(this.SourceID);
|
||||
public GameObject SourceObject => Service<ObjectTable>.Get().SearchByID(this.SourceID);
|
||||
|
||||
private FFXIVClientStructs.FFXIV.Client.Game.Status* Struct => (FFXIVClientStructs.FFXIV.Client.Game.Status*)this.Address;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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