forked from tkkcc/ArkLights
-
Notifications
You must be signed in to change notification settings - Fork 1
/
path.lua
4374 lines (3918 loc) · 127 KB
/
path.lua
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
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
path = {}
-- base 只在跳转时使用,如果在任务中间需要登录失效,则当前任务超时后,下一任务的跳转会重新登录。
-- base 应覆盖尽可能多的corner case。
-- wait_game_up 每5秒执行一次,保证游戏在前台,别点到其他应用。
-- wait_game_up 有必要在游戏中自动亮屏吗:有
-- wait_game_up 有必要在切出游戏后回到游戏吗:有
-- wait_game_up 有必要做B服界面跳转吗:没有。做了之后,退出账号难实现
path.base = {
面板 = function()
login_error_times = 0
return true
end,
下载资源确认 = "下载资源确认",
资源下载确定 = "资源下载确定",
start黄框 = function()
wait(function()
tap("适龄提示")
tap("保持配音")
tap("保持配音确定")
tap("start黄框")
end)
end,
start黄框暗 = function() return path.base["start黄框"]() end,
账号登录 = function() tap("账号登录") end,
开始唤醒 = function()
check_login_frequency()
tap("开始唤醒")
disappear("开始唤醒")
end,
手机验证码登录 = disable_game_up_check_wrapper(function()
if appid ~= oppid then return end
if not username or #username == 0 or not password or #password == 0 then
-- 单账号直接停,多账号跳过
stop("账号或密码为空", account_idx and true or false)
end
if #username > 0 then
if not wait(function()
tap("账号左侧")
tap("账号")
-- if disappear("手机验证码登录", 1) then return true end
if appear('inputbox', 1) then return true end
end, 10) then return end
-- if not appear('inputbox') then return end
-- ssleep(1) -- 等待输入法弹出
-- if debug_mode then toast(username) end
-- ssleep(.5) -- 等待输入法弹出
if not wait(function()
wait(function() input("inputbox", username) end, 1)
tap("okbutton")
-- appear("手机验证码登录")
if appear("手机验证码登录", 1) and not findOne("okbutton") then
return true
end
end, 3) then return end
end
if not appear("手机验证码登录", 1) then return end
if #password > 0 then
-- if debug_mode then toast(password) end
if not wait(function()
tap("账号左侧")
tap("密码")
-- if disappear("手机验证码登录", 1) then return true end
if appear('inputbox', 1) then return true end
end, 10) then return end
-- if not appear('inputbox') then return end
-- ssleep(1) -- 等待输入法弹出
-- if debug_mode then toast(password) end
-- ssleep(.5) -- 等待输入法弹出
if not wait(function()
wait(function() input("inputbox", password) end, 1)
tap("okbutton")
-- appear("手机验证码登录")
if appear("手机验证码登录", 1) and not findOne("okbutton") then
return true
end
end, 3) then return end
-- appear("手机验证码登录")
end
if not appear("手机验证码登录", 1) then return end
-- local login_error_times = 0
wait(function()
tap("登录")
local p = appear({"captcha", "密码不能为空", "单选确认框"}, 2)
log(p)
if p == 'captcha' then
trySolveCapture()
appear("单选确认框")
end
if p == "密码不能为空" or p == "单选确认框" then
return true
end
end, 4)
if findTap("单选确认框") then
log("login_error_times", login_error_times)
login_error_times = (login_error_times or 0) + 1
end
-- 两次,第一次可能是数据更新
if login_error_times > 1 then stop("单选确认框,密码错误?") end
end),
正在释放神经递质 = function()
if not disappear("正在释放神经递质", 60 * 60, 1) then
stop("正在释放神经递质超1小时")
end
end,
接管作战 = function()
if not disappear("接管作战", 8 * 60 * 60, 1) then
stop("接管作战超8小时")
end
-- this calllback only works for 主线、资源、剿灭
local unfinished
local first_time_see_zero_star
local zero_star
local see_end
local unexpect_return
if not wait(function()
if findOne("行动结束") then see_end = true end
if findOne("行动结束") and findOne("零星代理") then
first_time_see_zero_star = first_time_see_zero_star or time()
-- 实测560秒,给两倍
if time() - first_time_see_zero_star > 1200 then zero_star = true end
end
if findOne("开始行动") and findOne("代理指挥开") then
log(59)
return true
end
if findOne("接管作战") then
unfinished = true
return true
end
-- 战斗记录未同步
if findOne("返回确认界面") then
tap("左取消")
unexpect_return = true
end
-- 掉线
if findAny({
"开始唤醒", "bilibili_framelayout_only", "面板",
"手机验证码登录",
}) then
log(60)
return path.跳转("首页")
end
tap("开始行动")
appear({"开始行动", "接管作战"}, 1)
end, 60) then return end
if unfinished then return path.base.接管作战() end
log("代理结束", cur_fight, "失败次数", fight_failed_times[cur_fight])
log(139, first_time_see_zero_star, zero_star)
if zero_star or not see_end then
log("代理失败返回首页")
captureqqimagedeliver(os.date('%Y.%m.%d %H:%M:%S') ..
table.join(qqmessage, ' ') .. " " .. cur_fight ..
"代理失败", QQ)
-- 一次代理失败直接认为无效:不行,因为可能是掉线造成的失败
-- fight_failed_times[cur_fight] = 3
log(161)
return path.跳转("首页")
end
log(89, repeat_fight_mode)
if repeat_fight_mode then return path.开始游戏('') end
-- current fight success
pre_fight = cur_fight
fight_failed_times[cur_fight] = 0
-- if same fight or same page fight
local next_fight_tick = fight_tick % #fight + 1
local next_fight = fight[next_fight_tick]
log(cur_fight, next_fight)
if get_fight_type(cur_fight) == "剿灭" then
-- 剿灭必须回主页
path.跳转("首页")
elseif next_fight == cur_fight then
fight_tick = next_fight_tick
pre_fight = nil
return path.开始游戏(next_fight)
elseif same_page_fight(cur_fight, next_fight) then
if not wait(function()
if not findOne("开始行动") then return true end
tap("主页右侧")
end, 20) then return end
-- TODO how to ignore this sleep
-- ssleep(.5)
-- 只有主线与物资芯片会存在same_page_fight,
-- 物资芯片的appear是完备的
local x = get_fight_type(cur_fight)
-- if x == "物资芯片" then
-- appear("作战列表" .. cur_fight, .5)
if x == "主线" then
local x0 = cur_fight
local chapter = x0:find("-")
chapter = x0:sub(1, chapter - 1)
chapter = chapter:sub(chapter:find("%d"))
local chapter_index = tonumber(chapter) + 1
appear("当前进度列表" .. chapter_index, .5)
else
log("unexpected same page fight wait")
ssleep(.5)
end
end
end,
bilibili_framelayout_only = function() auto(path.bilibili_login) end,
-- bilibili_account_switch = function() auto(path.bilibili_login) end,
}
path.bilibili_login = {
captcha = function() trySolveCapture() end,
bgame = true,
bilibili_license_ok = function() tap("bilibili_license_ok") end,
bilibili_phone_inputbox = function()
-- 把输入法关了
wait(function()
if findOne("bilibili_account_login") then return true end
tap("返回")
end, 5)
tap("bilibili_account_login")
appear("bilibili_username_inputbox")
end,
-- bilibili_username_inputbox = function()
-- if not findOne()
-- tap("返回")
-- end,
bilibili_username_inputbox = function()
log(149)
-- 把输入法关了
wait(function()
if findOne("bilibili_login") then return true end
tap("返回")
end, 5)
if username and #username > 0 and password and #password > 0 then
wait(function() input("bilibili_username_inputbox", username) end, 1)
wait(function() input("bilibili_password_inputbox", password) end, 1)
-- input("bilibili_username_inputbox", username)
-- input("bilibili_password_inputbox", password)
end
tap("bilibili_login")
if not disappear("bilibili_login", 5) then stop("登录失败35", true) end
-- 小米
appearTap({text = "存储"}, 1)
appear({"bilibili_change2", "captcha"})
end,
bilibili_oneclicklogin = function()
tap("bilibili_oneclicklogin")
appear({"bilibili_ok", "bilibili_change2"}, 5)
end,
bilibili_ok = function()
tap("bilibili_ok")
appear("bgame", 5)
end,
bilibili_other = function()
tap("bilibili_other")
appear("bilibili_phone_inputbox")
end,
bilibili_change2 = function()
if debug_mode then
if appear("bilibili_account_switch") then
toast(259)
else
toast(258)
end
exit()
end
check_login_frequency()
disappear("bilibili_change2", 10)
log(271)
end,
}
path.bilibili_login_change = update(path.bilibili_login, {
bilibili_oneclicklogin = false,
bilibili_username_inputbox = true,
bilibili_change2 = function()
wait(function()
tap("bilibili_change2")
-- if appear({"bilibili_change", "bilibili_account_login"}, .5) then
if appear({"bilibili_change", "bilibili_phone_inputbox"}, .5) then
return true
end
end, 5)
end,
bilibili_change = function()
tap("bilibili_change")
-- appear("bilibili_account_login")
appear("bilibili_phone_inputbox")
end,
}, nil, true)
path.fallback = {
查看谢幕表 = function() tap("战略确认") end,
我知道了 = function() tap("我知道了") end,
剿灭提示 = function() tap("左上角返回") end,
获得物资 = function() tap("返回") end,
战略返回 = function()
tap("战略返回")
appear("常规行动", 2)
end,
断罪返回 = function()
tap("断罪返回")
disappear("断罪返回")
end,
断罪 = function()
if appear("跳过剧情") then
tap("跳过剧情")
ssleep(1)
tap("跳过剧情确认")
end
end,
签到返回黄 = function() return path.fallback.签到返回() end,
签到返回 = function()
local x
local last_time_tap_return = time()
local start_time = time()
if not wait(function()
-- 曾出现 返回确认 误判为 活动公告返回
-- 返回确认3按back太快弹不出来
local timeout = min(2, (time() - start_time) / 1000 * 2 / 10)
log(237, timeout)
-- timeout = 0
x = appear({"返回确认", "返回确认3", "断罪"}, timeout)
-- disappear("开始行动", min(2, (time() - start_time) / 1000 * 2 / 2))
if x then return true end
back()
-- 每两秒按下返回,处理限时活动中领到干员/皮肤
if time() - last_time_tap_return > 5000 then
-- TODO:按返回在获得物资界面没用
tap("返回", true)
last_time_tap_return = time()
end
-- 干员/皮肤界面用返回键没用,这时按基建右上角
end, 30) then stop("214 返回键30秒超时") end
if x then return tap(path.fallback[x]) end
end,
活动公告返回 = function() return path.fallback.签到返回() end,
抽签返回 = function()
for u = scale(300), screen.width - scale(300), 200 do
tap({u, screen.height // 2})
end
tap("确定抽取")
return path.fallback.签到返回()
end,
活动签到返回 = function()
for u = screen.width // 2 + scale(825 - 1920 // 2), screen.width // 2 +
scale(1730 - 1920 // 2), scale(100) do tap({u, scale(500)}) end
for v = screen.height // 2 + scale(180 - 1080 // 2), screen.height // 2 +
scale(950 - 1080 // 2), scale(100) do tap({screen.width // 2, v}) end
return path.fallback.签到返回()
end,
返回确认 = function()
log(191)
leaving_jump = false
if not wait(function()
if not findOne("返回确认") then return true end
if stay_in_dorm_once then
back()
-- 必须等待
if disappear("返回确认", .5) and not appear("进驻总览", 1) then
-- 解决灯泡激活状态的死循环
tap("基建右上角")
end
else
tap("右确认")
end
end, 60) then stop("基建返回提示不消失") end
stay_in_dorm_once = false
if appear("进驻总览", 1) then leaving_jump = true end
end,
返回确认2 = "右确认",
返回确认3 = function()
wait(function()
if findAny({
"面板", "开始唤醒", "bilibili_framelayout_only",
"活动公告返回",
}) then return true end
tap("左取消")
end, 5)
end,
单选确认框 = "右确认",
剿灭说明 = function()
tap("基建右上角")
-- if not wait(function()
-- if findOne("主页") then return true end
-- tap("基建右上角")
-- end, 5) then stop(208) end
end,
行动结束 = function()
tap("行动结束")
-- if not wait(function()
-- if findOne("开始行动") and findOne("代理指挥开") then
-- return true
-- end
-- findTap("行动结束")
-- end, 10) then stop(217) end
end,
限时幸运签 = function()
tapAll(point.限时幸运签列表)
ssleep(.25)
tap("限时幸运签抽取")
disappear("限时幸运签", 10)
return path.fallback.签到返回()
end,
限时开放许可 = function()
wait(function() tap("开始作业") end, 1)
wait(function()
if findOne("面板") then return true end
tap("开包skip")
end, 10)
-- disappear("面板", 1)
end,
感谢庆典返回 = function()
wait(function() tap("感谢典点击领取") end, 1)
wait(function()
if findOne("面板") then return true end
tap("开包skip")
end, 10)
-- disappear("面板", 1)
end,
返回 = function()
-- 基建内返回太快会卡
local x = appear({
"返回确认", "返回确认2", "返回确认3", "活动公告返回",
"签到返回", "签到返回黄", "活动签到返回", "抽签返回",
"战略返回", '感谢庆典返回', '限时开放许可',
"限时幸运签",
}, .1)
log(251, x)
if x then return tap(path.fallback[x]) end
-- back()
tap("返回")
end,
返回3 = function()
-- 只有邮件与设置界面有白色返回
tap("返回3")
-- disappear("返回3", .5)
end,
}
path.限时活动 = function(retry)
-- 只包含主页红点
retry = retry or 0
if retry > 5 then return end
path.跳转("首页")
local p = findAny({
"面板限时活动", "面板限时活动2", "面板限时活动3",
})
if p then
tap(p)
appear({
'活动签到返回', '抽签返回', '感谢庆典返回',
'限时开放许可', "限时幸运签",
})
elseif findOne("面板赠送一次") then
tap("面板干员寻访")
if not appear("赠送一次") then return end
ssleep(.5)
if not wait(function()
if not findOne("赠送一次") then return true end
tap("寻访一次")
disappear("赠送一次", 1)
end, 10) then return end
if not appear("返回确认界面") then return end
if not wait(function()
if not findOne("返回确认界面") then return true end
tap("右右确认")
end, 2) then return end
local last_time_see_home = time()
if not wait(function()
if findOne("主页") then last_time_see_home = time() end
if time() - last_time_see_home > 1000 then return true end
tap("开包skip")
end, 15) then return end
-- appear("主页", 2)
-- disappear("主页", 10)
if not wait(function()
if findOne("主页") then return true end
tap("开包skip")
end, 15) then return end
end
path.跳转("首页")
-- 需要点时间才能找到 面板限时活动2 与 单抽
if not wait(function()
if not findOne("面板") then return true end
if findAny({
"面板限时活动", "面板限时活动2", "面板限时活动3",
"面板赠送一次",
}) then return true end
end, 1) then return end
return path.限时活动(retry + 1)
end
path.邮件收取 = function()
path.跳转("邮件")
local state = sample("邮件提示")
if not wait(function()
if not findOne(state) then return true end
tap("收取所有邮件")
end, 10) then return end
-- 卡在邮件的获取
local start_time = time()
wait(function()
local timeout = min(2, (time() - start_time) / 1000 * 2 / 10)
-- local timeout = 0
if appear({
"开始唤醒", "账号登录", "返回确认3",
"bilibili_framelayout_only",
}, timeout) then return true end
back()
end, 30)
end
path.基建收获 = function()
-- jump with zoom too
path.跳转("基建")
local x
local max_retry = 5
for i = 1, max_retry do
x = appear({
"正在提交反馈至神经", "基建灯泡蓝", "基建灯泡蓝2",
"基建收获线索提示",
}, 3)
-- 没看到灯泡或线索提示
if not x then
log(448)
leaving_jump = true
return
end
if table.includes({
"基建收获线索提示", "正在提交反馈至神经",
}, x) then
disappear(x, 5)
if i >= max_retry then
log('unknown 140')
return
end
else
break
end
end
log(130)
wait(function()
if not findOne("进驻总览") then return true end
tap("点击全部收取2")
ssleep(.1)
tap(x)
ssleep(.1)
end, 10)
log(131)
wait(function()
log(132)
if findAny({"小蓝圈", "进驻总览"}) then return true end
log(133)
tap("点击全部收取2")
end, 10)
log(findAny({"小蓝圈", "进驻总览"}))
log(134)
-- 回到进驻总览
if not wait(function()
if findOne("进驻总览") then return true end
tap("基建右上角")
end, 5) then return end
leaving_jump = true
end
-- 跳转至由面板可到达的界面
-- 注意 从好友 以及 到采购中心的跳转
-- TODO 从好友跳转失败时有5秒等待
path.跳转 = function(x, disable_quick_jump, disable_postprocess)
local sign = {
好友 = "个人名片",
基建 = "进驻总览",
公开招募 = function()
return findOne("公开招募") and findOne("公开招募箭头")
end,
首页 = "面板",
干员 = "干员界面",
采购中心 = "可露希尔推荐",
任务 = "任务第一个",
终端 = "主页",
邮件 = function() return findOne("邮件信封") and findOne("返回3") end,
}
local plain = {
邮件 = "面板邮件",
好友 = "面板好友",
干员 = "面板干员",
基建 = "面板基建",
公开招募 = "面板公开招募",
首页 = nil,
采购中心 = "面板采购中心",
任务 = "面板任务",
终端 = "面板作战",
}
local timeout = 20
local target = sign[x]
local home_target = x == "邮件" and "首页" or x
-- direct quit
if findOne(target) then
log("before zoom", x)
if x == "基建" and not disable_postprocess then zoom() end
prev_jump = x
repeat_fight_mode = false
leaving_jump = false
return true
end
log(218)
local bypass = function(t)
log("bypass 基建返回确认", prev_jump)
if prev_jump == "基建" and appear({"返回确认", t}) == "返回确认" then
if not wait(function()
if not findOne("返回确认") then return true end
tap("右确认")
end, 5) then return end
end
log("bypass 基建返回确认", "end")
return true
end
local p
p = update(path.base, {
面板 = function()
p["主页"] = nil
tap(plain[x])
log(208)
appear({
target, "活动公告返回", "签到返回", "签到返回黄",
"活动签到返回", "抽签返回", "单选确认框", "返回3",
}, timeout)
log(209)
end,
主页 = function()
if not wait(function()
local y = findAny({"主页"})
tap(y)
-- TODO we can make this faster, gain .5s mostly
-- jump from 宿舍 to others
-- TODO .5 => .1 failed
if not y or disappear(y, .5) then
-- not y 表示 当前主页列表正在展开、收缩或停止,这时
if table.includes({"任务", "好友", "首页"}, home_target) then
ssleep(.2)
end
-- 一直按直到出现新状态
tap("主页列表" .. home_target)
tap("主页列表" .. home_target)
wait(function()
if not findAny({"返回", "返回2"}) or
findAny({"主页", "返回确认", "返回确认2"}) then
return true
end
tap("主页列表" .. home_target)
end, .5)
return true
end
end, 5) then return end
if not bypass(sign[home_target]) then return end
log('wait appear', sign[home_target], timeout)
local first_time_see_home
if not wait(function()
if findOne(sign[home_target]) then
p["主页"] = nil
return true
end
if findOne("返回") then
-- log(458)
if not first_time_see_home then
first_time_see_home = time()
elseif (time() - first_time_see_home) > 1000 then
p["主页"] = nil
return true -- we see 返回 for some time, but target still not appear
end
else
first_time_see_home = nil
end
end, timeout) then
p["主页"] = nil
return
end
end,
})
if x == prev_jump and x ~= "首页" or disable_quick_jump then p.主页 = nil end
p[target] = function()
if prev_jump == "基建" and x == "基建" and not leaving_jump then
tap('返回')
disappear(target)
return
end
-- leaving_jump is true means we don't need to wait 1 seconds to ensure current state is 进驻总览
-- leaving_jump will be true if the previous state is 返回确认, and we slow tap 返回 (0.5s interval)
-- leaving_jump will be also true if previous job confirm it
log("leaving_jump", leaving_jump)
local t = very_slow_state_check and 10 or 1
if not disappear(target, (prev_jump == "基建" and x == "基建" and
not leaving_jump) and t or 0) then
leaving_jump = false
log("found", target)
return true
end
end
stay_in_dorm_once = x == "基建"
auto(p, path.fallback)
-- post processing especially for 基建
if x == "基建" and not disable_postprocess then zoom() end
prev_jump = x
-- disable repeat fight after any jump complete
repeat_fight_mode = false
end
start_time = parse_time("202101010400")
-- 对于不同用户的首次任务
init_state = function()
-- 启用重复刷模式
repeat_fight_mode = true
fight_tick = 0
no_success_one_loop = 0
prev_jump = "基建"
update_state_last_day = 0
update_state_last_week = 0
communication_enough = false
jmfight_enough = false
zero_san = false
first_time_swipe = true
end
-- 对于单个用户的不同任务
update_state = function()
cur_fight = ''
fight_failed_times = {}
zero_san = false
login_error_times = 0
login_times = 0
local day = (parse_time() - start_time) // (24 * 3600)
if day == update_state_last_day then return end
communication_enough = false
update_open_time()
local week = (parse_time() - start_time) // (7 * 24 * 3600)
if week == update_state_last_week then return end
jmfight_enough = false
end
path.副手换人 = function()
-- toast("副手换人还没修,等5秒提示消失")
-- ssleep(5)
-- if 1 then return end
path.跳转("基建")
if not wait(function()
if not findOne("进驻总览") or not findOne("缩放结束") then
return true
end
tap("控制中枢")
end, 5) then return end
if not appear({"进驻信息", "进驻信息选中"}) then return end
if not wait(function()
if not findAny({"进驻信息", "进驻信息选中"}) then return true end
tap("基建副手")
end, 5) then return end
for i = 1, 5 do
if not wait(function()
tap("基建副手列表" .. i)
if findOne("副手确认蓝") then return true end
end, 5) then return end
if not wait(function()
tap("干员选择列表7")
if appear("副手第七干员选中", 1) then return true end
end, 5) then return end
if not wait(function()
if not findOne("副手确认蓝") and findOne("基建副手简报") then
return true
end
tap("副手确认蓝")
end, 5) then return end
if not wait(function()
tap("基建副手列表" .. i)
if findOne("副手确认蓝") then return true end
end, 5) then return end
if not wait(function()
tap("干员选择列表7")
if appear("副手第七干员选中", 1) then return true end
end, 5) then return end
if not wait(function()
tap("干员选择列表" .. (i + 1))
if disappear("副手第七干员选中", 1) then return true end
end, 5) then return end
if not wait(function()
if not findOne("副手确认蓝") and findOne("基建副手简报") then
return true
end
tap("副手确认蓝")
end, 5) then return end
end
end
sample = function(v)
local ans = ''
for _, p in pairs(point[v .. "采样列表"]) do
p = point[p]
ans = ans .. p[1] .. coord_delimeter .. p[2] .. coord_delimeter ..
getColor(p[1], p[2]) .. point_delimeter
end
point.sample = ans:sub(1, #ans - #point_delimeter)
rfl.sample = point2region(point.sample)
first_point.sample = {rfl.sample[1], rfl.sample[2]}
return "sample"
end
path.宿舍换班 = function()
local f
f = function(i)
path.跳转("基建")
if not wait(function()
if not findOne("进驻总览") or not findOne("缩放结束") then
return true
end
tap("宿舍列表" .. i)
end) then return end
if not appear({"进驻信息", "进驻信息选中"}, 5) then
log("621")
return
end
if not wait(function()
if findOne("筛选") then return true end
if findOne("进驻信息选中") then
wait(function()
if findOne("筛选") then return true end
tap("进驻第一人")
end, 1)
elseif findOne("进驻信息") then
tap("进驻信息")
ssleep(.2)
wait(function()
if findOne("筛选") then return true end
tap("进驻第一人")
end, 1)
end
end, 5) then return end
tap("清空选择")
if not wait(function()
if findOne("干员未选中") and findOne("第一干员未选中") then
return true
end
tap("清空选择")
end, 5) then return end
local operator
if shift_prefer_speed ~= 1 then
-- 选后5个
operator = map(function(x) return "干员选择列表" .. x end,
range(6, 10))
else
-- 根据心情阈值选择
operator = {}
discover(operator, {}, 1, true)
log(818, operator, shift_min_mood)
operator = table.filter(operator,
function(x) return x[3] < shift_min_mood end)
-- log(819,operator)
operator = map(function(x) return x[4] end, operator)
operator = table.slice(operator, 1, 5)
-- operator = table.slice(table.extend(operator, map(
-- function(x)
-- return "干员选择列表" .. x
-- end, range(1, 5))), 1, 5)
log(820, operator)
end
if #operator > 0 and not wait(function()
if not findOne("干员未选中") then return true end
-- 慢机仍会漏换, miui13也是
ssleep(0.25)
tapAll(operator)
disappear("干员未选中", 2)
end, 5) then return end
log(842, #operator)
-- 把未进驻的非满心情干员放进去
if #operator < 5 then
-- 进入筛选界面
if not wait(function()
if findOne("筛选取消") then return true end
tap("筛选")
end, 5) then return end
if not appear({"筛选未进驻选中", "筛选未进驻"}) then
return
end
if not findOne("筛选未进驻选中") then
if not wait(function()
if findOne("筛选未进驻选中") then return true end
tap("筛选未进驻选中")
appear("筛选未进驻选中", .5)
end, 5) then return end
end
if not wait(function()
if not findOne("筛选取消") then return true end
tap("筛选确认")
end, 5) then return end
if not wait(function()
if findOne("干员未选中") and findOne("第一干员未选中") then
return true
end
tap("清空选择")
end, 5) then return end
-- 选择后续干员
operator = map(function(x) return "干员选择列表" .. x end,
range(1, 5))
ssleep(0.25)
tapAll(operator)
-- 进入筛选界面
if not wait(function()
if findOne("筛选取消") then return true end
tap("筛选")
end, 5) then return end
if not appear({"筛选未进驻选中", "筛选未进驻"}) then
return
end
if not findOne("筛选未进驻") then
if not wait(function()
if findOne("筛选未进驻") then return true end
tap("筛选未进驻")
appear("筛选未进驻", .5)
end, 5) then return end
end
if not wait(function()
if not findOne("筛选取消") then return true end
tap("筛选确认")
end, 5) then return end
end
if not wait(function()
if findAny({
"隐藏", "进驻信息", "进驻信息选中",
-- "正在提交反馈至神经",