Exemplo n.º 1
0
        //this will need to be rewritten to use raw input instead of hacky WinForms input...
        public void MouseUpdate(SwitchInputSink sink, Panel panel1)
        {
            if (!firstTime)
            {
                Point m_translation = mouseTranslation.Translate(Mouse.Position, center);
                var   x             = m_translation.X;
                var   y             = m_translation.Y;

                if (x > 255)
                {
                    Mouse.Position = new Point(Mouse.Position.X - (x - 255), Mouse.Position.Y);
                    x = 255;
                }
                else if (x < 0)
                {
                    Mouse.Position = new Point(Mouse.Position.X - x, Mouse.Position.Y);
                    x = 0;
                }
                if (y > 255)
                {
                    Mouse.Position = new Point(Mouse.Position.X, Mouse.Position.Y - (y - 255));
                    y = 255;
                }
                else if (y < 0)
                {
                    Mouse.Position = new Point(Mouse.Position.X, Mouse.Position.Y - y);
                    y = 0;
                }

                if (last.X != x)
                {
                    Console.WriteLine(x + ", " + y);
                    sink.Update(InputFrame.ParseInputString("RX=" + x));
                }

                if (last.Y != y)
                {
                    Console.WriteLine(x + ", " + y);
                    sink.Update(InputFrame.ParseInputString("RY=" + y));
                }
                Mouse.Position = center;
                last           = new Point(x, y);
            }
            else
            {
                firstTime      = false;
                Mouse.Position = new Point(panel1.PointToScreen(Point.Empty).X + 128, panel1.PointToScreen(Point.Empty).Y + 128);
                center         = Mouse.Position;
            }
        }
Exemplo n.º 2
0
        public void Bot()
        {
            // Start Horipad Emulator(InputRedirection)

            string RegistyKey           = "HKEY_CURRENT_USER\\SOFTWARE\\Mitsuki\\LinkBots";
            string RegistyBotReadyCount = "BotsReadyCount";
            string RegistyBotCount      = "BotsAmount";
            int    Bots         = 0;
            int    BotsAmount   = 0;
            bool   FirstStarted = true;

            Input = new SwitchInputSink(Port);
            int ConnectAttemps = 0;

            Program.form.ApplyLog($"Use Sync: {UseSync.ToString()} Reconnect After: {ReconnectAfter} Slot: {Slot} Link Code: {LinkCode}");

            while (!Program.botConnected)
            {
                if (ConnectAttemps >= 5)
                {
                    Program.form.ApplyLog("Can't connect to Device!");
                    Program.form.UpdateStatus("Failed to connect to Console!");
                    Program.botRunning   = false;
                    Program.botConnected = false;
                    break;
                }
                Input.BotWait(1000);
                ConnectAttemps++;
            }
            if (Program.botConnected && Program.botRunning)
            {
                if (UseSync)
                {
                    Program.form.ApplyLog("Bot Sync is Enabled!");
                }
                Program.form.ApplyLog("Starting Bot in 5 Seconds...");
                Input.SendButton(Button.B, 1000);
                Input.SendButton(Button.B, 1000);
                Input.SendButton(Button.B, 1000);
            }
            while (Program.botRunning)
            {
                try
                {
                    if (CurrentTrades > ReconnectAfter || FirstStarted)
                    {
                        //Reconnect if disconnected
                        Program.form.ApplyLog("Auto Reconnect is enabled, reconnecting if disconnected...");
                        // Open Y-COM
                        Program.form.ApplyLog("Open Y-COM Menu");
                        Input.SendButton(Button.Y, 2000);

                        //Press Plus, don't need a confirmation if not connected
                        Input.SendButton(Button.Plus, 2000);
                        Program.form.ApplyLog("Wait 20 Seconds to ensure we are connected");
                        //Wait 15 Seconds
                        Input.BotWait(20000);
                        Program.form.ApplyLog("Reconnected! Return to Overworld");
                        //Return to Overworld
                        Input.SendButton(Button.B, 1500);
                        Input.SendButton(Button.B, 1500);
                        CurrentTrades = 1;
                        FirstStarted  = false;
                    }


                    Program.form.ApplyLog("Open Y-COM Menu");
                    Input.SendButton(Button.Y, 2000);
                    Program.form.ApplyLog("Select Link Trade Trade");
                    Input.SendButton(Button.A, 1000);
                    Program.form.ApplyLog("Select Password");
                    Input.SendDpad(DPad.Down, 100);
                    Input.SendButton(Button.A, 1000);
                    Input.SendButton(Button.A, 1000);

                    /* German version needs 3 A Presses? */
                    if (IsGerman)
                    {
                        Input.SendButton(Button.A, 1000);
                    }

                    Input.BotWait(3000);
                    Program.form.ApplyLog("Enter Code: " + LinkCode);
                    SelectTradeCode(LinkCode);
                    Input.SendButton(Button.Plus, 100);

                    //Start a Link Trade, in case of Empty Slot/Egg/Bad Pokemon we press sometimes B to return to the Overworld and skip this Slot.
                    Program.form.ApplyLog("Confirming...");
                    Input.SendButton(Button.A, 2000);
                    Input.SendButton(Button.A, 2000);
                    Input.SendButton(Button.A, 2000);
                    Input.SendButton(Button.A, 2000);
                    Thread.Sleep(new Random().Next(100, 1000));
                    if (UseSync)
                    {
                        Bots       = Convert.ToInt16(Registry.GetValue(RegistyKey, RegistyBotReadyCount, 0).ToString());
                        BotsAmount = Convert.ToInt16(Registry.GetValue(RegistyKey, RegistyBotCount, 0).ToString());
                        // Increase BotReady Count
                        Program.form.ApplyLog("Waiting for other Bots...");
                        Bots++;

                        Registry.SetValue(RegistyKey, RegistyBotReadyCount, Bots.ToString(), RegistryValueKind.String);

                        while (Bots < BotsAmount)
                        {
                            try
                            {
                                // Get Registry Values for Bots
                                Bots = Convert.ToInt16(Registry.GetValue(RegistyKey, RegistyBotReadyCount, 0).ToString());

                                BotsAmount = Convert.ToInt16(Registry.GetValue(RegistyKey, RegistyBotCount, 0).ToString());
                            }
                            catch
                            {
                                break;
                            }
                            Thread.Sleep(100);
                        }
                        Program.form.ApplyLog("Bots are Ready!");
                    }
                    Thread.Sleep(new Random().Next(500, 2500));

                    Input.SendButton(Button.A, 1000);
                    Program.form.ApplyLog("Wait 30 Seconds for Trainer...");
                    Input.BotWait(40000);
                    Program.form.ApplyLog("Potential Trainer Found!");

                    Program.form.ApplyLog("Select Pokemon");
                    SelectBoxSlot(Box, Slot, 250);

                    Input.SendButton(Button.A, 2000);
                    Input.SendButton(Button.A, 2000);
                    Program.form.ApplyLog("Wait for User Input...");

                    for (int i = 0; i < 25; i++)
                    {
                        Input.SendButton(Button.A, 1000);
                    }

                    Input.SendButton(Button.A, 3000);
                    Program.form.ApplyLog("Link Trade Started, wait 10 seconds, abort after 15 Seconds!");
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);

                    Input.SendButton(Button.A, 1500);
                    Input.SendButton(Button.A, 1500);
                    Program.form.ApplyLog("Wait 30 Seconds until Trade is finished...");

                    Input.BotWait(30000 + new Random().Next(500, 5000));

                    Program.form.ApplyLog("Pokemon has been prolly arrived, bypass Trade Evolution...");
                    Input.SendButton(Button.Y, 1000);
                    Input.BotWait(1000 + new Random().Next(500, 5000));

                    for (int i = 0; i < 10; i++)
                    {
                        Input.SendButton(Button.B, 1000);
                        Input.SendButton(Button.B, 1000);
                        Input.SendButton(Button.A, 1000);
                    }
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);

                    // Spam A Button for 40 seconds in Case of Trade Evolution/Moves Learnings/Dex
                    for (int ii = 0; ii < 20; ii++)
                    {
                        Input.SendButton(Button.A, 1000);
                    }

                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);
                    Program.form.ApplyLog("Trade was Successfull!");

                    if (Slot > 29)
                    {
                        Box++;
                        Slot = 1;
                    }
                    else
                    {
                        Slot++;
                    }
                    CurrentTrades++;
                }
                catch
                {
                    Program.form.ApplyLog("Bot lost connection to Host, check your cable connected!");
                    Program.form.UpdateStatus("Disconnected! | Can't connect to Host!");
                }
                Thread.Sleep(100);
            }
            Program.form.ApplyLog("Bot Stopped!");
        }
