mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-10-20 00:00:39 +00:00
anti anoying kids
This commit is contained in:
parent
6ed4612484
commit
7897eebd19
9 changed files with 91 additions and 57 deletions
|
|
@ -128,3 +128,7 @@ 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
|
||||
|
|
@ -10,7 +10,7 @@ import ba.internal
|
|||
import _thread
|
||||
import random
|
||||
from tools import playlist
|
||||
Commands = ['createteam', 'showid', 'hideid', 'lm', 'gp', 'party', 'quit', 'kickvote', 'maxplayers', 'playlist', 'ban', 'kick', 'remove', 'end', 'quit', 'mute', 'unmute', 'slowmo', 'nv', 'dv', 'pause',
|
||||
Commands = ['recents','info','createteam', 'showid', 'hideid', 'lm', 'gp', 'party', 'quit', 'kickvote', 'maxplayers', 'playlist', 'ban', 'kick', 'remove', 'end', 'quit', 'mute', 'unmute', 'slowmo', 'nv', 'dv', 'pause',
|
||||
'cameramode', 'createrole', 'addrole', 'removerole', 'addcommand', 'addcmd', 'removecommand', 'getroles', 'removecmd', 'changetag', 'customtag', 'customeffect', 'add', 'spectators', 'lobbytime']
|
||||
CommandAliases = ['max', 'rm', 'next', 'restart', 'mutechat', 'unmutechat', 'sm',
|
||||
'slow', 'night', 'day', 'pausegame', 'camera_mode', 'rotate_camera', 'effect']
|
||||
|
|
@ -29,6 +29,10 @@ def ExcelCommand(command, arguments, clientid, accountid):
|
|||
Returns:
|
||||
None
|
||||
"""
|
||||
if command in ['recents']:
|
||||
get_recents(clientid)
|
||||
if command in ['info']:
|
||||
get_player_info(arguments, clientid)
|
||||
if command in ['maxplayers', 'max']:
|
||||
changepartysize(arguments)
|
||||
if command in ['createteam']:
|
||||
|
|
@ -139,6 +143,17 @@ def show_player_spec():
|
|||
_ba.hide_player_device_id(False)
|
||||
|
||||
|
||||
def get_player_info(arguments, client_id):
|
||||
if len(arguments) == 0:
|
||||
send("invalid client id", client_id)
|
||||
for account in serverdata.recents:
|
||||
if account['client_id'] == int(arguments[0]):
|
||||
send(pdata.get_detailed_info(account["pbid"]), client_id)
|
||||
|
||||
def get_recents(client_id):
|
||||
for players in serverdata.recents:
|
||||
send(f"{players['client_id']} {players['deviceId']} {players['pbid']}", client_id)
|
||||
|
||||
def changepartysize(arguments):
|
||||
if len(arguments) == 0:
|
||||
ba.internal.chatmessage("enter number")
|
||||
|
|
@ -249,11 +264,13 @@ def ban(arguments):
|
|||
ac_id = ""
|
||||
for ros in ba.internal.get_game_roster():
|
||||
if ros["client_id"] == cl_id:
|
||||
pdata.ban_player(ros['account_id'])
|
||||
|
||||
ac_id = ros['account_id']
|
||||
pdata.ban_player(ros['account_id'])
|
||||
if ac_id in serverdata.clients:
|
||||
serverdata.clients[ac_id]["isBan"] = True
|
||||
for account in serverdata.recents: # backup case if player left the server
|
||||
if account['client_id'] == int(arguments[0]):
|
||||
pdata.ban_player(account["pbid"])
|
||||
kick(arguments)
|
||||
except:
|
||||
pass
|
||||
|
|
@ -272,10 +289,13 @@ def mute(arguments):
|
|||
ac_id = ""
|
||||
for ros in ba.internal.get_game_roster():
|
||||
if ros["client_id"] == cl_id:
|
||||
_thread.start_new_thread(pdata.mute, (ros['account_id'],))
|
||||
pdata.mute(ros['account_id'])
|
||||
ac_id = ros['account_id']
|
||||
if ac_id in serverdata.clients:
|
||||
serverdata.clients[ac_id]["isMuted"] = True
|
||||
for account in serverdata.recents: # backup case if player left the server
|
||||
if account['client_id'] == int(arguments[0]):
|
||||
pdata.mute(account["pbid"])
|
||||
except:
|
||||
pass
|
||||
return
|
||||
|
|
|
|||
13
dist/ba_root/mods/chatHandle/handlechat.py
vendored
13
dist/ba_root/mods/chatHandle/handlechat.py
vendored
|
|
@ -38,12 +38,9 @@ def filter_chat_message(msg, client_id):
|
|||
return
|
||||
logger.log(acid + " | " + displaystring + " | " + currentname + " | " + msg, "chat")
|
||||
if msg.startswith("/"):
|
||||
return Main.Command(msg, client_id)
|
||||
|
||||
if msg.startswith(",") and settings["allowTeamChat"]:
|
||||
return Main.QuickAccess(msg, client_id)
|
||||
if msg.startswith(".") and settings["allowInGameChat"]:
|
||||
return Main.QuickAccess(msg, client_id)
|
||||
msg = Main.Command(msg, client_id)
|
||||
if msg == None:
|
||||
return
|
||||
|
||||
if msg == "end" and settings["allowEndVote"]:
|
||||
EndVote.vote_end(acid, client_id)
|
||||
|
|
@ -61,6 +58,10 @@ def filter_chat_message(msg, client_id):
|
|||
_ba.screenmessage("New accounts not allowed to chat here", transient=True, clients=[client_id])
|
||||
return None
|
||||
else:
|
||||
if msg.startswith(",") and settings["allowTeamChat"]:
|
||||
return Main.QuickAccess(msg, client_id)
|
||||
if msg.startswith(".") and settings["allowInGameChat"]:
|
||||
return Main.QuickAccess(msg, client_id)
|
||||
return msg
|
||||
|
||||
|
||||
|
|
|
|||
18
dist/ba_root/mods/playersData/pdata.py
vendored
18
dist/ba_root/mods/playersData/pdata.py
vendored
|
|
@ -127,6 +127,21 @@ def commit_profiles(data={}) -> None:
|
|||
# with OpenJson(PLAYERS_DATA_PATH + "profiles.json") as profiles_file:
|
||||
# profiles_file.dump(CacheData.profiles, indent=4)
|
||||
|
||||
def get_detailed_info(pbid):
|
||||
main_account = get_info(pbid)
|
||||
if main_account == None:
|
||||
return "No info"
|
||||
linked_accounts = ' '.join(main_account["display_string"])
|
||||
ip = main_account["lastIP"]
|
||||
deviceid = main_account["deviceUUID"]
|
||||
otheraccounts = ""
|
||||
dob = main_account["accountAge"]
|
||||
profiles = get_profiles()
|
||||
for key, value in profiles.items():
|
||||
if ("lastIP" in value and value["lastIP"] == ip) or ("deviceUUID" in value and value["deviceUUID"] == deviceid):
|
||||
otheraccounts += ' '.join(value["display_string"])
|
||||
return f"Accounts:{linked_accounts} \n other accounts {otheraccounts} \n created on {dob}"
|
||||
|
||||
|
||||
def add_profile(
|
||||
account_id: str,
|
||||
|
|
@ -162,7 +177,6 @@ def add_profile(
|
|||
"totaltimeplayer": 0,
|
||||
}
|
||||
CacheData.profiles=profiles
|
||||
commit_profiles()
|
||||
|
||||
serverdata.clients[account_id] = profiles[account_id]
|
||||
serverdata.clients[account_id]["warnCount"] = 0
|
||||
|
|
@ -284,7 +298,7 @@ def mute(account_id: str) -> None:
|
|||
if account_id in profiles:
|
||||
profiles[account_id]["isMuted"] = True
|
||||
CacheData.profiles=profiles
|
||||
_thread.start_new_thread(commit_profiles, (profiles,))
|
||||
|
||||
|
||||
|
||||
def unmute(account_id: str) -> None:
|
||||
|
|
|
|||
1
dist/ba_root/mods/serverData/serverdata.py
vendored
1
dist/ba_root/mods/serverData/serverdata.py
vendored
|
|
@ -5,3 +5,4 @@ cachedclients=[]
|
|||
muted=False
|
||||
coopmode=False
|
||||
ips={}
|
||||
recents=[]
|
||||
|
|
|
|||
4
dist/ba_root/mods/tools/account.py
vendored
4
dist/ba_root/mods/tools/account.py
vendored
|
|
@ -1,4 +1,4 @@
|
|||
# ba_meta require api 7
|
||||
# ba_meta require api 6
|
||||
from __future__ import annotations
|
||||
|
||||
import ba
|
||||
|
|
@ -69,7 +69,7 @@ class AccountUtil:
|
|||
def _logged_in(self):
|
||||
logging.info("Logged in as: "+ba.internal.get_v1_account_display_string())
|
||||
|
||||
# ba_meta export plugin
|
||||
# #ba_meta export plugin
|
||||
# class AccountV2(ba.Plugin):
|
||||
# def __init__(self):
|
||||
# if(ba.internal.get_v1_account_state()=='signed_in' and ba.internal.get_v1_account_type()=='V2'):
|
||||
|
|
|
|||
80
dist/ba_root/mods/tools/servercheck.py
vendored
80
dist/ba_root/mods/tools/servercheck.py
vendored
|
|
@ -21,7 +21,7 @@ from playersData import pdata
|
|||
blacklist = pdata.get_blacklist()
|
||||
|
||||
settings = setting.get_settings_data()
|
||||
|
||||
ipjoin = {}
|
||||
|
||||
class checkserver(object):
|
||||
def start(self):
|
||||
|
|
@ -32,6 +32,7 @@ class checkserver(object):
|
|||
def check(self):
|
||||
newPlayers = []
|
||||
ipClientMap = {}
|
||||
deviceClientMap = {}
|
||||
for ros in ba.internal.get_game_roster():
|
||||
ip = _ba.get_client_ip(ros["client_id"])
|
||||
if ip not in ipClientMap:
|
||||
|
|
@ -69,8 +70,8 @@ class checkserver(object):
|
|||
except:
|
||||
pass
|
||||
ba.internal.disconnect_client(ros['client_id'], 1)
|
||||
|
||||
return
|
||||
|
||||
if settings["whitelist"] and ros["account_id"] != None:
|
||||
if ros["account_id"] not in pdata.CacheData.whitelist:
|
||||
_ba.screenmessage("Not in whitelist,contact admin",
|
||||
|
|
@ -86,44 +87,49 @@ class checkserver(object):
|
|||
if ros['account_id'] in serverdata.clients:
|
||||
on_player_join_server(ros['account_id'],
|
||||
serverdata.clients[
|
||||
ros['account_id']])
|
||||
ros['account_id']], ip)
|
||||
else:
|
||||
LoadProfile(ros['account_id']).start()
|
||||
LoadProfile(ros['account_id'], ip).start() # from local cache, then call on_player_join_server
|
||||
|
||||
self.players = newPlayers
|
||||
|
||||
|
||||
def on_player_join_server(pbid, player_data):
|
||||
def on_player_join_server(pbid, player_data, ip):
|
||||
global ipjoin
|
||||
now = time.time()
|
||||
# player_data=pdata.get_info(pbid)
|
||||
clid = 113
|
||||
device_string = ""
|
||||
for ros in ba.internal.get_game_roster():
|
||||
if ros["account_id"] == pbid:
|
||||
clid = ros["client_id"]
|
||||
|
||||
if pbid in serverdata.clients:
|
||||
rejoinCount = serverdata.clients[pbid]["rejoincount"]
|
||||
spamCount = serverdata.clients[pbid]["spamCount"]
|
||||
if now - serverdata.clients[pbid]["lastJoin"] < 15:
|
||||
rejoinCount += 1
|
||||
if rejoinCount > 2:
|
||||
device_string = ros['display_string']
|
||||
if ip in ipjoin:
|
||||
lastjoin = ipjoin[ip]["lastJoin"]
|
||||
joincount = ipjoin[ip]["count"]
|
||||
if now - lastjoin < 15:
|
||||
joincount += 1
|
||||
if joincount > 2:
|
||||
_ba.screenmessage("Joining too fast , slow down dude",
|
||||
color=(1, 0, 1), transient=True,
|
||||
clients=[clid])
|
||||
logger.log(pbid + "|| kicked for joining too fast")
|
||||
ba.internal.disconnect_client(clid)
|
||||
|
||||
_thread.start_new_thread(reportSpam, (pbid,))
|
||||
|
||||
return
|
||||
else:
|
||||
rejoinCount = 0
|
||||
joincount = 0
|
||||
|
||||
serverdata.clients[pbid]["rejoincount"] = rejoinCount
|
||||
ipjoin[ip]["count"] = joincount
|
||||
ipjoin[ip]["lastJoin"] = now
|
||||
else:
|
||||
ipjoin[ip] = {"lastJoin":now,"count":0}
|
||||
if pbid in serverdata.clients:
|
||||
serverdata.clients[pbid]["lastJoin"] = now
|
||||
|
||||
if player_data != None:
|
||||
device_strin = ""
|
||||
if player_data != None: # player data not in serevrdata or in local.json cache
|
||||
serverdata.recents.append({"client_id":clid,"deviceId":device_string,"pbid":pbid})
|
||||
serverdata.recents = serverdata.recents[-20:]
|
||||
if player_data["isBan"] or get_account_age(player_data["accountAge"]) < \
|
||||
settings["minAgeToJoinInHours"]:
|
||||
for ros in ba.internal.get_game_roster():
|
||||
|
|
@ -154,43 +160,30 @@ def on_player_join_server(pbid, player_data):
|
|||
if not player_data["canStartKickVote"]:
|
||||
_ba.disable_kickvote(pbid)
|
||||
|
||||
verify_account(pbid, player_data)
|
||||
cid = 113
|
||||
d_st = "xx"
|
||||
for ros in ba.internal.get_game_roster():
|
||||
if ros['account_id'] == pbid:
|
||||
cid = ros['client_id']
|
||||
d_st = ros['display_string']
|
||||
serverdata.clients[pbid]["lastIP"] = _ba.get_client_ip(cid)
|
||||
|
||||
device_id = _ba.get_client_public_device_uuid(cid)
|
||||
serverdata.clients[pbid]["lastIP"] = ip
|
||||
|
||||
device_id = _ba.get_client_public_device_uuid(clid)
|
||||
if(device_id==None):
|
||||
device_id = _ba.get_client_device_uuid(cid)
|
||||
device_id = _ba.get_client_device_uuid(clid)
|
||||
serverdata.clients[pbid]["deviceUUID"] = device_id
|
||||
verify_account(pbid, player_data) # checked for spoofed ids
|
||||
logger.log(pbid+" ip: "+serverdata.clients[pbid]["lastIP"]+", Device id: "+device_id)
|
||||
_ba.screenmessage(settings["regularWelcomeMsg"] + " " + d_st,
|
||||
_ba.screenmessage(settings["regularWelcomeMsg"] + " " + device_string,
|
||||
color=(0.60, 0.8, 0.6), transient=True,
|
||||
clients=[cid])
|
||||
|
||||
clients=[clid])
|
||||
else:
|
||||
|
||||
d_string = ""
|
||||
cid = 113
|
||||
for ros in ba.internal.get_game_roster():
|
||||
if ros['account_id'] == pbid:
|
||||
d_string = ros['display_string']
|
||||
cid = ros['client_id']
|
||||
|
||||
# fetch id for first time.
|
||||
thread = FetchThread(
|
||||
target=my_acc_age,
|
||||
callback=save_age,
|
||||
pb_id=pbid,
|
||||
display_string=d_string
|
||||
display_string=device_string
|
||||
)
|
||||
|
||||
thread.start()
|
||||
_ba.screenmessage(settings["firstTimeJoinMsg"], color=(0.6, 0.8, 0.6),
|
||||
transient=True, clients=[cid])
|
||||
transient=True, clients=[clid])
|
||||
|
||||
# pdata.add_profile(pbid,d_string,d_string)
|
||||
|
||||
|
|
@ -282,13 +275,14 @@ def get_device_accounts(pb_id):
|
|||
# ============ file I/O =============
|
||||
|
||||
class LoadProfile(threading.Thread):
|
||||
def __init__(self, pb_id):
|
||||
def __init__(self, pb_id, ip):
|
||||
threading.Thread.__init__(self)
|
||||
self.pbid = pb_id
|
||||
self.ip = ip
|
||||
|
||||
def run(self):
|
||||
player_data = pdata.get_info(self.pbid)
|
||||
_ba.pushcall(Call(on_player_join_server, self.pbid, player_data),
|
||||
_ba.pushcall(Call(on_player_join_server, self.pbid, player_data, self.ip),
|
||||
from_other_thread=True)
|
||||
|
||||
|
||||
|
|
|
|||
BIN
dist/bombsquad_headless
vendored
BIN
dist/bombsquad_headless
vendored
Binary file not shown.
BIN
dist/bombsquad_headless_aarch64
vendored
BIN
dist/bombsquad_headless_aarch64
vendored
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue