Rename AOClient member variables
Cleanup a lot of of the variables naming inside area.cpp
This commit is contained in:
parent
b22a83658a
commit
318d12eb7d
core
@ -34,8 +34,6 @@
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
|
||||
class Server;
|
||||
|
||||
/**
|
||||
* @brief Represents a client connected to the server running Attorney Online 2 or one of its derivatives.
|
||||
*/
|
||||
@ -51,12 +49,12 @@ class AOClient : public QObject {
|
||||
* @param parent Qt-based parent, passed along to inherited constructor from QObject.
|
||||
*/
|
||||
AOClient(Server* p_server, QTcpSocket* p_socket, QObject* parent = nullptr, int user_id = 0)
|
||||
: QObject(parent), id(user_id), remote_ip(p_socket->peerAddress()), password(""),
|
||||
joined(false), current_area(0), current_char(""), socket(p_socket), server(p_server),
|
||||
: QObject(parent), m_id(user_id), m_remote_ip(p_socket->peerAddress()), m_password(""),
|
||||
m_joined(false), m_current_area(0), m_current_char(""), m_socket(p_socket), server(p_server),
|
||||
is_partial(false), last_wtce_time(0) {
|
||||
afk_timer = new QTimer;
|
||||
afk_timer->setSingleShot(true);
|
||||
connect(afk_timer, SIGNAL(timeout()), this, SLOT(onAfkTimeout()));
|
||||
m_afk_timer = new QTimer;
|
||||
m_afk_timer->setSingleShot(true);
|
||||
connect(m_afk_timer, SIGNAL(timeout()), this, SLOT(onAfkTimeout()));
|
||||
};
|
||||
|
||||
/**
|
||||
@ -103,17 +101,17 @@ class AOClient : public QObject {
|
||||
/**
|
||||
* @brief The user ID of the client.
|
||||
*/
|
||||
int id;
|
||||
int m_id;
|
||||
|
||||
/**
|
||||
* @brief The IP address of the client.
|
||||
*/
|
||||
QHostAddress remote_ip;
|
||||
QHostAddress m_remote_ip;
|
||||
|
||||
/**
|
||||
* @brief The stored character password for the client, used to be able to select passworded characters.
|
||||
*/
|
||||
QString password;
|
||||
QString m_password;
|
||||
|
||||
/**
|
||||
* @brief True if the client is actually in the server.
|
||||
@ -124,78 +122,78 @@ class AOClient : public QObject {
|
||||
* The purpose of this variable is to determine if the user isn't just doing that, but has actually double-clicked the server, and
|
||||
* its client has sent the standard handshake packets, which does signify that the client intended to 'join' this server.
|
||||
*/
|
||||
bool joined;
|
||||
bool m_joined;
|
||||
|
||||
/**
|
||||
* @brief The ID of the area the client is currently in.
|
||||
*/
|
||||
int current_area;
|
||||
int m_current_area;
|
||||
|
||||
/**
|
||||
* @brief The internal name of the character the client is currently using.
|
||||
*/
|
||||
QString current_char;
|
||||
QString m_current_char;
|
||||
|
||||
/**
|
||||
* @brief The internal name of the character the client is iniswapped to.
|
||||
*
|
||||
* @note This will be the same as current_char if the client is not iniswapped.
|
||||
*/
|
||||
QString current_iniswap;
|
||||
QString m_current_iniswap;
|
||||
|
||||
/**
|
||||
* @brief If true, the client is a logged-in moderator.
|
||||
*/
|
||||
bool authenticated = false;
|
||||
bool m_authenticated = false;
|
||||
|
||||
/**
|
||||
* @brief If using advanced authentication, this is the moderator name that the client has logged in with.
|
||||
*/
|
||||
QString moderator_name = "";
|
||||
QString m_moderator_name = "";
|
||||
|
||||
/**
|
||||
* @brief The out-of-character name of the client, generally the nickname of the user themself.
|
||||
*/
|
||||
QString ooc_name = "";
|
||||
QString m_ooc_name = "";
|
||||
|
||||
/**
|
||||
* @brief The custom showname of the client, used when "renaming" already existing characters in-character.
|
||||
*/
|
||||
QString showname = "";
|
||||
QString m_showname = "";
|
||||
|
||||
/**
|
||||
* @brief If true, the client is willing to receive global messages.
|
||||
*
|
||||
* @see AOClient::cmdG and AOClient::cmdToggleGlobal
|
||||
*/
|
||||
bool global_enabled = true;
|
||||
bool m_global_enabled = true;
|
||||
|
||||
/**
|
||||
* @brief If true, the client's messages will be sent in first-person mode.
|
||||
*
|
||||
* @see AOClient::cmdFirstPerson
|
||||
*/
|
||||
bool first_person = false;
|
||||
bool m_first_person = false;
|
||||
|
||||
/**
|
||||
* @brief If true, the client may not use in-character chat.
|
||||
*/
|
||||
bool is_muted = false;
|
||||
bool m_is_muted = false;
|
||||
|
||||
/**
|
||||
* @brief If true, the client may not use out-of-character chat.
|
||||
*/
|
||||
bool is_ooc_muted = false;
|
||||
bool m_is_ooc_muted = false;
|
||||
|
||||
/**
|
||||
* @brief If true, the client may not use the music list.
|
||||
*/
|
||||
bool is_dj_blocked = false;
|
||||
bool m_is_dj_blocked = false;
|
||||
|
||||
/**
|
||||
* @brief If true, the client may not use the judge controls.
|
||||
*/
|
||||
bool is_wtce_blocked = false;
|
||||
bool m_is_wtce_blocked = false;
|
||||
|
||||
/**
|
||||
* @brief Represents the client's client software, and its version.
|
||||
@ -215,7 +213,7 @@ class AOClient : public QObject {
|
||||
*
|
||||
* @see The struct itself for more details.
|
||||
*/
|
||||
ClientVersion version;
|
||||
ClientVersion m_version;
|
||||
|
||||
/**
|
||||
* @brief The authorisation bitflag, representing what permissions a client can have.
|
||||
@ -248,63 +246,63 @@ class AOClient : public QObject {
|
||||
/**
|
||||
* @brief A list of 5 casing preferences (def, pro, judge, jury, steno)
|
||||
*/
|
||||
QList<bool> casing_preferences = {false, false, false, false, false};
|
||||
QList<bool> m_casing_preferences = {false, false, false, false, false};
|
||||
|
||||
/**
|
||||
* @brief If true, the client's in-character messages will have their word order randomised.
|
||||
*/
|
||||
bool is_shaken = false;
|
||||
bool m_is_shaken = false;
|
||||
|
||||
/**
|
||||
* @brief If true, the client's in-character messages will have their vowels (English alphabet only) removed.
|
||||
*/
|
||||
bool is_disemvoweled = false;
|
||||
bool m_is_disemvoweled = false;
|
||||
|
||||
/**
|
||||
* @brief If true, the client's in-character messages will be overwritten by a randomly picked predetermined message.
|
||||
*/
|
||||
bool is_gimped = false;
|
||||
bool m_is_gimped = false;
|
||||
|
||||
/**
|
||||
* @brief If true, the client will be marked as AFK in /getarea. Automatically applied when a configurable
|
||||
* amount of time has passed since the last interaction, or manually applied by /afk.
|
||||
*/
|
||||
bool is_afk = false;
|
||||
bool m_is_afk = false;
|
||||
|
||||
/**
|
||||
* @brief If true, the client will not recieve PM messages.
|
||||
*/
|
||||
bool pm_mute = false;
|
||||
bool m_pm_mute = false;
|
||||
|
||||
/**
|
||||
* @brief If true, the client will recieve advertisements.
|
||||
*/
|
||||
bool advert_enabled = true;
|
||||
bool m_advert_enabled = true;
|
||||
|
||||
/**
|
||||
* @brief If true, the client is restricted to only changing into certain characters.
|
||||
*/
|
||||
bool is_charcursed = false;
|
||||
bool m_is_charcursed = false;
|
||||
|
||||
/**
|
||||
* @brief Timer for tracking user interaction. Automatically restarted whenever a user interacts (i.e. sends any packet besides CH)
|
||||
*/
|
||||
QTimer* afk_timer;
|
||||
QTimer* m_afk_timer;
|
||||
|
||||
/**
|
||||
* @brief The list of char IDs a charcursed player is allowed to switch to.
|
||||
*/
|
||||
QList<int> charcurse_list;
|
||||
QList<int> m_charcurse_list;
|
||||
|
||||
/**
|
||||
* @brief Temporary client permission if client is allowed to save a testimony to server storage.
|
||||
*/
|
||||
bool testimony_saving = false;
|
||||
bool m_testimony_saving = false;
|
||||
|
||||
/**
|
||||
* @brief If true, the client's next OOC message will be interpreted as a moderator login.
|
||||
*/
|
||||
bool is_logging_in = false;
|
||||
bool m_is_logging_in = false;
|
||||
|
||||
public slots:
|
||||
/**
|
||||
@ -343,7 +341,7 @@ class AOClient : public QObject {
|
||||
/**
|
||||
* @brief The TCP socket used to communicate with the client.
|
||||
*/
|
||||
QTcpSocket* socket;
|
||||
QTcpSocket* m_socket;
|
||||
|
||||
/**
|
||||
* @brief A pointer to the Server, used for updating server variables that depend on the client (e.g. amount of players in an area).
|
||||
@ -609,7 +607,7 @@ class AOClient : public QObject {
|
||||
*
|
||||
* In general, the client assumes that this is a continuous block starting from 0.
|
||||
*/
|
||||
int char_id = -1;
|
||||
int m_char_id = -1;
|
||||
|
||||
/**
|
||||
* @brief The character ID of the other character that the client wants to pair up with.
|
||||
@ -618,7 +616,7 @@ class AOClient : public QObject {
|
||||
* Furthermore, the owner of that character ID must also do the reverse to this client, making their `pairing_with` equal
|
||||
* to this client's character ID.
|
||||
*/
|
||||
int pairing_with = -1;
|
||||
int m_pairing_with = -1;
|
||||
|
||||
/**
|
||||
* @brief The name of the emote last used by the client. No extension.
|
||||
@ -626,7 +624,7 @@ class AOClient : public QObject {
|
||||
* @details This is used for pairing mainly, for the server to be able to craft a smooth-looking transition from one
|
||||
* paired-up client talking to the next.
|
||||
*/
|
||||
QString emote = "";
|
||||
QString m_emote = "";
|
||||
|
||||
/**
|
||||
* @brief The amount the client was last offset by.
|
||||
@ -634,17 +632,17 @@ class AOClient : public QObject {
|
||||
* @details This used to be just a plain number ranging from -100 to 100, but then Crystal mangled it by building some extra data into it.
|
||||
* Cheers, love.
|
||||
*/
|
||||
QString offset = "";
|
||||
QString m_offset = "";
|
||||
|
||||
/**
|
||||
* @brief The last flipped state of the client.
|
||||
*/
|
||||
QString flipping = "";
|
||||
QString m_flipping = "";
|
||||
|
||||
/**
|
||||
* @brief The last reported position of the client.
|
||||
*/
|
||||
QString pos = "";
|
||||
QString m_pos = "";
|
||||
|
||||
///@}
|
||||
|
||||
|
@ -23,33 +23,33 @@
|
||||
|
||||
void AOClient::cmdCM(int argc, QStringList argv)
|
||||
{
|
||||
QString sender_name = ooc_name;
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
if (area->isProtected()) {
|
||||
QString l_sender_name = m_ooc_name;
|
||||
AreaData* l_area = server->m_areas[m_current_area];
|
||||
if (l_area->isProtected()) {
|
||||
sendServerMessage("This area is protected, you may not become CM.");
|
||||
return;
|
||||
}
|
||||
else if (area->owners().isEmpty()) { // no one owns this area, and it's not protected
|
||||
area->addOwner(id);
|
||||
sendServerMessageArea(sender_name + " is now CM in this area.");
|
||||
else if (l_area->owners().isEmpty()) { // no one owns this area, and it's not protected
|
||||
l_area->addOwner(m_id);
|
||||
sendServerMessageArea(l_sender_name + " is now CM in this area.");
|
||||
arup(ARUPType::CM, true);
|
||||
}
|
||||
else if (!area->owners().contains(id)) { // there is already a CM, and it isn't us
|
||||
else if (!l_area->owners().contains(m_id)) { // there is already a CM, and it isn't us
|
||||
sendServerMessage("You cannot become a CM in this area.");
|
||||
}
|
||||
else if (argc == 1) { // we are CM, and we want to make ID argv[0] also CM
|
||||
bool ok;
|
||||
AOClient* owner_candidate = server->getClientByID(argv[0].toInt(&ok));
|
||||
AOClient* l_owner_candidate = server->getClientByID(argv[0].toInt(&ok));
|
||||
if (!ok) {
|
||||
sendServerMessage("That doesn't look like a valid ID.");
|
||||
return;
|
||||
}
|
||||
if (owner_candidate == nullptr) {
|
||||
if (l_owner_candidate == nullptr) {
|
||||
sendServerMessage("Unable to find client with ID " + argv[0] + ".");
|
||||
return;
|
||||
}
|
||||
area->addOwner(owner_candidate->id);
|
||||
sendServerMessageArea(owner_candidate->ooc_name + " is now CM in this area.");
|
||||
l_area->addOwner(l_owner_candidate->m_id);
|
||||
sendServerMessageArea(l_owner_candidate->m_ooc_name + " is now CM in this area.");
|
||||
arup(ARUPType::CM, true);
|
||||
}
|
||||
else {
|
||||
@ -59,41 +59,41 @@ void AOClient::cmdCM(int argc, QStringList argv)
|
||||
|
||||
void AOClient::cmdUnCM(int argc, QStringList argv)
|
||||
{
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
int uid;
|
||||
AreaData* l_area = server->m_areas[m_current_area];
|
||||
int l_uid;
|
||||
|
||||
if (area->owners().isEmpty()) {
|
||||
if (l_area->owners().isEmpty()) {
|
||||
sendServerMessage("There are no CMs in this area.");
|
||||
return;
|
||||
}
|
||||
else if (argc == 0) {
|
||||
uid = id;
|
||||
l_uid = m_id;
|
||||
sendServerMessage("You are no longer CM in this area.");
|
||||
}
|
||||
else if (checkAuth(ACLFlags.value("UNCM")) && argc == 1) {
|
||||
bool conv_ok = false;
|
||||
uid = argv[0].toInt(&conv_ok);
|
||||
l_uid = argv[0].toInt(&conv_ok);
|
||||
if (!conv_ok) {
|
||||
sendServerMessage("Invalid user ID.");
|
||||
return;
|
||||
}
|
||||
if (!area->owners().contains(uid)) {
|
||||
if (!l_area->owners().contains(l_uid)) {
|
||||
sendServerMessage("That user is not CMed.");
|
||||
return;
|
||||
}
|
||||
AOClient* target = server->getClientByID(uid);
|
||||
if (target == nullptr) {
|
||||
AOClient* l_target = server->getClientByID(l_uid);
|
||||
if (l_target == nullptr) {
|
||||
sendServerMessage("No client with that ID found.");
|
||||
return;
|
||||
}
|
||||
target->sendServerMessage("You have been unCMed by a moderator.");
|
||||
l_target->sendServerMessage("You have been unCMed by a moderator.");
|
||||
}
|
||||
else {
|
||||
sendServerMessage("Invalid command.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (area->removeOwner(uid)) {
|
||||
if (l_area->removeOwner(l_uid)) {
|
||||
arup(ARUPType::LOCKED, true);
|
||||
}
|
||||
|
||||
@ -104,54 +104,54 @@ void AOClient::cmdInvite(int argc, QStringList argv)
|
||||
{
|
||||
Q_UNUSED(argc);
|
||||
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
AreaData* l_area = server->m_areas[m_current_area];
|
||||
bool ok;
|
||||
int invited_id = argv[0].toInt(&ok);
|
||||
int l_invited_id = argv[0].toInt(&ok);
|
||||
if (!ok) {
|
||||
sendServerMessage("That does not look like a valid ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
AOClient* target_client = server->getClientByID(invited_id);
|
||||
AOClient* target_client = server->getClientByID(l_invited_id);
|
||||
if (target_client == nullptr) {
|
||||
sendServerMessage("No client with that ID found.");
|
||||
return;
|
||||
}
|
||||
else if (!area->invite(invited_id)) {
|
||||
else if (!l_area->invite(l_invited_id)) {
|
||||
sendServerMessage("That ID is already on the invite list.");
|
||||
return;
|
||||
}
|
||||
sendServerMessage("You invited ID " + argv[0]);
|
||||
target_client->sendServerMessage("You were invited and given access to " + area->name());
|
||||
target_client->sendServerMessage("You were invited and given access to " + l_area->name());
|
||||
}
|
||||
|
||||
void AOClient::cmdUnInvite(int argc, QStringList argv)
|
||||
{
|
||||
Q_UNUSED(argc);
|
||||
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
AreaData* l_area = server->m_areas[m_current_area];
|
||||
bool ok;
|
||||
int uninvited_id = argv[0].toInt(&ok);
|
||||
int l_uninvited_id = argv[0].toInt(&ok);
|
||||
if (!ok) {
|
||||
sendServerMessage("That does not look like a valid ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
AOClient* target_client = server->getClientByID(uninvited_id);
|
||||
AOClient* target_client = server->getClientByID(l_uninvited_id);
|
||||
if (target_client == nullptr) {
|
||||
sendServerMessage("No client with that ID found.");
|
||||
return;
|
||||
}
|
||||
else if (area->owners().contains(uninvited_id)) {
|
||||
else if (l_area->owners().contains(l_uninvited_id)) {
|
||||
sendServerMessage("You cannot uninvite a CM!");
|
||||
return;
|
||||
}
|
||||
else if (!area->uninvite(uninvited_id)) {
|
||||
else if (!l_area->uninvite(l_uninvited_id)) {
|
||||
sendServerMessage("That ID is not on the invite list.");
|
||||
return;
|
||||
}
|
||||
sendServerMessage("You uninvited ID " + argv[0]);
|
||||
target_client->sendServerMessage("You were uninvited from " + area->name());
|
||||
target_client->sendServerMessage("You were uninvited from " + l_area->name());
|
||||
}
|
||||
|
||||
void AOClient::cmdLock(int argc, QStringList argv)
|
||||
@ -159,7 +159,7 @@ void AOClient::cmdLock(int argc, QStringList argv)
|
||||
Q_UNUSED(argc);
|
||||
Q_UNUSED(argv);
|
||||
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
AreaData* area = server->m_areas[m_current_area];
|
||||
if (area->lockStatus() == AreaData::LockStatus::LOCKED) {
|
||||
sendServerMessage("This area is already locked.");
|
||||
return;
|
||||
@ -167,8 +167,8 @@ void AOClient::cmdLock(int argc, QStringList argv)
|
||||
sendServerMessageArea("This area is now locked.");
|
||||
area->lock();
|
||||
for (AOClient* client : qAsConst(server->m_clients)) { // qAsConst here avoids detaching the container
|
||||
if (client->current_area == current_area && client->joined) {
|
||||
area->invite(client->id);
|
||||
if (client->m_current_area == m_current_area && client->m_joined) {
|
||||
area->invite(client->m_id);
|
||||
}
|
||||
}
|
||||
arup(ARUPType::LOCKED, true);
|
||||
@ -179,16 +179,16 @@ void AOClient::cmdSpectatable(int argc, QStringList argv)
|
||||
Q_UNUSED(argc);
|
||||
Q_UNUSED(argv);
|
||||
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
if (area->lockStatus() == AreaData::LockStatus::SPECTATABLE) {
|
||||
AreaData* l_area = server->m_areas[m_current_area];
|
||||
if (l_area->lockStatus() == AreaData::LockStatus::SPECTATABLE) {
|
||||
sendServerMessage("This area is already in spectate mode.");
|
||||
return;
|
||||
}
|
||||
sendServerMessageArea("This area is now spectatable.");
|
||||
area->spectatable();
|
||||
l_area->spectatable();
|
||||
for (AOClient* client : qAsConst(server->m_clients)) {
|
||||
if (client->current_area == current_area && client->joined) {
|
||||
area->invite(client->id);
|
||||
if (client->m_current_area == m_current_area && client->m_joined) {
|
||||
l_area->invite(client->m_id);
|
||||
}
|
||||
}
|
||||
arup(ARUPType::LOCKED, true);
|
||||
@ -199,13 +199,13 @@ void AOClient::cmdUnLock(int argc, QStringList argv)
|
||||
Q_UNUSED(argc);
|
||||
Q_UNUSED(argv);
|
||||
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
if (area->lockStatus() == AreaData::LockStatus::FREE) {
|
||||
AreaData* l_area = server->m_areas[m_current_area];
|
||||
if (l_area->lockStatus() == AreaData::LockStatus::FREE) {
|
||||
sendServerMessage("This area is not locked.");
|
||||
return;
|
||||
}
|
||||
sendServerMessageArea("This area is now unlocked.");
|
||||
area->unlock();
|
||||
l_area->unlock();
|
||||
arup(ARUPType::LOCKED, true);
|
||||
}
|
||||
|
||||
@ -214,13 +214,13 @@ void AOClient::cmdGetAreas(int argc, QStringList argv)
|
||||
Q_UNUSED(argc);
|
||||
Q_UNUSED(argv);
|
||||
|
||||
QStringList entries;
|
||||
entries.append("== Area List ==");
|
||||
QStringList l_entries;
|
||||
l_entries.append("== Area List ==");
|
||||
for (int i = 0; i < server->m_area_names.length(); i++) {
|
||||
QStringList cur_area_lines = buildAreaList(i);
|
||||
entries.append(cur_area_lines);
|
||||
QStringList l_cur_area_lines = buildAreaList(i);
|
||||
l_entries.append(l_cur_area_lines);
|
||||
}
|
||||
sendServerMessage(entries.join("\n"));
|
||||
sendServerMessage(l_entries.join("\n"));
|
||||
}
|
||||
|
||||
void AOClient::cmdGetArea(int argc, QStringList argv)
|
||||
@ -228,8 +228,8 @@ void AOClient::cmdGetArea(int argc, QStringList argv)
|
||||
Q_UNUSED(argc);
|
||||
Q_UNUSED(argv);
|
||||
|
||||
QStringList entries = buildAreaList(current_area);
|
||||
sendServerMessage(entries.join("\n"));
|
||||
QStringList l_entries = buildAreaList(m_current_area);
|
||||
sendServerMessage(l_entries.join("\n"));
|
||||
}
|
||||
|
||||
void AOClient::cmdArea(int argc, QStringList argv)
|
||||
@ -237,41 +237,41 @@ void AOClient::cmdArea(int argc, QStringList argv)
|
||||
Q_UNUSED(argc);
|
||||
|
||||
bool ok;
|
||||
int new_area = argv[0].toInt(&ok);
|
||||
if (!ok || new_area >= server->m_areas.size() || new_area < 0) {
|
||||
int l_new_area = argv[0].toInt(&ok);
|
||||
if (!ok || l_new_area >= server->m_areas.size() || l_new_area < 0) {
|
||||
sendServerMessage("That does not look like a valid area ID.");
|
||||
return;
|
||||
}
|
||||
changeArea(new_area);
|
||||
changeArea(l_new_area);
|
||||
}
|
||||
|
||||
void AOClient::cmdAreaKick(int argc, QStringList argv)
|
||||
{
|
||||
Q_UNUSED(argc);
|
||||
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
AreaData* l_area = server->m_areas[m_current_area];
|
||||
|
||||
bool ok;
|
||||
int idx = argv[0].toInt(&ok);
|
||||
int l_idx = argv[0].toInt(&ok);
|
||||
if (!ok) {
|
||||
sendServerMessage("That does not look like a valid ID.");
|
||||
return;
|
||||
}
|
||||
if (server->m_areas[current_area]->owners().contains(idx)) {
|
||||
if (server->m_areas[m_current_area]->owners().contains(l_idx)) {
|
||||
sendServerMessage("You cannot kick another CM!");
|
||||
return;
|
||||
}
|
||||
AOClient* client_to_kick = server->getClientByID(idx);
|
||||
if (client_to_kick == nullptr) {
|
||||
AOClient* l_client_to_kick = server->getClientByID(l_idx);
|
||||
if (l_client_to_kick == nullptr) {
|
||||
sendServerMessage("No client with that ID found.");
|
||||
return;
|
||||
}
|
||||
else if (client_to_kick->current_area != current_area) {
|
||||
else if (l_client_to_kick->m_current_area != m_current_area) {
|
||||
sendServerMessage("That client is not in this area.");
|
||||
return;
|
||||
}
|
||||
client_to_kick->changeArea(0);
|
||||
area->uninvite(client_to_kick->id);
|
||||
l_client_to_kick->changeArea(0);
|
||||
l_area->uninvite(l_client_to_kick->m_id);
|
||||
|
||||
sendServerMessage("Client " + argv[0] + " kicked back to area 0.");
|
||||
}
|
||||
@ -281,12 +281,12 @@ void AOClient::cmdSetBackground(int argc, QStringList argv)
|
||||
Q_UNUSED(argc);
|
||||
|
||||
QString f_background = argv.join(" ");
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
if (authenticated || !area->bgLocked()) {
|
||||
AreaData* area = server->m_areas[m_current_area];
|
||||
if (m_authenticated || !area->bgLocked()) {
|
||||
if (server->m_backgrounds.contains(f_background, Qt::CaseInsensitive) || area->ignoreBgList() == true) {
|
||||
area->setBackground(f_background);
|
||||
server->broadcast(AOPacket("BN", {f_background}), current_area);
|
||||
sendServerMessageArea(current_char + " changed the background to " + f_background);
|
||||
server->broadcast(AOPacket("BN", {f_background}), m_current_area);
|
||||
sendServerMessageArea(m_current_char + " changed the background to " + f_background);
|
||||
}
|
||||
else {
|
||||
sendServerMessage("Invalid background name.");
|
||||
@ -302,13 +302,13 @@ void AOClient::cmdBgLock(int argc, QStringList argv)
|
||||
Q_UNUSED(argc);
|
||||
Q_UNUSED(argv);
|
||||
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
AreaData* l_area = server->m_areas[m_current_area];
|
||||
|
||||
if (area->bgLocked() == false) {
|
||||
area->toggleBgLock();
|
||||
if (l_area->bgLocked() == false) {
|
||||
l_area->toggleBgLock();
|
||||
};
|
||||
|
||||
server->broadcast(AOPacket("CT", {ConfigManager::serverName(), current_char + " locked the background.", "1"}), current_area);
|
||||
server->broadcast(AOPacket("CT", {ConfigManager::serverName(), m_current_char + " locked the background.", "1"}), m_current_area);
|
||||
}
|
||||
|
||||
void AOClient::cmdBgUnlock(int argc, QStringList argv)
|
||||
@ -316,25 +316,25 @@ void AOClient::cmdBgUnlock(int argc, QStringList argv)
|
||||
Q_UNUSED(argc);
|
||||
Q_UNUSED(argv);
|
||||
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
AreaData* l_area = server->m_areas[m_current_area];
|
||||
|
||||
if (area->bgLocked() == true) {
|
||||
area->toggleBgLock();
|
||||
if (l_area->bgLocked() == true) {
|
||||
l_area->toggleBgLock();
|
||||
};
|
||||
|
||||
server->broadcast(AOPacket("CT", {ConfigManager::serverName(), current_char + " unlocked the background.", "1"}), current_area);
|
||||
server->broadcast(AOPacket("CT", {ConfigManager::serverName(), m_current_char + " unlocked the background.", "1"}), m_current_area);
|
||||
}
|
||||
|
||||
void AOClient::cmdStatus(int argc, QStringList argv)
|
||||
{
|
||||
Q_UNUSED(argc);
|
||||
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
QString arg = argv[0].toLower();
|
||||
AreaData* l_area = server->m_areas[m_current_area];
|
||||
QString l_arg = argv[0].toLower();
|
||||
|
||||
if (area->changeStatus(arg)) {
|
||||
if (l_area->changeStatus(l_arg)) {
|
||||
arup(ARUPType::STATUS, true);
|
||||
server->broadcast(AOPacket("CT", {ConfigManager::serverName(), current_char + " changed status to " + arg.toUpper(), "1"}), current_area);
|
||||
server->broadcast(AOPacket("CT", {ConfigManager::serverName(), m_current_char + " changed status to " + l_arg.toUpper(), "1"}), m_current_area);
|
||||
} else {
|
||||
const QStringList keys = AreaData::map_statuses.keys();
|
||||
sendServerMessage("That does not look like a valid status. Valid statuses are " + keys.join(", "));
|
||||
@ -346,18 +346,18 @@ void AOClient::cmdJudgeLog(int argc, QStringList argv)
|
||||
Q_UNUSED(argc);
|
||||
Q_UNUSED(argv);
|
||||
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
if (area->judgelog().isEmpty()) {
|
||||
AreaData* l_area = server->m_areas[m_current_area];
|
||||
if (l_area->judgelog().isEmpty()) {
|
||||
sendServerMessage("There have been no judge actions in this area.");
|
||||
return;
|
||||
}
|
||||
QString message = area->judgelog().join("\n");
|
||||
QString l_message = l_area->judgelog().join("\n");
|
||||
//Judgelog contains an IPID, so we shouldn't send that unless the caller has appropriate permissions
|
||||
if (checkAuth(ACLFlags.value("KICK")) == 1 || checkAuth(ACLFlags.value("BAN")) == 1) {
|
||||
sendServerMessage(message);
|
||||
sendServerMessage(l_message);
|
||||
}
|
||||
else {
|
||||
QString filteredmessage = message.remove(QRegularExpression("[(].*[)]")); //Filter out anything between two parentheses. This should only ever be the IPID
|
||||
QString filteredmessage = l_message.remove(QRegularExpression("[(].*[)]")); //Filter out anything between two parentheses. This should only ever be the IPID
|
||||
sendServerMessage(filteredmessage);
|
||||
}
|
||||
}
|
||||
@ -367,8 +367,8 @@ void AOClient::cmdIgnoreBgList(int argc, QStringList argv)
|
||||
Q_UNUSED(argc);
|
||||
Q_UNUSED(argv);
|
||||
|
||||
AreaData* area = server->m_areas[current_area];
|
||||
area->toggleIgnoreBgList();
|
||||
QString state = area->ignoreBgList() ? "ignored." : "enforced.";
|
||||
sendServerMessage("BG list in this area is now " + state);
|
||||
AreaData* l_area = server->m_areas[m_current_area];
|
||||
l_area->toggleIgnoreBgList();
|
||||
QString l_state = l_area->ignoreBgList() ? "ignored." : "enforced.";
|
||||
sendServerMessage("BG list in this area is now " + l_state);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user