using Dalamud.Plugin; using Dalamud.Plugin.Ipc; using LightlessSync.Interop.Ipc.Framework; using LightlessSync.Services.Mediator; using Microsoft.Extensions.Logging; namespace LightlessSync.Interop.Ipc; public sealed class IpcCallerLifestream : IpcServiceBase { private static readonly IpcServiceDescriptor LifestreamDescriptor = new("Lifestream", "Lifestream", new Version(0, 0, 0, 0)); private readonly ICallGateSubscriber _executeLifestreamCommand; private readonly ICallGateSubscriber _isHere; private readonly ICallGateSubscriber _goToHousingAddress; private readonly ICallGateSubscriber _isBusy; private readonly ICallGateSubscriber _abort; private readonly ICallGateSubscriber _changeWorld; private readonly ICallGateSubscriber _changeWorldById; private readonly ICallGateSubscriber _aetheryteTeleport; private readonly ICallGateSubscriber _aetheryteTeleportById; public IpcCallerLifestream(IDalamudPluginInterface pi, LightlessMediator lightlessMediator, ILogger logger) : base(logger, lightlessMediator, pi, LifestreamDescriptor) { _executeLifestreamCommand = pi.GetIpcSubscriber("Lifestream.ExecuteCommand"); _isHere = pi.GetIpcSubscriber("Lifestream.IsHere"); _goToHousingAddress = pi.GetIpcSubscriber("Lifestream.GoToHousingAddress"); _isBusy = pi.GetIpcSubscriber("Lifestream.IsBusy"); _abort = pi.GetIpcSubscriber("Lifestream.Abort"); _changeWorld = pi.GetIpcSubscriber("Lifestream.ChangeWorld"); _changeWorldById = pi.GetIpcSubscriber("Lifestream.ChangeWorldById"); _aetheryteTeleport = pi.GetIpcSubscriber("Lifestream.AetheryteTeleport"); _aetheryteTeleportById = pi.GetIpcSubscriber("Lifestream.AetheryteTeleportById"); CheckAPI(); } public void ExecuteLifestreamCommand(string command) { if (!APIAvailable) return; _executeLifestreamCommand.InvokeAction(command); } public bool IsHere(AddressBookEntryTuple entry) { if (!APIAvailable) return false; return _isHere.InvokeFunc(entry); } public void GoToHousingAddress(AddressBookEntryTuple entry) { if (!APIAvailable) return; _goToHousingAddress.InvokeAction(entry); } public bool IsBusy() { if (!APIAvailable) return false; return _isBusy.InvokeFunc(); } public void Abort() { if (!APIAvailable) return; _abort.InvokeAction(); } public bool ChangeWorld(string worldName) { if (!APIAvailable) return false; return _changeWorld.InvokeFunc(worldName); } public bool AetheryteTeleport(string aetheryteName) { if (!APIAvailable) return false; return _aetheryteTeleport.InvokeFunc(aetheryteName); } public bool ChangeWorldById(uint worldId) { if (!APIAvailable) return false; return _changeWorldById.InvokeFunc(worldId); } public bool AetheryteTeleportById(uint aetheryteId) { if (!APIAvailable) return false; return _aetheryteTeleportById.InvokeFunc(aetheryteId); } }