forked from Hay1tsme/artemis
153 lines
5.2 KiB
Python
153 lines
5.2 KiB
Python
from typing import Union
|
|
from titles.diva.handlers.base import (
|
|
BaseRequest,
|
|
BaseResponse,
|
|
DivaRequestParseException,
|
|
)
|
|
from datetime import datetime
|
|
from urllib import parse
|
|
from ..const import DivaConstants
|
|
|
|
class PreStartRequest(BaseRequest):
|
|
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)
|
|
try:
|
|
self.key_obj_type = int(self.key_obj_type)
|
|
self.exec_vu = int(self.exec_vu)
|
|
|
|
except AttributeError as e:
|
|
raise DivaRequestParseException(f"PreStartRequest: {e}")
|
|
|
|
class PreStartResponse(BaseResponse):
|
|
def __init__(self, req_id: int, pd_id: int) -> None:
|
|
super().__init__("pre_start", req_id)
|
|
self.ps_result = 1
|
|
self.pd_id = pd_id
|
|
self.accept_idx = 100
|
|
self.nblss_ltt_stts = -1
|
|
self.nblss_ltt_tckt = -1
|
|
self.nblss_ltt_is_opn = -1
|
|
self.player_name: str = ""
|
|
self.sort_kind: str = ""
|
|
self.lv_efct_id: str = ""
|
|
self.lv_plt_id: str = ""
|
|
self.lv_str: str = ""
|
|
self.lv_num: str = ""
|
|
self.lv_pnt: str = ""
|
|
self.vcld_pts: str = ""
|
|
self.skn_eqp: str = ""
|
|
self.btn_se_eqp: str = ""
|
|
self.sld_se_eqp: str = ""
|
|
self.chn_sld_se_eqp: str = ""
|
|
self.sldr_tch_se_eqp: str = ""
|
|
self.passwd_stat: str = ""
|
|
self.mdl_eqp_tm: str = ""
|
|
# Ideally this would be a real array that would get converted later
|
|
# But this is how it's stored in the db, so w/e for now
|
|
self.mdl_eqp_ary = "-999,-999,-999"
|
|
|
|
class StartRequest(BaseRequest):
|
|
def __init__(self, raw: str) -> None:
|
|
super().__init__(raw)
|
|
try:
|
|
self.pd_id = int(self.pd_id)
|
|
self.accept_idx = int(self.accept_idx)
|
|
|
|
except AttributeError as e:
|
|
raise DivaRequestParseException(f"StartRequest: {e}")
|
|
|
|
class StartResponse(BaseResponse):
|
|
def __init__(self, req_id: int, pv_id: int, pv_name: str) -> None:
|
|
super().__init__("start", req_id)
|
|
self.pd_id: int = pv_id
|
|
self.start_result: int = 1
|
|
self.accept_idx: int = 100
|
|
self.hp_vol: int = 0
|
|
self.btn_se_vol: int = 1
|
|
self.btn_se_vol2: int = 1
|
|
self.sldr_se_vol2: int = 1
|
|
self.sort_kind: int = 1
|
|
self.player_name: str = pv_name
|
|
self.lv_num: int = 1
|
|
self.lv_pnt: int = 0
|
|
self.lv_efct_id: int = 1
|
|
self.lv_plt_id: int = 1
|
|
self.mdl_have: str = "F" * 250
|
|
self.cstmz_itm_have: str = "F" * 250
|
|
self.use_pv_mdl_eqp: int = 0
|
|
self.use_mdl_pri: int = 0
|
|
self.use_pv_skn_eqp: int = 1
|
|
self.use_pv_btn_se_eqp: int = 1
|
|
self.use_pv_sld_se_eqp: int = 1
|
|
self.use_pv_chn_sld_se_eqp: int = 1
|
|
self.use_pv_sldr_tch_se_eqp: int = 1
|
|
self.vcld_pts: int = 0
|
|
self.nxt_pv_id: int = 1
|
|
self.nxt_dffclty: int = 1
|
|
self.nxt_edtn: int = 0
|
|
self.dsp_clr_brdr: int = 0
|
|
self.dsp_intrm_rnk: int = 0
|
|
self.dsp_clr_sts: int = 0
|
|
self.rgo_sts: int = 0
|
|
self.cv_cid: 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_bf: str = "-1,-1,-1,-1"
|
|
self.cnp_cid=-1
|
|
self.cnp_val=-1
|
|
self.cnp_rr=-1
|
|
self.my_qst_id: str = ",".join(["-1"] * 25)
|
|
self.my_qst_sts: str = ",".join("0" * 5) + "," + ",".join(["-1"] * 20)
|
|
self.my_qst_prgrs: str = ",".join("0" * 5) + "," + ",".join(["-1"] * 20)
|
|
self.my_qst_et: str = ",".join([parse.quote(datetime.now().strftime(DivaConstants.LUT_TIME_FMT))] * 5) + "," + ",".join(["xxx"] * 20)
|
|
self.clr_sts: str = ",".join("0" * 5) + "," + ",".join(["-1"] * 20)
|
|
self.mdl_eqp_tm: str = parse.quote(datetime.now().strftime(DivaConstants.LUT_TIME_FMT))
|
|
self.mdl_eqp_ary = ",".join(["-999"] * 3)
|
|
self.c_itm_eqp_ary = ",".join(["-999"] * 12)
|
|
self.ms_itm_flg_ary = ",".join(["1"] * 12)
|
|
|
|
class RegisterRequest(BaseRequest):
|
|
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)
|
|
try:
|
|
self.aime_id = int(self.aime_id)
|
|
self.key_obj_type = int(self.key_obj_type)
|
|
|
|
except AttributeError as e:
|
|
raise DivaRequestParseException(f"RegisterRequest: {e}")
|
|
|
|
class RegisterResponse(BaseResponse):
|
|
def __init__(self, req_id: int, pv_id: int) -> None:
|
|
super().__init__("register", req_id)
|
|
self.cd_adm_result: int = 1
|
|
self.pd_id: int = pv_id
|
|
|
|
class EndRequest(BaseRequest):
|
|
def __init__(self, raw: str | bytes) -> None:
|
|
self.my_qst_id: str
|
|
self.my_qst_sts: str
|
|
|
|
super().__init__(raw)
|
|
try:
|
|
self.pd_id = int(self.pd_id)
|
|
|
|
except AttributeError as e:
|
|
raise DivaRequestParseException(f"EndRequest: {e}")
|
|
|