CommonClient: Add docs for Attributes (#5003)

Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
This commit is contained in:
qwint
2025-05-22 10:08:15 -05:00
committed by GitHub
parent 0351698ef7
commit 88b529593f

View File

@@ -266,38 +266,71 @@ class CommonContext:
last_death_link: float = time.time() # last send/received death link on AP layer last_death_link: float = time.time() # last send/received death link on AP layer
# remaining type info # remaining type info
slot_info: typing.Dict[int, NetworkSlot] slot_info: dict[int, NetworkSlot]
server_address: typing.Optional[str] """Slot Info from the server for the current connection"""
password: typing.Optional[str] server_address: str | None
hint_cost: typing.Optional[int] """Autoconnect address provided by the ctx constructor"""
hint_points: typing.Optional[int] password: str | None
player_names: typing.Dict[int, str] """Password used for Connecting, expected by server_auth"""
hint_cost: int | None
"""Current Hint Cost per Hint from the server"""
hint_points: int | None
"""Current avaliable Hint Points from the server"""
player_names: dict[int, str]
"""Current lookup of slot number to player display name from server (includes aliases)"""
finished_game: bool finished_game: bool
"""
Bool to signal that status should be updated to Goal after reconnecting
to be used to ensure that a StatusUpdate packet does not get lost when disconnected
"""
ready: bool ready: bool
team: typing.Optional[int] """Bool to keep track of state for the /ready command"""
slot: typing.Optional[int] team: int | None
auth: typing.Optional[str] """Team number of currently connected slot"""
seed_name: typing.Optional[str] slot: int | None
"""Slot number of currently connected slot"""
auth: str | None
"""Name used in Connect packet"""
seed_name: str | None
"""Seed name that will be validated on opening a socket if present"""
# locations # locations
locations_checked: typing.Set[int] # local state locations_checked: set[int]
locations_scouted: typing.Set[int] """
items_received: typing.List[NetworkItem] Local container of location ids checked to signal that LocationChecks should be resent after reconnecting
missing_locations: typing.Set[int] # server state to be used to ensure that a LocationChecks packet does not get lost when disconnected
checked_locations: typing.Set[int] # server state """
server_locations: typing.Set[int] # all locations the server knows of, missing_location | checked_locations locations_scouted: set[int]
locations_info: typing.Dict[int, NetworkItem] """
Local container of location ids scouted to signal that LocationScouts should be resent after reconnecting
to be used to ensure that a LocationScouts packet does not get lost when disconnected
"""
items_received: list[NetworkItem]
"""List of NetworkItems recieved from the server"""
missing_locations: set[int]
"""Container of Locations that are unchecked per server state"""
checked_locations: set[int]
"""Container of Locations that are checked per server state"""
server_locations: set[int]
"""Container of Locations that exist per server state; a combination between missing and checked locations"""
locations_info: dict[int, NetworkItem]
"""Dict of location id: NetworkItem info from LocationScouts request"""
# data storage # data storage
stored_data: typing.Dict[str, typing.Any] stored_data: dict[str, typing.Any]
stored_data_notification_keys: typing.Set[str] """
Data Storage values by key that were retrieved from the server
any keys subscribed to with SetNotify will be kept up to date
"""
stored_data_notification_keys: set[str]
"""Current container of watched Data Storage keys, managed by ctx.set_notify"""
# internals # internals
# current message box through kvui
_messagebox: typing.Optional["kvui.MessageBox"] = None _messagebox: typing.Optional["kvui.MessageBox"] = None
# message box reporting a loss of connection """Current message box through kvui"""
_messagebox_connection_loss: typing.Optional["kvui.MessageBox"] = None _messagebox_connection_loss: typing.Optional["kvui.MessageBox"] = None
"""Message box reporting a loss of connection"""
def __init__(self, server_address: typing.Optional[str] = None, password: typing.Optional[str] = None) -> None: def __init__(self, server_address: typing.Optional[str] = None, password: typing.Optional[str] = None) -> None:
# server state # server state