public static bool CheckObstacles() { ClickablePoint messagePos = CoCHelper.SearchPixelInRect(ScreenData.Inactivity); if (!messagePos.IsEmpty) { CoCHelper.Click(ScreenData.ReloadButton); Thread.Sleep(7000); return(true); } if (CoCHelper.CheckPixelColor(ScreenData.Attacked)) { CoCHelper.Click(ScreenData.AttackedBtn); return(true); } // The main screen if (CoCHelper.CheckPixelColor(ScreenData.IsMainGrayed)) { CoCHelper.Click(ScreenData.TopLeftClient); return(true); } // If we have a screen with a small x to cancel it, like when you start a fight. if (CoCHelper.CheckPixelColor(ScreenData.SomeXCancelBtn)) { CoCHelper.Click(ScreenData.SomeXCancelBtn); return(true); } // If a fight is on going, than cancel it. if (CoCHelper.CheckPixelColor(ScreenData.CancelFight) || CoCHelper.CheckPixelColor(ScreenData.CancelFight2)) { CoCHelper.Click(ScreenData.CancelFight); return(true); } if (CoCHelper.CheckPixelColorBad(new Point(331, 330), Color.FromArgb(240, 160, 59), 20)) { CoCHelper.ClickBad(new Point(331, 330), 1); Thread.Sleep(1000); return(true); } if (CoCHelper.CheckPixelColorBad(new Point(429, 519), Color.FromArgb(184, 227, 95), 20)) { CoCHelper.ClickBad(new Point(429, 519), 1); return(true); } if (CoCHelper.CheckPixelColorBad(new Point(71, 530), Color.FromArgb(192, 0, 0), 20)) { CoCHelper.ClickBad(new Point(331, 330), 1); ReturnHome(false, false); return(true); } return(false); }
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 GetAppPos() { ClickablePoint p1 = CoCHelper.SearchPixelInRect(ScreenData.ClashApp); if (CoCHelper.IsInColorRange(new ClickablePoint(p1.Point.X + ScreenData.ClashApp2.Point.X, p1.Point.Y + ScreenData.ClashApp2.Point.Y), ScreenData.ClashApp2.Color, ScreenData.ClashApp2.ShadeVariation)) { if (CoCHelper.IsInColorRange(new ClickablePoint(p1.Point.X + ScreenData.ClashApp3.Point.X, p1.Point.Y + ScreenData.ClashApp3.Point.Y), ScreenData.ClashApp3.Color, ScreenData.ClashApp3.ShadeVariation)) { return(p1); } } return(new ClickablePoint()); }