Ejemplo n.º 1
0
        private void ErrorHandling()
        {
            if (ErrorDialog.IsVisible)
            {
                // Check if Demonbuddy found errordialog
                if (!_handlederror)
                {
                    Send(ControlRequest.CheckConnection);
                    _handlederror = true;
                }
                else
                {
                    _handlederror = false;
                    ErrorDialog.Click();
                    CheckForLoginScreen();
                }
            }

            if (UIElementTester.IsValid(UIElement.ErrorDialogOkButton))
            {
                // Demonbuddy failed to find error dialog use static hash to find the OK button
                Send(ControlRequest.CheckConnection);
                Zeta.Game.Internals.UIElement.FromHash(UIElement.ErrorDialogOkButton).Click();
                CheckForLoginScreen();
            }

            _handlederror = false;
            if (UIElementTester.IsValid(UIElement.LoginScreenUsername))
            {
                // We are at loginscreen
                Send(ControlRequest.CheckConnection);
            }
        }
Ejemplo n.º 2
0
        // Detect if we are booted to login screen or character selection screen
        private void CheckForLoginScreen()
        {
            DateTime timeout = DateTime.UtcNow;

            while (DateTime.UtcNow.Subtract(timeout).TotalSeconds <= 15)
            {
                BotMain.PauseFor(TimeSpan.FromMilliseconds(600));
                if (UIElementTester.IsValid(UIElement.StartResumeButton))
                {
                    break;
                }
                if (UIElementTester.IsValid(UIElement.LoginScreenUsername))
                {
                    // We are at loginscreen
                    Send(ControlRequest.CheckConnection);
                    break;
                }
                Thread.Sleep(500);
            }
        }