public static void OpenPlanetTrial() { //No Need to call OpenCastle Since this is at top of castle //Get Attention of screen incase its not ontop WindowCapture.CaptureApplication("Nox"); //Opening up Castle MouseHandler.MoveCursor(LocationConstants.HOME_BOTTOM_CASTLE_LOCATION, true); MouseHandler.MoveCursor(LocationConstants.CASTLE_SCROLL_LOCATION); Main.Sleep(2); //Scrolling to top of castle for (int i = 0; i < 8; i++) { MouseHandler.MouseWheelUp(); Main.Sleep(1); } //Search Pixel Method is better than Specific location Since Expedition is an animation if (PixelChecker.SearchPixel(ColorConstants.CASTLE_PLANET_TRIAL_COLOR, out Point Location)) { MouseHandler.MoveCursor(Location, true); } else { //TODO: Max 3 Retries before giving up OpenPlanetTrial(); } }
public static void OpenEvents() { Main.ResetToHome(); MouseHandler.MoveCursor(LocationConstants.HOME_MAINMENU_LOCATION, true); Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.MENU_EVENTS, true); }
public static bool ClaimQuestReward() { Main.ResetToHome(); Main.ResetToHome(); MouseHandler.MoveCursor(LocationConstants.HOME_MAINMENU_LOCATION, true); Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.MENU_QUESTS_BUTTON_LOCATION, true); while (!PixelChecker.CheckPixelValue(LocationConstants.QUEST_CLAIM, ColorConstants.QUEST_UNCLAIMABLE_COLOR)) { MouseHandler.MoveCursor(LocationConstants.QUEST_CLAIMAIN_LOCATION, true); } bool isClaimable = false; //Checks is it is Unclaimable if since the claimable button is animated. if (!PixelChecker.CheckPixelValue(LocationConstants.QUEST_CLAIM_MASTER, ColorConstants.EVENTS_UNCLAIMABLE)) { isClaimable = true; } if (isClaimable) { MouseHandler.MoveCursor(LocationConstants.QUEST_CLAIM_MASTER, true); return(true); } return(false); }
public static int[] GetCurrecyDetails() { Main.ResetToHome(); Main.Sleep(1); OpenObjects.OpenAltar(); Main.Sleep(2); int[] CurrencyArray = new int[5]; // 0 = Gold; 1 = Gem; 2 = Level; 3 = Purple Soul; 4 = Golden Soul; //Task/Thread This Later CurrencyArray[0] = ImageToText.GetMoneyAmount(); CurrencyArray[1] = ImageToText.GetGemAmount(); CurrencyArray[2] = ImageToText.GetLevel(); CurrencyArray[3] = ImageToText.GetPurpleSoulAmount(); CurrencyArray[4] = ImageToText.GetGoldenSoulAmount(); if (CurrencyArray[2] == -1) { MouseHandler.MoveCursor(TextConstants.LEVEL_START, true); CurrencyArray[2] = ImageToText.GetLevelAdvanced(); } Console.WriteLine("Gold " + CurrencyArray[0]); Console.WriteLine("Gem " + CurrencyArray[1]); Console.WriteLine("Level " + CurrencyArray[2]); Console.WriteLine("Purple " + CurrencyArray[3]); Console.WriteLine("Golden " + CurrencyArray[4]); return(CurrencyArray); }
private static bool CheckDispatch() { if (PixelChecker.CheckPixelValue(LocationConstants.TAVERN_COMPLETE, ColorConstants.TAVERN_DISPATCH)) { MouseHandler.MoveCursor(LocationConstants.TAVERN_COMPLETE, true); Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.TAVERN_QUICK, true); Main.Sleep(2); if (PixelChecker.CheckPixelValue(LocationConstants.TAVERN_START, ColorConstants.TAVERN_START)) { MouseHandler.MoveCursor(LocationConstants.TAVERN_START, true); Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.TAVERN_COMPLETE, true); Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.TAVERN_COMPLETE, true); return(true); } else { Main.LogConsole("Not Enough Heroes to complete event!..."); return(false); } } return(false); }
public static void 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); //Check If Anything on the menu needs to be completed (Keep In Mind Quests Needs a deeper Check) GlobalVariables.QUESTS_FINISHED = !PixelChecker.CheckPixelValue(LocationConstants.MENU_QUEST, ColorConstants.MENU_QUEST_RED); //Requires more checks //Events Require Two Checks if (PixelChecker.CheckPixelValue(LocationConstants.MENU_EVENTS, ColorConstants.MENU_EVENTS_GREEN) || PixelChecker.CheckPixelValue(LocationConstants.MENU_EVENTS, ColorConstants.MENU_EVENTS_RED)) { GlobalVariables.EVENTS_COMPLETED = false; } GlobalVariables.HEARTS_SENT = !PixelChecker.CheckPixelValue(LocationConstants.MENU_FRIENDS, ColorConstants.MENU_FRIENDS_RED); GlobalVariables.UPGRADED_FAMILIAR = !PixelChecker.CheckPixelValue(LocationConstants.MENU_FAMILIAR, ColorConstants.MENU_FAMILIAR_GREEN); GlobalVariables.MAIL_EMPTY = !PixelChecker.CheckPixelValue(LocationConstants.MENU_MAILS, ColorConstants.MENU_MAIL_RED); Console.WriteLine(GlobalVariables.QUESTS_FINISHED); Console.WriteLine(GlobalVariables.EVENTS_COMPLETED); Console.WriteLine(GlobalVariables.HEARTS_SENT); Console.WriteLine(GlobalVariables.UPGRADED_FAMILIAR); Console.WriteLine(GlobalVariables.MAIL_EMPTY); }
public static Boolean MineGuildGold() { OpenObjects.OpenGuild(); if (PixelChecker.CheckPixelValue(LocationConstants.GUILD_DAILY_COINS, ColorConstants.GUILD_DAILY_COINS)) { MouseHandler.MoveCursor(LocationConstants.GUILD_DAILY_COINS, true); } if (PixelChecker.CheckPixelValue(LocationConstants.GUILD_MINE_BONUS, ColorConstants.GUILD_MINE_BONUS)) { Main.LogConsole("Claiming Previous Bonus"); MouseHandler.MoveCursor(LocationConstants.GUILD_CLAIM_BONUS, true); Main.Sleep(2); MouseHandler.MoveCursor(LocationConstants.GUILD_CLAIM, true); MineGuildGold(); } if (PixelChecker.CheckPixelValue(LocationConstants.GUILD_START_DIGGING, ColorConstants.GUILD_START_DIGGING)) { Main.LogConsole("Digging next bonus..."); Main.Sleep(2); MouseHandler.MoveCursor(LocationConstants.GUILD_START_DIGGING, true); } return(true); }
private static void LowerCombineAmont(int LowerAmount) { for (int i = 0; i < LowerAmount; i++) { MouseHandler.MoveCursor(LocationConstants.BLACKSMITH_LOWER, true); //Thread.Sleep(30); } }
public static void AttackDenOfSecrets() { bool AttackingDOS = true; int winAmount = 0; while (AttackingDOS) { Main.LogConsole($"Attacking Den Of Secrets. Total Levels Won: {winAmount.ToString()}"); for (int CurrentTry = 0; CurrentTry < OtherConstants.ATTACK_RETRY_AMOUNT; CurrentTry++) { Main.Sleep(2); MouseHandler.MoveCursor(LocationConstants.DOS_BATTLE_LOCATION, true); //Maybe Add SearchPixel If Problems Occur 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); winAmount += 1; break; } else { Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_FINISHED, true); if (CurrentTry == 2) { AttackingDOS = false; } } } } Main.LogConsole($"Finished Attacking Den Of Secrets After 3 Losses On Same Level. Total Levels Won: {winAmount.ToString()}"); }
public static bool ResetToHomePage(int ClicksUntilHome) { for (int i = 0; i < ClicksUntilHome; i++) { MouseHandler.MoveCursor(LocationConstants.HOME_BOTTOM_BATTLE, true); } return(true); }
public static bool GuildBossAttack(int BossesAttacked = 0) { Main.Sleep(2); MouseHandler.MoveCursor(LocationConstants.GUILD_BATTLE, true); Main.Sleep(2); MouseHandler.MoveCursor(LocationConstants.GUILD_ATTACK, true); Main.Sleep(3); MouseHandler.MoveCursor(LocationConstants.GLOBAL_ENEMYINFO_BATTLE_CONFIRM, true); Main.Sleep(3); 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); } else { Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BATTLE_FINISHED, true); } BossesAttacked++; if (BossesAttacked >= GlobalVariables.attackSettings.GuildRetryAmount) { return(true); } else { GuildBossAttack(BossesAttacked); } 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 bool ClaimTavernQuest() { Main.ResetToHome(); OpenObjects.OpenTavern(); Thread.Sleep(100); MouseHandler.MoveCursor(LocationConstants.CASTLE_SCROLL_LOCATION); for (int i = 0; i < 5; i++) { MouseHandler.MouseWheelDown(); } int howmuch = 0; if (FinishQuest()) { howmuch++; FinishQuest(); if (FinishQuest()) { howmuch++; } } if (howmuch == 2) { return(true); } if (CheckSpeedUp()) { //Add Speed Up handling howmuch++; } if (CheckDispatch()) { howmuch++; if (CheckDispatch()) { howmuch++; } } if (howmuch > 2) { Main.LogConsole("Completed Daily Tavern Quests"); return(true); } return(false); }
public static void OpenGuild() { WindowCapture.CaptureApplication(GlobalVariables.GLOBAL_PROC_NAME); Main.ResetToHome(); Main.Sleep(2); MouseHandler.MoveCursor(LocationConstants.HOME_BOTTOM_GUILD, true); Main.Sleep(2); }
public static Boolean SpinWheel() { OpenObjects.OpenFortuneWheel(); Thread.Sleep(500); int Tokens = ImageToText.GetWheelCoinAmount(); if (Tokens < 2) { //Add Purchasing Token Below if (GlobalVariables.CURRENCY_INFO[1] < 300 && GlobalVariables.CURRENCY_INFO[1] != -1) { Main.LogConsole("Not Enough Tokens & Gem Amount Below 300. Not Purchasing Any Tokens"); return(false); } if (Tokens == 1) { //Add Token Purchasing if (GlobalVariables.CURRENCY_INFO[1] < 100) { Main.LogConsole("Gems Below 100. Bot Purchasing Tokens"); } else { Main.LogConsole("Gems Above 300. Purchasing 1 Token"); PurchaseTokens(); } //MouseHandler.MoveCursor() Thread.Sleep(1000); } else if (Tokens == 0 || Tokens == -1) { Main.LogConsole("Gems Above 300. Purchasing 2 Tokens"); //Add Token Purchasing PurchaseTokens(); Thread.Sleep(1000); PurchaseTokens(); Thread.Sleep(1000); } } Main.LogConsole("Got Enough Tokens Spinning Wheel"); MouseHandler.MoveCursor(LocationConstants.FORTUNE_SPIN1_BUTTON, true); Thread.Sleep(7000); MouseHandler.MoveCursor(LocationConstants.FORTUNE_SPINAGAIN1_BUTTON, true); Thread.Sleep(7000); Main.LogConsole("Spun Daily Wheel"); Main.ResetToHome(); return(true); }
private static void OpenChallenge() { if (!PixelChecker.SearchPixel(ColorConstants.EVENTS_UNCLAIMABLE, out Point unClaimLoc)) { for (int i = 0; i < 3; i++) { MouseHandler.MoveCursor(LocationConstants.HOME_BOTTOM_CASTLE_LOCATION, true); } OpenChallenge(); } unClaimLoc = new Point(unClaimLoc.X, unClaimLoc.Y - 96); MouseHandler.MoveCursor(unClaimLoc, true); }
public static void OpenMarket() { OpenCastle(); if (PixelChecker.SearchPixel(ColorConstants.CASTLE_MARKET_CHECK_COLOR, out Point Location)) { MouseHandler.MoveCursor(Location, true); } else { //TODO: Max 3 Retry for recalling function OpenMarket(); //Tries Again Until it is clicked } }
public static Boolean IdleClick() { while (GlobalVariables.BOT_STATE == "Idling") { MouseHandler.MoveCursor(LocationConstants.GLOBAL_BOT_IDLE_CLICK, true); Thread.Sleep(100); //for (int i = 0; i < 50; i++) //{ // MouseHandler.MoveCursor(LocationConstants.GLOBAL_BOT_IDLE_CLICK, true); //} } return(true); }
public static Boolean SetGuildTeam() { OpenObjects.OpenGuild(); if (PixelChecker.CheckPixelValue(LocationConstants.GUILD_WAR_TEAM, ColorConstants.GUILD_SET_WAR)) { Main.Sleep(2); MouseHandler.MoveCursor(LocationConstants.GUILD_WAR_TEAM, true); Main.Sleep(2); MouseHandler.MoveCursor(LocationConstants.GUILD_SET_TEAM, true); Main.Sleep(2); } return(true); }
private static void PurchaseTokens() { MouseHandler.MoveCursor(LocationConstants.FORTUNE_PURCHASE, true); MouseHandler.MoveCursor(LocationConstants.FORTUNE_BUY, true); //if (PixelChecker.CheckPixelValue(LocationConstants.FORTUNE_BUY, ColorConstants.FORTUNE_BUY)) //{ // MouseHandler.MoveCursor(LocationConstants.FORTUNE_BUY, true); //} //else //{ // Main.ResetToHome(); // OpenObjects.OpenFortuneWheel(); // PurchaseTokens(); //} }
public static void OpenCreationBag() { OpenCastle(); //Uses same Check as Above since its hard to check for creating bag since its an animation if (PixelChecker.SearchPixel(ColorConstants.CASTLE_CREATION_BAG_COLOR, out Point Location)) { MouseHandler.MoveCursor(Location, true); } else { //TODO: Max 3 Retry for recalling function OpenMarket(); //Tries Again Until it is clicked } }
private static bool FinishQuest() { for (int i = 0; i < 15; i++) { if (PixelChecker.CheckPixelValue(LocationConstants.TAVERN_COMPLETE, ColorConstants.TAVER_FINISH)) { MouseHandler.MoveCursor(LocationConstants.TAVERN_COMPLETE, true); return(true); } Thread.Sleep(430); } return(false); }
public static Boolean ClaimPrivellage() { Main.ResetToHome(); Thread.Sleep(4000); MouseHandler.MoveCursor(LocationConstants.HOME_PIRVALLEGE_BUTTON, true); while (PixelChecker.CheckPixelValue(LocationConstants.PRIVALLEGE_CHECKIN_BUTTON, ColorConstants.PRIVALLEGE_CHECKIN_YELLOW)) { MouseHandler.MoveCursor(LocationConstants.PRIVALLEGE_CHECKIN_BUTTON, true); Thread.Sleep(500); } return(true); }
public static void OpenFortuneWheel() { OpenCastle(); MouseHandler.MouseWheelUp(); Main.Sleep(2); MouseHandler.MouseWheelUp(); //Mouse Wheel Up doesnt always move the same amount upwards so searching for the pixel is used instead of a specific location if (PixelChecker.SearchPixel(ColorConstants.CASTLE_FORTUNE_WHEEL_COLOR, out Point Location)) { MouseHandler.MoveCursor(Location, true); } else { //TODO: Max 3 Retries before giving up OpenFortuneWheel(); } }
public static void OpenCastle() { //Get Attention of screen incase its not ontop //Get Attention of screen incase its not ontop WindowCapture.CaptureApplication("Nox"); /* Opening up Castle (Runs 30 Times Becuase Sometimes Gold Isn't Collected. This is rare for it to not be collected but running this * this 50 times ensures that the bug doesn't occur */ for (int i = 0; i < 30; i++) { MouseHandler.MoveCursor(LocationConstants.HOME_BOTTOM_CASTLE_LOCATION, true); } Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.CASTLE_SCROLL_LOCATION); Main.Sleep(1); MouseHandler.ResetCastle(); Main.Sleep(2); }
/// <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 50 Times because it will click nonstop) for (int i = 0; i < 50; 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 ClaimMail() { WindowCapture.CaptureApplication("Nox"); Main.ResetToHome(); //if (!Main.ResetToHome()) //{ // Console.WriteLine("Returning False"); // return false; //} Thread.Sleep(500); MouseHandler.MoveCursor(LocationConstants.HOME_MAINMENU_LOCATION, true); Main.Sleep(3); if (PixelChecker.CheckPixelValue(LocationConstants.MENU_MAILS, ColorConstants.MENU_MAIL_RED)) { Console.WriteLine("Its Red"); MouseHandler.MoveCursor(LocationConstants.MENU_MAILS, true); Main.Sleep(1); MouseHandler.MoveCursor(LocationConstants.MAIL_RECEIVEALL, true); if (GlobalVariables.dailySettings.DeleteMail == false) { Main.ResetToHome(); return(true); } while (PixelChecker.CheckPixelValue(LocationConstants.MAIL_RECEIVE, ColorConstants.MAIL_DELETE)) { MouseHandler.MoveCursor(LocationConstants.MAIL_RECEIVE, true); } } else { Console.WriteLine("Its Not Red"); MouseHandler.MoveCursor(LocationConstants.GLOBAL_BOT_IDLE_CLICK, true); } Main.ResetToHome(); return(true); }
private static bool CheckSpeedUp() { if (PixelChecker.CheckPixelValue(LocationConstants.TAVERN_COMPLETE, ColorConstants.TAVERN_SPEEDUP)) { MouseHandler.MoveCursor(LocationConstants.TAVERN_COMPLETE, true); Thread.Sleep(1000); if (PixelChecker.CheckPixelValue(LocationConstants.TAVERN_SPEED, ColorConstants.TAVERN_SPEED)) { MouseHandler.MoveCursor(LocationConstants.TAVERN_SPEED, true); MouseHandler.MoveCursor(LocationConstants.TAVERN_COMPLETE, true); return(true); } else { MouseHandler.MoveCursor(LocationConstants.TAVERN_COMPLETE, true); return(true); } } return(false); }
public static Boolean Defeat3Main() { Main.ResetToHome(); bool IdleClick = true; var task = new Thread(() => { while (IdleClick) { MouseHandler.MoveCursor(LocationConstants.GLOBAL_BOT_IDLE_CLICK, true); Thread.Sleep(100); } }); task.Start(); Main.Sleep(25); //Sleep For 15 Minutes Before Continuing IdleClick = false; return(true); }