miao-plugin/resources/meta-gs/character/index.js

54 lines
1.3 KiB
JavaScript
Raw Normal View History

import lodash from 'lodash'
2023-10-19 20:18:30 +00:00
import { Data, Meta } from '#miao'
import { alias } from './alias.js'
import { extraChars, wifeCfg } from './extra.js'
2023-10-19 20:18:30 +00:00
2023-10-24 19:34:36 +00:00
let data = Data.readJSON('resources/meta-gs/character/data.json', 'miao')
let meta = Meta.create('gs', 'char')
2023-10-20 08:59:06 +00:00
meta.addData(data)
meta.addAlias(alias)
2024-07-04 10:50:36 +00:00
// 导入主角天赋对应元素,以据此判断主角元素
let travelers = ["荧", "空", "旅行者"]
travelers.forEach(name => {
meta.addDataItem(
meta.getId(name),
Data.readJSON(`resources/meta-gs/character/${name}/data.json`, 'miao')
)
})
// 添加自定义角色
lodash.forEach(extraChars, (alias, char) => {
meta.addDataItem(char, {
id: char,
name: char
})
})
// 添加自定义角色别名
meta.addAlias(extraChars)
// 添加老婆设置
let wifeData = {}
2024-04-24 10:43:55 +00:00
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
}
})
})
2024-04-24 10:43:55 +00:00
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 })