_addonLifecycle.RegisterListener(AddonEvent.PostSetup, "SelectYesno", SelectYesnoPostSetup);
_addonLifecycle.RegisterListener(AddonEvent.PostSetup, "PointMenu", PointMenuPostSetup);
_addonLifecycle.RegisterListener(AddonEvent.PostSetup, "HousingSelectBlock", HousingSelectBlockPostSetup);
- _addonLifecycle.RegisterListener(AddonEvent.PostSetup, "TelepotTown", TeleportTownPostSetup);
unsafe
{
addon->FireCallbackInt(0);
}
- private void TeleportTownPostSetup(AddonEvent type, AddonArgs args)
- {
- if (ShouldHandleUiInteractions &&
- _questController.HasCurrentTaskMatching(out AethernetShortcut.Task? aethernetShortcut) &&
- aethernetShortcut.From.IsFirmamentAetheryte())
- {
- // this might be better via atkvalues; but this works for now
- uint toIndex = aethernetShortcut.To switch
- {
- EAetheryteLocation.FirmamentMendicantsCourt => 0,
- EAetheryteLocation.FirmamentMattock => 1,
- EAetheryteLocation.FirmamentNewNest => 2,
- EAetheryteLocation.FirmanentSaintRoellesDais => 3,
- EAetheryteLocation.FirmamentFeatherfall => 4,
- EAetheryteLocation.FirmamentHoarfrostHall => 5,
- EAetheryteLocation.FirmamentWesternRisensongQuarter => 6,
- EAetheryteLocation.FIrmamentEasternRisensongQuarter => 7,
- _ => uint.MaxValue,
- };
-
- if (toIndex == uint.MaxValue)
- return;
-
- _logger.LogInformation("Teleporting to {ToName} with menu index {ToIndex}", aethernetShortcut.From,
- toIndex);
- unsafe
- {
- var teleportToDestination = stackalloc AtkValue[]
- {
- new() { Type = ValueType.Int, Int = 11 },
- new() { Type = ValueType.UInt, UInt = toIndex }
- };
-
- var addon = (AtkUnitBase*)args.Addon;
- addon->FireCallback(2, teleportToDestination);
- addon->FireCallback(2, teleportToDestination, true);
- }
- }
- }
-
private StringOrRegex? ResolveReference(Quest? quest, string? excelSheet, ExcelRef? excelRef, bool isRegExp)
{
if (excelRef == null)
public void Dispose()
{
- _addonLifecycle.UnregisterListener(AddonEvent.PostSetup, "TelepotTown", TeleportTownPostSetup);
_addonLifecycle.UnregisterListener(AddonEvent.PostSetup, "HousingSelectBlock", HousingSelectBlockPostSetup);
_addonLifecycle.UnregisterListener(AddonEvent.PostSetup, "PointMenu", PointMenuPostSetup);
_addonLifecycle.UnregisterListener(AddonEvent.PostSetup, "SelectYesno", SelectYesnoPostSetup);
private void DoTeleport()
{
- if (Task.From.IsFirmamentAetheryte())
- {
- logger.LogInformation("Using manual teleport interaction");
- _teleported = gameFunctions.InteractWith((uint)Task.From, ObjectKind.EventObj);
- }
- else
- {
- logger.LogInformation("Using lifestream to teleport to {Destination}", Task.To);
- lifestreamIpc.Teleport(Task.To);
- _teleported = true;
- }
+ logger.LogInformation("Using lifestream to teleport to {Destination}", Task.To);
+ lifestreamIpc.Teleport(Task.To);
+ _teleported = true;
}
public override ETaskResult Update()
-using Dalamud.Plugin;
+using System.Collections.Generic;
+using Dalamud.Plugin;
using Dalamud.Plugin.Ipc;
+using Dalamud.Plugin.Services;
+using Lumina.Excel.Sheets;
+using Microsoft.Extensions.Logging;
using Questionable.Data;
using Questionable.Model.Common;
internal sealed class LifestreamIpc
{
private readonly AetheryteData _aetheryteData;
+ private readonly IDataManager _dataManager;
+ private readonly ILogger<LifestreamIpc> _logger;
private readonly ICallGateSubscriber<string, bool> _aethernetTeleport;
- public LifestreamIpc(IDalamudPluginInterface pluginInterface, AetheryteData aetheryteData)
+ public LifestreamIpc(IDalamudPluginInterface pluginInterface, AetheryteData aetheryteData, IDataManager dataManager, ILogger<LifestreamIpc> logger)
{
_aetheryteData = aetheryteData;
+ _dataManager = dataManager;
+ _logger = logger;
_aethernetTeleport = pluginInterface.GetIpcSubscriber<string, bool>("Lifestream.AethernetTeleport");
}
public bool Teleport(EAetheryteLocation aetheryteLocation)
{
- if (aetheryteLocation == EAetheryteLocation.IshgardFirmament)
+ string? name = aetheryteLocation switch
{
- // TODO does this even work on non-EN clients?
- return _aethernetTeleport.InvokeFunc("Firmament");
- }
+ EAetheryteLocation.IshgardFirmament => "Firmament",
+ EAetheryteLocation.FirmamentMendicantsCourt => GetPlaceName(3436),
+ EAetheryteLocation.FirmamentMattock => GetPlaceName(3473),
+ EAetheryteLocation.FirmamentNewNest => GetPlaceName(3475),
+ EAetheryteLocation.FirmanentSaintRoellesDais => GetPlaceName(3474),
+ EAetheryteLocation.FirmamentFeatherfall => GetPlaceName(3525),
+ EAetheryteLocation.FirmamentHoarfrostHall => GetPlaceName(3528),
+ EAetheryteLocation.FirmamentWesternRisensongQuarter => GetPlaceName(3646),
+ EAetheryteLocation.FIrmamentEasternRisensongQuarter => GetPlaceName(3645),
+ _ => _aetheryteData.AethernetNames.GetValueOrDefault(aetheryteLocation),
+ };
- if (!_aetheryteData.AethernetNames.TryGetValue(aetheryteLocation, out string? name))
+ if (name == null)
return false;
+ _logger.LogInformation("Teleporting to '{Name}'", name);
return _aethernetTeleport.InvokeFunc(name);
}
+
+ private string GetPlaceName(uint rowId) => _dataManager.GetExcelSheet<PlaceName>().GetRow(rowId).Name.ToString();
}