Add json spoiler option
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@
|
||||
*.bmbp
|
||||
*.log
|
||||
*_Spoiler.json
|
||||
*_Meta.json
|
||||
*_custom.yaml
|
||||
*_meta.txt
|
||||
*.bps
|
||||
|
||||
@@ -2944,7 +2944,7 @@ class Spoiler(object):
|
||||
self.settings = {'settings'}
|
||||
elif world.spoiler_mode == 'semi':
|
||||
self.settings = {'settings', 'entrances', 'requirements', 'prizes'}
|
||||
elif world.spoiler_mode == 'full':
|
||||
elif world.spoiler_mode == 'full' or world.spoiler_mode == 'json':
|
||||
self.settings = {'all'}
|
||||
elif world.spoiler_mode == 'debug':
|
||||
self.settings = {'all', 'debug'}
|
||||
|
||||
14
Main.py
14
Main.py
@@ -160,7 +160,8 @@ def main(args, seed=None, fish=None):
|
||||
|
||||
if world.spoiler_mode != 'none' and not args.jsonout:
|
||||
logger.info(world.fish.translate("cli", "cli", "create.meta"))
|
||||
world.spoiler.meta_to_file(output_path(f'{outfilebase}_Spoiler.txt'))
|
||||
if world.spoiler_mode != 'json':
|
||||
world.spoiler.meta_to_file(output_path(f'{outfilebase}_Spoiler.txt'))
|
||||
if args.mystery and not args.suppress_meta:
|
||||
world.spoiler.mystery_meta_to_file(output_path(f'{outfilebase}_meta.txt'))
|
||||
|
||||
@@ -363,9 +364,9 @@ def main(args, seed=None, fish=None):
|
||||
|
||||
if args.mystery and not args.suppress_meta:
|
||||
world.spoiler.hashes_to_file(output_path(f'{outfilebase}_meta.txt'))
|
||||
elif world.spoiler_mode != 'none' and not args.jsonout:
|
||||
elif world.spoiler_mode != 'none' and world.spoiler_mode != 'json' and not args.jsonout:
|
||||
world.spoiler.hashes_to_file(output_path(f'{outfilebase}_Spoiler.txt'))
|
||||
if world.spoiler_mode != 'none' and not args.jsonout:
|
||||
if world.spoiler_mode != 'none' and world.spoiler_mode != 'json' and not args.jsonout:
|
||||
logger.info(world.fish.translate("cli", "cli", "patching.spoiler"))
|
||||
world.spoiler.to_file(output_path(f'{outfilebase}_Spoiler.txt'))
|
||||
if 'debug' in world.spoiler.settings:
|
||||
@@ -385,7 +386,12 @@ def main(args, seed=None, fish=None):
|
||||
logger.info(world.fish.translate("cli","cli","patching.spoiler"))
|
||||
if args.jsonout:
|
||||
with open(output_path('%s_Spoiler.json' % outfilebase), 'w') as outfile:
|
||||
outfile.write(world.spoiler.to_json())
|
||||
outfile.write(world.spoiler.to_json())
|
||||
elif world.spoiler_mode == 'json':
|
||||
with open(output_path('%s_Spoiler.json' % outfilebase), 'w') as outfile:
|
||||
outfile.write(world.spoiler.to_json())
|
||||
with open(output_path('%s_Meta.json' % outfilebase), 'w') as outfile:
|
||||
outfile.write(json.dumps(world.spoiler.metadata))
|
||||
elif world.players > 1 or world.logic[1] != "nologic":
|
||||
world.spoiler.playthrough_to_file(output_path(f'{outfilebase}_Spoiler.txt'))
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"settings",
|
||||
"semi",
|
||||
"full",
|
||||
"debug"
|
||||
"debug",
|
||||
"json"
|
||||
]
|
||||
},
|
||||
"mystery": {
|
||||
|
||||
Reference in New Issue
Block a user