Exemplo n.º 3
0
        public void KeyBoardUpdate(SwitchInputSink sink)
        {
            //--------------- Y BUTTON ---------------
            if (KeyBindDown(Y.bind))
            {
                if (!Y.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + Y.ID));
                    Y.pressed = true;
                    Console.WriteLine("Y");
                }
            }
            else if (!KeyBindDown(Y.bind) && Y.pressed)
            {
                Y.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + Y.ID));
            }

            //--------------- B BUTTON / JUMP ---------------
            if (KeyBindDown(B.bind))
            {
                if (!B.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + B.ID));
                    B.pressed = true;
                    Console.WriteLine("B");
                }
            }
            else if (!KeyBindDown(B.bind) && B.pressed)
            {
                B.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + B.ID));
            }

            //--------------- A BUTTON ---------------
            if (KeyBindDown(A.bind))
            {
                if (!A.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + A.ID));
                    A.pressed = true;
                    Console.WriteLine("A");
                }
            }
            else if (!KeyBindDown(A.bind) && A.pressed)
            {
                A.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + A.ID));
            }

            //--------------- X BUTTON / MAP ---------------
            if (KeyBindDown(X.bind))
            {
                if (!X.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + X.ID));
                    X.pressed = true;
                    Console.WriteLine("X");
                }
            }
            else if (!KeyBindDown(X.bind) && X.pressed)
            {
                X.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + X.ID));
            }

            //--------------- L BUTTON ---------------
            if (KeyBindDown(L.bind))
            {
                if (!L.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + L.ID));
                    L.pressed = true;
                    Console.WriteLine("L");
                }
            }
            else if (!KeyBindDown(L.bind) && L.pressed)
            {
                L.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + L.ID));
            }

            //--------------- R BUTTON ---------------
            if (KeyBindDown(R.bind))
            {
                if (!R.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + R.ID));
                    R.pressed = true;
                    Console.WriteLine("R");
                }
            }
            else if (!KeyBindDown(R.bind) && R.pressed)
            {
                R.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + R.ID));
            }

            //--------------- ZL BUTTON / SQUID FORM/RUN ---------------
            if (KeyBindDown(ZL.bind))
            {
                if (!ZL.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + ZL.ID));
                    ZL.pressed = true;
                    Console.WriteLine("ZL");
                }
            }
            else if (!KeyBindDown(ZL.bind) && ZL.pressed)
            {
                ZL.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + ZL.ID));
            }

            //--------------- ZR BUTTON / SHOOT ---------------
            if (KeyBindDown(ZR.bind))
            {
                if (!ZR.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + ZR.ID));
                    ZR.pressed = true;
                    Console.WriteLine("ZR");
                }
            }
            else if (!KeyBindDown(ZR.bind) && ZR.pressed)
            {
                ZR.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + ZR.ID));
            }

            //--------------- L3 BUTTON ---------------
            if (KeyBindDown(L3.bind))
            {
                if (!L3.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + L3.ID));
                    L3.pressed = true;
                    Console.WriteLine("L3");
                }
            }
            else if (!KeyBindDown(L3.bind) && L3.pressed)
            {
                L3.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + L3.ID));
            }

            //--------------- R3 BUTTON / SPECIAL WEAPON ---------------
            if (KeyBindDown(R3.bind))
            {
                if (!R3.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + R3.ID));
                    R3.pressed = true;
                    Console.WriteLine("R3");
                }
            }
            else if (!KeyBindDown(R3.bind) && R3.pressed)
            {
                R3.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + R3.ID));
            }

            //--------------- Minus BUTTON ---------------
            if (KeyBindDown(Minus.bind))
            {
                if (!Minus.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + Minus.ID));
                    Minus.pressed = true;
                    Console.WriteLine("MINUS");
                }
            }
            else if (!KeyBindDown(Minus.bind) && Minus.pressed)
            {
                Minus.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + Minus.ID));
            }

            //--------------- Plus BUTTON ---------------
            if (KeyBindDown(Plus.bind))
            {
                if (!Plus.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + Plus.ID));
                    Plus.pressed = true;
                    Console.WriteLine("PLUS");
                }
            }
            else if (!KeyBindDown(Plus.bind) && Plus.pressed)
            {
                Plus.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + Plus.ID));
            }

            //--------------- HOME BUTTON ---------------
            if (KeyBindDown(Home.bind))
            {
                if (!Home.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + Home.ID));
                    Home.pressed = true;
                    Console.WriteLine("HOME");
                }
            }
            else if (!KeyBindDown(Home.bind) && Home.pressed)
            {
                Home.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + Home.ID));
            }

            //--------------- SHARE BUTTON ---------------
            if (KeyBindDown(Share.bind))
            {
                if (!Share.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("P=" + Share.ID));
                    Share.pressed = true;
                    Console.WriteLine("SHARE");
                }
            }
            else if (!KeyBindDown(Share.bind) && Share.pressed)
            {
                Share.pressed = false;
                sink.Update(InputFrame.ParseInputString("R=" + Share.ID));
            }

            //--------------- WALK MODIFIER ---------------
            //if (KeyBindDown(Key.LeftCtrl))
            //{
            //    if (!walk)
            //    {
            //        walk_modifier = 32;

            //        if (KeyBindDown(Key.W) && l_up)
            //        {
            //            sink.Update(InputFrame.ParseInputString("LY=" + (0 + walk_modifier)));
            //        }
            //        else if (KeyBindDown(Key.S) && l_down)
            //        {
            //            sink.Update(InputFrame.ParseInputString("LY=" + (255 - walk_modifier)));
            //        }


            //        if (KeyBindDown(Key.A) && l_left)
            //        {
            //            sink.Update(InputFrame.ParseInputString("LX=" + (0 + walk_modifier)));
            //        }
            //        else if (KeyBindDown(Key.D) && l_right)
            //        {
            //            sink.Update(InputFrame.ParseInputString("LX=" + (255 - walk_modifier)));
            //        }
            //    }
            //    walk = true;
            //}
            //else if (!KeyBindDown(Key.LeftCtrl) && walk)
            //{
            //    walk = false;
            //    walk_modifier = 0;
            //    Console.WriteLine("WALK UP");
            //}

            //--------------- DPAD UP BUTTON ---------------
            if (KeyBindDown(Up.bind))
            {
                if (!Up.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("D=" + Up.ID));
                    Up.pressed = true;
                    Console.WriteLine("UP");
                }
            }
            else if (!KeyBindDown(Up.bind) && Up.pressed)
            {
                Up.pressed = false;
                sink.Update(InputFrame.ParseInputString("D=8"));
            }

            //--------------- DPAD DOWN BUTTON ---------------
            if (KeyBindDown(Down.bind))
            {
                if (!Down.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("D=" + Down.ID));
                    Down.pressed = true;
                    Console.WriteLine("DOWN");
                }
            }
            else if (!KeyBindDown(Down.bind) && Down.pressed)
            {
                Down.pressed = false;
                sink.Update(InputFrame.ParseInputString("D=8"));
            }

            //--------------- DPAD LEFT BUTTON ---------------
            if (KeyBindDown(Left.bind))
            {
                if (!Left.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("D=" + Left.ID));
                    Left.pressed = true;
                    Console.WriteLine("LEFT");
                }
            }
            else if (!KeyBindDown(Left.bind) && Left.pressed)
            {
                Left.pressed = false;
                sink.Update(InputFrame.ParseInputString("D=8"));
            }

            //--------------- DPAD RIGHT BUTTON ---------------
            if (KeyBindDown(Right.bind))
            {
                if (!Right.pressed)
                {
                    sink.Update(InputFrame.ParseInputString("D=" + Right.ID));
                    Right.pressed = true;
                    Console.WriteLine("RIGHT");
                }
            }
            else if (!KeyBindDown(Right.bind) && Right.pressed)
            {
                Right.pressed = false;
                sink.Update(InputFrame.ParseInputString("D=8"));
            }

            //--------------- UP ---------------
            if (KeyBindDown(Key.W) && !l_up)
            {
                if (KeyBindDown(Key.S) || l_down)
                {
                    l_down = true;
                }
                if (KeyBindDown(Key.W))
                {
                    sink.Update(InputFrame.ParseInputString("LY=" + (0 + walk_modifier)));
                    Console.WriteLine("L_UP");
                }
                l_up = true;
            }
            else if (!KeyBindDown(Key.W) && l_up)
            {
                l_up = false;
                if (!KeyBindDown(Key.W))
                {
                    sink.Update(InputFrame.ParseInputString("LY=128"));
                }
                else
                {
                    l_down = false;
                }
            }

            //--------------- DOWN ---------------
            if (KeyBindDown(Key.S) && !l_down)
            {
                if (KeyBindDown(Key.W) || l_up)
                {
                    l_up = true;
                }
                if (KeyBindDown(Key.S))
                {
                    sink.Update(InputFrame.ParseInputString("LY=" + (255 - walk_modifier)));
                    Console.WriteLine("L_DOWN");
                }
                l_down = true;
            }
            else if (!KeyBindDown(Key.S) && l_down)
            {
                l_down = false;
                if (!KeyBindDown(Key.W))
                {
                    sink.Update(InputFrame.ParseInputString("LY=128"));
                }
                else
                {
                    l_up = false;
                }
            }

            //--------------- LEFT ---------------
            if (KeyBindDown(Key.A) && !l_left)
            {
                if (KeyBindDown(Key.D) || l_right)
                {
                    l_right = true;
                }
                if (KeyBindDown(Key.A))
                {
                    sink.Update(InputFrame.ParseInputString("LX=" + (0 + walk_modifier)));
                    Console.WriteLine("L_LEFT");
                }
                l_left = true;
            }
            else if (!KeyBindDown(Key.A) && l_left)
            {
                l_left = false;
                if (!KeyBindDown(Key.D))
                {
                    sink.Update(InputFrame.ParseInputString("LX=128"));
                }
                else
                {
                    l_right = false;
                }
            }

            //--------------- RIGHT ---------------
            if (KeyBindDown(Key.D) && !l_right)
            {
                if (KeyBindDown(Key.A) || l_left)
                {
                    l_left = true;
                }
                if (KeyBindDown(Key.D))
                {
                    sink.Update(InputFrame.ParseInputString("LX=" + (255 - walk_modifier)));
                    Console.WriteLine("L_RIGHT");
                }
                l_right = true;
            }
            else if (!KeyBindDown(Key.D) && l_right)
            {
                l_right = false;

                if (!KeyBindDown(Key.A))
                {
                    sink.Update(InputFrame.ParseInputString("LX=128"));
                }
                else
                {
                    l_left = false;
                }
            }
        }
