Convert data to yaml
This commit is contained in:
Generated
+5977
-40
File diff suppressed because it is too large
Load Diff
+3
-1
@@ -15,7 +15,8 @@
|
|||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-indiana-drag-scroll": "^2.1.0",
|
"react-indiana-drag-scroll": "^2.1.0",
|
||||||
"theme-ui": "^0.12.1"
|
"theme-ui": "^0.12.1",
|
||||||
|
"yaml": "^2.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node-fetch": "^2.6.1",
|
"@types/node-fetch": "^2.6.1",
|
||||||
@@ -29,6 +30,7 @@
|
|||||||
"http-server": "^14.1.0",
|
"http-server": "^14.1.0",
|
||||||
"node-fetch": "^2.6.7",
|
"node-fetch": "^2.6.7",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
|
"sort-keys": "^4.2.0",
|
||||||
"ts-node": "^10.4.0",
|
"ts-node": "^10.4.0",
|
||||||
"typescript": "^4.5.2"
|
"typescript": "^4.5.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
export function runScript(method: () => Promise<void>) {
|
||||||
|
return method()
|
||||||
|
.then(() => {
|
||||||
|
process.exit(0)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error)
|
||||||
|
process.exit(1)
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import { runScript } from '../lib/utils'
|
||||||
|
import { listBattlesuits } from '../../server/data/honkai3rd/battlesuits'
|
||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
import yaml from 'yaml'
|
||||||
|
import sortKeys from 'sort-keys'
|
||||||
|
|
||||||
|
const order = [
|
||||||
|
'id',
|
||||||
|
'version',
|
||||||
|
'name',
|
||||||
|
'krName',
|
||||||
|
'type',
|
||||||
|
'valkyrie',
|
||||||
|
'features',
|
||||||
|
'equipment',
|
||||||
|
'leader',
|
||||||
|
'passive',
|
||||||
|
'evasion',
|
||||||
|
'special',
|
||||||
|
'ultimate',
|
||||||
|
'basic',
|
||||||
|
'sp',
|
||||||
|
'core',
|
||||||
|
'description',
|
||||||
|
'krDescription',
|
||||||
|
'requiredRank',
|
||||||
|
]
|
||||||
|
|
||||||
|
async function migrateBattlesuits() {
|
||||||
|
const battlesuits = listBattlesuits()
|
||||||
|
const newDataDir = path.join(__dirname, '../../../data/honkai3rd')
|
||||||
|
|
||||||
|
const sortedData = sortKeys(battlesuits, {
|
||||||
|
deep: true,
|
||||||
|
compare: (a, b) => {
|
||||||
|
return order.indexOf(a) - order.indexOf(b)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(newDataDir, 'battlesuits.yaml'),
|
||||||
|
yaml.stringify(sortedData)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
runScript(migrateBattlesuits)
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import { runScript } from '../lib/utils'
|
||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
import yaml from 'yaml'
|
||||||
|
import sortKeys from 'sort-keys'
|
||||||
|
import { listElfs } from '../../server/data/honkai3rd/elfs'
|
||||||
|
|
||||||
|
const order = [
|
||||||
|
'id',
|
||||||
|
'version',
|
||||||
|
'name',
|
||||||
|
'krName',
|
||||||
|
'baseRank',
|
||||||
|
'features',
|
||||||
|
'skillRows',
|
||||||
|
'type',
|
||||||
|
'description',
|
||||||
|
'krDescription',
|
||||||
|
'requiredRank',
|
||||||
|
]
|
||||||
|
|
||||||
|
async function migrateElfs() {
|
||||||
|
const elfs = listElfs()
|
||||||
|
const newDataDir = path.join(__dirname, '../../../data/honkai3rd')
|
||||||
|
|
||||||
|
const sortedData = sortKeys(elfs, {
|
||||||
|
deep: true,
|
||||||
|
compare: (a, b) => {
|
||||||
|
return order.indexOf(a) - order.indexOf(b)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(newDataDir, 'elfs.yaml'),
|
||||||
|
yaml.stringify(sortedData)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
runScript(migrateElfs)
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { runScript } from '../lib/utils'
|
||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
import yaml from 'yaml'
|
||||||
|
import sortKeys from 'sort-keys'
|
||||||
|
import { getRemembranceSigils } from '../../server/data/honkai3rd/elysianRealm'
|
||||||
|
|
||||||
|
const order = ['id', 'name', 'krName', 'description', 'krDescription']
|
||||||
|
|
||||||
|
async function migrateErSigils() {
|
||||||
|
const sigils = getRemembranceSigils()
|
||||||
|
const krSigils = getRemembranceSigils('ko-KR')
|
||||||
|
const merged = sigils.map((sigil, index) => {
|
||||||
|
return {
|
||||||
|
...sigil,
|
||||||
|
krName: krSigils[index].name,
|
||||||
|
krDescription: krSigils[index].description,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const newDataDir = path.join(__dirname, '../../../data/honkai3rd')
|
||||||
|
|
||||||
|
const sortedData = sortKeys(merged, {
|
||||||
|
deep: true,
|
||||||
|
compare: (a, b) => {
|
||||||
|
return order.indexOf(a) - order.indexOf(b)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(newDataDir, 'er-sigils.yaml'),
|
||||||
|
yaml.stringify(sortedData)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
runScript(migrateErSigils)
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
import { runScript } from '../lib/utils'
|
||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
import yaml from 'yaml'
|
||||||
|
import sortKeys from 'sort-keys'
|
||||||
|
import {
|
||||||
|
signetGroupMap,
|
||||||
|
krSignetGroupMap,
|
||||||
|
} from '../../server/data/honkai3rd/elysianRealm'
|
||||||
|
|
||||||
|
const order = [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'krName',
|
||||||
|
'altName',
|
||||||
|
'krAltName',
|
||||||
|
'description',
|
||||||
|
'krDescription',
|
||||||
|
'sets',
|
||||||
|
'signets',
|
||||||
|
'upgrades',
|
||||||
|
]
|
||||||
|
|
||||||
|
async function migrateErSupports() {
|
||||||
|
const newDataDir = path.join(__dirname, '../../../data/honkai3rd')
|
||||||
|
|
||||||
|
const groupMap = Object.entries(signetGroupMap).reduce(
|
||||||
|
(map, [key, group]) => {
|
||||||
|
const sets = group.sets.map((set, index) => {
|
||||||
|
const signets = set.signets.map((signet, signetIndex) => {
|
||||||
|
const upgrades = signet.upgrades.map((upgrade, upgradeIndex) => {
|
||||||
|
return {
|
||||||
|
...upgrade,
|
||||||
|
krName:
|
||||||
|
krSignetGroupMap[key].sets[index].signets[signetIndex].upgrades[
|
||||||
|
upgradeIndex
|
||||||
|
].name,
|
||||||
|
krDescription:
|
||||||
|
krSignetGroupMap[key].sets[index].signets[signetIndex].upgrades[
|
||||||
|
upgradeIndex
|
||||||
|
].description,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
...signet,
|
||||||
|
krName: krSignetGroupMap[key].sets[index].signets[signetIndex].name,
|
||||||
|
krDescription:
|
||||||
|
krSignetGroupMap[key].sets[index].signets[signetIndex]
|
||||||
|
.description,
|
||||||
|
upgrades,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
...set,
|
||||||
|
krName: krSignetGroupMap[key].sets[index].name,
|
||||||
|
signets,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
map[key] = {
|
||||||
|
...group,
|
||||||
|
krName: krSignetGroupMap[key].name,
|
||||||
|
krAltName: krSignetGroupMap[key].altName,
|
||||||
|
sets,
|
||||||
|
}
|
||||||
|
return map
|
||||||
|
},
|
||||||
|
{} as any
|
||||||
|
)
|
||||||
|
|
||||||
|
const sortedData = sortKeys(groupMap, {
|
||||||
|
deep: true,
|
||||||
|
compare: (a, b) => {
|
||||||
|
return order.indexOf(a) - order.indexOf(b)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(newDataDir, 'er-signets.yaml'),
|
||||||
|
yaml.stringify(sortedData)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
runScript(migrateErSupports)
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import { runScript } from '../lib/utils'
|
||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
import yaml from 'yaml'
|
||||||
|
import sortKeys from 'sort-keys'
|
||||||
|
import { getSupportBattlesuits } from '../../server/data/honkai3rd/elysianRealm'
|
||||||
|
|
||||||
|
const order = [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'krName',
|
||||||
|
'skillName',
|
||||||
|
'krSkillName',
|
||||||
|
'cooldown',
|
||||||
|
'description',
|
||||||
|
'krDescription',
|
||||||
|
]
|
||||||
|
|
||||||
|
async function migrateErSupports() {
|
||||||
|
const supports = getSupportBattlesuits()
|
||||||
|
const krSupports = getSupportBattlesuits('ko-KR')
|
||||||
|
const merged = supports.map((sigil, index) => {
|
||||||
|
return {
|
||||||
|
...sigil,
|
||||||
|
krName: krSupports[index].name,
|
||||||
|
krSkillName: krSupports[index].skillName,
|
||||||
|
krDescription: krSupports[index].description,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const newDataDir = path.join(__dirname, '../../../data/honkai3rd')
|
||||||
|
|
||||||
|
const sortedData = sortKeys(merged, {
|
||||||
|
deep: true,
|
||||||
|
compare: (a, b) => {
|
||||||
|
return order.indexOf(a) - order.indexOf(b)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(newDataDir, 'er-supports.yaml'),
|
||||||
|
yaml.stringify(sortedData)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
runScript(migrateErSupports)
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import { runScript } from '../lib/utils'
|
||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
import yaml from 'yaml'
|
||||||
|
import { listStigmataSet } from '../../server/data/honkai3rd/stigmata'
|
||||||
|
import sortKeys from 'sort-keys'
|
||||||
|
|
||||||
|
const order = [
|
||||||
|
'id',
|
||||||
|
'version',
|
||||||
|
'name',
|
||||||
|
'krName',
|
||||||
|
'altName',
|
||||||
|
'krAltName',
|
||||||
|
'type',
|
||||||
|
'rarity',
|
||||||
|
'twoSetSkill',
|
||||||
|
'threeSetSkill',
|
||||||
|
'description',
|
||||||
|
'krDescription',
|
||||||
|
]
|
||||||
|
|
||||||
|
async function migrateStigmataSets() {
|
||||||
|
const stigmataSetList = listStigmataSet()
|
||||||
|
const newDataDir = path.join(__dirname, '../../../data/honkai3rd')
|
||||||
|
|
||||||
|
const sortedData = sortKeys(stigmataSetList, {
|
||||||
|
deep: true,
|
||||||
|
compare: (a, b) => {
|
||||||
|
return order.indexOf(a) - order.indexOf(b)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(newDataDir, 'stigmata-sets.yaml'),
|
||||||
|
yaml.stringify(sortedData)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
runScript(migrateStigmataSets)
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { runScript } from '../lib/utils'
|
||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
import yaml from 'yaml'
|
||||||
|
import { listStigmata } from '../../server/data/honkai3rd/stigmata'
|
||||||
|
import sortKeys from 'sort-keys'
|
||||||
|
|
||||||
|
const order = [
|
||||||
|
'id',
|
||||||
|
'version',
|
||||||
|
'name',
|
||||||
|
'krName',
|
||||||
|
'type',
|
||||||
|
'rarity',
|
||||||
|
'hp',
|
||||||
|
'atk',
|
||||||
|
'def',
|
||||||
|
'crt',
|
||||||
|
'set',
|
||||||
|
'skill',
|
||||||
|
'description',
|
||||||
|
'krDescription',
|
||||||
|
]
|
||||||
|
|
||||||
|
async function migrateStigmata() {
|
||||||
|
const stigmataList = listStigmata()
|
||||||
|
const newDataDir = path.join(__dirname, '../../../data/honkai3rd')
|
||||||
|
|
||||||
|
const sortedData = sortKeys(stigmataList, {
|
||||||
|
deep: true,
|
||||||
|
compare: (a, b) => {
|
||||||
|
return order.indexOf(a) - order.indexOf(b)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(newDataDir, 'stigmata.yaml'),
|
||||||
|
yaml.stringify(sortedData)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
runScript(migrateStigmata)
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import { runScript } from '../lib/utils'
|
||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
import yaml from 'yaml'
|
||||||
|
import sortKeys from 'sort-keys'
|
||||||
|
import { listVersionData } from '../../server/data/honkai3rd/versions'
|
||||||
|
import { listSupplyEventsByVersion } from '../../server/data/honkai3rd/supplyEvents'
|
||||||
|
|
||||||
|
const order = [
|
||||||
|
'id',
|
||||||
|
'version',
|
||||||
|
'name',
|
||||||
|
'krName',
|
||||||
|
'duration',
|
||||||
|
'newBattlesuits',
|
||||||
|
'newWeapons',
|
||||||
|
'description',
|
||||||
|
'supplyEvents',
|
||||||
|
'track',
|
||||||
|
'verified',
|
||||||
|
'featured',
|
||||||
|
'others',
|
||||||
|
]
|
||||||
|
|
||||||
|
async function migrateVersions() {
|
||||||
|
const versions = listVersionData()
|
||||||
|
const newDataDir = path.join(__dirname, '../../../data/honkai3rd')
|
||||||
|
|
||||||
|
const merged = versions.map((version) => {
|
||||||
|
return {
|
||||||
|
...version,
|
||||||
|
supplyEvents: listSupplyEventsByVersion(version.version).map((event) => {
|
||||||
|
return {
|
||||||
|
track: event.track,
|
||||||
|
name: event.name,
|
||||||
|
verified: event.verified,
|
||||||
|
featured: event.featured,
|
||||||
|
duration: event.duration,
|
||||||
|
others:
|
||||||
|
(event as any).drops != null
|
||||||
|
? (event as any).drops
|
||||||
|
.map((drop: any) => {
|
||||||
|
const item = drop.items[0]
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
type: item.type,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter((item: any) => {
|
||||||
|
return !event.featured.some(({ id }) => item.id === id)
|
||||||
|
})
|
||||||
|
: (event as any).others != null
|
||||||
|
? (event as any).others
|
||||||
|
: [],
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const sortedData = sortKeys(merged, {
|
||||||
|
deep: true,
|
||||||
|
compare: (a, b) => {
|
||||||
|
return order.indexOf(a) - order.indexOf(b)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(newDataDir, 'versions.yaml'),
|
||||||
|
yaml.stringify(sortedData)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
runScript(migrateVersions)
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { runScript } from '../lib/utils'
|
||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
import yaml from 'yaml'
|
||||||
|
import sortKeys from 'sort-keys'
|
||||||
|
import { listWeapons } from '../../server/data/honkai3rd/weapons'
|
||||||
|
|
||||||
|
const order = [
|
||||||
|
'id',
|
||||||
|
'version',
|
||||||
|
'name',
|
||||||
|
'krName',
|
||||||
|
'category',
|
||||||
|
'rarity',
|
||||||
|
'atk',
|
||||||
|
'crt',
|
||||||
|
'battlesuits',
|
||||||
|
'originalWeapons',
|
||||||
|
'sources',
|
||||||
|
'skills',
|
||||||
|
'description',
|
||||||
|
'krDescription',
|
||||||
|
]
|
||||||
|
|
||||||
|
async function migrateWeapons() {
|
||||||
|
const weapons = listWeapons()
|
||||||
|
const newDataDir = path.join(__dirname, '../../../data/honkai3rd')
|
||||||
|
|
||||||
|
const sortedData = sortKeys(weapons, {
|
||||||
|
deep: true,
|
||||||
|
compare: (a, b) => {
|
||||||
|
return order.indexOf(a) - order.indexOf(b)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(newDataDir, 'weapons.yaml'),
|
||||||
|
yaml.stringify(sortedData)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
runScript(migrateWeapons)
|
||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
} from '../../../lib/honkai3rd/elysianRealm'
|
} from '../../../lib/honkai3rd/elysianRealm'
|
||||||
import { getBattlesuitById } from './battlesuits'
|
import { getBattlesuitById } from './battlesuits'
|
||||||
|
|
||||||
const signetGroupMap = signetGroups.reduce<{
|
export const signetGroupMap = signetGroups.reduce<{
|
||||||
[key: string]: PopulatedSignetGroup
|
[key: string]: PopulatedSignetGroup
|
||||||
}>((map, group) => {
|
}>((map, group) => {
|
||||||
let populatedGroup = map[group.id]
|
let populatedGroup = map[group.id]
|
||||||
@@ -59,7 +59,7 @@ const signetGroupMap = signetGroups.reduce<{
|
|||||||
return map
|
return map
|
||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
const krSignetGroupMap = signetGroups.reduce<{
|
export const krSignetGroupMap = signetGroups.reduce<{
|
||||||
[key: string]: PopulatedSignetGroup
|
[key: string]: PopulatedSignetGroup
|
||||||
}>((map, group) => {
|
}>((map, group) => {
|
||||||
let populatedGroup = map[group.id]
|
let populatedGroup = map[group.id]
|
||||||
|
|||||||
Reference in New Issue
Block a user