From 613ea0da782a17e127ec7ed2622adaa8615a6089 Mon Sep 17 00:00:00 2001 From: drmext <71258889+drmext@users.noreply.github.com> Date: Wed, 14 Feb 2024 03:17:14 +0000 Subject: [PATCH] Fix --- modules/iidx/iidx31gamesystem.py | 105 ++++++++++++++++--------------- modules/iidx/iidx31pc.py | 28 +++++++-- utils/db/delete_monkey_user.py | 65 +++++++++++++++++++ 3 files changed, 140 insertions(+), 58 deletions(-) create mode 100644 utils/db/delete_monkey_user.py diff --git a/modules/iidx/iidx31gamesystem.py b/modules/iidx/iidx31gamesystem.py index ba003c7..f98749b 100644 --- a/modules/iidx/iidx31gamesystem.py +++ b/modules/iidx/iidx31gamesystem.py @@ -30,62 +30,63 @@ async def iidx31gamesystem_systeminfo(request: Request): ) for mid in unlock ], - # E.grade_course(), - # E.arena_schedule( - # E.phase(3, __type="u8"), - # E.start(current_time - 600, __type="u32"), - # E.end(current_time + 600, __type="u32"), - # ), - # *[ - # E.arena_reward( - # E.index(unlock.index(mid), __type="s32"), - # E.cube_num((unlock.index(mid) + 1) * 50, __type="s32"), - # E.kind(0, __type="s32"), - # E.value(mid, __type="str"), - # ) - # for mid in unlock - # ], - # *[ - # E.arena_music_difficult( - # E.play_style(sp_dp, __type="s32"), - # E.arena_class(arena_class, __type="s32"), - # E.low_difficult(8, __type="s32"), - # E.high_difficult(12, __type="s32"), - # E.is_leggendaria(1, __type="bool"), - # E.force_music_list_id(0, __type="s32"), - # ) - # for sp_dp in (0, 1) - # for arena_class in range(20) - # ], - # *[ - # E.arena_cpu_define( - # E.play_style(sp_dp, __type="s32"), - # E.arena_class(arena_class, __type="s32"), - # E.grade_id(18, __type="s32"), - # E.low_music_difficult(8, __type="s32"), - # E.high_music_difficult(12, __type="s32"), - # E.is_leggendaria(0, __type="bool"), - # ) - # for sp_dp in (0, 1) - # for arena_class in range(20) - # ], - # *[ - # E.maching_class_range( - # E.play_style(sp_dp, __type="s32"), - # E.matching_class(arena_class, __type="s32"), - # E.low_arena_class(arena_class, __type="s32"), - # E.high_arena_class(arena_class, __type="s32"), - # ) - # for sp_dp in (0, 1) - # for arena_class in range(20) - # ], + #E.grade_course(), + E.arena_schedule( + E.phase(3, __type="u8"), + E.rule_type(1, __type="u8"), + E.start(current_time - 600, __type="u32"), + E.end(current_time + 600, __type="u32"), + ), + *[ + E.arena_reward( + E.index(unlock.index(mid), __type="s32"), + E.cube_num((unlock.index(mid) + 1) * 50, __type="s32"), + E.kind(0, __type="s32"), + E.value(mid, __type="str"), + ) + for mid in unlock + ], + *[ + E.arena_music_difficult( + E.play_style(sp_dp, __type="s32"), + E.arena_class(arena_class, __type="s32"), + E.low_difficult(8, __type="s32"), + E.high_difficult(12, __type="s32"), + E.is_leggendaria(1, __type="bool"), + E.force_music_list_id(0, __type="s32"), + ) + for sp_dp in (0, 1) + for arena_class in range(20) + ], + *[ + E.arena_cpu_define( + E.play_style(sp_dp, __type="s32"), + E.arena_class(arena_class, __type="s32"), + E.grade_id(18, __type="s32"), + E.low_music_difficult(8, __type="s32"), + E.high_music_difficult(12, __type="s32"), + E.is_leggendaria(0, __type="bool"), + ) + for sp_dp in (0, 1) + for arena_class in range(20) + ], + *[ + E.maching_class_range( + E.play_style(sp_dp, __type="s32"), + E.matching_class(arena_class, __type="s32"), + E.low_arena_class(arena_class, __type="s32"), + E.high_arena_class(arena_class, __type="s32"), + ) + for sp_dp in (0, 1) + for arena_class in range(20) + ], E.CommonBossPhase(val=0), - # E.Event1InternalPhase(val=0), + E.Event1Phase(val=0), # E.ExtraBossEventPhase(val=0), E.isNewSongAnother12OpenFlg(val=1), # E.gradeOpenPhase(val=2), - # E.isEiseiOpenFlg(val=1), - # E.WorldTourismOpenList(val=-1), + E.isKiwamiOpenFlg(val=1), + E.WorldTourismOpenList(val=-1), E.OldBPLBattleOpenPhase(val=3), ) ) diff --git a/modules/iidx/iidx31pc.py b/modules/iidx/iidx31pc.py index aa4a1a3..5fd4759 100644 --- a/modules/iidx/iidx31pc.py +++ b/modules/iidx/iidx31pc.py @@ -62,6 +62,7 @@ def calculate_folder_mask(profile): async def iidx31pc_get(request: Request): request_info = await core_process_request(request) game_version = request_info["game_version"] + date_code = int(request_info["ext"]) cid = request_info["root"][0].attrib["cid"] profile = get_game_profile(cid, game_version) @@ -219,7 +220,7 @@ async def iidx31pc_get(request: Request): profile["fullcombo"], 0, ], - __type="s16", + __type="s32" if date_code >= 2024011600 else "s16", ), E.tdjskin( [ @@ -301,6 +302,9 @@ async def iidx31pc_get(request: Request): E.flg1(profile.get("wt_flg1", [-1, -1, -1]), __type="s64"), E.flg2(profile.get("wt_flg2", [-1, -1, -1]), __type="s64"), ), + E.world_tourism_setting( + E.booster(1, __type="bool"), + ), E.world_tourism( *[ E.tour_data( @@ -340,6 +344,8 @@ async def iidx31pc_get(request: Request): play_style=0, arena_class=19, rating_value=90, + now_top_class_continuing=19, + best_top_class_continuing=19, win_count=0, now_winning_streak_count=0, best_winning_streak_count=0, @@ -351,6 +357,8 @@ async def iidx31pc_get(request: Request): play_style=1, arena_class=19, rating_value=90, + now_top_class_continuing=19, + best_top_class_continuing=19, win_count=0, now_winning_streak_count=0, best_winning_streak_count=0, @@ -399,10 +407,11 @@ async def iidx31pc_get(request: Request): rank4=3, rank5=1, ), - E.player_kind_data( - kind=(random.choice([random.randint(0, 13), 0])), - ), + #E.player_kind_data( + # kind=(random.choice([random.randint(0, 13), 0])), + #), E.setting( + E.hide_shopname(0, __type="bool"), stats_type=0, ), E.qpro_motion( @@ -424,6 +433,9 @@ async def iidx31pc_get(request: Request): E.nostalgia_open(), E.language_setting(language=profile["language_setting"]), E.movie_agreement(agreement_version=profile["movie_agreement"]), + E.movie_setting( + E.hide_name(0, __type="bool"), + ), E.bpl_virtual(), E.lightning_play_data( spnum=profile["lightning_play_data_spnum"], @@ -442,10 +454,14 @@ async def iidx31pc_get(request: Request): E.kac_entry_info( E.enable_kac_deller(), E.disp_kac_mark(), - E.open_kac_common_music(), - E.open_kac_new_a12_music(), E.is_kac_entry(), E.is_kac_evnet_entry(), + E.kac_secret_music( + E.music_info( + index=0, + music_id=1000, + ), + ), ), E.orb_data( rest_orb=100, diff --git a/utils/db/delete_monkey_user.py b/utils/db/delete_monkey_user.py new file mode 100644 index 0000000..0d2dc69 --- /dev/null +++ b/utils/db/delete_monkey_user.py @@ -0,0 +1,65 @@ +import argparse +import time +from os import stat +from shutil import copy + +from tinydb import TinyDB, where +from tinydb.middlewares import CachingMiddleware +from tinydb.storages import JSONStorage + + +def delete_scores(user_id, game): + for scores in (f"{game}_scores_best", f"{game}_scores", f"{game}_profile"): + if db.table(scores).search((where(f"{game}_id") == user_id)): + db.table(scores).remove((where(f"{game}_id") == user_id)) + + +# special case +def delete_gitadora_scores(user_id): + for scores in ( + "guitarfreaks_scores_best", + "drummania_scores_best", + "guitarfreaks_scores", + "drummania_scores", + "gitadora_profile", + ): + if db.table(scores).search((where("gitadora_id") == user_id)): + db.table(scores).remove((where("gitadora_id") == user_id)) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("-g", "--game", help="ex: ddr, gitadora, iidx", required=True) + parser.add_argument("-i", "--user_id", help="ex: 12345678", required=True) + args = parser.parse_args() + + storage = CachingMiddleware(JSONStorage) + storage.WRITE_CACHE_SIZE = 5000 + + infile = "db.json" + outfile = f"db_{round(time.time())}.json" + + copy(infile, outfile) + + db = TinyDB( + infile, + indent=2, + encoding="utf-8", + ensure_ascii=False, + storage=storage, + ) + + start_size = stat(infile).st_size + + game = args.game.lower() + user_id = int(args.user_id.replace("-", "")) + if game == "gitadora": + delete_gitadora_scores(user_id) + else: + delete_scores(user_id, game) + + db.close() + + end_size = stat(infile).st_size + + print(f"{infile} {round((start_size - end_size) / 1024 / 1024, 2)} MiB trimmed")