/// <summary> /// Click down and release a mouse button /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="clickTypeDown"></param> /// <param name="clickTypeUp"></param> private static Point Click(int x, int y, int clickTypeDown, int clickTypeUp, int hoverDelay, int randomize) { Random rng = new Random(); Point clickPoint = Probability.GaussianCircle(new Point(x, y), 0.35 * randomize, 0, 360, randomize); x = clickPoint.X; y = clickPoint.Y; ScreenScraper.BringToForeGround(); ScreenScraper.GameScreenToWindow(ref x, ref y); if (BotProgram.StopFlag) { return(new Point(0, 0)); } NaturalMove(x, y); BotProgram.SafeWaitPlus(hoverDelay, 0.25 * hoverDelay); //wait for RS client to recognize the cursor hover if (!BotProgram.StopFlag) { mouse_event(clickTypeDown, x, y, 0, 0); mouse_event(clickTypeUp, x, y, 0, 0); } return(clickPoint); }
/// <summary> /// Moves a mouse across a screen like a human would /// </summary> /// <param name="x">x-coordinate within the game screen</param> /// <param name="y">y-coordinate within the game screen</param> public static void Move(int x, int y) { if (ScreenScraper.ProcessExists(RSClient)) { ScreenScraper.GameScreenToWindow(ref x, ref y); NaturalMove(x, y); } }