-
Notifications
You must be signed in to change notification settings - Fork 16
/
一件换装收火车云手机3.7.1
419 lines (395 loc) · 15.6 KB
/
一件换装收火车云手机3.7.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
'SetScreenScale 1080,1920 '字库缘故,不能直接用这个代码了'云手机,适用分辨率设置: 720*1280 ,1080*1920
'代码参考自nga fetztech 模拟器代码
Import "File.lua"
dim FileName = "log.txt"//路径和日志名字可自定义"/storage/emulated/0/Mobileanjian/"=/sdcard/
'***********************设置区*************************
Dim lh = {3, 6, 9, 16, 18, 19, 29, 28, 27} ' 收货模式建筑列表
Dim gh = {5, 7, 8, 13, 18, 19, 23, 28, 27} ' 收钱模式建筑列表
//Dim lh = {1, 5, 4, 10, 13, 14, 26, 28, 27} ' 收货模式建筑列表
//Dim gh = {1, 5, 4, 14, 13, 14, 26, 28, 27} ' 收钱模式建筑列表
dim id=4 '指定升级建筑id,从左至右,从下到上依次为0~8
Dim s={2, 0, 1, 3, 2} '优先升级指定政策,否则。可以只填第一个,前两个,剩下的随意,也可以全部随意。从左至右,从上到下依次为0~4
'***********************参数区*************************
Dim count=0 '统计收货数
Dim screen_x = GetScreenX(), screen_y = GetScreenY()
'房子坐标
Dim hx() ={296, 550, 803, 296, 550, 803, 296, 550, 803}
Dim hy() ={1262, 1133, 1008, 1008, 881, 756, 756, 628, 503}
'小火车坐标,泡泡偏移量
Dim tx() ={660, 820, 980,100}
Dim ty() ={1640, 1560, 1480,160}
'功能性坐标
Dim fx()={540, 100, 970, 880, 558, 75, 263, 540, 310, 160}
Dim fy()={1680, 1880, 1160, 1752, 1752, 150, 174, 1024, 1600, 1784}
Dim gx()={440, 590, 530, 0, 0, 0 ,0, 200} '文字区域x:更换界面文字左右边界,2政策中心中线,7政策中心偏移量
Dim gy()={680, 1736, 550, 1600, 10, 410, 700, 80} '文字区域y,2~6政策中心中线定位,7政策中心偏移量
'更换界面文字上下沿,政策中心上下沿,当前政策定位点3个
Dim stix()={-210, 210, -210, 210, -210} '政策中心5项定位偏移值
Dim stiy()={140, 140, 320, 320, 500} '政策中心5项定位偏移值
'坐标变换
for j = 0 to 8
hx(j)=hx(j)*screen_x/1080
hy(j)=hy(j)*screen_y/1920
tx(j)=tx(j)*screen_x/1080
ty(j)=ty(j)*screen_y/1920
fx(j)=fx(j)*screen_x/1080
fy(j) = fy(j) * screen_y / 1920
gx(j)=gx(j)*screen_x/1080
gy(j) = gy(j) * screen_y / 1920
stix(j)=stix(j)*screen_x/1080
stiy(j) = stiy(j) * screen_y / 1920
next
'功能性坐标定义
Dim blan = {fx(0), fy(0)} '空白处,屏幕正下方
Dim inst = {fx(1), fy(1)} '修建按钮坐标,屏幕左下
Dim edit = {fx(2), fy(2)} '编辑按钮坐标
Dim upgr = {fx(3), fy(3)} '升级按钮坐标
Dim chan = {fx(4), fy(4)} '替换按钮坐标
Dim b = {tx(3), ty(3)} '选择区域时用到的坐标偏移量
Dim stra = {fx(6), fy(6)} '政策中心起始点
Dim bb = {gx(7), gy(7)} '选择区域时用到的坐标偏移量
Dim stu = {fx(9), fy(9)} '登录界面蓝色对号
Dim nnc(9, 3) '字库
nnc={ {0, "木屋","-20|32|FFFFFF,15|-2|FBD01B,65|3|FFFFFF,66|38|FFFFFF"},_
{1, "钢结构房","28|39|FFFFFF,79|39|FFFFFF,107|40|FBD125,178|21|FFFFFF"},_
{2, "平房" ,"-1|35|FBD125,17|38|FFFFFF,66|-3|FFFFFF,81|30|FFFFFF"},_
{3, "小型公寓","-19|28|FFFFFF,47|38|FFFFFF,161|33|FFFFFF,95|9|FBCE14"},_
{4, "居民楼", "-3|35|FFFFFF,66|40|FBD026,129|37|FFFFFF,128|0|FFFFFF"},_
{5, "人才公寓", "0|37|FBBEBD,32|9|FFFFFF,83|37|FFFFFF,163|6|FFFFFF"},_
{6, "花园洋房" ,"-5|39|FFFFFF,56|18|FFFFFF,99|41|FBBEBA,170|4|FFFFFF"},_
{7, "中式小楼", "0|39|FFFFFF,65|19|FBBFC0,115|24|FFFFFF,162|39|FFFFFF"},_
{8, "空中别墅", "33|1|FFFFFF,56|-38|67BDE4,132|-19|FFFFFF,174|-23|FFFFFF"},_
{9, "复兴公馆" ,"11|29|FFFFFF,67|30|6DBFE2,130|3|FFFFFF,182|23|FFFFFF"},_
{10, "便利店","-3|39|FFFFFF,59|38|FBD125,78|0|FFFFFF,129|4|FFFFFF"}, _
{11, "学校","-6|27|FFFFFF,25|38|FBD225,79|5|FFFFFF,75|35|FFFFFF"}, _
{12, "服装店","-2|37|FFFFFF,72|41|FBD126,73|29|FFFFFF,132|3|FFFFFF"}, _
{13, "五金店" ,"-1|35|FFFFFF,19|26|FBD124,66|35|FFFFFF,132|12|FFFFFF"},_
{14, "菜市场","-11|40|FFFFFF,47|30|FBD124,72|8|FFFFFF,121|26|FFFFFF"}, _
{15, "图书城","13|37|FFFFFF,50|32|FBBEBD,81|2|FFFFFF,131|18|FFFFFF"},_
{16, "商贸中心","-17|38|FFFFFF,107|37|FBBEBD,146|21|FBBFBF,161|19|FFFFFF"},_
{17, "加油站", "25|24|F6B4B3,66|39|FFFFFF,95|-1|FFFFFF,130|8|FFFFFF"},_
{18, "民食斋", "0|37|FFFFFF,18|40|6BBEE2,112|-2|FFFFFF,127|38|FFFFFF"},_
{19, "媒体之声", "-4|40|FFFFFF,68|41|FFFFFF,127|28|5CBBE7,175|29|FFFFFF"},_
{20, "木材厂", "0|39|FFFFFF,-19|32|FFFFFF,11|38|FBD025,66|9|FFFFFF"},_
{21, "造纸厂","34|-4|FBCE1A,-2|35|FFFFFF,83|37|FFFFFF,83|-1|FFFFFF"},_
{22, "水厂","-10|38|FFFFFF,-20|32|FFFFFF,9|39|FBD125,66|2|FFFFFF"},_
{23, "电厂","-16|28|FFFFFF,6|40|FFFFFF,45|16|FBD022,69|4|FFFFFF"},_
{24, "食品厂", "15|38|FFFFFF,2|42|FBD226,48|0|FFFFFF,65|37|FFFFFF"},_
{25, "钢铁厂", "23|-15|FFFFFF,62|2|FFFFFF,96|-17|FFFFFF,115|-13|FBBCBF"},_
{26, "纺织厂","-7|37|FFFFFF,30|29|FFFFFF,68|13|FBC0BE,80|39|FFFFFF"},_
{27, "零件厂","0|38|FBBEBC,25|40|FFFFFF,51|38|FFFFFF,84|9|FFFFFF"}, _
{28, "企鹅机械", "-19|15|FFFFFF,100|38|6BBEE2,163|38|FFFFFF,162|1|FFFFFF"},_
{29, "人民石油", "0|32|6DC0E2,-18|36|FFFFFF,96|26|6ABFE2,163|35|FFFFFF"} }
'***********************自定义函数区*************************
Function money() '收钱函数
Swipe hx(0)*1.5- hx(1)*.5,hy(0)*1.5- hy(1)*.5,hx(2)*2- hx(1),hy(2)*2- hy(1),600
Delay 200
Swipe hx(5)*2- hx(4),hy(5)*2- hy(4),hx(3)*2- hx(4),hy(3)*2- hy(4), 600
Delay 200
Swipe hx(6)*2- hx(7),hy(6)*2- hy(7),hx(8)*2- hx(7),hy(8)*2- hy(7), 600
Delay 1000
End Function
Function upgrade(id) '升级指定建筑函数
Tap edit(0), edit(1)
Delay 100
Tap hx(id), hy(id ) '大哥
Delay 500
Tap upgr(0), upgr(1)
Delay 300
Tap edit(0), edit(1)
Delay 100
End Function
Function RestartGame() '重启游戏函数
Dim package = "com.tencent.jgm"
ShowMessage "重启家国梦"
// TracePrint "当前时间:",datetime.hour(),"时",datetime.hour(),"分,重启家国梦"
// Call File.Append(FileName,datetime.hour()&":"&datetime.minute()&":"&datetime.second()&",重启家国梦"& chr(10))
KillApp package
Delay 1000
RunApp package
i=0
While i<10
Delay 1000
i=i+1
ShowMessage "重启中,已用时"& i &"秒"
TracePrint "重启中,已用时"& i &"秒"
Wend
FindColor inst(0)*.88, inst(1)*.98, inst(0)*1.08, inst(1)*1.01, "04C178", 1, 0.99, cx, cy
While cx < 0
Delay 1000
i=i+1
FindColor stu(0)*.88, stu(1)*.98, stu(0)*1.08, stu(1)*1.01, "FFBF33", 1, 0.99, cx, cy
If cx > -1 and cy > -1 Then
ShowMessage "有点卡,稍等一会 "& i &"秒"
TracePrint "有点卡,稍等一会 "& i &"秒"
Else
ShowMessage "重启中,已用时"& i &"秒"
TracePrint "重启中,已用时"& i &"秒"
End If
FindColor inst(0) * .88, inst(1) * .98, inst(0) * 1.08, inst(1) * 1.01, "04C178", 1, 0.99, cx, cy
If i > 60 Then
ShowMessage "重启出现问题,尝试再次重启..."
TracePrint "重启出现问题,尝试再次重启..."
RestartGame()
End If
Wend
ShowMessage "顺利重启"
TracePrint "顺利重启"
End Function
'凌晨重启-注意模拟器时间要与实际之间一致
Function MidNightRestart() '凌晨重启函数)
If datetime.hour() = 0 and datetime.minute() <= 3 Then
ShowMessage "火车已刷新,重启家国梦"
// TracePrint "当前时间:",datetime.hour(),"时",datetime.minute(),"分,火车已刷新,重启家国梦"
RestartGame() '杀后台
End If
End Function
function strategy() '升级政策函数
tap stra(0), stra(1) '打开政策中心界面
delay 2000
tap blan(0), blan(1) ' 确定已完成的政策
Delay 1000
tap blan(0), blan(1) ' 确定已完成的政策
Delay 200
Dim qt1,qt2
qt1=1
while qt1<20 ' 寻找可升级政策
FindColor gx(2)-gx(7)*2, gy(2), gx(2)+gx(7), gy(3), "03fe01|07fc07", 0, 0.98, stx, sty
if stx < 0 then
ShowMessage "寻找可升级政策"
touchdown gx(2), gy(3)*.7
delay 500
touchmove gx(2), gy(2)*1.1
delay 300
touchup
delay 500
Else
FindMultiColor gx(2), gy(2), gx(2), gy(3), "FFFFFF", "0|" & gy(4) & "|FCDFAB," & "0|" & gy(5) & "|FCDFAB," & "0|" & gy(6) & "|E8E5E0", 0, 0.99, cx, cy
qt2=1
While cx < 0 and qt2 < 10
ShowMessage "已找到可升级政策,正在定位..."
Delay 500
touchdown gx(2), gy(3)*.7
delay 200
touchmove gx(2), gy(3)*.5
delay 300
touchup
Delay 500
FindMultiColor gx(2), gy(2), gx(2), gy(3), "FFFFFF", "0|" & gy(4) & "|FCDFAB," & "0|" & gy(5) & "|FCDFAB," & "0|" & gy(6) & "|E8E5E0", 0, 0.99, cx, cy
qt2=qt2+1
If qt2 > 9 Then
ShowMessage "定位失败,尝试直接查询..."
End If
Wend
stx = -1
i=0
While stx < 0
ShowMessage "指定政策查询中..."
FindColor cx+stix(s(i))+stix(0), cy+stiy(s(i))-.6*stiy(0), cx+stix(s(i)), cy+stiy(s(i))+.6*stiy(0), "03fe01|07fc07", 0, 0.98, stx, sty
if stx > 0 then
ShowMessage "找到指定政策,即将升级..."
End If
if i > 4 then
ShowMessage "指定政策未找到,升级找到的第一个可升级政策"
FindColor gx(2)-gx(7)*2, gy(2), gx(2)+gx(7), gy(3), "03fe01|07fc07", 0, 0.98, stx, sty
End If
i=i+1
Wend
exit while
End If
qt1 = qt1 + 1
If qt1 > 19 Then
ShowMessage "未找到可升级政策,即将退出..."
End If
wend
// TracePrint "当前时间:",datetime.hour(),"时",datetime.minute(),"分,升级政策""
// Call File.Append(FileName,datetime.hour()&":"&datetime.minute()&":"&datetime.second()&",升级政策"& chr(10))
tap stx+bb(0), sty+bb(1) '选择第 个可升级项
delay 1000
tap gx(2), gy(3)*.75 ' 升级
delay 500
tap inst(0), inst(1) '退出政策界面
delay 500
tap inst(0), inst(1) '退出政策界面
End Function
Function loadtrain() '卸货函数
Dim ssx, ssy,ax, ay
For i = 0 To 2
// 只收橙色,判断是否有紫色蓝色
FindColor tx(i)-b(0), ty(i) -b(1), tx(i), ty(i) - 0.5*b(1), "3CC1FF", 1, 1, ssx, ssy
/*
//只收橙色紫色,判断是否有蓝色
FindColor tx(i)-b(0), ty(i) -b(1), tx(i), ty(i) - 0.5*b(1), "3CC1FF|FF989A",1,1, ssx, ssy
ssx = 1 '收所有
*/
If ssx > - 1 Then
While True
TouchDown tx(i), ty(i)
Delay 200
FindColor hx(0)*.5, hy(8)*.5, hx(0)*3.3, hy(0), "44E167|4AD566|7FFD8E", 1, 0.98, ax, ay
If ax > -1 and ay > -1 Then
TouchMove ax, ay
Delay 100
TouchUp
Delay 100
count =count+1
ShowMessage "当前时间:"&datetime.hour()&"时"&datetime.minute()&"分,共收取"&count&"份货物"
// TracePrint "当前时间:",datetime.hour(),"时",datetime.minute(),"分,共收取",count,"份货物"
// Call File.Append(FileName,datetime.hour()&":"&datetime.minute()&":"&datetime.second()&",共收取"&count&"份货物"& chr(10))
Else
TouchUp
Delay 100
Goto xx
End If
Wend
End If
Rem xx
Next
End Function
function housechan(i, j) '更换建筑操作函数
delay 500
tap hx(i), hy(i)-.8*bb(1) ' 点击要更换建筑的位置
If j = gh(i) Then
ShowMessage "尝试更换‘"& nnc(lh(i),1)& "’为‘" &nnc(j, 1)&"’"
// TracePrint "尝试更换", nnc(lh(i),1), "为" ,nnc(j, 1)
Else
ShowMessage "尝试更换‘"& nnc(gh(i),1)& "’为‘" &nnc(j, 1)&"’"
// TracePrint "尝试更换", nnc(gh(i),1), "为" ,nnc(j, 1)
End If
delay 1000
tap chan(0), chan(1) '打开更换列表
delay 1000
'字库分辨率适配代码
dim cx, cy, a, b1,b2,b3,c(12),qt3, nncc
a = Split(nnc(j, 2), "|")
b1 = Split(a(2), ",")
b2 = Split(a(4), ",")
b3 = Split(a(6), ",")
c(0) = a(0)*screen_x/1080
c(1) = a(1)*screen_y/1920
c(2) = b1(0)
c(3) = b1(1)*screen_x/1080
c(4) = a(3)*screen_y/1920
c(5) = b2(0)
c(6) = b2(1)*screen_x/1080
c(7) = a(5)*screen_y/1920
c(8) = b3(0)
c(9) = b3(1)*screen_x/1080
c(10) = a(7)*screen_y/1920
c(11) = a(8)
nncc = c(0) & "|" & c(1) & "|" & c(2) & "," & c(3) & "|" & c(4) & "|" & c(5) & "," & c(6) & "|" & c(7) & "|" & c(8) & "," & c(9) & "|" & c(10) & "|" & c(11)
FindmultiColor gx(0), gy(2)*.4, gx(1), gy(2), "FFFFFF",nncc, 0, .98, cx, cy
If cx > -1 and cy > -1 Then
ShowMessage "‘" &nnc(j, 1)&"’已就位,无需更换"
goto nochan
Else
qt3=1
while true '翻页查找建筑
FindmultiColor gx(0), gy(0), gx(1), gy(1), "FFFFFF",nncc, 0, .98, cx, cy
if cx < 0 and cy <0 then
ShowMessage "正在查找‘" &nnc(j, 1)&"’..."
TouchDown gx(2), gy(1)*.75
Delay 300
TouchMove gx(2), gy(0)*1.1
Delay 300
TouchUp
Delay 2000
else
ShowMessage "‘" &nnc(j, 1)&"’已找到,即将更换..."
exit while
End If
If qt3 > 4 Then
ShowMessage "‘" &nnc(j, 1)&"’未找到,即将退出..."
Goto nochan
End If
qt3=qt3+1
wend
//TracePrint cx, cy
tap cx, cy+2*bb(1) '找到建筑,点击
delay 1500
end if
Rem nochan
tap inst(0), inst(1)
delay 200
end function
function changehouse(j) '轮流更换建筑函数
delay 500
tap edit(0), edit(1) '打开编辑按钮
for i=0 to 8
if lh(i) =gh(i) then
else
housechan(i, j(i))
end if
next
delay 200
tap edit(0), edit(1) '关闭编辑按钮
end function
function loadtime() '收货模式函数
changehouse(lh) '收货前换建筑
ShowMessage "进入收货模式,即将更换收货增益建筑..."
//Call File.Append(FileName,datetime.hour()&":"&datetime.minute()&":"&datetime.second()&",收货前换建筑"& chr(10))
While True
Dim m=1, n = 1, iter = 120, cx1, cy1, stx, sty,res
While n < iter
delay 1000
FindColor stra(0), stra(1), stra(0)*1.3, stra(1)*1.4, "00d900" , 0, 0.98, stx, sty
if stx > -1 then
ShowMessage "发现政策中心可升级..."
strategy()
end if
FindColor tx(0)-tx(3), ty(0) -ty(3), tx(0), ty(0) - 0.5*ty(3), "EAC254|FF989A|3CC1FF", 1, 1, cx1, cy1
If cx1<0 And cy1< 0 Then
m=m+1
If n = 1 Then
tap inst(0), inst(1) '增加容错率,防止 弹出 通知 卡死
delay 500
tap inst(0), inst(1) '增加容错率,防止 弹出 通知 卡死
delay 500
money ()'收钱,注释掉此行后不进行收钱
upgrade (id) '升级建筑,注释掉此行后不进行升级
Else
End If
Else
res = loadtrain() '卸货
RestartGame() '重新登陆
End If
n = n + 1
Wend
if m>iter-2 then '连续2分钟无火车,退出收货模式
exit while
end if
Wend
ShowMessage "收货结束,即将换回收钱建筑..."
// Call File.Append(FileName,datetime.hour()&":"&datetime.minute()&":"&datetime.second()&",收完货,换回建筑"& chr(10))
changehouse(gh) '收完货,换回建筑
End Function
'主程序
Dim i, cx, cy, stx, sty, t =120
Delay 3000
ShowMessage "自动化已启动......"
//Call File.Write(FileName, datetime.hour()&":"&datetime.minute()&":"&datetime.second()&",开始运行"& chr(10))//这边有加上执行该命令相应的系统时间
while true
MidNightRestart()
Delay 1000
FindColor stra(0), stra(1), stra(0)*1.3, stra(1)*1.4, "00d900" , 0, 0.98, stx, sty
If stx > -1 Then
ShowMessage "发现政策中心可升级..."
strategy()
end if
FindColor tx(0)-tx(3), ty(0) -ty(3), tx(0), ty(0) - 0.5*ty(3), "EAC254|FF989A|3CC1FF", 1, 1, cx, cy
If cx<0 And cy< 0 Then
if t= 120 then
tap inst(0), inst(1) '增加容错率,防止 弹出 通知 卡死
delay 500
tap inst(0), inst(1) '增加容错率,防止 弹出 通知 卡死
delay 500
money ()'收钱,注释掉此行后不进行收钱
upgrade (id) '升级建筑,注释掉此行后不进行升级
t=1
else
end if
else
loadtime()
end if
t=t+ 1
wend