Ballistica Logo

bacommon package

Subpackages

Submodules

bacommon.app module

Common high level values/functionality related to apps.

class bacommon.app.AppArchitecture(*values)[source]

Bases: Enum

Processor architecture the App is running on.

ARM = 'arm'
ARM64 = 'arm64'
X86 = 'x86'
X86_64 = 'x86_64'
class bacommon.app.AppExperience(*values)[source]

Bases: Enum

A particular experience that can be provided by a Ballistica app.

This is one metric used to isolate different playerbases from each other where there might be no technical barriers doing so. For example, a casual one-hand-playable phone game and an augmented reality tabletop game may both use the same scene-versions and networking-protocols and whatnot, but it would make no sense to allow players of one to join servers of the other. AppExperience can be used to keep these player bases separate.

Generally a single Ballistica app targets a single AppExperience. This is not a technical requirement, however. A single app may support multiple experiences, or there may be multiple apps targeting one experience. Cloud components such as leagues are generally associated with an AppExperience so that they are only visible to client apps designed for that play style.

EMPTY = 'empty'
MELEE = 'melee'
REMOTE = 'remote'
class bacommon.app.AppInstanceInfo(interface_idiom: ~typing.Annotated[~bacommon.app.AppInterfaceIdiom, <efro.dataclassio.IOAttrs object at 0x7f5307fb9dc0>], locale: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307fb9c10>], device: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5307fbac60>])[source]

Bases: object

General info about an individual running app.

architecture

alias of Annotated[AppArchitecture, <efro.dataclassio.IOAttrs object at 0x7f53094706e0>]

device: IOAttrs object at 0x7f5307fba9f0>]
engine_build

alias of Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5309470500>]

engine_version

alias of Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f53095dbad0>]

interface_idiom: IOAttrs object at 0x7f5307f96d80>]
locale: IOAttrs object at 0x7f5307fbe000>]
name

alias of Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f53095dbe60>]

os_version

alias of Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5309470800>]

platform

alias of Annotated[AppPlatform, <efro.dataclassio.IOAttrs object at 0x7f5309470050>]

variant

alias of Annotated[AppVariant, <efro.dataclassio.IOAttrs object at 0x7f53094705c0>]

class bacommon.app.AppInterfaceIdiom(*values)[source]

Bases: Enum

A general form-factor or method of experiencing a Ballistica app.

Note that it is possible for a running app to switch idioms (for instance if a mobile device or computer is connected to a TV).

DESKTOP = 'desktop'
PHONE = 'phone'
TABLET = 'tablet'
TV = 'tv'
XR = 'xr'
class bacommon.app.AppPlatform(*values)[source]

Bases: Enum

Overall platform a Ballistica build is targeting.

Each distinct flavor of an app has a unique combination of AppPlatform and AppVariant. Generally platform describes a set of hardware, while variant describes a destination or purpose for the build.

ANDROID = 'android'
IOS = 'ios'
LINUX = 'linux'
MAC = 'mac'
TVOS = 'tvos'
WINDOWS = 'windows'
class bacommon.app.AppVariant(*values)[source]

Bases: Enum

A unique Ballistica build type within a single platform.

Each distinct flavor of an app has a unique combination of AppPlatform and AppVariant. Generally platform describes a set of hardware, while variant describes a destination or purpose for the build.

AMAZON_APPSTORE = 'amazon_appstore'
APP_STORE = 'app_store'
ARCADE = 'arcade'
DEMO = 'demo'
EPIC_GAMES_STORE = 'epic_games_store'
GENERIC = 'generic'
GOOGLE_PLAY = 'google_play'
META = 'meta'
STEAM = 'steam'
TEST = 'test'
WINDOWS_STORE = 'windows_store'

bacommon.assets module

Functionality related to cloud based assets.

class bacommon.assets.AssetPackageBuildState(in_progress_builds: ~typing.Annotated[list[str], <efro.dataclassio.IOAttrs object at 0x7f5307dcfd40>] = <factory>, initial_build_count: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307dcfc80>] = 0, error: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5307dcfa10>] = None)[source]

Bases: object

Contains info about an in-progress asset cloud build.

error: IOAttrs object at 0x7f5307e22570>] = None
in_progress_builds: IOAttrs object at 0x7f5307e23da0>]
initial_build_count: IOAttrs object at 0x7f5307dcf140>] = 0
class bacommon.assets.AssetPackageFlavor(*values)[source]

Bases: Enum

Flavors for asset package outputs for different platforms/etc.

DESKTOP = 'desktop'
MOBILE = 'mobile'
class bacommon.assets.AssetPackageFlavorManifest(cloudfiles: ~typing.Annotated[dict[str, str], <efro.dataclassio.IOAttrs object at 0x7f5307ffedb0>] = <factory>)[source]

Bases: object

A manifest of asset info for a specific flavor of an asset package.

cloudfiles: IOAttrs object at 0x7f5307dcd7c0>]
class bacommon.assets.AssetType(*values)[source]

Bases: Enum

Types for individual assets within a package.

COLLISION_MESH = 'collision_mesh'
CUBE_TEXTURE = 'cube_texture'
DATA = 'data'
MESH = 'mesh'
SOUND = 'sound'
TEXTURE = 'texture'

bacommon.bacloud module

Functionality related to the bacloud tool.

class bacommon.bacloud.RequestData(command: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307edef30>], token: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5307edde20>], payload: ~typing.Annotated[dict, <efro.dataclassio.IOAttrs object at 0x7f5307edede0>], tzoffset: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f5307edc080>], isatty: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7f5307edc170>])[source]

Bases: object

Request sent to bacloud server.

command: IOAttrs object at 0x7f5307ede900>]
isatty: IOAttrs object at 0x7f5307e73bf0>]
payload: IOAttrs object at 0x7f5307e73a40>]
token: IOAttrs object at 0x7f5307edf3b0>]
tzoffset: IOAttrs object at 0x7f5307fbc2f0>]
class bacommon.bacloud.ResponseData(message: Annotated[str | None, IOAttrs('m', store_default=False)] = None, message_end: Annotated[str, IOAttrs('m_end', store_default=False)] = '\n', error: Annotated[str | None, IOAttrs('e', store_default=False)] = None, delay_seconds: Annotated[float, IOAttrs('d', store_default=False)] = 0.0, login: Annotated[str | None, IOAttrs('l', store_default=False)] = None, logout: Annotated[bool, IOAttrs('lo', store_default=False)] = False, dir_manifest: Annotated[str | None, IOAttrs('man', store_default=False)] = None, uploads: Annotated[tuple[list[str], str, dict] | None, IOAttrs('u', store_default=False)] = None, uploads_inline: Annotated[list[str] | None, IOAttrs('uinl', store_default=False)] = None, deletes: Annotated[list[str] | None, IOAttrs('dlt', store_default=False)] = None, downloads: Annotated[Downloads | None, IOAttrs('dl', store_default=False)] = None, downloads_inline: Annotated[dict[str, bytes] | None, IOAttrs('dinl', store_default=False)] = None, dir_prune_empty: Annotated[str | None, IOAttrs('dpe', store_default=False)] = None, open_url: Annotated[str | None, IOAttrs('url', store_default=False)] = None, input_prompt: Annotated[tuple[str, bool] | None, IOAttrs('inp', store_default=False)] = None, end_message: Annotated[str | None, IOAttrs('em', store_default=False)] = None, end_message_end: Annotated[str, IOAttrs('eme', store_default=False)] = '\n', end_command: Annotated[tuple[str, dict] | None, IOAttrs('ec', store_default=False)] = None)[source]

Bases: object

Response sent from the bacloud server to the client.

message

If present, client should print this message before any other response processing (including error handling) occurs.

Type:

Annotated[str | None, IOAttrs(‘m’, store_default=False)]

message_end

end arg for message print() call.

Type:

Annotated[str, IOAttrs(‘m_end’, store_default=False)]

error

If present, client should abort with this error message.

Type:

Annotated[str | None, IOAttrs(‘e’, store_default=False)]

delay_seconds

How long to wait before proceeding with remaining response (can be useful when waiting for server progress in a loop).

Type:

Annotated[float, IOAttrs(‘d’, store_default=False)]

login

If present, a token that should be stored client-side and passed with subsequent commands.

Type:

Annotated[str | None, IOAttrs(‘l’, store_default=False)]

logout

If True, any existing client-side token should be discarded.

Type:

Annotated[bool, IOAttrs(‘lo’, store_default=False)]

dir_manifest

If present, client should generate a manifest of this dir. It should be added to end_command args as ‘manifest’.

Type:

Annotated[str | None, IOAttrs(‘man’, store_default=False)]

uploads

If present, client should upload the requested files (arg1) individually to a server command (arg2) with provided args (arg3).

Type:

Annotated[tuple[list[str], str, dict] | None, IOAttrs(‘u’, store_default=False)]

uploads_inline

If present, a list of pathnames that should be gzipped and uploaded to an ‘uploads_inline’ bytes dict in end_command args. This should be limited to relatively small files.

Type:

Annotated[list[str] | None, IOAttrs(‘uinl’, store_default=False)]

deletes

If present, file paths that should be deleted on the client.

Type:

Annotated[list[str] | None, IOAttrs(‘dlt’, store_default=False)]

downloads

If present, describes files the client should individually request from the server if not already present on the client.

Type:

Annotated[Downloads | None, IOAttrs(‘dl’, store_default=False)]

downloads_inline

If present, pathnames mapped to gzipped data to be written to the client. This should only be used for relatively small files as they are all included inline as part of the response.

Type:

Annotated[dict[str, bytes] | None, IOAttrs(‘dinl’, store_default=False)]

dir_prune_empty

If present, all empty dirs under this one should be removed.

Type:

Annotated[str | None, IOAttrs(‘dpe’, store_default=False)]

open_url

If present, url to display to the user.

Type:

Annotated[str | None, IOAttrs(‘url’, store_default=False)]

input_prompt

If present, a line of input is read and placed into end_command args as ‘input’. The first value is the prompt printed before reading and the second is whether it should be read as a password (without echoing to the terminal).

Type:

Annotated[tuple[str, bool] | None, IOAttrs(‘inp’, store_default=False)]

end_message

If present, a message that should be printed after all other response processing is done.

Type:

Annotated[str | None, IOAttrs(‘em’, store_default=False)]

end_message_end

end arg for end_message print() call.

Type:

Annotated[str, IOAttrs(‘eme’, store_default=False)]

end_command

If present, this command is run with these args at the end of response processing.

Type:

Annotated[tuple[str, dict] | None, IOAttrs(‘ec’, store_default=False)]

class Downloads(basepath: Annotated[str | None, IOAttrs('p')], cmd: Annotated[str, IOAttrs('c')], baseargs: Annotated[dict[str, str], IOAttrs('a')], entries: Annotated[list[Entry], IOAttrs('e')])[source]

Bases: object

Info about downloads included in a response.

class Entry(path: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307ee96a0>], args: ~typing.Annotated[dict[str, str], <efro.dataclassio.IOAttrs object at 0x7f5307ee9520>])[source]

Bases: object

Individual download.

args: IOAttrs object at 0x7f5307eeb470>]
path: IOAttrs object at 0x7f5307eeb650>]
baseargs: Annotated[dict[str, str], IOAttrs('a')]
basepath: Annotated[str | None, IOAttrs('p')]
cmd: Annotated[str, IOAttrs('c')]
entries: Annotated[list[Entry], IOAttrs('e')]
delay_seconds: Annotated[float, IOAttrs('d', store_default=False)] = 0.0
deletes: Annotated[list[str] | None, IOAttrs('dlt', store_default=False)] = None
dir_manifest: Annotated[str | None, IOAttrs('man', store_default=False)] = None
dir_prune_empty: Annotated[str | None, IOAttrs('dpe', store_default=False)] = None
downloads: Annotated[Downloads | None, IOAttrs('dl', store_default=False)] = None
downloads_inline: Annotated[dict[str, bytes] | None, IOAttrs('dinl', store_default=False)] = None
end_command: Annotated[tuple[str, dict] | None, IOAttrs('ec', store_default=False)] = None
end_message: Annotated[str | None, IOAttrs('em', store_default=False)] = None
end_message_end: Annotated[str, IOAttrs('eme', store_default=False)] = '\n'
error: Annotated[str | None, IOAttrs('e', store_default=False)] = None
input_prompt: Annotated[tuple[str, bool] | None, IOAttrs('inp', store_default=False)] = None
login: Annotated[str | None, IOAttrs('l', store_default=False)] = None
logout: Annotated[bool, IOAttrs('lo', store_default=False)] = False
message: Annotated[str | None, IOAttrs('m', store_default=False)] = None
message_end: Annotated[str, IOAttrs('m_end', store_default=False)] = '\n'
open_url: Annotated[str | None, IOAttrs('url', store_default=False)] = None
uploads: Annotated[tuple[list[str], str, dict] | None, IOAttrs('u', store_default=False)] = None
uploads_inline: Annotated[list[str] | None, IOAttrs('uinl', store_default=False)] = None
bacommon.bacloud.asset_file_cache_path(filehash: str) str[source]

Given a sha256 hex file hash, return a storage path.

bacommon.bs module

BombSquad specific bits.

class bacommon.bs.BasicClientUI(components: Annotated[list[BasicClientUIComponent], IOAttrs('s')], interaction_style: Annotated[InteractionStyle, IOAttrs('i', enum_fallback=InteractionStyle.UNKNOWN)] = InteractionStyle.BUTTON_POSITIVE, button_label_positive: Annotated[ButtonLabel, IOAttrs('p', enum_fallback=ButtonLabel.UNKNOWN)] = ButtonLabel.OK, button_label_negative: Annotated[ButtonLabel, IOAttrs('n', enum_fallback=ButtonLabel.UNKNOWN)] = ButtonLabel.CANCEL)[source]

Bases: ClientUI

A basic UI for the client.

class ButtonLabel(*values)[source]

Bases: Enum

Distinct button labels we support.

ACCEPT = 'ac'
APPLY = 'a'
CANCEL = 'c'
CLAIM = 'cl'
DECLINE = 'dn'
DISCARD = 'd'
IGNORE = 'ig'
OK = 'o'
UNKNOWN = 'u'
class InteractionStyle(*values)[source]

Bases: Enum

Overall interaction styles we support.

BUTTON_POSITIVE = 'p'
BUTTON_POSITIVE_NEGATIVE = 'pn'
UNKNOWN = 'u'
button_label_negative: Annotated[ButtonLabel, IOAttrs('n', enum_fallback=ButtonLabel.UNKNOWN)] = 'c'
button_label_positive: Annotated[ButtonLabel, IOAttrs('p', enum_fallback=ButtonLabel.UNKNOWN)] = 'o'
components: Annotated[list[BasicClientUIComponent], IOAttrs('s')]
contains_unknown_elements() bool[source]

Whether something within us is an unknown type or enum.

classmethod get_type_id() ClientUITypeID[source]

Return the type-id for this subclass.

interaction_style: Annotated[InteractionStyle, IOAttrs('i', enum_fallback=InteractionStyle.UNKNOWN)] = 'p'
class bacommon.bs.BasicClientUIBsClassicTourneyResult(tournament_id: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307bc96d0>], game: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307bc9880>], players: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307c0ad80>], rank: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307c0ab40>], trophy: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5307c0afc0>], prizes: ~typing.Annotated[list[~bacommon.bs.DisplayItemWrapper], <efro.dataclassio.IOAttrs object at 0x7f5307fbac00>])[source]

Bases: BasicClientUIComponent

Show info about a classic tourney.

game: IOAttrs object at 0x7f5307ee93d0>]
classmethod get_type_id() BasicClientUIComponentTypeID[source]

Return the type-id for this subclass.

players: IOAttrs object at 0x7f5307c20e30>]
prizes: IOAttrs object at 0x7f5307c21a60>]
rank: IOAttrs object at 0x7f5307c21b50>]
tournament_id: IOAttrs object at 0x7f5307c08680>]
trophy: IOAttrs object at 0x7f5307c225a0>]
class bacommon.bs.BasicClientUIComponent[source]

Bases: IOMultiType[BasicClientUIComponentTypeID]

Top level class for our multitype.

classmethod get_type(type_id: BasicClientUIComponentTypeID) type[BasicClientUIComponent][source]

Return the subclass for each of our type-ids.

classmethod get_type_id() BasicClientUIComponentTypeID[source]

Return the type-id for this subclass.

classmethod get_unknown_type_fallback() BasicClientUIComponent[source]

Return a fallback object in cases of unrecognized types.

This can allow newer data to remain readable in older environments. Use caution with this option, however, as it effectively modifies data.

Bases: BasicClientUIComponent

Show a link in the inbox message.

classmethod get_type_id() BasicClientUIComponentTypeID[source]

Return the type-id for this subclass.

label: IOAttrs object at 0x7f5307edf1a0>]
spacing_bottom: IOAttrs object at 0x7f5307edf2c0>] = 0.0
spacing_top: IOAttrs object at 0x7f5307a54fb0>] = 0.0
subs: IOAttrs object at 0x7f5307ab7aa0>]
url: IOAttrs object at 0x7f5307dcfc80>]
class bacommon.bs.BasicClientUIComponentText(text: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307dcc920>], subs: ~typing.Annotated[list[str], <efro.dataclassio.IOAttrs object at 0x7f5307dcdf10>] = <factory>, scale: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f5307bc89b0>] = 1.0, color: ~typing.Annotated[tuple[float, float, float, float], <efro.dataclassio.IOAttrs object at 0x7f5307dcf6b0>] = (1.0, 1.0, 1.0, 1.0), spacing_top: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f5307f97680>] = 0.0, spacing_bottom: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f5307edc890>] = 0.0)[source]

Bases: BasicClientUIComponent

Show some text in the inbox message.

color: IOAttrs object at 0x7f5307ee8b90>] = (1.0, 1.0, 1.0, 1.0)
classmethod get_type_id() BasicClientUIComponentTypeID[source]

Return the type-id for this subclass.

scale: IOAttrs object at 0x7f5307ffee10>] = 1.0
spacing_bottom: IOAttrs object at 0x7f5307c229f0>] = 0.0
spacing_top: IOAttrs object at 0x7f5307c20dd0>] = 0.0
subs: IOAttrs object at 0x7f5307b82360>]
text: IOAttrs object at 0x7f5307af8530>]
class bacommon.bs.BasicClientUIComponentTypeID(*values)[source]

Bases: Enum

Type ID for each of our subclasses.

BS_CLASSIC_TOURNEY_RESULT = 'ct'
DISPLAY_ITEMS = 'di'
EXPIRE_TIME = 'd'
TEXT = 't'
UNKNOWN = 'u'
class bacommon.bs.BasicClientUIComponentUnknown[source]

Bases: BasicClientUIComponent

An unknown basic client component type.

In practice these should never show up since the master-server generates these on the fly for the client and so should not send clients one they can’t digest.

classmethod get_type_id() BasicClientUIComponentTypeID[source]

Return the type-id for this subclass.

class bacommon.bs.BasicClientUIDisplayItems(items: ~typing.Annotated[list[~bacommon.bs.DisplayItemWrapper], <efro.dataclassio.IOAttrs object at 0x7f5307af8d40>], width: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f5307af8dd0>] = 100.0, spacing_top: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f5307a549e0>] = 0.0, spacing_bottom: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f5307c084a0>] = 0.0)[source]

Bases: BasicClientUIComponent

Show some display-items.

classmethod get_type_id() BasicClientUIComponentTypeID[source]

Return the type-id for this subclass.

items: IOAttrs object at 0x7f5307af96a0>]
spacing_bottom: IOAttrs object at 0x7f5307edfa10>] = 0.0
spacing_top: IOAttrs object at 0x7f5307edd3d0>] = 0.0
width: IOAttrs object at 0x7f5307af9e20>] = 100.0
class bacommon.bs.BasicClientUIExpireTime(time: ~typing.Annotated[~datetime.datetime, <efro.dataclassio.IOAttrs object at 0x7f5307afa3f0>], spacing_top: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f5307afa330>] = 0.0, spacing_bottom: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f5307ee9c70>] = 0.0)[source]

Bases: BasicClientUIComponent

Show expire-time.

classmethod get_type_id() BasicClientUIComponentTypeID[source]

Return the type-id for this subclass.

spacing_bottom: IOAttrs object at 0x7f5307ede480>] = 0.0
spacing_top: IOAttrs object at 0x7f5307af8bf0>] = 0.0
time: IOAttrs object at 0x7f5307afa630>]
class bacommon.bs.ChestActionMessage(action: Annotated[Action, IOAttrs('a')], token_payment: Annotated[int, IOAttrs('t')], chest_id: Annotated[str, IOAttrs('i')])[source]

Bases: Message

Request action about a chest.

class Action(*values)[source]

Bases: Enum

Types of actions we can request.

AD = 'ad'
UNLOCK = 'u'
action: Annotated[Action, IOAttrs('a')]
chest_id: Annotated[str, IOAttrs('i')]
classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

token_payment: Annotated[int, IOAttrs('t')]
class bacommon.bs.ChestActionResponse(tokens_charged: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307c0a930>] = 0, contents: ~typing.Annotated[list[~bacommon.bs.DisplayItemWrapper] | None, <efro.dataclassio.IOAttrs object at 0x7f5307c0a870>] = None, prizeindex: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307c0a330>] = 0, error: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5307c23890>] = None, warning: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5307c23800>] = None, success_msg: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5307c23a40>] = None, effects: ~typing.Annotated[list[~bacommon.bs.ClientEffect], <efro.dataclassio.IOAttrs object at 0x7f5307c22450>] = <factory>)[source]

Bases: Response

Here’s the results of that action you asked for, boss.

contents: IOAttrs object at 0x7f5307edf650>] = None
effects: IOAttrs object at 0x7f5307bc9d60>]
error: IOAttrs object at 0x7f5307ee8680>] = None
prizeindex: IOAttrs object at 0x7f5307ee89e0>] = 0
success_msg: IOAttrs object at 0x7f53079b1730>] = None
tokens_charged: IOAttrs object at 0x7f5307eeab10>] = 0
warning: IOAttrs object at 0x7f53079b1b50>] = None
class bacommon.bs.ChestDisplayItem(appearance: ~typing.Annotated[~bacommon.bs.ClassicChestAppearance, <efro.dataclassio.IOAttrs object at 0x7f53079b20c0>])[source]

Bases: DisplayItem

Display a chest.

appearance: IOAttrs object at 0x7f53079b2660>]
get_description() tuple[str, list[tuple[str, str]]][source]

Return a string description and subs for the item.

These decriptions are baked into the DisplayItemWrapper and should be accessed from there when available. This allows clients to give descriptions even for newer display items they don’t recognize.

classmethod get_type_id() DisplayItemTypeID[source]

Return the type-id for this subclass.

class bacommon.bs.ChestInfoMessage(chest_id: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307c20e00>])[source]

Bases: Message

Request info about a chest.

chest_id: IOAttrs object at 0x7f53079b2390>]
classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

class bacommon.bs.ChestInfoResponse(chest: Annotated[Chest | None, IOAttrs('c')], user_tokens: Annotated[int | None, IOAttrs('t')])[source]

Bases: Response

Here’s that chest info you asked for, boss.

class Chest(appearance: Annotated[ClassicChestAppearance, IOAttrs('a', enum_fallback=ClassicChestAppearance.UNKNOWN)], unlock_tokens: Annotated[int, IOAttrs('tk')], unlock_time: Annotated[datetime.datetime, IOAttrs('t')], prizesets: Annotated[list[PrizeSet], IOAttrs('p')], ad_allow: Annotated[bool, IOAttrs('aa')])[source]

Bases: object

A lovely chest.

class PrizeSet(weight: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f53079b39b0>], contents: ~typing.Annotated[list[~bacommon.bs.DisplayItemWrapper], <efro.dataclassio.IOAttrs object at 0x7f53079b3ad0>])[source]

Bases: object

A possible set of prizes for this chest.

contents: IOAttrs object at 0x7f53079107d0>]
weight: IOAttrs object at 0x7f53079109e0>]
ad_allow: Annotated[bool, IOAttrs('aa')]
appearance: Annotated[ClassicChestAppearance, IOAttrs('a', enum_fallback=ClassicChestAppearance.UNKNOWN)]
prizesets: Annotated[list[PrizeSet], IOAttrs('p')]
unlock_time: Annotated[datetime.datetime, IOAttrs('t')]
unlock_tokens: Annotated[int, IOAttrs('tk')]
chest: Annotated[Chest | None, IOAttrs('c')]
user_tokens: Annotated[int | None, IOAttrs('t')]
class bacommon.bs.ClassicAccountLiveData(tickets: Annotated[int, IOAttrs('ti')], tokens: Annotated[int, IOAttrs('to')], gold_pass: Annotated[bool, IOAttrs('g')], remove_ads: Annotated[bool, IOAttrs('r')], achievements: Annotated[int, IOAttrs('a')], achievements_total: Annotated[int, IOAttrs('at')], league_type: Annotated[LeagueType | None, IOAttrs('lt')], league_num: Annotated[int | None, IOAttrs('ln')], league_rank: Annotated[int | None, IOAttrs('lr')], level: Annotated[int, IOAttrs('lv')], xp: Annotated[int, IOAttrs('xp')], xpmax: Annotated[int, IOAttrs('xpm')], inbox_count: Annotated[int, IOAttrs('ibc')], inbox_count_is_max: Annotated[bool, IOAttrs('ibcm')], chests: Annotated[dict[str, Chest], IOAttrs('c')])[source]

Bases: object

Live account data fed to the client in the bs classic app mode.

class Chest(appearance: ~typing.Annotated[~bacommon.bs.ClassicChestAppearance, <efro.dataclassio.IOAttrs object at 0x7f5307af8860>], unlock_time: ~typing.Annotated[~datetime.datetime, <efro.dataclassio.IOAttrs object at 0x7f53079b3ad0>], ad_allow_time: ~typing.Annotated[~datetime.datetime | None, <efro.dataclassio.IOAttrs object at 0x7f53079b3920>])[source]

Bases: object

A lovely chest.

ad_allow_time: IOAttrs object at 0x7f5307c08dd0>]
appearance: IOAttrs object at 0x7f5307c20da0>]
unlock_time: IOAttrs object at 0x7f5307911550>]
class LeagueType(*values)[source]

Bases: Enum

Type of league we are in.

BRONZE = 'b'
DIAMOND = 'd'
GOLD = 'g'
SILVER = 's'
achievements: Annotated[int, IOAttrs('a')]
achievements_total: Annotated[int, IOAttrs('at')]
chests: Annotated[dict[str, Chest], IOAttrs('c')]
gold_pass: Annotated[bool, IOAttrs('g')]
inbox_count: Annotated[int, IOAttrs('ibc')]
inbox_count_is_max: Annotated[bool, IOAttrs('ibcm')]
league_num: Annotated[int | None, IOAttrs('ln')]
league_rank: Annotated[int | None, IOAttrs('lr')]
league_type: Annotated[LeagueType | None, IOAttrs('lt')]
level: Annotated[int, IOAttrs('lv')]
remove_ads: Annotated[bool, IOAttrs('r')]
tickets: Annotated[int, IOAttrs('ti')]
tokens: Annotated[int, IOAttrs('to')]
xp: Annotated[int, IOAttrs('xp')]
xpmax: Annotated[int, IOAttrs('xpm')]
class bacommon.bs.ClassicChestAppearance(*values)[source]

Bases: Enum

Appearances bombsquad classic chests can have.

DEFAULT = 'd'
L1 = 'l1'
L2 = 'l2'
L3 = 'l3'
L4 = 'l4'
L5 = 'l5'
L6 = 'l6'
UNKNOWN = 'u'
property pretty_name: str

Pretty name for the chest in English.

class bacommon.bs.ClientEffect[source]

Bases: IOMultiType[ClientEffectTypeID]

Something that can happen on the client.

This can include screen messages, sounds, visual effects, etc.

classmethod get_type(type_id: ClientEffectTypeID) type[ClientEffect][source]

Return the subclass for each of our type-ids.

classmethod get_type_id() ClientEffectTypeID[source]

Return the type-id for this subclass.

classmethod get_unknown_type_fallback() ClientEffect[source]

Return a fallback object in cases of unrecognized types.

This can allow newer data to remain readable in older environments. Use caution with this option, however, as it effectively modifies data.

class bacommon.bs.ClientEffectChestWaitTimeAnimation(chestid: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f53079b9f70>], duration: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f53079bb7a0>], startvalue: ~typing.Annotated[~datetime.datetime, <efro.dataclassio.IOAttrs object at 0x7f53079b2f90>], endvalue: ~typing.Annotated[~datetime.datetime, <efro.dataclassio.IOAttrs object at 0x7f53079b2e70>])[source]

Bases: ClientEffect

Animate chest wait time changing.

chestid: IOAttrs object at 0x7f5307af9400>]
duration: IOAttrs object at 0x7f5307c0b2c0>]
endvalue: IOAttrs object at 0x7f5307c22f60>]
classmethod get_type_id() ClientEffectTypeID[source]

Return the type-id for this subclass.

startvalue: IOAttrs object at 0x7f53079113a0>]
class bacommon.bs.ClientEffectDelay(seconds: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f53079bbef0>])[source]

Bases: ClientEffect

Delay effect processing.

classmethod get_type_id() ClientEffectTypeID[source]

Return the type-id for this subclass.

seconds: IOAttrs object at 0x7f5307af97f0>]
class bacommon.bs.ClientEffectScreenMessage(message: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307910110>], subs: ~typing.Annotated[list[str], <efro.dataclassio.IOAttrs object at 0x7f5307911310>], color: ~typing.Annotated[tuple[float, float, float], <efro.dataclassio.IOAttrs object at 0x7f5307c0aa80>] = (1.0, 1.0, 1.0))[source]

Bases: ClientEffect

Display a screen-message.

color: IOAttrs object at 0x7f53079b35c0>] = (1.0, 1.0, 1.0)
classmethod get_type_id() ClientEffectTypeID[source]

Return the type-id for this subclass.

message: IOAttrs object at 0x7f530784c770>]
subs: IOAttrs object at 0x7f530784cb90>]
class bacommon.bs.ClientEffectSound(sound: Annotated[Sound, IOAttrs('s', enum_fallback=Sound.UNKNOWN)], volume: Annotated[float, IOAttrs('v')] = 1.0)[source]

Bases: ClientEffect

Play a sound.

class Sound(*values)[source]

Bases: Enum

Sounds that can be made alongside the message.

CASH_REGISTER = 'c'
ERROR = 'e'
GUN_COCKING = 'g'
POWER_DOWN = 'p'
UNKNOWN = 'u'
classmethod get_type_id() ClientEffectTypeID[source]

Return the type-id for this subclass.

sound: Annotated[Sound, IOAttrs('s', enum_fallback=Sound.UNKNOWN)]
volume: Annotated[float, IOAttrs('v')] = 1.0
class bacommon.bs.ClientEffectTicketsAnimation(duration: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f530784deb0>], startvalue: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307c21370>], endvalue: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307911cd0>])[source]

Bases: ClientEffect

Animate tickets count.

duration: IOAttrs object at 0x7f530784e3f0>]
endvalue: IOAttrs object at 0x7f53079127b0>]
classmethod get_type_id() ClientEffectTypeID[source]

Return the type-id for this subclass.

startvalue: IOAttrs object at 0x7f5308c338c0>]
class bacommon.bs.ClientEffectTokensAnimation(duration: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f5307912db0>], startvalue: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307912d80>], endvalue: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307912de0>])[source]

Bases: ClientEffect

Animate tokens count.

duration: IOAttrs object at 0x7f530784ed50>]
endvalue: IOAttrs object at 0x7f53079b82c0>]
classmethod get_type_id() ClientEffectTypeID[source]

Return the type-id for this subclass.

startvalue: IOAttrs object at 0x7f530784f0b0>]
class bacommon.bs.ClientEffectTypeID(*values)[source]

Bases: Enum

Type ID for each of our subclasses.

CHEST_WAIT_TIME_ANIMATION = 't'
DELAY = 'd'
SCREEN_MESSAGE = 'm'
SOUND = 's'
TICKETS_ANIMATION = 'ta'
TOKENS_ANIMATION = 'toa'
UNKNOWN = 'u'
class bacommon.bs.ClientEffectUnknown[source]

Bases: ClientEffect

Fallback substitute for types we don’t recognize.

classmethod get_type_id() ClientEffectTypeID[source]

Return the type-id for this subclass.

class bacommon.bs.ClientUI[source]

Bases: IOMultiType[ClientUITypeID]

Defines some user interface on the client.

classmethod get_type(type_id: ClientUITypeID) type[ClientUI][source]

Return the subclass for each of our type-ids.

classmethod get_type_id() ClientUITypeID[source]

Return the type-id for this subclass.

classmethod get_unknown_type_fallback() ClientUI[source]

Return a fallback object in cases of unrecognized types.

This can allow newer data to remain readable in older environments. Use caution with this option, however, as it effectively modifies data.

class bacommon.bs.ClientUIAction(*values)[source]

Bases: Enum

Types of actions we can run.

BUTTON_PRESS_NEGATIVE = 'n'
BUTTON_PRESS_POSITIVE = 'p'
class bacommon.bs.ClientUIActionMessage(id: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307882960>], action: ~typing.Annotated[~bacommon.bs.ClientUIAction, <efro.dataclassio.IOAttrs object at 0x7f5307881190>])[source]

Bases: Message

Do something to a client ui.

action: IOAttrs object at 0x7f53079b2060>]
classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

id: IOAttrs object at 0x7f5307880b90>]
class bacommon.bs.ClientUIActionResponse(error_type: Annotated[ErrorType | None, IOAttrs('et', enum_fallback=ErrorType.UNKNOWN)], error_message: Annotated[str | None, IOAttrs('em')], effects: Annotated[list[ClientEffect], IOAttrs('fx')])[source]

Bases: Response

Did something to that inbox entry, boss.

class ErrorType(*values)[source]

Bases: Enum

Types of errors that may have occurred.

EXPIRED = 'e'
INTERNAL = 'i'
UNKNOWN = 'u'
effects: Annotated[list[ClientEffect], IOAttrs('fx')]
error_message: Annotated[str | None, IOAttrs('em')]
error_type: Annotated[ErrorType | None, IOAttrs('et', enum_fallback=ErrorType.UNKNOWN)]
class bacommon.bs.ClientUITypeID(*values)[source]

Bases: Enum

Type ID for each of our subclasses.

BASIC = 'b'
UNKNOWN = 'u'
class bacommon.bs.ClientUIWrapper(id: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f53078802f0>], createtime: ~typing.Annotated[~datetime.datetime, <efro.dataclassio.IOAttrs object at 0x7f53078801a0>], ui: ~typing.Annotated[~bacommon.bs.ClientUI, <efro.dataclassio.IOAttrs object at 0x7f53079b2e40>])[source]

Bases: object

Wrapper for a ClientUI and its common data.

createtime: IOAttrs object at 0x7f53079117f0>]
id: IOAttrs object at 0x7f5307882b70>]
ui: IOAttrs object at 0x7f53079b3950>]
class bacommon.bs.DisplayItem[source]

Bases: IOMultiType[DisplayItemTypeID]

Some amount of something that can be shown or described.

Used to depict chest contents or other rewards or prices.

get_description() tuple[str, list[tuple[str, str]]][source]

Return a string description and subs for the item.

These decriptions are baked into the DisplayItemWrapper and should be accessed from there when available. This allows clients to give descriptions even for newer display items they don’t recognize.

classmethod get_type(type_id: DisplayItemTypeID) type[DisplayItem][source]

Return the subclass for each of our type-ids.

classmethod get_type_id() DisplayItemTypeID[source]

Return the type-id for this subclass.

classmethod get_unknown_type_fallback() DisplayItem[source]

Return a fallback object in cases of unrecognized types.

This can allow newer data to remain readable in older environments. Use caution with this option, however, as it effectively modifies data.

class bacommon.bs.DisplayItemTypeID(*values)[source]

Bases: Enum

Type ID for each of our subclasses.

CHEST = 'c'
TEST = 's'
TICKETS = 't'
TOKENS = 'k'
UNKNOWN = 'u'
class bacommon.bs.DisplayItemWrapper(item: ~typing.Annotated[~bacommon.bs.DisplayItem, <efro.dataclassio.IOAttrs object at 0x7f5307883b90>], description: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307883b30>], description_subs: ~typing.Annotated[list[str] | None, <efro.dataclassio.IOAttrs object at 0x7f5307af8d10>])[source]

Bases: object

Wraps a DisplayItem and common info.

description: IOAttrs object at 0x7f53079b31d0>]
description_subs: IOAttrs object at 0x7f5307910d10>]
classmethod for_display_item(item: DisplayItem) DisplayItemWrapper[source]

Convenience method to wrap a DisplayItem.

item: IOAttrs object at 0x7f53079138c0>]
class bacommon.bs.InboxRequestMessage[source]

Bases: Message

Message requesting our inbox.

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

class bacommon.bs.InboxRequestResponse(wrappers: ~typing.Annotated[list[~bacommon.bs.ClientUIWrapper], <efro.dataclassio.IOAttrs object at 0x7f53079b8350>], error: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f53079b9ca0>] = None)[source]

Bases: Response

Here’s that inbox contents you asked for, boss.

error: IOAttrs object at 0x7f5307af8380>] = None
wrappers: IOAttrs object at 0x7f5307c21280>]
class bacommon.bs.PrivatePartyMessage(need_datacode: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7f5307c21dc0>])[source]

Bases: Message

Message asking about info we need for private-party UI.

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

need_datacode: IOAttrs object at 0x7f5307864980>]
class bacommon.bs.PrivatePartyResponse(success: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7f5307864050>], tokens: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307866870>], gold_pass: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7f530784c7d0>], datacode: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f530784c8c0>])[source]

Bases: Response

Here’s that private party UI info you asked for, boss.

datacode: IOAttrs object at 0x7f530784e1e0>]
gold_pass: IOAttrs object at 0x7f53079b9100>]
success: IOAttrs object at 0x7f5307864a10>]
tokens: IOAttrs object at 0x7f530784d190>]
class bacommon.bs.ScoreSubmitMessage(score_token: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307864d70>])[source]

Bases: Message

Let the server know we got some score in something.

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

score_token: IOAttrs object at 0x7f5307911cd0>]
class bacommon.bs.ScoreSubmitResponse(effects: ~typing.Annotated[list[~bacommon.bs.ClientEffect], <efro.dataclassio.IOAttrs object at 0x7f530784e930>])[source]

Bases: Response

Did something to that inbox entry, boss.

effects: IOAttrs object at 0x7f5307c219a0>]
class bacommon.bs.TestDisplayItem[source]

Bases: DisplayItem

Fills usable space for a display-item - good for calibration.

get_description() tuple[str, list[tuple[str, str]]][source]

Return a string description and subs for the item.

These decriptions are baked into the DisplayItemWrapper and should be accessed from there when available. This allows clients to give descriptions even for newer display items they don’t recognize.

classmethod get_type_id() DisplayItemTypeID[source]

Return the type-id for this subclass.

class bacommon.bs.TicketsDisplayItem(count: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307865340>])[source]

Bases: DisplayItem

Some amount of tickets.

count: IOAttrs object at 0x7f53078659a0>]
get_description() tuple[str, list[tuple[str, str]]][source]

Return a string description and subs for the item.

These decriptions are baked into the DisplayItemWrapper and should be accessed from there when available. This allows clients to give descriptions even for newer display items they don’t recognize.

classmethod get_type_id() DisplayItemTypeID[source]

Return the type-id for this subclass.

class bacommon.bs.TokensDisplayItem(count: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307865dc0>])[source]

Bases: DisplayItem

Some amount of tokens.

count: IOAttrs object at 0x7f5307865be0>]
get_description() tuple[str, list[tuple[str, str]]][source]

Return a string description and subs for the item.

These decriptions are baked into the DisplayItemWrapper and should be accessed from there when available. This allows clients to give descriptions even for newer display items they don’t recognize.

classmethod get_type_id() DisplayItemTypeID[source]

Return the type-id for this subclass.

class bacommon.bs.UnknownClientUI[source]

Bases: ClientUI

Fallback type for unrecognized entries.

classmethod get_type_id() ClientUITypeID[source]

Return the type-id for this subclass.

class bacommon.bs.UnknownDisplayItem[source]

Bases: DisplayItem

Something we don’t know how to display.

get_description() tuple[str, list[tuple[str, str]]][source]

Return a string description and subs for the item.

These decriptions are baked into the DisplayItemWrapper and should be accessed from there when available. This allows clients to give descriptions even for newer display items they don’t recognize.

classmethod get_type_id() DisplayItemTypeID[source]

Return the type-id for this subclass.

bacommon.build module

Functionality related to game builds.

class bacommon.build.BuildInfoSet(builds: Annotated[list[Entry], IOAttrs('builds')] = <factory>)[source]

Bases: object

Set of build infos.

class Entry(filename: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307220ef0>], size: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307220ec0>], version: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307880ce0>], build_number: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307880c20>], checksum: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f53078802f0>], createtime: ~typing.Annotated[~datetime.datetime, <efro.dataclassio.IOAttrs object at 0x7f5307880320>])[source]

Bases: object

Info about a particular app build.

build_number: IOAttrs object at 0x7f53079bbe00>]
checksum: IOAttrs object at 0x7f53072222d0>]
createtime: IOAttrs object at 0x7f5307864290>]
filename: IOAttrs object at 0x7f5307222660>]
size: IOAttrs object at 0x7f5307864500>]
version: IOAttrs object at 0x7f53079116a0>]
builds: Annotated[list[Entry], IOAttrs('builds')]

bacommon.cloud module

Functionality related to cloud functionality.

class bacommon.cloud.LoginProxyCompleteMessage(proxyid: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307274950>])[source]

Bases: Message

Just so you know, we’re done with this proxy.

proxyid: IOAttrs object at 0x7f5307247da0>]
class bacommon.cloud.LoginProxyRequestMessage[source]

Bases: Message

Request send to the cloud to ask for a login-proxy.

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

class bacommon.cloud.LoginProxyRequestResponse(url: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307247800>], url_overlay: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307247a70>], proxyid: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f530784e180>], proxykey: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f530784e630>])[source]

Bases: Response

Response to a request for a login proxy.

proxyid: IOAttrs object at 0x7f5307865640>]
proxykey: IOAttrs object at 0x7f5307865e80>]
url: IOAttrs object at 0x7f530784d100>]
url_overlay: IOAttrs object at 0x7f5307246360>]
class bacommon.cloud.LoginProxyStateQueryMessage(proxyid: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307246030>], proxykey: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307245ee0>])[source]

Bases: Message

Soo.. how is that login proxy going?

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

proxyid: IOAttrs object at 0x7f5307274620>]
proxykey: IOAttrs object at 0x7f53072743b0>]
class bacommon.cloud.LoginProxyStateQueryResponse(state: Annotated[State, IOAttrs('s')], credentials: Annotated[str | None, IOAttrs('tk')])[source]

Bases: Response

Here’s the info on that login-proxy you asked about, boss.

class State(*values)[source]

Bases: Enum

States a login-proxy can be in.

FAIL = 'fail'
SUCCESS = 'success'
WAITING = 'waiting'
credentials: Annotated[str | None, IOAttrs('tk')]
state: Annotated[State, IOAttrs('s')]
class bacommon.cloud.ManageAccountMessage(weblocation: ~typing.Annotated[~bacommon.cloud.WebLocation, <efro.dataclassio.IOAttrs object at 0x7f5307275a00>] = WebLocation.ACCOUNT_EDITOR)[source]

Bases: Message

Message asking for a manage-account url.

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

weblocation: IOAttrs object at 0x7f5307244440>] = 'e'
class bacommon.cloud.ManageAccountResponse(url: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f53072759a0>])[source]

Bases: Response

Here’s that sign-in result you asked for, boss.

url: IOAttrs object at 0x7f5307275d00>]
class bacommon.cloud.MerchAvailabilityMessage[source]

Bases: Message

Can we show merch link?

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

class bacommon.cloud.MerchAvailabilityResponse(url: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5307276180>])[source]

Bases: Response

About that merch…

url: IOAttrs object at 0x7f5307276450>]
class bacommon.cloud.PingMessage[source]

Bases: Message

Standard ping.

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

class bacommon.cloud.PingResponse[source]

Bases: Response

pong.

class bacommon.cloud.SecureDataCheckMessage(data: ~typing.Annotated[bytes, <efro.dataclassio.IOAttrs object at 0x7f5307276600>], signature: ~typing.Annotated[bytes, <efro.dataclassio.IOAttrs object at 0x7f5307276570>])[source]

Bases: Message

Was this data signed by the master-server?.

data: IOAttrs object at 0x7f5307277080>]
classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

signature: IOAttrs object at 0x7f53072773b0>]
class bacommon.cloud.SecureDataCheckResponse(result: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7f53072776e0>])[source]

Bases: Response

Here’s the result of that data check, boss.

result: IOAttrs object at 0x7f5307276a50>]
class bacommon.cloud.SecureDataCheckerRequest[source]

Bases: Message

Can I get a checker over here?.

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

class bacommon.cloud.SecureDataCheckerResponse(checker: ~typing.Annotated[~bacommon.securedata.SecureDataChecker, <efro.dataclassio.IOAttrs object at 0x7f5307277a10>])[source]

Bases: Response

Here’s that checker ya asked for, boss.

checker: IOAttrs object at 0x7f53072d4170>]
class bacommon.cloud.SendInfoMessage(description: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307882420>])[source]

Bases: Message

User is using the send-info function

description: IOAttrs object at 0x7f5307244f80>]
classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

class bacommon.cloud.SendInfoResponse(handled: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7f5307221bb0>], message: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5307910f50>] = None, legacy_code: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5307221d90>] = None)[source]

Bases: Response

Response to sending into the server.

handled: IOAttrs object at 0x7f53073da150>]
legacy_code: IOAttrs object at 0x7f53073db740>] = None
message: IOAttrs object at 0x7f5307c219d0>] = None
class bacommon.cloud.SignInMessage(login_type: ~typing.Annotated[~bacommon.login.LoginType, <efro.dataclassio.IOAttrs object at 0x7f5307277590>], sign_in_token: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5307864980>], description: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f53072228a0>], apptime: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f5307222870>])[source]

Bases: Message

Can I sign in please?

apptime: IOAttrs object at 0x7f530784e300>]
description: IOAttrs object at 0x7f530784e1e0>]
classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

login_type: IOAttrs object at 0x7f53072d5700>]
sign_in_token: IOAttrs object at 0x7f53072d5b20>]
class bacommon.cloud.SignInResponse(credentials: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5307c22ea0>])[source]

Bases: Response

Here’s that sign-in result you asked for, boss.

credentials: IOAttrs object at 0x7f53072d6060>]
class bacommon.cloud.StoreQueryMessage[source]

Bases: Message

Message asking about purchasable stuff and store related state.

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

class bacommon.cloud.StoreQueryResponse(result: Annotated[Result, IOAttrs('r')], tokens: Annotated[int, IOAttrs('t')], gold_pass: Annotated[bool, IOAttrs('g')], available_purchases: Annotated[list[Purchase], IOAttrs('p')], token_info_url: Annotated[str, IOAttrs('tiu')])[source]

Bases: Response

Here’s that store info you asked for, boss.

class Purchase(purchaseid: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f53072d6d50>])[source]

Bases: object

Info about a purchasable thing.

purchaseid: IOAttrs object at 0x7f53072d6e10>]
class Result(*values)[source]

Bases: Enum

Our overall result.

ERROR = 'e'
SUCCESS = 's'
available_purchases: Annotated[list[Purchase], IOAttrs('p')]
gold_pass: Annotated[bool, IOAttrs('g')]
result: Annotated[Result, IOAttrs('r')]
token_info_url: Annotated[str, IOAttrs('tiu')]
tokens: Annotated[int, IOAttrs('t')]
class bacommon.cloud.TestMessage(testfoo: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f53072d6810>])[source]

Bases: Message

Can I get some of that workspace action?

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

testfoo: IOAttrs object at 0x7f53072d7980>]
class bacommon.cloud.TestResponse(testfoo: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f53072d7bf0>])[source]

Bases: Response

Here’s that workspace you asked for, boss.

testfoo: IOAttrs object at 0x7f53072d6750>]
class bacommon.cloud.WebLocation(*values)[source]

Bases: Enum

Set of places we can be directed on ballistica.net.

ACCOUNT_DELETE_SECTION = 'd'
ACCOUNT_EDITOR = 'e'
class bacommon.cloud.WorkspaceFetchMessage(workspaceid: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f53071045f0>], state: ~typing.Annotated[~bacommon.cloud.WorkspaceFetchState, <efro.dataclassio.IOAttrs object at 0x7f5307104590>])[source]

Bases: Message

Can I get some of that workspace action?

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

state: IOAttrs object at 0x7f53072d64b0>]
workspaceid: IOAttrs object at 0x7f5307245e50>]
class bacommon.cloud.WorkspaceFetchResponse(state: ~typing.Annotated[~bacommon.cloud.WorkspaceFetchState, <efro.dataclassio.IOAttrs object at 0x7f5307245e80>], deletes: ~typing.Annotated[list[str], <efro.dataclassio.IOAttrs object at 0x7f5307246000>] = <factory>, downloads_inline: ~typing.Annotated[dict[str, bytes], <efro.dataclassio.IOAttrs object at 0x7f5307274b00>] = <factory>, done: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7f5307274bc0>] = False)[source]

Bases: Response

Here’s that workspace you asked for, boss.

deletes: IOAttrs object at 0x7f53072768a0>]
done: IOAttrs object at 0x7f5307277050>] = False
downloads_inline: IOAttrs object at 0x7f53072773b0>]
state: IOAttrs object at 0x7f5307106450>]
class bacommon.cloud.WorkspaceFetchState(manifest: ~typing.Annotated[~bacommon.transfer.DirectoryManifest, <efro.dataclassio.IOAttrs object at 0x7f53071065a0>], iteration: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f53071067e0>] = 0, total_deletes: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5307277f50>] = 0, total_downloads: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f53072d4110>] = 0, total_up_to_date: ~typing.Annotated[int | None, <efro.dataclassio.IOAttrs object at 0x7f5307883ad0>] = None)[source]

Bases: object

Common state data for a workspace fetch.

iteration: IOAttrs object at 0x7f53073d97f0>] = 0
manifest: IOAttrs object at 0x7f5307107410>]
total_deletes: IOAttrs object at 0x7f5307864980>] = 0
total_downloads: IOAttrs object at 0x7f530784cb90>] = 0
total_up_to_date: IOAttrs object at 0x7f5307c21760>] = None

bacommon.loggercontrol module

System for managing loggers.

class bacommon.loggercontrol.LoggerControlConfig(levels: ~typing.Annotated[dict[str, int], <efro.dataclassio.IOAttrs object at 0x7f53070e1a30>] = <factory>)[source]

Bases: object

A logging level configuration that applies to all loggers.

Any loggers not explicitly contained in the configuration will be set to NOTSET.

apply(*, warn_unexpected_loggers: bool = False, warn_missing_loggers: bool = False, ignore_log_prefixes: list[str] | None = None) None[source]

Apply the config to all Python loggers.

If ‘warn_unexpected_loggers’ is True, warnings will be issues for any loggers not explicitly covered by the config. This is useful to help ensure controls for all possible loggers are present in a UI/etc.

If ‘warn_missing_loggers’ is True, warnings will be issued for any loggers present in the config that are not found at apply time. This can be useful for pruning settings for no longer used loggers.

Warnings for any log names beginning with any strings in ‘ignore_log_prefixes’ will be suppressed. This can allow ignoring loggers associated with submodules for a given package and instead presenting only a top level logger (or none at all).

apply_diff(diffconfig: LoggerControlConfig) LoggerControlConfig[source]

Apply a diff config to ourself.

Note that values that resolve to NOTSET are left intact in the output config. This is so all loggers expected by either the base or diff config to exist can be created if desired/etc.

diff(baseconfig: LoggerControlConfig) LoggerControlConfig[source]

Return a config containing only changes compared to a base config.

Note that this omits all NOTSET values that resolve to NOTSET in the base config.

This diffed config can later be used with apply_diff() against the base config to recreate the state represented by self.

classmethod from_current_loggers() Self[source]

Build a config from the current set of loggers.

get_effective_level(logname: str) int[source]

Given a log name, predict its level if this config is applied.

levels: IOAttrs object at 0x7f5307014560>]
sanity_check_effective_levels() None[source]

Checks existing loggers to make sure they line up with us.

This can be called periodically to ensure that a control-config is properly driving log levels and that nothing else is changing them behind our back.

would_make_changes() bool[source]

Return whether calling apply would change anything.

bacommon.logging module

Logging functionality.

bacommon.logging.get_base_logger_control_config_client() LoggerControlConfig[source]

Return the logger-control-config used by the ballistica client.

This should remain consistent since local logger configurations are stored relative to this.

bacommon.login module

Functionality related to cloud based assets.

class bacommon.login.LoginType(*values)[source]

Bases: Enum

Types of logins available.

EMAIL = 'email'
GAME_CENTER = 'game_center'
GPGS = 'gpgs'
property displayname: str

Human readable name for this value.

property displaynameshort: str

Human readable name for this value.

bacommon.net module

Network related data and functionality.

class bacommon.net.PrivateHostingConfig(session_type: str = 'ffa', playlist_name: str = 'Unknown', randomize: bool = False, tutorial: bool = False, custom_team_names: tuple[str, str] | None = None, custom_team_colors: tuple[tuple[float, float, float], tuple[float, float, float]] | None = None, playlist: list[dict[str, Any]] | None = None, exit_minutes: float = 120.0, exit_minutes_unclean: float = 180.0, exit_minutes_idle: float = 10.0)[source]

Bases: object

Config provided when hosting a private party.

custom_team_colors: tuple[tuple[float, float, float], tuple[float, float, float]] | None = None
custom_team_names: tuple[str, str] | None = None
exit_minutes: float = 120.0
exit_minutes_idle: float = 10.0
exit_minutes_unclean: float = 180.0
playlist: list[dict[str, Any]] | None = None
playlist_name: str = 'Unknown'
randomize: bool = False
session_type: str = 'ffa'
tutorial: bool = False
class bacommon.net.PrivateHostingState(unavailable_error: str | None = None, party_code: str | None = None, tickets_to_host_now: int = 0, tokens_to_host_now: int = 0, minutes_until_free_host: float | None = None, free_host_minutes_remaining: float | None = None)[source]

Bases: object

Combined state of whether we’re hosting, whether we can, etc.

free_host_minutes_remaining: float | None = None
minutes_until_free_host: float | None = None
party_code: str | None = None
tickets_to_host_now: int = 0
tokens_to_host_now: int = 0
unavailable_error: str | None = None
class bacommon.net.PrivatePartyConnectResult(error: str | None = None, address4: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5306e18140>] = None, address6: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5306fcbfe0>] = None, port: int | None = None, password: str | None = None)[source]

Bases: object

Info about a server we get back when connecting.

address4: IOAttrs object at 0x7f5306fc8a70>] = None
address6: IOAttrs object at 0x7f5306e185f0>] = None
error: str | None = None
password: str | None = None
port: int | None = None
class bacommon.net.ServerNodeEntry(zone: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5306e19370>], latlong: ~typing.Annotated[tuple[float, float] | None, <efro.dataclassio.IOAttrs object at 0x7f5306e192e0>], address: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f53072d66f0>], port: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f53072d6090>])[source]

Bases: object

Information about a specific server.

address: IOAttrs object at 0x7f5307274560>]
latlong: IOAttrs object at 0x7f5306f62900>]
port: IOAttrs object at 0x7f5307274ec0>]
zone: IOAttrs object at 0x7f5306f61b80>]
class bacommon.net.ServerNodeQueryResponse(time: ~typing.Annotated[~datetime.datetime, <efro.dataclassio.IOAttrs object at 0x7f5306f61ca0>], latlong: ~typing.Annotated[tuple[float, float] | None, <efro.dataclassio.IOAttrs object at 0x7f5306f61df0>], ping_per_dist: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f5307105b20>], max_dist: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7f53072769f0>], debug_log_seconds: ~typing.Annotated[float | None, <efro.dataclassio.IOAttrs object at 0x7f5307276ba0>] = None, error: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7f5306f60530>] = None, servers: ~typing.Annotated[list[~bacommon.net.ServerNodeEntry], <efro.dataclassio.IOAttrs object at 0x7f5306f612e0>] = <factory>)[source]

Bases: object

A response to a query about server-nodes.

debug_log_seconds: IOAttrs object at 0x7f5306e1b440>] = None
error: IOAttrs object at 0x7f5307177830>] = None
latlong: IOAttrs object at 0x7f5306e381d0>]
max_dist: IOAttrs object at 0x7f5306e38c50>]
ping_per_dist: IOAttrs object at 0x7f5306e391c0>]
servers: IOAttrs object at 0x7f5306e191c0>]
time: IOAttrs object at 0x7f5306e39fd0>]

bacommon.securedata module

Functionality related to verifying ballistica server generated data.

class bacommon.securedata.SecureDataChecker(starttime: ~typing.Annotated[~datetime.datetime, <efro.dataclassio.IOAttrs object at 0x7f5309c6f5c0>], endtime: ~typing.Annotated[~datetime.datetime, <efro.dataclassio.IOAttrs object at 0x7f5309c7f2f0>], publickeys: ~typing.Annotated[list[bytes], <efro.dataclassio.IOAttrs object at 0x7f5309c7cf50>])[source]

Bases: object

Verifies data as being signed by our master server.

check(data: bytes, signature: bytes) bool[source]

Verify data, returning True if successful.

Note that this call imports and uses the cryptography module and can be slow; it generally should be done in a background thread or on a server.

endtime: IOAttrs object at 0x7f5309c7f2f0>]
publickeys: IOAttrs object at 0x7f5309c7cf50>]
starttime: IOAttrs object at 0x7f5309c6f5c0>]

bacommon.servermanager module

Functionality related to the server manager script.

class bacommon.servermanager.ChatMessageCommand(message: str, clients: list[int] | None)[source]

Bases: ServerCommand

Chat message from the server.

clients: list[int] | None
message: str
class bacommon.servermanager.ClientListCommand[source]

Bases: ServerCommand

Print a list of clients.

class bacommon.servermanager.KickCommand(client_id: int, ban_time: int | None)[source]

Bases: ServerCommand

Kick a client.

ban_time: int | None
client_id: int
class bacommon.servermanager.ScreenMessageCommand(message: str, color: tuple[float, float, float] | None, clients: list[int] | None)[source]

Bases: ServerCommand

Screen-message from the server.

clients: list[int] | None
color: tuple[float, float, float] | None
message: str
class bacommon.servermanager.ServerCommand[source]

Bases: object

Base class for commands that can be sent to the server.

class bacommon.servermanager.ServerConfig(party_name: str = 'FFA', party_is_public: bool = True, authenticate_clients: bool = True, admins: list[str] = <factory>, enable_default_kick_voting: bool = True, public_ipv4_address: str | None = None, public_ipv6_address: str | None = None, port: int = 43210, max_party_size: int = 6, session_max_players_override: int | None = None, session_type: str = 'ffa', playlist_code: int | None = None, playlist_inline: list[dict[str, ~typing.Any]] | None = None, playlist_shuffle: bool = True, auto_balance_teams: bool = True, coop_campaign: str = 'Easy', coop_level: str = 'Onslaught Training', enable_telnet: bool = False, teams_series_length: int = 7, ffa_series_length: int = 24, stats_url: str | None = None, clean_exit_minutes: float | None = None, unclean_exit_minutes: float | None = None, idle_exit_minutes: float | None = None, show_tutorial: bool = False, team_names: tuple[str, str] | None = None, team_colors: tuple[tuple[float, float, float], tuple[float, float, float]] | None = None, enable_queue: bool = True, protocol_version: int | None = None, stress_test_players: int | None = None, player_rejoin_cooldown: float = 10.0, log_levels: dict[str, str] | None = None)[source]

Bases: object

Configuration for the server manager app (<appname>_server).

admins: list[str]
authenticate_clients: bool = True
auto_balance_teams: bool = True
clean_exit_minutes: float | None = None
coop_campaign: str = 'Easy'
coop_level: str = 'Onslaught Training'
enable_default_kick_voting: bool = True
enable_queue: bool = True
enable_telnet: bool = False
ffa_series_length: int = 24
idle_exit_minutes: float | None = None
log_levels: dict[str, str] | None = None
max_party_size: int = 6
party_is_public: bool = True
party_name: str = 'FFA'
player_rejoin_cooldown: float = 10.0
playlist_code: int | None = None
playlist_inline: list[dict[str, Any]] | None = None
playlist_shuffle: bool = True
port: int = 43210
protocol_version: int | None = None
public_ipv4_address: str | None = None
public_ipv6_address: str | None = None
session_max_players_override: int | None = None
session_type: str = 'ffa'
show_tutorial: bool = False
stats_url: str | None = None
stress_test_players: int | None = None
team_colors: tuple[tuple[float, float, float], tuple[float, float, float]] | None = None
team_names: tuple[str, str] | None = None
teams_series_length: int = 7
unclean_exit_minutes: float | None = None
class bacommon.servermanager.ShutdownCommand(reason: ShutdownReason, immediate: bool)[source]

Bases: ServerCommand

Tells the server to shut down.

immediate: bool
reason: ShutdownReason
class bacommon.servermanager.ShutdownReason(*values)[source]

Bases: Enum

Reason a server is shutting down.

NONE = 'none'
RESTARTING = 'restarting'
class bacommon.servermanager.StartServerModeCommand(config: ServerConfig)[source]

Bases: ServerCommand

Tells the app to switch into ‘server’ mode.

config: ServerConfig

bacommon.transfer module

Functionality related to transferring files/data.

class bacommon.transfer.DirectoryManifest(files: ~typing.Annotated[dict[str, ~bacommon.transfer.DirectoryManifestFile], <efro.dataclassio.IOAttrs object at 0x7f5306ce59a0>], exists: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7f53071044a0>])[source]

Bases: object

Contains a summary of files in a directory.

classmethod create_from_disk(path: Path) DirectoryManifest[source]

Create a manifest from a directory on disk.

exists: IOAttrs object at 0x7f5306c9d0a0>]
files: IOAttrs object at 0x7f5306fcaf60>]
validate() None[source]

Log any odd data in the manifest; for debugging.

class bacommon.transfer.DirectoryManifestFile(hash_sha256: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7f5306c5c5c0>], size: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7f5306c5f860>])[source]

Bases: object

Describes a file in a manifest.

hash_sha256: IOAttrs object at 0x7f5306ce5880>]
size: IOAttrs object at 0x7f5306ce73b0>]

Module contents

Functionality and data common to ballistica client and server components.