/// <summary> /// Detected the Quest Done graphic that overlays the main quest upon completion, calls Click() of mainQuest.Point /// </summary> private void QuestDone() { if (questDone.IsPresent(Screen, 2)) { Click(mainQuest.Point); } }
/// <summary> /// Detects movement using Click(), calls Click if idle is detected. /// </summary> private void IdleCheck() { if (Timer.ElapsedMilliseconds > IdleTimeInMs) { if (movePixel.IsPresent(Screen, 2)) { movePixel.UpdateColor(Screen); Click(mainQuest.Point); } movePixel.UpdateColor(Screen); Timer.Stop(); Timer.Reset(); Timer.Start(); } }
/// <summary> /// looks through a single column of pixels for a specific pixel. /// </summary> /// <param name="Screen">The game screen location.</param> /// <param name="Start">The point at which we begin searching.</param> /// <param name="StrideLength">A possitive integer value the represents the distance of pixels to be searched through in the stride.</param> /// <param name="Color">The color we are searching for.</param> /// <param name="Tolerance">A threashold for pixel variation.</param> /// <returns></returns> public static Pixel SearchPixelHorizontalStride(Image Image, Point Start, uint StrideLength, Color Color, int Tolerance = 0) { for (int i = 0; i <= StrideLength; i++) { Pixel p = new Pixel { Color = Color, Point = new Point(Start.X + i, Start.Y) }; if (p.IsPresent(Image, Tolerance)) { return(p); } } return(new Pixel()); }
/// <summary> /// looks through a single column of pixels for a specific pixel. /// </summary> /// <param name="Screen">The game screen location.</param> /// <param name="Start">The point at which we begin searching.</param> /// <param name="StrideLength">A possitive integer value the represents the distance of pixels to be searched through in the stride.</param> /// <param name="Color">The color we are searching for.</param> /// <param name="Tolerance">A threashold for pixel variation.</param> /// <returns></returns> public static Pixel SearchPixelHorizontalStride(Rectangle Screen, Point Start, uint StrideLength, Color Color, int Tolerance = 0) { for (int i = 0; i <= StrideLength; i++) { Pixel p = new Pixel { Color = Color, Point = new Point(Start.X + i, Start.Y) }; if (p.IsPresent(Screen, Tolerance)) { //MainWindow.main.UpdateLog = p.ToString(); return(p); } } return(new Pixel()); }
public void Start() { UpdateScreen(); User32.SetForegroundWindow(App.MainWindowHandle); Thread.Sleep(_SleepTime); if (_IsComplete()) { Complete = true; CloseMenus(); } if (!_IsMenuOpen && Bot.IsCombatScreenUp(App)) { Debug.WriteLine("Menu has not been opened, opening menu"); OpenDungeons(); ScrollToEnd(); OpenExpDungeon(); _IsMenuOpen = true; } if (enter.IsPresent(Screen, 2)) { Debug.WriteLine("Enter buton detected"); ChoseDungeon(); } if (_IsMenuOpen && Bot.IsCombatScreenUp(App) && !_IsAutoCombatEnabled) { EnableAutoCombat(); } if (Bot.IsCombatScreenUp(App) && _IsAutoCombatEnabled) { Thread.Sleep(_SleepTime); } if (_IsOkBtnPresent()) { Click(ok[0].Point); } else { //Bot.PopUpKiller(App); } }
/// <summary> /// looks through a single column of pixels for a specific pixel. /// </summary> /// <param name="Screen">The game screen location.</param> /// <param name="Start">The point at which we begin searching.</param> /// <param name="StrideLength">A possitive integer value the represents the distance of pixels to be searched through in the stride.</param> /// <param name="Color">The color we are searching for.</param> /// <param name="Tolerance">A threashold for pixel variation.</param> /// <returns></returns> public static Pixel SearchPixelVerticalStride(Rectangle Screen, Point Start, uint StrideLength, Color Color, int Tolerance = 0) { for (int i = 0; i <= StrideLength; i++) { Pixel p = new Pixel { Color = Color, Point = new Point(Start.X, Start.Y + i) }; if (p.IsPresent(Screen, Tolerance)) { return(p); } } return(new Pixel()); }
/// <summary> /// looks through a single column of pixels for a specific pixel. /// </summary> /// <param name="Screen">The game screen location.</param> /// <param name="Start">The point at which we begin searching.</param> /// <param name="StrideLength">A possitive integer value the represents the distance of pixels to be searched through in the stride.</param> /// <param name="Color">The color we are searching for.</param> /// <param name="IsFound">Returns true if the pixel is found in the stride.</param> /// <param name="Tolerance">A threashold for pixel variation.</param> /// <returns></returns> public static Pixel SearchPixelVerticalStride(Rectangle Screen, Point Start, uint StrideLength, Color Color, out bool IsFound, int Tolerance = 0) { for (int i = 0; i <= StrideLength; i++) { Pixel p = new Pixel { Color = Color, Point = new Point(Start.X, Start.Y + i) }; if (p.IsPresent(Screen, Tolerance)) { //MainWindow.main.UpdateLog = p.ToString(); IsFound = true; return(p); } } IsFound = false; return(new Pixel()); }
/// <summary> /// Detects movement using Click(), calls Click if idle is detected. /// </summary> private void IdleCheck() { if (Timer.ElapsedMilliseconds > IdleTimeInMs)//Checks both click timers. { log.Info(BotName + " IdleCheck() Timer condition has been met."); ResetTimer(); StartTimer(); if (IsCombatScreenUp() && movePixel.IsPresent(Screen, 2))//Looks to see if your map has moved. { log.Info(BotName + " IdleCheck()-->None movement detected."); ToggleCombat(); Click(mainQuest.Point); } movePixel.UpdateColor(Screen); } }
/// <summary> /// looks through a single row of pixels for a specific pixel. /// </summary> /// <param name="Screen">The game screen location.</param> /// <param name="Start">The point at which we begin searching.</param> /// <param name="StrideLength">A possitive integer value the represents the distance of pixels to be searched through in the stride.</param> /// <param name="Color">The color we are searching for.</param> /// <param name="IsFound">Returns true if the pixel is found in the stride.</param> /// <param name="Tolerance">A threashold for pixel variation.</param> /// <returns></returns> public static Pixel SearchPixelHorizontalStride(Rectangle Screen, Point Start, uint StrideLength, Color Color, out bool IsFound, int Tolerance = 0) { for (int i = 0; i <= StrideLength; i++) { Pixel p = new Pixel { Color = Color, Point = new Point(Start.X + i, Start.Y) }; if (p.IsPresent(Screen, Tolerance)) { IsFound = true; return(p); } } IsFound = false; return(new Pixel()); }
/// <summary> /// looks through a single column of pixels for a specific pixel. /// </summary> /// <param name="Screen">The game screen location.</param> /// <param name="Start">The point at which we begin searching.</param> /// <param name="StrideLength">A possitive integer value the represents the distance of pixels to be searched through in the stride.</param> /// <param name="Color">The color we are searching for.</param> /// <param name="IsFound">Returns true if the pixel is found in the stride.</param> /// <param name="Tolerance">A threashold for pixel variation.</param> /// <returns></returns> public static Pixel SearchPixelVerticalStride(Image Image, Point Start, uint StrideLength, Color Color, out bool IsFound, int Tolerance = 0) { for (int i = 0; i <= StrideLength; i++) { Pixel p = new Pixel { Color = Color, Point = new Point(Start.X, Start.Y + i) }; if (p.IsPresent(Image, Tolerance)) { IsFound = true; return(p); } } IsFound = false; return(new Pixel()); }
public Boolean IsCombatScreenUp() { return((WifiLogo.IsPresent(Screen, 4)) ? true : false); }
/// <summary> /// Starts the Alter of Madness Quest logic /// </summary> public void Start() { UpdateScreen(); //updates Screen object in parent class with latest window size and x,y location. if (BringToFront == true) { BringWindowToFront(); } if (_finished == true && _riftMenuOpen == false) { if (IsCombatScreenUp()) { OpenRiftMenu(); } } if (_finished == true && _riftMenuOpen == true) { EnterDungeon(); } if (IsCombatScreenUp() && _startQuest == false && _finished == false) //look for combat screen, starts Quest once it is detected. { Thread.Sleep(TimeSpan.FromSeconds(1)); if (IsRechargeUp()) //added it here because of timing issues { Click(_closeRechargeWindow[0].Point); //closes recharge window if its present. Thread.Sleep(TimeSpan.FromSeconds(.1)); } _startQuest = true; Click(new Point(128, 370)); // clicks the quest go button _mapPoint.UpdateColor(Screen); } if (IsCombatScreenUp() && _startQuest == true && _finished == false) { if (TimeSpan.FromMilliseconds(Timer.ElapsedMilliseconds) > TimeSpan.FromSeconds(15)) { //checks if there has been any map movement in the last 15 seconds if (_mapPoint.IsPresent(Screen, 0)) { //resets quest status by clicking on the auto combat button 3 times //then changes _startQuest to false so i will start the quest again. Click(new Point(876, 684)); Thread.Sleep(TimeSpan.FromSeconds(.1)); Click(new Point(876, 684)); Thread.Sleep(TimeSpan.FromSeconds(.1)); Click(new Point(876, 684)); Thread.Sleep(TimeSpan.FromSeconds(.1)); _startQuest = false; } _mapPoint.UpdateColor(Screen); } } if (NeedRevived()) { Click(SpotRevive[0].Point); _startQuest = false; } if (IsGadgetUp()) { Click(_closeGadgetWindow[0].Point); Thread.Sleep(TimeSpan.FromSeconds(.1)); } if (IsRechargeUp()) { Click(_closeRechargeWindow[0].Point);//closes recharge window if its present Thread.Sleep(TimeSpan.FromSeconds(.1)); } if (_partyAccept[0].IsPresent(Screen, 2) && _partyAccept[1].IsPresent(Screen, 2)) { Click(PartyAccept[0].Point); Thread.Sleep(TimeSpan.FromSeconds(.1)); } if (IsFinished()) { DoAgain(); } Helper.Start(); }