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