add /pm, make changing pos send SP packet
This commit is contained in:
parent
d04fef0ded
commit
edbb531e88
@ -219,6 +219,7 @@ class AOClient : public QObject {
|
||||
void cmdRandomChar(int argc, QStringList argv);
|
||||
void cmdG(int argc, QStringList argv);
|
||||
void cmdToggleGlobal(int argc, QStringList argv);
|
||||
void cmdPM(int argc, QStringList argv);
|
||||
|
||||
// Command helper functions
|
||||
QString getAreaTimer(int area_idx, QTimer* timer);
|
||||
@ -284,6 +285,7 @@ class AOClient : public QObject {
|
||||
{"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}},
|
||||
};
|
||||
|
||||
QString partial_packet;
|
||||
|
@ -193,6 +193,13 @@ void AOClient::changeCharacter(int char_id)
|
||||
}
|
||||
}
|
||||
|
||||
void AOClient::changePosition(QString new_pos)
|
||||
{
|
||||
pos = new_pos;
|
||||
sendServerMessage("Position changed to " + pos + ".");
|
||||
sendPacket("SP", {pos});
|
||||
}
|
||||
|
||||
void AOClient::handleCommand(QString command, int argc, QStringList argv)
|
||||
{
|
||||
CommandInfo info = commands.value(command, {false, -1, &AOClient::cmdDefault});
|
||||
|
@ -364,8 +364,7 @@ void AOClient::cmdLogout(int argc, QStringList argv)
|
||||
|
||||
void AOClient::cmdPos(int argc, QStringList argv)
|
||||
{
|
||||
pos = argv[0];
|
||||
sendServerMessage("Position changed to " + pos + ".");
|
||||
changePosition(argv[0]);
|
||||
}
|
||||
|
||||
void AOClient::cmdForcePos(int argc, QStringList argv)
|
||||
@ -396,8 +395,8 @@ void AOClient::cmdForcePos(int argc, QStringList argv)
|
||||
}
|
||||
}
|
||||
for (AOClient* target : targets) {
|
||||
target->pos = argv[0];
|
||||
target->sendServerMessage("Position forced to " + target->pos + " by CM.");
|
||||
target->sendServerMessage("Position forcibly changed by CM.");
|
||||
target->changePosition(argv[0]);
|
||||
forced_clients++;
|
||||
}
|
||||
sendServerMessage("Forced " + QString::number(forced_clients) + " into pos " + argv[0] + ".");
|
||||
@ -813,6 +812,23 @@ void AOClient::cmdCurrentMusic(int argc, QStringList argv)
|
||||
sendServerMessage("There is no music playing.");
|
||||
}
|
||||
|
||||
void AOClient::cmdPM(int arc, QStringList argv)
|
||||
{
|
||||
bool ok;
|
||||
int target_id = argv.takeFirst().toInt(&ok); // using takeFirst removes the ID from our list of arguments...
|
||||
if (!ok) {
|
||||
sendServerMessage("That does not look like a valid ID.");
|
||||
return;
|
||||
}
|
||||
AOClient* target_client = server->getClientByID(target_id);
|
||||
if (target_client == nullptr) {
|
||||
sendServerMessage("No client with that ID found.");
|
||||
return;
|
||||
}
|
||||
QString message = argv.join(" "); //...which means it will not end up as part of the message
|
||||
target_client->sendServerMessage("Message from " + ooc_name + " (" + QString::number(id) + "): " + message);
|
||||
}
|
||||
|
||||
QStringList AOClient::buildAreaList(int area_idx)
|
||||
{
|
||||
QStringList entries;
|
||||
|
Loading…
Reference in New Issue
Block a user