diva: change how requests are decoded

This commit is contained in:
Hay1tsme 2023-11-26 20:43:10 -05:00
parent d2d02f9483
commit 1a616cba41
3 changed files with 174 additions and 165 deletions

View File

@ -95,25 +95,21 @@ class BaseRequest:
f"time_stamp not in request data {self.raw_dict}" f"time_stamp not in request data {self.raw_dict}"
) )
self.cmd: str self.cmd: str = self.raw_dict.get('cmd')
self.req_id: str self.req_id: str = self.raw_dict.get('req_id')
self.game_id: str self.game_id: str = self.raw_dict.get('game_id')
self.r_rev: str self.r_rev: str = self.raw_dict.get('r_rev')
self.kc_serial: str self.kc_serial: str = self.raw_dict.get('kc_serial')
self.b_serial: str self.b_serial: str = self.raw_dict.get('b_serial')
self.country_code: str self.country_code: str = self.raw_dict.get('country_code')
self.place_id = int(self.raw_dict['place_id'], 16)
for k, v in self.raw_dict.items(): self.start_up_mode = int(self.raw_dict.get('start_up_mode'))
setattr(self, k, v) self.cmm_dly_mod = int(self.raw_dict.get('cmm_dly_mod'))
self.cmm_dly_sec = int(self.raw_dict.get('cmm_dly_sec'))
self.place_id = int(self.place_id, 16) self.cmm_err_mod = int(self.raw_dict.get('cmm_err_mod'))
self.start_up_mode = int(self.start_up_mode) self.region_code = int(self.raw_dict.get('region_code'))
self.cmm_dly_mod = int(self.cmm_dly_mod)
self.cmm_dly_sec = int(self.cmm_dly_sec)
self.cmm_err_mod = int(self.cmm_err_mod)
self.region_code = int(self.region_code)
# datetime.now().astimezone().replace(microsecond=0).isoformat() # datetime.now().astimezone().replace(microsecond=0).isoformat()
self.time_stamp = datetime.strptime(self.time_stamp, "%Y-%m-%dT%H:%M:%S%z") self.time_stamp = datetime.strptime(self.raw_dict.get('time_stamp'), "%Y-%m-%dT%H:%M:%S%z")
class BaseResponse: class BaseResponse:
def __init__(self, cmd_id: str, req_id: int) -> None: def __init__(self, cmd_id: str, req_id: int) -> None:
@ -144,9 +140,18 @@ class GameInitRequest(BaseRequest):
class AttendRequest(BaseRequest): class AttendRequest(BaseRequest):
def __init__(self, raw: Union[str, bytes]) -> None: def __init__(self, raw: Union[str, bytes]) -> None:
super().__init__(raw) super().__init__(raw)
self.power_on = int(self.power_on) if 'power_on' not in self.raw_dict:
self.is_bb = bool(int(self.power_on)) raise DivaRequestParseException(
f"power_on not in request data {self.raw_dict}"
)
if 'is_bb' not in self.raw_dict:
raise DivaRequestParseException(
f"is_bb not in request data {self.raw_dict}"
)
self.power_on = int(self.raw_dict.get('power_on'))
self.is_bb = bool(int(self.raw_dict.get('is_bb')))
class AttendResponse(BaseResponse): class AttendResponse(BaseResponse):
def __init__(self, req_id: int) -> None: def __init__(self, req_id: int) -> None:
@ -162,16 +167,37 @@ class AttendResponse(BaseResponse):
class SpendCreditRequest(BaseRequest): class SpendCreditRequest(BaseRequest):
def __init__(self, raw: Union[str, bytes]) -> None: def __init__(self, raw: Union[str, bytes]) -> None:
super().__init__(raw) super().__init__(raw)
try: if 'pd_id' not in self.raw_dict:
self.pd_id = int(self.pd_id) raise DivaRequestParseException(
self.my_qst_id = [int(x) for x in self.my_qst_id.split(",")] f"pd_id not in request data {self.raw_dict}"
self.my_qst_sts = [int(x) for x in self.my_qst_sts.split(",")] )
self.crdt_typ = int(self.crdt_typ) if 'my_qst_id' not in self.raw_dict:
self.cmpgn_id = [int(x) for x in self.cmpgn_id.split(",")] raise DivaRequestParseException(
self.cmpgn_pb = [int(x) for x in self.cmpgn_pb.split(",")] f"my_qst_id not in request data {self.raw_dict}"
)
except AttributeError as e: if 'my_qst_sts' not in self.raw_dict:
raise DivaRequestParseException(f"StartRequest: {e}") raise DivaRequestParseException(
f"my_qst_sts not in request data {self.raw_dict}"
)
if 'crdt_typ' not in self.raw_dict:
raise DivaRequestParseException(
f"crdt_typ not in request data {self.raw_dict}"
)
if 'cmpgn_id' not in self.raw_dict:
raise DivaRequestParseException(
f"cmpgn_id not in request data {self.raw_dict}"
)
if 'cmpgn_pb' not in self.raw_dict:
raise DivaRequestParseException(
f"cmpgn_pb not in request data {self.raw_dict}"
)
self.pd_id = int(self.raw_dict.get('pd_id'))
self.my_qst_id = decode_list_int(self.raw_dict.get('my_qst_id'))
self.my_qst_sts = decode_list_int(self.raw_dict.get('my_qst_sts'))
self.crdt_typ = int(self.raw_dict.get('crdt_typ'))
self.cmpgn_id = decode_list_int(self.raw_dict.get('cmpgn_id'))
self.cmpgn_pb = decode_list_int(self.raw_dict.get('cmpgn_pb'))
class SpendCreditResponse(BaseResponse): class SpendCreditResponse(BaseResponse):
def __init__(self, req_id: int) -> None: def __init__(self, req_id: int) -> None:

