From cf5cadb45c11493cbddbc44a7be35eb1d49ee57f Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Mon, 9 Sep 2024 19:02:06 +0200 Subject: [PATCH] Webfiles (#376) * add webfiles command * only show chars who are swapping Co-Authored-By: Salanto <62221668+Salanto@users.noreply.github.com> * whitespace wow --------- Co-authored-by: Salanto <62221668+Salanto@users.noreply.github.com> --- src/aoclient.cpp | 1 + src/aoclient.h | 9 +++++++++ src/commands/area.cpp | 16 ++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/aoclient.cpp b/src/aoclient.cpp index 7dcbff3..b0d5c4a 100644 --- a/src/aoclient.cpp +++ b/src/aoclient.cpp @@ -139,6 +139,7 @@ const QMap AOClient::COMMANDS{ {"togglemessage", {{ACLRole::CM}, 0, &AOClient::cmdToggleAreaMessageOnJoin}}, {"clearmessage", {{ACLRole::CM}, 0, &AOClient::cmdClearAreaMessage}}, {"areamessage", {{ACLRole::CM}, 0, &AOClient::cmdAreaMessage}}, + {"webfiles", {{ACLRole::NONE}, 0, &AOClient::cmdWebfiles}}, {"addsong", {{ACLRole::CM}, 1, &AOClient::cmdAddSong}}, {"addcategory", {{ACLRole::CM}, 1, &AOClient::cmdAddCategory}}, {"removeentry", {{ACLRole::CM}, 1, &AOClient::cmdRemoveCategorySong}}, diff --git a/src/aoclient.h b/src/aoclient.h index 18e614d..1f5dec0 100644 --- a/src/aoclient.h +++ b/src/aoclient.h @@ -1038,6 +1038,15 @@ class AOClient : public QObject */ void cmdToggleShouts(int argc, QStringList argv); + /** + * @brief Generates a download link for characters who are iniswapping + * + * @details No arguments. + * + * @iscommand + */ + void cmdWebfiles(int argc, QStringList argv); + ///@} /** diff --git a/src/commands/area.cpp b/src/commands/area.cpp index 7b1276c..0c04628 100644 --- a/src/commands/area.cpp +++ b/src/commands/area.cpp @@ -472,3 +472,19 @@ void AOClient::cmdClearAreaMessage(int argc, QStringList argv) if (l_area->sendAreaMessageOnJoin()) // Turn off the automatic sending. cmdToggleAreaMessageOnJoin(0, QStringList{}); // Dummy values. } + +void AOClient::cmdWebfiles(int argc, QStringList argv) +{ + const QVector l_clients = server->getClients(); + QStringList l_weblinks; + for (AOClient *l_client : l_clients) { + if (l_client->m_current_iniswap.isEmpty() || l_client->areaId() != areaId()) { + continue; + } + + if (l_client->character().toLower() != l_client->m_current_iniswap.toLower()) { + l_weblinks.append("https://attorneyonline.github.io/webDownloader/index.html?char=" + l_client->m_current_iniswap); + } + } + sendServerMessage("Character files:\n" + l_weblinks.join("\n")); +} \ No newline at end of file