Add mute and unmute
This commit is contained in:
parent
6f1d17f923
commit
c673339653
@ -59,6 +59,7 @@ class AOClient : public QObject {
|
||||
QString ooc_name = "";
|
||||
QString showname = "";
|
||||
bool global_enabled = true;
|
||||
bool is_muted = false;
|
||||
struct ClientVersion {
|
||||
QString string;
|
||||
int release = -1;
|
||||
@ -79,6 +80,7 @@ class AOClient : public QObject {
|
||||
{"MOTD", 1ULL << 7},
|
||||
{"ANNOUNCE", 1ULL << 8},
|
||||
{"MODCHAT", 1ULL << 9},
|
||||
{"MUTE", 1ULL << 10},
|
||||
{"SUPER", ~0ULL}
|
||||
};
|
||||
|
||||
@ -221,6 +223,8 @@ class AOClient : public QObject {
|
||||
void cmdAnnounce(int argc, QStringList argv);
|
||||
void cmdM(int argc, QStringList argv);
|
||||
void cmdGM(int argc, QStringList argv);
|
||||
void cmdMute(int argc, QStringList argv);
|
||||
void cmdUnmute(int argc, QStringList argv);
|
||||
// Casing/RP
|
||||
void cmdPlay(int argc, QStringList argv);
|
||||
void cmdNeed(int argc, QStringList argv);
|
||||
@ -310,7 +314,9 @@ class AOClient : public QObject {
|
||||
{"motd", {ACLFlags.value("NONE"), 0, &AOClient::cmdMOTD}},
|
||||
{"announce", {ACLFlags.value("ANNOUNCE"), 1, &AOClient::cmdAnnounce}},
|
||||
{"m", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdM}},
|
||||
{"gm", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdGM}}
|
||||
{"gm", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdGM}},
|
||||
{"mute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdMute}},
|
||||
{"unmute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnmute}}
|
||||
};
|
||||
|
||||
QString partial_packet;
|
||||
|
@ -933,6 +933,38 @@ void AOClient::cmdGM(int argc, QStringList argv)
|
||||
}
|
||||
}
|
||||
|
||||
void AOClient::cmdMute(int argc, QStringList argv)
|
||||
{
|
||||
bool conv_ok = false;
|
||||
int uid = argv[0].toInt(&conv_ok);
|
||||
if (!conv_ok) {
|
||||
sendServerMessage("Invalid user ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (server->getClientByID(uid)->is_muted)
|
||||
sendServerMessage("That player is already muted!");
|
||||
else
|
||||
sendServerMessage("Muted player.");
|
||||
server->getClientByID(uid)->is_muted = true;
|
||||
}
|
||||
|
||||
void AOClient::cmdUnmute(int argc, QStringList argv)
|
||||
{
|
||||
bool conv_ok = false;
|
||||
int uid = argv[0].toInt(&conv_ok);
|
||||
if (!conv_ok) {
|
||||
sendServerMessage("Invalid user ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!server->getClientByID(uid)->is_muted)
|
||||
sendServerMessage("That player is already unmuted!");
|
||||
else
|
||||
sendServerMessage("Unmuted player.");
|
||||
server->getClientByID(uid)->is_muted = false;
|
||||
}
|
||||
|
||||
QStringList AOClient::buildAreaList(int area_idx)
|
||||
{
|
||||
QStringList entries;
|
||||
|
@ -154,6 +154,11 @@ void AOClient::pktSelectChar(AreaData* area, int argc, QStringList argv, AOPacke
|
||||
|
||||
void AOClient::pktIcChat(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
||||
{
|
||||
if (is_muted) {
|
||||
sendServerMessage("You cannot speak while muted.");
|
||||
return;
|
||||
}
|
||||
|
||||
AOPacket validated_packet = validateIcPacket(packet);
|
||||
if (validated_packet.header == "INVALID")
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user