private void ErrorHandling() { if (ErrorDialog.IsVisible) { // Check if Demonbuddy found errordialog if (!handlederror) { Send("CheckConnection", pause: true); handlederror = true; } else { handlederror = false; ErrorDialog.Click(); bootTo(); } } else if (UIElementTester.isValid(_UIElement.errordialog_okbutton)) { // Demonbuddy failed to find error dialog use static hash to find the OK button Send("CheckConnection", pause: true); UIElement.FromHash(_UIElement.errordialog_okbutton).Click(); bootTo(); } else { handlederror = false; if (UIElementTester.isValid(_UIElement.loginscreen_username)) { // We are at loginscreen Send("CheckConnection", pause: true); } } }
// Detect if we are booted to login screen or character selection screen private void bootTo() { var timeout = DateTime.Now; while (DateTime.Now.Subtract(timeout).TotalSeconds <= 15) { BotMain.PauseFor(TimeSpan.FromMilliseconds(600)); if (UIElementTester.isValid(_UIElement.startresume_button)) { break; } if (UIElementTester.isValid(_UIElement.loginscreen_username)) { // We are at loginscreen Send("CheckConnection", pause: true); break; } Thread.Sleep(500); } }