Exemplo n.º 4
0
        //not really a functional test
        public void CircleTest(SwitchInputSink sink)
        {
            Point m_translation = mouseTranslation.Translate(circlePosition, new Point(0, 0));

            switch (circleCount)
            {
            case 1:
                circlePosition.X = 0;
                circlePosition.Y = 1;
                break;

            case 2:
                circlePosition.X = 1;
                circlePosition.Y = 1;
                break;

            case 3:
                circlePosition.X = 1;
                circlePosition.Y = 0;
                break;

            case 4:
                circlePosition.X = 1;
                circlePosition.Y = -1;
                break;

            case 5:
                circlePosition.X = 0;
                circlePosition.Y = -1;
                break;

            case 6:
                circlePosition.X = -1;
                circlePosition.Y = -1;
                break;

            case 7:
                circlePosition.X = -1;
                circlePosition.Y = 0;
                break;

            case 8:
                circlePosition.X = -1;
                circlePosition.Y = 1;
                circleCount      = 1;
                break;
            }
            circleCount++;

            var x = m_translation.X;
            var y = m_translation.Y;

            if (x > 255)
            {
                x = 255;
            }
            else if (x < 0)
            {
                x = 0;
            }
            if (y > 255)
            {
                y = 255;
            }
            else if (y < 0)
            {
                y = 0;
            }

            Console.WriteLine(x + ", " + y);
            sink.Update(InputFrame.ParseInputString("RX=" + x));
            sink.Update(InputFrame.ParseInputString("RY=" + y));
        }
