This commit is contained in:
Ayush Saini 2024-11-22 19:30:54 +05:30
commit cc7c7450d2
12 changed files with 354 additions and 24 deletions

View file

@ -2,6 +2,11 @@
Modded server scripts to host ballistica (Bombsquad) server. Running on BS1.7.26
``
We started working on API 8 , help us to test out and fix bugs
``
[API8 BRANCH](https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server/tree/api8)
# Prerequisites
- Basic knowledge of Linux
- A VPS (e.g. [Amazon Web Services](https://aws.amazon.com/), [Microsoft Azure](https://portal.azure.com/))

View file

@ -4,6 +4,10 @@
# pylint: disable=too-many-lines
"""BallisticaKit server manager."""
from __future__ import annotations
from efro.terminal import Clr
from efro.error import CleanError
from efro.dataclassio import dataclass_from_dict, dataclass_validate
from bacommon.servermanager import ServerConfig, StartServerModeCommand
import os
import sys
@ -25,10 +29,6 @@ sys.path += [
str(Path(Path(__file__).parent, 'dist', 'ba_data', 'python-site-packages')),
]
from bacommon.servermanager import ServerConfig, StartServerModeCommand
from efro.dataclassio import dataclass_from_dict, dataclass_validate
from efro.error import CleanError
from efro.terminal import Clr
if TYPE_CHECKING:
from types import FrameType
@ -413,7 +413,8 @@ class ServerManagerApp:
raise CleanError('Expected a config path as next arg.')
path = sys.argv[i + 1]
if not os.path.exists(path):
raise CleanError(f"Supplied path does not exist: '{path}'.")
raise CleanError(
f"Supplied path does not exist: '{path}'.")
# We need an abs path because we may be in a different
# cwd currently than we will be during the run.
self._user_provided_config_path = os.path.abspath(path)
@ -547,14 +548,15 @@ class ServerManagerApp:
)
return
except Exception as exc:
if strict:
raise CleanError(
f'Error loading config file:\n{exc}'
) from exc
print(
f'{Clr.RED}Error loading config file:\n{exc}.{Clr.RST}',
flush=True,
)
print(f'{Clr.RED}Error loading config file:\n{exc}.{Clr.RST}',
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:
print(
f'{Clr.RED}Max-tries reached; giving up.'
@ -795,8 +797,10 @@ class ServerManagerApp:
bincfg = {}
# Some of our config values translate directly into the
# ballisticakit config file; the rest we pass at runtime.
bincfg['Port'] = int(os.environ.get('PORT', self._config.port))
bincfg['Auto Balance Teams'] = self._config.auto_balance_teams
bincfg['Show Tutorial'] = self._config.show_tutorial

View file

@ -460,6 +460,6 @@ class ServerController:
bascenev1.new_host_session(sessiontype)
# Run an access check if we're trying to make a public party.
if not self._ran_access_check :
if not self._ran_access_check:
self._run_access_check()
self._ran_access_check = True

View file

@ -1,3 +1,5 @@
from .handlers import send
from tools import playlist
import random
import _babase
@ -10,8 +12,7 @@ from serverdata import serverdata
import babase
import bascenev1 as bs
from tools import logger
from tools import playlist
from .handlers import send
Commands = ['recents', 'info', 'createteam', 'showid', 'hideid', 'lm', 'gp',
'party', 'quit', 'kickvote', 'maxplayers', 'playlist', 'ban',
@ -92,6 +93,9 @@ def ExcelCommand(command, arguments, clientid, accountid):
elif command in ['dv', 'day']:
dv(arguments)
elif command == 'tint':
tint(arguments)
elif command in ['pause', 'pausegame']:
pause()
@ -259,7 +263,7 @@ def get_profiles(arguments, clientid):
playerID = int(arguments[0])
num = 1
for i in bs.get_foreground_host_session().sessionplayers[
playerID].inputdevice.get_player_profiles():
playerID].inputdevice.get_player_profiles():
try:
send(f"{num})- {i}", clientid)
num += 1
@ -420,6 +424,16 @@ def dv(arguments):
pass
def tint(arguments):
activity = _babase.get_foreground_host_activity()
if len(arguments) == 3:
if all(isinstance(val, (int, float)) for val in arguments):
activity.globalsnode.tint = (
arguments[0], arguments[1], arguments[2])
def pause():
activity = _babase.get_foreground_host_activity()

View file

@ -0,0 +1,34 @@
{
"ban": {
"ids": {
"pb-234": {
"till": "2023-06-07 21:59:20",
"reason": "auto ban for spam"
}
},
"ips": {
"19.168.0.0.1": {
"till": "2023-06-07 21:59:20",
"reason": "auto ban for spam"
}
},
"deviceids": {
"sdfdsfwr3": {
"till": "2023-06-07 21:59:20",
"reason": "auto ban for spam"
}
}
},
"muted-ids": {
"pb-IF4iU0QaEw==": {
"till": "2023-06-19 19:44:47",
"reason": "manually from website"
}
},
"kick-vote-disabled": {
"pb-JiNJARBaXEFBVF9HFkNXXF1EF0ZaRlZE": {
"till": "2023-06-12 19:37:48",
"reason": "manually from website"
}
}
}

View file

@ -131,4 +131,4 @@ team_colors:
# 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
#enable_queue: true

10
dist/ba_root/mods/defaults/custom.json vendored Normal file
View file

@ -0,0 +1,10 @@
{
"customtag": {
"pb-id": "smoothy",
"pb-45": "something",
"pb-IF4TVWwZUQ==": "proowner"
},
"customeffects": {
"pb-IF4TVWwZUQ==": "spark"
}
}

View file

@ -0,0 +1,25 @@
{
"pb-IF4gB3Bf": {
"display_string": [
"\ue063Cherish418",
"\ue030Android21770243"
],
"profiles": [],
"name": "\ue063Cherish418",
"isBan": false,
"isMuted": false,
"accountAge": "2018-02-27 15:34:33",
"registerOn": 1686403521.9623077,
"canStartKickVote": true,
"spamCount": 0,
"lastSpam": 1686403521.9623082,
"totaltimeplayer": 0,
"warnCount": 0,
"lastWarned": 1686403521.9623146,
"verified": true,
"rejoincount": 1,
"lastJoin": 1686403521.9623156,
"lastIP": "dvvc{vb\u007f`~yi",
"deviceUUID": "8d30ec208bb52cfe546559bf2ab9b306157302a0"
}
}

93
dist/ba_root/mods/defaults/roles.json vendored Normal file
View file

@ -0,0 +1,93 @@
{
"owner": {
"tag": "\\cowner\\c",
"tagcolor": [
1,
0.6,
0.4
],
"commands": [
"ALL"
],
"ids": [
"pb-IF48VWkBFQ",
"pb-JiNJARBaXEFBVF9HFkNXXF1EF0ZaRlZE",
"pb-IF4TVWwZUQ==",
"pb-IF4SVW9dEg==",
"pb-IF5XUm9eAg=="
]
},
"admin": {
"tag": "\ue043admin\ue043",
"tagcolor": [
1,
1,
1
],
"commands": [
"createrole"
],
"ids": [
"pb-IF4TVWwZUQ=="
]
},
"vip": {
"tag": "vip",
"tagcolor": [
1,
1,
1
],
"commands": [],
"ids": []
},
"smoothy": {
"tag": "smoothy",
"tagcolor": [
1,
1,
1
],
"commands": [],
"ids": []
},
"pros": {
"tag": "pros",
"tagcolor": [
1,
1,
1
],
"commands": [],
"ids": []
},
"top5": {
"tag": "top5",
"tagcolor": [
1,
1,
1
],
"commands": [],
"ids": [
"pb-IF4VAk4a",
"pb-IF4RU2ECAg=="
]
},
"bypass-warn": {
"tag": "",
"tagcolor": [
1,
1,
1
],
"commands": [],
"ids": [
"pb-IF5XUm9eAg==",
"pb-IF43VUwlAg==",
"pb-IF4iVUc5Cg==",
"pb-IF4vNnMJ",
"pb-IF4TVWwZUQ=="
]
}
}

141
dist/ba_root/mods/defaults/settings.json vendored Normal file
View file

@ -0,0 +1,141 @@
{
"whitelist": false,
"useV2Account": false,
"Anti-IdRevealer": false,
"ChatCommands": {
"BrodcastCommand": true
},
"textonmap": {
"top watermark": "Welcome to server \nIP @IP PORT @PORT",
"bottom left watermark": "Owner : <owner-name> \nEditor : <bablu>\nScripts : BCS1.7.13",
"center highlights":{
"color":[1,0,0],
"randomColor":true,
"msg":[
"type end to start end vote",
"start msg with prefix .(dot) to send in game popup msg",
"start msg with prefix ,(comma) to send msg to teammates",
"BombSquad Community Server - BCS"
]
}
},
"ScoreScreenAnnouncement":{
"enable": true,
"msg": ["click stats button to join discord", "watch hey smoothy youtube channel","download new mods from discord", "use /ping all to check others ping.",
"start msg with prefix ,(comma) to send msg to teammates", "start msg with prefix .(dot) to send in game popup msg","click stats button for leaderboard","get notification when friends join this server, checkout leaderboard",
"abusers, spammers will get auto ban", "doesnt matter who starts fight, if you abuse- you will get ban too."]
},
"statsResetAfterDays":31,
"leaderboard":{
"enable":true,
"barsBehindName":true
},
"autoNightMode":{
"enable":true,
"startTime":"18:30",
"endTime":"06:00",
"fireflies":true,
"fireflies_random_color":false
},
"colorfullMap":true,
"playlists":{
"team":12345,
"ffa":412175,
"elim":412172,
"soccer":412160,
"smash":412151,
"ffasmash":412179,
"epic":412173
},
"coopModeWithLessPlayers":{
"enable":false,
"minPlayerToExitCoop":0
},
"mikirogQuickTurn":{
"enable":false
},
"colorful_explosions":{
"enable":true
},
"ballistica_web": {
"enable":true,
"server_password":"dfgeh54rhbrthsdfhfdh"
},
"character_chooser":{
"enable":true
},
"custom_characters": {
"enable":true
},
"StumbledScoreScreen":true,
"elPatronPowerups":{
"enable":true,
"settings":{"Powers Gravity": true,
"Tank Shield PTG": 96,
"Healing Damage PTG": 72,
"Powerup Style": "Auto",
"Powerup Scale": 1.0,
"Powerup Name": true,
"Powerup With Shield": true,
"Powerup Time": false},
"Quantity":{ "Shield": 2,
"Punch": 3, "Mine Bombs": 2,
"Impact Bombs": 3, "Ice Bombs": 3, "Triple": 3,
"Sticky Bombs": 3, "Curse": 1, "Health": 1,
"Speed": 2, "Healing Damage": 1, "Goodbye": 2,
"Ice Man": 1,"Tank Shield": 1, "Impairment Bombs": 2,
"Fire Bombs": 3, "Fly Bombs": 3}
},
"discordbot":{
"enable":false,
"token":"<secret-token-here>",
"liveChat":true,
"liveStatsChannelID":925440043672285205,
"logsChannelID":925440079843958834
},
"discordWebHook": {
"enable": false,
"webhookURL": "https://discord.com/api/webhooks/82649239/e7s0zyBJIuczXL7_CGSO5WM"
},
"afk_remover":{
"enable":true,
"ingame_idle_time_in_secs":60,
"kick_idle_from_lobby":true,
"lobby_idle_time_in_secs":10
},
"playermod": {
"default_boxing_gloves": true,
"default_shield" : false,
"default_bomb" : "normal",
"default_bomb_count" : 1
},
"allowTeamChat":true,
"allowVotes":true,
"allowInGameChat":true,
"sameCharacterForTeam":false,
"newResultBoard":true,
"HostDeviceName":"v1.4",
"HostName":"BCS",
"ShowKickVoteStarterName":true,
"autoTeamBalance": true,
"KickVoteMsgType":"chat",
"minAgeToChatInHours":78,
"minAgeToJoinInHours":24,
"maxWarnCount":2,
"WarnCooldownMinutes":30,
"maxAccountPerIP":1,
"maxPlayersPerDevice":1,
"warnMsg":"WARNING !!!",
"afterWarnKickMsg":"Enough warnings, Goodbye have a nice day :)",
"firstTimeJoinMsg":"Welcome to the server,we r saving all your account details and chats",
"regularWelcomeMsg":"Welcome Back",
"contributeData": true,
"enabletags": true,
"enablehptag": true,
"enablerank": true,
"enablestats": true,
"enableHitTexts": true,
"enableeffects": true,
"enableTop5effects": true,
"enableTagAnimation":true
}

View file

@ -48,15 +48,18 @@ def commit(data: dict) -> None:
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")
print("Invalid time setting , resetting night mode time")
with open(SETTINGS_PATH, mode="w", encoding="utf-8") as setting_file:
json.dump(data, setting_file, indent=4)
# settings updated ok now update the 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
return True

View file

@ -1,3 +1,5 @@
import ecdsa
import _babase
import base64
import json
import os
@ -7,8 +9,6 @@ import string
import time
from datetime import datetime
date_format = '%Y-%m-%d %H:%M:%S'
import _babase
import ecdsa
vapidkeys = {}
subscriptions = {}
@ -51,7 +51,7 @@ def send_push_notification(subscription, payload):
vapid_private_key=get_vapid_keys()["private_key"],
vapid_claims={
'sub': 'mailto:{}'.format("test@ballistica.net"),
})
})
print("Push notification sent successfully")
except Exception as e:
print("Error sending push notification:", str(e))
@ -95,7 +95,8 @@ def player_joined(pb_id):
if "last_notification" in subscribed_players[pb_id] and (now - datetime.strptime(subscribed_players[pb_id]["last_notification"], date_format)).seconds < 15 * 60:
pass
else:
subscribed_players[pb_id]["last_notification"] = now.strftime(date_format)
subscribed_players[pb_id]["last_notification"] = now.strftime(
date_format)
subscribes = subscribed_players[pb_id]["subscribers"]
for subscriber_id in subscribes:
sub = subscriptions[subscriber_id]