aboutsummaryrefslogtreecommitdiff
path: root/srb.py
diff options
context:
space:
mode:
Diffstat (limited to 'srb.py')
-rwxr-xr-xsrb.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/srb.py b/srb.py
index f97e01b..81c8b5f 100755
--- a/srb.py
+++ b/srb.py
@@ -9,8 +9,8 @@
# delsum from github
# bgconf.py
-# WORKHERE: right now, this only just corrects any file. in the future, offer options like --take-plane all or --give-plane marcie
-# or --give-plane marcie or --set-rank-level 1,general --set-rank-level 1,none --set-rank-level all,general
+# WORKHERE:
+# or --set-rank-level 1,general --set-rank-level 1,none --set-rank-level all,general
# or --give-balloons-level 10 --take-balloons-level 11
# or --reset-level 5 (which zeros out all info about completion of that level)
@@ -39,9 +39,12 @@ parser.add_argument("--get-weapon",action="store_true",help="Print currently equ
#choices=[i for i in srb_lib.WEAPONS if i != "undefined"]+list(range(0,16))
#parser.add_argument("--set-weapon",choices=[i for i in srb_lib.WEAPONS if i != "undefined"],help="Print currently equipped weapon for profile.")
parser.add_argument("--set-weapon",help="Set currently equipped weapon for profile.")
-parser.add_argument("--get-purchased-weapons",action="store_true",help="Print currently purchased weapon for profile.")
+parser.add_argument("--get-purchased-weapons",action="store_true",help="Print currently purchased weapons for profile.")
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, remove (un-buy) these purchased weapons. Can be used multiple times.")
+parser.add_argument("--get-purchased-planes",action="store_true",help="Print currently purchased planes for profile.")
+parser.add_argument("--add-purchased-planes",action="append",help="For profile, add these purchased planes. Can be used multiple times.")
+parser.add_argument("--remove-purchased-planes",action="append",help="For profile, remove (un-buy) these purchased planes. 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.")
@@ -73,7 +76,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 or args.get_levelset):
+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):
ferror("Warning: Cannot perform most actions without --profile. Not all tasks may run.")
else:
if args.get_money:
@@ -165,6 +168,20 @@ else:
print(f"Failed to set gun to {args.set_gun} because {message}")
else:
srb_lib.write_file(args.file,0,data)
+ if args.get_purchased_planes:
+ print(f"Profile {profile_id} has planes {srb_lib.get_purchased_planes(args.file,profile_id)}")
+ if args.add_purchased_planes:
+ data, message = srb_lib.set_purchased_planes(args.file,profile_id,"add",args.add_purchased_planes)
+ if (type(data) == int and data == -1) or message != "":
+ ferror(f"Failed to add purchased planes {args.add_purchased_planes} because {message}")
+ else:
+ srb_lib.write_file(args.file,0,data)
+ if args.remove_purchased_planes:
+ data, message = srb_lib.set_purchased_planes(args.file,profile_id,"remove",args.remove_purchased_planes)
+ if (type(data) == int and data == -1) or message != "":
+ ferror(f"Failed to add purchased planes {args.remove_purchased_planes} because {message}")
+ else:
+ srb_lib.write_file(args.file,0,data)
if args.checksum:
f = args.file
bgstack15