Skip to content

Commit

Permalink
Merge branch 'ArchipelagoMW:main' into galaxy2
Browse files Browse the repository at this point in the history
  • Loading branch information
Joethepic authored Aug 1, 2023
2 parents 2adee64 + a9fb7e2 commit 8be2e6e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
6 changes: 4 additions & 2 deletions BaseClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,10 @@ def get_placeable_locations(self, state=None, player=None) -> List[Location]:
def get_unfilled_locations_for_players(self, location_names: List[str], players: Iterable[int]):
for player in players:
if not location_names:
location_names = [location.name for location in self.get_unfilled_locations(player)]
for location_name in location_names:
valid_locations = [location.name for location in self.get_unfilled_locations(player)]
else:
valid_locations = location_names
for location_name in valid_locations:
location = self._location_cache.get((location_name, player), None)
if location is not None and location.item is None:
yield location
Expand Down
12 changes: 9 additions & 3 deletions Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ def verify(self, world: typing.Type[World], player_name: str, plando_options: "P
f"Did you mean '{picks[0][0]}' ({picks[0][1]}% sure)")


class OptionDict(Option[typing.Dict[str, typing.Any]], VerifyKeys):
class OptionDict(Option[typing.Dict[str, typing.Any]], VerifyKeys, typing.Mapping[str, typing.Any]):
default: typing.Dict[str, typing.Any] = {}
supports_weighting = False

Expand All @@ -789,8 +789,14 @@ def from_any(cls, data: typing.Dict[str, typing.Any]) -> OptionDict:
def get_option_name(self, value):
return ", ".join(f"{key}: {v}" for key, v in value.items())

def __contains__(self, item):
return item in self.value
def __getitem__(self, item: str) -> typing.Any:
return self.value.__getitem__(item)

def __iter__(self) -> typing.Iterator[str]:
return self.value.__iter__()

def __len__(self) -> int:
return self.value.__len__()


class ItemDict(OptionDict):
Expand Down
26 changes: 26 additions & 0 deletions worlds/alttp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,32 @@ def get_pre_fill_items(self):
res.append(item)
return res

def fill_slot_data(self):
slot_data = {}
if not self.multiworld.is_race:
# all of these option are NOT used by the SNI- or Text-Client.
# they are used by the alttp-poptracker pack (https://github.com/StripesOO7/alttp-ap-poptracker-pack)
# for convenient auto-tracking of the generated settings and adjusting the tracker accordingly

slot_options = ["crystals_needed_for_gt", "crystals_needed_for_ganon", "open_pyramid",
"bigkey_shuffle", "smallkey_shuffle", "compass_shuffle", "map_shuffle",
"progressive", "swordless", "retro_bow", "retro_caves", "shop_item_slots",
"boss_shuffle", "pot_shuffle", "enemy_shuffle"]

slot_data = {option_name: getattr(self.multiworld, option_name)[self.player].value for option_name in slot_options}

slot_data.update({
'mode': self.multiworld.mode[self.player],
'goal': self.multiworld.goal[self.player],
'dark_room_logic': self.multiworld.dark_room_logic[self.player],
'mm_medalion': self.multiworld.required_medallions[self.player][0],
'tr_medalion': self.multiworld.required_medallions[self.player][1],
'shop_shuffle': self.multiworld.shop_shuffle[self.player],
'entrance_shuffle': self.multiworld.shuffle[self.player]
}
)
return slot_data


def get_same_seed(world, seed_def: tuple) -> str:
seeds: typing.Dict[tuple, str] = getattr(world, "__named_seeds", {})
Expand Down

0 comments on commit 8be2e6e

Please sign in to comment.