private bool LookForClose() { var count = 0; do { if (this.StopAllProcessing) { return(false); } this.UpdateSplashMessage($" Looking for close {count}."); Thread.Sleep(1000); if (this.fakeMoves) { SmoothMouseMove.MoveMouseInCircle(this.rand.Next(this.DisplayScreen.X, this.DisplayScreen.Width)); //this.keyboardSimulator.TextEntry(); SmoothMouseMove.MoveMouse(this.rand.Next(this.DisplayScreen.X, this.DisplayScreen.Width), this.rand.Next(this.DisplayScreen.Y, this.DisplayScreen.Height), 2, 2); SmoothMouseMove.MoveMouseInCircle((this.rand.Next(this.DisplayScreen.X, this.DisplayScreen.Width))); } if (count == 25) { this.Refresh(); } if (count++ > 30) { this.UpdateSplashMessage($"Close not found after {count} trys"); this.Close(); return(true); } }while (this.CloseAd() == false); this.CloseSplash(); return(true); }
private void CatRecognised(Point pt) { Logger.Info($"{MethodBase.GetCurrentMethod().Name}, zoomFactor: {this.zoomFactorX}, {this.zoomFactorY}"); var xpt = pt.X * (1 + (float)this.zoomFactorX / 100) + this.rand.Next(-30, 30); var ypt = pt.Y * (1 + (float)this.zoomFactorY / 100) + this.rand.Next(-30, 30); SmoothMouseMove.MoveMouse(this.DisplayScreen.X + (int)xpt, this.DisplayScreen.Y + (int)ypt, 1, 1); this.mouseSimulator.LeftButtonClick(); this.CaptureCatImage = false; this.speechRecognitionEngine.RecognizeAsyncStop(); }
public override bool GamePrize() { if (this.StopAllProcessing) { return(false); } int count = 0; while (true) { if (this.StopAllProcessing) { return(false); } var bmpScreenBitmap = this.screenShotsManager.ScreenShot("adprize.bmp"); Thread.Sleep(this.rand.Next(500, 1500)); Point?foundBmpAt = null; this.UpdateSplashMessage($" Looking for Ad ..."); foreach (var toFindBitmap in this.toFindBitmaps) { foundBmpAt = this.screenShotsManager.Find(bmpScreenBitmap, toFindBitmap); if (foundBmpAt.HasValue) { this.UpdateSplashMessage($" Found Ad ..."); break; } } if (foundBmpAt != null) { SmoothMouseMove.MoveMouse(foundBmpAt.Value.X + this.rand.Next(5, 30), foundBmpAt.Value.Y + +this.rand.Next(2, 8), 2, 2); Thread.Sleep(this.rand.Next(100, 500)); this.mouseSimulator?.LeftButtonClick(); MouseInput.MoveMouse(foundBmpAt.Value.X + this.rand.Next(50, 100), foundBmpAt.Value.Y + this.rand.Next(0, 280)); SmoothMouseMove.MoveMouseInCircle(50); count = 0; this.ShowSplashMessage(this.DisplayScreen.Location, "Finished clicking ...", 40000); Thread.Sleep(this.rand.Next(100, 500)); } if (count++ == 20) { this.Refresh(); } if (count > 30) { this.Close(); return(true); } } }
private void ClickTheFoundAd(Point?foundBmpAt) { var processHandle = ProcessManager.GetProcessHandle("firefox"); if (foundBmpAt != null) { var pointToScreen = new Point( this.DisplayScreen.X + foundBmpAt.Value.X + this.rand.Next(0, this.clixConfig.AdClickXRange), this.DisplayScreen.Y + foundBmpAt.Value.Y + this.rand.Next(0, this.clixConfig.AdClickYRange)); SmoothMouseMove.MoveMouse(pointToScreen.X, pointToScreen.Y, 1, 1); } this.mouseSimulator.LeftButtonClick(); Thread.Sleep(500); }
private bool FindTheAdAndClickIt() { if (this.StopAllProcessing) { return(false); } var bmpScreenBitmap = this.screenShotsManager.ScreenShot("shota.bmp"); Point?foundBmpAt = Point.Empty; this.ShowSplashMessage(this.DisplayScreen.Location, "Finding Ad", 40000); for (int index = 0; index < this.toFindBitmaps.Count; index++) { var toFindBitmap = this.toFindBitmaps[index]; foundBmpAt = this.screenShotsManager.Find(bmpScreenBitmap, toFindBitmap); if (foundBmpAt.HasValue) { if (foundBmpAt.Value.Y > 800) { SmoothMouseMove.MoveMouse(foundBmpAt.Value.X, foundBmpAt.Value.Y, 1, 1); MouseInput.ScrollWheel(-1); Thread.Sleep(5000); bmpScreenBitmap = this.screenShotsManager.ScreenShot("shota.bmp"); index = 0; continue; } break; } } if (foundBmpAt.HasValue) { this.UpdateSplashMessage($" Found an advert at : {foundBmpAt}"); SmoothMouseMove.MoveMouseInCircle(5); SmoothMouseMove.MoveMouse(foundBmpAt.Value.X + this.rand.Next(-50, 50), foundBmpAt.Value.Y + this.rand.Next(-100, 100), 2, 1); SmoothMouseMove.MoveMouse(foundBmpAt.Value.X, foundBmpAt.Value.Y, 1, 1); Thread.Sleep(this.rand.Next(100, 1000)); this.mouseSimulator?.LeftButtonClick(); } else { this.UpdateSplashMessage($" No Ad Found ,returning false"); return(false); } return(true); }
private bool FindTheDotAndClickIt() { Point?foundDotAt = null; var count = 30; this.UpdateSplashMessage("Finding The dot"); do { if (this.StopAllProcessing) { return(false); } var bmpScreenBitmap2 = this.screenShotsManager.ScreenShot("shotb.bmp"); Thread.Sleep(this.rand.Next(100, 1000)); foreach (var dotBitmap in this.clickDotBitmap) { this.UpdateSplashMessage($"Trying to find the dot {count--}"); foundDotAt = this.screenShotsManager.Find(bmpScreenBitmap2, dotBitmap); if (foundDotAt.HasValue) { break; } } }while (foundDotAt == null && count > 0); if (foundDotAt != null) { Thread.Sleep(this.rand.Next(500, 2000)); this.UpdateSplashMessage($"Found the dot {foundDotAt}"); SmoothMouseMove.MoveMouse(foundDotAt.Value.X + this.rand.Next(-100, 100), foundDotAt.Value.Y + this.rand.Next(-100, 100), 2, 1); SmoothMouseMove.MoveMouse(foundDotAt.Value.X + this.rand.Next(1, 5), foundDotAt.Value.Y + this.rand.Next(-3, 5), 2, 2); Thread.Sleep(this.rand.Next(500, 2000)); this.mouseSimulator?.LeftButtonClick(); } else { this.UpdateSplashMessage("Dot not found .. returning false"); return(false); } return(true); }
public bool GamePrize(Bitmap endGameBitmap) { if (this.StopAllProcessing) { return(false); } var stopwatch = new Stopwatch(); var processedItems = new List <Tuple <int, int> >(); stopwatch.Start(); var waitForClose = false; var count = 0; var gridCellWidth = Math.Abs(this.clixConfig.ClixGridTopLeft.X - this.clixConfig.ClixGridBottomRight.X) / this.clixConfig.ClixGridXDivisions; var gridCellHeight = Math.Abs(this.clixConfig.ClixGridTopLeft.Y - this.clixConfig.ClixGridBottomRight.Y) / this.clixConfig.ClixGridYDivisions; var row = 0; var column = 0; while (true) { if (this.StopAllProcessing) { return(false); } Thread.Sleep(this.rand.Next(500, 1000)); // Configuration if (waitForClose == false) { var skipPoint = false; this.ShowSplashMessage(this.DisplayScreen.Location, "Calculating next click point", 30000); // column = this.rand.Next(1, 30); this.UpdateSplashMessage($" {nameof(this.clixConfig.ClixGridTopLeft.X)} : {this.clixConfig.ClixGridTopLeft.X} , {nameof(this.clixConfig.ClixGridTopLeft.Y)} : {this.clixConfig.ClixGridTopLeft.Y}"); var clickPoint = new Point(this.clixConfig.ClixGridTopLeft.X + column * gridCellWidth + gridCellWidth / 2 + column, this.clixConfig.ClixGridTopLeft.Y + row * gridCellHeight + gridCellHeight / 2 + row); // clickPoint.Offset(-gridCellWidth, -gridCellHeight); this.UpdateSplashMessage($" {nameof(row)} : {row} [{gridCellWidth} , {nameof(column)} : {column} [{gridCellHeight}] , X= {clickPoint.X}, Y= {clickPoint.Y}"); foreach (var item in processedItems) { if (item.Item1 == row && item.Item2 == column) { skipPoint = true; this.UpdateSplashMessage("Skipping point as it was already used"); break; } } if (skipPoint) { continue; } processedItems.Add(new Tuple <int, int>(row, column)); SmoothMouseMove.MoveMouse(clickPoint); Thread.Sleep(this.rand.Next(1000, 2000)); // Configuration this.mouseSimulator.LeftButtonClick(); waitForClose = true; if (row++ == 19) { row = 0; column++; continue; } } else { var bmpScreenBitmap = this.screenShotsManager.ScreenShot("clixgrid.bmp"); Thread.Sleep(1000); Point?foundBmpAt = null; this.UpdateSplashMessage("Looking for close"); foreach (var toCloeBitmap in this.closeBitmaps) { foundBmpAt = this.screenShotsManager.Find(bmpScreenBitmap, toCloeBitmap); if (foundBmpAt.HasValue) { break; } } if (foundBmpAt != null) { this.Close(); this.UpdateSplashMessage($" Close found after {stopwatch.ElapsedMilliseconds / 1000} seconds."); count = 0; stopwatch.Stop(); stopwatch.Restart(); Thread.Sleep(3000); waitForClose = false; } } if (endGameBitmap != null) { var bmpEndGame = this.screenShotsManager.ScreenShot("clixgridend.bmp"); var result = this.screenShotsManager.Find(bmpEndGame, endGameBitmap); if (result.HasValue) { this.Close(); return(true); } } if (count == 35) // Configuration Refresh After x tries { this.Refresh(); waitForClose = false; } if (count++ > 60) // Configuration Close After x tries { this.Close(); return(true); } this.UpdateSplashMessage($"Close NOT found after {stopwatch.ElapsedMilliseconds / 1000} seconds."); } }
private bool SolveTheCatCaptha() { this.CaptureCatImage = true; var catSearchDone = false; var recognizeVoiceDone = false; this.UpdateSplashMessage("Finding the Cat ..."); bool catDbSearchThreadActive = false; Thread catDbSearchThread = null; Bitmap bmpScreenBitmap2 = null; while (this.CaptureCatImage) { Thread.Sleep(500); if (this.StopAllProcessing) { return(false); } if (catDbSearchThreadActive == false) { catDbSearchThread = new Thread( () => { if (!catSearchDone) { if (bmpScreenBitmap2 == null) { bmpScreenBitmap2 = this.screenShotsManager.ScreenShot( this.DisplayScreen.X, this.DisplayScreen.Y, this.clixConfig.CatCapthaBottomRight.X, this.clixConfig.CatCapthaBottomRight.Y, "senseb.bmp"); } var foundCat = this.FindTheCat((Bitmap)bmpScreenBitmap2); if (foundCat.HasValue) { this.CaptureCatImage = false; SmoothMouseMove.MoveMouse( this.DisplayScreen.X + foundCat.Value.X + this.rand.Next(0, 20), this.DisplayScreen.Y + foundCat.Value.Y + this.rand.Next(0, 14), 2, 2); this.UpdateSplashMessage("Found the Cat in DB Woo... Hoo..."); Thread.Sleep(5000); this.mouseSimulator.LeftButtonClick(); } catSearchDone = true; } }) { Name = "CatDbSearchThread" }; catDbSearchThread.Start(); catDbSearchThreadActive = true; } if (recognizeVoiceDone == false) { recognizeVoiceDone = true; this.Say(); } this.UpdateSplashMessage($"Waiting for user to select the cat "); } catDbSearchThread?.Abort(); return(true); }
public override bool FindAd() { if (this.StopAllProcessing) { return(false); } Thread.Sleep(3000); // wait for few seconds before var bmpScreenBitmap = this.screenShotsManager.ScreenShot("shota.bmp"); // this.BackgroundImage = bmpScreenBitmap; Point?foundBmpAt = Point.Empty; foreach (var toFindBitmap in this.toFindBitmaps) { foundBmpAt = this.screenShotsManager.Find(bmpScreenBitmap, toFindBitmap); if (foundBmpAt.HasValue) { break; } } if (foundBmpAt.HasValue) { Logger.Info($"Found an advert"); SmoothMouseMove.MoveMouse( foundBmpAt.Value.X + this.rand.Next(10, 40), foundBmpAt.Value.Y + this.rand.Next(20, 25), 2, 1); Thread.Sleep(2500); this.mouseSimulator.LeftButtonClick(); Point?foundCaptcha = null; var counter = 0; do { if (this.StopAllProcessing) { return(false); } counter++; Thread.Sleep(1000); SmoothMouseMove.MoveMouseInCircle(this.rand.Next(5, 200)); //this.keyboardSimulator.TextEntry(); SmoothMouseMove.MoveMouse(this.rand.Next(this.DisplayScreen.X, this.DisplayScreen.Width), this.rand.Next(this.DisplayScreen.Y, this.DisplayScreen.Height), 2, 2); SmoothMouseMove.MoveMouseInCircle(this.rand.Next(50, 100)); var webBrowserTabTitle = BrowserProcessHelpers.GetWebBrowserTabTitle("firefox"); if (webBrowserTabTitle.Contains("Internal Server Error")) { this.keyboardSimulator.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_W); Logger.Info($" Keyboard Close"); return(true); } }while (!this.MegaAdCaptchaSolve(out foundCaptcha) && counter < 7); if (foundCaptcha.HasValue) { SmoothMouseMove.MoveMouse(foundCaptcha.Value.X + this.rand.Next(10, 40), foundCaptcha.Value.Y + this.rand.Next(10, 24), 2, 2); Thread.Sleep(50); this.mouseSimulator.LeftButtonClick(); Thread.Sleep(1000); this.keyboardSimulator.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_W); Logger.Info($" Keyboard Close"); } } else { Logger.Info($"No Ad Found ..."); return(false); } return(true); }