artemis/titles/diva/handlers/user.py

112 lines
3.4 KiB
Python
Raw Normal View History

2023-03-09 16:50:11 +00:00
from titles.diva.handlers.base import (
BaseRequest,
BaseResponse,
DivaRequestParseException,
)
2023-04-02 03:05:10 +00:00
from datetime import datetime
from urllib import parse
from ..const import DivaConstants
2023-02-26 04:40:50 +00:00
class PreStartRequest(BaseRequest):
pmm: str
idm: str
mmgameid: str
mmuid: str
a_code: str
aime_id: str
aime_a_code: str
2023-03-09 16:50:11 +00:00
2023-02-26 04:40:50 +00:00
def __init__(self, raw: str) -> None:
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}")
2023-03-09 16:50:11 +00:00
2023-02-26 04:40:50 +00:00
class PreStartResponse(BaseResponse):
player_name: str
sort_kind: str
lv_efct_id: str
lv_plt_id: str
lv_str: str
lv_num: str
lv_pnt: str
vcld_pts: str
skn_eqp: str
btn_se_eqp: str
sld_se_eqp: str
chn_sld_se_eqp: str
sldr_tch_se_eqp: str
passwd_stat: str
mdl_eqp_tm: str
2023-03-09 16:50:11 +00:00
2023-02-26 04:40:50 +00:00
def __init__(self, cmd_id: str, req_id: int, pd_id: int) -> None:
2023-03-09 16:50:11 +00:00
super().__init__(cmd_id, req_id)
self.ps_result = 1
2023-02-26 04:40:50 +00:00
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
# 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"
2023-03-09 16:50:11 +00:00
2023-02-26 04:40:50 +00:00
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}")
2023-03-09 16:50:11 +00:00
2023-02-26 04:40:50 +00:00
class StartResponse(BaseResponse):
2023-04-02 03:05:10 +00:00
def __init__(self, cmd_id: str, req_id: int, pv_id: int, pv_name: str) -> None:
2023-02-26 04:40:50 +00:00
super().__init__(cmd_id, req_id)
2023-04-02 03:05:10 +00:00
pd_id: int = pv_id
start_result: int = 1
accept_idx: int = 100
hp_vol: int = 0
btn_se_vol: int = 1
btn_se_vol2: int = 1
sldr_se_vol2: int = 1
sort_kind: int = 1
player_name: str = pv_name
lv_num: int = 1
lv_pnt: int = 0
lv_efct_id: int = 1
lv_plt_id: int = 1
mdl_have: str = "F" * 250
cstmz_itm_have: str = "F" * 250
use_pv_mdl_eqp: int = 0
use_mdl_pri: int = 0
use_pv_skn_eqp: int = 1
use_pv_btn_se_eqp: int = 1
use_pv_sld_se_eqp: int = 1
use_pv_chn_sld_se_eqp: int = 1
use_pv_sldr_tch_se_eqp: int = 1
vcld_pts: int = 0
nxt_pv_id: int = 1
nxt_dffclty: int = 1
nxt_edtn: int = 0
dsp_clr_brdr: int = 0
dsp_intrm_rnk: int = 0
dsp_clr_sts: int = 0
rgo_sts: int = 0
my_qst_id: str = ",".join(["-1"] * 25)
my_qst_sts: str = ",".join("0" * 5) + "," + ",".join(["-1"] * 20)
my_qst_prgrs: str = ",".join("0" * 5) + "," + ",".join(["-1"] * 20)
my_qst_et: str = ",".join([parse.quote(datetime.now().strftime(DivaConstants.LUT_TIME_FMT))] * 5) + "," + ",".join(["xxx"] * 20)
clr_sts: str = ",".join("0" * 5) + "," + ",".join(["-1"] * 20)
mdl_eqp_tm: str = parse.quote(datetime.now().strftime(DivaConstants.LUT_TIME_FMT))
mdl_eqp_ary = ",".join(["-999"] * 3)
c_itm_eqp_ary = ",".join(["-999"] * 12)
ms_itm_flg_ary = ",".join(["-999"] * 12)