Add per area wtce and shout disable options (#22)
This commit is contained in:
parent
d82e6b8e59
commit
70b5212640
@ -76,5 +76,8 @@ aliases = updateban
|
|||||||
[ignore_bglist]
|
[ignore_bglist]
|
||||||
aliases = ignorebglist
|
aliases = ignorebglist
|
||||||
|
|
||||||
[ignore_bglist]
|
[togglewtce]
|
||||||
aliases = ignorebglist
|
aliases = toggle_wtce
|
||||||
|
|
||||||
|
[toggleshouts]
|
||||||
|
aliases = toggle_shouts
|
@ -1065,6 +1065,24 @@ class AOClient : public QObject
|
|||||||
*/
|
*/
|
||||||
void cmdToggleAreaMessageOnJoin(int argc, QStringList argv);
|
void cmdToggleAreaMessageOnJoin(int argc, QStringList argv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Toggles wether the client can use testimony animations in the area.
|
||||||
|
*
|
||||||
|
* @details No arguments.
|
||||||
|
*
|
||||||
|
* @iscommand
|
||||||
|
*/
|
||||||
|
void cmdToggleWtce(int argc, QStringList argv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Toggles wether the client can send game shouts in the area.
|
||||||
|
*
|
||||||
|
* @details No arguments.
|
||||||
|
*
|
||||||
|
* @iscommand
|
||||||
|
*/
|
||||||
|
void cmdToggleShouts(int argc, QStringList argv);
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -860,6 +860,16 @@ class AreaData : public QObject
|
|||||||
*/
|
*/
|
||||||
void toggleJukebox();
|
void toggleJukebox();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Toggles wether testimony animations can be used in the area.
|
||||||
|
*/
|
||||||
|
void toggleWtceAllowed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Toggles wether shouts can be used in the area.
|
||||||
|
*/
|
||||||
|
void toggleShoutAllowed();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Adds a song to the Jukeboxs queue.
|
* @brief Adds a song to the Jukeboxs queue.
|
||||||
*/
|
*/
|
||||||
@ -877,6 +887,20 @@ class AreaData : public QObject
|
|||||||
*/
|
*/
|
||||||
bool isMessageAllowed() const;
|
bool isMessageAllowed() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns whatever a wtce packet may be broadcasted or not.
|
||||||
|
*
|
||||||
|
* @return True if permitted, false otherwise.
|
||||||
|
*/
|
||||||
|
bool isWtceAllowed() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns wether a shout can be used in the area.
|
||||||
|
*
|
||||||
|
* @return True if permitted, false otherwise.
|
||||||
|
*/
|
||||||
|
bool isShoutAllowed() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Starts a timer that determines whatever a game message may be broadcasted or not.
|
* @brief Starts a timer that determines whatever a game message may be broadcasted or not.
|
||||||
*
|
*
|
||||||
@ -1161,6 +1185,16 @@ class AreaData : public QObject
|
|||||||
*/
|
*/
|
||||||
bool m_can_send_ic_messages = true;
|
bool m_can_send_ic_messages = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief If false, WTCE will be rejected.
|
||||||
|
*/
|
||||||
|
bool m_can_send_wtce = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief If false, shouts are stripped from all messages in the area.
|
||||||
|
*/
|
||||||
|
bool m_can_use_shouts = true;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/**
|
/**
|
||||||
* @brief Allow game messages to be broadcasted.
|
* @brief Allow game messages to be broadcasted.
|
||||||
|
@ -144,7 +144,8 @@ const QMap<QString, AOClient::CommandInfo> AOClient::COMMANDS{
|
|||||||
{"removeentry", {{ACLRole::CM}, 1, &AOClient::cmdRemoveCategorySong}},
|
{"removeentry", {{ACLRole::CM}, 1, &AOClient::cmdRemoveCategorySong}},
|
||||||
{"toggleroot", {{ACLRole::CM}, 0, &AOClient::cmdToggleRootlist}},
|
{"toggleroot", {{ACLRole::CM}, 0, &AOClient::cmdToggleRootlist}},
|
||||||
{"clearcustom", {{ACLRole::CM}, 0, &AOClient::cmdClearCustom}},
|
{"clearcustom", {{ACLRole::CM}, 0, &AOClient::cmdClearCustom}},
|
||||||
};
|
{"togglewtce", {{ACLRole::CM}, 0, &AOClient::cmdToggleWtce}},
|
||||||
|
{"toggleshouts", {{ACLRole::CM}, 0, &AOClient::cmdToggleShouts}}};
|
||||||
|
|
||||||
void AOClient::clientData()
|
void AOClient::clientData()
|
||||||
{
|
{
|
||||||
@ -486,6 +487,10 @@ bool AOClient::checkPermission(ACLRole::Permission f_permission) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((f_permission == ACLRole::CM) && server->getAreaById(m_current_area)->owners().contains(m_id)) {
|
||||||
|
return true; // I'm sorry for this hack.
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAuthenticated()) {
|
if (!isAuthenticated()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,9 @@ AreaData::AreaData(QString p_name, int p_index, MusicManager *p_music_manager =
|
|||||||
m_statement(0),
|
m_statement(0),
|
||||||
m_judgelog(),
|
m_judgelog(),
|
||||||
m_lastICMessage(),
|
m_lastICMessage(),
|
||||||
m_send_area_message(false)
|
m_send_area_message(false),
|
||||||
|
m_can_send_wtce(true),
|
||||||
|
m_can_use_shouts(true)
|
||||||
{
|
{
|
||||||
QStringList name_split = p_name.split(":");
|
QStringList name_split = p_name.split(":");
|
||||||
name_split.removeFirst();
|
name_split.removeFirst();
|
||||||
@ -57,6 +59,8 @@ AreaData::AreaData(QString p_name, int p_index, MusicManager *p_music_manager =
|
|||||||
m_shownameAllowed = areas_ini->value("shownames_allowed", "true").toBool();
|
m_shownameAllowed = areas_ini->value("shownames_allowed", "true").toBool();
|
||||||
m_ignoreBgList = areas_ini->value("ignore_bglist", "false").toBool();
|
m_ignoreBgList = areas_ini->value("ignore_bglist", "false").toBool();
|
||||||
m_jukebox = areas_ini->value("jukebox_enabled", "false").toBool();
|
m_jukebox = areas_ini->value("jukebox_enabled", "false").toBool();
|
||||||
|
m_can_send_wtce = areas_ini->value("wtce_enabled", "true").toBool();
|
||||||
|
m_can_use_shouts = areas_ini->value("shouts_enabled", "true").toBool();
|
||||||
areas_ini->endGroup();
|
areas_ini->endGroup();
|
||||||
QTimer *timer1 = new QTimer();
|
QTimer *timer1 = new QTimer();
|
||||||
m_timers.append(timer1);
|
m_timers.append(timer1);
|
||||||
@ -297,6 +301,16 @@ bool AreaData::isMessageAllowed() const
|
|||||||
return m_can_send_ic_messages;
|
return m_can_send_ic_messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AreaData::isWtceAllowed() const
|
||||||
|
{
|
||||||
|
return m_can_send_wtce;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AreaData::isShoutAllowed() const
|
||||||
|
{
|
||||||
|
return m_can_use_shouts;
|
||||||
|
}
|
||||||
|
|
||||||
void AreaData::startMessageFloodguard(int f_duration)
|
void AreaData::startMessageFloodguard(int f_duration)
|
||||||
{
|
{
|
||||||
m_can_send_ic_messages = false;
|
m_can_send_ic_messages = false;
|
||||||
@ -586,6 +600,16 @@ void AreaData::toggleJukebox()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AreaData::toggleWtceAllowed()
|
||||||
|
{
|
||||||
|
m_can_send_wtce = !m_can_send_wtce;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AreaData::toggleShoutAllowed()
|
||||||
|
{
|
||||||
|
m_can_use_shouts = !m_can_use_shouts;
|
||||||
|
}
|
||||||
|
|
||||||
QString AreaData::addJukeboxSong(QString f_song)
|
QString AreaData::addJukeboxSong(QString f_song)
|
||||||
{
|
{
|
||||||
if (!m_jukebox_queue.contains(f_song)) {
|
if (!m_jukebox_queue.contains(f_song)) {
|
||||||
|
@ -411,6 +411,28 @@ void AOClient::cmdToggleAreaMessageOnJoin(int argc, QStringList argv)
|
|||||||
sendServerMessage("Sending message on area join is now " + l_state);
|
sendServerMessage("Sending message on area join is now " + l_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOClient::cmdToggleWtce(int argc, QStringList argv)
|
||||||
|
{
|
||||||
|
Q_UNUSED(argc);
|
||||||
|
Q_UNUSED(argv);
|
||||||
|
|
||||||
|
AreaData *l_area = server->getAreaById(m_current_area);
|
||||||
|
l_area->toggleWtceAllowed();
|
||||||
|
QString l_state = l_area->isWtceAllowed() ? "enabled." : "disabled.";
|
||||||
|
sendServerMessage("Using testimony animations is now " + l_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOClient::cmdToggleShouts(int argc, QStringList argv)
|
||||||
|
{
|
||||||
|
Q_UNUSED(argc);
|
||||||
|
Q_UNUSED(argv);
|
||||||
|
|
||||||
|
AreaData *l_area = server->getAreaById(m_current_area);
|
||||||
|
l_area->toggleShoutAllowed();
|
||||||
|
QString l_state = l_area->isShoutAllowed() ? "enabled." : "disabled.";
|
||||||
|
sendServerMessage("Using shouts is now " + l_state);
|
||||||
|
}
|
||||||
|
|
||||||
void AOClient::cmdClearAreaMessage(int argc, QStringList argv)
|
void AOClient::cmdClearAreaMessage(int argc, QStringList argv)
|
||||||
{
|
{
|
||||||
Q_UNUSED(argc);
|
Q_UNUSED(argc);
|
||||||
|
@ -376,6 +376,12 @@ void AOClient::pktWtCe(AreaData *area, int argc, QStringList argv, AOPacket pack
|
|||||||
sendServerMessage("You are blocked from using the judge controls.");
|
sendServerMessage("You are blocked from using the judge controls.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!area->isWtceAllowed()) {
|
||||||
|
sendServerMessage("WTCE animations have been disabled in this area.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (QDateTime::currentDateTime().toSecsSinceEpoch() - m_last_wtce_time <= 5)
|
if (QDateTime::currentDateTime().toSecsSinceEpoch() - m_last_wtce_time <= 5)
|
||||||
return;
|
return;
|
||||||
m_last_wtce_time = QDateTime::currentDateTime().toSecsSinceEpoch();
|
m_last_wtce_time = QDateTime::currentDateTime().toSecsSinceEpoch();
|
||||||
@ -770,16 +776,25 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
|
|||||||
l_args.append(l_incoming_args[9].toString());
|
l_args.append(l_incoming_args[9].toString());
|
||||||
|
|
||||||
// objection modifier
|
// objection modifier
|
||||||
|
if (area->isShoutAllowed()) {
|
||||||
if (l_incoming_args[10].toString().contains("4")) {
|
if (l_incoming_args[10].toString().contains("4")) {
|
||||||
// custom shout includes text metadata
|
// custom shout includes text metadata
|
||||||
l_args.append(l_incoming_args[10].toString());
|
l_args.append(l_incoming_args[10].toString());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int l_obj_mod = l_incoming_args[10].toInt();
|
int l_obj_mod = l_incoming_args[10].toInt();
|
||||||
if (l_obj_mod != 0 && l_obj_mod != 1 && l_obj_mod != 2 && l_obj_mod != 3)
|
if ((l_obj_mod < 0) || (l_obj_mod > 4)) {
|
||||||
return l_invalid;
|
return l_invalid;
|
||||||
|
}
|
||||||
l_args.append(QString::number(l_obj_mod));
|
l_args.append(QString::number(l_obj_mod));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (l_incoming_args[10].toString() != "0") {
|
||||||
|
sendServerMessage("Shouts have been disabled in this area.");
|
||||||
|
}
|
||||||
|
l_args.append("0");
|
||||||
|
}
|
||||||
|
|
||||||
// evidence
|
// evidence
|
||||||
int evi_idx = l_incoming_args[11].toInt();
|
int evi_idx = l_incoming_args[11].toInt();
|
||||||
|
Loading…
Reference in New Issue
Block a user