1
0
mirror of synced 2024-11-27 23:50:47 +01:00

Make cardmgr change local to Pop'n Music.

This commit is contained in:
Jennifer Taylor 2021-09-03 04:54:35 +00:00
parent b8fb4adcb4
commit 737ef14ca7
3 changed files with 18 additions and 2 deletions

View File

@ -228,6 +228,13 @@ class Base(ABC):
"""
return True
def supports_expired_profiles(self) -> bool:
"""
Override this in your subclass if your game or series requires non-expired profiles
in order to correctly present migrations to the user.
"""
return True
def bind_profile(self, userid: UserID) -> None:
"""
Handling binding the user's profile to this version on this server.

View File

@ -38,12 +38,14 @@ class CardManagerHandler(Base):
# Special handling for looking up whether the previous game's profile existed. If we
# don't do this then some games won't present the user with a migration.
bound = self.has_profile(userid)
expired = False
if bound is False:
if modelstring is not None:
model = Model.from_modelstring(modelstring)
oldgame = Base.create(self.data, self.config, model, self.model)
if oldgame is not None:
bound = oldgame.has_profile(userid)
expired = self.supports_expired_profiles()
refid = self.data.local.user.get_refid(self.game, self.version, userid)
paseli_enabled = self.supports_paseli() and self.config.paseli.enabled
@ -61,8 +63,8 @@ class CardManagerHandler(Base):
root.set_attribute('binded', '1' if bound else '0')
# Whether this version of the profile is expired (was converted to newer version). We support forwards
# and backwards compatibility so we always set this to 0.
root.set_attribute('expired', '0')
# and backwards compatibility so some games will always set this to 0.
root.set_attribute('expired', '1' if expired else '0')
# Whether to allow paseli, as enabled by the operator and arcade owner.
root.set_attribute('ecflag', '1' if paseli_enabled else '0')

View File

@ -48,6 +48,13 @@ class PopnMusicBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
"""
return None
def supports_expired_profiles(self) -> bool:
"""
Pop'n Music in particular requires non-expired profiles to do conversions
properly.
"""
return False
def format_profile(self, userid: UserID, profile: Profile) -> Node:
"""
Base handler for a profile. Given a userid and a profile dictionary,