finish implementing evidence mod
This commit is contained in:
parent
1d4c1b8cda
commit
8c39d6ee35
@ -139,6 +139,7 @@ class AOClient : public QObject {
|
|||||||
|
|
||||||
// Packet helper functions
|
// Packet helper functions
|
||||||
void sendEvidenceList(AreaData* area);
|
void sendEvidenceList(AreaData* area);
|
||||||
|
void updateEvidenceList(AreaData* area);
|
||||||
AOPacket validateIcPacket(AOPacket packet);
|
AOPacket validateIcPacket(AOPacket packet);
|
||||||
QString dezalgo(QString p_text);
|
QString dezalgo(QString p_text);
|
||||||
bool checkEvidenceAccess(AreaData* area);
|
bool checkEvidenceAccess(AreaData* area);
|
||||||
|
@ -365,6 +365,7 @@ void AOClient::cmdLogout(int argc, QStringList argv)
|
|||||||
void AOClient::cmdPos(int argc, QStringList argv)
|
void AOClient::cmdPos(int argc, QStringList argv)
|
||||||
{
|
{
|
||||||
changePosition(argv[0]);
|
changePosition(argv[0]);
|
||||||
|
updateEvidenceList(server->areas[current_area]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOClient::cmdForcePos(int argc, QStringList argv)
|
void AOClient::cmdForcePos(int argc, QStringList argv)
|
||||||
@ -699,6 +700,9 @@ void AOClient::cmdEvidenceMod(int argc, QStringList argv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sendServerMessage("Changed evidence mod.");
|
sendServerMessage("Changed evidence mod.");
|
||||||
|
|
||||||
|
// Resend evidence lists to everyone in the area
|
||||||
|
sendEvidenceList(area);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOClient::cmdArea(int argc, QStringList argv)
|
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)
|
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;
|
QStringList evidence_list;
|
||||||
QString evidence_format("%1&%2&%3");
|
QString evidence_format("%1&%2&%3");
|
||||||
|
|
||||||
for (AreaData::Evidence evidence : area->evidence) {
|
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
|
evidence_list.append(evidence_format
|
||||||
.arg(evidence.name)
|
.arg(evidence.name)
|
||||||
.arg(evidence.description)
|
.arg(evidence.description)
|
||||||
.arg(evidence.image));
|
.arg(evidence.image));
|
||||||
}
|
}
|
||||||
|
|
||||||
server->broadcast(AOPacket("LE", evidence_list), current_area);
|
sendPacket(AOPacket("LE", evidence_list));
|
||||||
}
|
}
|
||||||
|
|
||||||
AOPacket AOClient::validateIcPacket(AOPacket packet)
|
AOPacket AOClient::validateIcPacket(AOPacket packet)
|
||||||
@ -381,6 +400,10 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
|
|||||||
// side
|
// side
|
||||||
// this is validated clientside so w/e
|
// this is validated clientside so w/e
|
||||||
args.append(incoming_args[5].toString());
|
args.append(incoming_args[5].toString());
|
||||||
|
if (pos != incoming_args[5].toString()) {
|
||||||
|
pos = incoming_args[5].toString();
|
||||||
|
updateEvidenceList(server->areas[current_area]);
|
||||||
|
}
|
||||||
|
|
||||||
// sfx name
|
// sfx name
|
||||||
args.append(incoming_args[6].toString());
|
args.append(incoming_args[6].toString());
|
||||||
|
Loading…
Reference in New Issue
Block a user