Merge pull request #137 from AttorneyOnline/ignore-bglist

Add the ability to ignore the BG list per area
This commit is contained in:
scatterflower 2021-06-21 21:50:26 -05:00 committed by GitHub
commit 78a644e592
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 1 deletions

View File

@ -230,6 +230,7 @@ class AOClient : public QObject {
{"SAVETEST", 1ULL << 12},
{"FORCE_CHARSELECT",1ULL << 13},
{"BYPASS_LOCKS", 1ULL << 14},
{"IGNORE_BGLIST", 1ULL << 15},
{"SUPER", ~0ULL }
};
@ -963,6 +964,15 @@ class AOClient : public QObject {
*/
void cmdJudgeLog(int argc, QStringList argv);
/**
* @brief Toggles whether the BG list is ignored in an area.
*
* @details No arguments.
*
* @iscommand
*/
void cmdIgnoreBgList(int argc, QStringList argv);
///@}
/**
@ -2055,6 +2065,8 @@ class AOClient : public QObject {
{"updateban", {ACLFlags.value("BAN"), 3, &AOClient::cmdUpdateBan}},
{"update_ban", {ACLFlags.value("BAN"), 3, &AOClient::cmdUpdateBan}},
{"changepass", {ACLFlags.value("NONE"), 1, &AOClient::cmdChangePassword}},
{"ignorebglist", {ACLFlags.value("IGNORE_BGLIST"),0, &AOClient::cmdIgnoreBgList}},
{"ignore_bglist", {ACLFlags.value("IGNORE_BGLIST"),0, &AOClient::cmdIgnoreBgList}}
};
/**

View File

@ -810,9 +810,23 @@ class AreaData : public QObject {
* @brief Returns a copy of the underlying logger's buffer.
*
* @return See short description.
*
* @see #m_ignoreBgList
*/
QQueue<QString> buffer() const;
/**
* @brief Returns whether the BG list is ignored in this araa.
*
* @return See short description.
*/
bool ignoreBgList();
/**
* @brief Toggles whether the BG list is ignored in this area.
*/
void toggleIgnoreBgList();
private:
/**
* @brief The list of timers available in the area.
@ -996,6 +1010,11 @@ private:
* @brief Whether or not music is allowed in this area. If false, only CMs can change the music.
*/
bool m_toggleMusic;
/**
* @brief Whether or not to ignore the server defined background list. If true, any background can be set in an area.
*/
bool m_ignoreBgList;
};
#endif // AREA_DATA_H

View File

@ -47,6 +47,7 @@ AreaData::AreaData(QString p_name, int p_index) :
m_forceImmediate = areas_ini.value("force_immediate", "false").toBool();
m_toggleMusic = areas_ini.value("toggle_music", "true").toBool();
m_shownameAllowed = areas_ini.value("shownames_allowed", "true").toBool();
m_ignoreBgList = areas_ini.value("ignore_bglist", "false").toBool();
areas_ini.endGroup();
int log_size = ConfigManager::logBuffer();
DataTypes::LogType l_logType = ConfigManager::loggingType();
@ -535,3 +536,13 @@ QString AreaData::background() const
{
return m_background;
}
bool AreaData::ignoreBgList()
{
return m_ignoreBgList;
}
void AreaData::toggleIgnoreBgList()
{
m_ignoreBgList = !m_ignoreBgList;
}

View File

@ -239,7 +239,7 @@ void AOClient::cmdSetBackground(int argc, QStringList argv)
{
AreaData* area = server->areas[current_area];
if (authenticated || !area->bgLocked()) {
if (server->backgrounds.contains(argv[0])) {
if (server->backgrounds.contains(argv[0]) || area->ignoreBgList() == true) {
area->background() = argv[0];
server->broadcast(AOPacket("BN", {argv[0]}), current_area);
sendServerMessageArea(current_char + " changed the background to " + argv[0]);
@ -305,3 +305,11 @@ void AOClient::cmdJudgeLog(int argc, QStringList argv)
sendServerMessage(filteredmessage);
}
}
void AOClient::cmdIgnoreBgList(int argc, QStringList argv)
{
AreaData* area = server->areas[current_area];
area->toggleIgnoreBgList();
QString state = area->ignoreBgList() ? "ignored." : "enforced.";
sendServerMessage("BG list in this area is now " + state);
}