From 9f94a372f0aabc2967efa38023086ca904f59c2d Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Fri, 5 Apr 2024 16:59:45 -0400 Subject: all: add reset breakables --- srb.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'srb.py') diff --git a/srb.py b/srb.py index 725ab88..3cbcd3d 100755 --- a/srb.py +++ b/srb.py @@ -53,6 +53,7 @@ parser.add_argument("--set-level",action="append",help="Set completion status, b parser.add_argument("--set-level-status",action="append",help="Set completion status for this level for profile. Example value to pass: \"0,general\"") parser.add_argument("--set-level-balloons",action="append",help="Set balloon status for this level for profile. Example value to pass: \"0,all\" or \"0,none\"") parser.add_argument("--set-level-letters",action="append",help="Set collected letters for level for profile. Examples: 0,all 15,none") +parser.add_argument("--reset-level-breakables",action="append",help="Reset breakables for these levels for profile. Can be used multiple times.") parser.add_argument("--get-levelset",help="Print status for this levelset for profile.") parser.add_argument("--set-levelset-completed-levels",action="append",help="Set number of completed levels in this levelset for profile.") parser.add_argument("--get-name",action="store_true",help="Print name for profile.") @@ -89,7 +90,7 @@ profile_id = args.profile #print(f"profile_id={profile_id}") # New actions that need --profile must be added here. -if not profile_id and (args.get_money or args.set_money or args.get_weapon or args.set_weapon or args.get_level or args.get_name or args.set_name or args.get_profile_in_use or args.get_purchased_weapons or args.get_tutorial_completed or args.add_purchased_weapons or args.remove_purchased_weapons or args.get_health or args.get_stunt or args.get_gun or args.set_health or args.set_stunt or args.set_gun or args.get_levelset or args.get_purchased_planes or args.add_purchased_planes or args.remove_purchased_planes or args.set_level_status or args.set_level_balloons or args.set_levelset_completed_levels or args.set_level_letters or args.unlock_everything or args.lock_everything or args.buy_everything or args.unbuy_everything or args.set_level or args.set_profile_in_use): +if not profile_id and (args.get_money or args.set_money or args.get_weapon or args.set_weapon or args.get_level or args.get_name or args.set_name or args.get_profile_in_use or args.get_purchased_weapons or args.get_tutorial_completed or args.add_purchased_weapons or args.remove_purchased_weapons or args.get_health or args.get_stunt or args.get_gun or args.set_health or args.set_stunt or args.set_gun or args.get_levelset or args.get_purchased_planes or args.add_purchased_planes or args.remove_purchased_planes or args.set_level_status or args.set_level_balloons or args.set_levelset_completed_levels or args.set_level_letters or args.unlock_everything or args.lock_everything or args.buy_everything or args.unbuy_everything or args.set_level or args.set_profile_in_use or args.reset_level_breakables): ferror("Warning: Cannot perform most actions without --profile. Not all tasks may run.") else: if args.get_money: @@ -260,6 +261,13 @@ else: else: #print(f"good?") srb_lib.write_file(args.file,0,data) + if args.reset_level_breakables: + for l in args.reset_level_breakables: + data, message = srb_lib.set_collected_breakables(args.file,profile_id,l) + if (type(data) == int and data == -1) or message != "": + ferror(f"Failed to reset {profile_id} level {l} breakables because {message}") + else: + srb_lib.write_file(args.file,0,data) if args.unlock_everything: data = srb_lib._get_data_from_data_object(args.file) # counting backwards helps the levelset completed levels count. -- cgit