Merge pull request #39 from AttorneyOnline/notecards

Add /notecard, /notecardclear, and /notecardreveal
This commit is contained in:
scatterflower 2021-04-04 03:02:36 -05:00 committed by GitHub
commit f810e3449b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 133 additions and 70 deletions

View File

@ -1257,6 +1257,34 @@ class AOClient : public QObject {
void cmdSubTheme(int argc, QStringList argv);
/**
* @brief Writes a "note card" in the current area.
*
* @details The note card is not readable until all note cards in the area are revealed by a **CM**.
* A message will appear to all clients in the area indicating that a note card has been written.
*
* @iscommand
*/
void cmdNoteCard(int argc, QStringList argv);
/**
* @brief Reveals all note cards in the current area.
*
* @iscommand
*/
void cmdNoteCardReveal(int argc, QStringList argv);
/**
* @brief Erases the client's note card from the area's list of cards.
*
* @details A message will appear to all clients in the area indicating that a note card has been erased.
*
* @iscommand
*/
void cmdNoteCardClear(int argc, QStringList argv);
// Messaging/Client
///@}
/**
@ -1521,20 +1549,17 @@ class AOClient : public QObject {
{"gm", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdGM}},
{"mute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdMute}},
{"unmute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnMute}},
{"oocmute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdOocMute}},
{"ooc_mute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdOocMute}},
{"oocunmute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdOocUnMute}},
{"ooc_unmute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdOocUnMute}},
{"blockdj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdBlockDj}},
{"unblockdj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockDj}},
{"blockwtce", {ACLFlags.value("MUTE"), 1, &AOClient::cmdBlockWtce}},
{"unblockwtce", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockWtce}},
{"bans", {ACLFlags.value("BAN"), 0, &AOClient::cmdBans}},
{"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}},
{"evidence_swap", {ACLFlags.value("CM"), 2, &AOClient::cmdEvidence_Swap}},
{"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}},
};
/**

View File

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

View File

@ -1203,6 +1203,43 @@ void AOClient::cmdUnBlockWtce(int argc, QStringList argv)
target->is_wtce_blocked = false;
}
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;