mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-11-07 17:36:15 +00:00
added chat commands
This commit is contained in:
parent
e9f6da8a2e
commit
28ba7d8b4d
7 changed files with 690 additions and 161 deletions
76
dist/ba_root/mods/chatHandle/chatCMDS/chatcmd.py
vendored
76
dist/ba_root/mods/chatHandle/chatCMDS/chatcmd.py
vendored
|
|
@ -1,41 +1,67 @@
|
||||||
# Released under the MIT License. See LICENSE for details.
|
# Released under the MIT License. See LICENSE for details.
|
||||||
|
|
||||||
import ba
|
import ba, _ba
|
||||||
import _ba
|
|
||||||
from playersData import pdata
|
|
||||||
import fun,management
|
|
||||||
import setting
|
import setting
|
||||||
def public_id(client_id):
|
from playersData import pdata
|
||||||
rost=_ba.get_game_roster()
|
from . import fun
|
||||||
for client in rost:
|
from . import management, cheats, normal_commands as normal_cmds
|
||||||
if client['client_id']==client_id:
|
|
||||||
return client['account_id']
|
|
||||||
|
def client_to_account(client_id):
|
||||||
|
rost = _ba.get_game_roster()
|
||||||
|
for i in rost:
|
||||||
|
if i['client_id'] == client_id:
|
||||||
|
return i['account_id']
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def check_permission(pbid,cmnd):
|
|
||||||
roles=pdata.roles()
|
def check_permission(account_id, command):
|
||||||
|
roles = pdata.get_roles()
|
||||||
for role in roles:
|
for role in roles:
|
||||||
if pbid in role.ids and cmnd in role.commands:
|
if account_id in roles[role]["ids"] and command in roles[role]["commands"]:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def cmd_type(cmnd):
|
def cmd_type(cmnd):
|
||||||
if cmnd in fun.cmnds:
|
|
||||||
return "fun"
|
if cmnd in normal_cmds.cmnds or cmnd in normal_cmds.cmnd_aliases:
|
||||||
if cmnd in management.cmnds:
|
return "normal_cmd"
|
||||||
|
|
||||||
|
if cmnd in management.cmnds or cmnd in management.cmnd_aliases:
|
||||||
return "management"
|
return "management"
|
||||||
|
|
||||||
def cmd(msg,client_id):
|
if cmnd in fun.cmnds or cmnd in fun.cmnd_aliases:
|
||||||
cmnd=msg.split(" ")[0].lower()
|
return "fun"
|
||||||
arg=msg.split(" ")[1:]
|
|
||||||
pbid=public_id(client_id)
|
if cmnd in cheats.cmnds or cmnd in cheats.cmnd_aliases:
|
||||||
if check_permission(pbid,cmnd):
|
return "cheats"
|
||||||
if cmd_type(cmnd)=="fun":
|
|
||||||
fun.exec_cmd(cmnd,arg,client_id,pbid)
|
|
||||||
elif cmd_type(cmnd)=="management":
|
def cmd(msg, client_id):
|
||||||
management.exec_cmd(cmnd,arg,client_id,pbid)
|
cmnd = msg.split(" ")[0].lower().split("/")[1]
|
||||||
|
arg = msg.split(" ")[1:]
|
||||||
|
acid = "pb-IF48VgWkBFQ"
|
||||||
|
#client_to_account(client_id)
|
||||||
|
|
||||||
|
if cmd_type(cmnd) == "fun":
|
||||||
|
if check_permission(acid, cmnd):
|
||||||
|
fun.exec_cmd(cmnd, arg, client_id, acid)
|
||||||
|
|
||||||
|
elif cmd_type(cmnd) == "management":
|
||||||
|
if check_permission(acid, cmnd):
|
||||||
|
management.exec_cmd(cmnd, arg, client_id, acid)
|
||||||
|
|
||||||
|
elif cmd_type(cmnd) == "cheats":
|
||||||
|
if check_permission(acid, cmnd):
|
||||||
|
cheats.exec_cmd(cmnd, arg, client_id, acid)
|
||||||
|
|
||||||
|
elif cmd_type(cmnd) == "normal_cmd":
|
||||||
|
normal_cmds.exec_cmd(cmnd, arg, client_id, acid)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
_ba.chatmessage("no access",clients=client_id)
|
_ba.chatmessage("no access")
|
||||||
|
|
||||||
|
|
||||||
if setting.brdcast_chatcmd:
|
if setting.brdcast_chatcmd:
|
||||||
return msg
|
return msg
|
||||||
|
|
|
||||||
176
dist/ba_root/mods/chatHandle/chatCMDS/fun.py
vendored
176
dist/ba_root/mods/chatHandle/chatCMDS/fun.py
vendored
|
|
@ -1,23 +1,177 @@
|
||||||
# Released under the MIT License. See LICENSE for details.
|
# Released under the MIT License. See LICENSE for details.
|
||||||
|
|
||||||
|
|
||||||
cmnds=["/fly","/freeze"]
|
from _ba import chatmessage as cmsg, screenmessage as smsg
|
||||||
|
from .handlers import activity_players, on_command_error, handlemsg, handlemsg_all
|
||||||
|
import ba, _ba
|
||||||
|
|
||||||
|
|
||||||
def exec_cmd(cmnd,arg,client_id,pbid):
|
cmnds = ['fly', 'invisible', 'headless', 'creepy', 'celebrate', 'spaz']
|
||||||
if cmnd =="/fly":
|
|
||||||
fly()
|
cmnd_aliases = ['inv', 'hl', 'creep', 'celeb']
|
||||||
|
|
||||||
|
|
||||||
|
def exec_cmd(cmnd, arg, clid, pbid):
|
||||||
|
|
||||||
|
if cmnd in ['fly']:
|
||||||
|
fly_call(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['inv', 'invisible']:
|
||||||
|
invi_call(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['hl', 'headless']:
|
||||||
|
headless_call(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['creepy', 'creep']:
|
||||||
|
creep_call(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['celebrate', 'celeb']:
|
||||||
|
celeb_call(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['spaz']:
|
||||||
|
spaz_call(arg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ==============
|
def fly_call(arg):
|
||||||
|
if on_command_error(arg):
|
||||||
|
return
|
||||||
|
|
||||||
def fly():
|
elif arg[0] == 'all':
|
||||||
# do something
|
|
||||||
|
for players in activity_players():
|
||||||
|
if players.actor.node.fly != True:
|
||||||
|
players.actor.node.fly = True
|
||||||
|
else:
|
||||||
|
players.actor.node.fly = False
|
||||||
|
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
player = int(arg[0])
|
||||||
|
|
||||||
|
if activity_players()[player].actor.node.fly != True:
|
||||||
|
activity_players()[player].actor.node.fly = True
|
||||||
|
else:
|
||||||
|
activity_players()[player].actor.node.fly = False
|
||||||
|
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def freeze():
|
|
||||||
# do something
|
|
||||||
|
|
||||||
def spaz():
|
|
||||||
#do something
|
def invi_call(arg):
|
||||||
|
if on_command_error(arg):
|
||||||
|
return
|
||||||
|
|
||||||
|
elif arg[0] == 'all':
|
||||||
|
for i in activity_players():
|
||||||
|
body = i.actor.node
|
||||||
|
if body.torso_model != None:
|
||||||
|
body.head_model = None
|
||||||
|
body.torso_model = None
|
||||||
|
body.upper_arm_model = None
|
||||||
|
body.forearm_model = None
|
||||||
|
body.pelvis_model = None
|
||||||
|
body.hand_model = None
|
||||||
|
body.toes_model = None
|
||||||
|
body.upper_leg_model = None
|
||||||
|
body.lower_leg_model = None
|
||||||
|
body.style = 'cyborg'
|
||||||
|
else:
|
||||||
|
|
||||||
|
player = int(arg[0])
|
||||||
|
body = activity_players()[player].actor.node
|
||||||
|
|
||||||
|
if body.torso_model != None:
|
||||||
|
body.head_model = None
|
||||||
|
body.torso_model = None
|
||||||
|
body.upper_arm_model = None
|
||||||
|
body.forearm_model = None
|
||||||
|
body.pelvis_model = None
|
||||||
|
body.hand_model = None
|
||||||
|
body.toes_model = None
|
||||||
|
body.upper_leg_model = None
|
||||||
|
body.lower_leg_model = None
|
||||||
|
body.style = 'cyborg'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def headless_call(arg):
|
||||||
|
if on_command_error(arg):
|
||||||
|
return
|
||||||
|
|
||||||
|
elif arg[0] == 'all':
|
||||||
|
|
||||||
|
for players in activity_players():
|
||||||
|
node = players.actor.node
|
||||||
|
|
||||||
|
if node.head_model != None:
|
||||||
|
node.head_model = None
|
||||||
|
node.style='cyborg'
|
||||||
|
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
player = int(arg[0])
|
||||||
|
node = activity_players()[player].actor.node
|
||||||
|
|
||||||
|
if node.head_model != None:
|
||||||
|
node.head_model = None
|
||||||
|
node.style='cyborg'
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def creep_call(arg):
|
||||||
|
if on_command_error(arg):
|
||||||
|
return
|
||||||
|
|
||||||
|
elif arg[0] == 'all':
|
||||||
|
|
||||||
|
for players in activity_players():
|
||||||
|
node = players.actor.node
|
||||||
|
|
||||||
|
if node.head_model != None:
|
||||||
|
node.head_model = None
|
||||||
|
node.handlemessage(ba.PowerupMessage(poweruptype='punch'))
|
||||||
|
node.handlemessage(ba.PowerupMessage(poweruptype='shield'))
|
||||||
|
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
player = int(arg[0])
|
||||||
|
node = activity_players()[player].actor.node
|
||||||
|
|
||||||
|
if node.head_model != None:
|
||||||
|
node.head_model = None
|
||||||
|
node.handlemessage(ba.PowerupMessage(poweruptype='punch'))
|
||||||
|
node.handlemessage(ba.PowerupMessage(poweruptype='shield'))
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def celeb_call(arg):
|
||||||
|
if on_command_error(arg):
|
||||||
|
return
|
||||||
|
|
||||||
|
elif arg[0] == 'all':
|
||||||
|
handlemsg_all(ba.CelebrateMessage())
|
||||||
|
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
player = int(arg[0])
|
||||||
|
handlemsg(player, ba.CelebrateMessage())
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def spaz_call(arg):
|
||||||
|
if on_command_error(arg):
|
||||||
|
return
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
|
||||||
254
dist/ba_root/mods/chatHandle/chatCMDS/management.py
vendored
254
dist/ba_root/mods/chatHandle/chatCMDS/management.py
vendored
|
|
@ -1,22 +1,260 @@
|
||||||
# Released under the MIT License. See LICENSE for details.
|
# Released under the MIT License. See LICENSE for details.
|
||||||
cmnds=["/add","/kick"]
|
|
||||||
|
|
||||||
|
from _ba import chatmessage as cmsg, screenmessage as smsg
|
||||||
|
from .handlers import activity_players, sess_players, on_command_error, handlemsg, handlemsg_all
|
||||||
|
from playersData import pdata
|
||||||
|
import ba, _ba, time
|
||||||
|
|
||||||
def exec_cmd(cmnd,arg,client_id,pbid):
|
cmnds = ['kick', 'remove', 'end', 'quit', 'mute', 'unmute', 'slowmo', 'nv', 'dv', 'pause', 'cameramode', 'createrole', 'addrole', 'removerole', 'addcommand', 'addcmd', 'removecommand', 'removecmd', 'changetag']
|
||||||
if cmnd =="/kick":
|
|
||||||
|
cmnd_aliases = ['rm', 'next', 'restart', 'mutechat', 'unmutechat', 'sm', 'slow', 'night', 'day', 'pausegame', 'camera_mode', 'rotate_camera']
|
||||||
|
|
||||||
|
def exec_cmd(cmnd, arg, client_id, pbid):
|
||||||
|
if cmnd in ['kick']:
|
||||||
kick(arg[0])
|
kick(arg[0])
|
||||||
|
|
||||||
|
elif cmnd in ['end', 'next']:
|
||||||
|
end_call(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['quit', 'restart']:
|
||||||
|
quit_call(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['mute', 'mutechat']:
|
||||||
|
mute_call()
|
||||||
|
|
||||||
|
elif cmnd in ['unmute', 'unmutechat']:
|
||||||
|
un_mute_call()
|
||||||
|
|
||||||
|
elif cmnd in ['remove', 'rm']:
|
||||||
|
remove_call(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['sm', 'slow', 'slowmo']:
|
||||||
|
slow_mo_call()
|
||||||
|
|
||||||
|
elif cmnd in ['nv', 'night']:
|
||||||
|
nv_call(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['dv', 'day']:
|
||||||
|
dv_call(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['pause', 'pausegame']:
|
||||||
|
pause_call()
|
||||||
|
|
||||||
|
elif cmnd in ['cameraMode', 'camera_mode', 'rotate_camera']:
|
||||||
|
rotate_camera_call()
|
||||||
|
|
||||||
|
elif cmnd in ['createrole']:
|
||||||
|
create_role_call(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['addrole']:
|
||||||
|
add_role_to_player(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['removerole']:
|
||||||
|
remove_role_from_player(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['addcommand', 'addcmd']:
|
||||||
|
add_command_to_role(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['removecommand', 'removecmd']:
|
||||||
|
remove_command_to_role(arg)
|
||||||
|
|
||||||
|
elif cmnd in ['changetag']:
|
||||||
|
change_role_tag_call(arg)
|
||||||
|
|
||||||
|
|
||||||
# ==============
|
|
||||||
|
|
||||||
|
# =============
|
||||||
|
|
||||||
|
|
||||||
def kick(client_id):
|
def kick(client_id):
|
||||||
_ba.disconnectclient(client_id)
|
_ba.disconnectclient(client_id)
|
||||||
# do something
|
|
||||||
|
|
||||||
|
def remove_call(arg):
|
||||||
|
|
||||||
|
if on_command_error(arg):
|
||||||
|
return
|
||||||
|
|
||||||
|
elif arg[0] == 'all':
|
||||||
|
for i in sess_players():
|
||||||
|
i.remove_from_game()
|
||||||
|
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
req_player = int(arg[0])
|
||||||
|
sess_players()[req_player].remove_from_game()
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def add():
|
def add():
|
||||||
# do something
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def end_call(arg):
|
||||||
|
if arg == [] or arg == ['']:
|
||||||
|
activity = _ba.get_foreground_host_activity()
|
||||||
|
activity.end_game()
|
||||||
|
"""
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
tmr = int(arg[0])
|
||||||
|
time.sleep(tmr)
|
||||||
|
activity = _ba.get_foreground_host_activity()
|
||||||
|
activity.end_game()
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def quit_call(arg):
|
||||||
|
|
||||||
|
if arg == [] or arg == ['']:
|
||||||
|
ba.quit()
|
||||||
|
|
||||||
|
"""
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
tmr = int(arg[0])
|
||||||
|
time.sleep(tmr)
|
||||||
|
ba.quit()
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def mute_call():
|
||||||
|
pass
|
||||||
|
|
||||||
|
def un_mute_call():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def slow_mo_call():
|
||||||
|
|
||||||
|
activity = _ba.get_foreground_host_activity()
|
||||||
|
|
||||||
|
if activity.globalsnode.slow_motion != True:
|
||||||
|
activity.globalsnode.slow_motion = True
|
||||||
|
|
||||||
|
else:
|
||||||
|
activity.globalsnode.slow_motion = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def nv_call(arg):
|
||||||
|
|
||||||
|
activity = _ba.get_foreground_host_activity()
|
||||||
|
|
||||||
|
if arg == [] or arg == ['']:
|
||||||
|
|
||||||
|
if activity.globalsnode.tint != (0.5, 0.7, 1.0):
|
||||||
|
activity.globalsnode.tint = (0.5, 0.7, 1.0)
|
||||||
|
else:
|
||||||
|
#will fix this soon
|
||||||
|
pass
|
||||||
|
|
||||||
|
elif arg[0] == 'off':
|
||||||
|
if activity.globalsnode.tint != (0.5, 0.7, 1.0):
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def dv_call(arg):
|
||||||
|
|
||||||
|
activity = _ba.get_foreground_host_activity()
|
||||||
|
|
||||||
|
if arg == [] or arg == ['']:
|
||||||
|
|
||||||
|
if activity.globalsnode.tint != (1,1,1):
|
||||||
|
activity.globalsnode.tint = (1,1,1)
|
||||||
|
else:
|
||||||
|
#will fix this soon
|
||||||
|
pass
|
||||||
|
|
||||||
|
elif arg[0] == 'off':
|
||||||
|
if activity.globalsnode.tint != (1,1,1):
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def pause_call():
|
||||||
|
|
||||||
|
activity = _ba.get_foreground_host_activity()
|
||||||
|
|
||||||
|
if activity.globalsnode.paused != True:
|
||||||
|
activity.globalsnode.paused = True
|
||||||
|
|
||||||
|
else:
|
||||||
|
activity.globalsnode.paused = False
|
||||||
|
|
||||||
|
|
||||||
|
def rotate_camera_call():
|
||||||
|
|
||||||
|
activity = _ba.get_foreground_host_activity()
|
||||||
|
|
||||||
|
if activity.globalsnode.camera_mode != 'rotate':
|
||||||
|
activity.globalsnode.camera_mode = 'rotate'
|
||||||
|
|
||||||
|
else:
|
||||||
|
activity.globalsnode.camera_mode == 'normal'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def create_role_call(arg):
|
||||||
|
pdata.create_role(arg[0])
|
||||||
|
|
||||||
|
|
||||||
|
def add_role_to_player(arg):
|
||||||
|
id = sess_players()[int(arg[1])].get_account_id()
|
||||||
|
try:
|
||||||
|
pdata.add_player_role(arg[0], id)
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
|
def remove_role_from_player(arg):
|
||||||
|
id = sess_players()[int(arg[1])].get_account_id()
|
||||||
|
try:
|
||||||
|
pdata.remove_player_role(arg[0], id)
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def change_role_tag_call(arg):
|
||||||
|
pdata.change_role_tag(arg[0], arg[1])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
all_commands = ["changetag","createrole", "addrole", "removerole", "addcommand", "addcmd","removecommand","removecmd","kick","remove","rm","end","next","quit","restart","mute","mutechat","unmute","unmutechat","sm","slow","slowmo","nv","night","dv","day","pause","pausegame","cameraMode","camera_mode","rotate_camera","kill","die","heal","heath","curse","cur","sleep","sp","superpunch","gloves","punch","shield","protect","freeze","ice","unfreeze","thaw","gm","godmode","fly","inv","invisible","hl","headless","creepy","creep","celebrate","celeb","spaz"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def add_command_to_role(arg):
|
||||||
|
try:
|
||||||
|
if arg[1] in all_commands:
|
||||||
|
pdata.add_command_role(arg[0], arg[1])
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def remove_command_to_role(arg):
|
||||||
|
try:
|
||||||
|
if arg[1] in all_commands:
|
||||||
|
pdata.remove_command_role(arg[0], arg[1])
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def end():
|
|
||||||
#do something
|
|
||||||
|
|
|
||||||
6
dist/ba_root/mods/chatHandle/handlechat.py
vendored
6
dist/ba_root/mods/chatHandle/handlechat.py
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
# 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
|
||||||
from chatHandle.chatCMDS import chatcmd
|
from chatHandle.chatCMDS import chatcmd
|
||||||
from chatFilter import chatfilter
|
#from chatFilter import chatfilter
|
||||||
import ba,_ba
|
import ba,_ba
|
||||||
|
|
||||||
def public_id(client_id):
|
def public_id(client_id):
|
||||||
|
|
@ -14,11 +14,13 @@ def public_id(client_id):
|
||||||
def filter_chat_message(msg,client_id):
|
def filter_chat_message(msg,client_id):
|
||||||
if msg.startswith("/"):
|
if msg.startswith("/"):
|
||||||
return chatcmd.cmd(msg,client_id)
|
return chatcmd.cmd(msg,client_id)
|
||||||
|
return msg
|
||||||
|
|
||||||
|
"""
|
||||||
if chatfilter.isAbuse(msg):
|
if chatfilter.isAbuse(msg):
|
||||||
pdata.warn(public_id(client_id))
|
pdata.warn(public_id(client_id))
|
||||||
return None
|
return None
|
||||||
return msg
|
return msg
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
4
dist/ba_root/mods/custom_hooks.py
vendored
4
dist/ba_root/mods/custom_hooks.py
vendored
|
|
@ -1,8 +1,10 @@
|
||||||
|
|
||||||
|
|
||||||
def filter_chat_message(msg,client_id):
|
def filter_chat_message(msg,client_id):
|
||||||
from chatHandle import handlechat
|
from chatHandle import handlechat
|
||||||
|
|
||||||
return handlechat.filter_chat_message(msg,client_id)
|
return handlechat.filter_chat_message(msg,client_id)
|
||||||
|
|
||||||
|
|
||||||
def on_app_launch():
|
def on_app_launch():
|
||||||
pass
|
pass
|
||||||
#something
|
#something
|
||||||
|
|
|
||||||
177
dist/ba_root/mods/playersData/pdata.py
vendored
177
dist/ba_root/mods/playersData/pdata.py
vendored
|
|
@ -1,151 +1,164 @@
|
||||||
# Released under the MIT License. See LICENSE for details.
|
# Released under the MIT License. See LICENSE for details.
|
||||||
import os,_ba,json
|
import _ba, os, json
|
||||||
roles={}
|
|
||||||
data={}
|
|
||||||
custom={}
|
|
||||||
|
roles = {}
|
||||||
|
data = {}
|
||||||
|
custom = {}
|
||||||
data_path = os.path.join(_ba.env()['python_directory_user'],"playersData" + os.sep)
|
data_path = os.path.join(_ba.env()['python_directory_user'],"playersData" + os.sep)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def commit(data):
|
||||||
|
global roles
|
||||||
|
if data == {}:
|
||||||
|
return
|
||||||
|
with open(data_path+'roles.json','w') as f:
|
||||||
|
json.dump(data, f, indent=4)
|
||||||
|
|
||||||
|
|
||||||
def get_roles():
|
def get_roles():
|
||||||
global roles
|
global roles
|
||||||
if roles=={}:
|
if roles == {}:
|
||||||
f=open(data_path+"roles.json","r")
|
with open(data_path+'roles.json', 'r') as f:
|
||||||
dat=json.loads(f.read())
|
roles = json.load(f)
|
||||||
roles=dat
|
|
||||||
f.close()
|
|
||||||
return roles
|
return roles
|
||||||
|
|
||||||
|
|
||||||
def create_role(role):
|
def create_role(role):
|
||||||
global roles
|
global roles
|
||||||
_roles=get_roles()
|
_roles = get_roles()
|
||||||
if role not in _roles:
|
if role not in _roles:
|
||||||
_roles[role]={
|
_roles[role] = {
|
||||||
"tag":role,
|
"tag":role,
|
||||||
"tagcolor":(1,1,1),
|
"tagcolor":[1,1,1],
|
||||||
"commands":[],
|
"commands":[],
|
||||||
"ids":[]
|
"ids":[]
|
||||||
}
|
}
|
||||||
roles=_roles
|
roles = _roles
|
||||||
comit()
|
commit(_roles)
|
||||||
return 'created successfully'
|
return
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
return 'already exists'
|
def add_player_role(role, id):
|
||||||
|
|
||||||
def add_player_role(role,id):
|
|
||||||
global roles
|
global roles
|
||||||
_roles=get_roles()
|
_roles = get_roles()
|
||||||
if role in _roles:
|
if role in _roles:
|
||||||
_roles[role].ids.append(id)
|
if id not in _roles[role]["ids"]:
|
||||||
roles=_roles
|
_roles[role]["ids"].append(id)
|
||||||
commit()
|
roles =_roles
|
||||||
return 'added to '+role
|
commit(_roles)
|
||||||
|
return "added to "+role
|
||||||
return "role not exists"
|
return "role not exists"
|
||||||
|
|
||||||
def add_command_role(role,command):
|
|
||||||
global roles
|
|
||||||
_roles=get_roles()
|
|
||||||
if role in _roles:
|
|
||||||
_roles[role].commands.append(command)
|
|
||||||
roles=_roles
|
|
||||||
commit()
|
|
||||||
return 'added '+command+"to "+role
|
|
||||||
return role+"not exists"
|
|
||||||
|
|
||||||
|
def remove_player_role(role, id):
|
||||||
def remove_player_role(role,id):
|
|
||||||
global roles
|
global roles
|
||||||
_roles=get_roles()
|
_roles = get_roles()
|
||||||
if role in _roles:
|
if role in _roles:
|
||||||
_roles[role].ids.remove(id)
|
_roles[role]["ids"].remove(id)
|
||||||
roles=_roles
|
roles =_roles
|
||||||
commit()
|
commit(_roles)
|
||||||
return "removed"
|
return "removed from "+role
|
||||||
return "role not exists"
|
return "role not exists"
|
||||||
|
|
||||||
def remove_command_role():
|
|
||||||
global roles
|
|
||||||
_roles=get_roles()
|
|
||||||
if role in _roles:
|
|
||||||
_roles[role].commands.remove(command)
|
|
||||||
roles=_roles
|
|
||||||
commit()
|
|
||||||
return 'removed '+command+"from "+role
|
|
||||||
return role+"not exists"
|
|
||||||
|
|
||||||
def change_role_tag(role,tag):
|
|
||||||
|
|
||||||
|
def add_command_role(role, command):
|
||||||
global roles
|
global roles
|
||||||
_roles=get_roles()
|
_roles = get_roles()
|
||||||
if role in _roles:
|
if role in _roles:
|
||||||
_roles[role].tag=tag
|
if command not in _roles[role]["commands"]:
|
||||||
roles=_roles
|
_roles[role]["commands"].append(command)
|
||||||
commit()
|
roles =_roles
|
||||||
|
commit(_roles)
|
||||||
|
return "command added to "+role
|
||||||
|
return "command not exists"
|
||||||
|
|
||||||
|
|
||||||
|
def remove_command_role(role, command):
|
||||||
|
global roles
|
||||||
|
_roles = get_roles()
|
||||||
|
if role in _roles:
|
||||||
|
if command in _roles[role]["commands"]:
|
||||||
|
_roles[role]["commands"].remove(command)
|
||||||
|
roles =_roles
|
||||||
|
commit(_roles)
|
||||||
|
return "command added to "+role
|
||||||
|
return "command not exists"
|
||||||
|
|
||||||
|
|
||||||
|
def change_role_tag(role, tag):
|
||||||
|
global roles
|
||||||
|
_roles = get_roles()
|
||||||
|
if role in _roles:
|
||||||
|
_roles[role]['tag'] = tag
|
||||||
|
roles = _roles
|
||||||
|
commit(_roles)
|
||||||
return "tag changed"
|
return "tag changed"
|
||||||
return "role not exists"
|
return "role not exists"
|
||||||
|
|
||||||
|
|
||||||
def commit(_roles):
|
|
||||||
global roles
|
|
||||||
if _roles=={}:
|
|
||||||
return
|
|
||||||
f=open(data_path+"roles.json",'w')
|
|
||||||
json.dump(_roles,f,indent=4)
|
|
||||||
f.close()
|
|
||||||
roles=_roles
|
|
||||||
|
|
||||||
def get_role(acc_id):
|
def get_role(acc_id):
|
||||||
global roles
|
global roles
|
||||||
_roles =get_roles()
|
_roles = get_roles()
|
||||||
for role in _roles:
|
for role in _roles:
|
||||||
if acc_id in role["ids"]:
|
if acc_id in role["ids"]:
|
||||||
return role
|
return role
|
||||||
|
|
||||||
|
|
||||||
|
##### those ups done will clean it in future
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#======================= CUSTOM EFFECTS/TAGS ===============
|
#======================= CUSTOM EFFECTS/TAGS ===============
|
||||||
|
|
||||||
|
|
||||||
def get_custom():
|
def get_custom():
|
||||||
global custom
|
global custom
|
||||||
if custom=={}:
|
if custom=={}:
|
||||||
f=open(data_path+"custom.json","r")
|
with open(data_path+"custom.json","r") as f:
|
||||||
dat=json.loads(f.read())
|
custom = json.loads(f.read())
|
||||||
custom=dat
|
|
||||||
f.close()
|
|
||||||
return custom
|
return custom
|
||||||
|
|
||||||
|
|
||||||
|
def set_effect(effect, id):
|
||||||
def set_effect(effect,id):
|
|
||||||
global custom
|
global custom
|
||||||
_custom=get_custom()
|
_custom = get_custom()
|
||||||
_custom['customeffects'][id]=effect
|
_custom['customeffects'][id] = effect
|
||||||
custom=_custom
|
custom = _custom
|
||||||
commit_c()
|
commit_c()
|
||||||
|
|
||||||
|
|
||||||
def set_tag(tag,id):
|
def set_tag(tag, id):
|
||||||
global custom
|
global custom
|
||||||
_custom=get_custom()
|
_custom = get_custom()
|
||||||
_custom['customtag'][id]=tag
|
_custom['customtag'][id] = tag
|
||||||
custom=_custom
|
custom = _custom
|
||||||
commit_c()
|
commit_c()
|
||||||
|
|
||||||
|
|
||||||
def remove_effect(id):
|
def remove_effect(id):
|
||||||
global custom
|
global custom
|
||||||
_custom=get_custom()
|
_custom = get_custom()
|
||||||
_custom['customeffects'].pop(id)
|
_custom['customeffects'].pop(id)
|
||||||
custom=_custom
|
custom = _custom
|
||||||
commit_c()
|
commit_c()
|
||||||
|
|
||||||
|
|
||||||
def remove_tag(id):
|
def remove_tag(id):
|
||||||
global custom
|
global custom
|
||||||
_custom=get_custom()
|
_custom = get_custom()
|
||||||
_custom['customtag'].pop(id)
|
_custom['customtag'].pop(id)
|
||||||
custom=_custom
|
custom = _custom
|
||||||
commit_c()
|
commit_c()
|
||||||
|
|
||||||
|
|
||||||
def commit_c():
|
def commit_c():
|
||||||
global custom
|
global custom
|
||||||
f=open(data_path+"custom.json",'w')
|
with open(data_path+"custom.json",'w') as f:
|
||||||
json.dump(custom,f,indent=4)
|
json.dump(custom,f,indent=4)
|
||||||
f.close()
|
|
||||||
|
|
|
||||||
136
dist/ba_root/mods/playersData/roles.json
vendored
136
dist/ba_root/mods/playersData/roles.json
vendored
|
|
@ -1,27 +1,121 @@
|
||||||
{
|
{
|
||||||
"owner":{
|
"owner": {
|
||||||
"tag":"OWNER",
|
"tag": "pranav",
|
||||||
"tagcolor":(1,1,1),
|
"tagcolor": [
|
||||||
"commands":["add","kick","remove"],
|
1,
|
||||||
"ids":["pb-ihugg7g9==","pb-7gt78"]
|
1,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"commands": [
|
||||||
|
"createrole",
|
||||||
|
"addrole",
|
||||||
|
"removerole",
|
||||||
|
"addcommand",
|
||||||
|
"addcmd",
|
||||||
|
"removecommand",
|
||||||
|
"removecmd",
|
||||||
|
"remove",
|
||||||
|
"kick",
|
||||||
|
"rm",
|
||||||
|
"next",
|
||||||
|
"quit",
|
||||||
|
"restart",
|
||||||
|
"mute",
|
||||||
|
"mutechat",
|
||||||
|
"unmute",
|
||||||
|
"unmutechat",
|
||||||
|
"sm",
|
||||||
|
"slow",
|
||||||
|
"slowmo",
|
||||||
|
"nv",
|
||||||
|
"night",
|
||||||
|
"dv",
|
||||||
|
"day",
|
||||||
|
"pause",
|
||||||
|
"pausegame",
|
||||||
|
"cameraMode",
|
||||||
|
"camera_mode",
|
||||||
|
"rotate_camera",
|
||||||
|
"kill",
|
||||||
|
"die",
|
||||||
|
"heal",
|
||||||
|
"heath",
|
||||||
|
"curse",
|
||||||
|
"cur",
|
||||||
|
"sleep",
|
||||||
|
"sp",
|
||||||
|
"superpunch",
|
||||||
|
"gloves",
|
||||||
|
"punch",
|
||||||
|
"shield",
|
||||||
|
"protect",
|
||||||
|
"freeze",
|
||||||
|
"ice",
|
||||||
|
"unfreeze",
|
||||||
|
"thaw",
|
||||||
|
"gm",
|
||||||
|
"godmode",
|
||||||
|
"fly",
|
||||||
|
"inv",
|
||||||
|
"invisible",
|
||||||
|
"hl",
|
||||||
|
"headless",
|
||||||
|
"creepy",
|
||||||
|
"creep",
|
||||||
|
"celebrate",
|
||||||
|
"celeb",
|
||||||
|
"spaz",
|
||||||
|
"me",
|
||||||
|
"stats",
|
||||||
|
"score",
|
||||||
|
"list",
|
||||||
|
"l",
|
||||||
|
"uniqeid",
|
||||||
|
"id",
|
||||||
|
"pb-id",
|
||||||
|
"pb",
|
||||||
|
"accountid",
|
||||||
|
"end",
|
||||||
|
"changetag"
|
||||||
|
],
|
||||||
|
"ids": [
|
||||||
|
"pb-IF48VgWkBFQ"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"admin":{
|
"test69": {
|
||||||
"tag":"ADMIN",
|
"tag": "test69",
|
||||||
"tagcolor":(1,1,1),
|
"tagcolor": [
|
||||||
"commands":["kick","end"],
|
1,
|
||||||
"ids":["pb-ugg","pb-767fyfd"]
|
1,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"commands": [
|
||||||
|
"mute"
|
||||||
|
],
|
||||||
|
"ids": [
|
||||||
|
"pb-IF4VAk4a"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"vip":{
|
"test70": {
|
||||||
"tag":"VIP",
|
"tag": "test70",
|
||||||
"tagcolor":(1,1,1),
|
"tagcolor": [
|
||||||
"commands":[],
|
1,
|
||||||
"ids":[]
|
1,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"commands": [],
|
||||||
|
"ids": [
|
||||||
|
"pb-IF4VAk4a"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"toppers":{
|
"test71": {
|
||||||
"tag":"DONOR",
|
"tag": "test71",
|
||||||
"tagcolor":(2,2,2),
|
"tagcolor": [
|
||||||
"commands":[],
|
1,
|
||||||
"ids":[]
|
1,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"commands": [],
|
||||||
|
"ids": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue