adapt pointers to framework stuff

This commit is contained in:
Stanley Dimant
2023-04-26 10:31:20 +02:00
parent 46c58c6cfd
commit c9aa890f08
4 changed files with 26 additions and 11 deletions

View File

@@ -88,7 +88,12 @@ public class DalamudUtilService : IHostedService
return (Dalamud.Game.ClientState.Objects.Types.Character)objTableObj;
}
public unsafe IntPtr GetCompanion(IntPtr? playerPointer = null)
public async Task<IntPtr> GetCompanion(IntPtr? playerPointer = null)
{
return await RunOnFrameworkThread(() => GetCompanionInternal(playerPointer));
}
private unsafe IntPtr GetCompanionInternal(IntPtr? playerPointer = null)
{
var mgr = CharacterManager.Instance();
playerPointer ??= PlayerPointer;
@@ -108,7 +113,12 @@ public class DalamudUtilService : IHostedService
return _objectTable.GetObjectAddress(((GameObject*)playerPointer)->ObjectIndex + 1);
}
public unsafe IntPtr GetPet(IntPtr? playerPointer = null)
public async Task<IntPtr> GetPet(IntPtr? playerPointer = null)
{
return await RunOnFrameworkThread(() => GetPetInternal(playerPointer));
}
private unsafe IntPtr GetPetInternal(IntPtr? playerPointer = null)
{
if (ClassJobIdsIgnoredForPets.Contains(_classJobId ?? 0)) return IntPtr.Zero;
var mgr = CharacterManager.Instance();