首頁  >  文章  >  後端開發  >  有趣! php使用adb自動刷王者農藥金幣 【冒險模式】

有趣! php使用adb自動刷王者農藥金幣 【冒險模式】

藏色散人
藏色散人轉載
2021-03-03 15:37:052896瀏覽

準備工作

下載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使用adb自动刷王者荣耀金币 (冒险模式)

開啟闖關頁面

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

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

檢視下自己的解析度

php wzny.php 高寬設備名稱

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

#總結

#參考了下: 王者榮耀自動刷金幣攻略(2020)
建議刷魔女的回憶。

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

例如這些名字,基本上都是 adb 做的嘛。
只要是個語言,都可以呼叫外部系統指令。
c語言腳本開發,  王者農藥自動...

#解析度計算按鈕xy座標

我先用我手機測試
2340 * 1080 像素

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

#例如下一步 按鈕,我的手機位置在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

這個刷金幣效率跟連點器一樣(就是連點器) 沒什麼優勢用起來還麻煩

過段時間寫個刷冒險的第一次獎勵的
(小號炸魚很缺銘文 金幣 經驗的)

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

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

############的)##################### ##電腦有點卡。 ###                         ###               

以上是有趣! php使用adb自動刷王者農藥金幣 【冒險模式】的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:learnku.com。如有侵權,請聯絡admin@php.cn刪除