Compare commits

..

1 Commits

40 changed files with 83 additions and 151 deletions

View File

@ -23,7 +23,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential ninja-build ccache
sudo apt-get install -y build-essential ninja-build ccache libmariadb-dev libmariadb-dev-compat libboost-all-dev libperl-dev liblua5.1-0-dev libluajit-5.1-dev zlib1g-dev uuid-dev libssl-dev libsodium-dev libmbedtls-dev
- name: Configure
run: |
@ -74,7 +74,7 @@ jobs:
- name: Build
shell: pwsh
run: cmake --build build --parallel --config RelWithDebInfo --target ALL_BUILD -- /m
run: cmake --build build --config RelWithDebInfo --target ALL_BUILD -- /m
- name: Test
working-directory: build

View File

@ -16,6 +16,9 @@ set(common_sources
database/database_dump_service.cpp
database.cpp
database_instances.cpp
database/database_update_manifest.cpp
database/database_update_manifest_custom.cpp
database/database_update_manifest_bots.cpp
database/database_update.cpp
data_bucket.cpp
dbcore.cpp
@ -554,9 +557,6 @@ set(common_headers
database.h
database_schema.h
database/database_update.h
database/database_update_manifest.h
database/database_update_manifest_custom.h
database/database_update_manifest_bots.h
data_bucket.cpp
dbcore.h
deity.h

View File

@ -5,10 +5,11 @@
#include "../strings.h"
#include "../rulesys.h"
#include "../http/httplib.h"
#include "database_update_manifest.cpp"
#include "database_update_manifest_custom.cpp"
#include "database_update_manifest_bots.cpp"
#include "database_dump_service.h"
#include "database_update_manifest.h"
#include "database_update_manifest_custom.h"
#include "database_update_manifest_bots.h"
constexpr int BREAK_LENGTH = 70;

View File

@ -1,4 +1,4 @@
#pragma once
#include "database_update.h"
std::vector<ManifestEntry> manifest_entries = {
ManifestEntry{

View File

@ -1,4 +1,4 @@
#pragma once
#include "database_update.h"
std::vector<ManifestEntry> bot_manifest_entries = {
ManifestEntry{

View File

@ -1,4 +1,4 @@
#pragma once
#include "database_update.h"
std::vector<ManifestEntry> manifest_entries_custom = {
ManifestEntry{

View File

@ -6,25 +6,6 @@ set(world_sources
client.cpp
cliententry.cpp
clientlist.cpp
cli/cli_database_concurrency.cpp
cli/cli_bots_enable.cpp
cli/cli_bots_disable.cpp
cli/cli_mercs_enable.cpp
cli/cli_mercs_disable.cpp
cli/cli_copy_character.cpp
cli/cli_database_updates.cpp
cli/cli_database_dump.cpp
cli/cli_database_get_schema.cpp
cli/cli_database_set_account_status.cpp
cli/cli_database_version.cpp
cli/cli_test.cpp
cli/cli_test_colors.cpp
cli/cli_test_expansion.cpp
cli/cli_test_repository.cpp
cli/cli_test_repository_2.cpp
cli/cli_test_string_benchmark.cpp
cli/cli_version.cpp
cli/cli_etl_get_settings.cpp
console.cpp
dynamic_zone.cpp
dynamic_zone_manager.cpp
@ -87,29 +68,7 @@ set(world_headers
world_event_scheduler.h
zonelist.h
zoneserver.h
)
source_group(cli FILES
cli/cli_database_concurrency.cpp
cli/cli_bots_enable.cpp
cli/cli_bots_disable.cpp
cli/cli_mercs_enable.cpp
cli/cli_mercs_disable.cpp
cli/cli_copy_character.cpp
cli/cli_database_updates.cpp
cli/cli_database_dump.cpp
cli/cli_database_get_schema.cpp
cli/cli_database_set_account_status.cpp
cli/cli_database_version.cpp
cli/cli_test.cpp
cli/cli_test_colors.cpp
cli/cli_test_expansion.cpp
cli/cli_test_repository.cpp
cli/cli_test_repository_2.cpp
cli/cli_test_string_benchmark.cpp
cli/cli_version.cpp
cli/cli_etl_get_settings.cpp
)
)
add_executable(world ${world_sources} ${world_headers})

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include "../worlddb.h"
#include "../../common/database_schema.h"

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include "../worlddb.h"
#include "../../common/rulesys.h"

View File

@ -1,5 +1,3 @@
#include "../world_server_cli.h"
#include "../../common/eqemu_logsys.h"
#include "../../common/eqemu_logsys_log_aliases.h"
#include "../worlddb.h"

View File

@ -1,5 +1,4 @@
#include <thread>
#include "../world_server_cli.h"
#include "../../common/repositories/zone_repository.h"
#include "../../common/eqemu_config.h"
#include <signal.h>

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include "../../common/database/database_dump_service.h"
void WorldserverCLI::DatabaseDump(int argc, char **argv, argh::parser &cmd, std::string &description)

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include "../../common/database_schema.h"
#include "../../common/json/json.h"

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include "../worlddb.h"
void WorldserverCLI::DatabaseSetAccountStatus(int argc, char **argv, argh::parser &cmd, std::string &description)

View File

@ -1,5 +1,3 @@
#include "../world_server_cli.h"
#include "../worlddb.h"
#include "../../common/database/database_update.h"
void WorldserverCLI::DatabaseUpdates(int argc, char **argv, argh::parser &cmd, std::string &description)

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include "../../common/version.h"
#include "../../common/json/json.h"
#include "../../common/rulesys.h"

View File

@ -1,5 +1,3 @@
#include "../world_server_cli.h"
#include "../worlddb.h"
#include "../../common/events/player_event_logs.h"
#include "../../common/json/json.h"

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include "../worlddb.h"
#include "../../common/database_schema.h"

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include "../worlddb.h"
#include "../../common/database_schema.h"

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include <cereal/archives/json.hpp>
#include <cereal/types/vector.hpp>
#include <iomanip>

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include "../../common/zone_store.h"
#include "../../common/termcolor/rang.hpp"

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include "../../common/rulesys.h"
#include "../../common/repositories/content_flags_repository.h"
#include "../../common/content/world_content_service.h"

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include "../../common/repositories/instance_list_repository.h"
#include "../worlddb.h"

View File

@ -1,5 +1,3 @@
#include "../world_server_cli.h"
#include "../worlddb.h"
#include "../../common/repositories/zone_repository.h"
void WorldserverCLI::TestRepository2(int argc, char **argv, argh::parser &cmd, std::string &description)

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include <cereal/archives/json.hpp>
#include <cereal/types/vector.hpp>
#include "../../common/events/player_events.h"

View File

@ -1,4 +1,3 @@
#include "../world_server_cli.h"
#include "../../common/json/json.h"
#include "../../common/version.h"

View File

@ -39,3 +39,22 @@ void WorldserverCLI::CommandHandler(int argc, char **argv)
EQEmuCommand::HandleMenu(function_map, cmd, argc, argv);
}
#include "cli/database_concurrency.cpp"
#include "cli/bots_enable.cpp"
#include "cli/bots_disable.cpp"
#include "cli/mercs_enable.cpp"
#include "cli/mercs_disable.cpp"
#include "cli/copy_character.cpp"
#include "cli/database_updates.cpp"
#include "cli/database_dump.cpp"
#include "cli/database_get_schema.cpp"
#include "cli/database_set_account_status.cpp"
#include "cli/database_version.cpp"
#include "cli/test.cpp"
#include "cli/test_colors.cpp"
#include "cli/test_expansion.cpp"
#include "cli/test_repository.cpp"
#include "cli/test_repository_2.cpp"
#include "cli/test_string_benchmark.cpp"
#include "cli/version.cpp"
#include "cli/etl_get_settings.cpp"

View File

@ -21,13 +21,6 @@ set(zone_sources
client_mods.cpp
client_packet.cpp
client_process.cpp
cli/cli_benchmark_databuckets.cpp
cli/cli_sidecar_serve_http.cpp
cli/tests/cli_test_util.cpp
cli/tests/cli_databuckets.cpp
cli/tests/cli_npc_handins.cpp
cli/tests/cli_npc_handins_multiquest.cpp
cli/tests/cli_zone_state.cpp
combat_record.cpp
corpse.cpp
doors.cpp

View File

@ -1,8 +1,6 @@
#include <chrono>
#include <iostream>
#include <random>
#include "../zone_cli.h"
#include "../../common/cli/eqemu_command_handler.h"
#include "../../common/http/httplib.h"
#include "../../common/eqemu_logsys.h"
#include "../sidecar_api/sidecar_api.h"

View File

@ -1,5 +1,3 @@
#include "../zone_cli.h"
#include "../../common/cli/eqemu_command_handler.h"
#include "../../common/http/httplib.h"
#include "../../common/eqemu_logsys.h"
#include "../sidecar_api/sidecar_api.h"

View File

@ -1,6 +1,6 @@
#include "../../zone.h"
void RunTest(const std::string &test_name, const std::string &expected, const std::string &actual)
inline void RunTest(const std::string &test_name, const std::string &expected, const std::string &actual)
{
if (expected == actual) {
std::cout << "[✅] " << test_name << " PASSED\n";
@ -12,7 +12,7 @@ void RunTest(const std::string &test_name, const std::string &expected, const st
}
}
void RunTest(const std::string &test_name, bool expected, bool actual)
inline void RunTest(const std::string &test_name, bool expected, bool actual)
{
if (expected == actual) {
std::cout << "[✅] " << test_name << " PASSED\n";
@ -25,7 +25,7 @@ void RunTest(const std::string &test_name, bool expected, bool actual)
}
}
void RunTest(const std::string &test_name, int expected, int actual)
inline void RunTest(const std::string &test_name, int expected, int actual)
{
if (expected == actual) {
std::cout << "[✅] " << test_name << " PASSED\n";
@ -40,7 +40,7 @@ void RunTest(const std::string &test_name, int expected, int actual)
extern Zone *zone;
void SetupZone(std::string zone_short_name, uint32 instance_id = 0) {
inline void SetupZone(std::string zone_short_name, uint32 instance_id = 0) {
EQEmuLogSys::Instance()->SilenceConsoleLogging();
EQEmuLogSys::Instance()->log_settings[Logs::ZoneState].log_to_console = std::getenv("DEBUG") ? 3 : 0;

View File

@ -1,5 +1,3 @@
#include "../../zone_cli.h"
#include "../../common/cli/eqemu_command_handler.h"
#include "../../common/http/httplib.h"
#include "../../common/eqemu_logsys.h"
#include "../../common/platform.h"
@ -9,10 +7,6 @@
extern Zone* zone;
void RunTest(const std::string& test_name, const std::string& expected, const std::string& actual);
void RunTest(const std::string& test_name, bool expected, bool actual);
void RunTest(const std::string& test_name, int expected, int actual);
void ZoneCLI::TestDataBuckets(int argc, char** argv, argh::parser& cmd, std::string& description)
{
if (cmd[{"-h", "--help"}]) {

View File

@ -1,5 +1,3 @@
#include "../../zone_cli.h"
#include "../../common/cli/eqemu_command_handler.h"
#include "../../common/http/httplib.h"
#include "../../common/eqemu_logsys.h"
#include "../../common/platform.h"
@ -11,10 +9,6 @@
extern Zone *zone;
using json = nlohmann::json;
void RunTest(const std::string& test_name, const std::string& expected, const std::string& actual);
void RunTest(const std::string& test_name, bool expected, bool actual);
void RunTest(const std::string& test_name, int expected, int actual);
struct HandinEntry {
std::string item_id = "0";
uint32 count = 0;

View File

@ -1,5 +1,3 @@
#include "../../zone_cli.h"
#include "../../common/cli/eqemu_command_handler.h"
#include "../../common/eqemu_logsys.h"
#include "../../common/platform.h"
#include "../../zone.h"
@ -8,10 +6,6 @@
extern Zone *zone;
void RunTest(const std::string& test_name, const std::string& expected, const std::string& actual);
void RunTest(const std::string& test_name, bool expected, bool actual);
void RunTest(const std::string& test_name, int expected, int actual);
void ZoneCLI::TestNpcHandinsMultiQuest(int argc, char **argv, argh::parser &cmd, std::string &description)
{
if (cmd[{"-h", "--help"}]) {

View File

@ -1,18 +1,11 @@
#include "../../zone_cli.h"
#include "../../common/cli/eqemu_command_handler.h"
extern Zone *zone;
#include <cereal/archives/json.hpp>
#include <cereal/types/map.hpp>
#include "../../common/repositories/npc_types_repository.h"
#include "../../corpse.h"
#include "../../../common/repositories/respawn_times_repository.h"
extern Zone* zone;
void RunTest(const std::string& test_name, const std::string& expected, const std::string& actual);
void RunTest(const std::string& test_name, bool expected, bool actual);
void RunTest(const std::string& test_name, int expected, int actual);
void SetupZone(std::string zone_short_name, uint32 instance_id = 0);
inline void ClearState()
{
ZoneStateSpawnsRepository::DeleteWhere(database, "zone_id = 32 and instance_id = 0");

View File

@ -0,0 +1,18 @@
void SidecarApi::RequestLogHandler(const httplib::Request &req, const httplib::Response &res)
{
if (!req.path.empty()) {
std::vector<std::string> params;
for (auto &p: req.params) {
params.emplace_back(fmt::format("{}={}", p.first, p.second));
}
LogInfo(
"[API] Request [{}] [{}{}] via [{}:{}]",
res.status,
req.path,
(!params.empty() ? "?" + Strings::Join(params, "&") : ""),
req.remote_addr,
req.remote_port
);
}
}

View File

@ -0,0 +1,4 @@
void SidecarApi::MapBestZController(const httplib::Request &req, httplib::Response &res)
{
}

View File

@ -16,39 +16,9 @@ void CatchSidecarSignal(int sig_num)
std::exit(0);
}
void SidecarApi::RequestLogHandler(const httplib::Request& req, const httplib::Response& res)
{
if (!req.path.empty()) {
std::vector<std::string> params;
for (auto& p : req.params) {
params.emplace_back(fmt::format("{}={}", p.first, p.second));
}
LogInfo(
"[API] Request [{}] [{}{}] via [{}:{}]",
res.status,
req.path,
(!params.empty() ? "?" + Strings::Join(params, "&") : ""),
req.remote_addr,
req.remote_port
);
}
}
void SidecarApi::TestController(const httplib::Request& req, httplib::Response& res)
{
nlohmann::json j;
j["data"]["test"] = "test";
res.set_content(j.dump(), "application/json");
}
void SidecarApi::MapBestZController(const httplib::Request& req, httplib::Response& res)
{
}
#include "log_handler.cpp"
#include "test_controller.cpp"
#include "map_best_z_controller.cpp"
#include "../../common/file.h"
constexpr static int HTTP_RESPONSE_OK = 200;

View File

@ -0,0 +1,10 @@
#include "sidecar_api.h"
void SidecarApi::TestController(const httplib::Request &req, httplib::Response &res)
{
nlohmann::json j;
j["data"]["test"] = "test";
res.set_content(j.dump(), "application/json");
}

View File

@ -39,3 +39,13 @@ void ZoneCLI::CommandHandler(int argc, char **argv)
EQEmuCommand::HandleMenu(function_map, cmd, argc, argv);
}
// cli
#include "cli/benchmark_databuckets.cpp"
#include "cli/sidecar_serve_http.cpp"
// tests
#include "cli/tests/_test_util.cpp"
#include "cli/tests/databuckets.cpp"
#include "cli/tests/npc_handins.cpp"
#include "cli/tests/npc_handins_multiquest.cpp"
#include "cli/tests/zone_state.cpp"