mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-08 16:53:49 +08:00
more work-in-progress isolating _bainternal functionality
This commit is contained in:
parent
266f39e260
commit
ca306b57cc
@ -3995,50 +3995,50 @@
|
|||||||
"assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e",
|
"assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e",
|
||||||
"assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/b2/e5/0ee0561e16257a32830645239f34",
|
"assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/b2/e5/0ee0561e16257a32830645239f34",
|
||||||
"ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a",
|
"ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a",
|
||||||
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/fd/a3/ddce498a4373250e9655ee2bb1da",
|
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/28/fb/c8ec7461060e8c202bc78c8fa38a",
|
||||||
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/8b/91/c9d5fd1c7194a0be3ba38c9ddff6",
|
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/df/2e/97f98f053d8ea2fb55047026368a",
|
||||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/88/2d/0ed824842a323520e69dc426acd7",
|
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/df/d7/598285f85b7ec5ccd23a2ec43077",
|
||||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1f/05/5b2bb76fa7bb108273a18a941060",
|
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d5/4c/acfdc5cf15a4ba8117aa227b0e52",
|
||||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/b2/7e/d19ab278cc4dbd9a33b800eaeb59",
|
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/01/8f/3630d966672380d20a61920bc103",
|
||||||
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/71/25/0f2f737d61b8abb1d6acfd5af3ea",
|
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/77/d5/63f0652d80179e492327112f5375",
|
||||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/0c/d2/219029f15cc6d160b022e9325190",
|
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/af/fd/fe8b1649f9cf1052348e09c663a1",
|
||||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a4/a4/4c3192576df920570c3d44c5f109",
|
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1e/b8/9f600d32586d9a7783e6698dc8ea",
|
||||||
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ad/7d/22c09f6bfc9bc0de2d333e6eabcd",
|
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/80/0e/e4a6a029dadb26e1db1a0be98da3",
|
||||||
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d7/91/73aa499ceaf42da7fcbe90a2439c",
|
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/cb/49/46440223ff8961704c8e89a128a3",
|
||||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ad/5d/cccf8d0646f63ba1d53184177d75",
|
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4e/1c/9f25a48bb7162371f29eb52c14c6",
|
||||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/fe/60/8717c415173b9278c27435998fd0",
|
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/8e/ed/e505dbd36f5c1c0c65ac4c60fd9d",
|
||||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/7b/d2/0a028adf20a4446c777d964bf656",
|
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/e7/b0/c4e3a6163b0a2870faf4671fcce9",
|
||||||
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/1f/90/485ba24aa6addb7ef195911383a7",
|
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a2/6d/f97b9b3e983c78843c2b190a8686",
|
||||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5f/67/ee9e7340a4ac7c5a168c940a5ec4",
|
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d1/f6/af9b07385621483956c6a7aaa3ea",
|
||||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/55/76/8a035a6f2f2e71213ad36c40970a",
|
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/7d/92/5048005b193f5f0281267d5a9dad",
|
||||||
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/37/d4/33568dca9737e388d47e4ec3f9d0",
|
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/bd/ed/b9f42b5c7ec0701e3d0773897dde",
|
||||||
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/fd/0d/5ff69d357fc22193f4d1ec87e2f4",
|
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/96/ed/9bb84e5736f901cd46bab97100cf",
|
||||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/dc/85/b8ba248c03c5d4e9e8885171afa0",
|
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/f0/f4/6be4d77e230d60835b2253a8bc49",
|
||||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/a7/e2/ee819ad3e97adc5815f1d01876e3",
|
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/8d/8c/a5a6e9b683d3852e5cf587e971fa",
|
||||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ec/70/bb76d82665f9cfc95bea6a3b277f",
|
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/14/ee/113076d5d2e088cc90230cf6ab51",
|
||||||
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/49/36/0c77fc298d97a386f0f1c1faa020",
|
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7e/e4/38a2a67908a08aa068c4927d3122",
|
||||||
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/fe/35/f506a7fd6b80e89cfa4ce5a9af84",
|
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/75/fd/6250319a816a7b312051bfc2a63f",
|
||||||
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a1/b1/bffa28e8677d6025f43ebaec241b",
|
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e4/32/1b30542405d53f85a1eed025be9d",
|
||||||
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9d/f7/ee8b85edf48e549dba57e23082d9",
|
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/37/80/ce8008d84820ef0d0ca8960965c4",
|
||||||
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/cd/fe/e8e4ae7de89c8ac6b1093c148a5f",
|
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2e/09/a78c65202f7d1fc0fbb4d83933c3",
|
||||||
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/47/08/4662c54c56443c6ed70fd95294cd",
|
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0d/04/dba2a6ac9f1817603fccf3a5542b",
|
||||||
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f5/cc/e3c1d51df1cdcce702c12c2538ef",
|
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/20/c6/4a99477e51ef8b70db429af3719e",
|
||||||
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6e/ff/85ffb41a77eabae5bf74e1d52607",
|
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/34/24/18ef1ad96d0f203409b60424d9d0",
|
||||||
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/bb/dd/96ab4c30c037eff4d1005b6515ec",
|
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6e/83/0c5492eff9fa8ce9bafb8e39a561",
|
||||||
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/34/8a/23328b06e397dfdafb201f429e0e",
|
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ab/1e/ccd89ecb93c13c4ca7c6c6a3797e",
|
||||||
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/09/d9/ee415075a16dccc24f365dc2c847",
|
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/16/e7/461b11e11e2026b559bfaf7c3941",
|
||||||
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0f/80/d43c47af5dc56078f0e4b31049ec",
|
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e1/93/519f4f309f0f4fa8752114b70a64",
|
||||||
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ff/81/4c771163b42212f839a1fbc3b1ce",
|
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/dd/d1/187a739cbbe0316fd809708fa9ee",
|
||||||
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a8/f3/187de01651879d28e70ab4d2375a",
|
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/19/38/7a480d58b0ade7b5705f2f9474ee",
|
||||||
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/de/4c/74a267e161853efc82afa8aa6b41",
|
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e2/4b/524bed0bfca1b06a324163728fe1",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/f4/4a/7e3057f5e804bdd3d1d46af68b65",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/17/30/080b63fe14e6f775d439c3256f54",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/42/81/4ef15ec30288432c961f377fe914",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/02/a0/5498bc8c8c55ab7e7ebdd23402b5",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/cc/f7/f9c425c1b21706a1fa98dbfb2efc",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/7b/56/65a60485ae436ef86f8ccc8db7cf",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/74/35/b5d4edd416127e6d53833e0aca28",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/83/93/bbaa2c5c664779c69cbfae1b8163",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/7a/d3/41a29e5ffeca78aa7bb2f7fca5e2",
|
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/f1/1b/9eb27d7361d65dc0afbb26e74870",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/73/62/c40d827186e276b202b4d5610a3e",
|
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/d2/6f/743f2f6e1ac49577900724cefe08",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/5a/86/b6f9d1d2302c5a0aa97ccc1740d5",
|
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/be/d2/64fbeeb285197fd410a92a35624e",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/75/d4/89b9a3618c6a95fed6698c5a60ab",
|
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/5c/be/30aecc599f3c5977b40bd1155191",
|
||||||
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/7d/3e/229a581cb2454ed856f1d8b564a7",
|
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/7d/3e/229a581cb2454ed856f1d8b564a7",
|
||||||
"src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/98/12/571b2160d69d42580e8f31fa6a8d"
|
"src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/98/12/571b2160d69d42580e8f31fa6a8d"
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
### 1.7.7 (build 20762, api 7, 2022-09-04)
|
### 1.7.7 (build 20764, api 7, 2022-09-05)
|
||||||
- Added `ba.app.meta.load_exported_classes()` for loading classes discovered by the meta subsystem cleanly in a background thread.
|
- Added `ba.app.meta.load_exported_classes()` for loading classes discovered by the meta subsystem cleanly in a background thread.
|
||||||
- Improved logging of missing playlist game types.
|
- Improved logging of missing playlist game types.
|
||||||
- Some ba.Lstr functionality can now be used in background threads.
|
- Some ba.Lstr functionality can now be used in background threads.
|
||||||
|
|||||||
@ -35,6 +35,7 @@
|
|||||||
"ba_data/python/ba/__pycache__/_general.cpython-310.opt-1.pyc",
|
"ba_data/python/ba/__pycache__/_general.cpython-310.opt-1.pyc",
|
||||||
"ba_data/python/ba/__pycache__/_hooks.cpython-310.opt-1.pyc",
|
"ba_data/python/ba/__pycache__/_hooks.cpython-310.opt-1.pyc",
|
||||||
"ba_data/python/ba/__pycache__/_input.cpython-310.opt-1.pyc",
|
"ba_data/python/ba/__pycache__/_input.cpython-310.opt-1.pyc",
|
||||||
|
"ba_data/python/ba/__pycache__/_internal.cpython-310.opt-1.pyc",
|
||||||
"ba_data/python/ba/__pycache__/_keyboard.cpython-310.opt-1.pyc",
|
"ba_data/python/ba/__pycache__/_keyboard.cpython-310.opt-1.pyc",
|
||||||
"ba_data/python/ba/__pycache__/_language.cpython-310.opt-1.pyc",
|
"ba_data/python/ba/__pycache__/_language.cpython-310.opt-1.pyc",
|
||||||
"ba_data/python/ba/__pycache__/_level.cpython-310.opt-1.pyc",
|
"ba_data/python/ba/__pycache__/_level.cpython-310.opt-1.pyc",
|
||||||
@ -105,6 +106,7 @@
|
|||||||
"ba_data/python/ba/_generated/enums.py",
|
"ba_data/python/ba/_generated/enums.py",
|
||||||
"ba_data/python/ba/_hooks.py",
|
"ba_data/python/ba/_hooks.py",
|
||||||
"ba_data/python/ba/_input.py",
|
"ba_data/python/ba/_input.py",
|
||||||
|
"ba_data/python/ba/_internal.py",
|
||||||
"ba_data/python/ba/_keyboard.py",
|
"ba_data/python/ba/_keyboard.py",
|
||||||
"ba_data/python/ba/_language.py",
|
"ba_data/python/ba/_language.py",
|
||||||
"ba_data/python/ba/_level.py",
|
"ba_data/python/ba/_level.py",
|
||||||
|
|||||||
@ -169,6 +169,7 @@ SCRIPT_TARGETS_PY_PUBLIC = \
|
|||||||
build/ba_data/python/ba/_generated/enums.py \
|
build/ba_data/python/ba/_generated/enums.py \
|
||||||
build/ba_data/python/ba/_hooks.py \
|
build/ba_data/python/ba/_hooks.py \
|
||||||
build/ba_data/python/ba/_input.py \
|
build/ba_data/python/ba/_input.py \
|
||||||
|
build/ba_data/python/ba/_internal.py \
|
||||||
build/ba_data/python/ba/_keyboard.py \
|
build/ba_data/python/ba/_keyboard.py \
|
||||||
build/ba_data/python/ba/_language.py \
|
build/ba_data/python/ba/_language.py \
|
||||||
build/ba_data/python/ba/_level.py \
|
build/ba_data/python/ba/_level.py \
|
||||||
@ -420,6 +421,7 @@ SCRIPT_TARGETS_PYC_PUBLIC = \
|
|||||||
build/ba_data/python/ba/_generated/__pycache__/enums.cpython-310.opt-1.pyc \
|
build/ba_data/python/ba/_generated/__pycache__/enums.cpython-310.opt-1.pyc \
|
||||||
build/ba_data/python/ba/__pycache__/_hooks.cpython-310.opt-1.pyc \
|
build/ba_data/python/ba/__pycache__/_hooks.cpython-310.opt-1.pyc \
|
||||||
build/ba_data/python/ba/__pycache__/_input.cpython-310.opt-1.pyc \
|
build/ba_data/python/ba/__pycache__/_input.cpython-310.opt-1.pyc \
|
||||||
|
build/ba_data/python/ba/__pycache__/_internal.cpython-310.opt-1.pyc \
|
||||||
build/ba_data/python/ba/__pycache__/_keyboard.cpython-310.opt-1.pyc \
|
build/ba_data/python/ba/__pycache__/_keyboard.cpython-310.opt-1.pyc \
|
||||||
build/ba_data/python/ba/__pycache__/_language.cpython-310.opt-1.pyc \
|
build/ba_data/python/ba/__pycache__/_language.cpython-310.opt-1.pyc \
|
||||||
build/ba_data/python/ba/__pycache__/_level.cpython-310.opt-1.pyc \
|
build/ba_data/python/ba/__pycache__/_level.cpython-310.opt-1.pyc \
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
126683827977798484003262787310231621875
|
161826047581351482927423840323346436406
|
||||||
@ -59,9 +59,7 @@ def game_service_has_leaderboard(game: str, config: str) -> bool:
|
|||||||
return bool()
|
return bool()
|
||||||
|
|
||||||
|
|
||||||
def get_master_server_address(source: int = -1,
|
def get_master_server_address(source: int = -1, version: int = 1) -> str:
|
||||||
version: int = 1,
|
|
||||||
internal: bool = False) -> str:
|
|
||||||
"""(internal)
|
"""(internal)
|
||||||
|
|
||||||
Return the address of the master server.
|
Return the address of the master server.
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import time
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
|
import _bainternal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -41,7 +42,7 @@ class AccountV1Subsystem:
|
|||||||
def do_auto_sign_in() -> None:
|
def do_auto_sign_in() -> None:
|
||||||
if _ba.app.headless_mode or _ba.app.config.get(
|
if _ba.app.headless_mode or _ba.app.config.get(
|
||||||
'Auto Account State') == 'Local':
|
'Auto Account State') == 'Local':
|
||||||
_ba.sign_in_v1('Local')
|
_bainternal.sign_in_v1('Local')
|
||||||
|
|
||||||
_ba.pushcall(do_auto_sign_in)
|
_ba.pushcall(do_auto_sign_in)
|
||||||
|
|
||||||
@ -108,8 +109,8 @@ class AccountV1Subsystem:
|
|||||||
|
|
||||||
if data['p']:
|
if data['p']:
|
||||||
pro_mult = 1.0 + float(
|
pro_mult = 1.0 + float(
|
||||||
_ba.get_v1_account_misc_read_val('proPowerRankingBoost',
|
_bainternal.get_v1_account_misc_read_val(
|
||||||
0.0)) * 0.01
|
'proPowerRankingBoost', 0.0)) * 0.01
|
||||||
else:
|
else:
|
||||||
pro_mult = 1.0
|
pro_mult = 1.0
|
||||||
|
|
||||||
@ -135,12 +136,13 @@ class AccountV1Subsystem:
|
|||||||
"""(internal)"""
|
"""(internal)"""
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from ba import _store
|
from ba import _store
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if _bainternal.get_v1_account_state() != 'signed_in':
|
||||||
return []
|
return []
|
||||||
icons = []
|
icons = []
|
||||||
store_items = _store.get_store_items()
|
store_items = _store.get_store_items()
|
||||||
for item_name, item in list(store_items.items()):
|
for item_name, item in list(store_items.items()):
|
||||||
if item_name.startswith('icons.') and _ba.get_purchased(item_name):
|
if item_name.startswith('icons.') and _bainternal.get_purchased(
|
||||||
|
item_name):
|
||||||
icons.append(item['icon'])
|
icons.append(item['icon'])
|
||||||
return icons
|
return icons
|
||||||
|
|
||||||
@ -152,12 +154,13 @@ class AccountV1Subsystem:
|
|||||||
(internal)
|
(internal)
|
||||||
"""
|
"""
|
||||||
# This only applies when we're signed in.
|
# This only applies when we're signed in.
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if _bainternal.get_v1_account_state() != 'signed_in':
|
||||||
return
|
return
|
||||||
|
|
||||||
# If the short version of our account name currently cant be
|
# If the short version of our account name currently cant be
|
||||||
# displayed by the game, cancel.
|
# displayed by the game, cancel.
|
||||||
if not _ba.have_chars(_ba.get_v1_account_display_string(full=False)):
|
if not _ba.have_chars(
|
||||||
|
_bainternal.get_v1_account_display_string(full=False)):
|
||||||
return
|
return
|
||||||
|
|
||||||
config = _ba.app.config
|
config = _ba.app.config
|
||||||
@ -165,7 +168,7 @@ class AccountV1Subsystem:
|
|||||||
or '__account__' not in config['Player Profiles']):
|
or '__account__' not in config['Player Profiles']):
|
||||||
|
|
||||||
# Create a spaz with a nice default purply color.
|
# Create a spaz with a nice default purply color.
|
||||||
_ba.add_transaction({
|
_bainternal.add_transaction({
|
||||||
'type': 'ADD_PLAYER_PROFILE',
|
'type': 'ADD_PLAYER_PROFILE',
|
||||||
'name': '__account__',
|
'name': '__account__',
|
||||||
'profile': {
|
'profile': {
|
||||||
@ -174,7 +177,7 @@ class AccountV1Subsystem:
|
|||||||
'highlight': [0.5, 0.25, 1.0]
|
'highlight': [0.5, 0.25, 1.0]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
_bainternal.run_transactions()
|
||||||
|
|
||||||
def have_pro(self) -> bool:
|
def have_pro(self) -> bool:
|
||||||
"""Return whether pro is currently unlocked."""
|
"""Return whether pro is currently unlocked."""
|
||||||
@ -182,9 +185,9 @@ class AccountV1Subsystem:
|
|||||||
# Check our tickets-based pro upgrade and our two real-IAP based
|
# Check our tickets-based pro upgrade and our two real-IAP based
|
||||||
# upgrades. Also always unlock this stuff in ballistica-core builds.
|
# upgrades. Also always unlock this stuff in ballistica-core builds.
|
||||||
return bool(
|
return bool(
|
||||||
_ba.get_purchased('upgrades.pro')
|
_bainternal.get_purchased('upgrades.pro')
|
||||||
or _ba.get_purchased('static.pro')
|
or _bainternal.get_purchased('static.pro')
|
||||||
or _ba.get_purchased('static.pro_sale')
|
or _bainternal.get_purchased('static.pro_sale')
|
||||||
or 'ballistica' + 'core' == _ba.appname())
|
or 'ballistica' + 'core' == _ba.appname())
|
||||||
|
|
||||||
def have_pro_options(self) -> bool:
|
def have_pro_options(self) -> bool:
|
||||||
@ -199,7 +202,8 @@ class AccountV1Subsystem:
|
|||||||
# or also if we've been grandfathered in or are using ballistica-core
|
# or also if we've been grandfathered in or are using ballistica-core
|
||||||
# builds.
|
# builds.
|
||||||
return self.have_pro() or bool(
|
return self.have_pro() or bool(
|
||||||
_ba.get_v1_account_misc_read_val_2('proOptionsUnlocked', False)
|
_bainternal.get_v1_account_misc_read_val_2('proOptionsUnlocked',
|
||||||
|
False)
|
||||||
or _ba.app.config.get('lc14292', 0) > 1)
|
or _ba.app.config.get('lc14292', 0) > 1)
|
||||||
|
|
||||||
def show_post_purchase_message(self) -> None:
|
def show_post_purchase_message(self) -> None:
|
||||||
@ -221,17 +225,17 @@ class AccountV1Subsystem:
|
|||||||
from ba._language import Lstr
|
from ba._language import Lstr
|
||||||
|
|
||||||
# Run any pending promo codes we had queued up while not signed in.
|
# Run any pending promo codes we had queued up while not signed in.
|
||||||
if _ba.get_v1_account_state(
|
if _bainternal.get_v1_account_state(
|
||||||
) == 'signed_in' and self.pending_promo_codes:
|
) == 'signed_in' and self.pending_promo_codes:
|
||||||
for code in self.pending_promo_codes:
|
for code in self.pending_promo_codes:
|
||||||
_ba.screenmessage(Lstr(resource='submittingPromoCodeText'),
|
_ba.screenmessage(Lstr(resource='submittingPromoCodeText'),
|
||||||
color=(0, 1, 0))
|
color=(0, 1, 0))
|
||||||
_ba.add_transaction({
|
_bainternal.add_transaction({
|
||||||
'type': 'PROMO_CODE',
|
'type': 'PROMO_CODE',
|
||||||
'expire_time': time.time() + 5,
|
'expire_time': time.time() + 5,
|
||||||
'code': code
|
'code': code
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
_bainternal.run_transactions()
|
||||||
self.pending_promo_codes = []
|
self.pending_promo_codes = []
|
||||||
|
|
||||||
def add_pending_promo_code(self, code: str) -> None:
|
def add_pending_promo_code(self, code: str) -> None:
|
||||||
@ -242,7 +246,7 @@ class AccountV1Subsystem:
|
|||||||
# If we're not signed in, queue up the code to run the next time we
|
# If we're not signed in, queue up the code to run the next time we
|
||||||
# are and issue a warning if we haven't signed in within the next
|
# are and issue a warning if we haven't signed in within the next
|
||||||
# few seconds.
|
# few seconds.
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if _bainternal.get_v1_account_state() != 'signed_in':
|
||||||
|
|
||||||
def check_pending_codes() -> None:
|
def check_pending_codes() -> None:
|
||||||
"""(internal)"""
|
"""(internal)"""
|
||||||
@ -259,9 +263,9 @@ class AccountV1Subsystem:
|
|||||||
return
|
return
|
||||||
_ba.screenmessage(Lstr(resource='submittingPromoCodeText'),
|
_ba.screenmessage(Lstr(resource='submittingPromoCodeText'),
|
||||||
color=(0, 1, 0))
|
color=(0, 1, 0))
|
||||||
_ba.add_transaction({
|
_bainternal.add_transaction({
|
||||||
'type': 'PROMO_CODE',
|
'type': 'PROMO_CODE',
|
||||||
'expire_time': time.time() + 5,
|
'expire_time': time.time() + 5,
|
||||||
'code': code
|
'code': code
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
_bainternal.run_transactions()
|
||||||
|
|||||||
@ -6,6 +6,7 @@ from __future__ import annotations
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
|
from ba import _internal
|
||||||
from ba._error import print_exception
|
from ba._error import print_exception
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -317,10 +318,13 @@ class AchievementSubsystem:
|
|||||||
if not ach.complete:
|
if not ach.complete:
|
||||||
|
|
||||||
# Report new achievements to the game-service.
|
# Report new achievements to the game-service.
|
||||||
_ba.report_achievement(achname)
|
_internal.report_achievement(achname)
|
||||||
|
|
||||||
# And to our account.
|
# And to our account.
|
||||||
_ba.add_transaction({'type': 'ACHIEVEMENT', 'name': achname})
|
_internal.add_transaction({
|
||||||
|
'type': 'ACHIEVEMENT',
|
||||||
|
'name': achname
|
||||||
|
})
|
||||||
|
|
||||||
# Now attempt to show a banner.
|
# Now attempt to show a banner.
|
||||||
self.display_achievement_banner(achname)
|
self.display_achievement_banner(achname)
|
||||||
@ -409,7 +413,7 @@ def _get_ach_mult(include_pro_bonus: bool = False) -> int:
|
|||||||
|
|
||||||
(just for display; changing this here won't affect actual rewards)
|
(just for display; changing this here won't affect actual rewards)
|
||||||
"""
|
"""
|
||||||
val: int = _ba.get_v1_account_misc_read_val('achAwardMult', 5)
|
val: int = _internal.get_v1_account_misc_read_val('achAwardMult', 5)
|
||||||
assert isinstance(val, int)
|
assert isinstance(val, int)
|
||||||
if include_pro_bonus and _ba.app.accounts_v1.have_pro():
|
if include_pro_bonus and _ba.app.accounts_v1.have_pro():
|
||||||
val *= 2
|
val *= 2
|
||||||
@ -496,7 +500,7 @@ class Achievement:
|
|||||||
# signed in, lets not show them (otherwise we tend to get
|
# signed in, lets not show them (otherwise we tend to get
|
||||||
# confusing 'controller connected' achievements popping up while
|
# confusing 'controller connected' achievements popping up while
|
||||||
# waiting to log in which can be confusing).
|
# waiting to log in which can be confusing).
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if _internal.get_v1_account_state() != 'signed_in':
|
||||||
return
|
return
|
||||||
|
|
||||||
# If we're being freshly complete, display/report it and whatnot.
|
# If we're being freshly complete, display/report it and whatnot.
|
||||||
@ -592,8 +596,8 @@ class Achievement:
|
|||||||
|
|
||||||
def get_award_ticket_value(self, include_pro_bonus: bool = False) -> int:
|
def get_award_ticket_value(self, include_pro_bonus: bool = False) -> int:
|
||||||
"""Get the ticket award value for this achievement."""
|
"""Get the ticket award value for this achievement."""
|
||||||
val: int = (_ba.get_v1_account_misc_read_val('achAward.' + self._name,
|
val: int = (_internal.get_v1_account_misc_read_val(
|
||||||
self._award) *
|
'achAward.' + self._name, self._award) *
|
||||||
_get_ach_mult(include_pro_bonus))
|
_get_ach_mult(include_pro_bonus))
|
||||||
assert isinstance(val, int)
|
assert isinstance(val, int)
|
||||||
return val
|
return val
|
||||||
@ -601,7 +605,7 @@ class Achievement:
|
|||||||
@property
|
@property
|
||||||
def power_ranking_value(self) -> int:
|
def power_ranking_value(self) -> int:
|
||||||
"""Get the power-ranking award value for this achievement."""
|
"""Get the power-ranking award value for this achievement."""
|
||||||
val: int = _ba.get_v1_account_misc_read_val(
|
val: int = _internal.get_v1_account_misc_read_val(
|
||||||
'achLeaguePoints.' + self._name, self._award)
|
'achLeaguePoints.' + self._name, self._award)
|
||||||
assert isinstance(val, int)
|
assert isinstance(val, int)
|
||||||
return val
|
return val
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import time
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
|
from ba import _internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Callable, Any
|
from typing import Callable, Any
|
||||||
@ -94,15 +95,15 @@ class AdsSubsystem:
|
|||||||
launch_count = app.config.get('launchCount', 0)
|
launch_count = app.config.get('launchCount', 0)
|
||||||
|
|
||||||
# If we're seeing short ads we may want to space them differently.
|
# If we're seeing short ads we may want to space them differently.
|
||||||
interval_mult = (_ba.get_v1_account_misc_read_val(
|
interval_mult = (_internal.get_v1_account_misc_read_val(
|
||||||
'ads.shortIntervalMult', 1.0)
|
'ads.shortIntervalMult', 1.0)
|
||||||
if self.last_ad_was_short else 1.0)
|
if self.last_ad_was_short else 1.0)
|
||||||
if self.ad_amt is None:
|
if self.ad_amt is None:
|
||||||
if launch_count <= 1:
|
if launch_count <= 1:
|
||||||
self.ad_amt = _ba.get_v1_account_misc_read_val(
|
self.ad_amt = _internal.get_v1_account_misc_read_val(
|
||||||
'ads.startVal1', 0.99)
|
'ads.startVal1', 0.99)
|
||||||
else:
|
else:
|
||||||
self.ad_amt = _ba.get_v1_account_misc_read_val(
|
self.ad_amt = _internal.get_v1_account_misc_read_val(
|
||||||
'ads.startVal2', 1.0)
|
'ads.startVal2', 1.0)
|
||||||
interval = None
|
interval = None
|
||||||
else:
|
else:
|
||||||
@ -111,15 +112,17 @@ class AdsSubsystem:
|
|||||||
# (we reach our threshold faster the longer we've been
|
# (we reach our threshold faster the longer we've been
|
||||||
# playing).
|
# playing).
|
||||||
base = 'ads' if _ba.has_video_ads() else 'ads2'
|
base = 'ads' if _ba.has_video_ads() else 'ads2'
|
||||||
min_lc = _ba.get_v1_account_misc_read_val(base + '.minLC', 0.0)
|
min_lc = _internal.get_v1_account_misc_read_val(
|
||||||
max_lc = _ba.get_v1_account_misc_read_val(base + '.maxLC', 5.0)
|
base + '.minLC', 0.0)
|
||||||
min_lc_scale = (_ba.get_v1_account_misc_read_val(
|
max_lc = _internal.get_v1_account_misc_read_val(
|
||||||
|
base + '.maxLC', 5.0)
|
||||||
|
min_lc_scale = (_internal.get_v1_account_misc_read_val(
|
||||||
base + '.minLCScale', 0.25))
|
base + '.minLCScale', 0.25))
|
||||||
max_lc_scale = (_ba.get_v1_account_misc_read_val(
|
max_lc_scale = (_internal.get_v1_account_misc_read_val(
|
||||||
base + '.maxLCScale', 0.34))
|
base + '.maxLCScale', 0.34))
|
||||||
min_lc_interval = (_ba.get_v1_account_misc_read_val(
|
min_lc_interval = (_internal.get_v1_account_misc_read_val(
|
||||||
base + '.minLCInterval', 360))
|
base + '.minLCInterval', 360))
|
||||||
max_lc_interval = (_ba.get_v1_account_misc_read_val(
|
max_lc_interval = (_internal.get_v1_account_misc_read_val(
|
||||||
base + '.maxLCInterval', 300))
|
base + '.maxLCInterval', 300))
|
||||||
if launch_count < min_lc:
|
if launch_count < min_lc:
|
||||||
lc_amt = 0.0
|
lc_amt = 0.0
|
||||||
|
|||||||
@ -20,6 +20,7 @@ from ba._meta import MetadataSubsystem
|
|||||||
from ba._ads import AdsSubsystem
|
from ba._ads import AdsSubsystem
|
||||||
from ba._net import NetworkSubsystem
|
from ba._net import NetworkSubsystem
|
||||||
from ba._workspace import WorkspaceSubsystem
|
from ba._workspace import WorkspaceSubsystem
|
||||||
|
from ba import _internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import asyncio
|
import asyncio
|
||||||
@ -378,7 +379,7 @@ class App:
|
|||||||
# Non-test, non-debug builds should generally be blessed; warn if not.
|
# Non-test, non-debug builds should generally be blessed; warn if not.
|
||||||
# (so I don't accidentally release a build that can't play tourneys)
|
# (so I don't accidentally release a build that can't play tourneys)
|
||||||
if (not self.debug_build and not self.test_build
|
if (not self.debug_build and not self.test_build
|
||||||
and not _ba.is_blessed()):
|
and not _internal.is_blessed()):
|
||||||
_ba.screenmessage('WARNING: NON-BLESSED BUILD', color=(1, 0, 0))
|
_ba.screenmessage('WARNING: NON-BLESSED BUILD', color=(1, 0, 0))
|
||||||
|
|
||||||
# If there's a leftover log file, attempt to upload it to the
|
# If there's a leftover log file, attempt to upload it to the
|
||||||
@ -416,7 +417,8 @@ class App:
|
|||||||
def check_special_offer() -> None:
|
def check_special_offer() -> None:
|
||||||
from bastd.ui.specialoffer import show_offer
|
from bastd.ui.specialoffer import show_offer
|
||||||
config = self.config
|
config = self.config
|
||||||
if ('pendingSpecialOffer' in config and _ba.get_public_login_id()
|
if ('pendingSpecialOffer' in config
|
||||||
|
and _internal.get_public_login_id()
|
||||||
== config['pendingSpecialOffer']['a']):
|
== config['pendingSpecialOffer']['a']):
|
||||||
self.special_offer = config['pendingSpecialOffer']['o']
|
self.special_offer = config['pendingSpecialOffer']['o']
|
||||||
show_offer()
|
show_offer()
|
||||||
@ -583,11 +585,11 @@ class App:
|
|||||||
|
|
||||||
# Kick off a little transaction so we'll hopefully have all the
|
# Kick off a little transaction so we'll hopefully have all the
|
||||||
# latest account state when we get back to the menu.
|
# latest account state when we get back to the menu.
|
||||||
_ba.add_transaction({
|
_internal.add_transaction({
|
||||||
'type': 'END_SESSION',
|
'type': 'END_SESSION',
|
||||||
'sType': str(type(host_session))
|
'sType': str(type(host_session))
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
_internal.run_transactions()
|
||||||
|
|
||||||
host_session.end()
|
host_session.end()
|
||||||
|
|
||||||
|
|||||||
@ -159,8 +159,9 @@ def commit_app_config(force: bool = False) -> None:
|
|||||||
|
|
||||||
(internal)
|
(internal)
|
||||||
"""
|
"""
|
||||||
|
from ba._internal import mark_config_dirty
|
||||||
if not _ba.app.config_file_healthy and not force:
|
if not _ba.app.config_file_healthy and not force:
|
||||||
print('Current config file is broken; '
|
print('Current config file is broken; '
|
||||||
'skipping write to avoid losing settings.')
|
'skipping write to avoid losing settings.')
|
||||||
return
|
return
|
||||||
_ba.mark_config_dirty()
|
mark_config_dirty()
|
||||||
|
|||||||
@ -58,6 +58,7 @@ def handle_log() -> None:
|
|||||||
"""
|
"""
|
||||||
from ba._net import master_server_post
|
from ba._net import master_server_post
|
||||||
from ba._generated.enums import TimeType
|
from ba._generated.enums import TimeType
|
||||||
|
from ba._internal import get_news_show
|
||||||
app = _ba.app
|
app = _ba.app
|
||||||
app.log_have_new = True
|
app.log_have_new = True
|
||||||
if not app.log_upload_timer_started:
|
if not app.log_upload_timer_started:
|
||||||
@ -83,7 +84,7 @@ def handle_log() -> None:
|
|||||||
'userRanCommands': _ba.has_user_run_commands(),
|
'userRanCommands': _ba.has_user_run_commands(),
|
||||||
'time': _ba.time(TimeType.REAL),
|
'time': _ba.time(TimeType.REAL),
|
||||||
'userModded': _ba.workspaces_in_use(),
|
'userModded': _ba.workspaces_in_use(),
|
||||||
'newsShow': _ba.get_news_show(),
|
'newsShow': get_news_show(),
|
||||||
}
|
}
|
||||||
|
|
||||||
def response(data: Any) -> None:
|
def response(data: Any) -> None:
|
||||||
|
|||||||
@ -32,7 +32,7 @@ def bootstrap() -> None:
|
|||||||
|
|
||||||
# Give a soft warning if we're being used with a different binary
|
# Give a soft warning if we're being used with a different binary
|
||||||
# version than we expect.
|
# version than we expect.
|
||||||
expected_build = 20762
|
expected_build = 20764
|
||||||
running_build: int = env['build_number']
|
running_build: int = env['build_number']
|
||||||
if running_build != expected_build:
|
if running_build != expected_build:
|
||||||
print(
|
print(
|
||||||
|
|||||||
@ -6,6 +6,7 @@ from __future__ import annotations
|
|||||||
from typing import TYPE_CHECKING, TypeVar
|
from typing import TYPE_CHECKING, TypeVar
|
||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
|
from ba import _internal
|
||||||
from ba._gameactivity import GameActivity
|
from ba._gameactivity import GameActivity
|
||||||
from ba._general import WeakCall
|
from ba._general import WeakCall
|
||||||
|
|
||||||
@ -217,10 +218,10 @@ class CoopGameActivity(GameActivity[PlayerType, TeamType]):
|
|||||||
self._achievements_awarded.add(achievement_name)
|
self._achievements_awarded.add(achievement_name)
|
||||||
|
|
||||||
# Report new achievements to the game-service.
|
# Report new achievements to the game-service.
|
||||||
_ba.report_achievement(achievement_name)
|
_internal.report_achievement(achievement_name)
|
||||||
|
|
||||||
# ...and to our account.
|
# ...and to our account.
|
||||||
_ba.add_transaction({
|
_internal.add_transaction({
|
||||||
'type': 'ACHIEVEMENT',
|
'type': 'ACHIEVEMENT',
|
||||||
'name': achievement_name
|
'name': achievement_name
|
||||||
})
|
})
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import random
|
|||||||
from typing import TYPE_CHECKING, TypeVar
|
from typing import TYPE_CHECKING, TypeVar
|
||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
|
from ba import _internal
|
||||||
from ba._activity import Activity
|
from ba._activity import Activity
|
||||||
from ba._score import ScoreConfig
|
from ba._score import ScoreConfig
|
||||||
from ba._language import Lstr
|
from ba._language import Lstr
|
||||||
@ -240,11 +241,11 @@ class GameActivity(Activity[PlayerType, TeamType]):
|
|||||||
self._zoom_message_times: dict[int, float] = {}
|
self._zoom_message_times: dict[int, float] = {}
|
||||||
self._is_waiting_for_continue = False
|
self._is_waiting_for_continue = False
|
||||||
|
|
||||||
self._continue_cost = _ba.get_v1_account_misc_read_val(
|
self._continue_cost = _internal.get_v1_account_misc_read_val(
|
||||||
'continueStartCost', 25)
|
'continueStartCost', 25)
|
||||||
self._continue_cost_mult = _ba.get_v1_account_misc_read_val(
|
self._continue_cost_mult = _internal.get_v1_account_misc_read_val(
|
||||||
'continuesMult', 2)
|
'continuesMult', 2)
|
||||||
self._continue_cost_offset = _ba.get_v1_account_misc_read_val(
|
self._continue_cost_offset = _internal.get_v1_account_misc_read_val(
|
||||||
'continuesOffset', 0)
|
'continuesOffset', 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -364,11 +365,11 @@ class GameActivity(Activity[PlayerType, TeamType]):
|
|||||||
if do_continue:
|
if do_continue:
|
||||||
_ba.playsound(_ba.getsound('shieldUp'))
|
_ba.playsound(_ba.getsound('shieldUp'))
|
||||||
_ba.playsound(_ba.getsound('cashRegister'))
|
_ba.playsound(_ba.getsound('cashRegister'))
|
||||||
_ba.add_transaction({
|
_internal.add_transaction({
|
||||||
'type': 'CONTINUE',
|
'type': 'CONTINUE',
|
||||||
'cost': self._continue_cost
|
'cost': self._continue_cost
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
_internal.run_transactions()
|
||||||
self._continue_cost = (
|
self._continue_cost = (
|
||||||
self._continue_cost * self._continue_cost_mult +
|
self._continue_cost * self._continue_cost_mult +
|
||||||
self._continue_cost_offset)
|
self._continue_cost_offset)
|
||||||
@ -391,7 +392,8 @@ class GameActivity(Activity[PlayerType, TeamType]):
|
|||||||
from ba._generated.enums import TimeType
|
from ba._generated.enums import TimeType
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if _ba.get_v1_account_misc_read_val('enableContinues', False):
|
if _internal.get_v1_account_misc_read_val('enableContinues',
|
||||||
|
False):
|
||||||
session = self.session
|
session = self.session
|
||||||
|
|
||||||
# We only support continuing in non-tournament games.
|
# We only support continuing in non-tournament games.
|
||||||
@ -454,7 +456,7 @@ class GameActivity(Activity[PlayerType, TeamType]):
|
|||||||
# time is left.
|
# time is left.
|
||||||
tournament_id = self.session.tournament_id
|
tournament_id = self.session.tournament_id
|
||||||
if tournament_id is not None:
|
if tournament_id is not None:
|
||||||
_ba.tournament_query(
|
_internal.tournament_query(
|
||||||
args={
|
args={
|
||||||
'tournamentIDs': [tournament_id],
|
'tournamentIDs': [tournament_id],
|
||||||
'source': 'in-game time remaining query'
|
'source': 'in-game time remaining query'
|
||||||
|
|||||||
@ -16,6 +16,7 @@ from __future__ import annotations
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
|
from ba import _internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Sequence, Any
|
from typing import Sequence, Any
|
||||||
@ -189,8 +190,8 @@ def unavailable_message() -> None:
|
|||||||
|
|
||||||
|
|
||||||
def submit_analytics_counts(sval: str) -> None:
|
def submit_analytics_counts(sval: str) -> None:
|
||||||
_ba.add_transaction({'type': 'ANALYTICS_COUNTS', 'values': sval})
|
_internal.add_transaction({'type': 'ANALYTICS_COUNTS', 'values': sval})
|
||||||
_ba.run_transactions()
|
_internal.run_transactions()
|
||||||
|
|
||||||
|
|
||||||
def set_last_ad_network(sval: str) -> None:
|
def set_last_ad_network(sval: str) -> None:
|
||||||
|
|||||||
@ -6,6 +6,7 @@ from __future__ import annotations
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
|
from ba._internal import get_v1_account_display_string
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -639,5 +640,5 @@ def get_last_player_name_from_input_device(device: ba.InputDevice) -> str:
|
|||||||
if profilename == '_random':
|
if profilename == '_random':
|
||||||
profilename = device.get_default_player_name()
|
profilename = device.get_default_player_name()
|
||||||
if profilename == '__account__':
|
if profilename == '__account__':
|
||||||
profilename = _ba.get_v1_account_display_string()
|
profilename = get_v1_account_display_string()
|
||||||
return profilename
|
return profilename
|
||||||
|
|||||||
367
assets/src/ba_data/python/ba/_internal.py
Normal file
367
assets/src/ba_data/python/ba/_internal.py
Normal file
@ -0,0 +1,367 @@
|
|||||||
|
# Released under the MIT License. See LICENSE for details.
|
||||||
|
#
|
||||||
|
"""A soft wrapper around _bainternal.
|
||||||
|
|
||||||
|
This allows code to use _bainternal functionality and get warnings
|
||||||
|
or fallbacks in some cases instead of hard errors. Code that absolutely
|
||||||
|
relies on the presence of _bainternal can just use that module directly.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
try:
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
|
import _bainternal
|
||||||
|
HAVE_INTERNAL = True
|
||||||
|
except ImportError:
|
||||||
|
HAVE_INTERNAL = False
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from typing import Callable, Any
|
||||||
|
|
||||||
|
|
||||||
|
# Code that will function without _bainternal but which should be updated
|
||||||
|
# to account for its absence should call this to draw attention to itself.
|
||||||
|
def _no_bainternal_warning() -> None:
|
||||||
|
import logging
|
||||||
|
logging.warning('INTERNAL CALL RUN WITHOUT INTERNAL PRESENT.')
|
||||||
|
|
||||||
|
|
||||||
|
# Code that won't work without _bainternal should raise these errors.
|
||||||
|
def _no_bainternal_error() -> RuntimeError:
|
||||||
|
raise RuntimeError('_bainternal is not present')
|
||||||
|
|
||||||
|
|
||||||
|
def get_v2_fleet() -> str:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_v2_fleet()
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def get_master_server_address(source: int = -1, version: int = 1) -> str:
|
||||||
|
"""(internal)
|
||||||
|
|
||||||
|
Return the address of the master server.
|
||||||
|
"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_master_server_address(source=source,
|
||||||
|
version=version)
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def is_blessed() -> bool:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.is_blessed()
|
||||||
|
|
||||||
|
# Harmless to always just say no here.
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def get_news_show() -> str:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_news_show()
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def game_service_has_leaderboard(game: str, config: str) -> bool:
|
||||||
|
"""(internal)
|
||||||
|
|
||||||
|
Given a game and config string, returns whether there is a leaderboard
|
||||||
|
for it on the game service.
|
||||||
|
"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.game_service_has_leaderboard(game=game,
|
||||||
|
config=config)
|
||||||
|
# Harmless to always just say no here.
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def report_achievement(achievement: str, pass_to_account: bool = True) -> None:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
_bainternal.report_achievement(achievement=achievement,
|
||||||
|
pass_to_account=pass_to_account)
|
||||||
|
return
|
||||||
|
|
||||||
|
# Need to see if this actually still works as expected.. warning for now.
|
||||||
|
_no_bainternal_warning()
|
||||||
|
|
||||||
|
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
|
def submit_score(game: str,
|
||||||
|
config: str,
|
||||||
|
name: Any,
|
||||||
|
score: int | None,
|
||||||
|
callback: Callable,
|
||||||
|
friend_callback: Callable | None,
|
||||||
|
order: str = 'increasing',
|
||||||
|
tournament_id: str | None = None,
|
||||||
|
score_type: str = 'points',
|
||||||
|
campaign: str | None = None,
|
||||||
|
level: str | None = None) -> None:
|
||||||
|
"""(internal)
|
||||||
|
|
||||||
|
Submit a score to the server; callback will be called with the results.
|
||||||
|
As a courtesy, please don't send fake scores to the server. I'd prefer
|
||||||
|
to devote my time to improving the game instead of trying to make the
|
||||||
|
score server more mischief-proof.
|
||||||
|
"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
_bainternal.submit_score(game=game,
|
||||||
|
config=config,
|
||||||
|
name=name,
|
||||||
|
score=score,
|
||||||
|
callback=callback,
|
||||||
|
friend_callback=friend_callback,
|
||||||
|
order=order,
|
||||||
|
tournament_id=tournament_id,
|
||||||
|
score_type=score_type,
|
||||||
|
campaign=campaign,
|
||||||
|
level=level)
|
||||||
|
return
|
||||||
|
# This technically breaks since callback will never be called/etc.
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def tournament_query(callback: Callable[[dict | None], None],
|
||||||
|
args: dict) -> None:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
_bainternal.tournament_query(callback=callback, args=args)
|
||||||
|
return
|
||||||
|
|
||||||
|
# This technically breaks since callback will never be called/etc.
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def power_ranking_query(callback: Callable, season: Any = None) -> None:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
_bainternal.power_ranking_query(callback=callback, season=season)
|
||||||
|
return
|
||||||
|
|
||||||
|
# This technically breaks since callback will never be called/etc.
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def restore_purchases() -> None:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
_bainternal.restore_purchases()
|
||||||
|
return
|
||||||
|
|
||||||
|
# This shouldn't break anything but should try to avoid calling it.
|
||||||
|
_no_bainternal_warning()
|
||||||
|
|
||||||
|
|
||||||
|
def purchase(item: str) -> None:
|
||||||
|
"""(internal)"""
|
||||||
|
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
_bainternal.purchase(item)
|
||||||
|
return
|
||||||
|
|
||||||
|
# This won't break messily but won't function as intended.
|
||||||
|
_no_bainternal_warning()
|
||||||
|
|
||||||
|
|
||||||
|
def get_purchases_state() -> int:
|
||||||
|
"""(internal)"""
|
||||||
|
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_purchases_state()
|
||||||
|
|
||||||
|
# This won't function correctly without internal.
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def get_purchased(item: str) -> bool:
|
||||||
|
"""(internal)"""
|
||||||
|
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_purchased(item)
|
||||||
|
|
||||||
|
# Without internal we can just assume no purchases.
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def get_price(item: str) -> str | None:
|
||||||
|
"""(internal)"""
|
||||||
|
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_price(item)
|
||||||
|
|
||||||
|
# Without internal we can just assume no prices.
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def in_game_purchase(item: str, price: int) -> None:
|
||||||
|
"""(internal)"""
|
||||||
|
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
_bainternal.in_game_purchase(item=item, price=price)
|
||||||
|
return
|
||||||
|
|
||||||
|
# Without internal this doesn't function as expected.
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
|
def add_transaction(transaction: dict,
|
||||||
|
callback: Callable | None = None) -> None:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
_bainternal.add_transaction(transaction=transaction, callback=callback)
|
||||||
|
return
|
||||||
|
|
||||||
|
# This won't function correctly without internal (callback never called).
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def reset_achievements() -> None:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
_bainternal.reset_achievements()
|
||||||
|
return
|
||||||
|
|
||||||
|
# Technically doesnt break but won't do anything.
|
||||||
|
_no_bainternal_warning()
|
||||||
|
|
||||||
|
|
||||||
|
def get_public_login_id() -> str | None:
|
||||||
|
"""(internal)"""
|
||||||
|
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_public_login_id()
|
||||||
|
|
||||||
|
# Harmless to return nothing in this case.
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def have_outstanding_transactions() -> bool:
|
||||||
|
"""(internal)"""
|
||||||
|
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.have_outstanding_transactions()
|
||||||
|
|
||||||
|
# Harmless to return False here.
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def run_transactions() -> None:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
_bainternal.run_transactions()
|
||||||
|
|
||||||
|
# Harmless no-op in this case.
|
||||||
|
|
||||||
|
|
||||||
|
def get_v1_account_misc_read_val(name: str, default_value: Any) -> Any:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_v1_account_misc_read_val(
|
||||||
|
name=name, default_value=default_value)
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def get_v1_account_misc_read_val_2(name: str, default_value: Any) -> Any:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_v1_account_misc_read_val_2(
|
||||||
|
name=name, default_value=default_value)
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def get_v1_account_misc_val(name: str, default_value: Any) -> Any:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_v1_account_misc_val(name=name,
|
||||||
|
default_value=default_value)
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def get_v1_account_ticket_count() -> int:
|
||||||
|
"""(internal)
|
||||||
|
|
||||||
|
Returns the number of tickets for the current account.
|
||||||
|
"""
|
||||||
|
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_v1_account_ticket_count()
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def get_v1_account_state_num() -> int:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_v1_account_state_num()
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def get_v1_account_state() -> str:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_v1_account_state()
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def get_v1_account_display_string(full: bool = True) -> str:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_v1_account_display_string(full=full)
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def get_v1_account_type() -> str:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_v1_account_type()
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def get_v1_account_name() -> str:
|
||||||
|
"""(internal)"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
return _bainternal.get_v1_account_name()
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def sign_out_v1(v2_embedded: bool = False) -> None:
|
||||||
|
"""(internal)
|
||||||
|
|
||||||
|
Category: General Utility Functions
|
||||||
|
"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
_bainternal.sign_out_v1(v2_embedded=v2_embedded)
|
||||||
|
return
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def sign_in_v1(account_type: str) -> None:
|
||||||
|
"""(internal)
|
||||||
|
|
||||||
|
Category: General Utility Functions
|
||||||
|
"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
_bainternal.sign_in_v1(account_type=account_type)
|
||||||
|
return
|
||||||
|
raise _no_bainternal_error()
|
||||||
|
|
||||||
|
|
||||||
|
def mark_config_dirty() -> None:
|
||||||
|
"""(internal)
|
||||||
|
|
||||||
|
Category: General Utility Functions
|
||||||
|
"""
|
||||||
|
if HAVE_INTERNAL:
|
||||||
|
_bainternal.mark_config_dirty()
|
||||||
|
return
|
||||||
|
|
||||||
|
# Note to self - need to fix config writing to not rely on
|
||||||
|
# internal lib.
|
||||||
|
_no_bainternal_warning()
|
||||||
@ -134,15 +134,16 @@ class MasterServerCallThread(threading.Thread):
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from efro.error import is_urllib_communication_error
|
from efro.error import is_urllib_communication_error
|
||||||
from ba import _general
|
from ba._general import Call, utf8_all
|
||||||
|
from ba._internal import get_master_server_address
|
||||||
|
|
||||||
response_data: Any = None
|
response_data: Any = None
|
||||||
url: str | None = None
|
url: str | None = None
|
||||||
try:
|
try:
|
||||||
self._data = _general.utf8_all(self._data)
|
self._data = utf8_all(self._data)
|
||||||
_ba.set_thread_name('BA_ServerCallThread')
|
_ba.set_thread_name('BA_ServerCallThread')
|
||||||
if self._request_type == 'get':
|
if self._request_type == 'get':
|
||||||
url = (_ba.get_master_server_address() + '/' + self._request +
|
url = (get_master_server_address() + '/' + self._request +
|
||||||
'?' + urllib.parse.urlencode(self._data))
|
'?' + urllib.parse.urlencode(self._data))
|
||||||
response = urllib.request.urlopen(
|
response = urllib.request.urlopen(
|
||||||
urllib.request.Request(
|
urllib.request.Request(
|
||||||
@ -150,7 +151,7 @@ class MasterServerCallThread(threading.Thread):
|
|||||||
context=_ba.app.net.sslcontext,
|
context=_ba.app.net.sslcontext,
|
||||||
timeout=DEFAULT_REQUEST_TIMEOUT_SECONDS)
|
timeout=DEFAULT_REQUEST_TIMEOUT_SECONDS)
|
||||||
elif self._request_type == 'post':
|
elif self._request_type == 'post':
|
||||||
url = _ba.get_master_server_address() + '/' + self._request
|
url = get_master_server_address() + '/' + self._request
|
||||||
response = urllib.request.urlopen(
|
response = urllib.request.urlopen(
|
||||||
urllib.request.Request(
|
urllib.request.Request(
|
||||||
url,
|
url,
|
||||||
@ -189,7 +190,7 @@ class MasterServerCallThread(threading.Thread):
|
|||||||
response_data = None
|
response_data = None
|
||||||
|
|
||||||
if self._callback is not None:
|
if self._callback is not None:
|
||||||
_ba.pushcall(_general.Call(self._run_callback, response_data),
|
_ba.pushcall(Call(self._run_callback, response_data),
|
||||||
from_other_thread=True)
|
from_other_thread=True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,8 @@ from bacommon.servermanager import (ServerCommand, StartServerModeCommand,
|
|||||||
ChatMessageCommand, ScreenMessageCommand,
|
ChatMessageCommand, ScreenMessageCommand,
|
||||||
ClientListCommand, KickCommand)
|
ClientListCommand, KickCommand)
|
||||||
import _ba
|
import _ba
|
||||||
|
from ba._internal import (add_transaction, run_transactions,
|
||||||
|
get_v1_account_state)
|
||||||
from ba._generated.enums import TimeType
|
from ba._generated.enums import TimeType
|
||||||
from ba._freeforallsession import FreeForAllSession
|
from ba._freeforallsession import FreeForAllSession
|
||||||
from ba._dualteamsession import DualTeamSession
|
from ba._dualteamsession import DualTeamSession
|
||||||
@ -227,7 +229,7 @@ class ServerController:
|
|||||||
|
|
||||||
def _prepare_to_serve(self) -> None:
|
def _prepare_to_serve(self) -> None:
|
||||||
"""Run in a timer to do prep before beginning to serve."""
|
"""Run in a timer to do prep before beginning to serve."""
|
||||||
signed_in = _ba.get_v1_account_state() == 'signed_in'
|
signed_in = get_v1_account_state() == 'signed_in'
|
||||||
if not signed_in:
|
if not signed_in:
|
||||||
|
|
||||||
# Signing in to the local server account should not take long;
|
# Signing in to the local server account should not take long;
|
||||||
@ -247,14 +249,14 @@ class ServerController:
|
|||||||
if not self._playlist_fetch_sent_request:
|
if not self._playlist_fetch_sent_request:
|
||||||
print(f'{Clr.SBLU}Requesting shared-playlist'
|
print(f'{Clr.SBLU}Requesting shared-playlist'
|
||||||
f' {self._config.playlist_code}...{Clr.RST}')
|
f' {self._config.playlist_code}...{Clr.RST}')
|
||||||
_ba.add_transaction(
|
add_transaction(
|
||||||
{
|
{
|
||||||
'type': 'IMPORT_PLAYLIST',
|
'type': 'IMPORT_PLAYLIST',
|
||||||
'code': str(self._config.playlist_code),
|
'code': str(self._config.playlist_code),
|
||||||
'overwrite': True
|
'overwrite': True
|
||||||
},
|
},
|
||||||
callback=self._on_playlist_fetch_response)
|
callback=self._on_playlist_fetch_response)
|
||||||
_ba.run_transactions()
|
run_transactions()
|
||||||
self._playlist_fetch_sent_request = True
|
self._playlist_fetch_sent_request = True
|
||||||
|
|
||||||
if self._playlist_fetch_got_response:
|
if self._playlist_fetch_got_response:
|
||||||
@ -302,7 +304,7 @@ class ServerController:
|
|||||||
appcfg = app.config
|
appcfg = app.config
|
||||||
sessiontype = self._get_session_type()
|
sessiontype = self._get_session_type()
|
||||||
|
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if get_v1_account_state() != 'signed_in':
|
||||||
print('WARNING: launch_server_session() expects to run '
|
print('WARNING: launch_server_session() expects to run '
|
||||||
'with a signed in server account')
|
'with a signed in server account')
|
||||||
|
|
||||||
@ -322,13 +324,13 @@ class ServerController:
|
|||||||
|
|
||||||
# Need to add this in a transaction instead of just setting
|
# Need to add this in a transaction instead of just setting
|
||||||
# it directly or it will get overwritten by the master-server.
|
# it directly or it will get overwritten by the master-server.
|
||||||
_ba.add_transaction({
|
add_transaction({
|
||||||
'type': 'ADD_PLAYLIST',
|
'type': 'ADD_PLAYLIST',
|
||||||
'playlistType': ptypename,
|
'playlistType': ptypename,
|
||||||
'playlistName': self._playlist_name,
|
'playlistName': self._playlist_name,
|
||||||
'playlist': self._config.playlist_inline
|
'playlist': self._config.playlist_inline
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
run_transactions()
|
||||||
|
|
||||||
if self._first_run:
|
if self._first_run:
|
||||||
curtimestr = time.strftime('%c')
|
curtimestr = time.strftime('%c')
|
||||||
|
|||||||
@ -615,6 +615,7 @@ class Session:
|
|||||||
def transitioning_out_activity_was_freed(
|
def transitioning_out_activity_was_freed(
|
||||||
self, can_show_ad_on_death: bool) -> None:
|
self, can_show_ad_on_death: bool) -> None:
|
||||||
"""(internal)"""
|
"""(internal)"""
|
||||||
|
# pylint: disable=cyclic-import
|
||||||
from ba._apputils import garbage_collect
|
from ba._apputils import garbage_collect
|
||||||
|
|
||||||
# Since things should be generally still right now, it's a good time
|
# Since things should be generally still right now, it's a good time
|
||||||
|
|||||||
@ -7,6 +7,7 @@ from __future__ import annotations
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
|
from ba import _internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -366,11 +367,11 @@ def get_store_layout() -> dict[str, list[dict[str, Any]]]:
|
|||||||
'games.ninja_fight', 'games.meteor_shower', 'games.target_practice'
|
'games.ninja_fight', 'games.meteor_shower', 'games.target_practice'
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
if _ba.get_v1_account_misc_read_val('xmas', False):
|
if _internal.get_v1_account_misc_read_val('xmas', False):
|
||||||
store_layout['characters'][0]['items'].append('characters.santa')
|
store_layout['characters'][0]['items'].append('characters.santa')
|
||||||
store_layout['characters'][0]['items'].append('characters.wizard')
|
store_layout['characters'][0]['items'].append('characters.wizard')
|
||||||
store_layout['characters'][0]['items'].append('characters.cyborg')
|
store_layout['characters'][0]['items'].append('characters.cyborg')
|
||||||
if _ba.get_v1_account_misc_read_val('easter', False):
|
if _internal.get_v1_account_misc_read_val('easter', False):
|
||||||
store_layout['characters'].append({
|
store_layout['characters'].append({
|
||||||
'title': 'store.holidaySpecialText',
|
'title': 'store.holidaySpecialText',
|
||||||
'items': ['characters.bunny']
|
'items': ['characters.bunny']
|
||||||
@ -401,10 +402,10 @@ def get_clean_price(price_string: str) -> str:
|
|||||||
def get_available_purchase_count(tab: str | None = None) -> int:
|
def get_available_purchase_count(tab: str | None = None) -> int:
|
||||||
"""(internal)"""
|
"""(internal)"""
|
||||||
try:
|
try:
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if _internal.get_v1_account_state() != 'signed_in':
|
||||||
return 0
|
return 0
|
||||||
count = 0
|
count = 0
|
||||||
our_tickets = _ba.get_v1_account_ticket_count()
|
our_tickets = _internal.get_v1_account_ticket_count()
|
||||||
store_data = get_store_layout()
|
store_data = get_store_layout()
|
||||||
if tab is not None:
|
if tab is not None:
|
||||||
tabs = [(tab, store_data[tab])]
|
tabs = [(tab, store_data[tab])]
|
||||||
@ -425,11 +426,11 @@ def _calc_count_for_tab(tabval: list[dict[str, Any]], our_tickets: int,
|
|||||||
count: int) -> int:
|
count: int) -> int:
|
||||||
for section in tabval:
|
for section in tabval:
|
||||||
for item in section['items']:
|
for item in section['items']:
|
||||||
ticket_cost = _ba.get_v1_account_misc_read_val(
|
ticket_cost = _internal.get_v1_account_misc_read_val(
|
||||||
'price.' + item, None)
|
'price.' + item, None)
|
||||||
if ticket_cost is not None:
|
if ticket_cost is not None:
|
||||||
if (our_tickets >= ticket_cost
|
if (our_tickets >= ticket_cost
|
||||||
and not _ba.get_purchased(item)):
|
and not _internal.get_purchased(item)):
|
||||||
count += 1
|
count += 1
|
||||||
return count
|
return count
|
||||||
|
|
||||||
@ -463,7 +464,7 @@ def get_available_sale_time(tab: str) -> int | None:
|
|||||||
|
|
||||||
# We start the timer once we get the duration from
|
# We start the timer once we get the duration from
|
||||||
# the server.
|
# the server.
|
||||||
start_duration = _ba.get_v1_account_misc_read_val(
|
start_duration = _internal.get_v1_account_misc_read_val(
|
||||||
'proSaleDurationMinutes', None)
|
'proSaleDurationMinutes', None)
|
||||||
if start_duration is not None:
|
if start_duration is not None:
|
||||||
app.pro_sale_start_time = int(
|
app.pro_sale_start_time = int(
|
||||||
@ -489,12 +490,12 @@ def get_available_sale_time(tab: str) -> int | None:
|
|||||||
sale_times.append(val)
|
sale_times.append(val)
|
||||||
|
|
||||||
# Now look for sales in this tab.
|
# Now look for sales in this tab.
|
||||||
sales_raw = _ba.get_v1_account_misc_read_val('sales', {})
|
sales_raw = _internal.get_v1_account_misc_read_val('sales', {})
|
||||||
store_layout = get_store_layout()
|
store_layout = get_store_layout()
|
||||||
for section in store_layout[tab]:
|
for section in store_layout[tab]:
|
||||||
for item in section['items']:
|
for item in section['items']:
|
||||||
if item in sales_raw:
|
if item in sales_raw:
|
||||||
if not _ba.get_purchased(item):
|
if not _internal.get_purchased(item):
|
||||||
to_end = ((datetime.datetime.utcfromtimestamp(
|
to_end = ((datetime.datetime.utcfromtimestamp(
|
||||||
sales_raw[item]['e']) -
|
sales_raw[item]['e']) -
|
||||||
datetime.datetime.utcnow()).total_seconds())
|
datetime.datetime.utcnow()).total_seconds())
|
||||||
@ -520,7 +521,7 @@ def get_unowned_maps() -> list[str]:
|
|||||||
if not _ba.app.headless_mode:
|
if not _ba.app.headless_mode:
|
||||||
for map_section in get_store_layout()['maps']:
|
for map_section in get_store_layout()['maps']:
|
||||||
for mapitem in map_section['items']:
|
for mapitem in map_section['items']:
|
||||||
if not _ba.get_purchased(mapitem):
|
if not _internal.get_purchased(mapitem):
|
||||||
m_info = get_store_item(mapitem)
|
m_info = get_store_item(mapitem)
|
||||||
unowned_maps.add(m_info['map_type'].name)
|
unowned_maps.add(m_info['map_type'].name)
|
||||||
return sorted(unowned_maps)
|
return sorted(unowned_maps)
|
||||||
@ -533,7 +534,7 @@ def get_unowned_game_types() -> set[type[ba.GameActivity]]:
|
|||||||
if not _ba.app.headless_mode:
|
if not _ba.app.headless_mode:
|
||||||
for section in get_store_layout()['minigames']:
|
for section in get_store_layout()['minigames']:
|
||||||
for mname in section['items']:
|
for mname in section['items']:
|
||||||
if not _ba.get_purchased(mname):
|
if not _internal.get_purchased(mname):
|
||||||
m_info = get_store_item(mname)
|
m_info = get_store_item(mname)
|
||||||
unowned_games.add(m_info['gametype'])
|
unowned_games.add(m_info['gametype'])
|
||||||
return unowned_games
|
return unowned_games
|
||||||
|
|||||||
@ -6,6 +6,7 @@ Classes and functions contained here, while technically 'public', may change
|
|||||||
or disappear without warning, so should be avoided (or used sparingly and
|
or disappear without warning, so should be avoided (or used sparingly and
|
||||||
defensively) in mods.
|
defensively) in mods.
|
||||||
"""
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from ba._map import (get_map_class, register_map, preload_map_preview_media,
|
from ba._map import (get_map_class, register_map, preload_map_preview_media,
|
||||||
get_map_display_string, get_filtered_map_name)
|
get_map_display_string, get_filtered_map_name)
|
||||||
@ -38,6 +39,19 @@ from ba._store import (get_available_sale_time, get_available_purchase_count,
|
|||||||
from ba._tournament import get_tournament_prize_strings
|
from ba._tournament import get_tournament_prize_strings
|
||||||
from ba._gameutils import get_trophy_string
|
from ba._gameutils import get_trophy_string
|
||||||
|
|
||||||
|
from ba._internal import (
|
||||||
|
get_v2_fleet, get_master_server_address, is_blessed, get_news_show,
|
||||||
|
game_service_has_leaderboard, report_achievement, submit_score,
|
||||||
|
tournament_query, power_ranking_query, restore_purchases, purchase,
|
||||||
|
get_purchases_state, get_purchased, get_price, in_game_purchase,
|
||||||
|
add_transaction, reset_achievements, get_public_login_id,
|
||||||
|
have_outstanding_transactions, run_transactions,
|
||||||
|
get_v1_account_misc_read_val, get_v1_account_misc_read_val_2,
|
||||||
|
get_v1_account_misc_val, get_v1_account_ticket_count,
|
||||||
|
get_v1_account_state_num, get_v1_account_state,
|
||||||
|
get_v1_account_display_string, get_v1_account_type, get_v1_account_name,
|
||||||
|
sign_out_v1, sign_in_v1, mark_config_dirty)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'get_unowned_maps', 'get_unowned_game_types', 'get_map_class',
|
'get_unowned_maps', 'get_unowned_game_types', 'get_map_class',
|
||||||
'register_map', 'preload_map_preview_media', 'get_map_display_string',
|
'register_map', 'preload_map_preview_media', 'get_map_display_string',
|
||||||
@ -56,5 +70,16 @@ __all__ = [
|
|||||||
'get_default_teams_playlist', 'filter_playlist', 'get_available_sale_time',
|
'get_default_teams_playlist', 'filter_playlist', 'get_available_sale_time',
|
||||||
'get_available_purchase_count', 'get_store_item_name_translated',
|
'get_available_purchase_count', 'get_store_item_name_translated',
|
||||||
'get_store_item_display_size', 'get_store_layout', 'get_store_item',
|
'get_store_item_display_size', 'get_store_layout', 'get_store_item',
|
||||||
'get_clean_price', 'get_tournament_prize_strings', 'get_trophy_string'
|
'get_clean_price', 'get_tournament_prize_strings', 'get_trophy_string',
|
||||||
|
'get_v2_fleet', 'get_master_server_address', 'is_blessed', 'get_news_show',
|
||||||
|
'game_service_has_leaderboard', 'report_achievement', 'submit_score',
|
||||||
|
'tournament_query', 'power_ranking_query', 'restore_purchases', 'purchase',
|
||||||
|
'get_purchases_state', 'get_purchased', 'get_price', 'in_game_purchase',
|
||||||
|
'add_transaction', 'reset_achievements', 'get_public_login_id',
|
||||||
|
'have_outstanding_transactions', 'run_transactions',
|
||||||
|
'get_v1_account_misc_read_val', 'get_v1_account_misc_read_val_2',
|
||||||
|
'get_v1_account_misc_val', 'get_v1_account_ticket_count',
|
||||||
|
'get_v1_account_state_num', 'get_v1_account_state',
|
||||||
|
'get_v1_account_display_string', 'get_v1_account_type',
|
||||||
|
'get_v1_account_name', 'sign_out_v1', 'sign_in_v1', 'mark_config_dirty'
|
||||||
]
|
]
|
||||||
|
|||||||
@ -10,6 +10,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.actor.text import Text
|
from bastd.actor.text import Text
|
||||||
from bastd.actor.zoomtext import ZoomText
|
from bastd.actor.zoomtext import ZoomText
|
||||||
|
|
||||||
@ -52,9 +53,9 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
|
|||||||
ba.app.ach.achievements_for_coop_level(self._campaign.name + ':' +
|
ba.app.ach.achievements_for_coop_level(self._campaign.name + ':' +
|
||||||
settings['level']))
|
settings['level']))
|
||||||
|
|
||||||
self._account_type = (_ba.get_v1_account_type()
|
self._account_type = (ba.internal.get_v1_account_type()
|
||||||
if _ba.get_v1_account_state() == 'signed_in' else
|
if ba.internal.get_v1_account_state()
|
||||||
None)
|
== 'signed_in' else None)
|
||||||
|
|
||||||
self._game_service_icon_color: Sequence[float] | None
|
self._game_service_icon_color: Sequence[float] | None
|
||||||
self._game_service_achievements_texture: ba.Texture | None
|
self._game_service_achievements_texture: ba.Texture | None
|
||||||
@ -167,7 +168,7 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
|
|||||||
|
|
||||||
# If game-center/etc scores are available we show our friends'
|
# If game-center/etc scores are available we show our friends'
|
||||||
# scores. Otherwise we show our local high scores.
|
# scores. Otherwise we show our local high scores.
|
||||||
self._show_friend_scores = _ba.game_service_has_leaderboard(
|
self._show_friend_scores = ba.internal.game_service_has_leaderboard(
|
||||||
self._game_name_str, self._game_config_str)
|
self._game_name_str, self._game_config_str)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -552,7 +553,7 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
|
|||||||
|
|
||||||
# Any time we complete a level, set the next one as unlocked.
|
# Any time we complete a level, set the next one as unlocked.
|
||||||
if self._is_complete and self._is_more_levels:
|
if self._is_complete and self._is_more_levels:
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'COMPLETE_LEVEL',
|
'type': 'COMPLETE_LEVEL',
|
||||||
'campaign': self._campaign.name,
|
'campaign': self._campaign.name,
|
||||||
'level': self._level_name
|
'level': self._level_name
|
||||||
@ -632,7 +633,7 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
|
|||||||
if ba.app.server is None:
|
if ba.app.server is None:
|
||||||
# If we're running in normal non-headless build, show this text
|
# If we're running in normal non-headless build, show this text
|
||||||
# because only host can continue the game.
|
# because only host can continue the game.
|
||||||
adisp = _ba.get_v1_account_display_string()
|
adisp = ba.internal.get_v1_account_display_string()
|
||||||
txt = Text(ba.Lstr(resource='waitingForHostText',
|
txt = Text(ba.Lstr(resource='waitingForHostText',
|
||||||
subs=[('${HOST}', adisp)]),
|
subs=[('${HOST}', adisp)]),
|
||||||
maxwidth=300,
|
maxwidth=300,
|
||||||
@ -726,14 +727,14 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
|
|||||||
if self._score is not None:
|
if self._score is not None:
|
||||||
sver = (self._campaign.getlevel(
|
sver = (self._campaign.getlevel(
|
||||||
self._level_name).get_score_version_string())
|
self._level_name).get_score_version_string())
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'SET_LEVEL_LOCAL_HIGH_SCORES',
|
'type': 'SET_LEVEL_LOCAL_HIGH_SCORES',
|
||||||
'campaign': self._campaign.name,
|
'campaign': self._campaign.name,
|
||||||
'level': self._level_name,
|
'level': self._level_name,
|
||||||
'scoreVersion': sver,
|
'scoreVersion': sver,
|
||||||
'scores': our_high_scores_all
|
'scores': our_high_scores_all
|
||||||
})
|
})
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
# We expect this only in kiosk mode; complain otherwise.
|
# We expect this only in kiosk mode; complain otherwise.
|
||||||
if not (ba.app.demo_mode or ba.app.arcade_mode):
|
if not (ba.app.demo_mode or ba.app.arcade_mode):
|
||||||
print('got not-signed-in at score-submit; unexpected')
|
print('got not-signed-in at score-submit; unexpected')
|
||||||
@ -743,21 +744,22 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
|
|||||||
else:
|
else:
|
||||||
assert self._game_name_str is not None
|
assert self._game_name_str is not None
|
||||||
assert self._game_config_str is not None
|
assert self._game_config_str is not None
|
||||||
_ba.submit_score(self._game_name_str,
|
ba.internal.submit_score(
|
||||||
self._game_config_str,
|
self._game_name_str,
|
||||||
name_str,
|
self._game_config_str,
|
||||||
self._score,
|
name_str,
|
||||||
ba.WeakCall(self._got_score_results),
|
self._score,
|
||||||
ba.WeakCall(self._got_friend_score_results)
|
ba.WeakCall(self._got_score_results),
|
||||||
if self._show_friend_scores else None,
|
ba.WeakCall(self._got_friend_score_results)
|
||||||
order=self._score_order,
|
if self._show_friend_scores else None,
|
||||||
tournament_id=self.session.tournament_id,
|
order=self._score_order,
|
||||||
score_type=self._score_type,
|
tournament_id=self.session.tournament_id,
|
||||||
campaign=self._campaign.name,
|
score_type=self._score_type,
|
||||||
level=self._level_name)
|
campaign=self._campaign.name,
|
||||||
|
level=self._level_name)
|
||||||
|
|
||||||
# Apply the transactions we've been adding locally.
|
# Apply the transactions we've been adding locally.
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|
||||||
# If we're not doing the world's-best button, just show a title
|
# If we're not doing the world's-best button, just show a title
|
||||||
# instead.
|
# instead.
|
||||||
@ -1077,8 +1079,9 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
|
|||||||
# Prepend our master-server addr if its a relative addr.
|
# Prepend our master-server addr if its a relative addr.
|
||||||
if (not self._score_link.startswith('http://')
|
if (not self._score_link.startswith('http://')
|
||||||
and not self._score_link.startswith('https://')):
|
and not self._score_link.startswith('https://')):
|
||||||
self._score_link = (_ba.get_master_server_address() + '/' +
|
self._score_link = (
|
||||||
self._score_link)
|
ba.internal.get_master_server_address() + '/' +
|
||||||
|
self._score_link)
|
||||||
self._score_loading_status = None
|
self._score_loading_status = None
|
||||||
if 'tournamentSecondsRemaining' in results:
|
if 'tournamentSecondsRemaining' in results:
|
||||||
secs_remaining = results['tournamentSecondsRemaining']
|
secs_remaining = results['tournamentSecondsRemaining']
|
||||||
|
|||||||
@ -5,8 +5,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
pass
|
pass
|
||||||
@ -16,66 +16,67 @@ def get_appearances(include_locked: bool = False) -> list[str]:
|
|||||||
"""Get the list of available spaz appearances."""
|
"""Get the list of available spaz appearances."""
|
||||||
# pylint: disable=too-many-statements
|
# pylint: disable=too-many-statements
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
|
get_purchased = ba.internal.get_purchased
|
||||||
disallowed = []
|
disallowed = []
|
||||||
if not include_locked:
|
if not include_locked:
|
||||||
# hmm yeah this'll be tough to hack...
|
# hmm yeah this'll be tough to hack...
|
||||||
if not _ba.get_purchased('characters.santa'):
|
if not get_purchased('characters.santa'):
|
||||||
disallowed.append('Santa Claus')
|
disallowed.append('Santa Claus')
|
||||||
if not _ba.get_purchased('characters.frosty'):
|
if not get_purchased('characters.frosty'):
|
||||||
disallowed.append('Frosty')
|
disallowed.append('Frosty')
|
||||||
if not _ba.get_purchased('characters.bones'):
|
if not get_purchased('characters.bones'):
|
||||||
disallowed.append('Bones')
|
disallowed.append('Bones')
|
||||||
if not _ba.get_purchased('characters.bernard'):
|
if not get_purchased('characters.bernard'):
|
||||||
disallowed.append('Bernard')
|
disallowed.append('Bernard')
|
||||||
if not _ba.get_purchased('characters.pixie'):
|
if not get_purchased('characters.pixie'):
|
||||||
disallowed.append('Pixel')
|
disallowed.append('Pixel')
|
||||||
if not _ba.get_purchased('characters.pascal'):
|
if not get_purchased('characters.pascal'):
|
||||||
disallowed.append('Pascal')
|
disallowed.append('Pascal')
|
||||||
if not _ba.get_purchased('characters.actionhero'):
|
if not get_purchased('characters.actionhero'):
|
||||||
disallowed.append('Todd McBurton')
|
disallowed.append('Todd McBurton')
|
||||||
if not _ba.get_purchased('characters.taobaomascot'):
|
if not get_purchased('characters.taobaomascot'):
|
||||||
disallowed.append('Taobao Mascot')
|
disallowed.append('Taobao Mascot')
|
||||||
if not _ba.get_purchased('characters.agent'):
|
if not get_purchased('characters.agent'):
|
||||||
disallowed.append('Agent Johnson')
|
disallowed.append('Agent Johnson')
|
||||||
if not _ba.get_purchased('characters.jumpsuit'):
|
if not get_purchased('characters.jumpsuit'):
|
||||||
disallowed.append('Lee')
|
disallowed.append('Lee')
|
||||||
if not _ba.get_purchased('characters.assassin'):
|
if not get_purchased('characters.assassin'):
|
||||||
disallowed.append('Zola')
|
disallowed.append('Zola')
|
||||||
if not _ba.get_purchased('characters.wizard'):
|
if not get_purchased('characters.wizard'):
|
||||||
disallowed.append('Grumbledorf')
|
disallowed.append('Grumbledorf')
|
||||||
if not _ba.get_purchased('characters.cowboy'):
|
if not get_purchased('characters.cowboy'):
|
||||||
disallowed.append('Butch')
|
disallowed.append('Butch')
|
||||||
if not _ba.get_purchased('characters.witch'):
|
if not get_purchased('characters.witch'):
|
||||||
disallowed.append('Witch')
|
disallowed.append('Witch')
|
||||||
if not _ba.get_purchased('characters.warrior'):
|
if not get_purchased('characters.warrior'):
|
||||||
disallowed.append('Warrior')
|
disallowed.append('Warrior')
|
||||||
if not _ba.get_purchased('characters.superhero'):
|
if not get_purchased('characters.superhero'):
|
||||||
disallowed.append('Middle-Man')
|
disallowed.append('Middle-Man')
|
||||||
if not _ba.get_purchased('characters.alien'):
|
if not get_purchased('characters.alien'):
|
||||||
disallowed.append('Alien')
|
disallowed.append('Alien')
|
||||||
if not _ba.get_purchased('characters.oldlady'):
|
if not get_purchased('characters.oldlady'):
|
||||||
disallowed.append('OldLady')
|
disallowed.append('OldLady')
|
||||||
if not _ba.get_purchased('characters.gladiator'):
|
if not get_purchased('characters.gladiator'):
|
||||||
disallowed.append('Gladiator')
|
disallowed.append('Gladiator')
|
||||||
if not _ba.get_purchased('characters.wrestler'):
|
if not get_purchased('characters.wrestler'):
|
||||||
disallowed.append('Wrestler')
|
disallowed.append('Wrestler')
|
||||||
if not _ba.get_purchased('characters.operasinger'):
|
if not get_purchased('characters.operasinger'):
|
||||||
disallowed.append('Gretel')
|
disallowed.append('Gretel')
|
||||||
if not _ba.get_purchased('characters.robot'):
|
if not get_purchased('characters.robot'):
|
||||||
disallowed.append('Robot')
|
disallowed.append('Robot')
|
||||||
if not _ba.get_purchased('characters.cyborg'):
|
if not get_purchased('characters.cyborg'):
|
||||||
disallowed.append('B-9000')
|
disallowed.append('B-9000')
|
||||||
if not _ba.get_purchased('characters.bunny'):
|
if not get_purchased('characters.bunny'):
|
||||||
disallowed.append('Easter Bunny')
|
disallowed.append('Easter Bunny')
|
||||||
if not _ba.get_purchased('characters.kronk'):
|
if not get_purchased('characters.kronk'):
|
||||||
disallowed.append('Kronk')
|
disallowed.append('Kronk')
|
||||||
if not _ba.get_purchased('characters.zoe'):
|
if not get_purchased('characters.zoe'):
|
||||||
disallowed.append('Zoe')
|
disallowed.append('Zoe')
|
||||||
if not _ba.get_purchased('characters.jackmorgan'):
|
if not get_purchased('characters.jackmorgan'):
|
||||||
disallowed.append('Jack Morgan')
|
disallowed.append('Jack Morgan')
|
||||||
if not _ba.get_purchased('characters.mel'):
|
if not get_purchased('characters.mel'):
|
||||||
disallowed.append('Mel')
|
disallowed.append('Mel')
|
||||||
if not _ba.get_purchased('characters.snakeshadow'):
|
if not get_purchased('characters.snakeshadow'):
|
||||||
disallowed.append('Snake Shadow')
|
disallowed.append('Snake Shadow')
|
||||||
return [
|
return [
|
||||||
s for s in list(ba.app.spaz_appearances.keys()) if s not in disallowed
|
s for s in list(ba.app.spaz_appearances.keys()) if s not in disallowed
|
||||||
|
|||||||
@ -7,8 +7,8 @@ from __future__ import annotations
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.gameutils import SharedObjects
|
from bastd.gameutils import SharedObjects
|
||||||
import _ba
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any, Sequence
|
from typing import Any, Sequence
|
||||||
@ -208,15 +208,18 @@ class SpazFactory:
|
|||||||
|
|
||||||
# Lets load some basic rules.
|
# Lets load some basic rules.
|
||||||
# (allows them to be tweaked from the master server)
|
# (allows them to be tweaked from the master server)
|
||||||
self.shield_decay_rate = _ba.get_v1_account_misc_read_val('rsdr', 10.0)
|
self.shield_decay_rate = ba.internal.get_v1_account_misc_read_val(
|
||||||
self.punch_cooldown = _ba.get_v1_account_misc_read_val('rpc', 400)
|
'rsdr', 10.0)
|
||||||
self.punch_cooldown_gloves = (_ba.get_v1_account_misc_read_val(
|
self.punch_cooldown = ba.internal.get_v1_account_misc_read_val(
|
||||||
|
'rpc', 400)
|
||||||
|
self.punch_cooldown_gloves = (ba.internal.get_v1_account_misc_read_val(
|
||||||
'rpcg', 300))
|
'rpcg', 300))
|
||||||
self.punch_power_scale = _ba.get_v1_account_misc_read_val('rpp', 1.2)
|
self.punch_power_scale = ba.internal.get_v1_account_misc_read_val(
|
||||||
self.punch_power_scale_gloves = (_ba.get_v1_account_misc_read_val(
|
'rpp', 1.2)
|
||||||
'rppg', 1.4))
|
self.punch_power_scale_gloves = (
|
||||||
self.max_shield_spillover_damage = (_ba.get_v1_account_misc_read_val(
|
ba.internal.get_v1_account_misc_read_val('rppg', 1.4))
|
||||||
'rsms', 500))
|
self.max_shield_spillover_damage = (
|
||||||
|
ba.internal.get_v1_account_misc_read_val('rsms', 500))
|
||||||
|
|
||||||
def get_style(self, character: str) -> str:
|
def get_style(self, character: str) -> str:
|
||||||
"""Return the named style for this character.
|
"""Return the named style for this character.
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import weakref
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
import _ba
|
import _ba
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -67,7 +68,8 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
|
|||||||
# host is navigating menus while they're just staring at an
|
# host is navigating menus while they're just staring at an
|
||||||
# empty-ish screen.
|
# empty-ish screen.
|
||||||
tval = ba.Lstr(resource='hostIsNavigatingMenusText',
|
tval = ba.Lstr(resource='hostIsNavigatingMenusText',
|
||||||
subs=[('${HOST}', _ba.get_v1_account_display_string())])
|
subs=[('${HOST}',
|
||||||
|
ba.internal.get_v1_account_display_string())])
|
||||||
self._host_is_navigating_text = ba.NodeActor(
|
self._host_is_navigating_text = ba.NodeActor(
|
||||||
ba.newnode('text',
|
ba.newnode('text',
|
||||||
attrs={
|
attrs={
|
||||||
@ -274,7 +276,7 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
|
|||||||
|
|
||||||
# We now want to wait until we're signed in before fetching news.
|
# We now want to wait until we're signed in before fetching news.
|
||||||
def _try_fetching_news(self) -> None:
|
def _try_fetching_news(self) -> None:
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
self._fetch_news()
|
self._fetch_news()
|
||||||
self._fetch_timer = None
|
self._fetch_timer = None
|
||||||
|
|
||||||
@ -282,7 +284,7 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
|
|||||||
ba.app.main_menu_last_news_fetch_time = time.time()
|
ba.app.main_menu_last_news_fetch_time = time.time()
|
||||||
|
|
||||||
# UPDATE - We now just pull news from MRVs.
|
# UPDATE - We now just pull news from MRVs.
|
||||||
news = _ba.get_v1_account_misc_read_val('n', None)
|
news = ba.internal.get_v1_account_misc_read_val('n', None)
|
||||||
if news is not None:
|
if news is not None:
|
||||||
self._got_news(news)
|
self._got_news(news)
|
||||||
|
|
||||||
@ -762,7 +764,7 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
|
|||||||
})
|
})
|
||||||
|
|
||||||
def _get_custom_logo_tex_name(self) -> str | None:
|
def _get_custom_logo_tex_name(self) -> str | None:
|
||||||
if _ba.get_v1_account_misc_read_val('easter', False):
|
if ba.internal.get_v1_account_misc_read_val('easter', False):
|
||||||
return 'logoEaster'
|
return 'logoEaster'
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
import ba
|
||||||
|
|
||||||
|
|
||||||
@ -12,10 +11,11 @@ def show_sign_in_prompt(account_type: str | None = None) -> None:
|
|||||||
"""Bring up a prompt telling the user they must sign in."""
|
"""Bring up a prompt telling the user they must sign in."""
|
||||||
from bastd.ui.confirm import ConfirmWindow
|
from bastd.ui.confirm import ConfirmWindow
|
||||||
from bastd.ui.account import settings
|
from bastd.ui.account import settings
|
||||||
|
from ba.internal import sign_in_v1
|
||||||
if account_type == 'Google Play':
|
if account_type == 'Google Play':
|
||||||
ConfirmWindow(
|
ConfirmWindow(
|
||||||
ba.Lstr(resource='notSignedInGooglePlayErrorText'),
|
ba.Lstr(resource='notSignedInGooglePlayErrorText'),
|
||||||
lambda: _ba.sign_in_v1('Google Play'),
|
lambda: sign_in_v1('Google Play'),
|
||||||
ok_text=ba.Lstr(resource='accountSettingsWindow.signInText'),
|
ok_text=ba.Lstr(resource='accountSettingsWindow.signInText'),
|
||||||
width=460,
|
width=460,
|
||||||
height=130)
|
height=130)
|
||||||
|
|||||||
@ -8,8 +8,8 @@ import copy
|
|||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -50,7 +50,8 @@ class AccountLinkWindow(ba.Window):
|
|||||||
autoselect=True,
|
autoselect=True,
|
||||||
icon=ba.gettexture('crossOut'),
|
icon=ba.gettexture('crossOut'),
|
||||||
iconscale=1.2)
|
iconscale=1.2)
|
||||||
maxlinks = _ba.get_v1_account_misc_read_val('maxLinkAccounts', 5)
|
maxlinks = ba.internal.get_v1_account_misc_read_val(
|
||||||
|
'maxLinkAccounts', 5)
|
||||||
ba.textwidget(
|
ba.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height * 0.56),
|
position=(self._width * 0.5, self._height * 0.56),
|
||||||
@ -84,17 +85,17 @@ class AccountLinkWindow(ba.Window):
|
|||||||
|
|
||||||
def _generate_press(self) -> None:
|
def _generate_press(self) -> None:
|
||||||
from bastd.ui import account
|
from bastd.ui import account
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
account.show_sign_in_prompt()
|
account.show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
ba.screenmessage(
|
ba.screenmessage(
|
||||||
ba.Lstr(resource='gatherWindow.requestingAPromoCodeText'),
|
ba.Lstr(resource='gatherWindow.requestingAPromoCodeText'),
|
||||||
color=(0, 1, 0))
|
color=(0, 1, 0))
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'ACCOUNT_LINK_CODE_REQUEST',
|
'type': 'ACCOUNT_LINK_CODE_REQUEST',
|
||||||
'expire_time': time.time() + 5
|
'expire_time': time.time() + 5
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|
||||||
def _enter_code_press(self) -> None:
|
def _enter_code_press(self) -> None:
|
||||||
from bastd.ui import promocode
|
from bastd.ui import promocode
|
||||||
|
|||||||
@ -10,6 +10,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
pass
|
pass
|
||||||
@ -45,10 +46,10 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
self._r = 'accountSettingsWindow'
|
self._r = 'accountSettingsWindow'
|
||||||
self._modal = modal
|
self._modal = modal
|
||||||
self._needs_refresh = False
|
self._needs_refresh = False
|
||||||
self._signed_in = (_ba.get_v1_account_state() == 'signed_in')
|
self._signed_in = (ba.internal.get_v1_account_state() == 'signed_in')
|
||||||
self._account_state_num = _ba.get_v1_account_state_num()
|
self._account_state_num = ba.internal.get_v1_account_state_num()
|
||||||
self._show_linked = (self._signed_in
|
self._show_linked = (self._signed_in
|
||||||
and _ba.get_v1_account_misc_read_val(
|
and ba.internal.get_v1_account_misc_read_val(
|
||||||
'allowAccountLinking2', False))
|
'allowAccountLinking2', False))
|
||||||
self._check_sign_in_timer = ba.Timer(1.0,
|
self._check_sign_in_timer = ba.Timer(1.0,
|
||||||
ba.WeakCall(self._update),
|
ba.WeakCall(self._update),
|
||||||
@ -58,7 +59,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
# Currently we can only reset achievements on game-center.
|
# Currently we can only reset achievements on game-center.
|
||||||
account_type: str | None
|
account_type: str | None
|
||||||
if self._signed_in:
|
if self._signed_in:
|
||||||
account_type = _ba.get_v1_account_type()
|
account_type = ba.internal.get_v1_account_type()
|
||||||
else:
|
else:
|
||||||
account_type = None
|
account_type = None
|
||||||
self._can_reset_achievements = (account_type == 'Game Center')
|
self._can_reset_achievements = (account_type == 'Game Center')
|
||||||
@ -159,11 +160,12 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
# Hmm should update this to use get_account_state_num.
|
# Hmm should update this to use get_account_state_num.
|
||||||
# Theoretically if we switch from one signed-in account to another
|
# Theoretically if we switch from one signed-in account to another
|
||||||
# in the background this would break.
|
# in the background this would break.
|
||||||
account_state_num = _ba.get_v1_account_state_num()
|
account_state_num = ba.internal.get_v1_account_state_num()
|
||||||
account_state = _ba.get_v1_account_state()
|
account_state = ba.internal.get_v1_account_state()
|
||||||
|
|
||||||
show_linked = (self._signed_in and _ba.get_v1_account_misc_read_val(
|
show_linked = (self._signed_in
|
||||||
'allowAccountLinking2', False))
|
and ba.internal.get_v1_account_misc_read_val(
|
||||||
|
'allowAccountLinking2', False))
|
||||||
|
|
||||||
if (account_state_num != self._account_state_num
|
if (account_state_num != self._account_state_num
|
||||||
or self._show_linked != show_linked or self._needs_refresh):
|
or self._show_linked != show_linked or self._needs_refresh):
|
||||||
@ -191,8 +193,8 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui import confirm
|
from bastd.ui import confirm
|
||||||
|
|
||||||
account_state = _ba.get_v1_account_state()
|
account_state = ba.internal.get_v1_account_state()
|
||||||
account_type = (_ba.get_v1_account_type()
|
account_type = (ba.internal.get_v1_account_type()
|
||||||
if account_state == 'signed_in' else 'unknown')
|
if account_state == 'signed_in' else 'unknown')
|
||||||
|
|
||||||
is_google = account_type == 'Google Play'
|
is_google = account_type == 'Google Play'
|
||||||
@ -225,8 +227,8 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
in ['Game Center', 'Game Circle'])
|
in ['Game Center', 'Game Circle'])
|
||||||
game_service_button_space = 60.0
|
game_service_button_space = 60.0
|
||||||
|
|
||||||
show_linked_accounts_text = (self._signed_in
|
show_linked_accounts_text = (self._signed_in and
|
||||||
and _ba.get_v1_account_misc_read_val(
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
'allowAccountLinking2', False))
|
'allowAccountLinking2', False))
|
||||||
linked_accounts_text_space = 60.0
|
linked_accounts_text_space = 60.0
|
||||||
|
|
||||||
@ -254,8 +256,8 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
show_player_profiles_button = self._signed_in
|
show_player_profiles_button = self._signed_in
|
||||||
player_profiles_button_space = 100.0
|
player_profiles_button_space = 100.0
|
||||||
|
|
||||||
show_link_accounts_button = (self._signed_in
|
show_link_accounts_button = (self._signed_in and
|
||||||
and _ba.get_v1_account_misc_read_val(
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
'allowAccountLinking2', False))
|
'allowAccountLinking2', False))
|
||||||
link_accounts_button_space = 70.0
|
link_accounts_button_space = 70.0
|
||||||
|
|
||||||
@ -335,7 +337,8 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=ba.Lstr(
|
text=ba.Lstr(
|
||||||
resource='accountSettingsWindow.deviceSpecificAccountText',
|
resource='accountSettingsWindow.deviceSpecificAccountText',
|
||||||
subs=[('${NAME}', _ba.get_v1_account_display_string())]),
|
subs=[('${NAME}',
|
||||||
|
ba.internal.get_v1_account_display_string())]),
|
||||||
scale=0.7,
|
scale=0.7,
|
||||||
color=(0.5, 0.5, 0.6),
|
color=(0.5, 0.5, 0.6),
|
||||||
maxwidth=self._sub_width * 0.9,
|
maxwidth=self._sub_width * 0.9,
|
||||||
@ -589,7 +592,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
if show_game_service_button:
|
if show_game_service_button:
|
||||||
button_width = 300
|
button_width = 300
|
||||||
v -= game_service_button_space * 0.85
|
v -= game_service_button_space * 0.85
|
||||||
account_type = _ba.get_v1_account_type()
|
account_type = ba.internal.get_v1_account_type()
|
||||||
if account_type == 'Game Center':
|
if account_type == 'Game Center':
|
||||||
account_type_name = ba.Lstr(resource='gameCenterText')
|
account_type_name = ba.Lstr(resource='gameCenterText')
|
||||||
elif account_type == 'Game Circle':
|
elif account_type == 'Game Circle':
|
||||||
@ -889,8 +892,8 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
def _on_achievements_press(self) -> None:
|
def _on_achievements_press(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui import achievements
|
from bastd.ui import achievements
|
||||||
account_state = _ba.get_v1_account_state()
|
account_state = ba.internal.get_v1_account_state()
|
||||||
account_type = (_ba.get_v1_account_type()
|
account_type = (ba.internal.get_v1_account_type()
|
||||||
if account_state == 'signed_in' else 'unknown')
|
if account_state == 'signed_in' else 'unknown')
|
||||||
# for google play we use the built-in UI; otherwise pop up our own
|
# for google play we use the built-in UI; otherwise pop up our own
|
||||||
if account_type == 'Google Play':
|
if account_type == 'Google Play':
|
||||||
@ -913,9 +916,10 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
def _have_unlinkable_accounts(self) -> bool:
|
def _have_unlinkable_accounts(self) -> bool:
|
||||||
# if this is not present, we haven't had contact from the server so
|
# if this is not present, we haven't had contact from the server so
|
||||||
# let's not proceed..
|
# let's not proceed..
|
||||||
if _ba.get_public_login_id() is None:
|
if ba.internal.get_public_login_id() is None:
|
||||||
return False
|
return False
|
||||||
accounts = _ba.get_v1_account_misc_read_val_2('linkedAccounts', [])
|
accounts = ba.internal.get_v1_account_misc_read_val_2(
|
||||||
|
'linkedAccounts', [])
|
||||||
return len(accounts) > 1
|
return len(accounts) > 1
|
||||||
|
|
||||||
def _update_unlink_accounts_button(self) -> None:
|
def _update_unlink_accounts_button(self) -> None:
|
||||||
@ -933,11 +937,12 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
|
|
||||||
# if this is not present, we haven't had contact from the server so
|
# if this is not present, we haven't had contact from the server so
|
||||||
# let's not proceed..
|
# let's not proceed..
|
||||||
if _ba.get_public_login_id() is None:
|
if ba.internal.get_public_login_id() is None:
|
||||||
num = int(time.time()) % 4
|
num = int(time.time()) % 4
|
||||||
accounts_str = num * '.' + (4 - num) * ' '
|
accounts_str = num * '.' + (4 - num) * ' '
|
||||||
else:
|
else:
|
||||||
accounts = _ba.get_v1_account_misc_read_val_2('linkedAccounts', [])
|
accounts = ba.internal.get_v1_account_misc_read_val_2(
|
||||||
|
'linkedAccounts', [])
|
||||||
# our_account = _bs.get_v1_account_display_string()
|
# our_account = _bs.get_v1_account_display_string()
|
||||||
# accounts = [a for a in accounts if a != our_account]
|
# accounts = [a for a in accounts if a != our_account]
|
||||||
# accounts_str = u', '.join(accounts) if accounts else
|
# accounts_str = u', '.join(accounts) if accounts else
|
||||||
@ -977,7 +982,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
if self._tickets_text is None:
|
if self._tickets_text is None:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
tc_str = str(_ba.get_v1_account_ticket_count())
|
tc_str = str(ba.internal.get_v1_account_ticket_count())
|
||||||
except Exception:
|
except Exception:
|
||||||
ba.print_exception()
|
ba.print_exception()
|
||||||
tc_str = '-'
|
tc_str = '-'
|
||||||
@ -989,7 +994,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
if self._account_name_text is None:
|
if self._account_name_text is None:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
name_str = _ba.get_v1_account_display_string()
|
name_str = ba.internal.get_v1_account_display_string()
|
||||||
except Exception:
|
except Exception:
|
||||||
ba.print_exception()
|
ba.print_exception()
|
||||||
name_str = '??'
|
name_str = '??'
|
||||||
@ -1043,7 +1048,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
if ba.app.accounts_v2.have_primary_credentials():
|
if ba.app.accounts_v2.have_primary_credentials():
|
||||||
ba.app.accounts_v2.set_primary_credentials(None)
|
ba.app.accounts_v2.set_primary_credentials(None)
|
||||||
else:
|
else:
|
||||||
_ba.sign_out_v1()
|
ba.internal.sign_out_v1()
|
||||||
|
|
||||||
cfg = ba.app.config
|
cfg = ba.app.config
|
||||||
|
|
||||||
@ -1061,7 +1066,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
account_type: str,
|
account_type: str,
|
||||||
show_test_warning: bool = True) -> None:
|
show_test_warning: bool = True) -> None:
|
||||||
del show_test_warning # unused
|
del show_test_warning # unused
|
||||||
_ba.sign_in_v1(account_type)
|
ba.internal.sign_in_v1(account_type)
|
||||||
|
|
||||||
# Make note of the type account we're *wanting* to be signed in with.
|
# Make note of the type account we're *wanting* to be signed in with.
|
||||||
cfg = ba.app.config
|
cfg = ba.app.config
|
||||||
@ -1082,7 +1087,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
# FIXME: This would need to happen server-side these days.
|
# FIXME: This would need to happen server-side these days.
|
||||||
if self._can_reset_achievements:
|
if self._can_reset_achievements:
|
||||||
ba.app.config['Achievements'] = {}
|
ba.app.config['Achievements'] = {}
|
||||||
_ba.reset_achievements()
|
ba.internal.reset_achievements()
|
||||||
campaign = getcampaign('Default')
|
campaign = getcampaign('Default')
|
||||||
campaign.reset() # also writes the config..
|
campaign.reset() # also writes the config..
|
||||||
campaign = getcampaign('Challenges')
|
campaign = getcampaign('Challenges')
|
||||||
|
|||||||
@ -7,8 +7,8 @@ from __future__ import annotations
|
|||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -77,11 +77,11 @@ class AccountUnlinkWindow(ba.Window):
|
|||||||
margin=0,
|
margin=0,
|
||||||
left_border=10)
|
left_border=10)
|
||||||
|
|
||||||
our_login_id = _ba.get_public_login_id()
|
our_login_id = ba.internal.get_public_login_id()
|
||||||
if our_login_id is None:
|
if our_login_id is None:
|
||||||
entries = []
|
entries = []
|
||||||
else:
|
else:
|
||||||
account_infos = _ba.get_v1_account_misc_read_val_2(
|
account_infos = ba.internal.get_v1_account_misc_read_val_2(
|
||||||
'linkedAccounts2', [])
|
'linkedAccounts2', [])
|
||||||
entries = [{
|
entries = [{
|
||||||
'name': ai['d'],
|
'name': ai['d'],
|
||||||
@ -108,12 +108,12 @@ class AccountUnlinkWindow(ba.Window):
|
|||||||
ba.screenmessage(ba.Lstr(resource='pleaseWaitText',
|
ba.screenmessage(ba.Lstr(resource='pleaseWaitText',
|
||||||
fallback_resource='requestingText'),
|
fallback_resource='requestingText'),
|
||||||
color=(0, 1, 0))
|
color=(0, 1, 0))
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'ACCOUNT_UNLINK_REQUEST',
|
'type': 'ACCOUNT_UNLINK_REQUEST',
|
||||||
'accountID': entry['id'],
|
'accountID': entry['id'],
|
||||||
'expire_time': time.time() + 5
|
'expire_time': time.time() + 5
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import logging
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
import _ba
|
import _ba
|
||||||
|
|
||||||
from efro.error import CommunicationError
|
from efro.error import CommunicationError
|
||||||
@ -81,7 +82,8 @@ class V2SignInWindow(ba.Window):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Show link(s) the user can use to log in.
|
# Show link(s) the user can use to log in.
|
||||||
address = _ba.get_master_server_address(version=2) + response.url
|
address = ba.internal.get_master_server_address(
|
||||||
|
version=2) + response.url
|
||||||
address_pretty = address.removeprefix('https://')
|
address_pretty = address.removeprefix('https://')
|
||||||
|
|
||||||
ba.textwidget(
|
ba.textwidget(
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.ui import popup
|
from bastd.ui import popup
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -91,8 +92,9 @@ class AccountViewerWindow(popup.PopupWindow):
|
|||||||
|
|
||||||
# In cases where the user most likely has a browser/email, lets
|
# In cases where the user most likely has a browser/email, lets
|
||||||
# offer a 'report this user' button.
|
# offer a 'report this user' button.
|
||||||
if (is_browser_likely_available() and _ba.get_v1_account_misc_read_val(
|
if (is_browser_likely_available()
|
||||||
'showAccountExtrasMenu', False)):
|
and ba.internal.get_v1_account_misc_read_val(
|
||||||
|
'showAccountExtrasMenu', False)):
|
||||||
|
|
||||||
self._extras_menu_button = ba.buttonwidget(
|
self._extras_menu_button = ba.buttonwidget(
|
||||||
parent=self.root_widget,
|
parent=self.root_widget,
|
||||||
@ -154,11 +156,11 @@ class AccountViewerWindow(popup.PopupWindow):
|
|||||||
delegate=self)
|
delegate=self)
|
||||||
|
|
||||||
def _on_ban_press(self) -> None:
|
def _on_ban_press(self) -> None:
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'BAN_ACCOUNT',
|
'type': 'BAN_ACCOUNT',
|
||||||
'account': self._account_id
|
'account': self._account_id
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|
||||||
def _on_report_press(self) -> None:
|
def _on_report_press(self) -> None:
|
||||||
from bastd.ui import report
|
from bastd.ui import report
|
||||||
@ -166,8 +168,8 @@ class AccountViewerWindow(popup.PopupWindow):
|
|||||||
origin_widget=self._extras_menu_button)
|
origin_widget=self._extras_menu_button)
|
||||||
|
|
||||||
def _on_more_press(self) -> None:
|
def _on_more_press(self) -> None:
|
||||||
ba.open_url(_ba.get_master_server_address() + '/highscores?profile=' +
|
ba.open_url(ba.internal.get_master_server_address() +
|
||||||
self._account_id)
|
'/highscores?profile=' + self._account_id)
|
||||||
|
|
||||||
def _on_query_response(self, data: dict[str, Any] | None) -> None:
|
def _on_query_response(self, data: dict[str, Any] | None) -> None:
|
||||||
# FIXME: Tidy this up.
|
# FIXME: Tidy this up.
|
||||||
|
|||||||
@ -10,6 +10,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -62,11 +63,11 @@ class AppInviteWindow(ba.Window):
|
|||||||
'gatherWindow.earnTicketsForRecommendingText'),
|
'gatherWindow.earnTicketsForRecommendingText'),
|
||||||
subs=[('${COUNT}',
|
subs=[('${COUNT}',
|
||||||
str(
|
str(
|
||||||
_ba.get_v1_account_misc_read_val(
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
'friendTryTickets', 300))),
|
'friendTryTickets', 300))),
|
||||||
('${YOU_COUNT}',
|
('${YOU_COUNT}',
|
||||||
str(
|
str(
|
||||||
_ba.get_v1_account_misc_read_val(
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
'friendTryAwardTickets', 100)))]))
|
'friendTryAwardTickets', 100)))]))
|
||||||
|
|
||||||
or_text = ba.Lstr(resource='orText',
|
or_text = ba.Lstr(resource='orText',
|
||||||
@ -104,14 +105,14 @@ class AppInviteWindow(ba.Window):
|
|||||||
on_activate_call=ba.WeakCall(self._send_code))
|
on_activate_call=ba.WeakCall(self._send_code))
|
||||||
|
|
||||||
# kick off a transaction to get our code
|
# kick off a transaction to get our code
|
||||||
_ba.add_transaction(
|
ba.internal.add_transaction(
|
||||||
{
|
{
|
||||||
'type': 'FRIEND_PROMO_CODE_REQUEST',
|
'type': 'FRIEND_PROMO_CODE_REQUEST',
|
||||||
'ali': False,
|
'ali': False,
|
||||||
'expire_time': time.time() + 20
|
'expire_time': time.time() + 20
|
||||||
},
|
},
|
||||||
callback=ba.WeakCall(self._on_code_result))
|
callback=ba.WeakCall(self._on_code_result))
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|
||||||
def _on_code_result(self, result: dict[str, Any] | None) -> None:
|
def _on_code_result(self, result: dict[str, Any] | None) -> None:
|
||||||
if result is not None:
|
if result is not None:
|
||||||
@ -128,18 +129,18 @@ class AppInviteWindow(ba.Window):
|
|||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
return
|
return
|
||||||
|
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
ba.set_analytics_screen('App Invite UI')
|
ba.set_analytics_screen('App Invite UI')
|
||||||
_ba.show_app_invite(
|
_ba.show_app_invite(
|
||||||
ba.Lstr(resource='gatherWindow.appInviteTitleText',
|
ba.Lstr(resource='gatherWindow.appInviteTitleText',
|
||||||
subs=[('${APP_NAME}', ba.Lstr(resource='titleText'))
|
subs=[('${APP_NAME}', ba.Lstr(resource='titleText'))
|
||||||
]).evaluate(),
|
]).evaluate(),
|
||||||
ba.Lstr(resource='gatherWindow.appInviteMessageText',
|
ba.Lstr(resource='gatherWindow.appInviteMessageText',
|
||||||
subs=[
|
subs=[('${COUNT}', str(self._data['tickets'])),
|
||||||
('${COUNT}', str(self._data['tickets'])),
|
('${NAME}',
|
||||||
('${NAME}', _ba.get_v1_account_name().split()[0]),
|
ba.internal.get_v1_account_name().split()[0]),
|
||||||
('${APP_NAME}', ba.Lstr(resource='titleText'))
|
('${APP_NAME}', ba.Lstr(resource='titleText'))
|
||||||
]).evaluate(), self._data['code'])
|
]).evaluate(), self._data['code'])
|
||||||
else:
|
else:
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
|
|
||||||
@ -256,7 +257,8 @@ class ShowFriendCodeWindow(ba.Window):
|
|||||||
]).evaluate(),
|
]).evaluate(),
|
||||||
ba.Lstr(resource='gatherWindow.appInviteMessageText',
|
ba.Lstr(resource='gatherWindow.appInviteMessageText',
|
||||||
subs=[('${COUNT}', str(self._data['tickets'])),
|
subs=[('${COUNT}', str(self._data['tickets'])),
|
||||||
('${NAME}', _ba.get_v1_account_name().split()[0]),
|
('${NAME}',
|
||||||
|
ba.internal.get_v1_account_name().split()[0]),
|
||||||
('${APP_NAME}', ba.Lstr(resource='titleText'))
|
('${APP_NAME}', ba.Lstr(resource='titleText'))
|
||||||
]).evaluate(), self._data['code'])
|
]).evaluate(), self._data['code'])
|
||||||
|
|
||||||
@ -264,7 +266,7 @@ class ShowFriendCodeWindow(ba.Window):
|
|||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
# If somehow we got signed out.
|
# If somehow we got signed out.
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
ba.screenmessage(ba.Lstr(resource='notSignedInText'),
|
ba.screenmessage(ba.Lstr(resource='notSignedInText'),
|
||||||
color=(1, 0, 0))
|
color=(1, 0, 0))
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
@ -273,7 +275,7 @@ class ShowFriendCodeWindow(ba.Window):
|
|||||||
ba.set_analytics_screen('Email Friend Code')
|
ba.set_analytics_screen('Email Friend Code')
|
||||||
subject = (ba.Lstr(resource='gatherWindow.friendHasSentPromoCodeText').
|
subject = (ba.Lstr(resource='gatherWindow.friendHasSentPromoCodeText').
|
||||||
evaluate().replace(
|
evaluate().replace(
|
||||||
'${NAME}', _ba.get_v1_account_name()).replace(
|
'${NAME}', ba.internal.get_v1_account_name()).replace(
|
||||||
'${APP_NAME}',
|
'${APP_NAME}',
|
||||||
ba.Lstr(resource='titleText').evaluate()).replace(
|
ba.Lstr(resource='titleText').evaluate()).replace(
|
||||||
'${COUNT}', str(self._data['tickets'])))
|
'${COUNT}', str(self._data['tickets'])))
|
||||||
@ -304,7 +306,7 @@ def handle_app_invites_press(force_code: bool = False) -> None:
|
|||||||
"""(internal)"""
|
"""(internal)"""
|
||||||
app = ba.app
|
app = ba.app
|
||||||
do_app_invites = (app.platform == 'android' and app.subplatform == 'google'
|
do_app_invites = (app.platform == 'android' and app.subplatform == 'google'
|
||||||
and _ba.get_v1_account_misc_read_val(
|
and ba.internal.get_v1_account_misc_read_val(
|
||||||
'enableAppInvites', False) and not app.on_tv)
|
'enableAppInvites', False) and not app.on_tv)
|
||||||
if force_code:
|
if force_code:
|
||||||
do_app_invites = False
|
do_app_invites = False
|
||||||
@ -326,11 +328,11 @@ def handle_app_invites_press(force_code: bool = False) -> None:
|
|||||||
else:
|
else:
|
||||||
ShowFriendCodeWindow(result)
|
ShowFriendCodeWindow(result)
|
||||||
|
|
||||||
_ba.add_transaction(
|
ba.internal.add_transaction(
|
||||||
{
|
{
|
||||||
'type': 'FRIEND_PROMO_CODE_REQUEST',
|
'type': 'FRIEND_PROMO_CODE_REQUEST',
|
||||||
'ali': False,
|
'ali': False,
|
||||||
'expire_time': time.time() + 10
|
'expire_time': time.time() + 10
|
||||||
},
|
},
|
||||||
callback=handle_result)
|
callback=handle_result)
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|||||||
@ -7,8 +7,8 @@ from __future__ import annotations
|
|||||||
import math
|
import math
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.ui import popup
|
from bastd.ui import popup
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -156,7 +156,7 @@ class CharacterPicker(popup.PopupWindow):
|
|||||||
def _on_store_press(self) -> None:
|
def _on_store_press(self) -> None:
|
||||||
from bastd.ui.account import show_sign_in_prompt
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
from bastd.ui.store.browser import StoreBrowserWindow
|
from bastd.ui.store.browser import StoreBrowserWindow
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
self._transition_out()
|
self._transition_out()
|
||||||
|
|||||||
@ -9,6 +9,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
@ -149,9 +150,9 @@ class ContinuesWindow(ba.Window):
|
|||||||
self._on_cancel()
|
self._on_cancel()
|
||||||
return
|
return
|
||||||
|
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
sval = (ba.charstr(ba.SpecialChar.TICKET) +
|
sval = (ba.charstr(ba.SpecialChar.TICKET) +
|
||||||
str(_ba.get_v1_account_ticket_count()))
|
str(ba.internal.get_v1_account_ticket_count()))
|
||||||
else:
|
else:
|
||||||
sval = '?'
|
sval = '?'
|
||||||
if self._tickets_text is not None:
|
if self._tickets_text is not None:
|
||||||
@ -183,14 +184,14 @@ class ContinuesWindow(ba.Window):
|
|||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
else:
|
else:
|
||||||
# If somehow we got signed out...
|
# If somehow we got signed out...
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
ba.screenmessage(ba.Lstr(resource='notSignedInText'),
|
ba.screenmessage(ba.Lstr(resource='notSignedInText'),
|
||||||
color=(1, 0, 0))
|
color=(1, 0, 0))
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
return
|
return
|
||||||
|
|
||||||
# If it appears we don't have enough tickets, offer to buy more.
|
# If it appears we don't have enough tickets, offer to buy more.
|
||||||
tickets = _ba.get_v1_account_ticket_count()
|
tickets = ba.internal.get_v1_account_ticket_count()
|
||||||
if tickets < self._cost:
|
if tickets < self._cost:
|
||||||
# FIXME: Should we start the timer back up again after?
|
# FIXME: Should we start the timer back up again after?
|
||||||
self._counting_down = False
|
self._counting_down = False
|
||||||
|
|||||||
@ -10,6 +10,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.ui.store.button import StoreButton
|
from bastd.ui.store.button import StoreButton
|
||||||
from bastd.ui.league.rankbutton import LeagueRankButton
|
from bastd.ui.league.rankbutton import LeagueRankButton
|
||||||
from bastd.ui.store.browser import StoreBrowserWindow
|
from bastd.ui.store.browser import StoreBrowserWindow
|
||||||
@ -93,7 +94,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
|
|
||||||
self._tourney_data_up_to_date = False
|
self._tourney_data_up_to_date = False
|
||||||
|
|
||||||
self._campaign_difficulty = _ba.get_v1_account_misc_val(
|
self._campaign_difficulty = ba.internal.get_v1_account_misc_val(
|
||||||
'campaignDifficulty', 'easy')
|
'campaignDifficulty', 'easy')
|
||||||
|
|
||||||
super().__init__(root_widget=ba.containerwidget(
|
super().__init__(root_widget=ba.containerwidget(
|
||||||
@ -234,7 +235,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
self._subcontainer: ba.Widget | None = None
|
self._subcontainer: ba.Widget | None = None
|
||||||
|
|
||||||
# Take note of our account state; we'll refresh later if this changes.
|
# Take note of our account state; we'll refresh later if this changes.
|
||||||
self._account_state_num = _ba.get_v1_account_state_num()
|
self._account_state_num = ba.internal.get_v1_account_state_num()
|
||||||
|
|
||||||
# Same for fg/bg state.
|
# Same for fg/bg state.
|
||||||
self._fg_state = app.fg_state
|
self._fg_state = app.fg_state
|
||||||
@ -252,7 +253,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
# starting point.
|
# starting point.
|
||||||
if (app.accounts_v1.account_tournament_list is not None
|
if (app.accounts_v1.account_tournament_list is not None
|
||||||
and app.accounts_v1.account_tournament_list[0]
|
and app.accounts_v1.account_tournament_list[0]
|
||||||
== _ba.get_v1_account_state_num() and all(
|
== ba.internal.get_v1_account_state_num() and all(
|
||||||
t_id in app.accounts_v1.tournament_info
|
t_id in app.accounts_v1.tournament_info
|
||||||
for t_id in app.accounts_v1.account_tournament_list[1])):
|
for t_id in app.accounts_v1.account_tournament_list[1])):
|
||||||
tourney_data = [
|
tourney_data = [
|
||||||
@ -300,7 +301,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
self._tourney_data_up_to_date = False
|
self._tourney_data_up_to_date = False
|
||||||
|
|
||||||
# If our account state has changed, do a full request.
|
# If our account state has changed, do a full request.
|
||||||
account_state_num = _ba.get_v1_account_state_num()
|
account_state_num = ba.internal.get_v1_account_state_num()
|
||||||
if account_state_num != self._account_state_num:
|
if account_state_num != self._account_state_num:
|
||||||
self._account_state_num = account_state_num
|
self._account_state_num = account_state_num
|
||||||
self._save_state()
|
self._save_state()
|
||||||
@ -324,7 +325,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
self._fg_state = ba.app.fg_state
|
self._fg_state = ba.app.fg_state
|
||||||
self._last_tournament_query_time = cur_time
|
self._last_tournament_query_time = cur_time
|
||||||
self._doing_tournament_query = True
|
self._doing_tournament_query = True
|
||||||
_ba.tournament_query(
|
ba.internal.tournament_query(
|
||||||
args={
|
args={
|
||||||
'source': 'coop window refresh',
|
'source': 'coop window refresh',
|
||||||
'numScores': 1
|
'numScores': 1
|
||||||
@ -395,11 +396,9 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
accounts.cache_tournament_info(tournament_data)
|
accounts.cache_tournament_info(tournament_data)
|
||||||
|
|
||||||
# Also cache the current tourney list/order for this account.
|
# Also cache the current tourney list/order for this account.
|
||||||
accounts.account_tournament_list = (_ba.get_v1_account_state_num(),
|
accounts.account_tournament_list = (
|
||||||
[
|
ba.internal.get_v1_account_state_num(),
|
||||||
e['tournamentID']
|
[e['tournamentID'] for e in tournament_data])
|
||||||
for e in tournament_data
|
|
||||||
])
|
|
||||||
|
|
||||||
self._doing_tournament_query = False
|
self._doing_tournament_query = False
|
||||||
self._update_for_data(tournament_data)
|
self._update_for_data(tournament_data)
|
||||||
@ -417,7 +416,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
print('ERROR: invalid campaign difficulty:', difficulty)
|
print('ERROR: invalid campaign difficulty:', difficulty)
|
||||||
difficulty = 'easy'
|
difficulty = 'easy'
|
||||||
self._campaign_difficulty = difficulty
|
self._campaign_difficulty = difficulty
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'SET_MISC_VAL',
|
'type': 'SET_MISC_VAL',
|
||||||
'name': 'campaignDifficulty',
|
'name': 'campaignDifficulty',
|
||||||
'value': difficulty
|
'value': difficulty
|
||||||
@ -668,7 +667,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
# no tournaments).
|
# no tournaments).
|
||||||
if self._tournament_button_count == 0:
|
if self._tournament_button_count == 0:
|
||||||
unavailable_text = ba.Lstr(resource='unavailableText')
|
unavailable_text = ba.Lstr(resource='unavailableText')
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
unavailable_text = ba.Lstr(
|
unavailable_text = ba.Lstr(
|
||||||
value='${A} (${B})',
|
value='${A} (${B})',
|
||||||
subs=[('${A}', unavailable_text),
|
subs=[('${A}', unavailable_text),
|
||||||
@ -744,8 +743,9 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Show easter-egg-hunt either if its easter or we own it.
|
# Show easter-egg-hunt either if its easter or we own it.
|
||||||
if _ba.get_v1_account_misc_read_val(
|
if ba.internal.get_v1_account_misc_read_val(
|
||||||
'easter', False) or _ba.get_purchased('games.easter_egg_hunt'):
|
'easter',
|
||||||
|
False) or ba.internal.get_purchased('games.easter_egg_hunt'):
|
||||||
items = [
|
items = [
|
||||||
'Challenges:Easter Egg Hunt',
|
'Challenges:Easter Egg Hunt',
|
||||||
'Challenges:Pro Easter Egg Hunt',
|
'Challenges:Pro Easter Egg Hunt',
|
||||||
@ -838,7 +838,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.account import show_sign_in_prompt
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
from bastd.ui.league.rankwindow import LeagueRankWindow
|
from bastd.ui.league.rankwindow import LeagueRankWindow
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
self._save_state()
|
self._save_state()
|
||||||
@ -855,7 +855,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
) -> None:
|
) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.account import show_sign_in_prompt
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
self._save_state()
|
self._save_state()
|
||||||
@ -893,7 +893,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
if game in ('Challenges:Infinite Runaround',
|
if game in ('Challenges:Infinite Runaround',
|
||||||
'Challenges:Infinite Onslaught'
|
'Challenges:Infinite Onslaught'
|
||||||
) and not ba.app.accounts_v1.have_pro():
|
) and not ba.app.accounts_v1.have_pro():
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
else:
|
else:
|
||||||
PurchaseWindow(items=['pro'])
|
PurchaseWindow(items=['pro'])
|
||||||
@ -920,8 +920,8 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
required_purchase = None
|
required_purchase = None
|
||||||
|
|
||||||
if (required_purchase is not None
|
if (required_purchase is not None
|
||||||
and not _ba.get_purchased(required_purchase)):
|
and not ba.internal.get_purchased(required_purchase)):
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
else:
|
else:
|
||||||
PurchaseWindow(items=[required_purchase])
|
PurchaseWindow(items=[required_purchase])
|
||||||
@ -937,7 +937,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
from bastd.ui.account import show_sign_in_prompt
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
from bastd.ui.tournamententry import TournamentEntryWindow
|
from bastd.ui.tournamententry import TournamentEntryWindow
|
||||||
|
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ from __future__ import annotations
|
|||||||
import random
|
import random
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
import ba
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -200,17 +199,17 @@ class GameButton:
|
|||||||
'Challenges:Infinite Onslaught')
|
'Challenges:Infinite Onslaught')
|
||||||
and not ba.app.accounts_v1.have_pro())
|
and not ba.app.accounts_v1.have_pro())
|
||||||
or (game in ('Challenges:Meteor Shower', )
|
or (game in ('Challenges:Meteor Shower', )
|
||||||
and not _ba.get_purchased('games.meteor_shower'))
|
and not ba.internal.get_purchased('games.meteor_shower'))
|
||||||
or (game in ('Challenges:Target Practice',
|
or (game in ('Challenges:Target Practice',
|
||||||
'Challenges:Target Practice B')
|
'Challenges:Target Practice B')
|
||||||
and not _ba.get_purchased('games.target_practice'))
|
and not ba.internal.get_purchased('games.target_practice'))
|
||||||
or (game in ('Challenges:Ninja Fight', )
|
or (game in ('Challenges:Ninja Fight', )
|
||||||
and not _ba.get_purchased('games.ninja_fight'))
|
and not ba.internal.get_purchased('games.ninja_fight'))
|
||||||
or (game in ('Challenges:Pro Ninja Fight', )
|
or (game in ('Challenges:Pro Ninja Fight', )
|
||||||
and not _ba.get_purchased('games.ninja_fight'))
|
and not ba.internal.get_purchased('games.ninja_fight')) or
|
||||||
or (game in ('Challenges:Easter Egg Hunt',
|
(game in ('Challenges:Easter Egg Hunt',
|
||||||
'Challenges:Pro Easter Egg Hunt')
|
'Challenges:Pro Easter Egg Hunt')
|
||||||
and not _ba.get_purchased('games.easter_egg_hunt'))):
|
and not ba.internal.get_purchased('games.easter_egg_hunt'))):
|
||||||
unlocked = False
|
unlocked = False
|
||||||
|
|
||||||
# Let's tint levels a slightly different color when easy mode
|
# Let's tint levels a slightly different color when easy mode
|
||||||
|
|||||||
@ -499,7 +499,7 @@ class TournamentButton:
|
|||||||
self.allow_ads = allow_ads = entry['allowAds']
|
self.allow_ads = allow_ads = entry['allowAds']
|
||||||
|
|
||||||
final_fee: int | None = (None if fee_var is None else
|
final_fee: int | None = (None if fee_var is None else
|
||||||
_ba.get_v1_account_misc_read_val(
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
fee_var, '?'))
|
fee_var, '?'))
|
||||||
|
|
||||||
final_fee_str: str | ba.Lstr
|
final_fee_str: str | ba.Lstr
|
||||||
|
|||||||
@ -10,6 +10,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.ui.tabs import TabRow
|
from bastd.ui.tabs import TabRow
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -151,7 +152,8 @@ class GatherWindow(ba.Window):
|
|||||||
tabdefs: list[tuple[GatherWindow.TabID, ba.Lstr]] = [
|
tabdefs: list[tuple[GatherWindow.TabID, ba.Lstr]] = [
|
||||||
(self.TabID.ABOUT, ba.Lstr(resource=self._r + '.aboutText'))
|
(self.TabID.ABOUT, ba.Lstr(resource=self._r + '.aboutText'))
|
||||||
]
|
]
|
||||||
if _ba.get_v1_account_misc_read_val('enablePublicParties', True):
|
if ba.internal.get_v1_account_misc_read_val('enablePublicParties',
|
||||||
|
True):
|
||||||
tabdefs.append((self.TabID.INTERNET,
|
tabdefs.append((self.TabID.INTERNET,
|
||||||
ba.Lstr(resource=self._r + '.publicText')))
|
ba.Lstr(resource=self._r + '.publicText')))
|
||||||
tabdefs.append(
|
tabdefs.append(
|
||||||
|
|||||||
@ -7,7 +7,7 @@ from __future__ import annotations
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import ba
|
import ba
|
||||||
import _ba
|
import ba.internal
|
||||||
from bastd.ui.gather import GatherTab
|
from bastd.ui.gather import GatherTab
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -51,8 +51,8 @@ class AboutGatherTab(GatherTab):
|
|||||||
include_invite = True
|
include_invite = True
|
||||||
msc_scale = 1.1
|
msc_scale = 1.1
|
||||||
c_height_2 = min(region_height, string_height * msc_scale + 100)
|
c_height_2 = min(region_height, string_height * msc_scale + 100)
|
||||||
try_tickets = _ba.get_v1_account_misc_read_val('friendTryTickets',
|
try_tickets = ba.internal.get_v1_account_misc_read_val(
|
||||||
None)
|
'friendTryTickets', None)
|
||||||
if try_tickets is None:
|
if try_tickets is None:
|
||||||
include_invite = False
|
include_invite = False
|
||||||
self._container = ba.containerwidget(
|
self._container = ba.containerwidget(
|
||||||
@ -106,7 +106,7 @@ class AboutGatherTab(GatherTab):
|
|||||||
def _invite_to_try_press(self) -> None:
|
def _invite_to_try_press(self) -> None:
|
||||||
from bastd.ui.account import show_sign_in_prompt
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
from bastd.ui.appinvite import handle_app_invites_press
|
from bastd.ui.appinvite import handle_app_invites_press
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
handle_app_invites_press()
|
handle_app_invites_press()
|
||||||
|
|||||||
@ -12,6 +12,7 @@ from dataclasses import dataclass
|
|||||||
from typing import TYPE_CHECKING, cast
|
from typing import TYPE_CHECKING, cast
|
||||||
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
import _ba
|
import _ba
|
||||||
from efro.dataclassio import dataclass_from_dict, dataclass_to_dict
|
from efro.dataclassio import dataclass_from_dict, dataclass_to_dict
|
||||||
from bacommon.net import (PrivateHostingState, PrivateHostingConfig,
|
from bacommon.net import (PrivateHostingState, PrivateHostingConfig,
|
||||||
@ -227,7 +228,7 @@ class PrivateGatherTab(GatherTab):
|
|||||||
def _update_currency_ui(self) -> None:
|
def _update_currency_ui(self) -> None:
|
||||||
# Keep currency count up to date if applicable.
|
# Keep currency count up to date if applicable.
|
||||||
try:
|
try:
|
||||||
t_str = str(_ba.get_v1_account_ticket_count())
|
t_str = str(ba.internal.get_v1_account_ticket_count())
|
||||||
except Exception:
|
except Exception:
|
||||||
t_str = '?'
|
t_str = '?'
|
||||||
if self._get_tickets_button:
|
if self._get_tickets_button:
|
||||||
@ -247,7 +248,7 @@ class PrivateGatherTab(GatherTab):
|
|||||||
if self._state.sub_tab is SubTabType.HOST:
|
if self._state.sub_tab is SubTabType.HOST:
|
||||||
|
|
||||||
# If we're not signed in, just refresh to show that.
|
# If we're not signed in, just refresh to show that.
|
||||||
if (_ba.get_v1_account_state() != 'signed_in'
|
if (ba.internal.get_v1_account_state() != 'signed_in'
|
||||||
and self._showing_not_signed_in_screen):
|
and self._showing_not_signed_in_screen):
|
||||||
self._refresh_sub_tab()
|
self._refresh_sub_tab()
|
||||||
else:
|
else:
|
||||||
@ -256,8 +257,8 @@ class PrivateGatherTab(GatherTab):
|
|||||||
if (self._last_hosting_state_query_time is None
|
if (self._last_hosting_state_query_time is None
|
||||||
or now - self._last_hosting_state_query_time > 15.0):
|
or now - self._last_hosting_state_query_time > 15.0):
|
||||||
self._debug_server_comm('querying private party state')
|
self._debug_server_comm('querying private party state')
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
_ba.add_transaction(
|
ba.internal.add_transaction(
|
||||||
{
|
{
|
||||||
'type': 'PRIVATE_PARTY_QUERY',
|
'type': 'PRIVATE_PARTY_QUERY',
|
||||||
'expire_time': time.time() + 20,
|
'expire_time': time.time() + 20,
|
||||||
@ -265,7 +266,7 @@ class PrivateGatherTab(GatherTab):
|
|||||||
callback=ba.WeakCall(
|
callback=ba.WeakCall(
|
||||||
self._hosting_state_idle_response),
|
self._hosting_state_idle_response),
|
||||||
)
|
)
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
else:
|
else:
|
||||||
self._hosting_state_idle_response(None)
|
self._hosting_state_idle_response(None)
|
||||||
self._last_hosting_state_query_time = now
|
self._last_hosting_state_query_time = now
|
||||||
@ -438,7 +439,7 @@ class PrivateGatherTab(GatherTab):
|
|||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
# pylint: disable=too-many-statements
|
# pylint: disable=too-many-statements
|
||||||
|
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
ba.textwidget(parent=self._container,
|
ba.textwidget(parent=self._container,
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -762,7 +763,7 @@ class PrivateGatherTab(GatherTab):
|
|||||||
self._connect_press_time = now
|
self._connect_press_time = now
|
||||||
|
|
||||||
self._debug_server_comm('sending private party connect')
|
self._debug_server_comm('sending private party connect')
|
||||||
_ba.add_transaction(
|
ba.internal.add_transaction(
|
||||||
{
|
{
|
||||||
'type': 'PRIVATE_PARTY_CONNECT',
|
'type': 'PRIVATE_PARTY_CONNECT',
|
||||||
'expire_time': time.time() + 20,
|
'expire_time': time.time() + 20,
|
||||||
@ -770,14 +771,14 @@ class PrivateGatherTab(GatherTab):
|
|||||||
},
|
},
|
||||||
callback=ba.WeakCall(self._connect_response),
|
callback=ba.WeakCall(self._connect_response),
|
||||||
)
|
)
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|
||||||
def _start_stop_button_press(self) -> None:
|
def _start_stop_button_press(self) -> None:
|
||||||
if (self._waiting_for_start_stop_response
|
if (self._waiting_for_start_stop_response
|
||||||
or self._waiting_for_initial_state):
|
or self._waiting_for_initial_state):
|
||||||
return
|
return
|
||||||
|
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
ba.screenmessage(ba.Lstr(resource='notSignedInErrorText'))
|
ba.screenmessage(ba.Lstr(resource='notSignedInErrorText'))
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
self._refresh_sub_tab()
|
self._refresh_sub_tab()
|
||||||
@ -796,7 +797,7 @@ class PrivateGatherTab(GatherTab):
|
|||||||
if self._hostingstate.tickets_to_host_now > 0:
|
if self._hostingstate.tickets_to_host_now > 0:
|
||||||
ticket_count: int | None
|
ticket_count: int | None
|
||||||
try:
|
try:
|
||||||
ticket_count = _ba.get_v1_account_ticket_count()
|
ticket_count = ba.internal.get_v1_account_ticket_count()
|
||||||
except Exception:
|
except Exception:
|
||||||
# FIXME: should add a ba.NotSignedInError we can use here.
|
# FIXME: should add a ba.NotSignedInError we can use here.
|
||||||
ticket_count = None
|
ticket_count = None
|
||||||
@ -806,7 +807,7 @@ class PrivateGatherTab(GatherTab):
|
|||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
return
|
return
|
||||||
self._last_action_send_time = time.time()
|
self._last_action_send_time = time.time()
|
||||||
_ba.add_transaction(
|
ba.internal.add_transaction(
|
||||||
{
|
{
|
||||||
'type': 'PRIVATE_PARTY_START',
|
'type': 'PRIVATE_PARTY_START',
|
||||||
'config': dataclass_to_dict(self._hostingconfig),
|
'config': dataclass_to_dict(self._hostingconfig),
|
||||||
@ -814,17 +815,17 @@ class PrivateGatherTab(GatherTab):
|
|||||||
'expire_time': time.time() + 20,
|
'expire_time': time.time() + 20,
|
||||||
},
|
},
|
||||||
callback=ba.WeakCall(self._hosting_state_response))
|
callback=ba.WeakCall(self._hosting_state_response))
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self._last_action_send_time = time.time()
|
self._last_action_send_time = time.time()
|
||||||
_ba.add_transaction(
|
ba.internal.add_transaction(
|
||||||
{
|
{
|
||||||
'type': 'PRIVATE_PARTY_STOP',
|
'type': 'PRIVATE_PARTY_STOP',
|
||||||
'expire_time': time.time() + 20,
|
'expire_time': time.time() + 20,
|
||||||
},
|
},
|
||||||
callback=ba.WeakCall(self._hosting_state_response))
|
callback=ba.WeakCall(self._hosting_state_response))
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
ba.playsound(ba.getsound('click01'))
|
ba.playsound(ba.getsound('click01'))
|
||||||
|
|
||||||
self._waiting_for_start_stop_response = True
|
self._waiting_for_start_stop_response = True
|
||||||
|
|||||||
@ -14,6 +14,7 @@ from typing import TYPE_CHECKING, cast
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.ui.gather import GatherTab
|
from bastd.ui.gather import GatherTab
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -88,8 +89,8 @@ class UIRow:
|
|||||||
if party.clean_display_index == index:
|
if party.clean_display_index == index:
|
||||||
return
|
return
|
||||||
|
|
||||||
ping_good = _ba.get_v1_account_misc_read_val('pingGood', 100)
|
ping_good = ba.internal.get_v1_account_misc_read_val('pingGood', 100)
|
||||||
ping_med = _ba.get_v1_account_misc_read_val('pingMed', 500)
|
ping_med = ba.internal.get_v1_account_misc_read_val('pingMed', 500)
|
||||||
|
|
||||||
self._clear()
|
self._clear()
|
||||||
hpos = 20
|
hpos = 20
|
||||||
@ -122,8 +123,8 @@ class UIRow:
|
|||||||
if party.stats_addr:
|
if party.stats_addr:
|
||||||
url = party.stats_addr.replace(
|
url = party.stats_addr.replace(
|
||||||
'${ACCOUNT}',
|
'${ACCOUNT}',
|
||||||
_ba.get_v1_account_misc_read_val_2('resolvedAccountID',
|
ba.internal.get_v1_account_misc_read_val_2(
|
||||||
'UNKNOWN'))
|
'resolvedAccountID', 'UNKNOWN'))
|
||||||
self._stats_button = ba.buttonwidget(
|
self._stats_button = ba.buttonwidget(
|
||||||
color=(0.3, 0.6, 0.94),
|
color=(0.3, 0.6, 0.94),
|
||||||
textcolor=(1.0, 1.0, 1.0),
|
textcolor=(1.0, 1.0, 1.0),
|
||||||
@ -793,7 +794,7 @@ class PublicGatherTab(GatherTab):
|
|||||||
self._process_pending_party_infos()
|
self._process_pending_party_infos()
|
||||||
|
|
||||||
# Anytime we sign in/out, make sure we refresh our list.
|
# Anytime we sign in/out, make sure we refresh our list.
|
||||||
signed_in = _ba.get_v1_account_state() == 'signed_in'
|
signed_in = ba.internal.get_v1_account_state() == 'signed_in'
|
||||||
if self._signed_in != signed_in:
|
if self._signed_in != signed_in:
|
||||||
self._signed_in = signed_in
|
self._signed_in = signed_in
|
||||||
self._party_lists_dirty = True
|
self._party_lists_dirty = True
|
||||||
@ -986,7 +987,7 @@ class PublicGatherTab(GatherTab):
|
|||||||
p[1].index))
|
p[1].index))
|
||||||
|
|
||||||
# If signed out or errored, show no parties.
|
# If signed out or errored, show no parties.
|
||||||
if (_ba.get_v1_account_state() != 'signed_in'
|
if (ba.internal.get_v1_account_state() != 'signed_in'
|
||||||
or not self._have_valid_server_list):
|
or not self._have_valid_server_list):
|
||||||
self._parties_displayed = {}
|
self._parties_displayed = {}
|
||||||
else:
|
else:
|
||||||
@ -1022,20 +1023,21 @@ class PublicGatherTab(GatherTab):
|
|||||||
|
|
||||||
# Fire off a new public-party query periodically.
|
# Fire off a new public-party query periodically.
|
||||||
if (self._last_server_list_query_time is None
|
if (self._last_server_list_query_time is None
|
||||||
or now - self._last_server_list_query_time > 0.001 *
|
or now - self._last_server_list_query_time >
|
||||||
_ba.get_v1_account_misc_read_val('pubPartyRefreshMS', 10000)):
|
0.001 * ba.internal.get_v1_account_misc_read_val(
|
||||||
|
'pubPartyRefreshMS', 10000)):
|
||||||
self._last_server_list_query_time = now
|
self._last_server_list_query_time = now
|
||||||
if DEBUG_SERVER_COMMUNICATION:
|
if DEBUG_SERVER_COMMUNICATION:
|
||||||
print('REQUESTING SERVER LIST')
|
print('REQUESTING SERVER LIST')
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
_ba.add_transaction(
|
ba.internal.add_transaction(
|
||||||
{
|
{
|
||||||
'type': 'PUBLIC_PARTY_QUERY',
|
'type': 'PUBLIC_PARTY_QUERY',
|
||||||
'proto': ba.app.protocol_version,
|
'proto': ba.app.protocol_version,
|
||||||
'lang': ba.app.lang.language
|
'lang': ba.app.lang.language
|
||||||
},
|
},
|
||||||
callback=ba.WeakCall(self._on_public_party_query_result))
|
callback=ba.WeakCall(self._on_public_party_query_result))
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
else:
|
else:
|
||||||
self._on_public_party_query_result(None)
|
self._on_public_party_query_result(None)
|
||||||
|
|
||||||
@ -1156,7 +1158,7 @@ class PublicGatherTab(GatherTab):
|
|||||||
|
|
||||||
def _on_start_advertizing_press(self) -> None:
|
def _on_start_advertizing_press(self) -> None:
|
||||||
from bastd.ui.account import show_sign_in_prompt
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -176,38 +177,34 @@ class GetCurrencyWindow(ba.Window):
|
|||||||
|
|
||||||
rsrc = self._r + '.ticketsText'
|
rsrc = self._r + '.ticketsText'
|
||||||
|
|
||||||
c2txt = ba.Lstr(
|
c2txt = ba.Lstr(resource=rsrc,
|
||||||
resource=rsrc,
|
subs=[('${COUNT}',
|
||||||
subs=[('${COUNT}',
|
str(
|
||||||
str(_ba.get_v1_account_misc_read_val('tickets2Amount',
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
500)))])
|
'tickets2Amount', 500)))])
|
||||||
c3txt = ba.Lstr(
|
c3txt = ba.Lstr(resource=rsrc,
|
||||||
resource=rsrc,
|
subs=[('${COUNT}',
|
||||||
subs=[
|
str(
|
||||||
('${COUNT}',
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
str(_ba.get_v1_account_misc_read_val('tickets3Amount', 1500)))
|
'tickets3Amount', 1500)))])
|
||||||
])
|
c4txt = ba.Lstr(resource=rsrc,
|
||||||
c4txt = ba.Lstr(
|
subs=[('${COUNT}',
|
||||||
resource=rsrc,
|
str(
|
||||||
subs=[
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
('${COUNT}',
|
'tickets4Amount', 5000)))])
|
||||||
str(_ba.get_v1_account_misc_read_val('tickets4Amount', 5000)))
|
c5txt = ba.Lstr(resource=rsrc,
|
||||||
])
|
subs=[('${COUNT}',
|
||||||
c5txt = ba.Lstr(
|
str(
|
||||||
resource=rsrc,
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
subs=[
|
'tickets5Amount', 15000)))])
|
||||||
('${COUNT}',
|
|
||||||
str(_ba.get_v1_account_misc_read_val('tickets5Amount',
|
|
||||||
15000)))
|
|
||||||
])
|
|
||||||
|
|
||||||
h = 110.0
|
h = 110.0
|
||||||
|
|
||||||
# enable buttons if we have prices..
|
# enable buttons if we have prices..
|
||||||
tickets2_price = _ba.get_price('tickets2')
|
tickets2_price = ba.internal.get_price('tickets2')
|
||||||
tickets3_price = _ba.get_price('tickets3')
|
tickets3_price = ba.internal.get_price('tickets3')
|
||||||
tickets4_price = _ba.get_price('tickets4')
|
tickets4_price = ba.internal.get_price('tickets4')
|
||||||
tickets5_price = _ba.get_price('tickets5')
|
tickets5_price = ba.internal.get_price('tickets5')
|
||||||
|
|
||||||
# TEMP
|
# TEMP
|
||||||
# tickets1_price = '$0.99'
|
# tickets1_price = '$0.99'
|
||||||
@ -263,11 +260,12 @@ class GetCurrencyWindow(ba.Window):
|
|||||||
'ad',
|
'ad',
|
||||||
position=(h + h_offs, v),
|
position=(h + h_offs, v),
|
||||||
size=b_size_3,
|
size=b_size_3,
|
||||||
label=ba.Lstr(resource=self._r + '.ticketsFromASponsorText',
|
label=ba.Lstr(
|
||||||
subs=[('${COUNT}',
|
resource=self._r + '.ticketsFromASponsorText',
|
||||||
str(
|
subs=[('${COUNT}',
|
||||||
_ba.get_v1_account_misc_read_val(
|
str(
|
||||||
'sponsorTickets', 5)))]),
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
|
'sponsorTickets', 5)))]),
|
||||||
tex_name='ticketsMore',
|
tex_name='ticketsMore',
|
||||||
enabled=self._enable_ad_button,
|
enabled=self._enable_ad_button,
|
||||||
tex_opacity=0.6,
|
tex_opacity=0.6,
|
||||||
@ -308,7 +306,7 @@ class GetCurrencyWindow(ba.Window):
|
|||||||
resource='gatherWindow.earnTicketsForRecommendingText',
|
resource='gatherWindow.earnTicketsForRecommendingText',
|
||||||
subs=[('${COUNT}',
|
subs=[('${COUNT}',
|
||||||
str(
|
str(
|
||||||
_ba.get_v1_account_misc_read_val(
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
'sponsorTickets', 5)))]),
|
'sponsorTickets', 5)))]),
|
||||||
tex_name='ticketsMore',
|
tex_name='ticketsMore',
|
||||||
enabled=True,
|
enabled=True,
|
||||||
@ -431,16 +429,16 @@ class GetCurrencyWindow(ba.Window):
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
# if we somehow get signed out, just die..
|
# if we somehow get signed out, just die..
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
self._back()
|
self._back()
|
||||||
return
|
return
|
||||||
|
|
||||||
self._ticket_count = _ba.get_v1_account_ticket_count()
|
self._ticket_count = ba.internal.get_v1_account_ticket_count()
|
||||||
|
|
||||||
# update our incentivized ad button depending on whether ads are
|
# update our incentivized ad button depending on whether ads are
|
||||||
# available
|
# available
|
||||||
if self._ad_button is not None:
|
if self._ad_button is not None:
|
||||||
next_reward_ad_time = _ba.get_v1_account_misc_read_val_2(
|
next_reward_ad_time = ba.internal.get_v1_account_misc_read_val_2(
|
||||||
'nextRewardAdTime', None)
|
'nextRewardAdTime', None)
|
||||||
if next_reward_ad_time is not None:
|
if next_reward_ad_time is not None:
|
||||||
next_reward_ad_time = datetime.datetime.utcfromtimestamp(
|
next_reward_ad_time = datetime.datetime.utcfromtimestamp(
|
||||||
@ -499,8 +497,8 @@ class GetCurrencyWindow(ba.Window):
|
|||||||
if ((app.test_build or
|
if ((app.test_build or
|
||||||
(app.platform == 'android'
|
(app.platform == 'android'
|
||||||
and app.subplatform in ['oculus', 'cardboard']))
|
and app.subplatform in ['oculus', 'cardboard']))
|
||||||
and _ba.get_v1_account_misc_read_val('allowAccountLinking2',
|
and ba.internal.get_v1_account_misc_read_val(
|
||||||
False)):
|
'allowAccountLinking2', False)):
|
||||||
ba.screenmessage(ba.Lstr(resource=self._r +
|
ba.screenmessage(ba.Lstr(resource=self._r +
|
||||||
'.unavailableLinkAccountText'),
|
'.unavailableLinkAccountText'),
|
||||||
color=(1, 0.5, 0))
|
color=(1, 0.5, 0))
|
||||||
@ -514,7 +512,7 @@ class GetCurrencyWindow(ba.Window):
|
|||||||
from bastd.ui import appinvite
|
from bastd.ui import appinvite
|
||||||
from ba.internal import master_server_get
|
from ba.internal import master_server_get
|
||||||
if item == 'app_invite':
|
if item == 'app_invite':
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
account.show_sign_in_prompt()
|
account.show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
appinvite.handle_app_invites_press()
|
appinvite.handle_app_invites_press()
|
||||||
@ -559,7 +557,7 @@ class GetCurrencyWindow(ba.Window):
|
|||||||
if item == 'ad':
|
if item == 'ad':
|
||||||
import datetime
|
import datetime
|
||||||
# if ads are disabled until some time, error..
|
# if ads are disabled until some time, error..
|
||||||
next_reward_ad_time = _ba.get_v1_account_misc_read_val_2(
|
next_reward_ad_time = ba.internal.get_v1_account_misc_read_val_2(
|
||||||
'nextRewardAdTime', None)
|
'nextRewardAdTime', None)
|
||||||
if next_reward_ad_time is not None:
|
if next_reward_ad_time is not None:
|
||||||
next_reward_ad_time = datetime.datetime.utcfromtimestamp(
|
next_reward_ad_time = datetime.datetime.utcfromtimestamp(
|
||||||
@ -574,7 +572,7 @@ class GetCurrencyWindow(ba.Window):
|
|||||||
elif self._enable_ad_button:
|
elif self._enable_ad_button:
|
||||||
_ba.app.ads.show_ad('tickets')
|
_ba.app.ads.show_ad('tickets')
|
||||||
else:
|
else:
|
||||||
_ba.purchase(item)
|
ba.internal.purchase(item)
|
||||||
|
|
||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
from bastd.ui.store import browser
|
from bastd.ui.store import browser
|
||||||
|
|||||||
@ -7,8 +7,8 @@ from __future__ import annotations
|
|||||||
import math
|
import math
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.ui import popup
|
from bastd.ui import popup
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -137,7 +137,7 @@ class IconPicker(popup.PopupWindow):
|
|||||||
def _on_store_press(self) -> None:
|
def _on_store_press(self) -> None:
|
||||||
from bastd.ui.account import show_sign_in_prompt
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
from bastd.ui.store.browser import StoreBrowserWindow
|
from bastd.ui.store.browser import StoreBrowserWindow
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
self._transition_out()
|
self._transition_out()
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
pass
|
pass
|
||||||
@ -360,7 +361,7 @@ class KioskWindow(ba.Window):
|
|||||||
def _update(self) -> None:
|
def _update(self) -> None:
|
||||||
# Kiosk-mode is designed to be used signed-out... try for force
|
# Kiosk-mode is designed to be used signed-out... try for force
|
||||||
# the issue.
|
# the issue.
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
# _bs.sign_out()
|
# _bs.sign_out()
|
||||||
# FIXME: Try to delete player profiles here too.
|
# FIXME: Try to delete player profiles here too.
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
@ -94,7 +95,7 @@ class LeagueRankButton:
|
|||||||
self._smooth_update_timer: ba.Timer | None = None
|
self._smooth_update_timer: ba.Timer | None = None
|
||||||
|
|
||||||
# Take note of our account state; we'll refresh later if this changes.
|
# Take note of our account state; we'll refresh later if this changes.
|
||||||
self._account_state_num = _ba.get_v1_account_state_num()
|
self._account_state_num = ba.internal.get_v1_account_state_num()
|
||||||
self._last_power_ranking_query_time: float | None = None
|
self._last_power_ranking_query_time: float | None = None
|
||||||
self._doing_power_ranking_query = False
|
self._doing_power_ranking_query = False
|
||||||
self.set_position(position)
|
self.set_position(position)
|
||||||
@ -224,7 +225,7 @@ class LeagueRankButton:
|
|||||||
|
|
||||||
in_top = data is not None and data['rank'] is not None
|
in_top = data is not None and data['rank'] is not None
|
||||||
do_percent = False
|
do_percent = False
|
||||||
if data is None or _ba.get_v1_account_state() != 'signed_in':
|
if data is None or ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
self._percent = self._rank = None
|
self._percent = self._rank = None
|
||||||
status_text = '-'
|
status_text = '-'
|
||||||
elif in_top:
|
elif in_top:
|
||||||
@ -335,7 +336,7 @@ class LeagueRankButton:
|
|||||||
cur_time = ba.time(ba.TimeType.REAL)
|
cur_time = ba.time(ba.TimeType.REAL)
|
||||||
|
|
||||||
# If our account state has changed, refresh our UI.
|
# If our account state has changed, refresh our UI.
|
||||||
account_state_num = _ba.get_v1_account_state_num()
|
account_state_num = ba.internal.get_v1_account_state_num()
|
||||||
if account_state_num != self._account_state_num:
|
if account_state_num != self._account_state_num:
|
||||||
self._account_state_num = account_state_num
|
self._account_state_num = account_state_num
|
||||||
|
|
||||||
@ -350,7 +351,7 @@ class LeagueRankButton:
|
|||||||
or cur_time - self._last_power_ranking_query_time > 30.0):
|
or cur_time - self._last_power_ranking_query_time > 30.0):
|
||||||
self._last_power_ranking_query_time = cur_time
|
self._last_power_ranking_query_time = cur_time
|
||||||
self._doing_power_ranking_query = True
|
self._doing_power_ranking_query = True
|
||||||
_ba.power_ranking_query(
|
ba.internal.power_ranking_query(
|
||||||
callback=ba.WeakCall(self._on_power_ranking_query_response))
|
callback=ba.WeakCall(self._on_power_ranking_query_response))
|
||||||
|
|
||||||
def _default_on_activate_call(self) -> None:
|
def _default_on_activate_call(self) -> None:
|
||||||
|
|||||||
@ -9,6 +9,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.ui import popup as popup_ui
|
from bastd.ui import popup as popup_ui
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -118,7 +119,7 @@ class LeagueRankWindow(ba.Window):
|
|||||||
self._season: str | None = None
|
self._season: str | None = None
|
||||||
|
|
||||||
# take note of our account state; we'll refresh later if this changes
|
# take note of our account state; we'll refresh later if this changes
|
||||||
self._account_state = _ba.get_v1_account_state()
|
self._account_state = ba.internal.get_v1_account_state()
|
||||||
|
|
||||||
self._refresh()
|
self._refresh()
|
||||||
self._restore_state()
|
self._restore_state()
|
||||||
@ -155,8 +156,9 @@ class LeagueRankWindow(ba.Window):
|
|||||||
resource='coopSelectWindow.activenessAllTimeInfoText'
|
resource='coopSelectWindow.activenessAllTimeInfoText'
|
||||||
if self._season == 'a' else 'coopSelectWindow.activenessInfoText',
|
if self._season == 'a' else 'coopSelectWindow.activenessInfoText',
|
||||||
subs=[('${MAX}',
|
subs=[('${MAX}',
|
||||||
str(_ba.get_v1_account_misc_read_val('activenessMax',
|
str(
|
||||||
1.0)))])
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
|
'activenessMax', 1.0)))])
|
||||||
confirm.ConfirmWindow(txt,
|
confirm.ConfirmWindow(txt,
|
||||||
cancel_button=False,
|
cancel_button=False,
|
||||||
width=460,
|
width=460,
|
||||||
@ -168,7 +170,7 @@ class LeagueRankWindow(ba.Window):
|
|||||||
txt = ba.Lstr(resource='coopSelectWindow.proMultInfoText',
|
txt = ba.Lstr(resource='coopSelectWindow.proMultInfoText',
|
||||||
subs=[('${PERCENT}',
|
subs=[('${PERCENT}',
|
||||||
str(
|
str(
|
||||||
_ba.get_v1_account_misc_read_val(
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
'proPowerRankingBoost', 10))),
|
'proPowerRankingBoost', 10))),
|
||||||
('${PRO}',
|
('${PRO}',
|
||||||
ba.Lstr(resource='store.bombSquadProNameText',
|
ba.Lstr(resource='store.bombSquadProNameText',
|
||||||
@ -208,7 +210,7 @@ class LeagueRankWindow(ba.Window):
|
|||||||
cur_time = ba.time(ba.TimeType.REAL)
|
cur_time = ba.time(ba.TimeType.REAL)
|
||||||
|
|
||||||
# if our account state has changed, refresh our UI
|
# if our account state has changed, refresh our UI
|
||||||
account_state = _ba.get_v1_account_state()
|
account_state = ba.internal.get_v1_account_state()
|
||||||
if account_state != self._account_state:
|
if account_state != self._account_state:
|
||||||
self._account_state = account_state
|
self._account_state = account_state
|
||||||
self._save_state()
|
self._save_state()
|
||||||
@ -242,9 +244,9 @@ class LeagueRankWindow(ba.Window):
|
|||||||
|
|
||||||
self._last_power_ranking_query_time = cur_time
|
self._last_power_ranking_query_time = cur_time
|
||||||
self._doing_power_ranking_query = True
|
self._doing_power_ranking_query = True
|
||||||
_ba.power_ranking_query(season=self._requested_season,
|
ba.internal.power_ranking_query(
|
||||||
callback=ba.WeakCall(
|
season=self._requested_season,
|
||||||
self._on_power_ranking_query_response))
|
callback=ba.WeakCall(self._on_power_ranking_query_response))
|
||||||
|
|
||||||
def _refresh(self) -> None:
|
def _refresh(self) -> None:
|
||||||
# pylint: disable=too-many-statements
|
# pylint: disable=too-many-statements
|
||||||
@ -352,7 +354,7 @@ class LeagueRankWindow(ba.Window):
|
|||||||
maxwidth=200)
|
maxwidth=200)
|
||||||
|
|
||||||
self._activity_mult_button: ba.Widget | None
|
self._activity_mult_button: ba.Widget | None
|
||||||
if _ba.get_v1_account_misc_read_val('act', False):
|
if ba.internal.get_v1_account_misc_read_val('act', False):
|
||||||
self._activity_mult_button = ba.buttonwidget(
|
self._activity_mult_button = ba.buttonwidget(
|
||||||
parent=w_parent,
|
parent=w_parent,
|
||||||
position=(h2 - 60, v2 + 10),
|
position=(h2 - 60, v2 + 10),
|
||||||
@ -564,7 +566,7 @@ class LeagueRankWindow(ba.Window):
|
|||||||
self._on_more_press))
|
self._on_more_press))
|
||||||
|
|
||||||
def _on_more_press(self) -> None:
|
def _on_more_press(self) -> None:
|
||||||
our_login_id = _ba.get_public_login_id()
|
our_login_id = ba.internal.get_public_login_id()
|
||||||
# our_login_id = _bs.get_account_misc_read_val_2(
|
# our_login_id = _bs.get_account_misc_read_val_2(
|
||||||
# 'resolvedAccountID', None)
|
# 'resolvedAccountID', None)
|
||||||
if not self._can_do_more_button or our_login_id is None:
|
if not self._can_do_more_button or our_login_id is None:
|
||||||
@ -582,7 +584,7 @@ class LeagueRankWindow(ba.Window):
|
|||||||
league_str = '&league=' + self._league_url_arg
|
league_str = '&league=' + self._league_url_arg
|
||||||
else:
|
else:
|
||||||
league_str = ''
|
league_str = ''
|
||||||
ba.open_url(_ba.get_master_server_address() +
|
ba.open_url(ba.internal.get_master_server_address() +
|
||||||
'/highscores?list=powerRankings&v=2' + league_str +
|
'/highscores?list=powerRankings&v=2' + league_str +
|
||||||
season_str + '&player=' + our_login_id)
|
season_str + '&player=' + our_login_id)
|
||||||
|
|
||||||
@ -602,7 +604,7 @@ class LeagueRankWindow(ba.Window):
|
|||||||
finished_season_unranked = False
|
finished_season_unranked = False
|
||||||
self._can_do_more_button = True
|
self._can_do_more_button = True
|
||||||
extra_text = ''
|
extra_text = ''
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
status_text = '(' + ba.Lstr(
|
status_text = '(' + ba.Lstr(
|
||||||
resource='notSignedInText').evaluate() + ')'
|
resource='notSignedInText').evaluate() + ')'
|
||||||
elif in_top:
|
elif in_top:
|
||||||
@ -789,8 +791,8 @@ class LeagueRankWindow(ba.Window):
|
|||||||
|
|
||||||
have_pro = False if data is None else data['p']
|
have_pro = False if data is None else data['p']
|
||||||
pro_mult = 1.0 + float(
|
pro_mult = 1.0 + float(
|
||||||
_ba.get_v1_account_misc_read_val('proPowerRankingBoost',
|
ba.internal.get_v1_account_misc_read_val('proPowerRankingBoost',
|
||||||
0.0)) * 0.01
|
0.0)) * 0.01
|
||||||
# pylint: disable=consider-using-f-string
|
# pylint: disable=consider-using-f-string
|
||||||
ba.textwidget(edit=self._pro_mult_text,
|
ba.textwidget(edit=self._pro_mult_text,
|
||||||
text=' -' if
|
text=' -' if
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from __future__ import annotations
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
import _ba
|
import _ba
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -67,9 +68,9 @@ class MainMenuWindow(ba.Window):
|
|||||||
self._restore_state()
|
self._restore_state()
|
||||||
|
|
||||||
# Keep an eye on a few things and refresh if they change.
|
# Keep an eye on a few things and refresh if they change.
|
||||||
self._account_state = _ba.get_v1_account_state()
|
self._account_state = ba.internal.get_v1_account_state()
|
||||||
self._account_state_num = _ba.get_v1_account_state_num()
|
self._account_state_num = ba.internal.get_v1_account_state_num()
|
||||||
self._account_type = (_ba.get_v1_account_type()
|
self._account_type = (ba.internal.get_v1_account_type()
|
||||||
if self._account_state == 'signed_in' else None)
|
if self._account_state == 'signed_in' else None)
|
||||||
self._refresh_timer = ba.Timer(1.0,
|
self._refresh_timer = ba.Timer(1.0,
|
||||||
ba.WeakCall(self._check_refresh),
|
ba.WeakCall(self._check_refresh),
|
||||||
@ -122,10 +123,11 @@ class MainMenuWindow(ba.Window):
|
|||||||
ba.print_exception('Error showing get-remote-app info')
|
ba.print_exception('Error showing get-remote-app info')
|
||||||
|
|
||||||
def _get_store_char_tex(self) -> str:
|
def _get_store_char_tex(self) -> str:
|
||||||
return ('storeCharacterXmas' if _ba.get_v1_account_misc_read_val(
|
return (
|
||||||
'xmas', False) else
|
'storeCharacterXmas' if ba.internal.get_v1_account_misc_read_val(
|
||||||
'storeCharacterEaster' if _ba.get_v1_account_misc_read_val(
|
'xmas', False) else
|
||||||
'easter', False) else 'storeCharacter')
|
'storeCharacterEaster' if ba.internal.get_v1_account_misc_read_val(
|
||||||
|
'easter', False) else 'storeCharacter')
|
||||||
|
|
||||||
def _check_refresh(self) -> None:
|
def _check_refresh(self) -> None:
|
||||||
if not self._root_widget:
|
if not self._root_widget:
|
||||||
@ -138,13 +140,14 @@ class MainMenuWindow(ba.Window):
|
|||||||
return
|
return
|
||||||
|
|
||||||
store_char_tex = self._get_store_char_tex()
|
store_char_tex = self._get_store_char_tex()
|
||||||
account_state_num = _ba.get_v1_account_state_num()
|
account_state_num = ba.internal.get_v1_account_state_num()
|
||||||
if (account_state_num != self._account_state_num
|
if (account_state_num != self._account_state_num
|
||||||
or store_char_tex != self._store_char_tex):
|
or store_char_tex != self._store_char_tex):
|
||||||
self._store_char_tex = store_char_tex
|
self._store_char_tex = store_char_tex
|
||||||
self._account_state_num = account_state_num
|
self._account_state_num = account_state_num
|
||||||
account_state = self._account_state = (_ba.get_v1_account_state())
|
account_state = self._account_state = (
|
||||||
self._account_type = (_ba.get_v1_account_type()
|
ba.internal.get_v1_account_state())
|
||||||
|
self._account_type = (ba.internal.get_v1_account_type()
|
||||||
if account_state == 'signed_in' else None)
|
if account_state == 'signed_in' else None)
|
||||||
self._save_state()
|
self._save_state()
|
||||||
self._refresh()
|
self._refresh()
|
||||||
@ -213,8 +216,8 @@ class MainMenuWindow(ba.Window):
|
|||||||
on_activate_call=self._settings)
|
on_activate_call=self._settings)
|
||||||
|
|
||||||
# Scattered eggs on easter.
|
# Scattered eggs on easter.
|
||||||
if _ba.get_v1_account_misc_read_val('easter',
|
if ba.internal.get_v1_account_misc_read_val(
|
||||||
False) and not self._in_game:
|
'easter', False) and not self._in_game:
|
||||||
icon_size = 34
|
icon_size = 34
|
||||||
ba.imagewidget(parent=self._root_widget,
|
ba.imagewidget(parent=self._root_widget,
|
||||||
position=(h - icon_size * 0.5 - 15,
|
position=(h - icon_size * 0.5 - 15,
|
||||||
@ -310,7 +313,7 @@ class MainMenuWindow(ba.Window):
|
|||||||
transition_delay=self._tdelay)
|
transition_delay=self._tdelay)
|
||||||
|
|
||||||
# Scattered eggs on easter.
|
# Scattered eggs on easter.
|
||||||
if _ba.get_v1_account_misc_read_val('easter', False):
|
if ba.internal.get_v1_account_misc_read_val('easter', False):
|
||||||
icon_size = 30
|
icon_size = 30
|
||||||
ba.imagewidget(parent=self._root_widget,
|
ba.imagewidget(parent=self._root_widget,
|
||||||
position=(h - icon_size * 0.5 + 25,
|
position=(h - icon_size * 0.5 + 25,
|
||||||
@ -427,8 +430,8 @@ class MainMenuWindow(ba.Window):
|
|||||||
self._height = 200.0
|
self._height = 200.0
|
||||||
enable_account_button = True
|
enable_account_button = True
|
||||||
account_type_name: str | ba.Lstr
|
account_type_name: str | ba.Lstr
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
account_type_name = _ba.get_v1_account_display_string()
|
account_type_name = ba.internal.get_v1_account_display_string()
|
||||||
account_type_icon = None
|
account_type_icon = None
|
||||||
account_textcolor = (1.0, 1.0, 1.0)
|
account_textcolor = (1.0, 1.0, 1.0)
|
||||||
else:
|
else:
|
||||||
@ -618,8 +621,8 @@ class MainMenuWindow(ba.Window):
|
|||||||
enable_sound=account_type_enable_button_sound)
|
enable_sound=account_type_enable_button_sound)
|
||||||
|
|
||||||
# Scattered eggs on easter.
|
# Scattered eggs on easter.
|
||||||
if _ba.get_v1_account_misc_read_val('easter',
|
if ba.internal.get_v1_account_misc_read_val(
|
||||||
False) and not self._in_game:
|
'easter', False) and not self._in_game:
|
||||||
icon_size = 32
|
icon_size = 32
|
||||||
ba.imagewidget(parent=self._root_widget,
|
ba.imagewidget(parent=self._root_widget,
|
||||||
position=(h - icon_size * 0.5 + 35,
|
position=(h - icon_size * 0.5 + 35,
|
||||||
@ -648,8 +651,8 @@ class MainMenuWindow(ba.Window):
|
|||||||
self._how_to_play_button = btn
|
self._how_to_play_button = btn
|
||||||
|
|
||||||
# Scattered eggs on easter.
|
# Scattered eggs on easter.
|
||||||
if _ba.get_v1_account_misc_read_val('easter',
|
if ba.internal.get_v1_account_misc_read_val(
|
||||||
False) and not self._in_game:
|
'easter', False) and not self._in_game:
|
||||||
icon_size = 28
|
icon_size = 28
|
||||||
ba.imagewidget(parent=self._root_widget,
|
ba.imagewidget(parent=self._root_widget,
|
||||||
position=(h - icon_size * 0.5 + 30,
|
position=(h - icon_size * 0.5 + 30,
|
||||||
@ -851,7 +854,7 @@ class MainMenuWindow(ba.Window):
|
|||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.store.browser import StoreBrowserWindow
|
from bastd.ui.store.browser import StoreBrowserWindow
|
||||||
from bastd.ui.account import show_sign_in_prompt
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
self._save_state()
|
self._save_state()
|
||||||
|
|||||||
@ -10,6 +10,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any, Sequence
|
from typing import Any, Sequence
|
||||||
@ -257,11 +258,11 @@ class PartyQueueWindow(ba.Window):
|
|||||||
def __del__(self) -> None:
|
def __del__(self) -> None:
|
||||||
try:
|
try:
|
||||||
ba.app.ui.have_party_queue_window = False
|
ba.app.ui.have_party_queue_window = False
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'PARTY_QUEUE_REMOVE',
|
'type': 'PARTY_QUEUE_REMOVE',
|
||||||
'q': self._queue_id
|
'q': self._queue_id
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
except Exception:
|
except Exception:
|
||||||
ba.print_exception('Error removing self from party queue.')
|
ba.print_exception('Error removing self from party queue.')
|
||||||
|
|
||||||
@ -320,8 +321,9 @@ class PartyQueueWindow(ba.Window):
|
|||||||
if -1 not in self._dudes_by_id:
|
if -1 not in self._dudes_by_id:
|
||||||
dude = self.Dude(
|
dude = self.Dude(
|
||||||
self, response['d'], self._initial_offset, True,
|
self, response['d'], self._initial_offset, True,
|
||||||
_ba.get_v1_account_misc_read_val_2('resolvedAccountID', None),
|
ba.internal.get_v1_account_misc_read_val_2(
|
||||||
_ba.get_v1_account_display_string())
|
'resolvedAccountID', None),
|
||||||
|
ba.internal.get_v1_account_display_string())
|
||||||
self._dudes_by_id[-1] = dude
|
self._dudes_by_id[-1] = dude
|
||||||
self._dudes.append(dude)
|
self._dudes.append(dude)
|
||||||
else:
|
else:
|
||||||
@ -457,17 +459,17 @@ class PartyQueueWindow(ba.Window):
|
|||||||
"""Boost was pressed."""
|
"""Boost was pressed."""
|
||||||
from bastd.ui import account
|
from bastd.ui import account
|
||||||
from bastd.ui import getcurrency
|
from bastd.ui import getcurrency
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
account.show_sign_in_prompt()
|
account.show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
|
|
||||||
if _ba.get_v1_account_ticket_count() < self._boost_tickets:
|
if ba.internal.get_v1_account_ticket_count() < self._boost_tickets:
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
getcurrency.show_get_tickets_prompt()
|
getcurrency.show_get_tickets_prompt()
|
||||||
return
|
return
|
||||||
|
|
||||||
ba.playsound(ba.getsound('laserReverse'))
|
ba.playsound(ba.getsound('laserReverse'))
|
||||||
_ba.add_transaction(
|
ba.internal.add_transaction(
|
||||||
{
|
{
|
||||||
'type': 'PARTY_QUEUE_BOOST',
|
'type': 'PARTY_QUEUE_BOOST',
|
||||||
't': self._boost_tickets,
|
't': self._boost_tickets,
|
||||||
@ -497,18 +499,18 @@ class PartyQueueWindow(ba.Window):
|
|||||||
|
|
||||||
# Update boost button color based on if we have enough moola.
|
# Update boost button color based on if we have enough moola.
|
||||||
if self._boost_button is not None:
|
if self._boost_button is not None:
|
||||||
can_boost = (
|
can_boost = ((ba.internal.get_v1_account_state() == 'signed_in'
|
||||||
(_ba.get_v1_account_state() == 'signed_in'
|
and ba.internal.get_v1_account_ticket_count() >=
|
||||||
and _ba.get_v1_account_ticket_count() >= self._boost_tickets))
|
self._boost_tickets))
|
||||||
ba.buttonwidget(edit=self._boost_button,
|
ba.buttonwidget(edit=self._boost_button,
|
||||||
color=(0, 1, 0) if can_boost else (0.7, 0.7, 0.7))
|
color=(0, 1, 0) if can_boost else (0.7, 0.7, 0.7))
|
||||||
|
|
||||||
# Update ticket-count.
|
# Update ticket-count.
|
||||||
if self._tickets_text is not None:
|
if self._tickets_text is not None:
|
||||||
if self._boost_button is not None:
|
if self._boost_button is not None:
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
val = ba.charstr(ba.SpecialChar.TICKET) + str(
|
val = ba.charstr(ba.SpecialChar.TICKET) + str(
|
||||||
_ba.get_v1_account_ticket_count())
|
ba.internal.get_v1_account_ticket_count())
|
||||||
else:
|
else:
|
||||||
val = ba.charstr(ba.SpecialChar.TICKET) + '???'
|
val = ba.charstr(ba.SpecialChar.TICKET) + '???'
|
||||||
ba.textwidget(edit=self._tickets_text, text=val)
|
ba.textwidget(edit=self._tickets_text, text=val)
|
||||||
@ -517,16 +519,16 @@ class PartyQueueWindow(ba.Window):
|
|||||||
|
|
||||||
current_time = ba.time(ba.TimeType.REAL)
|
current_time = ba.time(ba.TimeType.REAL)
|
||||||
if (self._last_transaction_time is None
|
if (self._last_transaction_time is None
|
||||||
or current_time - self._last_transaction_time >
|
or current_time - self._last_transaction_time > 0.001 *
|
||||||
0.001 * _ba.get_v1_account_misc_read_val('pqInt', 5000)):
|
ba.internal.get_v1_account_misc_read_val('pqInt', 5000)):
|
||||||
self._last_transaction_time = current_time
|
self._last_transaction_time = current_time
|
||||||
_ba.add_transaction(
|
ba.internal.add_transaction(
|
||||||
{
|
{
|
||||||
'type': 'PARTY_QUEUE_QUERY',
|
'type': 'PARTY_QUEUE_QUERY',
|
||||||
'q': self._queue_id
|
'q': self._queue_id
|
||||||
},
|
},
|
||||||
callback=ba.WeakCall(self.on_update_response))
|
callback=ba.WeakCall(self.on_update_response))
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|
||||||
# step our dudes
|
# step our dudes
|
||||||
for dude in self._dudes:
|
for dude in self._dudes:
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
pass
|
pass
|
||||||
@ -447,7 +448,7 @@ class PlayWindow(ba.Window):
|
|||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.account import show_sign_in_prompt
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
from bastd.ui.coop.browser import CoopBrowserWindow
|
from bastd.ui.coop.browser import CoopBrowserWindow
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
self._save_state()
|
self._save_state()
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from bastd.ui.playlist.editcontroller import PlaylistEditController
|
from bastd.ui.playlist.editcontroller import PlaylistEditController
|
||||||
@ -197,7 +198,7 @@ class PlaylistAddGameWindow(ba.Window):
|
|||||||
def _on_get_more_games_press(self) -> None:
|
def _on_get_more_games_press(self) -> None:
|
||||||
from bastd.ui.account import show_sign_in_prompt
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
from bastd.ui.store.browser import StoreBrowserWindow
|
from bastd.ui.store.browser import StoreBrowserWindow
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
StoreBrowserWindow(modal=True,
|
StoreBrowserWindow(modal=True,
|
||||||
|
|||||||
@ -10,6 +10,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
pass
|
pass
|
||||||
@ -140,8 +141,9 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
def _ensure_standard_playlists_exist(self) -> None:
|
def _ensure_standard_playlists_exist(self) -> None:
|
||||||
# On new installations, go ahead and create a few playlists
|
# On new installations, go ahead and create a few playlists
|
||||||
# besides the hard-coded default one:
|
# besides the hard-coded default one:
|
||||||
if not _ba.get_v1_account_misc_val('madeStandardPlaylists', False):
|
if not ba.internal.get_v1_account_misc_val('madeStandardPlaylists',
|
||||||
_ba.add_transaction({
|
False):
|
||||||
|
ba.internal.add_transaction({
|
||||||
'type':
|
'type':
|
||||||
'ADD_PLAYLIST',
|
'ADD_PLAYLIST',
|
||||||
'playlistType':
|
'playlistType':
|
||||||
@ -175,7 +177,7 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type':
|
'type':
|
||||||
'ADD_PLAYLIST',
|
'ADD_PLAYLIST',
|
||||||
'playlistType':
|
'playlistType':
|
||||||
@ -226,7 +228,7 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type':
|
'type':
|
||||||
'ADD_PLAYLIST',
|
'ADD_PLAYLIST',
|
||||||
'playlistType':
|
'playlistType':
|
||||||
@ -255,7 +257,7 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type':
|
'type':
|
||||||
'ADD_PLAYLIST',
|
'ADD_PLAYLIST',
|
||||||
'playlistType':
|
'playlistType':
|
||||||
@ -274,12 +276,12 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'SET_MISC_VAL',
|
'type': 'SET_MISC_VAL',
|
||||||
'name': 'madeStandardPlaylists',
|
'name': 'madeStandardPlaylists',
|
||||||
'value': True
|
'value': True
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|
||||||
def _refresh(self) -> None:
|
def _refresh(self) -> None:
|
||||||
# FIXME: Should tidy this up.
|
# FIXME: Should tidy this up.
|
||||||
|
|||||||
@ -10,6 +10,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -424,12 +425,12 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
|
|||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
|
|
||||||
def _do_delete_playlist(self) -> None:
|
def _do_delete_playlist(self) -> None:
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'REMOVE_PLAYLIST',
|
'type': 'REMOVE_PLAYLIST',
|
||||||
'playlistType': self._pvars.config_name,
|
'playlistType': self._pvars.config_name,
|
||||||
'playlistName': self._selected_playlist_name
|
'playlistName': self._selected_playlist_name
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
ba.playsound(ba.getsound('shieldDown'))
|
ba.playsound(ba.getsound('shieldDown'))
|
||||||
|
|
||||||
# (we don't use len()-1 here because the default list adds one)
|
# (we don't use len()-1 here because the default list adds one)
|
||||||
@ -445,7 +446,7 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
|
|||||||
from bastd.ui.playlist import share
|
from bastd.ui.playlist import share
|
||||||
|
|
||||||
# Gotta be signed in for this to work.
|
# Gotta be signed in for this to work.
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
ba.screenmessage(ba.Lstr(resource='notSignedInErrorText'),
|
ba.screenmessage(ba.Lstr(resource='notSignedInErrorText'),
|
||||||
color=(1, 0, 0))
|
color=(1, 0, 0))
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
@ -477,7 +478,7 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Gotta be signed in for this to work.
|
# Gotta be signed in for this to work.
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
ba.screenmessage(ba.Lstr(resource='notSignedInErrorText'),
|
ba.screenmessage(ba.Lstr(resource='notSignedInErrorText'),
|
||||||
color=(1, 0, 0))
|
color=(1, 0, 0))
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
@ -492,7 +493,7 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
|
|||||||
if self._selected_playlist_name is None:
|
if self._selected_playlist_name is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
_ba.add_transaction(
|
ba.internal.add_transaction(
|
||||||
{
|
{
|
||||||
'type': 'SHARE_PLAYLIST',
|
'type': 'SHARE_PLAYLIST',
|
||||||
'expire_time': time.time() + 5,
|
'expire_time': time.time() + 5,
|
||||||
@ -501,7 +502,7 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
|
|||||||
},
|
},
|
||||||
callback=ba.WeakCall(self._on_share_playlist_response,
|
callback=ba.WeakCall(self._on_share_playlist_response,
|
||||||
self._selected_playlist_name))
|
self._selected_playlist_name))
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
ba.screenmessage(ba.Lstr(resource='sharingText'))
|
ba.screenmessage(ba.Lstr(resource='sharingText'))
|
||||||
|
|
||||||
def _delete_playlist(self) -> None:
|
def _delete_playlist(self) -> None:
|
||||||
@ -582,13 +583,13 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
|
|||||||
break
|
break
|
||||||
test_index += 1
|
test_index += 1
|
||||||
|
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'ADD_PLAYLIST',
|
'type': 'ADD_PLAYLIST',
|
||||||
'playlistType': self._pvars.config_name,
|
'playlistType': self._pvars.config_name,
|
||||||
'playlistName': test_name,
|
'playlistName': test_name,
|
||||||
'playlist': copy.deepcopy(plst)
|
'playlist': copy.deepcopy(plst)
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|
||||||
ba.playsound(ba.getsound('gunCocking'))
|
ba.playsound(ba.getsound('gunCocking'))
|
||||||
self._refresh(select_playlist=test_name)
|
self._refresh(select_playlist=test_name)
|
||||||
|
|||||||
@ -7,6 +7,7 @@ from __future__ import annotations
|
|||||||
from typing import TYPE_CHECKING, cast
|
from typing import TYPE_CHECKING, cast
|
||||||
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
import _ba
|
import _ba
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -283,7 +284,7 @@ class PlaylistEditWindow(ba.Window):
|
|||||||
|
|
||||||
# If we had an old one, delete it.
|
# If we had an old one, delete it.
|
||||||
if self._editcontroller.get_existing_playlist_name() is not None:
|
if self._editcontroller.get_existing_playlist_name() is not None:
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type':
|
'type':
|
||||||
'REMOVE_PLAYLIST',
|
'REMOVE_PLAYLIST',
|
||||||
'playlistType':
|
'playlistType':
|
||||||
@ -292,13 +293,13 @@ class PlaylistEditWindow(ba.Window):
|
|||||||
self._editcontroller.get_existing_playlist_name()
|
self._editcontroller.get_existing_playlist_name()
|
||||||
})
|
})
|
||||||
|
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'ADD_PLAYLIST',
|
'type': 'ADD_PLAYLIST',
|
||||||
'playlistType': self._editcontroller.get_config_name(),
|
'playlistType': self._editcontroller.get_config_name(),
|
||||||
'playlistName': new_name,
|
'playlistName': new_name,
|
||||||
'playlist': self._editcontroller.get_playlist()
|
'playlist': self._editcontroller.get_playlist()
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.playsound(ba.getsound('gunCocking'))
|
ba.playsound(ba.getsound('gunCocking'))
|
||||||
|
|||||||
@ -9,6 +9,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
@ -210,7 +211,7 @@ class PlaylistMapSelectWindow(ba.Window):
|
|||||||
def _on_store_press(self) -> None:
|
def _on_store_press(self) -> None:
|
||||||
from bastd.ui import account
|
from bastd.ui import account
|
||||||
from bastd.ui.store.browser import StoreBrowserWindow
|
from bastd.ui.store.browser import StoreBrowserWindow
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
account.show_sign_in_prompt()
|
account.show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
StoreBrowserWindow(modal=True,
|
StoreBrowserWindow(modal=True,
|
||||||
|
|||||||
@ -7,8 +7,8 @@ from __future__ import annotations
|
|||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.ui import promocode
|
from bastd.ui import promocode
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -50,14 +50,14 @@ class SharePlaylistImportWindow(promocode.PromoCodeWindow):
|
|||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
|
|
||||||
def _do_enter(self) -> None:
|
def _do_enter(self) -> None:
|
||||||
_ba.add_transaction(
|
ba.internal.add_transaction(
|
||||||
{
|
{
|
||||||
'type': 'IMPORT_PLAYLIST',
|
'type': 'IMPORT_PLAYLIST',
|
||||||
'expire_time': time.time() + 5,
|
'expire_time': time.time() + 5,
|
||||||
'code': ba.textwidget(query=self._text_field)
|
'code': ba.textwidget(query=self._text_field)
|
||||||
},
|
},
|
||||||
callback=ba.WeakCall(self._on_import_response))
|
callback=ba.WeakCall(self._on_import_response))
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
ba.screenmessage(ba.Lstr(resource='importingText'))
|
ba.screenmessage(ba.Lstr(resource='importingText'))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.ui import popup
|
from bastd.ui import popup
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -350,7 +351,7 @@ class PlayOptionsWindow(popup.PopupWindow):
|
|||||||
from bastd.ui.teamnamescolors import TeamNamesColorsWindow
|
from bastd.ui.teamnamescolors import TeamNamesColorsWindow
|
||||||
from bastd.ui.purchase import PurchaseWindow
|
from bastd.ui.purchase import PurchaseWindow
|
||||||
if not ba.app.accounts_v1.have_pro():
|
if not ba.app.accounts_v1.have_pro():
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
else:
|
else:
|
||||||
PurchaseWindow(items=['pro'])
|
PurchaseWindow(items=['pro'])
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -174,7 +175,8 @@ class ProfileBrowserWindow(ba.Window):
|
|||||||
from bastd.ui.purchase import PurchaseWindow
|
from bastd.ui.purchase import PurchaseWindow
|
||||||
|
|
||||||
# Limit to a handful profiles if they don't have pro-options.
|
# Limit to a handful profiles if they don't have pro-options.
|
||||||
max_non_pro_profiles = _ba.get_v1_account_misc_read_val('mnpp', 5)
|
max_non_pro_profiles = ba.internal.get_v1_account_misc_read_val(
|
||||||
|
'mnpp', 5)
|
||||||
assert self._profiles is not None
|
assert self._profiles is not None
|
||||||
if (not ba.app.accounts_v1.have_pro_options()
|
if (not ba.app.accounts_v1.have_pro_options()
|
||||||
and len(self._profiles) >= max_non_pro_profiles):
|
and len(self._profiles) >= max_non_pro_profiles):
|
||||||
@ -221,11 +223,11 @@ class ProfileBrowserWindow(ba.Window):
|
|||||||
self._do_delete_profile, 350)
|
self._do_delete_profile, 350)
|
||||||
|
|
||||||
def _do_delete_profile(self) -> None:
|
def _do_delete_profile(self) -> None:
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'REMOVE_PLAYER_PROFILE',
|
'type': 'REMOVE_PLAYER_PROFILE',
|
||||||
'name': self._selected_profile
|
'name': self._selected_profile
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
ba.playsound(ba.getsound('shieldDown'))
|
ba.playsound(ba.getsound('shieldDown'))
|
||||||
self._refresh()
|
self._refresh()
|
||||||
|
|
||||||
@ -283,8 +285,8 @@ class ProfileBrowserWindow(ba.Window):
|
|||||||
items.sort(key=lambda x: asserttype(x[0], str).lower())
|
items.sort(key=lambda x: asserttype(x[0], str).lower())
|
||||||
index = 0
|
index = 0
|
||||||
account_name: str | None
|
account_name: str | None
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
account_name = _ba.get_v1_account_display_string()
|
account_name = ba.internal.get_v1_account_display_string()
|
||||||
else:
|
else:
|
||||||
account_name = None
|
account_name = None
|
||||||
widget_to_select = None
|
widget_to_select = None
|
||||||
|
|||||||
@ -9,6 +9,7 @@ from typing import TYPE_CHECKING, cast
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from bastd.ui.colorpicker import ColorPicker
|
from bastd.ui.colorpicker import ColorPicker
|
||||||
@ -172,8 +173,8 @@ class EditProfileWindow(ba.Window):
|
|||||||
|
|
||||||
self._upgrade_button = None
|
self._upgrade_button = None
|
||||||
if self._is_account_profile:
|
if self._is_account_profile:
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
sval = _ba.get_v1_account_display_string()
|
sval = ba.internal.get_v1_account_display_string()
|
||||||
else:
|
else:
|
||||||
sval = '??'
|
sval = '??'
|
||||||
ba.textwidget(parent=self._root_widget,
|
ba.textwidget(parent=self._root_widget,
|
||||||
@ -426,7 +427,7 @@ class EditProfileWindow(ba.Window):
|
|||||||
"""Attempt to ugrade the profile to global."""
|
"""Attempt to ugrade the profile to global."""
|
||||||
from bastd.ui import account
|
from bastd.ui import account
|
||||||
from bastd.ui.profile import upgrade as pupgrade
|
from bastd.ui.profile import upgrade as pupgrade
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
account.show_sign_in_prompt()
|
account.show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -592,8 +593,9 @@ class EditProfileWindow(ba.Window):
|
|||||||
return
|
return
|
||||||
name = self.getname()
|
name = self.getname()
|
||||||
if name == '__account__':
|
if name == '__account__':
|
||||||
name = (_ba.get_v1_account_name()
|
name = (ba.internal.get_v1_account_name()
|
||||||
if _ba.get_v1_account_state() == 'signed_in' else '???')
|
if ba.internal.get_v1_account_state() == 'signed_in' else
|
||||||
|
'???')
|
||||||
if len(name) > 10 and not (self._global or self._is_account_profile):
|
if len(name) > 10 and not (self._global or self._is_account_profile):
|
||||||
ba.textwidget(edit=self._clipped_name_text,
|
ba.textwidget(edit=self._clipped_name_text,
|
||||||
text=ba.Lstr(resource='inGameClippedNameText',
|
text=ba.Lstr(resource='inGameClippedNameText',
|
||||||
@ -640,7 +642,7 @@ class EditProfileWindow(ba.Window):
|
|||||||
|
|
||||||
# Delete old in case we're renaming.
|
# Delete old in case we're renaming.
|
||||||
if self._existing_profile and self._existing_profile != new_name:
|
if self._existing_profile and self._existing_profile != new_name:
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'REMOVE_PLAYER_PROFILE',
|
'type': 'REMOVE_PLAYER_PROFILE',
|
||||||
'name': self._existing_profile
|
'name': self._existing_profile
|
||||||
})
|
})
|
||||||
@ -649,7 +651,7 @@ class EditProfileWindow(ba.Window):
|
|||||||
# new name (will need to re-request it).
|
# new name (will need to re-request it).
|
||||||
self._global = False
|
self._global = False
|
||||||
|
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'ADD_PLAYER_PROFILE',
|
'type': 'ADD_PLAYER_PROFILE',
|
||||||
'name': new_name,
|
'name': new_name,
|
||||||
'profile': {
|
'profile': {
|
||||||
@ -662,7 +664,7 @@ class EditProfileWindow(ba.Window):
|
|||||||
})
|
})
|
||||||
|
|
||||||
if transition_out:
|
if transition_out:
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.ui.set_main_menu_window(
|
ba.app.ui.set_main_menu_window(
|
||||||
ProfileBrowserWindow(
|
ProfileBrowserWindow(
|
||||||
|
|||||||
@ -8,8 +8,8 @@ import time
|
|||||||
import weakref
|
import weakref
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -126,8 +126,8 @@ class ProfileUpgradeWindow(ba.Window):
|
|||||||
'b': ba.app.build_number
|
'b': ba.app.build_number
|
||||||
},
|
},
|
||||||
callback=ba.WeakCall(self._profile_check_result))
|
callback=ba.WeakCall(self._profile_check_result))
|
||||||
self._cost = _ba.get_v1_account_misc_read_val('price.global_profile',
|
self._cost = ba.internal.get_v1_account_misc_read_val(
|
||||||
500)
|
'price.global_profile', 500)
|
||||||
self._status: str | None = 'waiting'
|
self._status: str | None = 'waiting'
|
||||||
self._update_timer = ba.Timer(1.0,
|
self._update_timer = ba.Timer(1.0,
|
||||||
ba.WeakCall(self._update),
|
ba.WeakCall(self._update),
|
||||||
@ -170,7 +170,7 @@ class ProfileUpgradeWindow(ba.Window):
|
|||||||
from bastd.ui import getcurrency
|
from bastd.ui import getcurrency
|
||||||
if self._status is None:
|
if self._status is None:
|
||||||
# If it appears we don't have enough tickets, offer to buy more.
|
# If it appears we don't have enough tickets, offer to buy more.
|
||||||
tickets = _ba.get_v1_account_ticket_count()
|
tickets = ba.internal.get_v1_account_ticket_count()
|
||||||
if tickets < self._cost:
|
if tickets < self._cost:
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
getcurrency.show_get_tickets_prompt()
|
getcurrency.show_get_tickets_prompt()
|
||||||
@ -193,11 +193,11 @@ class ProfileUpgradeWindow(ba.Window):
|
|||||||
color=(1, 0, 0))
|
color=(1, 0, 0))
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
return
|
return
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'UPGRADE_PROFILE',
|
'type': 'UPGRADE_PROFILE',
|
||||||
'name': self._name
|
'name': self._name
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
self._status = 'upgrading'
|
self._status = 'upgrading'
|
||||||
self._upgrade_start_time = time.time()
|
self._upgrade_start_time = time.time()
|
||||||
else:
|
else:
|
||||||
@ -205,7 +205,7 @@ class ProfileUpgradeWindow(ba.Window):
|
|||||||
|
|
||||||
def _update(self) -> None:
|
def _update(self) -> None:
|
||||||
try:
|
try:
|
||||||
t_str = str(_ba.get_v1_account_ticket_count())
|
t_str = str(ba.internal.get_v1_account_ticket_count())
|
||||||
except Exception:
|
except Exception:
|
||||||
t_str = '?'
|
t_str = '?'
|
||||||
if self._tickets_text is not None:
|
if self._tickets_text is not None:
|
||||||
@ -219,7 +219,7 @@ class ProfileUpgradeWindow(ba.Window):
|
|||||||
# Once we've kicked off an upgrade attempt and all transactions go
|
# Once we've kicked off an upgrade attempt and all transactions go
|
||||||
# through, we're done.
|
# through, we're done.
|
||||||
if (self._status == 'upgrading'
|
if (self._status == 'upgrading'
|
||||||
and not _ba.have_outstanding_transactions()):
|
and not ba.internal.have_outstanding_transactions()):
|
||||||
self._status = 'exiting'
|
self._status = 'exiting'
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
edit_profile_window = self._edit_profile_window()
|
edit_profile_window = self._edit_profile_window()
|
||||||
|
|||||||
@ -7,8 +7,8 @@ from __future__ import annotations
|
|||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
pass
|
pass
|
||||||
@ -112,9 +112,9 @@ class PromoCodeWindow(ba.Window):
|
|||||||
if not self._modal:
|
if not self._modal:
|
||||||
ba.app.ui.set_main_menu_window(
|
ba.app.ui.set_main_menu_window(
|
||||||
AdvancedSettingsWindow(transition='in_left').get_root_widget())
|
AdvancedSettingsWindow(transition='in_left').get_root_widget())
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'PROMO_CODE',
|
'type': 'PROMO_CODE',
|
||||||
'expire_time': time.time() + 5,
|
'expire_time': time.time() + 5,
|
||||||
'code': ba.textwidget(query=self._text_field)
|
'code': ba.textwidget(query=self._text_field)
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|||||||
@ -6,8 +6,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -68,11 +68,11 @@ class PurchaseWindow(ba.Window):
|
|||||||
pass # not working
|
pass # not working
|
||||||
else:
|
else:
|
||||||
if self._items == ['pro']:
|
if self._items == ['pro']:
|
||||||
price_str = _ba.get_price(self._items[0])
|
price_str = ba.internal.get_price(self._items[0])
|
||||||
pyoffs = -15
|
pyoffs = -15
|
||||||
else:
|
else:
|
||||||
pyoffs = 0
|
pyoffs = 0
|
||||||
price = self._price = _ba.get_v1_account_misc_read_val(
|
price = self._price = ba.internal.get_v1_account_misc_read_val(
|
||||||
'price.' + str(items[0]), -1)
|
'price.' + str(items[0]), -1)
|
||||||
price_str = ba.charstr(ba.SpecialChar.TICKET) + str(price)
|
price_str = ba.charstr(ba.SpecialChar.TICKET) + str(price)
|
||||||
self._price_text = ba.textwidget(parent=self._root_widget,
|
self._price_text = ba.textwidget(parent=self._root_widget,
|
||||||
@ -121,7 +121,7 @@ class PurchaseWindow(ba.Window):
|
|||||||
if ba.app.accounts_v1.have_pro():
|
if ba.app.accounts_v1.have_pro():
|
||||||
can_die = True
|
can_die = True
|
||||||
else:
|
else:
|
||||||
if _ba.get_purchased(self._items[0]):
|
if ba.internal.get_purchased(self._items[0]):
|
||||||
can_die = True
|
can_die = True
|
||||||
|
|
||||||
if can_die:
|
if can_die:
|
||||||
@ -130,11 +130,11 @@ class PurchaseWindow(ba.Window):
|
|||||||
def _purchase(self) -> None:
|
def _purchase(self) -> None:
|
||||||
from bastd.ui import getcurrency
|
from bastd.ui import getcurrency
|
||||||
if self._items == ['pro']:
|
if self._items == ['pro']:
|
||||||
_ba.purchase('pro')
|
ba.internal.purchase('pro')
|
||||||
else:
|
else:
|
||||||
ticket_count: int | None
|
ticket_count: int | None
|
||||||
try:
|
try:
|
||||||
ticket_count = _ba.get_v1_account_ticket_count()
|
ticket_count = ba.internal.get_v1_account_ticket_count()
|
||||||
except Exception:
|
except Exception:
|
||||||
ticket_count = None
|
ticket_count = None
|
||||||
if ticket_count is not None and ticket_count < self._price:
|
if ticket_count is not None and ticket_count < self._price:
|
||||||
@ -143,7 +143,7 @@ class PurchaseWindow(ba.Window):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def do_it() -> None:
|
def do_it() -> None:
|
||||||
_ba.in_game_purchase(self._items[0], self._price)
|
ba.internal.in_game_purchase(self._items[0], self._price)
|
||||||
|
|
||||||
ba.playsound(ba.getsound('swish'))
|
ba.playsound(ba.getsound('swish'))
|
||||||
do_it()
|
do_it()
|
||||||
|
|||||||
@ -6,6 +6,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
|
|
||||||
class ReportPlayerWindow(ba.Window):
|
class ReportPlayerWindow(ba.Window):
|
||||||
@ -63,7 +64,7 @@ class ReportPlayerWindow(ba.Window):
|
|||||||
|
|
||||||
def _on_language_press(self) -> None:
|
def _on_language_press(self) -> None:
|
||||||
from urllib import parse
|
from urllib import parse
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'REPORT_ACCOUNT',
|
'type': 'REPORT_ACCOUNT',
|
||||||
'reason': 'language',
|
'reason': 'language',
|
||||||
'account': self._account_id
|
'account': self._account_id
|
||||||
@ -76,7 +77,7 @@ class ReportPlayerWindow(ba.Window):
|
|||||||
|
|
||||||
def _on_cheating_press(self) -> None:
|
def _on_cheating_press(self) -> None:
|
||||||
from urllib import parse
|
from urllib import parse
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'REPORT_ACCOUNT',
|
'type': 'REPORT_ACCOUNT',
|
||||||
'reason': 'cheating',
|
'reason': 'cheating',
|
||||||
'account': self._account_id
|
'account': self._account_id
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -76,7 +77,7 @@ class ServerDialogWindow(ba.Window):
|
|||||||
ba.TimeFormat.MILLISECONDS) - self._starttime < 1000:
|
ba.TimeFormat.MILLISECONDS) - self._starttime < 1000:
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
return
|
return
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'DIALOG_RESPONSE',
|
'type': 'DIALOG_RESPONSE',
|
||||||
'dialogID': self._dialog_id,
|
'dialogID': self._dialog_id,
|
||||||
'response': 1
|
'response': 1
|
||||||
@ -88,7 +89,7 @@ class ServerDialogWindow(ba.Window):
|
|||||||
ba.TimeFormat.MILLISECONDS) - self._starttime < 1000:
|
ba.TimeFormat.MILLISECONDS) - self._starttime < 1000:
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
return
|
return
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'DIALOG_RESPONSE',
|
'type': 'DIALOG_RESPONSE',
|
||||||
'dialogID': self._dialog_id,
|
'dialogID': self._dialog_id,
|
||||||
'response': 0
|
'response': 0
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.ui import popup as popup_ui
|
from bastd.ui import popup as popup_ui
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -340,7 +341,7 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
self._update_lang_status()
|
self._update_lang_status()
|
||||||
v -= 40
|
v -= 40
|
||||||
|
|
||||||
lang_inform = _ba.get_v1_account_misc_val('langInform', False)
|
lang_inform = ba.internal.get_v1_account_misc_val('langInform', False)
|
||||||
|
|
||||||
self._language_inform_checkbox = cbw = ba.checkboxwidget(
|
self._language_inform_checkbox = cbw = ba.checkboxwidget(
|
||||||
parent=self._subcontainer,
|
parent=self._subcontainer,
|
||||||
@ -526,12 +527,12 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
color=(1, 1, 0))
|
color=(1, 1, 0))
|
||||||
|
|
||||||
def _on_lang_inform_value_change(self, val: bool) -> None:
|
def _on_lang_inform_value_change(self, val: bool) -> None:
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'SET_MISC_VAL',
|
'type': 'SET_MISC_VAL',
|
||||||
'name': 'langInform',
|
'name': 'langInform',
|
||||||
'value': val
|
'value': val
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|
||||||
def _on_vr_test_press(self) -> None:
|
def _on_vr_test_press(self) -> None:
|
||||||
from bastd.ui.settings.vrtesting import VRTestingWindow
|
from bastd.ui.settings.vrtesting import VRTestingWindow
|
||||||
@ -544,7 +545,7 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
from bastd.ui.settings.nettesting import NetTestingWindow
|
from bastd.ui.settings.nettesting import NetTestingWindow
|
||||||
|
|
||||||
# Net-testing requires a signed in v1 account.
|
# Net-testing requires a signed in v1 account.
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
ba.screenmessage(ba.Lstr(resource='notSignedInErrorText'),
|
ba.screenmessage(ba.Lstr(resource='notSignedInErrorText'),
|
||||||
color=(1, 0, 0))
|
color=(1, 0, 0))
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
@ -558,7 +559,7 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
def _on_friend_promo_code_press(self) -> None:
|
def _on_friend_promo_code_press(self) -> None:
|
||||||
from bastd.ui import appinvite
|
from bastd.ui import appinvite
|
||||||
from bastd.ui import account
|
from bastd.ui import account
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
account.show_sign_in_prompt()
|
account.show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
appinvite.handle_app_invites_press()
|
appinvite.handle_app_invites_press()
|
||||||
@ -576,7 +577,7 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
from bastd.ui.account import show_sign_in_prompt
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
|
|
||||||
# We have to be logged in for promo-codes to work.
|
# We have to be logged in for promo-codes to work.
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
self._save_state()
|
self._save_state()
|
||||||
|
|||||||
@ -13,6 +13,7 @@ from typing import TYPE_CHECKING
|
|||||||
from efro.error import CleanError
|
from efro.error import CleanError
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.ui.settings.testing import TestingWindow
|
from bastd.ui.settings.testing import TestingWindow
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -175,12 +176,12 @@ def _run_diagnostics(weakwin: weakref.ref[NetTestingWindow]) -> None:
|
|||||||
_print_test_results(_dummy_fail)
|
_print_test_results(_dummy_fail)
|
||||||
|
|
||||||
# V1 ping
|
# V1 ping
|
||||||
baseaddr = _ba.get_master_server_address(source=0, version=1)
|
baseaddr = ba.internal.get_master_server_address(source=0, version=1)
|
||||||
_print(f'\nContacting V1 master-server src0 ({baseaddr})...')
|
_print(f'\nContacting V1 master-server src0 ({baseaddr})...')
|
||||||
_print_test_results(lambda: _test_fetch(baseaddr))
|
_print_test_results(lambda: _test_fetch(baseaddr))
|
||||||
|
|
||||||
# V1 alternate ping
|
# V1 alternate ping
|
||||||
baseaddr = _ba.get_master_server_address(source=1, version=1)
|
baseaddr = ba.internal.get_master_server_address(source=1, version=1)
|
||||||
_print(f'\nContacting V1 master-server src1 ({baseaddr})...')
|
_print(f'\nContacting V1 master-server src1 ({baseaddr})...')
|
||||||
_print_test_results(lambda: _test_fetch(baseaddr))
|
_print_test_results(lambda: _test_fetch(baseaddr))
|
||||||
|
|
||||||
@ -189,14 +190,14 @@ def _run_diagnostics(weakwin: weakref.ref[NetTestingWindow]) -> None:
|
|||||||
for srcid, result in sorted(ba.app.net.v1_ctest_results.items()):
|
for srcid, result in sorted(ba.app.net.v1_ctest_results.items()):
|
||||||
_print(f'\nV1 src{srcid} result: {result}')
|
_print(f'\nV1 src{srcid} result: {result}')
|
||||||
|
|
||||||
curv1addr = _ba.get_master_server_address(version=1)
|
curv1addr = ba.internal.get_master_server_address(version=1)
|
||||||
_print(f'\nUsing V1 address: {curv1addr}')
|
_print(f'\nUsing V1 address: {curv1addr}')
|
||||||
|
|
||||||
_print('\nRunning V1 transaction...')
|
_print('\nRunning V1 transaction...')
|
||||||
_print_test_results(_test_v1_transaction)
|
_print_test_results(_test_v1_transaction)
|
||||||
|
|
||||||
# V2 ping
|
# V2 ping
|
||||||
baseaddr = _ba.get_master_server_address(version=2)
|
baseaddr = ba.internal.get_master_server_address(version=2)
|
||||||
_print(f'\nContacting V2 master-server ({baseaddr})...')
|
_print(f'\nContacting V2 master-server ({baseaddr})...')
|
||||||
_print_test_results(lambda: _test_fetch(baseaddr))
|
_print_test_results(lambda: _test_fetch(baseaddr))
|
||||||
|
|
||||||
@ -246,7 +247,7 @@ def _dummy_fail() -> None:
|
|||||||
|
|
||||||
def _test_v1_transaction() -> None:
|
def _test_v1_transaction() -> None:
|
||||||
"""Dummy fail test case."""
|
"""Dummy fail test case."""
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
raise RuntimeError('Not signed in.')
|
raise RuntimeError('Not signed in.')
|
||||||
|
|
||||||
starttime = time.monotonic()
|
starttime = time.monotonic()
|
||||||
@ -263,14 +264,14 @@ def _test_v1_transaction() -> None:
|
|||||||
|
|
||||||
def _do_it() -> None:
|
def _do_it() -> None:
|
||||||
# Fire off a transaction with a callback.
|
# Fire off a transaction with a callback.
|
||||||
_ba.add_transaction(
|
ba.internal.add_transaction(
|
||||||
{
|
{
|
||||||
'type': 'PRIVATE_PARTY_QUERY',
|
'type': 'PRIVATE_PARTY_QUERY',
|
||||||
'expire_time': time.time() + 20,
|
'expire_time': time.time() + 20,
|
||||||
},
|
},
|
||||||
callback=_cb,
|
callback=_cb,
|
||||||
)
|
)
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|
||||||
ba.pushcall(_do_it, from_other_thread=True)
|
ba.pushcall(_do_it, from_other_thread=True)
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -35,15 +36,15 @@ class SpecialOfferWindow(ba.Window):
|
|||||||
|
|
||||||
# Misnomer: 'pro' actually means offer 'pro_sale'.
|
# Misnomer: 'pro' actually means offer 'pro_sale'.
|
||||||
if offer['item'] in ['pro', 'pro_fullprice']:
|
if offer['item'] in ['pro', 'pro_fullprice']:
|
||||||
real_price = _ba.get_price('pro' if offer['item'] ==
|
real_price = ba.internal.get_price('pro' if offer['item'] ==
|
||||||
'pro_fullprice' else 'pro_sale')
|
'pro_fullprice' else 'pro_sale')
|
||||||
if real_price is None and ba.app.debug_build:
|
if real_price is None and ba.app.debug_build:
|
||||||
print('NOTE: Faking prices for debug build.')
|
print('NOTE: Faking prices for debug build.')
|
||||||
real_price = '$1.23'
|
real_price = '$1.23'
|
||||||
zombie = real_price is None
|
zombie = real_price is None
|
||||||
elif isinstance(offer['price'], str):
|
elif isinstance(offer['price'], str):
|
||||||
# (a string price implies IAP id)
|
# (a string price implies IAP id)
|
||||||
real_price = _ba.get_price(offer['price'])
|
real_price = ba.internal.get_price(offer['price'])
|
||||||
if real_price is None and ba.app.debug_build:
|
if real_price is None and ba.app.debug_build:
|
||||||
print('NOTE: Faking price for debug build.')
|
print('NOTE: Faking price for debug build.')
|
||||||
real_price = '$1.23'
|
real_price = '$1.23'
|
||||||
@ -83,10 +84,10 @@ class SpecialOfferWindow(ba.Window):
|
|||||||
self._is_bundle_sale = False
|
self._is_bundle_sale = False
|
||||||
try:
|
try:
|
||||||
if offer['item'] in ['pro', 'pro_fullprice']:
|
if offer['item'] in ['pro', 'pro_fullprice']:
|
||||||
original_price_str = _ba.get_price('pro')
|
original_price_str = ba.internal.get_price('pro')
|
||||||
if original_price_str is None:
|
if original_price_str is None:
|
||||||
original_price_str = '?'
|
original_price_str = '?'
|
||||||
new_price_str = _ba.get_price('pro_sale')
|
new_price_str = ba.internal.get_price('pro_sale')
|
||||||
if new_price_str is None:
|
if new_price_str is None:
|
||||||
new_price_str = '?'
|
new_price_str = '?'
|
||||||
percent_off_text = ''
|
percent_off_text = ''
|
||||||
@ -95,7 +96,7 @@ class SpecialOfferWindow(ba.Window):
|
|||||||
if ('bonusTickets' in offer
|
if ('bonusTickets' in offer
|
||||||
and offer['bonusTickets'] is not None):
|
and offer['bonusTickets'] is not None):
|
||||||
self._is_bundle_sale = True
|
self._is_bundle_sale = True
|
||||||
original_price = _ba.get_v1_account_misc_read_val(
|
original_price = ba.internal.get_v1_account_misc_read_val(
|
||||||
'price.' + self._offer_item, 9999)
|
'price.' + self._offer_item, 9999)
|
||||||
|
|
||||||
# For pure ticket prices we can show a percent-off.
|
# For pure ticket prices we can show a percent-off.
|
||||||
@ -207,7 +208,7 @@ class SpecialOfferWindow(ba.Window):
|
|||||||
# Total-value if they supplied it.
|
# Total-value if they supplied it.
|
||||||
total_worth_item = offer.get('valueItem', None)
|
total_worth_item = offer.get('valueItem', None)
|
||||||
if total_worth_item is not None:
|
if total_worth_item is not None:
|
||||||
price = _ba.get_price(total_worth_item)
|
price = ba.internal.get_price(total_worth_item)
|
||||||
total_worth_price = (get_clean_price(price)
|
total_worth_price = (get_clean_price(price)
|
||||||
if price is not None else None)
|
if price is not None else None)
|
||||||
if total_worth_price is not None:
|
if total_worth_price is not None:
|
||||||
@ -344,7 +345,7 @@ class SpecialOfferWindow(ba.Window):
|
|||||||
if _ba.app.accounts_v1.have_pro():
|
if _ba.app.accounts_v1.have_pro():
|
||||||
can_die = True
|
can_die = True
|
||||||
else:
|
else:
|
||||||
if _ba.get_purchased(self._offer_item):
|
if ba.internal.get_purchased(self._offer_item):
|
||||||
can_die = True
|
can_die = True
|
||||||
|
|
||||||
if can_die:
|
if can_die:
|
||||||
@ -364,9 +365,9 @@ class SpecialOfferWindow(ba.Window):
|
|||||||
if not self._root_widget:
|
if not self._root_widget:
|
||||||
return
|
return
|
||||||
sval: str | ba.Lstr
|
sval: str | ba.Lstr
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
sval = (ba.charstr(SpecialChar.TICKET) +
|
sval = (ba.charstr(SpecialChar.TICKET) +
|
||||||
str(_ba.get_v1_account_ticket_count()))
|
str(ba.internal.get_v1_account_ticket_count()))
|
||||||
else:
|
else:
|
||||||
sval = ba.Lstr(resource='getTicketsWindow.titleText')
|
sval = ba.Lstr(resource='getTicketsWindow.titleText')
|
||||||
ba.buttonwidget(edit=self._get_tickets_button, label=sval)
|
ba.buttonwidget(edit=self._get_tickets_button, label=sval)
|
||||||
@ -374,7 +375,7 @@ class SpecialOfferWindow(ba.Window):
|
|||||||
def _on_get_more_tickets_press(self) -> None:
|
def _on_get_more_tickets_press(self) -> None:
|
||||||
from bastd.ui import account
|
from bastd.ui import account
|
||||||
from bastd.ui import getcurrency
|
from bastd.ui import getcurrency
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
account.show_sign_in_prompt()
|
account.show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
getcurrency.GetCurrencyWindow(modal=True).get_root_widget()
|
getcurrency.GetCurrencyWindow(modal=True).get_root_widget()
|
||||||
@ -384,16 +385,16 @@ class SpecialOfferWindow(ba.Window):
|
|||||||
from bastd.ui import getcurrency
|
from bastd.ui import getcurrency
|
||||||
from bastd.ui import confirm
|
from bastd.ui import confirm
|
||||||
if self._offer['item'] == 'pro':
|
if self._offer['item'] == 'pro':
|
||||||
_ba.purchase('pro_sale')
|
ba.internal.purchase('pro_sale')
|
||||||
elif self._offer['item'] == 'pro_fullprice':
|
elif self._offer['item'] == 'pro_fullprice':
|
||||||
_ba.purchase('pro')
|
ba.internal.purchase('pro')
|
||||||
elif self._is_bundle_sale:
|
elif self._is_bundle_sale:
|
||||||
# With bundle sales, the price is the name of the IAP.
|
# With bundle sales, the price is the name of the IAP.
|
||||||
_ba.purchase(self._offer['price'])
|
ba.internal.purchase(self._offer['price'])
|
||||||
else:
|
else:
|
||||||
ticket_count: int | None
|
ticket_count: int | None
|
||||||
try:
|
try:
|
||||||
ticket_count = _ba.get_v1_account_ticket_count()
|
ticket_count = ba.internal.get_v1_account_ticket_count()
|
||||||
except Exception:
|
except Exception:
|
||||||
ticket_count = None
|
ticket_count = None
|
||||||
if (ticket_count is not None
|
if (ticket_count is not None
|
||||||
@ -403,8 +404,8 @@ class SpecialOfferWindow(ba.Window):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def do_it() -> None:
|
def do_it() -> None:
|
||||||
_ba.in_game_purchase('offer:' + str(self._offer['id']),
|
ba.internal.in_game_purchase('offer:' + str(self._offer['id']),
|
||||||
self._offer['price'])
|
self._offer['price'])
|
||||||
|
|
||||||
ba.playsound(ba.getsound('swish'))
|
ba.playsound(ba.getsound('swish'))
|
||||||
confirm.ConfirmWindow(ba.Lstr(
|
confirm.ConfirmWindow(ba.Lstr(
|
||||||
@ -446,7 +447,7 @@ def show_offer() -> bool:
|
|||||||
if app.special_offer.get('item') == 'pro_fullprice':
|
if app.special_offer.get('item') == 'pro_fullprice':
|
||||||
cfg = app.config
|
cfg = app.config
|
||||||
cfg['pendingSpecialOffer'] = {
|
cfg['pendingSpecialOffer'] = {
|
||||||
'a': _ba.get_public_login_id(),
|
'a': ba.internal.get_public_login_id(),
|
||||||
'o': app.special_offer
|
'o': app.special_offer
|
||||||
}
|
}
|
||||||
cfg.commit()
|
cfg.commit()
|
||||||
|
|||||||
@ -12,6 +12,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any, Callable, Sequence
|
from typing import Any, Callable, Sequence
|
||||||
@ -282,10 +283,10 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
|
|
||||||
def _restore_purchases(self) -> None:
|
def _restore_purchases(self) -> None:
|
||||||
from bastd.ui import account
|
from bastd.ui import account
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
account.show_sign_in_prompt()
|
account.show_sign_in_prompt()
|
||||||
else:
|
else:
|
||||||
_ba.restore_purchases()
|
ba.internal.restore_purchases()
|
||||||
|
|
||||||
def _update_tabs(self) -> None:
|
def _update_tabs(self) -> None:
|
||||||
from ba.internal import (get_available_sale_time,
|
from ba.internal import (get_available_sale_time,
|
||||||
@ -323,9 +324,9 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
if not self._root_widget:
|
if not self._root_widget:
|
||||||
return
|
return
|
||||||
sval: str | ba.Lstr
|
sval: str | ba.Lstr
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
sval = ba.charstr(SpecialChar.TICKET) + str(
|
sval = ba.charstr(SpecialChar.TICKET) + str(
|
||||||
_ba.get_v1_account_ticket_count())
|
ba.internal.get_v1_account_ticket_count())
|
||||||
else:
|
else:
|
||||||
sval = ba.Lstr(resource='getTicketsWindow.titleText')
|
sval = ba.Lstr(resource='getTicketsWindow.titleText')
|
||||||
if self._get_tickets_button:
|
if self._get_tickets_button:
|
||||||
@ -410,7 +411,7 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
else:
|
else:
|
||||||
if is_ticket_purchase:
|
if is_ticket_purchase:
|
||||||
if result['allow']:
|
if result['allow']:
|
||||||
price = _ba.get_v1_account_misc_read_val(
|
price = ba.internal.get_v1_account_misc_read_val(
|
||||||
'price.' + item, None)
|
'price.' + item, None)
|
||||||
if (price is None or not isinstance(price, int)
|
if (price is None or not isinstance(price, int)
|
||||||
or price <= 0):
|
or price <= 0):
|
||||||
@ -419,7 +420,7 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
else:
|
else:
|
||||||
ba.playsound(ba.getsound('click01'))
|
ba.playsound(ba.getsound('click01'))
|
||||||
_ba.in_game_purchase(item, price)
|
ba.internal.in_game_purchase(item, price)
|
||||||
else:
|
else:
|
||||||
if result['reason'] == 'versionTooOld':
|
if result['reason'] == 'versionTooOld':
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
@ -434,7 +435,7 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
# Real in-app purchase.
|
# Real in-app purchase.
|
||||||
else:
|
else:
|
||||||
if result['allow']:
|
if result['allow']:
|
||||||
_ba.purchase(item)
|
ba.internal.purchase(item)
|
||||||
else:
|
else:
|
||||||
if result['reason'] == 'versionTooOld':
|
if result['reason'] == 'versionTooOld':
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
@ -485,7 +486,7 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
self._last_buy_time) < 2.0:
|
self._last_buy_time) < 2.0:
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
else:
|
else:
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
account.show_sign_in_prompt()
|
account.show_sign_in_prompt()
|
||||||
else:
|
else:
|
||||||
self._last_buy_time = curtime
|
self._last_buy_time = curtime
|
||||||
@ -499,9 +500,9 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
self._do_purchase_check('pro' if get_available_sale_time(
|
self._do_purchase_check('pro' if get_available_sale_time(
|
||||||
'extras') is None else 'pro_sale')
|
'extras') is None else 'pro_sale')
|
||||||
else:
|
else:
|
||||||
price = _ba.get_v1_account_misc_read_val(
|
price = ba.internal.get_v1_account_misc_read_val(
|
||||||
'price.' + item, None)
|
'price.' + item, None)
|
||||||
our_tickets = _ba.get_v1_account_ticket_count()
|
our_tickets = ba.internal.get_v1_account_ticket_count()
|
||||||
if price is not None and our_tickets < price:
|
if price is not None and our_tickets < price:
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
getcurrency.show_get_tickets_prompt()
|
getcurrency.show_get_tickets_prompt()
|
||||||
@ -540,7 +541,7 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
if not self._root_widget:
|
if not self._root_widget:
|
||||||
return
|
return
|
||||||
import datetime
|
import datetime
|
||||||
sales_raw = _ba.get_v1_account_misc_read_val('sales', {})
|
sales_raw = ba.internal.get_v1_account_misc_read_val('sales', {})
|
||||||
sales = {}
|
sales = {}
|
||||||
try:
|
try:
|
||||||
# Look at the current set of sales; filter any with time remaining.
|
# Look at the current set of sales; filter any with time remaining.
|
||||||
@ -561,7 +562,7 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
if b_type in ['upgrades.pro', 'pro']:
|
if b_type in ['upgrades.pro', 'pro']:
|
||||||
purchased = _ba.app.accounts_v1.have_pro()
|
purchased = _ba.app.accounts_v1.have_pro()
|
||||||
else:
|
else:
|
||||||
purchased = _ba.get_purchased(b_type)
|
purchased = ba.internal.get_purchased(b_type)
|
||||||
|
|
||||||
sale_opacity = 0.0
|
sale_opacity = 0.0
|
||||||
sale_title_text: str | ba.Lstr = ''
|
sale_title_text: str | ba.Lstr = ''
|
||||||
@ -587,10 +588,10 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
if b_type in ['upgrades.pro', 'pro']:
|
if b_type in ['upgrades.pro', 'pro']:
|
||||||
sale_time = get_available_sale_time('extras')
|
sale_time = get_available_sale_time('extras')
|
||||||
if sale_time is not None:
|
if sale_time is not None:
|
||||||
priceraw = _ba.get_price('pro')
|
priceraw = ba.internal.get_price('pro')
|
||||||
price_text_left = (priceraw
|
price_text_left = (priceraw
|
||||||
if priceraw is not None else '?')
|
if priceraw is not None else '?')
|
||||||
priceraw = _ba.get_price('pro_sale')
|
priceraw = ba.internal.get_price('pro_sale')
|
||||||
price_text_right = (priceraw
|
price_text_right = (priceraw
|
||||||
if priceraw is not None else '?')
|
if priceraw is not None else '?')
|
||||||
sale_opacity = 1.0
|
sale_opacity = 1.0
|
||||||
@ -601,20 +602,20 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
centi=False,
|
centi=False,
|
||||||
timeformat=ba.TimeFormat.MILLISECONDS)
|
timeformat=ba.TimeFormat.MILLISECONDS)
|
||||||
else:
|
else:
|
||||||
priceraw = _ba.get_price('pro')
|
priceraw = ba.internal.get_price('pro')
|
||||||
price_text = priceraw if priceraw is not None else '?'
|
price_text = priceraw if priceraw is not None else '?'
|
||||||
price_text_left = ''
|
price_text_left = ''
|
||||||
price_text_right = ''
|
price_text_right = ''
|
||||||
else:
|
else:
|
||||||
price = _ba.get_v1_account_misc_read_val(
|
price = ba.internal.get_v1_account_misc_read_val(
|
||||||
'price.' + b_type, 0)
|
'price.' + b_type, 0)
|
||||||
|
|
||||||
# Color the button differently if we cant afford this.
|
# Color the button differently if we cant afford this.
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
if _ba.get_v1_account_ticket_count() < price:
|
if ba.internal.get_v1_account_ticket_count() < price:
|
||||||
color = (0.6, 0.61, 0.6)
|
color = (0.6, 0.61, 0.6)
|
||||||
price_text = ba.charstr(ba.SpecialChar.TICKET) + str(
|
price_text = ba.charstr(ba.SpecialChar.TICKET) + str(
|
||||||
_ba.get_v1_account_misc_read_val(
|
ba.internal.get_v1_account_misc_read_val(
|
||||||
'price.' + b_type, '?'))
|
'price.' + b_type, '?'))
|
||||||
price_text_left = ''
|
price_text_left = ''
|
||||||
price_text_right = ''
|
price_text_right = ''
|
||||||
@ -1064,7 +1065,7 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.account import show_sign_in_prompt
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
from bastd.ui.getcurrency import GetCurrencyWindow
|
from bastd.ui.getcurrency import GetCurrencyWindow
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
self._save_state()
|
self._save_state()
|
||||||
|
|||||||
@ -7,6 +7,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any, Sequence, Callable
|
from typing import Any, Sequence, Callable
|
||||||
@ -197,7 +198,7 @@ class StoreButton:
|
|||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.account import show_sign_in_prompt
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
from bastd.ui.store.browser import StoreBrowserWindow
|
from bastd.ui.store.browser import StoreBrowserWindow
|
||||||
if _ba.get_v1_account_state() != 'signed_in':
|
if ba.internal.get_v1_account_state() != 'signed_in':
|
||||||
show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
StoreBrowserWindow(modal=True, origin_widget=self._button)
|
StoreBrowserWindow(modal=True, origin_widget=self._button)
|
||||||
@ -216,9 +217,9 @@ class StoreButton:
|
|||||||
return # Our instance may outlive our UI objects.
|
return # Our instance may outlive our UI objects.
|
||||||
|
|
||||||
if self._ticket_text is not None:
|
if self._ticket_text is not None:
|
||||||
if _ba.get_v1_account_state() == 'signed_in':
|
if ba.internal.get_v1_account_state() == 'signed_in':
|
||||||
sval = ba.charstr(SpecialChar.TICKET) + str(
|
sval = ba.charstr(SpecialChar.TICKET) + str(
|
||||||
_ba.get_v1_account_ticket_count())
|
ba.internal.get_v1_account_ticket_count())
|
||||||
else:
|
else:
|
||||||
sval = '-'
|
sval = '-'
|
||||||
ba.textwidget(edit=self._ticket_text, text=sval)
|
ba.textwidget(edit=self._ticket_text, text=sval)
|
||||||
@ -230,13 +231,13 @@ class StoreButton:
|
|||||||
# ..also look for new style sales.
|
# ..also look for new style sales.
|
||||||
if sale_time is None:
|
if sale_time is None:
|
||||||
import datetime
|
import datetime
|
||||||
sales_raw = _ba.get_v1_account_misc_read_val('sales', {})
|
sales_raw = ba.internal.get_v1_account_misc_read_val('sales', {})
|
||||||
sale_times = []
|
sale_times = []
|
||||||
try:
|
try:
|
||||||
# Look at the current set of sales; filter any with time
|
# Look at the current set of sales; filter any with time
|
||||||
# remaining that we don't own.
|
# remaining that we don't own.
|
||||||
for sale_item, sale_info in list(sales_raw.items()):
|
for sale_item, sale_info in list(sales_raw.items()):
|
||||||
if not _ba.get_purchased(sale_item):
|
if not ba.internal.get_purchased(sale_item):
|
||||||
to_end = (datetime.datetime.utcfromtimestamp(
|
to_end = (datetime.datetime.utcfromtimestamp(
|
||||||
sale_info['e']) -
|
sale_info['e']) -
|
||||||
datetime.datetime.utcnow()).total_seconds()
|
datetime.datetime.utcnow()).total_seconds()
|
||||||
|
|||||||
@ -5,7 +5,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
import ba
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -202,7 +201,7 @@ def instantiate_store_item_display(item_name: str,
|
|||||||
color=(1, 1, 1),
|
color=(1, 1, 1),
|
||||||
texture=ba.gettexture('ticketsMore')))
|
texture=ba.gettexture('ticketsMore')))
|
||||||
bonus_tickets = str(
|
bonus_tickets = str(
|
||||||
_ba.get_v1_account_misc_read_val('proBonusTickets', 100))
|
ba.internal.get_v1_account_misc_read_val('proBonusTickets', 100))
|
||||||
extra_texts.append(
|
extra_texts.append(
|
||||||
ba.textwidget(parent=parent_widget,
|
ba.textwidget(parent=parent_widget,
|
||||||
draw_controller=btn,
|
draw_controller=btn,
|
||||||
@ -270,11 +269,11 @@ def instantiate_store_item_display(item_name: str,
|
|||||||
|
|
||||||
# If we have a 'total-worth' item-id for this id, show that price so
|
# If we have a 'total-worth' item-id for this id, show that price so
|
||||||
# the user knows how much this is worth.
|
# the user knows how much this is worth.
|
||||||
total_worth_item = _ba.get_v1_account_misc_read_val('twrths',
|
total_worth_item = ba.internal.get_v1_account_misc_read_val(
|
||||||
{}).get(item_name)
|
'twrths', {}).get(item_name)
|
||||||
total_worth_price: str | None
|
total_worth_price: str | None
|
||||||
if total_worth_item is not None:
|
if total_worth_item is not None:
|
||||||
price = _ba.get_price(total_worth_item)
|
price = ba.internal.get_price(total_worth_item)
|
||||||
total_worth_price = (get_clean_price(price)
|
total_worth_price = (get_clean_price(price)
|
||||||
if price is not None else '??')
|
if price is not None else '??')
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.ui import popup
|
from bastd.ui import popup
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -349,13 +350,13 @@ class TournamentEntryWindow(popup.PopupWindow):
|
|||||||
if not self._running_query and (
|
if not self._running_query and (
|
||||||
(self._last_query_time is None) or (not self._have_valid_data) or
|
(self._last_query_time is None) or (not self._have_valid_data) or
|
||||||
(ba.time(ba.TimeType.REAL) - self._last_query_time > 30.0)):
|
(ba.time(ba.TimeType.REAL) - self._last_query_time > 30.0)):
|
||||||
_ba.tournament_query(args={
|
ba.internal.tournament_query(
|
||||||
'source':
|
args={
|
||||||
'entry window' if self._tournament_activity is None else
|
'source':
|
||||||
'retry entry window'
|
'entry window' if self._tournament_activity is None
|
||||||
},
|
else 'retry entry window'
|
||||||
callback=ba.WeakCall(
|
},
|
||||||
self._on_tournament_query_response))
|
callback=ba.WeakCall(self._on_tournament_query_response))
|
||||||
self._last_query_time = ba.time(ba.TimeType.REAL)
|
self._last_query_time = ba.time(ba.TimeType.REAL)
|
||||||
self._running_query = True
|
self._running_query = True
|
||||||
|
|
||||||
@ -376,7 +377,7 @@ class TournamentEntryWindow(popup.PopupWindow):
|
|||||||
timeformat=ba.TimeFormat.MILLISECONDS))
|
timeformat=ba.TimeFormat.MILLISECONDS))
|
||||||
|
|
||||||
# Keep price up-to-date and update the button with it.
|
# Keep price up-to-date and update the button with it.
|
||||||
self._purchase_price = _ba.get_v1_account_misc_read_val(
|
self._purchase_price = ba.internal.get_v1_account_misc_read_val(
|
||||||
self._purchase_price_name, None)
|
self._purchase_price_name, None)
|
||||||
|
|
||||||
ba.textwidget(
|
ba.textwidget(
|
||||||
@ -424,7 +425,7 @@ class TournamentEntryWindow(popup.PopupWindow):
|
|||||||
color=(0, 0.8, 0) if enabled else (0.4, 0.4, 0.4))
|
color=(0, 0.8, 0) if enabled else (0.4, 0.4, 0.4))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
t_str = str(_ba.get_v1_account_ticket_count())
|
t_str = str(ba.internal.get_v1_account_ticket_count())
|
||||||
except Exception:
|
except Exception:
|
||||||
t_str = '?'
|
t_str = '?'
|
||||||
if self._get_tickets_button:
|
if self._get_tickets_button:
|
||||||
@ -514,7 +515,7 @@ class TournamentEntryWindow(popup.PopupWindow):
|
|||||||
# Deny if we don't have enough tickets.
|
# Deny if we don't have enough tickets.
|
||||||
ticket_count: int | None
|
ticket_count: int | None
|
||||||
try:
|
try:
|
||||||
ticket_count = _ba.get_v1_account_ticket_count()
|
ticket_count = ba.internal.get_v1_account_ticket_count()
|
||||||
except Exception:
|
except Exception:
|
||||||
# FIXME: should add a ba.NotSignedInError we can use here.
|
# FIXME: should add a ba.NotSignedInError we can use here.
|
||||||
ticket_count = None
|
ticket_count = None
|
||||||
@ -527,15 +528,15 @@ class TournamentEntryWindow(popup.PopupWindow):
|
|||||||
cur_time = ba.time(ba.TimeType.REAL, ba.TimeFormat.MILLISECONDS)
|
cur_time = ba.time(ba.TimeType.REAL, ba.TimeFormat.MILLISECONDS)
|
||||||
self._last_ticket_press_time = cur_time
|
self._last_ticket_press_time = cur_time
|
||||||
assert isinstance(ticket_cost, int)
|
assert isinstance(ticket_cost, int)
|
||||||
_ba.in_game_purchase(self._purchase_name, ticket_cost)
|
ba.internal.in_game_purchase(self._purchase_name, ticket_cost)
|
||||||
|
|
||||||
self._entering = True
|
self._entering = True
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'ENTER_TOURNAMENT',
|
'type': 'ENTER_TOURNAMENT',
|
||||||
'fee': self._fee,
|
'fee': self._fee,
|
||||||
'tournamentID': self._tournament_id
|
'tournamentID': self._tournament_id
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
self._launch()
|
self._launch()
|
||||||
|
|
||||||
def _on_pay_with_ad_press(self) -> None:
|
def _on_pay_with_ad_press(self) -> None:
|
||||||
@ -568,7 +569,7 @@ class TournamentEntryWindow(popup.PopupWindow):
|
|||||||
|
|
||||||
# Make sure any transactions the ad added got locally applied
|
# Make sure any transactions the ad added got locally applied
|
||||||
# (rewards added, etc.).
|
# (rewards added, etc.).
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
|
|
||||||
# If we're already entering the tourney, ignore.
|
# If we're already entering the tourney, ignore.
|
||||||
if self._entering:
|
if self._entering:
|
||||||
@ -580,19 +581,19 @@ class TournamentEntryWindow(popup.PopupWindow):
|
|||||||
# This should have awarded us the tournament_entry_ad purchase;
|
# This should have awarded us the tournament_entry_ad purchase;
|
||||||
# make sure that's present.
|
# make sure that's present.
|
||||||
# (otherwise the server will ignore our tournament entry anyway)
|
# (otherwise the server will ignore our tournament entry anyway)
|
||||||
if not _ba.get_purchased('tournament_entry_ad'):
|
if not ba.internal.get_purchased('tournament_entry_ad'):
|
||||||
print('no tournament_entry_ad purchase present in _on_ad_complete')
|
print('no tournament_entry_ad purchase present in _on_ad_complete')
|
||||||
ba.screenmessage(ba.Lstr(resource='errorText'), color=(1, 0, 0))
|
ba.screenmessage(ba.Lstr(resource='errorText'), color=(1, 0, 0))
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
return
|
return
|
||||||
|
|
||||||
self._entering = True
|
self._entering = True
|
||||||
_ba.add_transaction({
|
ba.internal.add_transaction({
|
||||||
'type': 'ENTER_TOURNAMENT',
|
'type': 'ENTER_TOURNAMENT',
|
||||||
'fee': 'ad',
|
'fee': 'ad',
|
||||||
'tournamentID': self._tournament_id
|
'tournamentID': self._tournament_id
|
||||||
})
|
})
|
||||||
_ba.run_transactions()
|
ba.internal.run_transactions()
|
||||||
self._launch()
|
self._launch()
|
||||||
|
|
||||||
def _on_get_tickets_press(self) -> None:
|
def _on_get_tickets_press(self) -> None:
|
||||||
@ -614,9 +615,10 @@ class TournamentEntryWindow(popup.PopupWindow):
|
|||||||
# button if it looks like we're waiting on a purchase or entering
|
# button if it looks like we're waiting on a purchase or entering
|
||||||
# the tournament.
|
# the tournament.
|
||||||
if ((ba.time(ba.TimeType.REAL, ba.TimeFormat.MILLISECONDS) -
|
if ((ba.time(ba.TimeType.REAL, ba.TimeFormat.MILLISECONDS) -
|
||||||
self._last_ticket_press_time < 6000) and
|
self._last_ticket_press_time < 6000)
|
||||||
(_ba.have_outstanding_transactions()
|
and (ba.internal.have_outstanding_transactions()
|
||||||
or _ba.get_purchased(self._purchase_name) or self._entering)):
|
or ba.internal.get_purchased(self._purchase_name)
|
||||||
|
or self._entering)):
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
return
|
return
|
||||||
self._transition_out()
|
self._transition_out()
|
||||||
|
|||||||
@ -6,8 +6,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
from bastd.ui import popup as popup_ui
|
from bastd.ui import popup as popup_ui
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -99,13 +99,13 @@ class TournamentScoresWindow(popup_ui.PopupWindow):
|
|||||||
ba.containerwidget(edit=self.root_widget,
|
ba.containerwidget(edit=self.root_widget,
|
||||||
cancel_button=self._cancel_button)
|
cancel_button=self._cancel_button)
|
||||||
|
|
||||||
_ba.tournament_query(args={
|
ba.internal.tournament_query(args={
|
||||||
'tournamentIDs': [tournament_id],
|
'tournamentIDs': [tournament_id],
|
||||||
'numScores': 50,
|
'numScores': 50,
|
||||||
'source': 'scores window'
|
'source': 'scores window'
|
||||||
},
|
},
|
||||||
callback=ba.WeakCall(
|
callback=ba.WeakCall(
|
||||||
self._on_tournament_query_response))
|
self._on_tournament_query_response))
|
||||||
|
|
||||||
def _on_tournament_query_response(self,
|
def _on_tournament_query_response(self,
|
||||||
data: dict[str, Any] | None) -> None:
|
data: dict[str, Any] | None) -> None:
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
namespace ballistica {
|
namespace ballistica {
|
||||||
|
|
||||||
// These are set automatically via script; don't modify them here.
|
// These are set automatically via script; don't modify them here.
|
||||||
const int kAppBuildNumber = 20762;
|
const int kAppBuildNumber = 20764;
|
||||||
const char* kAppVersion = "1.7.7";
|
const char* kAppVersion = "1.7.7";
|
||||||
|
|
||||||
// Our standalone globals.
|
// Our standalone globals.
|
||||||
|
|||||||
@ -752,16 +752,27 @@ def _dummy_module_dirty(mname: str) -> tuple[bool, str]:
|
|||||||
|
|
||||||
def update(projroot: str, check: bool, force: bool) -> None:
|
def update(projroot: str, check: bool, force: bool) -> None:
|
||||||
"""Update dummy-modules as needed."""
|
"""Update dummy-modules as needed."""
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from efrotools import getconfig
|
||||||
|
|
||||||
toolsdir = os.path.abspath(os.path.join(projroot, 'tools'))
|
toolsdir = os.path.abspath(os.path.join(projroot, 'tools'))
|
||||||
|
|
||||||
# Make sure we're running from the project root dir.
|
# Make sure we're running from the project root dir.
|
||||||
os.chdir(projroot)
|
os.chdir(projroot)
|
||||||
|
|
||||||
|
public = getconfig(Path('.'))['public']
|
||||||
|
|
||||||
# Force makes no sense in check mode.
|
# Force makes no sense in check mode.
|
||||||
if force and check:
|
if force and check:
|
||||||
raise Exception('cannot specify both force and check mode')
|
raise Exception('cannot specify both force and check mode')
|
||||||
|
|
||||||
for mname in ('_ba', '_bainternal'):
|
for mname in ('_ba', '_bainternal'):
|
||||||
|
# Skip internal module in public since it might
|
||||||
|
# not exist and is read-only anyway.
|
||||||
|
if mname == '_ba' and public:
|
||||||
|
continue
|
||||||
|
|
||||||
outfilename = os.path.abspath(
|
outfilename = os.path.abspath(
|
||||||
os.path.join(projroot, f'assets/src/ba_data/python/{mname}.py'))
|
os.path.join(projroot, f'assets/src/ba_data/python/{mname}.py'))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user