feat: 添加批处理设置功能
- 新增 batchSetting.js 文件,实现批量生成配置的功能 - 在 .gitignore 中添加 dist/ 目录,避免生成的文件被提交到仓库
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@ package-lock.json
|
|||||||
/node_modules/
|
/node_modules/
|
||||||
config.xml
|
config.xml
|
||||||
/dist.zip
|
/dist.zip
|
||||||
|
dist/
|
||||||
|
|||||||
77
batchSetting.js
Normal file
77
batchSetting.js
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
const fs = require('fs')
|
||||||
|
const key = "SpecialRing.config"
|
||||||
|
const values = [56, 100]
|
||||||
|
const interval = [1, 100]
|
||||||
|
const num = 45
|
||||||
|
const start = () => {
|
||||||
|
const template = ` "S1": {
|
||||||
|
"attr": [
|
||||||
|
{
|
||||||
|
"value": S2,
|
||||||
|
"type": 75
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": 10000,
|
||||||
|
"type": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": 428,
|
||||||
|
"type": 76
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": 536,
|
||||||
|
"type": 77
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": 55,
|
||||||
|
"type": 21
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": 55,
|
||||||
|
"type": 23
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": 55,
|
||||||
|
"type": 25
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": 55,
|
||||||
|
"type": 27
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": 5000,
|
||||||
|
"type": 83
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lv": S1,
|
||||||
|
"cost": [
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"type": 2,
|
||||||
|
"count": 300000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"type": 4,
|
||||||
|
"count": 500
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 1018,
|
||||||
|
"type": 0,
|
||||||
|
"count": 1000
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pos": 4
|
||||||
|
}`
|
||||||
|
const getStr = (index) => {
|
||||||
|
let str = template
|
||||||
|
values.forEach((v, i) => {
|
||||||
|
const reg = new RegExp(`S${i + 1}`, 'g')
|
||||||
|
str = str.replace(reg, v + index * interval[i])
|
||||||
|
})
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
const content = Array(num).fill(1).map((e,i)=>`${getStr(i)}`).join(',')
|
||||||
|
fs.writeFileSync(`./dist/${key}.txt`, content)
|
||||||
|
}
|
||||||
|
start()
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user