diva: add register, fixes, start still busted

This commit is contained in:
Kevin Trocolli
2023-10-04 02:18:04 -04:00
parent 7322bc60dc
commit 53c74c6511
4 changed files with 125 additions and 84 deletions

View File

@@ -399,27 +399,6 @@ class DivaBase:
if profile is None:
return f"&ps_result=-3"
else:
response = "&ps_result=1"
response += "&accept_idx=100"
response += "&nblss_ltt_stts=-1"
response += "&nblss_ltt_tckt=-1"
response += "&nblss_ltt_is_opn=-1"
response += f"&pd_id={data['aime_id']}"
response += f"&player_name={profile['player_name']}"
response += f"&sort_kind={profile['player_name']}"
response += f"&lv_efct_id={profile['lv_efct_id']}"
response += f"&lv_plt_id={profile['lv_plt_id']}"
response += f"&lv_str={profile['lv_str']}"
response += f"&lv_num={profile['lv_num']}"
response += f"&lv_pnt={profile['lv_pnt']}"
response += f"&vcld_pts={profile['vcld_pts']}"
response += f"&skn_eqp={profile['use_pv_skn_eqp']}"
response += f"&btn_se_eqp={profile['btn_se_eqp']}"
response += f"&sld_se_eqp={profile['sld_se_eqp']}"
response += f"&chn_sld_se_eqp={profile['chn_sld_se_eqp']}"
response += f"&sldr_tch_se_eqp={profile['sldr_tch_se_eqp']}"
response += f"&passwd_stat={profile['passwd_stat']}"
profile_dict = profile._asdict()
profile_dict.pop("id")
@@ -436,10 +415,13 @@ class DivaBase:
return resp.make()
def handle_registration_request(self, data: bytes) -> str:
self.data.profile.create_profile(
self.version, data["aime_id"], data["player_name"]
req = RegisterRequest(data)
pd_id = self.data.profile.create_profile(
self.version, req.aime_id, req.player_name
)
return f"&cd_adm_result=1&pd_id={data['aime_id']}"
if pd_id is None:
return "&cd_adm_result=-1"
return RegisterResponse(req.cmd, req.req_id, req.aime_id).make()
def handle_start_request(self, data: bytes) -> str:
req = StartRequest(data)
@@ -453,41 +435,49 @@ class DivaBase:
# generate the mdl_have string if "unlock_all_modules" is disabled
if not self.game_config.mods.unlock_all_modules:
resp.mdl_have = self.data.module.get_modules_have_string(
data["pd_id"], self.version
req.pd_id, self.version
)
# generate the cstmz_itm_have string if "unlock_all_items" is disabled
if not self.game_config.mods.unlock_all_items:
resp.cstmz_itm_have = self.data.customize.get_customize_items_have_string(
data["pd_id"], self.version
req.pd_id, self.version
)
"""
resp.hp_vol = profile['hp_vol']
resp.btn_se_vol = profile['btn_se_vol']
resp.btn_se_vol2 = profile['btn_se_vol2']
resp.sldr_se_vol2 = profile['sldr_se_vol2']
resp.sort_kind = profile['sort_kind']
resp.lv_num = profile['lv_num']
resp.lv_pnt = profile['lv_pnt']
resp.lv_efct_id = profile['lv_efct_id']
resp.lv_plt_id = profile['lv_plt_id']
resp.use_pv_mdl_eqp = int(profile['use_pv_mdl_eqp'])
resp.use_mdl_pri = int(profile['use_mdl_pri'])
resp.use_pv_skn_eqp = int(profile['use_pv_skn_eqp'])
resp.use_pv_btn_se_eqp = int(profile['use_pv_btn_se_eqp'])
resp.use_pv_sld_se_eqp = int(profile['use_pv_sld_se_eqp'])
resp.use_pv_chn_sld_se_eqp = int(profile['use_pv_chn_sld_se_eqp'])
resp.use_pv_sldr_tch_se_eqp = int(profile['use_pv_sldr_tch_se_eqp'])
resp.vcld_pts = profile['lv_efct_id']
resp.nxt_pv_id = profile['nxt_pv_id']
resp.nxt_dffclty = profile['nxt_dffclty']
resp.nxt_edtn = profile['nxt_edtn']
resp.dsp_clr_brdr = profile['dsp_clr_brdr']
resp.dsp_intrm_rnk = profile['dsp_intrm_rnk']
resp.dsp_clr_sts = profile['dsp_clr_sts']
resp.rgo_sts = profile['rgo_sts']
"""
profile_dict = profile._asdict()
profile_dict.pop("id")
profile_dict.pop("user")
profile_dict.pop("version")
resp.pd_id = data['pd_id']
resp.hp_vol = {profile['hp_vol']}
resp.btn_se_vol = {profile['btn_se_vol']}
resp.btn_se_vol2 = {profile['btn_se_vol2']}
resp.sldr_se_vol2 = {profile['sldr_se_vol2']}
resp.sort_kind = {profile['sort_kind']}
resp.player_name = {profile['player_name']}
resp.lv_num = {profile['lv_num']}
resp.lv_pnt = {profile['lv_pnt']}
resp.lv_efct_id = {profile['lv_efct_id']}
resp.lv_plt_id = {profile['lv_plt_id']}
resp.use_pv_mdl_eqp = {int(profile['use_pv_mdl_eqp'])}
resp.use_mdl_pri = {int(profile['use_mdl_pri'])}
resp.use_pv_skn_eqp = {int(profile['use_pv_skn_eqp'])}
resp.use_pv_btn_se_eqp = {int(profile['use_pv_btn_se_eqp'])}
resp.use_pv_sld_se_eqp = {int(profile['use_pv_sld_se_eqp'])}
resp.use_pv_chn_sld_se_eqp = {int(profile['use_pv_chn_sld_se_eqp'])}
resp.use_pv_sldr_tch_se_eqp = {int(profile['use_pv_sldr_tch_se_eqp'])}
resp.vcld_pts = {profile['lv_efct_id']}
resp.nxt_pv_id = {profile['nxt_pv_id']}
resp.nxt_dffclty = {profile['nxt_dffclty']}
resp.nxt_edtn = {profile['nxt_edtn']}
resp.dsp_clr_brdr = {profile['dsp_clr_brdr']}
resp.dsp_intrm_rnk = {profile['dsp_intrm_rnk']}
resp.dsp_clr_sts = {profile['dsp_clr_sts']}
resp.rgo_sts = {profile['rgo_sts']}
for k, v in profile_dict.items():
# if hasattr(resp, k):
setattr(resp, k, v)
response = "&ps_result=1"
# Contest progress
response += f"&cv_cid=-1,-1,-1,-1"
@@ -506,8 +496,8 @@ class DivaBase:
# To be fully fixed
if "my_qst_id" in profile:
resp.my_qst_id = {profile['my_qst_id']}
resp.my_qst_sts = {profile['my_qst_sts']}
resp.my_qst_id = profile['my_qst_id']
resp.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"
@@ -531,7 +521,7 @@ class DivaBase:
}
# get clear status from user scores
pv_records = self.data.score.get_best_scores(data["pd_id"])
pv_records = self.data.score.get_best_scores(req.pd_id)
clear_status = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"
if pv_records is not None:
@@ -568,6 +558,7 @@ class DivaBase:
clear_status = ",".join(map(str, clear_list))
response += f"&clr_sts={clear_status}"
resp.clr_sts = clear_status
# Store stuff to add to rework
response += f"&mdl_eqp_tm={self.time_lut}"