Skip to content

Commit 39de4e2

Browse files
authored
fix options on regen xd (ArchipelagoMW#20)
* fix options on regen xd * typing *shakes fist*
1 parent 75ba893 commit 39de4e2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

worlds/tracker/TrackerClient.py

+18
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
if typing.TYPE_CHECKING:
2727
from kvui import GameManager
28+
from argparse import Namespace
2829

2930
# webserver imports
3031
import urllib.parse
@@ -465,6 +466,19 @@ def _set_host_settings(self, host):
465466
'hide_excluded_locations']
466467

467468
def run_generator(self, slot_data: Optional[Dict] = None):
469+
def move_slots(args: "Namespace", slot_name: str):
470+
"""
471+
helper function to copy all the proper option values into slot 1,
472+
may need to change if/when multiworld.option_name dicts get fully removed
473+
"""
474+
player = {name: i for i, name in args.name.items()}[slot_name]
475+
if player == 1:
476+
return args
477+
for option_name, option_value in args._get_kwargs():
478+
if isinstance(option_value, Dict) and player in option_value:
479+
setattr(args, option_name, {1: option_value[player]})
480+
return args
481+
468482
try:
469483
host = get_settings()
470484
yaml_path, self.output_format, self.hide_excluded = self._set_host_settings(host)
@@ -487,6 +501,10 @@ def run_generator(self, slot_data: Optional[Dict] = None):
487501
g_args.multi = 1
488502
g_args.game = {1: self.game}
489503
g_args.player_ids = {1}
504+
505+
# TODO confirm that this will never not be filled
506+
g_args = move_slots(g_args, self.player_names.get(self.slot, None))
507+
490508
self.multiworld = self.TMain(g_args, seed)
491509
assert len(self.cached_slot_data) == len(self.cached_multiworlds)
492510
self.cached_multiworlds.append(self.multiworld)

0 commit comments

Comments
 (0)