-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathguoba.support.js
More file actions
451 lines (433 loc) · 12.3 KB
/
Copy pathguoba.support.js
File metadata and controls
451 lines (433 loc) · 12.3 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
import genshinSetting from './GachaMOD/Genshin/model/setting.js'
import pluginSetting from './model/setting.js'
import lodash from "lodash";
import { pluginResources, pluginRoot } from "./model/path.js";
import path from 'path'
import fs from 'fs'
// 检查星铁模块是否存在
const hasStarRail = fs.existsSync(`${pluginRoot}/GachaMOD/StarRail`)
// 动态加载星铁 setting
let starrailSetting = null
if (hasStarRail) {
starrailSetting = (await import('./GachaMOD/StarRail/model/setting.js')).default
}
export function supportGuoba () {
// ===== 插件配置 (apps/ → defSet/) =====
const pluginSchemas = [
{
label: '插件配置',
component: 'SOFT_GROUP_BEGIN'
},
{
label: '违禁词监听',
component: 'Divider'
},
{
field: 'wordListener.enable',
label: '违禁词开关',
bottomHelpMessage: '开启违禁词监听',
component: 'Switch'
},
{
field: 'wordListener.time',
label: '违禁词禁言时长',
bottomHelpMessage: '禁言时长,秒',
component: 'InputNumber',
required: false,
componentProps: {
min: 1,
max: 86400,
placeholder: '请设置时长'
}
},
{
label: '隐形拉黑',
component: 'Divider'
},
{
field: 'block.enable',
label: '隐形拉黑开关',
bottomHelpMessage: '开启隐形拉黑,降低拉黑用户的抽卡概率、且请求喵喵面板时总是失败',
component: 'Switch'
}
]
// ===== 原神配置 (GachaMOD/Genshin/ → Genshin/def/) =====
const genshinSchemas = [
{
label: '原神配置',
component: 'SOFT_GROUP_BEGIN'
},
{
label: '功能开关',
component: 'Divider'
},
{
field: 'Genshin.gacha.enable',
label: '自定义抽卡',
bottomHelpMessage: '使用原神抽卡服务',
component: 'Switch'
},
{
field: 'Genshin.gacha.more',
label: '百连开关',
bottomHelpMessage: '关闭后,无法使用二十连、三十连以及百连',
component: 'Switch'
},
{
field: 'Genshin.gacha.sync',
label: '卡池自动同步',
bottomHelpMessage: '抽卡前检查卡池是否正确',
component: 'Switch'
},
{
field: 'Genshin.gacha.relifeCD',
label: '转生CD',
bottomHelpMessage: 'CD时长,单位分钟',
component: 'InputNumber',
required: false,
componentProps: {
min: 1,
max: 1440,
placeholder: '请输入时长'
}
},
{
field: 'Genshin.coin.default.pink',
label: '每日纠缠之缘',
bottomHelpMessage: '全局通用,每日粉球数量',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 10000,
placeholder: '请输入数量'
}
},
{
field: 'Genshin.coin.default.blue',
label: '每日相遇之缘',
bottomHelpMessage: '全局通用,每日蓝球数量',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 10000,
placeholder: '请输入数量'
}
},
{
label: '概率设置',
component: 'Divider'
},
{
field: 'Genshin.gacha.wai',
label: '小保底概率',
bottomHelpMessage: '小保底不歪概率,百分比(0-100)',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 100,
placeholder: '请输入概率'
}
},
{
field: 'Genshin.gacha.chance5',
label: '五星角色概率',
bottomHelpMessage: '角色池5星的出货概率,0-10000',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 10000,
placeholder: '请输入概率'
}
},
{
field: 'Genshin.gacha.chance4',
label: '四星角色概率',
bottomHelpMessage: '角色池4星的出货概率,0-10000',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 10000,
placeholder: '请输入概率'
}
},
{
field: 'Genshin.gacha.chanceW5',
label: '五星武器概率',
bottomHelpMessage: '武器池5星的出货概率,0-10000',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 10000,
placeholder: '请输入概率'
}
},
{
field: 'Genshin.gacha.chanceW4',
label: '四星武器概率',
bottomHelpMessage: '武器池4星的出货概率,0-10000',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 10000,
placeholder: '请输入概率'
}
},
{
field: 'Genshin.gacha.setchance',
label: '概率复位',
bottomHelpMessage: '如果需要将概率恢复默认概率,请将滑块滑到100%后点击保存',
component: 'Slider',
componentProps: {
min: 0,
max: 100,
tipFormatter: function (v) {
return v + '%'
}
}
}
]
// ===== 星铁配置 (GachaMOD/StarRail/ → StarRail/def/) =====
const starrailSchemas = hasStarRail ? [
{
label: '星铁配置',
component: 'SOFT_GROUP_BEGIN'
},
{
label: '功能开关',
component: 'Divider'
},
{
field: 'StarRail.gacha.enable',
label: '自定义抽卡',
bottomHelpMessage: '使用星铁抽卡服务',
component: 'Switch'
},
{
field: 'StarRail.gacha.more',
label: '百连开关',
bottomHelpMessage: '关闭后,无法使用二十连、三十连以及百连',
component: 'Switch'
},
{
field: 'StarRail.gacha.sync',
label: '卡池自动同步',
bottomHelpMessage: '抽卡前检查卡池是否正确',
component: 'Switch'
},
{
field: 'StarRail.gacha.relifeCD',
label: '转生CD',
bottomHelpMessage: 'CD时长,单位分钟',
component: 'InputNumber',
required: false,
componentProps: {
min: 1,
max: 1440,
placeholder: '请输入时长'
}
},
{
field: 'StarRail.coin.default.pink',
label: '每日星轨专票',
bottomHelpMessage: '全局通用,每日专票数',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 10000,
placeholder: '请输入数量'
}
},
{
field: 'StarRail.coin.default.blue',
label: '每日星轨通票',
bottomHelpMessage: '全局通用,每日通票数',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 10000,
placeholder: '请输入数量'
}
},
{
label: '概率设置',
component: 'Divider'
},
{
field: 'StarRail.gacha.wai',
label: '小保底概率',
bottomHelpMessage: '小保底不歪概率,百分比(0-100)',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 100,
placeholder: '请输入概率'
}
},
{
field: 'StarRail.gacha.chance5',
label: '五星角色概率',
bottomHelpMessage: '角色池5星的出货概率,0-10000',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 10000,
placeholder: '请输入概率'
}
},
{
field: 'StarRail.gacha.chance4',
label: '四星角色概率',
bottomHelpMessage: '角色池4星的出货概率,0-10000',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 10000,
placeholder: '请输入概率'
}
},
{
field: 'StarRail.gacha.chanceW5',
label: '五星光锥概率',
bottomHelpMessage: '光锥池5星的出货概率,0-10000',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 10000,
placeholder: '请输入概率'
}
},
{
field: 'StarRail.gacha.chanceW4',
label: '四星光锥概率',
bottomHelpMessage: '光锥池4星的出货概率,0-10000',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 10000,
placeholder: '请输入概率'
}
},
{
field: 'StarRail.gacha.setchance',
label: '概率复位',
bottomHelpMessage: '如果需要将概率恢复默认概率,请将滑块滑到100%后点击保存',
component: 'Slider',
componentProps: {
min: 0,
max: 100,
tipFormatter: function (v) {
return v + '%'
}
}
}
] : []
return {
pluginInfo: {
name: 'flower-plugin',
title: '抽卡插件',
author: '@听语惊花',
authorLink: 'https://github.com/Nwflower',
link: 'https://github.com/Nwflower/flower-plugin',
isV3: true,
isV2: false,
description: '集百连与单抽于一体的综合性模拟抽卡插件',
icon: 'iconoir:3d-three-pts-box',
iconColor: '#d19f56',
iconPath: path.join(pluginResources, 'img/logo_flower_plugin.png'),
},
configInfo: {
schemas: [
...pluginSchemas,
...genshinSchemas,
...starrailSchemas
],
getConfigData () {
// 插件配置(defSet/)
let pluginConfig = pluginSetting.merge()
// 原神配置(Genshin/def/)
let genshinConfig = genshinSetting.merge()
let data = { ...pluginConfig, Genshin: genshinConfig }
// 星铁配置(StarRail/def/)
if (hasStarRail && starrailSetting) {
let srConfig = starrailSetting.merge()
data.StarRail = srConfig
}
return data
},
setConfigData (data, { Result }) {
let pluginConfig = pluginSetting.merge()
let genshinConfig = genshinSetting.merge()
let srConfig = hasStarRail && starrailSetting ? starrailSetting.merge() : null
for (let [keyPath, value] of Object.entries(data)) {
// ===== 插件配置 =====
if (keyPath === 'wordListener.enable') {
let config = pluginSetting.getConfig('wordListener')
config.enable = value
pluginSetting.setConfig('wordListener', config)
continue
}
if (keyPath === 'wordListener.time') {
let config = pluginSetting.getConfig('wordListener')
config.time = value
pluginSetting.setConfig('wordListener', config)
continue
}
if (keyPath === 'block.enable') {
let config = pluginSetting.getConfig('block')
config.enable = value
pluginSetting.setConfig('block', config)
continue
}
// ===== 原神配置 =====
if (keyPath.startsWith('Genshin.')) {
let realKey = keyPath.replace('Genshin.', '')
if (realKey === 'gacha.setchance' && value === 100) {
lodash.set(genshinConfig, 'gacha.chance5', 60)
lodash.set(genshinConfig, 'gacha.chanceW5', 70)
lodash.set(genshinConfig, 'gacha.chance4', 510)
lodash.set(genshinConfig, 'gacha.chanceW4', 600)
lodash.set(genshinConfig, 'gacha.wai', 50)
} else {
lodash.set(genshinConfig, realKey, value)
}
continue
}
// ===== 星铁配置 =====
if (keyPath.startsWith('StarRail.') && srConfig) {
let realKey = keyPath.replace('StarRail.', '')
if (realKey === 'gacha.setchance' && value === 100) {
lodash.set(srConfig, 'gacha.chance5', 60)
lodash.set(srConfig, 'gacha.chanceW5', 80)
lodash.set(srConfig, 'gacha.chance4', 510)
lodash.set(srConfig, 'gacha.chanceW4', 660)
lodash.set(srConfig, 'gacha.wai', 50)
} else {
lodash.set(srConfig, realKey, value)
}
continue
}
// 其他插件配置
lodash.set(pluginConfig, keyPath, value)
}
if (srConfig) starrailSetting.analysis(srConfig)
genshinSetting.analysis(genshinConfig)
pluginSetting.analysis(pluginConfig)
return Result.ok({}, '设置成功~')
}
}
}
}