/// <summary> /// Locates a bank booth in the Seers' Village bank /// </summary> /// <param name="bankBooth"></param> /// <returns>true if a bank booth is found</returns> internal bool LocateBankBoothSeersVillage(out Blob bankBooth) { bankBooth = null; List <Blob> possibleBankBooths = Vision.LocateObjects(RGBHSBRangeFactory.BankBoothSeersVillage(), MinBankBoothSize, MaxBankBoothSize); if (possibleBankBooths == null) { return(false); } List <Blob> bankBooths = new List <Blob>(); foreach (Blob booth in possibleBankBooths) { double widthToHeight = booth.Width / (double)booth.Height; if (Numerical.WithinBounds(widthToHeight, 2.3, 3.2)) { bankBooths.Add(booth); } } if (bankBooths.Count != 9) { return(false); } bankBooths.Sort(new BlobHorizontalComparer()); bankBooths.RemoveAt(5); //remove closed bank booths bankBooths.RemoveAt(4); bankBooths.RemoveAt(2); bankBooth = Blob.ClosestBlob(Screen.Center, bankBooths); return(true); }
/// <summary> /// Finds the center of a fairy ring. /// </summary> /// <param name="expectedLocation">The point at the expected center of the fairy ring.</param> /// <param name="searchRadius">The maximum expected deviation of the fairy ring's center from the expected center.</param> /// <returns>The point at the center off the fairy ring. Null if no fairy ring is not found.</returns> protected Point?LocateFairyRing(Point expectedLocation, int searchRadius) { const int fairyRingRadius = 100; int left = expectedLocation.X - searchRadius - fairyRingRadius; int right = expectedLocation.X + searchRadius + fairyRingRadius; int top = expectedLocation.Y - searchRadius - fairyRingRadius; int bottom = expectedLocation.Y + searchRadius + fairyRingRadius; List <Blob> mushrooms = Vision.LocateObjects(FairyRingWhite, left, right, top, bottom, true, 1, Screen.ArtifactArea(0.0000326)); //ex 0.0000261 if (mushrooms == null) { return(null); } return(Blob.ClusterCenter(mushrooms)); }
/// <summary> /// Clicks on the window that starts the Seers' Village agility course /// </summary> /// <returns>true if successful</returns> private bool ClimbBank() { int left = Screen.Center.X; int right = Screen.Width - 1; int top = 0; int bottom = Screen.Center.Y; List <Blob> possibleBankWalls = Vision.LocateObjects(BankWall, left, right, top, bottom, true, Screen.ArtifactArea(0.00004), Screen.ArtifactArea(0.0004)); //ex 0.0000803, 0.0004 Point? expectedWallLocation = ExpectedBankWallLocation(); if (expectedWallLocation == null) { return(false); } possibleBankWalls.Sort(new BlobProximityComparer((Point)expectedWallLocation)); if (HandEye.MouseOver(possibleBankWalls, StationaryObjectText, true, 6, 1600)) { SafeWait(4500); MoveMouse(Screen.Center.X - Screen.ArtifactLength(0.511), Screen.Center.Y - Screen.ArtifactLength(0.065)); return(true); } return(false); }
/// <summary> /// Finds all of the trees on the screen and sorts them by proximity to the player /// </summary> /// <returns>true if any trees are located</returns> protected bool LocateTrees() { Trees = Vision.LocateObjects(WillowTrunk, MinTreeSize); Trees.Sort(new BlobProximityComparer(Screen.Center)); return(Trees.Count > 0); }