956 lines
41 KiB
Python
956 lines
41 KiB
Python
|
import random
|
||
|
import time
|
||
|
from typing import Any, Dict, Optional, Tuple
|
||
|
|
||
|
from bemani.client.base import BaseClient
|
||
|
from bemani.protocol import Node
|
||
|
|
||
|
|
||
|
class IIDXSinobuzClient(BaseClient):
|
||
|
NAME = 'TEST'
|
||
|
|
||
|
def verify_iidx24shop_getname(self, lid: str) -> str:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24shop = Node.void('IIDX24shop')
|
||
|
call.add_child(IIDX24shop)
|
||
|
IIDX24shop.set_attribute('method', 'getname')
|
||
|
IIDX24shop.set_attribute('lid', lid)
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify that response is correct
|
||
|
self.assert_path(resp, "response/IIDX24shop/@opname")
|
||
|
self.assert_path(resp, "response/IIDX24shop/@pid")
|
||
|
self.assert_path(resp, "response/IIDX24shop/@cls_opt")
|
||
|
self.assert_path(resp, "response/IIDX24shop/@hr")
|
||
|
self.assert_path(resp, "response/IIDX24shop/@mi")
|
||
|
|
||
|
return resp.child('IIDX24shop').attribute('opname')
|
||
|
|
||
|
def verify_iidx24shop_savename(self, lid: str, name: str) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24shop = Node.void('IIDX24shop')
|
||
|
IIDX24shop.set_attribute('lid', lid)
|
||
|
IIDX24shop.set_attribute('pid', '51')
|
||
|
IIDX24shop.set_attribute('method', 'savename')
|
||
|
IIDX24shop.set_attribute('cls_opt', '0')
|
||
|
IIDX24shop.set_attribute('ccode', 'US')
|
||
|
IIDX24shop.set_attribute('opname', name)
|
||
|
IIDX24shop.set_attribute('rcode', '.')
|
||
|
|
||
|
call.add_child(IIDX24shop)
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify that response is correct
|
||
|
self.assert_path(resp, "response/IIDX24shop")
|
||
|
|
||
|
def verify_iidx24pc_common(self) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24pc = Node.void('IIDX24pc')
|
||
|
call.add_child(IIDX24pc)
|
||
|
IIDX24pc.set_attribute('method', 'common')
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify that response is correct
|
||
|
self.assert_path(resp, "response/IIDX24pc/ir/@beat")
|
||
|
self.assert_path(resp, "response/IIDX24pc/newsong_another/@open")
|
||
|
self.assert_path(resp, "response/IIDX24pc/boss/@phase")
|
||
|
self.assert_path(resp, "response/IIDX24pc/event1_phase/@phase")
|
||
|
self.assert_path(resp, "response/IIDX24pc/event2_phase/@phase")
|
||
|
self.assert_path(resp, "response/IIDX24pc/extra_boss_event/@phase")
|
||
|
self.assert_path(resp, "response/IIDX24pc/expert/@phase")
|
||
|
self.assert_path(resp, "response/IIDX24pc/expert_random_select/@phase")
|
||
|
self.assert_path(resp, "response/IIDX24pc/common_evnet/@flg")
|
||
|
|
||
|
def verify_iidx24music_crate(self) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24pc = Node.void('IIDX24music')
|
||
|
call.add_child(IIDX24pc)
|
||
|
IIDX24pc.set_attribute('method', 'crate')
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
self.assert_path(resp, "response/IIDX24music")
|
||
|
for child in resp.child("IIDX24music").children:
|
||
|
if child.name != 'c':
|
||
|
raise Exception('Invalid node {} in clear rate response!'.format(child))
|
||
|
if len(child.value) != 12:
|
||
|
raise Exception('Invalid node data {} in clear rate response!'.format(child))
|
||
|
for v in child.value:
|
||
|
if v < 0 or v > 1001:
|
||
|
raise Exception('Invalid clear percent {} in clear rate response!'.format(child))
|
||
|
|
||
|
def verify_iidx24shop_getconvention(self, lid: str) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24pc = Node.void('IIDX24shop')
|
||
|
call.add_child(IIDX24pc)
|
||
|
IIDX24pc.set_attribute('method', 'getconvention')
|
||
|
IIDX24pc.set_attribute('lid', lid)
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify that response is correct
|
||
|
self.assert_path(resp, "response/IIDX24shop/valid")
|
||
|
self.assert_path(resp, "response/IIDX24shop/@music_0")
|
||
|
self.assert_path(resp, "response/IIDX24shop/@music_1")
|
||
|
self.assert_path(resp, "response/IIDX24shop/@music_2")
|
||
|
self.assert_path(resp, "response/IIDX24shop/@music_3")
|
||
|
|
||
|
def verify_iidx24pc_visit(self, extid: int, lid: str) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24pc = Node.void('IIDX24pc')
|
||
|
call.add_child(IIDX24pc)
|
||
|
IIDX24pc.set_attribute('iidxid', str(extid))
|
||
|
IIDX24pc.set_attribute('lid', lid)
|
||
|
IIDX24pc.set_attribute('method', 'visit')
|
||
|
IIDX24pc.set_attribute('pid', '51')
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify that response is correct
|
||
|
self.assert_path(resp, "response/IIDX24pc/@aflg")
|
||
|
self.assert_path(resp, "response/IIDX24pc/@anum")
|
||
|
self.assert_path(resp, "response/IIDX24pc/@pflg")
|
||
|
self.assert_path(resp, "response/IIDX24pc/@pnum")
|
||
|
self.assert_path(resp, "response/IIDX24pc/@sflg")
|
||
|
self.assert_path(resp, "response/IIDX24pc/@snum")
|
||
|
|
||
|
def verify_iidx24ranking_getranker(self, lid: str) -> None:
|
||
|
for clid in [0, 1, 2, 3, 4, 5, 6]:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24pc = Node.void('IIDX24ranking')
|
||
|
call.add_child(IIDX24pc)
|
||
|
IIDX24pc.set_attribute('method', 'getranker')
|
||
|
IIDX24pc.set_attribute('lid', lid)
|
||
|
IIDX24pc.set_attribute('clid', str(clid))
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify that response is correct
|
||
|
self.assert_path(resp, "response/IIDX24ranking")
|
||
|
|
||
|
def verify_iidx24shop_sentinfo(self, lid: str, shop_name: str) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24pc = Node.void('IIDX24shop')
|
||
|
call.add_child(IIDX24pc)
|
||
|
IIDX24pc.set_attribute('method', 'sentinfo')
|
||
|
IIDX24pc.set_attribute('lid', lid)
|
||
|
IIDX24pc.set_attribute('bflg', '1')
|
||
|
IIDX24pc.set_attribute('bnum', '2')
|
||
|
IIDX24pc.set_attribute('ioid', '0')
|
||
|
IIDX24pc.set_attribute('company_code', '')
|
||
|
IIDX24pc.set_attribute('consumer_code', '')
|
||
|
IIDX24pc.set_attribute('location_name', shop_name)
|
||
|
IIDX24pc.set_attribute('tax_phase', '0')
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify that response is correct
|
||
|
self.assert_path(resp, "response/IIDX24shop")
|
||
|
|
||
|
def verify_iidx24pc_get(self, ref_id: str, card_id: str, lid: str) -> Dict[str, Any]:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24pc = Node.void('IIDX24pc')
|
||
|
call.add_child(IIDX24pc)
|
||
|
IIDX24pc.set_attribute('rid', ref_id)
|
||
|
IIDX24pc.set_attribute('did', ref_id)
|
||
|
IIDX24pc.set_attribute('pid', '51')
|
||
|
IIDX24pc.set_attribute('lid', lid)
|
||
|
IIDX24pc.set_attribute('cid', card_id)
|
||
|
IIDX24pc.set_attribute('method', 'get')
|
||
|
IIDX24pc.set_attribute('ctype', '1')
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify that the response is correct
|
||
|
self.assert_path(resp, "response/IIDX24pc/pcdata/@name")
|
||
|
self.assert_path(resp, "response/IIDX24pc/pcdata/@pid")
|
||
|
self.assert_path(resp, "response/IIDX24pc/pcdata/@id")
|
||
|
self.assert_path(resp, "response/IIDX24pc/pcdata/@idstr")
|
||
|
self.assert_path(resp, "response/IIDX24pc/deller")
|
||
|
self.assert_path(resp, "response/IIDX24pc/secret/flg1")
|
||
|
self.assert_path(resp, "response/IIDX24pc/secret/flg2")
|
||
|
self.assert_path(resp, "response/IIDX24pc/secret/flg3")
|
||
|
self.assert_path(resp, "response/IIDX24pc/achievements/trophy")
|
||
|
self.assert_path(resp, "response/IIDX24pc/skin")
|
||
|
self.assert_path(resp, "response/IIDX24pc/qprodata")
|
||
|
self.assert_path(resp, "response/IIDX24pc/grade")
|
||
|
self.assert_path(resp, "response/IIDX24pc/ir_data")
|
||
|
self.assert_path(resp, "response/IIDX24pc/secret_course_data")
|
||
|
self.assert_path(resp, "response/IIDX24pc/classic_course_data")
|
||
|
self.assert_path(resp, "response/IIDX24pc/rlist")
|
||
|
self.assert_path(resp, "response/IIDX24pc/step")
|
||
|
self.assert_path(resp, "response/IIDX24pc/favorite/sp_mlist")
|
||
|
self.assert_path(resp, "response/IIDX24pc/favorite/sp_clist")
|
||
|
self.assert_path(resp, "response/IIDX24pc/favorite/dp_mlist")
|
||
|
self.assert_path(resp, "response/IIDX24pc/favorite/dp_clist")
|
||
|
self.assert_path(resp, "response/IIDX24pc/extra_favorite/sp_mlist")
|
||
|
self.assert_path(resp, "response/IIDX24pc/extra_favorite/sp_clist")
|
||
|
self.assert_path(resp, "response/IIDX24pc/extra_favorite/dp_mlist")
|
||
|
self.assert_path(resp, "response/IIDX24pc/extra_favorite/dp_clist")
|
||
|
|
||
|
name = resp.child('IIDX24pc/pcdata').attribute('name')
|
||
|
if name != self.NAME:
|
||
|
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
|
||
|
|
||
|
# Extract and return account data
|
||
|
ir_data: Dict[int, Dict[int, Dict[str, int]]] = {}
|
||
|
for child in resp.child('IIDX24pc/ir_data').children:
|
||
|
if child.name == 'e':
|
||
|
course_id = child.value[0]
|
||
|
course_chart = child.value[1]
|
||
|
clear_status = child.value[2]
|
||
|
pgnum = child.value[3]
|
||
|
gnum = child.value[4]
|
||
|
|
||
|
if course_id not in ir_data:
|
||
|
ir_data[course_id] = {}
|
||
|
ir_data[course_id][course_chart] = {
|
||
|
'clear_status': clear_status,
|
||
|
'pgnum': pgnum,
|
||
|
'gnum': gnum,
|
||
|
}
|
||
|
|
||
|
secret_course_data: Dict[int, Dict[int, Dict[str, int]]] = {}
|
||
|
for child in resp.child('IIDX24pc/secret_course_data').children:
|
||
|
if child.name == 'e':
|
||
|
course_id = child.value[0]
|
||
|
course_chart = child.value[1]
|
||
|
clear_status = child.value[2]
|
||
|
pgnum = child.value[3]
|
||
|
gnum = child.value[4]
|
||
|
|
||
|
if course_id not in secret_course_data:
|
||
|
secret_course_data[course_id] = {}
|
||
|
secret_course_data[course_id][course_chart] = {
|
||
|
'clear_status': clear_status,
|
||
|
'pgnum': pgnum,
|
||
|
'gnum': gnum,
|
||
|
}
|
||
|
|
||
|
classic_course_data: Dict[int, Dict[int, Dict[str, int]]] = {} # noqa: E701
|
||
|
for child in resp.child('IIDX24pc/classic_course_data').children:
|
||
|
if child.name == 'score_data':
|
||
|
course_id = int(child.attribute('course_id'))
|
||
|
course_chart = int(child.attribute('play_style'))
|
||
|
clear_status = int(child.attribute('cflg'))
|
||
|
pgnum = int(child.attribute('pgnum'))
|
||
|
gnum = int(child.attribute('gnum'))
|
||
|
|
||
|
if course_id not in classic_course_data:
|
||
|
classic_course_data[course_id] = {}
|
||
|
classic_course_data[course_id][course_chart] = {
|
||
|
'clear_status': clear_status,
|
||
|
'pgnum': pgnum,
|
||
|
'gnum': gnum,
|
||
|
}
|
||
|
|
||
|
expert_point: Dict[int, Dict[str, int]] = {}
|
||
|
for child in resp.child('IIDX24pc/expert_point').children:
|
||
|
if child.name == 'detail':
|
||
|
expert_point[int(child.attribute('course_id'))] = {
|
||
|
'n_point': int(child.attribute('n_point')),
|
||
|
'h_point': int(child.attribute('h_point')),
|
||
|
'a_point': int(child.attribute('a_point')),
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
'extid': int(resp.child('IIDX24pc/pcdata').attribute('id')),
|
||
|
'sp_dan': int(resp.child('IIDX24pc/grade').attribute('sgid')),
|
||
|
'dp_dan': int(resp.child('IIDX24pc/grade').attribute('dgid')),
|
||
|
'deller': int(resp.child('IIDX24pc/deller').attribute('deller')),
|
||
|
'ir_data': ir_data,
|
||
|
'secret_course_data': secret_course_data,
|
||
|
'classic_course_data': classic_course_data,
|
||
|
'expert_point': expert_point,
|
||
|
}
|
||
|
|
||
|
def verify_iidx24music_getrank(self, extid: int) -> Dict[int, Dict[int, Dict[str, int]]]:
|
||
|
scores: Dict[int, Dict[int, Dict[str, int]]] = {}
|
||
|
for cltype in [0, 1]: # singles, doubles
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24music = Node.void('IIDX24music')
|
||
|
call.add_child(IIDX24music)
|
||
|
IIDX24music.set_attribute('method', 'getrank')
|
||
|
IIDX24music.set_attribute('iidxid', str(extid))
|
||
|
IIDX24music.set_attribute('cltype', str(cltype))
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
self.assert_path(resp, "response/IIDX24music/style")
|
||
|
if int(resp.child('IIDX24music/style').attribute('type')) != cltype:
|
||
|
raise Exception('Returned wrong clear type for IIDX24music.getrank!')
|
||
|
|
||
|
for child in resp.child('IIDX24music').children:
|
||
|
if child.name == 'm':
|
||
|
if child.value[0] != -1:
|
||
|
raise Exception('Got non-self score back when requesting only our scores!')
|
||
|
|
||
|
music_id = child.value[1]
|
||
|
normal_clear_status = child.value[2]
|
||
|
hyper_clear_status = child.value[3]
|
||
|
another_clear_status = child.value[4]
|
||
|
normal_ex_score = child.value[5]
|
||
|
hyper_ex_score = child.value[6]
|
||
|
another_ex_score = child.value[7]
|
||
|
normal_miss_count = child.value[8]
|
||
|
hyper_miss_count = child.value[9]
|
||
|
another_miss_count = child.value[10]
|
||
|
|
||
|
if cltype == 0:
|
||
|
normal = 0
|
||
|
hyper = 1
|
||
|
another = 2
|
||
|
else:
|
||
|
normal = 3
|
||
|
hyper = 4
|
||
|
another = 5
|
||
|
|
||
|
if music_id not in scores:
|
||
|
scores[music_id] = {}
|
||
|
|
||
|
scores[music_id][normal] = {
|
||
|
'clear_status': normal_clear_status,
|
||
|
'ex_score': normal_ex_score,
|
||
|
'miss_count': normal_miss_count,
|
||
|
}
|
||
|
scores[music_id][hyper] = {
|
||
|
'clear_status': hyper_clear_status,
|
||
|
'ex_score': hyper_ex_score,
|
||
|
'miss_count': hyper_miss_count,
|
||
|
}
|
||
|
scores[music_id][another] = {
|
||
|
'clear_status': another_clear_status,
|
||
|
'ex_score': another_ex_score,
|
||
|
'miss_count': another_miss_count,
|
||
|
}
|
||
|
elif child.name == 'b':
|
||
|
music_id = child.value[0]
|
||
|
clear_status = child.value[1]
|
||
|
|
||
|
scores[music_id][6] = {
|
||
|
'clear_status': clear_status,
|
||
|
'ex_score': -1,
|
||
|
'miss_count': -1,
|
||
|
}
|
||
|
|
||
|
return scores
|
||
|
|
||
|
def verify_iidx24pc_save(self, extid: int, card: str, lid: str, expert_point: Optional[Dict[str, int]]=None) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24pc = Node.void('IIDX24pc')
|
||
|
call.add_child(IIDX24pc)
|
||
|
IIDX24pc.set_attribute('s_disp_judge', '1')
|
||
|
IIDX24pc.set_attribute('mode', '6')
|
||
|
IIDX24pc.set_attribute('pmode', '0')
|
||
|
IIDX24pc.set_attribute('method', 'save')
|
||
|
IIDX24pc.set_attribute('s_sorttype', '0')
|
||
|
IIDX24pc.set_attribute('s_exscore', '0')
|
||
|
IIDX24pc.set_attribute('d_notes', '0.000000')
|
||
|
IIDX24pc.set_attribute('gpos', '0')
|
||
|
IIDX24pc.set_attribute('s_gno', '8')
|
||
|
IIDX24pc.set_attribute('s_hispeed', '5.771802')
|
||
|
IIDX24pc.set_attribute('s_judge', '0')
|
||
|
IIDX24pc.set_attribute('d_timing', '0')
|
||
|
IIDX24pc.set_attribute('rtype', '0')
|
||
|
IIDX24pc.set_attribute('d_graph_score', '0')
|
||
|
IIDX24pc.set_attribute('d_lift', '60')
|
||
|
IIDX24pc.set_attribute('s_pace', '0')
|
||
|
IIDX24pc.set_attribute('d_exscore', '0')
|
||
|
IIDX24pc.set_attribute('d_sdtype', '0')
|
||
|
IIDX24pc.set_attribute('s_opstyle', '1')
|
||
|
IIDX24pc.set_attribute('s_achi', '449')
|
||
|
IIDX24pc.set_attribute('s_graph_score', '0')
|
||
|
IIDX24pc.set_attribute('d_gno', '0')
|
||
|
IIDX24pc.set_attribute('s_lift', '60')
|
||
|
IIDX24pc.set_attribute('s_notes', '31.484070')
|
||
|
IIDX24pc.set_attribute('d_tune', '0')
|
||
|
IIDX24pc.set_attribute('d_sdlen', '0')
|
||
|
IIDX24pc.set_attribute('d_achi', '4')
|
||
|
IIDX24pc.set_attribute('d_opstyle', '0')
|
||
|
IIDX24pc.set_attribute('sp_opt', '8208')
|
||
|
IIDX24pc.set_attribute('iidxid', str(extid))
|
||
|
IIDX24pc.set_attribute('lid', lid)
|
||
|
IIDX24pc.set_attribute('s_judgeAdj', '0')
|
||
|
IIDX24pc.set_attribute('s_tune', '3')
|
||
|
IIDX24pc.set_attribute('s_sdtype', '1')
|
||
|
IIDX24pc.set_attribute('s_gtype', '2')
|
||
|
IIDX24pc.set_attribute('d_judge', '0')
|
||
|
IIDX24pc.set_attribute('cid', card)
|
||
|
IIDX24pc.set_attribute('cltype', '0')
|
||
|
IIDX24pc.set_attribute('ctype', '1')
|
||
|
IIDX24pc.set_attribute('bookkeep', '0')
|
||
|
IIDX24pc.set_attribute('d_hispeed', '0.000000')
|
||
|
IIDX24pc.set_attribute('d_pace', '0')
|
||
|
IIDX24pc.set_attribute('d_judgeAdj', '0')
|
||
|
IIDX24pc.set_attribute('s_timing', '1')
|
||
|
IIDX24pc.set_attribute('d_disp_judge', '0')
|
||
|
IIDX24pc.set_attribute('s_sdlen', '121')
|
||
|
IIDX24pc.set_attribute('dp_opt2', '0')
|
||
|
IIDX24pc.set_attribute('d_gtype', '0')
|
||
|
IIDX24pc.set_attribute('d_sorttype', '0')
|
||
|
IIDX24pc.set_attribute('dp_opt', '0')
|
||
|
deller = Node.void('deller')
|
||
|
IIDX24pc.add_child(deller)
|
||
|
deller.set_attribute('deller', '150')
|
||
|
|
||
|
if expert_point is not None:
|
||
|
epnode = Node.void('expert_point')
|
||
|
epnode.set_attribute('h_point', str(expert_point['h_point']))
|
||
|
epnode.set_attribute('course_id', str(expert_point['course_id']))
|
||
|
epnode.set_attribute('n_point', str(expert_point['n_point']))
|
||
|
epnode.set_attribute('a_point', str(expert_point['a_point']))
|
||
|
IIDX24pc.add_child(epnode)
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
self.assert_path(resp, "response/IIDX24pc")
|
||
|
|
||
|
def verify_iidx24music_reg(self, extid: int, lid: str, score: Dict[str, Any]) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24music = Node.void('IIDX24music')
|
||
|
call.add_child(IIDX24music)
|
||
|
IIDX24music.set_attribute('convid', '-1')
|
||
|
IIDX24music.set_attribute('iidxid', str(extid))
|
||
|
IIDX24music.set_attribute('pgnum', str(score['pgnum']))
|
||
|
IIDX24music.set_attribute('pid', '51')
|
||
|
IIDX24music.set_attribute('rankside', '1')
|
||
|
IIDX24music.set_attribute('cflg', str(score['clear_status']))
|
||
|
IIDX24music.set_attribute('method', 'reg')
|
||
|
IIDX24music.set_attribute('gnum', str(score['gnum']))
|
||
|
IIDX24music.set_attribute('clid', str(score['chart']))
|
||
|
IIDX24music.set_attribute('mnum', str(score['mnum']))
|
||
|
IIDX24music.set_attribute('is_death', '0')
|
||
|
IIDX24music.set_attribute('theory', '0')
|
||
|
IIDX24music.set_attribute('dj_level', '1')
|
||
|
IIDX24music.set_attribute('shopconvid', lid)
|
||
|
IIDX24music.set_attribute('mid', str(score['id']))
|
||
|
IIDX24music.set_attribute('shopflg', '1')
|
||
|
IIDX24music.add_child(Node.binary('ghost', bytes([1] * 64)))
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
self.assert_path(resp, "response/IIDX24music/shopdata/@rank")
|
||
|
self.assert_path(resp, "response/IIDX24music/ranklist/data")
|
||
|
|
||
|
def verify_iidx24music_appoint(self, extid: int, musicid: int, chart: int) -> Tuple[int, bytes]:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24music = Node.void('IIDX24music')
|
||
|
call.add_child(IIDX24music)
|
||
|
IIDX24music.set_attribute('clid', str(chart))
|
||
|
IIDX24music.set_attribute('method', 'appoint')
|
||
|
IIDX24music.set_attribute('ctype', '0')
|
||
|
IIDX24music.set_attribute('iidxid', str(extid))
|
||
|
IIDX24music.set_attribute('subtype', '')
|
||
|
IIDX24music.set_attribute('mid', str(musicid))
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
self.assert_path(resp, "response/IIDX24music/mydata/@score")
|
||
|
|
||
|
return (
|
||
|
int(resp.child('IIDX24music/mydata').attribute('score')),
|
||
|
resp.child_value('IIDX24music/mydata'),
|
||
|
)
|
||
|
|
||
|
def verify_iidx24pc_reg(self, ref_id: str, card_id: str, lid: str) -> int:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24pc = Node.void('IIDX24pc')
|
||
|
call.add_child(IIDX24pc)
|
||
|
IIDX24pc.set_attribute('lid', lid)
|
||
|
IIDX24pc.set_attribute('pid', '51')
|
||
|
IIDX24pc.set_attribute('method', 'reg')
|
||
|
IIDX24pc.set_attribute('cid', card_id)
|
||
|
IIDX24pc.set_attribute('did', ref_id)
|
||
|
IIDX24pc.set_attribute('rid', ref_id)
|
||
|
IIDX24pc.set_attribute('name', self.NAME)
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify nodes that cause crashes if they don't exist
|
||
|
self.assert_path(resp, "response/IIDX24pc/@id")
|
||
|
self.assert_path(resp, "response/IIDX24pc/@id_str")
|
||
|
|
||
|
return int(resp.child('IIDX24pc').attribute('id'))
|
||
|
|
||
|
def verify_iidx24pc_playstart(self) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24pc = Node.void('IIDX24pc')
|
||
|
IIDX24pc.set_attribute('method', 'playstart')
|
||
|
IIDX24pc.set_attribute('side', '1')
|
||
|
call.add_child(IIDX24pc)
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify nodes that cause crashes if they don't exist
|
||
|
self.assert_path(resp, "response/IIDX24pc")
|
||
|
|
||
|
def verify_iidx24music_play(self, score: Dict[str, int]) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24music = Node.void('IIDX24music')
|
||
|
IIDX24music.set_attribute('opt', '64')
|
||
|
IIDX24music.set_attribute('clid', str(score['chart']))
|
||
|
IIDX24music.set_attribute('mid', str(score['id']))
|
||
|
IIDX24music.set_attribute('gnum', str(score['gnum']))
|
||
|
IIDX24music.set_attribute('cflg', str(score['clear_status']))
|
||
|
IIDX24music.set_attribute('pgnum', str(score['pgnum']))
|
||
|
IIDX24music.set_attribute('pid', '51')
|
||
|
IIDX24music.set_attribute('method', 'play')
|
||
|
call.add_child(IIDX24music)
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify nodes that cause crashes if they don't exist
|
||
|
self.assert_path(resp, "response/IIDX24music/@clid")
|
||
|
self.assert_path(resp, "response/IIDX24music/@crate")
|
||
|
self.assert_path(resp, "response/IIDX24music/@frate")
|
||
|
self.assert_path(resp, "response/IIDX24music/@mid")
|
||
|
|
||
|
def verify_iidx24pc_playend(self, lid: str, shop_name: str) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24pc = Node.void('IIDX24pc')
|
||
|
IIDX24pc.set_attribute('cltype', '0')
|
||
|
IIDX24pc.set_attribute('bookkeep', '0')
|
||
|
IIDX24pc.set_attribute('mode', '1')
|
||
|
IIDX24pc.set_attribute('pay_coin', '1')
|
||
|
IIDX24pc.set_attribute('method', 'playend')
|
||
|
IIDX24pc.set_attribute('company_code', '')
|
||
|
IIDX24pc.set_attribute('consumer_code', '')
|
||
|
IIDX24pc.set_attribute('location_name', shop_name)
|
||
|
IIDX24pc.set_attribute('lid', lid)
|
||
|
call.add_child(IIDX24pc)
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify nodes that cause crashes if they don't exist
|
||
|
self.assert_path(resp, "response/IIDX24pc")
|
||
|
|
||
|
def verify_iidx24music_breg(self, iidxid: int, score: Dict[str, int]) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24music = Node.void('IIDX24music')
|
||
|
IIDX24music.set_attribute('gnum', str(score['gnum']))
|
||
|
IIDX24music.set_attribute('iidxid', str(iidxid))
|
||
|
IIDX24music.set_attribute('mid', str(score['id']))
|
||
|
IIDX24music.set_attribute('method', 'breg')
|
||
|
IIDX24music.set_attribute('pgnum', str(score['pgnum']))
|
||
|
IIDX24music.set_attribute('cflg', str(score['clear_status']))
|
||
|
call.add_child(IIDX24music)
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify nodes that cause crashes if they don't exist
|
||
|
self.assert_path(resp, "response/IIDX24music")
|
||
|
|
||
|
def verify_iidx24grade_raised(self, iidxid: int, shop_name: str, dantype: str) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24grade = Node.void('IIDX24grade')
|
||
|
IIDX24grade.set_attribute('opname', shop_name)
|
||
|
IIDX24grade.set_attribute('is_mirror', '0')
|
||
|
IIDX24grade.set_attribute('oppid', '51')
|
||
|
IIDX24grade.set_attribute('achi', '50')
|
||
|
IIDX24grade.set_attribute('cstage', '4')
|
||
|
IIDX24grade.set_attribute('gid', '5')
|
||
|
IIDX24grade.set_attribute('iidxid', str(iidxid))
|
||
|
IIDX24grade.set_attribute('gtype', '0' if dantype == 'sp' else '1')
|
||
|
IIDX24grade.set_attribute('is_ex', '0')
|
||
|
IIDX24grade.set_attribute('pside', '0')
|
||
|
IIDX24grade.set_attribute('method', 'raised')
|
||
|
call.add_child(IIDX24grade)
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify nodes that cause crashes if they don't exist
|
||
|
self.assert_path(resp, "response/IIDX24grade/@pnum")
|
||
|
|
||
|
def verify_iidx24ranking_entry(self, iidxid: int, shop_name: str, coursetype: str) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24ranking = Node.void('IIDX24ranking')
|
||
|
IIDX24ranking.set_attribute('opname', shop_name)
|
||
|
IIDX24ranking.set_attribute('clr', '4')
|
||
|
IIDX24ranking.set_attribute('pgnum', '1771')
|
||
|
IIDX24ranking.set_attribute('coid', '2')
|
||
|
IIDX24ranking.set_attribute('method', 'entry')
|
||
|
IIDX24ranking.set_attribute('opt', '8208')
|
||
|
IIDX24ranking.set_attribute('opt2', '0')
|
||
|
IIDX24ranking.set_attribute('oppid', '51')
|
||
|
IIDX24ranking.set_attribute('cstage', '4')
|
||
|
IIDX24ranking.set_attribute('gnum', '967')
|
||
|
IIDX24ranking.set_attribute('pside', '1')
|
||
|
IIDX24ranking.set_attribute('clid', '1')
|
||
|
IIDX24ranking.set_attribute('regist_type', '0' if coursetype == 'ir' else '1')
|
||
|
IIDX24ranking.set_attribute('iidxid', str(iidxid))
|
||
|
call.add_child(IIDX24ranking)
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify nodes that cause crashes if they don't exist
|
||
|
self.assert_path(resp, "response/IIDX24ranking/@anum")
|
||
|
self.assert_path(resp, "response/IIDX24ranking/@jun")
|
||
|
|
||
|
def verify_iidx24ranking_classicentry(self, iidxid: int) -> None:
|
||
|
call = self.call_node()
|
||
|
|
||
|
# Construct node
|
||
|
IIDX24ranking = Node.void('IIDX24ranking')
|
||
|
IIDX24ranking.set_attribute('clear_stage', '4')
|
||
|
IIDX24ranking.set_attribute('clear_flg', '4')
|
||
|
IIDX24ranking.set_attribute('course_id', '2')
|
||
|
IIDX24ranking.set_attribute('score', '4509')
|
||
|
IIDX24ranking.set_attribute('gnum', '967')
|
||
|
IIDX24ranking.set_attribute('iidx_id', str(iidxid))
|
||
|
IIDX24ranking.set_attribute('method', 'classicentry')
|
||
|
IIDX24ranking.set_attribute('pgnum', '1771')
|
||
|
IIDX24ranking.set_attribute('play_style', '1')
|
||
|
call.add_child(IIDX24ranking)
|
||
|
|
||
|
# Swap with server
|
||
|
resp = self.exchange('', call)
|
||
|
|
||
|
# Verify nodes that cause crashes if they don't exist
|
||
|
self.assert_path(resp, "response/IIDX24ranking/@status")
|
||
|
|
||
|
def verify(self, cardid: Optional[str]) -> None:
|
||
|
# Verify boot sequence is okay
|
||
|
self.verify_services_get(
|
||
|
expected_services=[
|
||
|
'pcbtracker',
|
||
|
'pcbevent',
|
||
|
'local',
|
||
|
'message',
|
||
|
'facility',
|
||
|
'cardmng',
|
||
|
'package',
|
||
|
'posevent',
|
||
|
'pkglist',
|
||
|
'dlstatus',
|
||
|
'eacoin',
|
||
|
'lobby',
|
||
|
'ntp',
|
||
|
'keepalive'
|
||
|
]
|
||
|
)
|
||
|
paseli_enabled = self.verify_pcbtracker_alive()
|
||
|
self.verify_package_list()
|
||
|
self.verify_message_get()
|
||
|
lid = self.verify_facility_get()
|
||
|
self.verify_pcbevent_put()
|
||
|
self.verify_iidx24shop_getname(lid)
|
||
|
self.verify_iidx24pc_common()
|
||
|
self.verify_iidx24music_crate()
|
||
|
self.verify_iidx24shop_getconvention(lid)
|
||
|
self.verify_iidx24ranking_getranker(lid)
|
||
|
self.verify_iidx24shop_sentinfo(lid, 'newname1')
|
||
|
|
||
|
# Verify card registration and profile lookup
|
||
|
if cardid is not None:
|
||
|
card = cardid
|
||
|
else:
|
||
|
card = self.random_card()
|
||
|
print("Generated random card ID {} for use.".format(card))
|
||
|
|
||
|
if cardid is None:
|
||
|
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
|
||
|
ref_id = self.verify_cardmng_getrefid(card)
|
||
|
if len(ref_id) != 16:
|
||
|
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
|
||
|
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
|
||
|
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
|
||
|
self.verify_iidx24pc_reg(ref_id, card, lid)
|
||
|
self.verify_iidx24pc_get(ref_id, card, lid)
|
||
|
else:
|
||
|
print("Skipping new card checks for existing card")
|
||
|
ref_id = self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled)
|
||
|
|
||
|
# Verify pin handling and return card handling
|
||
|
self.verify_cardmng_authpass(ref_id, correct=True)
|
||
|
self.verify_cardmng_authpass(ref_id, correct=False)
|
||
|
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
|
||
|
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
|
||
|
|
||
|
if cardid is None:
|
||
|
# Verify score handling
|
||
|
profile = self.verify_iidx24pc_get(ref_id, card, lid)
|
||
|
if profile['sp_dan'] != -1:
|
||
|
raise Exception('Somehow has SP DAN ranking on new profile!')
|
||
|
if profile['dp_dan'] != -1:
|
||
|
raise Exception('Somehow has DP DAN ranking on new profile!')
|
||
|
if profile['deller'] != 0:
|
||
|
raise Exception('Somehow has deller on new profile!')
|
||
|
if len(profile['ir_data'].keys()) > 0:
|
||
|
raise Exception('Somehow has internet ranking data on new profile!')
|
||
|
if len(profile['secret_course_data'].keys()) > 0:
|
||
|
raise Exception('Somehow has secret course data on new profile!')
|
||
|
if len(profile['expert_point'].keys()) > 0:
|
||
|
raise Exception('Somehow has expert point data on new profile!')
|
||
|
scores = self.verify_iidx24music_getrank(profile['extid'])
|
||
|
if len(scores.keys()) > 0:
|
||
|
raise Exception('Somehow have scores on a new profile!')
|
||
|
|
||
|
for phase in [1, 2]:
|
||
|
if phase == 1:
|
||
|
dummyscores = [
|
||
|
# An okay score on a chart
|
||
|
{
|
||
|
'id': 1000,
|
||
|
'chart': 2,
|
||
|
'clear_status': 4,
|
||
|
'pgnum': 123,
|
||
|
'gnum': 123,
|
||
|
'mnum': 5,
|
||
|
},
|
||
|
# A good score on an easier chart of the same song
|
||
|
{
|
||
|
'id': 1000,
|
||
|
'chart': 0,
|
||
|
'clear_status': 7,
|
||
|
'pgnum': 246,
|
||
|
'gnum': 0,
|
||
|
'mnum': 0,
|
||
|
},
|
||
|
# A bad score on a hard chart
|
||
|
{
|
||
|
'id': 1003,
|
||
|
'chart': 2,
|
||
|
'clear_status': 1,
|
||
|
'pgnum': 10,
|
||
|
'gnum': 20,
|
||
|
'mnum': 50,
|
||
|
},
|
||
|
# A terrible score on an easy chart
|
||
|
{
|
||
|
'id': 1003,
|
||
|
'chart': 0,
|
||
|
'clear_status': 1,
|
||
|
'pgnum': 2,
|
||
|
'gnum': 5,
|
||
|
'mnum': 75,
|
||
|
},
|
||
|
]
|
||
|
if phase == 2:
|
||
|
dummyscores = [
|
||
|
# A better score on the same chart
|
||
|
{
|
||
|
'id': 1000,
|
||
|
'chart': 2,
|
||
|
'clear_status': 5,
|
||
|
'pgnum': 234,
|
||
|
'gnum': 234,
|
||
|
'mnum': 3,
|
||
|
},
|
||
|
# A worse score on another same chart
|
||
|
{
|
||
|
'id': 1000,
|
||
|
'chart': 0,
|
||
|
'clear_status': 4,
|
||
|
'pgnum': 123,
|
||
|
'gnum': 123,
|
||
|
'mnum': 35,
|
||
|
'expected_clear_status': 7,
|
||
|
'expected_ex_score': 492,
|
||
|
'expected_miss_count': 0,
|
||
|
},
|
||
|
]
|
||
|
|
||
|
for dummyscore in dummyscores:
|
||
|
self.verify_iidx24music_reg(profile['extid'], lid, dummyscore)
|
||
|
self.verify_iidx24pc_visit(profile['extid'], lid)
|
||
|
self.verify_iidx24pc_save(profile['extid'], card, lid)
|
||
|
scores = self.verify_iidx24music_getrank(profile['extid'])
|
||
|
for score in dummyscores:
|
||
|
data = scores.get(score['id'], {}).get(score['chart'], None)
|
||
|
if data is None:
|
||
|
raise Exception('Expected to get score back for song {} chart {}!'.format(score['id'], score['chart']))
|
||
|
|
||
|
if 'expected_ex_score' in score:
|
||
|
expected_score = score['expected_ex_score']
|
||
|
else:
|
||
|
expected_score = (score['pgnum'] * 2) + score['gnum']
|
||
|
if 'expected_clear_status' in score:
|
||
|
expected_clear_status = score['expected_clear_status']
|
||
|
else:
|
||
|
expected_clear_status = score['clear_status']
|
||
|
if 'expected_miss_count' in score:
|
||
|
expected_miss_count = score['expected_miss_count']
|
||
|
else:
|
||
|
expected_miss_count = score['mnum']
|
||
|
|
||
|
if data['ex_score'] != expected_score:
|
||
|
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
|
||
|
expected_score, score['id'], score['chart'], data['ex_score'],
|
||
|
))
|
||
|
if data['clear_status'] != expected_clear_status:
|
||
|
raise Exception('Expected a clear status of \'{}\' for song \'{}\' chart \'{}\' but got clear status \'{}\''.format(
|
||
|
expected_clear_status, score['id'], score['chart'], data['clear_status'],
|
||
|
))
|
||
|
if data['miss_count'] != expected_miss_count:
|
||
|
raise Exception('Expected a miss count of \'{}\' for song \'{}\' chart \'{}\' but got miss count \'{}\''.format(
|
||
|
expected_miss_count, score['id'], score['chart'], data['miss_count'],
|
||
|
))
|
||
|
|
||
|
# Verify we can fetch our own ghost
|
||
|
ex_score, ghost = self.verify_iidx24music_appoint(profile['extid'], score['id'], score['chart'])
|
||
|
if ex_score != expected_score:
|
||
|
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
|
||
|
expected_score, score['id'], score['chart'], data['ex_score'],
|
||
|
))
|
||
|
|
||
|
if len(ghost) != 64:
|
||
|
raise Exception('Wrong ghost length {} for ghost!'.format(len(ghost)))
|
||
|
for g in ghost:
|
||
|
if g != 0x01:
|
||
|
raise Exception('Got back wrong ghost data for song \'{}\' chart \'{}\''.format(score['id'], score['chart']))
|
||
|
|
||
|
# Sleep so we don't end up putting in score history on the same second
|
||
|
time.sleep(1)
|
||
|
|
||
|
# Verify that we can save/load expert points
|
||
|
self.verify_iidx24pc_save(profile['extid'], card, lid, {'course_id': 1, 'n_point': 0, 'h_point': 500, 'a_point': 0})
|
||
|
profile = self.verify_iidx24pc_get(ref_id, card, lid)
|
||
|
if sorted(profile['expert_point'].keys()) != [1]:
|
||
|
raise Exception('Got back wrong number of expert course points!')
|
||
|
if profile['expert_point'][1] != {'n_point': 0, 'h_point': 500, 'a_point': 0}:
|
||
|
raise Exception('Got back wrong expert points after saving!')
|
||
|
self.verify_iidx24pc_save(profile['extid'], card, lid, {'course_id': 1, 'n_point': 0, 'h_point': 1000, 'a_point': 0})
|
||
|
profile = self.verify_iidx24pc_get(ref_id, card, lid)
|
||
|
if sorted(profile['expert_point'].keys()) != [1]:
|
||
|
raise Exception('Got back wrong number of expert course points!')
|
||
|
if profile['expert_point'][1] != {'n_point': 0, 'h_point': 1000, 'a_point': 0}:
|
||
|
raise Exception('Got back wrong expert points after saving!')
|
||
|
self.verify_iidx24pc_save(profile['extid'], card, lid, {'course_id': 2, 'n_point': 0, 'h_point': 0, 'a_point': 500})
|
||
|
profile = self.verify_iidx24pc_get(ref_id, card, lid)
|
||
|
if sorted(profile['expert_point'].keys()) != [1, 2]:
|
||
|
raise Exception('Got back wrong number of expert course points!')
|
||
|
if profile['expert_point'][1] != {'n_point': 0, 'h_point': 1000, 'a_point': 0}:
|
||
|
raise Exception('Got back wrong expert points after saving!')
|
||
|
if profile['expert_point'][2] != {'n_point': 0, 'h_point': 0, 'a_point': 500}:
|
||
|
raise Exception('Got back wrong expert points after saving!')
|
||
|
|
||
|
# Verify that a player without a card can play
|
||
|
self.verify_iidx24pc_playstart()
|
||
|
self.verify_iidx24music_play({
|
||
|
'id': 1000,
|
||
|
'chart': 2,
|
||
|
'clear_status': 4,
|
||
|
'pgnum': 123,
|
||
|
'gnum': 123,
|
||
|
})
|
||
|
self.verify_iidx24pc_playend(lid, 'newname1')
|
||
|
|
||
|
# Verify shop name change setting
|
||
|
self.verify_iidx24shop_savename(lid, 'newname1')
|
||
|
newname = self.verify_iidx24shop_getname(lid)
|
||
|
if newname != 'newname1':
|
||
|
raise Exception('Invalid shop name returned after change!')
|
||
|
self.verify_iidx24shop_savename(lid, 'newname2')
|
||
|
newname = self.verify_iidx24shop_getname(lid)
|
||
|
if newname != 'newname2':
|
||
|
raise Exception('Invalid shop name returned after change!')
|
||
|
|
||
|
# Verify beginner score saving
|
||
|
self.verify_iidx24music_breg(profile['extid'], {
|
||
|
'id': 1000,
|
||
|
'clear_status': 4,
|
||
|
'pgnum': 123,
|
||
|
'gnum': 123,
|
||
|
})
|
||
|
scores = self.verify_iidx24music_getrank(profile['extid'])
|
||
|
if 1000 not in scores:
|
||
|
raise Exception('Didn\'t get expected scores back for song {} beginner chart!'.format(1000))
|
||
|
if 6 not in scores[1000]:
|
||
|
raise Exception('Didn\'t get beginner score back for song {}!'.format(1000))
|
||
|
if scores[1000][6] != {'clear_status': 4, 'ex_score': -1, 'miss_count': -1}:
|
||
|
raise Exception('Didn\'t get correct status back from beginner save!')
|
||
|
|
||
|
# Verify DAN score saving and loading
|
||
|
self.verify_iidx24grade_raised(profile['extid'], newname, 'sp')
|
||
|
self.verify_iidx24grade_raised(profile['extid'], newname, 'dp')
|
||
|
profile = self.verify_iidx24pc_get(ref_id, card, lid)
|
||
|
if profile['sp_dan'] != 5:
|
||
|
raise Exception('Got wrong DAN score back for SP!')
|
||
|
if profile['dp_dan'] != 5:
|
||
|
raise Exception('Got wrong DAN score back for DP!')
|
||
|
|
||
|
# Verify secret course and internet ranking course saving
|
||
|
self.verify_iidx24ranking_entry(profile['extid'], newname, 'ir')
|
||
|
self.verify_iidx24ranking_entry(profile['extid'], newname, 'secret')
|
||
|
self.verify_iidx24ranking_classicentry(profile['extid'])
|
||
|
profile = self.verify_iidx24pc_get(ref_id, card, lid)
|
||
|
for ptype in ['ir_data', 'secret_course_data', 'classic_course_data']:
|
||
|
if profile[ptype] != {2: {1: {'clear_status': 4, 'pgnum': 1771, 'gnum': 967}}}:
|
||
|
raise Exception('Invalid data {} returned on profile load for {}!'.format(profile[ptype], ptype))
|
||
|
else:
|
||
|
print("Skipping score checks for existing card")
|
||
|
|
||
|
# Verify paseli handling
|
||
|
if paseli_enabled:
|
||
|
print("PASELI enabled for this PCBID, executing PASELI checks")
|
||
|
else:
|
||
|
print("PASELI disabled for this PCBID, skipping PASELI checks")
|
||
|
return
|
||
|
|
||
|
sessid, balance = self.verify_eacoin_checkin(card)
|
||
|
if balance == 0:
|
||
|
print("Skipping PASELI consume check because card has 0 balance")
|
||
|
else:
|
||
|
self.verify_eacoin_consume(sessid, balance, random.randint(0, balance))
|
||
|
self.verify_eacoin_checkout(sessid)
|