diva: implement StartResponse

This commit is contained in:
Hay1tsme 2023-04-01 23:19:44 -04:00
parent 6ff7827918
commit 8df1325613
2 changed files with 80 additions and 102 deletions

View File

@ -419,89 +419,67 @@ class DivaBase:
) )
return f"&cd_adm_result=1&pd_id={data['aime_id']}" return f"&cd_adm_result=1&pd_id={data['aime_id']}"
def handle_start_request(self, data: bytes) -> str: def handle_start_request(self, data: bytes) -> str:
profile = self.data.profile.get_profile(data["pd_id"], self.version) req = StartRequest(data)
profile_shop = self.data.item.get_shop(data["pd_id"], self.version) profile = self.data.profile.get_profile(req.pd_id, self.version)
profile_shop = self.data.item.get_shop(req.pd_id, self.version)
if profile is None: if profile is None:
return return
resp = StartResponse(req.cmd, req.req_id, req.pd_id, profile['player_name'])
mdl_have = "F" * 250
# generate the mdl_have string if "unlock_all_modules" is disabled # generate the mdl_have string if "unlock_all_modules" is disabled
if not self.game_config.mods.unlock_all_modules: if not self.game_config.mods.unlock_all_modules:
mdl_have = self.data.module.get_modules_have_string( resp.mdl_have = self.data.module.get_modules_have_string(
data["pd_id"], self.version data["pd_id"], self.version
) )
cstmz_itm_have = "F" * 250
# generate the cstmz_itm_have string if "unlock_all_items" is disabled # generate the cstmz_itm_have string if "unlock_all_items" is disabled
if not self.game_config.mods.unlock_all_items: if not self.game_config.mods.unlock_all_items:
cstmz_itm_have = self.data.customize.get_customize_items_have_string( resp.cstmz_itm_have = self.data.customize.get_customize_items_have_string(
data["pd_id"], self.version data["pd_id"], self.version
) )
response = f"&pd_id={data['pd_id']}" resp.pd_id = data['pd_id']
response += "&start_result=1" resp.hp_vol = {profile['hp_vol']}
resp.btn_se_vol = {profile['btn_se_vol']}
response += "&accept_idx=100" resp.btn_se_vol2 = {profile['btn_se_vol2']}
response += f"&hp_vol={profile['hp_vol']}" resp.sldr_se_vol2 = {profile['sldr_se_vol2']}
response += f"&btn_se_vol={profile['btn_se_vol']}" resp.sort_kind = {profile['sort_kind']}
response += f"&btn_se_vol2={profile['btn_se_vol2']}" resp.player_name = {profile['player_name']}
response += f"&sldr_se_vol2={profile['sldr_se_vol2']}" resp.lv_num = {profile['lv_num']}
response += f"&sort_kind={profile['sort_kind']}" resp.lv_pnt = {profile['lv_pnt']}
response += f"&player_name={profile['player_name']}" resp.lv_efct_id = {profile['lv_efct_id']}
response += f"&lv_num={profile['lv_num']}" resp.lv_plt_id = {profile['lv_plt_id']}
response += f"&lv_pnt={profile['lv_pnt']}" resp.use_pv_mdl_eqp = {int(profile['use_pv_mdl_eqp'])}
response += f"&lv_efct_id={profile['lv_efct_id']}" resp.use_mdl_pri = {int(profile['use_mdl_pri'])}
response += f"&lv_plt_id={profile['lv_plt_id']}" resp.use_pv_skn_eqp = {int(profile['use_pv_skn_eqp'])}
response += f"&mdl_have={mdl_have}" resp.use_pv_btn_se_eqp = {int(profile['use_pv_btn_se_eqp'])}
response += f"&cstmz_itm_have={cstmz_itm_have}" resp.use_pv_sld_se_eqp = {int(profile['use_pv_sld_se_eqp'])}
response += f"&use_pv_mdl_eqp={int(profile['use_pv_mdl_eqp'])}" resp.use_pv_chn_sld_se_eqp = {int(profile['use_pv_chn_sld_se_eqp'])}
response += f"&use_mdl_pri={int(profile['use_mdl_pri'])}" resp.use_pv_sldr_tch_se_eqp = {int(profile['use_pv_sldr_tch_se_eqp'])}
response += f"&use_pv_skn_eqp={int(profile['use_pv_skn_eqp'])}" resp.vcld_pts = {profile['lv_efct_id']}
response += f"&use_pv_btn_se_eqp={int(profile['use_pv_btn_se_eqp'])}" resp.nxt_pv_id = {profile['nxt_pv_id']}
response += f"&use_pv_sld_se_eqp={int(profile['use_pv_sld_se_eqp'])}" resp.nxt_dffclty = {profile['nxt_dffclty']}
response += f"&use_pv_chn_sld_se_eqp={int(profile['use_pv_chn_sld_se_eqp'])}" resp.nxt_edtn = {profile['nxt_edtn']}
response += f"&use_pv_sldr_tch_se_eqp={int(profile['use_pv_sldr_tch_se_eqp'])}" resp.dsp_clr_brdr = {profile['dsp_clr_brdr']}
response += f"&vcld_pts={profile['lv_efct_id']}" resp.dsp_intrm_rnk = {profile['dsp_intrm_rnk']}
response += f"&nxt_pv_id={profile['nxt_pv_id']}" resp.dsp_clr_sts = {profile['dsp_clr_sts']}
response += f"&nxt_dffclty={profile['nxt_dffclty']}" resp.rgo_sts = {profile['rgo_sts']}
response += f"&nxt_edtn={profile['nxt_edtn']}"
response += f"&dsp_clr_brdr={profile['dsp_clr_brdr']}"
response += f"&dsp_intrm_rnk={profile['dsp_intrm_rnk']}"
response += f"&dsp_clr_sts={profile['dsp_clr_sts']}"
response += f"&rgo_sts={profile['rgo_sts']}"
# To be fully fixed # To be fully fixed
if "my_qst_id" not in profile: if "my_qst_id" in profile:
response += f"&my_qst_id=-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1" resp.my_qst_id = {profile['my_qst_id']}
response += f"&my_qst_sts=0,0,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1" resp.my_qst_sts = {profile['my_qst_sts']}
else:
response += f"&my_qst_id={profile['my_qst_id']}"
response += f"&my_qst_sts={profile['my_qst_sts']}"
response += f"&my_qst_prgrs=0,0,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1"
response += f"&my_qst_et=2022-06-19%2010%3A28%3A52.0,2022-06-19%2010%3A28%3A52.0,2022-06-19%2010%3A28%3A52.0,2100-01-01%2008%3A59%3A59.0,2100-01-01%2008%3A59%3A59.0,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx"
response += f"&clr_sts=0,0,0,0,0,0,0,0,56,52,35,6,6,3,1,0,0,0,0,0"
# Store stuff to add to rework
response += f"&mdl_eqp_tm={self.time_lut}"
mdl_eqp_ary = "-999,-999,-999"
c_itm_eqp_ary = "-999,-999,-999,-999,-999,-999,-999,-999,-999,-999,-999,-999"
ms_itm_flg_ary = "1,1,1,1,1,1,1,1,1,1,1,1"
# get the common_modules, customize_items and customize_item_flags # get the common_modules, customize_items and customize_item_flags
# from the profile shop # from the profile shop
if profile_shop: if profile_shop:
mdl_eqp_ary = profile_shop["mdl_eqp_ary"] resp.mdl_eqp_ary = profile_shop["mdl_eqp_ary"]
c_itm_eqp_ary = profile_shop["c_itm_eqp_ary"] resp.c_itm_eqp_ary = profile_shop["c_itm_eqp_ary"]
ms_itm_flg_ary = profile_shop["ms_itm_flg_ary"] resp.ms_itm_flg_ary = profile_shop["ms_itm_flg_ary"]
response += f"&mdl_eqp_ary={mdl_eqp_ary}" return resp.make()
response += f"&c_itm_eqp_ary={c_itm_eqp_ary}"
response += f"&ms_itm_flg_ary={ms_itm_flg_ary}"
return response
def handle_pd_unlock_request(self, data: bytes) -> str: def handle_pd_unlock_request(self, data: bytes) -> str:
pass pass

