bug-fixes

This commit is contained in:
Ubuntu 2024-03-31 13:34:28 +05:30
parent 60b255c7ae
commit 07e4236701
1333 changed files with 198132 additions and 59228 deletions

View file

@ -1,12 +1,11 @@
from .Handlers import handlemsg, handlemsg_all, clientid_to_myself,send
from bastd.actor.zoomtext import ZoomText
import ba, _ba
import json
import os
Commands = ['kill', 'fall', 'heal', 'zoommessage', 'curse', 'sleep', 'superpunch', 'gloves', 'shield', 'freeze', 'unfreeze', 'godmode', 'speedon','admincmdlist']
CommandAliases = ['die', 'fell-down', 'zm', 'heath', 'cur', 'sp', 'punch', 'protect', 'ice', 'thaw', 'gm', 'speedy', 'acl']
Commands = ['kill', 'fall', 'heal', 'curse', 'sleep', 'superpunch', 'gloves', 'shield', 'freeze', 'unfreeze', 'godmode', 'speedon']
CommandAliases = ['die', 'fell-down', 'heath', 'cur', 'sp', 'punch', 'protect', 'ice', 'thaw', 'gm', 'speedy']
@ -52,10 +51,7 @@ def ExcelCommand(command, arguments, clientid, accountid):
elif command in ['freeze', 'ice']:
freeze(arguments, clientid)
elif command in ['zm', 'zoommessage']:
zm(arguments, clientid)
elif command in ['unfreeze', 'thaw']:
un_freeze(arguments, clientid)
@ -68,6 +64,8 @@ def ExcelCommand(command, arguments, clientid, accountid):
elif command in ['acl']:
acl(arguments, clientid)
elif command in ['vcl']:
vcl(arguments, clientid)
def kill(arguments, clientid):
@ -168,48 +166,6 @@ def sleep(arguments, clientid):
return
def hug(arguments, clientid):
activity = _ba.get_foreground_host_activity()
if arguments == [] or arguments == ['']:
myself = clientid_to_myself(clientid)
if activity.players[myself].actor.node.hold_node != True:
activity.players[myself].actor.node.hold_node = True
else:
activity.players[myself].node.hold_node = False
elif arguments[0] == 'all':
activity = _ba.get_foreground_host_activity()
for i in activity.players:
if i.actor.node.hold_node != True:
i.actor.node.hold_node = True
else:
i.actor.node.hold_node = False
else:
try:
activity = _ba.get_foreground_host_activity()
req_player = int(arguments[0])
if activity.players[req_player].actor.node.hold_node != True:
activity.players[req_player].actor.node.hold_node = True
else:
activity.players[req_player].actor.node.hold_node = False
except:
return
def super_punch(arguments, clientid):
activity = _ba.get_foreground_host_activity()
@ -415,43 +371,3 @@ def speedy(arguments, clientid):
else:
player.node.hockey = False
def zm(arguments, clientid):
if len(arguments) == 0:
_ba.screenmessage("Special Chat Only For Main", color=(1,1,1), transient=True, clients=[clientid])
else:
k = arguments[0]
with ba.Context(_ba.get_foreground_host_activity()):
ZoomText(
k,
position=(0, 180),
maxwidth=800,
lifespan=25000,
color=(0.93*1.25, 0.9*1.25, 1.0*1.25),
trailcolor=(0.15, 0.05, 1.0, 0.0),
flash=False,
jitter=2.0).autoretain
def load_roles_data():
base_path = os.path.join(_ba.env()['python_directory_user'], "playersData" + os.sep)
roles_file_path = os.path.join(base_path, 'roles.json')
with open(roles_file_path, 'r') as file:
roles_data = json.load(file)
return roles_data
def acl(arguments, client_id):
roles_data = load_roles_data()
if arguments == [] or arguments == ['']:
admin_commands = roles_data.get("admin", {}).get("commands", [])
msg = "Admin Commands:\n" + "\n".join(admin_commands)+"\n"
send(msg, client_id)

View file

