mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-10-20 00:00:39 +00:00
commit
d29ba7db51
21 changed files with 1006 additions and 161 deletions
BIN
dist/ba_root/mods/chatHandle/__pycache__/__init__.cpython-38.opt-1.pyc
vendored
Normal file
BIN
dist/ba_root/mods/chatHandle/__pycache__/__init__.cpython-38.opt-1.pyc
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/chatHandle/__pycache__/handlechat.cpython-38.opt-1.pyc
vendored
Normal file
BIN
dist/ba_root/mods/chatHandle/__pycache__/handlechat.cpython-38.opt-1.pyc
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/__init__.cpython-38.opt-1.pyc
vendored
Normal file
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/__init__.cpython-38.opt-1.pyc
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/chatcmd.cpython-38.opt-1.pyc
vendored
Normal file
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/chatcmd.cpython-38.opt-1.pyc
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/cheats.cpython-38.opt-1.pyc
vendored
Normal file
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/cheats.cpython-38.opt-1.pyc
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/fun.cpython-38.opt-1.pyc
vendored
Normal file
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/fun.cpython-38.opt-1.pyc
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/handlers.cpython-38.opt-1.pyc
vendored
Normal file
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/handlers.cpython-38.opt-1.pyc
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/management.cpython-38.opt-1.pyc
vendored
Normal file
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/management.cpython-38.opt-1.pyc
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/normal_commands.cpython-38.opt-1.pyc
vendored
Normal file
BIN
dist/ba_root/mods/chatHandle/chatCMDS/__pycache__/normal_commands.cpython-38.opt-1.pyc
vendored
Normal file
Binary file not shown.
80
dist/ba_root/mods/chatHandle/chatCMDS/chatcmd.py
vendored
80
dist/ba_root/mods/chatHandle/chatCMDS/chatcmd.py
vendored
|
|
@ -1,41 +1,67 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
|
||||
import ba
|
||||
import _ba
|
||||
from playersData import pdata
|
||||
import fun,management
|
||||
import ba, _ba
|
||||
import setting
|
||||
def public_id(client_id):
|
||||
rost=_ba.get_game_roster()
|
||||
for client in rost:
|
||||
if client['client_id']==client_id:
|
||||
return client['account_id']
|
||||
from playersData import pdata
|
||||
from . import fun
|
||||
from . import management, cheats, normal_commands as normal_cmds
|
||||
|
||||
|
||||
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
|
||||
|
||||
def check_permission(pbid,cmnd):
|
||||
roles=pdata.roles()
|
||||
|
||||
def check_permission(account_id, command):
|
||||
roles = pdata.get_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 False
|
||||
|
||||
def cmd_type(cmnd):
|
||||
if cmnd in fun.cmnds:
|
||||
return "fun"
|
||||
if cmnd in management.cmnds:
|
||||
return "management"
|
||||
|
||||
def cmd(msg,client_id):
|
||||
cmnd=msg.split(" ")[0].lower()
|
||||
arg=msg.split(" ")[1:]
|
||||
pbid=public_id(client_id)
|
||||
if check_permission(pbid,cmnd):
|
||||
if cmd_type(cmnd)=="fun":
|
||||
fun.exec_cmd(cmnd,arg,client_id,pbid)
|
||||
elif cmd_type(cmnd)=="management":
|
||||
management.exec_cmd(cmnd,arg,client_id,pbid)
|
||||
def cmd_type(cmnd):
|
||||
|
||||
if cmnd in normal_cmds.cmnds or cmnd in normal_cmds.cmnd_aliases:
|
||||
return "normal_cmd"
|
||||
|
||||
if cmnd in management.cmnds or cmnd in management.cmnd_aliases:
|
||||
return "management"
|
||||
|
||||
if cmnd in fun.cmnds or cmnd in fun.cmnd_aliases:
|
||||
return "fun"
|
||||
|
||||
if cmnd in cheats.cmnds or cmnd in cheats.cmnd_aliases:
|
||||
return "cheats"
|
||||
|
||||
|
||||
def cmd(msg, client_id):
|
||||
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:
|
||||
_ba.chatmessage("no access",clients=client_id)
|
||||
_ba.chatmessage("no access")
|
||||
|
||||
|
||||
if setting.brdcast_chatcmd:
|
||||
return msg
|
||||
|
|
|
|||
236
dist/ba_root/mods/chatHandle/chatCMDS/cheats.py
vendored
Normal file
236
dist/ba_root/mods/chatHandle/chatCMDS/cheats.py
vendored
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
|
||||
from _ba import chatmessage as cmsg, screenmessage as smsg
|
||||
from .handlers import activity_players, on_command_error, handlemsg, handlemsg_all
|
||||
import ba, _ba, time
|
||||
|
||||
cmnds = ['kill', 'heal', 'curse', 'sleep', 'superpunch', 'gloves', 'shield', 'freeze', 'unfreeze', 'godmode']
|
||||
|
||||
cmnd_aliases = ['die', 'heath', 'cur', 'sp', 'punch', 'protect', 'ice', 'thaw', 'gm']
|
||||
|
||||
|
||||
|
||||
def exec_cmd(cmnd, arg, client_id, pbid):
|
||||
|
||||
if cmnd in ['kill', 'die']:
|
||||
kill_call(arg)
|
||||
|
||||
elif cmnd in ['heal', 'heath']:
|
||||
heal_call(arg)
|
||||
|
||||
elif cmnd in ['curse', 'cur']:
|
||||
curse_call(arg)
|
||||
|
||||
elif cmnd in ['sleep']:
|
||||
sleep_call(arg)
|
||||
|
||||
elif cmnd in ['sp', 'superpunch']:
|
||||
super_punch_call(arg)
|
||||
|
||||
elif cmnd in ['gloves', 'punch']:
|
||||
gloves_call(arg)
|
||||
|
||||
elif cmnd in ['shield', 'protect']:
|
||||
shield_call(arg)
|
||||
|
||||
elif cmnd in ['freeze', 'ice']:
|
||||
freeze_call(arg)
|
||||
|
||||
elif cmnd in ['unfreeze', 'thaw']:
|
||||
un_freeze_call(arg)
|
||||
|
||||
elif cmnd in ['gm', 'godmode']:
|
||||
god_mode_call(arg)
|
||||
|
||||
|
||||
|
||||
|
||||
def kill_call(arg):
|
||||
if on_command_error(arg):
|
||||
return
|
||||
|
||||
elif arg[0] == 'all':
|
||||
handlemsg_all(ba.DieMessage())
|
||||
|
||||
else:
|
||||
try:
|
||||
req_player = int(arg[0])
|
||||
handlemsg(req_player, ba.DieMessage())
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def heal_call(arg):
|
||||
if on_command_error(arg):
|
||||
return
|
||||
|
||||
elif arg[0] == 'all':
|
||||
handlemsg_all(ba.PowerupMessage(poweruptype='health'))
|
||||
|
||||
else:
|
||||
try:
|
||||
req_player = int(arg[0])
|
||||
handlemsg(req_player, ba.PowerupMessage(poweruptype='health'))
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
def curse_call(arg):
|
||||
if on_command_error(arg):
|
||||
return
|
||||
|
||||
elif arg[0] == 'all':
|
||||
handlemsg_all(ba.PowerupMessage(poweruptype='curse'))
|
||||
|
||||
else:
|
||||
try:
|
||||
req_player = int(arg[0])
|
||||
handlemsg(req_player, ba.PowerupMessage(poweruptype='curse'))
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
|
||||
def sleep_call(arg):
|
||||
if on_command_error(arg):
|
||||
return
|
||||
# ahh ! harsh here maybe fix in future
|
||||
elif arg[0] == 'all':
|
||||
for i in activity_players():
|
||||
i.actor.node.handlemessage('knockout', 8000)
|
||||
else:
|
||||
try:
|
||||
req_player = int(arg[0])
|
||||
activity_players()[req_player].actor.node.handlemessage('knockout', 8000)
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
|
||||
def super_punch_call(arg):
|
||||
if on_command_error(arg):
|
||||
return
|
||||
|
||||
elif arg[0] == 'all':
|
||||
for i in activity_players():
|
||||
if i.actor._punch_power_scale != 15:
|
||||
i.actor._punch_power_scale = 15
|
||||
i.actor._punch_cooldown = 0
|
||||
else:
|
||||
i.actor._punch_power_scale = 1.2
|
||||
i.actor._punch_cooldown = 400
|
||||
|
||||
else:
|
||||
try:
|
||||
req_player = int(arg[0])
|
||||
|
||||
if activity_players()[req_player].actor._punch_power_scale != 15:
|
||||
activity_players()[req_player].actor._punch_power_scale = 15
|
||||
activity_players()[req_player].actor._punch_cooldown = 0
|
||||
else:
|
||||
activity_players()[req_player].actor._punch_power_scale = 1.2
|
||||
activity_players()[req_player].actor._punch_cooldown = 400
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
|
||||
def gloves_call(arg):
|
||||
if on_command_error(arg):
|
||||
return
|
||||
|
||||
elif arg[0] == 'all':
|
||||
handlemsg_all(ba.PowerupMessage(poweruptype='punch'))
|
||||
|
||||
else:
|
||||
try:
|
||||
req_player = int(arg[0])
|
||||
handlemsg(req_player, ba.PowerupMessage(poweruptype='punch'))
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
|
||||
def shield_call(arg):
|
||||
if on_command_error(arg):
|
||||
return
|
||||
|
||||
elif arg[0] == 'all':
|
||||
handlemsg_all(ba.PowerupMessage(poweruptype='shield'))
|
||||
|
||||
else:
|
||||
try:
|
||||
req_player = int(arg[0])
|
||||
handlemsg(req_player, ba.PowerupMessage(poweruptype='shield'))
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
|
||||
def freeze_call(arg):
|
||||
if on_command_error(arg):
|
||||
return
|
||||
|
||||
elif arg[0] == 'all':
|
||||
handlemsg_all(ba.FreezeMessage())
|
||||
|
||||
else:
|
||||
try:
|
||||
req_player = int(arg[0])
|
||||
handlemsg(req_player, ba.FreezeMessage())
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
|
||||
def un_freeze_call(arg):
|
||||
if on_command_error(arg):
|
||||
return
|
||||
|
||||
elif arg[0] == 'all':
|
||||
handlemsg_all(ba.ThawMessage())
|
||||
|
||||
else:
|
||||
try:
|
||||
req_player = int(arg[0])
|
||||
handlemsg(req_player, ba.ThawMessage())
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
|
||||
def god_mode_call(arg):
|
||||
if on_command_error(arg):
|
||||
return
|
||||
|
||||
elif arg[0] == 'all':
|
||||
|
||||
for i in activity_players():
|
||||
if i.actor._punch_power_scale != 7:
|
||||
i.actor._punch_power_scale = 7
|
||||
i.actor.node.hockey = True
|
||||
i.actor.node.invincible = True
|
||||
else:
|
||||
i.actor._punch_power_scale = 1.2
|
||||
i.actor.node.hockey = False
|
||||
i.actor.node.invincible = False
|
||||
|
||||
else:
|
||||
req_player = int(arg[0])
|
||||
player = activity_players()[req_player].actor
|
||||
|
||||
if player._punch_power_scale != 7:
|
||||
player._punch_power_scale = 7
|
||||
player.node.hockey = True
|
||||
player.node.invincible = True
|
||||
|
||||
else:
|
||||
player._punch_power_scale = 1.2
|
||||
player.node.hockey = False
|
||||
player.node.invincible = False
|
||||
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
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):
|
||||
if cmnd =="/fly":
|
||||
fly()
|
||||
cmnds = ['fly', 'invisible', 'headless', 'creepy', 'celebrate', 'spaz']
|
||||
|
||||
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
|
||||
|
||||
elif arg[0] == 'all':
|
||||
|
||||
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 fly():
|
||||
# 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 freeze():
|
||||
# do something
|
||||
|
||||
def spaz():
|
||||
#do something
|
||||
|
||||
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
|
||||
|
|
|
|||
26
dist/ba_root/mods/chatHandle/chatCMDS/handlers.py
vendored
Normal file
26
dist/ba_root/mods/chatHandle/chatCMDS/handlers.py
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
""" helper functions to reduce lot code """
|
||||
import _ba, ba
|
||||
|
||||
|
||||
def activity_players():
|
||||
return _ba.get_foreground_host_activity().players
|
||||
|
||||
def sess_players():
|
||||
return _ba.get_foreground_host_session().sessionplayers
|
||||
|
||||
def on_command_error(arg):
|
||||
if arg == [] or arg == ['']:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def handlemsg(client, msg):
|
||||
activity_players()[client].actor.node.handlemessage(msg)
|
||||
|
||||
def handlemsg_all(msg):
|
||||
for i in activity_players():
|
||||
i.actor.node.handlemessage(msg)
|
||||
|
||||
|
||||
|
||||
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.
|
||||
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):
|
||||
if cmnd =="/kick":
|
||||
cmnds = ['kick', 'remove', 'end', 'quit', 'mute', 'unmute', 'slowmo', 'nv', 'dv', 'pause', 'cameramode', 'createrole', 'addrole', 'removerole', 'addcommand', 'addcmd', 'removecommand', 'removecmd', 'changetag']
|
||||
|
||||
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])
|
||||
|
||||
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):
|
||||
_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():
|
||||
# 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
|
||||
|
|
|
|||
54
dist/ba_root/mods/chatHandle/chatCMDS/normal_commands.py
vendored
Normal file
54
dist/ba_root/mods/chatHandle/chatCMDS/normal_commands.py
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
|
||||
from _ba import chatmessage as cmsg, screenmessage as smsg
|
||||
from .handlers import sess_players
|
||||
import ba, _ba
|
||||
|
||||
cmnds = ['me', 'list', 'uniqeid']
|
||||
|
||||
cmnd_aliases = ['stats', 'score', 'rank', 'myself', 'l', 'id', 'pb-id', 'pb', 'accountid']
|
||||
|
||||
|
||||
def exec_cmd(cmnd, arg, clid, pbid):
|
||||
|
||||
if cmnd in ['me', 'stats', 'score', 'rank', 'myself']:
|
||||
stats_call()
|
||||
|
||||
elif cmnd in ['list', 'l']:
|
||||
list_call(clid)
|
||||
|
||||
elif cmnd in ['uniqeid', 'id', 'pb-id', 'pb' , 'accountid']:
|
||||
show_id_call(arg, pbid, clid)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def stats_call():
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def list_call(clid):
|
||||
seprator = '______________________________'
|
||||
lst = u'{0:^16}{1:^15}{2:^10}'.format('name', 'client_id' , 'player_id') + f'\n{seprator}\n'
|
||||
|
||||
for i in sess_players():
|
||||
lst += u'{0:^16}{1:^15}{2:^10}\n'.format(i.getname(icon = False), str(i.inputdevice.client_id), str(i.id))
|
||||
smsg(lst, color = (0,2.55,2.55), transient = True , clients = [clid])
|
||||
|
||||
|
||||
|
||||
def show_id_call(arg, acid, clid):
|
||||
if arg == [] or arg == ['']:
|
||||
cmsg(f'Your account id is {acid} ')
|
||||
else:
|
||||
try:
|
||||
rq_client = sess_players()[int(arg[0])]
|
||||
name = rq_client.getname(full=True , icon=True)
|
||||
acid = rq_client.get_account_id()
|
||||
smsg(f" {name}'s account id is '{acid}' ", color = (0,2.55,2.55), transient = True , clients = [clid])
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
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.
|
||||
from playersData import pdata
|
||||
from chatHandle.chatCMDS import chatcmd
|
||||
from chatFilter import chatfilter
|
||||
#from chatFilter import chatfilter
|
||||
import ba,_ba
|
||||
|
||||
def public_id(client_id):
|
||||
|
|
@ -14,11 +14,13 @@ def public_id(client_id):
|
|||
def filter_chat_message(msg,client_id):
|
||||
if msg.startswith("/"):
|
||||
return chatcmd.cmd(msg,client_id)
|
||||
return msg
|
||||
|
||||
"""
|
||||
if chatfilter.isAbuse(msg):
|
||||
pdata.warn(public_id(client_id))
|
||||
return None
|
||||
return msg
|
||||
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
|||
6
dist/ba_root/mods/custom_hooks.py
vendored
6
dist/ba_root/mods/custom_hooks.py
vendored
|
|
@ -1,8 +1,10 @@
|
|||
def filter_chat_message(msg,client_id):
|
||||
from chatHandle import handlechat
|
||||
|
||||
|
||||
def filter_chat_message(msg,client_id):
|
||||
from chatHandle import handlechat
|
||||
return handlechat.filter_chat_message(msg,client_id)
|
||||
|
||||
|
||||
def on_app_launch():
|
||||
pass
|
||||
#something
|
||||
|
|
|
|||
BIN
dist/ba_root/mods/playersData/__pycache__/__init__.cpython-38.opt-1.pyc
vendored
Normal file
BIN
dist/ba_root/mods/playersData/__pycache__/__init__.cpython-38.opt-1.pyc
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/playersData/__pycache__/pdata.cpython-38.opt-1.pyc
vendored
Normal file
BIN
dist/ba_root/mods/playersData/__pycache__/pdata.cpython-38.opt-1.pyc
vendored
Normal file
Binary file not shown.
185
dist/ba_root/mods/playersData/pdata.py
vendored
185
dist/ba_root/mods/playersData/pdata.py
vendored
|
|
@ -1,151 +1,164 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
import os,_ba,json
|
||||
roles={}
|
||||
data={}
|
||||
custom={}
|
||||
import _ba, os, json
|
||||
|
||||
|
||||
|
||||
roles = {}
|
||||
data = {}
|
||||
custom = {}
|
||||
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():
|
||||
global roles
|
||||
if roles=={}:
|
||||
f=open(data_path+"roles.json","r")
|
||||
dat=json.loads(f.read())
|
||||
roles=dat
|
||||
f.close()
|
||||
if roles == {}:
|
||||
with open(data_path+'roles.json', 'r') as f:
|
||||
roles = json.load(f)
|
||||
return roles
|
||||
|
||||
|
||||
def create_role(role):
|
||||
global roles
|
||||
_roles=get_roles()
|
||||
_roles = get_roles()
|
||||
if role not in _roles:
|
||||
_roles[role]={
|
||||
_roles[role] = {
|
||||
"tag":role,
|
||||
"tagcolor":(1,1,1),
|
||||
"tagcolor":[1,1,1],
|
||||
"commands":[],
|
||||
"ids":[]
|
||||
}
|
||||
roles=_roles
|
||||
comit()
|
||||
return 'created successfully'
|
||||
|
||||
|
||||
return 'already exists'
|
||||
}
|
||||
roles = _roles
|
||||
commit(_roles)
|
||||
return
|
||||
return
|
||||
|
||||
def add_player_role(role,id):
|
||||
|
||||
def add_player_role(role, id):
|
||||
global roles
|
||||
_roles=get_roles()
|
||||
_roles = get_roles()
|
||||
if role in _roles:
|
||||
_roles[role].ids.append(id)
|
||||
roles=_roles
|
||||
commit()
|
||||
return 'added to '+role
|
||||
if id not in _roles[role]["ids"]:
|
||||
_roles[role]["ids"].append(id)
|
||||
roles =_roles
|
||||
commit(_roles)
|
||||
return "added to "+role
|
||||
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
|
||||
_roles=get_roles()
|
||||
_roles = get_roles()
|
||||
if role in _roles:
|
||||
_roles[role].ids.remove(id)
|
||||
roles=_roles
|
||||
commit()
|
||||
return "removed"
|
||||
_roles[role]["ids"].remove(id)
|
||||
roles =_roles
|
||||
commit(_roles)
|
||||
return "removed from "+role
|
||||
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
|
||||
_roles=get_roles()
|
||||
_roles = get_roles()
|
||||
if role in _roles:
|
||||
_roles[role].tag=tag
|
||||
roles=_roles
|
||||
commit()
|
||||
if command not in _roles[role]["commands"]:
|
||||
_roles[role]["commands"].append(command)
|
||||
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 "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):
|
||||
global roles
|
||||
_roles =get_roles()
|
||||
_roles = get_roles()
|
||||
for role in _roles:
|
||||
if acc_id in role["ids"]:
|
||||
return role
|
||||
|
||||
|
||||
##### those ups done will clean it in future
|
||||
|
||||
|
||||
|
||||
#======================= CUSTOM EFFECTS/TAGS ===============
|
||||
|
||||
|
||||
def get_custom():
|
||||
global custom
|
||||
if custom=={}:
|
||||
f=open(data_path+"custom.json","r")
|
||||
dat=json.loads(f.read())
|
||||
custom=dat
|
||||
f.close()
|
||||
return custom
|
||||
with open(data_path+"custom.json","r") as f:
|
||||
custom = json.loads(f.read())
|
||||
return custom
|
||||
|
||||
|
||||
|
||||
def set_effect(effect,id):
|
||||
def set_effect(effect, id):
|
||||
global custom
|
||||
_custom=get_custom()
|
||||
_custom['customeffects'][id]=effect
|
||||
custom=_custom
|
||||
_custom = get_custom()
|
||||
_custom['customeffects'][id] = effect
|
||||
custom = _custom
|
||||
commit_c()
|
||||
|
||||
|
||||
def set_tag(tag,id):
|
||||
def set_tag(tag, id):
|
||||
global custom
|
||||
_custom=get_custom()
|
||||
_custom['customtag'][id]=tag
|
||||
custom=_custom
|
||||
_custom = get_custom()
|
||||
_custom['customtag'][id] = tag
|
||||
custom = _custom
|
||||
commit_c()
|
||||
|
||||
|
||||
def remove_effect(id):
|
||||
global custom
|
||||
_custom=get_custom()
|
||||
_custom = get_custom()
|
||||
_custom['customeffects'].pop(id)
|
||||
custom=_custom
|
||||
custom = _custom
|
||||
commit_c()
|
||||
|
||||
|
||||
def remove_tag(id):
|
||||
global custom
|
||||
_custom=get_custom()
|
||||
_custom = get_custom()
|
||||
_custom['customtag'].pop(id)
|
||||
custom=_custom
|
||||
custom = _custom
|
||||
commit_c()
|
||||
|
||||
|
||||
def commit_c():
|
||||
global custom
|
||||
f=open(data_path+"custom.json",'w')
|
||||
json.dump(custom,f,indent=4)
|
||||
f.close()
|
||||
with open(data_path+"custom.json",'w') as f:
|
||||
json.dump(custom,f,indent=4)
|
||||
|
|
|
|||
144
dist/ba_root/mods/playersData/roles.json
vendored
144
dist/ba_root/mods/playersData/roles.json
vendored
|
|
@ -1,27 +1,121 @@
|
|||
{
|
||||
"owner":{
|
||||
"tag":"OWNER",
|
||||
"tagcolor":(1,1,1),
|
||||
"commands":["add","kick","remove"],
|
||||
"ids":["pb-ihugg7g9==","pb-7gt78"]
|
||||
|
||||
},
|
||||
"admin":{
|
||||
"tag":"ADMIN",
|
||||
"tagcolor":(1,1,1),
|
||||
"commands":["kick","end"],
|
||||
"ids":["pb-ugg","pb-767fyfd"]
|
||||
},
|
||||
"vip":{
|
||||
"tag":"VIP",
|
||||
"tagcolor":(1,1,1),
|
||||
"commands":[],
|
||||
"ids":[]
|
||||
},
|
||||
"toppers":{
|
||||
"tag":"DONOR",
|
||||
"tagcolor":(2,2,2),
|
||||
"commands":[],
|
||||
"ids":[]
|
||||
}
|
||||
"owner": {
|
||||
"tag": "pranav",
|
||||
"tagcolor": [
|
||||
1,
|
||||
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"
|
||||
]
|
||||
},
|
||||
"test69": {
|
||||
"tag": "test69",
|
||||
"tagcolor": [
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"commands": [
|
||||
"mute"
|
||||
],
|
||||
"ids": [
|
||||
"pb-IF4VAk4a"
|
||||
]
|
||||
},
|
||||
"test70": {
|
||||
"tag": "test70",
|
||||
"tagcolor": [
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"commands": [],
|
||||
"ids": [
|
||||
"pb-IF4VAk4a"
|
||||
]
|
||||
},
|
||||
"test71": {
|
||||
"tag": "test71",
|
||||
"tagcolor": [
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"commands": [],
|
||||
"ids": []
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue