Older IIDX routing refactor. (#51)
* Older IIDX routing refactor. * game_to_db_chart() pattern added
This commit is contained in:
parent
99e60e6bbc
commit
b2edbdce24
@ -500,6 +500,18 @@ class IIDXBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
|
||||
"""
|
||||
raise Exception('Implement in specific game class!')
|
||||
|
||||
def game_to_db_chart(self, game_chart: int) -> int:
|
||||
"""
|
||||
Given a game's chart for a song, return the chart as defined above.
|
||||
"""
|
||||
raise Exception('Implement in sub-class!')
|
||||
|
||||
def db_to_game_chart(self, db_chart: int) -> int:
|
||||
"""
|
||||
Given a chart as defined above, return the game's chart constant.
|
||||
"""
|
||||
raise Exception('Implement in sub-class!')
|
||||
|
||||
def make_score_struct(self, scores: List[Score], cltype: int, index: int) -> List[List[int]]:
|
||||
scorestruct: Dict[int, List[int]] = {}
|
||||
|
||||
|
@ -86,6 +86,14 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
|
||||
|
||||
FAVORITE_LIST_LENGTH: Final[int] = 20
|
||||
|
||||
GAME_CHART_TYPE_N7: Final[int] = 0
|
||||
GAME_CHART_TYPE_H7: Final[int] = 1
|
||||
GAME_CHART_TYPE_A7: Final[int] = 2
|
||||
GAME_CHART_TYPE_N14: Final[int] = 3
|
||||
GAME_CHART_TYPE_H14: Final[int] = 4
|
||||
GAME_CHART_TYPE_A14: Final[int] = 5
|
||||
GAME_CHART_TYPE_B7: Final[int] = 6
|
||||
|
||||
requires_extended_regions: bool = True
|
||||
|
||||
def previous_version(self) -> Optional[IIDXBase]:
|
||||
@ -290,6 +298,17 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
|
||||
else:
|
||||
raise Exception('Invalid cltype!')
|
||||
|
||||
def game_to_db_chart(self, db_chart: int) -> int:
|
||||
return {
|
||||
self.GAME_CHART_TYPE_B7: self.CHART_TYPE_B7,
|
||||
self.GAME_CHART_TYPE_N7: self.CHART_TYPE_N7,
|
||||
self.GAME_CHART_TYPE_H7: self.CHART_TYPE_H7,
|
||||
self.GAME_CHART_TYPE_A7: self.CHART_TYPE_A7,
|
||||
self.GAME_CHART_TYPE_N14: self.CHART_TYPE_N14,
|
||||
self.GAME_CHART_TYPE_H14: self.CHART_TYPE_H14,
|
||||
self.GAME_CHART_TYPE_A14: self.CHART_TYPE_A14,
|
||||
}[db_chart]
|
||||
|
||||
def handle_IIDX25shop_getname_request(self, request: Node) -> Node:
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
if machine is not None:
|
||||
@ -367,7 +386,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
|
||||
|
||||
def handle_IIDX25ranking_getranker_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX25ranking')
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
if chart not in [
|
||||
self.CHART_TYPE_N7,
|
||||
self.CHART_TYPE_H7,
|
||||
@ -461,7 +480,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
|
||||
def handle_IIDX25ranking_entry_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
courseid = int(request.attribute('coid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
course_type = int(request.attribute('regist_type'))
|
||||
clear_status = self.game_to_db_status(int(request.attribute('clr')))
|
||||
pgreats = int(request.attribute('pgnum'))
|
||||
@ -597,7 +616,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
|
||||
|
||||
def handle_IIDX25music_appoint_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
ghost_type = int(request.attribute('ctype'))
|
||||
extid = int(request.attribute('iidxid'))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
@ -673,7 +692,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
|
||||
def handle_IIDX25music_reg_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
|
||||
# See if we need to report global or shop scores
|
||||
@ -840,7 +859,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
|
||||
|
||||
def handle_IIDX25music_play_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
clear_status = self.game_to_db_status(int(request.attribute('cflg')))
|
||||
|
||||
self.update_score(
|
||||
@ -1377,7 +1396,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
|
||||
best_clear_string = clear_map.get(best_clear, 'NO PLAY')
|
||||
now_clear_string = clear_map.get(now_clear, 'NO PLAY')
|
||||
# let's get the song info first
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, class_id)
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, self.game_to_db_chart(class_id))
|
||||
notecount = song.data.get('notecount', 0)
|
||||
# Construct the dictionary for the broadcast
|
||||
card_data = {
|
||||
|
@ -86,6 +86,14 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
|
||||
FAVORITE_LIST_LENGTH: Final[int] = 20
|
||||
|
||||
GAME_CHART_TYPE_N7: Final[int] = 0
|
||||
GAME_CHART_TYPE_H7: Final[int] = 1
|
||||
GAME_CHART_TYPE_A7: Final[int] = 2
|
||||
GAME_CHART_TYPE_N14: Final[int] = 3
|
||||
GAME_CHART_TYPE_H14: Final[int] = 4
|
||||
GAME_CHART_TYPE_A14: Final[int] = 5
|
||||
GAME_CHART_TYPE_B7: Final[int] = 6
|
||||
|
||||
def previous_version(self) -> Optional[IIDXBase]:
|
||||
return IIDXPendual(self.data, self.config, self.model)
|
||||
|
||||
@ -288,10 +296,18 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
else:
|
||||
raise Exception('Invalid cltype!')
|
||||
|
||||
def handle_IIDX23shop_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
def game_to_db_chart(self, db_chart: int) -> int:
|
||||
return {
|
||||
self.GAME_CHART_TYPE_B7: self.CHART_TYPE_B7,
|
||||
self.GAME_CHART_TYPE_N7: self.CHART_TYPE_N7,
|
||||
self.GAME_CHART_TYPE_H7: self.CHART_TYPE_H7,
|
||||
self.GAME_CHART_TYPE_A7: self.CHART_TYPE_A7,
|
||||
self.GAME_CHART_TYPE_N14: self.CHART_TYPE_N14,
|
||||
self.GAME_CHART_TYPE_H14: self.CHART_TYPE_H14,
|
||||
self.GAME_CHART_TYPE_A14: self.CHART_TYPE_A14,
|
||||
}[db_chart]
|
||||
|
||||
if method == 'getname':
|
||||
def handle_IIDX23shop_getname_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX23shop')
|
||||
root.set_attribute('cls_opt', '0')
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
@ -299,16 +315,16 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('pid', str(self.get_machine_region()))
|
||||
return root
|
||||
|
||||
if method == 'savename':
|
||||
def handle_IIDX23shop_savename_request(self, request: Node) -> Node:
|
||||
self.update_machine_name(request.attribute('opname'))
|
||||
root = Node.void('IIDX23shop')
|
||||
return root
|
||||
|
||||
if method == 'sentinfo':
|
||||
def handle_IIDX23shop_sentinfo_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX23shop')
|
||||
return root
|
||||
|
||||
if method == 'getconvention':
|
||||
def handle_IIDX23shop_getconvention_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX23shop')
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
if machine.arcade is not None:
|
||||
@ -326,7 +342,7 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
root.add_child(Node.bool('valid', course.get_bool('valid')))
|
||||
return root
|
||||
|
||||
if method == 'setconvention':
|
||||
def handle_IIDX23shop_setconvention_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX23shop')
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
if machine.arcade is not None:
|
||||
@ -340,20 +356,14 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'sendescapepackageinfo':
|
||||
def handle_IIDX23shop_sendescapepackageinfo_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX23shop')
|
||||
root.set_attribute('expire', str((Time.now() + 86400 * 365) * 1000))
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX23ranking_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'getranker':
|
||||
def handle_IIDX23ranking_getranker_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX23ranking')
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
if chart not in [
|
||||
self.CHART_TYPE_N7,
|
||||
self.CHART_TYPE_H7,
|
||||
@ -442,10 +452,10 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'entry':
|
||||
def handle_IIDX23ranking_entry_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
courseid = int(request.attribute('coid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
course_type = int(request.attribute('regist_type'))
|
||||
clear_status = self.game_to_db_status(int(request.attribute('clr')))
|
||||
pgreats = int(request.attribute('pgnum'))
|
||||
@ -478,13 +488,7 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('jun', '1')
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX23music_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'crate':
|
||||
def handle_IIDX23music_crate_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX23music')
|
||||
attempts = self.get_clear_rates()
|
||||
|
||||
@ -511,7 +515,7 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'getrank':
|
||||
def handle_IIDX23music_getrank_request(self, request: Node) -> Node:
|
||||
cltype = int(request.attribute('cltype'))
|
||||
|
||||
root = Node.void('IIDX23music')
|
||||
@ -562,10 +566,10 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'reg':
|
||||
def handle_IIDX23music_reg_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
|
||||
# See if we need to report global or shop scores
|
||||
@ -731,7 +735,7 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'breg':
|
||||
def handle_IIDX23music_breg_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
musicid = int(request.attribute('mid'))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
@ -757,9 +761,9 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
root = Node.void('IIDX23music')
|
||||
return root
|
||||
|
||||
if method == 'play':
|
||||
def handle_IIDX23music_play_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
clear_status = self.game_to_db_status(int(request.attribute('cflg')))
|
||||
|
||||
self.update_score(
|
||||
@ -793,9 +797,9 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'appoint':
|
||||
def handle_IIDX23music_appoint_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
ghost_type = int(request.attribute('ctype'))
|
||||
extid = int(request.attribute('iidxid'))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
@ -843,17 +847,10 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX23grade_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'raised':
|
||||
def handle_IIDX23grade_raised_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
cltype = int(request.attribute('gtype'))
|
||||
rank = self.game_to_db_rank(int(request.attribute('gid')), cltype)
|
||||
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
if userid is not None:
|
||||
percent = int(request.attribute('achi'))
|
||||
@ -880,13 +877,7 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('pnum', str(len(all_achievements)))
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX23pc_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'common':
|
||||
def handle_IIDX23pc_common_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX23pc')
|
||||
root.set_attribute('expire', '600')
|
||||
|
||||
@ -1274,16 +1265,16 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'delete':
|
||||
def handle_IIDX23pc_delete_request(self, request: Node) -> Node:
|
||||
return Node.void('IIDX23pc')
|
||||
|
||||
if method == 'playstart':
|
||||
def handle_IIDX23pc_playstart_request(self, request: Node) -> Node:
|
||||
return Node.void('IIDX23pc')
|
||||
|
||||
if method == 'playend':
|
||||
def handle_IIDX23pc_playend_request(self, request: Node) -> Node:
|
||||
return Node.void('IIDX23pc')
|
||||
|
||||
if method == 'oldget':
|
||||
def handle_IIDX23pc_oldget_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
userid = self.data.remote.user.from_refid(self.game, self.version, refid)
|
||||
if userid is not None:
|
||||
@ -1296,7 +1287,7 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('status', '1' if profile is None else '0')
|
||||
return root
|
||||
|
||||
if method == 'getname':
|
||||
def handle_IIDX23pc_getname_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
userid = self.data.remote.user.from_refid(self.game, self.version, refid)
|
||||
if userid is not None:
|
||||
@ -1317,7 +1308,7 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('pid', str(profile.get_int('pid')))
|
||||
return root
|
||||
|
||||
if method == 'takeover':
|
||||
def handle_IIDX23pc_takeover_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
name = request.attribute('name')
|
||||
pid = int(request.attribute('pid'))
|
||||
@ -1328,7 +1319,7 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('id', str(newprofile.extid))
|
||||
return root
|
||||
|
||||
if method == 'reg':
|
||||
def handle_IIDX23pc_reg_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
name = request.attribute('name')
|
||||
pid = int(request.attribute('pid'))
|
||||
@ -1340,21 +1331,21 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('id_str', ID.format_extid(profile.extid))
|
||||
return root
|
||||
|
||||
if method == 'get':
|
||||
def handle_IIDX23pc_get_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
root = self.get_profile_by_refid(refid)
|
||||
if root is None:
|
||||
root = Node.void('IIDX23pc')
|
||||
return root
|
||||
|
||||
if method == 'save':
|
||||
def handle_IIDX23pc_save_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
self.put_profile_by_extid(extid, request)
|
||||
|
||||
root = Node.void('IIDX23pc')
|
||||
return root
|
||||
|
||||
if method == 'visit':
|
||||
def handle_IIDX23pc_visit_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX23pc')
|
||||
root.set_attribute('anum', '0')
|
||||
root.set_attribute('pnum', '0')
|
||||
@ -1364,7 +1355,7 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('snum', '0')
|
||||
return root
|
||||
|
||||
if method == 'shopregister':
|
||||
def handle_IIDX23pc_shopregister_request(self, request: Node) -> Node:
|
||||
extid = int(request.child_value('iidx_id'))
|
||||
location = ID.parse_machine_id(request.child_value('location_id'))
|
||||
|
||||
@ -1379,9 +1370,6 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
root = Node.void('IIDX23pc')
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX23pc_eaappliresult_request(self, request: Node) -> Node:
|
||||
clear_map = {
|
||||
self.GAME_CLEAR_STATUS_NO_PLAY: 'NO PLAY',
|
||||
@ -1427,7 +1415,7 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
best_clear_string = clear_map.get(best_clear, 'NO PLAY')
|
||||
now_clear_string = clear_map.get(now_clear, 'NO PLAY')
|
||||
# let's get the song info first
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, class_id)
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, self.game_to_db_chart(class_id))
|
||||
notecount = song.data.get('notecount', 0)
|
||||
# Construct the dictionary for the broadcast
|
||||
card_data = {
|
||||
|
@ -83,6 +83,14 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
|
||||
FAVORITE_LIST_LENGTH: Final[int] = 20
|
||||
|
||||
GAME_CHART_TYPE_N7: Final[int] = 0
|
||||
GAME_CHART_TYPE_H7: Final[int] = 1
|
||||
GAME_CHART_TYPE_A7: Final[int] = 2
|
||||
GAME_CHART_TYPE_N14: Final[int] = 3
|
||||
GAME_CHART_TYPE_H14: Final[int] = 4
|
||||
GAME_CHART_TYPE_A14: Final[int] = 5
|
||||
GAME_CHART_TYPE_B7: Final[int] = 6
|
||||
|
||||
def previous_version(self) -> Optional[IIDXBase]:
|
||||
return IIDXSpada(self.data, self.config, self.model)
|
||||
|
||||
@ -174,10 +182,18 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
],
|
||||
}
|
||||
|
||||
def handle_IIDX22shop_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
def game_to_db_chart(self, db_chart: int) -> int:
|
||||
return {
|
||||
self.GAME_CHART_TYPE_B7: self.CHART_TYPE_B7,
|
||||
self.GAME_CHART_TYPE_N7: self.CHART_TYPE_N7,
|
||||
self.GAME_CHART_TYPE_H7: self.CHART_TYPE_H7,
|
||||
self.GAME_CHART_TYPE_A7: self.CHART_TYPE_A7,
|
||||
self.GAME_CHART_TYPE_N14: self.CHART_TYPE_N14,
|
||||
self.GAME_CHART_TYPE_H14: self.CHART_TYPE_H14,
|
||||
self.GAME_CHART_TYPE_A14: self.CHART_TYPE_A14,
|
||||
}[db_chart]
|
||||
|
||||
if method == 'getname':
|
||||
def handle_IIDX22shop_getname_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX22shop')
|
||||
root.set_attribute('cls_opt', '0')
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
@ -185,16 +201,16 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('pid', str(self.get_machine_region()))
|
||||
return root
|
||||
|
||||
if method == 'savename':
|
||||
def handle_IIDX22shop_savename_request(self, request: Node) -> Node:
|
||||
self.update_machine_name(request.attribute('opname'))
|
||||
root = Node.void('IIDX22shop')
|
||||
return root
|
||||
|
||||
if method == 'sentinfo':
|
||||
def handle_IIDX22shop_sentinfo_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX22shop')
|
||||
return root
|
||||
|
||||
if method == 'getconvention':
|
||||
def handle_IIDX22shop_getconvention_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX22shop')
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
if machine.arcade is not None:
|
||||
@ -212,7 +228,7 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
root.add_child(Node.bool('valid', course.get_bool('valid')))
|
||||
return root
|
||||
|
||||
if method == 'setconvention':
|
||||
def handle_IIDX22shop_setconvention_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX22shop')
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
if machine.arcade is not None:
|
||||
@ -226,15 +242,9 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX22ranking_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'getranker':
|
||||
def handle_IIDX22ranking_getranker_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX22ranking')
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
if chart not in [
|
||||
self.CHART_TYPE_N7,
|
||||
self.CHART_TYPE_H7,
|
||||
@ -323,10 +333,10 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'entry':
|
||||
def handle_IIDX22ranking_entry_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
courseid = int(request.attribute('coid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
course_type = int(request.attribute('regist_type'))
|
||||
clear_status = self.game_to_db_status(int(request.attribute('clr')))
|
||||
pgreats = int(request.attribute('pgnum'))
|
||||
@ -359,9 +369,6 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('jun', '1')
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def db_to_game_status(self, db_status: int) -> int:
|
||||
return {
|
||||
self.CLEAR_STATUS_NO_PLAY: self.GAME_CLEAR_STATUS_NO_PLAY,
|
||||
@ -414,6 +421,8 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
}[db_dan]
|
||||
elif cltype == self.GAME_CLTYPE_DOUBLE:
|
||||
return {
|
||||
self.DAN_RANK_7_KYU: self.GAME_DP_DAN_RANK_5_KYU,
|
||||
self.DAN_RANK_6_KYU: self.GAME_DP_DAN_RANK_5_KYU,
|
||||
self.DAN_RANK_5_KYU: self.GAME_DP_DAN_RANK_5_KYU,
|
||||
self.DAN_RANK_4_KYU: self.GAME_DP_DAN_RANK_4_KYU,
|
||||
self.DAN_RANK_3_KYU: self.GAME_DP_DAN_RANK_3_KYU,
|
||||
@ -482,10 +491,7 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
else:
|
||||
raise Exception('Invalid cltype!')
|
||||
|
||||
def handle_IIDX22music_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'crate':
|
||||
def handle_IIDX22music_crate_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX22music')
|
||||
attempts = self.get_clear_rates()
|
||||
|
||||
@ -512,7 +518,7 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'getrank':
|
||||
def handle_IIDX22music_getrank_request(self, request: Node) -> Node:
|
||||
cltype = int(request.attribute('cltype'))
|
||||
|
||||
root = Node.void('IIDX22music')
|
||||
@ -531,7 +537,6 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
except Exception:
|
||||
# Invalid extid
|
||||
continue
|
||||
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
if userid is not None:
|
||||
scores = self.data.remote.music.get_scores(self.game, self.music_version, userid)
|
||||
@ -564,10 +569,10 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'reg':
|
||||
def handle_IIDX22music_reg_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
|
||||
# See if we need to report global or shop scores
|
||||
@ -733,7 +738,7 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'breg':
|
||||
def handle_IIDX22music_breg_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
musicid = int(request.attribute('mid'))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
@ -759,9 +764,9 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
root = Node.void('IIDX22music')
|
||||
return root
|
||||
|
||||
if method == 'play':
|
||||
def handle_IIDX22music_play_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
clear_status = self.game_to_db_status(int(request.attribute('cflg')))
|
||||
|
||||
self.update_score(
|
||||
@ -795,9 +800,9 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'appoint':
|
||||
def handle_IIDX22music_appoint_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
ghost_type = int(request.attribute('ctype'))
|
||||
extid = int(request.attribute('iidxid'))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
@ -845,13 +850,7 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX22grade_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'raised':
|
||||
def handle_IIDX22grade_raised_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
cltype = int(request.attribute('gtype'))
|
||||
rank = self.game_to_db_rank(int(request.attribute('gid')), cltype)
|
||||
@ -886,13 +885,7 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('pnum', str(len(all_achievements)))
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX22pc_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'common':
|
||||
def handle_IIDX22pc_common_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX22pc')
|
||||
root.set_attribute('expire', '600')
|
||||
|
||||
@ -914,19 +907,18 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
timeshift_override = game_config.get_int('cycle_config')
|
||||
ccxbm_on = game_config.get_bool('ccxbm_enable')
|
||||
omni_events = game_config.get_bool('omnimix_events_enabled')
|
||||
event_phase = game_config.get_int('event_phase')
|
||||
else:
|
||||
# If we aren't in an arcade, we turn off events
|
||||
timeshift_override = 0
|
||||
event_phase = 0
|
||||
ccxbm_on = False
|
||||
omni_events = False
|
||||
|
||||
frontendphase = game_config.get_int('event_phase')
|
||||
if self.omnimix and (not omni_events):
|
||||
phase = 0
|
||||
elif self.omnimix and omni_events:
|
||||
phase = frontendphase
|
||||
elif not self.omnimix:
|
||||
phase = frontendphase
|
||||
else:
|
||||
phase = event_phase
|
||||
|
||||
# events
|
||||
boss = Node.void('boss')
|
||||
@ -1237,16 +1229,16 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'delete':
|
||||
def handle_IIDX22pc_delete_request(self, request: Node) -> Node:
|
||||
return Node.void('IIDX22pc')
|
||||
|
||||
if method == 'playstart':
|
||||
def handle_IIDX22pc_playstart_request(self, request: Node) -> Node:
|
||||
return Node.void('IIDX22pc')
|
||||
|
||||
if method == 'playend':
|
||||
def handle_IIDX22pc_playend_request(self, request: Node) -> Node:
|
||||
return Node.void('IIDX22pc')
|
||||
|
||||
if method == 'oldget':
|
||||
def handle_IIDX22pc_oldget_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
userid = self.data.remote.user.from_refid(self.game, self.version, refid)
|
||||
if userid is not None:
|
||||
@ -1259,7 +1251,7 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('status', '1' if profile is None else '0')
|
||||
return root
|
||||
|
||||
if method == 'getname':
|
||||
def handle_IIDX22pc_getname_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
userid = self.data.remote.user.from_refid(self.game, self.version, refid)
|
||||
if userid is not None:
|
||||
@ -1280,7 +1272,7 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('pid', str(profile.get_int('pid')))
|
||||
return root
|
||||
|
||||
if method == 'takeover':
|
||||
def handle_IIDX22pc_takeover_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
name = request.attribute('name')
|
||||
pid = int(request.attribute('pid'))
|
||||
@ -1291,7 +1283,7 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('id', str(newprofile.extid))
|
||||
return root
|
||||
|
||||
if method == 'reg':
|
||||
def handle_IIDX22pc_reg_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
name = request.attribute('name')
|
||||
pid = int(request.attribute('pid'))
|
||||
@ -1303,21 +1295,21 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('id_str', ID.format_extid(profile.extid))
|
||||
return root
|
||||
|
||||
if method == 'get':
|
||||
def handle_IIDX22pc_get_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
root = self.get_profile_by_refid(refid)
|
||||
if root is None:
|
||||
root = Node.void('IIDX22pc')
|
||||
return root
|
||||
|
||||
if method == 'save':
|
||||
def handle_IIDX22pc_save_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
self.put_profile_by_extid(extid, request)
|
||||
|
||||
root = Node.void('IIDX22pc')
|
||||
return root
|
||||
|
||||
if method == 'visit':
|
||||
def handle_IIDX22pc_visit_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX22pc')
|
||||
root.set_attribute('anum', '0')
|
||||
root.set_attribute('pnum', '0')
|
||||
@ -1327,7 +1319,7 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('snum', '0')
|
||||
return root
|
||||
|
||||
if method == 'shopregister':
|
||||
def handle_IIDX22pc_shopregister_request(self, request: Node) -> Node:
|
||||
extid = int(request.child_value('iidx_id'))
|
||||
location = ID.parse_machine_id(request.child_value('location_id'))
|
||||
|
||||
@ -1342,9 +1334,6 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
root = Node.void('IIDX22pc')
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX22pc_eaappliresult_request(self, request: Node) -> Node:
|
||||
clear_map = {
|
||||
self.GAME_CLEAR_STATUS_NO_PLAY: 'NO PLAY',
|
||||
@ -1390,7 +1379,7 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
best_clear_string = clear_map.get(best_clear, 'NO PLAY')
|
||||
now_clear_string = clear_map.get(now_clear, 'NO PLAY')
|
||||
# let's get the song info first
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, class_id)
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, self.game_to_db_chart(class_id))
|
||||
notecount = song.data.get('notecount', 0)
|
||||
# Construct the dictionary for the broadcast
|
||||
card_data = {
|
||||
|
@ -86,6 +86,14 @@ class IIDXRootage(IIDXCourse, IIDXBase):
|
||||
|
||||
FAVORITE_LIST_LENGTH: Final[int] = 20
|
||||
|
||||
GAME_CHART_TYPE_N7: Final[int] = 0
|
||||
GAME_CHART_TYPE_H7: Final[int] = 1
|
||||
GAME_CHART_TYPE_A7: Final[int] = 2
|
||||
GAME_CHART_TYPE_N14: Final[int] = 3
|
||||
GAME_CHART_TYPE_H14: Final[int] = 4
|
||||
GAME_CHART_TYPE_A14: Final[int] = 5
|
||||
GAME_CHART_TYPE_B7: Final[int] = 6
|
||||
|
||||
requires_extended_regions = True
|
||||
|
||||
def previous_version(self) -> Optional[IIDXBase]:
|
||||
@ -291,6 +299,17 @@ class IIDXRootage(IIDXCourse, IIDXBase):
|
||||
else:
|
||||
raise Exception('Invalid cltype!')
|
||||
|
||||
def game_to_db_chart(self, db_chart: int) -> int:
|
||||
return {
|
||||
self.GAME_CHART_TYPE_B7: self.CHART_TYPE_B7,
|
||||
self.GAME_CHART_TYPE_N7: self.CHART_TYPE_N7,
|
||||
self.GAME_CHART_TYPE_H7: self.CHART_TYPE_H7,
|
||||
self.GAME_CHART_TYPE_A7: self.CHART_TYPE_A7,
|
||||
self.GAME_CHART_TYPE_N14: self.CHART_TYPE_N14,
|
||||
self.GAME_CHART_TYPE_H14: self.CHART_TYPE_H14,
|
||||
self.GAME_CHART_TYPE_A14: self.CHART_TYPE_A14,
|
||||
}[db_chart]
|
||||
|
||||
def handle_IIDX26shop_getname_request(self, request: Node) -> Node:
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
if machine is not None:
|
||||
@ -450,7 +469,7 @@ class IIDXRootage(IIDXCourse, IIDXBase):
|
||||
|
||||
def handle_IIDX26music_appoint_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
ghost_type = int(request.attribute('ctype'))
|
||||
extid = int(request.attribute('iidxid'))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
@ -526,7 +545,7 @@ class IIDXRootage(IIDXCourse, IIDXBase):
|
||||
def handle_IIDX26music_reg_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
|
||||
# See if we need to report global or shop scores
|
||||
@ -693,7 +712,7 @@ class IIDXRootage(IIDXCourse, IIDXBase):
|
||||
|
||||
def handle_IIDX26music_play_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
clear_status = self.game_to_db_status(int(request.attribute('cflg')))
|
||||
|
||||
self.update_score(
|
||||
@ -1015,7 +1034,7 @@ class IIDXRootage(IIDXCourse, IIDXBase):
|
||||
best_clear_string = clear_map.get(best_clear, 'NO PLAY')
|
||||
now_clear_string = clear_map.get(now_clear, 'NO PLAY')
|
||||
# let's get the song info first
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, class_id)
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, self.game_to_db_chart(class_id))
|
||||
notecount = song.data.get('notecount', 0)
|
||||
# Construct the dictionary for the broadcast
|
||||
card_data = {
|
||||
|
@ -86,6 +86,14 @@ class IIDXSinobuz(IIDXCourse, IIDXBase):
|
||||
|
||||
FAVORITE_LIST_LENGTH: Final[int] = 20
|
||||
|
||||
GAME_CHART_TYPE_N7: Final[int] = 0
|
||||
GAME_CHART_TYPE_H7: Final[int] = 1
|
||||
GAME_CHART_TYPE_A7: Final[int] = 2
|
||||
GAME_CHART_TYPE_N14: Final[int] = 3
|
||||
GAME_CHART_TYPE_H14: Final[int] = 4
|
||||
GAME_CHART_TYPE_A14: Final[int] = 5
|
||||
GAME_CHART_TYPE_B7: Final[int] = 6
|
||||
|
||||
def previous_version(self) -> Optional[IIDXBase]:
|
||||
return IIDXCopula(self.data, self.config, self.model)
|
||||
|
||||
@ -288,6 +296,17 @@ class IIDXSinobuz(IIDXCourse, IIDXBase):
|
||||
else:
|
||||
raise Exception('Invalid cltype!')
|
||||
|
||||
def game_to_db_chart(self, db_chart: int) -> int:
|
||||
return {
|
||||
self.GAME_CHART_TYPE_B7: self.CHART_TYPE_B7,
|
||||
self.GAME_CHART_TYPE_N7: self.CHART_TYPE_N7,
|
||||
self.GAME_CHART_TYPE_H7: self.CHART_TYPE_H7,
|
||||
self.GAME_CHART_TYPE_A7: self.CHART_TYPE_A7,
|
||||
self.GAME_CHART_TYPE_N14: self.CHART_TYPE_N14,
|
||||
self.GAME_CHART_TYPE_H14: self.CHART_TYPE_H14,
|
||||
self.GAME_CHART_TYPE_A14: self.CHART_TYPE_A14,
|
||||
}[db_chart]
|
||||
|
||||
def handle_IIDX24shop_getname_request(self, request: Node) -> Node:
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
if machine is not None:
|
||||
@ -365,7 +384,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase):
|
||||
|
||||
def handle_IIDX24ranking_getranker_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX24ranking')
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
if chart not in [
|
||||
self.CHART_TYPE_N7,
|
||||
self.CHART_TYPE_H7,
|
||||
@ -457,7 +476,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase):
|
||||
def handle_IIDX24ranking_entry_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
courseid = int(request.attribute('coid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
course_type = int(request.attribute('regist_type'))
|
||||
clear_status = self.game_to_db_status(int(request.attribute('clr')))
|
||||
pgreats = int(request.attribute('pgnum'))
|
||||
@ -593,7 +612,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase):
|
||||
|
||||
def handle_IIDX24music_appoint_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
ghost_type = int(request.attribute('ctype'))
|
||||
extid = int(request.attribute('iidxid'))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
@ -669,7 +688,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase):
|
||||
def handle_IIDX24music_reg_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
|
||||
# See if we need to report global or shop scores
|
||||
@ -837,7 +856,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase):
|
||||
|
||||
def handle_IIDX24music_play_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
clear_status = self.game_to_db_status(int(request.attribute('cflg')))
|
||||
|
||||
self.update_score(
|
||||
@ -1399,7 +1418,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase):
|
||||
best_clear_string = clear_map.get(best_clear, 'NO PLAY')
|
||||
now_clear_string = clear_map.get(now_clear, 'NO PLAY')
|
||||
# let's get the song info first
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, class_id)
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, self.game_to_db_chart(class_id))
|
||||
notecount = song.data.get('notecount', 0)
|
||||
# Construct the dictionary for the broadcast
|
||||
card_data = {
|
||||
|
@ -82,6 +82,14 @@ class IIDXSpada(IIDXBase):
|
||||
|
||||
FAVORITE_LIST_LENGTH: Final[int] = 20
|
||||
|
||||
GAME_CHART_TYPE_N7: Final[int] = 0
|
||||
GAME_CHART_TYPE_H7: Final[int] = 1
|
||||
GAME_CHART_TYPE_A7: Final[int] = 2
|
||||
GAME_CHART_TYPE_N14: Final[int] = 3
|
||||
GAME_CHART_TYPE_H14: Final[int] = 4
|
||||
GAME_CHART_TYPE_A14: Final[int] = 5
|
||||
GAME_CHART_TYPE_B7: Final[int] = 6
|
||||
|
||||
def previous_version(self) -> Optional[IIDXBase]:
|
||||
return IIDXTricoro(self.data, self.config, self.model)
|
||||
|
||||
@ -193,6 +201,8 @@ class IIDXSpada(IIDXBase):
|
||||
}[db_dan]
|
||||
elif cltype == self.GAME_CLTYPE_DOUBLE:
|
||||
return {
|
||||
self.DAN_RANK_7_KYU: self.GAME_DP_DAN_RANK_5_KYU,
|
||||
self.DAN_RANK_6_KYU: self.GAME_DP_DAN_RANK_5_KYU,
|
||||
self.DAN_RANK_5_KYU: self.GAME_DP_DAN_RANK_5_KYU,
|
||||
self.DAN_RANK_4_KYU: self.GAME_DP_DAN_RANK_4_KYU,
|
||||
self.DAN_RANK_3_KYU: self.GAME_DP_DAN_RANK_3_KYU,
|
||||
@ -261,10 +271,18 @@ class IIDXSpada(IIDXBase):
|
||||
else:
|
||||
raise Exception('Invalid cltype!')
|
||||
|
||||
def handle_IIDX21shop_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
def game_to_db_chart(self, db_chart: int) -> int:
|
||||
return {
|
||||
self.GAME_CHART_TYPE_B7: self.CHART_TYPE_B7,
|
||||
self.GAME_CHART_TYPE_N7: self.CHART_TYPE_N7,
|
||||
self.GAME_CHART_TYPE_H7: self.CHART_TYPE_H7,
|
||||
self.GAME_CHART_TYPE_A7: self.CHART_TYPE_A7,
|
||||
self.GAME_CHART_TYPE_N14: self.CHART_TYPE_N14,
|
||||
self.GAME_CHART_TYPE_H14: self.CHART_TYPE_H14,
|
||||
self.GAME_CHART_TYPE_A14: self.CHART_TYPE_A14,
|
||||
}[db_chart]
|
||||
|
||||
if method == 'getname':
|
||||
def handle_IIDX21shop_getname_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX21shop')
|
||||
root.set_attribute('cls_opt', '0')
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
@ -272,16 +290,16 @@ class IIDXSpada(IIDXBase):
|
||||
root.set_attribute('pid', str(self.get_machine_region()))
|
||||
return root
|
||||
|
||||
if method == 'savename':
|
||||
def handle_IIDX21shop_savename_request(self, request: Node) -> Node:
|
||||
self.update_machine_name(request.attribute('opname'))
|
||||
root = Node.void('IIDX21shop')
|
||||
return root
|
||||
|
||||
if method == 'sentinfo':
|
||||
def handle_IIDX21shop_sentinfo_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX21shop')
|
||||
return root
|
||||
|
||||
if method == 'getconvention':
|
||||
def handle_IIDX21shop_getconvention_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX21shop')
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
if machine.arcade is not None:
|
||||
@ -299,7 +317,7 @@ class IIDXSpada(IIDXBase):
|
||||
root.add_child(Node.bool('valid', course.get_bool('valid')))
|
||||
return root
|
||||
|
||||
if method == 'setconvention':
|
||||
def handle_IIDX21shop_setconvention_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX21shop')
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
if machine.arcade is not None:
|
||||
@ -313,15 +331,9 @@ class IIDXSpada(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX21ranking_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'getranker':
|
||||
def handle_IIDX21ranking_getranker_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX21ranking')
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
if chart not in [
|
||||
self.CHART_TYPE_N7,
|
||||
self.CHART_TYPE_H7,
|
||||
@ -410,13 +422,7 @@ class IIDXSpada(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX21music_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'crate':
|
||||
def handle_IIDX21music_crate_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX21music')
|
||||
attempts = self.get_clear_rates()
|
||||
|
||||
@ -443,7 +449,7 @@ class IIDXSpada(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'getrank':
|
||||
def handle_IIDX21music_getrank_request(self, request: Node) -> Node:
|
||||
cltype = int(request.attribute('cltype'))
|
||||
|
||||
root = Node.void('IIDX21music')
|
||||
@ -494,10 +500,10 @@ class IIDXSpada(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'reg':
|
||||
def handle_IIDX21music_reg_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
|
||||
# See if we need to report global or shop scores
|
||||
@ -663,7 +669,7 @@ class IIDXSpada(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'breg':
|
||||
def handle_IIDX21music_breg_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
musicid = int(request.attribute('mid'))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
@ -689,9 +695,9 @@ class IIDXSpada(IIDXBase):
|
||||
root = Node.void('IIDX21music')
|
||||
return root
|
||||
|
||||
if method == 'play':
|
||||
def handle_IIDX21music_play_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
clear_status = self.game_to_db_status(int(request.attribute('cflg')))
|
||||
|
||||
self.update_score(
|
||||
@ -725,9 +731,9 @@ class IIDXSpada(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'appoint':
|
||||
def handle_IIDX21music_appoint_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
ghost_type = int(request.attribute('ctype'))
|
||||
extid = int(request.attribute('iidxid'))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
@ -775,13 +781,7 @@ class IIDXSpada(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX21pc_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'common':
|
||||
def handle_IIDX21pc_common_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX21pc')
|
||||
root.set_attribute('expire', '600')
|
||||
|
||||
@ -845,16 +845,16 @@ class IIDXSpada(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'delete':
|
||||
def handle_IIDX21pc_delete_request(self, request: Node) -> Node:
|
||||
return Node.void('IIDX21pc')
|
||||
|
||||
if method == 'playstart':
|
||||
def handle_IIDX21pc_playstart_request(self, request: Node) -> Node:
|
||||
return Node.void('IIDX21pc')
|
||||
|
||||
if method == 'playend':
|
||||
def handle_IIDX21pc_playend_request(self, request: Node) -> Node:
|
||||
return Node.void('IIDX21pc')
|
||||
|
||||
if method == 'oldget':
|
||||
def handle_IIDX21pc_oldget_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
userid = self.data.remote.user.from_refid(self.game, self.version, refid)
|
||||
if userid is not None:
|
||||
@ -867,7 +867,7 @@ class IIDXSpada(IIDXBase):
|
||||
root.set_attribute('status', '1' if profile is None else '0')
|
||||
return root
|
||||
|
||||
if method == 'getname':
|
||||
def handle_IIDX21pc_getname_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
userid = self.data.remote.user.from_refid(self.game, self.version, refid)
|
||||
if userid is not None:
|
||||
@ -888,7 +888,7 @@ class IIDXSpada(IIDXBase):
|
||||
root.set_attribute('pid', str(profile.get_int('pid')))
|
||||
return root
|
||||
|
||||
if method == 'takeover':
|
||||
def handle_IIDX21pc_takeover_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
name = request.attribute('name')
|
||||
pid = int(request.attribute('pid'))
|
||||
@ -899,7 +899,7 @@ class IIDXSpada(IIDXBase):
|
||||
root.set_attribute('id', str(newprofile.extid))
|
||||
return root
|
||||
|
||||
if method == 'reg':
|
||||
def handle_IIDX21pc_reg_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
name = request.attribute('name')
|
||||
pid = int(request.attribute('pid'))
|
||||
@ -911,21 +911,21 @@ class IIDXSpada(IIDXBase):
|
||||
root.set_attribute('id_str', ID.format_extid(profile.extid))
|
||||
return root
|
||||
|
||||
if method == 'get':
|
||||
def handle_IIDX21pc_get_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
root = self.get_profile_by_refid(refid)
|
||||
if root is None:
|
||||
root = Node.void('IIDX21pc')
|
||||
return root
|
||||
|
||||
if method == 'save':
|
||||
def handle_IIDX21pc_save_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
self.put_profile_by_extid(extid, request)
|
||||
|
||||
root = Node.void('IIDX21pc')
|
||||
return root
|
||||
|
||||
if method == 'visit':
|
||||
def handle_IIDX21pc_visit_request(self, request: Node) -> Node:
|
||||
root = Node.void('IIDX21pc')
|
||||
root.set_attribute('anum', '0')
|
||||
root.set_attribute('pnum', '0')
|
||||
@ -935,7 +935,7 @@ class IIDXSpada(IIDXBase):
|
||||
root.set_attribute('snum', '0')
|
||||
return root
|
||||
|
||||
if method == 'shopregister':
|
||||
def handle_IIDX21pc_shopregister_request(self, request: Node) -> Node:
|
||||
extid = int(request.child_value('iidx_id'))
|
||||
location = ID.parse_machine_id(request.child_value('location_id'))
|
||||
|
||||
@ -950,13 +950,7 @@ class IIDXSpada(IIDXBase):
|
||||
root = Node.void('IIDX21pc')
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX21grade_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'raised':
|
||||
def handle_IIDX21grade_raised_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
cltype = int(request.attribute('gtype'))
|
||||
rank = self.game_to_db_rank(int(request.attribute('gid')), cltype)
|
||||
@ -991,9 +985,6 @@ class IIDXSpada(IIDXBase):
|
||||
root.set_attribute('pnum', str(len(all_achievements)))
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX21pc_eaappliresult_request(self, request: Node) -> Node:
|
||||
clear_map = {
|
||||
self.GAME_CLEAR_STATUS_NO_PLAY: 'NO PLAY',
|
||||
@ -1039,7 +1030,7 @@ class IIDXSpada(IIDXBase):
|
||||
best_clear_string = clear_map.get(best_clear, 'NO PLAY')
|
||||
now_clear_string = clear_map.get(now_clear, 'NO PLAY')
|
||||
# let's get the song info first
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, class_id)
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, self.game_to_db_chart(class_id))
|
||||
notecount = song.data.get('notecount', 0)
|
||||
# Construct the dictionary for the broadcast
|
||||
card_data = {
|
||||
|
@ -81,6 +81,14 @@ class IIDXTricoro(IIDXBase):
|
||||
|
||||
FAVORITE_LIST_LENGTH: Final[int] = 20
|
||||
|
||||
GAME_CHART_TYPE_N7: Final[int] = 0
|
||||
GAME_CHART_TYPE_H7: Final[int] = 1
|
||||
GAME_CHART_TYPE_A7: Final[int] = 2
|
||||
GAME_CHART_TYPE_N14: Final[int] = 3
|
||||
GAME_CHART_TYPE_H14: Final[int] = 4
|
||||
GAME_CHART_TYPE_A14: Final[int] = 5
|
||||
GAME_CHART_TYPE_B7: Final[int] = 6
|
||||
|
||||
def previous_version(self) -> Optional[IIDXBase]:
|
||||
return IIDXLincle(self.data, self.config, self.model)
|
||||
|
||||
@ -192,6 +200,8 @@ class IIDXTricoro(IIDXBase):
|
||||
}[db_dan]
|
||||
elif cltype == self.GAME_CLTYPE_DOUBLE:
|
||||
return {
|
||||
self.DAN_RANK_7_KYU: self.GAME_DP_DAN_RANK_5_KYU,
|
||||
self.DAN_RANK_6_KYU: self.GAME_DP_DAN_RANK_5_KYU,
|
||||
self.DAN_RANK_5_KYU: self.GAME_DP_DAN_RANK_5_KYU,
|
||||
self.DAN_RANK_4_KYU: self.GAME_DP_DAN_RANK_4_KYU,
|
||||
self.DAN_RANK_3_KYU: self.GAME_DP_DAN_RANK_3_KYU,
|
||||
@ -260,10 +270,18 @@ class IIDXTricoro(IIDXBase):
|
||||
else:
|
||||
raise Exception('Invalid cltype!')
|
||||
|
||||
def handle_shop_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
def game_to_db_chart(self, db_chart: int) -> int:
|
||||
return {
|
||||
self.GAME_CHART_TYPE_B7: self.CHART_TYPE_B7,
|
||||
self.GAME_CHART_TYPE_N7: self.CHART_TYPE_N7,
|
||||
self.GAME_CHART_TYPE_H7: self.CHART_TYPE_H7,
|
||||
self.GAME_CHART_TYPE_A7: self.CHART_TYPE_A7,
|
||||
self.GAME_CHART_TYPE_N14: self.CHART_TYPE_N14,
|
||||
self.GAME_CHART_TYPE_H14: self.CHART_TYPE_H14,
|
||||
self.GAME_CHART_TYPE_A14: self.CHART_TYPE_A14,
|
||||
}[db_chart]
|
||||
|
||||
if method == 'getname':
|
||||
def handle_shop_getname_request(self, request: Node) -> Node:
|
||||
root = Node.void('shop')
|
||||
root.set_attribute('cls_opt', '0')
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
@ -271,16 +289,16 @@ class IIDXTricoro(IIDXBase):
|
||||
root.set_attribute('pid', str(self.get_machine_region()))
|
||||
return root
|
||||
|
||||
if method == 'savename':
|
||||
def handle_shop_savename_request(self, request: Node) -> Node:
|
||||
self.update_machine_name(request.attribute('opname'))
|
||||
root = Node.void('shop')
|
||||
return root
|
||||
|
||||
if method == 'sentinfo':
|
||||
def handle_shop_sentinfo_request(self, request: Node) -> Node:
|
||||
root = Node.void('shop')
|
||||
return root
|
||||
|
||||
if method == 'getconvention':
|
||||
def handle_shop_getconvention_request(self, request: Node) -> Node:
|
||||
root = Node.void('shop')
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
if machine.arcade is not None:
|
||||
@ -298,7 +316,7 @@ class IIDXTricoro(IIDXBase):
|
||||
root.add_child(Node.bool('valid', course.get_bool('valid')))
|
||||
return root
|
||||
|
||||
if method == 'setconvention':
|
||||
def handle_shop_setconvention_request(self, request: Node) -> Node:
|
||||
root = Node.void('shop')
|
||||
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
|
||||
if machine.arcade is not None:
|
||||
@ -312,15 +330,9 @@ class IIDXTricoro(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_ranking_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'getranker':
|
||||
def handle_ranking_getranker_request(self, request: Node) -> Node:
|
||||
root = Node.void('ranking')
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
if chart not in [
|
||||
self.CHART_TYPE_N7,
|
||||
self.CHART_TYPE_H7,
|
||||
@ -409,13 +421,7 @@ class IIDXTricoro(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_music_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'crate':
|
||||
def handle_music_crate_request(self, request: Node) -> Node:
|
||||
root = Node.void('music')
|
||||
attempts = self.get_clear_rates()
|
||||
|
||||
@ -442,7 +448,7 @@ class IIDXTricoro(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'getrank':
|
||||
def handle_music_getrank_request(self, request: Node) -> Node:
|
||||
cltype = int(request.attribute('cltype'))
|
||||
|
||||
root = Node.void('music')
|
||||
@ -494,10 +500,10 @@ class IIDXTricoro(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'reg':
|
||||
def handle_music_reg_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
|
||||
# See if we need to report global or shop scores
|
||||
@ -661,7 +667,7 @@ class IIDXTricoro(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'breg':
|
||||
def handle_music_breg_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
musicid = int(request.attribute('mid'))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
@ -687,9 +693,9 @@ class IIDXTricoro(IIDXBase):
|
||||
root = Node.void('music')
|
||||
return root
|
||||
|
||||
if method == 'play':
|
||||
def handle_music_play_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
clear_status = self.game_to_db_status(int(request.attribute('cflg')))
|
||||
|
||||
self.update_score(
|
||||
@ -723,9 +729,9 @@ class IIDXTricoro(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'appoint':
|
||||
def handle_music_appoint_request(self, request: Node) -> Node:
|
||||
musicid = int(request.attribute('mid'))
|
||||
chart = int(request.attribute('clid'))
|
||||
chart = self.game_to_db_chart(int(request.attribute('clid')))
|
||||
ghost_type = int(request.attribute('ctype'))
|
||||
extid = int(request.attribute('iidxid'))
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
@ -773,13 +779,7 @@ class IIDXTricoro(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_pc_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'common':
|
||||
def handle_pc_common_request(self, request: Node) -> Node:
|
||||
root = Node.void('pc')
|
||||
root.set_attribute('expire', '600')
|
||||
|
||||
@ -832,16 +832,16 @@ class IIDXTricoro(IIDXBase):
|
||||
|
||||
return root
|
||||
|
||||
if method == 'delete':
|
||||
def handle_pc_delete_request(self, request: Node) -> Node:
|
||||
return Node.void('pc')
|
||||
|
||||
if method == 'playstart':
|
||||
def handle_pc_playstart_request(self, request: Node) -> Node:
|
||||
return Node.void('pc')
|
||||
|
||||
if method == 'playend':
|
||||
def handle_pc_playend_request(self, request: Node) -> Node:
|
||||
return Node.void('pc')
|
||||
|
||||
if method == 'oldget':
|
||||
def handle_pc_oldget_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
userid = self.data.remote.user.from_refid(self.game, self.version, refid)
|
||||
if userid is not None:
|
||||
@ -854,7 +854,7 @@ class IIDXTricoro(IIDXBase):
|
||||
root.set_attribute('status', '1' if profile is None else '0')
|
||||
return root
|
||||
|
||||
if method == 'getname':
|
||||
def handle_pc_getname_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
userid = self.data.remote.user.from_refid(self.game, self.version, refid)
|
||||
if userid is not None:
|
||||
@ -875,7 +875,7 @@ class IIDXTricoro(IIDXBase):
|
||||
root.set_attribute('pid', str(profile.get_int('pid')))
|
||||
return root
|
||||
|
||||
if method == 'reg':
|
||||
def handle_pc_reg_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
name = request.attribute('name')
|
||||
pid = int(request.attribute('pid'))
|
||||
@ -887,21 +887,21 @@ class IIDXTricoro(IIDXBase):
|
||||
root.set_attribute('id_str', ID.format_extid(profile.extid))
|
||||
return root
|
||||
|
||||
if method == 'get':
|
||||
def handle_pc_get_request(self, request: Node) -> Node:
|
||||
refid = request.attribute('rid')
|
||||
root = self.get_profile_by_refid(refid)
|
||||
if root is None:
|
||||
root = Node.void('pc')
|
||||
return root
|
||||
|
||||
if method == 'save':
|
||||
def handle_pc_save_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
self.put_profile_by_extid(extid, request)
|
||||
|
||||
root = Node.void('pc')
|
||||
return root
|
||||
|
||||
if method == 'visit':
|
||||
def handle_pc_visit_request(self, request: Node) -> Node:
|
||||
root = Node.void('pc')
|
||||
root.set_attribute('anum', '0')
|
||||
root.set_attribute('snum', '0')
|
||||
@ -911,7 +911,7 @@ class IIDXTricoro(IIDXBase):
|
||||
root.set_attribute('pflg', '0')
|
||||
return root
|
||||
|
||||
if method == 'shopregister':
|
||||
def handle_pc_shopregister_request(self, request: Node) -> Node:
|
||||
extid = int(request.child_value('iidx_id'))
|
||||
location = ID.parse_machine_id(request.child_value('location_id'))
|
||||
|
||||
@ -926,17 +926,10 @@ class IIDXTricoro(IIDXBase):
|
||||
root = Node.void('pc')
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_grade_request(self, request: Node) -> Optional[Node]:
|
||||
method = request.attribute('method')
|
||||
|
||||
if method == 'raised':
|
||||
def handle_grade_raised_request(self, request: Node) -> Node:
|
||||
extid = int(request.attribute('iidxid'))
|
||||
cltype = int(request.attribute('gtype'))
|
||||
rank = self.game_to_db_rank(int(request.attribute('gid')), cltype)
|
||||
|
||||
userid = self.data.remote.user.from_extid(self.game, self.version, extid)
|
||||
if userid is not None:
|
||||
percent = int(request.attribute('achi'))
|
||||
@ -967,9 +960,6 @@ class IIDXTricoro(IIDXBase):
|
||||
root.set_attribute('pnum', str(len(all_achievements)))
|
||||
return root
|
||||
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def format_profile(self, userid: UserID, profile: Profile) -> Node:
|
||||
root = Node.void('pc')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user