@ -20,14 +20,16 @@ from tools import logger, mongo
import set
import json
Commands = ['cjt', 'checkjointime', 'shop', 'donate','removepaideffect']
CommandAliases = ['give', 'buy', 'cts', 'stc', 'rpe', 'bsc', 'bombsquad-card', 'claim']
CommandAliases = ['give', 'buy', 'cts', 'stc', 'rpe']
BANK_PATH = _ba.env().get("python_directory_user", "") + "/bank.json"
base_path = os.path.join(_ba.env()['python_directory_user'], "stats" + os.sep)
statsfile = base_path + 'stats.json'
python_path = _ba.env()["python_directory_user"]
settings = setting.get_settings_data()
tic = settings["CurrencyType"]["YourCurrency"]
ticket = settings["CurrencyType"]["CurrencyName"]
tic = settings["CurrencyType"]["Currency"] #dont change this or it will give an error
def CoinCommands(command, arguments, clientid, accountid):
@ -57,18 +59,12 @@ def CoinCommands(command, arguments, clientid, accountid):
elif command == 'buy':
buy(arguments, clientid, accountid)
elif command == 'claim':
claim_ticket(arguments, clientid, accountid)
elif command in ['rpe', 'removepaideffect']:
rpe(arguments, clientid, accountid)
elif command in ['cjt', 'checkjointime']:
check_claim_time(arguments, clientid, accountid)
elif command in ['bsc', 'bombsquad-card']:
bombsquad_card(clientid, accountid)
def getcoins(accountid: str):
with open(BANK_PATH, 'r') as f:
@ -201,7 +197,7 @@ def donate(arguments, clientid, accountid):
if sendersID == receiversID:
send(f"You can't transfer to your own account", clientid)
elif getcoins(sendersID) < transfer:
send(f"Not enough {tic}tickets to perform the transaction", clientid)
send(f"Not enough {tic}{ticket} to perform the transaction", clientid)
send(f"You have {havecoins}{tic} only....", clientid)
else:
addcoins(sendersID, transfer * -1)
@ -225,7 +221,7 @@ def cts(arguments, clientid, accountid):
coins = int(a[0])
havecoins = getcoins(accountid)
if havecoins < coins:
send(f"Not enough {tic}tickets to perform the transaction", clientid)
send(f"Not enough {tic}{ticket} to perform the transaction", clientid)
send(f"You have {havecoins}{tic} only....", clientid)
elif coins < 100:
send(f"You can only convert more than 100{tic}", clientid)
@ -279,54 +275,4 @@ def rpe(arguments, clientid, accountid):
pdata.remove_paid_effect(accountid)
send(f"paid {aeffect} effect have been removed Successfully", clientid)
except:
return
def claim_ticket(arguments, clientid, accountid):
players = _ba.get_foreground_host_activity().players
player = _ba.get_foreground_host_activity()
session = ba.internal.get_foreground_host_session()
if arguments == [] or arguments == ['']:
with ba.Context(player):
customers = pdata.get_custom()['ticketclaimed']
for i in session.sessionplayers:
if i.inputdevice.client_id == clientid:
name = i.getname(full=True, icon=True)
if accountid not in customers:
expiry = datetime.now() + timedelta(seconds=1)
customers[accountid] = {'name': name, 'expiry': expiry.strftime('%d-%m-%Y %H:%M:%S')}
coin_claim = 50
addcoins(accountid, coin_claim)
_ba.chatmessage(f"Successfully added {coin_claim}{tic} into {name}'s account..")
else:
till = customers[accountid]['expiry']
send(f"Hey, you've already claimed your reward.\nNext chance: {till}", clientid)
# Function to check credit card details by player ID
def check_credit_card_by_pbid(accountid):
card_data = mongo.collection.find_one({"player_id": accountid})
if card_data:
return card_data
else:
return None
# Function to handle the /cc command
def bombsquad_card(clientid, accountid):
card_data = check_credit_card_by_pbid(accountid)
if card_data:
message = (
f"Credit card details found:\n"
f"Player ID: {card_data['player_id']}\n"
f"Player Name: {card_data['player_name']}\n"
f"Main Bs Number: {card_data['main_bs_number']}\n"
)
send(message, clientid)
else:
send(f"No Main Bs Number details found for player ID: {pbid}", clientid)
return

