王者荣耀刷金币脚本内测

auto();
requestScreenCapture();

var h = device.width - 30;
var w = device.height - 30;

//按钮图像模板路径
var btnpath = {
"cg": "/sdcard/btnimg/cg.png",
"zd": "/sdcard/btnimg/zd.png",
"djpm": "/sdcard/btnimg/djpm.png",
"zctz": "/sdcard/btnimg/zctz.png"
};
var runnum = 0;

runNums();

//1闯关 2自动 3点击屏幕 4再次挑战
var type = 1;

//先寻找再次挑战
while (true) {
switch (type) {
case 1:
if (findbtnimg(btnpath.cg)) {
type = 2;
}
break;
case 2:
if (findbtnimg(btnpath.zd)) {
type = 4;
}
break;
case 3:
if (findbtnimg(btnpath.djpm)) {
type = 4;
}
break;
case 4:
if (findbtnimg(btnpath.zctz)) {
type = 1;
runnum--;
if (runnum < 1) {
home();
exit();
}
}
break;
}

sleep(3000);

click(w, h);

}

function findbtnimg(btnp) {

var readbtnimg = images.read(btnp);
//截图并找图
var p = findImage(captureScreen(), readbtnimg, {
// region: [0, 50],
threshold: 0.2
});
if (p) {

toast("找点成功: " + p + type);
//模拟点击
click((p.x + 30), (p.y + 20));
// pressCompat((p.x), (p.y),200);
return true;

} else {
toast("剩余场次" + (runnum - 1) + "次");
return false;
}

}

function isNumber(val) {

var regPos = /^\d+(.\d+)?$/; //非负浮点数
var regNeg = /^(-(([0-9]+.[0-9][1-9][0-9])|([0-9][1-9][0-9].[0-9]+)|([0-9][1-9][0-9])))$/; //负浮点数
if (regPos.test(val) || regNeg.test(val)) {
return true;
} else {
return false;
}

}

function runNums() {

runnum = rawInput("输入要刷的次数(0表示无限次)", "0");
if (!isNumber(runnum)) {
alert("请输入整数数字");
runNums();
}
if (runnum == 0) runnum = 9999;
}

图片可以加我扣扣索取,或者自己截图。

  • 4
    帖子
  • 3099
    浏览

与 Auto.js 的连接断开,我们正在尝试重连,请耐心等待