Fix bootup on login due to missing value

and fix some version correction on save load.
still left to work on save system
This commit is contained in:
DitFranXX 2021-04-26 06:33:46 +09:00
parent 3c941c3b3e
commit 18f05da297
5 changed files with 39 additions and 9 deletions

View File

@ -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<CommonMusicData> {

View File

@ -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<CommonMusicData> {

View File

@ -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<CommonMusicData> {

View File

@ -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;
}

View File

@ -45,6 +45,7 @@ export const check: EPR = async (info, data, send) => {
const playerInfo = await DB.FindOne<PlayerInfo>(refid, {
collection: 'playerinfo',
version
})
if (playerInfo) {
@ -90,6 +91,7 @@ export const getPlayer: EPR = async (info, data, send) => {
const name = await DB.FindOne<PlayerInfo>(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);