1
0
mirror of synced 2024-11-24 06:20:12 +01:00

MUSECA: Support Museca Plus modpack

This commit is contained in:
seth 2020-12-06 02:11:55 +00:00 committed by Jennifer Taylor
parent 37e01e0a3e
commit 82a67e0792
5 changed files with 64 additions and 26 deletions

3
.gitignore vendored
View File

@ -12,3 +12,6 @@ build/
.hgignore
.venv/
bemani.egg-info/
server/
emblems
.vscode/

View File

@ -1,10 +1,10 @@
# vim: set fileencoding=utf-8
from typing import Dict, Optional
from typing import Dict, Optional, Any
from bemani.backend.base import Base
from bemani.backend.core import CoreHandler, CardManagerHandler, PASELIHandler
from bemani.common import ValidatedDict, GameConstants, DBConstants, Parallel
from bemani.data import UserID
from bemani.common import ValidatedDict, GameConstants, DBConstants, Parallel, Model
from bemani.data import UserID, Data
from bemani.protocol import Node
@ -33,6 +33,19 @@ class MusecaBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
CLEAR_TYPE_CLEARED = DBConstants.MUSECA_CLEAR_TYPE_CLEARED
CLEAR_TYPE_FULL_COMBO = DBConstants.MUSECA_CLEAR_TYPE_FULL_COMBO
def __init__(self, data: Data, config: Dict[str, Any], model: Model) -> None:
super().__init__(data, config, model)
if model.rev == 'X':
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['MusecaBase']:
"""
Returns the previous version of the game, based on this game. Should
@ -128,11 +141,11 @@ class MusecaBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
all_attempts, remote_attempts = Parallel.execute([
lambda: self.data.local.music.get_all_attempts(
game=self.game,
version=self.version,
version=self.music_version,
),
lambda: self.data.remote.music.get_clear_rates(
game=self.game,
version=self.version,
version=self.music_version,
)
])
attempts: Dict[int, Dict[int, Dict[str, int]]] = {}
@ -214,7 +227,7 @@ class MusecaBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
if userid is not None:
oldscore = self.data.local.music.get_score(
self.game,
self.version,
self.music_version,
userid,
songid,
chart,
@ -262,7 +275,7 @@ class MusecaBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
# Write the new score back
self.data.local.music.put_score(
self.game,
self.version,
self.music_version,
userid,
songid,
chart,
@ -275,7 +288,7 @@ class MusecaBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
# Save the history of this score too
self.data.local.music.put_attempt(
self.game,
self.version,
self.music_version,
userid,
songid,
chart,

View File

@ -117,7 +117,7 @@ class Museca1(
game_config = self.get_game_config()
if game_config.get_bool('force_unlock_songs'):
ids = set()
songs = self.data.local.music.get_all_songs(self.game, self.version)
songs = self.data.local.music.get_all_songs(self.game, self.music_version)
for song in songs:
if song.data.get_int('limited') in (self.GAME_LIMITED_LOCKED, self.GAME_LIMITED_UNLOCKABLE):
ids.add((song.id, song.chart))
@ -175,7 +175,7 @@ class Museca1(
userid = None
if userid is not None:
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)
else:
scores = []
@ -269,7 +269,7 @@ class Museca1(
if game_config.get_bool('force_unlock_songs'):
ids: Dict[int, int] = {}
songs = self.data.local.music.get_all_songs(self.game, self.version)
songs = self.data.local.music.get_all_songs(self.game, self.music_version)
for song in songs:
if song.id not in ids:
ids[song.id] = 0

View File

@ -129,7 +129,7 @@ class Museca1Plus(
game_config = self.get_game_config()
if game_config.get_bool('force_unlock_songs'):
ids = set()
songs = self.data.local.music.get_all_songs(self.game, self.version)
songs = self.data.local.music.get_all_songs(self.game, self.music_version)
for song in songs:
if song.data.get_int('limited') in (self.GAME_LIMITED_LOCKED, self.GAME_LIMITED_UNLOCKABLE):
ids.add((song.id, song.chart))
@ -153,16 +153,33 @@ class Museca1Plus(
if not game_config.get_bool('disable_matching'):
enable_event(143) # Matching enabled
enable_event(1) # Extended pedal options
enable_event(83) # Light start
enable_event(130) # Curator rank
enable_event(195) # Fictional curator
# Event 194 is continuation mode, but it doesn't seem to work on latest data.
# These events are meant specifically for Museca Plus
museca_plus_events = [
140, # Agetta Moratta (vmlink_phase 3 in musicdb)
211, # News 1
]
event_ids = [
1, # Extended pedal options
56, # Generator grafica icon <print 1 in musicdb>
83, # Paseli Light Start
86, # Generator grafica icon <print 2 in musicdb>
98, # Caption 2 notice (grs_grafica_caption_2.png)
105, # Makes the "Number of Layers" option visible in game settings
130, # Curator Rank
141, # Coconatsu & Mukipara grafica effects
145, # MUKIPARA UNLOCKS
146, # MUKIPARA UNLOCKS
147, # MUKIPARA UNLOCKS
148, # MUKIPARA UNLOCKS
149, # MUKIPARA UNLOCKS
195, # Fictional Curator (foot pedal options)
]
enable_event(98) # Mission mode
for evtid in [145, 146, 147, 148, 149]:
for evtid in event_ids:
enable_event(evtid) # Mission stuff
if self.omnimix:
for evtid in museca_plus_events:
enable_event(evtid)
return game
def handle_game_3_lounge_request(self, request: Node) -> Node:
@ -210,7 +227,7 @@ class Museca1Plus(
userid = None
if userid is not None:
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)
else:
scores = []
@ -310,7 +327,7 @@ class Museca1Plus(
if game_config.get_bool('force_unlock_songs'):
ids: Dict[int, int] = {}
songs = self.data.local.music.get_all_songs(self.game, self.version)
songs = self.data.local.music.get_all_songs(self.game, self.music_version)
for song in songs:
if song.id not in ids:
ids[song.id] = 0

View File

@ -2839,13 +2839,18 @@ class ImportMuseca(ImportBase):
no_combine: bool,
update: bool,
) -> None:
if version in ['1', '1+1/2']:
actual_version = {
'1': VersionConstants.MUSECA,
'1+1/2': VersionConstants.MUSECA_1_PLUS,
}.get(version, -1)
elif version == 'plus':
actual_version = VersionConstants.MUSECA_1_PLUS + DBConstants.OMNIMIX_VERSION_BUMP
if actual_version in [VersionConstants.MUSECA, VersionConstants.MUSECA_1_PLUS]:
self.charts = [0, 1, 2, 3]
elif actual_version == VersionConstants.MUSECA_1_PLUS + DBConstants.OMNIMIX_VERSION_BUMP:
self.charts = [0, 1, 2, 3]
else:
raise Exception("Unsupported Museca version, expected one of the following: 1, 1+1/2!")