Server messages are now coloured differently.
This commit is contained in:
parent
fcd8f5b5ab
commit
d54064d892
@ -5,7 +5,7 @@ AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent)
|
||||
|
||||
}
|
||||
|
||||
void AOTextArea::append_chatmessage(QString p_name, QString p_message)
|
||||
void AOTextArea::append_chatmessage(QString p_name, QString p_message, QString p_colour)
|
||||
{
|
||||
const QTextCursor old_cursor = this->textCursor();
|
||||
const int old_scrollbar_value = this->verticalScrollBar()->value();
|
||||
@ -14,7 +14,7 @@ void AOTextArea::append_chatmessage(QString p_name, QString p_message)
|
||||
this->moveCursor(QTextCursor::End);
|
||||
|
||||
this->append("");
|
||||
this->insertHtml("<b>" + p_name.toHtmlEscaped() + "</b>: ");
|
||||
this->insertHtml("<b><font color=" + p_colour + ">" + p_name.toHtmlEscaped() + "</font></b>: ");
|
||||
|
||||
//cheap workarounds ahoy
|
||||
p_message += " ";
|
||||
|
@ -12,7 +12,7 @@ class AOTextArea : public QTextBrowser
|
||||
public:
|
||||
AOTextArea(QWidget *p_parent = nullptr);
|
||||
|
||||
void append_chatmessage(QString p_name, QString p_message);
|
||||
void append_chatmessage(QString p_name, QString p_message, QString p_colour);
|
||||
void append_error(QString p_message);
|
||||
|
||||
private:
|
||||
|
@ -1005,12 +1005,19 @@ void Courtroom::list_areas()
|
||||
|
||||
void Courtroom::append_ms_chatmessage(QString f_name, QString f_message)
|
||||
{
|
||||
ui_ms_chatlog->append_chatmessage(f_name, f_message);
|
||||
ui_ms_chatlog->append_chatmessage(f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name());
|
||||
}
|
||||
|
||||
void Courtroom::append_server_chatmessage(QString p_name, QString p_message)
|
||||
void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QString p_colour)
|
||||
{
|
||||
ui_server_chatlog->append_chatmessage(p_name, p_message);
|
||||
QString colour = "#000000";
|
||||
|
||||
if (p_colour == "0")
|
||||
colour = ao_app->get_color("ooc_default_color", "courtroom_design.ini").name();
|
||||
if (p_colour == "1")
|
||||
colour = ao_app->get_color("ooc_server_color", "courtroom_design.ini").name();
|
||||
|
||||
ui_server_chatlog->append_chatmessage(p_name, p_message, colour);
|
||||
}
|
||||
|
||||
void Courtroom::on_chat_return_pressed()
|
||||
@ -2660,21 +2667,21 @@ void Courtroom::on_ooc_return_pressed()
|
||||
else if (ooc_message.startsWith("/login"))
|
||||
{
|
||||
ui_guard->show();
|
||||
append_server_chatmessage("CLIENT", "You were granted the Guard button.");
|
||||
append_server_chatmessage("CLIENT", "You were granted the Guard button.", "1");
|
||||
}
|
||||
else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && !rainbow_appended)
|
||||
{
|
||||
//ui_text_color->addItem("Rainbow");
|
||||
ui_ooc_chat_message->clear();
|
||||
//rainbow_appended = true;
|
||||
append_server_chatmessage("CLIENT", "This does nohing, but there you go.");
|
||||
append_server_chatmessage("CLIENT", "This does nohing, but there you go.", "1");
|
||||
return;
|
||||
}
|
||||
else if (ooc_message.startsWith("/settings"))
|
||||
{
|
||||
ui_ooc_chat_message->clear();
|
||||
ao_app->call_settings_menu();
|
||||
append_server_chatmessage("CLIENT", "You opened the settings menu.");
|
||||
append_server_chatmessage("CLIENT", "You opened the settings menu.", "1");
|
||||
return;
|
||||
}
|
||||
else if (ooc_message.startsWith("/pair"))
|
||||
@ -2692,16 +2699,16 @@ void Courtroom::on_ooc_return_pressed()
|
||||
QString msg = "You will now pair up with ";
|
||||
msg.append(char_list.at(whom).name);
|
||||
msg.append(" if they also choose your character in return.");
|
||||
append_server_chatmessage("CLIENT", msg);
|
||||
append_server_chatmessage("CLIENT", msg, "1");
|
||||
}
|
||||
else
|
||||
{
|
||||
append_server_chatmessage("CLIENT", "You are no longer paired with anyone.");
|
||||
append_server_chatmessage("CLIENT", "You are no longer paired with anyone.", "1");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
append_server_chatmessage("CLIENT", "Are you sure you typed that well? The char ID could not be recognised.");
|
||||
append_server_chatmessage("CLIENT", "Are you sure you typed that well? The char ID could not be recognised.", "1");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -2720,29 +2727,29 @@ void Courtroom::on_ooc_return_pressed()
|
||||
QString msg = "You have set your offset to ";
|
||||
msg.append(QString::number(off));
|
||||
msg.append("%.");
|
||||
append_server_chatmessage("CLIENT", msg);
|
||||
append_server_chatmessage("CLIENT", msg, "1");
|
||||
}
|
||||
else
|
||||
{
|
||||
append_server_chatmessage("CLIENT", "Your offset must be between -100% and 100%!");
|
||||
append_server_chatmessage("CLIENT", "Your offset must be between -100% and 100%!", "1");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
append_server_chatmessage("CLIENT", "That offset does not look like one.");
|
||||
append_server_chatmessage("CLIENT", "That offset does not look like one.", "1");
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (ooc_message.startsWith("/switch_am"))
|
||||
{
|
||||
append_server_chatmessage("CLIENT", "You switched your music and area list.");
|
||||
append_server_chatmessage("CLIENT", "You switched your music and area list.", "1");
|
||||
on_switch_area_music_clicked();
|
||||
ui_ooc_chat_message->clear();
|
||||
return;
|
||||
}
|
||||
else if (ooc_message.startsWith("/enable_blocks"))
|
||||
{
|
||||
append_server_chatmessage("CLIENT", "You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this.");
|
||||
append_server_chatmessage("CLIENT", "You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this.", "1");
|
||||
ao_app->shownames_enabled = true;
|
||||
ao_app->charpairs_enabled = true;
|
||||
ao_app->arup_enabled = true;
|
||||
@ -2754,9 +2761,9 @@ void Courtroom::on_ooc_return_pressed()
|
||||
else if (ooc_message.startsWith("/non_int_pre"))
|
||||
{
|
||||
if (ui_pre_non_interrupt->isChecked())
|
||||
append_server_chatmessage("CLIENT", "Your pre-animations interrupt again.");
|
||||
append_server_chatmessage("CLIENT", "Your pre-animations interrupt again.", "1");
|
||||
else
|
||||
append_server_chatmessage("CLIENT", "Your pre-animations will not interrupt text.");
|
||||
append_server_chatmessage("CLIENT", "Your pre-animations will not interrupt text.", "1");
|
||||
ui_pre_non_interrupt->setChecked(!ui_pre_non_interrupt->isChecked());
|
||||
ui_ooc_chat_message->clear();
|
||||
return;
|
||||
|
@ -162,7 +162,7 @@ public:
|
||||
|
||||
//these are for OOC chat
|
||||
void append_ms_chatmessage(QString f_name, QString f_message);
|
||||
void append_server_chatmessage(QString p_name, QString p_message);
|
||||
void append_server_chatmessage(QString p_name, QString p_message, QString p_colour);
|
||||
|
||||
//these functions handle chatmessages sequentially.
|
||||
//The process itself is very convoluted and merits separate documentation
|
||||
|
@ -357,7 +357,7 @@ void Lobby::list_favorites()
|
||||
|
||||
void Lobby::append_chatmessage(QString f_name, QString f_message)
|
||||
{
|
||||
ui_chatbox->append_chatmessage(f_name, f_message);
|
||||
ui_chatbox->append_chatmessage(f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name());
|
||||
}
|
||||
|
||||
void Lobby::append_error(QString f_message)
|
||||
|
@ -178,7 +178,12 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
goto end;
|
||||
|
||||
if (courtroom_constructed)
|
||||
w_courtroom->append_server_chatmessage(f_contents.at(0), f_contents.at(1));
|
||||
{
|
||||
if (f_contents.size() == 3)
|
||||
w_courtroom->append_server_chatmessage(f_contents.at(0), f_contents.at(1), f_contents.at(2));
|
||||
else
|
||||
w_courtroom->append_server_chatmessage(f_contents.at(0), f_contents.at(1), "0");
|
||||
}
|
||||
}
|
||||
else if (header == "FL")
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ class AreaManager:
|
||||
c.send_command(cmd, *args)
|
||||
|
||||
def send_host_message(self, msg):
|
||||
self.send_command('CT', self.server.config['hostname'], msg)
|
||||
self.send_command('CT', self.server.config['hostname'], msg, '1')
|
||||
|
||||
def set_next_msg_delay(self, msg_length):
|
||||
delay = min(3000, 100 + 60 * msg_length)
|
||||
|
@ -94,7 +94,7 @@ class ClientManager:
|
||||
self.send_raw_message('{}#%'.format(command))
|
||||
|
||||
def send_host_message(self, msg):
|
||||
self.send_command('CT', self.server.config['hostname'], msg)
|
||||
self.send_command('CT', self.server.config['hostname'], msg, '1')
|
||||
|
||||
def send_motd(self):
|
||||
self.send_host_message('=== MOTD ===\r\n{}\r\n============='.format(self.server.config['motd']))
|
||||
@ -272,7 +272,7 @@ class ClientManager:
|
||||
info = 'Current online: {}'.format(cnt) + info
|
||||
else:
|
||||
try:
|
||||
info = 'People in this area: {}\n'.format(len(self.server.area_manager.areas[area_id].clients)) + self.get_area_info(area_id, mods)
|
||||
info = 'People in this area: {}'.format(len(self.server.area_manager.areas[area_id].clients)) + self.get_area_info(area_id, mods)
|
||||
except AreaError:
|
||||
raise
|
||||
self.send_host_message(info)
|
||||
|
@ -502,7 +502,7 @@ def ooc_cmd_announce(client, arg):
|
||||
if len(arg) == 0:
|
||||
raise ArgumentError("Can't send an empty message.")
|
||||
client.server.send_all_cmd_pred('CT', '{}'.format(client.server.config['hostname']),
|
||||
'=== Announcement ===\r\n{}\r\n=================='.format(arg))
|
||||
'=== Announcement ===\r\n{}\r\n=================='.format(arg), '1')
|
||||
logger.log_server('[{}][{}][ANNOUNCEMENT]{}.'.format(client.area.abbreviation, client.get_char_name(), arg), client)
|
||||
logger.log_mod('[{}][{}][ANNOUNCEMENT]{}.'.format(client.area.abbreviation, client.get_char_name(), arg), client)
|
||||
|
||||
|
@ -60,7 +60,7 @@ class DistrictClient:
|
||||
elif cmd == 'NEED':
|
||||
need_msg = '=== Cross Advert ===\r\n{} at {} in {} [{}] needs {}\r\n====================' \
|
||||
.format(args[1], args[0], args[2], args[3], args[4])
|
||||
self.server.send_all_cmd_pred('CT', '{}'.format(self.server.config['hostname']), need_msg,
|
||||
self.server.send_all_cmd_pred('CT', '{}'.format(self.server.config['hostname']), need_msg, '1',
|
||||
pred=lambda x: not x.muted_adverts)
|
||||
|
||||
async def write_queue(self):
|
||||
|
@ -253,8 +253,8 @@ class TsuServer3:
|
||||
area_name = client.area.name
|
||||
area_id = client.area.abbreviation
|
||||
self.send_all_cmd_pred('CT', '{}'.format(self.config['hostname']),
|
||||
'=== Advert ===\r\n{} in {} [{}] needs {}\r\n==============='
|
||||
.format(char_name, area_name, area_id, msg), pred=lambda x: not x.muted_adverts)
|
||||
['=== Advert ===\r\n{} in {} [{}] needs {}\r\n==============='
|
||||
.format(char_name, area_name, area_id, msg), '1'], pred=lambda x: not x.muted_adverts)
|
||||
if self.config['use_district']:
|
||||
self.district_client.send_raw_message('NEED#{}#{}#{}#{}'.format(char_name, area_name, area_id, msg))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user