add notecard functionality

This commit is contained in:
in1tiate 2021-03-21 15:01:15 -05:00
parent 1636dd93ef
commit ef20ff00d7
3 changed files with 47 additions and 1 deletions

View File

@ -243,6 +243,9 @@ class AOClient : public QObject {
void cmdTimer(int argc, QStringList argv);
void cmdEvidenceMod(int argc, QStringList argv);
void cmdSubTheme(int argc, QStringList argv);
void cmdNoteCard(int argc, QStringList argv);
void cmdNoteCardReveal(int argc, QStringList argv);
void cmdNoteCardClear(int argc, QStringList argv);
// Messaging/Client
void cmdPos(int argc, QStringList argv);
void cmdForcePos(int argc, QStringList argv);
@ -329,7 +332,12 @@ class AOClient : public QObject {
{"unban", {ACLFlags.value("BAN"), 1, &AOClient::cmdUnBan}},
{"removeuser", {ACLFlags.value("MODIFY_USERS"), 1, &AOClient::cmdRemoveUser}},
{"subtheme", {ACLFlags.value("CM"), 1, &AOClient::cmdSubTheme}},
{"about", {ACLFlags.value("NONE"), 0, &AOClient::cmdAbout}}
{"about", {ACLFlags.value("NONE"), 0, &AOClient::cmdAbout}},
{"notecard", {ACLFlags.value("NONE"), 1, &AOClient::cmdNoteCard}},
{"notecardreveal", {ACLFlags.value("CM"), 0, &AOClient::cmdNoteCardReveal}},
{"notecard_reveal", {ACLFlags.value("CM"), 0, &AOClient::cmdNoteCardReveal}},
{"notecardclear", {ACLFlags.value("NONE"), 0, &AOClient::cmdNoteCardClear}},
{"notecard_clear", {ACLFlags.value("NONE"), 0, &AOClient::cmdNoteCardClear}},
};
QString partial_packet;

View File

@ -81,6 +81,7 @@ class AreaData : public QObject {
HIDDEN_CM
};
EvidenceMod evi_mod;
QMap<QString, QString> notecards;
};
#endif // AREA_DATA_H

View File

@ -1035,6 +1035,43 @@ void AOClient::cmdAbout(int argc, QStringList argv)
sendPacket("CT", {"The akashi dev team", "Thank you for using akashi! Made with love by scatterflower, with help from in1tiate and Salanto. akashi " + QCoreApplication::applicationVersion()});
}
void AOClient::cmdNoteCard(int argc, QStringList argv)
{
AreaData* area = server->areas[current_area];
if (area->notecards.keys().contains(current_char))
area->notecards.remove(current_char);
QString notecard = argv.join(" ");
area->notecards[current_char] = notecard;
sendServerMessageArea(current_char + " wrote a note card.");
}
void AOClient::cmdNoteCardClear(int argc, QStringList argv)
{
AreaData* area = server->areas[current_area];
if (area->notecards.keys().contains(current_char)) {
area->notecards.remove(current_char);
sendServerMessageArea(current_char + " erased their note card.");
}
else
sendServerMessage("You do not have a note card.");
}
void AOClient::cmdNoteCardReveal(int argc, QStringList argv)
{
AreaData* area = server->areas[current_area];
if (area->notecards.isEmpty()) {
sendServerMessage("There are no cards to reveal in this area.");
return;
}
QStringList message;
message << "Note cards have been revealed.";
QMap<QString, QString>::iterator i;
for (i = area->notecards.begin(); i != area->notecards.end(); ++i)
message << i.key() + ": " + i.value();
sendServerMessageArea(message.join("\n"));
area->notecards.clear();
}
QStringList AOClient::buildAreaList(int area_idx)
{
QStringList entries;