From f2e6c35f934d9930e3d45ccb1383ec5ce775f3d8 Mon Sep 17 00:00:00 2001 From: Jennifer Taylor Date: Thu, 9 Sep 2021 06:08:32 +0000 Subject: [PATCH] Document Peace a bit more, fix friend character for Lapistoria+. --- bemani/backend/popn/common.py | 24 +++++++++--------------- bemani/backend/popn/eclale.py | 2 +- bemani/backend/popn/lapistoria.py | 2 +- bemani/backend/popn/peace.py | 18 ++++++++++++++---- bemani/backend/popn/usaneko.py | 12 +++++++++++- 5 files changed, 36 insertions(+), 22 deletions(-) diff --git a/bemani/backend/popn/common.py b/bemani/backend/popn/common.py index 5f30a0d..01cf149 100644 --- a/bemani/backend/popn/common.py +++ b/bemani/backend/popn/common.py @@ -119,16 +119,17 @@ class PopnMusicModernBase(PopnMusicBase, ABC): return Node.void('pcb24') @abstractmethod - def get_common_config(self) -> Tuple[Dict[int, int], bool]: + def get_common_config(self) -> Tuple[Dict[int, int], bool, int]: """ Return a tuple of configuration options for sending the common node back to the client. The first parameter is a dictionary whose keys are event IDs and values are the event phase number. The second parameter is a bool - representing whether or not to send areas. + representing whether or not to send areas. The third parameter is the number + of deco parts available for purchase. """ def __construct_common_info(self, root: Node) -> None: - phases, send_areas = self.get_common_config() + phases, send_areas, goods_count = self.get_common_config() for phaseid, phase_value in phases.items(): phase = Node.void('phase') @@ -222,7 +223,7 @@ class PopnMusicModernBase(PopnMusicBase, ABC): choco.add_child(Node.s32('param', -1)) # Set up goods, educated guess here. - for goods_id in range(97): + for goods_id in range(goods_count): if goods_id < 15: price = 30 elif goods_id < 30: @@ -231,8 +232,10 @@ class PopnMusicModernBase(PopnMusicBase, ABC): price = 60 elif goods_id < 60: price = 80 - else: + elif goods_id < 98: price = 200 + else: + price = 250 goods = Node.void('goods') root.add_child(goods) goods.add_child(Node.s32('item_id', goods_id + 1)) @@ -511,7 +514,7 @@ class PopnMusicModernBase(PopnMusicBase, ABC): friend.add_child(Node.s16('no', no)) friend.add_child(Node.string('g_pm_id', self.format_extid(rivalprofile.extid))) # UsaNeko formats on its own friend.add_child(Node.string('name', rivalprofile.get_str('name', 'なし'))) - friend.add_child(Node.s16('chara', rivalprofile.get_int('chara', -1))) + friend.add_child(Node.s16('chara_num', rivalprofile.get_int('chara', -1))) # This might be for having non-active or non-confirmed friends, but setting to 0 makes the # ranking numbers disappear and the player icon show a questionmark. friend.add_child(Node.s8('is_open', 1)) @@ -991,15 +994,6 @@ class PopnMusicModernBase(PopnMusicBase, ABC): # Item 0 is music unlocks. In this case, the id is the song ID according # to the game. Unclear what the param is supposed to be, but i've seen # seen 8 and 0. Might be what chart is available? - # - # Item limits are as follows: - # 0: 1704 - ID is the music ID that the player purchased/unlocked. - # 1: 2201 - # 2: 3 - # 3: 97 - ID points at a character part that can be purchased on the character screen. - # 4: 1 - # 5: 1 - # 6: 60 if game_config.get_bool('force_unlock_songs') and itemtype == 0: # We already sent song unlocks in the force unlock section above. continue diff --git a/bemani/backend/popn/eclale.py b/bemani/backend/popn/eclale.py index 7cddd21..0253dff 100644 --- a/bemani/backend/popn/eclale.py +++ b/bemani/backend/popn/eclale.py @@ -435,7 +435,7 @@ class PopnMusicEclale(PopnMusicBase): friend.add_child(Node.s16('no', no)) friend.add_child(Node.string('g_pm_id', self.format_extid(rivalprofile.extid))) # Eclale formats on its own friend.add_child(Node.string('name', rivalprofile.get_str('name', 'なし'))) - friend.add_child(Node.s16('chara', rivalprofile.get_int('chara', -1))) + friend.add_child(Node.s16('chara_num', rivalprofile.get_int('chara', -1))) # This might be for having non-active or non-confirmed friends, but setting to 0 makes the # ranking numbers disappear and the player icon show a questionmark. friend.add_child(Node.s8('is_open', 1)) diff --git a/bemani/backend/popn/lapistoria.py b/bemani/backend/popn/lapistoria.py index 54833bd..c6c80b6 100644 --- a/bemani/backend/popn/lapistoria.py +++ b/bemani/backend/popn/lapistoria.py @@ -333,7 +333,7 @@ class PopnMusicLapistoria(PopnMusicBase): friend.add_child(Node.s16('no', no)) friend.add_child(Node.string('g_pm_id', ID.format_extid(rivalprofile.extid))) friend.add_child(Node.string('name', rivalprofile.get_str('name', 'なし'))) - friend.add_child(Node.s16('chara', rivalprofile.get_int('chara', -1))) + friend.add_child(Node.s16('chara_num', rivalprofile.get_int('chara', -1))) # This might be for having non-active or non-confirmed friends, but setting to 0 makes the # ranking numbers disappear and the player icon show a questionmark. friend.add_child(Node.s8('is_open', 1)) diff --git a/bemani/backend/popn/peace.py b/bemani/backend/popn/peace.py index dfb3dc9..00042b2 100644 --- a/bemani/backend/popn/peace.py +++ b/bemani/backend/popn/peace.py @@ -15,18 +15,27 @@ class PopnMusicPeace(PopnMusicModernBase): # Biggest ID in the music DB GAME_MAX_MUSIC_ID: int = 1877 + # Item limits are as follows: + # 0: 1877 - ID is the music ID that the player purchased/unlocked. + # 1: 2284 + # 2: 3 + # 3: 133 - ID points at a character part that can be purchased on the character screen. + # 4: 1 + # 5: 1 + # 6: 60 + def previous_version(self) -> PopnMusicBase: return PopnMusicUsaNeko(self.data, self.config, self.model) - def get_common_config(self) -> Tuple[Dict[int, int], bool]: + def get_common_config(self) -> Tuple[Dict[int, int], bool, int]: # Event phases # TODO: Hook event mode settings up to the front end. return ( { # Default song phase availability (0-23) 0: 23, - # Unknown event (0-2) - 1: 2, + # Unknown event (0-4) + 1: 4, # Unknown event (0-2) 2: 2, # Unknown event (0-4) @@ -60,7 +69,7 @@ class PopnMusicPeace(PopnMusicModernBase): # Unknown event (0-8) 17: 8, # Unknown event (0-1) - 28: 1, + 18: 1, # Unknown event (0-1) 19: 1, # Unknown event (0-13) @@ -75,4 +84,5 @@ class PopnMusicPeace(PopnMusicModernBase): 24: 1, }, False, + 133, ) diff --git a/bemani/backend/popn/usaneko.py b/bemani/backend/popn/usaneko.py index b76a713..7115a47 100644 --- a/bemani/backend/popn/usaneko.py +++ b/bemani/backend/popn/usaneko.py @@ -15,6 +15,15 @@ class PopnMusicUsaNeko(PopnMusicModernBase): # Biggest ID in the music DB GAME_MAX_MUSIC_ID: int = 1704 + # Item limits are as follows: + # 0: 1704 - ID is the music ID that the player purchased/unlocked. + # 1: 2201 + # 2: 3 + # 3: 97 - ID points at a character part that can be purchased on the character screen. + # 4: 1 + # 5: 1 + # 6: 60 + def previous_version(self) -> PopnMusicBase: return PopnMusicEclale(self.data, self.config, self.model) @@ -91,7 +100,7 @@ class PopnMusicUsaNeko(PopnMusicModernBase): ], } - def get_common_config(self) -> Tuple[Dict[int, int], bool]: + def get_common_config(self) -> Tuple[Dict[int, int], bool, int]: game_config = self.get_game_config() music_phase = game_config.get_int('music_phase') active_event = game_config.get_int('active_event') @@ -161,4 +170,5 @@ class PopnMusicUsaNeko(PopnMusicModernBase): 13: 1, }, navikun_enabled, + 97, )