Exemplo n.º 1
0
        /// <summary>
        /// Determines if the client is logged into world 385 (F2P) or world 386 (P2P).
        /// Also identifies worlds 358 and 368 as bot worlds.
        /// Assumes that the client is logged into the game.
        /// </summary>
        /// /// <param name="readWindow">Set to true to force a new screen read</param>
        /// <returns>true if the client is logged into world 385 or 386</returns>
        protected bool LoggedIntoBotWorld(bool readWindow = false)
        {
            Screen.MakeSureWindowHasBeenRead(readWindow);
            Inventory.OpenLogout();
            SafeWaitPlus(1000, 150);
            Screen.ReadWindow();
            if (!Screen.WorldSwitcherIsOpen())
            {
                ClickWorldSwitcher();
                SafeWaitPlus(1500, 500);
                Screen.ReadWindow();
            }

            Stopwatch watch = new Stopwatch();

            watch.Start();
            while (!Screen.WorldSwitcherIsOpen() && (watch.ElapsedMilliseconds < 3000) && !StopFlag)
            {
                ClickWorldSwitcher();
                SafeWait(600, 200);
                Screen.ReadWindow();
            }

            int  left           = Screen.Width - 84;
            int  right          = left + 30;
            int  top            = Screen.Height - 297;
            int  bottom         = top + 20;
            long colorSum       = ImageProcessing.ColorSum(Vision.ScreenPiece(left, right, top, bottom));
            bool freeBotWorld   = Numerical.CloseEnough(120452, colorSum, 0.00001);
            bool memberBotWorld = Numerical.CloseEnough(121998, colorSum, 0.00001);

            return(memberBotWorld || freeBotWorld);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Logs out of the game
        /// </summary>
        protected void Logout()
        {
            RunParams.LoggedIn = false; //Signal our intent to logout immediately to anything else that is checking the login state.
            const int maxLogoutAttempts = 10;
            int       logoutAttempts    = 0;

            while (!Screen.IsLoggedOut(true) && (logoutAttempts++ < maxLogoutAttempts) && !StopFlag)
            {
                Inventory.OpenLogout();
                SafeWait(800, 200);
                LeftClick(Screen.Width - 38, Screen.Height - 286);    //close out of world switcher
                SafeWait(2000, 400);
                LeftClick(Screen.Width - 120, Screen.Height - 71, 5); //click here to logout
                SafeWait(2000, 400);
            }
        }