2023-05-16 05:04:43 +00:00
|
|
|
import { Data } from '#miao'
|
|
|
|
import lodash from 'lodash'
|
2023-10-13 10:25:21 +00:00
|
|
|
import { abbr, alias } from './meta.js'
|
2023-05-16 05:04:43 +00:00
|
|
|
|
2023-05-20 13:51:44 +00:00
|
|
|
const types = '存护,丰饶,毁灭,同谐,虚无,巡猎,智识'.split(',')
|
|
|
|
|
|
|
|
|
2023-05-16 05:04:43 +00:00
|
|
|
let data = Data.readJSON('/resources/meta-sr/weapon/data.json', 'miao')
|
|
|
|
let aliasMap = {}
|
|
|
|
|
|
|
|
lodash.forEach(data, (ds) => {
|
|
|
|
aliasMap[ds.id] = ds.id
|
|
|
|
aliasMap[ds.name] = ds.id
|
|
|
|
})
|
2023-10-13 10:25:21 +00:00
|
|
|
lodash.forEach(alias, (name, alias) => {
|
|
|
|
if (aliasMap[name]) {
|
|
|
|
aliasMap[alias] = aliasMap[name]
|
|
|
|
}
|
|
|
|
})
|
2023-05-16 05:04:43 +00:00
|
|
|
|
|
|
|
export const weaponAlias = aliasMap
|
2023-05-20 13:51:44 +00:00
|
|
|
export const weaponData = data
|
|
|
|
|
|
|
|
const weaponBuffs = {}
|
|
|
|
|
|
|
|
let loadBuffs = async function () {
|
|
|
|
for (let type of types) {
|
|
|
|
let calc = await Data.importDefault(`/resources/meta-sr/weapon/${type}/calc.js`, 'miao')
|
|
|
|
if (lodash.isFunction(calc)) {
|
|
|
|
calc = calc((idx, key) => {
|
|
|
|
return {
|
|
|
|
isStatic: true,
|
|
|
|
idx,
|
|
|
|
key
|
|
|
|
}
|
2023-05-22 19:19:45 +00:00
|
|
|
}, (title, key, idx) => {
|
2023-05-23 19:30:30 +00:00
|
|
|
if (lodash.isPlainObject(key)) {
|
2023-05-22 19:19:45 +00:00
|
|
|
return (tables) => {
|
|
|
|
let data = {}
|
|
|
|
lodash.forEach(key, (idx, k) => {
|
|
|
|
data[k] = tables[idx]
|
|
|
|
})
|
|
|
|
return {
|
|
|
|
title,
|
|
|
|
data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return {
|
|
|
|
title,
|
|
|
|
idx,
|
|
|
|
key
|
|
|
|
}
|
2023-05-21 18:13:38 +00:00
|
|
|
}
|
2023-05-20 13:51:44 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
lodash.forEach(calc, (ds, key) => {
|
|
|
|
let id = aliasMap[key]
|
|
|
|
weaponBuffs[id] = ds
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await loadBuffs()
|
|
|
|
|
2023-10-13 10:25:21 +00:00
|
|
|
export { weaponBuffs }
|