use index from gameobject to set set temp mods

This commit is contained in:
Stanley Dimant
2023-03-23 11:17:53 +01:00
parent 814b24ebd8
commit 9a049c0d01
6 changed files with 23 additions and 73 deletions

View File

@@ -1,4 +1,5 @@
using System.Text.Json;
using Dalamud.Game.ClientState.Objects.Types;
using System.Text.Json;
namespace MareSynchronos.Utils;
@@ -8,4 +9,14 @@ public static class VariousExtensions
{
return JsonSerializer.Deserialize<T>(JsonSerializer.Serialize(obj))!;
}
public static unsafe int? ObjectTableIndex(this GameObject? gameObject)
{
if (gameObject == null || gameObject.Address == IntPtr.Zero)
{
return null;
}
return ((FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)gameObject.Address)->ObjectIndex;
}
}