from typing import Union, List from titles.diva.handlers.base import ( BaseRequest, BaseResponse, DivaRequestParseException, decode_list_int ) from datetime import datetime from urllib import parse from ..const import DivaConstants class GetPvPdRequest(BaseRequest): def __init__(self, raw: Union[str, bytes]) -> None: super().__init__(raw) try: self.pd_id = int(self.raw_dict.get('pd_id')) self.accept_idx = int(self.raw_dict.get('accept_idx')) self.start_idx = int(self.raw_dict.get('start_idx')) 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(',')] except AttributeError as e: raise DivaRequestParseException(f"GetPvPdRequest: {e}") class GetPvPdResponse(BaseResponse): def __init__(self, req_id: int) -> None: super().__init__("get_pv_pd", req_id) self.pd_by_pv_id = "" self.pdddt_flg = 0 self.pdddt_tm = parse.quote(datetime.now().strftime(DivaConstants.LUT_TIME_FMT)) class StageResultRequest(BaseRequest): def __init__(self, raw: Union[str, bytes]) -> None: super().__init__(raw) self.pd_id = int(self.raw_dict.get('pd_id')) self.accept_idx = int(self.raw_dict.get('accept_idx')) self.start_idx = int(self.raw_dict.get('start_idx')) self.hp_vol = int(self.raw_dict.get('hp_vol')) self.btn_se_vol = int(self.raw_dict.get('btn_se_vol')) self.btn_se_vol2 = int(self.raw_dict.get('btn_se_vol2')) self.sldr_se_vol2 = int(self.raw_dict.get('sldr_se_vol2')) self.use_pv_mdl_eqp = int(self.raw_dict.get('use_pv_mdl_eqp')) self.vcld_pts = int(self.raw_dict.get('vcld_pts')) self.nxt_pv_id = int(self.raw_dict.get('nxt_pv_id')) self.nxt_dffclty = int(self.raw_dict.get('nxt_dffclty')) self.nxt_edtn = int(self.raw_dict.get('nxt_edtn')) self.sort_kind = int(self.raw_dict.get('sort_kind')) self.nblss_ltt_stts = int(self.raw_dict.get('nblss_ltt_stts')) self.nblss_ltt_tckt = int(self.raw_dict.get('nblss_ltt_tckt')) self.free_play = int(self.raw_dict.get('free_play')) self.game_type = int(self.raw_dict.get('game_type')) self.ply_pv_id = int(self.raw_dict.get('ply_pv_id')) self.ttl_vp_add = int(self.raw_dict.get('ttl_vp_add')) self.ttl_vp_sub = int(self.raw_dict.get('ttl_vp_sub')) self.continue_cnt = int(self.raw_dict.get('continue_cnt')) self.cr_cid = int(self.raw_dict.get('cr_cid')) self.cr_sc = int(self.raw_dict.get('cr_sc')) self.cr_tv = int(self.raw_dict.get('cr_tv')) self.cr_if = int(self.raw_dict.get('cr_if')) 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.raw_dict.get('my_qst_sts')) self.stg_difficulty: List[int] = decode_list_int(self.raw_dict.get('stg_difficulty')) 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.raw_dict.get('stg_ply_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.raw_dict.get('stg_scrpt_ver')) self.stg_score: List[int] = decode_list_int(self.raw_dict.get('stg_score')) 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.raw_dict.get('stg_chllng_result')) 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.raw_dict.get('stg_vcld_pts')) 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.raw_dict.get('stg_cool_pct')) 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.raw_dict.get('stg_fine_pct')) 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.raw_dict.get('stg_safe_pct')) 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.raw_dict.get('stg_sad_pct')) 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.raw_dict.get('stg_wt_wg_pct')) 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.raw_dict.get('stg_chance_tm')) 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.raw_dict.get('stg_atn_pnt')) 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.raw_dict.get('stg_btn_se')) 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.raw_dict.get('stg_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.raw_dict.get('stg_sldr_tch_se')) 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.raw_dict.get('stg_sel_mdl_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.raw_dict.get('stg_rvl_wl')) 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.raw_dict.get('stg_sld_scr')) 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.raw_dict.get('stg_pv_brnch_rslt')) 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.raw_dict.get('stg_c_itm_id')) 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.raw_dict.get('stg_rgo')) 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.raw_dict.get('stg_is_cs_scs')) 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.raw_dict.get('stg_p_std_lo_id')) 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.raw_dict.get('stg_p_std_is_ccu')) 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.raw_dict.get('stg_p_std_is_iu')) 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.raw_dict.get('stg_p_std_is_du')) 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.raw_dict.get('mdl_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.raw_dict.get('ms_itm_flg_cmn_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.raw_dict.get('c_itm_eqp_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.raw_dict.get('stg_mdl_s_sts')) self.cr_sp: List[int] = decode_list_int(parse.unquote(self.raw_dict.get('cr_sp'))) class StageResultResponse(BaseResponse): def __init__(self, req_id: int) -> None: super().__init__("stage_result", req_id) self.chllng_kind = -1 self.lv_num_old = 0 self.lv_pnt_old = 0 self.lv_num = 0 self.lv_str = 0 self.lv_pnt = 0 self.lv_efct_id = 0 self.lv_plt_id = 0 self.vcld_pts = 0 self.prsnt_vcld_pts = 0 self.cerwd_kind = -1 self.cerwd_value = -1 self.cerwd_str_0 = "***" self.cerwd_str_1 = "***" self.ttl_str_ary = ["xxx"] * 5 self.ttl_plt_id_ary = ["xxx"] * 5 self.ttl_desc_ary = ["xxx"] * 5 self.skin_id_ary = ["xxx"] * 5 self.skin_name_ary = ["xxx"] * 5 self.skin_illust_ary = ["xxx"] * 5 self.skin_desc_ary = ["xxx"] * 5 self.my_qst_id = [-1] * 25 self.my_qst_r_qid = [-1] * 25 self.my_qst_r_knd = [-1] * 25 self.my_qst_r_vl = [-1] * 25 self.my_qst_r_nflg = [-1] * 25 self.my_ccd_r_qid = [-1] * 5 self.my_ccd_r_hnd = [-1] * 5 self.my_ccd_r_vp = [-1] * 5