Add json spoiler option
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@
|
|||||||
*.bmbp
|
*.bmbp
|
||||||
*.log
|
*.log
|
||||||
*_Spoiler.json
|
*_Spoiler.json
|
||||||
|
*_Meta.json
|
||||||
*_custom.yaml
|
*_custom.yaml
|
||||||
*_meta.txt
|
*_meta.txt
|
||||||
*.bps
|
*.bps
|
||||||
|
|||||||
@@ -2944,7 +2944,7 @@ class Spoiler(object):
|
|||||||
self.settings = {'settings'}
|
self.settings = {'settings'}
|
||||||
elif world.spoiler_mode == 'semi':
|
elif world.spoiler_mode == 'semi':
|
||||||
self.settings = {'settings', 'entrances', 'requirements', 'prizes'}
|
self.settings = {'settings', 'entrances', 'requirements', 'prizes'}
|
||||||
elif world.spoiler_mode == 'full':
|
elif world.spoiler_mode == 'full' or world.spoiler_mode == 'json':
|
||||||
self.settings = {'all'}
|
self.settings = {'all'}
|
||||||
elif world.spoiler_mode == 'debug':
|
elif world.spoiler_mode == 'debug':
|
||||||
self.settings = {'all', '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:
|
if world.spoiler_mode != 'none' and not args.jsonout:
|
||||||
logger.info(world.fish.translate("cli", "cli", "create.meta"))
|
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:
|
if args.mystery and not args.suppress_meta:
|
||||||
world.spoiler.mystery_meta_to_file(output_path(f'{outfilebase}_meta.txt'))
|
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:
|
if args.mystery and not args.suppress_meta:
|
||||||
world.spoiler.hashes_to_file(output_path(f'{outfilebase}_meta.txt'))
|
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'))
|
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"))
|
logger.info(world.fish.translate("cli", "cli", "patching.spoiler"))
|
||||||
world.spoiler.to_file(output_path(f'{outfilebase}_Spoiler.txt'))
|
world.spoiler.to_file(output_path(f'{outfilebase}_Spoiler.txt'))
|
||||||
if 'debug' in world.spoiler.settings:
|
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"))
|
logger.info(world.fish.translate("cli","cli","patching.spoiler"))
|
||||||
if args.jsonout:
|
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())
|
||||||
|
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":
|
elif world.players > 1 or world.logic[1] != "nologic":
|
||||||
world.spoiler.playthrough_to_file(output_path(f'{outfilebase}_Spoiler.txt'))
|
world.spoiler.playthrough_to_file(output_path(f'{outfilebase}_Spoiler.txt'))
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
"settings",
|
"settings",
|
||||||
"semi",
|
"semi",
|
||||||
"full",
|
"full",
|
||||||
"debug"
|
"debug",
|
||||||
|
"json"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mystery": {
|
"mystery": {
|
||||||
|
|||||||
Reference in New Issue
Block a user