/getarea now shows the CM, /jukebox_toggle and /jukebox_skip are now CM commands as well.

This commit is contained in:
Cerapter 2018-08-24 18:48:13 +02:00
parent 91ad46eea0
commit 6d278330a2
2 changed files with 19 additions and 6 deletions

View File

@ -225,7 +225,10 @@ class ClientManager:
sorted_clients.append(client) sorted_clients.append(client)
sorted_clients = sorted(sorted_clients, key=lambda x: x.get_char_name()) sorted_clients = sorted(sorted_clients, key=lambda x: x.get_char_name())
for c in sorted_clients: for c in sorted_clients:
info += '\r\n[{}] {}'.format(c.id, c.get_char_name()) info += '\r\n'
if c.is_cm:
info +='[CM]'
info += '[{}] {}'.format(c.id, c.get_char_name())
if self.is_mod: if self.is_mod:
info += ' ({})'.format(c.ipid) info += ' ({})'.format(c.ipid)
info += ': {}'.format(c.name) info += ': {}'.format(c.name)

View File

@ -169,15 +169,20 @@ def ooc_cmd_currentmusic(client, arg):
client.area.current_music_player)) client.area.current_music_player))
def ooc_cmd_jukebox_toggle(client, arg): def ooc_cmd_jukebox_toggle(client, arg):
if not client.is_mod: if not client.is_mod and not client.is_cm:
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('This command has no arguments.') raise ArgumentError('This command has no arguments.')
client.area.jukebox = not client.area.jukebox client.area.jukebox = not client.area.jukebox
client.area.send_host_message('A mod has set the jukebox to {}.'.format(client.area.jukebox)) changer = 'Unknown'
if client.is_cm:
changer = 'The CM'
elif client.is_mod:
changer = 'A mod'
client.area.send_host_message('{} has set the jukebox to {}.'.format(changer, client.area.jukebox))
def ooc_cmd_jukebox_skip(client, arg): def ooc_cmd_jukebox_skip(client, arg):
if not client.is_mod: if not client.is_mod and not client.is_cm:
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('This command has no arguments.') raise ArgumentError('This command has no arguments.')
@ -186,10 +191,15 @@ def ooc_cmd_jukebox_skip(client, arg):
if len(client.area.jukebox_votes) == 0: if len(client.area.jukebox_votes) == 0:
raise ClientError('There is no song playing right now, skipping is pointless.') raise ClientError('There is no song playing right now, skipping is pointless.')
client.area.start_jukebox() client.area.start_jukebox()
changer = 'Unknown'
if client.is_cm:
changer = 'The CM'
elif client.is_mod:
changer = 'A mod'
if len(client.area.jukebox_votes) == 1: if len(client.area.jukebox_votes) == 1:
client.area.send_host_message('A mod has forced a skip, restarting the only jukebox song.') client.area.send_host_message('{} has forced a skip, restarting the only jukebox song.'.format(changer))
else: else:
client.area.send_host_message('A mod has forced a skip to the next jukebox song.') client.area.send_host_message('{} has forced a skip to the next jukebox song.'.format(changer))
logger.log_server('[{}][{}]Skipped the current jukebox song.'.format(client.area.id, client.get_char_name())) logger.log_server('[{}][{}]Skipped the current jukebox song.'.format(client.area.id, client.get_char_name()))
def ooc_cmd_jukebox(client, arg): def ooc_cmd_jukebox(client, arg):