Fix teleport

pull/17/head v2.8
Liza 2024-08-14 13:41:53 +02:00
parent 348fb06542
commit 33d1ca5195
Signed by: liza
GPG Key ID: 7199F8D727D55F67
3 changed files with 12 additions and 9 deletions

View File

@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>2.7</Version>
<Version>2.8</Version>
</PropertyGroup>
</Project>

View File

@ -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;
}

View File

@ -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<AetheryteFunctions> _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<GeneralAction>()!
.Single(x => x.Action.Row == 5)
uint unlockLink = _dataManager.GetExcelSheet<Action>()!
.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);