角色相关命令在V3下会使用V3的角色别名一同查询

This commit is contained in:
yoimiya-kokomi 2022-10-03 04:02:18 +08:00
parent cddabfa913
commit c103d680f0

View File

@ -17,6 +17,8 @@ let elemMap = {}
// 元素名
let elemTitleMap = {}
let gsCfg
async function init () {
let { sysCfg, diyCfg } = await Data.importCfg('character')
lodash.forEach([diyCfg.customCharacters, sysCfg.characters], (roleIds) => {
@ -50,6 +52,9 @@ async function init () {
})
})
abbrMap = sysCfg.abbr
gsCfg = await Data.importDefault('plugins/genshin/model/gsCfg.js', 'root')
console.log(gsCfg)
}
await init()
@ -94,6 +99,13 @@ const CharId = {
if (aliasMap[ds]) {
return ret(aliasMap[ds])
}
// 调用V3方法匹配
if (gsCfg && gsCfg.getRole) {
let roleRet = gsCfg.getRole(ds)
if (roleRet.name && aliasMap[roleRet.name]) {
return ret(aliasMap[roleRet.name])
}
}
// 无匹配结果
return false
}