View file

@ -74,10 +74,10 @@ def ExcelCommand(command, arguments, clientid, accountid):
quit(arguments)
elif command in ['mute', 'mutechat']:
mute(arguments)
mute(arguments, clientid)
elif command in ['unmute', 'unmutechat']:
un_mute(arguments)
un_mute(arguments, clientid)
elif command in ['remove', 'rm']:
remove(arguments)
@ -223,16 +223,16 @@ def partyname(arguments, client_id, ac_id):
name+= word+" "
try:
ba.internal.set_public_party_name(name)
_ba.screenmessage(f"{myself} Changed party Name To {name}", color=(1,1,1), transient=True)
_ba.screenmessage(f"{myself} Changed PartyName To {name}", color=(1,1,1), transient=True)
except:
_ba.screenmessage("failed to change partys name", color=(1,1,1), transient=True, clients=[client_id])
_ba.screenmessage("failed to change PartyName", color=(1,1,1), transient=True, clients=[client_id])
def kick(arguments, clientid, ac_id):
cl_id = int(arguments[0])
for pla in ba.internal.get_foreground_host_session().sessionplayers:
if pla.inputdevice.client_id == clientid:
myself = pla.getname(full=True, icon=True)
for me in ba.internal.get_game_roster():
if me["client_id"] == clientid:
myself = me["display_string"]
for ros in ba.internal.get_game_roster():
if ros["client_id"] == cl_id:
logger.log(f'kicked {ros["display_string"]}')
@ -324,10 +324,10 @@ def end(arguments):
def ban(arguments, clientid, ac_id):
try:
cl_id = int(arguments[0])
for pla in ba.internal.get_foreground_host_session().sessionplayers:
if pla.inputdevice.client_id == clientid:
myself = pla.getname(full=True, icon=True)
duration = int(arguments[1]) if len(arguments) >= 2 else 0.5
duration = int(arguments[1]) if len(arguments) >= 2 else 0.5
for me in ba.internal.get_game_roster():
if me["client_id"] == clientid:
myself = me["display_string"]
for ros in ba.internal.get_game_roster():
if ros["client_id"] == cl_id:
pdata.ban_player(ros['account_id'], duration,
@ -350,9 +350,9 @@ def ban(arguments, clientid, ac_id):
def unban(arguments, clientid, ac_id):
try:
cl_id = int(arguments[0])
for pla in ba.internal.get_foreground_host_session().sessionplayers:
if pla.inputdevice.client_id == clientid:
myself = pla.getname(full=True, icon=True)
for me in ba.internal.get_game_roster():
if me["client_id"] == clientid:
myself = me["display_string"]
for account in serverdata.recents: # backup unban if u by mistakely ban anyone
if account['client_id'] == cl_id:
pdata.unban_player(account["pbid"])
@ -371,17 +371,21 @@ def quit(arguments):
ba.quit()
def mute(arguments):
def mute(arguments, clientid):
if len(arguments) == 0:
serverdata.muted = True
try:
cl_id = int(arguments[0])
duration = int(arguments[1]) if len(arguments) >= 2 else 0.5
for me in ba.internal.get_game_roster():
if me["client_id"] == clientid:
myself = me["display_string"]
for ros in ba.internal.get_game_roster():
if ros["client_id"] == cl_id:
ac_id = ros['account_id']
logger.log(f'muted {ros["display_string"]}')
logger.log(f'muted {ros["display_string"]}')
pdata.mute(ac_id, duration, "muted by chat command")
sendchat(f'{myself} muted {ros["display_string"]}')
return
for account in serverdata.recents: # backup case if player left the server
if account['client_id'] == int(arguments[0]):
@ -392,15 +396,19 @@ def mute(arguments):
return
def un_mute(arguments):
def un_mute(arguments, clientid):
if len(arguments) == []:
serverdata.muted = False
try:
cl_id = int(arguments[0])
for me in ba.internal.get_game_roster():
if me["client_id"] == clientid:
myself = me["display_string"]
for ros in ba.internal.get_game_roster():
if ros["client_id"] == cl_id:
pdata.unmute(ros['account_id'])
logger.log(f'unmuted {ros["display_string"]} by chat command')
sendchat(f'{myself} unmuted {ros["display_string"]}')
return
for account in serverdata.recents: # backup case if player left the server
if account['client_id'] == int(arguments[0]):

View file

@ -1,8 +1,9 @@
from .Handlers import handlemsg, handlemsg_all, send, clientid_to_myself
from playersData import pdata
from bastd.actor.zoomtext import ZoomText
# from tools.whitelist import add_to_white_list, add_commit_to_logs
from serverData import serverdata
#from chatHandle.ChatCommands.commands import NormalCommands as nc
from chatHandle.ChatCommands.commands import NormalCommands as nc
import ba
import _ba,os,json
import time
@ -14,8 +15,8 @@ from stats import mystats
from bastd.gameutils import SharedObjects
from tools import playlist
from tools import logger
Commands = ['hug', 'icy', 'spaz', 'zombieall', 'boxall', 'texall', 'kickall', 'ooh', 'spazall', 'acl', 'vcl']
CommandAliases = ['cc', 'ccall', 'control', 'zombie', 'rainbow', 'ooh', 'playsound', 'tex', 'hugall', 'box', 'ac', 'exchange', 'tint', 'say', 'playsound', 'admincmdlist', 'vipcmdlist']
Commands = ['hug', 'icy', 'spaz', 'zombieall', 'boxall', 'texall', 'kickall', 'ooh', 'spazall', 'vcl', 'acl']
CommandAliases = ['cc', 'ccall', 'control', 'prot', 'protect', 'zoommessage', 'zm', 'pme', 'zombie', 'rainbow', 'ooh', 'playsound', 'tex', 'hugall', 'box', 'ac', 'exchange', 'tint', 'say', 'playsound', 'admincmdlist', 'vipcmdlist']
def NewCommands(command, arguments, clientid, accountid):
@ -84,13 +85,56 @@ def NewCommands(command, arguments, clientid, accountid):
elif command == 'ooh':
play_ooh_sound(arguments)
elif command in ['zm', 'zoommessage']:
zm(arguments, clientid)
elif command == 'playsound':
play_sound(arguments, clientid)
elif command in ['vcl', 'vipcmdlist']:
vcl(arguments, clientid)
elif command in ['prot', 'protect']:
protect_players(arguments, clientid)
elif command == 'pme':
stats_to_clientid(arguments, clientid, accountid)
def stats_to_clientid(arguments, clid, acid):
players = _ba.get_foreground_host_activity().players
player = _ba.get_foreground_host_activity()
if arguments == [] or arguments == ['']:
with ba.Context(player):
send(f"Using: /pme [Clientid of player]", clid)
else:
cl_id = int(arguments[0])
for pla in ba.internal.get_foreground_host_session().sessionplayers:
if pla.inputdevice.client_id == cl_id:
fname = pla.getname(full=True, icon=True)
for roe in ba.internal.get_game_roster():
if roe["client_id"] == cl_id:
pbid = roe["account_id"]
stats = mystats.get_stats_by_id(pbid)
if stats:
tickets = nc.getcoins(pbid)
reply = (
f"\ue048| Name: {fname}\n"
f"\ue048| PB-ID: {stats['aid']}\n"
f"\ue048| Tickets: {tickets}\U0001FA99\n"
f"\ue048| Rank: {stats['rank']}\n"
f"\ue048| Score: {stats['scores']}\n"
f"\ue048| Games: {stats['games']}\n"
f"\ue048| Kills: {stats['kills']}\n"
f"\ue048| Deaths: {stats['deaths']}\n"
f"\ue048| Avg.: {stats['avg_score']}\n"
)
send(reply, clid)
else:
areply = "Not played any match yet."
send(areply, clid)
def hug(arguments, clientid):
players = _ba.get_foreground_host_activity().players
player = _ba.get_foreground_host_activity()
@ -241,53 +285,71 @@ def tint(arguments, clientid):
def spaz(arguments, clientid):
players = _ba.get_foreground_host_activity().players
player = _ba.get_foreground_host_activity()
a = arguments
with ba.Context(player):
try:
players = _ba.get_foreground_host_activity().players
player = _ba.get_foreground_host_activity()
a = arguments
with ba.Context(player):
try:
if arguments != []:
n = int(a[0])
players[n].actor.node.color_texture = ba.gettexture(a[1]+"Color")
players[n].actor.node.color_mask_texture = ba.gettexture(a[1]+"ColorMask")
players[n].actor.node.head_model = ba.getmodel(a[1]+"Head")
players[n].actor.node.torso_model = ba.getmodel(a[1]+"Torso")
players[n].actor.node.pelvis_model = ba.getmodel(a[1]+"Pelvis")
players[n].actor.node.upper_arm_model = ba.getmodel(a[1]+"UpperArm")
players[n].actor.node.forearm_model = ba.getmodel(a[1]+"ForeArm")
players[n].actor.node.hand_model = ba.getmodel(a[1]+"Hand")
players[n].actor.node.upper_leg_model = ba.getmodel(a[1]+"UpperLeg")
players[n].actor.node.lower_leg_model = ba.getmodel(a[1]+"LowerLeg")
players[n].actor.node.toes_model = ba.getmodel(a[1]+"Toes")
players[n].actor.node.style = (a[1])
except:
send(f"Using: /spazall [AppearanceName] [or] /spaz [PlayerID] [AppearanceName] \n________________|_AppearanceName_|_______________\n {'ali, wizard, cyborg, penguin, agent, pixie, bear, bunny'}", clientid)
except:
send(f"Using: /spazall [AppearanceName] [or] /spaz [PlayerID] [AppearanceName] \n________________|_AppearanceName_|________________\n {'ali, wizard, cyborg, penguin, agent, pixie, bear, bunny'}", clientid)
appearance_name = a[1].lower() # Convert to lowercase for case-insensitive comparison
valid_appearance_names = ['ali', 'wizard', 'cyborg', 'penguin', 'agent', 'pixie', 'bear', 'bunny']
# Check if the appearance name is valid
if appearance_name in valid_appearance_names:
players[n].actor.node.color_texture = ba.gettexture(appearance_name + "Color")
players[n].actor.node.color_mask_texture = ba.gettexture(appearance_name + "ColorMask")
players[n].actor.node.head_model = ba.getmodel(appearance_name + "Head")
players[n].actor.node.torso_model = ba.getmodel(appearance_name + "Torso")
players[n].actor.node.pelvis_model = ba.getmodel(appearance_name + "Pelvis")
players[n].actor.node.upper_arm_model = ba.getmodel(appearance_name + "UpperArm")
players[n].actor.node.forearm_model = ba.getmodel(appearance_name + "ForeArm")
players[n].actor.node.hand_model = ba.getmodel(appearance_name + "Hand")
players[n].actor.node.upper_leg_model = ba.getmodel(appearance_name + "UpperLeg")
players[n].actor.node.lower_leg_model = ba.getmodel(appearance_name + "LowerLeg")
players[n].actor.node.toes_model = ba.getmodel(appearance_name + "Toes")
players[n].actor.node.style = appearance_name
else:
# If the appearance name is not valid, inform the user
send("Invalid CharacterName.\nPlease choose from: ali, wizard, cyborg, penguin, agent, pixie, bear, bunny", clientid)
else:
send("Using: /spaz [PLAYER-ID] [CharacterName]", clientid)
except Exception as e:
print(f"Error in spaz command: {e}")
send("An error occurred. Please try again.", clientid)
def spazall(arguments, clientid):
players = _ba.get_foreground_host_activity().players
player = _ba.get_foreground_host_activity()
a = arguments
with ba.Context(player):
for i in players:
try:
i.actor.node.color_texture = ba.gettexture(a[0]+"Color")
i.actor.node.color_mask_texture = ba.gettexture(a[0]+"ColorMask")
i.actor.node.head_model = ba.getmodel(a[0]+"Head")
i.actor.node.torso_model = ba.getmodel(a[0]+"Torso")
i.actor.node.pelvis_model = ba.getmodel(a[0]+"Pelvis")
i.actor.node.upper_arm_model = ba.getmodel(a[0]+"UpperArm")
i.actor.node.forearm_model = ba.getmodel(a[0]+"ForeArm")
i.actor.node.hand_model = ba.getmodel(a[0]+"Hand")
i.actor.node.upper_leg_model = ba.getmodel(a[0]+"UpperLeg")
i.actor.node.lower_leg_model = ba.getmodel(a[0]+"LowerLeg")
i.actor.node.toes_model = ba.getmodel(a[0]+"Toes")
i.actor.node.style = a[0]
except:
send(f"Using: /spazall [AppearanceName] \n________________|_AppearanceName_|________________\n {'ali, wizard, cyborg, penguin, agent, pixie, bear, bunny'}", clientid)
players = _ba.get_foreground_host_activity().players
player = _ba.get_foreground_host_activity()
a = arguments
with ba.Context(player):
for i in players:
try:
if arguments != []:
appearance_name = a[0].lower() # Convert to lowercase for case-insensitive comparison
valid_appearance_names = ['ali', 'wizard', 'cyborg', 'penguin', 'agent', 'pixie', 'bear', 'bunny']
# Check if the appearance name is valid
if appearance_name in valid_appearance_names:
i.actor.node.color_texture = ba.gettexture(appearance_name + "Color")
i.actor.node.color_mask_texture = ba.gettexture(appearance_name + "ColorMask")
i.actor.node.head_model = ba.getmodel(appearance_name + "Head")
i.actor.node.torso_model = ba.getmodel(appearance_name + "Torso")
i.actor.node.pelvis_model = ba.getmodel(appearance_name + "Pelvis")
i.actor.node.upper_arm_model = ba.getmodel(appearance_name + "UpperArm")
i.actor.node.forearm_model = ba.getmodel(appearance_name + "ForeArm")
i.actor.node.hand_model = ba.getmodel(appearance_name + "Hand")
i.actor.node.upper_leg_model = ba.getmodel(appearance_name + "UpperLeg")
i.actor.node.lower_leg_model = ba.getmodel(appearance_name + "LowerLeg")
i.actor.node.toes_model = ba.getmodel(appearance_name + "Toes")
i.actor.node.style = appearance_name
else:
# If the appearance name is not valid, inform the user
send("Invalid CharacterName.\nPlease choose from: ali, wizard, cyborg, penguin, agent, pixie, bear, bunny", clientid)
else:
send("Using: /spazall [CharacterName]", clientid)
except Exception as e:
print(f"Error in spaz command: {e}")
send("An error occurred. Please try again.", clientid)
def zombie(arguments, clientid):
@ -404,7 +466,25 @@ def control(arguments, clientid):
players[player2].actor.node = node1
except:
send(f"Using: /exchange [PlayerID1] [PlayerID2]", clientid)
def zm(arguments, clientid):
if len(arguments) == 0:
_ba.screenmessage("Special Chat Only For Main", color=(1,1,1), transient=True, clients=[clientid])
else:
k = ' '.join(arguments)
with ba.Context(_ba.get_foreground_host_activity()):
ZoomText(
k,
position=(0, 180),
maxwidth=800,
lifespan=1,
color=(0.93*1.25, 0.9*1.25, 1.0*1.25),
trailcolor=(0.15, 0.05, 1.0, 0.0),
flash=False,
jitter=3.0
).autoretain()
def icy(arguments, clientid):
players = _ba.get_foreground_host_activity().players
@ -469,16 +549,67 @@ def play_sound(arguments, clientid):
send(f"Using: /playsound [music sound] [time] [volume]", clientid)
def acl(arguments, clientid):
send(f"\ue046____________|ADMIN-CMDS-LISTS|______________\ue046", clientid)
send(f"\ue046|| kick, kill, heal, curse, ooh, sleep, superpunch or sp, gloves, tint", clientid)
send(f"\ue046|| shield, ice, thaw, gm, playsound, inv, hl, speed, sm, dv, nv, creepy, ac", clientid)
send(f"\ue046|| hug, tex, icy, celebrate, end, fly, lm, gp, remove, zombie, reflections", clientid)
def acl(arguments, client_id):
role = "admin"
admin_commands = pdata.roles_cmdlist(role)
if not admin_commands:
send("Error: Admin role not found.", client_id)
return
msg = "\ue046______________|ADMIN-CMDS-LISTS|________________\ue046\n"
admin_commands_list = admin_commands.split(', ')
for i, cmd in enumerate(admin_commands_list, 1):
if i % 10 == 0:
msg += "\n\ue046 || " + cmd
elif i == 1: # Add \ue046 || only to the first command of each line
msg += "\ue046 || " + cmd
else:
msg += ', ' + cmd
send(msg, client_id)
def vcl(arguments, clientid):
send(f"\ue046___________|VIP-CMDS-LISTS|______________\ue046", clientid)
send(f"\ue046|| kill, heal, curse, sleep, ooh, gloves, creepy, hug, shield, thaw, fly", clientid)
send(f"\ue046|| box, tex, inv, hl, zombie, playsound, nv, dv, sm, ice, lm, end, remove", clientid)
def protect_players(arguments, clientid):
if arguments == [] or arguments == ['']:
myself = clientid_to_myself(clientid)
activity = _ba.get_foreground_host_activity()
player = activity.players[myself].actor
if player.node.invincible != True:
player.node.invincible = True
else:
player.node.invincible = False
elif arguments[0] == 'all':
activity = _ba.get_foreground_host_activity()
for i in activity.players:
if i.actor.node.invincible != True:
i.actor.node.invincible = True
else:
i.actor.node.invincible = False
else:
activity = _ba.get_foreground_host_activity()
req_player = int(arguments[0])
player = activity.players[req_player].actor
if player.node.invincible != True:
player.node.invincible = True
else:
player.node.invincible = False
def vcl(arguments, client_id):
role = "vip"
admin_commands = pdata.roles_cmdlist(role)
if not admin_commands:
send("Error: Vip role not found.", client_id)
return
msg = "\ue046______________|VIP-CMDS-LISTS|________________\ue046\n"
admin_commands_list = admin_commands.split(', ')
for i, cmd in enumerate(admin_commands_list, 1):
if i % 10 == 0:
msg += "\n\ue046 || " + cmd
elif i == 1: # Add \ue046 || only to the first command of each line
msg += "\ue046 || " + cmd
else:
msg += ', ' + cmd
send(msg, client_id)

View file

@ -10,9 +10,14 @@ import ba.internal
from stats import mystats
from ba._general import Call
import _thread
import setting
settings = setting.get_settings_data()
ticket = settings["CurrencyType"]["CurrencyName"]
tic = settings["CurrencyType"]["Currency"] #dont change this or it will give an error
Commands = ['me', 'list', 'uniqeid', 'ping', 'vp', 'uid', 'pbid', 'comp', 'complaintstep']
CommandAliases = ['stats', 'score', 'rank',
'myself', 'l', 'id', 'pb-id', 'pme', 'pb', 'accountid', 'coinhelp', 'voting-playlist', 'complaint', 'cs']
'myself', 'l', 'id', 'link', 'pb-id', 'dclink', 'pme', 'pb', 'accountid', 'coinhelp', 'voting-playlist', 'complaint', 'cs']
def ExcelCommand(command, arguments, clientid, accountid, ARGUMENTS):
@ -55,12 +60,16 @@ def ExcelCommand(command, arguments, clientid, accountid, ARGUMENTS):
elif command == 'coinhelp':
coinhelp(arguments, clientid)
elif command == 'link':
linked_user(arguments, clientid, accountid)
elif command in ['comp', 'complaint']:
get_complaint(arguments, clientid, accountid, ARGUMENTS)
get_complaint(arguments, clientid, accountid, ARGUMENTS)
elif command == 'dclink':
linkingdc(arguments, clientid)
settings = setting.get_settings_data()
tic = settings["CurrencyType"]["YourCurrency"] #dont change this or it will give an error
def get_ping(arguments, clientid):
if arguments == [] or arguments == ['']:
@ -94,7 +103,7 @@ def stats(ac_id, clientid):
reply = (
f"\ue048| Name: {stats['name']}\n"
f"\ue048| PB-ID: {stats['aid']}\n"
f"\ue048| Tickets: {tickets}{tic}\n"
f"\ue048| {ticket.capitalize()}: {tickets}{tic}\n"
f"\ue048| Rank: {stats['rank']}\n"
f"\ue048| Score: {stats['scores']}\n"
f"\ue048| Games: {stats['games']}\n"
@ -132,7 +141,7 @@ def stats_to_clientid(arguments, clid, acid):
reply = (
f"\ue048| Name: {fname}\n"
f"\ue048| PB-ID: {stats['aid']}\n"
f"\ue048| Tickets: {tickets}{tic}\n"
f"\ue048| {ticket.capitalize()}: {tickets}{tic}\n"
f"\ue048| Rank: {stats['rank']}\n"
f"\ue048| Score: {stats['scores']}\n"
f"\ue048| Games: {stats['games']}\n"
@ -206,12 +215,23 @@ def coinhelp(arguments, clientid):
send(f"\ue048| Type /jct to check next join claim time", clientid)
send(f"\ue048| Type /rpe to remove paid effect..", clientid)
send(f"\ue048| Type /buy (effect) to buy effects ", clientid)
send(f"\ue048| Type /donate (amount of coins) (clientid of player) to donate your coins to a player", clientid)
#send(f"\ue048| Type /stc (amount) to convert score to cash (not available)", clientid)
#send(f"ue048| Type /cts (amount) to convert cash to score (not available)", clientid)
send(f"\ue048| Type /donate (amount of {ticket}) (clientid of player) to donate your {ticket} to a player", clientid)
send(f"\ue048| Type /stc (amount) to convert score to cash (not available)", clientid)
send(f"\ue048| Type /cts (amount) to convert cash to score (not available)", clientid)
def linkingdc(arguments, clientid):
"""Linking pbid to discord-id Step"""
if arguments == [] or arguments == ['']:
send(f"\ue048| LINKING PBIDs TO DISCORD IDs STEPS:", clientid)
send(f"\ue048| Type /link (Discord user ID or Username) to link your PBID.", clientid)
send(f"\ue048| If a user successfully links their PBID to their Discord-ID", clientid)
send(f"\ue048| U will receive reward of 3000{tic}.", clientid)
send(f"\ue048| This offer valid only for 3 month so hurry up and link your PBID", clientid)
send(f"\ue048| Note: The linking process is valid only for 5 min.", clientid)
def accountid_request(arguments, clientid, accountid):
"""Returns The Account Id Of Players"""
@ -245,7 +265,17 @@ def accountid_clientid(arguments, clientid, accountid):
names = i.getname(full=True, icon=True)
accountid = i.get_v1_account_id()
send(f" {names}'s account id is '{accountid}' ", clientid)
def linked_user(arguments, clid, acid):
player = _ba.get_foreground_host_activity()
if not arguments or arguments == ['']:
with ba.Context(player):
send(f"Using: /link [DC user-ID or Dc User-Name]", clid)
else:
userid = arguments[0]
asyncio.ensure_future(dc.link_pbid_to_discord(user_id_or_name=userid,pbid=acid,clientid=clid))
def get_complaint(arguments, clientid, acid, ARGUMENTS):
players = _ba.get_foreground_host_activity().players
@ -289,8 +319,9 @@ def get_complaint(arguments, clientid, acid, ARGUMENTS):
if not complaint:
send("Please provide a complaint reason.", clientid)
return
expiry = datetime.now() + timedelta(hours=3)
settime = settings["complaintTimeoutInHours"]
expiry = datetime.now() + timedelta(hours=settime)
customers[acid] = {'expiry': expiry.strftime('%d-%m-%Y %I:%M:%S %p')}
# Call the send_complaint_to_channel function