/// <summary> /// Teleports the player to the configured location. /// </summary> public void Teleport(bool waitForTeleport) { Mouse.LeftClick(TeleportButton.X, TeleportButton.Y, 8); if (waitForTeleport) { BotProgram.SafeWait(2000); } }
/// <summary> /// Waits for the right-click popup to appear /// </summary> /// <param name="timeout"></param> /// <returns></returns> public virtual bool WaitForPopup(int timeout = 3000, CheckHeight checkHeight = CheckHeight.None) { Color[,] screen = null; Stopwatch watch = new Stopwatch(); watch.Start(); while (watch.ElapsedMilliseconds < timeout) { if (BotProgram.SafeWait(200)) { return(false); } screen = ScreenScraper.GetRGB(ScreenScraper.CaptureWindow()); if (PopupExists(screen) && PopupIsCorrectHeight(screen, checkHeight)) { return(true); } } return(false); }
/// <summary> /// Holds a key down for a set time. /// </summary> /// <param name="key">System.Windows.Forms.Keys to specify a key to hold down.</param> /// <param name="milliseconds">Number of milliseconds to hold down the key.</param> public void HoldKey(Keys key, int milliseconds) { keybd_event((byte)key, 0, KEY_DOWN_EVENT, 0); BotProgram.SafeWait(milliseconds); keybd_event((byte)key, 0, KEY_UP_EVENT, 0); }
/// <summary> /// Goes through the dialog with the dark mage to repair runecrafting pouches /// </summary> /// <returns>true if successful</returns> public bool RepairPouches(TextBoxTool textBox) { Mouse.LeftClick(Left + 240, Top + 102, 10); BotProgram.SafeWait(NPC_CONTACT_CAST_TIME); return(textBox.ClickThroughTextScreens(4, 5000)); }