Exemplo n.º 5
0
        public void Bot()
        {
            // Start Horipad Emulator(InputRedirection)

            string RegistyKey           = "HKEY_CURRENT_USER\\SOFTWARE\\Mitsuki\\WTBots";
            string RegistyBotReadyCount = "BotsReadyCount";
            string RegistyBotCount      = "BotsAmount";
            int    Bots         = 0;
            int    BotsAmount   = 0;
            bool   FirstStarted = true;

            Program.form.ApplyLog($"Use Sync: {UseSync.ToString()} Reconnect After: {ReconnectAfter} Slot: {Slot} Show Pokemon: {ShowPokemon}");


            Input = new SwitchInputSink(Port);
            int ConnectAttemps = 0;

            while (!Program.botConnected)
            {
                if (ConnectAttemps > 5)
                {
                    Program.form.ApplyLog("Can't connect to Device!");
                    Program.form.UpdateStatus("Failed to connect to Console!");
                    Program.botRunning   = false;
                    Program.botConnected = false;
                    break;
                }
                Input.BotWait(1000);
                ConnectAttemps++;
            }
            if (Program.botConnected && Program.botRunning)
            {
                if (UseSync)
                {
                    Program.form.ApplyLog("Bot Sync is Enabled!");
                }
                Program.form.ApplyLog("Starting Bot in 5 Seconds...");
                Input.SendButton(Button.B, 1000);
                Input.SendButton(Button.B, 1000);
                Input.SendButton(Button.B, 1000);
            }
            while (Program.botRunning)
            {
                try
                {
                    if (CurrentTrades > ReconnectAfter || FirstStarted)
                    {
                        //Reconnect if disconnected
                        Program.form.ApplyLog("Auto Reconnect is enabled, reconnecting if disconnected...");
                        // Open Y-COM
                        Program.form.ApplyLog("Open Y-COM Menu");
                        Input.SendButton(Button.Y, 2000);

                        //Press Plus, don't need a confirmation if not connected
                        Input.SendButton(Button.Plus, 2000);
                        Program.form.ApplyLog("Wait 15 Seconds to ensure we are connected");
                        //Wait 15 Seconds
                        Input.BotWait(15000);
                        Program.form.ApplyLog("Reconnected! Return to Overworld");
                        //Return to Overworld
                        Input.SendButton(Button.B, 1500);
                        Input.SendButton(Button.B, 1500);
                        CurrentTrades = 1;
                        FirstStarted  = false;
                    }


                    Program.form.ApplyLog("Open Y-COM Menu");
                    Input.SendButton(Button.Y, 2000);
                    Program.form.ApplyLog("Select Suprise Trade");
                    Input.SendDpad(DPad.Down, 100);
                    Input.SendButton(Button.A, 1000);
                    Input.BotWait(3000);

                    Program.form.ApplyLog("Select Pokemon");
                    SelectBoxSlot(Box, Slot, 250);

                    Input.SendButton(Button.A, 2000);

                    if (ShowPokemon)
                    {
                        Program.form.ApplyLog("Show Pokemon is enabled, wait 15 Seconds...");
                        Input.BotWait(new Random().Next(13000, 15000));
                    }
                    //Start a Suprise Trade, in case of Empty Slot/Egg/Bad Pokemon we press sometimes B to return to the Overworld and skip this Slot.
                    Program.form.ApplyLog("Confirming...");
                    Input.SendButton(Button.A, 1000);
                    Input.SendButton(Button.A, 3000);
                    Input.SendButton(Button.A, 1000);
                    Input.SendButton(Button.A, 2000);
                    if (UseSync)
                    {
                        Bots       = Convert.ToInt16(Registry.GetValue(RegistyKey, RegistyBotReadyCount, 0).ToString());
                        BotsAmount = Convert.ToInt16(Registry.GetValue(RegistyKey, RegistyBotCount, 0).ToString());
                        // Increase BotReady Count
                        Program.form.ApplyLog("Waiting for other Bots...");
                        Bots++;
                        Registry.SetValue(RegistyKey, RegistyBotReadyCount, Bots.ToString(), RegistryValueKind.String);


                        while (Bots < BotsAmount)
                        {
                            // Get Registry Values for Bots
                            Bots       = Convert.ToInt16(Registry.GetValue(RegistyKey, RegistyBotReadyCount, 0).ToString());
                            BotsAmount = Convert.ToInt16(Registry.GetValue(RegistyKey, RegistyBotCount, 0).ToString());

                            Input.BotWait(100);
                        }
                        Program.form.ApplyLog("Bots are Ready!");
                    }

                    Input.SendButton(Button.A, 3000);
                    Program.form.ApplyLog("Suprise Trade Started, wait 10 seconds...");
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);

                    Input.SendButton(Button.A, 1500);
                    Input.SendButton(Button.A, 1500);
                    Program.form.ApplyLog("Wait until Trade is finished, prevent auto disconnect by walking arround");

                    for (int BypassDisconnect = 0; BypassDisconnect < 35; BypassDisconnect++)
                    {
                        Input.SendAnalog(0, 128, 128, 128, 100);   // Left
                        Input.SendAnalog(-20, 128, 128, 128, 100); // Right
                    }
                    Input.BotWait(1000);

                    Program.form.ApplyLog("Pokemon has been arrived, bypass Trade Evolution...");
                    Input.SendButton(Button.Y, 1000);
                    Input.BotWait(1000);

                    Input.SendButton(Button.A, 1000);
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.A, 1000);
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);


                    for (int i = 0; i < 5; i++)
                    {
                        Input.SendButton(Button.A, 1000);
                    }

                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);

                    // Spam A Button for 40 seconds in Case of Trade Evolution/Moves Learnings/Dex
                    for (int ii = 0; ii < 40; ii++)
                    {
                        Input.SendButton(Button.A, 1000);
                    }

                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);
                    Input.SendButton(Button.B, 1000);
                    Program.form.ApplyLog("Trade was Successfull!");

                    if (Slot > 29)
                    {
                        Box++;
                        Slot = 1;
                    }
                    else
                    {
                        Slot++;
                    }
                    CurrentTrades++;
                }
                catch
                {
                    Program.form.ApplyLog("Bot lost connection to Host, check your cable connected!");
                    Program.form.UpdateStatus("Disconnected! | Can't connect to Host!");
                }
            }
            Program.form.ApplyLog("Bot Stopped!");
        }
Exemplo n.º 6
0
 private void Button4_Click(object sender, EventArgs e)
 {
     sink = new SwitchInputSink(comboBox1.SelectedItem.ToString());
     sink.Update(InputFrame.ParseInputString("P=8"));
 }