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

@@ -115,6 +115,9 @@ public sealed class IpcCallerCustomize : IIpcCaller
public void CheckAPI()
{
// todo: restore this when it's available again
return;
try
{
var version = _customizePlusApiVersion.InvokeFunc();

View File

@@ -1,5 +1,4 @@
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Plugin;
using Dalamud.Plugin;
using Dalamud.Plugin.Ipc;
using MareSynchronos.Services;
using MareSynchronos.Services.Mediator;
@@ -15,8 +14,8 @@ public sealed class IpcCallerHeels : IIpcCaller
private readonly ICallGateSubscriber<(int, int)> _heelsGetApiVersion;
private readonly ICallGateSubscriber<string> _heelsGetOffset;
private readonly ICallGateSubscriber<string, object?> _heelsOffsetUpdate;
private readonly ICallGateSubscriber<IGameObject, string, object?> _heelsRegisterPlayer;
private readonly ICallGateSubscriber<IGameObject, object?> _heelsUnregisterPlayer;
private readonly ICallGateSubscriber<int, string, object?> _heelsRegisterPlayer;
private readonly ICallGateSubscriber<int, object?> _heelsUnregisterPlayer;
public IpcCallerHeels(ILogger<IpcCallerHeels> logger, IDalamudPluginInterface pi, DalamudUtilService dalamudUtil, MareMediator mareMediator)
{
@@ -25,8 +24,8 @@ public sealed class IpcCallerHeels : IIpcCaller
_dalamudUtil = dalamudUtil;
_heelsGetApiVersion = pi.GetIpcSubscriber<(int, int)>("SimpleHeels.ApiVersion");
_heelsGetOffset = pi.GetIpcSubscriber<string>("SimpleHeels.GetLocalPlayer");
_heelsRegisterPlayer = pi.GetIpcSubscriber<IGameObject, string, object?>("SimpleHeels.RegisterPlayer");
_heelsUnregisterPlayer = pi.GetIpcSubscriber<IGameObject, object?>("SimpleHeels.UnregisterPlayer");
_heelsRegisterPlayer = pi.GetIpcSubscriber<int, string, object?>("SimpleHeels.RegisterPlayer");
_heelsUnregisterPlayer = pi.GetIpcSubscriber<int, object?>("SimpleHeels.UnregisterPlayer");
_heelsOffsetUpdate = pi.GetIpcSubscriber<string, object?>("SimpleHeels.LocalChanged");
_heelsOffsetUpdate.Subscribe(HeelsOffsetChange);
@@ -56,7 +55,7 @@ public sealed class IpcCallerHeels : IIpcCaller
if (gameObj != null)
{
_logger.LogTrace("Restoring Heels data to {chara}", character.ToString("X"));
_heelsUnregisterPlayer.InvokeAction(gameObj);
_heelsUnregisterPlayer.InvokeAction(gameObj.ObjectIndex);
}
}).ConfigureAwait(false);
}
@@ -70,7 +69,7 @@ public sealed class IpcCallerHeels : IIpcCaller
if (gameObj != null)
{
_logger.LogTrace("Applying Heels data to {chara}", character.ToString("X"));
_heelsRegisterPlayer.InvokeAction(gameObj, data);
_heelsRegisterPlayer.InvokeAction(gameObj.ObjectIndex, data);
}
}).ConfigureAwait(false);
}
@@ -79,7 +78,7 @@ public sealed class IpcCallerHeels : IIpcCaller
{
try
{
APIAvailable = _heelsGetApiVersion.InvokeFunc() is { Item1: 1, Item2: >= 1 };
APIAvailable = _heelsGetApiVersion.InvokeFunc() is { Item1: 2, Item2: >= 1 };
}
catch
{

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);

View File

@@ -45,6 +45,9 @@ public sealed class IpcCallerMoodles : IIpcCaller
public void CheckAPI()
{
// todo: restore this when it's available again
return;
try
{
APIAvailable = _moodlesApiVersion.InvokeFunc() == 1;