public static ClickablePoint GetDonateButton() { int left = ScreenData.ChatArea.Left; int top = ScreenData.ChatArea.Top; int right = ScreenData.ChatArea.Right; int bottom = ScreenData.ChatArea.Bottom; int count = 0; do { DetectableArea area = new DetectableArea(left, top, right, bottom, ScreenData.ChatArea.Color, ScreenData.ChatArea.ShadeVariation); ClickablePoint p1 = CoCHelper.SearchPixelInRect(area); if (!p1.IsEmpty && !(p1.Point.X == -1 || p1.Point.Y == -1)) { return(p1); } if (count >= 100) { break; } if (!p1.IsEmpty && !(p1.Point.X == -1 || p1.Point.Y == -1)) { top = p1.Point.Y; } count++; } while (true); return(new ClickablePoint()); }
public static ClickablePoint GetRequestTroopsButton() { int left = ScreenData.RequestTroopsButton.Left; int top = ScreenData.RequestTroopsButton.Top; int right = ScreenData.RequestTroopsButton.Right; int bottom = ScreenData.RequestTroopsButton.Bottom; int count = 0; do { DetectableArea area = new DetectableArea(left, top, right, bottom, ScreenData.RequestTroopsButton.Color, ScreenData.RequestTroopsButton.ShadeVariation); ClickablePoint p1 = Tools.CoCHelper.SearchPixelInRect(area); if (!p1.IsEmpty && !(p1.Point.X == -1 || p1.Point.Y == -1)) { if (Tools.CoCHelper.IsInColorRange(new ClickablePoint(p1.Point.X + ScreenData.RequestTroopsButton2.Point.X, p1.Point.Y + ScreenData.RequestTroopsButton2.Point.Y), ScreenData.RequestTroopsButton2.Color, ScreenData.RequestTroopsButton2.ShadeVariation)) { return(p1); } } if (count >= 6) { break; } else { if (!p1.IsEmpty && !(p1.Point.X == -1 || p1.Point.Y == -1)) { left = p1.Point.X; top = p1.Point.Y; } count++; } } while (true); return(new ClickablePoint()); }
static public ClickablePoint SearchPixelInRect(DetectableArea point) { return((ClickablePoint)FastFindHelper.PixelSearch(point.Left, point.Top, point.Right, point.Bottom, point.Color, point.ShadeVariation)); }