From 18f05da29708f40ae5c69621771a9ffad14da799 Mon Sep 17 00:00:00 2001 From: DitFranXX Date: Mon, 26 Apr 2021 06:33:46 +0900 Subject: [PATCH] Fix bootup on login due to missing value and fix some version correction on save load. still left to work on save system --- gitadora@asphyxia/data/Exchain.ts | 6 +++--- gitadora@asphyxia/data/Matixx.ts | 6 +++--- gitadora@asphyxia/data/Nextage.ts | 6 +++--- gitadora@asphyxia/handlers/info.ts | 13 +++++++++++++ gitadora@asphyxia/handlers/profiles.ts | 17 +++++++++++++++++ 5 files changed, 39 insertions(+), 9 deletions(-) diff --git a/gitadora@asphyxia/data/Exchain.ts b/gitadora@asphyxia/data/Exchain.ts index 99ff8bc..94ea0f6 100644 --- a/gitadora@asphyxia/data/Exchain.ts +++ b/gitadora@asphyxia/data/Exchain.ts @@ -4,9 +4,9 @@ export async function processData() { if (IO.Exists("data/mdb_ex.b64")) { return await readB64JSON("data/mdb_ex.b64"); } - const data = await readJSONOrXML('data/mdb_nt.json', 'data/mdb_nt.xml', processRawData) - // await IO.WriteFile("data/mdb_ex.b64", Buffer.from(JSON.stringify(data)).toString("base64")) - return data + const { music } = await readJSONOrXML('data/mdb_ex.json', 'data/mdb_ex.xml', processRawData) + await IO.WriteFile("data/mdb_ex.b64", Buffer.from(JSON.stringify({music})).toString("base64")) + return { music }; } export async function processRawData(path: string): Promise { diff --git a/gitadora@asphyxia/data/Matixx.ts b/gitadora@asphyxia/data/Matixx.ts index e11a9c4..53ce737 100644 --- a/gitadora@asphyxia/data/Matixx.ts +++ b/gitadora@asphyxia/data/Matixx.ts @@ -4,9 +4,9 @@ export async function processData() { if (IO.Exists("data/mdb_mt.b64")) { return await readB64JSON("data/mdb_mt.b64"); } - const data = await readJSONOrXML('data/mdb_nt.json', 'data/mdb_nt.xml', processRawData) - // await IO.WriteFile("data/mdb_mt.b64", Buffer.from(JSON.stringify(data)).toString("base64")) - return data + const { music } = await readJSONOrXML('data/mdb_mt.json', 'data/mdb_mt.xml', processRawData) + await IO.WriteFile("data/mdb_mt.b64", Buffer.from(JSON.stringify({music})).toString("base64")) + return { music }; } export async function processRawData(path: string): Promise { diff --git a/gitadora@asphyxia/data/Nextage.ts b/gitadora@asphyxia/data/Nextage.ts index 06f695c..4b020a5 100644 --- a/gitadora@asphyxia/data/Nextage.ts +++ b/gitadora@asphyxia/data/Nextage.ts @@ -4,9 +4,9 @@ export async function processData() { if (IO.Exists("data/mdb_nt.b64")) { return await readB64JSON("data/mdb_nt.b64"); } - const data = await readJSONOrXML('data/mdb_nt.json', 'data/mdb_nt.xml', processRawData) - // await IO.WriteFile("data/mdb_nt.b64", Buffer.from(JSON.stringify(data)).toString("base64")) - return data + const { music } = await readJSONOrXML('data/mdb_nt.json', 'data/mdb_nt.xml', processRawData) + await IO.WriteFile("data/mdb_nt.b64", Buffer.from(JSON.stringify({music})).toString("base64")) + return { music }; } export async function processRawData(path: string): Promise { diff --git a/gitadora@asphyxia/handlers/info.ts b/gitadora@asphyxia/handlers/info.ts index f65ff7c..339dbdd 100644 --- a/gitadora@asphyxia/handlers/info.ts +++ b/gitadora@asphyxia/handlers/info.ts @@ -19,6 +19,7 @@ export const gameInfoGet: EPR = async (info, data, send) => { bonus_musicid: K.ITEM('s32', 0), }, bear_fes: {}, + nextadium: {}, }; const time = BigInt(31536000); for (let i = 1; i <= 20; ++i) { @@ -42,6 +43,18 @@ export const gameInfoGet: EPR = async (info, data, send) => { term: K.ITEM('u8', 0), sticker_list: {}, }; + addition['thanksgiving'] = { + ...obj, + box_term: { + state: K.ITEM('u8', 0) + } + }; + addition['lotterybox'] = { + ...obj, + box_term: { + state: K.ITEM('u8', 0) + } + }; } else { addition[`phrase_combo_challenge_${i}`] = obj; } diff --git a/gitadora@asphyxia/handlers/profiles.ts b/gitadora@asphyxia/handlers/profiles.ts index 77ebab8..18c0f20 100644 --- a/gitadora@asphyxia/handlers/profiles.ts +++ b/gitadora@asphyxia/handlers/profiles.ts @@ -45,6 +45,7 @@ export const check: EPR = async (info, data, send) => { const playerInfo = await DB.FindOne(refid, { collection: 'playerinfo', + version }) if (playerInfo) { @@ -90,6 +91,7 @@ export const getPlayer: EPR = async (info, data, send) => { const name = await DB.FindOne(refid, { collection: 'playerinfo', + version }) const dmProfile = await getProfile(refid, version, 'dm') const gfProfile = await getProfile(refid, version, 'gf') @@ -512,6 +514,20 @@ export const getPlayer: EPR = async (info, data, send) => { unlock_status_6: K.ITEM('s32', 0), unlock_status_7: K.ITEM('s32', 0), }, + thanksgiving: { + term: K.ITEM("u8", 0), + score: { + one_day_play_cnt: K.ITEM("s32", 0), + one_day_lottery_cnt: K.ITEM("s32", 0), + lucky_star: K.ITEM("s32", 0), + bear_mark: K.ITEM("s32", 0), + play_date_ms: K.ITEM("u64", BigInt(0)) + }, + lottery_result: { + unlock_bit: K.ITEM("u64", BigInt(0)) + } + }, + lotterybox: {}, ...addition, ...playerData, finish: K.ITEM('bool', 1), @@ -742,6 +758,7 @@ async function registerUser(refid: string, version: string, id = _.random(0, 999 export const savePlayer: EPR = async (info, data, send) => { const refid = $(data).str('player.refid'); if (!refid) return send.deny(); + console.debug(JSON.stringify(data.obj, null, 4)) const no = getPlayerNo(data); const version = getVersion(info);