From cc820c07dcdbb729dc948c6ae30fb1d17d2695e3 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Tue, 12 Mar 2024 22:11:46 -0400 Subject: worked on levels and levelsets --- srb.py | 5 +- srb_lib.py | 180 ++++++++++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 141 insertions(+), 44 deletions(-) diff --git a/srb.py b/srb.py index 01974f8..e762b72 100755 --- a/srb.py +++ b/srb.py @@ -49,6 +49,7 @@ parser.add_argument("--get-purchased-weapons",action="store_true",help="Print cu parser.add_argument("--add-purchased-weapons",action="append",help="For profile, add these purchased weapons. Can be used multiple times.") parser.add_argument("--remove-purchased-weapons",action="append",help="For profile, add these purchased weapons. Can be used multiple times.") parser.add_argument("--get-level",help="Print status for this level for profile.") +parser.add_argument("--get-levelset",help="Print status for this levelset for profile.") parser.add_argument("--get-name",action="store_true",help="Print name for profile.") parser.add_argument("--set-name",help="Set name for profile.") parser.add_argument("--get-profile-in-use",action="store_true",help="Print if profile is in use.") @@ -78,7 +79,7 @@ profile_id = args.profile #print(f"profile_id={profile_id}") # WORKHERE: 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): +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): ferror("Warning: Cannot perform most actions without --profile. Not all tasks may run.") else: if args.get_money: @@ -105,6 +106,8 @@ else: srb_lib.write_file(args.file,0,data) if args.get_level: print(f"Profile {profile_id} has level {args.get_level} status {srb_lib.get_level_status(args.file,profile_id,args.get_level)}") + if args.get_levelset: + print(f"Profile {profile_id} has levelset {args.get_levelset} status {srb_lib.get_levelset_status(args.file,profile_id,args.get_levelset)}") if args.get_name: print(f"Profile {profile_id} has name {srb_lib.get_name(args.file,profile_id)}") if args.set_name: diff --git a/srb_lib.py b/srb_lib.py index 9e82ca4..3873a26 100644 --- a/srb_lib.py +++ b/srb_lib.py @@ -26,12 +26,16 @@ srb_lib_version = "20240311a" # money is 0x270 bytes after the "Z