mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-10-20 00:00:39 +00:00
Update to 1.7.9
This commit is contained in:
parent
a133256df2
commit
01faae6f31
21 changed files with 123 additions and 85 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
# Released under the MIT License. See LICENSE for details.
|
# Released under the MIT License. See LICENSE for details.
|
||||||
|
|
||||||
from playersData import pdata
|
from playersData import pdata
|
||||||
import ba, _ba
|
import ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -17,7 +18,7 @@ def clientid_to_accountid(clientid):
|
||||||
Returns:
|
Returns:
|
||||||
None
|
None
|
||||||
"""
|
"""
|
||||||
for i in _ba.get_game_roster():
|
for i in ba.internal.get_game_roster():
|
||||||
if i['client_id'] == clientid:
|
if i['client_id'] == clientid:
|
||||||
return i['account_id']
|
return i['account_id']
|
||||||
return None
|
return None
|
||||||
|
|
@ -52,6 +53,6 @@ def check_permissions(accountid, command):
|
||||||
|
|
||||||
|
|
||||||
def is_server(accid):
|
def is_server(accid):
|
||||||
for i in _ba.get_game_roster():
|
for i in ba.internal.get_game_roster():
|
||||||
if i['account_id']==accid and i['client_id']==-1:
|
if i['account_id']==accid and i['client_id']==-1:
|
||||||
return True
|
return True
|
||||||
|
|
@ -11,6 +11,7 @@ from .Handlers import check_permissions
|
||||||
from chatHandle.chatFilter import ChatFilter
|
from chatHandle.chatFilter import ChatFilter
|
||||||
from bastd.actor import popuptext
|
from bastd.actor import popuptext
|
||||||
import ba, _ba
|
import ba, _ba
|
||||||
|
import ba.internal
|
||||||
import setting
|
import setting
|
||||||
|
|
||||||
from serverData import serverdata
|
from serverData import serverdata
|
||||||
|
|
@ -98,12 +99,12 @@ def QuickAccess(msg, client_id):
|
||||||
if msg.startswith(","):
|
if msg.startswith(","):
|
||||||
name = ""
|
name = ""
|
||||||
teamid = 0
|
teamid = 0
|
||||||
for i in _ba.get_foreground_host_session().sessionplayers:
|
for i in ba.internal.get_foreground_host_session().sessionplayers:
|
||||||
if i.inputdevice.client_id == client_id:
|
if i.inputdevice.client_id == client_id:
|
||||||
teamid = i.sessionteam.id
|
teamid = i.sessionteam.id
|
||||||
name = i.getname(True)
|
name = i.getname(True)
|
||||||
|
|
||||||
for i in _ba.get_foreground_host_session().sessionplayers:
|
for i in ba.internal.get_foreground_host_session().sessionplayers:
|
||||||
if i.sessionteam and teamid == i.sessionteam.id and i.inputdevice.client_id != client_id:
|
if i.sessionteam and teamid == i.sessionteam.id and i.inputdevice.client_id != client_id:
|
||||||
_ba.screenmessage(name + ":" + msg[1:], clients=[i.inputdevice.client_id],
|
_ba.screenmessage(name + ":" + msg[1:], clients=[i.inputdevice.client_id],
|
||||||
color=(0.3, 0.6, 0.3), transient=True)
|
color=(0.3, 0.6, 0.3), transient=True)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
""" Some useful handlers to reduce lot of code """
|
""" Some useful handlers to reduce lot of code """
|
||||||
import _ba, ba
|
import _ba, ba
|
||||||
|
import ba.internal
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -16,7 +17,7 @@ def send(msg, clientid):
|
||||||
def clientid_to_myself(clientid):
|
def clientid_to_myself(clientid):
|
||||||
"""Return Player Index Of Self Player"""
|
"""Return Player Index Of Self Player"""
|
||||||
|
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
|
|
||||||
for i in range(len(session.sessionplayers)):
|
for i in range(len(session.sessionplayers)):
|
||||||
if session.sessionplayers[i].inputdevice.client_id == clientid:
|
if session.sessionplayers[i].inputdevice.client_id == clientid:
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ from playersData import pdata
|
||||||
# from tools.whitelist import add_to_white_list, add_commit_to_logs
|
# from tools.whitelist import add_to_white_list, add_commit_to_logs
|
||||||
from serverData import serverdata
|
from serverData import serverdata
|
||||||
import ba, _ba, time, setting
|
import ba, _ba, time, setting
|
||||||
|
import ba.internal
|
||||||
import _thread
|
import _thread
|
||||||
from tools import playlist
|
from tools import playlist
|
||||||
Commands = ['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']
|
Commands = ['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']
|
||||||
|
|
@ -112,7 +113,7 @@ def changepartysize(arguments):
|
||||||
if len(arguments)==0:
|
if len(arguments)==0:
|
||||||
_ba.chatmessage("enter number")
|
_ba.chatmessage("enter number")
|
||||||
else:
|
else:
|
||||||
_ba.set_public_party_max_size(int(arguments[0]))
|
ba.internal.set_public_party_max_size(int(arguments[0]))
|
||||||
|
|
||||||
def changeplaylist(arguments):
|
def changeplaylist(arguments):
|
||||||
if len(arguments)==0:
|
if len(arguments)==0:
|
||||||
|
|
@ -127,7 +128,7 @@ def changeplaylist(arguments):
|
||||||
|
|
||||||
|
|
||||||
def kick(arguments):
|
def kick(arguments):
|
||||||
_ba.disconnect_client(int(arguments[0]))
|
ba.internal.disconnect_client(int(arguments[0]))
|
||||||
return
|
return
|
||||||
def kikvote(arguments, clientid):
|
def kikvote(arguments, clientid):
|
||||||
if arguments == [] or arguments == [''] or len(arguments) < 2:
|
if arguments == [] or arguments == [''] or len(arguments) < 2:
|
||||||
|
|
@ -139,7 +140,7 @@ def kikvote(arguments, clientid):
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
cl_id=int(arguments[1])
|
cl_id=int(arguments[1])
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
if ros["client_id"]==cl_id:
|
if ros["client_id"]==cl_id:
|
||||||
if ros["account_id"] in serverdata.clients:
|
if ros["account_id"] in serverdata.clients:
|
||||||
serverdata.clients[ros["account_id"]]["canStartKickVote"]=True
|
serverdata.clients[ros["account_id"]]["canStartKickVote"]=True
|
||||||
|
|
@ -154,7 +155,7 @@ def kikvote(arguments, clientid):
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
cl_id=int(arguments[1])
|
cl_id=int(arguments[1])
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
if ros["client_id"]==cl_id:
|
if ros["client_id"]==cl_id:
|
||||||
_ba.disable_kickvote(ros["account_id"])
|
_ba.disable_kickvote(ros["account_id"])
|
||||||
send("Kick-vote disabled for this person", clientid)
|
send("Kick-vote disabled for this person", clientid)
|
||||||
|
|
@ -167,14 +168,14 @@ def kikvote(arguments, clientid):
|
||||||
return
|
return
|
||||||
|
|
||||||
def last_msgs(clientid):
|
def last_msgs(clientid):
|
||||||
for i in _ba.get_chat_messages():
|
for i in ba.internal.get_chat_messages():
|
||||||
send(i,clientid)
|
send(i,clientid)
|
||||||
|
|
||||||
def get_profiles(arguments,clientid):
|
def get_profiles(arguments,clientid):
|
||||||
try:
|
try:
|
||||||
playerID = int(arguments[0])
|
playerID = int(arguments[0])
|
||||||
num = 1
|
num = 1
|
||||||
for i in _ba.get_foreground_host_session().sessionplayers[playerID].inputdevice.get_player_profiles():
|
for i in ba.internal.get_foreground_host_session().sessionplayers[playerID].inputdevice.get_player_profiles():
|
||||||
try:
|
try:
|
||||||
send(f"{num})- {i}",clientid)
|
send(f"{num})- {i}",clientid)
|
||||||
num += 1
|
num += 1
|
||||||
|
|
@ -185,10 +186,10 @@ def get_profiles(arguments,clientid):
|
||||||
|
|
||||||
def party_toggle(arguments):
|
def party_toggle(arguments):
|
||||||
if arguments == ['public']:
|
if arguments == ['public']:
|
||||||
_ba.set_public_party_enabled(True)
|
ba.internal.set_public_party_enabled(True)
|
||||||
_ba.chatmessage("party is public now")
|
_ba.chatmessage("party is public now")
|
||||||
elif arguments == ['private']:
|
elif arguments == ['private']:
|
||||||
_ba.set_public_party_enabled(False)
|
ba.internal.set_public_party_enabled(False)
|
||||||
_ba.chatmessage("party is private now")
|
_ba.chatmessage("party is private now")
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
@ -206,7 +207,7 @@ def ban(arguments):
|
||||||
try:
|
try:
|
||||||
cl_id=int(arguments[0])
|
cl_id=int(arguments[0])
|
||||||
ac_id=""
|
ac_id=""
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
if ros["client_id"]==cl_id:
|
if ros["client_id"]==cl_id:
|
||||||
_thread.start_new_thread(pdata.ban_player,(ros['account_id'],))
|
_thread.start_new_thread(pdata.ban_player,(ros['account_id'],))
|
||||||
|
|
||||||
|
|
@ -232,7 +233,7 @@ def mute(arguments):
|
||||||
try:
|
try:
|
||||||
cl_id=int(arguments[0])
|
cl_id=int(arguments[0])
|
||||||
ac_id=""
|
ac_id=""
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
if ros["client_id"]==cl_id:
|
if ros["client_id"]==cl_id:
|
||||||
_thread.start_new_thread(pdata.mute,(ros['account_id'],))
|
_thread.start_new_thread(pdata.mute,(ros['account_id'],))
|
||||||
|
|
||||||
|
|
@ -251,7 +252,7 @@ def un_mute(arguments):
|
||||||
try:
|
try:
|
||||||
cl_id=int(arguments[0])
|
cl_id=int(arguments[0])
|
||||||
ac_id=""
|
ac_id=""
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
if ros["client_id"]==cl_id:
|
if ros["client_id"]==cl_id:
|
||||||
pdata.unmute(ros['account_id'])
|
pdata.unmute(ros['account_id'])
|
||||||
ac_id=ros['account_id']
|
ac_id=ros['account_id']
|
||||||
|
|
@ -269,13 +270,13 @@ def remove(arguments):
|
||||||
return
|
return
|
||||||
|
|
||||||
elif arguments[0] == 'all':
|
elif arguments[0] == 'all':
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
for i in session.sessionplayers:
|
for i in session.sessionplayers:
|
||||||
i.remove_from_game()
|
i.remove_from_game()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
for i in session.sessionplayers:
|
for i in session.sessionplayers:
|
||||||
if i.inputdevice.client_id== int(arguments[0]):
|
if i.inputdevice.client_id== int(arguments[0]):
|
||||||
i.remove_from_game()
|
i.remove_from_game()
|
||||||
|
|
@ -369,7 +370,7 @@ def create_role(arguments):
|
||||||
def add_role_to_player(arguments):
|
def add_role_to_player(arguments):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
for i in session.sessionplayers:
|
for i in session.sessionplayers:
|
||||||
if i.inputdevice.client_id== int(arguments[1]):
|
if i.inputdevice.client_id== int(arguments[1]):
|
||||||
roles=pdata.add_player_role(arguments[0],i.get_v1_account_id())
|
roles=pdata.add_player_role(arguments[0],i.get_v1_account_id())
|
||||||
|
|
@ -380,7 +381,7 @@ def add_role_to_player(arguments):
|
||||||
|
|
||||||
def remove_role_from_player(arguments):
|
def remove_role_from_player(arguments):
|
||||||
try:
|
try:
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
for i in session.sessionplayers:
|
for i in session.sessionplayers:
|
||||||
if i.inputdevice.client_id== int(arguments[1]):
|
if i.inputdevice.client_id== int(arguments[1]):
|
||||||
roles=pdata.remove_player_role(arguments[0],i.get_v1_account_id())
|
roles=pdata.remove_player_role(arguments[0],i.get_v1_account_id())
|
||||||
|
|
@ -389,7 +390,7 @@ def remove_role_from_player(arguments):
|
||||||
return
|
return
|
||||||
def get_roles_of_player(arguments,clientid):
|
def get_roles_of_player(arguments,clientid):
|
||||||
try:
|
try:
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
roles=[]
|
roles=[]
|
||||||
reply=""
|
reply=""
|
||||||
for i in session.sessionplayers:
|
for i in session.sessionplayers:
|
||||||
|
|
@ -409,7 +410,7 @@ def change_role_tag(arguments):
|
||||||
|
|
||||||
def set_custom_tag(arguments):
|
def set_custom_tag(arguments):
|
||||||
try:
|
try:
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
for i in session.sessionplayers:
|
for i in session.sessionplayers:
|
||||||
if i.inputdevice.client_id== int(arguments[1]):
|
if i.inputdevice.client_id== int(arguments[1]):
|
||||||
roles=pdata.set_tag(arguments[0],i.get_v1_account_id())
|
roles=pdata.set_tag(arguments[0],i.get_v1_account_id())
|
||||||
|
|
@ -417,7 +418,7 @@ def set_custom_tag(arguments):
|
||||||
return
|
return
|
||||||
def set_custom_effect(arguments):
|
def set_custom_effect(arguments):
|
||||||
try:
|
try:
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
for i in session.sessionplayers:
|
for i in session.sessionplayers:
|
||||||
if i.inputdevice.client_id== int(arguments[1]):
|
if i.inputdevice.client_id== int(arguments[1]):
|
||||||
roles=pdata.set_effect(arguments[0],i.get_v1_account_id())
|
roles=pdata.set_effect(arguments[0],i.get_v1_account_id())
|
||||||
|
|
@ -469,7 +470,7 @@ def remove_command_to_role(arguments):
|
||||||
# return
|
# return
|
||||||
|
|
||||||
# else:
|
# else:
|
||||||
# rost = _ba.get_game_roster()
|
# rost = ba.internal.get_game_roster()
|
||||||
|
|
||||||
# for i in rost:
|
# for i in rost:
|
||||||
# if i['client_id'] == int(arguments[0]):
|
# if i['client_id'] == int(arguments[0]):
|
||||||
|
|
@ -502,8 +503,9 @@ def change_lobby_check_time(arguments):
|
||||||
try:
|
try:
|
||||||
argument = int(arguments[0])
|
argument = int(arguments[0])
|
||||||
except:
|
except:
|
||||||
_ba.chatmessage("must type numbe to change lobby check time")
|
_ba.chatmessage("must type number to change lobby check time")
|
||||||
|
return
|
||||||
settings = setting.get_settings_data()
|
settings = setting.get_settings_data()
|
||||||
settings["white_list"]["lobbychecktime"] = argument
|
settings["white_list"]["lobbychecktime"] = argument
|
||||||
setting.commit(settings)
|
setting.commit(settings)
|
||||||
_ba.chatmessage(f"lobby check time is {arg} now")
|
_ba.chatmessage(f"lobby check time is {argument} now")
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from .Handlers import send
|
from .Handlers import send
|
||||||
import ba, _ba
|
import ba, _ba
|
||||||
|
import ba.internal
|
||||||
from stats import mystats
|
from stats import mystats
|
||||||
from ba._general import Call
|
from ba._general import Call
|
||||||
import _thread
|
import _thread
|
||||||
|
|
@ -56,7 +57,7 @@ def list(clientid):
|
||||||
|
|
||||||
|
|
||||||
list = p.format('Name', 'Client ID' , 'Player ID')+seprator
|
list = p.format('Name', 'Client ID' , 'Player ID')+seprator
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
|
|
||||||
|
|
||||||
for index, player in enumerate(session.sessionplayers):
|
for index, player in enumerate(session.sessionplayers):
|
||||||
|
|
@ -76,7 +77,7 @@ def accountid_request(arguments, clientid, accountid):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
player = session.sessionplayers[int(arguments[0])]
|
player = session.sessionplayers[int(arguments[0])]
|
||||||
|
|
||||||
name = player.getname(full=True, icon=True)
|
name = player.getname(full=True, icon=True)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
# Released under the MIT License. See LICENSE for details.
|
# Released under the MIT License. See LICENSE for details.
|
||||||
import ba, _ba
|
import ba, _ba
|
||||||
|
import ba.internal
|
||||||
from serverData import serverdata
|
from serverData import serverdata
|
||||||
from features import profanity
|
from features import profanity
|
||||||
from tools import servercheck
|
from tools import servercheck
|
||||||
|
|
@ -52,7 +53,7 @@ def filter(msg,pb_id,client_id):
|
||||||
smsgcount+=1
|
smsgcount+=1
|
||||||
if smsgcount>=3:
|
if smsgcount>=3:
|
||||||
logger.log(pb_id+" | kicked for chat spam")
|
logger.log(pb_id+" | kicked for chat spam")
|
||||||
_ba.disconnect_client(client_id)
|
ba.internal.disconnect_client(client_id)
|
||||||
smsgcount=0
|
smsgcount=0
|
||||||
_ba.screenmessage("Don\'t SPAM!", color=(1,0,0), transient=True, clients=[client_id])
|
_ba.screenmessage("Don\'t SPAM!", color=(1,0,0), transient=True, clients=[client_id])
|
||||||
if not check_permissions(pb_id):
|
if not check_permissions(pb_id):
|
||||||
|
|
@ -88,7 +89,7 @@ def addWarn(pb_id,client_id):
|
||||||
if warn > settings["maxWarnCount"]:
|
if warn > settings["maxWarnCount"]:
|
||||||
_ba.screenmessage(settings["afterWarnKickMsg"],color=(1,0,0),transient=True,clients=[client_id])
|
_ba.screenmessage(settings["afterWarnKickMsg"],color=(1,0,0),transient=True,clients=[client_id])
|
||||||
logger.log(pb_id+" | kicked for chat spam")
|
logger.log(pb_id+" | kicked for chat spam")
|
||||||
_ba.disconnect_client(client_id)
|
ba.internal.disconnect_client(client_id)
|
||||||
_thread.start_new_thread(servercheck.reportSpam,(pb_id,))
|
_thread.start_new_thread(servercheck.reportSpam,(pb_id,))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
3
dist/ba_root/mods/chatHandle/handlechat.py
vendored
3
dist/ba_root/mods/chatHandle/handlechat.py
vendored
|
|
@ -7,6 +7,7 @@ from tools import logger, servercheck
|
||||||
from chatHandle.chatFilter import ChatFilter
|
from chatHandle.chatFilter import ChatFilter
|
||||||
from features import EndVote
|
from features import EndVote
|
||||||
import ba, _ba
|
import ba, _ba
|
||||||
|
import ba.internal
|
||||||
import setting
|
import setting
|
||||||
|
|
||||||
settings = setting.get_settings_data()
|
settings = setting.get_settings_data()
|
||||||
|
|
@ -22,7 +23,7 @@ def filter_chat_message(msg, client_id):
|
||||||
displaystring = ""
|
displaystring = ""
|
||||||
currentname = ""
|
currentname = ""
|
||||||
|
|
||||||
for i in _ba.get_game_roster():
|
for i in ba.internal.get_game_roster():
|
||||||
if i['client_id'] == client_id:
|
if i['client_id'] == client_id:
|
||||||
acid = i['account_id']
|
acid = i['account_id']
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
3
dist/ba_root/mods/features/EndVote.py
vendored
3
dist/ba_root/mods/features/EndVote.py
vendored
|
|
@ -1,6 +1,7 @@
|
||||||
# EndVote by -mr.smoothy
|
# EndVote by -mr.smoothy
|
||||||
|
|
||||||
import _ba, ba
|
import _ba, ba
|
||||||
|
import ba.internal
|
||||||
import time
|
import time
|
||||||
|
|
||||||
last_end_vote_start_time = 0
|
last_end_vote_start_time = 0
|
||||||
|
|
@ -27,7 +28,7 @@ def vote_end(pb_id, client_id):
|
||||||
|
|
||||||
# clean up voters list
|
# clean up voters list
|
||||||
active_players = []
|
active_players = []
|
||||||
for player in _ba.get_game_roster():
|
for player in ba.internal.get_game_roster():
|
||||||
active_players.append(player['account_id'])
|
active_players.append(player['account_id'])
|
||||||
for voter in voters:
|
for voter in voters:
|
||||||
if voter not in active_players:
|
if voter not in active_players:
|
||||||
|
|
|
||||||
9
dist/ba_root/mods/features/afk_check.py
vendored
9
dist/ba_root/mods/features/afk_check.py
vendored
|
|
@ -3,6 +3,7 @@ import time
|
||||||
import ba
|
import ba
|
||||||
from ba._general import Call
|
from ba._general import Call
|
||||||
import _ba
|
import _ba
|
||||||
|
import ba.internal
|
||||||
import setting
|
import setting
|
||||||
settings = setting.get_settings_data()
|
settings = setting.get_settings_data()
|
||||||
INGAME_TIME=settings["afk_remover"]["ingame_idle_time_in_secs"]
|
INGAME_TIME=settings["afk_remover"]["ingame_idle_time_in_secs"]
|
||||||
|
|
@ -14,7 +15,7 @@ class checkIdle(object):
|
||||||
self.lobbies={}
|
self.lobbies={}
|
||||||
def check(self):
|
def check(self):
|
||||||
current=ba.time(ba.TimeType.REAL,timeformat=ba.TimeFormat.MILLISECONDS)
|
current=ba.time(ba.TimeType.REAL,timeformat=ba.TimeFormat.MILLISECONDS)
|
||||||
for player in _ba.get_foreground_host_session().sessionplayers:
|
for player in ba.internal.get_foreground_host_session().sessionplayers:
|
||||||
last_input=int(player.inputdevice.get_last_input_time())
|
last_input=int(player.inputdevice.get_last_input_time())
|
||||||
afk_time=int((current-last_input)/1000)
|
afk_time=int((current-last_input)/1000)
|
||||||
if afk_time in range(INGAME_TIME,INGAME_TIME+20):
|
if afk_time in range(INGAME_TIME,INGAME_TIME+20):
|
||||||
|
|
@ -23,7 +24,7 @@ class checkIdle(object):
|
||||||
player.remove_from_game()
|
player.remove_from_game()
|
||||||
if LOBBY_KICK:
|
if LOBBY_KICK:
|
||||||
current_players=[]
|
current_players=[]
|
||||||
for player in _ba.get_game_roster():
|
for player in ba.internal.get_game_roster():
|
||||||
if player['client_id'] !=-1 and len(player['players']) ==0:
|
if player['client_id'] !=-1 and len(player['players']) ==0:
|
||||||
current_players.append(player['client_id'])
|
current_players.append(player['client_id'])
|
||||||
if player['client_id'] not in self.lobbies:
|
if player['client_id'] not in self.lobbies:
|
||||||
|
|
@ -32,14 +33,14 @@ class checkIdle(object):
|
||||||
if lobby_afk in range(INLOBBY_TIME,INLOBBY_TIME+10):
|
if lobby_afk in range(INLOBBY_TIME,INLOBBY_TIME+10):
|
||||||
_ba.screenmessage("Join game within "+str(INLOBBY_TIME+10-lobby_afk)+" secs",color=(1,0,0),transient=True,clients=[player['client_id']])
|
_ba.screenmessage("Join game within "+str(INLOBBY_TIME+10-lobby_afk)+" secs",color=(1,0,0),transient=True,clients=[player['client_id']])
|
||||||
if lobby_afk > INLOBBY_TIME+ 10:
|
if lobby_afk > INLOBBY_TIME+ 10:
|
||||||
_ba.disconnect_client(player['client_id'],0)
|
ba.internal.disconnect_client(player['client_id'],0)
|
||||||
# clean the lobbies dict
|
# clean the lobbies dict
|
||||||
temp=self.lobbies.copy()
|
temp=self.lobbies.copy()
|
||||||
for clid in temp:
|
for clid in temp:
|
||||||
if clid not in current_players:
|
if clid not in current_players:
|
||||||
del self.lobbies[clid]
|
del self.lobbies[clid]
|
||||||
def warn_player(self,pbid,msg):
|
def warn_player(self,pbid,msg):
|
||||||
for player in _ba.get_game_roster():
|
for player in ba.internal.get_game_roster():
|
||||||
if player["account_id"]==pbid:
|
if player["account_id"]==pbid:
|
||||||
_ba.screenmessage(msg,color=(1,0,0),transient=True,clients=[player['client_id']])
|
_ba.screenmessage(msg,color=(1,0,0),transient=True,clients=[player['client_id']])
|
||||||
|
|
||||||
|
|
|
||||||
7
dist/ba_root/mods/features/discord_bot.py
vendored
7
dist/ba_root/mods/features/discord_bot.py
vendored
|
|
@ -6,6 +6,7 @@ from discord.ext.commands import Bot
|
||||||
import ba
|
import ba
|
||||||
from ba._general import Call
|
from ba._general import Call
|
||||||
import _ba
|
import _ba
|
||||||
|
import ba.internal
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import _thread
|
import _thread
|
||||||
|
|
@ -168,15 +169,15 @@ class BsDataThread(object):
|
||||||
currentMap=''
|
currentMap=''
|
||||||
global stats
|
global stats
|
||||||
|
|
||||||
for i in _ba.get_game_roster():
|
for i in ba.internal.get_game_roster():
|
||||||
try:
|
try:
|
||||||
liveplayers[i['account_id']]={'name':i['players'][0]['name_full'],'client_id':i['client_id'],'device_id':i['display_string']}
|
liveplayers[i['account_id']]={'name':i['players'][0]['name_full'],'client_id':i['client_id'],'device_id':i['display_string']}
|
||||||
except:
|
except:
|
||||||
liveplayers[i['account_id']]={'name':"<in-lobby>",'clientid':i['client_id'],'device_id':i['display_string']}
|
liveplayers[i['account_id']]={'name':"<in-lobby>",'clientid':i['client_id'],'device_id':i['display_string']}
|
||||||
try:
|
try:
|
||||||
nextMap=_ba.get_foreground_host_session().get_next_game_description().evaluate()
|
nextMap=ba.internal.get_foreground_host_session().get_next_game_description().evaluate()
|
||||||
|
|
||||||
current_game_spec=_ba.get_foreground_host_session()._current_game_spec
|
current_game_spec=ba.internal.get_foreground_host_session()._current_game_spec
|
||||||
gametype: Type[GameActivity] =current_game_spec['resolved_type']
|
gametype: Type[GameActivity] =current_game_spec['resolved_type']
|
||||||
|
|
||||||
currentMap=gametype.get_settings_display_string(current_game_spec).evaluate()
|
currentMap=gametype.get_settings_display_string(current_game_spec).evaluate()
|
||||||
|
|
|
||||||
11
dist/ba_root/mods/features/team_balancer.py
vendored
11
dist/ba_root/mods/features/team_balancer.py
vendored
|
|
@ -1,4 +1,5 @@
|
||||||
import _ba,ba
|
import _ba,ba
|
||||||
|
import ba.internal
|
||||||
import setting
|
import setting
|
||||||
from serverData import serverdata
|
from serverData import serverdata
|
||||||
|
|
||||||
|
|
@ -9,7 +10,7 @@ from tools import playlist
|
||||||
|
|
||||||
def balanceTeams():
|
def balanceTeams():
|
||||||
|
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
if settings["coopModeWithLessPlayers"]["enable"] and len(session.sessionplayers) < settings["coopModeWithLessPlayers"]["minPlayerToExitCoop"]:
|
if settings["coopModeWithLessPlayers"]["enable"] and len(session.sessionplayers) < settings["coopModeWithLessPlayers"]["minPlayerToExitCoop"]:
|
||||||
playlist.setPlaylist('coop')
|
playlist.setPlaylist('coop')
|
||||||
return
|
return
|
||||||
|
|
@ -37,7 +38,7 @@ def movePlayers(fromTeam,toTeam,count):
|
||||||
return
|
return
|
||||||
# disabling team balance for now , until we found solution
|
# disabling team balance for now , until we found solution
|
||||||
# Error : on score screen when shifted player left the game on_player_leave unable to found player in activity team
|
# Error : on score screen when shifted player left the game on_player_leave unable to found player in activity team
|
||||||
session=_ba.get_foreground_host_session()
|
session=ba.internal.get_foreground_host_session()
|
||||||
fromTeam=session.sessionteams[fromTeam]
|
fromTeam=session.sessionteams[fromTeam]
|
||||||
toTeam=session.sessionteams[toTeam]
|
toTeam=session.sessionteams[toTeam]
|
||||||
for i in range(0,count):
|
for i in range(0,count):
|
||||||
|
|
@ -50,12 +51,12 @@ def movePlayers(fromTeam,toTeam,count):
|
||||||
toTeam.players.append(player)
|
toTeam.players.append(player)
|
||||||
|
|
||||||
def broadCastShiftMsg(pb_id):
|
def broadCastShiftMsg(pb_id):
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
if ros['account_id']==pb_id:
|
if ros['account_id']==pb_id:
|
||||||
_ba.screenmessage("Shifted "+ros["display_string"]+" to balance team")
|
_ba.screenmessage("Shifted "+ros["display_string"]+" to balance team")
|
||||||
|
|
||||||
def on_player_join():
|
def on_player_join():
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
if len(session.sessionplayers)>1:
|
if len(session.sessionplayers)>1:
|
||||||
return
|
return
|
||||||
if isinstance(session,DualTeamSession):
|
if isinstance(session,DualTeamSession):
|
||||||
|
|
@ -69,7 +70,7 @@ def on_player_join():
|
||||||
|
|
||||||
|
|
||||||
def checkToExitCoop():
|
def checkToExitCoop():
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
if len(session.sessionplayers) >= settings["coopModeWithLessPlayers"]["minPlayerToExitCoop"] and not serverdata.coopmode:
|
if len(session.sessionplayers) >= settings["coopModeWithLessPlayers"]["minPlayerToExitCoop"] and not serverdata.coopmode:
|
||||||
playlist.setPlaylist('default')
|
playlist.setPlaylist('default')
|
||||||
|
|
||||||
|
|
|
||||||
3
dist/ba_root/mods/features/text_on_map.py
vendored
3
dist/ba_root/mods/features/text_on_map.py
vendored
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
from ba._generated.enums import TimeType
|
from ba._generated.enums import TimeType
|
||||||
import ba, _ba
|
import ba, _ba
|
||||||
|
import ba.internal
|
||||||
import setting
|
import setting
|
||||||
from stats import mystats
|
from stats import mystats
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
@ -23,7 +24,7 @@ class textonmap:
|
||||||
nextMap=""
|
nextMap=""
|
||||||
try:
|
try:
|
||||||
|
|
||||||
nextMap=_ba.get_foreground_host_session().get_next_game_description().evaluate()
|
nextMap=ba.internal.get_foreground_host_session().get_next_game_description().evaluate()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
self.index = 0
|
self.index = 0
|
||||||
|
|
|
||||||
6
dist/ba_root/mods/playersData/pdata.py
vendored
6
dist/ba_root/mods/playersData/pdata.py
vendored
|
|
@ -12,7 +12,9 @@ import _thread
|
||||||
|
|
||||||
from serverData import serverdata
|
from serverData import serverdata
|
||||||
from tools.file_handle import OpenJson
|
from tools.file_handle import OpenJson
|
||||||
import _ba # pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
|
import _ba
|
||||||
|
import ba.internal
|
||||||
import json
|
import json
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
@ -131,7 +133,7 @@ def add_profile(
|
||||||
serverdata.clients[account_id]["rejoincount"] = 1
|
serverdata.clients[account_id]["rejoincount"] = 1
|
||||||
serverdata.clients[account_id]["lastJoin"] = time.time()
|
serverdata.clients[account_id]["lastJoin"] = time.time()
|
||||||
cid = 113
|
cid = 113
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
if ros['account_id'] == account_id:
|
if ros['account_id'] == account_id:
|
||||||
cid = ros['client_id']
|
cid = ros['client_id']
|
||||||
serverdata.clients[account_id]["lastIP"] = _ba.get_client_ip(cid)
|
serverdata.clients[account_id]["lastIP"] = _ba.get_client_ip(cid)
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ from __future__ import annotations
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import ba,_ba
|
import ba,_ba
|
||||||
|
import ba.internal
|
||||||
from bastd.actor.playerspaz import PlayerSpaz
|
from bastd.actor.playerspaz import PlayerSpaz
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -163,7 +164,7 @@ def _set_ready(self, ready: bool) -> None:
|
||||||
|
|
||||||
# Give their input-device UI ownership too
|
# Give their input-device UI ownership too
|
||||||
# (prevent someone else from snatching it in crowded games)
|
# (prevent someone else from snatching it in crowded games)
|
||||||
_ba.set_ui_input_device(self._sessionplayer.inputdevice)
|
ba.internal.set_ui_input_device(self._sessionplayer.inputdevice)
|
||||||
return
|
return
|
||||||
|
|
||||||
if ready==False:
|
if ready==False:
|
||||||
|
|
|
||||||
11
dist/ba_root/mods/plugins/bcs_plugin.py
vendored
11
dist/ba_root/mods/plugins/bcs_plugin.py
vendored
|
|
@ -5,6 +5,7 @@
|
||||||
from typing import Optional, Any, Dict, List, Type, Sequence
|
from typing import Optional, Any, Dict, List, Type, Sequence
|
||||||
from ba._gameactivity import GameActivity
|
from ba._gameactivity import GameActivity
|
||||||
import ba,_ba
|
import ba,_ba
|
||||||
|
import ba.internal
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import _thread
|
import _thread
|
||||||
|
|
@ -53,7 +54,7 @@ class BsDataThread(object):
|
||||||
nextMap=''
|
nextMap=''
|
||||||
currentMap=''
|
currentMap=''
|
||||||
global stats
|
global stats
|
||||||
for i in _ba.get_game_roster():
|
for i in ba.internal.get_game_roster():
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -61,9 +62,9 @@ class BsDataThread(object):
|
||||||
except:
|
except:
|
||||||
liveplayers[i['account_id']]={'name':"<in-lobby>",'clientid':i['client_id'],'device_id':i['display_string']}
|
liveplayers[i['account_id']]={'name':"<in-lobby>",'clientid':i['client_id'],'device_id':i['display_string']}
|
||||||
try:
|
try:
|
||||||
nextMap=_ba.get_foreground_host_session().get_next_game_description().evaluate()
|
nextMap=ba.internal.get_foreground_host_session().get_next_game_description().evaluate()
|
||||||
|
|
||||||
current_game_spec=_ba.get_foreground_host_session()._current_game_spec
|
current_game_spec=ba.internal.get_foreground_host_session()._current_game_spec
|
||||||
gametype: Type[GameActivity] =current_game_spec['resolved_type']
|
gametype: Type[GameActivity] =current_game_spec['resolved_type']
|
||||||
|
|
||||||
currentMap=gametype.get_settings_display_string(current_game_spec).evaluate()
|
currentMap=gametype.get_settings_display_string(current_game_spec).evaluate()
|
||||||
|
|
@ -74,7 +75,7 @@ class BsDataThread(object):
|
||||||
system={'cpu':"null",'ram':'null'}
|
system={'cpu':"null",'ram':'null'}
|
||||||
stats['system']=system
|
stats['system']=system
|
||||||
stats['roster']=liveplayers
|
stats['roster']=liveplayers
|
||||||
stats['chats']=_ba.get_chat_messages()
|
stats['chats']=ba.internal.get_chat_messages()
|
||||||
stats['playlist']=minigame
|
stats['playlist']=minigame
|
||||||
stats['teamInfo']=self.getTeamInfo()
|
stats['teamInfo']=self.getTeamInfo()
|
||||||
|
|
||||||
|
|
@ -83,7 +84,7 @@ class BsDataThread(object):
|
||||||
def getTeamInfo(self):
|
def getTeamInfo(self):
|
||||||
data={}
|
data={}
|
||||||
|
|
||||||
session=_ba.get_foreground_host_session()
|
session=ba.internal.get_foreground_host_session()
|
||||||
data['sessionType']=type(session).__name__
|
data['sessionType']=type(session).__name__
|
||||||
teams=session.sessionteams
|
teams=session.sessionteams
|
||||||
for team in teams:
|
for team in teams:
|
||||||
|
|
|
||||||
19
dist/ba_root/mods/plugins/elPatronPowerups.py
vendored
19
dist/ba_root/mods/plugins/elPatronPowerups.py
vendored
File diff suppressed because one or more lines are too long
3
dist/ba_root/mods/spazmod/effects.py
vendored
3
dist/ba_root/mods/spazmod/effects.py
vendored
|
|
@ -16,6 +16,7 @@ from bastd.actor import spaz,spazappearance
|
||||||
from bastd.actor import bomb as stdbomb
|
from bastd.actor import bomb as stdbomb
|
||||||
from bastd.actor.powerupbox import PowerupBoxFactory
|
from bastd.actor.powerupbox import PowerupBoxFactory
|
||||||
import ba,_ba,bastd,weakref,random,math,time,base64,os,json,setting
|
import ba,_ba,bastd,weakref,random,math,time,base64,os,json,setting
|
||||||
|
import ba.internal
|
||||||
from playersData import pdata
|
from playersData import pdata
|
||||||
from stats import mystats
|
from stats import mystats
|
||||||
PlayerType = TypeVar('PlayerType', bound=ba.Player)
|
PlayerType = TypeVar('PlayerType', bound=ba.Player)
|
||||||
|
|
@ -156,7 +157,7 @@ class Effect(ba.Actor):
|
||||||
node_id = self.source_player.node.playerID
|
node_id = self.source_player.node.playerID
|
||||||
cl_str = None
|
cl_str = None
|
||||||
clID = None
|
clID = None
|
||||||
for c in _ba.get_foreground_host_session().sessionplayers:
|
for c in ba.internal.get_foreground_host_session().sessionplayers:
|
||||||
if (c.activityplayer) and (c.activityplayer.node.playerID == node_id):
|
if (c.activityplayer) and (c.activityplayer.node.playerID == node_id):
|
||||||
profiles = c.inputdevice.get_player_profiles()
|
profiles = c.inputdevice.get_player_profiles()
|
||||||
clID = c.inputdevice.client_id
|
clID = c.inputdevice.client_id
|
||||||
|
|
|
||||||
3
dist/ba_root/mods/spazmod/hitmessage.py
vendored
3
dist/ba_root/mods/spazmod/hitmessage.py
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
# Released under the MIT License. See LICENSE for details.
|
# Released under the MIT License. See LICENSE for details.
|
||||||
|
|
||||||
import ba, _ba, setting
|
import ba, _ba, setting
|
||||||
|
import ba.internal
|
||||||
from stats.mystats import damage_data
|
from stats.mystats import damage_data
|
||||||
from bastd.actor.popuptext import PopupText
|
from bastd.actor.popuptext import PopupText
|
||||||
|
|
||||||
|
|
@ -18,7 +19,7 @@ def handle_hit(msg, hp, dmg, hit_by, msg_pos):
|
||||||
hit_by_id = hit_by.node.playerID
|
hit_by_id = hit_by.node.playerID
|
||||||
if hit_by_id is not None:
|
if hit_by_id is not None:
|
||||||
hit_by_account_id = None
|
hit_by_account_id = None
|
||||||
for c in _ba.get_foreground_host_session().sessionplayers:
|
for c in ba.internal.get_foreground_host_session().sessionplayers:
|
||||||
if (c.activityplayer) and (c.activityplayer.node.playerID == hit_by_id):
|
if (c.activityplayer) and (c.activityplayer.node.playerID == hit_by_id):
|
||||||
hit_by_account_id = c.get_v1_account_id()
|
hit_by_account_id = c.get_v1_account_id()
|
||||||
if hit_by_account_id in damage_data: damage_data[hit_by_account_id] += float(dmg)
|
if hit_by_account_id in damage_data: damage_data[hit_by_account_id] += float(dmg)
|
||||||
|
|
|
||||||
7
dist/ba_root/mods/spazmod/modifyspaz.py
vendored
7
dist/ba_root/mods/spazmod/modifyspaz.py
vendored
|
|
@ -4,13 +4,14 @@ import setting
|
||||||
from random import randint
|
from random import randint
|
||||||
|
|
||||||
import _ba,ba
|
import _ba,ba
|
||||||
|
import ba.internal
|
||||||
_setting=setting.get_settings_data()
|
_setting=setting.get_settings_data()
|
||||||
|
|
||||||
def update_name():
|
def update_name():
|
||||||
import _ba
|
import ba.internal
|
||||||
from stats import mystats
|
from stats import mystats
|
||||||
stat = mystats.get_all_stats()
|
stat = mystats.get_all_stats()
|
||||||
ros = _ba.get_game_roster()
|
ros = ba.internal.get_game_roster()
|
||||||
for i in ros:
|
for i in ros:
|
||||||
if i['account_id']:
|
if i['account_id']:
|
||||||
name = i['display_string']
|
name = i['display_string']
|
||||||
|
|
@ -60,7 +61,7 @@ def setTeamCharacter():
|
||||||
if not _setting["sameCharacterForTeam"]:
|
if not _setting["sameCharacterForTeam"]:
|
||||||
return
|
return
|
||||||
used=[]
|
used=[]
|
||||||
teams=_ba.get_foreground_host_session().sessionteams
|
teams=ba.internal.get_foreground_host_session().sessionteams
|
||||||
if len(teams) < 10:
|
if len(teams) < 10:
|
||||||
for team in teams:
|
for team in teams:
|
||||||
character=getRandomCharacter(used)
|
character=getRandomCharacter(used)
|
||||||
|
|
|
||||||
12
dist/ba_root/mods/tools/playlist.py
vendored
12
dist/ba_root/mods/tools/playlist.py
vendored
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import ba
|
import ba
|
||||||
import _ba
|
import _ba
|
||||||
|
import ba.internal
|
||||||
#session change by smoothy
|
#session change by smoothy
|
||||||
from ba._freeforallsession import FreeForAllSession
|
from ba._freeforallsession import FreeForAllSession
|
||||||
from ba._dualteamsession import DualTeamSession
|
from ba._dualteamsession import DualTeamSession
|
||||||
|
|
@ -32,14 +33,13 @@ def set_playlist(content):
|
||||||
|
|
||||||
|
|
||||||
def set_playlist_inline(playlist,newPLaylistType):
|
def set_playlist_inline(playlist,newPLaylistType):
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
|
|
||||||
if (isinstance(session,DualTeamSession) or isinstance(session,CoopSession)) and newPLaylistType=='ffa':
|
if (isinstance(session,DualTeamSession) or isinstance(session,CoopSession)) and newPLaylistType=='ffa':
|
||||||
#_ba.get_foreground_host_activity().end_game()
|
ba.internal.get_foreground_host_session().end()
|
||||||
_ba.get_foreground_host_session().end()
|
|
||||||
_thread.start_new_thread(withDelay,(FreeForAllSession,playlist,))
|
_thread.start_new_thread(withDelay,(FreeForAllSession,playlist,))
|
||||||
elif (isinstance(session,FreeForAllSession) or isinstance(session,CoopSession))and newPLaylistType=="teams":
|
elif (isinstance(session,FreeForAllSession) or isinstance(session,CoopSession))and newPLaylistType=="teams":
|
||||||
_ba.get_foreground_host_session().end()
|
ba.internal.get_foreground_host_session().end()
|
||||||
_thread.start_new_thread(withDelay,(DualTeamSession,playlist,))
|
_thread.start_new_thread(withDelay,(DualTeamSession,playlist,))
|
||||||
else:
|
else:
|
||||||
updatePlaylist(playlist)
|
updatePlaylist(playlist)
|
||||||
|
|
@ -51,14 +51,14 @@ def withDelay(session,playlist):
|
||||||
_ba.pushcall(Call(updateSession,session,playlist),from_other_thread=True)
|
_ba.pushcall(Call(updateSession,session,playlist),from_other_thread=True)
|
||||||
|
|
||||||
def updateSession(session,playlist):
|
def updateSession(session,playlist):
|
||||||
_ba.new_host_session(session)
|
ba.internal.new_host_session(session)
|
||||||
if playlist:
|
if playlist:
|
||||||
updatePlaylist(playlist)
|
updatePlaylist(playlist)
|
||||||
|
|
||||||
|
|
||||||
def updatePlaylist(playlist):
|
def updatePlaylist(playlist):
|
||||||
|
|
||||||
session = _ba.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
content = ba._playlist.filter_playlist(
|
content = ba._playlist.filter_playlist(
|
||||||
playlist,
|
playlist,
|
||||||
sessiontype=type(session),
|
sessiontype=type(session),
|
||||||
|
|
|
||||||
25
dist/ba_root/mods/tools/servercheck.py
vendored
25
dist/ba_root/mods/tools/servercheck.py
vendored
|
|
@ -6,6 +6,7 @@
|
||||||
from serverData import serverdata
|
from serverData import serverdata
|
||||||
from playersData import pdata
|
from playersData import pdata
|
||||||
import _ba
|
import _ba
|
||||||
|
import ba.internal
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
|
|
@ -31,7 +32,7 @@ class checkserver(object):
|
||||||
|
|
||||||
def check(self):
|
def check(self):
|
||||||
newPlayers = []
|
newPlayers = []
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
|
|
||||||
newPlayers.append(ros['account_id'])
|
newPlayers.append(ros['account_id'])
|
||||||
if ros['account_id'] not in self.players and ros[
|
if ros['account_id'] not in self.players and ros[
|
||||||
|
|
@ -55,7 +56,7 @@ class checkserver(object):
|
||||||
"sys")
|
"sys")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
_ba.disconnect_client(ros['client_id'], 1)
|
ba.internal.disconnect_client(ros['client_id'], 1)
|
||||||
|
|
||||||
return
|
return
|
||||||
if settings["whitelist"] and ros["account_id"] != None:
|
if settings["whitelist"] and ros["account_id"] != None:
|
||||||
|
|
@ -65,7 +66,7 @@ class checkserver(object):
|
||||||
clients=[ros['client_id']])
|
clients=[ros['client_id']])
|
||||||
logger.log(d_str + "||" + ros[
|
logger.log(d_str + "||" + ros[
|
||||||
"account_id"] + " | kicked > not in whitelist")
|
"account_id"] + " | kicked > not in whitelist")
|
||||||
_ba.disconnect_client(ros['client_id'])
|
ba.internal.disconnect_client(ros['client_id'])
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -84,7 +85,7 @@ def on_player_join_server(pbid, player_data):
|
||||||
now = time.time()
|
now = time.time()
|
||||||
# player_data=pdata.get_info(pbid)
|
# player_data=pdata.get_info(pbid)
|
||||||
clid = 113
|
clid = 113
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
if ros["account_id"] == pbid:
|
if ros["account_id"] == pbid:
|
||||||
clid = ros["client_id"]
|
clid = ros["client_id"]
|
||||||
if pbid in serverdata.clients:
|
if pbid in serverdata.clients:
|
||||||
|
|
@ -97,7 +98,7 @@ def on_player_join_server(pbid, player_data):
|
||||||
color=(1, 0, 1), transient=True,
|
color=(1, 0, 1), transient=True,
|
||||||
clients=[clid])
|
clients=[clid])
|
||||||
logger.log(pbid + "|| kicked for joining too fast")
|
logger.log(pbid + "|| kicked for joining too fast")
|
||||||
_ba.disconnect_client(clid)
|
ba.internal.disconnect_client(clid)
|
||||||
|
|
||||||
_thread.start_new_thread(reportSpam, (pbid,))
|
_thread.start_new_thread(reportSpam, (pbid,))
|
||||||
|
|
||||||
|
|
@ -112,7 +113,7 @@ def on_player_join_server(pbid, player_data):
|
||||||
device_strin = ""
|
device_strin = ""
|
||||||
if player_data["isBan"] or get_account_age(player_data["accountAge"]) < \
|
if player_data["isBan"] or get_account_age(player_data["accountAge"]) < \
|
||||||
settings["minAgeToJoinInHours"]:
|
settings["minAgeToJoinInHours"]:
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
if ros['account_id'] == pbid:
|
if ros['account_id'] == pbid:
|
||||||
if not player_data["isBan"]:
|
if not player_data["isBan"]:
|
||||||
_ba.screenmessage(
|
_ba.screenmessage(
|
||||||
|
|
@ -120,7 +121,7 @@ def on_player_join_server(pbid, player_data):
|
||||||
color=(1, 0, 0), transient=True,
|
color=(1, 0, 0), transient=True,
|
||||||
clients=[ros['client_id']])
|
clients=[ros['client_id']])
|
||||||
logger.log(pbid + " | kicked > reason:Banned account")
|
logger.log(pbid + " | kicked > reason:Banned account")
|
||||||
_ba.disconnect_client(ros['client_id'])
|
ba.internal.disconnect_client(ros['client_id'])
|
||||||
|
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
|
@ -137,7 +138,7 @@ def on_player_join_server(pbid, player_data):
|
||||||
verify_account(pbid, player_data)
|
verify_account(pbid, player_data)
|
||||||
cid = 113
|
cid = 113
|
||||||
d_st = "xx"
|
d_st = "xx"
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
if ros['account_id'] == pbid:
|
if ros['account_id'] == pbid:
|
||||||
cid = ros['client_id']
|
cid = ros['client_id']
|
||||||
d_st = ros['display_string']
|
d_st = ros['display_string']
|
||||||
|
|
@ -156,7 +157,7 @@ def on_player_join_server(pbid, player_data):
|
||||||
|
|
||||||
d_string = ""
|
d_string = ""
|
||||||
cid = 113
|
cid = 113
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
if ros['account_id'] == pbid:
|
if ros['account_id'] == pbid:
|
||||||
d_string = ros['display_string']
|
d_string = ros['display_string']
|
||||||
cid = ros['client_id']
|
cid = ros['client_id']
|
||||||
|
|
@ -177,7 +178,7 @@ def on_player_join_server(pbid, player_data):
|
||||||
|
|
||||||
def verify_account(pb_id, p_data):
|
def verify_account(pb_id, p_data):
|
||||||
d_string = ""
|
d_string = ""
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
if ros['account_id'] == pb_id:
|
if ros['account_id'] == pb_id:
|
||||||
d_string = ros['display_string']
|
d_string = ros['display_string']
|
||||||
|
|
||||||
|
|
@ -309,10 +310,10 @@ def save_ids(ids, pb_id, display_string):
|
||||||
|
|
||||||
|
|
||||||
def kick_by_pb_id(pb_id, msg):
|
def kick_by_pb_id(pb_id, msg):
|
||||||
for ros in _ba.get_game_roster():
|
for ros in ba.internal.get_game_roster():
|
||||||
if ros['account_id'] == pb_id:
|
if ros['account_id'] == pb_id:
|
||||||
_ba.screenmessage(msg, transient=True, clients=[ros['client_id']])
|
_ba.screenmessage(msg, transient=True, clients=[ros['client_id']])
|
||||||
_ba.disconnect_client(ros['client_id'])
|
ba.internal.disconnect_client(ros['client_id'])
|
||||||
|
|
||||||
|
|
||||||
def get_account_age(ct):
|
def get_account_age(ct):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue