2023-10-20 08:59:06 +00:00
|
|
|
import { Data, Meta } from '#miao'
|
2022-09-24 12:19:59 +00:00
|
|
|
import lodash from 'lodash'
|
2022-11-26 21:51:36 +00:00
|
|
|
import { weaponType, abbr, alias, weaponSet } from './meta.js'
|
2022-09-24 12:19:59 +00:00
|
|
|
|
|
|
|
let calc = {}
|
|
|
|
let data = {}
|
|
|
|
|
|
|
|
const step = function (start, step = 0) {
|
|
|
|
if (!step) {
|
|
|
|
step = start / 4
|
|
|
|
}
|
|
|
|
let ret = []
|
|
|
|
for (let idx = 0; idx <= 5; idx++) {
|
|
|
|
ret.push(start + step * idx)
|
|
|
|
}
|
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
2022-11-21 21:26:06 +00:00
|
|
|
const attr = function (key, start, _step) {
|
|
|
|
let refine = {}
|
|
|
|
refine[key] = step(start, _step)
|
|
|
|
return {
|
|
|
|
title: `${key}提高[key]`,
|
|
|
|
isStatic: true,
|
|
|
|
refine
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-24 12:19:59 +00:00
|
|
|
for (let type in weaponType) {
|
|
|
|
// calc
|
2023-03-07 17:52:11 +00:00
|
|
|
let typeCalc = await Data.importDefault(`resources/meta/weapon/${type}/calc.js`, 'miao')
|
2022-11-21 21:26:06 +00:00
|
|
|
let typeRet = typeCalc(step, attr)
|
2022-09-24 12:19:59 +00:00
|
|
|
calc = lodash.extend(calc, typeRet)
|
|
|
|
|
|
|
|
// data
|
2023-10-20 08:59:06 +00:00
|
|
|
let typeData = await Data.readJSON(`resources/meta/weapon/${type}/data.json`, 'miao')
|
2022-09-24 12:19:59 +00:00
|
|
|
lodash.forEach(typeData, (ds) => {
|
|
|
|
data[ds.name] = {
|
2023-02-27 19:20:43 +00:00
|
|
|
id: ds.id,
|
2022-09-24 12:19:59 +00:00
|
|
|
name: ds.name,
|
|
|
|
type,
|
|
|
|
star: ds.star
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-11-26 21:51:36 +00:00
|
|
|
let aliasMap = {}
|
|
|
|
lodash.forEach(alias, (txt, name) => {
|
|
|
|
Data.eachStr(txt, (t) => {
|
|
|
|
aliasMap[t] = name
|
|
|
|
aliasMap[name] = name
|
|
|
|
})
|
|
|
|
})
|
|
|
|
lodash.forEach(abbr, (a, name) => {
|
|
|
|
aliasMap[a] = name
|
|
|
|
})
|
|
|
|
lodash.forEach(data, (ds, name) => {
|
|
|
|
aliasMap[name] = name
|
2023-02-27 19:20:43 +00:00
|
|
|
aliasMap[ds.id] = name
|
2022-11-26 21:51:36 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
export const weaponBuffs = calc
|
|
|
|
export const weaponData = data
|
|
|
|
export const weaponAbbr = abbr
|
|
|
|
export const weaponAlias = aliasMap
|
|
|
|
export { weaponType, weaponSet }
|
2023-10-20 08:59:06 +00:00
|
|
|
|
|
|
|
let meta = Meta.getMeta('gs', 'weapon')
|
|
|
|
meta.addData(data)
|
|
|
|
meta.addAlias(alias)
|
|
|
|
meta.addAbbr(abbr)
|
|
|
|
meta.addCfg({
|
|
|
|
weaponType, weaponSet, weaponBuffs
|
|
|
|
})
|
|
|
|
export default meta
|