From 74d9d2f6ab5fca19375c6cd1bef48f0600e7e39d Mon Sep 17 00:00:00 2001 From: tyam Date: Mon, 20 Jan 2025 23:00:25 -0600 Subject: [PATCH] Protect profile from unilab deco force unlock Avoid progression lockout if deco parts are unintentionally force unlocked and updated in the achievements table for pop'n Unilab --- bemani/backend/popn/unilab.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/bemani/backend/popn/unilab.py b/bemani/backend/popn/unilab.py index d251795..09931de 100644 --- a/bemani/backend/popn/unilab.py +++ b/bemani/backend/popn/unilab.py @@ -535,6 +535,7 @@ class PopnMusicUnilab(PopnMusicModernBase): def unformat_profile(self, userid: UserID, request: Node, oldprofile: Profile) -> Profile: newprofile = super().unformat_profile(userid, request, oldprofile) + game_config = self.get_game_config() account = request.child("account") if account is not None: newprofile.replace_int("card_again_count", account.child_value("card_again_count")) @@ -624,17 +625,18 @@ class PopnMusicUnilab(PopnMusicModernBase): energy = battery_data.child_value("energy") is_cleared = battery_data.child_value("is_cleared") - self.data.local.user.put_achievement( - self.game, - self.version, - userid, - battery_id, - "battery", - { - "battery_id": battery_id, - "energy": energy, - "is_cleared": is_cleared, - }, - ) + if not game_config.get_bool("force_unlock_deco"): + self.data.local.user.put_achievement( + self.game, + self.version, + userid, + battery_id, + "battery", + { + "battery_id": battery_id, + "energy": energy, + "is_cleared": is_cleared, + }, + ) return newprofile