protected override async Task <bool> RunAsync() { DutyManager.LeaveActiveDuty(); await Coroutine.Sleep(5000); return(false); }
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 CalendarController( IDiscordSender discordSender, DutyManager <ApplicationDbContext> dutyManager, UserManager <Student> userManager) { _discordSender = discordSender; _dutyManager = dutyManager; _userManager = userManager; }
private IEnumerator Start() { Stopwatch stopWatch = new Stopwatch(); stopWatch.Reset(); stopWatch.Start(); yield return(new WaitForEndOfFrame()); mDutyManager = new DutyManager(); SingletonMonoBehaviour <UIPortFrame> .Instance.CircleUpdateInfo(mDutyManager); mDutyGrid.SetOnSummarySelectedCallBack(UIDutySummaryEventCallBack); mDutyGrid.SetOnChangePageListener(OnChangePageDutyGrid); DutyModel[] duties = GetDuties(); mDutyGrid.Initialize(duties); SoundFile.LoadBGM(BGMFileInfos.PortTools); _DeteilMode = false; if (duties.Length <= 0) { mDutyGrid.GoToPage(0, focus: false); mTransform_AllClearText.SetActive(isActive: true); UpdateOrderPossibleDutyCount(0, animate: false); KeyControl nextKeyController = mDutyGrid.GetKeyController(); mDutyGrid.FirstFocus(); ChangeKeyController(nextKeyController); stopWatch.Stop(); } else { int orderDutyCount = mDutyManager.MaxExecuteCount - mDutyManager.GetExecutedDutyList().Count; UpdateOrderPossibleDutyCount(orderDutyCount, animate: false); KeyControl greetingOhyodoKeyController = new KeyControl(); ChangeKeyController(greetingOhyodoKeyController); mDutyGrid.GoToPage(0, focus: false); stopWatch.Stop(); for (int frame = 0; frame < stopWatch.Elapsed.Milliseconds / 60; frame++) { yield return(new WaitForEndOfFrame()); } yield return(new WaitForEndOfFrame()); StartCoroutine(GreetingOhyodo(greetingOhyodoKeyController, delegate { KeyControl keyController = this.mDutyGrid.GetKeyController(); this.ChangeKeyController(keyController); })); mDutyGrid.FirstFocus(); } SingletonMonoBehaviour <PortObjectManager> .Instance.PortTransition.EndTransition(delegate { var preloadBGM = SoundFile.LoadBGM(BGMFileInfos.PortTools); SoundUtils.SwitchBGM(preloadBGM); }); }
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; } }
public DutyController( //IHostedService hostedService, IDiscordSender discordSender, DutyManager <ApplicationDbContext> dutyManager, PostManager <ApplicationDbContext> postManager, ShareManager <ApplicationDbContext> shareManager, SubjectManager <ApplicationDbContext> subjectManager, UserManager <Student> userManager) { _discordSender = discordSender; _dutyManager = dutyManager; //_mailingCron = hostedService as MailingCron; _postManager = postManager; _shareManager = shareManager; _subjectManager = subjectManager; _userManager = userManager; }
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 void OnDestroy() { if (DOTween.IsTweening(mLabel_DutyCount)) { DOTween.Kill(mLabel_DutyCount); } if (DOTween.IsTweening(mTexture_LeftArrow)) { DOTween.Kill(mTexture_LeftArrow); } if (DOTween.IsTweening(mTexture_RightArrow)) { DOTween.Kill(mTexture_RightArrow); } if (DOTween.IsTweening(mTexture_LeftArrowShadow)) { DOTween.Kill(mTexture_LeftArrowShadow); } if (DOTween.IsTweening(mTexture_RightArrowShadow)) { DOTween.Kill(mTexture_RightArrowShadow); } UserInterfacePortManager.ReleaseUtils.Releases(ref mTextures_Preload); UserInterfacePortManager.ReleaseUtils.Release(ref mLabel_DutyCount); UserInterfacePortManager.ReleaseUtils.Release(ref mTexture_LeftArrow); UserInterfacePortManager.ReleaseUtils.Release(ref mTexture_RightArrow); UserInterfacePortManager.ReleaseUtils.Release(ref mTexture_LeftArrowShadow); UserInterfacePortManager.ReleaseUtils.Release(ref mTexture_RightArrowShadow); mTransform_AllClearText = null; mPrefabDutyDetail = null; mPrefabDutyDetailCheck = null; mPrefabUIDutyRewardMaterialsDialog = null; mPrefabRewardShip = null; mModalCamera = null; mPrefab_DutyOhyodo = null; mDutyGrid = null; mDutyManager = null; mFocusKeyController = null; }
public static async Task StopBusy(bool leaveDuty = true, bool stopFishing = true, bool dismount = true) { for (var tryStep = 1; tryStep < 6; tryStep++) { if (!CheckIfBusy(leaveDuty, stopFishing, dismount)) { break; } Log($"We're occupied. Trying to exit out. Attempt #{tryStep}"); if (stopFishing && FishingManager.State != FishingState.None) { var quit = ActionManager.CurrentActions.Values.FirstOrDefault(i => i.Id == 299); if (quit != default(SpellData)) { Log($"Exiting Fishing."); if (ActionManager.CanCast(quit, Core.Me)) { ActionManager.DoAction(quit, Core.Me); await Coroutine.Wait(6000, () => FishingManager.State == FishingState.None); } } } if (CraftingLog.IsOpen || CraftingManager.IsCrafting || Synthesis.IsOpen) { Log($"Closing Crafting Window."); await Lisbeth.ExitCrafting(); Synthesis.Close(); await Coroutine.Wait(6000, () => !Synthesis.IsOpen); await Coroutine.Wait(1500, () => CraftingLog.IsOpen); CraftingLog.Close(); await Coroutine.Wait(6000, () => !CraftingLog.IsOpen); await Coroutine.Wait(6000, () => !CraftingManager.IsCrafting && !MovementManager.IsOccupied); } if (leaveDuty && DutyManager.InInstance) { Log($"Leaving Diadem."); DutyManager.LeaveActiveDuty(); if (await Coroutine.Wait(30000, () => CommonBehaviors.IsLoading)) { await Coroutine.Yield(); await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading); await Coroutine.Sleep(5000); } } if (dismount && Core.Me.IsMounted) { Log("Dismounting."); ActionManager.Dismount(); await Coroutine.Wait(3000, () => !Core.Me.IsMounted); } if (InSmallTalk) { Log("Skipping smalltalk."); await SmallTalk(); } await Coroutine.Sleep(2500); } if (CheckIfBusy(leaveDuty, stopFishing, dismount)) { Log("Something went wrong, we're still occupied."); TreeRoot.Stop("Stopping bot."); } }
public async Task GatherWeatherNodes() { if (WorldManager.RawZoneId != 901) { await EnterDiadem(); Log($"Waiting for instance time"); await Coroutine.Wait(5000, () => TimeLeftInDiadem.TotalMinutes > 1); Log($"Time left {TimeLeftInDiadem:hh\\:mm\\:ss}"); } lastChange = new WaitTimer(new TimeSpan(0, 7, 0)); Log($"Current Weather: {WorldManager.CurrentWeather} {WorldManager.CurrentWeatherId}"); Random time = new Random(); int minutes = time.Next(10, 20); int sec = time.Next(0, 59); standBy = afkSpots[time.Next(0, afkSpots.Length)]; while (TimeLeftInDiadem > new TimeSpan(0, minutes, sec)) { switch (WorldManager.CurrentWeatherId) { case 133: if (lastWeather == 133) { break; } //await FlyTo(new Vector3(-295.9257f, 268.4518f, -370.327f)); await MineWeather(ClassJobType.Miner, umbralFlareAbove, umbralFlare); standBy = afkSpots[time.Next(0, afkSpots.Length)]; await StandBy(); break; case 135: if (lastWeather == 135) { break; } await MineWeather(ClassJobType.Miner, umbralLevinAbove, umbralLevin); standBy = afkSpots[time.Next(0, afkSpots.Length)]; await StandBy(); break; case 134: if (lastWeather == 134) { break; } await MineWeather(ClassJobType.Botanist, umbralDuststormAbove, umbralDuststorm); standBy = afkSpots[time.Next(0, afkSpots.Length)]; await StandBy(); break; case 136: if (lastWeather == 136) { break; } await MineWeather(ClassJobType.Botanist, umbralTempestAbove, umbralTempest); standBy = afkSpots[time.Next(0, afkSpots.Length)]; await StandBy(); break; default: await Coroutine.Sleep(1000); if (lastChange.IsFinished) { lastChange.Reset(); lastWeather = 0; } await StandBy(); break; } await Coroutine.Sleep(1000); } if (DutyManager.InInstance) { Log($"Out of time: {TimeLeftInDiadem:hh\\:mm\\:ss} Left"); DutyManager.LeaveActiveDuty(); if (await Coroutine.Wait(30000, () => CommonBehaviors.IsLoading)) { await Coroutine.Yield(); await Coroutine.Wait(Timeout.Infinite, () => !CommonBehaviors.IsLoading); await Coroutine.Sleep(10000); } } }
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; }
/// <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)); }
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; }
public static async Task CheckVentureTask() { var verified = await VerifiedRetainerData(); if (!verified) { return; } var count = await HelperFunctions.GetNumberOfRetainers(); var rets = Core.Memory.ReadArray <RetainerInfo>(Offsets.RetainerData, count); var now = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds; if (rets.Any(i => i.Active && i.VentureTask != 0 && (i.VentureEndTimestamp - now) <= 0 && SpecialCurrencyManager.GetCurrencyCount(SpecialCurrency.Venture) > 2)) { if (FishingManager.State != FishingState.None) { var quit = ActionManager.CurrentActions.Values.FirstOrDefault(i => i.Id == 299); if (quit != default(SpellData)) { Log($"Exiting Fishing"); if (ActionManager.CanCast(quit, Core.Me)) { ActionManager.DoAction(quit, Core.Me); await Coroutine.Wait(6000, () => FishingManager.State == FishingState.None); } } } if (CraftingLog.IsOpen) { Log($"Closing Crafting Window"); await Lisbeth.ExitCrafting(); await Coroutine.Wait(6000, () => !CraftingLog.IsOpen); await Coroutine.Wait(6000, () => !CraftingManager.IsCrafting && !MovementManager.IsOccupied); } if (DutyManager.InInstance) { Log($"Leaving Diadem"); DutyManager.LeaveActiveDuty(); if (await Coroutine.Wait(30000, () => CommonBehaviors.IsLoading)) { await Coroutine.Yield(); await Coroutine.Wait(Timeout.Infinite, () => !CommonBehaviors.IsLoading); await Coroutine.Sleep(5000); } } if (DutyManager.InInstance || CraftingLog.IsOpen || FishingManager.State != FishingState.None || MovementManager.IsOccupied || CraftingManager.IsCrafting) { Log("Something went wrong"); return; } var bell = await GoToSummoningBell(); if (bell == false) { LogCritical("No summoning bell near by"); return; } await RetainerRoutine.ReadRetainers(RetainerCheckOnlyVenture); } else { Log("No Ventures Complete"); } }