diff --git a/LightlessSync/Interop/InteropModel/Enums/ResidentialAetheryteKind.cs b/LightlessSync/Interop/InteropModel/Enums/ResidentialAetheryteKind.cs index af7c18e..cd5e57c 100644 --- a/LightlessSync/Interop/InteropModel/Enums/ResidentialAetheryteKind.cs +++ b/LightlessSync/Interop/InteropModel/Enums/ResidentialAetheryteKind.cs @@ -2,6 +2,7 @@ public enum ResidentialAetheryteKind { + None = -1, Uldah = 9, Gridania = 2, Limsa = 8, diff --git a/LightlessSync/Interop/Ipc/IpcCallerLifestream.cs b/LightlessSync/Interop/Ipc/IpcCallerLifestream.cs index 2ced314..0243e59 100644 --- a/LightlessSync/Interop/Ipc/IpcCallerLifestream.cs +++ b/LightlessSync/Interop/Ipc/IpcCallerLifestream.cs @@ -1,5 +1,6 @@ using Dalamud.Plugin; using Dalamud.Plugin.Ipc; +using Lifestream.Enums; using LightlessSync.Interop.Ipc.Framework; using LightlessSync.Services.Mediator; using Microsoft.Extensions.Logging; @@ -20,6 +21,11 @@ public sealed class IpcCallerLifestream : IpcServiceBase private readonly ICallGateSubscriber _changeWorldById; private readonly ICallGateSubscriber _aetheryteTeleport; private readonly ICallGateSubscriber _aetheryteTeleportById; + private readonly ICallGateSubscriber _canChangeInstance; + private readonly ICallGateSubscriber _getCurrentInstance; + private readonly ICallGateSubscriber _getNumberOfInstances; + private readonly ICallGateSubscriber _changeInstance; + private readonly ICallGateSubscriber<(ResidentialAetheryteKind, int, int)> _getCurrentPlotInfo; public IpcCallerLifestream(IDalamudPluginInterface pi, LightlessMediator lightlessMediator, ILogger logger) : base(logger, lightlessMediator, pi, LifestreamDescriptor) @@ -33,6 +39,11 @@ public sealed class IpcCallerLifestream : IpcServiceBase _changeWorldById = pi.GetIpcSubscriber("Lifestream.ChangeWorldById"); _aetheryteTeleport = pi.GetIpcSubscriber("Lifestream.AetheryteTeleport"); _aetheryteTeleportById = pi.GetIpcSubscriber("Lifestream.AetheryteTeleportById"); + _canChangeInstance = pi.GetIpcSubscriber("Lifestream.CanChangeInstance"); + _getCurrentInstance = pi.GetIpcSubscriber("Lifestream.GetCurrentInstance"); + _getNumberOfInstances = pi.GetIpcSubscriber("Lifestream.GetNumberOfInstances"); + _changeInstance = pi.GetIpcSubscriber("Lifestream.ChangeInstance"); + _getCurrentPlotInfo = pi.GetIpcSubscriber<(ResidentialAetheryteKind, int, int)>("Lifestream.GetCurrentPlotInfo"); CheckAPI(); } @@ -84,10 +95,35 @@ public sealed class IpcCallerLifestream : IpcServiceBase return _changeWorldById.InvokeFunc(worldId); } - public bool AetheryteTeleportById(uint aetheryteId) { if (!APIAvailable) return false; return _aetheryteTeleportById.InvokeFunc(aetheryteId); } + + public bool CanChangeInstance() + { + if (!APIAvailable) return false; + return _canChangeInstance.InvokeFunc(); + } + public int GetCurrentInstance() + { + if (!APIAvailable) return -1; + return _getCurrentInstance.InvokeFunc(); + } + public int GetNumberOfInstances() + { + if (!APIAvailable) return -1; + return _getNumberOfInstances.InvokeFunc(); + } + public void ChangeInstance(int instanceNumber) + { + if (!APIAvailable) return; + _changeInstance.InvokeAction(instanceNumber); + } + public (ResidentialAetheryteKind, int, int)? GetCurrentPlotInfo() + { + if (!APIAvailable) return (ResidentialAetheryteKind.None, -1, -1); + return _getCurrentPlotInfo.InvokeFunc(); + } } \ No newline at end of file