Spoiler refactor

This commit is contained in:
aerinon
2022-06-17 14:36:51 -06:00
parent b938bef8fa
commit 8d140c9bf8
3 changed files with 163 additions and 79 deletions

21
Main.py
View File

@@ -130,6 +130,8 @@ def main(args, seed=None, fish=None):
world.player_names[player].append(name)
logger.info('')
outfilebase = f'DR_{args.outputname if args.outputname else world.seed}'
for player in range(1, world.players + 1):
world.difficulty_requirements[player] = difficulties[world.difficulty[player]]
@@ -143,6 +145,13 @@ def main(args, seed=None, fish=None):
if item:
world.push_precollected(item)
if args.create_spoiler 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 args.mystery:
world.spoiler.mystery_meta_to_file(output_path(f'{outfilebase}_meta.txt'))
for player in range(1, world.players + 1):
if world.mode[player] != 'inverted':
create_regions(world, player)
else:
@@ -258,8 +267,6 @@ def main(args, seed=None, fish=None):
balance_money_progression(world)
ensure_good_pots(world, True)
outfilebase = f'DR_{args.outputname if args.outputname else world.seed}'
rom_names = []
jsonout = {}
enemized = False
@@ -334,6 +341,14 @@ def main(args, seed=None, fish=None):
with open(output_path('%s_multidata' % outfilebase), 'wb') as f:
f.write(multidata)
if args.mystery:
world.spoiler.hashes_to_file(output_path(f'{outfilebase}_meta.txt'))
elif args.create_spoiler and not args.jsonout:
world.spoiler.hashes_to_file(output_path(f'{outfilebase}_Spoiler.txt'))
if args.create_spoiler and not args.jsonout:
logger.info(world.fish.translate("cli", "cli", "patching.spoiler"))
world.spoiler.to_file(output_path(f'{outfilebase}_Spoiler.txt'))
if not args.skip_playthrough:
logger.info(world.fish.translate("cli","cli","calc.playthrough"))
create_playthrough(world)
@@ -346,7 +361,7 @@ def main(args, seed=None, fish=None):
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))
world.spoiler.playthrough_to_file(output_path(f'{outfilebase}_Spoiler.txt'))
YES = world.fish.translate("cli","cli","yes")
NO = world.fish.translate("cli","cli","no")