From c0c3204fd50953f6f580b998d5fdbb026af5d205 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sat, 29 Jul 2023 05:10:47 -0500 Subject: [PATCH] Notes field --- BaseClasses.py | 6 +++++- 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, 14 insertions(+), 5 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 3663a962..3d97414b 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -2501,7 +2501,9 @@ class Spoiler(object): 'triforcegoal': self.world.treasure_hunt_count, 'triforcepool': self.world.treasure_hunt_total, 'race': self.world.settings.world_rep['meta']['race'], - 'code': {p: Settings.make_code(self.world, p) for p in range(1, self.world.players + 1)} + '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 } for p in range(1, self.world.players + 1): @@ -2642,6 +2644,8 @@ class Spoiler(object): self.parse_meta() with open(filename, 'w') as outfile: outfile.write('ALttP Dungeon Randomizer Version %s - Seed: %s\n\n' % (self.metadata['version'], self.world.seed)) + if self.metadata['user_notes']: + outfile.write('User Notes: %s\n' % self.metadata['user_notes']) outfile.write('Filling Algorithm: %s\n' % self.world.algorithm) outfile.write('Players: %d\n' % self.world.players) outfile.write('Teams: %d\n' % self.world.teams) diff --git a/CLI.py b/CLI.py index 2c925c6c..8f790ed8 100644 --- a/CLI.py +++ b/CLI.py @@ -346,7 +346,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 dd5ebc3e..7c124808 100644 --- a/Main.py +++ b/Main.py @@ -172,7 +172,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'DR_{args.outputname if args.outputname else world.seed}' diff --git a/docs/customizer_example.yaml b/docs/customizer_example.yaml index 76514990..acdf5188 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 2eaf847e..bdc6b4db 100644 --- a/resources/app/cli/args.json +++ b/resources/app/cli/args.json @@ -513,5 +513,6 @@ ] }, "outputname": {}, + "notes": {}, "code": {} } diff --git a/source/classes/CustomSettings.py b/source/classes/CustomSettings.py index a0cea069..c0e82eed 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: @@ -214,14 +215,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] = {}