From 8e7ed89723740cc18d365bc1faf617d9ba83f979 Mon Sep 17 00:00:00 2001 From: aerinon Date: Thu, 9 Apr 2020 17:02:40 -0600 Subject: [PATCH] Formatting Json spoiler tied to jsonout arg Fixed Default Link sprite button again Removed odd return from local_path (need to test this with bundle) --- Main.py | 10 ++++++---- Rom.py | 2 +- Utils.py | 14 ++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Main.py b/Main.py index bc81e977..dc41c279 100644 --- a/Main.py +++ b/Main.py @@ -255,7 +255,7 @@ def main(args, seed=None, fish=None): "mscb": mcsb_name, # 9 "retro": world.retro[player], # A "progressive": world.progressive, # B - "hints": str(world.hints[player]) # C + "hints": 'True' if world.hints[player] else 'False' # C } # 0 1 2 3 4 5 6 7 8 9 A B C outfilesuffix = ('_%s_%s-%s-%s-%s%s_%s_%s-%s%s%s%s%s' % ( @@ -303,9 +303,11 @@ def main(args, seed=None, fish=None): print(json.dumps({**jsonout, 'spoiler': world.spoiler.to_json()})) elif args.create_spoiler: logger.info(world.fish.translate("cli","cli","patching.spoiler")) - world.spoiler.to_file(output_path('%s_Spoiler.txt' % outfilebase)) - with open(output_path('%s_Spoiler.json' % outfilebase), 'w') as outfile: - outfile.write(world.spoiler.to_json()) + if args.jsonout: + with open(output_path('%s_Spoiler.json' % outfilebase), 'w') as outfile: + outfile.write(world.spoiler.to_json()) + else: + world.spoiler.to_file(output_path('%s_Spoiler.txt' % outfilebase)) YES = world.fish.translate("cli","cli","yes") NO = world.fish.translate("cli","cli","no") diff --git a/Rom.py b/Rom.py index 9ea459b1..62220043 100644 --- a/Rom.py +++ b/Rom.py @@ -385,7 +385,7 @@ class Sprite(object): @staticmethod def default_link_sprite(): - return Sprite(local_path('data/default.zspr')) + return get_sprite_from_name('Link') def decode8(self, pos): arr = [[0 for _ in range(8)] for _ in range(8)] diff --git a/Utils.py b/Utils.py index 964558a8..e0d21ff7 100644 --- a/Utils.py +++ b/Utils.py @@ -35,8 +35,6 @@ def is_bundled(): return getattr(sys, 'frozen', False) def local_path(path): - return path - if local_path.cached_path is not None: return os.path.join(local_path.cached_path, path) @@ -260,10 +258,10 @@ def update_deprecated_args(args): if isinstance(argVars["hints"],dict): tmp = {} for idx in range(1,len(argVars["hints"]) + 1): - tmp[idx] = not argVars[src] in truthy # tmp = !src - args.hints = tmp # dest = tmp + tmp[idx] = argVars[src] not in truthy # tmp = !src + args.hints = tmp # dest = tmp else: - args.hints = not args.no_hints in truthy # dest = !src + args.hints = args.no_hints not in truthy # dest = !src # Don't do: No # Do: Yes if "hints" in argVars: @@ -271,10 +269,10 @@ def update_deprecated_args(args): if isinstance(argVars["hints"],dict): tmp = {} for idx in range(1,len(argVars["hints"]) + 1): - tmp[idx] = not argVars[src] in truthy # tmp = !src - args.no_hints = tmp # dest = tmp + tmp[idx] = argVars[src] not in truthy # tmp = !src + args.no_hints = tmp # dest = tmp else: - args.no_hints = not args.hints in truthy # dest = !src + args.no_hints = args.hints not in truthy # dest = !src # Spoiler defaults to FALSE # Don't do: No