Files
ClubPenguinClient/MareSynchronos/Utils/VariousExtensions.cs
2023-03-23 11:17:53 +01:00

23 lines
595 B
C#

using Dalamud.Game.ClientState.Objects.Types;
using System.Text.Json;
namespace MareSynchronos.Utils;
public static class VariousExtensions
{
public static T DeepClone<T>(this T obj)
{
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;
}
}