2
									
								
								MareAPI
									
									
									
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								MareAPI
									
									
									
									
									
								
							 Submodule MareAPI updated: 9dc1e901aa...9bb99a5e68
									
								
							| @@ -277,8 +277,6 @@ public class CharacterDataFactory | |||||||
|             { |             { | ||||||
|                 Logger.Warn("Could not get Legacy Body Decal Data"); |                 Logger.Warn("Could not get Legacy Body Decal Data"); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             previousData.HeelsOffset = _ipcManager.GetHeelsOffset(); |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         st.Stop(); |         st.Stop(); | ||||||
|   | |||||||
| @@ -3,10 +3,12 @@ using System.Collections.Generic; | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using System.Threading; | using System.Threading; | ||||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||||
|  | using Dalamud.Game.ClientState.Objects.SubKinds; | ||||||
| using Dalamud.Logging; | using Dalamud.Logging; | ||||||
| using FFXIVClientStructs.FFXIV.Client.Game.Character; | using FFXIVClientStructs.FFXIV.Client.Game.Character; | ||||||
| using MareSynchronos.API; | using MareSynchronos.API; | ||||||
| using MareSynchronos.FileCacheDB; | using MareSynchronos.FileCacheDB; | ||||||
|  | using MareSynchronos.Interop; | ||||||
| using MareSynchronos.Models; | using MareSynchronos.Models; | ||||||
| using MareSynchronos.Utils; | using MareSynchronos.Utils; | ||||||
| using MareSynchronos.WebAPI; | using MareSynchronos.WebAPI; | ||||||
| @@ -114,17 +116,6 @@ public class CachedPlayer | |||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (objectKind == ObjectKind.Player) |  | ||||||
|             { |  | ||||||
|                 bool heelsOffsetDifferent = _cachedData.HeelsOffset != characterData.HeelsOffset; |  | ||||||
|                 if (heelsOffsetDifferent) |  | ||||||
|                 { |  | ||||||
|                     Logger.Debug("Updating " + objectKind); |  | ||||||
|                     charaDataToUpdate.Add(objectKind); |  | ||||||
|                     continue; |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         _cachedData = characterData; |         _cachedData = characterData; | ||||||
| @@ -241,7 +232,6 @@ public class CachedPlayer | |||||||
|         if (objectKind == ObjectKind.Player) |         if (objectKind == ObjectKind.Player) | ||||||
|         { |         { | ||||||
|             _dalamudUtil.WaitWhileCharacterIsDrawing(PlayerCharacter); |             _dalamudUtil.WaitWhileCharacterIsDrawing(PlayerCharacter); | ||||||
|             _ipcManager.HeelsSetOffsetForPlayer(_cachedData.HeelsOffset, PlayerCharacter); |  | ||||||
|             RequestedPenumbraRedraw = true; |             RequestedPenumbraRedraw = true; | ||||||
|             Logger.Debug( |             Logger.Debug( | ||||||
|                 $"Request Redraw for {PlayerName}"); |                 $"Request Redraw for {PlayerName}"); | ||||||
| @@ -319,8 +309,6 @@ public class CachedPlayer | |||||||
|             { |             { | ||||||
|                 _ipcManager.PenumbraRedraw(PlayerCharacter); |                 _ipcManager.PenumbraRedraw(PlayerCharacter); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             _ipcManager.HeelsRestoreOffsetForPlayer(PlayerCharacter); |  | ||||||
|         } |         } | ||||||
|         else if (objectKind == ObjectKind.MinionOrMount) |         else if (objectKind == ObjectKind.MinionOrMount) | ||||||
|         { |         { | ||||||
|   | |||||||
| @@ -11,7 +11,6 @@ using System.Collections.Concurrent; | |||||||
| namespace MareSynchronos.Managers | namespace MareSynchronos.Managers | ||||||
| { | { | ||||||
|     public delegate void PenumbraRedrawEvent(IntPtr address, int objTblIdx); |     public delegate void PenumbraRedrawEvent(IntPtr address, int objTblIdx); | ||||||
|     public delegate void HeelsOffsetChange(float change); |  | ||||||
|     public class IpcManager : IDisposable |     public class IpcManager : IDisposable | ||||||
|     { |     { | ||||||
|         private readonly ICallGateSubscriber<int> _glamourerApiVersion; |         private readonly ICallGateSubscriber<int> _glamourerApiVersion; | ||||||
| @@ -34,13 +33,6 @@ namespace MareSynchronos.Managers | |||||||
|         private readonly ICallGateSubscriber<string, string[]>? _reverseResolvePlayer; |         private readonly ICallGateSubscriber<string, string[]>? _reverseResolvePlayer; | ||||||
|         private readonly ICallGateSubscriber<string, string, Dictionary<string, string>, string, int, int> |         private readonly ICallGateSubscriber<string, string, Dictionary<string, string>, string, int, int> | ||||||
|             _penumbraSetTemporaryMod; |             _penumbraSetTemporaryMod; | ||||||
|  |  | ||||||
|         private readonly ICallGateSubscriber<string> _heelsGetApiVersion; |  | ||||||
|         private readonly ICallGateSubscriber<float> _heelsGetOffset; |  | ||||||
|         private readonly ICallGateSubscriber<float, object?> _heelsOffsetUpdate; |  | ||||||
|         private readonly ICallGateSubscriber<GameObject, float, object?> _heelsRegisterPlayer; |  | ||||||
|         private readonly ICallGateSubscriber<GameObject, object?> _heelsUnregisterPlayer; |  | ||||||
|  |  | ||||||
|         private readonly DalamudUtil _dalamudUtil; |         private readonly DalamudUtil _dalamudUtil; | ||||||
|         private readonly ConcurrentQueue<Action> actionQueue = new(); |         private readonly ConcurrentQueue<Action> actionQueue = new(); | ||||||
|  |  | ||||||
| @@ -81,15 +73,6 @@ namespace MareSynchronos.Managers | |||||||
|             _penumbraRemoveTemporaryCollection = |             _penumbraRemoveTemporaryCollection = | ||||||
|                 pi.GetIpcSubscriber<string, int>("Penumbra.RemoveTemporaryCollection"); |                 pi.GetIpcSubscriber<string, int>("Penumbra.RemoveTemporaryCollection"); | ||||||
|  |  | ||||||
|             _heelsGetApiVersion = pi.GetIpcSubscriber<string>("HeelsPlugin.ApiVersion"); |  | ||||||
|             _heelsGetOffset = pi.GetIpcSubscriber<float>("HeelsPlugin.GetOffset"); |  | ||||||
|             _heelsRegisterPlayer = pi.GetIpcSubscriber<GameObject, float, object?>("HeelsPlugin.RegisterPlayer"); |  | ||||||
|             _heelsUnregisterPlayer = pi.GetIpcSubscriber<GameObject, object?>("HeelsPlugin.UnregisterPlayer"); |  | ||||||
|             _heelsOffsetUpdate = pi.GetIpcSubscriber<float, object?>("HeelsPlugin.OffsetChanged"); |  | ||||||
|  |  | ||||||
|             _heelsOffsetUpdate.Subscribe(HeelsOffsetChange); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|             if (Initialized) |             if (Initialized) | ||||||
|             { |             { | ||||||
|                 PenumbraInitialized?.Invoke(); |                 PenumbraInitialized?.Invoke(); | ||||||
| @@ -112,7 +95,6 @@ namespace MareSynchronos.Managers | |||||||
|         public event VoidDelegate? PenumbraInitialized; |         public event VoidDelegate? PenumbraInitialized; | ||||||
|         public event VoidDelegate? PenumbraDisposed; |         public event VoidDelegate? PenumbraDisposed; | ||||||
|         public event PenumbraRedrawEvent? PenumbraRedrawEvent; |         public event PenumbraRedrawEvent? PenumbraRedrawEvent; | ||||||
|         public event HeelsOffsetChange? HeelsOffsetChangeEvent; |  | ||||||
|  |  | ||||||
|         public bool Initialized => CheckPenumbraApi(); |         public bool Initialized => CheckPenumbraApi(); | ||||||
|         public bool CheckGlamourerApi() |         public bool CheckGlamourerApi() | ||||||
| @@ -139,18 +121,6 @@ namespace MareSynchronos.Managers | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public bool CheckHeelsApi() |  | ||||||
|         { |  | ||||||
|             try |  | ||||||
|             { |  | ||||||
|                 return _heelsGetApiVersion.InvokeFunc() == "1.0.1"; |  | ||||||
|             }  |  | ||||||
|             catch |  | ||||||
|             { |  | ||||||
|                 return false; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         public void Dispose() |         public void Dispose() | ||||||
|         { |         { | ||||||
|             Logger.Verbose("Disposing " + nameof(IpcManager)); |             Logger.Verbose("Disposing " + nameof(IpcManager)); | ||||||
| @@ -161,41 +131,6 @@ namespace MareSynchronos.Managers | |||||||
|             _penumbraDispose.Unsubscribe(PenumbraDispose); |             _penumbraDispose.Unsubscribe(PenumbraDispose); | ||||||
|             _penumbraInit.Unsubscribe(PenumbraInit); |             _penumbraInit.Unsubscribe(PenumbraInit); | ||||||
|             _penumbraObjectIsRedrawn.Unsubscribe(RedrawEvent); |             _penumbraObjectIsRedrawn.Unsubscribe(RedrawEvent); | ||||||
|             _heelsOffsetUpdate.Unsubscribe(HeelsOffsetChange); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         public float GetHeelsOffset() |  | ||||||
|         { |  | ||||||
|             if (!CheckHeelsApi()) return 0.0f; |  | ||||||
|             return _heelsGetOffset.InvokeFunc(); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         public void HeelsSetOffsetForPlayer(float offset, IntPtr character) |  | ||||||
|         { |  | ||||||
|             if(!CheckHeelsApi()) return; |  | ||||||
|             actionQueue.Enqueue(() => |  | ||||||
|             { |  | ||||||
|                 var gameObj = _dalamudUtil.CreateGameObject(character); |  | ||||||
|                 if (gameObj != null) |  | ||||||
|                 { |  | ||||||
|                     Logger.Verbose("Applying Heels data to " + character.ToString("X")); |  | ||||||
|                     _heelsRegisterPlayer.InvokeAction(gameObj, offset); |  | ||||||
|                 } |  | ||||||
|             }); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         public void HeelsRestoreOffsetForPlayer(IntPtr character) |  | ||||||
|         { |  | ||||||
|             if (!CheckHeelsApi()) return; |  | ||||||
|             actionQueue.Enqueue(() => |  | ||||||
|             { |  | ||||||
|                 var gameObj = _dalamudUtil.CreateGameObject(character); |  | ||||||
|                 if (gameObj != null) |  | ||||||
|                 { |  | ||||||
|                     Logger.Verbose("Restoring Heels data to " + character.ToString("X")); |  | ||||||
|                     _heelsUnregisterPlayer.InvokeAction(gameObj); |  | ||||||
|                 } |  | ||||||
|             }); |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public void GlamourerApplyAll(string? customization, IntPtr obj) |         public void GlamourerApplyAll(string? customization, IntPtr obj) | ||||||
| @@ -345,11 +280,6 @@ namespace MareSynchronos.Managers | |||||||
|             }); |             }); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         private void HeelsOffsetChange(float offset) |  | ||||||
|         { |  | ||||||
|             HeelsOffsetChangeEvent?.Invoke(offset); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         private void RedrawEvent(IntPtr objectAddress, int objectTableIndex) |         private void RedrawEvent(IntPtr objectAddress, int objectTableIndex) | ||||||
|         { |         { | ||||||
|             PenumbraRedrawEvent?.Invoke(objectAddress, objectTableIndex); |             PenumbraRedrawEvent?.Invoke(objectAddress, objectTableIndex); | ||||||
|   | |||||||
| @@ -42,7 +42,6 @@ namespace MareSynchronos.Managers | |||||||
|             _apiController.Connected += ApiControllerOnConnected; |             _apiController.Connected += ApiControllerOnConnected; | ||||||
|             _apiController.Disconnected += ApiController_Disconnected; |             _apiController.Disconnected += ApiController_Disconnected; | ||||||
|             _dalamudUtil.DelayedFrameworkUpdate += DalamudUtilOnDelayedFrameworkUpdate; |             _dalamudUtil.DelayedFrameworkUpdate += DalamudUtilOnDelayedFrameworkUpdate; | ||||||
|             _ipcManager.HeelsOffsetChangeEvent += HeelsOffsetChanged; |  | ||||||
|  |  | ||||||
|             Logger.Debug("Watching Player, ApiController is Connected: " + _apiController.IsConnected); |             Logger.Debug("Watching Player, ApiController is Connected: " + _apiController.IsConnected); | ||||||
|             if (_apiController.IsConnected) |             if (_apiController.IsConnected) | ||||||
| @@ -59,16 +58,6 @@ namespace MareSynchronos.Managers | |||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         private void HeelsOffsetChanged(float change) |  | ||||||
|         { |  | ||||||
|             var player = playerRelatedObjects.First(f => f.ObjectKind == ObjectKind.Player); |  | ||||||
|             if (LastCreatedCharacterData != null && LastCreatedCharacterData.HeelsOffset != change && !player.IsProcessing) |  | ||||||
|             { |  | ||||||
|                 Logger.Debug("Heels offset changed to " + change); |  | ||||||
|                 playerRelatedObjects.First(f => f.ObjectKind == ObjectKind.Player).HasUnprocessedUpdate = true; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         public void Dispose() |         public void Dispose() | ||||||
|         { |         { | ||||||
|             Logger.Verbose("Disposing " + nameof(PlayerManager)); |             Logger.Verbose("Disposing " + nameof(PlayerManager)); | ||||||
| @@ -78,7 +67,6 @@ namespace MareSynchronos.Managers | |||||||
|  |  | ||||||
|             _ipcManager.PenumbraRedrawEvent -= IpcManager_PenumbraRedrawEvent; |             _ipcManager.PenumbraRedrawEvent -= IpcManager_PenumbraRedrawEvent; | ||||||
|             _dalamudUtil.DelayedFrameworkUpdate -= DalamudUtilOnDelayedFrameworkUpdate; |             _dalamudUtil.DelayedFrameworkUpdate -= DalamudUtilOnDelayedFrameworkUpdate; | ||||||
|             _ipcManager.HeelsOffsetChangeEvent -= HeelsOffsetChanged; |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         private unsafe void DalamudUtilOnDelayedFrameworkUpdate() |         private unsafe void DalamudUtilOnDelayedFrameworkUpdate() | ||||||
|   | |||||||
| @@ -20,9 +20,6 @@ namespace MareSynchronos.Models | |||||||
|         [JsonProperty] |         [JsonProperty] | ||||||
|         public string ManipulationString { get; set; } = string.Empty; |         public string ManipulationString { get; set; } = string.Empty; | ||||||
|  |  | ||||||
|         [JsonProperty] |  | ||||||
|         public float HeelsOffset { get; set; } = 0.0f; |  | ||||||
|  |  | ||||||
|         public void AddFileReplacement(ObjectKind objectKind, FileReplacement fileReplacement) |         public void AddFileReplacement(ObjectKind objectKind, FileReplacement fileReplacement) | ||||||
|         { |         { | ||||||
|             if (!fileReplacement.HasFileReplacement) return; |             if (!fileReplacement.HasFileReplacement) return; | ||||||
| @@ -53,8 +50,7 @@ namespace MareSynchronos.Models | |||||||
|                     }; |                     }; | ||||||
|                 }).ToList()), |                 }).ToList()), | ||||||
|                 GlamourerData = GlamourerString.ToDictionary(d => d.Key, d => d.Value), |                 GlamourerData = GlamourerString.ToDictionary(d => d.Key, d => d.Value), | ||||||
|                 ManipulationData = ManipulationString, |                 ManipulationData = ManipulationString | ||||||
|                 HeelsOffset = HeelsOffset |  | ||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -114,11 +114,9 @@ namespace MareSynchronos.UI | |||||||
|         { |         { | ||||||
|             var penumbraExists = _ipcManager.CheckPenumbraApi(); |             var penumbraExists = _ipcManager.CheckPenumbraApi(); | ||||||
|             var glamourerExists = _ipcManager.CheckGlamourerApi(); |             var glamourerExists = _ipcManager.CheckGlamourerApi(); | ||||||
|             var heelsExists = _ipcManager.CheckHeelsApi(); |  | ||||||
|  |  | ||||||
|             var penumbraColor = penumbraExists ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed; |             var penumbraColor = penumbraExists ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed; | ||||||
|             var glamourerColor = glamourerExists ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed; |             var glamourerColor = glamourerExists ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed; | ||||||
|             var heelsColor = heelsExists ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed; |  | ||||||
|             ImGui.Text("Penumbra:"); |             ImGui.Text("Penumbra:"); | ||||||
|             ImGui.SameLine(); |             ImGui.SameLine(); | ||||||
|             ImGui.TextColored(penumbraColor, penumbraExists ? "Available" : "Unavailable"); |             ImGui.TextColored(penumbraColor, penumbraExists ? "Available" : "Unavailable"); | ||||||
| @@ -126,11 +124,6 @@ namespace MareSynchronos.UI | |||||||
|             ImGui.Text("Glamourer:"); |             ImGui.Text("Glamourer:"); | ||||||
|             ImGui.SameLine(); |             ImGui.SameLine(); | ||||||
|             ImGui.TextColored(glamourerColor, glamourerExists ? "Available" : "Unavailable"); |             ImGui.TextColored(glamourerColor, glamourerExists ? "Available" : "Unavailable"); | ||||||
|             ImGui.Text("Optional Addons | "); |  | ||||||
|             ImGui.SameLine(); |  | ||||||
|             ImGui.Text("Heels:"); |  | ||||||
|             ImGui.SameLine(); |  | ||||||
|             ImGui.TextColored(heelsColor, heelsExists ? "Available" : "Unavailable"); |  | ||||||
|  |  | ||||||
|             if (!penumbraExists || !glamourerExists) |             if (!penumbraExists || !glamourerExists) | ||||||
|             { |             { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stanley Dimant
					Stanley Dimant