Added new option to export pre-seed customizer template yaml
This commit is contained in:
5
CLI.py
5
CLI.py
@@ -34,7 +34,9 @@ def parse_cli(argv, no_defaults=False):
|
|||||||
parser.add_argument('--settingsfile', help="input json file of settings", type=str)
|
parser.add_argument('--settingsfile', help="input json file of settings", type=str)
|
||||||
parser.add_argument('--multi', default=defval(settings["multi"]), type=lambda value: min(max(int(value), 1), 255))
|
parser.add_argument('--multi', default=defval(settings["multi"]), type=lambda value: min(max(int(value), 1), 255))
|
||||||
parser.add_argument('--customizer', help='input yaml file for customizations', type=str)
|
parser.add_argument('--customizer', help='input yaml file for customizations', type=str)
|
||||||
parser.add_argument('--print_custom_yaml', help='print example yaml for current settings',
|
parser.add_argument('--print_template_yaml', help='print example yaml for current settings',
|
||||||
|
default=False, action="store_true")
|
||||||
|
parser.add_argument('--print_custom_yaml', help='print example plando yaml for current settings and placements',
|
||||||
default=False, action="store_true")
|
default=False, action="store_true")
|
||||||
parser.add_argument('--mystery', dest="mystery", default=False, action="store_true")
|
parser.add_argument('--mystery', dest="mystery", default=False, action="store_true")
|
||||||
|
|
||||||
@@ -94,6 +96,7 @@ def parse_cli(argv, no_defaults=False):
|
|||||||
parser.add_argument('--teams', default=defval(1), type=lambda value: max(int(value), 1))
|
parser.add_argument('--teams', default=defval(1), type=lambda value: max(int(value), 1))
|
||||||
parser.add_argument('--settingsfile', dest="filename", help="input json file of settings", type=str)
|
parser.add_argument('--settingsfile', dest="filename", help="input json file of settings", type=str)
|
||||||
parser.add_argument('--customizer', dest="customizer", help='input yaml file for customizations', type=str)
|
parser.add_argument('--customizer', dest="customizer", help='input yaml file for customizations', type=str)
|
||||||
|
parser.add_argument('--print_template_yaml', dest="print_template_yaml", default=False, action="store_true")
|
||||||
parser.add_argument('--print_custom_yaml', dest="print_custom_yaml", default=False, action="store_true")
|
parser.add_argument('--print_custom_yaml', dest="print_custom_yaml", default=False, action="store_true")
|
||||||
|
|
||||||
if player_num:
|
if player_num:
|
||||||
|
|||||||
4
Gui.py
4
Gui.py
@@ -45,8 +45,8 @@ def save_settings(gui, args, filename):
|
|||||||
os.makedirs(settings_path)
|
os.makedirs(settings_path)
|
||||||
output_args = {}
|
output_args = {}
|
||||||
settings = ["create_rom", "suppress_rom", "bps", "create_spoiler", "suppress_spoiler",
|
settings = ["create_rom", "suppress_rom", "bps", "create_spoiler", "suppress_spoiler",
|
||||||
"calc_playthrough", "skip_playthrough", "print_custom_yaml", "settingsonload",
|
"calc_playthrough", "skip_playthrough", "print_template_yaml", "print_custom_yaml",
|
||||||
"rom", "enemizercli", "outputpath"]
|
"settingsonload", "rom", "enemizercli", "outputpath"]
|
||||||
if filename == "settings.json":
|
if filename == "settings.json":
|
||||||
for s in settings:
|
for s in settings:
|
||||||
output_args[s] = args[s]
|
output_args[s] = args[s]
|
||||||
|
|||||||
24
Main.py
24
Main.py
@@ -183,8 +183,6 @@ def main(args, seed=None, fish=None):
|
|||||||
for player, name in enumerate(team, 1):
|
for player, name in enumerate(team, 1):
|
||||||
world.player_names[player].append(name)
|
world.player_names[player].append(name)
|
||||||
logger.info('')
|
logger.info('')
|
||||||
world.settings = CustomSettings()
|
|
||||||
world.settings.create_from_world(world, args)
|
|
||||||
|
|
||||||
outfilebase = f'OR_{args.outputname if args.outputname else world.seed}'
|
outfilebase = f'OR_{args.outputname if args.outputname else world.seed}'
|
||||||
|
|
||||||
@@ -210,6 +208,12 @@ def main(args, seed=None, fish=None):
|
|||||||
if item:
|
if item:
|
||||||
world.push_precollected(item)
|
world.push_precollected(item)
|
||||||
|
|
||||||
|
world.settings = CustomSettings()
|
||||||
|
world.settings.create_from_world(world, args)
|
||||||
|
|
||||||
|
if args.print_template_yaml:
|
||||||
|
world.settings.record_item_pool(world, True)
|
||||||
|
world.settings.write_to_file(output_path(f'{outfilebase}_template.yaml'))
|
||||||
if args.create_spoiler and not args.jsonout:
|
if args.create_spoiler 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'))
|
world.spoiler.meta_to_file(output_path(f'{outfilebase}_Spoiler.txt'))
|
||||||
@@ -227,9 +231,6 @@ def main(args, seed=None, fish=None):
|
|||||||
adjust_locations(world, player)
|
adjust_locations(world, player)
|
||||||
place_bosses(world, player)
|
place_bosses(world, player)
|
||||||
|
|
||||||
if args.print_custom_yaml:
|
|
||||||
world.settings.record_info(world)
|
|
||||||
|
|
||||||
if any(world.potshuffle.values()):
|
if any(world.potshuffle.values()):
|
||||||
logger.info(world.fish.translate("cli", "cli", "shuffling.pots"))
|
logger.info(world.fish.translate("cli", "cli", "shuffling.pots"))
|
||||||
for player in range(1, world.players + 1):
|
for player in range(1, world.players + 1):
|
||||||
@@ -247,8 +248,6 @@ def main(args, seed=None, fish=None):
|
|||||||
update_world_regions(world, player)
|
update_world_regions(world, player)
|
||||||
mark_light_dark_world_regions(world, player)
|
mark_light_dark_world_regions(world, player)
|
||||||
create_dynamic_exits(world, player)
|
create_dynamic_exits(world, player)
|
||||||
if args.print_custom_yaml:
|
|
||||||
world.settings.record_overworld(world)
|
|
||||||
|
|
||||||
init_districts(world)
|
init_districts(world)
|
||||||
|
|
||||||
@@ -262,8 +261,6 @@ def main(args, seed=None, fish=None):
|
|||||||
for player in range(1, world.players + 1):
|
for player in range(1, world.players + 1):
|
||||||
link_doors_prep(world, player)
|
link_doors_prep(world, player)
|
||||||
|
|
||||||
if args.print_custom_yaml:
|
|
||||||
world.settings.record_entrances(world)
|
|
||||||
create_item_pool_config(world)
|
create_item_pool_config(world)
|
||||||
|
|
||||||
logger.info(world.fish.translate("cli", "cli", "shuffling.dungeons"))
|
logger.info(world.fish.translate("cli", "cli", "shuffling.dungeons"))
|
||||||
@@ -271,8 +268,6 @@ def main(args, seed=None, fish=None):
|
|||||||
for player in range(1, world.players + 1):
|
for player in range(1, world.players + 1):
|
||||||
link_doors(world, player)
|
link_doors(world, player)
|
||||||
mark_light_dark_world_regions(world, player)
|
mark_light_dark_world_regions(world, player)
|
||||||
if args.print_custom_yaml:
|
|
||||||
world.settings.record_doors(world)
|
|
||||||
|
|
||||||
logger.info(world.fish.translate("cli", "cli", "generating.itempool"))
|
logger.info(world.fish.translate("cli", "cli", "generating.itempool"))
|
||||||
|
|
||||||
@@ -300,8 +295,6 @@ def main(args, seed=None, fish=None):
|
|||||||
lock_shop_locations(world, player)
|
lock_shop_locations(world, player)
|
||||||
|
|
||||||
massage_item_pool(world)
|
massage_item_pool(world)
|
||||||
if args.print_custom_yaml:
|
|
||||||
world.settings.record_item_pool(world)
|
|
||||||
logger.info(world.fish.translate("cli", "cli", "placing.dungeon.prizes"))
|
logger.info(world.fish.translate("cli", "cli", "placing.dungeon.prizes"))
|
||||||
|
|
||||||
fill_prizes(world)
|
fill_prizes(world)
|
||||||
@@ -351,6 +344,11 @@ def main(args, seed=None, fish=None):
|
|||||||
ensure_good_pots(world, True)
|
ensure_good_pots(world, True)
|
||||||
|
|
||||||
if args.print_custom_yaml:
|
if args.print_custom_yaml:
|
||||||
|
world.settings.record_info(world)
|
||||||
|
world.settings.record_overworld(world)
|
||||||
|
world.settings.record_entrances(world)
|
||||||
|
world.settings.record_doors(world)
|
||||||
|
world.settings.record_item_pool(world)
|
||||||
world.settings.record_item_placements(world)
|
world.settings.record_item_placements(world)
|
||||||
world.settings.write_to_file(output_path(f'{outfilebase}_custom.yaml'))
|
world.settings.write_to_file(output_path(f'{outfilebase}_custom.yaml'))
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,13 @@ This can also be used to roll a mystery or mutli-mystery seed via the GUI. [Exam
|
|||||||
|
|
||||||
The cli includes a couple arguments to help:
|
The cli includes a couple arguments to help:
|
||||||
|
|
||||||
|
`--print_template_yaml` will create a yaml file based on the settings used. This does not contain any seed specific information.
|
||||||
|
|
||||||
`--print_custom_yaml` will create a yaml file based on the seed rolled. Treat it like a spoiler.
|
`--print_custom_yaml` will create a yaml file based on the seed rolled. Treat it like a spoiler.
|
||||||
|
|
||||||
`--customizer` takes a file as an argument.
|
`--customizer` takes a file as an argument.
|
||||||
|
|
||||||
Present on the GUI as `Print Customizer File` and `Customizer File` on the Generation Setup tab.
|
Present on the GUI as `Print Customizer Template`, `Print Customizer File`, and `Customizer File` on the Generation Setup tab.
|
||||||
|
|
||||||
### meta
|
### meta
|
||||||
|
|
||||||
@@ -44,7 +46,7 @@ Start inventory is not supported here. It has a separate section.
|
|||||||
|
|
||||||
###### Not Yet Implemented
|
###### Not Yet Implemented
|
||||||
|
|
||||||
Rom/Adjust flags like sprite, quickswap are not outputing with the print_custom_yaml settings
|
Rom/Adjust flags like sprite, quickswap are not outputing with the print_template_yaml or print_custom_yaml settings
|
||||||
|
|
||||||
### item_pool
|
### item_pool
|
||||||
|
|
||||||
|
|||||||
@@ -234,6 +234,7 @@
|
|||||||
"randomizer.generation.createspoiler": "Create Spoiler Log",
|
"randomizer.generation.createspoiler": "Create Spoiler Log",
|
||||||
"randomizer.generation.createrom": "Create Patched ROM",
|
"randomizer.generation.createrom": "Create Patched ROM",
|
||||||
"randomizer.generation.calcplaythrough": "Calculate Playthrough",
|
"randomizer.generation.calcplaythrough": "Calculate Playthrough",
|
||||||
|
"randomizer.generation.print_template_yaml": "Print Customizer Template",
|
||||||
"randomizer.generation.print_custom_yaml": "Print Customizer File",
|
"randomizer.generation.print_custom_yaml": "Print Customizer File",
|
||||||
|
|
||||||
"randomizer.generation.settingsonload": "Settings On Load",
|
"randomizer.generation.settingsonload": "Settings On Load",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
"bps": { "type": "checkbox" },
|
"bps": { "type": "checkbox" },
|
||||||
"createspoiler": { "type": "checkbox" },
|
"createspoiler": { "type": "checkbox" },
|
||||||
"calcplaythrough": { "type": "checkbox" },
|
"calcplaythrough": { "type": "checkbox" },
|
||||||
|
"print_template_yaml":{ "type": "checkbox" },
|
||||||
"print_custom_yaml": { "type": "checkbox" }
|
"print_custom_yaml": { "type": "checkbox" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,10 +262,11 @@ class CustomSettings(object):
|
|||||||
self.world_rep['meta'] = meta_dict
|
self.world_rep['meta'] = meta_dict
|
||||||
meta_dict['players'] = world.players
|
meta_dict['players'] = world.players
|
||||||
meta_dict['algorithm'] = world.algorithm
|
meta_dict['algorithm'] = world.algorithm
|
||||||
meta_dict['seed'] = world.seed
|
|
||||||
meta_dict['race'] = settings.race
|
meta_dict['race'] = settings.race
|
||||||
meta_dict['user_notes'] = settings.notes
|
meta_dict['user_notes'] = settings.notes
|
||||||
self.world_rep['settings'] = settings_dict
|
self.world_rep['settings'] = settings_dict
|
||||||
|
if world.precollected_items:
|
||||||
|
self.world_rep['start_inventory'] = start_inv = {}
|
||||||
for p in self.player_range:
|
for p in self.player_range:
|
||||||
settings_dict[p] = {}
|
settings_dict[p] = {}
|
||||||
settings_dict[p]['ow_shuffle'] = world.owShuffle[p]
|
settings_dict[p]['ow_shuffle'] = world.owShuffle[p]
|
||||||
@@ -323,6 +324,10 @@ class CustomSettings(object):
|
|||||||
settings_dict[p]['triforce_goal'] = world.treasure_hunt_count[p]
|
settings_dict[p]['triforce_goal'] = world.treasure_hunt_count[p]
|
||||||
settings_dict[p]['triforce_pool'] = world.treasure_hunt_total[p]
|
settings_dict[p]['triforce_pool'] = world.treasure_hunt_total[p]
|
||||||
settings_dict[p]['beemizer'] = world.beemizer[p]
|
settings_dict[p]['beemizer'] = world.beemizer[p]
|
||||||
|
if world.precollected_items:
|
||||||
|
start_inv[p] = []
|
||||||
|
for item in world.precollected_items:
|
||||||
|
start_inv[item.player].append(item.name)
|
||||||
|
|
||||||
# rom adjust stuff
|
# rom adjust stuff
|
||||||
# settings_dict[p]['sprite'] = world.sprite[p]
|
# settings_dict[p]['sprite'] = world.sprite[p]
|
||||||
@@ -335,34 +340,42 @@ class CustomSettings(object):
|
|||||||
# settings_dict[p]['ow_palettes'] = world.ow_palettes[p]
|
# settings_dict[p]['ow_palettes'] = world.ow_palettes[p]
|
||||||
# settings_dict[p]['uw_palettes'] = world.uw_palettes[p]
|
# settings_dict[p]['uw_palettes'] = world.uw_palettes[p]
|
||||||
# settings_dict[p]['shuffle_sfx'] = world.shuffle_sfx[p]
|
# settings_dict[p]['shuffle_sfx'] = world.shuffle_sfx[p]
|
||||||
|
# settings_dict[p]['shuffle_songinstruments'] = world.shuffle_songinstruments[p]
|
||||||
# more settings?
|
# more settings?
|
||||||
|
|
||||||
def record_info(self, world):
|
def record_info(self, world):
|
||||||
|
self.world_rep['meta']['seed'] = world.seed
|
||||||
self.world_rep['bosses'] = bosses = {}
|
self.world_rep['bosses'] = bosses = {}
|
||||||
self.world_rep['start_inventory'] = start_inv = {}
|
self.world_rep['medallions'] = medallions = {}
|
||||||
for p in self.player_range:
|
for p in self.player_range:
|
||||||
bosses[p] = {}
|
bosses[p] = {}
|
||||||
start_inv[p] = []
|
medallions[p] = {}
|
||||||
for dungeon in world.dungeons:
|
for dungeon in world.dungeons:
|
||||||
for level, boss in dungeon.bosses.items():
|
for level, boss in dungeon.bosses.items():
|
||||||
location = dungeon.name if level is None else f'{dungeon.name} ({level})'
|
location = dungeon.name if level is None else f'{dungeon.name} ({level})'
|
||||||
if boss and 'Agahnim' not in boss.name:
|
if boss and 'Agahnim' not in boss.name:
|
||||||
bosses[dungeon.player][location] = boss.name
|
bosses[dungeon.player][location] = boss.name
|
||||||
for item in world.precollected_items:
|
|
||||||
start_inv[item.player].append(item.name)
|
|
||||||
|
|
||||||
def record_item_pool(self, world):
|
|
||||||
self.world_rep['item_pool'] = item_pool = {}
|
|
||||||
self.world_rep['medallions'] = medallions = {}
|
|
||||||
for p in self.player_range:
|
|
||||||
item_pool[p] = defaultdict(int)
|
|
||||||
medallions[p] = {}
|
|
||||||
for item in world.itempool:
|
|
||||||
item_pool[item.player][item.name] += 1
|
|
||||||
for p, req_medals in world.required_medallions.items():
|
for p, req_medals in world.required_medallions.items():
|
||||||
medallions[p]['Misery Mire'] = req_medals[0]
|
medallions[p]['Misery Mire'] = req_medals[0]
|
||||||
medallions[p]['Turtle Rock'] = req_medals[1]
|
medallions[p]['Turtle Rock'] = req_medals[1]
|
||||||
|
|
||||||
|
def record_item_pool(self, world, use_custom_pool=False):
|
||||||
|
if not use_custom_pool or world.custom:
|
||||||
|
self.world_rep['item_pool'] = item_pool = {}
|
||||||
|
for p in self.player_range:
|
||||||
|
if not use_custom_pool or p in world.customitemarray:
|
||||||
|
item_pool[p] = defaultdict(int)
|
||||||
|
if use_custom_pool and world.custom:
|
||||||
|
import source.classes.constants as CONST
|
||||||
|
for p in world.customitemarray:
|
||||||
|
for i, c in world.customitemarray[p].items():
|
||||||
|
if c > 0:
|
||||||
|
item = CONST.CUSTOMITEMLABELS[CONST.CUSTOMITEMS.index(i)]
|
||||||
|
item_pool[p][item] += c
|
||||||
|
else:
|
||||||
|
for item in world.itempool:
|
||||||
|
item_pool[item.player][item.name] += 1
|
||||||
|
|
||||||
def record_item_placements(self, world):
|
def record_item_placements(self, world):
|
||||||
self.world_rep['placements'] = placements = {}
|
self.world_rep['placements'] = placements = {}
|
||||||
for p in self.player_range:
|
for p in self.player_range:
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ SETTINGSTOPROCESS = {
|
|||||||
"createspoiler": "create_spoiler",
|
"createspoiler": "create_spoiler",
|
||||||
"createrom": "create_rom",
|
"createrom": "create_rom",
|
||||||
"calcplaythrough": "calc_playthrough",
|
"calcplaythrough": "calc_playthrough",
|
||||||
|
"print_template_yaml": "print_template_yaml",
|
||||||
"print_custom_yaml": "print_custom_yaml",
|
"print_custom_yaml": "print_custom_yaml",
|
||||||
"settingsonload": "settingsonload"
|
"settingsonload": "settingsonload"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user