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:
		
							parent
							
								
									3c3b88f05c
								
							
						
					
					
						commit
						2a923ac86f
					
				@ -3999,7 +3999,9 @@ void Courtroom::on_ooc_return_pressed()
 | 
			
		||||
{
 | 
			
		||||
  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") {
 | 
			
		||||
      toggle_judge_buttons(true);
 | 
			
		||||
    }
 | 
			
		||||
@ -4007,120 +4009,9 @@ void Courtroom::on_ooc_return_pressed()
 | 
			
		||||
      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;
 | 
			
		||||
    int off = ooc_message.toInt(&ok);
 | 
			
		||||
    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);
 | 
			
		||||
  if (ooc_message.startsWith("/load_case")) {
 | 
			
		||||
    QStringList command = ooc_message.split(" ", Qt::SkipEmptyParts);
 | 
			
		||||
 | 
			
		||||
    QDir casefolder("base/cases");
 | 
			
		||||
    if (!casefolder.exists()) {
 | 
			
		||||
@ -4218,7 +4109,7 @@ void Courtroom::on_ooc_return_pressed()
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  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");
 | 
			
		||||
    if (!casefolder.exists()) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user