English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Write a script to刷gold coins in Wanzheng Wangzhe with Python

Many friends of King of Glory want to buy scripts and hacks, hoping to easily obtain gold and other items that can be used to buy heroes in the game. Today, we take advantage of our programmers' strengths to teach everyone how to write a script in Python that can earn gold. The following is the entire content.

In the Adventure Mode of WZRY, there is a challenge mode where you can get a lot of gold for the first pass, and you will still get a small amount of gold for subsequent challenges, which is not considered a bug. If you don't mind, you can also manually brute-force to farm gold.

Recommended level: Falling Desert - Witch's Memory

This level uses pure output heroes2It takes about 0 seconds to defeat the BOSS,5It takes about 0 seconds to complete the game, and you can get rewards every time you repeat the pass.19Gold. It is recommended to manually complete the game before hacking to experience the game mechanism.

In simple terms, you need to perform the following steps:

The interface opens to the challenge level: Falling Desert - Witch's Memory [Click next]

Enter the team adjustment interface, arrange the team in advance. [Click to level up]

Enter the challenge interface. [Click the upper right corner-Automatic-Wait for the challenge to end

Enter the challenge completion interface. [Click the screen to continue]

Enter the level reward interface. [Click to challenge again]

Enter the team adjustment interface and loop to the step1Or steps2It seems to depend on the game area and version

As long as you can simulate screen taps, you can complete the gold farming script. The simplest way to click on the Android emulator interface is to use ADB to send commands, without needing to root the phone or install third-party software, which is convenient and fast. The ADB command to click the screen coordinates [x, y] can be used with the command:

adb shell input tap x y

I'm not clear if there are similar tools and commands for iOS, but if there are, implementing automatic gold farming is also very simple.

Preparation

This script is suitable for Android game areas and requires a real Android phone.

The phone needs to enable USB debugging mode and allow the computer to debug.

The Android driver needs to be installed on the computer, which is usually automatically installed by the Wandoujia or various assistants.

The computer needs to have the ADB toolset, which can be obtained in many ways.

The ADB tool needs to be added to the PATH environment variable for easy access.

Python needs to be installed on the computer because it is the scripting language I have chosen.

Professional developers and testers can also refer to my other two blogs:

Build Appium on Windows + Android automation testing environment

Configure Appium on Mac OSX+Android automation testing environment

If you just want to刷金币, you only need to install the drivers and ADB tools.

Steps

If everything is ready, then the steps are very simple.

Environment detection

Connect the phone to the computer via USB, and if a warning pops up, allow the computer to debug the phone.

Use the command 'adb devices' to check if adb and the phone are ready.

$ adb devices
List of devices attached
b******4    device

Simulate screen taps, for example, you can open a drawing software and then run the command:

adb shell input tap 500 500

If everything is OK, then you will see the drawing software at the coordinates (500,500) position there is a dot.

code implementation

The screen position to click to pass is fixed, with comments we only need less than30 lines of code can be completed.

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)

Then we write a main function to loop money.

if __name__ == '__main__':
  for i in range(repeat_times):
    print('round #{}'.format(i + 1))
    do_money_work()

Then:

Download kog.py from the project to the local.

Open the game, enter the challenge mode, witchcraft memories, lineup adjustment interface.

Adjust the parameters in kog.py according to the phone performance and resolution. (Phone resolution, gold刷次数 etc.)

Run the following command, you can view the real-time running effect on the phone.

python kog.py

Note:

Weekly Gold Limit4200, need to approach4hours, it is not recommended to刷满 at once, your phone and you both need to rest.

Engraving, mobile performance, hero selection will all affect the speed of passing, and adjust the waiting time by yourself.

If you don't want to be bound by USB data cables, consider using wireless connection to an Android device.

You May Also Like