Ejemplo n.º 1
0
        /// <summary>
        /// Find the in-game screen we're on.
        /// </summary>
        /// <param name="device"></param>
        /// <returns></returns>
        private BotState GetCurrentBotState(DeviceData device)
        {
            // Check if in Main screen
            if (!ADBCommandService.IsL2RRunning(device))
            {
                return(BotState.L2R_DEAD);
            }
            else if (GStateInGameMagMainScreen.IsState(device, _data) || GStateInGameMainScreen.IsState(device, _data))
            {
                if (RunElite)
                {
                    return(BotState.GOTO_ELITE);
                }
                return(BotState.MAIN_INGAME_SCREEN);
            }
            //if (EliteTransition[EliteTransition.Count - 1].IsState(device))
            //{
            //   if (RunElite)
            //   {
            //        return BotState.RUN_ELITE;
            //    }
            //}

            return(BotState.L2R_DEAD);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  L2R is dead and needs to be launched.
        /// </summary>
        /// <param name="device">ADB Device</param>
        /// <returns>The next state</returns>
        public override bool Run(DeviceData device)
        {
            ushort maxWaitSeconds = 100;

Relaunch:
            ADBCommandService.KillL2R(device);
            Thread.Sleep(5000);
            ADBCommandService.LaunchL2R(device);
            Thread.Sleep(5000);
            if (!ADBCommandService.IsL2RRunning(device))
            {
                goto Relaunch;
            }


            while (maxWaitSeconds > 0)
            {
                Console.WriteLine(" maxWaitSeconds DEADL2R");

                if (Next.IsState(device))
                {
                    Console.WriteLine("NEXT STATE DEADL2R");
                    return(true);
                }
                Thread.Sleep(1000);
                --maxWaitSeconds;
            }

            maxWaitSeconds += 20;
            goto Relaunch;
        }
Ejemplo n.º 3
0
        public override bool Run(DeviceData device)
        {
            Thread.Sleep(2000);

            ushort maxWaitSeconds;

            ushort.TryParse(_data["macros:char_select_exit_ad:x"], out ushort x);
            ushort.TryParse(_data["macros:char_select_exit_ad:y"], out ushort y);

OutAd:
            ADBCommandService.SendClick(device, x, y);
            maxWaitSeconds = 120;

            while (maxWaitSeconds > 0)
            {
                Thread.Sleep(1000);
                if (Next.IsState(device))
                {
                    return(true);
                }
                else if (IsState(device))
                {
                    goto OutAd;
                }
                --maxWaitSeconds;
            }

            return(false);
        }
Ejemplo n.º 4
0
        public override bool Run(DeviceData device)
        {
            Thread.Sleep(2000);

            ushort maxWaitSeconds;

            ushort.TryParse(_data["macros:char_enter_game_button:x"], out ushort x);
            ushort.TryParse(_data["macros:char_enter_game_button:y"], out ushort y);
            maxWaitSeconds = 200;

EnterGame:
            ADBCommandService.SendClick(device, x, y);

            while (maxWaitSeconds > 0)
            {
                Console.WriteLine("State: " + GetType());

                Thread.Sleep(1000);
                if (Next.IsState(device))
                {
                    return(true);
                }
                else if (IsState(device))
                {
                    goto EnterGame;
                }
                --maxWaitSeconds;
            }

            return(false);
        }
Ejemplo n.º 5
0
        public override bool Run(DeviceData device)
        {
            ushort maxWait = 60;

            while (maxWait > 0)
            {
                Console.WriteLine("State: " + GetType() + " " + maxWait);

                if (IsState(device))
                {
                    Thread.Sleep(3000);
                    ushort.TryParse(_data["macros:weekly_rewards_menu_exit:x"], out ushort x);
                    ushort.TryParse(_data["macros:weekly_rewards_menu_exit:y"], out ushort y);
                    ADBCommandService.SendTripleClick(device, x, y);
                    Thread.Sleep(3000);
                    return(true);
                }
                else if (GStateInGameMagMainScreen.IsState(device, _data) || GStateInGameMainScreen.IsState(device, _data))
                {
                    Thread.Sleep(3000);
                    return(true);
                }
                --maxWait;
            }

            return(true);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Macro through the login screen
        /// </summary>
        /// <param name="device">ADB Device</param>
        /// <returns>The next State. Returns null if there's an error</returns>
        public override bool Run(DeviceData device)
        {
            Thread.Sleep(2000);

            ushort maxWaitSeconds;

            ushort.TryParse(_data["macros:login:x"], out ushort xLogin);
            ushort.TryParse(_data["macros:login:y"], out ushort yLogin);
Login:

            ADBCommandService.SendClick(device, xLogin, yLogin);

            maxWaitSeconds = 100;
            while (maxWaitSeconds > 0)
            {
                Thread.Sleep(1000);
                if (Next.IsState(device))
                {
                    return(true);
                }
                else if (IsState(device))
                {
                    goto Login;
                }
                --maxWaitSeconds;
            }

            return(false);
        }
Ejemplo n.º 7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="device"></param>
 /// <returns></returns>
 public override bool IsState(DeviceData device)
 {
     if (!ADBCommandService.IsL2RRunning(device))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 8
0
        public static bool IsState(DeviceData device, IConfiguration _data)
        {
            ushort.TryParse(_data["pixels:ingame_main_screen:coords:x"], out ushort x);
            ushort.TryParse(_data["pixels:ingame_main_screen:coords:y"], out ushort y);
            String color = _data["pixels:ingame_main_screen:color"];

            return(ADBCommandService.CheckPixel(device, x, y, color));
        }
Ejemplo n.º 9
0
 public override bool IsState(DeviceData device)
 {
     if (ADBCommandService.CheckPixel(device, Sig.X, Sig.Y, Sig.Color))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 10
0
        public override bool IsState(DeviceData device)
        {
            if (ADBCommandService.CheckPixel(device, Sig.X, Sig.Y, Sig.Color))
            {
                return(true);
            }

            return(GStateInGameMagMainScreen.IsState(device, _data) || GStateInGameMainScreen.IsState(device, _data));
        }
Ejemplo n.º 11
0
        public override bool Run(DeviceData device)
        {
            ushort maxTries = 6;

            while (maxTries > 0)
            {
                ushort.TryParse(_data["macros:map:x"], out ushort xMap);
                ushort.TryParse(_data["macros:map:y"], out ushort yMap);
                ADBCommandService.SendTripleClick(device, xMap, yMap);

                Thread.Sleep(5000);
                ushort.TryParse(_data["macros:map_portal_button:x"], out ushort xMapPortal);
                ushort.TryParse(_data["macros:map_portal_button:y"], out ushort yMapPortal);

                ADBCommandService.SendTripleClick(device, xMapPortal, yMapPortal);
                Thread.Sleep(2000);

                ushort.TryParse(_data["macros:goto_mag_button:x"], out ushort xGotoMag);
                ushort.TryParse(_data["macros:goto_mag_button:y"], out ushort yGotoMag);
                ADBCommandService.SendTripleClick(device, xGotoMag, yGotoMag);
                Thread.Sleep(2000);

                ushort.TryParse(_data["macros:enter_mag_button:x"], out ushort xEnterMag);
                ushort.TryParse(_data["macros:enter_mag_button:y"], out ushort yEnterMag);
                ADBCommandService.SendTripleClick(device, xEnterMag, yEnterMag);

                // Maybe we can wait for isstate here
                Thread.Sleep(10000);

                if (GStateInGameMagMainScreen.IsState(device, _data) || GStateInGameMainScreen.IsState(device, _data))
                {
                    ushort.TryParse(_data["macros:exit_instance_button:x"], out ushort xExitMag);
                    ushort.TryParse(_data["macros:exit_instance_button:y"], out ushort yExitMag);
                    ADBCommandService.SendTripleClick(device, xExitMag, yExitMag);
                    Thread.Sleep(2000);
                    return(true);
                }
                else
                {
                    --maxTries;
                }
            }

            return(false);
        }
Ejemplo n.º 12
0
        public override bool Run(DeviceData device)
        {
            ADBCommandService.SendTab(device);


            ushort.TryParse(_data["macros:tabbed_dungeon_button:x"], out ushort xDung);
            ushort.TryParse(_data["macros:tabbed_dungeon_button:y"], out ushort yDung);
            ADBCommandService.SendTripleClick(device, xDung, yDung);
            Thread.Sleep(5000);

            ushort.TryParse(_data["macros:tabbed_normal_dungeon_button:x"], out ushort xNormDung);
            ushort.TryParse(_data["macros:tabbed_normal_dungeon_button:y"], out ushort yNormDung);

            ADBCommandService.SendClick(device, xNormDung, yNormDung);
            Thread.Sleep(5000);

            ushort.TryParse(_data["macros:daily_dungeon_menu_elite_dungeon_button:x"], out ushort xElite);
            ushort.TryParse(_data["macros:daily_dungeon_menu_elite_dungeon_button:y"], out ushort yElite);
            ADBCommandService.SendTripleClick(device, xElite, yElite);
            Thread.Sleep(5000);


            ushort maxTries = 10;

            while (maxTries > 0)
            {
                if (GStateEliteDungeonEnterButton.IsState(device, _data))
                {
                    ushort.TryParse(_data["macros:enter_elite_dungeon_button:x"], out ushort xExitMag);
                    ushort.TryParse(_data["macros:enter_elite_dungeon_button:y"], out ushort yExitMag);
                    ADBCommandService.SendTripleClick(device, xExitMag, yExitMag);
                    Thread.Sleep(20000);
                    // CHECK IF IN ELITE HERE ELSE RETURN FALSE AND TRY AGAIN
                    return(true);
                }
                Thread.Sleep(600);
                --maxTries;
            }
            return(false);
        }