diff --git a/include/aoclient.h b/include/aoclient.h index 690adbb..7d3fd9b 100644 --- a/include/aoclient.h +++ b/include/aoclient.h @@ -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; diff --git a/include/area_data.h b/include/area_data.h index 49f0a28..5eafb88 100644 --- a/include/area_data.h +++ b/include/area_data.h @@ -81,6 +81,7 @@ class AreaData : public QObject { HIDDEN_CM }; EvidenceMod evi_mod; + QMap notecards; }; #endif // AREA_DATA_H diff --git a/src/commands.cpp b/src/commands.cpp index 2455016..3a83cf1 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -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::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;