Git Product home page Git Product logo

a9's Issues

代币结算页面会卡住

代币结算页面会卡住,然后不停点击(1500,1000),应该是after run出了bug,麻烦查看一下

建议为刚通玩家改一个刷金币独立脚本

1920*1080分辨率。
我的euroshow赛季刚通十二关,因此刷金币完成一局返回默认在13关,可直接点12关继续刷而无需拉屏幕。
我将你的刷金币脚本修改了64行block12坐标x675.y930。362行删除swipescreen指令即可正常运行。供参考。另资助三十文,从你这学了不少

j50一圈后停止选车

小米mix2s,在开启后跑J50赛季,跑完一圈后在第二圈选车页面不选车了,就一直不动,希望能优化下。

一点小小的想法

  • 个人思路afterrun函数应该改写为一部分一部分的循环,而非现在的笼统循环
    • 完成比赛之后判断右下角继续按钮部位是否变绿,变绿之后有间隔的点击三次,之后跳出
    • 然后是间隔一会儿,点击屏幕中间防止声望升级卡住
    • 然后是等待加载到euro的界面,同样通过判断继续按钮和型能分的位置是否为绿色,未返回则sleep1000之后重复循环

  • 然后是可以新开一个线程专门每100ms检测有无广告,有就点击右上角叉掉

我自己的思路的代码在本地,不会上传,还望大佬赐教

Dr.Omega

选好车之后,没点开始

用的是模拟器,脚本能正常运行到选好车,但是好像没有点开始的按钮。
求大大更新一下,主要是想刷金币,万分感谢

努比亚Z11无法进入比赛

  • 脚本启动后按流程进入EURO12关卡,然后第一辆选的车竟然是911!!!,而且选好车后没法进入比赛,点到了欣赏车的界面。
  • 我是帮群友提的,没法去测试他的设备。我让他自己修改下goldenPoint的值,但是依然无法解决问题。不知道您那里是否能测试该机型呢。

新车亮相杯赛脚本(New Car Unleashed脚本)问题

新车亮相杯赛脚本(New Car Unleashed脚本)
这个脚本有个对新人很难受的地方,因为是新人,所以声望等级低,刚开始用脚本,声望等级会频繁的升级,一升级脚本运行中的时候不会点返回或者确定,会一直停在这个界面,直到自己去点击,所以希望作者能优化一下这个脚本,谢谢,图片我这里有,如果需要麻烦作者加一下我qq2747574577

newcar unleash翻车提醒

新更新的新车发布脚本在本次j50活动中因右划定时器设置500,较高性能车因右划不及时容易终点前上板翻车拿不到代币。经测试将235行右划代码延迟调到300即可避免翻车

我自己对作者的脚本做了一些修改 只有一个手机和平板 所以只支持1920*1080 2560*1600

// 白色 #ffffffff
// 红色 #fffb1264
// 继续 绿色 #ffc3fb12
// 推荐性能分 绿色 #ffc3fc0f
// 广告黑 #ff080906
// 代币蓝 #ff0009ff
// 积分黄 #ffffc600

//选择可用的车,第一列第一张编号为1,第一列第二张为2,第二列第一张为3,依次递增.可根据自己需求修改
//填写车的编号,1920*1080上最多6张车循环,按填写先后顺序用车
const cars = [1,4,2,6,5,3];

/********** 设备 start **********/
const { width, height } = device;

const POWER_SAVE_BRIGHTNESS = 0;
const POWER_SAVE_MUSIC_VOLUME = 0;
const AUTO_BRIGHTNESS_MODE = 1;

const isAutoBrightnessMode = device.getBrightnessMode();
const previousBrightness = device.getBrightness();
const previousMusicVolume = device.getMusicVolume();

/**

  • 调节亮度及音量,进入低功耗模式
    */
    const _savePower = () => {
    device.setBrightness(POWER_SAVE_BRIGHTNESS);
    device.setMusicVolume(POWER_SAVE_MUSIC_VOLUME);
    }

/**

  • 还原运行时脚本之前的屏幕亮度及设备音量
    */
    const _revertPower = () => {
    isAutoBrightnessMode ? device.setBrightnessMode(AUTO_BRIGHTNESS_MODE) : device.setBrightness(previousBrightness);
    device.setMusicVolume(previousMusicVolume);
    }

