The server now announces what features it has.

I'm not sure why I did this.
This commit is contained in:
Cerapter 2018-09-04 21:19:10 +02:00
parent 1124d6b073
commit 4f30afa51d
4 changed files with 81 additions and 27 deletions

View File

@ -69,6 +69,10 @@ public:
bool improved_loading_enabled = false; bool improved_loading_enabled = false;
bool desk_mod_enabled = false; bool desk_mod_enabled = false;
bool evidence_enabled = false; bool evidence_enabled = false;
bool shownames_enabled = false;
bool charpairs_enabled = false;
bool arup_enabled = false;
bool modcall_reason_enabled = false;
///////////////loading info/////////////////// ///////////////loading info///////////////////

View File

@ -437,6 +437,16 @@ void Courtroom::set_widgets()
ui_pair_offset_spinbox->hide(); ui_pair_offset_spinbox->hide();
set_size_and_pos(ui_pair_button, "pair_button"); set_size_and_pos(ui_pair_button, "pair_button");
ui_pair_button->set_image("pair_button.png"); ui_pair_button->set_image("pair_button.png");
if (ao_app->charpairs_enabled)
{
ui_pair_button->setEnabled(true);
ui_pair_button->show();
}
else
{
ui_pair_button->setEnabled(false);
ui_pair_button->hide();
}
set_size_and_pos(ui_area_list, "music_list"); set_size_and_pos(ui_area_list, "music_list");
ui_area_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); ui_area_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
@ -833,7 +843,16 @@ void Courtroom::enter_courtroom(int p_cid)
//ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml());
ui_char_select_background->hide(); ui_char_select_background->hide();
ui_ic_chat_name->setPlaceholderText(ao_app->get_showname(f_char)); if (ao_app->shownames_enabled)
{
ui_ic_chat_name->setPlaceholderText(ao_app->get_showname(f_char));
ui_ic_chat_name->setEnabled(true);
}
else
{
ui_ic_chat_name->setPlaceholderText("---");
ui_ic_chat_name->setEnabled(false);
}
ui_ic_chat_message->setEnabled(m_cid != -1); ui_ic_chat_message->setEnabled(m_cid != -1);
ui_ic_chat_message->setFocus(); ui_ic_chat_message->setFocus();
@ -894,44 +913,56 @@ void Courtroom::list_areas()
for (int n_area = 0 ; n_area < area_list.size() ; ++n_area) for (int n_area = 0 ; n_area < area_list.size() ; ++n_area)
{ {
QString i_area = area_list.at(n_area); QString i_area = area_list.at(n_area);
i_area.append("\n ");
i_area.append(arup_statuses.at(n_area)); if (ao_app->arup_enabled)
i_area.append(" | CM: "); {
i_area.append(arup_cms.at(n_area)); i_area.append("\n ");
i_area.append("\n "); i_area.append(arup_statuses.at(n_area));
i_area.append(" | CM: ");
i_area.append(arup_cms.at(n_area));
i_area.append(QString::number(arup_players.at(n_area))); i_area.append("\n ");
i_area.append(" users | ");
if (arup_locks.at(n_area) == true) i_area.append(QString::number(arup_players.at(n_area)));
i_area.append("LOCKED"); i_area.append(" users | ");
else
i_area.append("OPEN"); if (arup_locks.at(n_area) == true)
i_area.append("LOCKED");
else
i_area.append("OPEN");
}
if (i_area.toLower().contains(ui_music_search->text().toLower())) if (i_area.toLower().contains(ui_music_search->text().toLower()))
{ {
ui_area_list->addItem(i_area); ui_area_list->addItem(i_area);
area_row_to_number.append(n_area); area_row_to_number.append(n_area);
// Colouring logic here. if (ao_app->arup_enabled)
ui_area_list->item(n_listed_areas)->setBackground(free_brush);
if (arup_locks.at(n_area))
{ {
ui_area_list->item(n_listed_areas)->setBackground(locked_brush); // Colouring logic here.
ui_area_list->item(n_listed_areas)->setBackground(free_brush);
if (arup_locks.at(n_area))
{
ui_area_list->item(n_listed_areas)->setBackground(locked_brush);
}
else
{
if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS")
ui_area_list->item(n_listed_areas)->setBackground(lfp_brush);
else if (arup_statuses.at(n_area) == "CASING")
ui_area_list->item(n_listed_areas)->setBackground(casing_brush);
else if (arup_statuses.at(n_area) == "RECESS")
ui_area_list->item(n_listed_areas)->setBackground(recess_brush);
else if (arup_statuses.at(n_area) == "RP")
ui_area_list->item(n_listed_areas)->setBackground(rp_brush);
else if (arup_statuses.at(n_area) == "GAMING")
ui_area_list->item(n_listed_areas)->setBackground(gaming_brush);
}
} }
else else
{ {
if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") ui_area_list->item(n_listed_areas)->setBackground(free_brush);
ui_area_list->item(n_listed_areas)->setBackground(lfp_brush);
else if (arup_statuses.at(n_area) == "CASING")
ui_area_list->item(n_listed_areas)->setBackground(casing_brush);
else if (arup_statuses.at(n_area) == "RECESS")
ui_area_list->item(n_listed_areas)->setBackground(recess_brush);
else if (arup_statuses.at(n_area) == "RP")
ui_area_list->item(n_listed_areas)->setBackground(rp_brush);
else if (arup_statuses.at(n_area) == "GAMING")
ui_area_list->item(n_listed_areas)->setBackground(gaming_brush);
} }
++n_listed_areas; ++n_listed_areas;
@ -3070,6 +3101,13 @@ void Courtroom::on_spectator_clicked()
void Courtroom::on_call_mod_clicked() void Courtroom::on_call_mod_clicked()
{ {
if (!ao_app->modcall_reason_enabled)
{
ao_app->send_server_packet(new AOPacket("ZZ#%"));
ui_ic_chat_message->setFocus();
return;
}
bool ok; bool ok;
QString text = QInputDialog::getText(ui_viewport, "Call a mod", QString text = QInputDialog::getText(ui_viewport, "Call a mod",
"Reason for the modcall (optional):", QLineEdit::Normal, "Reason for the modcall (optional):", QLineEdit::Normal,

View File

@ -147,6 +147,10 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
improved_loading_enabled = false; improved_loading_enabled = false;
desk_mod_enabled = false; desk_mod_enabled = false;
evidence_enabled = false; evidence_enabled = false;
shownames_enabled = false;
charpairs_enabled = false;
arup_enabled = false;
modcall_reason_enabled = false;
//workaround for tsuserver4 //workaround for tsuserver4
if (f_contents.at(0) == "NOENCRYPT") if (f_contents.at(0) == "NOENCRYPT")
@ -192,6 +196,14 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
desk_mod_enabled = true; desk_mod_enabled = true;
if (f_packet.contains("evidence",Qt::CaseInsensitive)) if (f_packet.contains("evidence",Qt::CaseInsensitive))
evidence_enabled = true; evidence_enabled = true;
if (f_packet.contains("cc_customshownames",Qt::CaseInsensitive))
shownames_enabled = true;
if (f_packet.contains("characterpairs",Qt::CaseInsensitive))
charpairs_enabled = true;
if (f_packet.contains("arup",Qt::CaseInsensitive))
arup_enabled = true;
if (f_packet.contains("modcall_reason",Qt::CaseInsensitive))
modcall_reason_enabled = true;
} }
else if (header == "PN") else if (header == "PN")
{ {

View File

@ -213,7 +213,7 @@ class AOProtocol(asyncio.Protocol):
self.client.is_ao2 = True self.client.is_ao2 = True
self.client.send_command('FL', 'yellowtext', 'customobjections', 'flipping', 'fastloading', 'noencryption', 'deskmod', 'evidence') self.client.send_command('FL', 'yellowtext', 'customobjections', 'flipping', 'fastloading', 'noencryption', 'deskmod', 'evidence', 'modcall_reason', 'cc_customshownames', 'characterpairs', 'arup')
def net_cmd_ch(self, _): def net_cmd_ch(self, _):
""" Periodically checks the connection. """ Periodically checks the connection.