Repository navigation
Expand file tree
/
Copy pathinterface.lua
More file actions
2004 lines (1674 loc) · 84.6 KB
/
Copy pathinterface.lua
File metadata and controls
2004 lines (1674 loc) · 84.6 KB
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
-- ===========================================
-- UI相关
-- ===========================================
all_job = {
"邮件收取", "轮次作战", "自动培养",
"访问好友", "基建收获", "基建换班",
"制造加速", "线索交流", "副手换人",
"信用购买", "公开招募", "任务收集",
"限时活动", "商店搬空", "赛季任务",
"森空岛签到",
}
script_layouts = { "multi_account", "gesture_capture", "extra", "debug", "main", "auto", "auto_fight" }
now_job = table.filter(all_job, function(x) return x ~= "副手换人" end)
now_job = table.filter(all_job, function(x) return true end)
multi_account_num = 50
getUIConfigPath = function(layout)
return getWorkPath() .. '/config_' .. layout .. '.json'
end
loadOneUIConfig = function(layout)
local config = getUIConfigPath(layout)
if not fileExist(config) then return {} end
-- log("load", config)
local f = io.open(config, 'r')
local content = f:read() or '{}'
f:close()
local status
status, content = pcall(JsonDecode, content)
if status then return content or {} end
return {}
end
saveOneUIConfig = function(layout, content)
if type(content) == 'table' then content = JsonEncode(content) end
local config = getUIConfigPath(layout)
local f = io.open(config, 'w')
f:write(content or '{}')
f:close()
end
-- 将UI内容转为全局变量
loadUIConfig = function(layouts)
if not layouts then
layouts = script_layouts
end
for _, layout in pairs(layouts) do
assignGlobalVariable(loadOneUIConfig(layout))
end
end
styleButton = function(layout)
ui.setBackground(layout, "#fff1f3f4")
ui.setTextColor(layout, "#ff000000")
end
addButton = function(layout, id, text, func, w, h, bg)
id = id or randomString(32)
ui.addButton(layout, id, text, w or -2, h or -2)
ui.setOnClick(id, func)
if bg then ui.setBackground(id, bg) end
-- styleButton(id)
end
setNewRowGid = function(gid) default_row_gid = gid end
newRow = function(layout, id, align, w, h)
-- log(173,default_row_gid)
id = id or randomString(32)
ui.newRow(layout, id, w or -2, h or -2, default_row_gid)
align = align or 'left'
if align == 'center' then ui.setGravity(id, 17) end
end
addTextView = function(layout, text, id)
ui.addTextView(layout, id or randomString(32), text)
end
---@param png string 不填默认标题png,设置填"setting.png"
---@param noline any 是否不画横线,不填画
---@param alignment any 对齐方式,不填居中,填靠左
addTitle = function(layout, text, png, noline, alignment, id)
local path = "sdcard/pictures/" .. (png or "title.png")
if not fileExist(path) then
extractAssets("main.rc", "mnt/sdcard/Pictures/", png or "title.png")
end
local id = "title" .. (id or text)
newRow(layout)
if not noline then ui.addLine(layout, "line", 750, 1) end
newRow(layout, text)
ui.addImageView(layout, "img" .. id, path, 32, 32)
ui.addTextView(layout, id, text)
ui.setTextSize(id, 18)
ui.setTextColor(id, "#" .. 'ff13227a')
ui.setGravity(text, alignment and 3 or 17) --3靠左,5靠右,17居中
end
addInfo = function(layout, text, png, id)
local path = "sdcard/pictures/info.png"
if not fileExist(path) then
extractAssets("main.rc", "mnt/sdcard/Pictures/", "info.png")
end
local id = "info" .. (id or text)
newRow(layout)
ui.addImageView(layout, "img" .. id, path, 24, 20)
ui.addTextView(layout, id, text)
ui.setTextSize(id, 12)
ui.setTextColor(id, "#" .. 'FF6C6C6C')
end
make_account_ui = function(layout, prefix)
layout = layout or "main"
prefix = prefix or ''
newRow(layout)
addTextView(layout, "作战关卡")
ui.addEditText(layout, prefix .. "fight_ui", [[jm hd ce ls pr ap]])
newRow(layout)
addTextView(layout, "作战吃药")
ui.addEditText(layout, prefix .. 'max_drug_times', "0")
addTextView(layout, "次,吃石头")
ui.addEditText(layout, prefix .. 'max_stone_times', "0")
addTextView(layout, "次")
newRow(layout)
addTextView(layout, "信用多买")
ui.addEditText(layout, prefix .. "high_priority_goods", "聘 土 装置 技")
addTextView(layout, "信用少买")
ui.addEditText(layout, prefix .. "low_priority_goods", "碳 家 急")
-- addTextView(layout, "商店购买黑名单")
-- ui.addEditText(layout, prefix .. "shop_buy_black", "增补条 ")
newRow(layout)
addTextView(layout, "自动招募")
ui.addCheckBox(layout, prefix .. "auto_recruit0", "其他", true)
ui.addCheckBox(layout, prefix .. "auto_recruit1", "车", true)
ui.addCheckBox(layout, prefix .. "auto_recruit4", "4", true)
ui.addCheckBox(layout, prefix .. "auto_recruit5", "5", true)
ui.addCheckBox(layout, prefix .. "auto_recruit6", "6", false)
newRow(layout)
addTextView(layout, "时间配置(每周几上号)")
ui.addEditText(layout, prefix .. "login_week_time", "1-7")
ui.addCheckBox(layout, prefix .. "accelerate_trading", "加速贸易站", false)
newRow(layout)
addTextView(layout, "培养计划")
ui.addEditText(layout, prefix .. "raise_plan_text", "", 350, -1)
-- local max_checkbox_one_row = getScreen().width //200
local max_checkbox_one_row = 3
for k, v in pairs(all_job) do
if k % max_checkbox_one_row == 1 then
newRow(layout, prefix .. "now_job_row" .. k)
end
ui.addCheckBox(layout, prefix .. "now_job_ui" .. k, v,
table.includes(now_job, v))
end
end
show_multi_account_ui = function()
local start_time = os.clock()
local num = multi_account_num
toast("正在加载多账号设置...")
local layout = "multi_account"
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)
local cmd = {
"ui.saveProfile('" .. getUIConfigPath("multi_account") .. "')",
"ui.dismiss('multi_account');", "sync_ui_config('multi_account')",
}
ui_cmd = table.join(cmd, ';')
addButton(layout, nil, "定时", make_jump_ui_command(layout, nil,
"crontab_enable_only=true;lock:remove(main_ui_lock)"),
ui_small_submit_width)
addButton(layout, nil, "启动并定时",
make_jump_ui_command(layout, nil, "lock:remove(main_ui_lock)"),
ui_small_submit_width, ui_small_submit_height, ui_submit_color)
newRow(layout)
addButton(layout, randomString(32), "导出帐密", make_jump_ui_command(
layout, layout, "multi_account_config_export(1)"))
addButton(layout, randomString(32), "导出全部", make_jump_ui_command(
layout, layout, "multi_account_config_export()"))
addButton(layout, randomString(32), "导入",
make_jump_ui_command(layout, nil,
"multi_account_config_import();show_multi_account_ui()"))
newRow(layout)
ui.addCheckBox(layout, layout .. '_enable', "启用账号", false)
ui.addEditText(layout, layout .. "_choice", "1-" .. multi_account_num, -1)
continue_account = loadConfig("continue_account", '')
if #continue_account > 0 then
continue_account = shrink_number_config(continue_account)
continue_account_btn = randomString(32)
addButton(layout, continue_account_btn, "继续账号" .. continue_account,
"ui.setVisiblity(continue_account_btn,3);ui.setText('multi_account_choice', ui.getText('multi_account_choice') .. ' # '.. continue_account);saveConfig('continue_account','');")
end
newRow(layout)
addTextView(layout, "切号前关闭")
ui.addCheckBox(layout, "multi_account_end_closeotherapp", "其他服", true)
ui.addCheckBox(layout, "multi_account_end_closeapp", "当前服", true)
-- newRow(layout)
-- addTextView(layout, "单号最大登录次数")
-- ui.addEditText(layout, "max_login_times", "")
-- newRow(layout)
-- addTextView(layout,[[启用账号]])
-- newRow(layout)
-- addTextView(layout,
-- [[“启用账号”填“1-10”表示跑前10个号,填“7 10-8 7 1-3”等价于“7 10 9 8 7 1 2 3”。临时账号写在#号后,填“1-10 # 5-10”表示跑前10个号,但本次启动只跑第5到第10个。账密为空跳过,高级设置中可调。抢登处理看必读。]])
--
newRow(layout)
multi_account_all_inherit_choice = map(function(x)
return "账号" .. tostring(x):padStart(2, '0')
end, range(1, multi_account_num))
for i = 1, num do
local padi = tostring(i):padStart(2, '0')
newRow(layout)
addTextView(layout, "账号" .. padi)
ui.addEditText(layout, "username" .. i, "", -1)
addTextView(layout, "密码")
ui.addEditText(layout, "password" .. i, "", -1)
addButton(layout, nil, "#" .. i, make_jump_ui_command(layout, nil,
"multi_account_config_remove_once_choice('" ..
i ..
"');saveConfig('continue_account','');lock:remove(main_ui_lock)"),
-2, nil, ui_submit_color)
-- ui.addCheckBox(layout, "multi_account" .. i, "启用", true)
newRow(layout)
addTextView(layout, "账号" .. padi .. "在")
-- addTextView(layout, "在")
-- ui.addRadioGroup(layout, "server" .. i, {"官服", "B服"}, 0, -2, -2, true)
ui.addSpinner(layout, "server" .. i, { "官服", "B服" }, 0)
-- newRow(layout)
-- addTextView(layout, "账号" .. padi .. "用")
addTextView(layout, "用")
addButton(layout, "multi_account_inherit_toggle" .. i,
i == 1 and '单号设置' or "继承设置",
"multi_account_inherit_toggle(" .. i .. ")")
--
-- addButton(layout, "multi_account_inherit_toggle" .. i, "单号设置",
-- "multi_account_inherit_toggle(" .. i .. ")")
-- addTextView(layout, "账号" .. padi .. "使用",multi_account_inherit)
-- newRow(layout)
ui.addSpinner(layout, "multi_account_inherit_spinner" .. i,
multi_account_all_inherit_choice, 0)
-- addTextView(layout, "设置")
-- addButton(layout, "multi_account_inherit_toggle" .. i,
-- "切换为独立设置",
-- "multi_account_inherit_toggle(" .. i .. ")")
setNewRowGid("multi_account_user_row" .. i)
make_account_ui(layout, "multi_account_user" .. i)
setNewRowGid()
end
-- local all_inherit_choice = map(function(j)
-- return "账号" .. tostring(j):padStart(2, '0')
-- end, table.filter(range(1, num), function(k) return k ~= i end))
-- all_inherit_choice = table.extend({"默认"}, all_inherit_choice)
-- ui函数必须global
multi_account_inherit_toggle = function(i)
local btn = "multi_account_inherit_toggle" .. i
local txt = ui.getText(btn)
if txt == "单号设置" then
ui.setText(btn, "继承设置")
elseif txt == "继承设置" then
ui.setText(btn, "独立设置")
else
ui.setText(btn, "单号设置")
end
multi_account_inherit_render(i)
end
-- ui函数必须global
multi_account_inherit_render = function(start, stop)
local layout = "multi_account"
start = start or 1
stop = stop or start
for i = start, stop do
local btn = "multi_account_inherit_toggle" .. i
local gid = "multi_account_user_row" .. i
local spinner = "multi_account_inherit_spinner" .. i
local txt = ui.getText(btn)
-- local txt = ui.getText(btn)
-- if txt == "默认设置" then
-- ui.setText(btn, "使用" .. txt)
-- elseif txt == "独立设置" then
-- ui.setText(btn, "使用" .. txt)
-- end
-- fallback
if txt == "默认设置" then
txt = "单号设置"
ui.setText(btn, txt)
end
-- ui.setText(btn,"账号30设置")
if txt == "单号设置" then
ui.setVisiblity(spinner, 3)
ui.setRowVisibleByGid(layout, gid, 8)
elseif txt == "独立设置" then
ui.setVisiblity(spinner, 3)
ui.setRowVisibleByGid(layout, gid, 0)
elseif txt == "继承设置" then
ui.setRowVisibleByGid(layout, gid, 8)
ui.setVisiblity(spinner, 1)
end
end
end
ui.saveProfile(getUIConfigPath(layout .. '_default'))
ui.loadProfile(getUIConfigPath(layout))
multi_account_inherit_render(1, num)
-- if #continue_account > 0 then
-- if equal_number_config(ui.getText('multi_account_choice') or '',
-- continue_account) then
-- ui.setVisiblity(continue_account_btn, 3)
-- end
-- end
ui.show(layout, false)
log.debug("多账号页面加载耗时: " .. string.format("%.2f", os.clock() - start_time) .. " 秒")
end
multi_account_config_export = function(simple)
local layout = "multi_account"
local content = loadOneUIConfig(layout)
content = table.filterKV(content, function(k, v)
if #k == 32 and not k:find('_') then return false end
return true
end)
if simple then
-- 提取账密
local account = ''
for i = 1, multi_account_num do
local username = content['username' .. i]:trim():map({ [' '] = '' })
local password = content['password' .. i]:trim()
local server = content['server' .. i]
if type(username) == 'string' and #username > 0 and type(password) ==
'string' and #password > 0 then
account = account .. username .. ' ' .. password .. ' ' ..
(server == 1 and 'B服' or '官服') .. '\n'
end
end
log.debug(account)
content = account
else
local default = loadOneUIConfig(layout .. "_default")
content = JsonEncode(table.diff(content, default))
end
putClipboard(content)
toast("多账号设置已复制" .. #content)
end
multi_account_num_get = function()
local layout = "multi_account"
local content = loadOneUIConfig(layout)
local num = 0
content = table.filterKV(content, function(k, v)
if #k == 32 and not k:find('_') then return false end
return true
end)
local account = ''
for i = 1, 30 do
local username = content['username' .. i] or ''
local password = content['password' .. i] or ''
local server = content['server' .. i] or 0
if type(username) == 'string' and #username > 0 and type(password) ==
'string' and #password > 0 then
num = num + 1
end
end
return num or 0
end
parse_simple_config = function(data)
data = data or ''
local layout = 'multi_account'
local cur = loadOneUIConfig(layout)
local i = multi_account_num
while i > 0 do
if type(cur["username" .. i]) == 'string' and #cur["username" .. i] > 0 or
type(cur["password" .. i]) == 'string' and #cur["password" .. i] > 0 then
break
end
i = i - 1
end
i = i + 1
if i > multi_account_num then i = 1 end
log('good index', i)
local startidx = i
-- log(2041, data)
for _, v in pairs(data:split('\n')) do
v = v:trim():split(' ')
if #v >= 2 and not v[1]:startsWith('#') then
local username = v[1]
local password = v[2]
local server = 0
if type(v[3]) == 'string' and string.upper(v[3]:sub(1, 1)) == 'B' then
server = 1
end
log.debug(i, v)
update(cur, {
['username' .. i] = username,
['password' .. i] = password,
['server' .. i] = server,
}, true)
i = i + 1
end
end
local endidx = i - 1
return JsonEncode(cur), startidx, endidx
end
multi_account_config_import = function()
local data = getClipboard():trim()
if not data or #data == 0 then stop('剪贴板无数据') end
log("剪贴板数据:" .. data)
local status, result
status, result = pcall(JsonDecode, data)
if not status and data:sub(1, 1) == '{' then
stop("json格式错误(剪贴板数据不完整)")
end
if not status then data = parse_simple_config(data) end
if not data or #data == 0 then stop("从剪贴板导入失败:" .. result) end
local layout = "multi_account"
saveOneUIConfig(layout, data)
end
multi_account_config_remove_once_choice = function(append)
local layout = "multi_account"
local cur = loadOneUIConfig(layout)
local choice = cur[layout .. "_choice"] or ''
choice = choice:commonmap()
if choice:find('#') then choice = choice:sub(1, choice:find('#') - 1):trim() end
if type(append) == "string" and #append > 0 then
choice = choice .. '#' .. append
end
cur[layout .. "_choice"] = choice
cur = JsonEncode(cur)
saveOneUIConfig(layout, cur)
-- log("choice", choice)
return choice
end
make_jump_ui_command = function(cur, next, extra)
-- log(getUIConfigPath(cur))
local cmd = {
-- 'log(ui.getData())',
"ui.saveProfile('" .. getUIConfigPath(cur) .. "')",
"ui.dismiss('" .. cur .. "');", next and "show_" .. next .. "_ui()" or '',
extra or '', "sync_ui_config('" .. cur .. "')",
}
return table.join(cmd, ';')
end
-- 快速启动
make_continue_account_ui = function(layout)
continue_account = loadConfig("continue_account", '')
continue_all_account = loadConfig("continue_all_account", '')
if #continue_account > 0 and #continue_all_account > 0 then
newRow(layout, nil, nil, -1)
continue_account = shrink_number_config(continue_account)
addButton(layout, nil, "启动并定时,本次只跑剩余账号 #" ..
continue_account, make_jump_ui_command(layout, nil,
"multi_account_config_remove_once_choice(continue_account);saveConfig('continue_account','');lock:remove(main_ui_lock)"),
-1, nil, ui_submit_color)
newRow(layout, nil, nil, -1)
continue_all_account = shrink_number_config(continue_all_account)
addButton(layout, nil, "启动并定时,本次先跑剩余账号 #" ..
continue_all_account, make_jump_ui_command(layout, nil,
"multi_account_config_remove_once_choice(continue_all_account);saveConfig('continue_account','');lock:remove(main_ui_lock)"),
-1, nil, ui_submit_color)
end
end
make_continue_extra_ui = function(layout)
continue_extra_mode = loadConfig("continue_extra_mode", '')
if #continue_extra_mode > 0 then
newRow(layout, nil, nil, -1)
addButton(layout, nil, "继续" .. continue_extra_mode,
make_jump_ui_command(layout, nil,
"extra_mode=continue_extra_mode;saveConfig('continue_extra_mode','');lock:remove(main_ui_lock)"),
-1, nil, ui_submit_color)
end
end
make_afterjob_ui = function(layout)
newRow(layout)
addTextView(layout, "完成之后")
ui.addCheckBox(layout, "end_home", "返回桌面", true)
ui.addCheckBox(layout, "end_closeapp", "关闭游戏", false)
ui.addCheckBox(layout, "end_screenoff", "熄屏")
newRow(layout)
addTextView(layout, "定时")
ui.addEditText(layout, "crontab_text", "4:00 12:00 20:00")
-- ui.addCheckBox(layout, "auto_start_script", "脚本打开自动运行")
addButton(layout, "auto_run_button", "启用脚本自动运行", "set_auto_run_state();")
end
set_auto_run_state = function()
local state = loadConfig('auto_run', 'false') == 'true'
if state then
ui.setButton("auto_run_button", "启用脚本自动运行")
saveConfig('auto_run', 'false')
auto_run = false
toast("您需要退出脚本/或等待下次脚本启动才能生效")
else
ui.setButton("auto_run_button", "禁用脚本自动运行")
saveConfig('auto_run', 'true')
auto_run = true
end
end
make_jump_ui = function(layout)
newRow(layout)
addButton(layout, nil, "启动", make_jump_ui_command(layout, nil,
"crontab_enable=false;lock:remove(main_ui_lock)"),
ui_small_submit_width)
addButton(layout, nil, "定时", make_jump_ui_command(layout, nil,
"crontab_enable_only=true;lock:remove(main_ui_lock)"),
ui_small_submit_width)
addButton(layout, "start_and_clock", "启动并定时",
make_jump_ui_command(layout, nil, "lock:remove(main_ui_lock)"),
ui_small_submit_width, ui_small_submit_height, ui_submit_color)
local max_checkbox_one_row = 3
local readme_btn = randomString(32)
local buttons = {
{ nil, "多账户", make_jump_ui_command(layout, 'multi_account') },
{ nil, "小工具", make_jump_ui_command(layout, "auto") },
{ nil, "肉鸽|小游戏", make_jump_ui_command(layout, "extra") },
{ "quit_script", "退出", make_jump_ui_command(layout, nil, "saveConfig('Not_Restart','true');peaceExit()") },
{ nil, "自动作战", make_jump_ui_command(layout, "auto_fight") },
{ nil, "高级设置", make_jump_ui_command(layout, "debug") },
{ "join_qq", "加入QQ群", make_jump_ui_command(layout, nil, "jump_qq_qun()") },
-- { "join_channel", "QQ频道", make_jump_ui_command(layout, nil, "jump_qq_channel()") },
{ "jump_afadian", "爱发电赞助", make_jump_ui_command(layout, nil, "copy_address('https://afdian.com/a/arklights')") },
{ "readme_btn", "使用文档", make_jump_ui_command(layout, nil, "saveConfig('readme_already_read','1');jump_readme()") },
}
for k, v in pairs(buttons) do
if k % max_checkbox_one_row == 1 then newRow(layout) end
addButton(layout, v[1], v[2], v[3])
end
-- newRow(layout)
-- addButton(layout, "jump_afadian", "爱发电赞助",
-- make_jump_ui_command(layout, nil, "jump_address('https://afdian.com/a/arklights')"))
end
make_ui_title = function(layout, name)
local screen = getScreen()
local resolution = screen.width .. 'x' .. screen.height
name = name or ''
local title = name .. " " .. getApkVerInt() .. "-LTS " ..
release_date:gsub(' ', '-') .. ' ' .. resolution
ui.setTitleText(layout, title)
end
jump_address = function(address)
local intent = {
action = "android.intent.action.VIEW",
uri = address,
}
runIntent(intent)
toast("正在跳转到地址")
peaceExit()
end
copy_address = function(address)
putClipboard(address)
toast("地址已复制到剪贴板")
peaceExit()
end
show_main_ui = function()
local layout = "main"
saveConfig('last_layout', layout)
ui.newLayout(layout, ui_page_width, -2)
make_ui_title(layout, "明日方舟速通")
-- make_continue_account_ui(layout)
-- make_continue_extra_ui(layout)
if appid_need_user_select then
newRow(layout)
addTextView(layout, "服务器选")
ui.addSpinner(layout, "server", { "官服", "B服" }, 0)
end
make_account_ui(layout)
make_afterjob_ui(layout)
-- newRow(layout)
-- addTextView(layout,
-- [[开基建退出提示,异形屏适配设为0。关游戏模式、全局侧边栏、深色夜间护眼模式、隐藏刘海。关懒人输入法,音量加停止脚本。有问题看必读。]])
-- local max_checkbox_one_row = getScreen().width // 200
make_jump_ui(layout)
ui.loadProfile(getUIConfigPath(layout))
-- 后处理
if not root_mode then
ui.setEnable("end_screenoff", false)
ui.setEnable("end_poweroff", false)
ui.setEnable("end_closeapp", false)
end
ui.show(layout, false)
local tcolor = "#ff4169E1"
-- if #loadConfig("readme_already_read", '') == 0 then
-- ui.setBackground("readme_btn", tcolor)
-- end
ui.setBackground("join_qq", "#ff37a652")
-- ui.setBackground("join_channel", "#ff37a652")
ui.setBackground("readme_btn", "#ffeb1c09")
ui.setBackground("quit_script", "#ffeb1c09")
ui.setBackground("start_and_clock", "#ff37a652")
ui.setBackground("jump_afadian", "#ff37a652")
if loadConfig("auto_run", 'false') == 'true' then
ui.setButton("auto_run_button", "禁用脚本自动运行")
end
end
show_debug_ui = function()
local layout = "debug"
local debug_page_width = screen.width * 0.55
ui.newLayout(layout, debug_page_width, -2)
ui.setTitleText(layout, "高级设置")
newRow(layout)
addButton(layout, nil, "返回",
make_jump_ui_command(layout, loadConfig("last_layout", "main")),
nil, nil)
addButton(layout, nil, "系统手势解锁(可能有bug)", make_jump_ui_command(layout, 'gesture_capture'))
newRow(layout)
ui.addCheckBox(layout, "enable_log", "启用日志", true)
ui.addCheckBox(layout, "write_log_local", "保存日志到本地", true)
addButton(layout, "upload_log_server", "上传日志至开发者", "upload_log()")
newRow(layout)
addTextView(layout, "最大日志时长(分钟)")
ui.addEditText(layout, "max_log_time", "15")
addTextView(layout, " 最大日志行数")
ui.addEditText(layout, "max_log_count", "1000")
newRow(layout)
ui.addTabView(layout, "debug_tab")
local debug_layout_验证码 = "debug_tab_yzm"
ui.addTab("debug_tab", debug_layout_验证码, "验证码")
newRow(debug_layout_验证码)
addTextView(debug_layout_验证码, "Aunly打码平台(打码每次0.012元)")
newRow(debug_layout_验证码)
addButton(debug_layout_验证码, nil, "官网跳转",
make_jump_ui_command(layout, nil, [[jump_address("https://captcha.aunly.cn/")]]))
addButton(debug_layout_验证码, nil, "复制",
make_jump_ui_command(layout, nil, [[copy_address("https://captcha.aunly.cn/")]]))
newRow(debug_layout_验证码)
addTextView(debug_layout_验证码, "Aunly打码服务Token")
ui.addEditText(debug_layout_验证码, "cloud_captcha_token", "")
newRow(debug_layout_验证码)
ui.addCheckBox(debug_layout_验证码, "not_wait_aunly", "Aunly打码不等待(B服打码过慢可以勾选)", false)
addTitle(debug_layout_验证码, "滑块验证码", "setting.png", 1, 1)
-- newRow(debug_layout_验证码)
-- ui.addCheckBox(debug_layout_验证码, "use_local_captcha", "使用速通本地打码服务", true)
newRow(debug_layout_验证码)
ui.addCheckBox(debug_layout_验证码, "use_free_server_captcha", "1.使用免费打码服务", true)
newRow(debug_layout_验证码)
ui.addCheckBox(debug_layout_验证码, "use_captcha_aunly_slip", "2.使用Aunly打码", true)
newRow(debug_layout_验证码)
ui.addCheckBox(debug_layout_验证码, "use_jfbym", "3.使用云码API(会逐步废弃)", false)
addButton(debug_layout_验证码, nil, "官网跳转",
make_jump_ui_command(layout, nil, [[jump_address("https://www.jfbym.com/")]]))
addButton(debug_layout_验证码, nil, "复制",
make_jump_ui_command(layout, nil, [[copy_address("https://www.jfbym.com/")]]))
newRow(debug_layout_验证码)
addTextView(debug_layout_验证码, "云码Token")
ui.addEditText(debug_layout_验证码, "jfbym_token", "")
addTitle(debug_layout_验证码, "点选验证码", "setting.png", 1, 1)
newRow(debug_layout_验证码)
ui.addCheckBox(debug_layout_验证码, "use_captcha_aunly", "1.使用Aunly打码", true)
newRow(debug_layout_验证码)
ui.addCheckBox(debug_layout_验证码, "use_captcha_free2", "2.使用自定义打码服务", false)
newRow(debug_layout_验证码)
addTextView(debug_layout_验证码, "自定义打码地址②")
ui.addEditText(debug_layout_验证码, "cloud_captcha_server2", "")
newRow(debug_layout_验证码)
ui.addCheckBox(debug_layout_验证码, "use_captcha", "3.使用图鉴打码", true)
addButton(debug_layout_验证码, nil, "官网跳转",
make_jump_ui_command(layout, nil, [[jump_address("https://www.ttshitu.com/")]]))
addButton(debug_layout_验证码, nil, "复制",
make_jump_ui_command(layout, nil, [[copy_address("https://www.ttshitu.com/")]]))
newRow(debug_layout_验证码)
addTextView(debug_layout_验证码, "图鉴用户名")
ui.addEditText(debug_layout_验证码, "captcha_username", "")
newRow(debug_layout_验证码)
addTextView(debug_layout_验证码, "图鉴密码")
ui.addEditText(debug_layout_验证码, "captcha_password", "")
local debug_layout_云控 = "debug_tab_yk"
ui.addTab("debug_tab", debug_layout_云控, "云控")
newRow(debug_layout_云控)
ui.addCheckBox(debug_layout_云控, "cloud_v2_enable", "启用审判庭V2(实验性)", false)
newRow(debug_layout_云控)
ui.addCheckBox(debug_layout_云控, "cloud_get_task", "审判庭接受任务", false)
newRow(debug_layout_云控)
addTextView(debug_layout_云控, "审判庭服务地址")
ui.addEditText(debug_layout_云控, "cloud_server", "")
newRow(debug_layout_云控)
addTextView(debug_layout_云控, "审判庭设备标识")
ui.addEditText(debug_layout_云控, "cloud_device_token", "")
newRow(debug_layout_云控)
addTextView(debug_layout_云控, "审判庭AuthToken")
ui.addEditText(debug_layout_云控, "cloud_auth_token", "")
addInfo(debug_layout_云控, [[已知审判庭的开源版本存在重大漏洞,可能导致账户密码被窃取。
不建议将审判庭服务开放在公网上。
如有需求可联系开发者部署私有化版本。]])
newRow(debug_layout_云控)
ui.addCheckBox(debug_layout_云控, "log_login_to_cloud", "上报登录流程", false)
newRow(debug_layout_云控)
ui.addCheckBox(debug_layout_云控, "skland_use_cloud", "森空岛签到使用云端接口", false)
addInfo(debug_layout_云控, [[勾选使用云端接口请求时候会附带账户密码
不勾选此选项则所有的请求全在本地完成
部分设备(如光速虚拟机)内无法使用curl,故本地签到会失败]])
newRow(debug_layout_云控)
ui.addCheckBox(debug_layout_云控, "cloud_use_custom_san_max", "自定义上报理智的上限值", false)
ui.addEditText(debug_layout_云控, "cloud_custom_san_max", "180") --自定义云控上报的理智最大值
local debug_layout_账户 = "debug_tab_account"
ui.addTab("debug_tab", debug_layout_账户, "账户日常")
newRow(debug_layout_账户)
ui.addCheckBox(debug_layout_账户, "new_change_account_plan", "新版切号方案(测试)", false)
newRow(debug_layout_账户)
ui.addCheckBox(debug_layout_账户, "multiple_proxy_commander", "自动使用最大多倍代理次数", true)
addInfo(debug_layout_账户, [[自动多倍代理要求:作战次数必须大于1次,写"HD-9"或者"HD-9*1"均不会使用多倍代理,
写"HD-8*4"时候,则最大代理次数为4次,即使剩余理智可以代理更多次。
如果写"HD-8 HD-9 HD-8"这样,那么仍然算作存在2次HD-8代理,会使用多倍作战]])
newRow(debug_layout_账户)
addTextView(debug_layout_账户, "理智药每次使用瓶数")
ui.addEditText(debug_layout_账户, "max_use_number_drug", "3")
newRow(debug_layout_账户)
addTextView(debug_layout_账户, "单号最大登录次数")
ui.addEditText(debug_layout_账户, "max_login_times", "")
newRow(debug_layout_账户)
addTextView(debug_layout_账户, "单号15分钟内最大登录次数")
ui.addEditText(debug_layout_账户, "max_login_times_5min", "3")
newRow(debug_layout_账户)
addTextView(debug_layout_账户, "单关卡最大连续代理/导航失败次数")
ui.addEditText(debug_layout_账户, "max_fight_failed_times", "3")
newRow(debug_layout_账户)
addTextView(debug_layout_账户, "单号最大成功剿灭次数")
ui.addEditText(debug_layout_账户, "max_jmfight_times", "1")
newRow(debug_layout_账户)
addTextView(debug_layout_账户, "最大连续作战次数(达到重启游戏)")
ui.addEditText(debug_layout_账户, "max_fight_times", "")
-- newRow(layout)
-- addTextView(layout, "多点点击时长(宿舍换班选不上人)")
-- ui.addEditText(layout, "tapall_duration", "")
-- ui.addCheckBox(layout, "tapall_usetap", "多点点击模式", false)
--
-- newRow(layout)
-- ui.addCheckBox(layout, "disable_drug_24hour",
-- "禁用自动吃24时到期理智药", false)
--
-- newRow(layout)
-- ui.addCheckBox(layout, "disable_drug_48hour",
-- "禁用自动吃48时到期理智药", false)
for i = 1, 7 do
newRow(debug_layout_账户)
local timenote = i == 1 and "“X小时”" or "“" .. (i - 1) .. "天”"
local default = i < 2 and '99' or '0'
addTextView(debug_layout_账户, timenote .. "理智药最多吃")
ui.addEditText(debug_layout_账户, "max_drug_times_" .. i .. "day", default)
addTextView(debug_layout_账户, "次")
end
newRow(debug_layout_账户)
ui.addCheckBox(debug_layout_账户, "zero_san_after_fight", "使用1-7清空剩余理智", false)
local debug_layout_通知 = "debug_tab_notify"
ui.addTab("debug_tab", debug_layout_通知, "通知")
newRow(debug_layout_通知)
addTextView(debug_layout_通知, "QQ通知账号")
ui.addEditText(debug_layout_通知, "QQ", "")
newRow(debug_layout_通知)
addTextView(debug_layout_通知, "QQ通知自建服务地址")
ui.addEditText(debug_layout_通知, "qqimagedeliver", "")
newRow(debug_layout_通知)
addTextView(debug_layout_通知, "pushplus通知账号(token)")
ui.addEditText(debug_layout_通知, "pushplus_token", "")
newRow(debug_layout_通知)
addTextView(debug_layout_通知, "pushplus通知渠道(channel)")
ui.addEditText(debug_layout_通知, "pushplus_channel", "")
newRow(debug_layout_通知)
ui.addCheckBox(debug_layout_通知, "telegram_api_curl",
"使用curl推送通知", true)
newRow(debug_layout_通知)
addTextView(debug_layout_通知, "Telegram推送api(可不填)")
ui.addEditText(debug_layout_通知, "telegram_api", "")
newRow(debug_layout_通知)
addTextView(debug_layout_通知, "Telegram Bot Token")
ui.addEditText(debug_layout_通知, "telegram_token", "")
newRow(debug_layout_通知)
addTextView(debug_layout_通知, "Telegram chat ID")
ui.addEditText(debug_layout_通知, "telegram_chatid", "")
newRow(debug_layout_通知)
addTextView(debug_layout_通知, "企业微信 webhook地址")
ui.addEditText(debug_layout_通知, "wechat_webhook_url", "")
-- newRow(debug_layout_通知)
-- ui.addCheckBox(debug_layout_通知, "qqnotify_save",
-- "QQ通知保存到/sdcard/包名/ (保留一周)", true)
newRow(debug_layout_通知)
ui.addCheckBox(debug_layout_通知, "qqnotify_quiet",
"QQ通知设备名与账号名只显示备注", false)
newRow(debug_layout_通知)
ui.addCheckBox(debug_layout_通知, "qqnotify_notime", "QQ通知不显示发送时间",
false)
newRow(debug_layout_通知)
ui.addCheckBox(debug_layout_通知, "qqnotify_nofailedfight",
"QQ通知不显示代理失败信息", false)
newRow(debug_layout_通知)
ui.addCheckBox(debug_layout_通知, "qqnotify_nofight", "QQ通知不显示作战信息",
false)
newRow(debug_layout_通知)
ui.addCheckBox(debug_layout_通知, "qqnotify_beforemail",
"QQ通知显示邮件收取前情况", false)
newRow(debug_layout_通知)
ui.addCheckBox(debug_layout_通知, "qqnotify_afterenter",
"QQ通知显示基建进入后情况", false)
newRow(debug_layout_通知)
ui.addCheckBox(debug_layout_通知, "qqnotify_beforeleaving",
"QQ通知显示基建退出前情况", false)
newRow(debug_layout_通知)
ui.addCheckBox(debug_layout_通知, "notify_sub_expire",
"月卡到期通知", true)
local debug_layout_基建 = "debug_tab_base"
ui.addTab("debug_tab", debug_layout_基建, "基建")
newRow(debug_layout_基建)
ui.addCheckBox(debug_layout_基建, "not_use_ocr", "基建不使用ocr(低配置或基建崩溃建议打开)", false)
addInfo(debug_layout_基建, "勾选后无法使用红松林、多萝西等标准化组合,无法自动使用菲亚梅塔、深海队")
newRow(debug_layout_基建)
ui.addCheckBox(debug_layout_基建, "disable_add_friend", "好友访问不自动添加好友", false)
newRow(debug_layout_基建)
ui.addCheckBox(debug_layout_基建, "disable_training_shift", "基建换班忽略训练室", false)
newRow(debug_layout_基建)
addTextView(debug_layout_基建, "基建训练室检测延迟")
ui.addEditText(debug_layout_基建, "training_check_time", '0.15')
newRow(debug_layout_基建)
addTextView(debug_layout_基建, "基建换班心情阈值")
ui.addEditText(debug_layout_基建, "shift_min_mood", '12')
addInfo(debug_layout_基建, "换班间隔12小时推荐12,8小时推荐10,6小时推荐8")
-- ui.addCheckBox(debug_layout_基建, "disable_control_shift",
-- "基建换班禁用控制中枢换班", false)
newRow(debug_layout_基建)
ui.addCheckBox(debug_layout_基建, "manu_shift_short_circuit",
"制造站单个干员平均效率大于", false)
ui.addEditText(debug_layout_基建, "manu_shift_short_circuit_threshold", '0.38')
addTextView(debug_layout_基建, "时跳过")
newRow(debug_layout_基建)
newRow(debug_layout_基建)
ui.addCheckBox(debug_layout_基建, "only_change_assistant_at_Monday",
"副手换人仅在周一执行", true)
newRow(debug_layout_基建)
ui.addCheckBox(debug_layout_基建, "collect_beforeleaving",
"基建离开前加一次基建收获", true)
newRow(debug_layout_基建)
addTextView(debug_layout_基建, "多账号仅传递线索账号(线索小号)")
ui.addEditText(debug_layout_基建, "multi_account_disable_clue_unlock", '')
newRow(debug_layout_基建)
addTextView(debug_layout_基建, "换班计算满员深海队账号")
ui.addEditText(debug_layout_基建, "multi_account_use_abyssal_hunter", '')
addInfo(debug_layout_基建, "基于ocr,没有满员深海队时会报错停止")
local debug_layout_其他 = "debug_tab_other"
ui.addTab("debug_tab", debug_layout_其他, "其他")
newRow(debug_layout_其他)
ui.addCheckBox(debug_layout_其他, "disable_paddleocr",
"完全禁用飞浆OCR", false)
newRow(debug_layout_其他)
ui.addCheckBox(debug_layout_其他, "enable_raise_func", "启用自动养成", false)
newRow(debug_layout_其他)
ui.addCheckBox(debug_layout_其他, "enable_seasonal_tasks", "启用赛季任务", false)
addInfo(debug_layout_其他, "可能会报错停止,需要手动启用")
newRow(debug_layout_其他)
ui.addCheckBox(debug_layout_其他, "disable_free_draw",
"限时活动禁用赠送寻访(每日单抽)", false)
------------------------------------------------------------
addTitle(debug_layout_其他, "保全设置", "setting.png", 1, 1)