diff options
Diffstat (limited to 'srb.py')
-rwxr-xr-x | srb.py | 43 |
1 files changed, 41 insertions, 2 deletions
@@ -16,7 +16,7 @@ # make chart of level numbers, which ones have balloons # or --reset-level 5 (which zeros out all info about completion of that level) # --set-plane-health 1 (through 4) -# --set-plane-weapon 1 (through 4) +# --set-plane-weapon 1 (through 5) # --set-plane-stunt 1 (through 4) # --set-profile-name "asdbdf" @@ -54,6 +54,12 @@ 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.") parser.add_argument("--get-tutorial-completed",action="store_true",help="Print if profile has completed the tutorial.") parser.add_argument("--set-tutorial-completed",choices=["True","False"],help="Set tutorial-completed for profile.") +parser.add_argument("--get-health",action="store_true",help="Print stat health for profile.") +parser.add_argument("--set-health",type=int,choices=range(1,5),help="Set stat health for profile.") +parser.add_argument("--get-stunt",action="store_true",help="Print stat stunt for profile.") +parser.add_argument("--set-stunt",type=int,choices=range(1,5),help="Set stat stunt for profile.") +parser.add_argument("--get-gun",action="store_true",help="Print stat gun for profile.") +parser.add_argument("--set-gun",type=int,choices=range(1,6),help="Set stat gun for profile.") parser.add_argument("--checksum",action=argparse.BooleanOptionalAction,default=True,help="Correct checksum. Default is to do this. It happens at the end of everything else.") parser.add_argument("file",default="Profile 1.sav") args = parser.parse_args() @@ -72,7 +78,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): +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): ferror("Warning: Cannot perform most actions without --profile. Not all tasks may run.") else: if args.get_money: @@ -129,6 +135,39 @@ else: thisbool = False if args.set_tutorial_completed == "False" else True data, newstatus = srb_lib.set_tutorial_completed(args.file,profile_id,thisbool) srb_lib.write_file(args.file,0,data) + if args.get_health: + stat, message = srb_lib.get_plane_stat(args.file,profile_id,"health") + # error is printed in the function, so if not any error, run + if not (stat == -1 or message != ""): + print(f"Profile {profile_id} has health level {stat}") + if args.set_health: + data, message = srb_lib.set_plane_stat(args.file,profile_id,"health",args.set_health) + if data == -1 or message != "": + print(f"Failed to set health to {args.set_health} because {message}") + else: + srb_lib.write_file(args.file,0,data) + if args.get_stunt: + stat, message = srb_lib.get_plane_stat(args.file,profile_id,"stunt") + # error is printed in the function, so if not any error, run + if not (stat == -1 or message != ""): + print(f"Profile {profile_id} has stunt level {stat}") + if args.set_stunt: + data, message = srb_lib.set_plane_stat(args.file,profile_id,"stunt",args.set_stunt) + if data == -1 or message != "": + print(f"Failed to set stunt to {args.set_stunt} because {message}") + else: + srb_lib.write_file(args.file,0,data) + if args.get_gun: + stat, message = srb_lib.get_plane_stat(args.file,profile_id,"gun") + # error is printed in the function, so if not any error, run + if not (stat == -1 or message != ""): + print(f"Profile {profile_id} has gun level {stat}") + if args.set_gun: + data, message = srb_lib.set_plane_stat(args.file,profile_id,"gun",args.set_gun) + if data == -1 or message != "": + print(f"Failed to set gun to {args.set_gun} because {message}") + else: + srb_lib.write_file(args.file,0,data) if args.checksum: f = args.file |