mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-25 01:21:55 +00:00
45 lines
1.0 KiB
JavaScript
45 lines
1.0 KiB
JavaScript
import lodash from 'lodash'
|
|
import { Data, Meta } from '#miao'
|
|
import { alias } from './alias.js'
|
|
import { extraChars, wifeCfg } from './extra.js'
|
|
|
|
let data = Data.readJSON('resources/meta-gs/character/data.json', 'miao')
|
|
let meta = Meta.create('gs', 'char')
|
|
|
|
meta.addData(data)
|
|
meta.addAlias(alias)
|
|
|
|
// 添加自定义角色
|
|
lodash.forEach(extraChars, (alias, char) => {
|
|
meta.addDataItem(char, {
|
|
id: char,
|
|
name: char
|
|
})
|
|
})
|
|
// 添加自定义角色别名
|
|
meta.addAlias(extraChars)
|
|
|
|
// 添加老婆设置
|
|
let wifeData = {}
|
|
let { diyCfg } = await Data.importCfg('character')
|
|
let diyWifeData = diyCfg.wifeData || {}
|
|
lodash.forEach(wifeCfg, (txt, type) => {
|
|
wifeData[type] = wifeData[type] || {}
|
|
Data.eachStr(txt, (name) => {
|
|
let id = meta.getId(name)
|
|
if (id) {
|
|
wifeData[type][id] = true
|
|
}
|
|
})
|
|
})
|
|
lodash.forEach(diyWifeData, (txt, type) => {
|
|
wifeData[type] = wifeData[type] || {}
|
|
Data.eachStr(txt, (name) => {
|
|
let id = meta.getId(name)
|
|
if (id) {
|
|
wifeData[type][id] = true
|
|
}
|
|
})
|
|
})
|
|
meta.addMeta({ wifeData })
|