mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-10-20 00:00:39 +00:00
syncing mods change from #public-server branch
This commit is contained in:
parent
d6f12367a1
commit
16570cdcab
7 changed files with 168 additions and 9 deletions
7
.vscode/settings.json
vendored
Normal file
7
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"python.analysis.extraPaths": [
|
||||||
|
"./dist/ba_data/python",
|
||||||
|
"./dist/dummymodules",
|
||||||
|
"./dist/ba_data/python-site-packages"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -513,6 +513,11 @@ class ServerManagerApp:
|
||||||
f'{Clr.RED}Error loading config file:\n{exc}.{Clr.RST}',
|
f'{Clr.RED}Error loading config file:\n{exc}.{Clr.RST}',
|
||||||
flush=True,
|
flush=True,
|
||||||
)
|
)
|
||||||
|
with open(self._ba_root_path + "/mods/defaults/config.yaml", "r") as infile:
|
||||||
|
default_file = infile.read()
|
||||||
|
with open(self._config_path, "w") as outfile:
|
||||||
|
outfile.write(default_file)
|
||||||
|
print("config reset done")
|
||||||
if trynum == maxtries - 1:
|
if trynum == maxtries - 1:
|
||||||
print(
|
print(
|
||||||
f'{Clr.RED}Max-tries reached; giving up.'
|
f'{Clr.RED}Max-tries reached; giving up.'
|
||||||
|
|
@ -720,7 +725,7 @@ class ServerManagerApp:
|
||||||
|
|
||||||
# Some of our config values translate directly into the
|
# Some of our config values translate directly into the
|
||||||
# ballisticakit config file; the rest we pass at runtime.
|
# ballisticakit config file; the rest we pass at runtime.
|
||||||
bincfg['Port'] = self._config.port
|
bincfg['Port'] = int(os.environ.get('PORT', self._config.port))
|
||||||
bincfg['Auto Balance Teams'] = self._config.auto_balance_teams
|
bincfg['Auto Balance Teams'] = self._config.auto_balance_teams
|
||||||
bincfg['Show Tutorial'] = self._config.show_tutorial
|
bincfg['Show Tutorial'] = self._config.show_tutorial
|
||||||
|
|
||||||
|
|
|
||||||
6
dist/ba_data/python/baclassic/_servermode.py
vendored
6
dist/ba_data/python/baclassic/_servermode.py
vendored
|
|
@ -304,7 +304,11 @@ class ServerController:
|
||||||
) -> None:
|
) -> None:
|
||||||
if result is None:
|
if result is None:
|
||||||
print('Error fetching playlist; aborting.')
|
print('Error fetching playlist; aborting.')
|
||||||
sys.exit(-1)
|
print('Falling back to use default playlist.') #BCS
|
||||||
|
self._config.session_type = "teams"
|
||||||
|
self._prep_timer = None
|
||||||
|
babase.pushcall(self._launch_server_session)
|
||||||
|
return
|
||||||
|
|
||||||
# Once we get here, simply modify our config to use this playlist.
|
# Once we get here, simply modify our config to use this playlist.
|
||||||
typename = (
|
typename = (
|
||||||
|
|
|
||||||
134
dist/ba_root/mods/defaults/config.yaml
vendored
Normal file
134
dist/ba_root/mods/defaults/config.yaml
vendored
Normal file
|
|
@ -0,0 +1,134 @@
|
||||||
|
# To configure your server, create a config.yaml file in the same directory
|
||||||
|
# as the ballisticacore_server script. The config_template.yaml file can be
|
||||||
|
# copied or renamed as a convenient starting point.
|
||||||
|
|
||||||
|
# Uncomment any of these values to override defaults.
|
||||||
|
|
||||||
|
# Name of our server in the public parties list.
|
||||||
|
party_name: "BombSquad Community Server"
|
||||||
|
|
||||||
|
# If true, your party will show up in the global public party list
|
||||||
|
# Otherwise it will still be joinable via LAN or connecting by IP address.
|
||||||
|
#party_is_public: true
|
||||||
|
|
||||||
|
# If true, all connecting clients will be authenticated through the master
|
||||||
|
# server to screen for fake account info. Generally this should always
|
||||||
|
# be enabled unless you are hosting on a LAN with no internet connection.
|
||||||
|
authenticate_clients: true
|
||||||
|
|
||||||
|
# IDs of server admins. Server admins are not kickable through the default
|
||||||
|
# kick vote system and they are able to kick players without a vote. To get
|
||||||
|
# your account id, enter 'getaccountid' in settings->advanced->enter-code.
|
||||||
|
admins:
|
||||||
|
- pb-yOuRAccOuNtIdHErE
|
||||||
|
- pb-aNdMayBeAnotherHeRE
|
||||||
|
|
||||||
|
# Whether the default kick-voting system is enabled.
|
||||||
|
enable_default_kick_voting: true
|
||||||
|
|
||||||
|
# UDP port to host on. Change this to work around firewalls or run multiple
|
||||||
|
# servers on one machine.
|
||||||
|
# 43210 is the default and the only port that will show up in the LAN
|
||||||
|
# browser tab.
|
||||||
|
port: 43210
|
||||||
|
|
||||||
|
# Max devices in the party. Note that this does *NOT* mean max players.
|
||||||
|
# Any device in the party can have more than one player on it if they have
|
||||||
|
# multiple controllers. Also, this number currently includes the server so
|
||||||
|
# generally make it 1 bigger than you need. Max-players is not currently
|
||||||
|
# exposed but I'll try to add that soon.
|
||||||
|
max_party_size: 6
|
||||||
|
|
||||||
|
# Options here are 'ffa' (free-for-all), 'teams' and 'coop' (cooperative)
|
||||||
|
# This value is ignored if you supply a playlist_code (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
|
||||||
|
|
||||||
|
# Alternately, you can embed playlist data here instead of using codes.
|
||||||
|
# Make sure to set session_type to the correct type for the data here.
|
||||||
|
#playlist_inline: []
|
||||||
|
|
||||||
|
# Whether to shuffle the playlist or play its games in designated order.
|
||||||
|
#playlist_shuffle: true
|
||||||
|
|
||||||
|
# If true, keeps team sizes equal by disallowing joining the largest team
|
||||||
|
# (teams mode only).
|
||||||
|
#auto_balance_teams: true
|
||||||
|
|
||||||
|
# The campaign used when in co-op session mode.
|
||||||
|
# Do print(ba.app.campaigns) to see available campaign names.
|
||||||
|
#coop_campaign: Easy
|
||||||
|
|
||||||
|
# The level name within the campaign used in co-op session mode.
|
||||||
|
# For campaign name FOO, do print(ba.app.campaigns['FOO'].levels) to see
|
||||||
|
# available level names.
|
||||||
|
#coop_level: Onslaught Training
|
||||||
|
|
||||||
|
# Whether to enable telnet access.
|
||||||
|
# IMPORTANT: This option is no longer available, as it was being used
|
||||||
|
# for exploits. Live access to the running server is still possible through
|
||||||
|
# the mgr.cmd() function in the server script. Run your server through
|
||||||
|
# tools such as 'screen' or 'tmux' and you can reconnect to it remotely
|
||||||
|
# over a secure ssh connection.
|
||||||
|
#enable_telnet: false
|
||||||
|
|
||||||
|
# Series length in teams mode (7 == 'best-of-7' series; a team must
|
||||||
|
# get 4 wins)
|
||||||
|
teams_series_length: 7
|
||||||
|
|
||||||
|
# Points to win in free-for-all mode (Points are awarded per game based on
|
||||||
|
# performance)
|
||||||
|
ffa_series_length: 24
|
||||||
|
|
||||||
|
# If you have a custom stats webpage for your server, you can use this
|
||||||
|
# to provide a convenient in-game link to it in the server-browser
|
||||||
|
# alongside the server name.
|
||||||
|
# if ${ACCOUNT} is present in the string, it will be replaced by the
|
||||||
|
# currently-signed-in account's id. To fetch info about an account,
|
||||||
|
# your back-end server can use the following url:
|
||||||
|
# http://bombsquadgame.com/accountquery?id=ACCOUNT_ID_HERE
|
||||||
|
stats_url: https://discord.gg/ucyaesh
|
||||||
|
|
||||||
|
# If present, the server subprocess will attempt to gracefully exit after
|
||||||
|
# this amount of time. A graceful exit can occur at the end of a series
|
||||||
|
# or other opportune time. Server-managers set to auto-restart (the
|
||||||
|
# default) will then spin up a fresh subprocess. This mechanism can be
|
||||||
|
# useful to clear out any memory leaks or other accumulated bad state
|
||||||
|
# in the server subprocess.
|
||||||
|
#clean_exit_minutes: 60
|
||||||
|
|
||||||
|
# If present, the server subprocess will shut down immediately after this
|
||||||
|
# amount of time. This can be useful as a fallback for clean_exit_time.
|
||||||
|
# The server manager will then spin up a fresh server subprocess if
|
||||||
|
# auto-restart is enabled (the default).
|
||||||
|
#unclean_exit_minutes: 90
|
||||||
|
|
||||||
|
# If present, the server subprocess will shut down immediately if this
|
||||||
|
# amount of time passes with no activity from any players. The server
|
||||||
|
# manager will then spin up a fresh server subprocess if auto-restart is
|
||||||
|
# enabled (the default).
|
||||||
|
#idle_exit_minutes: 20
|
||||||
|
|
||||||
|
# Should the tutorial be shown at the beginning of games?
|
||||||
|
#show_tutorial: false
|
||||||
|
|
||||||
|
# Team names (teams mode only).
|
||||||
|
team_names:
|
||||||
|
- ladoo
|
||||||
|
- barfi
|
||||||
|
|
||||||
|
# Team colors (teams mode only).
|
||||||
|
team_colors:
|
||||||
|
- [0.8, 0.0, 0.6]
|
||||||
|
- [0, 1, 0.8]
|
||||||
|
|
||||||
|
# Whether to enable the queue where players can line up before entering
|
||||||
|
# your server. Disabling this can be used as a workaround to deal with
|
||||||
|
# queue spamming attacks.
|
||||||
|
#enable_queue: true
|
||||||
3
dist/ba_root/mods/playersdata/pdata.py
vendored
3
dist/ba_root/mods/playersdata/pdata.py
vendored
|
|
@ -7,7 +7,6 @@ from __future__ import annotations
|
||||||
|
|
||||||
import _thread
|
import _thread
|
||||||
import copy
|
import copy
|
||||||
import datetime
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
@ -76,7 +75,7 @@ def get_profiles() -> dict:
|
||||||
if CacheData.profiles == {}:
|
if CacheData.profiles == {}:
|
||||||
try:
|
try:
|
||||||
if os.stat(PLAYERS_DATA_PATH + "profiles.json").st_size > 1000000:
|
if os.stat(PLAYERS_DATA_PATH + "profiles.json").st_size > 1000000:
|
||||||
newpath = f'{PLAYERS_DATA_PATH}profiles-{str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))}.json'
|
newpath = f'{PLAYERS_DATA_PATH}profiles-{str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))}.json'
|
||||||
shutil.copyfile(PLAYERS_DATA_PATH + "profiles.json", newpath)
|
shutil.copyfile(PLAYERS_DATA_PATH + "profiles.json", newpath)
|
||||||
profiles = {"pb-sdf": {}}
|
profiles = {"pb-sdf": {}}
|
||||||
print("resetting profiles")
|
print("resetting profiles")
|
||||||
|
|
|
||||||
12
dist/ba_root/mods/setting.py
vendored
12
dist/ba_root/mods/setting.py
vendored
|
|
@ -6,6 +6,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import datetime
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
|
|
||||||
import _babase
|
import _babase
|
||||||
|
|
@ -44,7 +45,18 @@ def commit(data: dict) -> None:
|
||||||
data : dict
|
data : dict
|
||||||
data to be commited
|
data to be commited
|
||||||
"""
|
"""
|
||||||
|
if is_invalid_time_format(data['autoNightMode']['startTime']) or is_invalid_time_format(data['autoNightMode']['endTime']):
|
||||||
|
data['autoNightMode']['startTime'] = "18:30"
|
||||||
|
data['autoNightMode']['endTime'] = "6:30"
|
||||||
|
print("Invalid time setting , resetting night mode time")
|
||||||
with open(SETTINGS_PATH, mode="w", encoding="utf-8") as setting_file:
|
with open(SETTINGS_PATH, mode="w", encoding="utf-8") as setting_file:
|
||||||
json.dump(data, setting_file, indent=4)
|
json.dump(data, setting_file, indent=4)
|
||||||
# settings updated ok now update the cache
|
# settings updated ok now update the cache
|
||||||
refresh_cache()
|
refresh_cache()
|
||||||
|
|
||||||
|
def is_invalid_time_format(time_string, time_format='%H:%M'):
|
||||||
|
try:
|
||||||
|
datetime.datetime.strptime(time_string, time_format)
|
||||||
|
return False
|
||||||
|
except ValueError:
|
||||||
|
return True
|
||||||
|
|
@ -6,7 +6,7 @@ import shutil
|
||||||
import string
|
import string
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
date_format = '%Y-%m-%d %H:%M:%S'
|
||||||
import _babase
|
import _babase
|
||||||
import ecdsa
|
import ecdsa
|
||||||
|
|
||||||
|
|
@ -92,12 +92,10 @@ def subscribe(sub, account_id, name):
|
||||||
def player_joined(pb_id):
|
def player_joined(pb_id):
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
if pb_id in subscribed_players:
|
if pb_id in subscribed_players:
|
||||||
if "last_notification" in subscribed_players[pb_id] and (
|
if "last_notification" in subscribed_players[pb_id] and (now - datetime.strptime(subscribed_players[pb_id]["last_notification"], date_format)).seconds < 15 * 60:
|
||||||
now - subscribed_players[pb_id][
|
|
||||||
"last_notification"]).seconds < 15 * 60:
|
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
subscribed_players[pb_id]["last_notification"] = now
|
subscribed_players[pb_id]["last_notification"] = now.strftime(date_format)
|
||||||
subscribes = subscribed_players[pb_id]["subscribers"]
|
subscribes = subscribed_players[pb_id]["subscribers"]
|
||||||
for subscriber_id in subscribes:
|
for subscriber_id in subscribes:
|
||||||
sub = subscriptions[subscriber_id]
|
sub = subscriptions[subscriber_id]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue