From 1c408d84c4ebd5bdf3ca6e0f32ecaab0f4482608 Mon Sep 17 00:00:00 2001 From: cracrayol Date: Wed, 28 Sep 2022 18:36:10 +0200 Subject: [PATCH] Lapistoria+ : Add force unlock option --- popn@asphyxia/handler/eclale.ts | 12 ++++++++++++ popn@asphyxia/handler/lapistoria.ts | 12 ++++++++++++ popn@asphyxia/handler/usaneko.ts | 12 ++++++++++++ popn@asphyxia/index.ts | 7 +++++++ 4 files changed, 43 insertions(+) diff --git a/popn@asphyxia/handler/eclale.ts b/popn@asphyxia/handler/eclale.ts index 9335b2a..0054121 100644 --- a/popn@asphyxia/handler/eclale.ts +++ b/popn@asphyxia/handler/eclale.ts @@ -369,6 +369,18 @@ const getProfile = async (refid: string, name?: string) => { player.item.push(item); } + if(U.GetConfig("enable_force_unlock")) { + for(let i = 1; i <= GAME_MAX_MUSIC_ID; i++) { + player.item.push({ + type: K.ITEM('u8', 0), + id: K.ITEM('u16', i), + param: K.ITEM('u16', 15), + is_new: K.ITEM('bool', 0), + get_time: K.ITEM('u64', BigInt(0)), + }); + } + } + // Add version specific datas const params = await utils.readParams(refid, version); utils.addExtraData(player, params, extraData); diff --git a/popn@asphyxia/handler/lapistoria.ts b/popn@asphyxia/handler/lapistoria.ts index 6111600..4c27699 100644 --- a/popn@asphyxia/handler/lapistoria.ts +++ b/popn@asphyxia/handler/lapistoria.ts @@ -275,6 +275,18 @@ const getProfile = async (refid: string, name?: string) => { player.item.push(item); } + if(U.GetConfig("enable_force_unlock")) { + for(let i = 1; i <= GAME_MAX_MUSIC_ID; i++) { + player.item.push({ + type: K.ITEM('u8', 0), + id: K.ITEM('u16', i), + param: K.ITEM('u16', 15), + is_new: K.ITEM('bool', 0), + get_time: K.ITEM('u64', BigInt(0)), + }); + } + } + // Add version specific datas const params = await utils.readParams(refid, version); utils.addExtraData(player, params, extraData); diff --git a/popn@asphyxia/handler/usaneko.ts b/popn@asphyxia/handler/usaneko.ts index 5ea9683..5354670 100644 --- a/popn@asphyxia/handler/usaneko.ts +++ b/popn@asphyxia/handler/usaneko.ts @@ -462,6 +462,18 @@ const getProfile = async (refid: string, version: string, name?: string) => { }); } + if(U.GetConfig("enable_force_unlock")) { + for(let i = 1; i <= GAME_MAX_MUSIC_ID[version]; i++) { + player.item.push({ + type: K.ITEM('u8', 0), + id: K.ITEM('u16', i), + param: K.ITEM('u16', 15), + is_new: K.ITEM('bool', 0), + get_time: K.ITEM('u64', BigInt(0)), + }); + } + } + // Usaneko events if (version == 'v24') { const date = new Date(); diff --git a/popn@asphyxia/index.ts b/popn@asphyxia/index.ts index d5f5839..b7d5800 100644 --- a/popn@asphyxia/index.ts +++ b/popn@asphyxia/index.ts @@ -30,6 +30,13 @@ export function register() { default: true, }); + R.Config("enable_force_unlock", { + name: "Unlock all songs", + desc: "Force unlocking all songs (Lapistoria and later).", + type: "boolean", + default: true, + }); + R.WebUIEvent('importPnmData', importPnmData); R.WebUIEvent('updatePnmPlayerInfo', async (data: any) => {