public static void openChest() { for (int i = 0; i < 16; i++) { // just to make sure it'll still be randomized... ADBHelper.simulateClick(new Point(rnd.Next(270 - 50, 270 + 50), rnd.Next(200 - 50, 200 + 50))); //Click anywhere to unbox BotHelper.randomDelay(200, 20); } ADBHelper.simulateClick(ImageRecognition.getRandomLoc(BotHelper.getResourceByName("button_collect_prizes"), 0.901f)); // Check for Bonus item BotHelper.randomDelay(4000, 100); // it might take a second or two for the bonus chest to appear, better be safe than sorry comparePic = ADBHelper.getScreencap(); Point bonusLabel = ImageRecognition.GetSubPositions(comparePic, BotHelper.getResourceByName("label_bonus")).FirstOrDefault(); if (bonusLabel.X != 0 && bonusLabel.Y != 0) { // Bonus item, yay! Point watchButton = ImageRecognition.GetSubPositions(comparePic, BotHelper.getResourceByName("button_watch"), 0.901f).FirstOrDefault(); if (watchButton.X != 0 && watchButton.Y != 0) { // Ugh, they want us to watch an ad. Close the window. Point closeButton = ImageRecognition.GetSubPositions(comparePic, BotHelper.getResourceByName("button_cancel"), 0.901f).FirstOrDefault(); ADBHelper.simulateClick(ImageRecognition.getRandomLoc(closeButton, BotHelper.getResourceByName("button_cancel"))); } else { ADBHelper.simulateClick(new Point(rnd.Next(270 - 50, 270 + 50), rnd.Next(200 - 50, 200 + 50))); //Click anywhere to unbox BotHelper.randomDelay(300, 20); ADBHelper.simulateClick(ImageRecognition.getRandomLoc(BotHelper.getResourceByName("button_collect_prizes"), 0.901f)); } } }
public static void doLogic() { comparePic = ADBHelper.getScreencap(); if (checkDefense()) { comparePic = ADBHelper.getScreencap(); // update the screen if needed } if (checkForLeagueEnd()) { comparePic = ADBHelper.getScreencap(); // update the screen if needed } if (checkForChampionshipEnd()) { comparePic = ADBHelper.getScreencap(); // update the screen if needed } if (checkForChestInForeground()) { comparePic = ADBHelper.getScreencap(); // update the screen if needed } checkInstantPromo(); }