forked from liza/Questionable
Add retry to opening the journal for initiating leves
This commit is contained in:
parent
f7886d5969
commit
3f07ae797b
@ -36,6 +36,7 @@ internal static class InitiateLeve
|
||||
{
|
||||
private ElementId _elementId = null!;
|
||||
private uint _questType;
|
||||
private DateTime _openedAt = DateTime.MinValue;
|
||||
|
||||
public ITask With(ElementId elementId)
|
||||
{
|
||||
@ -47,19 +48,25 @@ internal static class InitiateLeve
|
||||
public bool Start()
|
||||
{
|
||||
AgentQuestJournal.Instance()->OpenForQuest(_elementId.Value, _questType);
|
||||
_openedAt = DateTime.Now;
|
||||
return true;
|
||||
}
|
||||
|
||||
public ETaskResult Update()
|
||||
{
|
||||
AgentQuestJournal* agentQuestJournal = AgentQuestJournal.Instance();
|
||||
if (!agentQuestJournal->IsAgentActive())
|
||||
return ETaskResult.StillRunning;
|
||||
if (agentQuestJournal->IsAgentActive() &&
|
||||
agentQuestJournal->SelectedQuestId == _elementId.Value &&
|
||||
agentQuestJournal->SelectedQuestType == _questType)
|
||||
return ETaskResult.TaskComplete;
|
||||
|
||||
return agentQuestJournal->SelectedQuestId == _elementId.Value &&
|
||||
agentQuestJournal->SelectedQuestType == _questType
|
||||
? ETaskResult.TaskComplete
|
||||
: ETaskResult.StillRunning;
|
||||
if (DateTime.Now > _openedAt.AddSeconds(3))
|
||||
{
|
||||
AgentQuestJournal.Instance()->OpenForQuest(_elementId.Value, _questType);
|
||||
_openedAt = DateTime.Now;
|
||||
}
|
||||
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
|
||||
public override string ToString() => $"OpenJournal({_elementId})";
|
||||
@ -118,5 +125,7 @@ internal static class InitiateLeve
|
||||
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
|
||||
public override string ToString() => "SelectLeveDifficulty";
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Dalamud.NET.Sdk/10.0.0">
|
||||
<PropertyGroup>
|
||||
<Version>2.3</Version>
|
||||
<Version>2.4</Version>
|
||||
<OutputPath>dist</OutputPath>
|
||||
<PathMap Condition="$(SolutionDir) != ''">$(SolutionDir)=X:\</PathMap>
|
||||
<Platforms>x64</Platforms>
|
||||
|
Loading…
Reference in New Issue
Block a user