mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-10-20 00:00:39 +00:00
added chat commands
This commit is contained in:
parent
28ba7d8b4d
commit
38cd45f379
14 changed files with 316 additions and 0 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.
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
|
||||
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
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.
Loading…
Add table
Add a link
Reference in a new issue