add /charselect

This commit is contained in:
scatterflower 2021-04-18 16:04:20 -05:00
parent a8d3dfa27a
commit 8156ae6515
3 changed files with 32 additions and 5 deletions

View File

@ -221,7 +221,8 @@ class AOClient : public QObject {
{"MUTE", 1ULL << 10}, {"MUTE", 1ULL << 10},
{"UNCM", 1ULL << 11}, {"UNCM", 1ULL << 11},
{"SAVETEST", 1ULL << 12}, {"SAVETEST", 1ULL << 12},
{"SUPER", ~0ULL }, {"FORCE_CHARSELECT",1ULL << 13},
{"SUPER", ~0ULL }
}; };
@ -1485,6 +1486,8 @@ class AOClient : public QObject {
*/ */
void cmdAfk(int argc, QStringList argv); void cmdAfk(int argc, QStringList argv);
void cmdCharSelect(int argc, QStringList argv);
///@} ///@}
/** /**
@ -1933,6 +1936,7 @@ class AOClient : public QObject {
{"block_dj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdBlockDj}}, {"block_dj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdBlockDj}},
{"unblockdj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockDj}}, {"unblockdj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockDj}},
{"unblock_dj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockDj}}, {"unblock_dj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockDj}},
{"charselect", {ACLFlags.value("NONE"), 0, &AOClient::cmdCharSelect}}
}; };
/** /**

View File

@ -148,16 +148,16 @@ bool AOClient::changeCharacter(int char_id)
if(char_id >= server->characters.length()) if(char_id >= server->characters.length())
return false; return false;
if (current_char != "") {
area->characters_taken.removeAll(server->getCharID(current_char));
}
if (char_id >= 0) { if (char_id >= 0) {
QString char_selected = server->characters[char_id]; QString char_selected = server->characters[char_id];
bool taken = area->characters_taken.contains(char_id); bool taken = area->characters_taken.contains(char_id);
if (taken || char_selected == "") if (taken || char_selected == "")
return false; return false;
if (current_char != "") {
area->characters_taken.removeAll(server->getCharID(current_char));
}
area->characters_taken.append(char_id); area->characters_taken.append(char_id);
current_char = char_selected; current_char = char_selected;
} }

View File

@ -317,3 +317,26 @@ void AOClient::cmdAfk(int argc, QStringList argv)
is_afk = true; is_afk = true;
sendServerMessage("You are now AFK."); sendServerMessage("You are now AFK.");
} }
void AOClient::cmdCharSelect(int argc, QStringList argv)
{
if (argc == 0) {
changeCharacter(-1);
sendPacket("DONE");
}
else {
if (!checkAuth(ACLFlags.value("FORCE_CHARSELECT"))) {
sendServerMessage("You do not have permission to force another player to character select!");
return;
}
bool ok = false;
int target_id = argv[0].toInt(&ok);
if (!ok)
return;
AOClient* target = server->getClientByID(target_id);
target->changeCharacter(-1);
target->sendPacket("DONE");
}
}