mirror of
https://github.com/DragonMinded/bemaniutils.git
synced 2026-09-13 04:45:12 -05:00
Roll in omnimix music version fixes to make Jubeat omnimix-capable, thanks to Subject38!
This commit is contained in:
@@ -4,8 +4,8 @@ from typing_extensions import Final
|
|||||||
|
|
||||||
from bemani.backend.base import Base
|
from bemani.backend.base import Base
|
||||||
from bemani.backend.core import CoreHandler, CardManagerHandler, PASELIHandler
|
from bemani.backend.core import CoreHandler, CardManagerHandler, PASELIHandler
|
||||||
from bemani.common import DBConstants, GameConstants, ValidatedDict, Profile
|
from bemani.common import DBConstants, GameConstants, ValidatedDict, Model, Profile
|
||||||
from bemani.data import Score, UserID
|
from bemani.data import Data, Score, UserID, Config
|
||||||
from bemani.protocol import Node
|
from bemani.protocol import Node
|
||||||
|
|
||||||
|
|
||||||
@@ -40,6 +40,19 @@ class JubeatBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
|
|||||||
CHART_TYPE_HARD_ADVANCED: Final[int] = 4
|
CHART_TYPE_HARD_ADVANCED: Final[int] = 4
|
||||||
CHART_TYPE_HARD_EXTREME: Final[int] = 5
|
CHART_TYPE_HARD_EXTREME: Final[int] = 5
|
||||||
|
|
||||||
|
def __init__(self, data: Data, config: Config, model: Model) -> None:
|
||||||
|
super().__init__(data, config, model)
|
||||||
|
if model.rev == 'X' or model.rev == 'Y':
|
||||||
|
self.omnimix = True
|
||||||
|
else:
|
||||||
|
self.omnimix = False
|
||||||
|
|
||||||
|
@property
|
||||||
|
def music_version(self) -> int:
|
||||||
|
if self.omnimix:
|
||||||
|
return DBConstants.OMNIMIX_VERSION_BUMP + self.version
|
||||||
|
return self.version
|
||||||
|
|
||||||
def previous_version(self) -> Optional['JubeatBase']:
|
def previous_version(self) -> Optional['JubeatBase']:
|
||||||
"""
|
"""
|
||||||
Returns the previous version of the game, based on this game. Should
|
Returns the previous version of the game, based on this game. Should
|
||||||
@@ -145,7 +158,7 @@ class JubeatBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||||
scores = self.data.remote.music.get_scores(self.game, self.version, userid)
|
scores = self.data.remote.music.get_scores(self.game, self.music_version, userid)
|
||||||
if scores is None:
|
if scores is None:
|
||||||
return None
|
return None
|
||||||
profile = self.get_profile(userid)
|
profile = self.get_profile(userid)
|
||||||
@@ -184,7 +197,7 @@ class JubeatBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
|
|||||||
|
|
||||||
oldscore = self.data.local.music.get_score(
|
oldscore = self.data.local.music.get_score(
|
||||||
self.game,
|
self.game,
|
||||||
self.version,
|
self.music_version,
|
||||||
userid,
|
userid,
|
||||||
songid,
|
songid,
|
||||||
chart,
|
chart,
|
||||||
@@ -246,7 +259,7 @@ class JubeatBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
|
|||||||
# Write the new score back
|
# Write the new score back
|
||||||
self.data.local.music.put_score(
|
self.data.local.music.put_score(
|
||||||
self.game,
|
self.game,
|
||||||
self.version,
|
self.music_version,
|
||||||
userid,
|
userid,
|
||||||
songid,
|
songid,
|
||||||
chart,
|
chart,
|
||||||
@@ -260,7 +273,7 @@ class JubeatBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
|
|||||||
# Save the history of this score too
|
# Save the history of this score too
|
||||||
self.data.local.music.put_attempt(
|
self.data.local.music.put_attempt(
|
||||||
self.game,
|
self.game,
|
||||||
self.version,
|
self.music_version,
|
||||||
userid,
|
userid,
|
||||||
songid,
|
songid,
|
||||||
chart,
|
chart,
|
||||||
|
|||||||
@@ -1318,8 +1318,8 @@ class JubeatClan(
|
|||||||
|
|
||||||
# Figure out if we've played these songs
|
# Figure out if we've played these songs
|
||||||
start_time, end_time = self.data.local.network.get_schedule_duration('daily')
|
start_time, end_time = self.data.local.network.get_schedule_duration('daily')
|
||||||
today_attempts = self.data.local.music.get_all_attempts(self.game, self.version, userid, entry.get_int('today', -1), timelimit=start_time)
|
today_attempts = self.data.local.music.get_all_attempts(self.game, self.music_version, userid, entry.get_int('today', -1), timelimit=start_time)
|
||||||
whim_attempts = self.data.local.music.get_all_attempts(self.game, self.version, userid, entry.get_int('whim', -1), timelimit=start_time)
|
whim_attempts = self.data.local.music.get_all_attempts(self.game, self.music_version, userid, entry.get_int('whim', -1), timelimit=start_time)
|
||||||
|
|
||||||
fc_challenge = Node.void('fc_challenge')
|
fc_challenge = Node.void('fc_challenge')
|
||||||
player.add_child(fc_challenge)
|
player.add_child(fc_challenge)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class JubeatDemodataGetHitchartHandler(JubeatBase):
|
|||||||
data.add_child(hitchart_lic)
|
data.add_child(hitchart_lic)
|
||||||
hitchart_lic.set_attribute('count', '0')
|
hitchart_lic.set_attribute('count', '0')
|
||||||
|
|
||||||
songs = self.data.local.music.get_hit_chart(self.game, self.version, 10)
|
songs = self.data.local.music.get_hit_chart(self.game, self.music_version, 10)
|
||||||
hitchart_org = Node.void('hitchart_org')
|
hitchart_org = Node.void('hitchart_org')
|
||||||
data.add_child(hitchart_org)
|
data.add_child(hitchart_org)
|
||||||
hitchart_org.set_attribute('count', str(len(songs)))
|
hitchart_org.set_attribute('count', str(len(songs)))
|
||||||
|
|||||||
@@ -718,10 +718,10 @@ class JubeatFesto(
|
|||||||
# Figure out if we've played these songs
|
# Figure out if we've played these songs
|
||||||
start_time, end_time = self.data.local.network.get_schedule_duration('daily')
|
start_time, end_time = self.data.local.network.get_schedule_duration('daily')
|
||||||
today_attempts = self.data.local.music.get_all_attempts(
|
today_attempts = self.data.local.music.get_all_attempts(
|
||||||
self.game, self.version, userid, entry.get_int('today', -1), timelimit=start_time
|
self.game, self.music_version, userid, entry.get_int('today', -1), timelimit=start_time
|
||||||
)
|
)
|
||||||
whim_attempts = self.data.local.music.get_all_attempts(
|
whim_attempts = self.data.local.music.get_all_attempts(
|
||||||
self.game, self.version, userid, entry.get_int('whim', -1), timelimit=start_time
|
self.game, self.music_version, userid, entry.get_int('whim', -1), timelimit=start_time
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: Are these still the right state constants?
|
# TODO: Are these still the right state constants?
|
||||||
|
|||||||
@@ -916,8 +916,8 @@ class JubeatProp(
|
|||||||
|
|
||||||
# Figure out if we've played these songs
|
# Figure out if we've played these songs
|
||||||
start_time, end_time = self.data.local.network.get_schedule_duration('daily')
|
start_time, end_time = self.data.local.network.get_schedule_duration('daily')
|
||||||
today_attempts = self.data.local.music.get_all_attempts(self.game, self.version, userid, entry.get_int('today', -1), timelimit=start_time)
|
today_attempts = self.data.local.music.get_all_attempts(self.game, self.music_version, userid, entry.get_int('today', -1), timelimit=start_time)
|
||||||
whim_attempts = self.data.local.music.get_all_attempts(self.game, self.version, userid, entry.get_int('whim', -1), timelimit=start_time)
|
whim_attempts = self.data.local.music.get_all_attempts(self.game, self.music_version, userid, entry.get_int('whim', -1), timelimit=start_time)
|
||||||
|
|
||||||
fc_challenge = Node.void('fc_challenge')
|
fc_challenge = Node.void('fc_challenge')
|
||||||
player.add_child(fc_challenge)
|
player.add_child(fc_challenge)
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ class JubeatQubell(
|
|||||||
|
|
||||||
# Looks to be set to true when there's an old profile, stops tutorial from
|
# Looks to be set to true when there's an old profile, stops tutorial from
|
||||||
# happening on first load.
|
# happening on first load.
|
||||||
info.add_child(Node.bool('inherit', profile.get_bool('has_old_version') and not profile.get_bool('saved')))
|
info.add_child(Node.bool('inherit', profile.get_bool('has_old_version')))
|
||||||
|
|
||||||
# Not saved, but loaded
|
# Not saved, but loaded
|
||||||
info.add_child(Node.s32('mtg_entry_cnt', 123))
|
info.add_child(Node.s32('mtg_entry_cnt', 123))
|
||||||
@@ -643,8 +643,8 @@ class JubeatQubell(
|
|||||||
|
|
||||||
# Figure out if we've played these songs
|
# Figure out if we've played these songs
|
||||||
start_time, end_time = self.data.local.network.get_schedule_duration('daily')
|
start_time, end_time = self.data.local.network.get_schedule_duration('daily')
|
||||||
today_attempts = self.data.local.music.get_all_attempts(self.game, self.version, userid, entry.get_int('today', -1), timelimit=start_time)
|
today_attempts = self.data.local.music.get_all_attempts(self.game, self.music_version, userid, entry.get_int('today', -1), timelimit=start_time)
|
||||||
whim_attempts = self.data.local.music.get_all_attempts(self.game, self.version, userid, entry.get_int('whim', -1), timelimit=start_time)
|
whim_attempts = self.data.local.music.get_all_attempts(self.game, self.music_version, userid, entry.get_int('whim', -1), timelimit=start_time)
|
||||||
|
|
||||||
fc_challenge = Node.void('fc_challenge')
|
fc_challenge = Node.void('fc_challenge')
|
||||||
player.add_child(fc_challenge)
|
player.add_child(fc_challenge)
|
||||||
@@ -925,7 +925,6 @@ class JubeatQubell(
|
|||||||
|
|
||||||
def unformat_profile(self, userid: UserID, request: Node, oldprofile: Profile) -> Profile:
|
def unformat_profile(self, userid: UserID, request: Node, oldprofile: Profile) -> Profile:
|
||||||
newprofile = oldprofile.clone()
|
newprofile = oldprofile.clone()
|
||||||
newprofile.replace_bool('saved', True)
|
|
||||||
data = request.child('data')
|
data = request.child('data')
|
||||||
|
|
||||||
# Grab system information
|
# Grab system information
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ class JubeatSaucer(
|
|||||||
|
|
||||||
# Figure out if we've played these songs
|
# Figure out if we've played these songs
|
||||||
start_time, end_time = self.data.local.network.get_schedule_duration('daily')
|
start_time, end_time = self.data.local.network.get_schedule_duration('daily')
|
||||||
today_attempts = self.data.local.music.get_all_attempts(self.game, self.version, userid, entry.get_int('today', -1), timelimit=start_time)
|
today_attempts = self.data.local.music.get_all_attempts(self.game, self.music_version, userid, entry.get_int('today', -1), timelimit=start_time)
|
||||||
|
|
||||||
challenge = Node.void('challenge')
|
challenge = Node.void('challenge')
|
||||||
player.add_child(challenge)
|
player.add_child(challenge)
|
||||||
|
|||||||
@@ -493,8 +493,8 @@ class JubeatSaucerFulfill(
|
|||||||
|
|
||||||
# Figure out if we've played these songs
|
# Figure out if we've played these songs
|
||||||
start_time, end_time = self.data.local.network.get_schedule_duration('daily')
|
start_time, end_time = self.data.local.network.get_schedule_duration('daily')
|
||||||
today_attempts = self.data.local.music.get_all_attempts(self.game, self.version, userid, entry.get_int('today', -1), timelimit=start_time)
|
today_attempts = self.data.local.music.get_all_attempts(self.game, self.music_version, userid, entry.get_int('today', -1), timelimit=start_time)
|
||||||
whim_attempts = self.data.local.music.get_all_attempts(self.game, self.version, userid, entry.get_int('whim', -1), timelimit=start_time)
|
whim_attempts = self.data.local.music.get_all_attempts(self.game, self.music_version, userid, entry.get_int('whim', -1), timelimit=start_time)
|
||||||
|
|
||||||
challenge = Node.void('challenge')
|
challenge = Node.void('challenge')
|
||||||
player.add_child(challenge)
|
player.add_child(challenge)
|
||||||
|
|||||||
Reference in New Issue
Block a user