View File

@ -13,10 +13,10 @@ class GetPvPdRequest(BaseRequest):
def __init__(self, raw: Union[str, bytes]) -> None: def __init__(self, raw: Union[str, bytes]) -> None:
super().__init__(raw) super().__init__(raw)
try: try:
self.pd_id = int(self.pd_id) self.pd_id = int(self.raw_dict.get('pd_id'))
self.accept_idx = int(self.accept_idx) self.accept_idx = int(self.raw_dict.get('accept_idx'))
self.start_idx = int(self.start_idx) self.start_idx = int(self.raw_dict.get('start_idx'))
self.difficulty = int(self.difficulty) self.difficulty = int(self.raw_dict.get('difficulty'))
self.pd_pv_id_lst: List[int] = [int(x) for x in self.pd_pv_id_lst.split(',')] self.pd_pv_id_lst: List[int] = [int(x) for x in self.pd_pv_id_lst.split(',')]
except AttributeError as e: except AttributeError as e:
@ -32,99 +32,95 @@ class GetPvPdResponse(BaseResponse):
class StageResultRequest(BaseRequest): class StageResultRequest(BaseRequest):
def __init__(self, raw: Union[str, bytes]) -> None: def __init__(self, raw: Union[str, bytes]) -> None:
super().__init__(raw) super().__init__(raw)
try: self.pd_id = int(self.raw_dict.get('pd_id'))
self.pd_id = int(self.pd_id) self.accept_idx = int(self.raw_dict.get('accept_idx'))
self.accept_idx = int(self.accept_idx) self.start_idx = int(self.raw_dict.get('start_idx'))
self.start_idx = int(self.start_idx) self.hp_vol = int(self.raw_dict.get('hp_vol'))
self.hp_vol = int(self.hp_vol) self.btn_se_vol = int(self.raw_dict.get('btn_se_vol'))
self.btn_se_vol = int(self.btn_se_vol) self.btn_se_vol2 = int(self.raw_dict.get('btn_se_vol2'))
self.btn_se_vol2 = int(self.btn_se_vol2) self.sldr_se_vol2 = int(self.raw_dict.get('sldr_se_vol2'))
self.sldr_se_vol2 = int(self.sldr_se_vol2) self.use_pv_mdl_eqp = int(self.raw_dict.get('use_pv_mdl_eqp'))
self.use_pv_mdl_eqp = int(self.use_pv_mdl_eqp) self.vcld_pts = int(self.raw_dict.get('vcld_pts'))
self.vcld_pts = int(self.vcld_pts) self.nxt_pv_id = int(self.raw_dict.get('nxt_pv_id'))
self.nxt_pv_id = int(self.nxt_pv_id) self.nxt_dffclty = int(self.raw_dict.get('nxt_dffclty'))
self.nxt_dffclty = int(self.nxt_dffclty) self.nxt_edtn = int(self.raw_dict.get('nxt_edtn'))
self.nxt_edtn = int(self.nxt_edtn) self.sort_kind = int(self.raw_dict.get('sort_kind'))
self.sort_kind = int(self.sort_kind) self.nblss_ltt_stts = int(self.raw_dict.get('nblss_ltt_stts'))
self.nblss_ltt_stts = int(self.nblss_ltt_stts) self.nblss_ltt_tckt = int(self.raw_dict.get('nblss_ltt_tckt'))
self.nblss_ltt_tckt = int(self.nblss_ltt_tckt) self.free_play = int(self.raw_dict.get('free_play'))
self.free_play = int(self.free_play) self.game_type = int(self.raw_dict.get('game_type'))
self.game_type = int(self.game_type) self.ply_pv_id = int(self.raw_dict.get('ply_pv_id'))
self.ply_pv_id = int(self.ply_pv_id) self.ttl_vp_add = int(self.raw_dict.get('ttl_vp_add'))
self.ttl_vp_add = int(self.ttl_vp_add) self.ttl_vp_sub = int(self.raw_dict.get('ttl_vp_sub'))
self.ttl_vp_sub = int(self.ttl_vp_sub) self.continue_cnt = int(self.raw_dict.get('continue_cnt'))
self.continue_cnt = int(self.continue_cnt) self.cr_cid = int(self.raw_dict.get('cr_cid'))
self.cr_cid = int(self.cr_cid) self.cr_sc = int(self.raw_dict.get('cr_sc'))
self.cr_sc = int(self.cr_sc) self.cr_tv = int(self.raw_dict.get('cr_tv'))
self.cr_tv = int(self.cr_tv) self.cr_if = int(self.raw_dict.get('cr_if'))
self.cr_if = int(self.cr_if)
self.my_qst_id: List[int] = decode_list_int(self.my_qst_id) self.my_qst_id: List[int] = decode_list_int(self.raw_dict.get('my_qst_id'))
self.my_qst_sts: List[int] = decode_list_int(self.my_qst_sts) self.my_qst_sts: List[int] = decode_list_int(self.raw_dict.get('my_qst_sts'))
self.stg_difficulty: List[int] = decode_list_int(self.stg_difficulty) self.stg_difficulty: List[int] = decode_list_int(self.raw_dict.get('stg_difficulty'))
self.stg_edtn: List[int] = decode_list_int(self.stg_edtn) self.stg_edtn: List[int] = decode_list_int(self.raw_dict.get('stg_edtn'))
self.stg_ply_pv_id: List[int] = decode_list_int(self.stg_ply_pv_id) self.stg_ply_pv_id: List[int] = decode_list_int(self.raw_dict.get('stg_ply_pv_id'))
self.stg_sel_pv_id: List[int] = decode_list_int(self.stg_sel_pv_id) self.stg_sel_pv_id: List[int] = decode_list_int(self.raw_dict.get('stg_sel_pv_id'))
self.stg_scrpt_ver: List[int] = decode_list_int(self.stg_scrpt_ver) self.stg_scrpt_ver: List[int] = decode_list_int(self.raw_dict.get('stg_scrpt_ver'))
self.stg_score: List[int] = decode_list_int(self.stg_score) self.stg_score: List[int] = decode_list_int(self.raw_dict.get('stg_score'))
self.stg_chllng_kind: List[int] = decode_list_int(self.stg_chllng_kind) self.stg_chllng_kind: List[int] = decode_list_int(self.raw_dict.get('stg_chllng_kind'))
self.stg_chllng_result: List[int] = decode_list_int(self.stg_chllng_result) self.stg_chllng_result: List[int] = decode_list_int(self.raw_dict.get('stg_chllng_result'))
self.stg_clr_kind: List[int] = decode_list_int(self.stg_clr_kind) self.stg_clr_kind: List[int] = decode_list_int(self.raw_dict.get('stg_clr_kind'))
self.stg_vcld_pts: List[int] = decode_list_int(self.stg_vcld_pts) self.stg_vcld_pts: List[int] = decode_list_int(self.raw_dict.get('stg_vcld_pts'))
self.stg_cool_cnt: List[int] = decode_list_int(self.stg_cool_cnt) self.stg_cool_cnt: List[int] = decode_list_int(self.raw_dict.get('stg_cool_cnt'))
self.stg_cool_pct: List[int] = decode_list_int(self.stg_cool_pct) self.stg_cool_pct: List[int] = decode_list_int(self.raw_dict.get('stg_cool_pct'))
self.stg_fine_cnt: List[int] = decode_list_int(self.stg_fine_cnt) self.stg_fine_cnt: List[int] = decode_list_int(self.raw_dict.get('stg_fine_cnt'))
self.stg_fine_pct: List[int] = decode_list_int(self.stg_fine_pct) self.stg_fine_pct: List[int] = decode_list_int(self.raw_dict.get('stg_fine_pct'))
self.stg_safe_cnt: List[int] = decode_list_int(self.stg_safe_cnt) self.stg_safe_cnt: List[int] = decode_list_int(self.raw_dict.get('stg_safe_cnt'))
self.stg_safe_pct: List[int] = decode_list_int(self.stg_safe_pct) self.stg_safe_pct: List[int] = decode_list_int(self.raw_dict.get('stg_safe_pct'))
self.stg_sad_cnt: List[int] = decode_list_int(self.stg_sad_cnt) self.stg_sad_cnt: List[int] = decode_list_int(self.raw_dict.get('stg_sad_cnt'))
self.stg_sad_pct: List[int] = decode_list_int(self.stg_sad_pct) self.stg_sad_pct: List[int] = decode_list_int(self.raw_dict.get('stg_sad_pct'))
self.stg_wt_wg_cnt: List[int] = decode_list_int(self.stg_wt_wg_cnt) self.stg_wt_wg_cnt: List[int] = decode_list_int(self.raw_dict.get('stg_wt_wg_cnt'))
self.stg_wt_wg_pct: List[int] = decode_list_int(self.stg_wt_wg_pct) self.stg_wt_wg_pct: List[int] = decode_list_int(self.raw_dict.get('stg_wt_wg_pct'))
self.stg_max_cmb: List[int] = decode_list_int(self.stg_max_cmb) self.stg_max_cmb: List[int] = decode_list_int(self.raw_dict.get('stg_max_cmb'))
self.stg_chance_tm: List[int] = decode_list_int(self.stg_chance_tm) self.stg_chance_tm: List[int] = decode_list_int(self.raw_dict.get('stg_chance_tm'))
self.stg_sm_hl: List[int] = decode_list_int(self.stg_sm_hl) self.stg_sm_hl: List[int] = decode_list_int(self.raw_dict.get('stg_sm_hl'))
self.stg_atn_pnt: List[int] = decode_list_int(self.stg_atn_pnt) self.stg_atn_pnt: List[int] = decode_list_int(self.raw_dict.get('stg_atn_pnt'))
self.stg_skin_id: List[int] = decode_list_int(self.stg_skin_id) self.stg_skin_id: List[int] = decode_list_int(self.raw_dict.get('stg_skin_id'))
self.stg_btn_se: List[int] = decode_list_int(self.stg_btn_se) self.stg_btn_se: List[int] = decode_list_int(self.raw_dict.get('stg_btn_se'))
self.stg_btn_se_vol: List[int] = decode_list_int(self.stg_btn_se_vol) self.stg_btn_se_vol: List[int] = decode_list_int(self.raw_dict.get('stg_btn_se_vol'))
self.stg_sld_se: List[int] = decode_list_int(self.stg_sld_se) self.stg_sld_se: List[int] = decode_list_int(self.raw_dict.get('stg_sld_se'))
self.stg_chn_sld_se: List[int] = decode_list_int(self.stg_chn_sld_se) self.stg_chn_sld_se: List[int] = decode_list_int(self.raw_dict.get('stg_chn_sld_se'))
self.stg_sldr_tch_se: List[int] = decode_list_int(self.stg_sldr_tch_se) self.stg_sldr_tch_se: List[int] = decode_list_int(self.raw_dict.get('stg_sldr_tch_se'))
self.stg_mdl_id: List[int] = decode_list_int(self.stg_mdl_id) self.stg_mdl_id: List[int] = decode_list_int(self.raw_dict.get('stg_mdl_id'))
self.stg_sel_mdl_id: List[int] = decode_list_int(self.stg_sel_mdl_id) self.stg_sel_mdl_id: List[int] = decode_list_int(self.raw_dict.get('stg_sel_mdl_id'))
self.stg_rvl_pd_id: List[int] = decode_list_int(self.stg_rvl_pd_id) self.stg_rvl_pd_id: List[int] = decode_list_int(self.raw_dict.get('stg_rvl_pd_id'))
self.stg_rvl_wl: List[int] = decode_list_int(self.stg_rvl_wl) self.stg_rvl_wl: List[int] = decode_list_int(self.raw_dict.get('stg_rvl_wl'))
self.stg_cpt_rslt: List[int] = decode_list_int(self.stg_cpt_rslt) self.stg_cpt_rslt: List[int] = decode_list_int(self.raw_dict.get('stg_cpt_rslt'))
self.stg_sld_scr: List[int] = decode_list_int(self.stg_sld_scr) self.stg_sld_scr: List[int] = decode_list_int(self.raw_dict.get('stg_sld_scr'))
self.stg_is_sr_gm: List[int] = decode_list_int(self.stg_is_sr_gm) self.stg_is_sr_gm: List[int] = decode_list_int(self.raw_dict.get('stg_is_sr_gm'))
self.stg_pv_brnch_rslt: List[int] = decode_list_int(self.stg_pv_brnch_rslt) self.stg_pv_brnch_rslt: List[int] = decode_list_int(self.raw_dict.get('stg_pv_brnch_rslt'))
self.stg_vcl_chg: List[int] = decode_list_int(self.stg_vcl_chg) self.stg_vcl_chg: List[int] = decode_list_int(self.raw_dict.get('stg_vcl_chg'))
self.stg_c_itm_id: List[int] = decode_list_int(self.stg_c_itm_id) self.stg_c_itm_id: List[int] = decode_list_int(self.raw_dict.get('stg_c_itm_id'))
self.stg_ms_itm_flg: List[int] = decode_list_int(self.stg_ms_itm_flg) self.stg_ms_itm_flg: List[int] = decode_list_int(self.raw_dict.get('stg_ms_itm_flg'))
self.stg_rgo: List[int] = decode_list_int(self.stg_rgo) self.stg_rgo: List[int] = decode_list_int(self.raw_dict.get('stg_rgo'))
self.stg_ss_num: List[int] = decode_list_int(self.stg_ss_num) self.stg_ss_num: List[int] = decode_list_int(self.raw_dict.get('stg_ss_num'))
self.stg_is_cs_scs: List[int] = decode_list_int(self.stg_is_cs_scs) self.stg_is_cs_scs: List[int] = decode_list_int(self.raw_dict.get('stg_is_cs_scs'))
self.stg_is_nppg_use: List[int] = decode_list_int(self.stg_is_nppg_use) self.stg_is_nppg_use: List[int] = decode_list_int(self.raw_dict.get('stg_is_nppg_use'))
self.stg_p_std_lo_id: List[int] = decode_list_int(self.stg_p_std_lo_id) self.stg_p_std_lo_id: List[int] = decode_list_int(self.raw_dict.get('stg_p_std_lo_id'))
self.stg_p_std_is_to: List[int] = decode_list_int(self.stg_p_std_is_to) self.stg_p_std_is_to: List[int] = decode_list_int(self.raw_dict.get('stg_p_std_is_to'))
self.stg_p_std_is_ccu: List[int] = decode_list_int(self.stg_p_std_is_ccu) self.stg_p_std_is_ccu: List[int] = decode_list_int(self.raw_dict.get('stg_p_std_is_ccu'))
self.stg_p_std_is_tiu: List[int] = decode_list_int(self.stg_p_std_is_tiu) self.stg_p_std_is_tiu: List[int] = decode_list_int(self.raw_dict.get('stg_p_std_is_tiu'))
self.stg_p_std_is_iu: List[int] = decode_list_int(self.stg_p_std_is_iu) self.stg_p_std_is_iu: List[int] = decode_list_int(self.raw_dict.get('stg_p_std_is_iu'))
self.stg_p_std_is_npu: List[int] = decode_list_int(self.stg_p_std_is_npu) self.stg_p_std_is_npu: List[int] = decode_list_int(self.raw_dict.get('stg_p_std_is_npu'))
self.stg_p_std_is_du: List[int] = decode_list_int(self.stg_p_std_is_du) self.stg_p_std_is_du: List[int] = decode_list_int(self.raw_dict.get('stg_p_std_is_du'))
self.gu_cmd: List[int] = decode_list_int(self.gu_cmd) self.gu_cmd: List[int] = decode_list_int(self.raw_dict.get('gu_cmd'))
self.mdl_eqp_cmn_ary: List[int] = decode_list_int(self.mdl_eqp_cmn_ary) self.mdl_eqp_cmn_ary: List[int] = decode_list_int(self.raw_dict.get('mdl_eqp_cmn_ary'))
self.c_itm_eqp_cmn_ary: List[int] = decode_list_int(self.c_itm_eqp_cmn_ary) self.c_itm_eqp_cmn_ary: List[int] = decode_list_int(self.raw_dict.get('c_itm_eqp_cmn_ary'))
self.ms_itm_flg_cmn_ary: List[int] = decode_list_int(self.ms_itm_flg_cmn_ary) self.ms_itm_flg_cmn_ary: List[int] = decode_list_int(self.raw_dict.get('ms_itm_flg_cmn_ary'))
self.mdl_eqp_pv_ary: List[int] = decode_list_int(self.mdl_eqp_pv_ary) self.mdl_eqp_pv_ary: List[int] = decode_list_int(self.raw_dict.get('mdl_eqp_pv_ary'))
self.c_itm_eqp_pv_ary: List[int] = decode_list_int(self.c_itm_eqp_pv_ary) self.c_itm_eqp_pv_ary: List[int] = decode_list_int(self.raw_dict.get('c_itm_eqp_pv_ary'))
self.ms_itm_flg_pv_ary: List[int] = decode_list_int(self.ms_itm_flg_pv_ary) self.ms_itm_flg_pv_ary: List[int] = decode_list_int(self.raw_dict.get('ms_itm_flg_pv_ary'))
self.stg_mdl_s_sts: List[int] = decode_list_int(self.stg_mdl_s_sts) self.stg_mdl_s_sts: List[int] = decode_list_int(self.raw_dict.get('stg_mdl_s_sts'))
self.cr_sp: List[int] = decode_list_int(parse.unquote(self.cr_sp)) self.cr_sp: List[int] = decode_list_int(parse.unquote(self.raw_dict.get('cr_sp')))
except AttributeError as e:
raise DivaRequestParseException(f"StageResultRequest: {e}")
class StageResultResponse(BaseResponse): class StageResultResponse(BaseResponse):
def __init__(self, req_id: int) -> None: def __init__(self, req_id: int) -> None:

