Esempio n. 1
0
        // This event handler is where the time-consuming work is done.
        //  ------  backgroundWorker2 -----------
        public static void bgw2DoWork(object sender, DoWorkEventArgs e)
        {
            //BackgroundWorker worker = sender as BackgroundWorker;

            for (int i = 1; i <= 300; i++)
            {
                if (backgroundWorker2.CancellationPending == true)
                {
                    e.Cancel = true;
                    break;
                }
                else   //Send F key
                       // Perform a time consuming operation and report progress.
                {
                    if (i > 30)  //Delay to kill Drohnes
                    {
                        KeyboardInput.Send(KeyboardInput.ScanCodeShort.KEY_F);
                        MainWindow.Sleep(4);
                        Console.WriteLine("pressing F key");
                        if (MainWindow.Spam2Active == 1)
                        {
                            KeyboardInput.Send(KeyboardInput.ScanCodeShort.KEY_2);
                        }
                    }
                    //System.Threading.Thread.Sleep(4);
                    //backgroundWorker2.ReportProgress(i * 10);
                }
            }
        }
Esempio n. 2
0
 private static void bgw3DoWork(object sender, DoWorkEventArgs e)
 {
     for (int i = 1; i <= 2; i++)
     {
         if (backgroundWorker3.CancellationPending == true)
         {
             e.Cancel = true;
             break;
         }
         else    //MouseMove
         {
             MainWindow.Sleep(1000);
             KeyboardInput.mouse_move(0, -1); //Move mouse 1 Uppwards
             KeyboardInput.mouse_move(0, -1);
             KeyboardInput.mouse_move(0, -1);
             int iChange     = 1;
             int iRounds     = 0;
             int straveCount = 0;
             while (iRounds < 40 && MainWindow.StopAutoPvP == false)
             {
                 if (backgroundWorker3.CancellationPending == true)
                 {
                     e.Cancel = true;
                     break;
                 }
                 iRounds += iChange;
                 KeyboardInput.mouse_move(iChange, 0);
                 MainWindow.Sleep(200);
                 Console.WriteLine(iRounds);
                 if (iRounds == 5 && straveCount < 5)
                 {
                     iRounds = 4;
                     iChange = -1;
                     straveCount++;
                     if (straveCount >= 7 || MainWindow.StopAutoPvP == true)
                     {
                         break;
                     }
                 }
                 else if (iRounds == 37 && straveCount >= 6)
                 {
                     iRounds = 36;
                     iChange = -1;
                 }
                 if (iRounds == -8 && straveCount <= 5)
                 {
                     iRounds = -7;
                     iChange = 1;
                 }
                 else if (iRounds == -40 && straveCount >= 6)
                 {
                     iRounds = -39;
                     iChange = 1;
                 }
             }
         }
     }
 }