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:
CloudDialogA basic UI for the client.
- class ButtonLabel(*values)[source]¶
Bases:
EnumDistinct 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:
EnumOverall 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:
BasicCloudDialogComponentShow 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:
BasicCloudDialogComponentShow 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:
BasicCloudDialogComponentShow 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:
EnumType 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:
BasicCloudDialogComponentAn 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:
BasicCloudDialogComponentShow 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:
BasicCloudDialogComponentShow 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:
MessageRequest action about a chest.
- class Action(*values)[source]¶
Bases:
EnumTypes 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:
ResponseHere’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:
DisplayItemDisplay 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:
MessageRequest info about a chest.
- class bacommon.bs.ChestInfoResponse(chest: Chest | None, user_tokens: int | None)[source]¶
Bases:
ResponseHere’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:
objectA lovely chest.
- class PrizeSet(weight: float, contents: list[DisplayItemWrapper])[source]¶
Bases:
objectA 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:
objectLive 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:
objectA lovely chest.
- appearance: ClassicChestAppearance¶
- class LeagueType(*values)[source]¶
Bases:
EnumType of league we are in.
- BRONZE = 'b'¶
- DIAMOND = 'd'¶
- GOLD = 'g'¶
- SILVER = 's'¶
- league_type: LeagueType | None¶
- class bacommon.bs.ClassicChestAppearance(*values)[source]¶
Bases:
EnumAppearances 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:
ClientEffectAnimate 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:
ClientEffectDelay effect processing.
- classmethod get_type_id() ClientEffectTypeID[source]¶
Return the type-id for this subclass.
- class bacommon.bs.ClientEffectLegacyScreenMessage(message: str, subs: list[str] = <factory>, color: tuple[float, float, float] = (1.0, 1.0, 1.0))[source]¶
Bases:
ClientEffectDisplay a screen-message (Legacy version).
This will be processed as an Lstr with translation category ‘serverResponses’.
When possible, migrate to using
ClientEffectScreenMessage.- classmethod get_type_id() ClientEffectTypeID[source]¶
Return the type-id for this subclass.
- class bacommon.bs.ClientEffectScreenMessage(message: str, color: tuple[float, float, float] = (1.0, 1.0, 1.0), is_lstr: bool = False)[source]¶
Bases:
ClientEffectDisplay a screen-message.
Supported on engine build 22606 or newer.
This version does no translation by default (expecting translation to happen server-side). Pass a Lstr json string and set is_lstr=True for client-side translation.
- 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:
ClientEffectPlay a sound.
- class Sound(*values)[source]¶
Bases:
EnumSounds 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:
ClientEffectAnimate 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:
ClientEffectAnimate tokens count.
- classmethod get_type_id() ClientEffectTypeID[source]¶
Return the type-id for this subclass.
- class bacommon.bs.ClientEffectTypeID(*values)[source]¶
Bases:
EnumType ID for each of our subclasses.
- CHEST_WAIT_TIME_ANIMATION = 't'¶
- DELAY = 'd'¶
- LEGACY_SCREEN_MESSAGE = 'm'¶
- SCREEN_MESSAGE = 'sm'¶
- SOUND = 's'¶
- TICKETS_ANIMATION = 'ta'¶
- TOKENS_ANIMATION = 'toa'¶
- UNKNOWN = 'u'¶
- class bacommon.bs.ClientEffectUnknown[source]¶
Bases:
ClientEffectFallback 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
bacommon.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:
EnumTypes of actions we can run.
- BUTTON_PRESS_NEGATIVE = 'n'¶
- BUTTON_PRESS_POSITIVE = 'p'¶
- class bacommon.bs.CloudDialogActionMessage(id: str, action: CloudDialogAction)[source]¶
Bases:
MessageDo something to a client ui.
- action: CloudDialogAction¶
- class bacommon.bs.CloudDialogActionResponse(error_type: ErrorType | None, error_message: str | None, effects: list[ClientEffect])[source]¶
Bases:
ResponseDid something to that inbox entry, boss.
- class ErrorType(*values)[source]¶
Bases:
EnumTypes of errors that may have occurred.
- EXPIRED = 'e'¶
- INTERNAL = 'i'¶
- UNKNOWN = 'u'¶
- effects: list[ClientEffect]¶
- class bacommon.bs.CloudDialogTypeID(*values)[source]¶
Bases:
EnumType ID for each of our subclasses.
- BASIC = 'b'¶
- UNKNOWN = 'u'¶
- class bacommon.bs.CloudDialogWrapper(id: str, createtime: datetime, ui: CloudDialog)[source]¶
Bases:
objectWrapper for a CloudDialog and its common data.
- ui: CloudDialog¶
- 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:
EnumType 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:
objectWraps 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:
MessageAsking for current account’s classic purchases.
- class bacommon.bs.GetClassicPurchasesResponse(purchases: set[str])[source]¶
Bases:
ResponseHere’s those classic purchases ya asked for boss.
- class bacommon.bs.GlobalProfileCheckMessage(name: str)[source]¶
Bases:
MessageIs this global profile name available?
- class bacommon.bs.GlobalProfileCheckResponse(available: bool, ticket_cost: int)[source]¶
Bases:
ResponseHere’s that profile check ya asked for boss.
- class bacommon.bs.InboxRequestResponse(wrappers: list[CloudDialogWrapper], error: str | None = None)[source]¶
Bases:
ResponseHere’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:
MessageA generic request for the legacy master server.
- class bacommon.bs.LegacyResponse(data: str | None, zipped: bool)[source]¶
Bases:
ResponseResponse for generic legacy request.
- class bacommon.bs.PrivatePartyMessage(need_datacode: bool)[source]¶
Bases:
MessageMessage 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:
ResponseHere’s that private party UI info you asked for, boss.
- class bacommon.bs.ScoreSubmitMessage(score_token: str)[source]¶
Bases:
MessageLet the server know we got some score in something.
- class bacommon.bs.ScoreSubmitResponse(effects: list[ClientEffect])[source]¶
Bases:
ResponseDid something to that inbox entry, boss.
- effects: list[ClientEffect]¶
- class bacommon.bs.SendInfoMessage(description: str)[source]¶
Bases:
MessageUser 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:
ResponseResponse to sending info to the server.
- effects: list[ClientEffect]¶
- class bacommon.bs.TestDisplayItem[source]¶
Bases:
DisplayItemFills 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:
DisplayItemSome 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:
DisplayItemSome 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:
CloudDialogFallback type for unrecognized entries.
- classmethod get_type_id() CloudDialogTypeID[source]¶
Return the type-id for this subclass.
- class bacommon.bs.UnknownDisplayItem[source]¶
Bases:
DisplayItemSomething 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.