Fixed jukebox not emptying on toggle, and mod actions on multiple IPIDs.

This commit is contained in:
Cerapter 2018-08-29 16:13:11 +02:00
parent 46e64d6077
commit 57fd4b9b9d
2 changed files with 34 additions and 34 deletions

View File

@ -168,8 +168,8 @@ class AreaManager:
self.current_music = '' self.current_music = ''
return return
if vote_picked.char_id != self.jukebox_prev_char_id or vote_picked.name != self.current_music or len(self.jukebox_votes) > 1: if vote_picked.client.char_id != self.jukebox_prev_char_id or vote_picked.name != self.current_music or len(self.jukebox_votes) > 1:
self.jukebox_prev_char_id = vote_picked.char_id self.jukebox_prev_char_id = vote_picked.client.char_id
if vote_picked.showname == '': if vote_picked.showname == '':
self.send_command('MC', vote_picked.name, vote_picked.client.char_id) self.send_command('MC', vote_picked.name, vote_picked.client.char_id)
else: else:

View File

@ -329,9 +329,9 @@ def ooc_cmd_kick(client, arg):
if not client.is_mod: if not client.is_mod:
raise ClientError('You must be authorized to do that.') raise ClientError('You must be authorized to do that.')
if len(arg) == 0: if len(arg) == 0:
raise ArgumentError('You must specify a target. Use /kick <ipid>.') raise ArgumentError('You must specify a target. Use /kick <ipid> <ipid> ...')
args = list(arg.split(' ')) args = list(arg.split(' '))
client.send_host_message('Attempting to ban {} IPIDs.'.format(len(args))) client.send_host_message('Attempting to kick {} IPIDs.'.format(len(args)))
for raw_ipid in args: for raw_ipid in args:
try: try:
ipid = int(raw_ipid) ipid = int(raw_ipid)
@ -350,7 +350,7 @@ def ooc_cmd_ban(client, arg):
if not client.is_mod: if not client.is_mod:
raise ClientError('You must be authorized to do that.') raise ClientError('You must be authorized to do that.')
if len(arg) == 0: if len(arg) == 0:
raise ArgumentError('You must specify a target. Use /ban <ipid>.') raise ArgumentError('You must specify a target. Use /ban <ipid> <ipid> ...')
args = list(arg.split(' ')) args = list(arg.split(' '))
client.send_host_message('Attempting to ban {} IPIDs.'.format(len(args))) client.send_host_message('Attempting to ban {} IPIDs.'.format(len(args)))
for raw_ipid in args: for raw_ipid in args:
@ -375,7 +375,7 @@ def ooc_cmd_unban(client, arg):
if not client.is_mod: if not client.is_mod:
raise ClientError('You must be authorized to do that.') raise ClientError('You must be authorized to do that.')
if len(arg) == 0: if len(arg) == 0:
raise ArgumentError('You must specify a target. Use /unban <ipid>.') raise ArgumentError('You must specify a target. Use /unban <ipid> <ipid> ...')
args = list(arg.split(' ')) args = list(arg.split(' '))
client.send_host_message('Attempting to unban {} IPIDs.'.format(len(args))) client.send_host_message('Attempting to unban {} IPIDs.'.format(len(args)))
for raw_ipid in args: for raw_ipid in args:
@ -403,21 +403,21 @@ def ooc_cmd_mute(client, arg):
args = list(arg.split(' ')) args = list(arg.split(' '))
client.send_host_message('Attempting to mute {} IPIDs.'.format(len(args))) client.send_host_message('Attempting to mute {} IPIDs.'.format(len(args)))
for raw_ipid in args: for raw_ipid in args:
try: if raw_ipid.isdigit():
ipid = int(raw_ipid) ipid = int(raw_ipid)
except: clients = client.server.client_manager.get_targets(client, TargetType.IPID, ipid, False)
raise ClientError('{} does not look like a valid IPID.'.format(raw_ipid)) if (clients):
try:
clients = client.server.client_manager.get_targets(client, TargetType.IPID, int(ipid), False)
msg = 'Muted ' + str(ipid) + ' clients' msg = 'Muted ' + str(ipid) + ' clients'
for c in clients: for c in clients:
c.is_muted = True c.is_muted = True
msg += ' ' + c.get_char_name() + ' [' + c.id + '],' msg += ' ' + c.get_char_name() + ' [' + str(c.id) + '],'
msg = msg[:-1] msg = msg[:-1]
msg += '.' msg += '.'
client.send_host_message('{}'.format(msg)) client.send_host_message('{}'.format(msg))
except: else:
client.send_host_message("No targets found. Use /mute <ipid> for mute.") client.send_host_message("No targets found. Use /mute <ipid> <ipid> ... for mute.")
else:
client.send_host_message('{} does not look like a valid IPID.'.format(raw_ipid))
def ooc_cmd_unmute(client, arg): def ooc_cmd_unmute(client, arg):
if not client.is_mod: if not client.is_mod:
@ -427,21 +427,21 @@ def ooc_cmd_unmute(client, arg):
args = list(arg.split(' ')) args = list(arg.split(' '))
client.send_host_message('Attempting to unmute {} IPIDs.'.format(len(args))) client.send_host_message('Attempting to unmute {} IPIDs.'.format(len(args)))
for raw_ipid in args: for raw_ipid in args:
try: if raw_ipid.isdigit():
ipid = int(raw_ipid) ipid = int(raw_ipid)
except: clients = client.server.client_manager.get_targets(client, TargetType.IPID, ipid, False)
raise ClientError('{} does not look like a valid IPID.'.format(raw_ipid)) if (clients):
try:
clients = client.server.client_manager.get_targets(client, TargetType.IPID, int(ipid), False)
msg = 'Unmuted ' + str(ipid) + ' clients' msg = 'Unmuted ' + str(ipid) + ' clients'
for c in clients: for c in clients:
c.is_muted = True c.is_muted = False
msg += ' ' + c.get_char_name() + ' [' + c.id + '],' msg += ' ' + c.get_char_name() + ' [' + str(c.id) + '],'
msg = msg[:-1] msg = msg[:-1]
msg += '.' msg += '.'
client.send_host_message('{}'.format(msg)) client.send_host_message('{}'.format(msg))
except: else:
client.send_host_message("No targets found. Use /unmute <ipid> for unmute.") client.send_host_message("No targets found. Use /unmute <ipid> <ipid> ... for unmute.")
else:
client.send_host_message('{} does not look like a valid IPID.'.format(raw_ipid))
def ooc_cmd_login(client, arg): def ooc_cmd_login(client, arg):
if len(arg) == 0: if len(arg) == 0: