/// <summary> /// Looks for the exterior or interior of a runecrafting altar /// </summary> /// <param name="altar">returns the altar blob if found</param> /// <param name="searchCenter">center of area to look at in first pass</param> /// <param name="searchRadius">vertical and horitzontal offset from the center defining the swuare to search in</param> /// <returns>true if an altar is found</returns> protected bool LocateAltar(out Blob altar, Point?searchCenter = null, int searchRadius = int.MaxValue) { searchCenter = searchCenter ?? Screen.Center; int minimumSize = Screen.ArtifactArea(0.01); //ex 0.0236 if (!Vision.LocateObject(NatureAltar, out altar, searchCenter.Value, Screen.ArtifactLength(0.3), minimumSize)) { return(Vision.LocateObject(NatureAltar, out altar)); } return(true); }
/// <summary> /// Searches for the bank chest in an area around the player /// </summary> /// <param name="stationaryObject">color filter for the bank chest brown wood</param> /// <param name="foundObject">bank chest blob return value</param> /// <param name="minimumSize">not used</param> /// <param name="maximumSize">not used</param> /// <returns></returns> protected bool FindBankChest(ColorFilter stationaryObject, out Blob foundObject, int minimumSize, int maximumSize) { int widthRadius = Screen.ArtifactLength(0.35); int heightRadius = Screen.ArtifactLength(0.25); int left = Screen.Center.X - widthRadius; int right = Screen.Center.X + widthRadius; int top = Screen.Center.Y - heightRadius; int bottom = Screen.Center.Y + heightRadius; return(Vision.LocateObject(BankChest, out foundObject, left, right, top, bottom, Screen.ArtifactArea(0.0004), Screen.ArtifactArea(0.0015))); }
/// <summary> /// Sets up a sawmill task for the butler /// Assumes that the butler is already waiting on a command /// </summary> /// <returns>true if successful</returns> protected bool StartSawmillTask() { Inventory.ClickInventory(FirstLogSlot, true); Blob demon; if (!Vision.LocateObject(DemonHead, out demon, 100)) { return(false); } LeftClick(demon.Center.X, demon.Center.Y); return(true); }
/// <summary> /// Looks for the brown packpack that normally appears on the inventory tab icon /// </summary> /// <returns>true if found</returns> protected bool InventoryActive() { Blob backpack; int radius = 15; int x = Inventory.INVENTORY_TAB_OFFSET_RIGHT; int y = Inventory.TAB_TOP_OFFSET_BOTTOM; int left = Screen.Width - x - radius; int right = left + 2 * radius; int top = Screen.Height - y - radius; int bottom = top + 2 * radius; return(Vision.LocateObject(BackpackBrown, out backpack, left, right, top, bottom, 5)); }
protected override bool Execute() { if (!Screen.ReadWindow()) { return(false); } Blob teaStall; if (!Vision.LocateObject(TeaStallRoof, out teaStall, minTeaStallSize)) { MessageBox.Show("Unable to locate a tea stall"); return(false); } Point click = (Point)teaStall.RandomBlobPixel(); Mouse.Move(click.X, click.Y); SafeWait(2000); if (!Vision.WaitForMouseOverText(MouseOverText)) { return(++FailedRuns < FAIL_LIMIT); } SafeWaitPlus(0, 150); LeftClick(click.X, click.Y); SafeWait(1000); Stopwatch watch = new Stopwatch(); watch.Start(); while (Inventory.SlotIsEmpty(TeaInventorySlot.X, TeaInventorySlot.Y, true, false)) { SafeWait(200); if (watch.ElapsedMilliseconds > 5000) { return(++FailedRuns < FAIL_LIMIT); } } Inventory.DropItem(TeaInventorySlot.X, TeaInventorySlot.Y, false, new int[1] { 0 }); FailedRuns = 0; RunParams.Iterations--; return(true); }