diff --git a/modules/iidx/iidx30grade.py b/modules/iidx/iidx30grade.py index 19682e7..6eaa720 100644 --- a/modules/iidx/iidx30grade.py +++ b/modules/iidx/iidx30grade.py @@ -89,13 +89,19 @@ async def iidx30grade_raised(request: Request): game_profile["grade_values"] = grades grade_sp = db.table("iidx_class_best").search( - (where("iidx_id") == iidx_id) & (where("gtype") == 0) & (where("cstage") == 4) + (where("game_version") == game_version) + & (where("iidx_id") == iidx_id) + & (where("gtype") == 0) + & (where("cstage") == 4) ) game_profile["grade_single"] = max([x["gid"] for x in grade_sp], default=-1) grade_dp = db.table("iidx_class_best").search( - (where("iidx_id") == iidx_id) & (where("gtype") == 1) & (where("cstage") == 4) + (where("game_version") == game_version) + & (where("iidx_id") == iidx_id) + & (where("gtype") == 1) + & (where("cstage") == 4) ) game_profile["grade_double"] = max([x["gid"] for x in grade_dp], default=-1) diff --git a/modules/iidx/iidx30music.py b/modules/iidx/iidx30music.py index ec825b2..1ecd1c8 100644 --- a/modules/iidx/iidx30music.py +++ b/modules/iidx/iidx30music.py @@ -483,7 +483,7 @@ async def iidx30music_appoint(request: Request): @router.post("/{gameinfo}/IIDX30music/arenaCPU") -async def iidx30music_arenaCPU(request: Request): +async def iidx30music_arenacpu(request: Request): request_info = await core_process_request(request) root = request_info["root"][0] @@ -492,21 +492,19 @@ async def iidx30music_arenaCPU(request: Request): cpu_list = root.findall("cpu_list") cpu_count = len(cpu_list) - cpu_scores = {} - cpu_ghosts = {} + cpu = {} + for music in music_list: - i = int(music.find("index").text) + music_idx = int(music.find("index").text) exscore_max = int(music.find("total_notes").text) * 2 - cpu_scores[i] = {} - cpu_ghosts[i] = {} + cpu[music_idx] = {} - for j in range(cpu_count): - cpu_scores[i][j] = {} - cpu_ghosts[i][j] = {} + for bot_idx in range(cpu_count): + cpu[music_idx][bot_idx] = {} exscore = round(exscore_max * random.uniform(0.77, 0.93)) - cpu_scores[i][j]["exscore"] = exscore + cpu[music_idx][bot_idx]["exscore"] = exscore ghost_len = 64 ghost_data = [0] * ghost_len @@ -515,29 +513,77 @@ async def iidx30music_arenaCPU(request: Request): if (exscore % ghost_len) > x: ghost_data[x] += 1 - cpu_ghosts[i][j]["ghost_data"] = ghost_data + cpu[music_idx][bot_idx]["ghost_data"] = ghost_data response = E.response( E.IIDX30music( *[ E.cpu_score_list( - E.index(i, __type="s32"), + E.index(bot_idx, __type="s32"), *[ E.score_list( - E.index(j, __type="s32"), - E.score(cpu_scores[i][j]["exscore"], __type="s32"), - E.ghost(cpu_ghosts[i][j]["ghost_data"], __type="u8"), + E.index(music_idx, __type="s32"), + E.score(cpu[music_idx][bot_idx]["exscore"], __type="s32"), + E.ghost(cpu[music_idx][bot_idx]["ghost_data"], __type="u8"), E.enable_score(1, __type="bool"), E.enable_ghost(1, __type="bool"), E.location_id("X000000001", __type="str"), ) - for j in range(cpu_count) + for music_idx in range(music_count) ], ) - for i in range(music_count) + for bot_idx in range(cpu_count) ], ) ) response_body, response_headers = await core_prepare_response(request, response) return Response(content=response_body, headers=response_headers) + + +@router.post("/{gameinfo}/IIDX30music/retry") +async def iidx30music_retry(request: Request): + request_info = await core_process_request(request) + + response = E.response( + E.IIDX30music( + E.session(session_id=1), + status=0, + ) + ) + + response_body, response_headers = await core_prepare_response(request, response) + return Response(content=response_body, headers=response_headers) + + +@router.post("/{gameinfo}/IIDX30music/play") +async def iidx30music_play(request: Request): + request_info = await core_process_request(request) + + response = E.response(E.IIDX30music()) + + response_body, response_headers = await core_prepare_response(request, response) + return Response(content=response_body, headers=response_headers) + + +@router.post("/{gameinfo}/IIDX30music/nosave") +async def iidx30music_nosave(request: Request): + request_info = await core_process_request(request) + + response = E.response(E.IIDX30music()) + + response_body, response_headers = await core_prepare_response(request, response) + return Response(content=response_body, headers=response_headers) + +@router.post("/{gameinfo}/IIDX30music/movieinfo") +async def iidx30music_movieinfo(request: Request): + request_info = await core_process_request(request) + + response = E.response( + E.IIDX30music( + status=0, + ) + ) + + response_body, response_headers = await core_prepare_response(request, response) + return Response(content=response_body, headers=response_headers) diff --git a/modules/iidx/iidx30pc.py b/modules/iidx/iidx30pc.py index bdc253d..62282b8 100644 --- a/modules/iidx/iidx30pc.py +++ b/modules/iidx/iidx30pc.py @@ -391,7 +391,7 @@ async def iidx30pc_get(request: Request): E.enable_qr_reward(), E.nostalgia_open(), E.language_setting(language=profile["language_setting"]), - E.movie_agreement(agreement_version=profile["movie_agreement"]), + E.movie_agreement(agreement_version=profile.get("movie_agreement", 0)), E.bpl_virtual(), E.lightning_play_data( spnum=profile["lightning_play_data_spnum"], @@ -758,7 +758,7 @@ async def iidx30pc_common(request: Request): E.movie_agreement(version=1), E.license("None", __type="str"), E.file_recovery(url=str(config.ip)), - E.movie_upload(url=str(config.ip)), + E.movie_upload(url=f"http://{str(request.client.host)}:4399/movie/"), # use https://github.com/bookqaq/010-record-api # E.button_release_frame(frame=''), # E.trigger_logic_type(type=''), # E.cm_movie_info(type=''), @@ -907,6 +907,16 @@ async def iidx30pc_save(request: Request): if concentration is not None: game_profile["lightning_setting_concentration"] = int(concentration.text) + movie_agreement = request_info["root"][0].find("movie_agreement") + if movie_agreement is not None and "agreement_version" in movie_agreement.attrib: + game_profile["movie_agreement"] = int( + movie_agreement.attrib["agreement_version"] + ) + + hide_name = request_info["root"][0].find("movie_setting/hide_name") + if hide_name is not None: + game_profile["hide_name"] = int(hide_name.text) + lightning_customize_flg = request_info["root"][0].find("lightning_customize_flg") if lightning_customize_flg is not None: for k in [ @@ -1339,6 +1349,35 @@ async def iidx30pc_eaappliresult(request: Request): return Response(content=response_body, headers=response_headers) +@router.post("/{gameinfo}/IIDX30pc/playstart") +async def iidx30pc_playstart(request: Request): + request_info = await core_process_request(request) + + response = E.response(E.IIDX30pc()) + + response_body, response_headers = await core_prepare_response(request, response) + return Response(content=response_body, headers=response_headers) + + +@router.post("/{gameinfo}/IIDX30pc/playend") +async def iidx30pc_playend(request: Request): + request_info = await core_process_request(request) + + response = E.response(E.IIDX30pc()) + + response_body, response_headers = await core_prepare_response(request, response) + return Response(content=response_body, headers=response_headers) + + +@router.post("/{gameinfo}/IIDX30pc/delete") +async def iidx30pc_delete(request: Request): + request_info = await core_process_request(request) + + response = E.response(E.IIDX30pc()) + + response_body, response_headers = await core_prepare_response(request, response) + return Response(content=response_body, headers=response_headers) + @router.post("/{gameinfo}/IIDX30pc/logout") async def iidx30pc_logout(request: Request): request_info = await core_process_request(request) diff --git a/modules/iidx/iidx31music.py b/modules/iidx/iidx31music.py index b59b606..4206ea8 100644 --- a/modules/iidx/iidx31music.py +++ b/modules/iidx/iidx31music.py @@ -576,3 +576,16 @@ async def iidx31music_nosave(request: Request): response_body, response_headers = await core_prepare_response(request, response) return Response(content=response_body, headers=response_headers) + +@router.post("/{gameinfo}/IIDX31music/movieinfo") +async def iidx31music_movieinfo(request: Request): + request_info = await core_process_request(request) + + response = E.response( + E.IIDX31music( + status=0, + ) + ) + + response_body, response_headers = await core_prepare_response(request, response) + return Response(content=response_body, headers=response_headers) diff --git a/modules/iidx/iidx31pc.py b/modules/iidx/iidx31pc.py index 09c1628..33932cf 100644 --- a/modules/iidx/iidx31pc.py +++ b/modules/iidx/iidx31pc.py @@ -310,7 +310,7 @@ async def iidx31pc_get(request: Request): tour_id=i, progress=50, # set to 49 to see WT folders, 50 is completed/hidden ) - for i in range(16) + for i in range(17) ], ), E.lightning_setting( @@ -809,7 +809,7 @@ async def iidx31pc_common(request: Request): E.movie_agreement(version=1), E.license("None", __type="str"), E.file_recovery(url=str(config.ip)), - E.movie_upload(url=f"http://{str(config.ip)}:4399/movie/"), + E.movie_upload(url=f"http://{str(request.client.host)}:4399/movie/"), # use https://github.com/bookqaq/010-record-api # E.button_release_frame(frame=''), # E.trigger_logic_type(type=''), # E.cm_movie_info(type=''), diff --git a/modules/iidx/iidx32music.py b/modules/iidx/iidx32music.py index f0c286c..373c49f 100644 --- a/modules/iidx/iidx32music.py +++ b/modules/iidx/iidx32music.py @@ -590,3 +590,17 @@ async def iidx32music_getranksub(request: Request): response_body, response_headers = await core_prepare_response(request, response) return Response(content=response_body, headers=response_headers) + +@router.post("/{gameinfo}/IIDX32music/movieinfo") +async def iidx32music_movieinfo(request: Request): + request_info = await core_process_request(request) + + response = E.response( + E.IIDX32music( + status=0, + ) + ) + + response_body, response_headers = await core_prepare_response(request, response) + return Response(content=response_body, headers=response_headers) + diff --git a/modules/iidx/iidx32pc.py b/modules/iidx/iidx32pc.py index e790618..13eeb4f 100644 --- a/modules/iidx/iidx32pc.py +++ b/modules/iidx/iidx32pc.py @@ -665,7 +665,7 @@ async def iidx32pc_common(request: Request): E.movie_agreement(version=1), E.license("None", __type="str"), E.file_recovery(url=str(config.ip)), - E.movie_upload(url=f"http://{str(config.ip)}:4399/movie/"), + E.movie_upload(url=f"http://{str(request.client.host)}:4399/movie/"), # use https://github.com/bookqaq/010-record-api # E.button_release_frame(frame=''), # E.trigger_logic_type(type=''), # E.cm_movie_info(type=''),