23 lines
		
	
	
		
			595 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			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;
 | |
|     }
 | |
| }
 | 
