2019-12-08 22:43:49 +01:00
|
|
|
# vim: set fileencoding=utf-8
|
|
|
|
import binascii
|
2021-09-09 03:03:23 +02:00
|
|
|
from typing import Any, Dict, List
|
2021-09-07 19:56:15 +02:00
|
|
|
from typing_extensions import Final
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
from bemani.backend.popn.base import PopnMusicBase
|
|
|
|
from bemani.backend.popn.lapistoria import PopnMusicLapistoria
|
|
|
|
|
2021-08-25 01:18:53 +02:00
|
|
|
from bemani.common import Profile, VersionConstants
|
2020-05-12 23:03:01 +02:00
|
|
|
from bemani.data import UserID, Link
|
2019-12-08 22:43:49 +01:00
|
|
|
from bemani.protocol import Node
|
|
|
|
|
|
|
|
|
|
|
|
class PopnMusicEclale(PopnMusicBase):
|
2021-09-07 19:56:15 +02:00
|
|
|
name: str = "Pop'n Music éclale"
|
|
|
|
version: int = VersionConstants.POPN_MUSIC_ECLALE
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Chart type, as returned from the game
|
2021-09-07 19:56:15 +02:00
|
|
|
GAME_CHART_TYPE_EASY: Final[int] = 0
|
|
|
|
GAME_CHART_TYPE_NORMAL: Final[int] = 1
|
|
|
|
GAME_CHART_TYPE_HYPER: Final[int] = 2
|
|
|
|
GAME_CHART_TYPE_EX: Final[int] = 3
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Medal type, as returned from the game
|
2021-09-07 19:56:15 +02:00
|
|
|
GAME_PLAY_MEDAL_CIRCLE_FAILED: Final[int] = 1
|
|
|
|
GAME_PLAY_MEDAL_DIAMOND_FAILED: Final[int] = 2
|
|
|
|
GAME_PLAY_MEDAL_STAR_FAILED: Final[int] = 3
|
|
|
|
GAME_PLAY_MEDAL_EASY_CLEAR: Final[int] = 4
|
|
|
|
GAME_PLAY_MEDAL_CIRCLE_CLEARED: Final[int] = 5
|
|
|
|
GAME_PLAY_MEDAL_DIAMOND_CLEARED: Final[int] = 6
|
|
|
|
GAME_PLAY_MEDAL_STAR_CLEARED: Final[int] = 7
|
|
|
|
GAME_PLAY_MEDAL_CIRCLE_FULL_COMBO: Final[int] = 8
|
|
|
|
GAME_PLAY_MEDAL_DIAMOND_FULL_COMBO: Final[int] = 9
|
|
|
|
GAME_PLAY_MEDAL_STAR_FULL_COMBO: Final[int] = 10
|
|
|
|
GAME_PLAY_MEDAL_PERFECT: Final[int] = 11
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Biggest ID in the music DB
|
2021-09-07 19:56:15 +02:00
|
|
|
GAME_MAX_MUSIC_ID: Final[int] = 1550
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2021-09-04 00:42:09 +02:00
|
|
|
def previous_version(self) -> PopnMusicBase:
|
2019-12-08 22:43:49 +01:00
|
|
|
return PopnMusicLapistoria(self.data, self.config, self.model)
|
|
|
|
|
2021-09-09 03:03:23 +02:00
|
|
|
@classmethod
|
|
|
|
def get_settings(cls) -> Dict[str, Any]:
|
|
|
|
"""
|
|
|
|
Return all of our front-end modifiably settings.
|
|
|
|
"""
|
|
|
|
return {
|
2022-10-15 20:56:30 +02:00
|
|
|
"ints": [
|
2021-09-09 03:03:23 +02:00
|
|
|
{
|
2022-10-15 20:56:30 +02:00
|
|
|
"name": "Music Open Phase",
|
|
|
|
"tip": "Default music phase for all players.",
|
|
|
|
"category": "game_config",
|
|
|
|
"setting": "music_phase",
|
|
|
|
"values": {
|
|
|
|
0: "No music unlocks",
|
|
|
|
1: "Phase 1",
|
|
|
|
2: "Phase 2",
|
|
|
|
3: "Phase 3",
|
|
|
|
4: "Phase 4",
|
|
|
|
5: "Phase 5",
|
|
|
|
6: "Phase 6",
|
|
|
|
7: "Phase 7",
|
|
|
|
8: "Phase 8",
|
|
|
|
9: "Phase 9",
|
|
|
|
10: "Phase 10",
|
|
|
|
11: "Phase 11",
|
|
|
|
12: "Phase 12",
|
|
|
|
13: "Phase 13",
|
|
|
|
14: "Phase 14",
|
|
|
|
15: "Phase 15",
|
|
|
|
16: "Phase MAX",
|
|
|
|
},
|
2021-09-09 03:03:23 +02:00
|
|
|
},
|
|
|
|
{
|
2022-10-15 20:56:30 +02:00
|
|
|
"name": "Additional Music Unlock Phase",
|
|
|
|
"tip": "Additional music unlock phase for all players.",
|
|
|
|
"category": "game_config",
|
|
|
|
"setting": "music_sub_phase",
|
|
|
|
"values": {
|
|
|
|
0: "No additional unlocks",
|
|
|
|
1: "Phase 1",
|
|
|
|
2: "Phase 2",
|
|
|
|
3: "Phase MAX",
|
2021-09-09 03:03:23 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2022-10-15 20:56:30 +02:00
|
|
|
"bools": [
|
2021-09-09 03:03:23 +02:00
|
|
|
{
|
2022-10-15 20:56:30 +02:00
|
|
|
"name": "Enable Starmaker Event",
|
|
|
|
"tip": "Enable Starmaker event as well as song shop.",
|
|
|
|
"category": "game_config",
|
|
|
|
"setting": "starmaker_enable",
|
2021-09-09 03:03:23 +02:00
|
|
|
},
|
2021-09-10 06:46:43 +02:00
|
|
|
# We don't currently support lobbies or anything, so this is commented out until
|
|
|
|
# somebody gets around to implementing it.
|
|
|
|
# {
|
|
|
|
# 'name': 'Net Taisen',
|
|
|
|
# 'tip': 'Enable Net Taisen, including win/loss display on song select',
|
|
|
|
# 'category': 'game_config',
|
|
|
|
# 'setting': 'enable_net_taisen',
|
|
|
|
# },
|
2021-09-09 03:03:23 +02:00
|
|
|
{
|
2022-10-15 20:56:30 +02:00
|
|
|
"name": "Force Song Unlock",
|
|
|
|
"tip": "Force unlock all songs.",
|
|
|
|
"category": "game_config",
|
|
|
|
"setting": "force_unlock_songs",
|
2021-09-09 03:03:23 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2019-12-08 22:43:49 +01:00
|
|
|
def __construct_common_info(self, root: Node) -> None:
|
2021-09-09 03:03:23 +02:00
|
|
|
game_config = self.get_game_config()
|
2022-10-15 20:56:30 +02:00
|
|
|
music_phase = game_config.get_int("music_phase")
|
|
|
|
music_sub_phase = game_config.get_int("music_sub_phase")
|
2021-09-10 06:46:43 +02:00
|
|
|
enable_net_taisen = False # game_config.get_bool('enable_net_taisen')
|
2021-09-09 03:03:23 +02:00
|
|
|
|
|
|
|
# Event phases. Eclale seems to be so basic that there is no way to disable/enable
|
|
|
|
# the starmaker event. It is just baked into the game.
|
2019-12-08 22:43:49 +01:00
|
|
|
phases = {
|
2021-09-09 03:03:23 +02:00
|
|
|
# Music open phase (0-16).
|
|
|
|
# The following songs are unlocked when the phase is at or above the number specified:
|
|
|
|
# 1 - 1470, 1471, 1472
|
|
|
|
# 2 - 1447, 1450, 1454, 1457
|
|
|
|
# 3 - 1477, 1475, 1483
|
|
|
|
# 4 - 1473
|
|
|
|
# 5 - 1480, 1479, 1481
|
|
|
|
# 6 - 1494, 1495
|
|
|
|
# 7 - 1490, 1491
|
|
|
|
# 8 - 1489
|
|
|
|
# 9 - 1502, 1503, 1504, 1505, 1506, 1507
|
|
|
|
# 10 - 1492
|
|
|
|
# 11 - 1508, 1509, 1510, 1511
|
|
|
|
# 12 - 1518
|
|
|
|
# 13 - 1530
|
|
|
|
# 14 - 1543
|
|
|
|
# 15 - 1544
|
|
|
|
# 16 - 1548
|
|
|
|
0: music_phase,
|
2019-12-08 22:43:49 +01:00
|
|
|
# Unknown event (0-3)
|
|
|
|
1: 3,
|
|
|
|
# Unknown event (0-1)
|
|
|
|
2: 1,
|
|
|
|
# Unknown event (0-2)
|
|
|
|
3: 2,
|
2021-09-09 03:03:23 +02:00
|
|
|
# Something to do with favorites folder and the favorites button on the 10key (0-1)
|
2019-12-08 22:43:49 +01:00
|
|
|
4: 1,
|
2021-09-09 03:03:23 +02:00
|
|
|
# Looks like something to do with stamp cards, enabled with 1 (0-2)
|
|
|
|
5: 1,
|
2019-12-08 22:43:49 +01:00
|
|
|
# Unknown event (0-1)
|
|
|
|
6: 1,
|
|
|
|
# Unknown event (0-4)
|
|
|
|
7: 4,
|
2021-09-09 03:03:23 +02:00
|
|
|
# Unlock a few more songs (1: 1496, 2: 1474, 3: 1531) (0-3)
|
|
|
|
8: music_sub_phase,
|
2019-12-08 22:43:49 +01:00
|
|
|
# Unknown event (0-4)
|
|
|
|
9: 4,
|
|
|
|
# Unknown event (0-4)
|
|
|
|
10: 4,
|
2021-09-09 03:03:23 +02:00
|
|
|
# Unknown event, maybe something to do with song categories? (0-1)
|
2019-12-08 22:43:49 +01:00
|
|
|
11: 1,
|
2021-09-09 03:03:23 +02:00
|
|
|
# Enable Net Taisen, including win/loss sort option on music select (0-1)
|
2021-09-10 06:46:43 +02:00
|
|
|
12: 1 if enable_net_taisen else 0,
|
2021-09-09 03:03:23 +02:00
|
|
|
# Enable local and server-side matching when selecting a song (0-4)
|
2019-12-08 22:43:49 +01:00
|
|
|
13: 4,
|
|
|
|
}
|
|
|
|
|
|
|
|
for phaseid in phases:
|
2022-10-15 20:56:30 +02:00
|
|
|
phase = Node.void("phase")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(phase)
|
2022-10-15 20:56:30 +02:00
|
|
|
phase.add_child(Node.s16("event_id", phaseid))
|
|
|
|
phase.add_child(Node.s16("phase", phases[phaseid]))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
if game_config.get_bool("starmaker_enable"):
|
2021-09-09 03:06:14 +02:00
|
|
|
for areaid in range(1, 51):
|
2022-10-15 20:56:30 +02:00
|
|
|
area = Node.void("area")
|
2021-09-09 03:03:23 +02:00
|
|
|
root.add_child(area)
|
2022-10-15 20:56:30 +02:00
|
|
|
area.add_child(Node.s16("area_id", areaid))
|
|
|
|
area.add_child(Node.u64("end_date", 0))
|
|
|
|
area.add_child(Node.s16("medal_id", areaid))
|
|
|
|
area.add_child(Node.bool("is_limit", False))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Calculate most popular characters
|
|
|
|
profiles = self.data.remote.user.get_all_profiles(self.game, self.version)
|
|
|
|
charas: Dict[int, int] = {}
|
2023-02-17 04:02:41 +01:00
|
|
|
for _userid, profile in profiles:
|
2022-10-15 20:56:30 +02:00
|
|
|
chara = profile.get_int("chara", -1)
|
2019-12-08 22:43:49 +01:00
|
|
|
if chara <= 0:
|
|
|
|
continue
|
|
|
|
if chara not in charas:
|
|
|
|
charas[chara] = 1
|
|
|
|
else:
|
|
|
|
charas[chara] = charas[chara] + 1
|
|
|
|
|
|
|
|
# Order a typle by most popular character to least popular character
|
|
|
|
charamap = sorted(
|
|
|
|
[(c, charas[c]) for c in charas],
|
|
|
|
key=lambda c: c[1],
|
|
|
|
reverse=True,
|
|
|
|
)
|
|
|
|
|
|
|
|
# Output the top 20 of them
|
|
|
|
rank = 1
|
2023-02-17 04:02:41 +01:00
|
|
|
for charaid, _usecount in charamap[:20]:
|
2022-10-15 20:56:30 +02:00
|
|
|
popular = Node.void("popular")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(popular)
|
2022-10-15 20:56:30 +02:00
|
|
|
popular.add_child(Node.s16("rank", rank))
|
|
|
|
popular.add_child(Node.s16("chara_num", charaid))
|
2019-12-08 22:43:49 +01:00
|
|
|
rank = rank + 1
|
|
|
|
|
|
|
|
# Output the hit chart
|
2023-02-17 04:02:41 +01:00
|
|
|
for songid, _plays in self.data.local.music.get_hit_chart(
|
2023-07-29 21:12:37 +02:00
|
|
|
self.game, self.music_version, 500
|
2022-10-15 20:56:30 +02:00
|
|
|
):
|
|
|
|
popular_music = Node.void("popular_music")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(popular_music)
|
2022-10-15 20:56:30 +02:00
|
|
|
popular_music.add_child(Node.s16("music_num", songid))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Output goods prices
|
|
|
|
for goodsid in range(1, 421):
|
|
|
|
if goodsid >= 1 and goodsid <= 80:
|
|
|
|
price = 60
|
|
|
|
elif goodsid >= 81 and goodsid <= 120:
|
|
|
|
price = 250
|
|
|
|
elif goodsid >= 121 and goodsid <= 142:
|
|
|
|
price = 500
|
|
|
|
elif goodsid >= 143 and goodsid <= 300:
|
|
|
|
price = 100
|
|
|
|
elif goodsid >= 301 and goodsid <= 420:
|
|
|
|
price = 150
|
|
|
|
else:
|
2022-10-15 20:56:30 +02:00
|
|
|
raise Exception("Invalid goods ID!")
|
|
|
|
goods = Node.void("goods")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(goods)
|
2022-10-15 20:56:30 +02:00
|
|
|
goods.add_child(Node.s16("goods_id", goodsid))
|
|
|
|
goods.add_child(Node.s32("price", price))
|
|
|
|
goods.add_child(Node.s16("goods_type", 0))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
def handle_pcb23_boot_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
return Node.void("pcb23")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
def handle_pcb23_error_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
return Node.void("pcb23")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
def handle_pcb23_dlstatus_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
return Node.void("pcb23")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
def handle_pcb23_write_request(self, request: Node) -> Node:
|
|
|
|
# Update the name of this cab for admin purposes
|
2022-10-15 20:56:30 +02:00
|
|
|
self.update_machine_name(request.child_value("pcb_setting/name"))
|
|
|
|
return Node.void("pcb23")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
def handle_info23_common_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
info = Node.void("info23")
|
2019-12-08 22:43:49 +01:00
|
|
|
self.__construct_common_info(info)
|
|
|
|
return info
|
|
|
|
|
2022-10-04 05:31:52 +02:00
|
|
|
def handle_lobby22_requests(self, request: Node) -> Node:
|
2019-12-08 22:43:49 +01:00
|
|
|
# Stub out the entire lobby22 service (yes, its lobby22 in Pop'n 23)
|
2022-10-15 20:56:30 +02:00
|
|
|
return Node.void("lobby22")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
def handle_player23_start_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
root = Node.void("player23")
|
|
|
|
root.add_child(Node.s32("play_id", 0))
|
2019-12-08 22:43:49 +01:00
|
|
|
self.__construct_common_info(root)
|
|
|
|
return root
|
|
|
|
|
|
|
|
def handle_player23_logout_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
return Node.void("player23")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
def handle_player23_read_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
refid = request.child_value("ref_id")
|
2019-12-08 22:43:49 +01:00
|
|
|
root = self.get_profile_by_refid(refid, self.OLD_PROFILE_FALLTHROUGH)
|
|
|
|
if root is None:
|
2022-10-15 20:56:30 +02:00
|
|
|
root = Node.void("player23")
|
|
|
|
root.add_child(Node.s8("result", 2))
|
2019-12-08 22:43:49 +01:00
|
|
|
return root
|
|
|
|
|
|
|
|
def handle_player23_write_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
refid = request.child_value("ref_id")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
if refid is not None:
|
|
|
|
userid = self.data.remote.user.from_refid(self.game, self.version, refid)
|
|
|
|
else:
|
|
|
|
userid = None
|
|
|
|
|
|
|
|
if userid is not None:
|
2022-10-15 20:56:30 +02:00
|
|
|
oldprofile = self.get_profile(userid) or Profile(
|
|
|
|
self.game, self.version, refid, 0
|
|
|
|
)
|
2019-12-08 22:43:49 +01:00
|
|
|
newprofile = self.unformat_profile(userid, request, oldprofile)
|
|
|
|
|
|
|
|
if newprofile is not None:
|
|
|
|
self.put_profile(userid, newprofile)
|
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
return Node.void("player23")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
def handle_player23_new_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
refid = request.child_value("ref_id")
|
|
|
|
name = request.child_value("name")
|
2019-12-08 22:43:49 +01:00
|
|
|
root = self.new_profile_by_refid(refid, name)
|
|
|
|
if root is None:
|
2022-10-15 20:56:30 +02:00
|
|
|
root = Node.void("player23")
|
|
|
|
root.add_child(Node.s8("result", 2))
|
2019-12-08 22:43:49 +01:00
|
|
|
return root
|
|
|
|
|
|
|
|
def handle_player23_conversion_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
refid = request.child_value("ref_id")
|
|
|
|
name = request.child_value("name")
|
|
|
|
chara = request.child_value("chara")
|
2019-12-08 22:43:49 +01:00
|
|
|
root = self.new_profile_by_refid(refid, name, chara)
|
|
|
|
if root is None:
|
2022-10-15 20:56:30 +02:00
|
|
|
root = Node.void("player23")
|
|
|
|
root.add_child(Node.s8("result", 2))
|
2019-12-08 22:43:49 +01:00
|
|
|
return root
|
|
|
|
|
|
|
|
def handle_player23_buy_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
refid = request.child_value("ref_id")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
if refid is not None:
|
|
|
|
userid = self.data.remote.user.from_refid(self.game, self.version, refid)
|
|
|
|
else:
|
|
|
|
userid = None
|
|
|
|
|
|
|
|
if userid is not None:
|
2022-10-15 20:56:30 +02:00
|
|
|
itemid = request.child_value("id")
|
|
|
|
itemtype = request.child_value("type")
|
|
|
|
itemparam = request.child_value("param")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
price = request.child_value("price")
|
|
|
|
lumina = request.child_value("lumina")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
if lumina >= price:
|
|
|
|
# Update player lumina balance
|
2022-10-15 20:56:30 +02:00
|
|
|
profile = self.get_profile(userid) or Profile(
|
|
|
|
self.game, self.version, refid, 0
|
|
|
|
)
|
|
|
|
profile.replace_int("lumina", lumina - price)
|
2019-12-08 22:43:49 +01:00
|
|
|
self.put_profile(userid, profile)
|
|
|
|
|
|
|
|
# Grant the object
|
|
|
|
self.data.local.user.put_achievement(
|
|
|
|
self.game,
|
|
|
|
self.version,
|
|
|
|
userid,
|
|
|
|
itemid,
|
2022-10-15 20:56:30 +02:00
|
|
|
f"item_{itemtype}",
|
2019-12-08 22:43:49 +01:00
|
|
|
{
|
2022-10-15 20:56:30 +02:00
|
|
|
"param": itemparam,
|
|
|
|
"is_new": True,
|
2019-12-08 22:43:49 +01:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
return Node.void("player23")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
def handle_player23_read_score_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
refid = request.child_value("ref_id")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
root = Node.void("player23")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
userid = self.data.remote.user.from_refid(self.game, self.version, refid)
|
|
|
|
if userid is not None:
|
2023-07-29 21:12:37 +02:00
|
|
|
scores = self.data.remote.music.get_scores(
|
|
|
|
self.game, self.music_version, userid
|
|
|
|
)
|
2019-12-08 22:43:49 +01:00
|
|
|
else:
|
|
|
|
scores = []
|
|
|
|
|
|
|
|
for score in scores:
|
|
|
|
# Skip any scores for chart types we don't support
|
|
|
|
if score.chart not in [
|
|
|
|
self.CHART_TYPE_EASY,
|
|
|
|
self.CHART_TYPE_NORMAL,
|
|
|
|
self.CHART_TYPE_HYPER,
|
|
|
|
self.CHART_TYPE_EX,
|
|
|
|
]:
|
|
|
|
continue
|
2022-10-15 20:56:30 +02:00
|
|
|
if score.data.get_int("medal") == self.PLAY_MEDAL_NO_PLAY:
|
2021-09-06 03:30:43 +02:00
|
|
|
continue
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
points = score.points
|
2022-10-15 20:56:30 +02:00
|
|
|
medal = score.data.get_int("medal")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
music = Node.void("music")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(music)
|
2022-10-15 20:56:30 +02:00
|
|
|
music.add_child(Node.s16("music_num", score.id))
|
|
|
|
music.add_child(
|
|
|
|
Node.u8(
|
|
|
|
"sheet_num",
|
|
|
|
{
|
|
|
|
self.CHART_TYPE_EASY: self.GAME_CHART_TYPE_EASY,
|
|
|
|
self.CHART_TYPE_NORMAL: self.GAME_CHART_TYPE_NORMAL,
|
|
|
|
self.CHART_TYPE_HYPER: self.GAME_CHART_TYPE_HYPER,
|
|
|
|
self.CHART_TYPE_EX: self.GAME_CHART_TYPE_EX,
|
|
|
|
}[score.chart],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
music.add_child(Node.s32("score", points))
|
|
|
|
music.add_child(
|
|
|
|
Node.u8(
|
|
|
|
"clear_type",
|
|
|
|
{
|
|
|
|
self.PLAY_MEDAL_CIRCLE_FAILED: self.GAME_PLAY_MEDAL_CIRCLE_FAILED,
|
|
|
|
self.PLAY_MEDAL_DIAMOND_FAILED: self.GAME_PLAY_MEDAL_DIAMOND_FAILED,
|
|
|
|
self.PLAY_MEDAL_STAR_FAILED: self.GAME_PLAY_MEDAL_STAR_FAILED,
|
|
|
|
self.PLAY_MEDAL_EASY_CLEAR: self.GAME_PLAY_MEDAL_EASY_CLEAR,
|
|
|
|
self.PLAY_MEDAL_CIRCLE_CLEARED: self.GAME_PLAY_MEDAL_CIRCLE_CLEARED,
|
|
|
|
self.PLAY_MEDAL_DIAMOND_CLEARED: self.GAME_PLAY_MEDAL_DIAMOND_CLEARED,
|
|
|
|
self.PLAY_MEDAL_STAR_CLEARED: self.GAME_PLAY_MEDAL_STAR_CLEARED,
|
|
|
|
self.PLAY_MEDAL_CIRCLE_FULL_COMBO: self.GAME_PLAY_MEDAL_CIRCLE_FULL_COMBO,
|
|
|
|
self.PLAY_MEDAL_DIAMOND_FULL_COMBO: self.GAME_PLAY_MEDAL_DIAMOND_FULL_COMBO,
|
|
|
|
self.PLAY_MEDAL_STAR_FULL_COMBO: self.GAME_PLAY_MEDAL_STAR_FULL_COMBO,
|
|
|
|
self.PLAY_MEDAL_PERFECT: self.GAME_PLAY_MEDAL_PERFECT,
|
|
|
|
}[medal],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
music.add_child(Node.s16("cnt", score.plays))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
return root
|
|
|
|
|
2020-05-12 23:03:01 +02:00
|
|
|
def handle_player23_friend_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
refid = request.attribute("ref_id")
|
|
|
|
no = int(request.attribute("no", "-1"))
|
2020-05-12 23:03:01 +02:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
root = Node.void("player23")
|
2020-05-12 23:03:01 +02:00
|
|
|
if no < 0:
|
2022-10-15 20:56:30 +02:00
|
|
|
root.add_child(Node.s8("result", 2))
|
2020-05-12 23:03:01 +02:00
|
|
|
return root
|
|
|
|
|
|
|
|
# Look up our own user ID based on the RefID provided.
|
|
|
|
userid = self.data.remote.user.from_refid(self.game, self.version, refid)
|
|
|
|
if userid is None:
|
2022-10-15 20:56:30 +02:00
|
|
|
root.add_child(Node.s8("result", 2))
|
2020-05-12 23:03:01 +02:00
|
|
|
return root
|
|
|
|
|
|
|
|
# Grab the links that we care about.
|
|
|
|
links = self.data.local.user.get_links(self.game, self.version, userid)
|
2021-08-20 06:43:13 +02:00
|
|
|
profiles: Dict[UserID, Profile] = {}
|
2020-05-12 23:03:01 +02:00
|
|
|
rivals: List[Link] = []
|
|
|
|
for link in links:
|
2022-10-15 20:56:30 +02:00
|
|
|
if link.type != "rival":
|
2020-05-12 23:03:01 +02:00
|
|
|
continue
|
|
|
|
|
|
|
|
other_profile = self.get_profile(link.other_userid)
|
|
|
|
if other_profile is None:
|
|
|
|
continue
|
|
|
|
profiles[link.other_userid] = other_profile
|
|
|
|
rivals.append(link)
|
|
|
|
|
|
|
|
# Somehow requested an invalid profile.
|
|
|
|
if no >= len(rivals):
|
2022-10-15 20:56:30 +02:00
|
|
|
root.add_child(Node.s8("result", 2))
|
2020-05-12 23:03:01 +02:00
|
|
|
return root
|
|
|
|
rivalid = links[no].other_userid
|
|
|
|
rivalprofile = profiles[rivalid]
|
2023-07-29 21:12:37 +02:00
|
|
|
scores = self.data.remote.music.get_scores(
|
|
|
|
self.game, self.music_version, rivalid
|
|
|
|
)
|
2020-05-12 23:03:01 +02:00
|
|
|
|
|
|
|
# First, output general profile info.
|
2022-10-15 20:56:30 +02:00
|
|
|
friend = Node.void("friend")
|
2020-05-12 23:03:01 +02:00
|
|
|
root.add_child(friend)
|
2022-10-15 20:56:30 +02:00
|
|
|
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_num", rivalprofile.get_int("chara", -1)))
|
2020-05-12 23:03:01 +02:00
|
|
|
# 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.
|
2022-10-15 20:56:30 +02:00
|
|
|
friend.add_child(Node.s8("is_open", 1))
|
2020-05-12 23:03:01 +02:00
|
|
|
|
|
|
|
for score in scores:
|
|
|
|
# Skip any scores for chart types we don't support
|
|
|
|
if score.chart not in [
|
|
|
|
self.CHART_TYPE_EASY,
|
|
|
|
self.CHART_TYPE_NORMAL,
|
|
|
|
self.CHART_TYPE_HYPER,
|
|
|
|
self.CHART_TYPE_EX,
|
|
|
|
]:
|
|
|
|
continue
|
2022-10-15 20:56:30 +02:00
|
|
|
if score.data.get_int("medal") == self.PLAY_MEDAL_NO_PLAY:
|
2021-09-06 03:30:43 +02:00
|
|
|
continue
|
2020-05-12 23:03:01 +02:00
|
|
|
|
|
|
|
points = score.points
|
2022-10-15 20:56:30 +02:00
|
|
|
medal = score.data.get_int("medal")
|
2020-05-12 23:03:01 +02:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
music = Node.void("music")
|
2020-05-12 23:03:01 +02:00
|
|
|
friend.add_child(music)
|
2022-10-15 20:56:30 +02:00
|
|
|
music.set_attribute("music_num", str(score.id))
|
|
|
|
music.set_attribute(
|
|
|
|
"sheet_num",
|
|
|
|
str(
|
|
|
|
{
|
|
|
|
self.CHART_TYPE_EASY: self.GAME_CHART_TYPE_EASY,
|
|
|
|
self.CHART_TYPE_NORMAL: self.GAME_CHART_TYPE_NORMAL,
|
|
|
|
self.CHART_TYPE_HYPER: self.GAME_CHART_TYPE_HYPER,
|
|
|
|
self.CHART_TYPE_EX: self.GAME_CHART_TYPE_EX,
|
|
|
|
}[score.chart]
|
|
|
|
),
|
|
|
|
)
|
|
|
|
music.set_attribute("score", str(points))
|
|
|
|
music.set_attribute(
|
|
|
|
"clearmedal",
|
|
|
|
str(
|
|
|
|
{
|
|
|
|
self.PLAY_MEDAL_CIRCLE_FAILED: self.GAME_PLAY_MEDAL_CIRCLE_FAILED,
|
|
|
|
self.PLAY_MEDAL_DIAMOND_FAILED: self.GAME_PLAY_MEDAL_DIAMOND_FAILED,
|
|
|
|
self.PLAY_MEDAL_STAR_FAILED: self.GAME_PLAY_MEDAL_STAR_FAILED,
|
|
|
|
self.PLAY_MEDAL_EASY_CLEAR: self.GAME_PLAY_MEDAL_EASY_CLEAR,
|
|
|
|
self.PLAY_MEDAL_CIRCLE_CLEARED: self.GAME_PLAY_MEDAL_CIRCLE_CLEARED,
|
|
|
|
self.PLAY_MEDAL_DIAMOND_CLEARED: self.GAME_PLAY_MEDAL_DIAMOND_CLEARED,
|
|
|
|
self.PLAY_MEDAL_STAR_CLEARED: self.GAME_PLAY_MEDAL_STAR_CLEARED,
|
|
|
|
self.PLAY_MEDAL_CIRCLE_FULL_COMBO: self.GAME_PLAY_MEDAL_CIRCLE_FULL_COMBO,
|
|
|
|
self.PLAY_MEDAL_DIAMOND_FULL_COMBO: self.GAME_PLAY_MEDAL_DIAMOND_FULL_COMBO,
|
|
|
|
self.PLAY_MEDAL_STAR_FULL_COMBO: self.GAME_PLAY_MEDAL_STAR_FULL_COMBO,
|
|
|
|
self.PLAY_MEDAL_PERFECT: self.GAME_PLAY_MEDAL_PERFECT,
|
|
|
|
}[medal]
|
|
|
|
),
|
|
|
|
)
|
2020-05-12 23:03:01 +02:00
|
|
|
|
|
|
|
return root
|
|
|
|
|
2019-12-08 22:43:49 +01:00
|
|
|
def handle_player23_write_music_request(self, request: Node) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
refid = request.child_value("ref_id")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
root = Node.void("player23")
|
2019-12-08 22:43:49 +01:00
|
|
|
if refid is None:
|
|
|
|
return root
|
|
|
|
|
|
|
|
userid = self.data.remote.user.from_refid(self.game, self.version, refid)
|
|
|
|
if userid is None:
|
|
|
|
return root
|
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
songid = request.child_value("music_num")
|
2019-12-08 22:43:49 +01:00
|
|
|
chart = {
|
|
|
|
self.GAME_CHART_TYPE_EASY: self.CHART_TYPE_EASY,
|
|
|
|
self.GAME_CHART_TYPE_NORMAL: self.CHART_TYPE_NORMAL,
|
|
|
|
self.GAME_CHART_TYPE_HYPER: self.CHART_TYPE_HYPER,
|
|
|
|
self.GAME_CHART_TYPE_EX: self.CHART_TYPE_EX,
|
2022-10-15 20:56:30 +02:00
|
|
|
}[request.child_value("sheet_num")]
|
|
|
|
medal = request.child_value("clearmedal")
|
|
|
|
points = request.child_value("score")
|
|
|
|
combo = request.child_value("combo")
|
2019-12-08 22:43:49 +01:00
|
|
|
stats = {
|
2022-10-15 20:56:30 +02:00
|
|
|
"cool": request.child_value("cool"),
|
|
|
|
"great": request.child_value("great"),
|
|
|
|
"good": request.child_value("good"),
|
|
|
|
"bad": request.child_value("bad"),
|
2019-12-08 22:43:49 +01:00
|
|
|
}
|
|
|
|
medal = {
|
|
|
|
self.GAME_PLAY_MEDAL_CIRCLE_FAILED: self.PLAY_MEDAL_CIRCLE_FAILED,
|
|
|
|
self.GAME_PLAY_MEDAL_DIAMOND_FAILED: self.PLAY_MEDAL_DIAMOND_FAILED,
|
|
|
|
self.GAME_PLAY_MEDAL_STAR_FAILED: self.PLAY_MEDAL_STAR_FAILED,
|
|
|
|
self.GAME_PLAY_MEDAL_EASY_CLEAR: self.PLAY_MEDAL_EASY_CLEAR,
|
|
|
|
self.GAME_PLAY_MEDAL_CIRCLE_CLEARED: self.PLAY_MEDAL_CIRCLE_CLEARED,
|
|
|
|
self.GAME_PLAY_MEDAL_DIAMOND_CLEARED: self.PLAY_MEDAL_DIAMOND_CLEARED,
|
|
|
|
self.GAME_PLAY_MEDAL_STAR_CLEARED: self.PLAY_MEDAL_STAR_CLEARED,
|
|
|
|
self.GAME_PLAY_MEDAL_CIRCLE_FULL_COMBO: self.PLAY_MEDAL_CIRCLE_FULL_COMBO,
|
|
|
|
self.GAME_PLAY_MEDAL_DIAMOND_FULL_COMBO: self.PLAY_MEDAL_DIAMOND_FULL_COMBO,
|
|
|
|
self.GAME_PLAY_MEDAL_STAR_FULL_COMBO: self.PLAY_MEDAL_STAR_FULL_COMBO,
|
|
|
|
self.GAME_PLAY_MEDAL_PERFECT: self.PLAY_MEDAL_PERFECT,
|
|
|
|
}[medal]
|
2022-10-15 20:56:30 +02:00
|
|
|
self.update_score(
|
|
|
|
userid, songid, chart, points, medal, combo=combo, stats=stats
|
|
|
|
)
|
2021-09-04 18:06:00 +02:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
if request.child_value("is_image_store") == 1:
|
2021-09-06 19:35:05 +02:00
|
|
|
self.broadcast_score(userid, songid, chart, medal, points, combo, stats)
|
2021-09-04 18:06:00 +02:00
|
|
|
|
2019-12-08 22:43:49 +01:00
|
|
|
return root
|
|
|
|
|
2021-08-20 06:43:13 +02:00
|
|
|
def format_conversion(self, userid: UserID, profile: Profile) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
root = Node.void("player23")
|
|
|
|
root.add_child(Node.string("name", profile.get_str("name", "なし")))
|
|
|
|
root.add_child(Node.s16("chara", profile.get_int("chara", -1)))
|
|
|
|
root.add_child(Node.s8("result", 1))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2021-09-03 06:34:19 +02:00
|
|
|
# Scores
|
2023-07-29 21:12:37 +02:00
|
|
|
scores = self.data.remote.music.get_scores(
|
|
|
|
self.game, self.music_version, userid
|
|
|
|
)
|
2019-12-08 22:43:49 +01:00
|
|
|
for score in scores:
|
|
|
|
# Skip any scores for chart types we don't support
|
|
|
|
if score.chart not in [
|
|
|
|
self.CHART_TYPE_EASY,
|
|
|
|
self.CHART_TYPE_NORMAL,
|
|
|
|
self.CHART_TYPE_HYPER,
|
|
|
|
self.CHART_TYPE_EX,
|
|
|
|
]:
|
|
|
|
continue
|
2022-10-15 20:56:30 +02:00
|
|
|
if score.data.get_int("medal") == self.PLAY_MEDAL_NO_PLAY:
|
2021-09-06 03:30:43 +02:00
|
|
|
continue
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
music = Node.void("music")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(music)
|
2022-10-15 20:56:30 +02:00
|
|
|
music.add_child(Node.s16("music_num", score.id))
|
|
|
|
music.add_child(
|
|
|
|
Node.u8(
|
|
|
|
"sheet_num",
|
|
|
|
{
|
|
|
|
self.CHART_TYPE_EASY: self.GAME_CHART_TYPE_EASY,
|
|
|
|
self.CHART_TYPE_NORMAL: self.GAME_CHART_TYPE_NORMAL,
|
|
|
|
self.CHART_TYPE_HYPER: self.GAME_CHART_TYPE_HYPER,
|
|
|
|
self.CHART_TYPE_EX: self.GAME_CHART_TYPE_EX,
|
|
|
|
}[score.chart],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
music.add_child(Node.s32("score", score.points))
|
|
|
|
music.add_child(
|
|
|
|
Node.u8(
|
|
|
|
"clear_type",
|
|
|
|
{
|
|
|
|
self.PLAY_MEDAL_CIRCLE_FAILED: self.GAME_PLAY_MEDAL_CIRCLE_FAILED,
|
|
|
|
self.PLAY_MEDAL_DIAMOND_FAILED: self.GAME_PLAY_MEDAL_DIAMOND_FAILED,
|
|
|
|
self.PLAY_MEDAL_STAR_FAILED: self.GAME_PLAY_MEDAL_STAR_FAILED,
|
|
|
|
self.PLAY_MEDAL_EASY_CLEAR: self.GAME_PLAY_MEDAL_EASY_CLEAR,
|
|
|
|
self.PLAY_MEDAL_CIRCLE_CLEARED: self.GAME_PLAY_MEDAL_CIRCLE_CLEARED,
|
|
|
|
self.PLAY_MEDAL_DIAMOND_CLEARED: self.GAME_PLAY_MEDAL_DIAMOND_CLEARED,
|
|
|
|
self.PLAY_MEDAL_STAR_CLEARED: self.GAME_PLAY_MEDAL_STAR_CLEARED,
|
|
|
|
self.PLAY_MEDAL_CIRCLE_FULL_COMBO: self.GAME_PLAY_MEDAL_CIRCLE_FULL_COMBO,
|
|
|
|
self.PLAY_MEDAL_DIAMOND_FULL_COMBO: self.GAME_PLAY_MEDAL_DIAMOND_FULL_COMBO,
|
|
|
|
self.PLAY_MEDAL_STAR_FULL_COMBO: self.GAME_PLAY_MEDAL_STAR_FULL_COMBO,
|
|
|
|
self.PLAY_MEDAL_PERFECT: self.GAME_PLAY_MEDAL_PERFECT,
|
|
|
|
}[score.data.get_int("medal")],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
music.add_child(Node.s16("cnt", score.plays))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
return root
|
|
|
|
|
|
|
|
def format_extid(self, extid: int) -> str:
|
|
|
|
data = str(extid)
|
2022-10-15 20:56:30 +02:00
|
|
|
crc = abs(binascii.crc32(data.encode("ascii"))) % 10000
|
|
|
|
return f"{data}{crc:04d}"
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2021-08-20 06:43:13 +02:00
|
|
|
def format_profile(self, userid: UserID, profile: Profile) -> Node:
|
2022-10-15 20:56:30 +02:00
|
|
|
root = Node.void("player23")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Mark this as a current profile
|
2022-10-15 20:56:30 +02:00
|
|
|
root.add_child(Node.s8("result", 0))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Account stuff
|
2022-10-15 20:56:30 +02:00
|
|
|
account = Node.void("account")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(account)
|
2022-10-15 20:56:30 +02:00
|
|
|
account.add_child(Node.string("g_pm_id", self.format_extid(profile.extid)))
|
|
|
|
account.add_child(Node.string("name", profile.get_str("name", "なし")))
|
|
|
|
account.add_child(Node.s8("tutorial", profile.get_int("tutorial")))
|
|
|
|
account.add_child(Node.s16("area_id", profile.get_int("area_id")))
|
|
|
|
account.add_child(Node.s16("lumina", profile.get_int("lumina", 300)))
|
|
|
|
account.add_child(Node.s16("read_news", profile.get_int("read_news")))
|
|
|
|
account.add_child(
|
|
|
|
Node.bool("welcom_pack", False)
|
|
|
|
) # Set this to true to grant extra stage no matter what.
|
|
|
|
account.add_child(
|
|
|
|
Node.s16_array("medal_set", profile.get_int_array("medal_set", 4))
|
|
|
|
)
|
|
|
|
account.add_child(
|
|
|
|
Node.s16_array("nice", profile.get_int_array("nice", 30, [-1] * 30))
|
|
|
|
)
|
|
|
|
account.add_child(
|
|
|
|
Node.s16_array(
|
|
|
|
"favorite_chara", profile.get_int_array("favorite_chara", 20, [-1] * 20)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
account.add_child(
|
|
|
|
Node.s16_array("special_area", profile.get_int_array("special_area", 8))
|
|
|
|
)
|
|
|
|
account.add_child(
|
|
|
|
Node.s16_array(
|
|
|
|
"chocolate_charalist",
|
|
|
|
profile.get_int_array("chocolate_charalist", 5, [-1] * 5),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
account.add_child(
|
|
|
|
Node.s16_array(
|
|
|
|
"teacher_setting", profile.get_int_array("teacher_setting", 10)
|
|
|
|
)
|
|
|
|
)
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Stuff we never change
|
2022-10-15 20:56:30 +02:00
|
|
|
account.add_child(Node.s8("staff", 0))
|
|
|
|
account.add_child(Node.s16("item_type", 0))
|
|
|
|
account.add_child(Node.s16("item_id", 0))
|
|
|
|
account.add_child(Node.s8("is_conv", 0))
|
|
|
|
account.add_child(Node.bool("meteor_flg", True))
|
|
|
|
account.add_child(Node.s16_array("license_data", [-1] * 20))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Add statistics section
|
2022-10-15 20:56:30 +02:00
|
|
|
last_played = [
|
|
|
|
x[0]
|
|
|
|
for x in self.data.local.music.get_last_played(
|
2023-07-29 21:12:37 +02:00
|
|
|
self.game, self.music_version, userid, 5
|
2022-10-15 20:56:30 +02:00
|
|
|
)
|
|
|
|
]
|
|
|
|
most_played = [
|
|
|
|
x[0]
|
|
|
|
for x in self.data.local.music.get_most_played(
|
2023-07-29 21:12:37 +02:00
|
|
|
self.game, self.music_version, userid, 10
|
2022-10-15 20:56:30 +02:00
|
|
|
)
|
|
|
|
]
|
2019-12-08 22:43:49 +01:00
|
|
|
while len(last_played) < 5:
|
|
|
|
last_played.append(-1)
|
|
|
|
while len(most_played) < 10:
|
|
|
|
most_played.append(-1)
|
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
account.add_child(Node.s16_array("my_best", most_played))
|
|
|
|
account.add_child(Node.s16_array("latest_music", last_played))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2020-05-12 23:03:01 +02:00
|
|
|
# Number of rivals that are active for this version.
|
|
|
|
links = self.data.local.user.get_links(self.game, self.version, userid)
|
|
|
|
rivalcount = 0
|
|
|
|
for link in links:
|
2022-10-15 20:56:30 +02:00
|
|
|
if link.type != "rival":
|
2020-05-12 23:03:01 +02:00
|
|
|
continue
|
|
|
|
|
|
|
|
if not self.has_profile(link.other_userid):
|
|
|
|
continue
|
|
|
|
|
|
|
|
# This profile is valid.
|
|
|
|
rivalcount += 1
|
2022-10-15 20:56:30 +02:00
|
|
|
account.add_child(Node.u8("active_fr_num", rivalcount))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# player statistics
|
|
|
|
statistics = self.get_play_statistics(userid)
|
2022-10-15 20:56:30 +02:00
|
|
|
account.add_child(Node.s16("total_play_cnt", statistics.total_plays))
|
|
|
|
account.add_child(Node.s16("today_play_cnt", statistics.today_plays))
|
|
|
|
account.add_child(Node.s16("consecutive_days", statistics.consecutive_days))
|
|
|
|
account.add_child(Node.s16("total_days", statistics.total_days))
|
|
|
|
account.add_child(Node.s16("interval_day", 0))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2021-09-04 18:06:00 +02:00
|
|
|
# eAmuse account link
|
2022-10-15 20:56:30 +02:00
|
|
|
eaappli = Node.void("eaappli")
|
2021-09-04 18:06:00 +02:00
|
|
|
root.add_child(eaappli)
|
2022-10-15 20:56:30 +02:00
|
|
|
eaappli.add_child(
|
|
|
|
Node.s8(
|
|
|
|
"relation",
|
|
|
|
1 if self.data.triggers.has_broadcast_destination(self.game) else -1,
|
|
|
|
)
|
|
|
|
)
|
2021-09-04 18:06:00 +02:00
|
|
|
|
2019-12-08 22:43:49 +01:00
|
|
|
# Set up info node
|
2022-10-15 20:56:30 +02:00
|
|
|
info = Node.void("info")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(info)
|
2022-10-15 20:56:30 +02:00
|
|
|
info.add_child(Node.u16("ep", profile.get_int("ep")))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Set up last information
|
2022-10-15 20:56:30 +02:00
|
|
|
config = Node.void("config")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(config)
|
2022-10-15 20:56:30 +02:00
|
|
|
config.add_child(Node.u8("mode", profile.get_int("mode")))
|
|
|
|
config.add_child(Node.s16("chara", profile.get_int("chara", -1)))
|
|
|
|
config.add_child(Node.s16("music", profile.get_int("music", -1)))
|
|
|
|
config.add_child(Node.u8("sheet", profile.get_int("sheet")))
|
|
|
|
config.add_child(Node.s8("category", profile.get_int("category", -1)))
|
|
|
|
config.add_child(Node.s8("sub_category", profile.get_int("sub_category", -1)))
|
|
|
|
config.add_child(
|
|
|
|
Node.s8("chara_category", profile.get_int("chara_category", -1))
|
|
|
|
)
|
|
|
|
config.add_child(Node.s16("course_id", profile.get_int("course_id", -1)))
|
|
|
|
config.add_child(Node.s8("course_folder", profile.get_int("course_folder", -1)))
|
|
|
|
config.add_child(Node.s8("ms_banner_disp", profile.get_int("ms_banner_disp")))
|
|
|
|
config.add_child(Node.s8("ms_down_info", profile.get_int("ms_down_info")))
|
|
|
|
config.add_child(Node.s8("ms_side_info", profile.get_int("ms_side_info")))
|
|
|
|
config.add_child(Node.s8("ms_raise_type", profile.get_int("ms_raise_type")))
|
|
|
|
config.add_child(Node.s8("ms_rnd_type", profile.get_int("ms_rnd_type")))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Player options
|
2022-10-15 20:56:30 +02:00
|
|
|
option = Node.void("option")
|
|
|
|
option_dict = profile.get_dict("option")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(option)
|
2022-10-15 20:56:30 +02:00
|
|
|
option.add_child(Node.s16("hispeed", option_dict.get_int("hispeed")))
|
|
|
|
option.add_child(Node.u8("popkun", option_dict.get_int("popkun")))
|
|
|
|
option.add_child(Node.bool("hidden", option_dict.get_bool("hidden")))
|
|
|
|
option.add_child(Node.s16("hidden_rate", option_dict.get_int("hidden_rate")))
|
|
|
|
option.add_child(Node.bool("sudden", option_dict.get_bool("sudden")))
|
|
|
|
option.add_child(Node.s16("sudden_rate", option_dict.get_int("sudden_rate")))
|
|
|
|
option.add_child(Node.s8("randmir", option_dict.get_int("randmir")))
|
|
|
|
option.add_child(Node.s8("gauge_type", option_dict.get_int("gauge_type")))
|
|
|
|
option.add_child(Node.u8("ojama_0", option_dict.get_int("ojama_0")))
|
|
|
|
option.add_child(Node.u8("ojama_1", option_dict.get_int("ojama_1")))
|
|
|
|
option.add_child(Node.bool("forever_0", option_dict.get_bool("forever_0")))
|
|
|
|
option.add_child(Node.bool("forever_1", option_dict.get_bool("forever_1")))
|
|
|
|
option.add_child(
|
|
|
|
Node.bool("full_setting", option_dict.get_bool("full_setting"))
|
|
|
|
)
|
|
|
|
option.add_child(Node.u8("judge", option_dict.get_int("judge")))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Unknown custom category stuff?
|
2022-10-15 20:56:30 +02:00
|
|
|
custom_cate = Node.void("custom_cate")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(custom_cate)
|
2022-10-15 20:56:30 +02:00
|
|
|
custom_cate.add_child(Node.s8("valid", 0))
|
|
|
|
custom_cate.add_child(Node.s8("lv_min", -1))
|
|
|
|
custom_cate.add_child(Node.s8("lv_max", -1))
|
|
|
|
custom_cate.add_child(Node.s8("medal_min", -1))
|
|
|
|
custom_cate.add_child(Node.s8("medal_max", -1))
|
|
|
|
custom_cate.add_child(Node.s8("friend_no", -1))
|
|
|
|
custom_cate.add_child(Node.s8("score_flg", -1))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2021-09-09 03:03:23 +02:00
|
|
|
game_config = self.get_game_config()
|
2022-10-15 20:56:30 +02:00
|
|
|
if game_config.get_bool("force_unlock_songs"):
|
|
|
|
songs = {
|
|
|
|
song.id
|
2023-07-29 21:12:37 +02:00
|
|
|
for song in self.data.local.music.get_all_songs(
|
|
|
|
self.game, self.music_version
|
|
|
|
)
|
2022-10-15 20:56:30 +02:00
|
|
|
}
|
2021-09-09 03:03:23 +02:00
|
|
|
for song in songs:
|
2022-10-15 20:56:30 +02:00
|
|
|
item = Node.void("item")
|
2021-09-09 03:03:23 +02:00
|
|
|
root.add_child(item)
|
2022-10-15 20:56:30 +02:00
|
|
|
item.add_child(Node.u8("type", 0))
|
|
|
|
item.add_child(Node.u16("id", song))
|
|
|
|
item.add_child(Node.u16("param", 15))
|
|
|
|
item.add_child(Node.bool("is_new", False))
|
2021-09-09 03:03:23 +02:00
|
|
|
|
2019-12-08 22:43:49 +01:00
|
|
|
# Set up achievements
|
2022-10-15 20:56:30 +02:00
|
|
|
achievements = self.data.local.user.get_achievements(
|
|
|
|
self.game, self.version, userid
|
|
|
|
)
|
2019-12-08 22:43:49 +01:00
|
|
|
for achievement in achievements:
|
2022-10-15 20:56:30 +02:00
|
|
|
if achievement.type[:5] == "item_":
|
2019-12-08 22:43:49 +01:00
|
|
|
itemtype = int(achievement.type[5:])
|
2022-10-15 20:56:30 +02:00
|
|
|
param = achievement.data.get_int("param")
|
|
|
|
is_new = achievement.data.get_bool("is_new")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Type is the type of unlock/item. Type 0 is song unlock in Eclale.
|
|
|
|
# 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 8 and 0. Might be
|
|
|
|
# what chart is available?
|
2022-10-15 20:56:30 +02:00
|
|
|
if game_config.get_bool("force_unlock_songs") and itemtype == 0:
|
2021-09-09 03:03:23 +02:00
|
|
|
# We already sent song unlocks in the force unlock section above.
|
|
|
|
continue
|
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
item = Node.void("item")
|
2021-09-09 03:05:19 +02:00
|
|
|
root.add_child(item)
|
2022-10-15 20:56:30 +02:00
|
|
|
item.add_child(Node.u8("type", itemtype))
|
|
|
|
item.add_child(Node.u16("id", achievement.id))
|
|
|
|
item.add_child(Node.u16("param", param))
|
|
|
|
item.add_child(Node.bool("is_new", is_new))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
elif achievement.type == "chara":
|
|
|
|
friendship = achievement.data.get_int("friendship")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
chara = Node.void("chara_param")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(chara)
|
2022-10-15 20:56:30 +02:00
|
|
|
chara.add_child(Node.u16("chara_id", achievement.id))
|
|
|
|
chara.add_child(Node.u16("friendship", friendship))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
elif achievement.type == "medal":
|
|
|
|
level = achievement.data.get_int("level")
|
|
|
|
exp = achievement.data.get_int("exp")
|
|
|
|
set_count = achievement.data.get_int("set_count")
|
|
|
|
get_count = achievement.data.get_int("get_count")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
medal = Node.void("medal")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(medal)
|
2022-10-15 20:56:30 +02:00
|
|
|
medal.add_child(Node.s16("medal_id", achievement.id))
|
|
|
|
medal.add_child(Node.s16("level", level))
|
|
|
|
medal.add_child(Node.s32("exp", exp))
|
|
|
|
medal.add_child(Node.s32("set_count", set_count))
|
|
|
|
medal.add_child(Node.s32("get_count", get_count))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2021-09-01 01:43:18 +02:00
|
|
|
# Character customizations
|
2022-10-15 20:56:30 +02:00
|
|
|
customize = Node.void("customize")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(customize)
|
2022-10-15 20:56:30 +02:00
|
|
|
customize.add_child(Node.u16("effect_left", profile.get_int("effect_left")))
|
|
|
|
customize.add_child(Node.u16("effect_center", profile.get_int("effect_center")))
|
|
|
|
customize.add_child(Node.u16("effect_right", profile.get_int("effect_right")))
|
|
|
|
customize.add_child(Node.u16("hukidashi", profile.get_int("hukidashi")))
|
|
|
|
customize.add_child(Node.u16("comment_1", profile.get_int("comment_1")))
|
|
|
|
customize.add_child(Node.u16("comment_2", profile.get_int("comment_2")))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# NetVS section
|
2022-10-15 20:56:30 +02:00
|
|
|
netvs = Node.void("netvs")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(netvs)
|
2022-10-15 20:56:30 +02:00
|
|
|
netvs.add_child(Node.s16_array("record", [0] * 6))
|
|
|
|
netvs.add_child(Node.string("dialog", ""))
|
|
|
|
netvs.add_child(Node.string("dialog", ""))
|
|
|
|
netvs.add_child(Node.string("dialog", ""))
|
|
|
|
netvs.add_child(Node.string("dialog", ""))
|
|
|
|
netvs.add_child(Node.string("dialog", ""))
|
|
|
|
netvs.add_child(Node.string("dialog", ""))
|
|
|
|
netvs.add_child(Node.s8_array("ojama_condition", [0] * 74))
|
|
|
|
netvs.add_child(Node.s8_array("set_ojama", [0] * 3))
|
|
|
|
netvs.add_child(Node.s8_array("set_recommend", [0] * 3))
|
|
|
|
netvs.add_child(Node.u32("netvs_play_cnt", 0))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Event stuff
|
2022-10-15 20:56:30 +02:00
|
|
|
event = Node.void("event")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(event)
|
2022-10-15 20:56:30 +02:00
|
|
|
event.add_child(Node.s16("enemy_medal", profile.get_int("event_enemy_medal")))
|
|
|
|
event.add_child(Node.s16("hp", profile.get_int("event_hp")))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Stamp stuff
|
2022-10-15 20:56:30 +02:00
|
|
|
stamp = Node.void("stamp")
|
2019-12-08 22:43:49 +01:00
|
|
|
root.add_child(stamp)
|
2022-10-15 20:56:30 +02:00
|
|
|
stamp.add_child(Node.s16("stamp_id", profile.get_int("stamp_id")))
|
|
|
|
stamp.add_child(Node.s16("cnt", profile.get_int("stamp_cnt")))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
return root
|
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
def unformat_profile(
|
|
|
|
self, userid: UserID, request: Node, oldprofile: Profile
|
|
|
|
) -> Profile:
|
2021-09-07 19:56:15 +02:00
|
|
|
newprofile = oldprofile.clone()
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
account = request.child("account")
|
2019-12-08 22:43:49 +01:00
|
|
|
if account is not None:
|
2022-10-15 20:56:30 +02:00
|
|
|
newprofile.replace_int("tutorial", account.child_value("tutorial"))
|
|
|
|
newprofile.replace_int("read_news", account.child_value("read_news"))
|
|
|
|
newprofile.replace_int("area_id", account.child_value("area_id"))
|
|
|
|
newprofile.replace_int("lumina", account.child_value("lumina"))
|
|
|
|
newprofile.replace_int_array(
|
|
|
|
"medal_set", 4, account.child_value("medal_set")
|
|
|
|
)
|
|
|
|
newprofile.replace_int_array("nice", 30, account.child_value("nice"))
|
|
|
|
newprofile.replace_int_array(
|
|
|
|
"favorite_chara", 20, account.child_value("favorite_chara")
|
|
|
|
)
|
|
|
|
newprofile.replace_int_array(
|
|
|
|
"special_area", 8, account.child_value("special_area")
|
|
|
|
)
|
|
|
|
newprofile.replace_int_array(
|
|
|
|
"chocolate_charalist", 5, account.child_value("chocolate_charalist")
|
|
|
|
)
|
|
|
|
newprofile.replace_int_array(
|
|
|
|
"teacher_setting", 10, account.child_value("teacher_setting")
|
|
|
|
)
|
|
|
|
|
|
|
|
info = request.child("info")
|
2019-12-08 22:43:49 +01:00
|
|
|
if info is not None:
|
2022-10-15 20:56:30 +02:00
|
|
|
newprofile.replace_int("ep", info.child_value("ep"))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
config = request.child("config")
|
2019-12-08 22:43:49 +01:00
|
|
|
if config is not None:
|
2022-10-15 20:56:30 +02:00
|
|
|
newprofile.replace_int("mode", config.child_value("mode"))
|
|
|
|
newprofile.replace_int("chara", config.child_value("chara"))
|
|
|
|
newprofile.replace_int("music", config.child_value("music"))
|
|
|
|
newprofile.replace_int("sheet", config.child_value("sheet"))
|
|
|
|
newprofile.replace_int("category", config.child_value("category"))
|
|
|
|
newprofile.replace_int("sub_category", config.child_value("sub_category"))
|
|
|
|
newprofile.replace_int(
|
|
|
|
"chara_category", config.child_value("chara_category")
|
|
|
|
)
|
|
|
|
newprofile.replace_int("course_id", config.child_value("course_id"))
|
|
|
|
newprofile.replace_int("course_folder", config.child_value("course_folder"))
|
|
|
|
newprofile.replace_int(
|
|
|
|
"ms_banner_disp", config.child_value("ms_banner_disp")
|
|
|
|
)
|
|
|
|
newprofile.replace_int("ms_down_info", config.child_value("ms_down_info"))
|
|
|
|
newprofile.replace_int("ms_side_info", config.child_value("ms_side_info"))
|
|
|
|
newprofile.replace_int("ms_raise_type", config.child_value("ms_raise_type"))
|
|
|
|
newprofile.replace_int("ms_rnd_type", config.child_value("ms_rnd_type"))
|
|
|
|
|
|
|
|
option_dict = newprofile.get_dict("option")
|
|
|
|
option = request.child("option")
|
2019-12-08 22:43:49 +01:00
|
|
|
if option is not None:
|
2022-10-15 20:56:30 +02:00
|
|
|
option_dict.replace_int("hispeed", option.child_value("hispeed"))
|
|
|
|
option_dict.replace_int("popkun", option.child_value("popkun"))
|
|
|
|
option_dict.replace_bool("hidden", option.child_value("hidden"))
|
|
|
|
option_dict.replace_int("hidden_rate", option.child_value("hidden_rate"))
|
|
|
|
option_dict.replace_bool("sudden", option.child_value("sudden"))
|
|
|
|
option_dict.replace_int("sudden_rate", option.child_value("sudden_rate"))
|
|
|
|
option_dict.replace_int("randmir", option.child_value("randmir"))
|
|
|
|
option_dict.replace_int("gauge_type", option.child_value("gauge_type"))
|
|
|
|
option_dict.replace_int("ojama_0", option.child_value("ojama_0"))
|
|
|
|
option_dict.replace_int("ojama_1", option.child_value("ojama_1"))
|
|
|
|
option_dict.replace_bool("forever_0", option.child_value("forever_0"))
|
|
|
|
option_dict.replace_bool("forever_1", option.child_value("forever_1"))
|
|
|
|
option_dict.replace_bool("full_setting", option.child_value("full_setting"))
|
|
|
|
option_dict.replace_int("judge", option.child_value("judge"))
|
|
|
|
newprofile.replace_dict("option", option_dict)
|
|
|
|
|
|
|
|
customize = request.child("customize")
|
2019-12-08 22:43:49 +01:00
|
|
|
if customize is not None:
|
2022-10-15 20:56:30 +02:00
|
|
|
newprofile.replace_int("effect_left", customize.child_value("effect_left"))
|
|
|
|
newprofile.replace_int(
|
|
|
|
"effect_center", customize.child_value("effect_center")
|
|
|
|
)
|
|
|
|
newprofile.replace_int(
|
|
|
|
"effect_right", customize.child_value("effect_right")
|
|
|
|
)
|
|
|
|
newprofile.replace_int("hukidashi", customize.child_value("hukidashi"))
|
|
|
|
newprofile.replace_int("comment_1", customize.child_value("comment_1"))
|
|
|
|
newprofile.replace_int("comment_2", customize.child_value("comment_2"))
|
|
|
|
|
|
|
|
event = request.child("event")
|
2019-12-08 22:43:49 +01:00
|
|
|
if event is not None:
|
2022-10-15 20:56:30 +02:00
|
|
|
newprofile.replace_int(
|
|
|
|
"event_enemy_medal", event.child_value("enemy_medal")
|
|
|
|
)
|
|
|
|
newprofile.replace_int("event_hp", event.child_value("hp"))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
stamp = request.child("stamp")
|
2019-12-08 22:43:49 +01:00
|
|
|
if stamp is not None:
|
2022-10-15 20:56:30 +02:00
|
|
|
newprofile.replace_int("stamp_id", stamp.child_value("stamp_id"))
|
|
|
|
newprofile.replace_int("stamp_cnt", stamp.child_value("cnt"))
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Extract achievements
|
2021-09-09 03:03:23 +02:00
|
|
|
game_config = self.get_game_config()
|
2019-12-08 22:43:49 +01:00
|
|
|
for node in request.children:
|
2022-10-15 20:56:30 +02:00
|
|
|
if node.name == "item":
|
|
|
|
itemid = node.child_value("id")
|
|
|
|
itemtype = node.child_value("type")
|
|
|
|
param = node.child_value("param")
|
|
|
|
is_new = node.child_value("is_new")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
if game_config.get_bool("force_unlock_songs") and itemtype == 0:
|
2021-09-09 03:03:23 +02:00
|
|
|
# If we enabled force song unlocks, don't save songs to the profile.
|
|
|
|
continue
|
|
|
|
|
2019-12-08 22:43:49 +01:00
|
|
|
self.data.local.user.put_achievement(
|
|
|
|
self.game,
|
|
|
|
self.version,
|
|
|
|
userid,
|
|
|
|
itemid,
|
2022-10-15 20:56:30 +02:00
|
|
|
f"item_{itemtype}",
|
2019-12-08 22:43:49 +01:00
|
|
|
{
|
2022-10-15 20:56:30 +02:00
|
|
|
"param": param,
|
|
|
|
"is_new": is_new,
|
2019-12-08 22:43:49 +01:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
elif node.name == "chara_param":
|
|
|
|
charaid = node.child_value("chara_id")
|
|
|
|
friendship = node.child_value("friendship")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
self.data.local.user.put_achievement(
|
|
|
|
self.game,
|
|
|
|
self.version,
|
|
|
|
userid,
|
|
|
|
charaid,
|
2022-10-15 20:56:30 +02:00
|
|
|
"chara",
|
2019-12-08 22:43:49 +01:00
|
|
|
{
|
2022-10-15 20:56:30 +02:00
|
|
|
"friendship": friendship,
|
2019-12-08 22:43:49 +01:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
elif node.name == "medal":
|
|
|
|
medalid = node.child_value("medal_id")
|
|
|
|
level = node.child_value("level")
|
|
|
|
exp = node.child_value("exp")
|
|
|
|
set_count = node.child_value("set_count")
|
|
|
|
get_count = node.child_value("get_count")
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
self.data.local.user.put_achievement(
|
|
|
|
self.game,
|
|
|
|
self.version,
|
|
|
|
userid,
|
|
|
|
medalid,
|
2022-10-15 20:56:30 +02:00
|
|
|
"medal",
|
2019-12-08 22:43:49 +01:00
|
|
|
{
|
2022-10-15 20:56:30 +02:00
|
|
|
"level": level,
|
|
|
|
"exp": exp,
|
|
|
|
"set_count": set_count,
|
|
|
|
"get_count": get_count,
|
2019-12-08 22:43:49 +01:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
# Keep track of play statistics
|
|
|
|
self.update_play_statistics(userid)
|
|
|
|
|
|
|
|
return newprofile
|