View File

@ -10,21 +10,16 @@ from ..const import DivaConstants
class PreStartRequest(BaseRequest): class PreStartRequest(BaseRequest):
def __init__(self, raw: str) -> None: def __init__(self, raw: str) -> None:
self.pmm: str
self.idm: str
self.mmgameid: str
self.mmuid: str
self.a_code: str
self.aime_id: str
self.aime_a_code: str
super().__init__(raw) super().__init__(raw)
try: self.pmm: str = self.raw_dict.get('pmm')
self.key_obj_type = int(self.key_obj_type) self.idm: str = self.raw_dict.get('idm')
self.exec_vu = int(self.exec_vu) self.mmgameid: str = self.raw_dict.get('mmgameid')
self.mmuid: str = self.raw_dict.get('mmuid')
except AttributeError as e: self.a_code: str = self.raw_dict.get('a_code')
raise DivaRequestParseException(f"PreStartRequest: {e}") self.aime_id: str = self.raw_dict.get('aime_id')
self.aime_a_code: str = self.raw_dict.get('aime_a_code')
self.key_obj_type = int(self.raw_dict.get('key_obj_type'))
self.exec_vu = int(self.raw_dict.get('exec_vu'))
class PreStartResponse(BaseResponse): class PreStartResponse(BaseResponse):
def __init__(self, req_id: int, pd_id: int) -> None: def __init__(self, req_id: int, pd_id: int) -> None:
@ -57,12 +52,8 @@ class PreStartResponse(BaseResponse):
class StartRequest(BaseRequest): class StartRequest(BaseRequest):
def __init__(self, raw: str) -> None: def __init__(self, raw: str) -> None:
super().__init__(raw) super().__init__(raw)
try: self.pd_id = int(self.raw_dict.get('pd_id'))
self.pd_id = int(self.pd_id) self.accept_idx = int(self.raw_dict.get('accept_idx'))
self.accept_idx = int(self.accept_idx)
except AttributeError as e:
raise DivaRequestParseException(f"StartRequest: {e}")
class StartResponse(BaseResponse): class StartResponse(BaseResponse):
def __init__(self, req_id: int, pv_id: int, pv_name: str) -> None: def __init__(self, req_id: int, pv_id: int, pv_name: str) -> None:
@ -97,7 +88,7 @@ class StartResponse(BaseResponse):
self.dsp_intrm_rnk: int = 0 self.dsp_intrm_rnk: int = 0
self.dsp_clr_sts: int = 0 self.dsp_clr_sts: int = 0
self.rgo_sts: int = 0 self.rgo_sts: int = 0
self.cv_cid: str = "-1,-1,-1,-1" self.cv_cid: str = "-1,-1,-1,-1"
self.cv_sc: str = "-1,-1,-1,-1" self.cv_sc: str = "-1,-1,-1,-1"
#self.cv_bv: str = "-1,-1,-1,-1" #self.cv_bv: str = "-1,-1,-1,-1"
self.cv_bv: str = "-1,-1,-1,-1" self.cv_bv: str = "-1,-1,-1,-1"
@ -117,21 +108,17 @@ class StartResponse(BaseResponse):
class RegisterRequest(BaseRequest): class RegisterRequest(BaseRequest):
def __init__(self, raw: str) -> None: def __init__(self, raw: str) -> None:
self.pmm: str
self.idm: str
self.mmgameid: str
self.mmuid: str
self.a_code: str
self.aime_a_code: str
self.player_name: str
self.passwd: str
super().__init__(raw) super().__init__(raw)
try: self.pmm: str = self.raw_dict.get('pmm')
self.aime_id = int(self.aime_id) self.idm: str = self.raw_dict.get('idm')
self.key_obj_type = int(self.key_obj_type) self.mmgameid: str = self.raw_dict.get('mmgameid')
self.mmuid: str = self.raw_dict.get('mmuid')
except AttributeError as e: self.a_code: str = self.raw_dict.get('a_code')
raise DivaRequestParseException(f"RegisterRequest: {e}") self.aime_a_code: str = self.raw_dict.get('aime_a_code')
self.player_name: str = self.raw_dict.get('player_name')
self.passwd: str = self.raw_dict.get('passwd')
self.aime_id = int(self.raw_dict.get('aime_id'))
self.key_obj_type = int(self.raw_dict.get('key_obj_type'))
class RegisterResponse(BaseResponse): class RegisterResponse(BaseResponse):
def __init__(self, req_id: int, pv_id: int) -> None: def __init__(self, req_id: int, pv_id: int) -> None:
@ -141,12 +128,12 @@ class RegisterResponse(BaseResponse):
class EndRequest(BaseRequest): class EndRequest(BaseRequest):
def __init__(self, raw: Union[str, bytes]) -> None: def __init__(self, raw: Union[str, bytes]) -> None:
self.my_qst_id: str self.my_qst_id: str = self.raw_dict.get('my_qst_id')
self.my_qst_sts: str self.my_qst_sts: str = self.raw_dict.get('my_qst_sts')
super().__init__(raw) super().__init__(raw)
try: try:
self.pd_id = int(self.pd_id) self.pd_id = int(self.raw_dict.get('pd_id'))
except AttributeError as e: except AttributeError as e:
raise DivaRequestParseException(f"EndRequest: {e}") raise DivaRequestParseException(f"EndRequest: {e}")