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
This commit is contained in:
tyam 2025-01-20 23:00:25 -06:00
parent 398188189c
commit 74d9d2f6ab

View File

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