diff --git a/gitadora@asphyxia/data/.gitignore b/gitadora@asphyxia/data/.gitignore index fc9251a..6b16f41 100644 --- a/gitadora@asphyxia/data/.gitignore +++ b/gitadora@asphyxia/data/.gitignore @@ -1,5 +1,7 @@ mdb_ex.xml mdb_mt.xml +mdb_nt.xml mdb_ex.b64 mdb_mt.b64 +mdb.nt.b64 custom_mdb.xml \ No newline at end of file diff --git a/gitadora@asphyxia/data/Nextage.ts b/gitadora@asphyxia/data/Nextage.ts new file mode 100644 index 0000000..81d54b1 --- /dev/null +++ b/gitadora@asphyxia/data/Nextage.ts @@ -0,0 +1,58 @@ +import { CommonMusicData, readJSONOrXML, readXML } from './helper'; + +export async function processData() { + const { music } = await readJSONOrXML('data/mdb_nt.json', 'data/mdb_nt.xml', processRawData) + return { + music, + }; +} + +export async function processRawData(path: string): Promise { + const data = await readXML(path) + const mdb = $(data).elements("mdb.mdb_data"); + const music: any[] = []; + for (const m of mdb) { + const d = m.numbers("xg_diff_list"); + const contain = m.numbers("contain_stat"); + const gf = contain[0]; + const dm = contain[1]; + + if (gf == 0 && dm == 0) { + continue; + } + + let type = gf; + if (gf == 0) { + type = dm; + } + + music.push({ + id: K.ITEM('s32', m.number("music_id")), + cont_gf: K.ITEM('bool', gf == 0 ? 0 : 1), + cont_dm: K.ITEM('bool', dm == 0 ? 0 : 1), + is_secret: K.ITEM('bool', 0), + is_hot: K.ITEM('bool', type == 2 ? 0 : 1), + data_ver: K.ITEM('s32', m.number("data_ver")), + diff: K.ARRAY('u16', [ + d[0], + d[1], + d[2], + d[3], + d[4], + d[10], + d[11], + d[12], + d[13], + d[14], + d[5], + d[6], + d[7], + d[8], + d[9], + ]), + }); + } + return { + music, + }; +} diff --git a/gitadora@asphyxia/handlers/MusicList.ts b/gitadora@asphyxia/handlers/MusicList.ts index 50ce39b..6e6f12c 100644 --- a/gitadora@asphyxia/handlers/MusicList.ts +++ b/gitadora@asphyxia/handlers/MusicList.ts @@ -1,6 +1,7 @@ import { getVersion } from "../utils"; import { processData as ExchainMusic } from "../data/Exchain" import { processData as MatixxMusic } from "../data/Matixx" +import { processData as NextageMusic } from "../data/Nextage" import { CommonMusicDataField, readJSONOrXML, readXML } from "../data/helper"; export const playableMusic: EPR = async (info, data, send) => { @@ -60,7 +61,9 @@ export const playableMusic: EPR = async (info, data, send) => { } if (music.length == 0) { - if (version == 'exchain') { + if (version == 'nextage') { + music = _.get(await NextageMusic(), 'music', []); + } else if (version == 'exchain') { music = _.get(await ExchainMusic(), 'music', []); } else { music = _.get(await MatixxMusic(), 'music', []); diff --git a/gitadora@asphyxia/index.ts b/gitadora@asphyxia/index.ts index a34cb42..14339d9 100644 --- a/gitadora@asphyxia/index.ts +++ b/gitadora@asphyxia/index.ts @@ -30,7 +30,7 @@ export function register() { // Helper for register multiple versions. R.Route(`exchain_${method}`, handler); R.Route(`matixx_${method}`, handler); - // TODO: NEXTAGE + R.Route(`nextage_${method}`, handler) // TODO: TB, TBRE and more older version? };