/// <summary> /// Waits for the "Enter amount:" prompt to appear over the chat box /// </summary> /// <param name="timeout">Gives up after the max wait time has elapsed</param> /// <returns>true if the prompt appears</returns> public static bool WaitForEnterAmount(Process rsClient, int timeout) { Point screenSize = ScreenScraper.GetWindowSize(rsClient); const int asterisk = 91235; const int left = 252; const int right = 265; int top = screenSize.Y - 81; int bottom = screenSize.Y - 69; Color[,] screen; Stopwatch watch = new Stopwatch(); watch.Start(); long asteriskHash; while (watch.ElapsedMilliseconds < timeout) { if (BotProgram.StopFlag) { return(false); } screen = ScreenScraper.GetRGB(ScreenScraper.CaptureWindow()); screen = ImageProcessing.ScreenPiece(screen, left, right, top, bottom); asteriskHash = ImageProcessing.ColorSum(screen); if (Numerical.CloseEnough(asterisk, asteriskHash, 0.01)) { return(true); } } return(false); }
public FurnaceCrafting(Process rsClient, Keyboard keyboard) { this.RSClient = rsClient; this.Keyboard = keyboard; Point screenSize = ScreenScraper.GetWindowSize(RSClient); SetLeft(screenSize.X); SetTop(screenSize.Y); }
public NPCContact(Process rsClient) { RSClient = rsClient; Point screenSize = ScreenScraper.GetWindowSize(RSClient); SetLeft(screenSize.X); SetRight(screenSize.X); SetTop(screenSize.Y); SetBottom(screenSize.Y); }
public Bank(Process rsClient, Inventory inventory, Keyboard keyboard) { RSClient = rsClient; Keyboard = keyboard; Point screenSize = ScreenScraper.GetWindowSize(rsClient); InventoryItems = inventory; SetLeft(screenSize.X); SetRight(screenSize.X); SetTop(screenSize.Y); SetBottom(screenSize.Y); }
/// <summary> /// Selects Make All for the single make option that shows up over the chat box /// </summary> /// <param name="rsClient"></param> /// <returns></returns> public bool ChatBoxSingleOptionMakeAll(Process rsClient) { Point screenSize = ScreenScraper.GetWindowSize(rsClient); int X = 256; int Y = screenSize.Y - 90; Random rng = new Random(); Point leftClick = new Point(X, Y); Blob clickBlob = new Blob(leftClick); HandEye.MouseOverDroppedItem(clickBlob, true, 20, 5000); return(true); }