BaseClasses¶
- class BaseClasses.CollectionState(parent: MultiWorld, allow_partial_entrances: bool = False)¶
Bases:
object
- additional_copy_functions: List[Callable[[CollectionState, CollectionState], CollectionState]] = []¶
- additional_init_functions: List[Callable[[CollectionState, MultiWorld], None]] = []¶
- allow_partial_entrances: bool¶
- can_reach(spot: Location | Entrance | Region | str, resolution_hint: str | None = None, player: int | None = None) bool ¶
- can_reach_entrance(spot: str, player: int) bool ¶
- can_reach_location(spot: str, player: int) bool ¶
- can_reach_region(spot: str, player: int) bool ¶
- copy() CollectionState ¶
- count(item: str, player: int) int ¶
- count_from_list(items: Iterable[str], player: int) int ¶
Returns the cumulative count of items from a list present in state.
- count_from_list_unique(items: Iterable[str], player: int) int ¶
Returns the cumulative count of items from a list present in state. Ignores duplicates of the same item.
- count_group(item_name_group: str, player: int) int ¶
Returns the cumulative count of items from an item group present in state.
- count_group_unique(item_name_group: str, player: int) int ¶
Returns the cumulative count of items from an item group present in state. Ignores duplicates of the same item.
- has(item: str, player: int, count: int = 1) bool ¶
- has_all(items: Iterable[str], player: int) bool ¶
Returns True if each item name of items is in state at least once.
- has_all_counts(item_counts: Mapping[str, int], player: int) bool ¶
Returns True if each item name is in the state at least as many times as specified.
- has_any(items: Iterable[str], player: int) bool ¶
Returns True if at least one item name of items is in state at least once.
- has_any_count(item_counts: Mapping[str, int], player: int) bool ¶
Returns True if at least one item name is in the state at least as many times as specified.
- has_from_list(items: Iterable[str], player: int, count: int) bool ¶
Returns True if the state contains at least count items matching any of the item names from a list.
- has_from_list_unique(items: Iterable[str], player: int, count: int) bool ¶
Returns True if the state contains at least count items matching any of the item names from a list. Ignores duplicates of the same item.
- has_group(item_name_group: str, player: int, count: int = 1) bool ¶
Returns True if the state contains at least count items present in a specified item group.
- has_group_unique(item_name_group: str, player: int, count: int = 1) bool ¶
Returns True if the state contains at least count items present in a specified item group. Ignores duplicates of the same item.
- multiworld: MultiWorld¶
- prog_items: Dict[int, Counter[str]]¶
- stale: Dict[int, bool]¶
- update_reachable_regions(player: int)¶
- class BaseClasses.Entrance(player: int, name: str = '', parent: Region | None = None, randomization_group: int = 0, randomization_type: EntranceType = EntranceType.ONE_WAY)¶
Bases:
object
- static access_rule(state)¶
- can_connect_to(other: Entrance, dead_end: bool, er_state: ERPlacementState) bool ¶
Determines whether a given Entrance is a valid target transition, that is, whether the entrance randomizer is allowed to pair this Entrance to that Entrance. By default, only allows connection between entrances of the same type (one ways only go to one ways, two ways always go to two ways) and prevents connecting an exit to itself in coupled mode.
- Parameters:
other – The proposed Entrance to connect to
dead_end – Whether the other entrance considered a dead end by Entrance randomization
er_state – The current (partial) state of the ongoing entrance randomization
- can_reach(state: CollectionState) bool ¶
- hide_path: bool = False¶
- is_valid_source_transition(er_state: ERPlacementState) bool ¶
Determines whether this is a valid source transition, that is, whether the entrance randomizer is allowed to pair it to place any other regions. By default, this is the same as a reachability check, but can be modified by Entrance implementations to add other restrictions based on the placement state.
- Parameters:
er_state – The current (partial) state of the ongoing entrance randomization
- name: str¶
- player: int¶
- randomization_group: int¶
- randomization_type: EntranceType¶
- class BaseClasses.EntranceInfo¶
Bases:
TypedDict
- direction: str¶
- entrance: str¶
- exit: str¶
- player: int¶
- class BaseClasses.Group¶
Bases:
TypedDict
- game: str¶
- item_pool: NotRequired[Set[str]]¶
- link_replacement: NotRequired[bool]¶
- local_items: NotRequired[Set[str]]¶
- name: str¶
- non_local_items: NotRequired[Set[str]]¶
- players: AbstractSet[int]¶
- replacement_items: NotRequired[Dict[int, str | None]]¶
- world: 'AutoWorld.World'¶
- class BaseClasses.Item(name: str, classification: ItemClassification, code: int | None, player: int)¶
Bases:
object
- property advancement: bool¶
- classification: ItemClassification¶
- code: int | None¶
an item with code None is called an Event, and does not get written to multidata
- property excludable: bool¶
- property filler: bool¶
- property flags: int¶
- game: str = 'Generic'¶
- property hint_text: str¶
- property is_event: bool¶
- name: str¶
- property pedestal_hint_text: str¶
- player: int¶
- property skip_in_prog_balancing: bool¶
- property trap: bool¶
- property useful: bool¶
- class BaseClasses.ItemClassification(*values)¶
Bases:
IntFlag
- as_flag() int ¶
As Network API flag int.
- filler = 0¶
aka trash, as in filler items like ammo, currency etc
- progression = 1¶
Item that is logically relevant. Protects this item from being placed on excluded or unreachable locations.
- progression_skip_balancing = 9¶
- skip_balancing = 8¶
should technically never occur on its own Item that is logically relevant, but progression balancing should not touch. Typically currency or other counted items.
- trap = 4¶
Item that is detrimental in some way.
- useful = 2¶
Item that is especially useful. Protects this item from being placed on excluded or unreachable locations. When combined with another flag like “progression”, it means “an especially useful progression item”.
- class BaseClasses.Location(player: int, name: str = '', address: int | None = None, parent: Region | None = None)¶
Bases:
object
- static access_rule(state)¶
- address: int | None¶
- property advancement: bool¶
- static always_allow(state, item)¶
- can_fill(state: CollectionState, item: Item, check_access: bool = True) bool ¶
- can_reach(state: CollectionState) bool ¶
- game: str = 'Generic'¶
- property hint_text: str¶
- property is_event: bool¶
Returns True if the address of this location is None, denoting it is an Event Location.
- static item_rule(item)¶
- locked: bool = False¶
- name: str¶
- property native_item: bool¶
Returns True if the item in this location matches game.
- player: int¶
- progress_type: LocationProgressType = 1¶
- show_in_spoiler: bool = True¶
- class BaseClasses.LocationProgressType(*values)¶
Bases:
IntEnum
- DEFAULT = 1¶
- EXCLUDED = 3¶
- PRIORITY = 2¶
- class BaseClasses.MultiWorld(players: int)¶
Bases:
object
- class AttributeProxy(rule)¶
Bases:
object
- add_group(name: str, game: str, players: AbstractSet[int] = frozenset({})) Tuple[int, Group] ¶
Create a group with name and return the assigned player ID and group. If a group of this name already exists, the set of players is extended instead of creating a new one.
- can_beat_game(starting_state: CollectionState | None = None) bool ¶
- completion_condition: Dict[int, Callable[[CollectionState], bool]]¶
- debug_types = False¶
- early_items: Dict[int, Dict[str, int]]¶
- exclude_locations: Dict[int, Options.ExcludeLocations]¶
- find_items_in_locations(items: Set[str], player: int, resolve_group_locations: bool = False) List[Location] ¶
- fulfills_accessibility(state: CollectionState | None = None)¶
Check if accessibility rules are fulfilled with current or supplied state.
- game: Dict[int, str]¶
- get_all_ids() Tuple[int, ...] ¶
- get_all_state(use_cache: bool, allow_partial_entrances: bool = False) CollectionState ¶
- get_file_safe_player_name(player: int) str ¶
- get_game_groups(game_name: str) Tuple[int, ...] ¶
- get_game_players(game_name: str) Tuple[int, ...] ¶
- get_game_worlds(game_name: str)¶
- get_name_string_for_object(obj: HasNameAndPlayer) str ¶
- get_out_file_name_base(player: int) str ¶
the base name (without file extension) for each player’s output file for a seed
- get_player_groups(player: int) Set[int] ¶
- get_player_name(player: int) str ¶
- get_reachable_locations(state: CollectionState | None = None, player: int | None = None) List[Location] ¶
- get_sendable_spheres() Iterator[Set[Location]] ¶
yields a set of multiserver sendable locations (location.item.code: int) for each logical sphere
If there are unreachable locations, the last sphere of reachable locations is followed by an empty set, and then a set of all of the unreachable locations.
- get_spheres() Iterator[Set[Location]] ¶
yields a set of locations for each logical sphere
If there are unreachable locations, the last sphere of reachable locations is followed by an empty set, and then a set of all of the unreachable locations.
- get_unfilled_locations_for_players(location_names: List[str], players: Iterable[int])¶
- has_beaten_game(state: CollectionState, player: int | None = None) bool ¶
- is_race: bool = False¶
- item_links: Dict[int, Options.ItemLinks]¶
- link_items() None ¶
Called to link together items in the itempool related to the registered item link groups.
- local_early_items: Dict[int, Dict[str, int]]¶
- local_items: Dict[int, Options.LocalItems]¶
- non_local_items: Dict[int, Options.NonLocalItems]¶
- per_slot_randoms: Utils.DeprecateDict[int, random.Random]¶
Deprecated. Please use self.random instead.
- plando_connections: List¶
- plando_items: List[List[Dict[str, Any]]]¶
- plando_options: PlandoOptions¶
- plando_texts: List[Dict[str, str]]¶
- property player_ids: Tuple[int, ...]¶
- player_name: Dict[int, str]¶
- priority_locations: Dict[int, Options.PriorityLocations]¶
- progression_balancing: Dict[int, Options.ProgressionBalancing]¶
- random: random.Random¶
- regions: RegionManager¶
- register_indirect_condition(region: Region, entrance: Entrance)¶
Report that access to this Region can result in unlocking this Entrance, state.can_reach(Region) in the Entrance’s traversal condition, as opposed to pure transition logic.
- secure()¶
- set_item_links()¶
- set_options(args: Namespace) None ¶
- set_seed(seed: int | None = None, secure: bool = False, name: str | None = None)¶
- start_hints: Dict[int, Options.StartHints]¶
- start_inventory: Dict[int, Options.StartInventory]¶
- start_location_hints: Dict[int, Options.StartLocationHints]¶
- state: CollectionState¶
- property world_name_lookup¶
- worlds: Dict[int, 'AutoWorld.World']¶
- class BaseClasses.PlandoOptions(*values)¶
Bases:
IntFlag
- bosses = 8¶
- connections = 2¶
- classmethod from_option_string(option_string: str) PlandoOptions ¶
- classmethod from_set(option_set: Set[str]) PlandoOptions ¶
- items = 1¶
- none = 0¶
- texts = 4¶
- class BaseClasses.Region(name: str, player: int, multiworld: MultiWorld, hint: str | None = None)¶
Bases:
object
- class EntranceRegister(region_manager: RegionManager)¶
Bases:
Register
- class LocationRegister(region_manager: RegionManager)¶
Bases:
Register
- class Register(region_manager: RegionManager)¶
Bases:
MutableSequence
- copy()¶
- region_manager: RegionManager¶
- add_exits(exits: Iterable[str] | Dict[str, str | None], rules: Dict[str, Callable[[CollectionState], bool]] = None) List[Entrance] ¶
Connects current region to regions in exit dictionary. Passed region names must exist first.
- Parameters:
exits – exits from the region. format is {“connecting_region”: “exit_name”}. if a non dict is provided,
created entrances will be named “self.name -> connecting_region” :param rules: rules for the exits from this region. format is {“connecting_region”, rule}
- add_locations(locations: Dict[str, int | None], location_type: type[Location] | None = None) None ¶
Adds locations to the Region object, where location_type is your Location class and locations is a dict of location names to address.
- Parameters:
locations – dictionary of locations to be created and added to this Region {name: ID}
location_type – Location class to be used to create the locations with
- can_reach(state: CollectionState) bool ¶
- connect(connecting_region: Region, name: str | None = None, rule: Callable[[CollectionState], bool] | None = None) Entrance ¶
Connects this Region to another Region, placing the provided rule on the connection.
- Parameters:
connecting_region – Region object to connect to path is self -> exiting_region
name – name of the connection being created
rule – callable to determine access of this connection to go from self to the exiting_region
- create_er_target(name: str) Entrance ¶
Creates and returns an Entrance object as an entrance to this region
- Parameters:
name – name of the Entrance being created
- create_exit(name: str) Entrance ¶
Creates and returns an Entrance object as an exit of this region.
- Parameters:
name – name of the Entrance being created
- property exits¶
- get_exits()¶
- get_locations()¶
- property hint_text: str¶
- property locations¶
- multiworld: MultiWorld | None¶
- name: str¶
- player: int¶
- set_exits(new)¶
- set_locations(new)¶
- class BaseClasses.Spoiler(multiworld: MultiWorld)¶
Bases:
object
- create_paths(state: CollectionState, collection_spheres: List[Set[Location]]) None ¶
- create_playthrough(create_paths: bool = True) None ¶
Destructive to the multiworld while it is run, damage gets repaired afterwards.
- entrances: Dict[Tuple[str, str, int], EntranceInfo]¶
- hashes: Dict[int, str]¶
- multiworld: MultiWorld¶
- paths: Dict[str, List[Tuple[str, str] | Tuple[str, None]]]¶
- playthrough: Dict[str, List[str] | Dict[str, str]]¶
- set_entrance(entrance: str, exit_: str, direction: str, player: int) None ¶
- to_file(filename: str) None ¶
- class BaseClasses.ThreadBarrierProxy(obj: object)¶
Bases:
object
Passes through getattr while passthrough is True
- class BaseClasses.Tutorial(tutorial_name: str, description: str, language: str, file_name: str, link: str, authors: List[str])¶
Bases:
NamedTuple
Class to build website tutorial pages from a .md file in the world’s /docs folder. Order is as follows. Name of the tutorial as it will appear on the site. Concise description covering what the guide will entail. Language the guide is written in. Name of the file ex ‘setup_en.md’. Name of the link on the site; game name is filled automatically so ‘setup/en’ etc. Author or authors.
- authors: List[str]¶
Alias for field number 5
- description: str¶
Alias for field number 1
- file_name: str¶
Alias for field number 3
- language: str¶
Alias for field number 2
- link: str¶
Alias for field number 4
- tutorial_name: str¶
Alias for field number 0
- BaseClasses.get_seed(seed: int | None = None) int ¶