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 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 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 Boolean CheckCrate() { Main.ResetToHome(); MouseHandler.MoveCursor(LocationConstants.HOME_CRATE_BUTTON, true); Thread.Sleep(500); MouseHandler.MoveCursor(LocationConstants.CRATE_EXIT_BUTTON, true); Main.ResetToHome(); return(true); }
public static bool ResetToHomePage(int ClicksUntilHome) { for (int i = 0; i < ClicksUntilHome; i++) { MouseHandler.MoveCursor(LocationConstants.HOME_BOTTOM_BATTLE, true); } return(true); }
public static void MouseMoveDown() { MouseHandler.MoveCursor(LocationConstants.SCREEN_CITY_BOTTOM, true); mouse_event((uint)MouseEventFlags.LEFTDOWN, 0, 0, 0, 0); mouse_event((uint)MouseEventFlags.MOVE, 0, -400, 0, 0); Thread.Sleep(100); mouse_event((uint)MouseEventFlags.MOVE, 0, -400, 0, 0); mouse_event((uint)MouseEventFlags.LEFTUP, 0, 0, 0, 0); Thread.Sleep(500); }
public static void OpenCity() { WindowCapture.CaptureApplication(GlobalVariables.GLOBAL_PROC_NAME); for (int i = 0; i < 5; i++) { MouseHandler.MoveCursor(LocationConstants.HOME_BOTTOM_CITY, true); } MouseHandler.MoveCursor(LocationConstants.CITY_CURSOR_SCROLL); MouseHandler.ResetCity(); Main.Sleep(2); }
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 Boolean IdleClick() { while (GlobalVariables.BOT_STATE == "Idling") { MouseHandler.MoveCursor(LocationConstants.GLOBAL_BOT_IDLE_CLICK, true); //for (int i = 0; i < 50; i++) //{ // MouseHandler.MoveCursor(LocationConstants.GLOBAL_BOT_IDLE_CLICK, true); //} } return(true); }
/// <summary> /// Gets Level /// </summary> /// <returns></returns> public static String GetPlayerLevel() { //Requires Colour Space == Color WindowCapture.CaptureApplication(GlobalVariables.GLOBAL_PROC_NAME); Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.GLOBAL_LEVEL_BAR, true); Main.Sleep(1); string playerLevel = GetOcrResponse(TextConstants.LEVEL_START, TextConstants.LEVEL_START_SIZE, "2"); MessageBox.Show(playerLevel); return(playerLevel); }
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(); } }
public static int GetEnemyCE() { int x = TextConstants.LEAGUE_ENEMY_CE_START.X; int y = TextConstants.LEAGUE_ENEMY_CE_START.Y; string[] CEArrayString = new string[3]; int[] CEArray = new int[3]; //for (int i = 0; i < 3; i++) //{ // y = TextConstants.LEAGUE_ENEMY_CE_START.Y + (i * 100); // var newPoint = new Point(x, y); // CEArrayString[i] = GetOcrResponse(newPoint, TextConstants.LEAGUE_PLAYER_CE_SIZE); //} //Console.WriteLine(CEArrayString[0]); //Console.WriteLine(CEArrayString[1]); //Console.WriteLine(CEArrayString[2]); ////Converts the Strings into Arrays //for (int i = 0; i < 3; i++) //{ // CEArray[i] = StringToInt(CEArrayString[i]); //} for (int i = 0; i < 3; i++) { Main.Sleep(1); x = TextConstants.LEAGUE_ENEMY_CE_START.X; y = TextConstants.LEAGUE_ENEMY_CE_START.Y + (i * 100); var PlayerLocation = new Point(x, y); MouseHandler.MoveCursor(PlayerLocation, true); Main.Sleep(2); CEArrayString[i] = GetOcrResponse(TextConstants.ENEMY_PROFILE_CE_START, TextConstants.ENEMY_PROFILE_CE_SIZE); CEArray[i] = StringToInt(CEArrayString[i]); Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.HOME_BOTTOM_BATTLE, true); //Closes Profile Menu } for (int i = 0; i < 3; i++) { Console.WriteLine(CEArray[i]); } return(1); }
public static Boolean[] CheckMenu() { WindowCapture.CaptureApplication(GlobalVariables.GLOBAL_PROC_NAME); // Reset To Main Menu Main.ResetToHome(); // Open Menu First MouseHandler.MoveCursor(LocationConstants.HOME_MENU_BUTTON, true); // Setting Up Boolean Var Boolean[] NotifAvailable = new Boolean[7]; // Take New Screenshot WindowCapture.CaptureApplication(GlobalVariables.GLOBAL_PROC_NAME); // Training Center NotifAvailable[0] = false; // Friends NotifAvailable[1] = false; // Trainer NotifAvailable[2] = false; // Mail NotifAvailable[3] = MailCheck(); // Claim Daily Bonus NotifAvailable[4] = ClaimDailyBonuses(); // Check For Shards NotifAvailable[5] = CheckShards(); // Check Contents of Crate NotifAvailable[6] = CheckCrate(); // Check Achievements NotifAvailable[7] = CheckAchievements(); Boolean[] B = new Boolean[3]; B[0] = true; return(B); }
/// <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> /// Checks if a Pixel value in the process is the same as paramter passed through /// </summary> /// <param name="LocationToCheck"> Location of the pixel to check against </param> /// <param name="ColourToCheck"> Colour of the pixel to check against </param> /// <param name="ClickPixel"> If true pixel will be left clicked </param> /// <returns> True/False Depending on weather the pixel value matched.</returns> public static Boolean CheckPixelValue(Point LocationToCheck, Color ColourToCheck, Boolean ClickPixel = false) { Bitmap bmp = WindowCapture.CaptureApplication(GlobalVariables.GLOBAL_PROC_NAME); Point ProcessLocation = WindowCapture.GetProcessPosition(GlobalVariables.GLOBAL_PROC_NAME); Point PixelScreenLocation = new Point(LocationToCheck.X + ProcessLocation.X, LocationToCheck.Y + ProcessLocation.Y); if (bmp.GetPixel(LocationToCheck.X, LocationToCheck.Y) == ColourToCheck) { if (ClickPixel) { MouseHandler.MoveCursor(PixelScreenLocation); MouseHandler.MouseLeftClick(); } return(true); } return(false); }
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 Boolean ClaimDailyBonuses() { Main.ResetToHome(); // Add: Check time before doing this Thread.Sleep(1000); MouseHandler.MoveCursor(LocationConstants.HOME_DAILYBONUS_BUTTON, true); Thread.Sleep(500); MouseHandler.MoveCursor(LocationConstants.DAILYBONUS_CHECKIN_BUTTON, true); Thread.Sleep(500); //MouseHandler.MoveCursor(LocationConstants.DAILYBONUS_EXIT_BUTTON, true); Main.ResetToHomePage(1); // Claim Daily Money Bonus MouseHandler.MoveCursor(LocationConstants.HOME_MONEYBONUS_BUTTON, true); Thread.Sleep(500); MouseHandler.MoveCursor(LocationConstants.MONEYBONUS_FREE_BUTTON, true); Thread.Sleep(500); // MouseHandler.MoveCursor(LocationConstants.MONEYBONUS_EXIT_BUTTON, true); Main.ResetToHome(); 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; } } } } }