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'
|
2023-10-23 14:14:09 +00:00
|
|
|
import { descFix } from './desc.js'
|
2022-09-24 12:19:59 +00:00
|
|
|
|
2023-10-21 18:54:45 +00:00
|
|
|
let weaponBuffs = {}
|
2022-09-24 12:19:59 +00:00
|
|
|
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)
|
2023-10-21 18:54:45 +00:00
|
|
|
weaponBuffs = lodash.extend(weaponBuffs, typeRet)
|
2022-09-24 12:19:59 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-10-21 18:54:45 +00:00
|
|
|
let meta = Meta.create('gs', 'weapon')
|
2023-10-20 08:59:06 +00:00
|
|
|
meta.addData(data)
|
|
|
|
meta.addAlias(alias)
|
|
|
|
meta.addAbbr(abbr)
|
2023-10-21 18:54:45 +00:00
|
|
|
meta.addMeta({
|
2023-10-23 14:14:09 +00:00
|
|
|
weaponType, weaponSet, weaponBuffs, descFix
|
2023-10-20 08:59:06 +00:00
|
|
|
})
|