aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/aoprotocol.py8
-rw-r--r--server/area_manager.py12
2 files changed, 15 insertions, 5 deletions
diff --git a/server/aoprotocol.py b/server/aoprotocol.py
index b36aa61..9c7c9ca 100644
--- a/server/aoprotocol.py
+++ b/server/aoprotocol.py
@@ -492,7 +492,13 @@ class AOProtocol(asyncio.Protocol):
name, length = self.server.get_song_data(args[0])
if self.client.area.jukebox:
- self.client.area.add_jukebox_vote(self.client, name, length)
+ showname = ''
+ if len(args) > 2:
+ if len(args[2]) > 0 and not self.client.area.showname_changes_allowed:
+ self.client.send_host_message("Showname changes are forbidden in this area!")
+ return
+ showname = args[2]
+ self.client.area.add_jukebox_vote(self.client, name, length, showname)
logger.log_server('[{}][{}]Added a jukebox vote for {}.'.format(self.client.area.id, self.client.get_char_name(), name), self.client)
else:
if len(args) > 2:
diff --git a/server/area_manager.py b/server/area_manager.py
index d0ff1cb..e6b34a0 100644
--- a/server/area_manager.py
+++ b/server/area_manager.py
@@ -114,12 +114,12 @@ class AreaManager:
return False
return True
- def add_jukebox_vote(self, client, music_name, length=-1):
+ def add_jukebox_vote(self, client, music_name, length=-1, showname=''):
if length <= 0:
self.remove_jukebox_vote(client, False)
else:
self.remove_jukebox_vote(client, True)
- self.jukebox_votes.append(self.JukeboxVote(client, music_name, length))
+ self.jukebox_votes.append(self.JukeboxVote(client, music_name, length, showname))
client.send_host_message('Your song was added to the jukebox.')
if len(self.jukebox_votes) == 1:
self.start_jukebox()
@@ -160,7 +160,10 @@ class AreaManager:
self.current_music = ''
return
- self.send_command('MC', vote_picked.name, vote_picked.client.char_id)
+ if vote_picked.showname == '':
+ self.send_command('MC', vote_picked.name, vote_picked.client.char_id)
+ else:
+ self.send_command('MC', vote_picked.name, vote_picked.client.char_id, vote_picked.showname)
self.current_music_player = 'The Jukebox'
self.current_music_player_ipid = 'has no IPID'
@@ -257,11 +260,12 @@ class AreaManager:
client.send_command('LE', *self.get_evidence_list(client))
class JukeboxVote:
- def __init__(self, client, name, length):
+ def __init__(self, client, name, length, showname):
self.client = client
self.name = name
self.length = length
self.chance = 1
+ self.showname = showname
def __init__(self, server):
self.server = server