/**

  • 是否调节亮度及音量,以此减少功耗
    /
    const enablePowerSave = enable => enable ? _savePower() : _revertPower();
    /
    ********* 设备 end **********/

var rootAutomator;
var robot = new Robot();

//1920*1080分辨率
var profile1920 = {

// 最上方代币图标
token: { x: 921 , y: 42 },

// 最上方积分图标
credit: { x: 1206 , y: 42 },

//生涯,开始,继续
goldenPoint: { x: 1500, y: 1000 },

//生涯百分比
careerPercent: { x: 1630, y: 1050 },

//euro
euro: { x: 350, y: 300 },

swipeScreen: function () {
    for (i = 0; i < 4; i++) {
        robot.swipe(height * 2 / 3, 150, height * 2 / 3, 900, 400);
        sleep(200);
    }
},

//12
block12: { x: 680, y: 800 },

//推荐性能分
recommendedPoints: { x: 1800, y: 900 },

//firstCar
firstCar: { x: 555, y: 616 },

distance: { x: 519, y: 365 },

//升级按钮
upgrade: { x: 960, y: 900 },

//广告
adv: { x: 820, y:820 },
//开
start:{x:337, y:200},
//完整结果
result:{x:200, y:1000}

}

var profile;
if (height === 1920 && width == 1080) {
profile = profile1920;
}
else {
toast("该分辨率暂未支持,程序结束");
exit();
}

main();

function main() {

// toast("3秒后将开始运行程序,请迅速切换至游戏主界面");
// sleep(3000);
// toast("开局可能会弹广告,请自己手动关掉,直至保证程序正常选关为止");
deviceInfo();

eventListener();
// 选关卡

//beforeRun();

for (var counter_loop = 0;;counter_loop++) {
    // 运行主函数
    loop(counter_loop);
}

}

function eventListener() {
threads.start(function () {
// 启用按键监听
events.observeKey();
// 监听音量上键按下
events.onKeyDown("volume_down", function (event) {
toastLog("程序手动退出");
if (rootAutomator != null) {
rootAutomator.exit();
}
enablePowerSave(false);
threads.shutDownAll();
exit();
});
});
}

function beforeRun() {
// 判断是否从主页开始
while (true){

   if (check_state() == 1){
        // toastLog("即将开始比赛");
        break;
    }
    // else toastLog("isHome ?= " + check_state());
}

// 点击生涯
robot.click(profile.goldenPoint.x, profile.goldenPoint.y);
sleep(1000);
robot.click(profile.goldenPoint.x, profile.goldenPoint.y);
sleep(1000);
robot.click(profile.goldenPoint.x, profile.goldenPoint.y);
sleep(2000);

// 点击位置
robot.click(profile.careerPercent.x, profile.careerPercent.y);
sleep(500);
// 选择关卡
robot.click(profile.euro.x, profile.euro.y);
sleep(1000);

}

function deviceInfo() {
auto();
if (!requestScreenCapture()) {
toastLog('请求截图失败,程序结束');
exit();
}
enablePowerSave(true);
}

function loop(counter_loop) {

// 选择关卡
chooseMode(counter_loop);
sleep(2000);

// 选车
chooseCar();
sleep(2000);


// 开始
robot.click(profile.goldenPoint.x, profile.goldenPoint.y);
sleep(000);

// 开跑
threads.start(function () {
    run()
});

// 跑完之后
afterRun(counter_loop);

}

function afterRun(counter_loop) {
sleep(68000);
toastLog(++counter_loop + "场比赛已完成");

/* var counter_next = 0;
// 完成三次结算
while (counter_next <= 2) {
if (check_state() == 5) {
robot.click(profile.goldenPoint.x, profile.goldenPoint.y);
sleep(1500);
counter_next++;
}
else if(check_state() == 9) {

        robot.back();
        counter_next++;
        robot.click(profile.goldenPoint.x, profile.goldenPoint.y);
        sleep(1500);
        robot.click(profile.goldenPoint.x, profile.goldenPoint.y);
        
    }     
    // 若未跑完仍可点击氮气
    else {
        robot.click(height * 4 / 5, width / 2);
        sleep(500);
       // toastLog("isNext ?= " + check_state());
    }
}*/

var counter_euro = 0;
while (counter_euro < 1) {
    // 三次结算之后的状态
    switch(check_state()) {
        // Euro
        case 3:{
            counter_euro++;
            break;
        }
        case 9:{
         sleep(2000);
         robot.click(profile.goldenPoint.x, profile.goldenPoint.y);  
         sleep(2000); 
         robot.back();
         break;
         
        
            
            
            }
        // 少点了继续
        case 5 :{
        sleep(500);
        robot.back();
        //robot.click(profile.goldenPoint.x, profile.goldenPoint.y);
        sleep(2000);
        robot.back();
        break
        
        //robot.click(profile.goldenPoint.x, profile.goldenPoint.y);
            }
        
       
        
       case 11:{
        
        robot.click(1919,1079);
        break;}
        
           
       
       }     
    
    sleep(2000);
}
var loop=counter_loop+1;
toastLog("即将开始第"+ loop +"场比赛");

}

function run() {
// 在新线程执行的代码
// 预计时间70秒
var exitTime = new Date().getTime() + 68000;
// 定时点击氮气
var id = setInterval(function () {
robot.click(profile.goldenPoint.x, profile.goldenPoint.y);
var now = new Date().getTime();
if (now > exitTime) {
clearInterval(id);
}
}, 1000);
}

/**

  • 选择关卡
    */
    function chooseMode(counter_loop) {
    if (!counter_loop){
    while (true){
    if (check_state() == 3){
    toast("选择关卡");
    break;
    }
    else {
    // toastLog("isEuro ?= " + check_state());
    sleep(200);
    }
    }
    }

    sleep(700);
    // 向↓滑动,选关
    // for (i = 0; i < 4; i++) {
    // robot.swipe(height * 2 / 3, 150, height * 2 / 3, 900, 400);
    // sleep(200);
    // }
    profile.swipeScreen();

    // toastLog("请在此处截图,截图时不要滑动屏幕");
    // exit();
    sleep(800);
    // 选择第12关
    robot.click(profile.block12.x, profile.block12.y);
    sleep(500);
    // 继续
    robot.click(profile.goldenPoint.x, profile.goldenPoint.y);
    }
    /**

  • 选车
    */
    function chooseCar() {
    for (let i = 0; i < cars.length; i++) {
    let n = cars[i];
    // toastLog(n);
    var carPoint = {
    x: profile.firstCar.x + profile.distance.x * parseInt((n - 1) / 2),
    y: profile.firstCar.y + profile.distance.y * ((n - 1) % 2)
    }
    // toastLog(carPoint.x + "," + carPoint.y);
    var img = captureScreen();
    var carStatus = images.pixel(img, carPoint.x, carPoint.y);
    // toastLog(colors.toString(carStatus));

     if (colors.equals(carStatus, "#ffc3fb12")) {
         robot.click(carPoint.x - profile.distance.x / 2, carPoint.y - profile.distance.y / 2);
         break;
     }
    

    }
    }

function checkForResolution(x, y, img) {
var width = img.getWidth();
var height = img.getHeight();
if (width < height) {
var temp = x;
x = y;
y = temp;
}

return {
    positionX: x,
    positionY: y
};

}

/**

  • 安卓5机器人

  • @constructor
    */
    function LollipopRobot() {
    rootAutomator = new RootAutomator();
    this.click = function (x, y) {
    // return rootAutomator.tap(x, y);
    return Tap(x, y);
    };

    this.swipe = function (x1, y1, x2, y2, duration) {
    // return rootAutomator.swipe(x1, y1, x2, y2, duration);
    return Swipe(x1, y1, x2, y2, duration);
    };

    this.back = function () {
    return Back();
    }
    }

/**

  • 安卓7机器人

  • @constructortap
    */
    function NougatRobot() {
    this.click = function (x, y) {
    return click(x, y);
    };

    this.swipe = function (x1, y1, x2, y2, duration) {
    return swipe(x1, y1, x2, y2, duration);
    };

    this.back = function () {
    return back();
    }
    }

