diff --git a/XivCommon/GameFunctions.cs b/XivCommon/GameFunctions.cs index d49124c..a580ef1 100755 --- a/XivCommon/GameFunctions.cs +++ b/XivCommon/GameFunctions.cs @@ -21,6 +21,8 @@ namespace XivCommon { private delegate IntPtr GetAgentModuleDelegate(IntPtr basePtr); + private delegate IntPtr GetAtkModuleDelegate(IntPtr uiModule); + private delegate IntPtr GetAgentByInternalIdDelegate(IntPtr agentModule, uint id); private DalamudPluginInterface Interface { get; } @@ -114,6 +116,30 @@ namespace XivCommon { return this.Interface.Framework.Gui.GetUIModule(); } + /// + /// Gets the pointer to the RaptureAtkModule + /// + /// + public IntPtr GetAtkModule() { + var uiModule = this.GetUiModule(); + if (uiModule == IntPtr.Zero) { + return IntPtr.Zero; + } + + var vtbl = Marshal.ReadIntPtr(uiModule); + if (vtbl == IntPtr.Zero) { + return IntPtr.Zero; + } + + var getAtkModulePtr = Marshal.ReadIntPtr(vtbl + 0x38); + if (getAtkModulePtr == IntPtr.Zero) { + return IntPtr.Zero; + } + + var getAtkModule = Marshal.GetDelegateForFunctionPointer(getAtkModulePtr); + return getAtkModule(uiModule); + } + /// /// Gets the pointer to the agent module ///