コード例 #1
0
 private void AutoPlantDoubleThread()
 {
     try
     {
         IntPtr FTPtr = FindWindow(null, "FarmTogether");
         GameWindowPtr = FTPtr;
         ShowWindow(FTPtr, SW_RESTORE);
         SetForegroundWindow(FTPtr);
         while (true)
         {
             TurnFaceDirection();
             DelegateOfKeyEvent dsd = SpacekeyDown;
             this.Dispatcher.Invoke(dsd);
             Thread.Sleep(2200);
             DelegateOfKeyEvent dsu = SpacekeyUp;
             this.Dispatcher.Invoke(dsu);
             Thread.Sleep(500);
             DelegateOfKeyEvent dwd = WkeyDown;
             this.Dispatcher.Invoke(dwd);
             Thread.Sleep(1227);
             DelegateOfKeyEvent dwu = WkeyUp;
             this.Dispatcher.Invoke(dwu);
             Thread.Sleep(500);
         }
     }
     catch { }
 }
コード例 #2
0
        private void StopAll(object sender, RoutedEventArgs e)
        {
            if (RunningThread != null)
            {
                RunningThread.Abort();
                RunningThread = null;
            }
            IntPtr             FTPtr = FindWindow(null, "FarmTogether");
            DelegateOfKeyEvent dwu   = WkeyUp;

            this.Dispatcher.Invoke(dwu);
            DelegateOfKeyEvent dspu = SpacekeyUp;

            this.Dispatcher.Invoke(dspu);
        }
コード例 #3
0
        private void AutoContinueSpace(object sender, RoutedEventArgs e)
        {
            if (RunningThread != null)
            {
                return;
            }
            Process[] MyProcess = Process.GetProcessesByName("FarmTogether");
            if (MyProcess.Length <= 0)
            {
                return;
            }
            IntPtr FTPtr = FindWindow(null, "FarmTogether");

            GameWindowPtr = FTPtr;
            ShowWindow(FTPtr, SW_RESTORE);
            SetForegroundWindow(FTPtr);
            DelegateOfKeyEvent dsd = SpacekeyDown;

            this.Dispatcher.Invoke(dsd);
        }
コード例 #4
0
 private void AutoMedalThread()
 {
     try
     {
         IntPtr FTPtr = FindWindow(null, "FarmTogether");
         GameWindowPtr = FTPtr;
         ShowWindow(FTPtr, SW_RESTORE);
         SetForegroundWindow(FTPtr);
         if (storenums <= 0)
         {
             RunningThread = null;
             return;
         }
         if (StoreRow == 1)//1列礼物店,往前走,互动,如此直到终点,折返,到起点,如此重复
         {
             while (true)
             {
                 TurnFaceDirection();
                 mouse_event(0x08, 0, 0, 1, 0);
                 mouse_event(0x10, 0, 0, 1, 0);
                 Thread.Sleep(100);
                 mouse_event(0x08, 0, 0, 1, 0);
                 mouse_event(0x10, 0, 0, 1, 0);
                 Thread.Sleep(100);
                 DelegateOfKeyEvent dsd = SpacekeyDown;
                 this.Dispatcher.Invoke(dsd);
                 DelegateOfKeyEvent dsu = SpacekeyUp;
                 this.Dispatcher.Invoke(dsu);
                 Thread.Sleep(2000);
                 for (int i = 0; i < storenums - 1; i++)
                 {
                     DelegateOfKeyEvent dwd1 = WkeyDown;
                     this.Dispatcher.Invoke(dwd1);
                     Thread.Sleep(732);
                     DelegateOfKeyEvent dwu1 = WkeyUp;
                     this.Dispatcher.Invoke(dwu1);
                     Thread.Sleep(500);
                     DelegateOfKeyEvent dspd1 = SpacekeyDown;
                     this.Dispatcher.Invoke(dspd1);
                     DelegateOfKeyEvent dspu1 = SpacekeyUp;
                     this.Dispatcher.Invoke(dspu1);
                     Thread.Sleep(2000);
                 }
                 for (int i = 0; i < storenums - 1; i++)
                 {
                     DelegateOfKeyEvent dsd2 = SkeyDown;
                     this.Dispatcher.Invoke(dsd2);
                     Thread.Sleep(732);
                     DelegateOfKeyEvent dsu2 = SkeyUp;
                     this.Dispatcher.Invoke(dsu2);
                     Thread.Sleep(500);
                 }
             }
         }
         else//两列礼物店 环状互动
         {
             if (storenums > 15)
             {
                 storenums = 15;
             }
             while (true)
             {
                 TurnFaceDirection();
                 mouse_event(0x08, 0, 0, 1, 0);
                 mouse_event(0x10, 0, 0, 1, 0);
                 Thread.Sleep(100);
                 mouse_event(0x08, 0, 0, 1, 0);
                 mouse_event(0x10, 0, 0, 1, 0);
                 Thread.Sleep(100);
                 DelegateOfKeyEvent dspd = SpacekeyDown;
                 this.Dispatcher.Invoke(dspd);
                 DelegateOfKeyEvent dspu = SpacekeyUp;
                 this.Dispatcher.Invoke(dspu);
                 Thread.Sleep(2000);
                 for (int i = 0; i < storenums - 1; i++)
                 {
                     DelegateOfKeyEvent dwd1 = WkeyDown;
                     this.Dispatcher.Invoke(dwd1);
                     Thread.Sleep(732);
                     DelegateOfKeyEvent dwu1 = WkeyUp;
                     this.Dispatcher.Invoke(dwu1);
                     Thread.Sleep(500);
                     DelegateOfKeyEvent dspd1 = SpacekeyDown;
                     this.Dispatcher.Invoke(dspd1);
                     DelegateOfKeyEvent dspu1 = SpacekeyUp;
                     this.Dispatcher.Invoke(dspu1);
                     Thread.Sleep(2000);
                 }
                 DelegateOfKeyEvent ddd2 = DkeyDown;
                 this.Dispatcher.Invoke(ddd2);
                 Thread.Sleep(250);
                 DelegateOfKeyEvent ddu2 = DkeyUp;
                 Thread.Sleep(200);
                 this.Dispatcher.Invoke(ddu2);
                 DelegateOfKeyEvent dspd2 = SpacekeyDown;
                 this.Dispatcher.Invoke(dspd2);
                 DelegateOfKeyEvent dspu2 = SpacekeyUp;
                 this.Dispatcher.Invoke(dspu2);
                 Thread.Sleep(2000);
                 for (int i = 0; i < storenums - 1; i++)
                 {
                     DelegateOfKeyEvent dsd3 = SkeyDown;
                     this.Dispatcher.Invoke(dsd3);
                     Thread.Sleep(732);
                     DelegateOfKeyEvent dsu3 = SkeyUp;
                     this.Dispatcher.Invoke(dsu3);
                     Thread.Sleep(500);
                     DelegateOfKeyEvent dspd3 = SpacekeyDown;
                     this.Dispatcher.Invoke(dspd3);
                     DelegateOfKeyEvent dspu3 = SpacekeyUp;
                     this.Dispatcher.Invoke(dspu3);
                     Thread.Sleep(2000);
                 }
                 DelegateOfKeyEvent dad4 = AkeyDown;
                 this.Dispatcher.Invoke(dad4);
                 Thread.Sleep(250);
                 DelegateOfKeyEvent dau4 = AkeyUp;
                 this.Dispatcher.Invoke(dau4);
             }
         }
     }
     catch { }
 }