baclassic package¶
Submodules¶
baclassic.macmusicapp module¶
Music playback functionality using the Mac Music (formerly iTunes) app.
- class baclassic.macmusicapp.MacMusicAppMusicPlayer[source]¶
Bases:
MusicPlayer
A music-player that utilizes the macOS Music.app for playback.
Allows selecting playlists as entries.
- get_playlists(callback: Callable) None [source]¶
Asynchronously fetch the list of available iTunes playlists.
- on_select_entry(callback: Callable[[Any], None], current_entry: Any, selection_target_name: str) bauiv1.MainWindow [source]¶
Present a GUI to select an entry.
The callback should be called with a valid entry or None to signify that the default soundtrack should be used..
baclassic.osmusic module¶
Music playback using OS functionality exposed through the C++ layer.
- class baclassic.osmusic.OSMusicPlayer[source]¶
Bases:
MusicPlayer
Music player that talks to internal C++ layer for functionality.
(internal)
- classmethod get_valid_music_file_extensions() list[str] [source]¶
Return file extensions for types playable on this device.
- on_select_entry(callback: Callable[[Any], None], current_entry: Any, selection_target_name: str) bauiv1.MainWindow [source]¶
Present a GUI to select an entry.
The callback should be called with a valid entry or None to signify that the default soundtrack should be used..
Module contents¶
Components for the classic BombSquad experience.
This package is used as a dumping ground for functionality that is necessary to keep classic BombSquad working, but which may no longer be the best way to do things going forward.
New code should try to avoid using code from here when possible.
Functionality in this package should be exposed through the ClassicAppSubsystem. This allows type-checked code to go through the babase.app.classic singleton which forces it to explicitly handle the possibility of babase.app.classic being None. When code instead imports classic submodules directly, it is much harder to make it cleanly handle classic not being present.
- class baclassic.Achievement(name: str, icon_name: str, icon_color: Sequence[float], level_name: str, award: int, hard_mode_only: bool = False)¶
Bases:
object
Represents attributes and state for an individual achievement.
Category: App Classes
- announce_completion(sound: bool = True) None [source]¶
Kick off an announcement for this achievement’s completion.
- property complete: bool¶
Whether this Achievement is currently complete.
- create_display(x: float, y: float, delay: float, *, outdelay: float | None = None, color: Sequence[float] | None = None, style: str = 'post_game') list[bascenev1.Actor] [source]¶
Create a display for the Achievement.
Shows the Achievement icon, name, and description.
- property description_complete: Lstr¶
Get a babase.Lstr for the Achievement’s description when complete.
- property description_full_complete: Lstr¶
Get a babase.Lstr for the Achievement’s full desc. when completed.
- get_award_ticket_value(include_pro_bonus: bool = False) int [source]¶
Get the ticket award value for this achievement.
- get_icon_color(complete: bool) Sequence[float] [source]¶
Return the color tint for this Achievement’s icon.
- get_icon_texture(complete: bool) Texture [source]¶
Return the icon texture to display for this achievement
- get_icon_ui_texture(complete: bool) Texture [source]¶
Return the icon texture to display for this achievement
- property hard_mode_only: bool¶
Whether this Achievement is only unlockable in hard-mode.
- property level_name: str¶
The name of the level this achievement applies to.
- property name: str¶
The name of this achievement.
- property power_ranking_value: int¶
Get the power-ranking award value for this achievement.
- class baclassic.AchievementSubsystem¶
Bases:
object
Subsystem for achievement handling.
Category: App Classes
Access the single shared instance of this class at ‘ba.app.ach’.
- achievements_for_coop_level(level_name: str) list[Achievement] [source]¶
Given a level name, return achievements available for it.
- award_local_achievement(achname: str) None [source]¶
For non-game-based achievements such as controller-connection.
- display_achievement_banner(achname: str) None [source]¶
Display a completion banner for an achievement.
(internal)
Used for server-driven achievements.
- get_achievement(name: str) Achievement [source]¶
Return an Achievement by name.
- class baclassic.ClassicAppMode¶
Bases:
AppMode
AppMode for the classic BombSquad experience.
- classmethod get_app_experience() AppExperience [source]¶
Return the overall experience provided by this mode.
- on_app_active_changed() None [source]¶
Called when ba*.app.active changes while this mode is active.
The app-mode may want to take action such as pausing a running game in such cases.
- update_for_primary_account(account: AccountV2Handle | None) None [source]¶
Update subscriptions/etc. for a new primary account state.
- class baclassic.ClassicAppSubsystem¶
Bases:
AppSubsystem
Subsystem for classic functionality in the app.
The single shared instance of this app can be accessed at babase.app.classic. Note that it is possible for babase.app.classic to be None if the classic package is not present, and code should handle that case gracefully.
- class MusicPlayMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
Influences behavior when playing music.
Category: Enums
- REGULAR = 'regular'¶
- TEST = 'test'¶
- add_coop_practice_level(level: Level) None [source]¶
Adds an individual level to the ‘practice’ section in Co-op.
(internal)
(internal)
- get_input_device_config(inputdevice: InputDevice, default: bool) tuple[dict, str] [source]¶
Given an input device, return its config dict in the app config.
The dict will be created if it does not exist.
- get_input_device_map_hash(inputdevice: InputDevice) str [source]¶
Given an input device, return hash based on its raw input values.
- get_input_device_mapped_value(device: bascenev1.InputDevice, name: str, default: bool = False) Any [source]¶
Return a mapped value for an input device.
This checks the user config and falls back to default values where available.
(internal)
- get_player_colors() list[tuple[float, float, float]] [source]¶
Return user-selectable player colors.
- get_player_profile_colors(profilename: str | None, profiles: dict[str, dict[str, Any]] | None = None) tuple[tuple[float, float, float], tuple[float, float, float]] [source]¶
Given a profile, return colors for them.
- get_player_profile_icon(profilename: str) str [source]¶
Given a profile name, returns an icon string for it.
(non-account profiles only)
- get_tournament_prize_strings(entry: dict[str, Any]) list[str] [source]¶
Given a tournament entry, return strings for its prize levels.
- getmaps(playtype: str) list[str] [source]¶
Return a list of bascenev1.Map types supporting a playtype str.
Category: Asset Functions
Maps supporting a given playtype must provide a particular set of features and lend themselves to a certain style of play.
Play Types:
- ‘melee’
General fighting map. Has one or more ‘spawn’ locations.
- ‘team_flag’
For games such as Capture The Flag where each team spawns by a flag. Has two or more ‘spawn’ locations, each with a corresponding ‘flag’ location (based on index).
- ‘single_flag’
For games such as King of the Hill or Keep Away where multiple teams are fighting over a single flag. Has two or more ‘spawn’ locations and 1 ‘flag_default’ location.
- ‘conquest’
For games such as Conquest where flags are spread throughout the map - has 2+ ‘flag’ locations, 2+ ‘spawn_by_flag’ locations.
- ‘king_of_the_hill’ - has 2+ ‘spawn’ locations,
1+ ‘flag_default’ locations, and 1+ ‘powerup_spawn’ locations
- ‘hockey’
For hockey games. Has two ‘goal’ locations, corresponding ‘spawn’ locations, and one ‘flag_default’ location (for where puck spawns)
- ‘football’
For football games. Has two ‘goal’ locations, corresponding ‘spawn’ locations, and one ‘flag_default’ location (for where flag/ball/etc. spawns)
- ‘race’
For racing games where players much touch each region in order. Has two or more ‘race_point’ locations.
Bring up main menu ui.
- classmethod json_prep(data: Any) Any [source]¶
Return a json-friendly version of the provided data.
This converts any tuples to lists and any bytes to strings (interpreted as utf-8, ignoring errors). Logs errors (just once) if any data is modified/discarded/unsupported.
- launch_coop_game(game: str, force: bool = False, args: dict | None = None) bool [source]¶
High level way to launch a local co-op session.
- property legacy_user_agent_string: str¶
String containing various bits of info about OS/device/etc.
- master_server_v1_get(request: str, data: dict[str, Any], callback: MasterServerCallback | None = None, response_type: MasterServerResponseType = MasterServerResponseType.JSON) None [source]¶
Make a call to the master server via a http GET.
- master_server_v1_post(request: str, data: dict[str, Any], callback: MasterServerCallback | None = None, response_type: MasterServerResponseType = MasterServerResponseType.JSON) None [source]¶
Make a call to the master server via a http POST.
- on_app_loading() None [source]¶
Called when the app reaches the loading state.
Note that subsystems created after the app switches to the loading state will not receive this callback. Subsystems created by plugins are an example of this.
- pause() None [source]¶
Pause the game due to a user request or menu popping up.
If there’s a foreground host-activity that says it’s pausable, tell it to pause. Note: we now no longer pause if there are connected clients.
- property platform: str¶
Name of the current platform.
Examples are: ‘mac’, ‘windows’, android’.
- preload_map_preview_media() None [source]¶
Preload media needed for map preview UIs.
Category: Asset Functions
- profile_browser_window(transition: str = 'in_right', origin_widget: Widget | None = None, selected_profile: str | None = None) None [source]¶
(internal)
- resume() None [source]¶
Resume the game due to a user request or menu closing.
If there’s a foreground host-activity that’s currently paused, tell it to resume.
Attempt to cleanly get back to the main menu.
- run_stress_test(*, playlist_type: str = 'Random', playlist_name: str = '__default__', player_count: int = 8, round_duration: int = 30, attract_mode: bool = False) None [source]¶
Run a stress test.
- property subplatform: str¶
String for subplatform.
Can be empty. For the ‘android’ platform, subplatform may be ‘google’, ‘amazon’, etc.
- tournament_entry_window(tournament_id: str, *, tournament_activity: bascenev1.Activity | None = None, position: tuple[float, float] = (0.0, 0.0), delegate: Any = None, scale: float | None = None, offset: tuple[float, float] = (0.0, 0.0), on_close_call: Callable[[], Any] | None = None) None [source]¶
(internal)