miao-plugin/resources/meta/weapon/index.js

54 lines
1.1 KiB
JavaScript
Raw Normal View History

2023-10-20 08:59:06 +00:00
import { Data, Meta } from '#miao'
import lodash from 'lodash'
2022-11-26 21:51:36 +00:00
import { weaponType, abbr, alias, weaponSet } from './meta.js'
let weaponBuffs = {}
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
}
const attr = function (key, start, _step) {
let refine = {}
refine[key] = step(start, _step)
return {
title: `${key}提高[key]`,
isStatic: true,
refine
}
}
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')
let typeRet = typeCalc(step, attr)
weaponBuffs = lodash.extend(weaponBuffs, typeRet)
// data
2023-10-20 08:59:06 +00:00
let typeData = await Data.readJSON(`resources/meta/weapon/${type}/data.json`, 'miao')
lodash.forEach(typeData, (ds) => {
data[ds.name] = {
2023-02-27 19:20:43 +00:00
id: ds.id,
name: ds.name,
type,
star: ds.star
}
})
}
let meta = Meta.create('gs', 'weapon')
2023-10-20 08:59:06 +00:00
meta.addData(data)
meta.addAlias(alias)
meta.addAbbr(abbr)
meta.addMeta({
2023-10-20 08:59:06 +00:00
weaponType, weaponSet, weaponBuffs
})