Compare commits
	
		
			No commits in common. "dc89b713bcf9268bf67c375bd0f1f57c2e01417e" and "4f0415cb371dde8b4eefebd9126a51ab92fa7124" have entirely different histories.
		
	
	
		
			dc89b713bc
			...
			4f0415cb37
		
	
		
							
								
								
									
										10
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							| @ -18,7 +18,7 @@ jobs: | ||||
|     name: check-clang-format | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|     - uses: actions/checkout@v4 | ||||
|     - uses: actions/checkout@v2 | ||||
|     - name: Run clang-format style check. | ||||
|       uses: jidicula/clang-format-action@v4.5.0 | ||||
|       with: | ||||
| @ -33,7 +33,7 @@ jobs: | ||||
|     # Steps represent a sequence of tasks that will be executed as part of the job | ||||
|     steps: | ||||
|       # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||||
|       - uses: actions/checkout@v4 | ||||
|       - uses: actions/checkout@v2 | ||||
|        | ||||
|       - name: Install dependencies | ||||
|         uses: awalsh128/cache-apt-pkgs-action@latest | ||||
| @ -57,7 +57,7 @@ jobs: | ||||
|             done; | ||||
|            | ||||
|       - name: Upload binary | ||||
|         uses: actions/upload-artifact@v4 | ||||
|         uses: actions/upload-artifact@v2 | ||||
|         with: | ||||
|           name: akashi-linux | ||||
|           path: bin/ | ||||
| @ -112,7 +112,7 @@ jobs: | ||||
|     runs-on: windows-latest | ||||
|      | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - uses: actions/checkout@v2 | ||||
|       - uses: ilammy/msvc-dev-cmd@v1 | ||||
|        | ||||
|       - 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 | ||||
|            | ||||
|       - name: Upload zip | ||||
|         uses: actions/upload-artifact@v4 | ||||
|         uses: actions/upload-artifact@v2 | ||||
|         with: | ||||
|           name: akashi-windows | ||||
|           path: bin\ | ||||
|  | ||||
| @ -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> | ||||
|  [](https://app.codecov.io/gh/AttorneyOnline/akashi) [](https://GitHub.com/AttorneyOnline/akashi/graphs/commit-activity) <br> | ||||
| 
 | ||||
|  | ||||
| @ -89,7 +89,4 @@ aliases = kickother | ||||
| aliases = jukeboxskip | ||||
| 
 | ||||
| [play_ambience] | ||||
| aliases = playambience playa | ||||
| 
 | ||||
| [pause] | ||||
| aliases = end | ||||
| aliases = playambience playa | ||||
| @ -5,9 +5,6 @@ max_players=100 | ||||
| ; The port to listen for incoming connections on. | ||||
| port=27016 | ||||
| 
 | ||||
| ; The port to advertise for SSL. | ||||
| secure_port=-1 | ||||
| 
 | ||||
| ; 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! | ||||
| 
 | ||||
|  | ||||
| @ -29,13 +29,6 @@ | ||||
|       "usage":"/getarea", | ||||
|       "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": [ | ||||
|          "ban" | ||||
|  | ||||
| @ -33,8 +33,8 @@ const QMap<QString, AOClient::CommandInfo> AOClient::COMMANDS{ | ||||
|     {"rootpass", {{ACLRole::SUPER}, 1, &AOClient::cmdSetRootPass}}, | ||||
|     {"background", {{ACLRole::NONE}, 1, &AOClient::cmdSetBackground}}, | ||||
|     {"side", {{ACLRole::NONE}, 0, &AOClient::cmdSetSide}}, | ||||
|     {"lock_background", {{ACLRole::CM}, 0, &AOClient::cmdBgLock}}, | ||||
|     {"unlock_background", {{ACLRole::CM}, 0, &AOClient::cmdBgUnlock}}, | ||||
|     {"lock_background", {{ACLRole::BGLOCK}, 0, &AOClient::cmdBgLock}}, | ||||
|     {"unlock_background", {{ACLRole::BGLOCK}, 0, &AOClient::cmdBgUnlock}}, | ||||
|     {"adduser", {{ACLRole::MODIFY_USERS}, 2, &AOClient::cmdAddUser}}, | ||||
|     {"removeuser", {{ACLRole::MODIFY_USERS}, 1, &AOClient::cmdRemoveUser}}, | ||||
|     {"listusers", {{ACLRole::MODIFY_USERS}, 0, &AOClient::cmdListUsers}}, | ||||
| @ -198,9 +198,6 @@ void AOClient::handlePacket(AOPacket *packet) | ||||
|         if (m_is_afk) | ||||
|             sendServerMessage("You are no longer AFK."); | ||||
|         m_is_afk = false; | ||||
|         if (characterName().endsWith(" [AFK]")) { | ||||
|             setCharacterName(characterName().remove(" [AFK]")); | ||||
|         } | ||||
|         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) | ||||
| { | ||||
|     if (f_name != m_ooc_name) { | ||||
|         m_ooc_name = f_name; | ||||
|         Q_EMIT nameChanged(m_ooc_name); | ||||
|     } | ||||
|     m_ooc_name = f_name; | ||||
|     Q_EMIT nameChanged(m_ooc_name); | ||||
| } | ||||
| 
 | ||||
| int AOClient::areaId() const | ||||
| @ -518,10 +513,8 @@ int AOClient::areaId() const | ||||
| 
 | ||||
| void AOClient::setAreaId(const int f_area_id) | ||||
| { | ||||
|     if (f_area_id != m_current_area) { | ||||
|         m_current_area = f_area_id; | ||||
|         Q_EMIT areaIdChanged(m_current_area); | ||||
|     } | ||||
|     m_current_area = f_area_id; | ||||
|     Q_EMIT areaIdChanged(m_current_area); | ||||
| } | ||||
| 
 | ||||
| QString AOClient::character() const | ||||
| @ -531,20 +524,16 @@ QString AOClient::character() const | ||||
| 
 | ||||
| void AOClient::setCharacter(const QString &f_character) | ||||
| { | ||||
|     if (f_character != m_current_char) { | ||||
|         m_current_char = f_character; | ||||
|         Q_EMIT characterChanged(m_current_char); | ||||
|     } | ||||
|     m_current_char = f_character; | ||||
|     Q_EMIT characterChanged(m_current_char); | ||||
| } | ||||
| 
 | ||||
| QString AOClient::characterName() const { return m_showname; } | ||||
| 
 | ||||
| void AOClient::setCharacterName(const QString &f_showname) | ||||
| { | ||||
|     if (f_showname != m_showname) { | ||||
|         m_showname = f_showname; | ||||
|         Q_EMIT characterNameChanged(m_showname); | ||||
|     } | ||||
|     m_showname = f_showname; | ||||
|     Q_EMIT characterNameChanged(m_showname); | ||||
| } | ||||
| 
 | ||||
| void AOClient::setSpectator(bool f_spectator) | ||||
| @ -559,10 +548,8 @@ bool AOClient::isSpectator() const | ||||
| 
 | ||||
| void AOClient::onAfkTimeout() | ||||
| { | ||||
|     if (!m_is_afk) { | ||||
|     if (!m_is_afk) | ||||
|         sendServerMessage("You are now AFK."); | ||||
|         setCharacterName(characterName() + " [AFK]"); | ||||
|     } | ||||
|     m_is_afk = true; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -113,12 +113,12 @@ void AOClient::cmdTestify(int argc, QStringList argv) | ||||
| 
 | ||||
|     AreaData *l_area = server->getAreaById(areaId()); | ||||
|     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 { | ||||
|         clearTestimony(); | ||||
|         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()); | ||||
|     if (l_area->testimony().size() - 1 > 0) { | ||||
|         if (l_area->testimonyRecording() == AreaData::TestimonyRecording::PLAYBACK) { | ||||
|             sendServerMessage("An examination is already running. Use /testimony to view the testimony."); | ||||
|         } | ||||
|         else { | ||||
|             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."); | ||||
|         l_area->restartTestimony(); | ||||
|         server->broadcast(PacketFactory::createPacket("RT", {"testimony2", "0"}), areaId()); | ||||
|         server->broadcast(PacketFactory::createPacket("MS", {l_area->testimony()[0]}), areaId()); | ||||
|         return; | ||||
|     } | ||||
|     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) | ||||
| @ -186,7 +182,7 @@ void AOClient::cmdUpdateStatement(int argc, QStringList argv) | ||||
|     Q_UNUSED(argv); | ||||
| 
 | ||||
|     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) | ||||
| @ -197,7 +193,7 @@ void AOClient::cmdPauseTestimony(int argc, QStringList argv) | ||||
|     AreaData *l_area = server->getAreaById(areaId()); | ||||
|     l_area->setTestimonyRecording(AreaData::TestimonyRecording::STOPPED); | ||||
|     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) | ||||
|  | ||||
| @ -64,6 +64,8 @@ QStringList AOClient::buildAreaList(int area_idx) | ||||
|                 char_entry.insert(0, "[CM] "); | ||||
|             if (m_authenticated) | ||||
|                 char_entry += " (" + l_client->getIpid() + "): " + l_client->name(); | ||||
|             if (l_client->m_is_afk) | ||||
|                 char_entry += " [AFK]"; | ||||
|             entries.append(char_entry); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -387,7 +387,6 @@ void AOClient::cmdAfk(int argc, QStringList argv) | ||||
| 
 | ||||
|     m_is_afk = true; | ||||
|     sendServerMessage("You are now AFK."); | ||||
|     setCharacterName(characterName() + " [AFK]"); | ||||
| } | ||||
| 
 | ||||
| void AOClient::cmdCharCurse(int argc, QStringList argv) | ||||
|  | ||||
| @ -71,12 +71,17 @@ bool ConfigManager::verifyServerConfig() | ||||
|         qCritical("port is not a valid port!"); | ||||
|         return false; | ||||
|     } | ||||
|     m_settings->value("secure_port", -1).toInt(&ok); | ||||
|     if (!ok) { | ||||
|         qCritical("secure_port is not a valid port!"); | ||||
|         return false; | ||||
|     bool web_ao = m_settings->value("webao_enable", false).toBool(); | ||||
|     if (!web_ao) { | ||||
|         m_settings->setValue("webao_port", -1); | ||||
|     } | ||||
|     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(); | ||||
|     if (!(l_auth == "simple" || l_auth == "advanced")) { | ||||
|         qCritical("auth is not a valid auth type!"); | ||||
| @ -322,11 +327,6 @@ int ConfigManager::serverPort() | ||||
|     return m_settings->value("Options/port", 27016).toInt(); | ||||
| } | ||||
| 
 | ||||
| int ConfigManager::securePort() | ||||
| { | ||||
|     return m_settings->value("Options/secure_port", -1).toInt(); | ||||
| } | ||||
| 
 | ||||
| QString ConfigManager::serverDescription() | ||||
| { | ||||
|     return m_settings->value("Options/server_description", "This is my flashy new server!").toString(); | ||||
|  | ||||
| @ -143,13 +143,6 @@ class ConfigManager | ||||
|      */ | ||||
|     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. | ||||
|      * | ||||
|  | ||||
| @ -394,7 +394,9 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const | ||||
|         client_name = client.character(); // fallback in case of empty ooc name
 | ||||
|     } | ||||
|     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) { | ||||
|             l_args[4] = "~~-- " + l_args[4] + " --"; | ||||
|             l_args[14] = "3"; | ||||
| @ -432,17 +434,9 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const | ||||
|                 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
 | ||||
|         if (match.hasMatch()) { | ||||
|             client.m_pos = "wit"; | ||||
|             int jump_idx = match.captured("int").toInt(); | ||||
|             auto l_statement = area->jumpToStatement(jump_idx); | ||||
|             l_args = l_statement.first; | ||||
| @ -479,8 +473,6 @@ QRegularExpressionMatch PacketMS::isTestimonyJumpCommand(QString message) const | ||||
|     // even if it hurts my heart
 | ||||
|     //
 | ||||
|     // and my grey matter
 | ||||
|     //
 | ||||
|     // get well soon
 | ||||
|     QRegularExpression jump("(?<arrow>>|<)(?<int>\\d+)"); | ||||
|     QRegularExpression jump("(?<arrow>>)(?<int>[0,1,2,3,4,5,6,7,8,9]+)"); | ||||
|     return jump.match(message); | ||||
| } | ||||
|  | ||||
| @ -58,9 +58,6 @@ void ServerPublisher::publishServer() | ||||
|         if (!ConfigManager::serverDomainName().trimmed().isEmpty()) { | ||||
|             serverinfo["ip"] = ConfigManager::serverDomainName(); | ||||
|         } | ||||
|         if (ConfigManager::securePort() != -1) { | ||||
|             serverinfo["wss_port"] = ConfigManager::securePort(); | ||||
|         } | ||||
|         serverinfo["port"] = 27106; | ||||
|         serverinfo["ws_port"] = ConfigManager::advertiseWSProxy() ? WS_REVERSE_PROXY : m_port; | ||||
|         serverinfo["players"] = *m_players; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user