fix contextmenu etc

This commit is contained in:
Stanley Dimant
2024-07-17 21:29:53 +02:00
parent b9cf7eb6fa
commit bfafcad8e8
16 changed files with 101 additions and 78 deletions

View File

@@ -1,5 +1,4 @@
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Plugin;
using Dalamud.Plugin.Ipc;
using MareSynchronos.Services;
@@ -12,12 +11,12 @@ namespace MareSynchronos.Interop.Ipc;
public sealed class IpcCallerHonorific : IIpcCaller
{
private readonly ICallGateSubscriber<(uint major, uint minor)> _honorificApiVersion;
private readonly ICallGateSubscriber<ICharacter, object> _honorificClearCharacterTitle;
private readonly ICallGateSubscriber<int, object> _honorificClearCharacterTitle;
private readonly ICallGateSubscriber<object> _honorificDisposing;
private readonly ICallGateSubscriber<string> _honorificGetLocalCharacterTitle;
private readonly ICallGateSubscriber<string, object> _honorificLocalCharacterTitleChanged;
private readonly ICallGateSubscriber<object> _honorificReady;
private readonly ICallGateSubscriber<ICharacter, string, object> _honorificSetCharacterTitle;
private readonly ICallGateSubscriber<int, string, object> _honorificSetCharacterTitle;
private readonly ILogger<IpcCallerHonorific> _logger;
private readonly MareMediator _mareMediator;
private readonly DalamudUtilService _dalamudUtil;
@@ -30,8 +29,8 @@ public sealed class IpcCallerHonorific : IIpcCaller
_dalamudUtil = dalamudUtil;
_honorificApiVersion = pi.GetIpcSubscriber<(uint, uint)>("Honorific.ApiVersion");
_honorificGetLocalCharacterTitle = pi.GetIpcSubscriber<string>("Honorific.GetLocalCharacterTitle");
_honorificClearCharacterTitle = pi.GetIpcSubscriber<ICharacter, object>("Honorific.ClearCharacterTitle");
_honorificSetCharacterTitle = pi.GetIpcSubscriber<ICharacter, string, object>("Honorific.SetCharacterTitle");
_honorificClearCharacterTitle = pi.GetIpcSubscriber<int, object>("Honorific.ClearCharacterTitle");
_honorificSetCharacterTitle = pi.GetIpcSubscriber<int, string, object>("Honorific.SetCharacterTitle");
_honorificLocalCharacterTitleChanged = pi.GetIpcSubscriber<string, object>("Honorific.LocalCharacterTitleChanged");
_honorificDisposing = pi.GetIpcSubscriber<object>("Honorific.Disposing");
_honorificReady = pi.GetIpcSubscriber<object>("Honorific.Ready");
@@ -49,7 +48,7 @@ public sealed class IpcCallerHonorific : IIpcCaller
{
try
{
APIAvailable = _honorificApiVersion.InvokeFunc() is { Item1: 2, Item2: >= 0 };
APIAvailable = _honorificApiVersion.InvokeFunc() is { Item1: 3, Item2: >= 1 };
}
catch
{
@@ -73,7 +72,7 @@ public sealed class IpcCallerHonorific : IIpcCaller
if (gameObj is IPlayerCharacter c)
{
_logger.LogTrace("Honorific removing for {addr}", c.Address.ToString("X"));
_honorificClearCharacterTitle!.InvokeAction(c);
_honorificClearCharacterTitle!.InvokeAction(c.ObjectIndex);
}
}).ConfigureAwait(false);
}
@@ -99,11 +98,11 @@ public sealed class IpcCallerHonorific : IIpcCaller
string honorificData = string.IsNullOrEmpty(honorificDataB64) ? string.Empty : Encoding.UTF8.GetString(Convert.FromBase64String(honorificDataB64));
if (string.IsNullOrEmpty(honorificData))
{
_honorificClearCharacterTitle!.InvokeAction(pc);
_honorificClearCharacterTitle!.InvokeAction(pc.ObjectIndex);
}
else
{
_honorificSetCharacterTitle!.InvokeAction(pc, honorificData);
_honorificSetCharacterTitle!.InvokeAction(pc.ObjectIndex, honorificData);
}
}
}).ConfigureAwait(false);