From 1111b8a86cdb07e26281cfe6cec86e4aa1d59a2c Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Fri, 20 Sep 2024 09:18:49 +0800 Subject: [PATCH] Try to kick out people whose sending malformed max combo count. --- npps4/game/live.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/npps4/game/live.py b/npps4/game/live.py index f145412..4a61e2b 100644 --- a/npps4/game/live.py +++ b/npps4/game/live.py @@ -505,6 +505,13 @@ async def live_reward(context: idol.SchoolIdolUserParams, request: LiveRewardReq if live_setting is None: raise idol.error.by_code(idol.error.ERROR_CODE_LIVE_NOT_FOUND) + beatmap_data = await live.get_live_info(context, request.live_difficulty_id, live_setting) + if beatmap_data is None: + raise idol.error.by_code(idol.error.ERROR_CODE_LIVE_NOTES_LIST_NOT_FOUND) + + if request.max_combo > len(beatmap_data.notes_list): + raise idol.error.IdolError(detail="...", http_code=423) + # Get old data live_clear_data = await live.get_live_clear_data(context, current_user, request.live_difficulty_id, True) old_live_clear_data = copy.copy(live_clear_data)