Autoclicker that watches Battle Cat ads on your phone for you for catfood using adb and OpenCV.
This 100% still works, but Battle Cats has recently forbid you from watching more than 5 ads a day (lame) starting Version 11. This essentially makes this thing worthless unless they revert their decision.
This bot can:
- Farm catfood overnight reliably (60 CF / h)
- "Learn" how to close ads over time through OpenCV template matching
- Easily be modified if UI updates come.
- Control BC directly from the command line; No mirroring needed.
- Recover from ad crashes
- Be run on a Raspberry Pi.
- Work on non-rooted phones.
This bot, as of right now, can't:
- Work right out of the box
- Navigate through chapters; Chapters must be visible the moment you press "Start" on the menu (look at gif).
To run this bot, you need to have a Linux system with the latest version of Bash installed. For your Android phone, I'm not sure what specific Android versions are supported, but I ran this on Android 11. In addition, you must have USB Debugging enabled on your android.
After that, simply run sudo apt-get install python3 adb libopencv-dev
and python3 -m pip install pillow opencv-python
.
*Note: Depending on your flavor of Linux, you may need to recompile getcoords (shown below)
This bot is pretty simple and consists of two parts:
- adb. Everything that directly interfaces with your phone and the app is done through this command. This includes touches, closing BCE, opening BCE, taking screenshots, detecting the current app, ect. A list of functions are in
adbAPI.bash
that contains shortcuts for these actions. - OpenCV. OpenCV is responsible for determining the location of the UI and the X's on the ads through screenshots. This is the crucial component that allows to work reliably with different ads, but is also the most resource-intensive. It is for this reason there are two versions of scripts that do this:
getcoords
executable compiled in C++ andgetcoords.py
in python. The C++ version is a lot faster and can be compiled fromcimgdec
, while the python version is just there or learning purposes. The C++ executable will be used unless you uncomment stuff inadbAPI.bash
Unless you are using a Oneplus Nord N10 5G cellphone, you'll have to follow these steps:
- Take a screenshot of every piece of UI as shown in
imgdec
and replace each image with the same name. Screenshots MUST be done withadb exec-out screencap -p > screen.png
or through the phone then cropped afterwards. - Manually watch a few ads and take screenshots of the closing symbols through the method mentioned before. Cropped images should go to
imgdec/ads
. - Run
bash main.bash
and reap the gains. If the bot is unable to close an ad after around 45s, a screenshot of it will go tostuck/
(that will be created). Do step 2 again and move the image intoimgdec/ads
as before. This is how the bot "learns" how to close ads.
The only compiled portion of this project is the C++ OpenCV detector (getcoords
) whose source code is in cimgdec
, which you can manually compile after installing the dependencies sudo apt-get install cmake libopencv-dev g++
. Simply navigate to the folder and run compile.bash
that will create a folder called executable
. Place the executable in the root of the project and rename it to "getcoords". That's it.