示例#1
0
        public static void doLogic()
        {
            BotHelper.randomDelay(1000, 100); //make sure to screen is cleared from previous tasks, just in case. Will probably be removed after some testing.
            currentlyUnlocking = true;
            comparePic         = ImageRecognition.CaptureApplication();

            currentlyUnlocking = isChestUnlocking();

            if (chestsReady())
            {
                BotHelper.Log("Completed box found!");
                openClosestChest();
            }

            if (!currentlyUnlocking)
            {
                BotHelper.Log("There's no box being unlocked right now, unlocking");
                List <Point> regularBoxes = ImageRecognition.GetSubPositions(comparePic, BotHelper.getResourceByName("chest_regular"));
                List <Point> superBoxes   = ImageRecognition.GetSubPositions(comparePic, BotHelper.getResourceByName("chest_super"));

                Point firstReg = regularBoxes.FirstOrDefault();
                Point firstSup = superBoxes.FirstOrDefault();

                if (firstReg.X != 0 && firstReg.Y != 0)
                {
                    // Open a regular box
                    BotHelper.Log(" regular box", false);
                    ADBHelper.simulateClick(ImageRecognition.getRandomLoc(firstReg, BotHelper.getResourceByName("chest_regular")));
                    BotHelper.randomDelay(1000, 100);
                    ADBHelper.simulateClick(ImageRecognition.getRandomLoc(BotHelper.getResourceByName("button_unlock")));
                    BotHelper.randomDelay(1000, 100);
                    ADBHelper.simulateClick(ImageRecognition.getRandomLoc(BotHelper.getResourceByName("button_cancel"), 0.901f));
                }
                else if (firstSup.X != 0 && firstSup.Y != 0)
                {
                    // Open a super box
                    BotHelper.Log(" super box", false);
                    ADBHelper.simulateClick(ImageRecognition.getRandomLoc(firstSup, BotHelper.getResourceByName("chest_super")));
                    BotHelper.randomDelay(1000, 100);
                    ADBHelper.simulateClick(ImageRecognition.getRandomLoc(BotHelper.getResourceByName("button_unlock")));
                    BotHelper.randomDelay(1000, 100);
                    ADBHelper.simulateClick(ImageRecognition.getRandomLoc(BotHelper.getResourceByName("button_cancel"), 0.901f));
                }
                else
                {
                    BotHelper.Log(" ...nevermind. No boxes found.", false);
                }
            }

            BotHelper.Log("Finished ChestLogic!");
        }
示例#2
0
        //returns 1 for win, 2 for loss and 0 for error
        private static int checkWin()
        {
            Bitmap img           = ImageRecognition.CaptureApplication();
            Bitmap label_victory = BotHelper.getResourceByName("label_victory");
            Bitmap label_defeat  = BotHelper.getResourceByName("label_defeat");

            Point win    = ImageRecognition.GetSubPositions(img, label_victory).FirstOrDefault();
            Point defeat = ImageRecognition.GetSubPositions(img, label_defeat).FirstOrDefault();

            if (win.X != 0 && win.Y != 0)
            {
                return(1);
            }
            else if (defeat.X != 0 && defeat.Y != 0)
            {
                return(2);
            }

            return(0);
        }