2022-09-24 12:19:59 +00:00
|
|
|
import { Data } from '../../../components/index.js'
|
|
|
|
import lodash from 'lodash'
|
|
|
|
import { weaponType, abbr } from './meta.js'
|
|
|
|
|
|
|
|
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
|
|
|
|
let typeCalc = await Data.importDefault(`resources/meta/weapon/${type}/calc.js`)
|
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
|
|
|
|
let typeData = await Data.readJSON(`resources/meta/weapon/${type}/data.json`)
|
|
|
|
lodash.forEach(typeData, (ds) => {
|
|
|
|
data[ds.name] = {
|
|
|
|
name: ds.name,
|
|
|
|
type,
|
|
|
|
star: ds.star
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export { abbr, weaponType, calc, data }
|