Discard old data
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
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',
|
||||
'subskills',
|
||||
'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)
|
||||
@@ -1,38 +0,0 @@
|
||||
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)
|
||||
@@ -1,34 +0,0 @@
|
||||
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)
|
||||
@@ -1,84 +0,0 @@
|
||||
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)
|
||||
@@ -1,44 +0,0 @@
|
||||
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)
|
||||
@@ -1,72 +0,0 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user