-
Notifications
You must be signed in to change notification settings - Fork 42
/
exUtils.lua
1957 lines (1762 loc) · 67.3 KB
/
exUtils.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
-- ===========================================
-- 额外工具类函数
-- 请所有贡献者在此处添加额外需要的函数
--
-- 函数命名规范推荐
-- 1. 工具 --> 小驼峰
-- 2. 类path函数 --> 下划线
-- 3. 禁止重载utils.lua中已有的函数,避免污染
--
-- 函数注解
-- 请在函数上方添加注解,尽可能的说明函数用途
-- ===========================================
-- 以字符串格式找色
findOneStr = function(x, confidence)
-- 每5秒确认游戏在前台
-- if (time() - findOne_game_up_check_last_time > 5000) then
-- findOne_game_up_check_last_time = time()
-- wait_game_up()
-- end
confidence = confidence or default_findcolor_confidence
if type(x) == "string" then
-- 控制截图频率
local current = time()
if findOne_interval > 0 and current - findOne_last_time > findOne_interval then
findOne_last_time = time()
keepCapture()
end
local pos
if cmpColorEx(x, confidence) == 1 then
pos = { str2int(x:match("^(%d+)|"), 0), str2int(x:match("^%d+|(%d+)|"), 0) }
end
return pos
end
end
-- 单点找色
checkPointColor = function(pInfo, confidence)
-- 每5秒确认游戏在前台
-- if (time() - findOne_game_up_check_last_time > 5000) then
-- findOne_game_up_check_last_time = time()
-- wait_game_up()
-- end
confidence = confidence or default_findcolor_confidence
-- 控制截图频率
local current = time()
if findOne_interval > 0 and current - findOne_last_time > findOne_interval then
findOne_last_time = time()
keepCapture()
end
if type(pInfo) == "table" then
colorStr = pInfo[1] .. "|" .. pInfo[2] .. "|" .. pInfo[3]
elseif type(pInfo) == "string" then
colorStr = pInfo
end
-- 比色
if cmpColorEx(colorStr, confidence) == 1 then
return true
else
return false
end
end
-- 等待单点颜色出现
waitUntilFindColor = function(pInfo, time)
local time = time or 5
return wait(function()
if checkPointColor(pInfo) then
return true
end
end, time)
end
-- 持续点击直到找到指定颜色
tapUntilCheckedPointColor = function(pTap, pInfo, msg, sleep, time)
log(msg)
local sleep = sleep or 0
local time = time or 5
if wait(function()
if checkPointColor(pInfo) then
log(msg, "成功")
return true
end
tap({ pTap[1], pTap[2] })
ssleep(sleep)
end, time) then
return true
else
log("持续点击直到找到指定颜色失败")
return false
end
end
doIfCheckedColor = function(pInfo, func, time)
time = time or 15
if checkPointColor(pInfo) then
wait(function()
return func()
end, time)
end
end
tapIfCheckedColor = function(pTap, pInfo)
doIfCheckedColor(pInfo,
function()
tap({ pTap[1], pTap[2] })
return true
end)
end
-- 新deploy3 原deploy3有计算bug
-- src: 从右数第几个干员
-- dst: 目标位置,格式{x,y,direction} direction: 上1 右2 下3 左4
-- total: 当前有几个干员,不同干员数影响干员位置
nDeploy3 = function(src, dst, total)
total = total or 1
local max_op_width = scale(178) -- in loose mode, each operator's width
local x1
if total * max_op_width > screen.width then
-- tight
max_op_width = screen.width // total
x1 = src * max_op_width - max_op_width // 2
else
-- loose
-- x1 = screen.width - (total - src) * max_op_width - max_op_width // 2
x1 = screen.width - src * max_op_width + max_op_width // 2
end
deploy(x1, dst[1], dst[2], dst[3])
end
-- 合并至主分支后已弃用
-- show_extra_ui = function()
-- local layout = "extra"
-- saveConfig('last_layout', layout)
-- ui.newLayout(layout, ui_page_width, -2)
-- make_ui_title(layout, "其他功能")
-- newRow(layout)
-- addButton(layout, nil, "返回", make_jump_ui_command(layout, "main"), nil,
-- nil)
-- -- ui.addButton(layout, layout .. "_stop", "返回")
-- -- ui.setBackground(layout .. "_stop", ui_cancel_color)
-- -- ui.setOnClick(layout .. "_stop", make_jump_ui_command(layout, "main"))
-- -- make_continue_extra_ui(layout)
-- -- {nil, "退出", make_jump_ui_command(layout, nil, "peaceExit()")}, {
-- -- readme_btn, "必读", make_jump_ui_command(layout, nil,
-- -- "saveConfig('readme_already_read','1');jump_readme()"),
-- -- }, {nil, "高级设置", make_jump_ui_command(layout, "debug")},
-- newRow(layout)
-- addTextView(layout, [[以下功能将沿用脚本主页设置]])
-- newRow(layout)
-- addButton(layout, nil, "傀影与猩红孤钻",
-- make_jump_ui_command(layout, nil,
-- "extra_mode='傀影与猩红孤钻自动上号';lock:remove(main_ui_lock)"))
-- addButton(layout, nil, "水月与深蓝之树",
-- make_jump_ui_command(layout, nil,
-- "extra_mode='水月与深蓝之树自动上号';lock:remove(main_ui_lock)"))
-- addButton(layout, nil, "生息演算",
-- make_jump_ui_command(layout, nil,
-- "extra_mode='生息演算沙中之火自动上号';lock:remove(main_ui_lock)"))
-- newRow(layout)
-- addTextView(layout, [[账号]])
-- ui.addEditText(layout, "rogue_account", [[]])
-- addTextView(layout, [[ 密码]])
-- ui.addEditText(layout, "rogue_password", [[]])
-- ui.addCheckBox(layout, "rogue_server", "是B服", false)
-- newRow(layout)
-- addTextView(layout, [[选第]])
-- ui.addEditText(layout, "zl_best_operator", [[-1]])
-- addTextView(layout, [[个近卫 开]])
-- ui.addEditText(layout, "zl_skill_times", [[0]])
-- addTextView(layout, [[次]])
-- ui.addEditText(layout, "zl_skill_idx", [[1]])
-- addTextView(layout, [[技能]])
-- newRow(layout)
-- ui.addCheckBox(layout, "zl_more_repertoire", "多点剧目", false)
-- ui.addCheckBox(layout, "zl_more_experience", "升级等级", true)
-- ui.addCheckBox(layout, "zl_skip_coin", "跳过投币", false)
-- newRow(layout)
-- ui.addCheckBox(layout, "zl_accept_mg", "可打敏感", false)
-- ui.addCheckBox(layout, "zl_accept_yx", "可打臆想", false)
-- ui.addCheckBox(layout, "zl_accept_sc", "可打生存", false)
-- newRow(layout)
-- ui.addCheckBox(layout, "zl_skip_hard", "不打驯兽", false)
-- ui.addCheckBox(layout, "zl_no_waste", "每8小时做日常", true)
-- -- ui.addSpinner(layout, "zl_hard_level", {"观光", "正式"}, 0)
-- newRow(layout)
-- addTextView(layout, [[需求商品]])
-- ui.addEditText(layout, "zl_need_goods", [[]])
-- addTextView(layout, [[等级]])
-- ui.addEditText(layout, "zl_max_level", [[]])
-- addTextView(layout, [[源石锭]])
-- ui.addEditText(layout, "zl_max_coin", [[]])
-- -- ui.addCheckBox(layout, "zl_disable_game_up_check", "禁用前台检查", false)
-- -- newRow(layout)
-- -- addTextView(layout, [[重启间隔(秒)]])
-- -- ui.addEditText(layout, "zl_restart_interval", [[]])
-- -- newRow(layout)
-- -- addTextView(layout,
-- -- [[用于刷源石锭投资、等级(蜡烛)、藏品、剧目等。应选择常见5、6星近卫,临光1、煌2、山2、羽毛笔1、帕拉斯1、赫拉格2、史尔特尔2、银灰1、幽灵鲨1、拉狗2,更多干员测试见群精华消息。]] ..
-- -- [[刷源石锭应选“观光难度”,不勾“多点蜡烛”、“跳过投币”]]
-- -- [[支持凌晨4点数据更新、支持掉线抢登情况、支持每8小时做日常。支持16:9及以上分辨率,但建议16:9,否则可能选不到后勤队。]] ..
-- -- [[游戏本体存在内存泄漏,因此会抽空重启。如果1小时内就出现脚本停止运行、随机界面卡住、悬浮按钮消失,应把“高级设置”中两个3600重启间隔调小(如900)。]] ..
-- -- [[999源石锭刷取耗时与难度、幕后筹备无关,与是否通关三结局、网络延迟有关,双结局耗时10时14分(97个/时),三结局耗时8时10分(122个/时),低网络延迟+三结局耗时7时21分(135个/时)。]] ..
-- -- [[如需刷等级(蜡烛),应选普通难度,勾“多点蜡烛”与“跳过投币”。]] ..
-- -- [[商品需求可填商品名称关键字,用空格隔开(如填“玩 金 骑士”),则刷到其中任一商品就会停止并通知QQ]])
-- --
-- -- ui.(layout, layout .. "_invest", "集成战略前瞻性投资")
-- -- ui.setOnClick(layout .. "_invest", make_jump_ui_command(layout, nil,
-- -- "extra_mode='前瞻投资';lock:remove(main_ui_lock)"))
-- newRow(layout)
-- addButton(layout, layout .. "_recruit", "公开招募加急",
-- make_jump_ui_command(layout, nil,
-- "extra_mode='公开招募加急';lock:remove(main_ui_lock)"))
-- addTextView(layout, [[保留标签]])
-- ui.addEditText(layout, layout .. "_recruit_important_tag", [[]])
-- -- newRow(layout)
-- -- addTextView(layout,
-- -- [[用于刷黄绿票,或刷出指定标签。使用加急券在第一个公招位反复执行“公开招募”任务,沿用脚本主页的“自动招募”设置。“自动招募”只勾“其他”时,刷出保底标签就停;只勾“其他”、“4”时,刷出保底小车、保底5星、资深就停;其余同理。如果想刷到指定标签就停,则“保留标签”填期望标签(例如填“削弱 快速复活”)。]])
-- -- newRow(layout)
-- -- addButton(layout, layout .. "_hd2_shop", "遗尘漫步任务与商店",
-- -- make_jump_ui_command(layout, nil,
-- -- "extra_mode='活动任务与商店';lock:remove(main_ui_lock)"))
-- --
-- -- addButton(layout, layout .. "_hd2_shop_multi",
-- -- "遗尘漫步任务与商店多号",
-- -- make_jump_ui_command(layout, nil,
-- -- "extra_mode='活动任务与商店';extra_mode_multi=true;lock:remove(main_ui_lock)"))
-- -- newRow(layout)
-- -- addButton(layout, layout .. "_hd3_shop", "吾导先路任务与商店",
-- -- make_jump_ui_command(layout, nil,
-- -- "extra_mode='活动2任务与商店';lock:remove(main_ui_lock)"))
-- --
-- -- addButton(layout, layout .. "_hd3_shop_multi",
-- -- "吾导先路任务与商店多号",
-- -- make_jump_ui_command(layout, nil,
-- -- "extra_mode='活动2任务与商店';extra_mode_multi=true;lock:remove(main_ui_lock)"))
-- -- newRow(layout)
-- -- addButton(layout, layout .. "_speedrun", "每日任务速通(待修)",
-- -- make_jump_ui_command(layout, nil,
-- -- "extra_mode='每日任务速通';lock:remove(main_ui_lock)"))
-- -- ui.setOnClick(layout .. "_speedrun", )
-- -- addButton(layout, layout .. "jump_qq_btn", "需加机器人好友",
-- -- make_jump_ui_command(layout, nil, 'jump_qq()'))
-- -- newRow(layout)
-- -- ui.addButton(layout, layout .. "_speedrun", "每日任务速通(别用)")
-- -- ui.setOnClick(layout .. "_speedrun", make_jump_ui_command(layout, nil,
-- -- "extra_mode='每日任务速通';lock:remove(main_ui_lock)"))
-- --
-- -- newRow(layout)
-- -- ui.addButton(layout, layout .. "_1-12", "克洛丝单人1-12(没写)")
-- -- ui.setOnClick(layout .. "_1-12", make_jump_ui_command(layout, nil,
-- -- "extra_mode='克洛丝单人1-12';lock:remove(main_ui_lock)"))
-- ui.loadProfile(getUIConfigPath(layout))
-- ui.show(layout, false)
-- end
-- 水月肉鸽导航
mizuki_navigation = function()
-- 先导航到水月_常规行动
if not findOne("水月_常规行动") then
path.跳转("首页")
tap("面板作战")
if not appear("主页") then return false end
-- if not wait(function()
-- if findOne("主题曲界面") then return true end
-- tap("主题曲")
-- end, 5) then return false end
if not wait(function()
if findOne("傀影") then return true end
tap("集成战略")
end, 5) then
return false
end
if not wait(function()
if checkPointColor(mizuki_point.等待开始页面标题) then
return true
end
tap("进入主题")
end, 5) then
return false
end
end
log("常规行动选中")
return true
end
-- 水月肉鸽助战
mizuki_help_fight = function(reflashNum)
reflashNum = reflashNum or 0
single_man_operation = false
if reflashNum > 3 then
log("助战刷新次数超过3次")
return false
end
-- if not findOne("确认招募") then return end
if not wait(function()
if findOne("战略助战界面") then return true end
tap("战略助战")
end, 5) then
return
end
local operator
if not wait(function()
operator = ocr("战略助战干员范围")
if #operator > 3 then return true end
end, 5) then
stop("找不到助战干员", 'cur')
end
local name2point = table.reduce(operator, function(a, c)
a[c.text] = c
return a
end, {})
local order = {
{ "羽毛笔", 0, 1 },
{ "海沫", 0, 1 },
{ "煌", 0, 2 },
{ "百炼嘉维尔", 99, 2 }
}
local best = table.findv(order, function(x) return name2point[x[1]] end)
if not best then
log("助战也找不到所需干员")
tapUntilCheckedPointColor(mizuki_point.刷新助战, mizuki_point.刷新助战中, 5)
reflashNum = reflashNum + 1
ssleep(3)
return mizuki_help_fight(reflashNum)
end
reflashNum = 0
if best[1] == "羽毛笔" or best[1] == "海沫" then
single_man_operation = true
end
zl_skill_times = best[2]
zl_skill_idx = best[3]
-- log("best", best)
-- if not best then return point.战略助战干员列表1, 0, 1 end
local p = name2point[best[1]]
p = { p.l, p.t }
tap(p)
disappear("战略助战界面", 5)
return wait(function()
if checkPointColor(mizuki_point.初始招募进度条) then
log("助战选择完成")
return true
end
tap("开包skip")
tap("战略助战确认")
-- 需要等待ui加载
ssleep(0.5)
end, 5)
end
-- 水月肉鸽重启
mizuki_restart = function(msg)
toast(msg)
mizuki_fight_time = mizuki_fight_time + 1
-- if not restart_game_check(zl_restart_interval) then
if not request_memory_clean() then
path.水月与深蓝之树前瞻投资()
else
path.跳转("首页")
end
end
-- 水月肉鸽认知塑造
mizuki_cognition = function()
mizuki_fight_time = 0
local f = function()
local pos_cognition = mizuki_point.认知塑造界面[1] .. "|" ..
mizuki_point.认知塑造界面[2] .. "|" ..
mizuki_point.认知塑造界面[3]
-- 进入认知塑造
log("进入认知塑造")
if not wait(function()
tap({ mizuki_point.认知塑造[1], mizuki_point.认知塑造[2] })
sleep(100)
if findOneStr(pos_cognition) then return true end
end, 5) then
return
end
sleep(100)
-- 缩放
log("缩放")
local finger = {
{
point = { { 0, 0 }, { screen.width // 2, screen.height // 2 } },
duration = duration,
}, {
point = {
{ screen.width, screen.height },
{ screen.width // 2, screen.height // 2 },
},
duration = duration,
},
}
gesture(finger)
sleep(300)
-- 创建坐标
local pos_up = mizuki_point.认知塑造节点升级[1] .. "|" ..
mizuki_point.认知塑造节点升级[2] .. "|" ..
mizuki_point.认知塑造节点升级[3]
local pos_uped = mizuki_point.认知塑造节点已升级[1] .. "|" ..
mizuki_point.认知塑造节点已升级[2] .. "|" ..
mizuki_point.认知塑造节点已升级[3]
local pos_lock = mizuki_point.认知塑造节点未解锁[1] .. "|" ..
mizuki_point.认知塑造节点未解锁[2] .. "|" ..
mizuki_point.认知塑造节点未解锁[3]
-- 确认是否已满
log("确认是否已满")
tap(mizuki_point.认知塑造节点列表[#mizuki_point.认知塑造节点列表])
ssleep(1)
if findOneStr(pos_uped) then
log("认知塑造已满")
lighter_enough = true
return true
end
-- 升级
log("升级")
for i = 1, #mizuki_point.认知塑造节点列表 do
local flag = false
if not wait(function()
tap(mizuki_point.认知塑造节点列表[i])
sleep(100)
if findOneStr(pos_lock) then
flag = true
return true
end
if findOneStr(pos_up) then
tap({
mizuki_point.认知塑造节点升级[1],
mizuki_point.认知塑造节点升级[2],
})
end
if findOneStr(pos_uped) then return true end
end, 3) then
break
end
if flag then break end
end
end
f()
return true
end
-- 水月肉鸽作战选择器
mizuki_fight_select = function()
local select_fight = nil
if not wait(function()
setDict(0, "水月.txt") -- 字库需要放到资源文件中
useDict(0)
if not wait(function()
-- 战斗
select_fight = matrixOcr(mizuki_point.水月关卡标题坐标1[1],
mizuki_point.水月关卡标题坐标1[2],
mizuki_point.水月关卡标题坐标1[3],
mizuki_point.水月关卡标题坐标1[4],
"FFFFFF", 0.90)
if select_fight ~= nil then
log(select_fight)
return true
end
-- 不期而遇/地区委托/诡异行商
select_fight = matrixOcr(mizuki_point.水月关卡标题坐标2[1],
mizuki_point.水月关卡标题坐标2[2],
mizuki_point.水月关卡标题坐标2[3],
mizuki_point.水月关卡标题坐标2[4],
"FFFFFF", 0.90)
if select_fight ~= nil then
log(select_fight)
return true
end
-- 紧急战斗识别区域
select_fight = matrixOcr(mizuki_point.水月关卡标题坐标3[1],
mizuki_point.水月关卡标题坐标3[2],
mizuki_point.水月关卡标题坐标3[3],
mizuki_point.水月关卡标题坐标3[4],
"FFFFFF", 0.90)
if select_fight ~= nil then
log(select_fight)
return true
end
end, 5) then
log("关卡识别错误")
return mizuki_restart("关卡识别错误")
end
if #select_fight > 1 then
if select_fight:includes({ "排", "反", "应" }) then
select_fight = "排异反应"
elseif select_fight:includes({ "启", "示" }) then
select_fight = "启示"
elseif select_fight:includes({ "大", "的", "呼", "唤" }) then
select_fight = "大群的呼唤"
elseif select_fight:includes({ "掷", "出", "骰", "子" }) then
select_fight = "掷出骰子"
elseif select_fight:includes({ "虫", "群", "横" }) then
select_fight = "虫群横行"
-- 蓄水池
elseif select_fight:includes({ "蓄", "水", "池" }) then
select_fight = "蓄水池"
-- 共生
elseif select_fight:includes({ "共", "生" }) then
select_fight = "共生"
elseif select_fight:includes({ "互", "助" }) then
select_fight = "互助"
elseif select_fight:includes({ "射", "手", "部", "队" }) then
select_fight = "射手部队"
-- 不期而遇
elseif select_fight:includes({ "不", "期", "而", "遇" }) then
select_fight = "不期而遇"
-- 地区委托
elseif select_fight:includes({ "地", "区", "委", "托" }) then
select_fight = "地区委托"
-- 诡异行商
elseif select_fight:includes({ "诡", "异", "行", "商" }) then
select_fight = "诡异行商"
-- 得偿所愿
elseif select_fight:includes({ "得", "偿", "所", "愿" }) then
select_fight = "得偿所愿"
-- 兴致盎然
elseif select_fight:includes({ "兴", "致", "盎", "然" }) then
select_fight = "兴致盎然"
else
log("不知道什么作战:" .. select_fight)
return
end
log("作战: " .. select_fight)
return true
end
end, 5) then
stop("不知道第一个作战是什么", 'cur')
return
end
return select_fight
end
-- 水月肉鸽干员放置
mizuki_deploy = function(deploy_table)
for i = 1, #deploy_table, 1 do
if not wait(function()
if findOne("干员费用够列表1") then return true end
if not findOne("生命值") then
log("没找到生命值,继续等待")
end
end, 30) then
return false
end
wait(function()
tap("水月_干员费用够列表1")
disappear("水月_干员费用够列表1", 0.5)
nDeploy3(1, deploy_table[i], 4 - i)
wait(function()
if findOne("生命值") then return true end
tap("开始行动1")
end)
if not appear("水月_干员费用够列表" .. 4 - i, 5) then return true end
end, 20)
if single_man_operation then break end
end
end
-- 水月肉鸽重新校准路径
mizuki_repos_path = function()
findTap("战略返回")
local tgha_pos = mizuki_point.天光海岸[1] .. "|" ..
mizuki_point.天光海岸[2] .. "|" ..
mizuki_point.天光海岸[3]
log("tgha_pos: ", tgha_pos)
if not wait(function()
if checkPointColor(mizuki_point.等待开始页面标题) then
log("找到等待开始页面标题")
return true
end
end, 5) then
mizuki_restart("超时未找到等待开始页面标题")
end
wait(function()
tap(mizuki_point.继续探索)
if findOneStr(tgha_pos) then
log("重置成功")
return true
end
end, 5)
end
-- 水月肉鸽路径选择器
mizuki_path_selecter = function()
local path_count = 0
wait(function()
local current = time()
if findOne_interval > 0 and current - findOne_last_time > findOne_interval then
findOne_last_time = time()
-- log(500)
-- releaseCapture()
keepCapture()
end
-- 检查此次分支关卡数量
for i = 1, 5 do
local path_pos = mizuki_point.水月关卡坐标[i][1] .. "|" ..
mizuki_point.水月关卡坐标[i][2]
-- log("正在检测第" .. i .. "个路径")
-- log("path_pos: ", path_pos)
-- 关卡等级判断
for k, t in ipairs({ "846BDE", "AC4F79", "131314", "17C7C8", "199B81" }) do
local path_pos_color = path_pos .. "|" .. t
local res = cmpColorEx(path_pos_color, 0.95)
if res == 1 then
-- log("path_pos_color: ", path_pos_color)
if i < 4 then
path_count = 4 - i
return true
elseif i == 4 then
path_count = 2
return true
elseif i == 5 then
path_count = 1
return true
end
end
end
end
end, 5)
log("当前分支数量 ", path_count)
if path_count == 0 then
log("没有找到路径")
mizuki_repos_path()
return mizuki_path_selecter()
end
return path_count
end
-- 水月肉鸽关卡类型判断器
mizuki_level_type = function(count)
local res = {}
local level = {}
local currentDetectionTypeColor = nil
-- 关卡坐标
if count == 3 then
level = {
mizuki_point.水月关卡坐标[1], mizuki_point.水月关卡坐标[3],
mizuki_point.水月关卡坐标[5],
}
elseif count == 2 then
level = {
mizuki_point.水月关卡坐标[2], mizuki_point.水月关卡坐标[4],
}
elseif count == 1 then
level = { mizuki_point.水月关卡坐标[3] }
end
-- 关卡类型
count = math.tointeger(count)
for i = 1, count do
-- log("第".. i .."个关卡类型判断")
wait(function()
for t, v in ipairs({
"关卡等级_不期而遇", "关卡等级_普通",
"关卡等级_行商", "关卡等级_紧急", "关卡等级_未选择",
}) do
currentDetectionTypeColor = mizuki_point[v]
local pos = level[i][1] .. "|" .. level[i][2] .. "|" ..
currentDetectionTypeColor
local ans = cmpColorEx(pos, 0.95)
if ans == 1 then
res[i] = { level = t, pos = level[i] }
-- x偏移77 y偏移-114
local pos_key = level[i][1] + mizuki_point.偏移[1] .. "|" ..
level[i][2] - mizuki_point.偏移[2] .. "|FFFFFFF"
local ans_key = cmpColorEx(pos_key, 0.8)
if ans_key == 1 then
res[i]["key"] = true
log("第" .. i .. "个 " .. v .. " 有钥匙")
else
res[i]["key"] = false
log("第" .. i .. "个 " .. v)
end
return true
end
end
end, 3)
end
-- log(res)
return res
end
-- 水月肉鸽关卡判决器
mizuki_level_selecter = function(input_info)
local info = input_info
-- log("关卡判决器",info)
if info == nil then
log("关卡判决器未传入参数")
return false
end
-- 选择排序 info
for i = 1, #info do
local min = i
for j = i + 1, #info do
if info[j].level < info[min].level then min = j end
end
info[i], info[min] = info[min], info[i]
end
for i = 1, #info do
if info[i].key then info[i], info[#info] = info[#info], info[i] end
end
-- 非单人作战的情况下尝试打紧急
if not single_man_operation then
-- 排序后检查是否只有紧急
if info[1] ~= nil then
if info[1].level == 4 then
log("只有紧急, 重试")
mizuki_restart("只有紧急, 重试")
return false
end
end
end
-- 检查全是钥匙
local key_count = 0
local flag = false
for k, v in pairs(info) do
if not info[k].key then
if wait(function()
tap(info[k].pos)
if waitUntilFindColor(mizuki_point.选中关卡, 1) then return true end
end, 3) then
log("进入关卡准备界面")
flag = true
break
end
else
key_count = key_count + 1
end
end
if flag then return true end
if key_count == #info then
log("全有钥匙, 重试")
mizuki_restart("全有钥匙, 重试")
return false
end
mizuki_repos_path()
return mizuki_level_selecter(input_info)
end
-- 水月肉鸽骰子处理器(只处理必定出现的情况)
mizuki_dice_solve = function()
ssleep(1)
local pos = mizuki_point.投骰子确认[1] .. "|" ..
mizuki_point.投骰子确认[2] .. "|" ..
mizuki_point.投骰子确认[3]
if not wait(function()
if findOneStr(pos) then
log("点击骰子确认")
tap({ mizuki_point.投骰子确认[1], mizuki_point.投骰子确认[2] })
return true
end
end, 10) then
log("骰子处理器未找到投骰子确认")
return false
end
if not wait(function()
if not findOne("战略帮助") then
log("点击骰子确认 2次确认")
tap({ mizuki_point.投骰子确认[1], mizuki_point.投骰子确认[2] })
else
return true
end
end, 10) then
return false
end
log("骰子处理完成")
return true
end
-- 水月肉鸽不期而遇处理器
mizuki_unexpect_solve = function()
local select_unexpect = nil
local unexpect_tag = mizuki_point.左侧标记[1] .. "|" ..
mizuki_point.左侧标记[2] .. "|" ..
mizuki_point.左侧标记[3]
local unexpect_area = mizuki_point.不期而遇范围
if not wait(function()
-- 进入不期而遇
log("尝试进入不期而遇")
tap(mizuki_point.进入)
if findOneStr(unexpect_tag, 0.9) then
log("已进入不期而遇")
return true
end
end, 5) then
return false
end
if not wait(function()
setDict(0, "水月_不期而遇.txt") -- 字库需要放到资源文件中
useDict(0)
select_unexpect = matrixOcr(unexpect_area[1], unexpect_area[2],
unexpect_area[3], unexpect_area[4],
"008AFF-215682", 0.90)
if select_unexpect ~= nil then
log(select_unexpect)
return true
end
end, 5) then
return false
end
if not wait(function()
if #select_unexpect > 1 then
-- 继承
if select_unexpect:includes({ "继", "承" }) then
select_unexpect = "继承"
-- 噬尘扩散
elseif select_unexpect:includes({ "噬", "尘", "扩", "散" }) then
select_unexpect = "噬尘扩散"
-- 天灾信使
elseif select_unexpect:includes({ "天", "灾", "信", "使" }) then
select_unexpect = "天灾信使"
-- 悬高之葬
elseif select_unexpect:includes({ "悬", "高", "之", "葬" }) then
select_unexpect = "悬高之葬"
-- 阴云如聚
elseif select_unexpect:includes({ "阴", "云", "如", "聚" }) then
select_unexpect = "阴云如聚"
-- 远销海外
elseif select_unexpect:includes({ "远", "销", "海", "外" }) then
select_unexpect = "远销海外"
-- 重返家园
elseif select_unexpect:includes({ "重", "返", "家", "园" }) then
select_unexpect = "重返家园"
-- 狗眼婆娑
elseif select_unexpect:includes({ "狗", "眼", "婆", "娑" }) then
select_unexpect = "狗眼婆娑"
-- 海嗣学者
elseif select_unexpect:includes({ "嗣", "学", "者" }) then
select_unexpect = "海嗣学者"
-- 狂徒妄念
elseif select_unexpect:includes({ "狂", "徒", "妄", "念" }) then
select_unexpect = "狂徒妄念"
-- 开端
elseif select_unexpect:includes({ "开", "端" }) then
select_unexpect = "开端"
else
log("不期而遇识别失败")
return
end
log("不期而遇: " .. select_unexpect)
return true
end
end, 5) then
stop("不知道不期而遇是什么", 'cur')
return false
end
-- local pos = mizuki_point[select_unexpect][1] .."|" .. mizuki_point[select_unexpect][2] .. "|" .. mizuki_point[select_unexpect][3]
local pos_2 = {
mizuki_point[select_unexpect][1], mizuki_point[select_unexpect][2],
}
local dicePos = mizuki_point.投骰子确认[1] .. "|" ..
mizuki_point.投骰子确认[2] .. "|" ..
mizuki_point.投骰子确认[3]
if not wait(function()
if not findOne("战略帮助") then
log("点击选项")
tap(pos_2)
tap(pos_2)
tap(pos_2)
tap(pos_2)
tap(pos_2)
ssleep(0.1)
-- 处理投骰子
if select_unexpect == "重返家园" and findOneStr(dicePos) then return mizuki_dice_solve() end
return false
else
return true
end
end, 5) then
return false
end
log("不期而遇处理完成")
return true
end
-- 水月地区委托处理器
mizuki_entrust_solve = function()
local pos = mizuki_point.左侧清单[1] .. "|" ..
mizuki_point.左侧清单[2] .. "|" ..
mizuki_point.左侧清单[3]
log("尝试进入地区委托")
if not wait(function()
if not findOneStr(pos) then
tap(mizuki_point.进入)
else
return true
end
end, 5) then
return false
end
log("成功进入地区委托")
if not wait(function()
if not findOne("战略帮助") then
tap({ mizuki_point.关闭终端[1], mizuki_point.关闭终端[2] })
ssleep(0.1)
else
return true
end
end, 5) then
return false
end
log("地区委托完成")
return true
end
-- 水月得偿所愿处理器
mizuki_wish_solve = function()
local pos = mizuki_point.左侧标记[1] .. "|" ..
mizuki_point.左侧标记[2] .. "|" ..
mizuki_point.左侧标记[3]
log("尝试进入得偿所愿")
if not wait(function()
if not findOneStr(pos) then
tap(mizuki_point.进入)
else
return true
end
end, 5) then
return false
end
log("成功进入得偿所愿")