/// <summary> /// Receive Pulse event from DemonBuddy. /// </summary> public void OnPulse() { using (new PerformanceLogger("OnPulse")) { try { // At Login screen, derp! var loginSubmitButton = Zeta.Game.Internals.UIElement.FromName("Root.NormalLayer.BattleNetLogin_main.LayoutRoot.LoginContainer.SubmitButton"); if (loginSubmitButton != null && loginSubmitButton.IsValid && loginSubmitButton.IsVisible && BotMain.IsRunning) { new Thread(() => { BotMain.Stop(); Thread.Sleep(1000); BotMain.Start(); }) { IsBackground = true, Name = "LoginScreenBouncer", }.Start(); return; } if (ZetaDia.Me == null) { return; } if (!ZetaDia.IsInGame || !ZetaDia.Me.IsValid || ZetaDia.IsLoadingWorld) { return; } GameUI.SafeClickUIButtons(); if (ZetaDia.Me.IsDead) { return; } using (new PerformanceLogger("LazyRaiderClickToPause")) { if (Settings.Advanced.LazyRaiderClickToPause && !BotMain.IsPaused) { BotMain.PauseWhile(MouseLeft); } } // See if we should update the stats file if (DateTime.UtcNow.Subtract(ItemStatsLastPostedReport).TotalSeconds > 10) { ItemStatsLastPostedReport = DateTime.UtcNow; OutputReport(); } // Recording of all the XML's in use this run UsedProfileManager.RecordProfile(); Monk_MaintainTempestRush(); } catch (AccessViolationException) { // woof! } catch (Exception ex) { Logger.Log(LogCategory.UserInformation, "Exception in Pulse: {0}", ex.ToString()); } } }