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]] = []
advancements: Set[Location]
allow_partial_entrances: bool
blocked_connections: Dict[int, Set[Entrance]]
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
collect(item: Item, prevent_sweep: bool = False, location: Location | None = None) 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.

locations_checked: Set[Location]
multiworld: MultiWorld
path: Dict[Region | Entrance, Tuple[str, Tuple[str, PathValue | None] | None]]
prog_items: Dict[int, Counter[str]]
reachable_regions: Dict[int, Set[Region]]
remove(item: Item)
stale: Dict[int, bool]
sweep_for_advancements(locations: Iterable[Location] | None = None) None
sweep_for_events(locations: Iterable[Location] | None = None) None
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
connect(region: Region) None
connected_region: Region | None = None
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
parent_region: Region | None
player: int
randomization_group: int
randomization_type: EntranceType
class BaseClasses.EntranceInfo

Bases: TypedDict

direction: str
entrance: str
exit: str
player: int
class BaseClasses.EntranceType(*values)

Bases: IntEnum

ONE_WAY = 1
TWO_WAY = 2
class BaseClasses.Group

Bases: TypedDict

game: str
item_pool: NotRequired[Set[str]]
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.HasNameAndPlayer(*args, **kwargs)

Bases: Protocol

name: str
player: int
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
location: Location | None
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.

item: Item | None = None
static item_rule(item)
locked: bool = False
name: str
property native_item: bool

Returns True if the item in this location matches game.

parent_region: Region | None
place_locked_item(item: Item)
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

class RegionManager(players: int)

Bases: object

add_group(new_id: int)
append(region: Region)
entrance_cache: Dict[int, Dict[str, Entrance]]
extend(regions: Iterable[Region])
location_cache: Dict[int, Dict[str, Location]]
region_cache: Dict[int, Dict[str, Region]]
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]]
create_item(item_name: str, player: int) Item
debug_types = False
early_items: Dict[int, Dict[str, int]]
exclude_locations: Dict[int, Options.ExcludeLocations]
find_item(item: str, player: int) Location
find_item_locations(item: str, player: int, resolve_group_locations: bool = False) List[Location]
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_entrance(entrance_name: str, player: int) Entrance
get_entrances(player: int | None = None) Iterable[Entrance]
get_file_safe_player_name(player: int) str
get_filled_locations(player: int | None = None) List[Location]
get_game_groups(game_name: str) Tuple[int, ...]
get_game_players(game_name: str) Tuple[int, ...]
get_game_worlds(game_name: str)
get_items() List[Item]
get_location(location_name: str, player: int) Location
get_locations(player: int | None = None) Iterable[Location]
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_placeable_locations(state=None, player=None) List[Location]
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_region(region_name: str, player: int) Region
get_regions(player: int | None = None) Collection[Region]
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(player: int | None = None) List[Location]
get_unfilled_locations_for_players(location_names: List[str], players: Iterable[int])
groups: Dict[int, Group]
has_beaten_game(state: CollectionState, player: int | None = None) bool
indirect_connections: Dict[Region, Set[Entrance]]
is_race: bool = False
itempool: List[Item]

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]
precollected_items: Dict[int, List[Item]]
priority_locations: Dict[int, Options.PriorityLocations]
progression_balancing: Dict[int, Options.ProgressionBalancing]
push_item(location: Location, item: Item, collect: bool = True)
push_precollected(item: Item)
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_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
unlocks_new_location(item: Item) bool
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

insert(index: int, value: Entrance) None

S.insert(index, value) – insert value before index

class LocationRegister(region_manager: RegionManager)

Bases: Register

insert(index: int, value: Location) None

S.insert(index, value) – insert value before index

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

entrance_type

alias of Entrance

entrances: List[Entrance]
property exits
get_connecting_entrance(is_main_entrance: Callable[[Entrance], bool]) Entrance
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
unreachables: Set[Location]
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

Alias for field number 4

tutorial_name: str

Alias for field number 0

BaseClasses.get_seed(seed: int | None = None) int