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;
|
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))
|
if (!mute_map.value(n_char))
|
||||||
{
|
{
|
||||||
append_ic_songchange(f_song_clear, str_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 = ui_music_list->item(p_model.row())->text();
|
||||||
QString p_song = music_list.at(p_model.row());
|
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()
|
void Courtroom::on_hold_it_clicked()
|
||||||
|
@ -478,7 +478,7 @@ class AOProtocol(asyncio.Protocol):
|
|||||||
if not self.client.is_dj:
|
if not self.client.is_dj:
|
||||||
self.client.send_host_message('You were blockdj\'d by a moderator.')
|
self.client.send_host_message('You were blockdj\'d by a moderator.')
|
||||||
return
|
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
|
return
|
||||||
if args[1] != self.client.char_id:
|
if args[1] != self.client.char_id:
|
||||||
return
|
return
|
||||||
@ -487,8 +487,13 @@ class AOProtocol(asyncio.Protocol):
|
|||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
name, length = self.server.get_song_data(args[0])
|
name, length = self.server.get_song_data(args[0])
|
||||||
self.client.area.play_music(name, self.client.char_id, length)
|
if len(args) > 2:
|
||||||
self.client.area.add_music_playing(self.client, name)
|
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 {}.'
|
logger.log_server('[{}][{}]Changed music to {}.'
|
||||||
.format(self.client.area.id, self.client.get_char_name(), name), self.client)
|
.format(self.client.area.id, self.client.get_char_name(), name), self.client)
|
||||||
except ServerError:
|
except ServerError:
|
||||||
|
@ -117,6 +117,14 @@ class AreaManager:
|
|||||||
self.music_looper = asyncio.get_event_loop().call_later(length,
|
self.music_looper = asyncio.get_event_loop().call_later(length,
|
||||||
lambda: self.play_music(name, -1, 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):
|
def can_send_message(self, client):
|
||||||
if self.is_locked and not client.is_mod and not client.ipid in self.invite_list:
|
if self.is_locked and not client.is_mod and not client.ipid in self.invite_list:
|
||||||
@ -159,6 +167,10 @@ class AreaManager:
|
|||||||
self.current_music_player = client.get_char_name()
|
self.current_music_player = client.get_char_name()
|
||||||
self.current_music = 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):
|
def get_evidence_list(self, client):
|
||||||
client.evi_list, evi_list = self.evi_list.create_evi_list(client)
|
client.evi_list, evi_list = self.evi_list.create_evi_list(client)
|
||||||
return evi_list
|
return evi_list
|
||||||
|
Loading…
Reference in New Issue
Block a user