Esempio n. 1
0
 public static void Atacar()
 {
     while (true)
     {
         if (Setting.PlayerOnScreen == true || Setting.Kill)
         {
             Thread.CurrentThread.Abort();
         }
         bool targeting = Verificacoes.Targetando();
         bool vivo      = Verificacoes.PokeVivo();
         if (targeting == false && vivo == true)
         {
             if (Setting.PlayerOnScreen == true || Setting.Kill)
             {
                 Thread.CurrentThread.Abort();
             }
             win32.LeftClick(Setting.BattleX, Setting.BattleY);
             if (Setting.tries < Setting.triestotal)
             {
                 if (Setting.Pescar == 1)
                 {
                     Setting.tries++;
                 }
             }
             else
             {
                 Setting.PlayerOnScreen = true;
             }
         }
         Thread.Sleep(300);
         if (targeting == true)
         {
             Setting.tries = 0;
             Moves();
         }
         if (Verificacoes.PokeVivo() == false)
         {
             break;
         }
     }
 }
Esempio n. 2
0
        public void exec()
        {
            if (stop == true)
            {
                Thread.CurrentThread.Abort();
            }
            int time = 200;

            view.Rows[iexec].Selected = true;
            string now = view.Rows[iexec].Cells[1].Value.ToString();

            if (Setting.PausarNoTarget == 1)
            {
                Verificacoes.Targetando();
                while (Setting.IsTargeting == 1)
                {
                    Thread.Sleep(0);
                    Verificacoes.Targetando();
                }
            }
            if (Setting.PausarNoTarget == 1)
            {
                Verificacoes.Targetando();
                while (Setting.IsTargeting == 1)
                {
                    Thread.Sleep(0);
                    Verificacoes.Targetando();
                }
            }
            switch (now)
            {
            default:
                break;

            case "Waypoint":
                int ix = Convert.ToInt32(view.Rows[iexec].Cells[2].Value);
                int iy = Convert.ToInt32(view.Rows[iexec].Cells[3].Value);
                int nx, ny, lx, ly;
                int max = 5;
                while (Setting.charx != ix | Setting.chary != iy)
                {
                    if (Setting.PausarNoTarget == 1)
                    {
                        Verificacoes.Targetando();
                        while (Setting.IsTargeting == 1)
                        {
                            Thread.Sleep(0);
                            Verificacoes.Targetando();
                        }
                    }
                    if (Setting.charx < ix)
                    {
                        lx = Setting.charx;
                        win32.SetForegroundWindow(otpHandle);
                        //SendKeysA(Keys.Right);
                        SendKeys.SendWait("{Right}");
                        Thread.Sleep(time);
                        nx = Setting.charx;
                        if (lx == nx)
                        {
                            //if(Rdn.Radn() == 0) SendKeys.SendWait("{Up}");
                            //else SendKeys.SendWait("{Down}");
                        }
                    }
                    if (Setting.charx > ix)
                    {
                        lx = Setting.charx;
                        win32.SetForegroundWindow(otpHandle);
                        //SendKeysA(Keys.Right);
                        SendKeys.SendWait("{Left}");
                        Thread.Sleep(time);
                        nx = Setting.charx;
                        if (lx == nx)
                        {
                            //if (Rdn.Radn() == 0) SendKeys.SendWait("{Up}");
                            // else SendKeys.SendWait("{Down}");
                        }
                    }
                    if (Setting.chary > iy)
                    {
                        ly = Setting.charx;
                        win32.SetForegroundWindow(otpHandle);
                        //SendKeysA(Keys.Right);
                        SendKeys.SendWait("{Up}");
                        Thread.Sleep(time);
                        ny = Setting.charx;
                        if (ly == ny)
                        {
                            // if (Rdn.Radn() == 0) SendKeys.SendWait("{Up}");
                            // else SendKeys.SendWait("{Down}");
                        }
                    }
                    if (Setting.chary < iy)
                    {
                        ly = Setting.charx;
                        win32.SetForegroundWindow(otpHandle);
                        //SendKeysA(Keys.Right);
                        SendKeys.SendWait("{Down}");
                        Thread.Sleep(time);
                        ny = Setting.charx;
                        if (ly == ny)
                        {
                            //  if (Rdn.Radn() == 0) SendKeys.SendWait("{Left}");
                            //    else SendKeys.SendWait("{Right}");
                        }
                    }
                }
                break;

            case "Left":
                win32.SetForegroundWindow(otpHandle);
                //SendKeysA(Keys.Left);
                SendKeys.SendWait("{Left}");
                Thread.Sleep(time);
                break;

            case "Right":
                win32.SetForegroundWindow(otpHandle);
                //SendKeysA(Keys.Right);
                SendKeys.SendWait("{Right}");
                Thread.Sleep(time);
                break;

            case "Up":
                win32.SetForegroundWindow(otpHandle);
                //SendKeysA(Keys.Up);
                SendKeys.SendWait("{Up}");
                Thread.Sleep(time);
                break;

            case "Down":
                win32.SetForegroundWindow(otpHandle);
                //SendKeysA(Keys.Down);
                SendKeys.SendWait("{Down}");
                Thread.Sleep(time);
                break;

            case "Wait":
                //win32.SetForegroundWindow(otpHandle);
                Thread.Sleep(Convert.ToInt32(view.Rows[iexec].Cells[4].Value) * 1000);
                break;

            case "LClick":
                //win32.SetForegroundWindow(otpHandle);
                win32.LeftClick(Convert.ToInt32(view.Rows[iexec].Cells[2].Value), Convert.ToInt32(view.Rows[iexec].Cells[3].Value));
                Thread.Sleep(200);
                break;

            case "RClick":
                //win32.SetForegroundWindow(otpHandle);
                win32.RightClick(Convert.ToInt32(view.Rows[iexec].Cells[2].Value), Convert.ToInt32(view.Rows[iexec].Cells[3].Value));
                Thread.Sleep(200);
                break;

            case "Message":
                //win32.SetForegroundWindow(otpHandle);
                MessageBox.Show(Convert.ToString(view.Rows[iexec].Cells[4].Value));
                Thread.Sleep(200);
                break;

            case "Goto Label":
                string labeltogo = view.Rows[iexec].Cells[4].Value.ToString();
                for (int a = 0; a < view.RowCount; a++)
                {
                    if (view.Rows[a].Cells[1].Value.ToString() == "Label" && view.Rows[a].Cells[4].Value.ToString() == labeltogo)
                    {
                        iexec = a;
                        break;
                    }
                }
                break;

            case "If Color":
                //win32.SetForegroundWindow(otpHandle);
                int x = Convert.ToInt32(view.Rows[iexec].Cells[2].Value);
                int y = Convert.ToInt32(view.Rows[iexec].Cells[3].Value);
                //MessageBox.Show(GrabPixel(x, y));
                if (GrabPixel(x, y) == view.Rows[iexec].Cells[4].Value.ToString())
                {
                    trueif = true;
                    //MessageBox.Show(Convert.ToString(trueif));
                    //iexec++;
                }
                else
                {
                    trueif = false;
                    for (int b = iexec; b < view.RowCount; b++)
                    {
                        if (view.Rows[b].Cells[1].Value.ToString() == "Else")
                        {
                            iexec = b;
                            break;
                        }
                        else if (view.Rows[b].Cells[1].Value.ToString() == "End")
                        {
                            iexec = b;
                            break;
                        }
                        if (b == view.RowCount)
                        {
                            MessageBox.Show("End não encontrado!\nParando CaveBot!");
                            iexec = view.RowCount;
                            break;
                        }
                    }
                }
                break;

            case "Else":
                for (int c = iexec; c < view.RowCount; c++)
                {
                    if (view.Rows[c].Cells[1].Value.ToString() == "End")
                    {
                        //MessageBox.Show("f");
                        if (trueif == true)
                        {
                            iexec = c; trueif = false;
                        }
                        break;
                    }
                    if (c == view.RowCount)
                    {
                        MessageBox.Show("End não encontrado!\nParando CaveBot!");
                        iexec = view.RowCount;
                        break;
                    }
                }
                break;

            case "SAY":
                String s = Convert.ToString(view.Rows[iexec].Cells[4].Value);
                SendKeys.SendWait("{Enter}");
                var chars = s.ToCharArray();
                for (int ctr = 0; ctr < chars.Length; ctr++)                            //Console.WriteLine("   {0}: {1}", ctr, chars[ctr]);
                {
                    win32.SetForegroundWindow(otpHandle);
                    if (Convert.ToString(chars[ctr]) == " ")
                    {
                        SendKeys.SendWait(" ");
                    }
                    else
                    {
                        SendKeys.SendWait("{" + chars[ctr] + "}");
                    }
                    //MessageBox.Show("{" + chars[ctr] + "}");
                }
                SendKeys.SendWait("{Enter}");
                break;

            case "Pokemon":
                //win32.SetForegroundWindow(otpHandle);
                int diff       = Setting.Poke2Y - Setting.Poke1Y;
                int pokechange = Convert.ToInt32(view.Rows[iexec].Cells[4].Value);
                if (pokechange == 1)
                {
                    Thread.Sleep(500); win32.LeftClick(Setting.Poke1X, Setting.Poke1Y);
                }
                if (pokechange == 2)
                {
                    Thread.Sleep(500); win32.LeftClick(Setting.Poke2X, Setting.Poke2Y);
                }
                if (pokechange == 3)
                {
                    Thread.Sleep(500); win32.LeftClick(Setting.Poke3X, Setting.Poke3Y);
                }
                if (pokechange == 4)
                {
                    Thread.Sleep(500); win32.LeftClick(Setting.Poke4X, Setting.Poke4Y);
                }
                if (pokechange == 5)
                {
                    Thread.Sleep(500); win32.LeftClick(Setting.Poke5X, Setting.Poke5Y);
                }
                if (pokechange == 6)
                {
                    Thread.Sleep(500); win32.LeftClick(Setting.Poke6X, Setting.Poke6Y);
                }
                Thread.Sleep(3000);
                break;

            case "Teleport":
                string tp      = "!teleport Saffron";
                var    charstp = tp.ToCharArray();
                SendKeys.SendWait("{Enter}");
                for (int ctr = 0; ctr < charstp.Length; ctr++)                            //Console.WriteLine("   {0}: {1}", ctr, chars[ctr]);
                {
                    win32.SetForegroundWindow(otpHandle);
                    if (Convert.ToString(charstp[ctr]) == " ")
                    {
                        SendKeys.SendWait(" ");
                    }
                    else
                    {
                        SendKeys.SendWait("{" + charstp[ctr] + "}");
                    }
                    //MessageBox.Show("{" + chars[ctr] + "}");
                }
                SendKeys.SendWait("{Enter}");
                Thread.Sleep(1000);
                break;

            case "Logout":
                while (z == 1)
                {
                    string colornow = GrabPixel(Setting.RodX, Setting.RodY);
                    Thread.Sleep(1000);
                    win32.SetForegroundWindow(otpHandle);
                    SendKeys.SendWait("^{q}");
                    if (colornow != colorrod)
                    {
                        z = 0;
                        break;
                    }
                }
                break;
            }
            if (Setting.PausarNoTarget == 1)
            {
                Verificacoes.Targetando();
                while (Setting.IsTargeting == 1)
                {
                    Thread.Sleep(0);
                    Verificacoes.Targetando();
                }
            }
            if (iexec < view.RowCount)
            {
                iexec++;
            }
            if (iexec >= view.RowCount)
            {
                iexec = 0; stop = true;
            }
            if (stop == false)
            {
                exec();
            }
        }