Purge most clientside-OOC commands (#599)

Remove OOC-Client commands that are already replaced by UI elements that are easily accessible.

Debatable if /save_case and /load_case should stay as they seem unused by most users/servers.

* Maintain backwards compatability with older servers.

Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
This commit is contained in:
Salanto 2021-10-12 00:53:44 +02:00 committed by GitHub
parent 3c3b88f05c
commit 2a923ac86f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2336,7 +2336,7 @@ bool Courtroom::handle_objection()
"custom", m_chatmessage[CHAR_NAME], "custom", m_chatmessage[CHAR_NAME],
ao_app->get_chat(m_chatmessage[CHAR_NAME])); ao_app->get_chat(m_chatmessage[CHAR_NAME]));
} }
break; break;
m_chatmessage[EMOTE_MOD] = 1; m_chatmessage[EMOTE_MOD] = 1;
} }
ui_vp_objection->load_image( ui_vp_objection->load_image(
@ -3447,7 +3447,7 @@ void Courtroom::chat_tick()
} }
ui_vp_chat_arrow->transform_mode = ao_app->get_misc_scaling(f_custom_theme); ui_vp_chat_arrow->transform_mode = ao_app->get_misc_scaling(f_custom_theme);
ui_vp_chat_arrow->load_image("chat_arrow", f_custom_theme); // Chat stopped being processed, indicate that. ui_vp_chat_arrow->load_image("chat_arrow", f_custom_theme); // Chat stopped being processed, indicate that.
QString f_message_filtered = filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt()); QString f_message_filtered = filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt());
for (int c = 0; c < max_colors; ++c) { for (int c = 0; c < max_colors; ++c) {
additive_previous = additive_previous.replace("$c" + QString::number(c), char_color_rgb_list.at(c).name(QColor::HexRgb)); additive_previous = additive_previous.replace("$c" + QString::number(c), char_color_rgb_list.at(c).name(QColor::HexRgb));
f_message_filtered = f_message_filtered.replace("$c" + QString::number(c), char_color_rgb_list.at(c).name(QColor::HexRgb)); f_message_filtered = f_message_filtered.replace("$c" + QString::number(c), char_color_rgb_list.at(c).name(QColor::HexRgb));
@ -3999,7 +3999,9 @@ void Courtroom::on_ooc_return_pressed()
{ {
QString ooc_message = ui_ooc_chat_message->text(); QString ooc_message = ui_ooc_chat_message->text();
if (ooc_message.startsWith("/pos")) { //We ignore it when the server is compatible with 2.8
//Using an arbitrary 2.8 feature flag certainly won't cause issues someday.
if (ooc_message.startsWith("/pos") & !ao_app->effects_enabled) {
if (ooc_message == "/pos jud") { if (ooc_message == "/pos jud") {
toggle_judge_buttons(true); toggle_judge_buttons(true);
} }
@ -4007,120 +4009,9 @@ void Courtroom::on_ooc_return_pressed()
toggle_judge_buttons(false); toggle_judge_buttons(false);
} }
} }
else if (ooc_message.startsWith("/settings")) {
ui_ooc_chat_message->clear();
ao_app->call_settings_menu();
append_server_chatmessage("CLIENT", tr("You opened the settings menu."),
"1");
return;
}
else if (ooc_message.startsWith("/offset")) {
ui_ooc_chat_message->clear();
ooc_message.remove(0, 8);
bool ok; if (ooc_message.startsWith("/load_case")) {
int off = ooc_message.toInt(&ok); QStringList command = ooc_message.split(" ", Qt::SkipEmptyParts);
if (ok) {
if (off >= -100 && off <= 100) {
char_offset = off;
QString msg =
tr("You have set your offset to %1%%.").arg(QString::number(off));
append_server_chatmessage("CLIENT", msg, "1");
}
else {
append_server_chatmessage(
"CLIENT", tr("Your offset must be between -100% and 100%!"), "1");
}
}
else {
append_server_chatmessage("CLIENT",
tr("That offset does not look like one."), "1");
}
return;
}
else if (ooc_message.startsWith("/voffset")) {
ui_ooc_chat_message->clear();
ooc_message.remove(0, 8);
bool ok;
int off = ooc_message.toInt(&ok);
if (ok) {
if (off >= -100 && off <= 100) {
char_vert_offset = off;
QString msg = tr("You have set your vertical offset to %1%%.")
.arg(QString::number(off));
append_server_chatmessage("CLIENT", msg, "1");
}
else {
append_server_chatmessage(
"CLIENT",
tr("Your vertical offset must be between -100% and 100%!"), "1");
}
}
else {
append_server_chatmessage(
"CLIENT", tr("That vertical offset does not look like one."), "1");
}
return;
}
else if (ooc_message.startsWith("/switch_am")) {
append_server_chatmessage(
"CLIENT", tr("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",
tr("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->cccc_ic_support_enabled = true;
ao_app->arup_enabled = true;
ao_app->modcall_reason_enabled = true;
on_reload_theme_clicked();
ui_ooc_chat_message->clear();
return;
}
else if (ooc_message.startsWith("/non_int_pre")) {
if (ui_immediate->isChecked())
append_server_chatmessage(
"CLIENT", tr("Your pre-animations interrupt again."), "1");
else
append_server_chatmessage(
"CLIENT", tr("Your pre-animations will not interrupt text."), "1");
ui_immediate->setChecked(!ui_immediate->isChecked());
ui_ooc_chat_message->clear();
return;
}
else if (ooc_message.startsWith("/save_chatlog")) {
QFile file("chatlog.txt");
if (!file.open(QIODevice::WriteOnly | QIODevice::Text |
QIODevice::Truncate)) {
append_server_chatmessage(
"CLIENT", tr("Couldn't open chatlog.txt to write into."), "1");
ui_ooc_chat_message->clear();
return;
}
QTextStream out(&file);
out.setCodec("UTF-8");
foreach (chatlogpiece item, ic_chatlog_history) {
out << item.get_full() << '\n';
}
file.close();
append_server_chatmessage("CLIENT", tr("The IC chatlog has been saved."),
"1");
ui_ooc_chat_message->clear();
return;
}
else if (ooc_message.startsWith("/load_case")) {
QStringList command = ooc_message.split(" ", QString::SkipEmptyParts);
QDir casefolder("base/cases"); QDir casefolder("base/cases");
if (!casefolder.exists()) { if (!casefolder.exists()) {
@ -4218,7 +4109,7 @@ void Courtroom::on_ooc_return_pressed()
return; return;
} }
else if (ooc_message.startsWith("/save_case")) { else if (ooc_message.startsWith("/save_case")) {
QStringList command = ooc_message.split(" ", QString::SkipEmptyParts); QStringList command = ooc_message.split(" ", Qt::SkipEmptyParts);
QDir casefolder("base/cases"); QDir casefolder("base/cases");
if (!casefolder.exists()) { if (!casefolder.exists()) {