mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 06:13:40 +01:00
Use AtkUnitBasePtr on IGameGui.GetAddonByName
This commit is contained in:
parent
4cc3d4b3e0
commit
59003f8cd5
2 changed files with 10 additions and 8 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
using Dalamud.Game.Gui.NativeWrapper;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
using Dalamud.Hooking;
|
using Dalamud.Hooking;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
|
|
@ -181,21 +182,21 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IntPtr GetAddonByName(string name, int index = 1)
|
public AtkUnitBasePtr GetAddonByName(string name, int index = 1)
|
||||||
{
|
{
|
||||||
var atkStage = AtkStage.Instance();
|
var atkStage = AtkStage.Instance();
|
||||||
if (atkStage == null)
|
if (atkStage == null)
|
||||||
return IntPtr.Zero;
|
return 0;
|
||||||
|
|
||||||
var unitMgr = atkStage->RaptureAtkUnitManager;
|
var unitMgr = atkStage->RaptureAtkUnitManager;
|
||||||
if (unitMgr == null)
|
if (unitMgr == null)
|
||||||
return IntPtr.Zero;
|
return 0;
|
||||||
|
|
||||||
var addon = unitMgr->GetAddonByName(name, index);
|
var addon = unitMgr->GetAddonByName(name, index);
|
||||||
if (addon == null)
|
if (addon == null)
|
||||||
return IntPtr.Zero;
|
return 0;
|
||||||
|
|
||||||
return (IntPtr)addon;
|
return (nint)addon;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|
@ -458,7 +459,7 @@ internal class GameGuiPluginScoped : IInternalDisposableService, IGameGui
|
||||||
=> this.gameGuiService.GetUIModule();
|
=> this.gameGuiService.GetUIModule();
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IntPtr GetAddonByName(string name, int index = 1)
|
public AtkUnitBasePtr GetAddonByName(string name, int index = 1)
|
||||||
=> this.gameGuiService.GetAddonByName(name, index);
|
=> this.gameGuiService.GetAddonByName(name, index);
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
|
using Dalamud.Game.Gui.NativeWrapper;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
|
|
||||||
namespace Dalamud.Plugin.Services;
|
namespace Dalamud.Plugin.Services;
|
||||||
|
|
@ -86,7 +87,7 @@ public unsafe interface IGameGui
|
||||||
/// <param name="name">Name of addon to find.</param>
|
/// <param name="name">Name of addon to find.</param>
|
||||||
/// <param name="index">Index of addon to find (1-indexed).</param>
|
/// <param name="index">Index of addon to find (1-indexed).</param>
|
||||||
/// <returns>nint.Zero if unable to find UI, otherwise nint pointing to the start of the addon.</returns>
|
/// <returns>nint.Zero if unable to find UI, otherwise nint pointing to the start of the addon.</returns>
|
||||||
public nint GetAddonByName(string name, int index = 1);
|
public AtkUnitBasePtr GetAddonByName(string name, int index = 1);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Find the agent associated with an addon, if possible.
|
/// Find the agent associated with an addon, if possible.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue