bacommon.bs package¶
Functionality related to bombsquad classic.
- class bacommon.bs.BasicCloudDialog(components: list[BasicCloudDialogComponent], interaction_style: InteractionStyle = InteractionStyle.BUTTON_POSITIVE, button_label_positive: ButtonLabel = ButtonLabel.OK, button_label_negative: ButtonLabel = ButtonLabel.CANCEL)[source]¶
Bases:
CloudDialog
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: ButtonLabel = 'c'¶
- button_label_positive: ButtonLabel = 'o'¶
- components: list[BasicCloudDialogComponent]¶
- classmethod get_type_id() CloudDialogTypeID [source]¶
Return the type-id for this subclass.
- interaction_style: InteractionStyle = 'p'¶
- class bacommon.bs.BasicCloudDialogBsClassicTourneyResult(tournament_id: str, game: str, players: int, rank: int, trophy: str | None, prizes: list[DisplayItemWrapper])[source]¶
Bases:
BasicCloudDialogComponent
Show info about a classic tourney.
- classmethod get_type_id() BasicCloudDialogComponentTypeID [source]¶
Return the type-id for this subclass.
- prizes: list[DisplayItemWrapper]¶
- class bacommon.bs.BasicCloudDialogComponent[source]¶
Bases:
IOMultiType
[BasicCloudDialogComponentTypeID
]Top level class for our multitype.
- classmethod get_type(type_id: BasicCloudDialogComponentTypeID) type[BasicCloudDialogComponent] [source]¶
Return the subclass for each of our type-ids.
- classmethod get_type_id() BasicCloudDialogComponentTypeID [source]¶
Return the type-id for this subclass.
- classmethod get_unknown_type_fallback() BasicCloudDialogComponent [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.BasicCloudDialogComponentLink(url: str, label: str, subs: list[str] = <factory>, spacing_top: float = 0.0, spacing_bottom: float = 0.0)[source]¶
Bases:
BasicCloudDialogComponent
Show a link in the inbox message.
- classmethod get_type_id() BasicCloudDialogComponentTypeID [source]¶
Return the type-id for this subclass.
- class bacommon.bs.BasicCloudDialogComponentText(text: str, subs: list[str] = <factory>, scale: float = 1.0, color: tuple[float, float, float, float] = (1.0, 1.0, 1.0, 1.0), spacing_top: float = 0.0, spacing_bottom: float = 0.0)[source]¶
Bases:
BasicCloudDialogComponent
Show some text in the inbox message.
- classmethod get_type_id() BasicCloudDialogComponentTypeID [source]¶
Return the type-id for this subclass.
- class bacommon.bs.BasicCloudDialogComponentTypeID(*values)[source]¶
Bases:
Enum
Type ID for each of our subclasses.
- BS_CLASSIC_TOURNEY_RESULT = 'ct'¶
- DISPLAY_ITEMS = 'di'¶
- EXPIRE_TIME = 'd'¶
- LINK = 'l'¶
- TEXT = 't'¶
- UNKNOWN = 'u'¶
- class bacommon.bs.BasicCloudDialogComponentUnknown[source]¶
Bases:
BasicCloudDialogComponent
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() BasicCloudDialogComponentTypeID [source]¶
Return the type-id for this subclass.
- class bacommon.bs.BasicCloudDialogDisplayItems(items: list[DisplayItemWrapper], width: float = 100.0, spacing_top: float = 0.0, spacing_bottom: float = 0.0)[source]¶
Bases:
BasicCloudDialogComponent
Show some display-items.
- classmethod get_type_id() BasicCloudDialogComponentTypeID [source]¶
Return the type-id for this subclass.
- items: list[DisplayItemWrapper]¶
- class bacommon.bs.BasicCloudDialogExpireTime(time: datetime, spacing_top: float = 0.0, spacing_bottom: float = 0.0)[source]¶
Bases:
BasicCloudDialogComponent
Show expire-time.
- classmethod get_type_id() BasicCloudDialogComponentTypeID [source]¶
Return the type-id for this subclass.
- class bacommon.bs.ChestActionMessage(action: Action, token_payment: int, chest_id: str)[source]¶
Bases:
Message
Request action about a chest.
- class Action(*values)[source]¶
Bases:
Enum
Types of actions we can request.
- AD = 'ad'¶
- UNLOCK = 'u'¶
- class bacommon.bs.ChestActionResponse(tokens_charged: int = 0, contents: list[~bacommon.bs._displayitem.DisplayItemWrapper] | None = None, prizeindex: int = 0, error: str | None = None, warning: str | None = None, success_msg: str | None = None, effects: list[~bacommon.bs._clienteffect.ClientEffect] = <factory>)[source]¶
Bases:
Response
Here’s the results of that action you asked for, boss.
- contents: list[DisplayItemWrapper] | None = None¶
- effects: list[ClientEffect]¶
- class bacommon.bs.ChestDisplayItem(appearance: ClassicChestAppearance)[source]¶
Bases:
DisplayItem
Display a chest.
- appearance: ClassicChestAppearance¶
- 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: str)[source]¶
Bases:
Message
Request info about a chest.
- class bacommon.bs.ChestInfoResponse(chest: Chest | None, user_tokens: int | None)[source]¶
Bases:
Response
Here’s that chest info you asked for, boss.
- class Chest(appearance: ClassicChestAppearance, unlock_tokens: int, unlock_time: datetime.datetime, prizesets: list[PrizeSet], ad_allow: bool)[source]¶
Bases:
object
A lovely chest.
- class PrizeSet(weight: float, contents: list[DisplayItemWrapper])[source]¶
Bases:
object
A possible set of prizes for this chest.
- contents: list[DisplayItemWrapper]¶
- appearance: ClassicChestAppearance¶
- unlock_time: datetime.datetime¶
- class bacommon.bs.ClassicAccountLiveData(tickets: int, tokens: int, gold_pass: bool, remove_ads: bool, achievements: int, achievements_total: int, league_type: LeagueType | None, league_num: int | None, league_rank: int | None, level: int, xp: int, xpmax: int, inbox_count: int, inbox_count_is_max: bool, inbox_contains_prize: bool, chests: dict[str, Chest], purchases_state: str | None, flags: set[Flag])[source]¶
Bases:
object
Live account data fed to the client in the bs classic app mode.
- class Chest(appearance: ClassicChestAppearance, create_time: datetime, unlock_time: datetime, unlock_tokens: int, ad_allow_time: datetime | None)[source]¶
Bases:
object
A lovely chest.
- appearance: ClassicChestAppearance¶
- class LeagueType(*values)[source]¶
Bases:
Enum
Type of league we are in.
- BRONZE = 'b'¶
- DIAMOND = 'd'¶
- GOLD = 'g'¶
- SILVER = 's'¶
- league_type: LeagueType | None¶
- 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'¶
- 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: str, duration: float, startvalue: datetime, endvalue: datetime)[source]¶
Bases:
ClientEffect
Animate chest wait time changing.
- classmethod get_type_id() ClientEffectTypeID [source]¶
Return the type-id for this subclass.
- class bacommon.bs.ClientEffectDelay(seconds: float)[source]¶
Bases:
ClientEffect
Delay effect processing.
- classmethod get_type_id() ClientEffectTypeID [source]¶
Return the type-id for this subclass.
- class bacommon.bs.ClientEffectScreenMessage(message: str, subs: list[str] = <factory>, color: tuple[float, float, float] = (1.0, 1.0, 1.0))[source]¶
Bases:
ClientEffect
Display a screen-message.
- classmethod get_type_id() ClientEffectTypeID [source]¶
Return the type-id for this subclass.
- class bacommon.bs.ClientEffectSound(sound: Sound, volume: float = 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.
- class bacommon.bs.ClientEffectTicketsAnimation(duration: float, startvalue: int, endvalue: int)[source]¶
Bases:
ClientEffect
Animate tickets count.
- classmethod get_type_id() ClientEffectTypeID [source]¶
Return the type-id for this subclass.
- class bacommon.bs.ClientEffectTokensAnimation(duration: float, startvalue: int, endvalue: int)[source]¶
Bases:
ClientEffect
Animate tokens count.
- classmethod get_type_id() ClientEffectTypeID [source]¶
Return the type-id for this subclass.
- 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.CloudDialog[source]¶
Bases:
IOMultiType
[CloudDialogTypeID
]Small self-contained ui bit provided by the cloud.
These take care of updating and/or dismissing themselves based on user input. Useful for things such as inbox messages. For more complex UI construction, look at
CloudUI
.- classmethod get_type(type_id: CloudDialogTypeID) type[CloudDialog] [source]¶
Return the subclass for each of our type-ids.
- classmethod get_type_id() CloudDialogTypeID [source]¶
Return the type-id for this subclass.
- classmethod get_unknown_type_fallback() CloudDialog [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.CloudDialogAction(*values)[source]¶
Bases:
Enum
Types of actions we can run.
- BUTTON_PRESS_NEGATIVE = 'n'¶
- BUTTON_PRESS_POSITIVE = 'p'¶
- class bacommon.bs.CloudDialogActionMessage(id: str, action: CloudDialogAction)[source]¶
Bases:
Message
Do something to a client ui.
- action: CloudDialogAction¶
- class bacommon.bs.CloudDialogActionResponse(error_type: ErrorType | None, error_message: str | None, effects: list[ClientEffect])[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: list[ClientEffect]¶
- class bacommon.bs.CloudDialogTypeID(*values)[source]¶
Bases:
Enum
Type ID for each of our subclasses.
- BASIC = 'b'¶
- UNKNOWN = 'u'¶
- class bacommon.bs.CloudDialogWrapper(id: str, createtime: datetime, ui: CloudDialog)[source]¶
Bases:
object
Wrapper for a CloudDialog and its common data.
- ui: CloudDialog¶
- class bacommon.bs.CloudUI[source]¶
Bases:
IOMultiType
[CloudUITypeID
]UI defined by the cloud.
Conceptually similar to a basic html page, except using app UI.
- classmethod get_type(type_id: CloudUITypeID) type[CloudUI] [source]¶
Return the subclass for each of our type-ids.
- classmethod get_type_id() CloudUITypeID [source]¶
Return the type-id for this subclass.
- class bacommon.bs.CloudUITypeID(*values)[source]¶
Bases:
Enum
Type ID for each of our subclasses.
- UNKNOWN = 'u'¶
- V1 = 'v1'¶
- class bacommon.bs.DisplayItem[source]¶
Bases:
IOMultiType
[DisplayItemTypeID
]Some amount of something that can be shown or described.
Used to depict chest contents, inventory, rewards, etc.
- 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: DisplayItem, description: str, description_subs: list[str] | None)[source]¶
Bases:
object
Wraps a DisplayItem and common info.
- classmethod for_display_item(item: DisplayItem) DisplayItemWrapper [source]¶
Convenience method to wrap a DisplayItem.
- item: DisplayItem¶
- class bacommon.bs.GetClassicPurchasesMessage[source]¶
Bases:
Message
Asking for current account’s classic purchases.
- class bacommon.bs.GetClassicPurchasesResponse(purchases: set[str])[source]¶
Bases:
Response
Here’s those classic purchases ya asked for boss.
- class bacommon.bs.GlobalProfileCheckMessage(name: str)[source]¶
Bases:
Message
Is this global profile name available?
- class bacommon.bs.GlobalProfileCheckResponse(available: bool, ticket_cost: int)[source]¶
Bases:
Response
Here’s that profile check ya asked for boss.
- class bacommon.bs.InboxRequestResponse(wrappers: list[CloudDialogWrapper], error: str | None = None)[source]¶
Bases:
Response
Here’s that inbox contents you asked for, boss.
- wrappers: list[CloudDialogWrapper]¶
- class bacommon.bs.LegacyRequest(request: str, request_type: str, user_agent_string: str, data: str)[source]¶
Bases:
Message
A generic request for the legacy master server.
- class bacommon.bs.LegacyResponse(data: str | None, zipped: bool)[source]¶
Bases:
Response
Response for generic legacy request.
- class bacommon.bs.PrivatePartyMessage(need_datacode: bool)[source]¶
Bases:
Message
Message asking about info we need for private-party UI.
- class bacommon.bs.PrivatePartyResponse(success: bool, tokens: int, gold_pass: bool, datacode: str | None)[source]¶
Bases:
Response
Here’s that private party UI info you asked for, boss.
- class bacommon.bs.ScoreSubmitMessage(score_token: str)[source]¶
Bases:
Message
Let the server know we got some score in something.
- class bacommon.bs.ScoreSubmitResponse(effects: list[ClientEffect])[source]¶
Bases:
Response
Did something to that inbox entry, boss.
- effects: list[ClientEffect]¶
- class bacommon.bs.SendInfoMessage(description: str)[source]¶
Bases:
Message
User is using the send-info function.
- class bacommon.bs.SendInfoResponse(handled: bool, message: str | None = None, effects: list[~bacommon.bs._clienteffect.ClientEffect] = <factory>, legacy_code: str | None = None)[source]¶
Bases:
Response
Response to sending info to the server.
- effects: list[ClientEffect]¶
- 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: int)[source]¶
Bases:
DisplayItem
Some amount of tickets.
- 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: int)[source]¶
Bases:
DisplayItem
Some amount of tokens.
- 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.UnknownCloudDialog[source]¶
Bases:
CloudDialog
Fallback type for unrecognized entries.
- classmethod get_type_id() CloudDialogTypeID [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.