.
3ss.cn

有趣!php使用adb自动刷王者农药金币 【冒险模式】

准备工作

下载adb

https://adbdriver.com/

然后设置全局变量。

开启开发者模式

我是用 雷电模拟器 的。
步骤是 设置 -> 点击 关于平板电脑 开启开发者模式 -> 进入开发者模式 -> 勾选 usb调试
总之把 ubs调试 开启了就可以了。【推荐学习:PHP视频教程】

复制代码保存成文件

<?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();

打开adb

adb devices 可以看到一台设备。

打开闯关页面

查看下自己的 分辨率

php wzny.php 高 宽 设备名称

总结

参考了下: 王者荣耀自动刷金币攻略(2020)
建议刷魔女的回忆。

比如这些名字,基本都是 adb 做的嘛。
只要是个语言,都可以调用外部系统命令。
c语言脚本开发, 王者农药自动...

分辨率计算按钮xy坐标

我先用我手机测试
2340 * 1080 像素

比如 下一步 按钮,我的手机位置在 x:1750 y:950 方向。
高: 2340 / 1750 = 0.74786
宽: 1080 / 950 = 0.87962

如果在 960 * 540的手机,那么 下一步 按钮所在 xy:
x位置: 960 * 0.74786 = 717
y位置: 540 * 0.87962 = 474

其他可以做到的操作

1.按键精灵 & 脚本精灵

2.安卓模拟器的 操作录制

ps

这个刷金币效率跟连点器一样(就是连点器) 没什么优势 用起来还麻烦

过段时间写个刷冒险的第一次奖励的
(小号炸鱼很缺 铭文 金币 经验的)

电脑有点卡。

赞(0)
未经允许不得转载:互联学术 » 有趣!php使用adb自动刷王者农药金币 【冒险模式】

评论 抢沙发