qstbak/Questionable/Questionable.External/LifestreamIpc.cs
2025-10-09 07:47:19 +10:00

45 lines
2.2 KiB
C#

using System;
using Dalamud.Plugin;
using Dalamud.Plugin.Ipc;
using Microsoft.Extensions.Logging;
using Questionable.Model.Common;
namespace Questionable.External;
internal sealed class LifestreamIpc
{
private readonly ILogger<LifestreamIpc> _logger;
private readonly ICallGateSubscriber<uint, bool> _aethernetTeleportByPlaceNameId;
private readonly ICallGateSubscriber<uint, bool> _aethernetTeleportById;
private readonly ICallGateSubscriber<bool> _aethernetTeleportToFirmament;
public LifestreamIpc(IDalamudPluginInterface pluginInterface, ILogger<LifestreamIpc> logger)
{
_logger = logger;
_aethernetTeleportByPlaceNameId = pluginInterface.GetIpcSubscriber<uint, bool>("Lifestream.AethernetTeleportByPlaceNameId");
_aethernetTeleportById = pluginInterface.GetIpcSubscriber<uint, bool>("Lifestream.AethernetTeleportById");
_aethernetTeleportToFirmament = pluginInterface.GetIpcSubscriber<bool>("Lifestream.AethernetTeleportToFirmament");
}
public bool Teleport(EAetheryteLocation aetheryteLocation)
{
_logger.LogInformation("Teleporting to '{Name}'", aetheryteLocation);
return aetheryteLocation switch
{
EAetheryteLocation.IshgardFirmament => _aethernetTeleportToFirmament.InvokeFunc(),
EAetheryteLocation.FirmamentMendicantsCourt => _aethernetTeleportByPlaceNameId.InvokeFunc(3436u),
EAetheryteLocation.FirmamentMattock => _aethernetTeleportByPlaceNameId.InvokeFunc(3473u),
EAetheryteLocation.FirmamentNewNest => _aethernetTeleportByPlaceNameId.InvokeFunc(3475u),
EAetheryteLocation.FirmanentSaintRoellesDais => _aethernetTeleportByPlaceNameId.InvokeFunc(3474u),
EAetheryteLocation.FirmamentFeatherfall => _aethernetTeleportByPlaceNameId.InvokeFunc(3525u),
EAetheryteLocation.FirmamentHoarfrostHall => _aethernetTeleportByPlaceNameId.InvokeFunc(3528u),
EAetheryteLocation.FirmamentWesternRisensongQuarter => _aethernetTeleportByPlaceNameId.InvokeFunc(3646u),
EAetheryteLocation.FIrmamentEasternRisensongQuarter => _aethernetTeleportByPlaceNameId.InvokeFunc(3645u),
EAetheryteLocation.None => throw new ArgumentOutOfRangeException("aetheryteLocation"),
_ => _aethernetTeleportById.InvokeFunc((uint)aetheryteLocation),
};
}
}