From bfb5d25467329e355183efeac7211a7a91778ae6 Mon Sep 17 00:00:00 2001 From: brostosjoined Date: Mon, 22 Jan 2024 12:06:37 +0300 Subject: [PATCH] ^->8 --- plugins/minigames.json | 126 ++++------------------ plugins/minigames/hot_potato.py | 20 ++-- plugins/minigames/ultimate_last_stand.py | 2 +- plugins/utilities.json | 119 +++----------------- plugins/utilities/auto_stunt.py | 37 ++++--- plugins/utilities/discord_richpresence.py | 20 ++-- 6 files changed, 80 insertions(+), 244 deletions(-) diff --git a/plugins/minigames.json b/plugins/minigames.json index ad0b475..5f3b9e2 100644 --- a/plugins/minigames.json +++ b/plugins/minigames.json @@ -77,12 +77,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "3b55e82dc1c1d4d84760c23098233e30" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "2fda676", @@ -102,12 +97,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "74d61a487379d163c3f5713f001ec69d" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "2fda676", @@ -127,12 +117,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "25f9018fdc70173212e436d4e7c41e97" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "2fda676", @@ -152,12 +137,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "4630220820b08642e9c72f9f24675298" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "2fda676", @@ -202,12 +182,7 @@ } ], "versions": { - "1.1.0": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "6c90c97151c31d240a760590c56d7dbf" - }, + "1.1.0": null, "1.0.1": { "api_version": 7, "commit_sha": "d511c15", @@ -233,12 +208,7 @@ } ], "versions": { - "2.0.1": { - "api_version": 8, - "commit_sha": "184c2a1", - "released_on": "21-01-2024", - "md5sum": "e83ad2929caf883c24e2e81c93c39d4f" - }, + "2.0.1": null, "2.0.0": { "api_version": 7, "commit_sha": "8b257b3", @@ -364,12 +334,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "48f0768fe1715825e61c66f78dde51c4" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "0841b9e", @@ -419,12 +384,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "3730cdc9f922ac5a8c86e2c7debd09fe" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "52094fc", @@ -469,12 +429,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "a1d2d75303aaeb0b078a4c836d65ebee" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "2aa1e50", @@ -494,12 +449,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "038ef74", - "released_on": "21-01-2024", - "md5sum": "aa03952868be8e978d7b23891883b52a" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "2aa1e50", @@ -519,12 +469,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "3a99f089fda47e034b16e7fa086ee051" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "2aa1e50", @@ -544,12 +489,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "627390f50e18bd76d94abf35f538ec8f" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "52094fc", @@ -660,12 +600,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "7e741a7f4c1ace1124d8719a009f8948" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "7219487", @@ -685,12 +620,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "270961a492432e6199dec2d0915d8acf" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "7219487", @@ -710,12 +640,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "3fb424583f1e686854fe94bd22c5161c" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "7219487", @@ -735,12 +660,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "7e70fb037b49b183a9fb4eaa2babb90e" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "7219487", @@ -760,12 +680,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "febeeb370ac150f455ed27bc9d557d75" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "7219487", @@ -804,12 +719,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "5422dd6", - "released_on": "18-01-2024", - "md5sum": "82ffbb28961c57731bd64d4c4add06cd" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "7219487", diff --git a/plugins/minigames/hot_potato.py b/plugins/minigames/hot_potato.py index 6a57eda..658f440 100644 --- a/plugins/minigames/hot_potato.py +++ b/plugins/minigames/hot_potato.py @@ -92,7 +92,7 @@ class Icon(bs.Actor): self._player = player self._name_scale = name_scale - self._outline_tex = bui.gettexture('characterIconMask') + self._outline_tex = bs.gettexture('characterIconMask') # Character portrait icon = player.get_icon() @@ -640,16 +640,16 @@ class HotPotato(bs.TeamGameActivity[Player, bs.Team]): self.settings = settings # Let's define all of the sounds we need. - self._tick_sound = bui.getsound('tick') - self._player_eliminated_sound = bui.getsound('playerDeath') + self._tick_sound = bs.getsound('tick') + self._player_eliminated_sound = bs.getsound('playerDeath') # These next sounds are arrays instead of single sounds. # We'll use that fact later. - self._danger_tick_sounds = [bui.getsound('orchestraHit'), - bui.getsound('orchestraHit2'), - bui.getsound('orchestraHit3')] - self._marked_sounds = [bui.getsound('powerdown01'), - bui.getsound('activateBeep'), - bui.getsound('hiss')] + self._danger_tick_sounds = [bs.getsound('orchestraHit'), + bs.getsound('orchestraHit2'), + bs.getsound('orchestraHit3')] + self._marked_sounds = [bs.getsound('powerdown01'), + bs.getsound('activateBeep'), + bs.getsound('hiss')] # Normally play KOTH music, but switch to Epic music if we're in slow motion. self._epic_mode = bool(settings['Epic Mode']) @@ -837,7 +837,7 @@ class HotPotato(bs.TeamGameActivity[Player, bs.Team]): # To make a nice marked sound effect, I play multiple sounds at once # All of them are contained in the array. for sound in self._marked_sounds: - sound.play(1.0, new_victim.actor.node.position) + bs.Sound.play(sound, 1.0, new_victim.actor.node.position) self.mark(new_victim) # This function is called when the gamemode first loads. diff --git a/plugins/minigames/ultimate_last_stand.py b/plugins/minigames/ultimate_last_stand.py index cff9526..67f36cf 100644 --- a/plugins/minigames/ultimate_last_stand.py +++ b/plugins/minigames/ultimate_last_stand.py @@ -362,7 +362,7 @@ class UltimateLastStand(bs.TeamGameActivity[Player, Team]): def on_transition_in(self) -> None: super().on_transition_in() - bs.timer(1.3, babase.Call(babase.playsound, self._new_wave_sound)) + bs.timer(1.3, self._new_wave_sound.play) def on_player_join(self, player: Player) -> None: player.lives = self._lives_per_player diff --git a/plugins/utilities.json b/plugins/utilities.json index a070a10..5404ffd 100644 --- a/plugins/utilities.json +++ b/plugins/utilities.json @@ -19,12 +19,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "f81810220b0cc13cc436434014fbe8de" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "2454845", @@ -63,12 +58,7 @@ } ], "versions": { - "1.3.2": { - "api_version": 8, - "commit_sha": "284055e", - "released_on": "21-01-2024", - "md5sum": "1cf2d07d15dbacf0a277795f3742c14b" - }, + "1.3.2": null, "1.3.1": { "api_version": 7, "commit_sha": "d511c15", @@ -118,12 +108,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "beab6387e86bd842ffc8c857750b510e" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "2fda676", @@ -143,12 +128,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "80f8fd9e9bd23d33daace0059029378b" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "2fda676", @@ -168,12 +148,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "a0bff95", - "released_on": "20-01-2024", - "md5sum": "6eb01543b28a9a2c95f873aa92dbe3b2" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "2fda676", @@ -193,12 +168,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "ee8187a63d9e205f0355aa5c21141af2" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "fed7c24", @@ -223,12 +193,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "ee666a289e34c7ceca1d64ed977de4ce" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "2fda676", @@ -248,12 +213,7 @@ } ], "versions": { - "1.2.3": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "6601d41f60b276d54770c0718158e701" - }, + "1.2.3": null, "1.2.2": { "api_version": 7, "commit_sha": "7753b87", @@ -518,12 +478,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "68340cb74a1227c70045e26bb1d1e859" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "6acdea8", @@ -742,12 +697,7 @@ } ], "versions": { - "3.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "697f1204f7722f27f2bdbbff3994763c" - }, + "3.0.1": null, "3.0.0": { "api_version": 7, "commit_sha": "0841b9e", @@ -767,12 +717,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "7b1dd1432930e6dc198780a134b88c88" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "0841b9e", @@ -792,12 +737,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "7313a54c35611e9d8f7d0854b6646bc7" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "0841b9e", @@ -817,12 +757,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "bb75b79a749f26ed359e0fc99f23a958" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "800125c", @@ -897,12 +832,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "c472b9ba7be0a1f109a757c1c06b25cd" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "cb2d952", @@ -922,12 +852,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "264b14d7ec65453b74d4680d507fcb4f" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "05ffa9f", @@ -947,12 +872,7 @@ } ], "versions": { - "1.0.1": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "d4b1c74d4c6e6f893f0b50c4f863720e" - }, + "1.0.1": null, "1.0.0": { "api_version": 7, "commit_sha": "3221b3a", @@ -1028,12 +948,7 @@ } ], "versions": { - "1.4.2": { - "api_version": 8, - "commit_sha": "87b302a", - "released_on": "18-01-2024", - "md5sum": "f60a0fd81c5a367e644a7b9c123af662" - }, + "1.4.2": null, "1.4.1": { "api_version": 8, "commit_sha": "48c8abb", diff --git a/plugins/utilities/auto_stunt.py b/plugins/utilities/auto_stunt.py index c060ff2..57603fb 100644 --- a/plugins/utilities/auto_stunt.py +++ b/plugins/utilities/auto_stunt.py @@ -20,6 +20,7 @@ from bascenev1lib.gameutils import SharedObjects from bascenev1lib.actor.powerupbox import PowerupBoxFactory from bascenev1lib.actor.spazfactory import SpazFactory from bascenev1lib.game.elimination import EliminationGame +from bauiv1lib import mainmenu import math import json import os @@ -246,7 +247,7 @@ def mirror(clieid): def capture(player): - with babase.ContextRef(player.actor._activity()): + with player.actor._activity().context: player.recording_start_time = bs.time() PLAYERS_STUNT_INFO[player.sessionplayer] = [] @@ -272,7 +273,7 @@ def replay(player, stunt_name): bui.screenmessage(f"{stunt_name} doesn't exists") return player.in_replay = True - with babase.ContextRef(player.actor._activity()): + with player.actor._activity().context: ControlsUI.display(player.actor._activity()) for move in stunt: value = move["move"]["value"] @@ -294,7 +295,7 @@ def replay(player, stunt_name): def spawn_mirror_spaz(player): player.mirror_mode = True - with babase.ContextRef(player.actor._activity()): + with player.actor._activity().context: bot = spaz.Spaz(player.color, player.highlight, character=player.character).autoretain() bot.handlemessage(bs.StandMessage( (player.actor.node.position[0], player.actor.node.position[1], player.actor.node.position[2]+1), 93)) @@ -317,7 +318,7 @@ def ghost(player, stunt_name): return player.in_replay = True - with babase.ContextRef(player.actor._activity()): + with player.actor._activity().context: bot = spaz.Spaz((1, 0, 0), character="Spaz").autoretain() bot.handlemessage(bs.StandMessage(player.actor.node.position, 93)) give_ghost_power(bot) @@ -389,6 +390,7 @@ def give_ghost_power(spaz): def new_chatmessage(msg): + #! Fix here to make it work with other mods modifying chat message if not msg.startswith("*"): return original_chatmessage(msg) @@ -397,7 +399,11 @@ def new_chatmessage(msg): command = msg_splits[0] client_id = -1 - player = get_player_from_client_id(client_id) + try: + player = get_player_from_client_id(client_id) + except AttributeError: + bui.screenmessage("Start a game to use", color=(0, 1, 0)) + return if command == "start": capture(player) @@ -477,25 +483,25 @@ def set_stick_image_position(self, x: float, y: float) -> None: def on_begin(self, *args, **kwargs) -> None: self._jump_image = Image( - bui.gettexture('buttonJump'), + bs.gettexture('buttonJump'), position=(385, 160), scale=(50, 50), color=[0.1, 0.45, 0.1, 0] ) self._pickup_image = Image( - bui.gettexture('buttonPickUp'), + bs.gettexture('buttonPickUp'), position=(385, 240), scale=(50, 50), color=[0, 0.35, 0, 0] ) self._punch_image = Image( - bui.gettexture('buttonPunch'), + bs.gettexture('buttonPunch'), position=(345, 200), scale=(50, 50), color=[0.45, 0.45, 0, 0] ) self._bomb_image = Image( - bui.gettexture('buttonBomb'), + bs.gettexture('buttonBomb'), position=(425, 200), scale=(50, 50), color=[0.45, 0.1, 0.1, 0] @@ -506,7 +512,7 @@ def on_begin(self, *args, **kwargs) -> None: self._stick_base_image = bs.newnode( 'image', attrs={ - 'texture': bui.gettexture('nub'), + 'texture': bs.gettexture('nub'), 'absolute_scale': True, 'vr_depth': -40, 'position': p, @@ -517,7 +523,7 @@ def on_begin(self, *args, **kwargs) -> None: self._stick_nub_image_color = c3 = (0.4, 0.4, 0.4, 1.0) self._stick_nub_image = bs.newnode('image', attrs={ - 'texture': bui.gettexture('nub'), + 'texture': bs.gettexture('nub'), 'absolute_scale': True, 'position': p, 'scale': (110*0.6, 110*0.66), @@ -528,11 +534,16 @@ def on_begin(self, *args, **kwargs) -> None: self.set_stick_image_position = set_stick_image_position return original_on_begin(self, *args, **kwargs) - +class NewMainMenuWindow(mainmenu.MainMenuWindow): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + # Display chat icon, but if user open/close gather it may disappear + bui.set_party_icon_always_visible(True) + # ba_meta export plugin class byHeySmoothy(babase.Plugin): def on_app_running(self): - bui.set_party_icon_always_visible(True) + mainmenu.MainMenuWindow = NewMainMenuWindow bs._activity.Activity.on_begin = on_begin bs.chatmessage = new_chatmessage bascenev1lib.actor.playerspaz.PlayerSpaz = NewPlayerSpaz diff --git a/plugins/utilities/discord_richpresence.py b/plugins/utilities/discord_richpresence.py index 4980a05..7e01d2c 100644 --- a/plugins/utilities/discord_richpresence.py +++ b/plugins/utilities/discord_richpresence.py @@ -370,13 +370,13 @@ def get_event_loop(force_fresh=False): def _generate_join_secret(self): # resp = requests.get('https://legacy.ballistica.net/bsAccessCheck').text - connection_info = bs.get_connection_to_host_info( - ) if build_number < 21697 else bs.get_connection_to_host_info_2() - if connection_info: - addr = _last_server_addr - port = _last_server_port - else: - try: + try: + connection_info = bs.get_connection_to_host_info( + ) if build_number < 21727 else bs.get_connection_to_host_info_2() + if connection_info: + addr = _last_server_addr + port = _last_server_port + else: with urlopen( "https://legacy.ballistica.net/bsAccessCheck" ) as resp: @@ -390,8 +390,8 @@ def get_event_loop(force_fresh=False): "port": port, } self.join_secret = json.dumps(secret_dict) - except: - pass + except: + pass def _update_secret(self): threading.Thread(target=self._generate_join_secret, daemon=True).start() @@ -872,7 +872,7 @@ class DiscordRP(babase.Plugin): def update_status(self) -> None: roster = bs.get_game_roster() connection_info = bs.get_connection_to_host_info( - ) if build_number < 21697 else bs.get_connection_to_host_info_2() + ) if build_number < 21727 else bs.get_connection_to_host_info_2() self.rpc_thread.large_image_key = "bombsquadicon" self.rpc_thread.large_image_text = "BombSquad"