From 5b3507ed9a61af469aa03b3cab0bc5da1a64e0cf Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Thu, 23 Jan 2025 15:38:04 -0800 Subject: [PATCH] added ability to get chests and other rewards from co-op scores --- .efrocachemap | 76 +++++++++---------- CHANGELOG.md | 2 +- src/assets/ba_data/python/baenv.py | 2 +- src/assets/ba_data/python/baplus/_cloud.py | 9 +++ .../python/bascenev1lib/activity/coopscore.py | 30 ++++++++ .../ba_data/python/bascenev1lib/mainmenu.py | 2 + src/ballistica/shared/ballistica.cc | 2 +- tools/bacommon/bs.py | 22 ++++++ 8 files changed, 104 insertions(+), 41 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 5451e13a..2d1f827e 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -432,7 +432,7 @@ "build/assets/ba_data/audio/zoeOw.ogg": "b2d705c31c9dcc1efdc71394764c3beb", "build/assets/ba_data/audio/zoePickup01.ogg": "e9366dc2d2b8ab8b0c4e2c14c02d0789", "build/assets/ba_data/audio/zoeScream01.ogg": "903e0e45ee9b3373e9d9ce20c814374e", - "build/assets/ba_data/data/langdata.json": "78cd35847b68872e90bbfe79f13821bc", + "build/assets/ba_data/data/langdata.json": "8d49fa91845f43ec8bff3ad3f4895e69", "build/assets/ba_data/data/languages/arabic.json": "32b9849fb8389b8c7798f0b744620318", "build/assets/ba_data/data/languages/belarussian.json": "009b452aa308bf2b2f7e92d9b78ba5ff", "build/assets/ba_data/data/languages/chinese.json": "5363a79f843e6be7ef47a840f47cc17d", @@ -462,7 +462,7 @@ "build/assets/ba_data/data/languages/russian.json": "780d1857df77ef59104d5dac75415bd6", "build/assets/ba_data/data/languages/serbian.json": "623fa4129a1154c2f32ed7867e56ff6a", "build/assets/ba_data/data/languages/slovak.json": "c11c29708b3742cdc2a92b4fa0d6d29f", - "build/assets/ba_data/data/languages/spanish.json": "ccb08a06f13d56c5d0b752a03c49865e", + "build/assets/ba_data/data/languages/spanish.json": "83baf596f8d29ebb965051bf280424c6", "build/assets/ba_data/data/languages/swedish.json": "3b179e7333183c70adb0811246b09959", "build/assets/ba_data/data/languages/tamil.json": "ead39b864228696a9b0d19344bc4b5ec", "build/assets/ba_data/data/languages/thai.json": "383540a1e9c7c131ac579f51afc87471", @@ -4174,42 +4174,42 @@ "build/assets/windows/Win32/ucrtbased.dll": "bfd1180c269d3950b76f35a63655e9e1", "build/assets/windows/Win32/vc_redist.x86.exe": "15a5f1f876503885adbdf5b3989b3718", "build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "9586059917b68d5e1c63e6e4c2a65b97", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "5c96ded4f5ac876ad063a8194062c828", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "77cfa82b16ecdf951b2dc95927e78a84", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "4becd7098fe72c991917ad853161348b", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "068ad5fd9d6a2a9332398a3b06bfea9f", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "5feeadb78a562da1957ee85513ffe97e", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "80137664014da1e3379a0e0ea2d2d972", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "7b5d8ff3b7263ff742c48223b70501eb", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "43d40f78287c703f8d62977421f420d3", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "7f512c46f11bffa6149fa588d746fe34", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "a0d4ffcdcfd7a5c14a4f23c9ac24487e", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "85e95bf514ef456d785abde4f74441b9", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "04b8114077df83aa6e619f27266d5f49", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "f0bb38bd9224d6dc00f08f749e4e632d", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "fa49695095c1f7faf1eedf6a2253cb75", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "3ffd6d2e6a5381379971a7512acae692", - "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "162e6aae6056d594bc0c1d3a333a6e7e", - "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "bb64e2182b1a533679f93c5997f14584", - "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "162e6aae6056d594bc0c1d3a333a6e7e", - "build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "bb64e2182b1a533679f93c5997f14584", - "build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "834ca6a4328b26e9ee900c9091b954ff", - "build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "ab6f04d0fb73d88ccbd3c65e73ead01f", - "build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "834ca6a4328b26e9ee900c9091b954ff", - "build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "ab6f04d0fb73d88ccbd3c65e73ead01f", - "build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "e3e9d9c7a94f8cd22939839fd8fbc178", - "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "116b500c2d57caf06619408b2176e83b", - "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "e3e9d9c7a94f8cd22939839fd8fbc178", - "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "116b500c2d57caf06619408b2176e83b", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "72f6efa0ee106bd0dc69c1f6b43572a0", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "6f67e9d48e3ae694db49488a52b32a79", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "1b3b5e234f8d3098fd5b353c3406acd6", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "e0ca61280197df3f82dd7cd1ee1cac4a", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "5c8abeb602a2d94ba390d84faedc8368", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "39663ee20552f1130447cbca404cbd5d", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "97f4af658de6a45288bf4b5d75ce9c0e", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "3de933233721b27b2144e81109f53931", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "dd3e4e8ff11d52d0b037b25fc1b5c936", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "6752d51a0ee054517d45ca69d48cb4f0", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "17f3f78ea8a5129607d0a60e19994a7e", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "fae424377a7ad5294ae4fbc3b42c5def", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "bdb34b97fefac8b002ebf697297a2575", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "d2b31a60257ff9fc555dd2fa945fe2c4", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "d6198914a00af9aa512c2d63826295cb", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "1a7bcf0d7e2e09338bb6a33d8cb728f5", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "24753c27f7350af0272a46a4da1eae6e", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "5a9307f66cfb6d75aa39bb0567348ef0", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "e06d4b08b41e3b08bb5b6cdeae030e19", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "deabf764c26a87c9b8fd5a39d4b81c9d", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "9c00d5fd76516379c12b6cbac26a3479", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "2fc39a7eb6383104587a59648d71769f", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "87cd7d4e2025c2eb466968456c4404fe", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "98d2900c6ccb918dacad68f5ee1bda2b", + "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "2ee184af9b80d60afea7f97aba29cb16", + "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "37c5f795ccbaeffeb5d6ede4fe9f3c19", + "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "2ee184af9b80d60afea7f97aba29cb16", + "build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "37c5f795ccbaeffeb5d6ede4fe9f3c19", + "build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "b6edad3013b9aceafc24dfc7d7903aa5", + "build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "25572bdc360130b2fe28925b5bd94a38", + "build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "b6edad3013b9aceafc24dfc7d7903aa5", + "build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "25572bdc360130b2fe28925b5bd94a38", + "build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "314516411d5ac8e991a6f742f399d4de", + "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "d258789fd7bdc5092aab87ccb4601921", + "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "314516411d5ac8e991a6f742f399d4de", + "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "d258789fd7bdc5092aab87ccb4601921", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "881ee81f8a5a779c9f4327704a7a3253", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "f76554bae2bab0530797ba6d31db1419", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "cf8b6622235349bf46b2a0879f1091a7", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "b0051826e5d36dd43707f1ced6d6a9ad", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "00d04e1715abbcce9680dff14ca7db40", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "a15b81a930ebcac977b7cf51b82b5ab6", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "994fdd808e6cb7a11bcadc53a09f5061", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "a744d9185b3e40942dc4b170745d7372", "src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad", "src/ballistica/base/mgen/pyembed/binding_base.inc": "06042d31df0ff9af96b99477162e2a91", diff --git a/CHANGELOG.md b/CHANGELOG.md index b76a70f8..ef883af9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.37 (build 22245, api 9, 2025-01-23) +### 1.7.37 (build 22246, api 9, 2025-01-23) - Bumping api version to 9. As you'll see below, there's some UI changes that will require a bit of work for any UI mods to adapt to. If your mods don't touch UI stuff at all you can simply bump your api version and call it a day. diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index c1fd874c..581ecccf 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -53,7 +53,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 22245 +TARGET_BALLISTICA_BUILD = 22246 TARGET_BALLISTICA_VERSION = '1.7.37' diff --git a/src/assets/ba_data/python/baplus/_cloud.py b/src/assets/ba_data/python/baplus/_cloud.py index 8be76293..c0d030d7 100644 --- a/src/assets/ba_data/python/baplus/_cloud.py +++ b/src/assets/ba_data/python/baplus/_cloud.py @@ -163,6 +163,15 @@ class CloudSubsystem(babase.AppSubsystem): ], ) -> None: ... + @overload + def send_message_cb( + self, + msg: bacommon.bs.ScoreSubmitMessage, + on_response: Callable[ + [bacommon.bs.ScoreSubmitResponse | Exception], None + ], + ) -> None: ... + def send_message_cb( self, msg: Message, diff --git a/src/assets/ba_data/python/bascenev1lib/activity/coopscore.py b/src/assets/ba_data/python/bascenev1lib/activity/coopscore.py index fe2cbb2a..02cf6a69 100644 --- a/src/assets/ba_data/python/bascenev1lib/activity/coopscore.py +++ b/src/assets/ba_data/python/bascenev1lib/activity/coopscore.py @@ -9,6 +9,7 @@ import random import logging from typing import TYPE_CHECKING, override +import bacommon.bs from bacommon.login import LoginType import bascenev1 as bs import bauiv1 as bui @@ -1201,6 +1202,18 @@ class CoopScoreScreen(bs.Activity[bs.Player, bs.Team]): transition_delay=tdelay2, ).autoretain() + def _on_v2_score_results( + self, response: bacommon.bs.ScoreSubmitResponse | Exception + ) -> None: + + if isinstance(response, Exception): + logging.debug('Got error score-submit response: %s', response) + return + assert isinstance(response, bacommon.bs.ScoreSubmitResponse) + + assert bui.app.classic is not None + bui.app.classic.run_bs_client_effects(response.effects) + def _got_score_results(self, results: dict[str, Any] | None) -> None: # pylint: disable=too-many-locals # pylint: disable=too-many-branches @@ -1208,6 +1221,8 @@ class CoopScoreScreen(bs.Activity[bs.Player, bs.Team]): plus = bs.app.plus assert plus is not None + classic = bs.app.classic + assert classic is not None # We need to manually run this in the context of our activity # and only if we aren't shutting down. @@ -1230,6 +1245,21 @@ class CoopScoreScreen(bs.Activity[bs.Player, bs.Team]): scale=0.7, ) else: + + # If there's a score-uuid bundled, ship it along to the + # v2 master server to ask about any rewards from that + # end. + score_token = results.get('token') + if ( + isinstance(score_token, str) + and plus.accounts.primary is not None + ): + with plus.accounts.primary: + plus.cloud.send_message_cb( + bacommon.bs.ScoreSubmitMessage(score_token), + on_response=bui.WeakCall(self._on_v2_score_results), + ) + self._score_link = results['link'] assert self._score_link is not None # Prepend our master-server addr if its a relative addr. diff --git a/src/assets/ba_data/python/bascenev1lib/mainmenu.py b/src/assets/ba_data/python/bascenev1lib/mainmenu.py index 1755d638..f6ec26bc 100644 --- a/src/assets/ba_data/python/bascenev1lib/mainmenu.py +++ b/src/assets/ba_data/python/bascenev1lib/mainmenu.py @@ -15,6 +15,8 @@ import bauiv1 as bui if TYPE_CHECKING: from typing import Any + import bacommon.bs + class MainMenuActivity(bs.Activity[bs.Player, bs.Team]): """Activity showing the rotating main menu bg stuff.""" diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index 1741406d..93cc5dc8 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 22245; +const int kEngineBuildNumber = 22246; const char* kEngineVersion = "1.7.37"; const int kEngineApiVersion = 9; diff --git a/tools/bacommon/bs.py b/tools/bacommon/bs.py index 5a74dad3..37897a14 100644 --- a/tools/bacommon/bs.py +++ b/tools/bacommon/bs.py @@ -863,3 +863,25 @@ class ClientUIActionResponse(Response): error_message: Annotated[str | None, IOAttrs('em')] effects: Annotated[list[ClientEffect], IOAttrs('fx')] + + +@ioprepped +@dataclass +class ScoreSubmitMessage(Message): + """Let the server know we got some score in something.""" + + score_token: Annotated[str, IOAttrs('t')] + + @override + @classmethod + def get_response_types(cls) -> list[type[Response] | None]: + return [ScoreSubmitResponse] + + +@ioprepped +@dataclass +class ScoreSubmitResponse(Response): + """Did something to that inbox entry, boss.""" + + # Things we should show on our end. + effects: Annotated[list[ClientEffect], IOAttrs('fx')]