Home  >  Article  >  Backend Development  >  interesting! PHP uses adb to automatically brush King Pesticide Gold Coins [Adventure Mode]

interesting! PHP uses adb to automatically brush King Pesticide Gold Coins [Adventure Mode]

藏色散人
藏色散人forward
2021-03-03 15:37:052978browse

Preparation

Download adb

https://adbdriver.com/

Then set the global variables.

Enable developer mode

I use Thunder Simulator.
The steps areSettings -> Click About tablet to turn on developer mode-> Enter developer mode-> Check usb debugging
In short, just enable ubs debugging. [Recommended learning: PHP video tutorial]

Copy the code and save it as a file

<?php


// 王者农药
class Wzny 
{

    // 长宽  就是手机像素
    protected $w,$h;
    protected $next_x,$next_y; // 下一步xy
    protected $start_x,$start_y; // 闯关xy    
    protected $sure_x,$sure_y; // 确定xy
    protected $auto_x,$auto_y; // 自动xy
    protected $again_x,$again_y; // 再次挑战xy
    protected $back_x,$back_y; // 返回xy
    protected $core_x,$core_y; // 中心xy
    protected $device; // // 那个设备
    public function __construct($w,$h,$device)
    {
        $this->device = $device; 
        $this->w = $w;
        $this->h = $h;
        $this->next_x = $w * .74786;
        $this->next_y = $h * .87962;

        $this->start_x = $w * .76923;
        $this->start_y = $h * .83333;

        $this->sure_x = $w * .91025;
        $this->sure_y = $h * .9166666;

        $this->auto_x = $w * .94017;
        $this->auto_y = $h * .138888;

        $this->again_x = $w * .8547;
        $this->again_y = $h * .916666;

        $this->back_x = $w * .69017;
        $this->back_y = $h * .916666;

        $this->core_x = $w * .5;
        $this->core_y = $h * .5;



    }

    // 打印xy坐标
    public function printfXy()
    {
        $str = "{$this->w}x{$this->h}的坐标\n";
        $str .=  sprintf("下一步:%d %d\n",$this->next_x,$this->next_y);
        $str .=  sprintf("闯关:%d %d\n",$this->start_x,$this->start_y);
        $str .=  sprintf("确定:%d %d\n",$this->sure_x,$this->sure_y);
        $str .=  sprintf("自动:%d %d\n",$this->auto_x,$this->auto_y);    
        $str .=  sprintf("再次挑战:%d %d\n",$this->again_x,$this->again_y);    
        $str .=  sprintf("返回:%d %d\n",$this->back_x,$this->back_y);    
        $str .=  sprintf("中心:%d %d\n",$this->core_x,$this->core_y);    
        echo $str;
    }


    // 开始刷金币 $num 代表次数
    public function start()
    {
        // 闯关
        $this->click_screen($this->start_x,$this->start_y);
        sleep(2);

        // 再次挑战
        $this->click_screen($this->again_x,$this->again_y);
        sleep(2);

        // 闯关
//        $this->click_screen($this->start_x,$this->start_y);
    }



    // 使用adb点击xy坐标
    public function click_screen($x,$y)
    {
        system("adb -s {$this->device} shell input tap {$x} {$y}");
        echo "正在点击 {$x} {$y} \n";
    }


}



// 如: 960 540 emulator-5554
//  传递分辨率 和 adb的设备名称
$wzny1 = new Wzny($argv[1],$argv[2],$argv[3]);
$wzny1->printfXy();

while(1) 
    $wzny1->start();

Open adb

adb devices can see a device.

php使用adb自动刷王者荣耀金币 (冒险模式)

Open the level entry page

php使用adb自动刷王者荣耀金币 (冒险模式)

php使用adb自动刷王者荣耀金币 (冒险模式)

Check it out own resolution.

php wzny.php Height and width device name

php使用adb自动刷王者荣耀金币 (冒险模式)

Summary

Reference Next: Guide to automatically earn gold coins in Honor of Kings (2020)
It is recommended to earn Memories of the Witch.

php使用adb自动刷王者荣耀金币 (冒险模式)

For example, these names are basically made by adb.
As long as it is a language, external system commands can be called.
C language script development, King Pesticide Automatic...

Resolution calculation button xy coordinates

I will test it with my mobile phone first
2340 * 1080 pixels

php使用adb自动刷王者荣耀金币 (冒险模式)

For example, Next button, my phone location is at x:1750 y:950 direction.
Height: 2340 / 1750 = 0.74786
Width: 1080 / 950 = 0.87962.

If you are on a mobile phone of 960 * 540, then the Next step button is located at xy:
x position: 960 * 0.74786 = 717
yPosition: 540 * 0.87962 = 474

Other operations that can be done

1.Button Wizard & Script Wizard

2. Android emulator’s operation recording

ps

The efficiency of gold coin farming is the same as that of a dot connecter (it is a dot connecter). It has no advantages and is troublesome to use.

I will write about the first reward of the adventure in a while
(small The number of fried fish is very short Inscription Gold Coins Experience)

php使用adb自动刷王者农药金币 (冒险模式)

php使用adb自动刷王者农药金币 (冒险模式)

The computer is a bit stuck.                                                                                                                      

The above is the detailed content of interesting! PHP uses adb to automatically brush King Pesticide Gold Coins [Adventure Mode]. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete