Skip to content

Commit bffd6c3

Browse files
committed
修复看广告异常的bug
1 parent 1a8c71e commit bffd6c3

File tree

3 files changed

+173
-108
lines changed

3 files changed

+173
-108
lines changed

README.md

+9-12
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
* 如果您觉得脚本好用,请点个star
77

88
## 设备要求:
9-
* 安卓7.0版本即以上无需ROOT权限,其余安卓版本需要ROOT.
9+
* 安卓7.0版本及以上无需ROOT权限,其余安卓版本需要ROOT.
1010
* 手机分辨率必须为**1920×1080或2160×1080或2220*1080**,其余分辨率**不支持**.
1111
* 需流畅运行a9,若有卡顿可能会出现意料之外的问题.
12-
* 需在酷安下载Auto.js软件, [下载链接](https://www.coolapk.com/apk/org.autojs.autojs),也可以前往auto.js的github[主页](https://github.com/hyb1996/Auto.js)下载最新版Auto.js
12+
* 需在酷安下载Auto.js软件, [下载链接](https://www.coolapk.com/apk/org.autojs.autojs),也可以前往auto.js的github[主页](https://github.com/hyb1996/Auto.js/releases)下载最新版Auto.js
1313

1414
## 使用方法:
1515
1. 下载auto.js, 导入脚本
16-
* 访问[下载连接](https://raw.githubusercontent.com/zlsq/A9/master/euro12.js),另存为即可下载,若下载不下来复制源码后导入auto.js软件内也行.
16+
* 访问[下载链接](https://github.com/zlsq/A9/releases),即可下载,若下载不下来复制所需要脚本的源码后导入auto.js软件内也行.
1717
2. 进入游戏主界面, 切出来运行脚本(推荐打开auto.js的悬浮窗,这样就可以直接在悬浮窗中点击运行脚本了)
1818
3. 立即切回游戏主界面, 等待脚本运行即可
1919
4. 音量下键可以停止运行脚本
@@ -24,10 +24,10 @@
2424
3. 相关车必须在指定时间内能跑完,性能分足够(自动驾驶一直点击氮气能跑完全程)
2525

2626
## 关于脚本:
27-
目前有四个脚本:
27+
目前有三个个脚本:
2828
* euro脚本能循环跑第四赛季EURO12限时赛(游戏主界面运行脚本)
2929
* 脚本循环用该关卡前面6张车(其实主要是z4,大众sport,BMW,DS)跑第四赛季Euro12关,使用本脚本需要先行解锁该关卡,并且性能分足够(一直点击氮气能通过本关卡).
30-
* 可以自定义使用的车辆,选车界面第一列第一排车为编号1,第一列第二排车为编号2,第二列第一排车为编号3,依次递增,填写在代码第三行cars数组中,默认为1,2,3,4,5,6表示使用6张车.当然你也可以自行定义使用车的顺序,你可以定义为6,5,4,3,2,1],表示先使用第6张车,没油了就用第5张依次递减.
30+
* 可以自定义使用的车辆,选车界面第一列第一排车为编号1,第一列第二排车为编号2,第二列第一排车为编号3,依次递增,填写在代码第三行cars数组中,默认为1,2,3,4,5,6表示使用6张车.当然你也可以自行定义使用车的顺序,你可以定义为[6,5,4,3,2,1],表示先使用第6张车,没油了就用第5张依次递减.
3131
* 脚本达到的效果:平均1分30秒一个循环,96000积分/小时,声望自行计算.
3232
* 脚本运行后会设置屏幕亮度为0,媒体音量为0,是正常现象.
3333
* 脚本每次运行时需要给无障碍权限(模拟点击,滑动等操作),第一次运行时需要修改系统设置权限(修改屏幕亮度)
@@ -38,16 +38,13 @@
3838
* 能自定义使用的车辆,自定义的方法同第一个脚本
3939
* 能循环跑bc杯赛,每把7600金币,平均一小时二十多万,效率远远大于第一个脚本.
4040
* DS需要满改,才能大概率获得赛事第一
41-
* 使用C级或B级车能拿到5代币,但是零件需要自己手肝
42-
* 在所有车没有油之后, 脚本会停止运行
43-
* 现在发布这个杯赛的脚本是因为杯赛流程每次都差不多,大家可以自行修改部分参数后即可每次都用来跑新车亮相的杯赛.
41+
* 使用C级或B级车能拿到5代币,但是零件需要自己手肝,若只想跑b车的赛事,请自定义使用车辆为b车,这样能尽快拿到100*5代币
42+
* 在所有定义的车辆没有燃油之后, 脚本会自动看广告
43+
* 这个杯赛的脚本流程每次都差不多,大家可以自行修改部分参数后即可每次都用来跑新车亮相的杯赛.
4444
* 需要适配其他分辨率请邮箱联系我,并附上游戏关键步骤截图(需要未经压缩的原图),有时间我便会适配.
45-
* BC杯赛自动看广告脚本
46-
* 使用方法同上个脚本,但是本脚本提供看广告功能,在所有车没油之后会选择第一辆车看广告
47-
* 之所以做两个版本是因为自动看广告还不成熟,受网络波动影响比较大,不是太稳定。无法解决网络报错6005和6006
4845
* 自动看广告脚本
4946
* 在选完车后页面运行本脚本(会自动点击跳过按钮,无需手动操作)
50-
* 本脚本主要是为了帮助肝多人比赛的朋友能尽快拿自己想开的车驰骋多人赛场
47+
* 本脚本主要是为了帮助肝多人比赛但不想自己看广告的朋友能尽快拿自己想开的车驰骋多人赛场
5148
## 联系作者:
5249
5350

帕加尼BC.js

+105-24
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// 选择可用的车,第一列第一辆编号为1,第一列第二辆为2,第二列第一辆为3,以此类推
22
// 在第6行填写车的编号,最多6辆车循环
33
// 按填写先后顺序用车
4-
// 请根据自己需求修改
4+
// 请根据自己实际情况修改第6行后开始运行脚本
55

6-
const cars = [1,2,3,4,5,6];
6+
const cars = [1, 2, 3, 4, 5, 6];
77
const width = device.width;
88
const height = device.height;
99

@@ -51,13 +51,11 @@ var profile2160 = {
5151
y: 974
5252
},
5353

54-
//生涯,开始,继续
5554
goldenPoint: {
5655
x: 1700,
5756
y: 1000
5857
},
5958

60-
//firstCar
6159
firstCar: {
6260
x: 565,
6361
y: 630
@@ -73,10 +71,8 @@ var profile2160 = {
7371
y: 313
7472
},
7573

76-
//左边按钮
7774
left: { x: 961, y: 730 },
7875

79-
//右边按钮
8076
right: { x: 1170, y: 730 }
8177
}
8278

@@ -116,16 +112,16 @@ function before() {
116112
toast('请求截图失败,程序结束');
117113
exit();
118114
}
119-
//调整屏幕亮度
115+
// 调整屏幕亮度及媒体音量
120116
device.setBrightness(0);
121117
device.setMusicVolume(0);
122118
}
123119

124120
function eventListener() {
125121
threads.start(function () {
126-
//启用按键监听
122+
// 启用按键监听
127123
events.observeKey();
128-
//监听音量上键按下
124+
// 监听音量上键按下
129125
events.onKeyDown("volume_down", function (event) {
130126
toastLog("程序手动退出");
131127
device.setBrightness(40);
@@ -136,41 +132,43 @@ function eventListener() {
136132
}
137133

138134
function main() {
139-
//比赛
135+
// 比赛
140136
click(profile.compete.x, profile.compete.y);
141137
click(profile.compete.x, profile.compete.y);
142138
sleep(2000);
143139

140+
// 选车 & 开始比赛
144141
toast("选车");
145142
sleep(700);
146-
//选车
147143
chooseCar();
144+
click(profile.goldenPoint.x, profile.goldenPoint.y);
145+
click(profile.goldenPoint.x, profile.goldenPoint.y);
148146

149-
//载入动画
147+
// 载入动画
150148
sleep(10000);
151149

152-
//开跑
150+
// 开跑
153151
threads.start(function () {
154152
run()
155153
});
156154

157-
//跑完之后
155+
// 跑完之后
158156
afterRun();
159157
}
160158

161159

162160
function run() {
163-
//在新线程执行的代码
164-
//console.log("定时器启动,定时点击氮气");
165-
//预计时间90秒
161+
// 在新线程执行的代码
162+
// console.log("定时器启动,定时点击氮气");
163+
// 预计时间90秒
166164
var exitTime = new Date().getTime() + 95000;
167-
//定时点击氮气
165+
// 定时点击氮气
168166
var id = setInterval(function () {
169167
click(height * 4 / 5, width / 2);
170168
swipe(5 * height / 8, width / 2, height * 7 / 8, width / 2, 500);
171169
var now = new Date().getTime();
172170
if (now > exitTime) {
173-
//{console.log("定时器结束");
171+
// console.log("定时器结束");
174172
clearInterval(id);
175173
}
176174
}, 1000);
@@ -182,22 +180,24 @@ function afterRun() {
182180
sleep(95000);
183181
toast("跑完了");
184182

185-
//本层循环用于点击三次继续.
183+
// 本层循环用于点击三次继续.
186184
while (true) {
187185
// 截图
188186
var img = captureScreen();
189187

190188
// 倒计时
191189
var color_countdown = images.pixel(img, profile.countdown.x, profile.countdown.y);
192190

193-
// 粉红(在跑完之后会闪现出活动主页)
191+
// 粉红(在跑完之后会出现一闪而过的活动主页)
194192
if (colors.equals(color_countdown, "#ffff0054")) {
195193
break;
196194
}
197195
click(profile.goldenPoint.x, profile.goldenPoint.y);
198196
}
199197

200-
//本层循环用于控制领代币或者升级
198+
sleep(1000);
199+
200+
// 本层循环用于控制领代币或者升级
201201
while (true) {
202202
sleep(1000);
203203
// 截图
@@ -242,8 +242,17 @@ function chooseCar() {
242242
}
243243
}
244244
if (flag) {
245-
toastLog("都没油了,脚本退出");
246-
exit();
245+
toastLog("都没油了");
246+
let n = cars[0];
247+
var carPoint = {
248+
x: profile.firstCar.x + profile.distance.x * parseInt((n - 1) / 2),
249+
y: profile.firstCar.y + profile.distance.y * ((n - 1) % 2)
250+
}
251+
click(carPoint.x - profile.distance.x / 2, carPoint.y - profile.distance.y / 2);
252+
sleep(2000);
253+
//开始
254+
click(profile.goldenPoint.x, profile.goldenPoint.y);
255+
ad();
247256
}
248257
}
249258

@@ -260,4 +269,76 @@ function checkForResolution(x, y, img) {
260269
positionX: x,
261270
positionY: y
262271
};
272+
}
273+
274+
275+
function ad() {
276+
toastLog("开始为车辆补充燃油");
277+
while (true) {
278+
// confirm the UI
279+
var img = captureScreen();
280+
var left = images.pixel(img, profile.left.x, profile.left.y);
281+
var right = images.pixel(img, profile.right.x, profile.right.y);
282+
// toastLog("left is " + colors.toString(left));
283+
// toastLog("right is " + colors.toString(right));
284+
if (colors.equals(left, "#c3fb12") && colors.equals(right, "#ffffff")) {
285+
click(profile.right.x, profile.right.y);
286+
toastLog("开始看这个广告");
287+
break;
288+
}
289+
else {
290+
sleep(1000);
291+
}
292+
}
293+
294+
// wait for playing ad
295+
sleep(30000);
296+
297+
var jump_back = 0;
298+
299+
while (true) {
300+
if (!jump_back) {
301+
toastLog("尝试返回")
302+
back();
303+
sleep(5000);
304+
}
305+
306+
var img = captureScreen();
307+
var left = images.pixel(img, profile.left.x, profile.left.y);
308+
var right = images.pixel(img, profile.right.x, profile.right.y);
309+
var next = images.pixel(img, profile.goldenPoint.x, profile.goldenPoint.y);
310+
// toastLog("left is " + colors.toString(left));
311+
// toastLog("right is " + colors.toString(right));
312+
// toastLog("next is " + colors.toString(next));
313+
314+
// grey blue
315+
if (colors.equals(left, "#bababa") && colors.isSimilar(right, "#2580d8")) {
316+
toastLog("继续广告");
317+
click(profile.right.x, profile.right.y);
318+
// click(profile.right.x, profile.right.y);
319+
sleep(8000);
320+
}
321+
// green white
322+
else if (colors.equals(left, "#c3fb12") && colors.equals(right, "#ffffff")) {
323+
toastLog("看下一个广告")
324+
ad();
325+
}
326+
// next is green
327+
else if (colors.equals(next, "#c3fb12")) {
328+
toastLog("车辆燃油已恢复,即将开始下一场比赛");
329+
break;
330+
}
331+
// next is white
332+
else if (colors.equals(next, "#ffffff")) {
333+
toastLog("偶然多点一次返回,看下一个广告")
334+
click(profile.goldenPoint.x, profile.goldenPoint.y);
335+
ad();
336+
}
337+
// In progress
338+
else {
339+
toastLog("请稍等");
340+
sleep(3000);
341+
jump_back = 1;
342+
}
343+
}
263344
}

0 commit comments

Comments
 (0)