View File

@ -70,42 +70,42 @@ class StartRequest(BaseRequest):
class StartResponse(BaseResponse): class StartResponse(BaseResponse):
def __init__(self, cmd_id: str, req_id: int, pv_id: int, pv_name: str) -> None: def __init__(self, cmd_id: str, req_id: int, pv_id: int, pv_name: str) -> None:
super().__init__(cmd_id, req_id) super().__init__(cmd_id, req_id)
pd_id: int = pv_id self.pd_id: int = pv_id
start_result: int = 1 self.start_result: int = 1
accept_idx: int = 100 self.accept_idx: int = 100
hp_vol: int = 0 self.hp_vol: int = 0
btn_se_vol: int = 1 self.btn_se_vol: int = 1
btn_se_vol2: int = 1 self.btn_se_vol2: int = 1
sldr_se_vol2: int = 1 self.sldr_se_vol2: int = 1
sort_kind: int = 1 self.sort_kind: int = 1
player_name: str = pv_name self.player_name: str = pv_name
lv_num: int = 1 self.lv_num: int = 1
lv_pnt: int = 0 self.lv_pnt: int = 0
lv_efct_id: int = 1 self.lv_efct_id: int = 1
lv_plt_id: int = 1 self.lv_plt_id: int = 1
mdl_have: str = "F" * 250 self.mdl_have: str = "F" * 250
cstmz_itm_have: str = "F" * 250 self.cstmz_itm_have: str = "F" * 250
use_pv_mdl_eqp: int = 0 self.use_pv_mdl_eqp: int = 0
use_mdl_pri: int = 0 self.use_mdl_pri: int = 0
use_pv_skn_eqp: int = 1 self.use_pv_skn_eqp: int = 1
use_pv_btn_se_eqp: int = 1 self.use_pv_btn_se_eqp: int = 1
use_pv_sld_se_eqp: int = 1 self.use_pv_sld_se_eqp: int = 1
use_pv_chn_sld_se_eqp: int = 1 self.use_pv_chn_sld_se_eqp: int = 1
use_pv_sldr_tch_se_eqp: int = 1 self.use_pv_sldr_tch_se_eqp: int = 1
vcld_pts: int = 0 self.vcld_pts: int = 0
nxt_pv_id: int = 1 self.nxt_pv_id: int = 1
nxt_dffclty: int = 1 self.nxt_dffclty: int = 1
nxt_edtn: int = 0 self.nxt_edtn: int = 0
dsp_clr_brdr: int = 0 self.dsp_clr_brdr: int = 0
dsp_intrm_rnk: int = 0 self.dsp_intrm_rnk: int = 0
dsp_clr_sts: int = 0 self.dsp_clr_sts: int = 0
rgo_sts: int = 0 self.rgo_sts: int = 0
my_qst_id: str = ",".join(["-1"] * 25) self.my_qst_id: str = ",".join(["-1"] * 25)
my_qst_sts: str = ",".join("0" * 5) + "," + ",".join(["-1"] * 20) self.my_qst_sts: str = ",".join("0" * 5) + "," + ",".join(["-1"] * 20)
my_qst_prgrs: str = ",".join("0" * 5) + "," + ",".join(["-1"] * 20) self.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) self.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) self.clr_sts: str = ",".join("0" * 5) + "," + ",".join(["-1"] * 20)
mdl_eqp_tm: str = parse.quote(datetime.now().strftime(DivaConstants.LUT_TIME_FMT)) self.mdl_eqp_tm: str = parse.quote(datetime.now().strftime(DivaConstants.LUT_TIME_FMT))
mdl_eqp_ary = ",".join(["-999"] * 3) self.mdl_eqp_ary = ",".join(["-999"] * 3)
c_itm_eqp_ary = ",".join(["-999"] * 12) self.c_itm_eqp_ary = ",".join(["-999"] * 12)
ms_itm_flg_ary = ",".join(["-999"] * 12) self.ms_itm_flg_ary = ",".join(["-999"] * 12)