forked from boluokk/e7Helper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
userinterface.lua
485 lines (479 loc) · 14.6 KB
/
userinterface.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
sui = {}
-- ui事件
suie = {}
parentUID = '第七史诗助手 '..release_date..' '..displaySizeWidth..'x'..displaySizeHeight
grindUID = '刷图设置'
bagUID = '背包清理设置'
functionSettingUID = '功能设置页'
AdvSettingUID = '高级设置页'
-- bin: bid、bname
addButton = function (bin, partid)
partid = partid or parentUID
ui.addButton(partid, bin, bin)
ui.setOnClick(bin, 'suie.'..bin..'()')
end
setButton = function (bin, w, h)
w = w or 100
h = h or 100
-- 添加事件函数
ui.setButton(bin, bin, w, h)
end
newLayout = function (pid)
pid = pid or parentUID
ui.newLayout(pid, 720, -2)
end
newRow = function (pid)
pid = pid or parentUID
ui.newRow(pid, uuid())
end
addTab = function (pin, pid)
pid = pid or parentUID
ui.addTab(pid, pin, pin)
end
addTabView = function (cid)
ui.addTabView(parentUID,cid)
end
addTextView = function (text, pid)
pid = pid or parentUID
ui.addTextView(pid,text,text)
end
addRadioGroup = function (id, data, pid)
pid = pid or parentUID
if type(data) ~= 'table' then data = {data} end
ui.addRadioGroup(pid,id,data,0,-1,70,true)
end
addCheckBox = function (id, selection, pid, defaluValue)
pid = pid or parentUID
ui.addCheckBox(pid,id,selection, defaluValue)
end
addEditText = function (id, text, pid)
pid = pid or parentUID
ui.addEditText(pid,id,text)
end
saveProfile = function (path)
ui.saveProfile(root_path..path)
end
loadProfile = function (path)
ui.loadProfile(root_path..path)
end
addSpinner = function (id, data, pid)
pid = pid or parentUID
data = data or {}
ui.addSpinner(pid, id ,data)
end
setDisabled = function (id)
ui.setEnable(id,false)
end
setEnable = function ()
ui.setEnable(id,true)
end
dismiss = function (id) ui.dismiss(id) end
suie.退出 = exit
suie.启动 = function ()
if not suie.开启前() then return end
if print_config_info then print(current_task) exit() end
if current_task['开启日志'] then logger_display_left_bottom = false detail_log_message = true end
path.游戏开始()
end
suie.开启前 = function ()
-- 保存配置
saveProfile('config.txt')
-- 是否配置了清理背包(必须配置, 不然会出问题卡死)
if not sFileExist('bagConfig.txt') then log('请配置满背包处理!') suie.清理背包() return end
if not sFileExist('functionSetting.txt') then log('请配置功能设置!') suie.功能设置() return end
-- 读取所有文件数据
current_task = uiConfigUnion(fileNames)
ui_config_finish = true
dismiss(parentUID)
return 1
end
suie.刷书签 = function ()
if not suie.开启前() then return end
path.刷书签(sgetNumberConfig("refresh_book_tag_count", 0))
end
suie.使用说明 = function ()
runIntent({
['action'] = 'android.intent.action.VIEW',
['uri'] = open_resource_doc
})
exit()
end
suie.刷图设置 = function ()
sui.showNotMainUI(sui.showGrindSetting)
end
suie.刷新UI = function ()
for i,v in pairs(fileNames) do sdelfile(v) end
reScript()
end
suie.功能设置 = function ()
sui.showNotMainUI(sui.showFunctionSetting)
end
suie.高级设置 = function ()
sui.showNotMainUI(sui.showAdvSetting)
end
suie.功能设置保存 = function ()
saveProfile('functionSetting.txt')
suie.功能设置取消()
end
suie.功能设置取消 = function ()
sui.hiddenNotMainUI(functionSettingUID)
end
suie.高级配置取消 = function ()
sui.hiddenNotMainUI(AdvSettingUID)
end
suie.高级配置保存 = function ()
saveProfile('advSetting.txt')
suie.功能设置取消()
end
suie.刷图配置取消 = function ()
sui.hiddenNotMainUI(grindUID)
end
suie.刷图配置保存 = function ()
saveProfile('fightConfig.txt')
suie.刷图配置取消()
end
suie.清理背包 = function ()
sui.showNotMainUI(sui.showBagSetting)
end
suie.背包配置取消 = function ()
sui.hiddenNotMainUI(bagUID)
end
suie.背包配置保存 = function ()
saveProfile('bagConfig.txt')
suie.背包配置取消()
end
suie.升3星狗粮 = function ()
if not suie.开启前() then return end
path.升3星狗粮()
end
suie.购买企鹅 = function ()
if not suie.开启前() then return end
path.购买企鹅()
end
suie.手动热更 = function ()
local hotUpdateUrl = ui.getValue("手动热更地址")
if hotUpdateUrl and hotUpdateUrl:find('http') then
update_source = hotUpdateUrl
hotUpdate()
else
log('热更地址格式错误!')
end
end
-- 主页
sui.show = function ()
newLayout()
newRow()
-- 开源信息
addTextView('免费开源,有问题(看下方使用说明 or 加群)\n'..
'QQ群:206490280 '..
'QQ频道号:24oyp5x92q')
newRow()
-- 服务器
addTextView('服务器: ')
local servers = ui_option.服务器
addRadioGroup('服务器', servers)
newRow()
-- 日常功能区
local selections = ui_option.任务
for i,v in pairs(selections) do
addCheckBox(v, v)
if i % 3 == 0 then newRow() end
end
newRow()
addTextView('每隔')
addEditText('运行间隔时间', '120')
addTextView('分钟, 循环一次')
newRow()
addButton('使用说明')
addTextView(('|'))
addButton('启动')
addButton('退出')
newRow()
addButton('刷新UI')
addTextView(('|'))
addButton('清理背包')
addButton('刷图设置')
newRow()
addButton('高级设置')
addTextView(('|'))
addButton('购买企鹅')
addButton('功能设置')
newRow()
addButton('XXX')
addTextView('|')
addButton('刷书签')
addButton('升3星狗粮')
ui.setBackground("使用说明","#ffe74032")
ui.setBackground("购买企鹅","#ff3bceb3")
ui.setBackground("升3星狗粮","#ff3bceb3")
ui.setBackground("刷书签","#ff3bceb3")
ui.show(parentUID, false)
-- load config
loadProfile('config.txt')
wait(function ()
if ui_config_finish then return true end
end, .05, nil, true)
end
-- 战斗设置
sui.showGrindSetting = function ()
newLayout(grindUID)
-- addButton('刷图测试', grindUID)
local passAll = ui_option.战斗类型
for i,v in pairs(passAll) do
local cur = i..''
if cur:includes({1,3,5,6,7}) then
addCheckBox(v, v, grindUID)
else
addCheckBox(v, v, grindUID)
-- 暂时禁用
-- todo
setDisabled(v)
end
if i % 4 == 0 then
newRow(grindUID)
end
end
newRow(grindUID)
addTextView('补充行动力:', grindUID)
addRadioGroup('补充行动力类型', ui_option.补充行动力类型, grindUID)
newRow(grindUID)
addCheckBox('宠物重复战斗', '宠物重复战斗', grindUID, true)
newRow(grindUID)
addTextView('讨伐: ', grindUID)
addSpinner('讨伐类型', ui_option.讨伐关卡类型, grindUID)
addSpinner('讨伐级别', ui_option.讨伐级别, grindUID)
addTextView('级', grindUID)
addEditText('讨伐次数', '100', grindUID)
addTextView('次', grindUID)
newRow(grindUID)
addTextView('迷宫:', grindUID)
newRow(grindUID)
addTextView('精灵祭坛:', grindUID)
addSpinner('精灵祭坛类型', ui_option.精灵祭坛关卡类型, grindUID)
addSpinner('精灵祭坛级别', ui_option.精灵祭坛级别, grindUID)
addTextView('级', grindUID)
addEditText('精灵祭坛次数', '100', grindUID)
addTextView('次', grindUID)
newRow(grindUID)
addTextView('深渊:', grindUID)
newRow(grindUID)
newRow(grindUID)
addTextView('后记:', grindUID)
addEditText('后记次数', '100', grindUID)
addTextView('次', grindUID)
newRow(grindUID)
addTextView('活动:', grindUID)
addSpinner('活动指定', ui_option.活动指定, grindUID)
addTextView('指定', grindUID)
addSpinner('活动级别', ui_option.活动级别, grindUID)
addTextView('级', grindUID)
addEditText('活动次数', '100', grindUID)
addTextView('次', grindUID)
newRow(grindUID)
addTextView('主线重复刷:', grindUID)
addEditText('主线重复刷次数', '100', grindUID)
newRow(grindUID)
addButton('刷图配置保存', grindUID)
addButton('刷图配置取消', grindUID)
ui.show(grindUID, false)
loadProfile('fightConfig.txt')
end
sui.showNotMainUI = function (fun)
-- 保存配置
saveProfile('config.txt')
dismiss(parentUID)
fun()
end
sui.hiddenNotMainUI = function (hiddenID)
dismiss(hiddenID)
sui.show()
end
-- 背包清理
sui.showBagSetting = function ()
newLayout(bagUID)
addTextView('宠物背包', bagUID)
newRow(bagUID)
-- 默认: B C D
for i,v in pairs(ui_option.宠物级别) do
if v:includes({'B', 'C', 'D'}) then
addCheckBox(v, v, bagUID, true)
else
addCheckBox(v, v, bagUID)
end
end
newRow(bagUID)
addTextView('出售-萃取优先度', bagUID)
newRow(bagUID)
addRadioGroup('出售萃取优先度', ui_option.出售萃取优先度, bagUID)
newRow(bagUID)
addTextView('装备背包', bagUID)
newRow(bagUID)
-- 默认:
for i,v in pairs(ui_option.装备类型) do
if v:includes({'一般', '高级', '稀有'}) then
addCheckBox(v, v, bagUID, true)
else
addCheckBox(v, v, bagUID)
end
end
newRow(bagUID)
for i,v in pairs(ui_option.装备等级) do
if v:includes({'28', '42', '57', '71', '72'}) then
addCheckBox(v, v, bagUID, true)
else
addCheckBox(v, v, bagUID)
end
if i % 4 == 0 then
newRow(bagUID)
end
end
newRow(bagUID)
for i,v in pairs(ui_option.装备强化等级) do
if v:includes({'+0', '9'}) then
addCheckBox(v, v, bagUID, true)
else
addCheckBox(v, v, bagUID)
end
if i % 4 == 0 then
newRow(bagUID)
end
end
newRow(bagUID)
addTextView('神器背包', bagUID)
newRow(bagUID)
for i,v in pairs(ui_option.神器星级) do
if v:includes({'1', '2', '3'}) then
addCheckBox(v, v, bagUID, true)
else
addCheckBox(v, v, bagUID)
end
if i % 7 == 0 then
newRow(bagUID)
end
end
newRow(bagUID)
for i,v in pairs(ui_option.神器强化) do
if v:includes({'+0', '10'}) then
addCheckBox(v, v, bagUID, true)
else
addCheckBox(v, v, bagUID)
end
if i % 4 == 0 then
newRow(bagUID)
end
end
newRow(bagUID)
addTextView('英雄等级', bagUID)
newRow(bagUID)
for i,v in pairs(ui_option.英雄等级) do
if v:includes({'1', '2', '3'}) then
addCheckBox(v, v, bagUID, true)
else
addCheckBox(v, v, bagUID)
end
if i % 7 == 0 then
newRow(bagUID)
end
end
newRow(bagUID)
addButton('背包配置保存', bagUID)
addButton('背包配置取消', bagUID)
ui.show(bagUID, false)
loadProfile('bagConfig.txt')
end
-- 功能设置
sui.showFunctionSetting = function ()
newLayout(functionSettingUID)
addTextView('<刷书签设置>', functionSettingUID)
newRow(functionSettingUID)
local tag = ui_option.刷标签类型
addTextView('书签: ', functionSettingUID)
for i,v in pairs(tag) do
if i == 3 then
addCheckBox(v, v, functionSettingUID)
else
addCheckBox(v, v, functionSettingUID, true)
ui.setEnable(v, false)
end
end
newRow(functionSettingUID)
-- 红装
local level = ui_option.红装等级
addTextView('红装暂停: ', functionSettingUID)
for i,v in pairs(level) do
addCheckBox('红装暂停-'..v, v, functionSettingUID)
end
-- 不能修改主题
newRow(functionSettingUID)
addTextView('次数:', functionSettingUID)
addEditText('更新次数', '333', functionSettingUID)
-- 需要配置及其他功能区
newRow(functionSettingUID)
addTextView('<竞技场设置>', functionSettingUID)
newRow(functionSettingUID)
addCheckBox('叶子买票', '叶子买票', functionSettingUID, true)
addTextView('刷新交战次数:', functionSettingUID)
addEditText('交战次数', '30', functionSettingUID)
newRow(functionSettingUID)
addTextView('每周奖励: ', functionSettingUID)
addRadioGroup('竞技场每周奖励', ui_option.竞技场每周奖励, functionSettingUID)
newRow(functionSettingUID)
addTextView('次序: ', functionSettingUID)
addRadioGroup('竞技场次序', ui_option.竞技场次序, functionSettingUID)
-- local mission = {'圣域', '探险', '讨伐', '战争'}
-- addTextView('派遣任务:')
-- addRadioGroup('派遣任务', mission)
newRow(functionSettingUID)
addTextView('<社团设置>', functionSettingUID)
newRow(functionSettingUID)
local teamMission = ui_option.社团任务
for i,v in pairs(teamMission) do
if i % 4 == 0 then newRow(functionSettingUID) end
addCheckBox(v, v, functionSettingUID, true)
end
newRow(functionSettingUID)
addTextView('社团捐赠:', functionSettingUID)
addRadioGroup('社团捐赠类型', ui_option.社团捐赠类型, functionSettingUID)
newRow(functionSettingUID)
addTextView('<升级狗粮设置>', functionSettingUID)
newRow(functionSettingUID)
addTextView('升3星狗粮:', functionSettingUID)
addRadioGroup('升3星狗粮类型', ui_option.升2星狗粮类型, functionSettingUID)
newRow(functionSettingUID)
addEditText('升3星狗粮个数','100', functionSettingUID)
addTextView('个', functionSettingUID)
addTextView('传送前请先锁定!', functionSettingUID)
newRow(functionSettingUID)
addButton('功能设置保存', functionSettingUID)
addButton('功能设置取消', functionSettingUID)
ui.show(functionSettingUID, false)
loadProfile('functionSetting.txt')
end
-- 高级设置
sui.showAdvSetting = function ()
newLayout(AdvSettingUID)
addTextView('卡死重试次数 ', AdvSettingUID)
addEditText('重试次数', '5', AdvSettingUID)
-- newRow(AdvSettingUID)
-- addTextView('qq消息通知 ', AdvSettingUID)
-- addEditText('重试次数', '5', AdvSettingUID)
newRow(AdvSettingUID)
addTextView('手动热更地址 ', AdvSettingUID)
addEditText('手动热更地址', 'https://gitcode.net/otato001/e7hepler/-/raw/master/', AdvSettingUID)
newRow(AdvSettingUID)
addButton('手动热更', AdvSettingUID)
newRow(AdvSettingUID)
addCheckBox('开启日志', '开启日志', AdvSettingUID)
addCheckBox('关闭热更', '关闭热更', AdvSettingUID)
newRow(AdvSettingUID)
addTextView('qq消息通知(服务器地址) ', AdvSettingUID)
addEditText('qq消息通知', '', AdvSettingUID)
newRow(AdvSettingUID)
addTextView('qq消息发送给谁(QQ号) ', AdvSettingUID)
addEditText('qq消息发送给谁', '', AdvSettingUID)
newRow(AdvSettingUID)
addButton('高级配置保存', AdvSettingUID)
addButton('高级配置取消', AdvSettingUID)
ui.show(AdvSettingUID, false)
loadProfile('advSetting.txt')
end