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

Document Peace a bit more, fix friend character for Lapistoria+.

This commit is contained in:
Jennifer Taylor 2021-09-09 06:08:32 +00:00
parent 3194524fca
commit f2e6c35f93
5 changed files with 36 additions and 22 deletions

View File

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

View File

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

View File

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

View File

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

View File

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