mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-16 04:35:42 +00:00
5fe63f4896
* 允许禁用面板替换功能 * 允许禁用非实装角色资料,关闭可禁用非实装角色资料及面板替换 * 可选择面板服务,可选喵喵Api优先(需具备Token)或Enka优先 * 更新迪希雅、米卡的最新天赋与命座数据 * 全量使用通过属性计算得到的面板数据,移除相关配置项
46 lines
918 B
JavaScript
46 lines
918 B
JavaScript
import fs from 'fs'
|
|
import lodash from 'lodash'
|
|
import cfgData from './cfg-lib/cfg-data.js'
|
|
|
|
const _path = process.cwd()
|
|
const _cfgPath = `${_path}/plugins/miao-plugin/components/`
|
|
let cfg = {}
|
|
|
|
try {
|
|
cfg = await cfgData.getCfg()
|
|
cfgData.saveCfg(cfg)
|
|
} catch (e) {
|
|
// do nth
|
|
}
|
|
|
|
let Cfg = {
|
|
get (rote) {
|
|
return lodash.get(cfg, rote)
|
|
},
|
|
set (rote, val) {
|
|
cfg[rote] = val
|
|
cfgData.saveCfg(cfg)
|
|
},
|
|
del (rote) {
|
|
lodash.set(cfg, rote, undefined)
|
|
fs.writeFileSync(_cfgPath + 'cfg.json', JSON.stringify(cfg, null, '\t'))
|
|
},
|
|
getCfg () {
|
|
return cfg
|
|
},
|
|
getCfgSchema () {
|
|
return cfgData.getCfgSchema()
|
|
},
|
|
getCfgSchemaMap () {
|
|
return cfgData.getCfgSchemaMap()
|
|
},
|
|
scale (pct = 1) {
|
|
let scale = Cfg.get('renderScale', 100)
|
|
scale = Math.min(2, Math.max(0.5, scale / 100))
|
|
pct = pct * scale
|
|
return `style=transform:scale(${pct})`
|
|
}
|
|
}
|
|
|
|
export default Cfg
|