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)
This commit is contained in:
aerinon
2020-04-09 17:02:40 -06:00
parent b86ffc3378
commit 8e7ed89723
3 changed files with 13 additions and 13 deletions

10
Main.py
View File

@@ -255,7 +255,7 @@ def main(args, seed=None, fish=None):
"mscb": mcsb_name, # 9 "mscb": mcsb_name, # 9
"retro": world.retro[player], # A "retro": world.retro[player], # A
"progressive": world.progressive, # B "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 # 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' % ( 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()})) print(json.dumps({**jsonout, 'spoiler': world.spoiler.to_json()}))
elif args.create_spoiler: elif args.create_spoiler:
logger.info(world.fish.translate("cli","cli","patching.spoiler")) logger.info(world.fish.translate("cli","cli","patching.spoiler"))
world.spoiler.to_file(output_path('%s_Spoiler.txt' % outfilebase)) if args.jsonout:
with open(output_path('%s_Spoiler.json' % outfilebase), 'w') as outfile: with open(output_path('%s_Spoiler.json' % outfilebase), 'w') as outfile:
outfile.write(world.spoiler.to_json()) outfile.write(world.spoiler.to_json())
else:
world.spoiler.to_file(output_path('%s_Spoiler.txt' % outfilebase))
YES = world.fish.translate("cli","cli","yes") YES = world.fish.translate("cli","cli","yes")
NO = world.fish.translate("cli","cli","no") NO = world.fish.translate("cli","cli","no")

2
Rom.py
View File

@@ -385,7 +385,7 @@ class Sprite(object):
@staticmethod @staticmethod
def default_link_sprite(): def default_link_sprite():
return Sprite(local_path('data/default.zspr')) return get_sprite_from_name('Link')
def decode8(self, pos): def decode8(self, pos):
arr = [[0 for _ in range(8)] for _ in range(8)] arr = [[0 for _ in range(8)] for _ in range(8)]

View File

@@ -35,8 +35,6 @@ def is_bundled():
return getattr(sys, 'frozen', False) return getattr(sys, 'frozen', False)
def local_path(path): def local_path(path):
return path
if local_path.cached_path is not None: if local_path.cached_path is not None:
return os.path.join(local_path.cached_path, path) return os.path.join(local_path.cached_path, path)
@@ -260,10 +258,10 @@ def update_deprecated_args(args):
if isinstance(argVars["hints"],dict): if isinstance(argVars["hints"],dict):
tmp = {} tmp = {}
for idx in range(1,len(argVars["hints"]) + 1): for idx in range(1,len(argVars["hints"]) + 1):
tmp[idx] = not argVars[src] in truthy # tmp = !src tmp[idx] = argVars[src] not in truthy # tmp = !src
args.hints = tmp # dest = tmp args.hints = tmp # dest = tmp
else: 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 # Don't do: No
# Do: Yes # Do: Yes
if "hints" in argVars: if "hints" in argVars:
@@ -271,10 +269,10 @@ def update_deprecated_args(args):
if isinstance(argVars["hints"],dict): if isinstance(argVars["hints"],dict):
tmp = {} tmp = {}
for idx in range(1,len(argVars["hints"]) + 1): for idx in range(1,len(argVars["hints"]) + 1):
tmp[idx] = not argVars[src] in truthy # tmp = !src tmp[idx] = argVars[src] not in truthy # tmp = !src
args.no_hints = tmp # dest = tmp args.no_hints = tmp # dest = tmp
else: 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 # Spoiler defaults to FALSE
# Don't do: No # Don't do: No