Music changing now shows your custom showname, if set.
This commit is contained in:
parent
0280f42f6e
commit
84da730bce
@ -2155,6 +2155,12 @@ void Courtroom::handle_song(QStringList *p_contents)
|
||||
{
|
||||
QString str_char = char_list.at(n_char).name;
|
||||
|
||||
if (p_contents->length() > 2)
|
||||
{
|
||||
if (ui_showname_enable->isChecked())
|
||||
str_char = p_contents->at(2);
|
||||
}
|
||||
|
||||
if (!mute_map.value(n_char))
|
||||
{
|
||||
append_ic_songchange(f_song_clear, str_char);
|
||||
@ -2401,7 +2407,14 @@ void Courtroom::on_music_list_double_clicked(QModelIndex p_model)
|
||||
//QString p_song = ui_music_list->item(p_model.row())->text();
|
||||
QString p_song = music_list.at(p_model.row());
|
||||
|
||||
ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"), false);
|
||||
if (!ui_ic_chat_name->text().isEmpty())
|
||||
{
|
||||
ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#" + ui_ic_chat_name->text() + "#%"), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"), false);
|
||||
}
|
||||
}
|
||||
|
||||
void Courtroom::on_hold_it_clicked()
|
||||
|
@ -478,7 +478,7 @@ class AOProtocol(asyncio.Protocol):
|
||||
if not self.client.is_dj:
|
||||
self.client.send_host_message('You were blockdj\'d by a moderator.')
|
||||
return
|
||||
if not self.validate_net_cmd(args, self.ArgType.STR, self.ArgType.INT):
|
||||
if not self.validate_net_cmd(args, self.ArgType.STR, self.ArgType.INT) and not self.validate_net_cmd(args, self.ArgType.STR, self.ArgType.INT, self.ArgType.STR):
|
||||
return
|
||||
if args[1] != self.client.char_id:
|
||||
return
|
||||
@ -487,8 +487,13 @@ class AOProtocol(asyncio.Protocol):
|
||||
return
|
||||
try:
|
||||
name, length = self.server.get_song_data(args[0])
|
||||
self.client.area.play_music(name, self.client.char_id, length)
|
||||
self.client.area.add_music_playing(self.client, name)
|
||||
if len(args) > 2:
|
||||
showname = args[2]
|
||||
self.client.area.play_music_shownamed(name, self.client.char_id, showname, length)
|
||||
self.client.area.add_music_playing_shownamed(self.client, showname, name)
|
||||
else:
|
||||
self.client.area.play_music(name, self.client.char_id, length)
|
||||
self.client.area.add_music_playing(self.client, name)
|
||||
logger.log_server('[{}][{}]Changed music to {}.'
|
||||
.format(self.client.area.id, self.client.get_char_name(), name), self.client)
|
||||
except ServerError:
|
||||
|
@ -116,6 +116,14 @@ class AreaManager:
|
||||
if length > 0:
|
||||
self.music_looper = asyncio.get_event_loop().call_later(length,
|
||||
lambda: self.play_music(name, -1, length))
|
||||
|
||||
def play_music_shownamed(self, name, cid, showname, length=-1):
|
||||
self.send_command('MC', name, cid, showname)
|
||||
if self.music_looper:
|
||||
self.music_looper.cancel()
|
||||
if length > 0:
|
||||
self.music_looper = asyncio.get_event_loop().call_later(length,
|
||||
lambda: self.play_music(name, -1, length))
|
||||
|
||||
|
||||
def can_send_message(self, client):
|
||||
@ -159,6 +167,10 @@ class AreaManager:
|
||||
self.current_music_player = client.get_char_name()
|
||||
self.current_music = name
|
||||
|
||||
def add_music_playing_shownamed(self, client, showname, name):
|
||||
self.current_music_player = showname + " (" + client.get_char_name() + ")"
|
||||
self.current_music = name
|
||||
|
||||
def get_evidence_list(self, client):
|
||||
client.evi_list, evi_list = self.evi_list.create_evi_list(client)
|
||||
return evi_list
|
||||
|
Loading…
Reference in New Issue
Block a user