角色相关命令在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 elemTitleMap = {}
let gsCfg
async function init () { async function init () {
let { sysCfg, diyCfg } = await Data.importCfg('character') let { sysCfg, diyCfg } = await Data.importCfg('character')
lodash.forEach([diyCfg.customCharacters, sysCfg.characters], (roleIds) => { lodash.forEach([diyCfg.customCharacters, sysCfg.characters], (roleIds) => {
@ -50,6 +52,9 @@ async function init () {
}) })
}) })
abbrMap = sysCfg.abbr abbrMap = sysCfg.abbr
gsCfg = await Data.importDefault('plugins/genshin/model/gsCfg.js', 'root')
console.log(gsCfg)
} }
await init() await init()
@ -94,6 +99,13 @@ const CharId = {
if (aliasMap[ds]) { if (aliasMap[ds]) {
return ret(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 return false
} }