/**

  • 机器人工厂
    */
    function Robot() {
    if (device.sdkInt < 24) {
    const hasRoot = files.exists("/sbin/su") || files.exists("/system/xbin/su") || files.exists("/system/bin/su");
    if (!hasRoot) {
    toast("安卓版本在安卓7以下需要root,程序结束");
    exit();
    }
    this.robot = new LollipopRobot();
    } else {
    this.robot = new NougatRobot();
    }
    this.click = function (x, y) {
    return this.robot.click(x, y);
    };

    this.swipe = function (x1, y1, x2, y2, duration) {
    return this.robot.swipe(x1, y1, x2, y2, duration);
    };

    this.back = function () {
    return this.robot.back();
    };
    }

function check_state() {
var img = captureScreen();

// 若干点的颜色值
var token = images.pixel(img, profile.token.x, profile.token.y);
var credit = images.pixel(img, profile.credit.x, profile.credit.y);
var goldenPoint = images.pixel(img, profile.goldenPoint.x, profile.goldenPoint.y);
var recommendedPoints = images.pixel(img, profile.recommendedPoints.x, profile.recommendedPoints.y);
var upgrade = images.pixel(img, profile.upgrade.x, profile.upgrade.y);
var adv = images.pixel(img, profile.adv.x, profile.adv.y);
var start = images.pixel(img, profile.start.x, profile.start.y);
var result = images.pixel(img, profile.result.x, profile.result.y);
// 1 主页
if (!colors.equals(goldenPoint, "#c3fb12") && colors.equals(token, "#0090ff") && colors.equals(credit, "#ffc600"))
    return 1;
// 3 EURO
if (/*colors.equals(goldenPoint, "#c3fb12") && colors.equals(token, "#0090ff") && colors.equals(credit, "#ffc600") && */(colors.equals(recommendedPoints, "#c3fc0f") || colors.equals(credit, "#ff0054")))
    return 3;
// 5 结算
//if (colors.equals(goldenPoint, "#c3fb12") && !(colors.equals(recommendedPoints, "#c3fb12") || colors.equals(recommendedPoints, "#ff0054")))
    //return 5;
// 7 升级
//if (colors.equals(upgrade, "#ffffff"))
   // return 7;    
// 9 错失机会
if (colors.equals(adv,"#ffffc600"))
    return 9;
// 11 开
if (colors.equals(start,"#FF14BDE9"))
    return 11;
// 13 完整结果
if (colors.equals(result,"#ffffffff")/*||colors.equals(goldenPoint, "#c3fb12")*/)
    return 5;

/*
toastLog("goldenPoint is " + colors.toString(goldenPoint));
toastLog("token is " + colors.toString(token));
toastLog("credit is " + colors.toString(credit));
toastLog("recommendedPoints is " + colors.toString(recommendedPoints));
*/
return -1;

}

依旧是停止选车

使用了你刚刚更新的代码,全车满油的情况下,跑完野兽和蝰蛇,居然直接选择了488开始跑,488的油跑完了居然还点击跳过,然后停在看广告的界面,我将代码第6行改为123456,重新启动程序,跑完第一圈停止选车,是我的破小米有问题吗。。。

关于2k屏

大佬能不能适配下2K屏幕,分辨率2560×1440的。

一点改进建议

目前车是预估60+秒会完成然后结算,但由于是不同的线程,在性能有差别的时候有影响。比如我是二星z4,跑几轮就会乱。考虑放在同步块里?

{

......

	// 按加速
	run()
	// 跑完之后
	afterRun(times);

}

function run() {
	var startTime = new Date().getTime()
	// 定时点击氮气
	while (!raceDone(startTime)) {
		robot.click(height * 4 / 5, width / 2);
		var now = new Date().getTime();
		sleep(1000)
	}
	toastLog("用时:" + (new Date().getTime() - startTime) / 1000)
}

function raceDone(startTime) {
	// 3秒采样一次
	var now = new Date().getTime();
	if (now > startTime + 3000) {
		var img = captureScreen();
		var goldenPoint = images.pixel(img, profile.goldenPoint.x, profile.goldenPoint.y);
		if (colors.equals(goldenPoint, "#c3fb12")) {
			toastLog("比赛结束")
			return true;
		}
	}
	return false;
}

建议写明语言

不知道是不是坐标的问题,我发现用英文版就报错好几次,但是用中文就啥事都没有

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.