private async Task <bool> TheTask() { if (await Coroutine.Wait(WaitTime * 1000, () => ContentsFinderConfirm.IsOpen)) { await Coroutine.Yield(); while (ContentsFinderConfirm.IsOpen) { DutyManager.Commence(); await Coroutine.Yield(); if (await Coroutine.Wait(30000, () => CommonBehaviors.IsLoading)) { await Coroutine.Yield(); await Coroutine.Wait(Timeout.Infinite, () => !CommonBehaviors.IsLoading); _done = true; return(true); } } Log("After commencing, load screen never occurred. Stopping Bot"); //await TreeRoot.StopGently(); _done = true; return(true); } Log("Duty finder didn't pop within {0} seconds.", WaitTime); //await TreeRoot.StopGently(); _done = true; return(true); }
public static void Commence() { if (!_joinTimeSet) { _joinTime = DateTime.Now.Add(TimeSpan.FromSeconds(MainSettingsModel.Instance.AutoCommenceDelay)); _joinTimeSet = true; } if (!_commenced && DateTime.Now > _joinTime && ContentsFinderConfirm.IsOpen) { DutyManager.Commence(); _commenced = true; } }
private static async Task EnterDiadem() { await Navigation.GetTo(886, new Vector3(-17.82406f, -16f, 141.3146f)); var Aurvael = GameObjectManager.GetObjectByNPCId(1031694); if (Aurvael != null) { Aurvael.Interact(); if (await Coroutine.Wait(3000, () => Talk.DialogOpen)) { Talk.Next(); } await Coroutine.Wait(3000, () => SelectString.IsOpen); if (SelectString.IsOpen) { SelectString.ClickSlot(0); await Coroutine.Wait(3000, () => SelectYesno.IsOpen); SelectYesno.Yes(); await Coroutine.Wait(30000, () => ContentsFinderConfirm.IsOpen); await Coroutine.Yield(); while (ContentsFinderConfirm.IsOpen) { DutyManager.Commence(); await Coroutine.Yield(); if (await Coroutine.Wait(30000, () => CommonBehaviors.IsLoading)) { await Coroutine.Yield(); await Coroutine.Wait(Timeout.Infinite, () => !CommonBehaviors.IsLoading); } } await Coroutine.Sleep(2500); } } }
private async Task JoinDutyTask(int DutyId, bool Undersized, bool Trial, bool Raid) { if (Undersized) { Logging.WriteDiagnostic("Joining Duty as Undersized party."); GameSettingsManager.JoinWithUndersizedParty = true; } else { Logging.WriteDiagnostic("Joining Duty as normal group."); GameSettingsManager.JoinWithUndersizedParty = false; } Logging.WriteDiagnostic("Queuing for " + DataManager.InstanceContentResults[(uint)DutyId].CurrentLocaleName); DutyManager.Queue(DataManager.InstanceContentResults[(uint)DutyId]); await Coroutine.Wait(5000, () => (DutyManager.QueueState == QueueState.CommenceAvailable || DutyManager.QueueState == QueueState.JoiningInstance)); Logging.WriteDiagnostic("Queued for Dungeon"); while (DutyManager.QueueState != QueueState.None || DutyManager.QueueState != QueueState.InDungeon || CommonBehaviors.IsLoading) { if (DutyManager.QueueState == QueueState.CommenceAvailable) { Logging.WriteDiagnostic("Waiting for queue pop."); await Coroutine.Wait(-1, () => (DutyManager.QueueState == QueueState.JoiningInstance || DutyManager.QueueState == QueueState.None)); } if (DutyManager.QueueState == QueueState.JoiningInstance) { Logging.WriteDiagnostic("Dungeon popped, commencing in 3."); await Coroutine.Sleep(3000); DutyManager.Commence(); await Coroutine.Wait(-1, () => (DutyManager.QueueState == QueueState.LoadingContent || DutyManager.QueueState == QueueState.CommenceAvailable)); } if (DutyManager.QueueState == QueueState.LoadingContent) { Logging.WriteDiagnostic("Waiting for everyone to accept"); await Coroutine.Wait(-1, () => (CommonBehaviors.IsLoading || DutyManager.QueueState == QueueState.CommenceAvailable)); await Coroutine.Sleep(1000); } if (CommonBehaviors.IsLoading) { break; } await Coroutine.Sleep(500); } if (DutyManager.QueueState == QueueState.None) { return; } await Coroutine.Sleep(500); if (CommonBehaviors.IsLoading) { await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading); } if (QuestLogManager.InCutscene) { TreeRoot.StatusText = "InCutscene"; if (ff14bot.RemoteAgents.AgentCutScene.Instance != null) { ff14bot.RemoteAgents.AgentCutScene.Instance.PromptSkip(); await Coroutine.Wait(250, () => SelectString.IsOpen); if (SelectString.IsOpen) { SelectString.ClickSlot(0); } } } Logging.WriteDiagnostic("Should be in duty"); var director = ((ff14bot.Directors.InstanceContentDirector)DirectorManager.ActiveDirector); if (director != null) { if (Trial) { if (director.TimeLeftInDungeon >= new TimeSpan(0, 60, 0)) { Logging.WriteDiagnostic("Barrier up"); await Coroutine.Wait(-1, () => director.TimeLeftInDungeon < new TimeSpan(0, 59, 58)); } } if (Raid) { if (director.TimeLeftInDungeon >= new TimeSpan(2, 0, 0)) { Logging.WriteDiagnostic("Barrier up"); await Coroutine.Wait(-1, () => director.TimeLeftInDungeon < new TimeSpan(1, 59, 58)); } } else { if (director.TimeLeftInDungeon >= new TimeSpan(1, 30, 0)) { Logging.WriteDiagnostic("Barrier up"); await Coroutine.Wait(-1, () => director.TimeLeftInDungeon < new TimeSpan(1, 29, 58)); } } } else { Logging.WriteDiagnostic("Director is null"); } Logging.WriteDiagnostic("Should be ready"); _isDone = true; }
private async Task JoinDutyTask(int DutyId, bool Trial) { Logging.WriteDiagnostic("Queuing for Dungeon"); GameSettingsManager.JoinWithUndersizedParty = true; DutyManager.Queue(DataManager.InstanceContentResults[(uint)DutyId]); await Coroutine.Wait(5000, () => (DutyManager.QueueState == QueueState.InQueue || DutyManager.QueueState == QueueState.JoiningInstance)); Logging.WriteDiagnostic("Queued for Dungeon"); await Coroutine.Wait(10000, () => (DutyManager.QueueState == QueueState.JoiningInstance)); await Coroutine.Wait(10000, () => (RaptureAtkUnitManager.GetWindowByName("ContentsFinderConfirm") != null)); Logging.WriteDiagnostic("Commencing"); DutyManager.Commence(); Logging.WriteDiagnostic("Waiting for Loading"); await Coroutine.Wait(10000, () => CommonBehaviors.IsLoading || QuestLogManager.InCutscene); if (CommonBehaviors.IsLoading) { await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading); } if (QuestLogManager.InCutscene) { TreeRoot.StatusText = "InCutscene"; if (ff14bot.RemoteAgents.AgentCutScene.Instance != null) { ff14bot.RemoteAgents.AgentCutScene.Instance.PromptSkip(); await Coroutine.Wait(250, () => SelectString.IsOpen); if (SelectString.IsOpen) { SelectString.ClickSlot(0); } } } Logging.WriteDiagnostic("Should be in duty"); var director = ((ff14bot.Directors.InstanceContentDirector)DirectorManager.ActiveDirector); if (director != null) { if (Trial) { if (director.TimeLeftInDungeon >= new TimeSpan(0, 60, 0)) { Logging.WriteDiagnostic("Barrier up"); await Coroutine.Wait(30000, () => director.TimeLeftInDungeon < new TimeSpan(0, 59, 58)); } } else { if (director.TimeLeftInDungeon >= new TimeSpan(1, 30, 0)) { Logging.WriteDiagnostic("Barrier up"); await Coroutine.Wait(30000, () => director.TimeLeftInDungeon < new TimeSpan(1, 29, 58)); } } } else { Logging.WriteDiagnostic("Director is null"); } Logging.WriteDiagnostic("Should be ready"); _isDone = true; }