mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2026-08-15 13:04:30 +00:00
security patch and other bug fixes.
This commit is contained in:
parent
99352f0f84
commit
cafc2e0225
20 changed files with 494 additions and 263 deletions
4
dist/ba_root/mods/changelogs.json
vendored
4
dist/ba_root/mods/changelogs.json
vendored
|
|
@ -46,6 +46,10 @@
|
|||
"77": {
|
||||
"log": "system logs, security patch, discord webhook logs dump.",
|
||||
"time": "8 April 2023"
|
||||
},
|
||||
"78": {
|
||||
"log": "security update: auto handle server queue, fake accounts protection, allow owner to join houefull server. And other bug fixes. ",
|
||||
"time": "28 May 2023"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ import ba
|
|||
import ba.internal
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def clientid_to_accountid(clientid):
|
||||
"""
|
||||
Transform Clientid To Accountid
|
||||
|
|
@ -24,9 +21,6 @@ def clientid_to_accountid(clientid):
|
|||
return None
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def check_permissions(accountid, command):
|
||||
"""
|
||||
Checks The Permission To Player To Executive Command
|
||||
|
|
|
|||
|
|
@ -182,7 +182,8 @@ class Floater(ba.Actor):
|
|||
pn = self.node.position
|
||||
dist = self.distance(pn[0], pn[1], pn[2], px, py, pz)
|
||||
self.node.velocity = ((px - pn[0]) / dist, (py - pn[1]) / dist, (pz - pn[2]) / dist)
|
||||
ba.timer(dist-1, ba.WeakCall(self.move), suppress_format_warning=True)
|
||||
t = dist - 1 if dist - 1 >= 0 else 0.1
|
||||
ba.timer(t, ba.WeakCall(self.move), suppress_format_warning=True)
|
||||
|
||||
def handlemessage(self, msg):
|
||||
if isinstance(msg, ba.DieMessage):
|
||||
|
|
|
|||
12
dist/ba_root/mods/chatHandle/handlechat.py
vendored
12
dist/ba_root/mods/chatHandle/handlechat.py
vendored
|
|
@ -5,7 +5,7 @@ from serverData import serverdata
|
|||
from chatHandle.ChatCommands import Main
|
||||
from tools import logger, servercheck
|
||||
from chatHandle.chatFilter import ChatFilter
|
||||
from features import EndVote
|
||||
from features import votingmachine
|
||||
import ba, _ba
|
||||
import ba.internal
|
||||
import setting
|
||||
|
|
@ -18,7 +18,7 @@ def filter_chat_message(msg, client_id):
|
|||
if msg.startswith("/"):
|
||||
Main.Command(msg, client_id)
|
||||
return None
|
||||
logger.log("Host msg: | " + msg , "chat")
|
||||
logger.log(f"Host msg: | {msg}" , "chat")
|
||||
return msg
|
||||
acid = ""
|
||||
displaystring = ""
|
||||
|
|
@ -36,14 +36,15 @@ def filter_chat_message(msg, client_id):
|
|||
msg = ChatFilter.filter(msg, acid, client_id)
|
||||
if msg == None:
|
||||
return
|
||||
logger.log(acid + " | " + displaystring + " | " + currentname + " | " + msg, "chat")
|
||||
logger.log(f'{acid} | {displaystring}| {currentname} | {msg}', "chat")
|
||||
if msg.startswith("/"):
|
||||
msg = Main.Command(msg, client_id)
|
||||
if msg == None:
|
||||
return
|
||||
|
||||
if msg == "end" and settings["allowEndVote"]:
|
||||
EndVote.vote_end(acid, client_id)
|
||||
if msg in ["end","dv","nv","sm"] and settings["allowVotes"]:
|
||||
votingmachine.vote(acid, client_id, msg)
|
||||
|
||||
|
||||
if acid in serverdata.clients and serverdata.clients[acid]["verified"]:
|
||||
|
||||
|
|
@ -64,7 +65,6 @@ def filter_chat_message(msg, client_id):
|
|||
return Main.QuickAccess(msg, client_id)
|
||||
return msg
|
||||
|
||||
|
||||
else:
|
||||
_ba.screenmessage("Fetching your account info , Wait a minute", transient=True, clients=[client_id])
|
||||
return None
|
||||
|
|
|
|||
52
dist/ba_root/mods/custom_hooks.py
vendored
52
dist/ba_root/mods/custom_hooks.py
vendored
|
|
@ -8,10 +8,11 @@
|
|||
# pylint: disable=protected-access
|
||||
|
||||
from __future__ import annotations
|
||||
from ba._servermode import ServerController
|
||||
from ba._session import Session
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from datetime import datetime
|
||||
|
||||
import _thread
|
||||
import importlib
|
||||
import time
|
||||
|
|
@ -19,19 +20,18 @@ import os
|
|||
import ba
|
||||
import _ba
|
||||
import logging
|
||||
from ba import _hooks
|
||||
from bastd.activity import dualteamscore, multiteamscore, drawscore
|
||||
from bastd.activity.coopscore import CoopScoreScreen
|
||||
import setting
|
||||
|
||||
from tools import account
|
||||
from chatHandle import handlechat
|
||||
from features import team_balancer, afk_check, fire_flies, hearts, dual_team_score as newdts
|
||||
from stats import mystats
|
||||
from spazmod import modifyspaz
|
||||
from tools import servercheck, ServerUpdate, logger, playlist
|
||||
from tools import servercheck, ServerUpdate, logger, playlist, servercontroller
|
||||
from playersData import pdata
|
||||
from serverData import serverdata
|
||||
from features import EndVote
|
||||
from features import votingmachine
|
||||
from features import text_on_map, announcement
|
||||
from features import map_fun
|
||||
from spazmod import modifyspaz
|
||||
|
|
@ -46,19 +46,17 @@ def filter_chat_message(msg: str, client_id: int) -> str | None:
|
|||
return handlechat.filter_chat_message(msg, client_id)
|
||||
|
||||
# ba_meta export plugin
|
||||
|
||||
|
||||
class modSetup(ba.Plugin):
|
||||
def on_app_running(self):
|
||||
"""Runs when app is launched."""
|
||||
bootstraping()
|
||||
servercheck.checkserver().start()
|
||||
ServerUpdate.check()
|
||||
|
||||
ba.timer(5, account.updateOwnerIps)
|
||||
if settings["afk_remover"]['enable']:
|
||||
afk_check.checkIdle().start()
|
||||
if (settings["useV2Account"]):
|
||||
from tools import account
|
||||
|
||||
if (ba.internal.get_v1_account_state() == 'signed_in' and ba.internal.get_v1_account_type() == 'V2'):
|
||||
logging.debug("Account V2 is active")
|
||||
else:
|
||||
|
|
@ -133,16 +131,19 @@ def bootstraping():
|
|||
import subprocess
|
||||
# Install psutil package
|
||||
# Download get-pip.py
|
||||
curl_process = subprocess.Popen(["curl", "-sS", "https://bootstrap.pypa.io/get-pip.py"], stdout=subprocess.PIPE)
|
||||
curl_process = subprocess.Popen(
|
||||
["curl", "-sS", "https://bootstrap.pypa.io/get-pip.py"], stdout=subprocess.PIPE)
|
||||
|
||||
# Install pip using python3.10
|
||||
python_process = subprocess.Popen(["python3.10"], stdin=curl_process.stdout)
|
||||
python_process = subprocess.Popen(
|
||||
["python3.10"], stdin=curl_process.stdout)
|
||||
|
||||
# Wait for the processes to finish
|
||||
curl_process.stdout.close()
|
||||
python_process.wait()
|
||||
|
||||
subprocess.check_call(["python3.10","-m","pip", "install", "psutil"])
|
||||
subprocess.check_call(
|
||||
["python3.10", "-m", "pip", "install", "psutil"])
|
||||
# restart after installation
|
||||
print("dependency installed , restarting server")
|
||||
_ba.quit()
|
||||
|
|
@ -155,8 +156,6 @@ def bootstraping():
|
|||
if settings["whitelist"]:
|
||||
pdata.load_white_list()
|
||||
|
||||
#
|
||||
|
||||
import_discord_bot()
|
||||
import_games()
|
||||
import_dual_team_score()
|
||||
|
|
@ -193,7 +192,7 @@ def import_games():
|
|||
|
||||
def import_dual_team_score() -> None:
|
||||
"""Imports the dual team score."""
|
||||
if settings["newResultBoard"] and _ba.get_foreground_host_session().use_teams:
|
||||
if settings["newResultBoard"]:
|
||||
dualteamscore.TeamVictoryScoreScreenActivity = newdts.TeamVictoryScoreScreenActivity
|
||||
multiteamscore.MultiTeamScoreScreenActivity.show_player_scores = newdts.show_player_scores
|
||||
drawscore.DrawScoreScreenActivity = newdts.DrawScoreScreenActivity
|
||||
|
|
@ -208,8 +207,8 @@ def new_begin(self):
|
|||
night_mode()
|
||||
if settings["colorfullMap"]:
|
||||
map_fun.decorate_map()
|
||||
EndVote.voters = []
|
||||
EndVote.game_started_on = time.time()
|
||||
votingmachine.reset_votes()
|
||||
votingmachine.game_started_on = time.time()
|
||||
|
||||
|
||||
ba._activity.Activity.on_begin = new_begin
|
||||
|
|
@ -224,13 +223,19 @@ def new_end(self, results: Any = None, delay: float = 0.0, force: bool = False):
|
|||
if isinstance(activity, CoopScoreScreen):
|
||||
team_balancer.checkToExitCoop()
|
||||
org_end(self, results, delay, force)
|
||||
|
||||
|
||||
ba._activity.Activity.end = new_end
|
||||
|
||||
org_player_join = ba._activity.Activity.on_player_join
|
||||
|
||||
|
||||
def on_player_join(self, player) -> None:
|
||||
"""Runs when player joins the game."""
|
||||
team_balancer.on_player_join()
|
||||
org_player_join(self, player)
|
||||
|
||||
|
||||
ba._activity.Activity.on_player_join = on_player_join
|
||||
|
||||
|
||||
|
|
@ -277,13 +282,12 @@ def on_map_init():
|
|||
text_on_map.textonmap()
|
||||
modifyspaz.setTeamCharacter()
|
||||
|
||||
from ba._servermode import ServerController
|
||||
|
||||
def shutdown(func) -> None:
|
||||
"""Set the app to quit either now or at the next clean opportunity."""
|
||||
def wrapper(*args, **kwargs):
|
||||
# add screen text and tell players we are going to restart soon.
|
||||
ba.internal.chatmessage("Server will restart on next opportunity. (series end)")
|
||||
ba.internal.chatmessage(
|
||||
"Server will restart on next opportunity. (series end)")
|
||||
_ba.restart_scheduled = True
|
||||
_ba.get_foreground_host_activity().restart_msg = _ba.newnode('text',
|
||||
attrs={
|
||||
|
|
@ -298,9 +302,11 @@ def shutdown(func) -> None:
|
|||
})
|
||||
func(*args, **kwargs)
|
||||
return wrapper
|
||||
|
||||
|
||||
ServerController.shutdown = shutdown(ServerController.shutdown)
|
||||
|
||||
from ba._session import Session
|
||||
|
||||
def on_player_request(func) -> bool:
|
||||
def wrapper(*args, **kwargs):
|
||||
player = args[1]
|
||||
|
|
@ -315,5 +321,9 @@ def on_player_request(func) -> bool:
|
|||
return False
|
||||
return func(*args, **kwargs)
|
||||
return wrapper
|
||||
|
||||
|
||||
Session.on_player_request = on_player_request(Session.on_player_request)
|
||||
|
||||
|
||||
ServerController._access_check_response = servercontroller._access_check_response
|
||||
|
|
|
|||
80
dist/ba_root/mods/features/dual_team_score.py
vendored
80
dist/ba_root/mods/features/dual_team_score.py
vendored
|
|
@ -46,17 +46,17 @@ class TeamVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
|||
best_txt = ba.Lstr(resource='bestOfSeriesText',
|
||||
subs=[('${COUNT}',
|
||||
str(session.get_series_length()))])
|
||||
|
||||
# ZoomText(best_txt,
|
||||
# position=(0, 175),
|
||||
# shiftposition=(-250, 175),
|
||||
# shiftdelay=2.5,
|
||||
# flash=False,
|
||||
# trail=False,
|
||||
# h_align='center',
|
||||
# scale=0.25,
|
||||
# color=(0.5, 0.5, 0.5, 1.0),
|
||||
# jitter=3.0).autoretain()
|
||||
if len(self.teams) != 2:
|
||||
ZoomText(best_txt,
|
||||
position=(0, 175),
|
||||
shiftposition=(-250, 175),
|
||||
shiftdelay=2.5,
|
||||
flash=False,
|
||||
trail=False,
|
||||
h_align='center',
|
||||
scale=0.25,
|
||||
color=(0.5, 0.5, 0.5, 1.0),
|
||||
jitter=3.0).autoretain()
|
||||
for team in self.session.sessionteams:
|
||||
ba.timer(
|
||||
i * 0.15 + 0.15,
|
||||
|
|
@ -86,6 +86,20 @@ class TeamVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
|||
def _show_team_name(self, pos_v: float, team: ba.SessionTeam,
|
||||
kill_delay: float, shiftdelay: float) -> None:
|
||||
del kill_delay # Unused arg.
|
||||
if len(self.teams) != 2:
|
||||
ZoomText(
|
||||
ba.Lstr(value='${A}:', subs=[('${A}', team.name)]),
|
||||
position=(100, pos_v),
|
||||
shiftposition=(-150, pos_v),
|
||||
shiftdelay=shiftdelay,
|
||||
flash=False,
|
||||
trail=False,
|
||||
h_align='right',
|
||||
maxwidth=300,
|
||||
color=team.color,
|
||||
jitter=1.0,
|
||||
).autoretain()
|
||||
else:
|
||||
ZoomText(ba.Lstr(value='${A}', subs=[('${A}', team.name)]),
|
||||
position=(-250, 260) if pos_v == 65 else (250, 260),
|
||||
shiftposition=(-250, 260) if pos_v == 65 else (250, 260),
|
||||
|
|
@ -100,6 +114,22 @@ class TeamVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
|||
|
||||
def _show_team_old_score(self, pos_v: float, sessionteam: ba.SessionTeam,
|
||||
shiftdelay: float) -> None:
|
||||
|
||||
if len(self.teams) != 2:
|
||||
ZoomText(
|
||||
str(sessionteam.customdata['score'] - 1),
|
||||
position=(150, pos_v),
|
||||
maxwidth=100,
|
||||
color=(0.6, 0.6, 0.7),
|
||||
shiftposition=(-100, pos_v),
|
||||
shiftdelay=shiftdelay,
|
||||
flash=False,
|
||||
trail=False,
|
||||
lifespan=1.0,
|
||||
h_align='left',
|
||||
jitter=1.0,
|
||||
).autoretain()
|
||||
else:
|
||||
ZoomText(str(sessionteam.customdata['score'] - 1),
|
||||
position=(-250, 190) if pos_v == 65 else (250, 190),
|
||||
maxwidth=100,
|
||||
|
|
@ -117,6 +147,21 @@ class TeamVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
|||
scored: bool, kill_delay: float,
|
||||
shiftdelay: float) -> None:
|
||||
del kill_delay # Unused arg.
|
||||
if len(self.teams) != 2:
|
||||
ZoomText(
|
||||
str(sessionteam.customdata['score']),
|
||||
position=(150, pos_v),
|
||||
maxwidth=100,
|
||||
color=(1.0, 0.9, 0.5) if scored else (0.6, 0.6, 0.7),
|
||||
shiftposition=(-100, pos_v),
|
||||
shiftdelay=shiftdelay,
|
||||
flash=scored,
|
||||
trail=scored,
|
||||
h_align='left',
|
||||
jitter=1.0,
|
||||
trailcolor=(1, 0.8, 0.0, 0),
|
||||
).autoretain()
|
||||
else:
|
||||
ZoomText(str(sessionteam.customdata['score']),
|
||||
position=(-250, 190) if pos_v == 65 else (250, 190),
|
||||
maxwidth=100,
|
||||
|
|
@ -241,6 +286,19 @@ def show_player_scores(self,
|
|||
h_align=Text.HAlign.CENTER,
|
||||
extrascale=1.4,
|
||||
maxwidth=None)
|
||||
else:
|
||||
tval = ba.Lstr(
|
||||
resource='gameLeadersText',
|
||||
subs=[('${COUNT}', str(session.get_game_number()))],
|
||||
)
|
||||
_txt(
|
||||
180,
|
||||
43,
|
||||
tval,
|
||||
h_align=Text.HAlign.CENTER,
|
||||
extrascale=1.4,
|
||||
maxwidth=None,
|
||||
)
|
||||
_txt(-15, 4, ba.Lstr(resource='playerText'), h_align=Text.HAlign.LEFT)
|
||||
_txt(180, 4, ba.Lstr(resource='killsText'))
|
||||
_txt(280, 4, ba.Lstr(resource='deathsText'), maxwidth=100)
|
||||
|
|
|
|||
2
dist/ba_root/mods/features/team_balancer.py
vendored
2
dist/ba_root/mods/features/team_balancer.py
vendored
|
|
@ -27,6 +27,7 @@ def balanceTeams():
|
|||
teamBSize += 1
|
||||
except:
|
||||
pass
|
||||
if settings["autoTeamBalance"]:
|
||||
if abs(teamBSize-teamASize) >= 0:
|
||||
if teamBSize > teamASize and teamBSize != 0:
|
||||
movePlayers(1, 0, abs(teamBSize-teamASize)-1)
|
||||
|
|
@ -40,7 +41,6 @@ def movePlayers(fromTeam, toTeam, count):
|
|||
toTeam = session.sessionteams[toTeam]
|
||||
for i in range(0, count):
|
||||
player = fromTeam.players.pop()
|
||||
print("moved"+player.get_v1_account_id())
|
||||
broadCastShiftMsg(player.get_v1_account_id())
|
||||
player.setdata(team=toTeam, character=player.character,
|
||||
color=toTeam.color, highlight=player.highlight)
|
||||
|
|
|
|||
1
dist/ba_root/mods/features/text_on_map.py
vendored
1
dist/ba_root/mods/features/text_on_map.py
vendored
|
|
@ -21,6 +21,7 @@ class textonmap:
|
|||
nextMap=ba.internal.get_foreground_host_session().get_next_game_description().evaluate()
|
||||
except:
|
||||
pass
|
||||
top = top.replace("@IP", _ba.our_ip).replace("@PORT", _ba.our_port)
|
||||
self.index = 0
|
||||
self.highlights = data['center highlights']["msg"]
|
||||
self.left_watermark(left)
|
||||
|
|
|
|||
|
|
@ -1,31 +1,40 @@
|
|||
# EndVote by -mr.smoothy
|
||||
# Electronic Voting Machine (EVM) by -mr.smoothy
|
||||
|
||||
import _ba
|
||||
import ba
|
||||
import ba.internal
|
||||
import time
|
||||
|
||||
last_end_vote_start_time = 0
|
||||
end_vote_duration = 50
|
||||
game_started_on = 0
|
||||
min_game_duration_to_start_end_vote = 30
|
||||
|
||||
voters = []
|
||||
|
||||
|
||||
def vote_end(pb_id, client_id):
|
||||
global voters
|
||||
global last_end_vote_start_time
|
||||
vote_machine = {"end": {"last_vote_start_time": 0, "vote_duration": 50,
|
||||
"min_game_duration_to_start_vote": 30, "voters": []},
|
||||
"sm": {"last_vote_start_time": 0, "vote_duration": 50,
|
||||
"min_game_duration_to_start_vote": 1, "voters": []},
|
||||
"nv": {"last_vote_start_time": 0, "vote_duration": 50,
|
||||
"min_game_duration_to_start_vote": 1, "voters": []},
|
||||
"dv": {"last_vote_start_time": 0, "vote_duration": 50,
|
||||
"min_game_duration_to_start_vote": 1, "voters": []}}
|
||||
|
||||
|
||||
def vote(pb_id, client_id, vote_type):
|
||||
global vote_machine
|
||||
voters = vote_machine[vote_type]["voters"]
|
||||
last_vote_start_time = vote_machine[vote_type]["last_vote_start_time"]
|
||||
vote_duration = vote_machine[vote_type]["vote_duration"]
|
||||
min_game_duration_to_start_vote = vote_machine[vote_type]["min_game_duration_to_start_vote"]
|
||||
|
||||
now = time.time()
|
||||
if now > last_end_vote_start_time + end_vote_duration:
|
||||
if now > last_vote_start_time + vote_duration:
|
||||
voters = []
|
||||
last_end_vote_start_time = now
|
||||
if now < game_started_on + min_game_duration_to_start_end_vote:
|
||||
last_vote_start_time = now
|
||||
if now < game_started_on + min_game_duration_to_start_vote:
|
||||
_ba.screenmessage("Seems game just started, Try again after some time", transient=True,
|
||||
clients=[client_id])
|
||||
return
|
||||
if len(voters) == 0:
|
||||
ba.internal.chatmessage("end vote started")
|
||||
ba.internal.chatmessage(f"{vote_type} vote started")
|
||||
|
||||
# clean up voters list
|
||||
active_players = []
|
||||
|
|
@ -36,25 +45,34 @@ def vote_end(pb_id, client_id):
|
|||
voters.remove(voter)
|
||||
if pb_id not in voters:
|
||||
voters.append(pb_id)
|
||||
_ba.screenmessage("Thanks for vote , encourage other players to type 'end' too.", transient=True,
|
||||
_ba.screenmessage(f'Thanks for vote , encourage other players to type {vote_type} too.', transient=True,
|
||||
clients=[client_id])
|
||||
if vote_type == 'end':
|
||||
update_vote_text(required_votes(len(active_players)) - len(voters))
|
||||
if required_votes(len(active_players)) - len(
|
||||
voters) == 3: # lets dont spam chat/screen message with votes required , only give message when only 3 votes left
|
||||
ba.internal.chatmessage("3 more end votes required")
|
||||
|
||||
if len(voters) >= required_votes(len(active_players)):
|
||||
ba.internal.chatmessage("end vote succeed")
|
||||
ba.internal.chatmessage(f"{vote_type} vote succeed")
|
||||
if vote_type == "end":
|
||||
try:
|
||||
with _ba.Context(_ba.get_foreground_host_activity()):
|
||||
_ba.get_foreground_host_activity().end_game()
|
||||
except:
|
||||
pass
|
||||
elif vote_type == "nv":
|
||||
_ba.chatmessage("/nv")
|
||||
elif vote_type == "dv":
|
||||
_ba.chatmessage("/dv")
|
||||
elif vote_type == "sm":
|
||||
_ba.chatmessage("/sm")
|
||||
|
||||
def reset_votes():
|
||||
global vote_machine
|
||||
for value in vote_machine.values():
|
||||
value["voters"] = []
|
||||
|
||||
def required_votes(players):
|
||||
if players == 2:
|
||||
return 1
|
||||
return 2
|
||||
elif players == 3:
|
||||
return 2
|
||||
elif players == 4:
|
||||
2
dist/ba_root/mods/plugins/colorfulmaps2.py
vendored
2
dist/ba_root/mods/plugins/colorfulmaps2.py
vendored
|
|
@ -11,7 +11,7 @@ CONFIGS = {
|
|||
"AdaptivePos": True,
|
||||
"IgnoreOnMaps": [],
|
||||
"Colors": {
|
||||
"Intensity": 0.8,
|
||||
"Intensity": 0.5,
|
||||
"Animate": True,
|
||||
"Random": True,
|
||||
"LeftSide": (1, 0, 1),
|
||||
|
|
|
|||
13
dist/ba_root/mods/setting.json
vendored
13
dist/ba_root/mods/setting.json
vendored
|
|
@ -6,7 +6,7 @@
|
|||
"BrodcastCommand": true
|
||||
},
|
||||
"textonmap": {
|
||||
"top watermark": "Welcome to server \nip 192.168.0.1",
|
||||
"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],
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
"minPlayerToExitCoop":0
|
||||
},
|
||||
"mikirogQuickTurn":{
|
||||
"enable":true
|
||||
"enable":false
|
||||
},
|
||||
"colorful_explosions":{
|
||||
"enable":true
|
||||
|
|
@ -102,14 +102,21 @@
|
|||
"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,
|
||||
"allowEndVote":true,
|
||||
"allowVotes":true,
|
||||
"allowInGameChat":true,
|
||||
"sameCharacterForTeam":false,
|
||||
"newResultBoard":true,
|
||||
"HostDeviceName":"v1.4",
|
||||
"HostName":"BCS",
|
||||
"ShowKickVoteStarterName":true,
|
||||
"autoTeamBalance": true,
|
||||
"KickVoteMsgType":"chat",
|
||||
"minAgeToChatInHours":78,
|
||||
"minAgeToJoinInHours":24,
|
||||
|
|
|
|||
19
dist/ba_root/mods/spazmod/modifyspaz.py
vendored
19
dist/ba_root/mods/spazmod/modifyspaz.py
vendored
|
|
@ -2,7 +2,8 @@ from spazmod import tag
|
|||
import setting
|
||||
from random import randint
|
||||
from spazmod import hitmessage
|
||||
import _ba,ba
|
||||
import _ba
|
||||
import ba
|
||||
import ba.internal
|
||||
_setting = setting.get_settings_data()
|
||||
|
||||
|
|
@ -11,6 +12,7 @@ if _setting['enableeffects']:
|
|||
from spazmod import spaz_effects
|
||||
spaz_effects.apply()
|
||||
|
||||
|
||||
def update_name():
|
||||
import ba.internal
|
||||
from stats import mystats
|
||||
|
|
@ -25,17 +27,24 @@ def update_name():
|
|||
mystats.dump_stats(stat)
|
||||
|
||||
# all activites related to modify spaz by any how will be here
|
||||
def main(spaz, node, player):
|
||||
|
||||
|
||||
def main(spaz, node, player):
|
||||
if _setting['enablehptag']:
|
||||
tag.addhp(node, spaz)
|
||||
if _setting['enabletags']:
|
||||
tag.addtag(node, player)
|
||||
if _setting['enablerank']:
|
||||
tag.addrank(node, player)
|
||||
|
||||
if _setting["playermod"]['default_boxing_gloves']:
|
||||
spaz.equip_boxing_gloves()
|
||||
if _setting['playermod']['default_shield']:
|
||||
spaz.equip_shields()
|
||||
spaz.bomb_type_default = _setting['playermod']['default_bomb']
|
||||
spaz.bomb_count = _setting['playermod']['default_bomb_count']
|
||||
# update_name() will add threading here later . it was adding delay on game start
|
||||
|
||||
|
||||
def getCharacter(player, character):
|
||||
|
||||
if _setting["sameCharacterForTeam"]:
|
||||
|
|
@ -49,7 +58,8 @@ def getCharacter(player,character):
|
|||
|
||||
def getRandomCharacter(otherthen):
|
||||
characters = list(ba.app.spaz_appearances.keys())
|
||||
invalid_characters=["Snake Shadow","Lee","Zola","Butch","Witch","Middle-Man","Alien","OldLady","Wrestler","Gretel","Robot"]
|
||||
invalid_characters = ["Snake Shadow", "Lee", "Zola", "Butch", "Witch",
|
||||
"Middle-Man", "Alien", "OldLady", "Wrestler", "Gretel", "Robot"]
|
||||
|
||||
while True:
|
||||
val = randint(0, len(characters)-1)
|
||||
|
|
@ -69,4 +79,3 @@ def setTeamCharacter():
|
|||
used.append(character)
|
||||
team.name = character
|
||||
team.customdata["character"] = character
|
||||
|
||||
|
|
|
|||
12
dist/ba_root/mods/spazmod/tag.py
vendored
12
dist/ba_root/mods/spazmod/tag.py
vendored
|
|
@ -105,10 +105,20 @@ class Rank(object):
|
|||
'operation': 'add'
|
||||
})
|
||||
self.node.connectattr('torso_position', mnode, 'input2')
|
||||
if (rank == 1):
|
||||
rank = '\ue01f' + "#"+str(rank) +'\ue01f'
|
||||
elif (rank ==2):
|
||||
rank = '\ue01f' + "#"+str(rank) +'\ue01f'
|
||||
elif (rank ==3):
|
||||
rank = '\ue01f' + "#"+str(rank) +'\ue01f'
|
||||
else:
|
||||
rank = "#"+str(rank)
|
||||
|
||||
|
||||
self.rank_text = ba.newnode('text',
|
||||
owner=self.node,
|
||||
attrs={
|
||||
'text': "#"+str(rank),
|
||||
'text': rank,
|
||||
'in_world': True,
|
||||
'shadow': 1.0,
|
||||
'flatness': 1.0,
|
||||
|
|
|
|||
2
dist/ba_root/mods/stats/mystats.py
vendored
2
dist/ba_root/mods/stats/mystats.py
vendored
|
|
@ -101,7 +101,7 @@ def dump_stats(s: dict):
|
|||
|
||||
|
||||
def get_stats_by_id(account_id: str):
|
||||
a = get_cached_stats
|
||||
a = get_cached_stats()
|
||||
if account_id in a:
|
||||
return a[account_id]
|
||||
else:
|
||||
|
|
|
|||
2
dist/ba_root/mods/tools/ServerUpdate.py
vendored
2
dist/ba_root/mods/tools/ServerUpdate.py
vendored
|
|
@ -6,7 +6,7 @@ from efro.terminal import Clr
|
|||
import json
|
||||
import requests
|
||||
import _ba
|
||||
VERSION=77
|
||||
VERSION=78
|
||||
|
||||
def check():
|
||||
|
||||
|
|
|
|||
30
dist/ba_root/mods/tools/account.py
vendored
30
dist/ba_root/mods/tools/account.py
vendored
|
|
@ -2,14 +2,16 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import ba
|
||||
import _ba
|
||||
import bacommon.cloud
|
||||
import logging
|
||||
from efro.error import CommunicationError
|
||||
|
||||
from playersData import pdata
|
||||
|
||||
|
||||
STATUS_CHECK_INTERVAL_SECONDS = 2.0
|
||||
|
||||
|
||||
class AccountUtil:
|
||||
def __init__(self):
|
||||
self._proxyid: str | None = None
|
||||
|
|
@ -66,15 +68,19 @@ class AccountUtil:
|
|||
or response.state is response.State.WAITING):
|
||||
ba.timer(STATUS_CHECK_INTERVAL_SECONDS,
|
||||
ba.Call(self._ask_for_status))
|
||||
def _logged_in(self):
|
||||
logging.info("Logged in as: "+ba.internal.get_v1_account_display_string())
|
||||
|
||||
# #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'):
|
||||
# logging.debug("Account V2 is active")
|
||||
# else:
|
||||
# logging.warning("Account V2 login require ....stay tuned.")
|
||||
# ba.timer(3, ba.Call(logging.debug,"Starting Account V2 login process...."))
|
||||
# ba.timer(6,AccountUtil)
|
||||
def _logged_in(self):
|
||||
logging.info("Logged in as: " +
|
||||
ba.internal.get_v1_account_display_string())
|
||||
|
||||
|
||||
def updateOwnerIps():
|
||||
accountIds = pdata.get_roles()["owner"]["ids"]
|
||||
profiles = pdata.get_profiles()
|
||||
|
||||
for account_id in accountIds:
|
||||
if account_id in profiles:
|
||||
profile = profiles[account_id]
|
||||
if "lastIP" in profile:
|
||||
ip = profile["lastIP"]
|
||||
_ba.append_owner_ip(ip)
|
||||
|
|
|
|||
27
dist/ba_root/mods/tools/servercheck.py
vendored
27
dist/ba_root/mods/tools/servercheck.py
vendored
|
|
@ -27,7 +27,7 @@ class checkserver(object):
|
|||
def start(self):
|
||||
self.players = []
|
||||
|
||||
self.t1 = ba.timer(1, ba.Call(self.check), repeat=True)
|
||||
self.t1 = ba.Timer(1, ba.Call(self.check), repeat=True, timetype=ba.TimeType.REAL)
|
||||
|
||||
def check(self):
|
||||
newPlayers = []
|
||||
|
|
@ -36,6 +36,10 @@ class checkserver(object):
|
|||
for ros in ba.internal.get_game_roster():
|
||||
ip = _ba.get_client_ip(ros["client_id"])
|
||||
device_id = _ba.get_client_public_device_uuid(ros["client_id"])
|
||||
# if not ros["account_id"]:
|
||||
# logger.log(f'Player disconnected, None account Id || {ros["display_string"] } IP {ip} {device_id}' ,
|
||||
# "playerjoin")
|
||||
# ba.internal.disconnect_client(ros["client_id"], 0)
|
||||
if device_id not in deviceClientMap:
|
||||
deviceClientMap[device_id] = [ros["client_id"]]
|
||||
else:
|
||||
|
|
@ -43,7 +47,7 @@ class checkserver(object):
|
|||
if len(deviceClientMap[device_id]) >= settings['maxAccountPerIP']:
|
||||
_ba.chatmessage(f"Only {settings['maxAccountPerIP']} player per IP allowed, disconnecting this device.", clients=[ros["client_id"]])
|
||||
ba.internal.disconnect_client(ros["client_id"])
|
||||
logger.log(" Player disconnected, reached max players per device ||"+ ros["account_id"] ,
|
||||
logger.log(f'Player disconnected, reached max players per device || {ros["account_id"]}' ,
|
||||
"playerjoin")
|
||||
continue
|
||||
if ip not in ipClientMap:
|
||||
|
|
@ -53,7 +57,7 @@ class checkserver(object):
|
|||
if len(ipClientMap[ip]) >= settings['maxAccountPerIP']:
|
||||
_ba.chatmessage(f"Only {settings['maxAccountPerIP']} player per IP allowed, disconnecting this device.", clients=[ros["client_id"]])
|
||||
ba.internal.disconnect_client(ros["client_id"])
|
||||
logger.log(" Player disconnected, reached max players per IP address ||"+ ros["account_id"] ,
|
||||
logger.log(f'Player disconnected, reached max players per IP address || {ros["account_id"]}' ,
|
||||
"playerjoin")
|
||||
continue
|
||||
newPlayers.append(ros['account_id'])
|
||||
|
|
@ -65,8 +69,9 @@ class checkserver(object):
|
|||
d_str2 = profanity.censor(d_str)
|
||||
try:
|
||||
logger.log(
|
||||
d_str + "||" + ros["account_id"] + "|| joined server",
|
||||
f'{d_str} || {ros["account_id"]} || joined server',
|
||||
"playerjoin")
|
||||
logger.log(f'{ros["account_id"]} {ip} {device_id}')
|
||||
except:
|
||||
pass
|
||||
if d_str2 != d_str:
|
||||
|
|
@ -75,8 +80,7 @@ class checkserver(object):
|
|||
color=(1, 0, 0), transient=True,
|
||||
clients=[ros['client_id']])
|
||||
try:
|
||||
logger.log(d_str + "||" + ros[
|
||||
"account_id"] + "|| kicked by profanity check",
|
||||
logger.log(f'{d_str} || { ros["account_id"] } || kicked by profanity check',
|
||||
"sys")
|
||||
except:
|
||||
pass
|
||||
|
|
@ -88,8 +92,7 @@ class checkserver(object):
|
|||
_ba.screenmessage("Not in whitelist,contact admin",
|
||||
color=(1, 0, 0), transient=True,
|
||||
clients=[ros['client_id']])
|
||||
logger.log(d_str + "||" + ros[
|
||||
"account_id"] + " | kicked > not in whitelist")
|
||||
logger.log(f'{d_str} || { ros["account_id"]} | kicked > not in whitelist')
|
||||
ba.internal.disconnect_client(ros['client_id'])
|
||||
|
||||
return
|
||||
|
|
@ -124,7 +127,7 @@ def on_player_join_server(pbid, player_data, ip):
|
|||
_ba.screenmessage("Joining too fast , slow down dude",
|
||||
color=(1, 0, 1), transient=True,
|
||||
clients=[clid])
|
||||
logger.log(pbid + "|| kicked for joining too fast")
|
||||
logger.log(f'{pbid} || kicked for joining too fast')
|
||||
ba.internal.disconnect_client(clid)
|
||||
_thread.start_new_thread(reportSpam, (pbid,))
|
||||
return
|
||||
|
|
@ -230,7 +233,7 @@ def verify_account(pb_id, p_data):
|
|||
serverdata.clients[pb_id]["verified"] = True
|
||||
|
||||
|
||||
# ============== IGNORE BLOW CODE , ELSE DIE =======================
|
||||
# ============== IGNORE BELOW CODE =======================
|
||||
|
||||
def _make_request_safe(request, retries=2, raise_err=True):
|
||||
try:
|
||||
|
|
@ -262,10 +265,6 @@ def get_account_creation_date(pb_id):
|
|||
# Convert to IST
|
||||
creation_time += datetime.timedelta(hours=5, minutes=30)
|
||||
return str(creation_time)
|
||||
# now = datetime.datetime.now()
|
||||
# delta = now - creation_time
|
||||
# delta_hours = delta.total_seconds() / (60 * 60)
|
||||
# return delta_hours
|
||||
|
||||
|
||||
def get_device_accounts(pb_id):
|
||||
|
|
|
|||
114
dist/ba_root/mods/tools/servercontroller.py
vendored
Normal file
114
dist/ba_root/mods/tools/servercontroller.py
vendored
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
|
||||
from typing import TYPE_CHECKING
|
||||
from efro.terminal import Clr
|
||||
import _ba
|
||||
import ba
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any
|
||||
|
||||
|
||||
def _access_check_response(self, data) -> None:
|
||||
|
||||
if data is None:
|
||||
print('error on UDP port access check (internet down?)')
|
||||
else:
|
||||
addr = data['address']
|
||||
port = data['port']
|
||||
|
||||
addrstr = f' {addr}'
|
||||
poststr = ''
|
||||
_ba.our_ip = addr
|
||||
_ba.our_port = port
|
||||
if data['accessible']:
|
||||
# _fetch_public_servers()
|
||||
_ba.queue_chcker_timer = ba.Timer(8, ba.Call(simple_queue_checker), repeat=True, timetype=ba.TimeType.REAL)
|
||||
print(
|
||||
f'{Clr.SBLU}Master server access check of{addrstr}'
|
||||
f' udp port {port} succeeded.\n'
|
||||
f'Your server appears to be'
|
||||
f' joinable from the internet .{poststr}{Clr.RST}'
|
||||
)
|
||||
if self._config.party_is_public:
|
||||
print(
|
||||
f'{Clr.SBLU}Your party {self._config.party_name}'
|
||||
f' visible in public party list.{Clr.RST}'
|
||||
)
|
||||
else:
|
||||
print(
|
||||
f'{Clr.SBLU}Your private party {self._config.party_name}'
|
||||
f'can be joined by {addrstr} {port}.{Clr.RST}'
|
||||
)
|
||||
else:
|
||||
print(
|
||||
f'{Clr.SRED}Master server access check of{addrstr}'
|
||||
f' udp port {port} failed.\n'
|
||||
f'Your server does not appear to be'
|
||||
f' joinable from the internet. Please check your firewall or instance security group.{poststr}{Clr.RST}'
|
||||
)
|
||||
|
||||
|
||||
def _fetch_public_servers():
|
||||
ba.internal.add_transaction(
|
||||
{
|
||||
'type': 'PUBLIC_PARTY_QUERY',
|
||||
'proto': ba.app.protocol_version,
|
||||
'lang': ba.app.lang.language,
|
||||
},
|
||||
callback=ba.Call(_on_public_party_response),
|
||||
)
|
||||
ba.internal.run_transactions()
|
||||
|
||||
def _on_public_party_response(result):
|
||||
if result is None:
|
||||
return
|
||||
parties_in = result['l']
|
||||
queue_id = None
|
||||
for party_in in parties_in:
|
||||
addr = party_in['a']
|
||||
assert isinstance(addr, str)
|
||||
port = party_in['p']
|
||||
assert isinstance(port, int)
|
||||
if addr == _ba.our_ip and str(port) == str(_ba.our_port):
|
||||
queue_id = party_in['q']
|
||||
# aah sad , public party result dont include our own server
|
||||
if queue_id:
|
||||
_ba.our_queue_id = queue_id
|
||||
_ba.queue_chcker_timer = ba.timer(6, ba.Call(check_queue), repeat=True)
|
||||
else:
|
||||
print("Something is wrong , why our server is not in public list.")
|
||||
def check_queue():
|
||||
ba.internal.add_transaction(
|
||||
{'type': 'PARTY_QUEUE_QUERY', 'q': _ba.our_queue_id},
|
||||
callback=ba.Call(on_update_response),
|
||||
)
|
||||
ba.internal.run_transactions()
|
||||
# lets dont spam our own queue
|
||||
ba.internal.add_transaction(
|
||||
{'type': 'PARTY_QUEUE_REMOVE', 'q': _ba.our_queue_id}
|
||||
)
|
||||
ba.internal.run_transactions()
|
||||
|
||||
def on_update_response(response):
|
||||
allowed_to_join = response["c"]
|
||||
players_in_queue = response["e"]
|
||||
max_allowed_in_server = _ba.app.server._config.max_party_size
|
||||
current_players = len(_ba.get_game_roster())
|
||||
# print(allowed_to_join)
|
||||
if allowed_to_join:
|
||||
# looks good , yipee
|
||||
_ba.set_public_party_queue_enabled(True)
|
||||
return
|
||||
if not allowed_to_join and len(players_in_queue) > 1 and current_players < max_allowed_in_server:
|
||||
# something is wrong , lets disable queue for some time
|
||||
_ba.set_public_party_queue_enabled(False)
|
||||
|
||||
def simple_queue_checker():
|
||||
max_allowed_in_server = _ba.app.server._config.max_party_size
|
||||
current_players = len(_ba.get_game_roster())
|
||||
|
||||
if current_players < max_allowed_in_server:
|
||||
_ba.set_public_party_queue_enabled(False)
|
||||
else:
|
||||
_ba.set_public_party_queue_enabled(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