Improve mount task
This commit is contained in:
parent
8b6b5e894b
commit
fc51f03f46
@ -61,6 +61,14 @@
|
|||||||
"InteractionType": "UseItem",
|
"InteractionType": "UseItem",
|
||||||
"ItemId": 2003234,
|
"ItemId": 2003234,
|
||||||
"GroundTarget": true,
|
"GroundTarget": true,
|
||||||
|
"CompletionQuestVariablesFlags": [
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
128
|
||||||
|
],
|
||||||
"$": "QuestValues after: 1 16 0 0 0 128"
|
"$": "QuestValues after: 1 16 0 0 0 128"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -73,7 +81,15 @@
|
|||||||
"TerritoryId": 961,
|
"TerritoryId": 961,
|
||||||
"InteractionType": "UseItem",
|
"InteractionType": "UseItem",
|
||||||
"ItemId": 2003234,
|
"ItemId": 2003234,
|
||||||
"GroundTarget": true
|
"GroundTarget": true,
|
||||||
|
"CompletionQuestVariablesFlags": [
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
64
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Dalamud.Game.ClientState.Conditions;
|
using System;
|
||||||
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Questionable.Data;
|
using Questionable.Data;
|
||||||
@ -13,6 +14,7 @@ internal sealed class MountTask(
|
|||||||
{
|
{
|
||||||
private ushort _territoryId;
|
private ushort _territoryId;
|
||||||
private bool _mountTriggered;
|
private bool _mountTriggered;
|
||||||
|
private DateTime _retryAt = DateTime.MinValue;
|
||||||
|
|
||||||
public ITask With(ushort territoryId)
|
public ITask With(ushort territoryId)
|
||||||
{
|
{
|
||||||
@ -40,7 +42,7 @@ internal sealed class MountTask(
|
|||||||
logger.LogInformation("Step wants a mount, trying to mount in territory {Id}...", _territoryId);
|
logger.LogInformation("Step wants a mount, trying to mount in territory {Id}...", _territoryId);
|
||||||
if (!condition[ConditionFlag.InCombat])
|
if (!condition[ConditionFlag.InCombat])
|
||||||
{
|
{
|
||||||
_mountTriggered = gameFunctions.Mount();
|
_retryAt = DateTime.Now.AddSeconds(0.5);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,6 +51,13 @@ internal sealed class MountTask(
|
|||||||
|
|
||||||
public ETaskResult Update()
|
public ETaskResult Update()
|
||||||
{
|
{
|
||||||
|
if (_mountTriggered && !condition[ConditionFlag.Mounted] && DateTime.Now > _retryAt)
|
||||||
|
{
|
||||||
|
logger.LogInformation("Not mounted, retrying...");
|
||||||
|
_mountTriggered = false;
|
||||||
|
_retryAt = DateTime.MaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_mountTriggered)
|
if (!_mountTriggered)
|
||||||
{
|
{
|
||||||
if (gameFunctions.HasStatusPreventingSprintOrMount())
|
if (gameFunctions.HasStatusPreventingSprintOrMount())
|
||||||
@ -58,6 +67,7 @@ internal sealed class MountTask(
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mountTriggered = gameFunctions.Mount();
|
_mountTriggered = gameFunctions.Mount();
|
||||||
|
_retryAt = DateTime.Now.AddSeconds(5);
|
||||||
return ETaskResult.StillRunning;
|
return ETaskResult.StillRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user