diff --git a/config.toml b/config.toml index 2e5fac1..ed5a203 100644 --- a/config.toml +++ b/config.toml @@ -67,12 +67,11 @@ party_name = "BombSquad Community Server" # (see below). #session_type = "ffa" -# Playlist-code for teams or free-for-all mode sessions. -# To host your own custom playlists, use the 'share' functionality in the -# playlist editor in the regular version of the game. -# This will give you a numeric code you can enter here to host that -# playlist. -playlist_code = 12345 +# Playlist-code for teams or free-for-all mode sessions. To host +# your own custom playlists, use the 'share' functionality in the +# playlist editor in the regular version of the game. This will give +# you a numeric code you can enter here to host that playlist. +#playlist_code = 12345 # Alternately, you can embed playlist data here instead of using # codes. Make sure to set session_type to the correct type for the @@ -107,7 +106,7 @@ playlist_code = 12345 # Series length in teams mode (7 == 'best-of-7' series; a team must # get 4 wins) -teams_series_length = 7 +#teams_series_length = 7 # Points to win in free-for-all mode (Points are awarded per game # based on performance) @@ -167,3 +166,10 @@ team_colors = [[0.8, 0.0, 0.6], [0, 1, 0.8]] # before rejoining the game. This can help suppress exploits # involving leaving and rejoining or switching teams rapidly. #player_rejoin_cooldown = 10.0 + +# Log levels for particular loggers, overriding the engine's +# defaults. Valid values are NOTSET, DEBUG, INFO, WARNING, ERROR, or +# CRITICAL. +#[log_levels] +#"ba.lifecycle" = "INFO" +#"ba.assets" = "INFO" \ No newline at end of file diff --git a/dist/ba_root/mods/custom_hooks.py b/dist/ba_root/mods/custom_hooks.py index b536090..3461b58 100644 --- a/dist/ba_root/mods/custom_hooks.py +++ b/dist/ba_root/mods/custom_hooks.py @@ -21,6 +21,8 @@ from typing import TYPE_CHECKING import babase import bascenev1 as bs +import _bascenev1 +from baclassic._appmode import ClassicAppMode import bauiv1 as bui import setting from baclassic._servermode import ServerController @@ -130,11 +132,6 @@ def bootstraping(): """Bootstarps the server.""" logging.warning("Bootstraping mods...") # server related - # _bascenev1.set_server_name(settings["HostName"]) - # _bascenev1.set_transparent_kickvote(settings["ShowKickVoteStarterName"]) - # _bascenev1.set_kickvote_msg_type(settings["KickVoteMsgType"]) - # bs.hide_player_device_id(settings["Anti-IdRevealer"]) TODO add call in - # cpp # check for auto update stats _thread.start_new_thread(mystats.refreshStats, ()) @@ -417,3 +414,25 @@ def wrap_player_spaz_init(original_class): playerspaz.PlayerSpaz = wrap_player_spaz_init(playerspaz.PlayerSpaz) + +original_classic_app_mode_activate = ClassicAppMode.on_activate + + +def new_classic_app_mode_activate(*args, **kwargs): + # Call the original function + result = original_classic_app_mode_activate(*args, **kwargs) + + # Perform additional actions after the original function call + on_classic_app_mode_active() + + return result + + +ClassicAppMode.on_activate = new_classic_app_mode_activate + + +def on_classic_app_mode_active(): + _bascenev1.set_server_name(settings["HostName"]) + _bascenev1.set_transparent_kickvote(settings["ShowKickVoteStarterName"]) + _bascenev1.set_kickvote_msg_type(settings["KickVoteMsgType"]) + _bascenev1.hide_player_device_id(settings["Anti-IdRevealer"]) diff --git a/dist/ba_root/mods/plugins/bcs_plugin.py b/dist/ba_root/mods/plugins/bcs_plugin.py index 9103886..0e419a7 100644 --- a/dist/ba_root/mods/plugins/bcs_plugin.py +++ b/dist/ba_root/mods/plugins/bcs_plugin.py @@ -11,6 +11,7 @@ from functools import wraps from threading import Thread import _babase +import _bascenev1 from flask import Flask, request, jsonify # import uvicorn @@ -42,7 +43,7 @@ def check_admin(func): @wraps(func) def wrapper(*args, **kwargs): if "Secret-Key" not in request.headers or request.headers[ - "Secret-Key"] != SECRET_KEY: + "Secret-Key"] != SECRET_KEY: return jsonify({"message": "Invalid secret key provided."}), 401 return func(*args, **kwargs) @@ -277,7 +278,7 @@ def update_server_config(): def run_server(): from waitress import serve - serve(app, host="0.0.0.0", port=_babase.get_game_port()) + serve(app, host="0.0.0.0", port=_bascenev1.get_game_port()) def enable(password): diff --git a/dist/ba_root/mods/plugins/bombsquad_service.py b/dist/ba_root/mods/plugins/bombsquad_service.py index 2711afb..8db5b7e 100644 --- a/dist/ba_root/mods/plugins/bombsquad_service.py +++ b/dist/ba_root/mods/plugins/bombsquad_service.py @@ -32,7 +32,7 @@ class BsDataThread(object): stats["vapidKey"] = notification_manager.get_vapid_keys()["public_key"] self.refresh_stats_cache_timer = bs.AppTimer(8, babase.Call( - self.refreshStats) , repeat=True) + self.refreshStats), repeat=True) self.refresh_leaderboard_cache_timer = bs.AppTimer(10, babase.Call( self.refreshLeaderboard), repeat=True) @@ -116,7 +116,8 @@ class BsDataThread(object): return data -BsDataThread() +v = bs.AppTimer(5, babase.Call( + BsDataThread)) def get_stats(): @@ -191,7 +192,7 @@ def search_player_profile(search_key: str, db: str): if (search_key == key or any(search_key.lower() in s.lower() for s in selectedDB[key].get("display_string", [])) or - search_key.lower() in selectedDB[key].get("name", "").lower()): + search_key.lower() in selectedDB[key].get("name", "").lower()): matching_objects[key] = selectedDB[key] count += 1 if count > 50: @@ -216,15 +217,15 @@ def get_player_details(account_id: str): isBanned = True extra_info += " , Banned for > " + haveBanReason if account_id in pdata.get_blacklist()[ - "muted-ids"] and current_time < datetime.strptime( - pdata.get_blacklist()["muted-ids"][account_id]["till"], - "%Y-%m-%d %H:%M:%S"): + "muted-ids"] and current_time < datetime.strptime( + pdata.get_blacklist()["muted-ids"][account_id]["till"], + "%Y-%m-%d %H:%M:%S"): isMuted = True extra_info += f', Muted for > {pdata.get_blacklist()["muted-ids"][account_id]["reason"]} , till > {pdata.get_blacklist()["muted-ids"][account_id]["till"]} ,' if account_id in pdata.get_blacklist()[ - "kick-vote-disabled"] and current_time < datetime.strptime( - pdata.get_blacklist()["kick-vote-disabled"][account_id]["till"], - "%Y-%m-%d %H:%M:%S"): + "kick-vote-disabled"] and current_time < datetime.strptime( + pdata.get_blacklist()["kick-vote-disabled"][account_id]["till"], + "%Y-%m-%d %H:%M:%S"): isKickVoteDisabled = True extra_info += f', Kick vote disabled for > {pdata.get_blacklist()["kick-vote-disabled"][account_id]["reason"]} , till > {pdata.get_blacklist()["kick-vote-disabled"][account_id]["till"]} ' diff --git a/dist/ba_root/mods/spazmod/tag.py b/dist/ba_root/mods/spazmod/tag.py index 6369903..84679ce 100644 --- a/dist/ba_root/mods/spazmod/tag.py +++ b/dist/ba_root/mods/spazmod/tag.py @@ -48,7 +48,6 @@ def addhp(node, spaz): position=(0, 1.75, 0), shad=1.4) else: spaz.hptimer = None - spaz.hptimer = bs.Timer(2, babase.Call( showHP), repeat=True)