finish implementing evidence mod
This commit is contained in:
parent
1d4c1b8cda
commit
8c39d6ee35
@ -139,6 +139,7 @@ class AOClient : public QObject {
|
||||
|
||||
// Packet helper functions
|
||||
void sendEvidenceList(AreaData* area);
|
||||
void updateEvidenceList(AreaData* area);
|
||||
AOPacket validateIcPacket(AOPacket packet);
|
||||
QString dezalgo(QString p_text);
|
||||
bool checkEvidenceAccess(AreaData* area);
|
||||
|
@ -365,6 +365,7 @@ void AOClient::cmdLogout(int argc, QStringList argv)
|
||||
void AOClient::cmdPos(int argc, QStringList argv)
|
||||
{
|
||||
changePosition(argv[0]);
|
||||
updateEvidenceList(server->areas[current_area]);
|
||||
}
|
||||
|
||||
void AOClient::cmdForcePos(int argc, QStringList argv)
|
||||
@ -699,6 +700,9 @@ void AOClient::cmdEvidenceMod(int argc, QStringList argv)
|
||||
return;
|
||||
}
|
||||
sendServerMessage("Changed evidence mod.");
|
||||
|
||||
// Resend evidence lists to everyone in the area
|
||||
sendEvidenceList(area);
|
||||
}
|
||||
|
||||
void AOClient::cmdArea(int argc, QStringList argv)
|
||||
|
@ -302,18 +302,37 @@ void AOClient::pktEditEvidence(AreaData* area, int argc, QStringList argv, AOPac
|
||||
}
|
||||
|
||||
void AOClient::sendEvidenceList(AreaData* area)
|
||||
{
|
||||
for (AOClient* client : server->clients) {
|
||||
if (client->current_area == current_area)
|
||||
client->updateEvidenceList(area);
|
||||
}
|
||||
}
|
||||
|
||||
void AOClient::updateEvidenceList(AreaData* area)
|
||||
{
|
||||
QStringList evidence_list;
|
||||
QString evidence_format("%1&%2&%3");
|
||||
|
||||
for (AreaData::Evidence evidence : area->evidence) {
|
||||
if (!checkAuth(ACLFlags.value("CM")) && area->evi_mod == AreaData::EvidenceMod::HIDDEN_CM) {
|
||||
QRegularExpression regex("<owner=(.*?)>");
|
||||
QRegularExpressionMatch match = regex.match(evidence.description);
|
||||
if (match.hasMatch()) {
|
||||
QStringList owners = match.captured(1).split(",");
|
||||
if (!owners.contains("all", Qt::CaseSensitivity::CaseInsensitive) && !owners.contains(pos, Qt::CaseSensitivity::CaseInsensitive)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// no match = show it to all
|
||||
}
|
||||
evidence_list.append(evidence_format
|
||||
.arg(evidence.name)
|
||||
.arg(evidence.description)
|
||||
.arg(evidence.image));
|
||||
.arg(evidence.name)
|
||||
.arg(evidence.description)
|
||||
.arg(evidence.image));
|
||||
}
|
||||
|
||||
server->broadcast(AOPacket("LE", evidence_list), current_area);
|
||||
sendPacket(AOPacket("LE", evidence_list));
|
||||
}
|
||||
|
||||
AOPacket AOClient::validateIcPacket(AOPacket packet)
|
||||
@ -381,6 +400,10 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
|
||||
// side
|
||||
// this is validated clientside so w/e
|
||||
args.append(incoming_args[5].toString());
|
||||
if (pos != incoming_args[5].toString()) {
|
||||
pos = incoming_args[5].toString();
|
||||
updateEvidenceList(server->areas[current_area]);
|
||||
}
|
||||
|
||||
// sfx name
|
||||
args.append(incoming_args[6].toString());
|
||||
|
Loading…
Reference in New Issue
Block a user