/// <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> /// Use the Make-X option in a Make-X pop-up /// </summary> public void MakeXItems(int itemsToMake) { const int yOffset = 70; SelectOption(yOffset); //Wait for the "Enter amount:" prompt to appear if (WaitForEnterAmount(5000)) { BotProgram.SafeWaitPlus(200, 50); BotUtilities.EnterAmount(Keyboard, itemsToMake); } }
/// <summary> /// Opens the Withdraw-X menu for a specified bank slot and clicks on the specified withdraw option /// </summary> /// <param name="column"></param> /// <param name="row"></param> /// <param name="yOffset"></param> public void WithdrawMenuClick(int column, int row, int yOffset) { Point?itemSlot = ItemSlotLocation(column, row); if (itemSlot == null) { return; } //open the withdraw right-click menu Point click = Probability.GaussianCircle(new Point(itemSlot.Value.X, itemSlot.Value.Y), 4, 0, 360, 11); Mouse.RightClick(click.X, click.Y); BotProgram.SafeWaitPlus(200, 100); RightClick menu = new RightClick(click.X, click.Y, RSClient, 9); menu.WaitForPopup(); //click on Withdraw-All click = Probability.GaussianRectangle(click.X - 90, click.X + 90, click.Y + yOffset - 2, click.Y + yOffset + 2); Mouse.LeftClick(click.X, click.Y); BotProgram.SafeWaitPlus(200, 100); }
/// <summary> /// Waits for a dial to spin the specified number of quarter turns /// </summary> protected void WaitForDialSpin(int numberOfTurns) { const int quarterTurnTime = 1000; BotProgram.SafeWaitPlus(numberOfTurns * quarterTurnTime, 100); }
/// <summary> /// Sets the bank to withdraw items as notes /// </summary> public void WithdrawAsNotes() { Mouse.LeftClick(Left + 279, Bottom - 15, 5); BotProgram.SafeWaitPlus(200, 20); }
/// <summary> /// Clicks on the "Deposit Inventory" button in the bank pop-up /// </summary> /// <param name="screenWidth">width of the game screen in pixels</param> /// <param name="screenHeight">height of the game screen in pixels</param> public void DepositInventory() { Mouse.LeftClick(Left + 427, Bottom - 22, 10); BotProgram.SafeWaitPlus(200, 20); }