From 55238da348d385c8bae12963c2e3bfe663610359 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Wed, 14 Aug 2024 13:41:53 +0200 Subject: [PATCH] Fix teleport --- Directory.Build.targets | 2 +- .../Steps/Shared/AetheryteShortcut.cs | 2 ++ Questionable/Functions/AetheryteFunctions.cs | 17 +++++++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index 2ad15fb..61c30fd 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,5 +1,5 @@ - 2.7 + 2.8 diff --git a/Questionable/Controller/Steps/Shared/AetheryteShortcut.cs b/Questionable/Controller/Steps/Shared/AetheryteShortcut.cs index c111e5b..9da8a01 100644 --- a/Questionable/Controller/Steps/Shared/AetheryteShortcut.cs +++ b/Questionable/Controller/Steps/Shared/AetheryteShortcut.cs @@ -145,6 +145,8 @@ internal static class AetheryteShortcut if (!aetheryteFunctions.IsTeleportUnlocked()) throw new TaskException("Teleport is not unlocked, attune to any aetheryte first."); + _continueAt = DateTime.Now.AddSeconds(1); + logger.LogTrace("Waiting for teleport cooldown..."); return false; } diff --git a/Questionable/Functions/AetheryteFunctions.cs b/Questionable/Functions/AetheryteFunctions.cs index a4e6566..0388b02 100644 --- a/Questionable/Functions/AetheryteFunctions.cs +++ b/Questionable/Functions/AetheryteFunctions.cs @@ -8,13 +8,14 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Questionable.Model.Common; using Questionable.Model.Questing; +using Action = Lumina.Excel.GeneratedSheets.Action; namespace Questionable.Functions; internal sealed unsafe class AetheryteFunctions { private const uint TeleportAction = 5; - private const uint ReturnAction = 8; + private const uint ReturnAction = 6; private readonly IServiceProvider _serviceProvider; private readonly ILogger _logger; @@ -48,16 +49,16 @@ internal sealed unsafe class AetheryteFunctions public bool CanTeleport(EAetheryteLocation aetheryteLocation) { if ((ushort)aetheryteLocation == PlayerState.Instance()->HomeAetheryteId && - ActionManager.Instance()->GetActionStatus(ActionType.GeneralAction, ReturnAction) == 0) + ActionManager.Instance()->GetActionStatus(ActionType.Action, ReturnAction) == 0) return true; - return ActionManager.Instance()->GetActionStatus(ActionType.GeneralAction, TeleportAction) == 0; + return ActionManager.Instance()->GetActionStatus(ActionType.Action, TeleportAction) == 0; } public bool IsTeleportUnlocked() { - ushort unlockLink = _dataManager.GetExcelSheet()! - .Single(x => x.Action.Row == 5) + uint unlockLink = _dataManager.GetExcelSheet()! + .GetRow(5)! .UnlockLink; return UIState.Instance()->IsUnlockLinkUnlocked(unlockLink); } @@ -68,17 +69,17 @@ internal sealed unsafe class AetheryteFunctions if (IsAetheryteUnlocked(aetheryteId, out var subIndex)) { if (aetheryteId == PlayerState.Instance()->HomeAetheryteId && - ActionManager.Instance()->GetActionStatus(ActionType.GeneralAction, ReturnAction) == 0) + ActionManager.Instance()->GetActionStatus(ActionType.Action, ReturnAction) == 0) { ReturnRequestedAt = DateTime.Now; - if (ActionManager.Instance()->UseAction(ActionType.GeneralAction, ReturnAction)) + if (ActionManager.Instance()->UseAction(ActionType.Action, ReturnAction)) { _logger.LogInformation("Using 'return' for home aetheryte"); return true; } } - if (ActionManager.Instance()->GetActionStatus(ActionType.GeneralAction, TeleportAction) == 0) + if (ActionManager.Instance()->GetActionStatus(ActionType.Action, TeleportAction) == 0) { // fallback if return isn't available or (more likely) on a different aetheryte _logger.LogInformation("Teleporting to aetheryte {AetheryteId}", aetheryteId);