private bool LaunchRaid(string exePath, string exeArgs) { bool success = false; try { Process.Start(exePath, exeArgs); ConsoleWriter.CountDown("Waiting for raid to finish its shenanigans...{0}", 50); if (IsRaidRunning()) { Console.WriteLine("\nRaid launched successfully !"); success = true; } else { ConsoleWriter.WriteLineError($"Error while trying to launch ({exePath} {exeArgs}) : Cannot found procees Id"); } } catch (Exception e) { ConsoleWriter.WriteLineError(e); } return(success); }
private int AutoBattleForKeeps(int nbLoop, int compteur, string keepName) { MouseHandler.MouseWheelDown(25); Thread.Sleep(500); MouseHandler.MouseClick(1803, 380); ConsoleWriter.CountDown("Starting battle in {0} ", _battleCountDown); MouseHandler.MouseClick(1790, 550); DateTime dateStart = DateTime.Now; TimeSpan t; Bitmap bmpReplay = new Bitmap($"{_imgDirPath}{_imgNameReplay}"); Bitmap bmpLvlUp = new Bitmap($"{_imgDirPath}{_imgNameLevelUp}"); compteur++; do { WindowHandler.RepositionRaidWindow(raidProcessId); Thread.Sleep(500); var bmpTestReplay = ImgHandler.GetBitmap(_recReplay); var bmpTestLvlUp = ImgHandler.GetBitmap(_recLevelUp); if (!ImgHandler.AreBitmapsDifferent(bmpReplay, bmpTestReplay, RaidOptions.SavePicturesAllowed)) { t = DateTime.Now - dateStart; ConsoleWriter.KeepAwake(); if ((t.TotalMinutes > 20) && (RaidOptions.CheckMineAllowed || RaidOptions.CheckPitAllowed || RaidOptions.CheckRewardsAllowed)) { Console.Write("\nPausing the battle to check the bastion..."); Thread.Sleep(800); break; } if ((nbLoop != 0) && (compteur >= nbLoop)) { Console.Write("\nMax number of allowed battle reached..."); //switch (keepName) //{ // case "magic keep": // RaidOptions.MagicKeepAllowed = false; // break; // case "void keep": // RaidOptions.VoidKeepAllowed = false; // break; // case "spirit keep": // RaidOptions.SpiritKeepAllowed = false; // break; // case "force keep": // RaidOptions.ForceKeepAllowed = false; // break; // case "arcane keep": // RaidOptions.ArcaneKeepAllowed = false; // break; // default: // throw new ArgumentNullException($"Cannot find the keep '{keepName}' !"); //} break; } KeyBoardHandler.SendKey(KEY_R); compteur++; Thread.Sleep(1000); } else if (!ImgHandler.AreBitmapsDifferent(bmpLvlUp, bmpTestLvlUp, RaidOptions.SavePicturesAllowed)) { KeyBoardHandler.SendKey(KEY_ESCAPE); } if (nbLoop != 0) { Console.Write($"\r=> Starting run {compteur}/{nbLoop} "); } else { Console.Write($"\r=> Starting run {compteur} "); } Thread.Sleep(_battleIdle); } while (true); Console.WriteLine(); return(compteur); }
internal int RunDurhamForest(int nbLoop) { int compteur = 0; DateTime dateStart = DateTime.Now; TimeSpan t; Bitmap bmpReplay = new Bitmap($"{_imgDirPath}{_imgNameReplay}"); Bitmap bmpLvlUp = new Bitmap($"{_imgDirPath}{_imgNameLevelUp}"); Console.Write("-> Starting the Durham Forest run "); if (nbLoop != 0) { Console.Write($"({nbLoop} run left)"); } Console.WriteLine(); Thread.Sleep(1000); if (GoToCampaignMap()) { Console.WriteLine("---> Entering durham forest..."); Thread.Sleep(1000); MouseHandler.MouseDrag(1767, 327, 905, 467); Thread.Sleep(2000); MouseHandler.MouseClick(1239, 271); Thread.Sleep(2000); MouseHandler.MouseClick(1815, 130); ConsoleWriter.CountDown("Starting battle in {0} ", _battleCountDown); MouseHandler.MouseClick(1790, 550); compteur++; do { Thread.Sleep(1000); WindowHandler.RepositionRaidWindow(raidProcessId); Thread.Sleep(500); var bmpTestReplay = ImgHandler.GetBitmap(_recReplay); var bmpTestLvlUp = ImgHandler.GetBitmap(_recLevelUp); if (!ImgHandler.AreBitmapsDifferent(bmpReplay, bmpTestReplay, RaidOptions.SavePicturesAllowed)) { t = DateTime.Now - dateStart; ConsoleWriter.KeepAwake(); if ((t.TotalMinutes > 20) && (RaidOptions.CheckMineAllowed || RaidOptions.CheckPitAllowed || RaidOptions.CheckRewardsAllowed)) { Console.Write("\nPausing the battle to check the bastion..."); Thread.Sleep(800); break; } if ((nbLoop != 0) && (compteur >= nbLoop)) { Console.Write("\nMax number of allowed battle reached..."); RaidOptions.DurhamForestAllowed = false; break; } KeyBoardHandler.SendKey(KEY_R); compteur++; Thread.Sleep(1000); } else if (!ImgHandler.AreBitmapsDifferent(bmpLvlUp, bmpTestLvlUp, RaidOptions.SavePicturesAllowed)) { KeyBoardHandler.SendKey(KEY_ESCAPE); } if (nbLoop != 0) { Console.Write($"\r=> Starting run {compteur}/{nbLoop} "); } else { Console.Write($"\r=> Starting run {compteur} "); } Thread.Sleep(_battleIdle); } while (true); Console.WriteLine(); } if (nbLoop != 0) { return(nbLoop - compteur); } else { return(nbLoop); } }
internal void DoManagement(string exePath, string exeArgs) { if (!RaidOptions.GlobalBattleAllowed && !RaidOptions.GlobalCheckAllowed) { return; } int compteur = 0; WindowHandler.RepositionMainWindow(_mainProcessId); if (CheckRaidApp(exePath, exeArgs)) { WindowHandler.RepositionRaidWindow(_raidProcessId); RaidChecker raid = new RaidChecker(_raidProcessId); int nbLoopArcane = RaidOptions.ArcaneLoopNumber; int nbLoopDurham = RaidOptions.DurhamLoopNumber; int nbLoopForce = RaidOptions.ForceLoopNumber; int nbLoopMagic = RaidOptions.MagicLoopNumber; int nbLoopVoid = RaidOptions.VoidLoopNumber; int nbLoopSpirit = RaidOptions.SpiritLoopNumber; int nbLoopIceGolemPeak = RaidOptions.IceGolemPeakLoopNumber; int nbLoopMinotaur = RaidOptions.MinotaurLoopNumber; int nbLoopGodfrey = RaidOptions.GodfreyLoopNumber; bool infiniteArcaneBattle = (nbLoopArcane == 0); bool infiniteForceBattle = (nbLoopForce == 0); bool infiniteDurhamBattle = (nbLoopDurham == 0); bool infiniteMagicBattle = (nbLoopMagic == 0); bool infiniteVoidBattle = (nbLoopVoid == 0); bool infiniteSpiritBattle = (nbLoopSpirit == 0); bool infiniteIceGolemPeakBattle = (nbLoopIceGolemPeak == 0); bool infiniteMinotaurBattle = (nbLoopMinotaur == 0); bool infiniteGodfreyBattle = (nbLoopGodfrey == 0); bool infiniteLoop = (RaidOptions.LoopNumber == 0); while (raid.ShowBastion()) { compteur++; if (RaidOptions.CheckRewardsAllowed) { raid.CheckPlaytimeRewards(); raid.ShowBastion(); } if (RaidOptions.CheckMineAllowed) { raid.CheckMine(); raid.ShowBastion(); } if (RaidOptions.CheckPitAllowed) { raid.CheckThePit(); raid.ShowBastion(); } if (RaidOptions.CheckMarketAllowed) { raid.CheckMarket(); raid.ShowBastion(); } if ((RaidOptions.ArcaneKeepAllowed) && ((nbLoopArcane > 0 || infiniteArcaneBattle))) { nbLoopArcane = raid.RunArcaneKeep(nbLoopArcane); if (!infiniteArcaneBattle && nbLoopArcane == 0) { RaidOptions.ArcaneKeepAllowed = false; } raid.ShowBastion(); } if ((RaidOptions.ForceKeepAllowed) && ((nbLoopForce > 0 || infiniteForceBattle))) { nbLoopForce = raid.RunForceKeep(nbLoopForce); if (!infiniteForceBattle && nbLoopForce == 0) { RaidOptions.ForceKeepAllowed = false; } raid.ShowBastion(); } if ((RaidOptions.MagicKeepAllowed) && ((nbLoopMagic > 0 || infiniteMagicBattle))) { nbLoopMagic = raid.RunMagicKeep(nbLoopMagic); if (!infiniteMagicBattle && nbLoopMagic == 0) { RaidOptions.MagicKeepAllowed = false; } raid.ShowBastion(); } if ((RaidOptions.SpiritKeepAllowed) && ((nbLoopSpirit > 0 || infiniteSpiritBattle))) { nbLoopSpirit = raid.RunSpiritKeep(nbLoopSpirit); if (!infiniteSpiritBattle && nbLoopSpirit == 0) { RaidOptions.SpiritKeepAllowed = false; } raid.ShowBastion(); } if ((RaidOptions.VoidKeepAllowed) && ((nbLoopVoid > 0 || infiniteVoidBattle))) { nbLoopVoid = raid.RunVoidKeep(nbLoopVoid); if (!infiniteVoidBattle && nbLoopVoid == 0) { RaidOptions.VoidKeepAllowed = false; } raid.ShowBastion(); } if ((RaidOptions.DurhamForestAllowed) && ((nbLoopDurham > 0 || infiniteDurhamBattle))) { nbLoopDurham = raid.RunDurhamForest(nbLoopDurham); if (!infiniteDurhamBattle && nbLoopDurham == 0) { RaidOptions.DurhamForestAllowed = false; } raid.ShowBastion(); } if ((RaidOptions.IceGolemAllowed) && ((nbLoopIceGolemPeak > 0 || infiniteIceGolemPeakBattle))) { nbLoopIceGolemPeak = raid.RunIceGolemPeak(nbLoopIceGolemPeak); if (!infiniteIceGolemPeakBattle && nbLoopIceGolemPeak == 0) { RaidOptions.IceGolemAllowed = false; } raid.ShowBastion(); } if ((RaidOptions.MinotaurAllowed) && ((nbLoopMinotaur > 0 || infiniteMinotaurBattle))) { nbLoopMinotaur = raid.RunMinotaurLabyrinth(nbLoopMinotaur); if (!infiniteMinotaurBattle && nbLoopMinotaur == 0) { RaidOptions.MinotaurAllowed = false; } raid.ShowBastion(); } if ((RaidOptions.GodfreyAllowed) && ((nbLoopGodfrey > 0 || infiniteGodfreyBattle))) { nbLoopGodfrey = raid.RunGodfreyCrossing(nbLoopGodfrey); if (!infiniteGodfreyBattle && nbLoopGodfrey == 0) { RaidOptions.GodfreyAllowed = false; } raid.ShowBastion(); } Console.Write($"\nEnd of loop n°{compteur}"); if (!infiniteLoop) { Console.Write($"/{RaidOptions.LoopNumber}"); } Console.WriteLine(); if (!RaidOptions.GlobalCheckAllowed && !RaidOptions.GlobalBattleAllowed || (!infiniteLoop && (compteur == RaidOptions.LoopNumber))) { Console.WriteLine("All actions finished..."); Thread.Sleep(1000); Console.WriteLine("Exiting..."); Thread.Sleep(1000); break; } ConsoleWriter.CountDown($"Next loop start in {{0}} ", 180); Console.WriteLine("_______________________________"); } } }