This commit is contained in:
Stanley Dimant
2024-07-27 02:29:59 +02:00
parent 91c7cc5fc8
commit 9c954471fb
7 changed files with 48 additions and 2 deletions

View File

@@ -0,0 +1,35 @@
using Dalamud.Plugin;
using MareSynchronos.Services;
using MareSynchronos.Services.Mediator;
using Microsoft.Extensions.Logging;
namespace MareSynchronos.Interop.Ipc;
public sealed class IpcCallerPetNames : IIpcCaller
{
private readonly ILogger<IpcCallerPetNames> _logger;
private readonly DalamudUtilService _dalamudUtil;
private readonly MareMediator _mareMediator;
public IpcCallerPetNames(ILogger<IpcCallerPetNames> logger, IDalamudPluginInterface pi, DalamudUtilService dalamudUtil,
MareMediator mareMediator)
{
_logger = logger;
_dalamudUtil = dalamudUtil;
_mareMediator = mareMediator;
// todo: implement this, bitch, look at moodles as example implementation
}
public bool APIAvailable => throw new NotImplementedException();
public void CheckAPI()
{
throw new NotImplementedException();
}
public void Dispose()
{
throw new NotImplementedException();
}
}

View File

@@ -7,7 +7,7 @@ public sealed partial class IpcManager : DisposableMediatorSubscriberBase
{
public IpcManager(ILogger<IpcManager> logger, MareMediator mediator,
IpcCallerPenumbra penumbraIpc, IpcCallerGlamourer glamourerIpc, IpcCallerCustomize customizeIpc, IpcCallerHeels heelsIpc,
IpcCallerHonorific honorificIpc, IpcCallerMoodles moodlesIpc) : base(logger, mediator)
IpcCallerHonorific honorificIpc, IpcCallerMoodles moodlesIpc, IpcCallerPetNames ipcCallerPetNames) : base(logger, mediator)
{
CustomizePlus = customizeIpc;
Heels = heelsIpc;
@@ -15,6 +15,7 @@ public sealed partial class IpcManager : DisposableMediatorSubscriberBase
Penumbra = penumbraIpc;
Honorific = honorificIpc;
Moodles = moodlesIpc;
PetNames = ipcCallerPetNames;
if (Initialized)
{
@@ -41,6 +42,7 @@ public sealed partial class IpcManager : DisposableMediatorSubscriberBase
public IpcCallerGlamourer Glamourer { get; }
public IpcCallerPenumbra Penumbra { get; }
public IpcCallerMoodles Moodles { get; }
public IpcCallerPetNames PetNames { get; }
private void PeriodicApiStateCheck()
{
@@ -51,5 +53,6 @@ public sealed partial class IpcManager : DisposableMediatorSubscriberBase
CustomizePlus.CheckAPI();
Honorific.CheckAPI();
Moodles.CheckAPI();
PetNames.CheckAPI();
}
}

View File

@@ -216,6 +216,7 @@ public class PlayerDataFactory
_logger.LogDebug("Heels is now: {heels}", previousData.HeelsData);
if (objectKind == ObjectKind.Player)
{
// TODO: use petnames here and save it to moodles data for temporary transfer
previousData.MoodlesData = await _ipcManager.Moodles.GetStatusAsync(playerRelatedObject.Address).ConfigureAwait(false) ?? string.Empty;
_logger.LogDebug("Moodles is now: {moodles}", previousData.MoodlesData);
}

View File

@@ -342,6 +342,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
break;
case PlayerChanges.Moodles:
// TODO: send it to petnames ipc here instead
await _ipcManager.Moodles.SetStatusAsync(handler.Address, charaData.MoodlesData).ConfigureAwait(false);
break;

View File

@@ -122,6 +122,9 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
MoodlesChanged();
}
});
// TODO: if event is needed for petnames add it here similar to moodles
Mediator.Subscribe<PenumbraModSettingChangedMessage>(this, (msg) =>
{
Logger.LogDebug("Received Penumbra Mod settings change, updating player");

View File

@@ -102,10 +102,12 @@ public sealed class Plugin : IDalamudPlugin
s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<MareMediator>()));
collection.AddSingleton((s) => new IpcCallerMoodles(s.GetRequiredService<ILogger<IpcCallerMoodles>>(), pluginInterface,
s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<MareMediator>()));
collection.AddSingleton((s) => new IpcCallerPetNames(s.GetRequiredService<ILogger<IpcCallerPetNames>>(), pluginInterface,
s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<MareMediator>()));
collection.AddSingleton((s) => new IpcManager(s.GetRequiredService<ILogger<IpcManager>>(),
s.GetRequiredService<MareMediator>(), s.GetRequiredService<IpcCallerPenumbra>(), s.GetRequiredService<IpcCallerGlamourer>(),
s.GetRequiredService<IpcCallerCustomize>(), s.GetRequiredService<IpcCallerHeels>(), s.GetRequiredService<IpcCallerHonorific>(),
s.GetRequiredService<IpcCallerMoodles>()));
s.GetRequiredService<IpcCallerMoodles>(), s.GetRequiredService<IpcCallerPetNames>()));
collection.AddSingleton((s) => new NotificationService(s.GetRequiredService<ILogger<NotificationService>>(),
s.GetRequiredService<MareMediator>(), s.GetRequiredService<DalamudUtilService>(),
notificationManager, chatGui, s.GetRequiredService<MareConfigService>()));

View File

@@ -53,6 +53,7 @@ public class PluginWarningNotificationService
warning.ShownHonorificWarning = true;
}
// todo: change the moodles apiavailable to petnames for testing
if (changes.Contains(PlayerChanges.Moodles) && !warning.ShownMoodlesWarning && !_ipcManager.Moodles.APIAvailable)
{
missingPluginsForData.Add("Moodles");