Guide language:
As a code farmer, xiaobian how can you lack gold to buy heroes? Use Python script to automatically brush king gold! Easy to use!
Principle:
King of Glory adventure mode has a challenge mode, the first pass can get more gold, later challenge will still get a small amount of gold, (this is not a bug, only you can brush gold manual brute force.)
For more complete source code or Python learning materials, please come to the private xiaobian
The game theory
In short, you need to perform the following steps:
The interface opens to the challenge level [Click Next]
Enter the lineup adjustment interface and arrange the lineup in advance. [Click enter]
The challenge screen is displayed. [Click on the upper right corner – Auto – Wait for the challenge to end]
The challenge completion screen is displayed. [Click the screen to continue]
Enter the level reward screen. [Click to challenge again]
Go to the lineup adjustment screen and loop to Step 1 or Step 2 [depending on the game area and version]
The ADB* *** tool is called Android Debug Bridge, which acts as a debugging Bridge. With adb tools, you can manage the state of your device or mobile emulator. You can also perform many mobile operations, such as installing software, upgrading the system, running shell commands and so on. In a nutshell, ADB is the bridge between Android phones and PCS, allowing users to fully control their phones from their computers.
As long as you can simulate the screen click can complete the script of brushing gold coins, in android simulation interface click the most simple way is to use ADB to send commands, do not need root phone, do not need to install third-party software, convenient and fast. ADB command Click on screen coordinates [x, y] to use the command:
adb shell input tap x y
Copy the code
To prepare
- This script is suitable for Android game area, requires a real Android phone.
- USB debugging mode should be enabled for mobile phones to allow PC debugging.
- The computer needs to install android drive, general pea pod or various butler can automatically help you install.
- Your computer needs to have an ADB toolset, which is available in a number of ways.
- ADB tools need to be added to the environment variable PATH for easy invocation.
- Python needs to be installed on my computer, because that’s my scripting language of choice.
If you just want to swipe gold, you just need to install the driver and ADB tools.
Environmental testing
- Connect the phone with USB and allow the computer to debug the phone if a warning pops up.
- Verify that adb and phone status are ready using the adb devices command. $ adb devices List of devices attached b ****** 4 device
Simulate clicking on the screen. For example, you can open the drawing software and run the following command:
adb shell input tap 500 500
Copy the code
If all is well, then you will see that the drawing software has a point at coordinates (500,500).
Code implementation
The location of the screen to click through is fixed, and with comments we can do it in less than 30 lines of code.
def tap_screen(x, y): os.system('adb shell input tap {} {}'.format(x, y)) def do_money_work(): print('#0 start the game') tap_screen(1600, 970) sleep(3) print('#1 ready, go!!! ') tap_screen(1450, 910) sleep(15) print('#2 auto power on! ') tap_screen(1780, 40) for i in range(25): tap_screen(1000, 500) sleep(1) print('#3 do it again... \n') tap_screen(1430, 980) sleep(3)Copy the code
And then we write a pivot function to cycle through.
if __name__ == '__main__':
for i in range(repeat_times):
print('round #{}'.format(i + 1))
do_money_work()
Copy the code
And then:
- Download project
kog.py
To local, iOS iskog_iOS.py
. - Open the game, enter the challenge mode, witch recall, lineup adjustment interface.
- Adjust according to the phone’s performance and resolution
kog.py
Parameter in. (Phone resolution, number of gold brushes, etc.) - Run the following command to view the real-time operation effect on your mobile phone. python kog.py
Note:
- Weekly gold coin upper limit 4200, need to be close to 4 hours, do not recommend a full brush, mobile phone and you have to rest.
- Inscriptions, phone performance, and hero selection all affect the speed of the game and the wait time.
- If you don’t want to be tethered to a USB cable, consider using a wireless Android phone.
This is the end of the share, if you are helpful, trouble point attention to go oh ~