aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCerapter <cerap@protonmail.com>2018-10-23 16:34:39 +0200
committerCerapter <cerap@protonmail.com>2018-10-23 16:34:39 +0200
commit962289793d97357b69e228a0b52737681d2ea0b0 (patch)
treea2f825d8b5b6236d1dc404960f33fb3ffbf84fc4
parentde8badc9a6e74ca29cbc04ab5438d6eed2eb8984 (diff)
Added support for the stenographer role in case alerts.
-rw-r--r--aoapplication.h3
-rw-r--r--aocaseannouncerdialog.cpp6
-rw-r--r--aocaseannouncerdialog.h1
-rw-r--r--aooptionsdialog.cpp22
-rw-r--r--aooptionsdialog.h2
-rw-r--r--courtroom.cpp13
-rw-r--r--courtroom.h4
-rw-r--r--packet_distribution.cpp6
-rw-r--r--server/client_manager.py1
-rw-r--r--server/commands.py9
-rw-r--r--text_file_functions.cpp6
11 files changed, 54 insertions, 19 deletions
diff --git a/aoapplication.h b/aoapplication.h
index eafb2b74..fa57ad80 100644
--- a/aoapplication.h
+++ b/aoapplication.h
@@ -288,6 +288,9 @@ public:
// Same for juror.
bool get_casing_juror_enabled();
+ // Same for steno.
+ bool get_casing_steno_enabled();
+
// Same for CM.
bool get_casing_cm_enabled();
diff --git a/aocaseannouncerdialog.cpp b/aocaseannouncerdialog.cpp
index aa373535..65448334 100644
--- a/aocaseannouncerdialog.cpp
+++ b/aocaseannouncerdialog.cpp
@@ -51,11 +51,14 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a
JudgeNeeded->setText("Judge needed");
JurorNeeded = new QCheckBox(this);
JurorNeeded->setText("Jurors needed");
+ StenographerNeeded = new QCheckBox(this);
+ StenographerNeeded->setText("Stenographer needed");
FormLayout->setWidget(1, QFormLayout::FieldRole, DefenceNeeded);
FormLayout->setWidget(2, QFormLayout::FieldRole, ProsecutorNeeded);
FormLayout->setWidget(3, QFormLayout::FieldRole, JudgeNeeded);
FormLayout->setWidget(4, QFormLayout::FieldRole, JurorNeeded);
+ FormLayout->setWidget(5, QFormLayout::FieldRole, StenographerNeeded);
setUpdatesEnabled(true);
}
@@ -66,7 +69,8 @@ void AOCaseAnnouncerDialog::ok_pressed()
DefenceNeeded->isChecked(),
ProsecutorNeeded->isChecked(),
JudgeNeeded->isChecked(),
- JurorNeeded->isChecked());
+ JurorNeeded->isChecked(),
+ StenographerNeeded->isChecked());
done(0);
}
diff --git a/aocaseannouncerdialog.h b/aocaseannouncerdialog.h
index b98f4d7b..78e94f3c 100644
--- a/aocaseannouncerdialog.h
+++ b/aocaseannouncerdialog.h
@@ -35,6 +35,7 @@ private:
QCheckBox *ProsecutorNeeded;
QCheckBox *JudgeNeeded;
QCheckBox *JurorNeeded;
+ QCheckBox *StenographerNeeded;
public slots:
void ok_pressed();
diff --git a/aooptionsdialog.cpp b/aooptionsdialog.cpp
index 813c8cda..b4599238 100644
--- a/aooptionsdialog.cpp
+++ b/aooptionsdialog.cpp
@@ -388,18 +388,31 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
CasingForm->setWidget(5, QFormLayout::FieldRole, JurorCheckbox);
+ // -- STENO ANNOUNCEMENTS
+
+ StenographerLabel = new QLabel(formLayoutWidget_3);
+ StenographerLabel->setText("Stenographer:");
+ StenographerLabel->setToolTip("If checked, you will get alerts about case announcements if a stenographer spot is open.");
+
+ CasingForm->setWidget(6, QFormLayout::LabelRole, StenographerLabel);
+
+ StenographerCheckbox = new QCheckBox(formLayoutWidget_3);
+ StenographerCheckbox->setChecked(ao_app->get_casing_steno_enabled());
+
+ CasingForm->setWidget(6, QFormLayout::FieldRole, StenographerCheckbox);
+
// -- 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);
+ CasingForm->setWidget(7, QFormLayout::LabelRole, CMLabel);
CMCheckbox = new QCheckBox(formLayoutWidget_3);
CMCheckbox->setChecked(ao_app->get_casing_cm_enabled());
- CasingForm->setWidget(6, QFormLayout::FieldRole, CMCheckbox);
+ CasingForm->setWidget(7, QFormLayout::FieldRole, CMCheckbox);
// -- CM CASES ANNOUNCEMENTS
@@ -407,12 +420,12 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
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);
+ CasingForm->setWidget(8, QFormLayout::LabelRole, CMCasesLabel);
CMCasesLineEdit = new QLineEdit(formLayoutWidget_3);
CMCasesLineEdit->setText(ao_app->get_casing_can_host_cases());
- CasingForm->setWidget(7, QFormLayout::FieldRole, CMCasesLineEdit);
+ CasingForm->setWidget(8, QFormLayout::FieldRole, CMCasesLineEdit);
// When we're done, we should continue the updates!
setUpdatesEnabled(true);
@@ -456,6 +469,7 @@ void AOOptionsDialog::save_pressed()
configini->setValue("casing_prosecution_enabled", ProsecutorCheckbox->isChecked());
configini->setValue("casing_judge_enabled", JudgeCheckbox->isChecked());
configini->setValue("casing_juror_enabled", JurorCheckbox->isChecked());
+ configini->setValue("casing_steno_enabled", StenographerCheckbox->isChecked());
configini->setValue("casing_cm_enabled", CMCheckbox->isChecked());
configini->setValue("casing_can_host_casees", CMCasesLineEdit->text());
diff --git a/aooptionsdialog.h b/aooptionsdialog.h
index bbc81ed1..0480eb89 100644
--- a/aooptionsdialog.h
+++ b/aooptionsdialog.h
@@ -96,6 +96,8 @@ private:
QCheckBox *JudgeCheckbox;
QLabel *JurorLabel;
QCheckBox *JurorCheckbox;
+ QLabel *StenographerLabel;
+ QCheckBox *StenographerCheckbox;
QLabel *CMLabel;
QCheckBox *CMCheckbox;
QLabel *CMCasesLabel;
diff --git a/courtroom.cpp b/courtroom.cpp
index 9cf074ac..e81d4fdd 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -2722,7 +2722,7 @@ void Courtroom::mod_called(QString p_ip)
}
}
-void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur)
+void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno)
{
if (ui_casing->isChecked())
{
@@ -2730,7 +2730,8 @@ void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur)
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))
+ (ao_app->get_casing_juror_enabled() && jur) ||
+ (ao_app->get_casing_steno_enabled() && steno))
{
modcall_player->play(ao_app->get_sfx("case_call"));
ao_app->alert(this);
@@ -3564,13 +3565,14 @@ void Courtroom::on_casing_clicked()
+ " " + QString::number(ao_app->get_casing_prosecution_enabled())
+ " " + QString::number(ao_app->get_casing_judge_enabled())
+ " " + QString::number(ao_app->get_casing_juror_enabled())
+ + " " + QString::number(ao_app->get_casing_steno_enabled())
+ "#%"));
else
- ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/setcase \"\" 0 0 0 0 0#%"));
+ ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/setcase \"\" 0 0 0 0 0 0#%"));
}
}
-void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur)
+void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno)
{
if (ao_app->casing_alerts_enabled)
ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/anncase \""
@@ -3578,7 +3580,8 @@ void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool
+ QString::number(def) + " "
+ QString::number(pro) + " "
+ QString::number(jud) + " "
- + QString::number(jur)
+ + QString::number(jur) + " "
+ + QString::number(steno)
+ "#%"));
}
diff --git a/courtroom.h b/courtroom.h
index 0dc7ba43..a27d902c 100644
--- a/courtroom.h
+++ b/courtroom.h
@@ -198,7 +198,7 @@ public:
//state is an number between 0 and 10 inclusive
void set_hp_bar(int p_bar, int p_state);
- void announce_case(QString title, bool def, bool pro, bool jud, bool jur);
+ void announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno);
void check_connection_received();
@@ -551,7 +551,7 @@ public slots:
void mod_called(QString p_ip);
- void case_called(QString msg, bool def, bool pro, bool jud, bool jur);
+ void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno);
private slots:
void start_chat_ticking();
diff --git a/packet_distribution.cpp b/packet_distribution.cpp
index 2abcd160..93ea5f14 100644
--- a/packet_distribution.cpp
+++ b/packet_distribution.cpp
@@ -662,10 +662,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
}
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");
+ if (courtroom_constructed && f_contents.size() > 6)
+ 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", f_contents.at(5) == "1");
}
end:
diff --git a/server/client_manager.py b/server/client_manager.py
index 4a5c1ef4..432c39d4 100644
--- a/server/client_manager.py
+++ b/server/client_manager.py
@@ -72,6 +72,7 @@ class ClientManager:
self.casing_pro = False
self.casing_jud = False
self.casing_jur = False
+ self.casing_steno = False
self.case_call_time = 0
#flood-guard stuff
diff --git a/server/commands.py b/server/commands.py
index 49fd9790..d02eff25 100644
--- a/server/commands.py
+++ b/server/commands.py
@@ -780,6 +780,7 @@ def ooc_cmd_setcase(client, arg):
client.casing_pro = args[3] == "1"
client.casing_jud = args[4] == "1"
client.casing_jur = args[5] == "1"
+ client.casing_steno = args[6] == "1"
def ooc_cmd_anncase(client, arg):
if client in client.area.owners:
@@ -791,7 +792,7 @@ def ooc_cmd_anncase(client, arg):
elif len(args) == 1:
raise ArgumentError('You should probably announce the case to at least one person.')
else:
- if not args[1] == "1" and not args[2] == "1" and not args[3] == "1" and not args[4] == "1":
+ if not args[1] == "1" and not args[2] == "1" and not args[3] == "1" and not args[4] == "1" and not args[5] == "1":
raise ArgumentError('You should probably announce the case to at least one person.')
msg = '=== Case Announcement ===\r\n{} [{}] is hosting {}, looking for '.format(client.get_char_name(), client.id, args[0])
@@ -805,14 +806,16 @@ def ooc_cmd_anncase(client, arg):
lookingfor.append("judge")
if args[4] == "1":
lookingfor.append("juror")
+ if args[5] == "1":
+ lookingfor.append("stenographer")
msg = msg + ', '.join(lookingfor) + '.\r\n=================='
- client.server.send_all_cmd_pred('CASEA', msg, args[1], args[2], args[3], args[4], '1')
+ client.server.send_all_cmd_pred('CASEA', msg, args[1], args[2], args[3], args[4], args[5], '1')
client.set_case_call_delay()
- logger.log_server('[{}][{}][CASE_ANNOUNCEMENT]{}, DEF: {}, PRO: {}, JUD: {}, JUR: {}.'.format(client.area.abbreviation, client.get_char_name(), args[0], args[1], args[2], args[3], args[4]), client)
+ logger.log_server('[{}][{}][CASE_ANNOUNCEMENT]{}, DEF: {}, PRO: {}, JUD: {}, JUR: {}, STENO: {}.'.format(client.area.abbreviation, client.get_char_name(), args[0], args[1], args[2], args[3], args[4], args[5]), client)
else:
raise ClientError('You cannot announce a case in an area where you are not a CM!')
diff --git a/text_file_functions.cpp b/text_file_functions.cpp
index 835a105a..a14db389 100644
--- a/text_file_functions.cpp
+++ b/text_file_functions.cpp
@@ -548,6 +548,12 @@ bool AOApplication::get_casing_juror_enabled()
return result.startsWith("true");
}
+bool AOApplication::get_casing_steno_enabled()
+{
+ QString result = configini->value("casing_steno_enabled", "false").value<QString>();
+ return result.startsWith("true");
+}
+
bool AOApplication::get_casing_cm_enabled()
{
QString result = configini->value("casing_cm_enabled", "false").value<QString>();