public static void DropTrophies() { int trophyCount = ReadText.GetOther(50, 74, "Trophy"); while (trophyCount > Main.Bot.MaxTrophies) { trophyCount = ReadText.GetOther(50, 74, "Trophy"); Main.Bot.WriteToOutput("Trophy Count: " + trophyCount, GlobalVariables.OutputStates.Normal); if (trophyCount > Main.Bot.MaxTrophies) { Main.Bot.WriteToOutput("Dropping Trophies...", GlobalVariables.OutputStates.Information); Thread.Sleep(2000); MainScreen.ZoomOut(); Search.PrepareSearch(); Thread.Sleep(5000); Tools.CoCHelper.Click(ScreenData.DropSingleBarb); Thread.Sleep(1000); MainScreen.ReturnHome(false, false); } else { Main.Bot.WriteToOutput("Trophy Drop Complete...", GlobalVariables.OutputStates.Information); } } }
public static void GetResources() { Gold = ReadText.GetGold(51, 66); Elixir = ReadText.GetElixir(51, 95); DarkElixir = ReadText.GetDarkElixir(51, 123); Main.Bot.WriteToOutput("[G]: " + Gold + "; [E]: " + Elixir + "; [DE]: " + DarkElixir + ";"); }
public static int ReadTroopQuantity(int slot) { int output; try { output = int.Parse(ReadText.GetNormal(40 + (72 * slot), 565)); } catch (Exception) { output = 0; } return(output); }
/// <summary> /// Initializes the Bot. /// </summary> public static void Initialize(MainViewModel vm) { // Store in properties so we can access in the SubFunctions Bot = vm; Bot.ClearOutput(); Bot.WriteToOutput(string.Format(Resources.OutputWelcomeMessage, Resources.AppName)); Bot.WriteToOutput(Resources.OutputBotIsStarting); // Check if BlueStacks is running if (!BlueStacksHelper.IsBlueStacksRunning) { Bot.WriteToOutput(Resources.OutputBSNotFound, GlobalVariables.OutputStates.Error); Bot.IsExecuting = false; return; } if (!BlueStacksHelper.IsRunningWithRequiredDimensions) { Bot.WriteToOutput(Resources.OutputBSNotRunningWithDimensions); Bot.WriteToOutput(Resources.OutputBSApplyDimensionsIntoRegistry); if (!BlueStacksHelper.SetDimensionsIntoRegistry()) { // Woops! Something went wrong, log the error! Bot.WriteToOutput(Resources.OutputBSApplyDimensionsError, GlobalVariables.OutputStates.Error); Bot.IsExecuting = false; return; } else { Bot.WriteToOutput(Resources.OutputBSAppliedDimensionsIntoRegistry); } // Restart BlueStacks // Wait until restart and continue... BlueStacksHelper.ActivateBlueStacks(); } CreateDirectory(GlobalVariables.LogPath); CreateDirectory(GlobalVariables.ScreenshotZombieAttacked); CreateDirectory(GlobalVariables.ScreenshotZombieSkipped); WriteLicense(); // Run Everything related to the bot in the background var thread = new Thread(() => { while (Bot.IsExecuting) { FastFindWrapper.SetHWnd(BlueStacksHelper.GetBlueStacksWindowHandle(), true); MainScreen.CheckMainScreen(); Thread.Sleep(1000); MainScreen.ZoomOut(); Thread.Sleep(1000); CoCHelper.Click(ScreenData.OpenChatBtn); Thread.Sleep(1000); string str = ReadText.GetString(151); System.Windows.MessageBox.Show(str); Village.ReArmTraps(); Thread.Sleep(1000); Barrack.TrainTroops(); Thread.Sleep(1000); Barrack.Boost(); Thread.Sleep(1000); RequestAndDonate.RequestTroops(); Thread.Sleep(1000); RequestAndDonate.DonateCC(); Thread.Sleep(1000); Village.CollectResources(); Thread.Sleep(1000); Village.UpgradeWalls(); Thread.Sleep(1000); Village.Idle(); Thread.Sleep(1000); //Attack.AttackMain(); } ; }) { IsBackground = true }; thread.Start(); }