Add /a and /s
This commit is contained in:
parent
0baa643f40
commit
40552b1602
@ -1488,6 +1488,24 @@ class AOClient : public QObject {
|
||||
|
||||
void cmdCharSelect(int argc, QStringList argv);
|
||||
|
||||
/**
|
||||
* @brief Sends a message to an area that you a CM in.
|
||||
*
|
||||
* @details Usage: /a <area> <message>
|
||||
*
|
||||
* @iscommand
|
||||
*/
|
||||
void cmdA(int argc, QStringList argv);
|
||||
|
||||
/**
|
||||
* @brief Send a message to all areas that you are a CM in.
|
||||
*
|
||||
* @details Usage: /s <message>
|
||||
*
|
||||
* @iscommand
|
||||
*/
|
||||
void cmdS(int argc, QStringList argv);
|
||||
|
||||
///@}
|
||||
|
||||
/**
|
||||
@ -1936,7 +1954,9 @@ class AOClient : public QObject {
|
||||
{"block_dj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdBlockDj}},
|
||||
{"unblockdj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockDj}},
|
||||
{"unblock_dj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockDj}},
|
||||
{"charselect", {ACLFlags.value("NONE"), 0, &AOClient::cmdCharSelect}}
|
||||
{"charselect", {ACLFlags.value("NONE"), 0, &AOClient::cmdCharSelect}},
|
||||
{"a", {ACLFlags.value("NONE"), 2, &AOClient::cmdA}},
|
||||
{"s", {ACLFlags.value("NONE"), 0, &AOClient::cmdS}},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -340,3 +340,36 @@ void AOClient::cmdCharSelect(int argc, QStringList argv)
|
||||
target->sendPacket("DONE");
|
||||
}
|
||||
}
|
||||
|
||||
void AOClient::cmdA(int argc, QStringList argv)
|
||||
{
|
||||
bool ok;
|
||||
int area_id = argv[0].toInt(&ok);
|
||||
if (!ok) {
|
||||
sendServerMessage("This does not look like a valid AreaID.");
|
||||
return;
|
||||
}
|
||||
|
||||
AreaData* area = server->areas[area_id];
|
||||
if (!area->owners.contains(id)) {
|
||||
sendServerMessage("You are not CM in that area.");
|
||||
return;
|
||||
}
|
||||
|
||||
argv.removeAt(0);
|
||||
QString sender_name = ooc_name;
|
||||
QString ooc_message = argv.join(" ");
|
||||
server->broadcast(AOPacket("CT", {"[CM]" + sender_name, ooc_message}), area_id);
|
||||
}
|
||||
|
||||
void AOClient::cmdS(int argc, QStringList argv)
|
||||
{
|
||||
int all_areas = server->areas.size() - 1;
|
||||
QString sender_name = ooc_name;
|
||||
QString ooc_message = argv.join(" ");
|
||||
|
||||
for (int i = 0; i <= all_areas; i++) {
|
||||
if (server->areas[i]->owners.contains(id))
|
||||
server->broadcast(AOPacket("CT", {"[CM]" + sender_name, ooc_message}), i);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user