/// <summary> /// Main task executor for the Commence Duty logic. /// </summary> /// <returns>Returns <c>true</c> if any action was executed, otherwise <c>false</c>.</returns> internal new async Task <bool> ExecuteLogic() { // Do not execute this logic if the botbase is paused if (Settings.BotBase.Instance.IsPaused) { return(await Task.FromResult(false)); } // Play Duty notification sound if (ShouldPlayDutyReadySound()) { ShowLogNotification(); PlayNotificationSound(); return(await Task.FromResult(true)); } // Auto accept Duty Finder if (ShouldAcceptDutyFinder()) { LogHelper.Instance.Log(Resources.Localization.Msg_DutyConfirm); ContentsFinderConfirm.Commence(); WaitHelper.Instance.RemoveWait(@"CommenceDuty.DutyNotificationSound"); return(await Task.FromResult(true)); } return(await Task.FromResult(false)); }
/// <summary> /// Queues for and accepts previously configured Trust dungeon. /// </summary> private async Task EnterTrust() { Logger.LogInformation(Translations.LOG_QUEUE_REGISTERING, GetTrustInfo()); Dawn.Instance.Register(); await Coroutine.Wait(5000, () => ContentsFinderConfirm.IsOpen); Logger.LogInformation(Translations.LOG_QUEUE_ACCEPTING); ContentsFinderConfirm.Commence(); await Coroutine.Wait(60000, () => CommonBehaviors.IsLoading); }
public async Task <bool> Run() { if (WorldManager.ZoneId != Constants.EntranceZoneId) { return(false); } if (Settings.Instance.Stop) { TreeRoot.Stop("Stop Requested"); DeepTracker.EndRun(true); return(true); } if (ContentsFinderConfirm.IsOpen) { Logger.Warn($"Entering {Constants.SelectedDungeon.GetDDType()} - Currently a Level {Core.Me.ClassLevel} {Core.Me.CurrentJob}"); DeepTracker.StartRun(Core.Me.ClassLevel); ContentsFinderConfirm.Commence(); await Coroutine.Wait(TimeSpan.FromMinutes(2), () => QuestLogManager.InCutscene || NowLoading.IsVisible); DungeonQueue.Stop(); return(true); } //TODO InQueue if (!DungeonQueue.IsFinished) { TreeRoot.StatusText = "Waiting on Queue"; await Coroutine.Wait(500, () => ContentsFinderConfirm.IsOpen); Logger.Info("Waiting on Queue"); return(true); } if (!HasWindowOpen) { if (Constants.UseJobList) { Logger.Info("Checking Joblist"); await CheckJobQueue(); } await OpenMenu(); return(true); } await MainMenu(); return(true); }
public bool Commence() { if (!_isTimeSet) { _joinTime = DateTime.Now.Add(TimeSpan.FromSeconds(Settings.Current.autoCommence.delay)); _isTimeSet = true; } if (!_commenced && DateTime.Now > _joinTime && ContentsFinderConfirm.IsOpen) { ContentsFinderConfirm.Commence(); _commenced = true; return(true); } return(false); }
public async Task <bool> Run() { if (WorldManager.ZoneId != Constants.SouthShroudZoneId) { return(false); } if (Settings.Instance.Stop) { TreeRoot.Stop("Stop Requested"); return(true); } if (ContentsFinderConfirm.IsOpen) { Logger.Warn($"Entering POTD - Currently a Level {Core.Me.ClassLevel} {Core.Me.CurrentJob}"); ContentsFinderConfirm.Commence(); await Coroutine.Wait(TimeSpan.FromMinutes(2), () => QuestLogManager.InCutscene || NowLoading.IsVisible); DungeonQueue.Stop(); return(true); } //TODO InQueue if (!DungeonQueue.IsFinished) { TreeRoot.StatusText = "Waiting on Queue"; await Coroutine.Wait(500, () => ContentsFinderConfirm.IsOpen); Logger.Info($"Waiting on Queue"); return(true); } if (!HasWindowOpen) { await OpenMenu(); return(true); } await MainMenu(); return(true); }
/// <summary> /// Main task executor for the Commence Duty logic. /// </summary> /// <returns>Returns <c>true</c> if any action was executed, otherwise <c>false</c>.</returns> internal new async Task <bool> ExecuteLogic() { // Do not execute this logic if the botbase is paused if (BotBase.Instance.IsPaused) { return(await Task.FromResult(false)); } if (DutyManager.InInstance) { if (ShouldVoteMvp()) { if (await VoteMvp().ExecuteCoroutine()) { return(await Task.FromResult(true)); } } if (ShouldLeaveDuty()) { LogHelper.Instance.Log("Leaving Duty..."); DutyManager.LeaveActiveDuty(); return(await Task.FromResult(true)); } if (BotBase.Instance.AutoPickUpTreasure && !WorldManager.InPvP) { if (GameObjectManager.GetObjectsOfType <Treasure>(true) .FirstOrDefault(i => i.IsTargetable && i.State == 0 && i.Distance2DSqr() < 8) is Treasure treasure) { LogHelper.Instance.Log(treasure); treasure.Interact(); Core.Me.ClearTarget(); return(await Task.FromResult(true)); } } } if (ShouldRegisterDuties()) { try { DutyManager.Queue(new InstanceContentResult { Id = BotBase.Instance.DutyToRegister.Id, IsInDutyFinder = true, ChnName = BotBase.Instance.DutyToRegister.Name, EngName = BotBase.Instance.DutyToRegister.Name }); LogHelper.Instance.Log($"Queued duty {BotBase.Instance.DutyToRegister.Name}"); } catch (ArgumentException e) { LogHelper.Instance.Log(e.Message); } catch (NullReferenceException e) { LogHelper.Instance.Log("Please select a duty to register!"); } //catch (NullReferenceException e) //{ // LogHelper.Instance.Log(); //} return(await Task.FromResult(true)); } // Play Duty notification sound if (ShouldPlayDutyReadySound()) { ShowLogNotification(); PlayNotificationSound(); return(await Task.FromResult(true)); } // Auto accept Duty Finder if (ShouldAcceptDutyFinder()) { LogHelper.Instance.Log(Localization.Localization.Msg_DutyConfirm); ContentsFinderConfirm.Commence(); WaitHelper.Instance.RemoveWait(@"CommenceDuty.DutyNotificationSound"); return(await Task.FromResult(true)); } return(await Task.FromResult(false)); }