Merge pull request #39 from AttorneyOnline/notecards
Add /notecard, /notecardclear, and /notecardreveal
This commit is contained in:
commit
f810e3449b
@ -1256,6 +1256,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
|
||||
|
||||
///@}
|
||||
|
||||
@ -1465,76 +1493,73 @@ class AOClient : public QObject {
|
||||
* See @ref CommandInfo "the type's documentation" for more details.
|
||||
*/
|
||||
const QMap<QString, CommandInfo> commands {
|
||||
{"login", {ACLFlags.value("NONE"), 1, &AOClient::cmdLogin}},
|
||||
{"getareas", {ACLFlags.value("NONE"), 0, &AOClient::cmdGetAreas}},
|
||||
{"getarea", {ACLFlags.value("NONE"), 0, &AOClient::cmdGetArea}},
|
||||
{"ban", {ACLFlags.value("BAN"), 2, &AOClient::cmdBan}},
|
||||
{"kick", {ACLFlags.value("KICK"), 2, &AOClient::cmdKick}},
|
||||
{"changeauth", {ACLFlags.value("SUPER"), 0, &AOClient::cmdChangeAuth}},
|
||||
{"rootpass", {ACLFlags.value("SUPER"), 1, &AOClient::cmdSetRootPass}},
|
||||
{"background", {ACLFlags.value("NONE"), 1, &AOClient::cmdSetBackground}},
|
||||
{"bg", {ACLFlags.value("NONE"), 1, &AOClient::cmdSetBackground}},
|
||||
{"bglock", {ACLFlags.value("BGLOCK"), 0, &AOClient::cmdBgLock}},
|
||||
{"bgunlock", {ACLFlags.value("BGLOCK"), 0, &AOClient::cmdBgUnlock}},
|
||||
{"adduser", {ACLFlags.value("MODIFY_USERS"), 2, &AOClient::cmdAddUser}},
|
||||
{"listperms", {ACLFlags.value("NONE"), 0, &AOClient::cmdListPerms}},
|
||||
{"addperm", {ACLFlags.value("MODIFY_USERS"), 2, &AOClient::cmdAddPerms}},
|
||||
{"removeperm", {ACLFlags.value("MODIFY_USERS"), 2, &AOClient::cmdRemovePerms}},
|
||||
{"listusers", {ACLFlags.value("MODIFY_USERS"), 0, &AOClient::cmdListUsers}},
|
||||
{"logout", {ACLFlags.value("NONE"), 0, &AOClient::cmdLogout}},
|
||||
{"pos", {ACLFlags.value("NONE"), 1, &AOClient::cmdPos}},
|
||||
{"g", {ACLFlags.value("NONE"), 1, &AOClient::cmdG}},
|
||||
{"need", {ACLFlags.value("NONE"), 1, &AOClient::cmdNeed}},
|
||||
{"coinflip", {ACLFlags.value("NONE"), 0, &AOClient::cmdFlip}},
|
||||
{"roll", {ACLFlags.value("NONE"), 0, &AOClient::cmdRoll}},
|
||||
{"rollp", {ACLFlags.value("NONE"), 0, &AOClient::cmdRollP}},
|
||||
{"doc", {ACLFlags.value("NONE"), 0, &AOClient::cmdDoc}},
|
||||
{"cleardoc", {ACLFlags.value("NONE"), 0, &AOClient::cmdClearDoc}},
|
||||
{"cm", {ACLFlags.value("NONE"), 0, &AOClient::cmdCM}},
|
||||
{"uncm", {ACLFlags.value("CM"), 0, &AOClient::cmdUnCM}},
|
||||
{"invite", {ACLFlags.value("CM"), 1, &AOClient::cmdInvite}},
|
||||
{"uninvite", {ACLFlags.value("CM"), 1, &AOClient::cmdUnInvite}},
|
||||
{"lock", {ACLFlags.value("CM"), 0, &AOClient::cmdLock}},
|
||||
{"area_lock", {ACLFlags.value("CM"), 0, &AOClient::cmdLock}},
|
||||
{"spectatable", {ACLFlags.value("CM"), 0, &AOClient::cmdSpectatable}},
|
||||
{"area_spectate", {ACLFlags.value("CM"), 0, &AOClient::cmdSpectatable}},
|
||||
{"unlock", {ACLFlags.value("CM"), 0, &AOClient::cmdUnLock}},
|
||||
{"area_unlock", {ACLFlags.value("CM"), 0, &AOClient::cmdUnLock}},
|
||||
{"timer", {ACLFlags.value("CM"), 0, &AOClient::cmdTimer}},
|
||||
{"area", {ACLFlags.value("NONE"), 1, &AOClient::cmdArea}},
|
||||
{"play", {ACLFlags.value("CM"), 1, &AOClient::cmdPlay}},
|
||||
{"areakick", {ACLFlags.value("CM"), 1, &AOClient::cmdAreaKick}},
|
||||
{"area_kick", {ACLFlags.value("CM"), 1, &AOClient::cmdAreaKick}},
|
||||
{"randomchar", {ACLFlags.value("NONE"), 0, &AOClient::cmdRandomChar}},
|
||||
{"switch", {ACLFlags.value("NONE"), 1, &AOClient::cmdSwitch}},
|
||||
{"toggleglobal", {ACLFlags.value("NONE"), 0, &AOClient::cmdToggleGlobal}},
|
||||
{"mods", {ACLFlags.value("NONE"), 0, &AOClient::cmdMods}},
|
||||
{"help", {ACLFlags.value("NONE"), 0, &AOClient::cmdHelp}},
|
||||
{"status", {ACLFlags.value("NONE"), 1, &AOClient::cmdStatus}},
|
||||
{"forcepos", {ACLFlags.value("CM"), 2, &AOClient::cmdForcePos}},
|
||||
{"currentmusic", {ACLFlags.value("NONE"), 0, &AOClient::cmdCurrentMusic}},
|
||||
{"pm", {ACLFlags.value("NONE"), 2, &AOClient::cmdPM}},
|
||||
{"evidence_mod", {ACLFlags.value("EVI_MOD"), 1, &AOClient::cmdEvidenceMod}},
|
||||
{"motd", {ACLFlags.value("NONE"), 0, &AOClient::cmdMOTD}},
|
||||
{"announce", {ACLFlags.value("ANNOUNCE"), 1, &AOClient::cmdAnnounce}},
|
||||
{"m", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdM}},
|
||||
{"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}},
|
||||
{"login", {ACLFlags.value("NONE"), 1, &AOClient::cmdLogin}},
|
||||
{"getareas", {ACLFlags.value("NONE"), 0, &AOClient::cmdGetAreas}},
|
||||
{"getarea", {ACLFlags.value("NONE"), 0, &AOClient::cmdGetArea}},
|
||||
{"ban", {ACLFlags.value("BAN"), 2, &AOClient::cmdBan}},
|
||||
{"kick", {ACLFlags.value("KICK"), 2, &AOClient::cmdKick}},
|
||||
{"changeauth", {ACLFlags.value("SUPER"), 0, &AOClient::cmdChangeAuth}},
|
||||
{"rootpass", {ACLFlags.value("SUPER"), 1, &AOClient::cmdSetRootPass}},
|
||||
{"background", {ACLFlags.value("NONE"), 1, &AOClient::cmdSetBackground}},
|
||||
{"bg", {ACLFlags.value("NONE"), 1, &AOClient::cmdSetBackground}},
|
||||
{"bglock", {ACLFlags.value("BGLOCK"), 0, &AOClient::cmdBgLock}},
|
||||
{"bgunlock", {ACLFlags.value("BGLOCK"), 0, &AOClient::cmdBgUnlock}},
|
||||
{"adduser", {ACLFlags.value("MODIFY_USERS"), 2, &AOClient::cmdAddUser}},
|
||||
{"listperms", {ACLFlags.value("NONE"), 0, &AOClient::cmdListPerms}},
|
||||
{"addperm", {ACLFlags.value("MODIFY_USERS"), 2, &AOClient::cmdAddPerms}},
|
||||
{"removeperm", {ACLFlags.value("MODIFY_USERS"), 2, &AOClient::cmdRemovePerms}},
|
||||
{"listusers", {ACLFlags.value("MODIFY_USERS"), 0, &AOClient::cmdListUsers}},
|
||||
{"logout", {ACLFlags.value("NONE"), 0, &AOClient::cmdLogout}},
|
||||
{"pos", {ACLFlags.value("NONE"), 1, &AOClient::cmdPos}},
|
||||
{"g", {ACLFlags.value("NONE"), 1, &AOClient::cmdG}},
|
||||
{"need", {ACLFlags.value("NONE"), 1, &AOClient::cmdNeed}},
|
||||
{"coinflip", {ACLFlags.value("NONE"), 0, &AOClient::cmdFlip}},
|
||||
{"roll", {ACLFlags.value("NONE"), 0, &AOClient::cmdRoll}},
|
||||
{"rollp", {ACLFlags.value("NONE"), 0, &AOClient::cmdRollP}},
|
||||
{"doc", {ACLFlags.value("NONE"), 0, &AOClient::cmdDoc}},
|
||||
{"cleardoc", {ACLFlags.value("NONE"), 0, &AOClient::cmdClearDoc}},
|
||||
{"cm", {ACLFlags.value("NONE"), 0, &AOClient::cmdCM}},
|
||||
{"uncm", {ACLFlags.value("CM"), 0, &AOClient::cmdUnCM}},
|
||||
{"invite", {ACLFlags.value("CM"), 1, &AOClient::cmdInvite}},
|
||||
{"uninvite", {ACLFlags.value("CM"), 1, &AOClient::cmdUnInvite}},
|
||||
{"lock", {ACLFlags.value("CM"), 0, &AOClient::cmdLock}},
|
||||
{"area_lock", {ACLFlags.value("CM"), 0, &AOClient::cmdLock}},
|
||||
{"spectatable", {ACLFlags.value("CM"), 0, &AOClient::cmdSpectatable}},
|
||||
{"area_spectate", {ACLFlags.value("CM"), 0, &AOClient::cmdSpectatable}},
|
||||
{"unlock", {ACLFlags.value("CM"), 0, &AOClient::cmdUnLock}},
|
||||
{"area_unlock", {ACLFlags.value("CM"), 0, &AOClient::cmdUnLock}},
|
||||
{"timer", {ACLFlags.value("CM"), 0, &AOClient::cmdTimer}},
|
||||
{"area", {ACLFlags.value("NONE"), 1, &AOClient::cmdArea}},
|
||||
{"play", {ACLFlags.value("CM"), 1, &AOClient::cmdPlay}},
|
||||
{"areakick", {ACLFlags.value("CM"), 1, &AOClient::cmdAreaKick}},
|
||||
{"area_kick", {ACLFlags.value("CM"), 1, &AOClient::cmdAreaKick}},
|
||||
{"randomchar", {ACLFlags.value("NONE"), 0, &AOClient::cmdRandomChar}},
|
||||
{"switch", {ACLFlags.value("NONE"), 1, &AOClient::cmdSwitch}},
|
||||
{"toggleglobal", {ACLFlags.value("NONE"), 0, &AOClient::cmdToggleGlobal}},
|
||||
{"mods", {ACLFlags.value("NONE"), 0, &AOClient::cmdMods}},
|
||||
{"help", {ACLFlags.value("NONE"), 0, &AOClient::cmdHelp}},
|
||||
{"status", {ACLFlags.value("NONE"), 1, &AOClient::cmdStatus}},
|
||||
{"forcepos", {ACLFlags.value("CM"), 2, &AOClient::cmdForcePos}},
|
||||
{"currentmusic", {ACLFlags.value("NONE"), 0, &AOClient::cmdCurrentMusic}},
|
||||
{"pm", {ACLFlags.value("NONE"), 2, &AOClient::cmdPM}},
|
||||
{"evidence_mod", {ACLFlags.value("EVI_MOD"), 1, &AOClient::cmdEvidenceMod}},
|
||||
{"motd", {ACLFlags.value("NONE"), 0, &AOClient::cmdMOTD}},
|
||||
{"announce", {ACLFlags.value("ANNOUNCE"), 1, &AOClient::cmdAnnounce}},
|
||||
{"m", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdM}},
|
||||
{"gm", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdGM}},
|
||||
{"mute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdMute}},
|
||||
{"unmute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnMute}},
|
||||
{"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}},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -271,6 +271,7 @@ class AreaData : public QObject {
|
||||
* @see EvidenceMod
|
||||
*/
|
||||
EvidenceMod evi_mod;
|
||||
QMap<QString, QString> notecards;
|
||||
};
|
||||
|
||||
#endif // AREA_DATA_H
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user