aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aoapplication.h26
-rw-r--r--aooptionsdialog.cpp125
-rw-r--r--aooptionsdialog.h22
-rw-r--r--courtroom.cpp49
-rw-r--r--courtroom.h5
-rw-r--r--packet_distribution.cpp10
-rw-r--r--text_file_functions.cpp39
7 files changed, 273 insertions, 3 deletions
diff --git a/aoapplication.h b/aoapplication.h
index aa34f13e..e106bcc7 100644
--- a/aoapplication.h
+++ b/aoapplication.h
@@ -71,6 +71,7 @@ public:
bool evidence_enabled = false;
bool cccc_ic_support_enabled = false;
bool arup_enabled = false;
+ bool casing_alerts_enabled = false;
bool modcall_reason_enabled = false;
///////////////loading info///////////////////
@@ -267,6 +268,31 @@ public:
//Returns p_char's gender
QString get_gender(QString p_char);
+ // ======
+ // These are all casing-related settings.
+ // ======
+
+ // Returns if the user has casing alerts enabled.
+ bool get_casing_enabled();
+
+ // Returns if the user wants to get alerts for the defence role.
+ bool get_casing_defence_enabled();
+
+ // Same for prosecution.
+ bool get_casing_prosecution_enabled();
+
+ // Same for judge.
+ bool get_casing_judge_enabled();
+
+ // Same for juror.
+ bool get_casing_juror_enabled();
+
+ // Same for CM.
+ bool get_casing_cm_enabled();
+
+ // Get the message for the CM for casing alerts.
+ QString get_casing_can_host_cases();
+
private:
const int RELEASE = 2;
const int MAJOR_VERSION = 4;
diff --git a/aooptionsdialog.cpp b/aooptionsdialog.cpp
index 7d307dd3..813c8cda 100644
--- a/aooptionsdialog.cpp
+++ b/aooptionsdialog.cpp
@@ -186,7 +186,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
CallwordsLayout->addWidget(CallwordsExplainLabel);
- // And finally, the Audio tab.
+ // The audio tab.
AudioTab = new QWidget();
SettingsTabs->addTab(AudioTab, "Audio");
@@ -299,6 +299,121 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
AudioForm->setWidget(7, QFormLayout::FieldRole, BlankBlipsCheckbox);
+ // The casing tab!
+ CasingTab = new QWidget();
+ SettingsTabs->addTab(CasingTab, "Casing");
+
+ formLayoutWidget_3 = new QWidget(CasingTab);
+ formLayoutWidget_3->setGeometry(QRect(10,10, 361, 211));
+
+ CasingForm = new QFormLayout(formLayoutWidget_3);
+ CasingForm->setObjectName(QStringLiteral("CasingForm"));
+ CasingForm->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
+ CasingForm->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop);
+ CasingForm->setContentsMargins(0, 0, 0, 0);
+
+ // -- SERVER SUPPORTS CASING
+
+ ServerSupportsCasing = new QLabel(formLayoutWidget_3);
+ if (ao_app->casing_alerts_enabled)
+ ServerSupportsCasing->setText("This server supports case alerts.");
+ else
+ ServerSupportsCasing->setText("This server does not support case alerts.");
+ ServerSupportsCasing->setToolTip("Pretty self-explanatory.");
+
+ CasingForm->setWidget(0, QFormLayout::FieldRole, ServerSupportsCasing);
+
+ // -- CASE ANNOUNCEMENTS
+
+ CasingEnabledLabel = new QLabel(formLayoutWidget_3);
+ CasingEnabledLabel->setText("Casing:");
+ CasingEnabledLabel->setToolTip("If checked, you will get alerts about case announcements.");
+
+ CasingForm->setWidget(1, QFormLayout::LabelRole, CasingEnabledLabel);
+
+ CasingEnabledCheckbox = new QCheckBox(formLayoutWidget_3);
+ CasingEnabledCheckbox->setChecked(ao_app->get_casing_enabled());
+
+ CasingForm->setWidget(1, QFormLayout::FieldRole, CasingEnabledCheckbox);
+
+ // -- DEFENCE ANNOUNCEMENTS
+
+ DefenceLabel = new QLabel(formLayoutWidget_3);
+ DefenceLabel->setText("Defence:");
+ DefenceLabel->setToolTip("If checked, you will get alerts about case announcements if a defence spot is open.");
+
+ CasingForm->setWidget(2, QFormLayout::LabelRole, DefenceLabel);
+
+ DefenceCheckbox = new QCheckBox(formLayoutWidget_3);
+ DefenceCheckbox->setChecked(ao_app->get_casing_defence_enabled());
+
+ CasingForm->setWidget(2, QFormLayout::FieldRole, DefenceCheckbox);
+
+ // -- PROSECUTOR ANNOUNCEMENTS
+
+ ProsecutorLabel = new QLabel(formLayoutWidget_3);
+ ProsecutorLabel->setText("Prosecution:");
+ ProsecutorLabel->setToolTip("If checked, you will get alerts about case announcements if a prosecutor spot is open.");
+
+ CasingForm->setWidget(3, QFormLayout::LabelRole, ProsecutorLabel);
+
+ ProsecutorCheckbox = new QCheckBox(formLayoutWidget_3);
+ ProsecutorCheckbox->setChecked(ao_app->get_casing_prosecution_enabled());
+
+ CasingForm->setWidget(3, QFormLayout::FieldRole, ProsecutorCheckbox);
+
+ // -- JUDGE ANNOUNCEMENTS
+
+ JudgeLabel = new QLabel(formLayoutWidget_3);
+ JudgeLabel->setText("Judge:");
+ JudgeLabel->setToolTip("If checked, you will get alerts about case announcements if the judge spot is open.");
+
+ CasingForm->setWidget(4, QFormLayout::LabelRole, JudgeLabel);
+
+ JudgeCheckbox = new QCheckBox(formLayoutWidget_3);
+ JudgeCheckbox->setChecked(ao_app->get_casing_judge_enabled());
+
+ CasingForm->setWidget(4, QFormLayout::FieldRole, JudgeCheckbox);
+
+ // -- JUROR ANNOUNCEMENTS
+
+ JurorLabel = new QLabel(formLayoutWidget_3);
+ JurorLabel->setText("Juror:");
+ JurorLabel->setToolTip("If checked, you will get alerts about case announcements if a juror spot is open.");
+
+ CasingForm->setWidget(5, QFormLayout::LabelRole, JurorLabel);
+
+ JurorCheckbox = new QCheckBox(formLayoutWidget_3);
+ JurorCheckbox->setChecked(ao_app->get_casing_juror_enabled());
+
+ CasingForm->setWidget(5, QFormLayout::FieldRole, JurorCheckbox);
+
+ // -- CM ANNOUNCEMENTS
+
+ CMLabel = new QLabel(formLayoutWidget_3);
+ CMLabel->setText("CM:");
+ CMLabel->setToolTip("If checked, you will appear amongst the potential CMs on the server.");
+
+ CasingForm->setWidget(6, QFormLayout::LabelRole, CMLabel);
+
+ CMCheckbox = new QCheckBox(formLayoutWidget_3);
+ CMCheckbox->setChecked(ao_app->get_casing_cm_enabled());
+
+ CasingForm->setWidget(6, QFormLayout::FieldRole, CMCheckbox);
+
+ // -- CM CASES ANNOUNCEMENTS
+
+ CMCasesLabel = new QLabel(formLayoutWidget_3);
+ CMCasesLabel->setText("Hosting cases:");
+ CMCasesLabel->setToolTip("If you're a CM, enter what cases are you willing to host.");
+
+ CasingForm->setWidget(7, QFormLayout::LabelRole, CMCasesLabel);
+
+ CMCasesLineEdit = new QLineEdit(formLayoutWidget_3);
+ CMCasesLineEdit->setText(ao_app->get_casing_can_host_cases());
+
+ CasingForm->setWidget(7, QFormLayout::FieldRole, CMCasesLineEdit);
+
// When we're done, we should continue the updates!
setUpdatesEnabled(true);
}
@@ -336,6 +451,14 @@ void AOOptionsDialog::save_pressed()
configini->setValue("blip_rate", BlipRateSpinbox->value());
configini->setValue("blank_blip", BlankBlipsCheckbox->isChecked());
+ configini->setValue("casing_enabled", CasingEnabledCheckbox->isChecked());
+ configini->setValue("casing_defence_enabled", DefenceCheckbox->isChecked());
+ configini->setValue("casing_prosecution_enabled", ProsecutorCheckbox->isChecked());
+ configini->setValue("casing_judge_enabled", JudgeCheckbox->isChecked());
+ configini->setValue("casing_juror_enabled", JurorCheckbox->isChecked());
+ configini->setValue("casing_cm_enabled", CMCheckbox->isChecked());
+ configini->setValue("casing_can_host_casees", CMCasesLineEdit->text());
+
callwordsini->close();
done(0);
}
diff --git a/aooptionsdialog.h b/aooptionsdialog.h
index a48bff9e..bbc81ed1 100644
--- a/aooptionsdialog.h
+++ b/aooptionsdialog.h
@@ -34,6 +34,7 @@ private:
QVBoxLayout *verticalLayout;
QTabWidget *SettingsTabs;
+
QWidget *GameplayTab;
QWidget *formLayoutWidget;
QFormLayout *GameplayForm;
@@ -54,12 +55,14 @@ private:
QLineEdit *MasterServerLineEdit;
QLabel *DiscordLabel;
QCheckBox *DiscordCheckBox;
+
QWidget *CallwordsTab;
QWidget *verticalLayoutWidget;
QVBoxLayout *CallwordsLayout;
QPlainTextEdit *CallwordsTextEdit;
QLabel *CallwordsExplainLabel;
QCheckBox *CharacterCallwordsCheckbox;
+
QWidget *AudioTab;
QWidget *formLayoutWidget_2;
QFormLayout *AudioForm;
@@ -79,6 +82,25 @@ private:
QLabel *BlankBlipsLabel;
QDialogButtonBox *SettingsButtons;
+ QWidget *CasingTab;
+ QWidget *formLayoutWidget_3;
+ QFormLayout *CasingForm;
+ QLabel *ServerSupportsCasing;
+ QLabel *CasingEnabledLabel;
+ QCheckBox *CasingEnabledCheckbox;
+ QLabel *DefenceLabel;
+ QCheckBox *DefenceCheckbox;
+ QLabel *ProsecutorLabel;
+ QCheckBox *ProsecutorCheckbox;
+ QLabel *JudgeLabel;
+ QCheckBox *JudgeCheckbox;
+ QLabel *JurorLabel;
+ QCheckBox *JurorCheckbox;
+ QLabel *CMLabel;
+ QCheckBox *CMCheckbox;
+ QLabel *CMCasesLabel;
+ QLineEdit *CMCasesLineEdit;
+
bool needs_default_audiodev();
signals:
diff --git a/courtroom.cpp b/courtroom.cpp
index b71c97bb..4426caa8 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -201,10 +201,14 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_guard = new QCheckBox(this);
ui_guard->setText("Guard");
ui_guard->hide();
+ ui_casing = new QCheckBox(this);
+ ui_showname_enable->setChecked(ao_app->get_casing_enabled());
+ ui_casing->setText("Casing");
+ ui_casing->hide();
ui_showname_enable = new QCheckBox(this);
ui_showname_enable->setChecked(ao_app->get_showname_enabled_by_default());
- ui_showname_enable->setText("Custom shownames");
+ ui_showname_enable->setText("Shownames");
ui_pre_non_interrupt = new QCheckBox(this);
ui_pre_non_interrupt->setText("No Intrpt");
@@ -323,6 +327,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked()));
connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked()));
connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked()));
+ connect(ui_casing, SIGNAL(clicked()), this, SLOT(on_casing_clicked()));
connect(ui_showname_enable, SIGNAL(clicked()), this, SLOT(on_showname_enable_clicked()));
@@ -599,11 +604,12 @@ void Courtroom::set_widgets()
ui_pre->setText("Pre");
set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt");
-
set_size_and_pos(ui_flip, "flip");
set_size_and_pos(ui_guard, "guard");
+ set_size_and_pos(ui_casing, "casing");
+
set_size_and_pos(ui_showname_enable, "showname_enable");
set_size_and_pos(ui_custom_objection, "custom_objection");
@@ -879,6 +885,11 @@ void Courtroom::enter_courtroom(int p_cid)
else
ui_flip->hide();
+ if (ao_app->casing_alerts_enabled)
+ ui_casing->show();
+ else
+ ui_casing->hide();
+
list_music();
list_areas();
@@ -2697,6 +2708,22 @@ void Courtroom::mod_called(QString p_ip)
}
}
+void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur)
+{
+ if (ui_casing->isChecked())
+ {
+ ui_server_chatlog->append(msg);
+ if ((ao_app->get_casing_defence_enabled() && def) ||
+ (ao_app->get_casing_prosecution_enabled() && pro) ||
+ (ao_app->get_casing_judge_enabled() && jud) ||
+ (ao_app->get_casing_juror_enabled() && jur))
+ {
+ modcall_player->play(ao_app->get_sfx("case_call"));
+ ao_app->alert(this);
+ }
+ }
+}
+
void Courtroom::on_ooc_return_pressed()
{
QString ooc_message = ui_ooc_chat_message->text();
@@ -3506,6 +3533,24 @@ void Courtroom::ping_server()
ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%"));
}
+void Courtroom::on_casing_clicked()
+{
+ if (ao_app->casing_alerts_enabled)
+ {
+ if (ui_casing->isChecked())
+ ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/setcase"
+ + " \"" + ao_app->get_casing_can_host_cases() + "\""
+ + " " + QString::number(ao_app->get_casing_cm_enabled())
+ + " " + QString::number(ao_app->get_casing_defence_enabled())
+ + " " + QString::number(ao_app->get_casing_prosecution_enabled())
+ + " " + QString::number(ao_app->get_casing_judge_enabled())
+ + " " + QString::number(ao_app->get_casing_juror_enabled())
+ + "#%"));
+ else
+ ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/setcase \"\" 0 0 0 0 0#%"));
+ }
+}
+
Courtroom::~Courtroom()
{
delete music_player;
diff --git a/courtroom.h b/courtroom.h
index 46a23d8f..2b60db5b 100644
--- a/courtroom.h
+++ b/courtroom.h
@@ -460,6 +460,7 @@ private:
QCheckBox *ui_pre;
QCheckBox *ui_flip;
QCheckBox *ui_guard;
+ QCheckBox *ui_casing;
QCheckBox *ui_pre_non_interrupt;
QCheckBox *ui_showname_enable;
@@ -548,6 +549,8 @@ public slots:
void mod_called(QString p_ip);
+ void case_called(QString msg, bool def, bool pro, bool jud, bool jur);
+
private slots:
void start_chat_ticking();
void play_sfx();
@@ -648,6 +651,8 @@ private slots:
void on_switch_area_music_clicked();
+ void on_casing_clicked();
+
void ping_server();
void load_bass_opus_plugin();
diff --git a/packet_distribution.cpp b/packet_distribution.cpp
index 6a11958e..2abcd160 100644
--- a/packet_distribution.cpp
+++ b/packet_distribution.cpp
@@ -149,6 +149,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
evidence_enabled = false;
cccc_ic_support_enabled = false;
arup_enabled = false;
+ casing_alerts_enabled = false;
modcall_reason_enabled = false;
//workaround for tsuserver4
@@ -204,6 +205,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
cccc_ic_support_enabled = true;
if (f_packet.contains("arup",Qt::CaseInsensitive))
arup_enabled = true;
+ if (f_packet.contains("casing_alerts",Qt::CaseInsensitive))
+ casing_alerts_enabled = true;
if (f_packet.contains("modcall_reason",Qt::CaseInsensitive))
modcall_reason_enabled = true;
@@ -657,6 +660,13 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (courtroom_constructed && f_contents.size() > 0)
w_courtroom->mod_called(f_contents.at(0));
}
+ else if (header == "CASEA")
+ {
+ if (courtroom_constructed && f_contents.size() > 0)
+ w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", f_contents.at(2) == "1", f_contents.at(3) == "1", f_contents.at(4) == "1");
+ qDebug() << f_contents;
+ qDebug() << (f_contents.at(1) == "1");
+ }
end:
diff --git a/text_file_functions.cpp b/text_file_functions.cpp
index be3d7a72..835a105a 100644
--- a/text_file_functions.cpp
+++ b/text_file_functions.cpp
@@ -518,5 +518,44 @@ bool AOApplication::is_discord_enabled()
return result.startsWith("true");
}
+bool AOApplication::get_casing_enabled()
+{
+ QString result = configini->value("casing_enabled", "false").value<QString>();
+ return result.startsWith("true");
+}
+bool AOApplication::get_casing_defence_enabled()
+{
+ QString result = configini->value("casing_defence_enabled", "false").value<QString>();
+ return result.startsWith("true");
+}
+bool AOApplication::get_casing_prosecution_enabled()
+{
+ QString result = configini->value("casing_prosecution_enabled", "false").value<QString>();
+ return result.startsWith("true");
+}
+
+bool AOApplication::get_casing_judge_enabled()
+{
+ QString result = configini->value("casing_judge_enabled", "false").value<QString>();
+ return result.startsWith("true");
+}
+
+bool AOApplication::get_casing_juror_enabled()
+{
+ QString result = configini->value("casing_juror_enabled", "false").value<QString>();
+ return result.startsWith("true");
+}
+
+bool AOApplication::get_casing_cm_enabled()
+{
+ QString result = configini->value("casing_cm_enabled", "false").value<QString>();
+ return result.startsWith("true");
+}
+
+QString AOApplication::get_casing_can_host_cases()
+{
+ QString result = configini->value("casing_can_host_casees", "Turnabout Check Your Settings").value<QString>();
+ return result;
+}