Compare commits

..

5 Commits

Author SHA1 Message Date
David Markowitz
c7d01dbb82 Merge branch 'main' into add-sqlite 2024-12-04 00:43:43 -08:00
David Markowitz
ec4ec2133b fix: logging uninitialized memory (#1658)
fixes an issue where the console would halt because we printed a control code which did such
2024-12-03 15:01:43 -06:00
David Markowitz
218a3f2d0d Update BaseFootRaceManager.cpp (#1657) 2024-11-27 16:26:10 -06:00
David Markowitz
9e242995e9 use SQLite types 2024-11-15 01:05:05 -08:00
David Markowitz
0aa1f70540 Use less specific matcher 2024-11-14 12:43:52 -08:00
41 changed files with 168 additions and 178 deletions

4
.gitignore vendored
View File

@@ -6,10 +6,6 @@ docker/configs
# Third party libraries # Third party libraries
thirdparty/mysql/ thirdparty/mysql/
thirdparty/mysql_linux/ thirdparty/mysql_linux/
thirdparty/backtrace/
thirdparty/magic_enum/
thirdparty/recastnavigation/
thirdparty/tinyxml2/
CMakeVariables.txt CMakeVariables.txt
# Build folders # Build folders

12
.gitmodules vendored
View File

@@ -1,7 +1,19 @@
[submodule "thirdparty/cpp-httplib"] [submodule "thirdparty/cpp-httplib"]
path = thirdparty/cpp-httplib path = thirdparty/cpp-httplib
url = https://github.com/yhirose/cpp-httplib url = https://github.com/yhirose/cpp-httplib
[submodule "thirdparty/tinyxml2"]
path = thirdparty/tinyxml2
url = https://github.com/leethomason/tinyxml2
[submodule "thirdparty/recastnavigation"]
path = thirdparty/recastnavigation
url = https://github.com/recastnavigation/recastnavigation
[submodule "thirdparty/libbcrypt"]
path = thirdparty/libbcrypt
url = https://github.com/trusch/libbcrypt.git
[submodule "thirdparty/mariadb-connector-cpp"] [submodule "thirdparty/mariadb-connector-cpp"]
path = thirdparty/mariadb-connector-cpp path = thirdparty/mariadb-connector-cpp
url = https://github.com/mariadb-corporation/mariadb-connector-cpp.git url = https://github.com/mariadb-corporation/mariadb-connector-cpp.git
ignore = dirty ignore = dirty
[submodule "thirdparty/magic_enum"]
path = thirdparty/magic_enum
url = https://github.com/Neargye/magic_enum.git

View File

@@ -109,53 +109,6 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
find_package(MariaDB) find_package(MariaDB)
# Fetch third party dependencies
set(DLU_THIRDPARTY_SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty)
include(FetchContent)
FetchContent_Declare(
backtrace
SYSTEM
SOURCE_DIR ${DLU_THIRDPARTY_SOURCE_DIR}/backtrace
GIT_REPOSITORY https://github.com/ianlancetaylor/libbacktrace.git
)
FetchContent_Declare(
bcrypt
SYSTEM
SOURCE_DIR ${DLU_THIRDPARTY_SOURCE_DIR}/libbcrypt
GIT_REPOSITORY https://github.com/trusch/libbcrypt.git
GIT_TAG d6523c370de6e724ce4ec703e2449b5b028ea3b1
)
FetchContent_Declare(
magic_enum
SYSTEM
SOURCE_DIR ${DLU_THIRDPARTY_SOURCE_DIR}/magic_enum
GIT_REPOSITORY https://github.com/Neargye/magic_enum.git
GIT_TAG v0.9.7
)
FetchContent_Declare(
Recast
SYSTEM
SOURCE_DIR ${DLU_THIRDPARTY_SOURCE_DIR}/recastnavigation
GIT_REPOSITORY https://github.com/recastnavigation/recastnavigation.git
GIT_TAG v1.6.0
)
FetchContent_Declare(
tinyxml2
SYSTEM
SOURCE_DIR ${DLU_THIRDPARTY_SOURCE_DIR}/tinyxml2
GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git
GIT_TAG 9.0.0
)
FetchContent_MakeAvailable(magic_enum Recast tinyxml2)
# Turn off tinyxml2 testing
set(tinyxml2_BUILD_TESTING OFF)
include(CMakePrintHelpers)
cmake_print_properties(TARGETS magic_enum Recast tinyxml2 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES)
# Create a /resServer directory # Create a /resServer directory
make_directory(${CMAKE_BINARY_DIR}/resServer) make_directory(${CMAKE_BINARY_DIR}/resServer)
@@ -298,7 +251,10 @@ include_directories(
"tests/dGameTests/dComponentsTests" "tests/dGameTests/dComponentsTests"
SYSTEM SYSTEM
"thirdparty/magic_enum/include/magic_enum"
"thirdparty/raknet/Source" "thirdparty/raknet/Source"
"thirdparty/tinyxml2"
"thirdparty/recastnavigation"
"thirdparty/SQLite" "thirdparty/SQLite"
"thirdparty/cpplinq" "thirdparty/cpplinq"
"thirdparty/cpp-httplib" "thirdparty/cpp-httplib"
@@ -316,7 +272,7 @@ if(MSVC)
# add_compile_options("/W4") # add_compile_options("/W4")
# Want to enable warnings eventually, but WAY too much noise right now # Want to enable warnings eventually, but WAY too much noise right now
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
add_compile_options("-Wuninitialized" "-Wold-style-cast" "-Wstrict-aliasing") add_compile_options("-Wuninitialized" "-Wold-style-cast")
else() else()
message(WARNING "Unknown compiler: '${CMAKE_CXX_COMPILER_ID}' - No warning flags enabled.") message(WARNING "Unknown compiler: '${CMAKE_CXX_COMPILER_ID}' - No warning flags enabled.")
endif() endif()
@@ -385,7 +341,7 @@ target_precompile_headers(
target_precompile_headers( target_precompile_headers(
tinyxml2 PRIVATE tinyxml2 PRIVATE
"$<$<COMPILE_LANGUAGE:CXX>:${tinyxml2_SOURCE_DIR}/tinyxml2.h>" "$<$<COMPILE_LANGUAGE:CXX>:${PROJECT_SOURCE_DIR}/thirdparty/tinyxml2/tinyxml2.h>"
) )
if(${ENABLE_TESTING}) if(${ENABLE_TESTING})

View File

@@ -70,6 +70,5 @@ else ()
endif () endif ()
target_link_libraries(dCommon target_link_libraries(dCommon
PUBLIC magic_enum
PRIVATE ZLIB::ZLIB bcrypt tinyxml2 PRIVATE ZLIB::ZLIB bcrypt tinyxml2
INTERFACE dDatabase) INTERFACE dDatabase)

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <magic_enum/magic_enum.hpp> #include "magic_enum.hpp"
namespace MessageType { namespace MessageType {
enum class Game : uint16_t { enum class Game : uint16_t {

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <magic_enum/magic_enum.hpp> #include "magic_enum.hpp"
namespace MessageType { namespace MessageType {
enum class World : uint32_t { enum class World : uint32_t {

View File

@@ -2,7 +2,7 @@
#define __STRINGIFIEDENUM_H__ #define __STRINGIFIEDENUM_H__
#include <string> #include <string>
#include <magic_enum/magic_enum.hpp> #include "magic_enum.hpp"
namespace StringifiedEnum { namespace StringifiedEnum {
template<typename T> template<typename T>

View File

@@ -4,7 +4,8 @@
#define __EINVENTORYTYPE__H__ #define __EINVENTORYTYPE__H__
#include <cstdint> #include <cstdint>
#include <magic_enum/magic_enum.hpp>
#include "magic_enum.hpp"
static const uint8_t NUMBER_OF_INVENTORIES = 17; static const uint8_t NUMBER_OF_INVENTORIES = 17;
/** /**

View File

@@ -4,4 +4,4 @@ add_subdirectory(GameDatabase)
add_library(dDatabase STATIC "MigrationRunner.cpp") add_library(dDatabase STATIC "MigrationRunner.cpp")
target_include_directories(dDatabase PUBLIC ".") target_include_directories(dDatabase PUBLIC ".")
target_link_libraries(dDatabase target_link_libraries(dDatabase
PUBLIC magic_enum dDatabaseCDClient dDatabaseGame) PUBLIC dDatabaseCDClient dDatabaseGame)

View File

@@ -505,7 +505,6 @@ void EntityManager::UpdateGhosting(Entity* player) {
if (collectionId != 0) { if (collectionId != 0) {
collectionId = static_cast<uint32_t>(collectionId) + static_cast<uint32_t>(Game::server->GetZoneID() << 8); collectionId = static_cast<uint32_t>(collectionId) + static_cast<uint32_t>(Game::server->GetZoneID() << 8);
if (missionComponent->HasCollectible(collectionId)) { if (missionComponent->HasCollectible(collectionId)) {
continue; continue;
} }

View File

@@ -55,7 +55,7 @@ set(DGAME_DBEHAVIORS_SOURCES "AirMovementBehavior.cpp"
"VerifyBehavior.cpp") "VerifyBehavior.cpp")
add_library(dBehaviors OBJECT ${DGAME_DBEHAVIORS_SOURCES}) add_library(dBehaviors OBJECT ${DGAME_DBEHAVIORS_SOURCES})
target_link_libraries(dBehaviors PUBLIC dDatabaseCDClient dPhysics magic_enum tinyxml2) target_link_libraries(dBehaviors PUBLIC dDatabaseCDClient dPhysics)
target_include_directories(dBehaviors PUBLIC "." target_include_directories(dBehaviors PUBLIC "."
"${PROJECT_SOURCE_DIR}/dGame/dGameMessages" # via BehaviorContext.h "${PROJECT_SOURCE_DIR}/dGame/dGameMessages" # via BehaviorContext.h
PRIVATE PRIVATE

View File

@@ -79,4 +79,4 @@ target_include_directories(dComponents PUBLIC "."
) )
target_precompile_headers(dComponents REUSE_FROM dGameBase) target_precompile_headers(dComponents REUSE_FROM dGameBase)
target_link_libraries(dComponents PUBLIC magic_enum tinyxml2 INTERFACE dBehaviors) target_link_libraries(dComponents INTERFACE dBehaviors)

View File

@@ -6,7 +6,7 @@ set(DGAME_DGAMEMESSAGES_SOURCES
add_library(dGameMessages OBJECT ${DGAME_DGAMEMESSAGES_SOURCES}) add_library(dGameMessages OBJECT ${DGAME_DGAMEMESSAGES_SOURCES})
target_link_libraries(dGameMessages target_link_libraries(dGameMessages
PUBLIC magic_enum tinyxml2 dDatabase PUBLIC dDatabase
INTERFACE dGameBase # TradingManager INTERFACE dGameBase # TradingManager
) )
target_include_directories(dGameMessages PUBLIC "." target_include_directories(dGameMessages PUBLIC "."

View File

@@ -24,7 +24,6 @@ target_include_directories(dInventory PUBLIC "."
"${PROJECT_SOURCE_DIR}/dGame/dMission" # via MissionComponent.h "${PROJECT_SOURCE_DIR}/dGame/dMission" # via MissionComponent.h
"${PROJECT_SOURCE_DIR}/dZoneManager" # via Item.cpp "${PROJECT_SOURCE_DIR}/dZoneManager" # via Item.cpp
) )
target_link_libraries(dInventory PUBLIC magic_enum tinyxml2)
target_precompile_headers(dInventory REUSE_FROM dGameBase) target_precompile_headers(dInventory REUSE_FROM dGameBase)
# Workaround for compiler bug where the optimized code could result in a memcpy of 0 bytes, even though that isnt possible. # Workaround for compiler bug where the optimized code could result in a memcpy of 0 bytes, even though that isnt possible.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97185 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97185

View File

@@ -4,7 +4,7 @@ set(DGAME_DMISSION_SOURCES
"MissionTask.cpp") "MissionTask.cpp")
add_library(dMission OBJECT ${DGAME_DMISSION_SOURCES}) add_library(dMission OBJECT ${DGAME_DMISSION_SOURCES})
target_link_libraries(dMission PUBLIC tinyxml2 dDatabase) target_link_libraries(dMission PUBLIC dDatabase)
target_include_directories(dMission PUBLIC "." target_include_directories(dMission PUBLIC "."
PRIVATE PRIVATE
"${PROJECT_SOURCE_DIR}/dGame/dComponents" "${PROJECT_SOURCE_DIR}/dGame/dComponents"

View File

@@ -13,7 +13,7 @@ foreach(file ${DGAME_DPROPERTYBEHAVIORS_CONTROLBEHAVIORMESSAGES})
endforeach() endforeach()
add_library(dPropertyBehaviors OBJECT ${DGAME_DPROPERTYBEHAVIORS_SOURCES}) add_library(dPropertyBehaviors OBJECT ${DGAME_DPROPERTYBEHAVIORS_SOURCES})
target_link_libraries(dPropertyBehaviors PUBLIC tinyxml2 PRIVATE dDatabaseCDClient) target_link_libraries(dPropertyBehaviors PRIVATE dDatabaseCDClient)
target_include_directories(dPropertyBehaviors PUBLIC "." "ControlBehaviorMessages" target_include_directories(dPropertyBehaviors PUBLIC "." "ControlBehaviorMessages"
PRIVATE PRIVATE
"${PROJECT_SOURCE_DIR}/dCommon/dClient" # ControlBehaviors.cpp uses AssetManager "${PROJECT_SOURCE_DIR}/dCommon/dClient" # ControlBehaviors.cpp uses AssetManager

View File

@@ -14,4 +14,4 @@ target_include_directories(dNavigation PUBLIC "."
"${PROJECT_SOURCE_DIR}/dGame/dEntity" "${PROJECT_SOURCE_DIR}/dGame/dEntity"
"${PROJECT_SOURCE_DIR}/dNavigation/dTerrain" # via dNavMesh.cpp "${PROJECT_SOURCE_DIR}/dNavigation/dTerrain" # via dNavMesh.cpp
) )
target_link_libraries(dNavigation PUBLIC tinyxml2 PRIVATE Detour Recast dCommon) target_link_libraries(dNavigation PRIVATE Detour Recast dCommon)

View File

@@ -87,6 +87,13 @@ void AuthPackets::SendHandshake(dServer* server, const SystemAddress& sysAddr, c
server->Send(bitStream, sysAddr, false); server->Send(bitStream, sysAddr, false);
} }
std::string CleanReceivedString(const std::string& str) {
std::string toReturn = str;
const auto removed = std::ranges::find_if(toReturn, [](char c) { return isprint(c) == 0 && isblank(c) == 0; });
toReturn.erase(removed, toReturn.end());
return toReturn;
}
void AuthPackets::HandleLoginRequest(dServer* server, Packet* packet) { void AuthPackets::HandleLoginRequest(dServer* server, Packet* packet) {
CINSTREAM_SKIP_HEADER; CINSTREAM_SKIP_HEADER;
@@ -111,11 +118,11 @@ void AuthPackets::HandleLoginRequest(dServer* server, Packet* packet) {
LUWString memoryStats(256); LUWString memoryStats(256);
inStream.Read(memoryStats); inStream.Read(memoryStats);
LOG_DEBUG("Memory Stats [%s]", memoryStats.GetAsString().c_str()); LOG_DEBUG("Memory Stats [%s]", CleanReceivedString(memoryStats.GetAsString()).c_str());
LUWString videoCard(128); LUWString videoCard(128);
inStream.Read(videoCard); inStream.Read(videoCard);
LOG_DEBUG("VideoCard Info: [%s]", videoCard.GetAsString().c_str()); LOG_DEBUG("VideoCard Info: [%s]", CleanReceivedString(videoCard.GetAsString()).c_str());
// Processor/CPU info // Processor/CPU info
uint32_t numOfProcessors; uint32_t numOfProcessors;

View File

@@ -4,7 +4,7 @@
#define _VARIADIC_MAX 10 #define _VARIADIC_MAX 10
#include "dCommonVars.h" #include "dCommonVars.h"
#include "dNetCommon.h" #include "dNetCommon.h"
#include <magic_enum/magic_enum.hpp> #include "magic_enum.hpp"
enum class ServerType : uint32_t; enum class ServerType : uint32_t;
enum class eLoginResponse : uint8_t; enum class eLoginResponse : uint8_t;

View File

@@ -8,7 +8,7 @@ set(DNET_SOURCES "AuthPackets.cpp"
"ZoneInstanceManager.cpp") "ZoneInstanceManager.cpp")
add_library(dNet STATIC ${DNET_SOURCES}) add_library(dNet STATIC ${DNET_SOURCES})
target_link_libraries(dNet PUBLIC magic_enum PRIVATE bcrypt MD5) target_link_libraries(dNet PRIVATE bcrypt MD5)
target_include_directories(dNet PRIVATE target_include_directories(dNet PRIVATE
"${PROJECT_SOURCE_DIR}/dCommon" "${PROJECT_SOURCE_DIR}/dCommon"
"${PROJECT_SOURCE_DIR}/dCommon/dEnums" "${PROJECT_SOURCE_DIR}/dCommon/dEnums"

View File

@@ -12,7 +12,10 @@ void BaseFootRaceManager::OnFireEventServerSide(Entity* self, Entity* sender, st
if (splitArguments.size() > 1) { if (splitArguments.size() > 1) {
const auto eventName = splitArguments[0]; const auto eventName = splitArguments[0];
const auto player = Game::entityManager->GetEntity(std::stoull(splitArguments[1])); auto playerId = GeneralUtils::TryParse<LWOOBJID>(splitArguments[1]);
if (!playerId) return;
const auto player = Game::entityManager->GetEntity(playerId.value());
if (player != nullptr) { if (player != nullptr) {
if (eventName == "updatePlayer") { if (eventName == "updatePlayer") {

View File

@@ -13,7 +13,7 @@ target_include_directories(WorldServer PRIVATE
"${PROJECT_SOURCE_DIR}/dServer" # BinaryPathFinder.h "${PROJECT_SOURCE_DIR}/dServer" # BinaryPathFinder.h
) )
target_link_libraries(WorldServer PUBLIC ${COMMON_LIBRARIES} target_link_libraries(WorldServer ${COMMON_LIBRARIES}
dScripts dScripts
dGameBase dGameBase
dComponents dComponents

View File

@@ -1,152 +1,152 @@
CREATE TABLE IF NOT EXISTS accounts ( CREATE TABLE IF NOT EXISTS accounts (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(35) NOT NULL UNIQUE, name TEXT NOT NULL UNIQUE,
password TEXT NOT NULL, password TEXT NOT NULL,
gm_level INT UNSIGNED NOT NULL DEFAULT 0, gm_level BIGINT NOT NULL DEFAULT 0,
locked BOOLEAN NOT NULL DEFAULT FALSE, locked INTEGER NOT NULL DEFAULT FALSE,
banned BOOLEAN NOT NULL DEFAULT FALSE, banned INTEGER NOT NULL DEFAULT FALSE,
play_key_id INT NOT NULL DEFAULT 0, play_key_id INTEGER NOT NULL DEFAULT 0,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(), created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(),
mute_expire BIGINT UNSIGNED NOT NULL DEFAULT 0 mute_expire BIGINT NOT NULL DEFAULT 0
); );
CREATE TABLE IF NOT EXISTS charinfo ( CREATE TABLE IF NOT EXISTS charinfo (
id BIGINT NOT NULL PRIMARY KEY, id BIGINT NOT NULL PRIMARY KEY,
account_id INT NOT NULL REFERENCES accounts(id), account_id INTEGER NOT NULL REFERENCES accounts(id),
name VARCHAR(35) NOT NULL, name TEXT NOT NULL,
pending_name VARCHAR(35) NOT NULL, pending_name TEXT NOT NULL,
needs_rename BOOLEAN NOT NULL DEFAULT FALSE, needs_rename INTEGER NOT NULL DEFAULT FALSE,
prop_clone_id BIGINT UNSIGNED AUTO_INCREMENT UNIQUE, prop_clone_id BIGINT AUTO_INCREMENT UNIQUE,
last_login BIGINT UNSIGNED NOT NULL DEFAULT 0, last_login BIGINT NOT NULL DEFAULT 0,
permission_map BIGINT UNSIGNED NOT NULL DEFAULT 0 permission_map BIGINT NOT NULL DEFAULT 0
); );
CREATE TABLE IF NOT EXISTS charxml ( CREATE TABLE IF NOT EXISTS charxml (
id BIGINT NOT NULL PRIMARY KEY REFERENCES charinfo(id), id BIGINT NOT NULL PRIMARY KEY REFERENCES charinfo(id),
xml_data LONGTEXT NOT NULL xml_data TEXT NOT NULL
); );
CREATE TABLE IF NOT EXISTS command_log ( CREATE TABLE IF NOT EXISTS command_log (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
character_id BIGINT NOT NULL REFERENCES charinfo(id), character_id BIGINT NOT NULL REFERENCES charinfo(id),
command VARCHAR(256) NOT NULL command TEXT NOT NULL
); );
CREATE TABLE IF NOT EXISTS friends ( CREATE TABLE IF NOT EXISTS friends (
player_id BIGINT NOT NULL REFERENCES charinfo(id), player_id BIGINT NOT NULL REFERENCES charinfo(id),
friend_id BIGINT NOT NULL REFERENCES charinfo(id), friend_id BIGINT NOT NULL REFERENCES charinfo(id),
best_friend BOOLEAN NOT NULL DEFAULT FALSE, best_friend INTEGER NOT NULL DEFAULT FALSE,
PRIMARY KEY (player_id, friend_id) PRIMARY KEY (player_id, friend_id)
); );
CREATE TABLE IF NOT EXISTS leaderboard ( CREATE TABLE IF NOT EXISTS leaderboard (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
game_id INT UNSIGNED NOT NULL DEFAULT 0, game_id INTEGER NOT NULL DEFAULT 0,
last_played TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(), last_played DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(),
character_id BIGINT NOT NULL REFERENCES charinfo(id), character_id BIGINT NOT NULL REFERENCES charinfo(id),
time BIGINT UNSIGNED NOT NULL, time BIGINT NOT NULL,
score BIGINT UNSIGNED NOT NULL DEFAULT 0 score BIGINT NOT NULL DEFAULT 0
); );
CREATE TABLE IF NOT EXISTS mail ( CREATE TABLE IF NOT EXISTS mail (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
sender_id INT NOT NULL DEFAULT 0, sender_id INTEGER NOT NULL DEFAULT 0,
sender_name VARCHAR(35) NOT NULL DEFAULT '', sender_name TEXT NOT NULL DEFAULT '',
receiver_id BIGINT NOT NULL REFERENCES charinfo(id), receiver_id BIGINT NOT NULL REFERENCES charinfo(id),
receiver_name VARCHAR(35) NOT NULL, receiver_name TEXT NOT NULL,
time_sent BIGINT UNSIGNED NOT NULL, time_sent BIGINT NOT NULL,
subject TEXT NOT NULL, subject TEXT NOT NULL,
body TEXT NOT NULL, body TEXT NOT NULL,
attachment_id BIGINT NOT NULL DEFAULT 0, attachment_id BIGINT NOT NULL DEFAULT 0,
attachment_lot INT NOT NULL DEFAULT 0, attachment_lot INTEGER NOT NULL DEFAULT 0,
attachment_subkey BIGINT NOT NULL DEFAULT 0, attachment_subkey BIGINT NOT NULL DEFAULT 0,
attachment_count INT NOT NULL DEFAULT 0, attachment_count INTEGER NOT NULL DEFAULT 0,
was_read BOOLEAN NOT NULL DEFAULT FALSE was_read INTEGER NOT NULL DEFAULT FALSE
); );
CREATE TABLE IF NOT EXISTS object_id_tracker ( CREATE TABLE IF NOT EXISTS object_id_tracker (
last_object_id BIGINT UNSIGNED NOT NULL DEFAULT 0 PRIMARY KEY last_object_id BIGINT NOT NULL DEFAULT 0 PRIMARY KEY
); );
CREATE TABLE IF NOT EXISTS pet_names ( CREATE TABLE IF NOT EXISTS pet_names (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
pet_name TEXT NOT NULL, pet_name TEXT NOT NULL,
approved INT UNSIGNED NOT NULL approved INTEGER NOT NULL
); );
CREATE TABLE IF NOT EXISTS play_keys ( CREATE TABLE IF NOT EXISTS play_keys (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
key_string CHAR(19) NOT NULL UNIQUE, key_string TEXT NOT NULL UNIQUE,
key_uses INT NOT NULL DEFAULT 1, key_uses INTEGER NOT NULL DEFAULT 1,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(), created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(),
active BOOLEAN NOT NULL DEFAULT TRUE active INTEGER NOT NULL DEFAULT TRUE
); );
CREATE TABLE IF NOT EXISTS properties ( CREATE TABLE IF NOT EXISTS properties (
id BIGINT NOT NULL PRIMARY KEY, id BIGINT NOT NULL PRIMARY KEY,
owner_id BIGINT NOT NULL REFERENCES charinfo(id), owner_id BIGINT NOT NULL REFERENCES charinfo(id),
template_id INT UNSIGNED NOT NULL, template_id INTEGER NOT NULL,
clone_id BIGINT UNSIGNED REFERENCES charinfo(prop_clone_id), clone_id BIGINT REFERENCES charinfo(prop_clone_id),
name TEXT NOT NULL, name TEXT NOT NULL,
description TEXT NOT NULL, description TEXT NOT NULL,
rent_amount INT NOT NULL, rent_amount INTEGER NOT NULL,
rent_due BIGINT NOT NULL, rent_due BIGINT NOT NULL,
privacy_option INT NOT NULL, privacy_option INTEGER NOT NULL,
mod_approved BOOLEAN NOT NULL DEFAULT FALSE, mod_approved INTEGER NOT NULL DEFAULT FALSE,
last_updated BIGINT NOT NULL, last_updated BIGINT NOT NULL,
time_claimed BIGINT NOT NULL, time_claimed BIGINT NOT NULL,
rejection_reason TEXT NOT NULL, rejection_reason TEXT NOT NULL,
reputation BIGINT UNSIGNED NOT NULL, reputation BIGINT NOT NULL,
zone_id INT NOT NULL zone_id INTEGER NOT NULL
); );
CREATE TABLE IF NOT EXISTS ugc ( CREATE TABLE IF NOT EXISTS ugc (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
account_id INT NOT NULL REFERENCES accounts(id), account_id INTEGER NOT NULL REFERENCES accounts(id),
character_id BIGINT NOT NULL REFERENCES charinfo(id), character_id BIGINT NOT NULL REFERENCES charinfo(id),
is_optimized BOOLEAN NOT NULL DEFAULT FALSE, is_optimized INTEGER NOT NULL DEFAULT FALSE,
lxfml MEDIUMBLOB NOT NULL, lxfml BLOB NOT NULL,
bake_ao BOOLEAN NOT NULL DEFAULT FALSE, bake_ao INTEGER NOT NULL DEFAULT FALSE,
filename TEXT NOT NULL DEFAULT ('') filename TEXT NOT NULL DEFAULT ('')
); );
CREATE TABLE IF NOT EXISTS properties_contents ( CREATE TABLE IF NOT EXISTS properties_contents (
id BIGINT NOT NULL PRIMARY KEY, id BIGINT NOT NULL PRIMARY KEY,
property_id BIGINT NOT NULL REFERENCES properties(id), property_id BIGINT NOT NULL REFERENCES properties(id),
ugc_id INT NULL REFERENCES ugc(id), ugc_id INTEGER NULL REFERENCES ugc(id),
lot INT NOT NULL, lot INTEGER NOT NULL,
x FLOAT NOT NULL, x DOUBLE NOT NULL,
y FLOAT NOT NULL, y DOUBLE NOT NULL,
z FLOAT NOT NULL, z DOUBLE NOT NULL,
rx FLOAT NOT NULL, rx DOUBLE NOT NULL,
ry FLOAT NOT NULL, ry DOUBLE NOT NULL,
rz FLOAT NOT NULL, rz DOUBLE NOT NULL,
rw FLOAT NOT NULL rw DOUBLE NOT NULL
); );
CREATE TABLE IF NOT EXISTS activity_log ( CREATE TABLE IF NOT EXISTS activity_log (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
character_id BIGINT NOT NULL REFERENCES charinfo(id), character_id BIGINT NOT NULL REFERENCES charinfo(id),
activity INT NOT NULL, activity INTEGER NOT NULL,
time BIGINT UNSIGNED NOT NULL, time BIGINT NOT NULL,
map_id INT NOT NULL map_id INTEGER NOT NULL
); );
CREATE TABLE IF NOT EXISTS bug_reports ( CREATE TABLE IF NOT EXISTS bug_reports (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
body TEXT NOT NULL, body TEXT NOT NULL,
client_version TEXT NOT NULL, client_version TEXT NOT NULL,
other_player_id TEXT NOT NULL, other_player_id TEXT NOT NULL,
selection TEXT NOT NULL, selection TEXT NOT NULL,
submitted TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP() submitted DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP()
); );
CREATE TABLE IF NOT EXISTS servers ( CREATE TABLE IF NOT EXISTS servers (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
name TEXT NOT NULL, name TEXT NOT NULL,
ip TEXT NOT NULL, ip TEXT NOT NULL,
port INT NOT NULL, port INTEGER NOT NULL,
state INT NOT NULL, state INTEGER NOT NULL,
version INT NOT NULL DEFAULT 0 version INTEGER NOT NULL DEFAULT 0
); );

View File

@@ -1,8 +1,8 @@
CREATE TABLE IF NOT EXISTS player_cheat_detections ( CREATE TABLE IF NOT EXISTS player_cheat_detections (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
account_id INT REFERENCES accounts(id), account_id INTEGER REFERENCES accounts(id),
name TEXT REFERENCES charinfo(name), name TEXT REFERENCES charinfo(name),
violation_msg TEXT NOT NULL, violation_msg TEXT NOT NULL,
violation_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(), violation_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(),
violation_system_address TEXT NOT NULL violation_system_address TEXT NOT NULL
); );

View File

@@ -1,9 +1,9 @@
DROP TABLE IF EXISTS `player_cheat_detections`; DROP TABLE IF EXISTS `player_cheat_detections`;
CREATE TABLE IF NOT EXISTS player_cheat_detections ( CREATE TABLE IF NOT EXISTS player_cheat_detections (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
account_id INT REFERENCES accounts(id), account_id INTEGER REFERENCES accounts(id),
name TEXT NOT NULL, name TEXT NOT NULL,
violation_msg TEXT NOT NULL, violation_msg TEXT NOT NULL,
violation_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(), violation_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(),
violation_system_address TEXT NOT NULL violation_system_address TEXT NOT NULL
); );

View File

@@ -1,5 +1,5 @@
CREATE TABLE IF NOT EXISTS accounts_rewardcodes ( CREATE TABLE IF NOT EXISTS accounts_rewardcodes (
account_id INT NOT NULL REFERENCES accounts(id) ON DELETE CASCADE, account_id INTEGER NOT NULL REFERENCES accounts(id) ON DELETE CASCADE,
rewardcode INT NOT NULL, rewardcode INTEGER NOT NULL,
PRIMARY KEY (account_id, rewardcode) PRIMARY KEY (account_id, rewardcode)
); );

View File

@@ -1 +1 @@
ALTER TABLE behaviors MODIFY behavior_info LONGTEXT DEFAULT NULL; ALTER TABLE behaviors MODIFY behavior_info TEXT DEFAULT NULL;

View File

@@ -1 +1 @@
ALTER TABLE bug_reports ADD reporter_id INT NOT NULL DEFAULT 0; ALTER TABLE bug_reports ADD reporter_id INTEGER NOT NULL DEFAULT 0;

View File

@@ -1 +1 @@
ALTER TABLE properties ADD COLUMN performance_cost DOUBLE(20, 15) DEFAULT 0.0; ALTER TABLE properties ADD COLUMN performance_cost DOUBLE DEFAULT 0.0;

View File

@@ -1,11 +1,11 @@
ALTER TABLE properties_contents ALTER TABLE properties_contents
ADD COLUMN model_name TEXT NOT NULL DEFAULT "", ADD COLUMN model_name TEXT NOT NULL DEFAULT "",
ADD COLUMN model_description TEXT NOT NULL DEFAULT "", ADD COLUMN model_description TEXT NOT NULL DEFAULT "",
ADD COLUMN behavior_1 INT NOT NULL DEFAULT 0, ADD COLUMN behavior_1 INTEGER NOT NULL DEFAULT 0,
ADD COLUMN behavior_2 INT NOT NULL DEFAULT 0, ADD COLUMN behavior_2 INTEGER NOT NULL DEFAULT 0,
ADD COLUMN behavior_3 INT NOT NULL DEFAULT 0, ADD COLUMN behavior_3 INTEGER NOT NULL DEFAULT 0,
ADD COLUMN behavior_4 INT NOT NULL DEFAULT 0, ADD COLUMN behavior_4 INTEGER NOT NULL DEFAULT 0,
ADD COLUMN behavior_5 INT NOT NULL DEFAULT 0; ADD COLUMN behavior_5 INTEGER NOT NULL DEFAULT 0;
UPDATE properties_contents SET model_name = CONCAT("Objects_", lot, "_name") WHERE model_name = ""; UPDATE properties_contents SET model_name = CONCAT("Objects_", lot, "_name") WHERE model_name = "";
CREATE TABLE IF NOT EXISTS behaviors (id INT NOT NULL, behavior_info TEXT NOT NULL); CREATE TABLE IF NOT EXISTS behaviors (id INTEGER NOT NULL, behavior_info TEXT NOT NULL);

View File

@@ -1 +1 @@
ALTER TABLE accounts MODIFY play_key_id INT DEFAULT 0; ALTER TABLE accounts MODIFY play_key_id INTEGER DEFAULT 0;

View File

@@ -1 +1 @@
ALTER TABLE accounts MODIFY play_key_id INT DEFAULT NULL; ALTER TABLE accounts MODIFY play_key_id INTEGER DEFAULT NULL;

View File

@@ -1,12 +1,12 @@
ALTER TABLE leaderboard ALTER TABLE leaderboard
ADD COLUMN tertiaryScore FLOAT NOT NULL DEFAULT 0, ADD COLUMN tertiaryScore DOUBLE NOT NULL DEFAULT 0,
ADD COLUMN numWins INT NOT NULL DEFAULT 0, ADD COLUMN numWins INTEGER NOT NULL DEFAULT 0,
ADD COLUMN timesPlayed INT NOT NULL DEFAULT 1, ADD COLUMN timesPlayed INTEGER NOT NULL DEFAULT 1,
MODIFY time INT NOT NULL DEFAULT 0; MODIFY time INTEGER NOT NULL DEFAULT 0;
/* Can only ALTER one column at a time... */ /* Can only ALTER one column at a time... */
ALTER TABLE leaderboard CHANGE score primaryScore FLOAT NOT NULL DEFAULT 0; ALTER TABLE leaderboard CHANGE score primaryScore DOUBLE NOT NULL DEFAULT 0;
ALTER TABLE leaderboard CHANGE time secondaryScore FLOAT NOT NULL DEFAULT 0 AFTER primaryScore; ALTER TABLE leaderboard CHANGE time secondaryScore DOUBLE NOT NULL DEFAULT 0 AFTER primaryScore;
/* A bit messy, but better than going through a bunch of code fixes all to be run once. */ /* A bit messy, but better than going through a bunch of code fixes all to be run once. */
UPDATE leaderboard SET UPDATE leaderboard SET
@@ -15,4 +15,4 @@ UPDATE leaderboard SET
/* Do this last so we dont update entry times erroneously */ /* Do this last so we dont update entry times erroneously */
ALTER TABLE leaderboard ALTER TABLE leaderboard
CHANGE last_played last_played TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP(); CHANGE last_played last_played DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP();

View File

@@ -32,7 +32,7 @@ add_custom_command(TARGET dCommonTests POST_BUILD
endif() endif()
# Link needed libraries # Link needed libraries
target_link_libraries(dCommonTests ${COMMON_LIBRARIES} GTest::gtest_main magic_enum) target_link_libraries(dCommonTests ${COMMON_LIBRARIES} GTest::gtest_main)
# Copy test files to testing directory # Copy test files to testing directory
add_subdirectory(TestBitStreams) add_subdirectory(TestBitStreams)

View File

@@ -8,7 +8,7 @@
#include "Game.h" #include "Game.h"
#include "MessageType/Game.h" #include "MessageType/Game.h"
#include "MessageType/World.h" #include "MessageType/World.h"
#include <magic_enum/magic_enum.hpp> #include "magic_enum.hpp"
#define ENUM_EQ(e, y, z)\ #define ENUM_EQ(e, y, z)\
LOG("%s %s", StringifiedEnum::ToString(static_cast<e>(y)).data(), #z);\ LOG("%s %s", StringifiedEnum::ToString(static_cast<e>(y)).data(), #z);\

View File

@@ -23,7 +23,7 @@ add_custom_command(TARGET dGameTests POST_BUILD
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif() endif()
target_link_libraries(dGameTests ${COMMON_LIBRARIES} magic_enum GTest::gtest_main target_link_libraries(dGameTests ${COMMON_LIBRARIES} GTest::gtest_main
dGame dScripts dPhysics Detour Recast tinyxml2 dWorldServer dZoneManager dChatFilter dNavigation) dGame dScripts dPhysics Detour Recast tinyxml2 dWorldServer dZoneManager dChatFilter dNavigation)
# Discover the tests # Discover the tests

View File

@@ -1,12 +1,17 @@
# Source Code for recast # Source Code for recast
# add_subdirectory(recastnavigation) add_subdirectory(recastnavigation)
# Turn off tinyxml2 testing
set(tinyxml2_BUILD_TESTING OFF)
# Source Code for tinyxml2
add_subdirectory(tinyxml2)
# Source Code for libbcrypt. Uses a file glob instead to get around Windows build issues. # Source Code for libbcrypt. Uses a file glob instead to get around Windows build issues.
file( file(
GLOB SOURCES_LIBBCRYPT GLOB SOURCES_LIBBCRYPT
LIST_DIRECTORIES false LIST_DIRECTORIES false
RELATIVE "${DLU_THIRDPARTY_SOURCE_DIR}" RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${DLU_THIRDPARTY_SOURCE_DIR}/libbcrypt/src/*.c ${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/src/*.c
) )
add_library(bcrypt ${SOURCES_LIBBCRYPT}) add_library(bcrypt ${SOURCES_LIBBCRYPT})
@@ -29,12 +34,21 @@ target_include_directories(bcrypt PRIVATE "libbcrypt/src")
# Source code for sqlite # Source code for sqlite
add_subdirectory(SQLite) add_subdirectory(SQLite)
# Source code for magic_enum
add_subdirectory(magic_enum)
# Create our third party library objects # Create our third party library objects
add_subdirectory(raknet) add_subdirectory(raknet)
# Download Backtrace if configured # Download Backtrace if configured
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
include(FetchContent)
if (${INCLUDE_BACKTRACE} AND ${COMPILE_BACKTRACE}) if (${INCLUDE_BACKTRACE} AND ${COMPILE_BACKTRACE})
FetchContent_Declare(
backtrace
GIT_REPOSITORY https://github.com/ianlancetaylor/libbacktrace.git
)
FetchContent_MakeAvailable(backtrace) FetchContent_MakeAvailable(backtrace)
if (NOT EXISTS ${backtrace_SOURCE_DIR}/.libs) if (NOT EXISTS ${backtrace_SOURCE_DIR}/.libs)

1
thirdparty/libbcrypt vendored Submodule

Submodule thirdparty/libbcrypt added at d6523c370d

1
thirdparty/magic_enum vendored Submodule

Submodule thirdparty/magic_enum added at e55b9b54d5

1
thirdparty/recastnavigation vendored Submodule

1
thirdparty/tinyxml2 vendored Submodule

Submodule thirdparty/tinyxml2 added at a977397684