From 35f3abc1c1041d69aee2ebe8e9bf23430923f422 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sat, 29 Jul 2023 05:10:47 -0500 Subject: [PATCH] Creating user notes field to be supplied by the seed roller --- BaseClasses.py | 3 +++ CLI.py | 3 ++- Main.py | 2 +- docs/customizer_example.yaml | 1 + resources/app/cli/args.json | 1 + source/classes/CustomSettings.py | 6 ++++-- 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index d6ac2c28..c79eb691 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -2898,6 +2898,7 @@ class Spoiler(object): 'triforcegoal': self.world.treasure_hunt_count, 'triforcepool': self.world.treasure_hunt_total, 'race': self.world.settings.world_rep['meta']['race'], + 'user_notes': self.world.settings.world_rep['meta']['user_notes'], 'code': {p: Settings.make_code(self.world, p) for p in range(1, self.world.players + 1)}, 'seed': self.world.seed } @@ -3047,6 +3048,8 @@ class Spoiler(object): outfile.write('ALttP Overworld Randomizer - Seed: %s\n\n' % (self.world.seed)) for k,v in self.metadata["versions"].items(): outfile.write((k + ' Version:').ljust(line_width) + '%s\n' % v) + if self.metadata['user_notes']: + outfile.write('User Notes:'.ljust(line_width) + '%s\n' % self.metadata['user_notes']) outfile.write('Filling Algorithm:'.ljust(line_width) + '%s\n' % self.world.algorithm) outfile.write('Players:'.ljust(line_width) + '%d\n' % self.world.players) outfile.write('Teams:'.ljust(line_width) + '%d\n' % self.world.teams) diff --git a/CLI.py b/CLI.py index b554d20f..1249f89b 100644 --- a/CLI.py +++ b/CLI.py @@ -355,7 +355,8 @@ def parse_settings(): "outputpath": os.path.join("."), "saveonexit": "ask", "outputname": "", - "startinventoryarray": {} + "startinventoryarray": {}, + "notes": "" } if sys.platform.lower().find("windows"): diff --git a/Main.py b/Main.py index 3d8d46e3..449d7977 100644 --- a/Main.py +++ b/Main.py @@ -183,7 +183,7 @@ def main(args, seed=None, fish=None): world.player_names[player].append(name) logger.info('') world.settings = CustomSettings() - world.settings.create_from_world(world, args.race) + world.settings.create_from_world(world, args) outfilebase = f'OR_{args.outputname if args.outputname else world.seed}' diff --git a/docs/customizer_example.yaml b/docs/customizer_example.yaml index 82505821..4c31cb7e 100644 --- a/docs/customizer_example.yaml +++ b/docs/customizer_example.yaml @@ -3,6 +3,7 @@ meta: players: 1 seed: 41 # note to self: seed 42 had an interesting Swamp Palace problem names: Lonk + notes: "Some notes specified by the user" settings: 1: door_shuffle: basic diff --git a/resources/app/cli/args.json b/resources/app/cli/args.json index 08ccec98..75456d19 100644 --- a/resources/app/cli/args.json +++ b/resources/app/cli/args.json @@ -576,5 +576,6 @@ ] }, "outputname": {}, + "notes": {}, "code": {} } \ No newline at end of file diff --git a/source/classes/CustomSettings.py b/source/classes/CustomSettings.py index 5d02ca14..99972d7f 100644 --- a/source/classes/CustomSettings.py +++ b/source/classes/CustomSettings.py @@ -63,6 +63,7 @@ class CustomSettings(object): args.suppress_rom = get_setting(meta['suppress_rom'], args.suppress_rom) args.names = get_setting(meta['names'], args.names) args.race = get_setting(meta['race'], args.race) + args.notes = get_setting(meta['user_notes'], args.notes) self.player_range = range(1, args.multi + 1) if 'settings' in self.file_source: for p in self.player_range: @@ -227,14 +228,15 @@ class CustomSettings(object): return self.file_source['drops'] return None - def create_from_world(self, world, race): + def create_from_world(self, world, settings): self.player_range = range(1, world.players + 1) settings_dict, meta_dict = {}, {} self.world_rep['meta'] = meta_dict meta_dict['players'] = world.players meta_dict['algorithm'] = world.algorithm meta_dict['seed'] = world.seed - meta_dict['race'] = race + meta_dict['race'] = settings.race + meta_dict['user_notes'] = settings.notes self.world_rep['settings'] = settings_dict for p in self.player_range: settings_dict[p] = {}