private void timer1_Tick(object sender, EventArgs e) { GrindBot.SetForegroundWindow(Program.ArcheageWindowHandle); GrindBot.SetKeyboardState(new byte[256]); SendKeys.Send("W"); Thread.Sleep(200); }
public static void RunOnLocation() { while (Hero.Action == "RunOnLocation") { SendMessageA(Program.Archeage, (int)Keyboard.WMessages.WM_KEYDOWN, (IntPtr)System.Windows.Forms.Keys.W, (IntPtr)0); GrindBot.GetCurrentRoute(); if (GrindBot.SleepRun > 0) { System.Threading.Thread.Sleep(GrindBot.SleepRun); GrindBot.SleepRun = 0; } else { if ((Hero.Target == true) && (Enemy.Health > 0)) { Hero.Action = "Fight"; break; } else { SendMessageA(Program.Archeage, (int)Keyboard.WMessages.WM_KEYDOWN, (IntPtr)System.Windows.Forms.Keys.Tab, (IntPtr)0); SendMessageA(Program.Archeage, (int)Keyboard.WMessages.WM_KEYUP, (IntPtr)System.Windows.Forms.Keys.Tab, (IntPtr)0); if (GrindBot.Direction != Hero.Direction) { IntPtr KeyToRotate = GetKeyToRotate(); for (int RotateCount = 0; RotateCount <= 10; RotateCount++) { SendMessageA(Program.Archeage, (int)Keyboard.WMessages.WM_KEYDOWN, KeyToRotate, (IntPtr)0); System.Threading.Thread.Sleep(100); if (GrindBot.Direction != Hero.Direction) { Hero.ForceUpdateDirection = true; } else { break; } } SendMessageA(Program.Archeage, (int)Keyboard.WMessages.WM_KEYUP, KeyToRotate, (IntPtr)0); } else { Hero.ForceUpdateDirection = false; } System.Threading.Thread.Sleep(200); } } } SendMessageA(Program.Archeage, (int)Keyboard.WMessages.WM_KEYUP, (IntPtr)System.Windows.Forms.Keys.W, (IntPtr)0); Program.NextAction = true; Program.RunOnLocation.Abort(); }