save evidence
Some checks are pending
CI / build-windows (push) Blocked by required conditions
CI / build-linux (push) Blocked by required conditions
CI / check-clang-format (push) Waiting to run

This commit is contained in:
simio 2025-03-02 08:15:36 -03:00
parent dfb0ef2e58
commit b0658cd000
13 changed files with 125 additions and 1 deletions

View File

@ -0,0 +1,24 @@
[0]
description=para q no se anden metiendo en esto
image=knife-aa.png
name=narcoejecucion
[1]
description=del espacio
image=prosecutorbadge-aai.png
name=el omnitrix
[2]
description=https://incels.wiki/w/Scientific_Blackpill\nhttps://incels.wiki/w/Scientific_Blackpill_(Supplemental)
image=DDcomputer.png
name=INCEL WIKI
[3]
description=https://files.catbox.moe/ykrhq3.webp
image=AAautopsy.png
name=Informe medico de la victima
[4]
description="http://esquizolandia.lyricaltokarev.com/expediente.html"
image=Autopsy.png
name=ESQUIZOLANDIA EXPEDIENTE

View File

@ -111,6 +111,7 @@ const QMap<QString, AOClient::CommandInfo> AOClient::COMMANDS{
{"savetestimony", {{ACLRole::NONE}, 1, &AOClient::cmdSaveTestimony}}, {"savetestimony", {{ACLRole::NONE}, 1, &AOClient::cmdSaveTestimony}},
{"loadtestimony", {{ACLRole::CM}, 1, &AOClient::cmdLoadTestimony}}, {"loadtestimony", {{ACLRole::CM}, 1, &AOClient::cmdLoadTestimony}},
{"permitsaving", {{ACLRole::MODCHAT}, 1, &AOClient::cmdPermitSaving}}, {"permitsaving", {{ACLRole::MODCHAT}, 1, &AOClient::cmdPermitSaving}},
{"saveevidence", {{ACLRole::MODCHAT}, 0, &AOClient::cmdSaveEvidence}},
{"mutepm", {{ACLRole::NONE}, 0, &AOClient::cmdMutePM}}, {"mutepm", {{ACLRole::NONE}, 0, &AOClient::cmdMutePM}},
{"toggleadverts", {{ACLRole::NONE}, 0, &AOClient::cmdToggleAdverts}}, {"toggleadverts", {{ACLRole::NONE}, 0, &AOClient::cmdToggleAdverts}},
{"ooc_mute", {{ACLRole::MUTE}, 1, &AOClient::cmdOocMute}}, {"ooc_mute", {{ACLRole::MUTE}, 1, &AOClient::cmdOocMute}},

View File

@ -919,6 +919,7 @@ class AOClient : public QObject
* *
* @iscommand * @iscommand
*/ */
void cmdSaveEvidence(int argc, QStringList argv);
void cmdArea(int argc, QStringList argv); void cmdArea(int argc, QStringList argv);
/** /**

View File

@ -22,6 +22,12 @@
#include "packet/packet_factory.h" #include "packet/packet_factory.h"
#include "server.h" #include "server.h"
#include <QFile>
#include <QTextStream>
#include <QDir>
#include <QSettings>
// This file is for commands under the casing category in aoclient.h // This file is for commands under the casing category in aoclient.h
// Be sure to register the command in the header before adding it here! // Be sure to register the command in the header before adding it here!
@ -38,6 +44,50 @@ void AOClient::cmdDoc(int argc, QStringList argv)
} }
} }
void AOClient::cmdSaveEvidence(int argc, QStringList argv)
{
Q_UNUSED(argc);
Q_UNUSED(argv);
AreaData *l_area = server->getAreaById(areaId());
QString l_area_name = l_area->name().toLower().replace("..", ""); // Sanitize the area name
// Ensure the inventory directory exists
QDir l_dir_inventory("storage/inventory");
if (!l_dir_inventory.exists()) {
l_dir_inventory.mkpath(".");
}
QString l_ini_file_name = "storage/inventory/" + l_area_name + ".ini";
// Open the INI file for writing
QFile l_file(l_ini_file_name);
if (!l_file.open(QIODevice::WriteOnly | QIODevice::Text)) {
sendServerMessage("Unable to open inventory file for writing.");
return;
}
QTextStream l_out(&l_file);
// Access the evidence list from the AreaData
QList<AreaData::Evidence> evidenceList = l_area->evidence(); // Assuming evidence is a list of Evidence objects
// Loop through each evidence item and write its data to the INI file
int l_ev_index = 0;
foreach (const AreaData::Evidence &evidence, evidenceList) {
l_out << "[" << l_ev_index++ << "]" << "\n";
l_out << "name=" << evidence.name << "\n";
l_out << "description=" << evidence.description << "\n";
l_out << "image=" << evidence.image << "\n"; // Save the image path or name
l_out << "\n"; // Empty line between each evidence entry
}
// Close the file after writing
l_file.close();
sendServerMessage("All evidence has been saved to " + l_ini_file_name);
}
void AOClient::cmdClearDoc(int argc, QStringList argv) void AOClient::cmdClearDoc(int argc, QStringList argv)
{ {
Q_UNUSED(argc); Q_UNUSED(argc);

View File

@ -143,7 +143,7 @@ void Server::loadInventoryForArea(AreaData* area, const QString& areaName)
} }
// Search for an inventory file corresponding to the area name (e.g., "area_1.ini"). // Search for an inventory file corresponding to the area name (e.g., "area_1.ini").
QString inventoryFileName = areaName + ".ini"; // Assuming file is named as area name QString inventoryFileName = (areaName + ".ini").toLower().replace("..", ""); // Sanitize the area name, assuming file is named as area name
QString filePath = dir.absoluteFilePath(inventoryFileName); QString filePath = dir.absoluteFilePath(inventoryFileName);
if (QFile::exists(filePath)) { if (QFile::exists(filePath)) {

View File

@ -0,0 +1,6 @@
#!/bin/sh
LD_LIBRARY_PATH=/usr/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
QT_PLUGIN_PATH=/usr/lib/qt/plugins${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}
export QT_PLUGIN_PATH
exec "$@"

View File

@ -0,0 +1,6 @@
#!/bin/sh
LD_LIBRARY_PATH=/usr/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
QT_PLUGIN_PATH=/usr/lib/qt/plugins${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}
export QT_PLUGIN_PATH
exec "$@"

View File

@ -0,0 +1,6 @@
#!/bin/sh
LD_LIBRARY_PATH=/usr/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
QT_PLUGIN_PATH=/usr/lib/qt/plugins${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}
export QT_PLUGIN_PATH
exec "$@"

View File

@ -0,0 +1,6 @@
#!/bin/sh
LD_LIBRARY_PATH=/usr/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
QT_PLUGIN_PATH=/usr/lib/qt/plugins${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}
export QT_PLUGIN_PATH
exec "$@"

View File

@ -0,0 +1,6 @@
#!/bin/sh
LD_LIBRARY_PATH=/usr/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
QT_PLUGIN_PATH=/usr/lib/qt/plugins${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}
export QT_PLUGIN_PATH
exec "$@"

View File

@ -0,0 +1,6 @@
#!/bin/sh
LD_LIBRARY_PATH=/usr/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
QT_PLUGIN_PATH=/usr/lib/qt/plugins${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}
export QT_PLUGIN_PATH
exec "$@"

View File

@ -0,0 +1,6 @@
#!/bin/sh
LD_LIBRARY_PATH=/usr/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
QT_PLUGIN_PATH=/usr/lib/qt/plugins${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}
export QT_PLUGIN_PATH
exec "$@"

View File

@ -0,0 +1,6 @@
#!/bin/sh
LD_LIBRARY_PATH=/usr/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
QT_PLUGIN_PATH=/usr/lib/qt/plugins${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}
export QT_PLUGIN_PATH
exec "$@"