Skip to content

Instantly share code, notes, and snippets.

@nogic1008
Created November 15, 2019 01:19
Show Gist options
  • Save nogic1008/43517ac55788d1d6f3c6b76af40b2cd1 to your computer and use it in GitHub Desktop.
Save nogic1008/43517ac55788d1d6f3c6b76af40b2cd1 to your computer and use it in GitHub Desktop.
ddr-song-info memo
export interface Chart {
songId: string
songName: string
playStyle: 1 | 2
difficulty: 0 | 1 | 2 | 3 | 4
level: number
notes: number
freezeArrow: number
shockArrow: number
stream: number
voltage: number
air: number
freeze: number
chaos: number
version: number
}
export interface Song {
id: string
name: string
nameKana: string
nameIndex: number
artist: string
series: string
minBPM: number | null
maxBPM: number | null
version: number
}
const songs: Song[] = [{
"id": "8Il6980di8P89lil1PDIqqIbiq1QO8lQ",
"name": "MAKE IT BETTER",
"nameKana": "MAKE IT BETTER",
"nameIndex": 22,
"artist": "mitsu-O!",
"series": "1st",
"minBPM": 119,
"maxBPM": 119,
"version": 20191109
},
{
"id": "06loOQ0DQb0DqbOibl6qO81qlIdoP9DI",
"name": "PARANOiA",
"nameKana": "PARANOIA",
"nameIndex": 25,
"artist": "180",
"series": "1st",
"minBPM": 180,
"maxBPM": 180,
"version": 20191109
},
{
"id": "Pb9II0oiI9ODQ8OP8IqIPQP9P68biqIi",
"name": "TRIP MACHINE",
"nameKana": "TRIP MACHINE",
"nameIndex": 29,
"artist": "DE-SIRE",
"series": "1st",
"minBPM": 160,
"maxBPM": 160,
"version": 20191109
}]
const charts: Chart[] = [
{
"songId": "8Il6980di8P89lil1PDIqqIbiq1QO8lQ",
"songName": "MAKE IT BETTER",
"playStyle": 1,
"difficulty": 0,
"level": 3,
"notes": 67,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 14,
"voltage": 14,
"air": 9,
"freeze": 0,
"chaos": 0,
"version": 20191109
},
{
"songId": "8Il6980di8P89lil1PDIqqIbiq1QO8lQ",
"songName": "MAKE IT BETTER",
"playStyle": 1,
"difficulty": 1,
"level": 7,
"notes": 143,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 31,
"voltage": 29,
"air": 47,
"freeze": 0,
"chaos": 3,
"version": 20191109
},
{
"songId": "8Il6980di8P89lil1PDIqqIbiq1QO8lQ",
"songName": "MAKE IT BETTER",
"playStyle": 1,
"difficulty": 2,
"level": 9,
"notes": 188,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 41,
"voltage": 39,
"air": 27,
"freeze": 0,
"chaos": 13,
"version": 20191109
},
{
"songId": "8Il6980di8P89lil1PDIqqIbiq1QO8lQ",
"songName": "MAKE IT BETTER",
"playStyle": 1,
"difficulty": 3,
"level": 12,
"notes": 212,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 46,
"voltage": 39,
"air": 54,
"freeze": 0,
"chaos": 19,
"version": 20191109
},
{
"songId": "8Il6980di8P89lil1PDIqqIbiq1QO8lQ",
"songName": "MAKE IT BETTER",
"playStyle": 2,
"difficulty": 1,
"level": 7,
"notes": 130,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 28,
"voltage": 29,
"air": 61,
"freeze": 0,
"chaos": 1,
"version": 20191109
},
{
"songId": "8Il6980di8P89lil1PDIqqIbiq1QO8lQ",
"songName": "MAKE IT BETTER",
"playStyle": 2,
"difficulty": 2,
"level": 9,
"notes": 181,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 40,
"voltage": 39,
"air": 30,
"freeze": 0,
"chaos": 11,
"version": 20191109
},
{
"songId": "8Il6980di8P89lil1PDIqqIbiq1QO8lQ",
"songName": "MAKE IT BETTER",
"playStyle": 2,
"difficulty": 3,
"level": 11,
"notes": 220,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 48,
"voltage": 54,
"air": 27,
"freeze": 0,
"chaos": 41,
"version": 20191109
},
{
"songId": "06loOQ0DQb0DqbOibl6qO81qlIdoP9DI",
"songName": "PARANOiA",
"playStyle": 1,
"difficulty": 0,
"level": 4,
"notes": 138,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 29,
"voltage": 22,
"air": 5,
"freeze": 0,
"chaos": 0,
"version": 20191109
},
{
"songId": "06loOQ0DQb0DqbOibl6qO81qlIdoP9DI",
"songName": "PARANOiA",
"playStyle": 1,
"difficulty": 1,
"level": 8,
"notes": 264,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 56,
"voltage": 44,
"air": 18,
"freeze": 0,
"chaos": 4,
"version": 20191109
},
{
"songId": "06loOQ0DQb0DqbOibl6qO81qlIdoP9DI",
"songName": "PARANOiA",
"playStyle": 1,
"difficulty": 2,
"level": 9,
"notes": 275,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 58,
"voltage": 52,
"air": 49,
"freeze": 0,
"chaos": 6,
"version": 20191109
},
{
"songId": "06loOQ0DQb0DqbOibl6qO81qlIdoP9DI",
"songName": "PARANOiA",
"playStyle": 1,
"difficulty": 3,
"level": 11,
"notes": 319,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 67,
"voltage": 52,
"air": 25,
"freeze": 0,
"chaos": 17,
"version": 20191109
},
{
"songId": "06loOQ0DQb0DqbOibl6qO81qlIdoP9DI",
"songName": "PARANOiA",
"playStyle": 2,
"difficulty": 1,
"level": 8,
"notes": 254,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 54,
"voltage": 37,
"air": 61,
"freeze": 0,
"chaos": 2,
"version": 20191109
},
{
"songId": "06loOQ0DQb0DqbOibl6qO81qlIdoP9DI",
"songName": "PARANOiA",
"playStyle": 2,
"difficulty": 2,
"level": 13,
"notes": 309,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 65,
"voltage": 60,
"air": 56,
"freeze": 0,
"chaos": 13,
"version": 20191109
},
{
"songId": "06loOQ0DQb0DqbOibl6qO81qlIdoP9DI",
"songName": "PARANOiA",
"playStyle": 2,
"difficulty": 3,
"level": 11,
"notes": 382,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 81,
"voltage": 60,
"air": 60,
"freeze": 0,
"chaos": 31,
"version": 20191109
},
{
"songId": "Pb9II0oiI9ODQ8OP8IqIPQP9P68biqIi",
"songName": "TRIP MACHINE",
"playStyle": 1,
"difficulty": 0,
"level": 3,
"notes": 106,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 25,
"voltage": 26,
"air": 5,
"freeze": 0,
"chaos": 0,
"version": 20191109
},
{
"songId": "Pb9II0oiI9ODQ8OP8IqIPQP9P68biqIi",
"songName": "TRIP MACHINE",
"playStyle": 1,
"difficulty": 1,
"level": 8,
"notes": 191,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 47,
"voltage": 40,
"air": 14,
"freeze": 0,
"chaos": 4,
"version": 20191109
},
{
"songId": "Pb9II0oiI9ODQ8OP8IqIPQP9P68biqIi",
"songName": "TRIP MACHINE",
"playStyle": 1,
"difficulty": 2,
"level": 9,
"notes": 211,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 52,
"voltage": 40,
"air": 30,
"freeze": 0,
"chaos": 7,
"version": 20191109
},
{
"songId": "Pb9II0oiI9ODQ8OP8IqIPQP9P68biqIi",
"songName": "TRIP MACHINE",
"playStyle": 1,
"difficulty": 3,
"level": 10,
"notes": 230,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 56,
"voltage": 53,
"air": 36,
"freeze": 0,
"chaos": 12,
"version": 20191109
},
{
"songId": "Pb9II0oiI9ODQ8OP8IqIPQP9P68biqIi",
"songName": "TRIP MACHINE",
"playStyle": 2,
"difficulty": 1,
"level": 9,
"notes": 201,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 49,
"voltage": 40,
"air": 27,
"freeze": 0,
"chaos": 3,
"version": 20191109
},
{
"songId": "Pb9II0oiI9ODQ8OP8IqIPQP9P68biqIi",
"songName": "TRIP MACHINE",
"playStyle": 2,
"difficulty": 2,
"level": 10,
"notes": 215,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 53,
"voltage": 53,
"air": 34,
"freeze": 0,
"chaos": 7,
"version": 20191109
},
{
"songId": "Pb9II0oiI9ODQ8OP8IqIPQP9P68biqIi",
"songName": "TRIP MACHINE",
"playStyle": 2,
"difficulty": 3,
"level": 10,
"notes": 264,
"freezeArrow": 0,
"shockArrow": 0,
"stream": 65,
"voltage": 53,
"air": 27,
"freeze": 0,
"chaos": 25,
"version": 20191109
}
]
songs.forEach((song) => {
const levels: (number | string)[] = []
for (let style: 1 | 2 = 1; style <= 2; style++) {
for (let dif: 0 | 1 | 2 | 3 | 4 = 0; dif <= 4; dif++) {
if (style === 2 && dif === 0) continue
const chart = charts.filter(c => c.songId === song.id && c.playStyle === style && c.difficulty === dif)
if (chart.length > 1) throw new Error('Multiple chart')
levels.push(chart.length === 0 ? '-' : chart[0].level)
}
}
console.log(`|${song.name}|${levels.join('|')}|`)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment