Compare commits

..

No commits in common. "dc89b713bcf9268bf67c375bd0f1f57c2e01417e" and "4f0415cb371dde8b4eefebd9126a51ab92fa7124" have entirely different histories.

13 changed files with 47 additions and 94 deletions

View File

@ -18,7 +18,7 @@ jobs:
name: check-clang-format name: check-clang-format
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- name: Run clang-format style check. - name: Run clang-format style check.
uses: jidicula/clang-format-action@v4.5.0 uses: jidicula/clang-format-action@v4.5.0
with: with:
@ -33,7 +33,7 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job # Steps represent a sequence of tasks that will be executed as part of the job
steps: steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- name: Install dependencies - name: Install dependencies
uses: awalsh128/cache-apt-pkgs-action@latest uses: awalsh128/cache-apt-pkgs-action@latest
@ -57,7 +57,7 @@ jobs:
done; done;
- name: Upload binary - name: Upload binary
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: akashi-linux name: akashi-linux
path: bin/ path: bin/
@ -112,7 +112,7 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1 - uses: ilammy/msvc-dev-cmd@v1
- name: Cache Qt - name: Cache Qt
@ -151,7 +151,7 @@ jobs:
copy .\openssl-1.1\x64\bin\libssl-1_1-x64.dll .\bin\libssl-1_1-x64.dll copy .\openssl-1.1\x64\bin\libssl-1_1-x64.dll .\bin\libssl-1_1-x64.dll
- name: Upload zip - name: Upload zip
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: akashi-windows name: akashi-windows
path: bin\ path: bin\

View File

@ -1,4 +1,4 @@
# akashi <img src="https://github.com/AttorneyOnline/akashi/blob/master/resource/icon/256.png" width=30 height=30> # akashi <img src="https://github.com/AttorneyOnline/akashi/blob/master/akashi/resource/icon/256.png" width=30 height=30>
A C++ server for Attorney Online 2<br><br> A C++ server for Attorney Online 2<br><br>
![Code Format and Build](https://github.com/AttorneyOnline/akashi/actions/workflows/main.yml/badge.svg?event=push) [![Codecov branch](https://img.shields.io/codecov/c/gh/AttorneyOnline/akashi/master)](https://app.codecov.io/gh/AttorneyOnline/akashi) [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/AttorneyOnline/akashi/graphs/commit-activity) ![GitHub](https://img.shields.io/github/license/AttorneyOnline/akashi?color=blue)<br> ![Code Format and Build](https://github.com/AttorneyOnline/akashi/actions/workflows/main.yml/badge.svg?event=push) [![Codecov branch](https://img.shields.io/codecov/c/gh/AttorneyOnline/akashi/master)](https://app.codecov.io/gh/AttorneyOnline/akashi) [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/AttorneyOnline/akashi/graphs/commit-activity) ![GitHub](https://img.shields.io/github/license/AttorneyOnline/akashi?color=blue)<br>

View File

@ -89,7 +89,4 @@ aliases = kickother
aliases = jukeboxskip aliases = jukeboxskip
[play_ambience] [play_ambience]
aliases = playambience playa aliases = playambience playa
[pause]
aliases = end

View File

@ -5,9 +5,6 @@ max_players=100
; The port to listen for incoming connections on. ; The port to listen for incoming connections on.
port=27016 port=27016
; The port to advertise for SSL.
secure_port=-1
; The server description that will appear on the master server. ; The server description that will appear on the master server.
server_description=This is a placeholder server description. Tell the world of AO who you are here! server_description=This is a placeholder server description. Tell the world of AO who you are here!

View File

@ -29,13 +29,6 @@
"usage":"/getarea", "usage":"/getarea",
"text":"Lists all clients in the area the caller is in. This command takes no arguments." "text":"Lists all clients in the area the caller is in. This command takes no arguments."
}, },
{
"names": [
"area"
],
"usage":"/area <id>",
"test":"Moves the caller to the area with the given ID."
},
{ {
"names": [ "names": [
"ban" "ban"

View File

@ -33,8 +33,8 @@ const QMap<QString, AOClient::CommandInfo> AOClient::COMMANDS{
{"rootpass", {{ACLRole::SUPER}, 1, &AOClient::cmdSetRootPass}}, {"rootpass", {{ACLRole::SUPER}, 1, &AOClient::cmdSetRootPass}},
{"background", {{ACLRole::NONE}, 1, &AOClient::cmdSetBackground}}, {"background", {{ACLRole::NONE}, 1, &AOClient::cmdSetBackground}},
{"side", {{ACLRole::NONE}, 0, &AOClient::cmdSetSide}}, {"side", {{ACLRole::NONE}, 0, &AOClient::cmdSetSide}},
{"lock_background", {{ACLRole::CM}, 0, &AOClient::cmdBgLock}}, {"lock_background", {{ACLRole::BGLOCK}, 0, &AOClient::cmdBgLock}},
{"unlock_background", {{ACLRole::CM}, 0, &AOClient::cmdBgUnlock}}, {"unlock_background", {{ACLRole::BGLOCK}, 0, &AOClient::cmdBgUnlock}},
{"adduser", {{ACLRole::MODIFY_USERS}, 2, &AOClient::cmdAddUser}}, {"adduser", {{ACLRole::MODIFY_USERS}, 2, &AOClient::cmdAddUser}},
{"removeuser", {{ACLRole::MODIFY_USERS}, 1, &AOClient::cmdRemoveUser}}, {"removeuser", {{ACLRole::MODIFY_USERS}, 1, &AOClient::cmdRemoveUser}},
{"listusers", {{ACLRole::MODIFY_USERS}, 0, &AOClient::cmdListUsers}}, {"listusers", {{ACLRole::MODIFY_USERS}, 0, &AOClient::cmdListUsers}},
@ -198,9 +198,6 @@ void AOClient::handlePacket(AOPacket *packet)
if (m_is_afk) if (m_is_afk)
sendServerMessage("You are no longer AFK."); sendServerMessage("You are no longer AFK.");
m_is_afk = false; m_is_afk = false;
if (characterName().endsWith(" [AFK]")) {
setCharacterName(characterName().remove(" [AFK]"));
}
m_afk_timer->start(ConfigManager::afkTimeout() * 1000); m_afk_timer->start(ConfigManager::afkTimeout() * 1000);
} }
@ -505,10 +502,8 @@ QString AOClient::name() const { return m_ooc_name; }
void AOClient::setName(const QString &f_name) void AOClient::setName(const QString &f_name)
{ {
if (f_name != m_ooc_name) { m_ooc_name = f_name;
m_ooc_name = f_name; Q_EMIT nameChanged(m_ooc_name);
Q_EMIT nameChanged(m_ooc_name);
}
} }
int AOClient::areaId() const int AOClient::areaId() const
@ -518,10 +513,8 @@ int AOClient::areaId() const
void AOClient::setAreaId(const int f_area_id) void AOClient::setAreaId(const int f_area_id)
{ {
if (f_area_id != m_current_area) { m_current_area = f_area_id;
m_current_area = f_area_id; Q_EMIT areaIdChanged(m_current_area);
Q_EMIT areaIdChanged(m_current_area);
}
} }
QString AOClient::character() const QString AOClient::character() const
@ -531,20 +524,16 @@ QString AOClient::character() const
void AOClient::setCharacter(const QString &f_character) void AOClient::setCharacter(const QString &f_character)
{ {
if (f_character != m_current_char) { m_current_char = f_character;
m_current_char = f_character; Q_EMIT characterChanged(m_current_char);
Q_EMIT characterChanged(m_current_char);
}
} }
QString AOClient::characterName() const { return m_showname; } QString AOClient::characterName() const { return m_showname; }
void AOClient::setCharacterName(const QString &f_showname) void AOClient::setCharacterName(const QString &f_showname)
{ {
if (f_showname != m_showname) { m_showname = f_showname;
m_showname = f_showname; Q_EMIT characterNameChanged(m_showname);
Q_EMIT characterNameChanged(m_showname);
}
} }
void AOClient::setSpectator(bool f_spectator) void AOClient::setSpectator(bool f_spectator)
@ -559,10 +548,8 @@ bool AOClient::isSpectator() const
void AOClient::onAfkTimeout() void AOClient::onAfkTimeout()
{ {
if (!m_is_afk) { if (!m_is_afk)
sendServerMessage("You are now AFK."); sendServerMessage("You are now AFK.");
setCharacterName(characterName() + " [AFK]");
}
m_is_afk = true; m_is_afk = true;
} }

View File

@ -113,12 +113,12 @@ void AOClient::cmdTestify(int argc, QStringList argv)
AreaData *l_area = server->getAreaById(areaId()); AreaData *l_area = server->getAreaById(areaId());
if (l_area->testimonyRecording() == AreaData::TestimonyRecording::RECORDING) { if (l_area->testimonyRecording() == AreaData::TestimonyRecording::RECORDING) {
sendServerMessage("Testimony recording is already in progress. Please stop it with /end before starting a new one."); sendServerMessage("Testimony recording is already in progress. Please stop it before starting a new one.");
} }
else { else {
clearTestimony(); clearTestimony();
l_area->setTestimonyRecording(AreaData::TestimonyRecording::RECORDING); l_area->setTestimonyRecording(AreaData::TestimonyRecording::RECORDING);
sendServerMessage("Started testimony recording. The next IC message will be a title. Use /end to stop recording."); sendServerMessage("Started testimony recording.");
} }
} }
@ -129,19 +129,15 @@ void AOClient::cmdExamine(int argc, QStringList argv)
AreaData *l_area = server->getAreaById(areaId()); AreaData *l_area = server->getAreaById(areaId());
if (l_area->testimony().size() - 1 > 0) { if (l_area->testimony().size() - 1 > 0) {
if (l_area->testimonyRecording() == AreaData::TestimonyRecording::PLAYBACK) { l_area->restartTestimony();
sendServerMessage("An examination is already running. Use /testimony to view the testimony."); server->broadcast(PacketFactory::createPacket("RT", {"testimony2", "0"}), areaId());
} server->broadcast(PacketFactory::createPacket("MS", {l_area->testimony()[0]}), areaId());
else { return;
l_area->restartTestimony();
server->broadcast(PacketFactory::createPacket("RT", {"testimony2", "0"}), areaId());
server->broadcast(PacketFactory::createPacket("MS", {l_area->testimony()[0]}), areaId());
return;
}
}
else {
sendServerMessage("Unable to start replay without prior testimony. Use /testify to start Or load a testimony with /loadtestimony.");
} }
if (l_area->testimonyRecording() == AreaData::TestimonyRecording::PLAYBACK)
sendServerMessage("Unable to examine while another examination is running");
else
sendServerMessage("Unable to start replay without prior examination.");
} }
void AOClient::cmdTestimony(int argc, QStringList argv) void AOClient::cmdTestimony(int argc, QStringList argv)
@ -186,7 +182,7 @@ void AOClient::cmdUpdateStatement(int argc, QStringList argv)
Q_UNUSED(argv); Q_UNUSED(argv);
server->getAreaById(areaId())->setTestimonyRecording(AreaData::TestimonyRecording::UPDATE); server->getAreaById(areaId())->setTestimonyRecording(AreaData::TestimonyRecording::UPDATE);
sendServerMessage("The next IC-Message will replace the currently selected testimony line."); sendServerMessage("The next IC-Message will replace the last displayed replay message.");
} }
void AOClient::cmdPauseTestimony(int argc, QStringList argv) void AOClient::cmdPauseTestimony(int argc, QStringList argv)
@ -197,7 +193,7 @@ void AOClient::cmdPauseTestimony(int argc, QStringList argv)
AreaData *l_area = server->getAreaById(areaId()); AreaData *l_area = server->getAreaById(areaId());
l_area->setTestimonyRecording(AreaData::TestimonyRecording::STOPPED); l_area->setTestimonyRecording(AreaData::TestimonyRecording::STOPPED);
server->broadcast(PacketFactory::createPacket("RT", {"testimony1", "1"}), areaId()); server->broadcast(PacketFactory::createPacket("RT", {"testimony1", "1"}), areaId());
sendServerMessage("Testimony has been stopped. Use /examine to begin cross-examination."); sendServerMessage("Testimony has been stopped.");
} }
void AOClient::cmdAddStatement(int argc, QStringList argv) void AOClient::cmdAddStatement(int argc, QStringList argv)

View File

@ -64,6 +64,8 @@ QStringList AOClient::buildAreaList(int area_idx)
char_entry.insert(0, "[CM] "); char_entry.insert(0, "[CM] ");
if (m_authenticated) if (m_authenticated)
char_entry += " (" + l_client->getIpid() + "): " + l_client->name(); char_entry += " (" + l_client->getIpid() + "): " + l_client->name();
if (l_client->m_is_afk)
char_entry += " [AFK]";
entries.append(char_entry); entries.append(char_entry);
} }
} }

View File

@ -387,7 +387,6 @@ void AOClient::cmdAfk(int argc, QStringList argv)
m_is_afk = true; m_is_afk = true;
sendServerMessage("You are now AFK."); sendServerMessage("You are now AFK.");
setCharacterName(characterName() + " [AFK]");
} }
void AOClient::cmdCharCurse(int argc, QStringList argv) void AOClient::cmdCharCurse(int argc, QStringList argv)

View File

@ -71,12 +71,17 @@ bool ConfigManager::verifyServerConfig()
qCritical("port is not a valid port!"); qCritical("port is not a valid port!");
return false; return false;
} }
m_settings->value("secure_port", -1).toInt(&ok); bool web_ao = m_settings->value("webao_enable", false).toBool();
if (!ok) { if (!web_ao) {
qCritical("secure_port is not a valid port!"); m_settings->setValue("webao_port", -1);
return false; }
else {
m_settings->value("webao_port", 27017).toInt(&ok);
if (!ok) {
qCritical("webao_port is not a valid port!");
return false;
}
} }
QString l_auth = m_settings->value("auth", "simple").toString().toLower(); QString l_auth = m_settings->value("auth", "simple").toString().toLower();
if (!(l_auth == "simple" || l_auth == "advanced")) { if (!(l_auth == "simple" || l_auth == "advanced")) {
qCritical("auth is not a valid auth type!"); qCritical("auth is not a valid auth type!");
@ -322,11 +327,6 @@ int ConfigManager::serverPort()
return m_settings->value("Options/port", 27016).toInt(); return m_settings->value("Options/port", 27016).toInt();
} }
int ConfigManager::securePort()
{
return m_settings->value("Options/secure_port", -1).toInt();
}
QString ConfigManager::serverDescription() QString ConfigManager::serverDescription()
{ {
return m_settings->value("Options/server_description", "This is my flashy new server!").toString(); return m_settings->value("Options/server_description", "This is my flashy new server!").toString();

View File

@ -143,13 +143,6 @@ class ConfigManager
*/ */
static int serverPort(); static int serverPort();
/**
* @brief Returns the SSL port to listen for connections on.
*
* @return See short description.
*/
static int securePort();
/** /**
* @brief Returns the server description. * @brief Returns the server description.
* *

View File

@ -394,7 +394,9 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const
client_name = client.character(); // fallback in case of empty ooc name client_name = client.character(); // fallback in case of empty ooc name
} }
if (area->testimonyRecording() == AreaData::TestimonyRecording::RECORDING || area->testimonyRecording() == AreaData::TestimonyRecording::ADD) { if (area->testimonyRecording() == AreaData::TestimonyRecording::RECORDING || area->testimonyRecording() == AreaData::TestimonyRecording::ADD) {
// -1 indicates title if (!l_args[5].startsWith("wit"))
return PacketFactory::createPacket("MS", l_args);
if (area->statement() == -1) { if (area->statement() == -1) {
l_args[4] = "~~-- " + l_args[4] + " --"; l_args[4] = "~~-- " + l_args[4] + " --";
l_args[14] = "3"; l_args[14] = "3";
@ -432,17 +434,9 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const
client.sendServerMessage("First statement reached."); client.sendServerMessage("First statement reached.");
} }
} }
if (l_args[4] == "=") {
auto l_statement = area->jumpToStatement(area->statement());
l_args = l_statement.first;
l_progress = l_statement.second;
client.m_pos = l_args[5];
client.sendServerMessageArea(client_name + " repeated the current statement.");
}
QRegularExpressionMatch match = isTestimonyJumpCommand(client.decodeMessage(l_args[4])); // Get rid of that pesky encoding, then do the fun part QRegularExpressionMatch match = isTestimonyJumpCommand(client.decodeMessage(l_args[4])); // Get rid of that pesky encoding, then do the fun part
if (match.hasMatch()) { if (match.hasMatch()) {
client.m_pos = "wit";
int jump_idx = match.captured("int").toInt(); int jump_idx = match.captured("int").toInt();
auto l_statement = area->jumpToStatement(jump_idx); auto l_statement = area->jumpToStatement(jump_idx);
l_args = l_statement.first; l_args = l_statement.first;
@ -479,8 +473,6 @@ QRegularExpressionMatch PacketMS::isTestimonyJumpCommand(QString message) const
// even if it hurts my heart // even if it hurts my heart
// //
// and my grey matter // and my grey matter
// QRegularExpression jump("(?<arrow>>)(?<int>[0,1,2,3,4,5,6,7,8,9]+)");
// get well soon
QRegularExpression jump("(?<arrow>>|<)(?<int>\\d+)");
return jump.match(message); return jump.match(message);
} }

View File

@ -58,9 +58,6 @@ void ServerPublisher::publishServer()
if (!ConfigManager::serverDomainName().trimmed().isEmpty()) { if (!ConfigManager::serverDomainName().trimmed().isEmpty()) {
serverinfo["ip"] = ConfigManager::serverDomainName(); serverinfo["ip"] = ConfigManager::serverDomainName();
} }
if (ConfigManager::securePort() != -1) {
serverinfo["wss_port"] = ConfigManager::securePort();
}
serverinfo["port"] = 27106; serverinfo["port"] = 27106;
serverinfo["ws_port"] = ConfigManager::advertiseWSProxy() ? WS_REVERSE_PROXY : m_port; serverinfo["ws_port"] = ConfigManager::advertiseWSProxy() ? WS_REVERSE_PROXY : m_port;
serverinfo["players"] = *m_players; serverinfo["players"] = *m_players;