forked from Hay1tsme/artemis
Merge branch 'develop' into diva_handler_classes
This commit is contained in:
@ -276,16 +276,17 @@ class DivaBase:
|
||||
def handle_festa_info_request(self, data: bytes) -> str:
|
||||
encoded = "&"
|
||||
params = {
|
||||
"fi_id": "1,-1",
|
||||
"fi_name": f"{self.core_cfg.server.name} Opening,xxx",
|
||||
"fi_kind": "0,0",
|
||||
"fi_id": "1,2",
|
||||
"fi_name": f"{self.core_cfg.server.name} Opening,Project DIVA Festa",
|
||||
# 0=PINK, 1=GREEN
|
||||
"fi_kind": "1,0",
|
||||
"fi_difficulty": "-1,-1",
|
||||
"fi_pv_id_lst": "ALL,ALL",
|
||||
"fi_attr": "7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
|
||||
"fi_add_vp": "20,0",
|
||||
"fi_mul_vp": "1,1",
|
||||
"fi_st": "2022-06-17 17:00:00.0,2014-07-08 18:10:11.0",
|
||||
"fi_et": "2029-01-01 10:00:00.0,2014-07-08 18:10:11.0",
|
||||
"fi_add_vp": "20,5",
|
||||
"fi_mul_vp": "1,2",
|
||||
"fi_st": "2019-01-01 00:00:00.0,2019-01-01 00:00:00.0",
|
||||
"fi_et": "2029-01-01 00:00:00.0,2029-01-01 00:00:00.0",
|
||||
"fi_lut": "{self.time_lut}",
|
||||
}
|
||||
|
||||
@ -396,8 +397,28 @@ class DivaBase:
|
||||
profile_shop = self.data.item.get_shop(req.aime_id, self.version)
|
||||
|
||||
if profile is None:
|
||||
resp.ps_result = -3
|
||||
return resp.make()
|
||||
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")
|
||||
@ -467,11 +488,122 @@ class DivaBase:
|
||||
resp.dsp_clr_sts = {profile['dsp_clr_sts']}
|
||||
resp.rgo_sts = {profile['rgo_sts']}
|
||||
|
||||
response += "&accept_idx=100"
|
||||
response += f"&hp_vol={profile['hp_vol']}"
|
||||
response += f"&btn_se_vol={profile['btn_se_vol']}"
|
||||
response += f"&btn_se_vol2={profile['btn_se_vol2']}"
|
||||
response += f"&sldr_se_vol2={profile['sldr_se_vol2']}"
|
||||
response += f"&sort_kind={profile['sort_kind']}"
|
||||
response += f"&player_name={profile['player_name']}"
|
||||
response += f"&lv_num={profile['lv_num']}"
|
||||
response += f"&lv_pnt={profile['lv_pnt']}"
|
||||
response += f"&lv_efct_id={profile['lv_efct_id']}"
|
||||
response += f"&lv_plt_id={profile['lv_plt_id']}"
|
||||
response += f"&mdl_have={mdl_have}"
|
||||
response += f"&cstmz_itm_have={cstmz_itm_have}"
|
||||
response += f"&use_pv_mdl_eqp={int(profile['use_pv_mdl_eqp'])}"
|
||||
response += f"&use_mdl_pri={int(profile['use_mdl_pri'])}"
|
||||
response += f"&use_pv_skn_eqp={int(profile['use_pv_skn_eqp'])}"
|
||||
response += f"&use_pv_btn_se_eqp={int(profile['use_pv_btn_se_eqp'])}"
|
||||
response += f"&use_pv_sld_se_eqp={int(profile['use_pv_sld_se_eqp'])}"
|
||||
response += f"&use_pv_chn_sld_se_eqp={int(profile['use_pv_chn_sld_se_eqp'])}"
|
||||
response += f"&use_pv_sldr_tch_se_eqp={int(profile['use_pv_sldr_tch_se_eqp'])}"
|
||||
response += f"&vcld_pts={profile['lv_efct_id']}"
|
||||
response += f"&nxt_pv_id={profile['nxt_pv_id']}"
|
||||
response += f"&nxt_dffclty={profile['nxt_dffclty']}"
|
||||
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']}"
|
||||
|
||||
# Contest progress
|
||||
response += f"&cv_cid=-1,-1,-1,-1"
|
||||
response += f"&cv_sc=-1,-1,-1,-1"
|
||||
response += f"&cv_bv=-1,-1,-1,-1"
|
||||
response += f"&cv_bv=-1,-1,-1,-1"
|
||||
response += f"&cv_bf=-1,-1,-1,-1"
|
||||
|
||||
# Contest now playing id, return -1 if no current playing contest
|
||||
response += f"&cnp_cid={profile['cnp_cid']}"
|
||||
response += f"&cnp_val={profile['cnp_val']}"
|
||||
# border can be 0=bronzem 1=silver, 2=gold
|
||||
response += f"&cnp_rr={profile['cnp_rr']}"
|
||||
# only show contest specifier if it is not empty
|
||||
response += f"&cnp_sp={profile['cnp_sp']}" if profile["cnp_sp"] != "" else ""
|
||||
|
||||
# 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']}
|
||||
|
||||
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"
|
||||
|
||||
# define a helper class to store all counts for clear, great,
|
||||
# excellent and perfect
|
||||
class ClearSet:
|
||||
def __init__(self):
|
||||
self.clear = 0
|
||||
self.great = 0
|
||||
self.excellent = 0
|
||||
self.perfect = 0
|
||||
|
||||
# create a dict to store the ClearSets per difficulty
|
||||
clear_set_dict = {
|
||||
0: ClearSet(), # easy
|
||||
1: ClearSet(), # normal
|
||||
2: ClearSet(), # hard
|
||||
3: ClearSet(), # extreme
|
||||
4: ClearSet(), # exExtreme
|
||||
}
|
||||
|
||||
# get clear status from user scores
|
||||
pv_records = self.data.score.get_best_scores(data["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:
|
||||
for score in pv_records:
|
||||
if score["edition"] == 0:
|
||||
# cheap and standard both count to "clear"
|
||||
if score["clr_kind"] in {1, 2}:
|
||||
clear_set_dict[score["difficulty"]].clear += 1
|
||||
elif score["clr_kind"] == 3:
|
||||
clear_set_dict[score["difficulty"]].great += 1
|
||||
elif score["clr_kind"] == 4:
|
||||
clear_set_dict[score["difficulty"]].excellent += 1
|
||||
elif score["clr_kind"] == 5:
|
||||
clear_set_dict[score["difficulty"]].perfect += 1
|
||||
else:
|
||||
# 4=ExExtreme
|
||||
if score["clr_kind"] in {1, 2}:
|
||||
clear_set_dict[4].clear += 1
|
||||
elif score["clr_kind"] == 3:
|
||||
clear_set_dict[4].great += 1
|
||||
elif score["clr_kind"] == 4:
|
||||
clear_set_dict[4].excellent += 1
|
||||
elif score["clr_kind"] == 5:
|
||||
clear_set_dict[4].perfect += 1
|
||||
|
||||
# now add all values to a list
|
||||
clear_list = []
|
||||
for clear_set in clear_set_dict.values():
|
||||
clear_list.append(clear_set.clear)
|
||||
clear_list.append(clear_set.great)
|
||||
clear_list.append(clear_set.excellent)
|
||||
clear_list.append(clear_set.perfect)
|
||||
|
||||
clear_status = ",".join(map(str, clear_list))
|
||||
|
||||
response += f"&clr_sts={clear_status}"
|
||||
|
||||
# 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
|
||||
# from the profile shop
|
||||
if profile_shop:
|
||||
|
Reference in New Issue
Block a user