Add spoiler json output option

This commit is contained in:
2025-03-05 19:06:19 -06:00
parent 8ecf4e530a
commit 88224a5aca
3 changed files with 9 additions and 0 deletions

View File

@@ -144,6 +144,12 @@ def main(args, seed=None):
if args.create_spoiler and not args.jsonout:
world.spoiler.to_file(output_path('%s_Spoiler.txt' % outfilebase))
if args.json_spoiler:
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))
if not args.skip_playthrough:
logger.info('Calculating playthrough.')
create_playthrough(world)