public static Boolean MailCheck() { Main.ResetToHome(); MouseHandler.MoveCursor(LocationConstants.HOME_MENU_BUTTON, true); if (PixelChecker.CheckPixelValue(LocationConstants.MENU_MAIL_BUTTON, ColorConstants.MENU_MAIL_REDINFO_COLOR)) { MouseHandler.MoveCursor(LocationConstants.MENU_MAIL_BUTTON, true); Thread.Sleep(500); MouseHandler.MoveCursor(LocationConstants.MAIL_CLAIMALL_BUTTON, true); Thread.Sleep(500); MouseHandler.MoveCursor(LocationConstants.MAIL_CLAIM_BUTTON, true); while (PixelChecker.CheckPixelValue(LocationConstants.MAIL_DELETE_BUTTON, ColorConstants.MAIL_DELETE_COLOR)) { MouseHandler.MoveCursor(LocationConstants.MAIL_DELETE_BUTTON, true); } } else { Console.WriteLine("No Red Info"); } Main.ResetToHome(); return(true); }
public static void AttackBoss() { //Reset To Home WindowCapture.CaptureApplication(GlobalVariables.GLOBAL_PROC_NAME); Main.ResetToHome(); WindowCapture.CaptureApplication(GlobalVariables.GLOBAL_PROC_NAME); string BossStatus = ImageToText.HomeBoss(); if (BossStatus == "next") { MouseHandler.MoveCursor(LocationConstants.HOME_BOSS_BATTLE_NEXT, true); Main.Sleep(2); MouseHandler.MoveCursor(LocationConstants.HOME_BOSS_IDLE_NEXT, true); Main.Sleep(1); AttackBoss(); //Starts Idling On Next Stage Then Re-Calls Function to Check for updates status } else if (BossStatus == "battle") { MouseHandler.MoveCursor(LocationConstants.HOME_BOSS_BATTLE_NEXT, true); Main.Sleep(2); MouseHandler.MoveCursor(LocationConstants.GLOBAL_ENEMYINFO_BATTLE_CONFIRM, true); Main.Sleep(2); MouseHandler.MoveCursor(LocationConstants.GLOBAL_TEAM_BATTLE_CONFIRM, true); Main.Sleep(3); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_SKIP, true); Main.Sleep(3); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_SKIP_CONFIRM, true); bool BattleFinished = false; while (!BattleFinished) { //Sleep for 2 seconds and then Check Main.Sleep(2); if (PixelChecker.CheckPixelValue(LocationConstants.GLOBAL_BATTLE_FINISHED, ColorConstants.GLOBAL_BATTLE_FINISHED)) { BattleFinished = true; } } bool BattleWon = CheckWin(); Console.WriteLine("The Outcome of the Battle Win: {0}", BattleWon); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_FINISHED, true); } ////Check if Button is Next Or Battle Boss //if (PixelChecker.CheckPixelValue(LocationConstants.HOME_BOSS_BATTLE_NEXT, ColorConstants.HOME_BOSS_BATTLE_COLOR)) //{ //} //Attack Boss MouseHandler.MoveCursor(LocationConstants.HOME_BOSS_BATTLE_NEXT, true); }
public static Boolean CheckShards() { Main.ResetToHome(); if (PixelChecker.CheckPixelValue(LocationConstants.HOME_BAG_BUTTON, ColorConstants.HOME_BAG_REDINFO_COLOR)) { MouseHandler.MoveCursor(LocationConstants.HOME_BAG_BUTTON, true); Thread.Sleep(500); if (PixelChecker.CheckPixelValue(LocationConstants.BAG_SHARDS_BUTTON, ColorConstants.BAG_SHARDS_REDINFO_COLOR)) { MouseHandler.MoveCursor(LocationConstants.BAG_SHARDS_BUTTON, true); Thread.Sleep(500); while (PixelChecker.CheckPixelValue(LocationConstants.BAG_SHARDS_REWARDS_BUTTON, ColorConstants.BAG_SHARDS_REWARDS_REDINFO_COLOR)) { MouseHandler.MoveCursor(LocationConstants.BAG_SHARDS_REWARDS_BUTTON, true); Thread.Sleep(500); MouseHandler.MoveCursor(LocationConstants.BAG_SHARDS_REWARDS_EXCHANGE_BUTTON, true); Thread.Sleep(1000); MouseHandler.MoveCursor(LocationConstants.BAG_SHARDS_REWARDS_CLAIM_BUTTON, true); Thread.Sleep(500); } MouseHandler.MoveCursor(LocationConstants.BAG_EXIT_BUTTON, true); } else { MouseHandler.MoveCursor(LocationConstants.BAG_EXIT_BUTTON, true); } } else { // Console Log } Main.ResetToHome(); return(true); }
public static Boolean isHome() { if (PixelChecker.CheckPixelValue(LocationConstants.HOME_BOTTOM_BATTLE_ACTIVE, ColorConstants.HOME_BOTTOM_BATTLE_ACTIVE_COLOR)) { return(true); } return(false); }
public static void AttackSkyPillar() { bool AttackingPillar = true; while (AttackingPillar) { for (int CurrentTry = 0; CurrentTry < OtherConstants.ATACK_RETRY_AMOUNT; CurrentTry++) { Main.Sleep(2); MouseHandler.MoveCursor(LocationConstants.SKYPILLAR_BATTLE_LOCATION, true); Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.GLOBAL_ENEMYINFO_BATTLE_CONFIRM, true); Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.GLOBAL_TEAM_BATTLE_CONFIRM, true); Main.Sleep(3); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_SKIP, true); Main.Sleep(3); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_SKIP_CONFIRM, true); bool BattleFinished = false; while (!BattleFinished) { //Sleep for 2 seconds and then Check Main.Sleep(2); if (PixelChecker.CheckPixelValue(LocationConstants.GLOBAL_BATTLE_FINISHED, ColorConstants.GLOBAL_BATTLE_FINISHED)) { BattleFinished = true; } } bool BattleWon = CheckWin(); if (BattleWon) { Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_FINISHED, true); break; } else { Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_FINISHED, true); if (CurrentTry == 2) { AttackingPillar = false; } } } } }
public static void OpenLinkTrade() { OpenCity(); if (PixelChecker.CheckPixelValue(LocationConstants.CITY_LINKTRADE_BUTTON, ColorConstants.CITY_LINKTRADE_COLOR)) { MouseHandler.MoveCursor(LocationConstants.CITY_LINKTRADE_BUTTON, true); } { //TODO: Max 3 retries before giving up || calling a different function //OpenItemCenter(); } }
public static void OpenBattleSubway() { OpenCity(); TopOfCity(); if (PixelChecker.CheckPixelValue(LocationConstants.CITY_BATTLESUBWAY_BUTTON, ColorConstants.CITY_BATTLESUBWAY_COLOR)) { MouseHandler.MoveCursor(LocationConstants.CITY_BATTLESUBWAY_BUTTON, true); } { //TODO: Max 3 retries before giving up || calling a different function //OpenItemCenter(); } }
/// <summary> /// Function that resets the game back to the main Menu /// </summary> /// <returns></returns> public static Boolean ResetToHome() { WindowCapture.CaptureApplication(GlobalVariables.GLOBAL_PROC_NAME); //If Screen is stuck on a battle screen this will select it. (Doesn't Check if button is there just clicks it anyways); // Now thinking about it this could cause problems so i added a check if (PixelChecker.CheckPixelValue(LocationConstants.GLOBAL_BATTLE_FINISHED, ColorConstants.GLOBAL_BATTLE_FINISHED)) { MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_FINISHED, true); } //Force Back To Main Menu && Collect any gold (Ran 30 Times because it will click nonstop) for (int i = 0; i < 30; i++) { MouseHandler.MoveCursor(LocationConstants.HOME_BOTTOM_BATTLE, true); } //Check if Menu is Open And Close it if it is //Check if Battle Menu is Active and Returns true if (isHome()) { Console.WriteLine("Is Home"); return(true); } /* Going to Do this bit later since i need to find a place where the above will not return True * What i need to check ofr is * If Not At Home check for X Button and Click * Multiple Close Button Locations */ //Do Comment Above Here //ReCheck If Home if (isHome()) { Console.WriteLine("Is Home"); return(true); } Console.WriteLine("Is Not Home"); return(false); }
/// <summary> /// This function is only called once battle is finished /// </summary> /// <param name="checkAmount"></param> /// <returns></returns> public static Boolean CheckWin(int checkAmount = 1) { if (checkAmount == 5) { //Add Handler // Events To Stop This Main.ResetToHome(); return(false); //Returns False indicating battle was not won although no battle occured. } if (PixelChecker.CheckPixelValue(LocationConstants.GLOBAL_BATTLE_CHECK_WIN, ColorConstants.GLOBAL_BATTLE_WON)) { return(true); } else if (PixelChecker.CheckPixelValue(LocationConstants.GLOBAL_BATTLE_CHECK_WIN, ColorConstants.GLOBAL_BATTLE_LOST)) { return(false); } else { return(CheckWin(checkAmount + 1)); } }
public static Boolean CheckAchievements() { Main.ResetToHome(); if (PixelChecker.CheckPixelValue(LocationConstants.HOME_PROFILE_BUTTON, ColorConstants.HOME_PROFILE_REDINFO_COLOR)) { MouseHandler.MoveCursor(LocationConstants.HOME_PROFILE_BUTTON, true); Thread.Sleep(500); while (PixelChecker.CheckPixelValue(LocationConstants.PROFILE_CLAIM_BUTTON, ColorConstants.PROFILE_CLAIM_REDINFO_COLOR)) { MouseHandler.MoveCursor(LocationConstants.PROFILE_CLAIM_BUTTON, true); Thread.Sleep(500); } } else { // Console Log } Main.ResetToHome(); return(true); }
public static void BotStart() { //Add Functions to Check if a Supported Emulator Is Open //WindowCapture.GetProccessName(); //Updates Process Name //if (GlobalVariables.GLOBAL_PROC_NAME == "InvalidProc") //{ // System.Windows.Application.Current.Shutdown(); //} WindowCapture.CaptureApplication(GlobalVariables.GLOBAL_PROC_NAME); //Add Functions to Check For Specific Options Console.WriteLine("Bot Started: " + GlobalVariables.BOT_STARTED.ToString()); //Adding this to Another Thread won't work. KeyHandler.StartKeyHandler(); //Create a new Thread to Handle All Bot Related Things var MainThread = new Thread(() => { DrawOverlay(); Thread.Sleep(2000); //KeyHandler.StartKeyHandler(); //Everything must be contained into a while loop to make sure bot stops when it is told to stop while (GlobalVariables.BOT_STARTED == true) { Console.WriteLine("Bot Started: " + GlobalVariables.BOT_STARTED.ToString()); Console.WriteLine("Bot Started"); //Add Functions to Clain Daily Items, Open Crates, etc //Make Bot Idle Click for 10 Minutes Then Move on GlobalVariables.BOT_STATE = "Idling"; Console.WriteLine("Bot State: Idling"); Console.WriteLine("Bot Idling"); //Create a new Task To Handle Clicking so it doesnt take up Main Thread. bool output = false; //Task task = Task.Factory.StartNew(() => //{ // output = Main.IdleClick(); //}); var task = new Thread(() => { output = Main.IdleClick(); }); task.Start(); Thread.Sleep(15 * 60000); //Sleep For 15 Minutes Before Continuing GlobalVariables.BOT_STATE = "Checking"; //Setting State //Waiting for the Task To Return A Value & Then Double Checking If Task Returned true. TRUE = Idling Stopped, FALSE = Still Idling. Console.WriteLine(output); Console.WriteLine("Bot State: Checking"); Console.WriteLine("Checking If Account Alreay Logged In"); //Check If Bot Logged In if (PixelChecker.CheckPixelValue(LocationConstants.HOME_ACCOUNT_ALREADY_LOGGED, ColorConstants.GLOBAL_OK_BOTTON)) { Console.WriteLine("Account Logged In From Another Account Waiting 5 More Seconds To Re-Log"); Thread.Sleep(5); MouseHandler.MoveCursor(LocationConstants.HOME_ACCOUNT_ALREADY_LOGGED, true); } Console.WriteLine("Bot Re-Idling"); Console.WriteLine("Bot Started: " + GlobalVariables.BOT_STARTED.ToString()); } }); MainThread.Start(); }
public static void GymAttack() { bool AttackingPillar = true; while (AttackingPillar) { for (int CurrentTry = 0; CurrentTry < OtherConstants.ATACK_RETRY_AMOUNT; CurrentTry++) { Main.Sleep(5); var Location = new Point(0, 0); if (!PixelChecker.SearchPixel(ColorConstants.GYM_BATTLE, out Location)) { string BattleTest = ImageToText.GymBattleCheck(out Location); if (BattleTest != "battle") { GymAttackHandler(); } Main.Sleep(1); MouseHandler.MoveCursor(Location, true); } else { MouseHandler.MoveCursor(Location, true); } Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.GLOBAL_ENEMYINFO_BATTLE_CONFIRM, true); Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.GLOBAL_TEAM_BATTLE_CONFIRM, true); Main.Sleep(3); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_SKIP, true); Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_SKIP_CONFIRM, true); bool BattleFinished = false; while (!BattleFinished) { //Sleep for 2 seconds and then Check Main.Sleep(2); if (PixelChecker.CheckPixelValue(LocationConstants.GLOBAL_BATTLE_FINISHED, ColorConstants.GLOBAL_BATTLE_FINISHED)) { BattleFinished = true; } } bool BattleWon = CheckWin(); if (BattleWon) { Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_FINISHED, true); break; } else { Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_FINISHED, true); if (CurrentTry == 2) { AttackingPillar = false; } } } } }