mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-17 03:37:08 -06:00
Compare commits
150 Commits
v2.2.0
...
fix-includ
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9655f0ee45 | ||
|
|
bfe6900c26 | ||
|
|
0d218fc5c7 | ||
|
|
102e3556cf | ||
|
|
33a8efdd22 | ||
|
|
8d54db7851 | ||
|
|
6213aed8e5 | ||
|
|
d57c5101f4 | ||
|
|
6be65569de | ||
|
|
94b9731a2b | ||
|
|
aaf446fe6e | ||
|
|
2c70f1503c | ||
|
|
49b4748ed3 | ||
|
|
ffeb0108d0 | ||
|
|
c3f6ef5a1d | ||
|
|
999995b2fb | ||
|
|
84fff7c380 | ||
|
|
59c4b35479 | ||
|
|
f2d72e7ed5 | ||
|
|
b648b43c4d | ||
|
|
2628470482 | ||
|
|
f82a82f254 | ||
|
|
9400ee1dc0 | ||
|
|
54b8c25754 | ||
|
|
b984cd6a0b | ||
|
|
bcf1058759 | ||
|
|
6ad6e930c7 | ||
|
|
fee0238e79 | ||
|
|
1454fcd003 | ||
|
|
af651f0d63 | ||
| ff38503597 | |||
| 3f22bf5cc0 | |||
| 9d5d2a68ee | |||
| 1a14c29c39 | |||
| 2ef45bd7ee | |||
| b56d077892 | |||
|
|
a54600b41e | ||
|
|
342da927f5 | ||
|
|
01086d05c8 | ||
|
|
cce5755366 | ||
|
|
e966d3a644 | ||
|
|
9328021339 | ||
|
|
d1134fdd62 | ||
|
|
efa658bc31 | ||
|
|
e59525d2ae | ||
|
|
0348db72a5 | ||
|
|
debc2a96e2 | ||
| 86f335d64b | |||
| 8ca05241f2 | |||
|
|
8ae1a8ff7c | ||
|
|
f0960d48b2 | ||
|
|
dc430d9758 | ||
|
|
dea10c6d56 | ||
|
|
ed00551982 | ||
|
|
d6cac65a8d | ||
|
|
d8f079cb1b | ||
|
|
db2d4f02b5 | ||
|
|
00f36f3f28 | ||
|
|
a50b256689 | ||
|
|
b3548de7da | ||
|
|
387c37505c | ||
|
|
0c4108e730 | ||
|
|
fd1c6ab2ea | ||
|
|
f2bf9a2a28 | ||
|
|
c8e0bb0db0 | ||
|
|
d9d262d3f1 | ||
|
|
d0a5678290 | ||
|
|
35321b22d9 | ||
|
|
8837b110ab | ||
|
|
09a8c99f3e | ||
|
|
e3b108e00e | ||
|
|
9f382aca42 | ||
|
|
4d1395e522 | ||
| 9e36510c6b | |||
|
|
2ca61c3e57 | ||
| 07cb19cc30 | |||
|
|
794b254fe7 | ||
|
|
ab7f6f0b57 | ||
|
|
58cc569c75 | ||
|
|
35c463656d | ||
| 3801a97722 | |||
|
|
0367c67c85 | ||
|
|
8fdc212cda | ||
| 99e7349f6c | |||
|
|
fafe2aefad | ||
|
|
5049f215ba | ||
|
|
3a6123fe36 | ||
|
|
b8b2b687e2 | ||
| d067a8d12f | |||
|
|
1ee45639af | ||
|
|
db192d2cde | ||
|
|
28ce8ac54d | ||
|
|
be0a2f6f14 | ||
|
|
3260a063cb | ||
| feeac2e041 | |||
|
|
18c27b14c8 | ||
|
|
bcfaa6c7fe | ||
|
|
06e7d57e0d | ||
|
|
b340d7c8f9 | ||
|
|
24de0e5fdb | ||
| 20408d8dfe | |||
|
|
c1c5db6593 | ||
|
|
884a41f36a | ||
|
|
bbc0908989 | ||
|
|
5996f3cbf4 | ||
|
|
150031861d | ||
|
|
9d8e0a9c4a | ||
|
|
bd9b790e1d | ||
|
|
39b81b6263 | ||
|
|
1e09ec92e3 | ||
|
|
2b253a8248 | ||
|
|
3262bc3a86 | ||
|
|
3a4e554da9 | ||
|
|
35ce8771e5 | ||
|
|
b9092a3cce | ||
|
|
0b4f70a76b | ||
|
|
4bc4624bc9 | ||
|
|
3a6313a3ba | ||
|
|
6e3b5acede | ||
|
|
fe4b29f643 | ||
|
|
fcb89b3c7a | ||
|
|
1a0aaf3123 | ||
|
|
9a26ba0a72 | ||
|
|
6c9c826e19 | ||
|
|
554a9a6806 | ||
| c4c1e93dc8 | |||
|
|
15504e693b | ||
|
|
7d626dc31b | ||
|
|
6df6e3e313 | ||
|
|
4ffdf851c6 | ||
| 43707952d2 | |||
|
|
ef3fdba621 | ||
| 398426545c | |||
|
|
366a80ffd2 | ||
|
|
c9a8be4fb9 | ||
|
|
424d54b98c | ||
|
|
b261e63233 | ||
|
|
75544e3eec | ||
|
|
9e0dd05d42 | ||
|
|
27d20dd8fa | ||
|
|
4b0079c817 | ||
|
|
30b9ef8ab2 | ||
|
|
7235423c7b | ||
|
|
94a467b361 | ||
|
|
c3743877df | ||
|
|
ab937055e7 | ||
|
|
5c1ed332c4 | ||
|
|
95d687846a | ||
| 192c8cf974 | |||
|
|
cf706d4974 |
113
CMakeLists.txt
113
CMakeLists.txt
@@ -1,9 +1,18 @@
|
|||||||
cmake_minimum_required(VERSION 3.18)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
project(Darkflame)
|
project(Darkflame)
|
||||||
|
|
||||||
|
# check if the path to the source directory contains a space
|
||||||
|
if("${CMAKE_SOURCE_DIR}" MATCHES " ")
|
||||||
|
message(FATAL_ERROR "The server cannot build in the path (" ${CMAKE_SOURCE_DIR} ") because it contains a space. Please move the server to a path without spaces.")
|
||||||
|
endif()
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CXX_STANDARD_REQUIRED ON)
|
set(CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Export the compile commands for debugging
|
||||||
|
set(CMAKE_POLICY_DEFAULT_CMP0063 NEW) # Set CMAKE visibility policy to NEW on project and subprojects
|
||||||
|
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) # Set C and C++ symbol visibility to hide inlined functions
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
# Read variables from file
|
# Read variables from file
|
||||||
@@ -70,13 +79,15 @@ if(UNIX)
|
|||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -O2 -fPIC")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -O2 -fPIC")
|
||||||
elseif(MSVC)
|
elseif(MSVC)
|
||||||
# Skip warning for invalid conversion from size_t to uint32_t for all targets below for now
|
# Skip warning for invalid conversion from size_t to uint32_t for all targets below for now
|
||||||
add_compile_options("/wd4267" "/utf-8")
|
# Also disable non-portable MSVC volatile behavior
|
||||||
|
add_compile_options("/wd4267" "/utf-8" "/volatile:iso")
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Our output dir
|
# Our output dir
|
||||||
set(CMAKE_BINARY_DIR ${PROJECT_BINARY_DIR})
|
set(CMAKE_BINARY_DIR ${PROJECT_BINARY_DIR})
|
||||||
|
#set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) # unfortunately, forces all libraries to be built in series, which will slow down the build process
|
||||||
|
|
||||||
# TODO make this not have to override the build type directories
|
# TODO make this not have to override the build type directories
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR})
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR})
|
||||||
@@ -90,6 +101,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
|||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
|
find_package(MariaDB)
|
||||||
|
|
||||||
# Create a /resServer directory
|
# Create a /resServer directory
|
||||||
make_directory(${CMAKE_BINARY_DIR}/resServer)
|
make_directory(${CMAKE_BINARY_DIR}/resServer)
|
||||||
|
|
||||||
@@ -97,7 +110,7 @@ make_directory(${CMAKE_BINARY_DIR}/resServer)
|
|||||||
make_directory(${CMAKE_BINARY_DIR}/logs)
|
make_directory(${CMAKE_BINARY_DIR}/logs)
|
||||||
|
|
||||||
# Copy resource files on first build
|
# Copy resource files on first build
|
||||||
set(RESOURCE_FILES "sharedconfig.ini" "authconfig.ini" "chatconfig.ini" "worldconfig.ini" "masterconfig.ini" "blacklist.dcf")
|
set(RESOURCE_FILES "sharedconfig.ini" "authconfig.ini" "chatconfig.ini" "worldconfig.ini" "masterconfig.ini" "blocklist.dcf")
|
||||||
message(STATUS "Checking resource file integrity")
|
message(STATUS "Checking resource file integrity")
|
||||||
|
|
||||||
include(Utils)
|
include(Utils)
|
||||||
@@ -179,7 +192,7 @@ file(ARCHIVE_EXTRACT INPUT ${PROJECT_BINARY_DIR}/navmeshes.zip DESTINATION ${PRO
|
|||||||
file(REMOVE ${PROJECT_BINARY_DIR}/navmeshes.zip)
|
file(REMOVE ${PROJECT_BINARY_DIR}/navmeshes.zip)
|
||||||
|
|
||||||
# Copy vanity files on first build
|
# Copy vanity files on first build
|
||||||
set(VANITY_FILES "CREDITS.md" "INFO.md" "TESTAMENT.md" "NPC.xml")
|
set(VANITY_FILES "CREDITS.md" "INFO.md" "TESTAMENT.md" "root.xml" "dev-tribute.xml" "atm.xml" "demo.xml")
|
||||||
|
|
||||||
foreach(file ${VANITY_FILES})
|
foreach(file ${VANITY_FILES})
|
||||||
configure_file("${CMAKE_SOURCE_DIR}/vanity/${file}" "${CMAKE_BINARY_DIR}/vanity/${file}" COPYONLY)
|
configure_file("${CMAKE_SOURCE_DIR}/vanity/${file}" "${CMAKE_BINARY_DIR}/vanity/${file}" COPYONLY)
|
||||||
@@ -202,91 +215,47 @@ foreach(file ${SQL_FILES})
|
|||||||
configure_file(${CMAKE_SOURCE_DIR}/migrations/cdserver/${file} ${PROJECT_BINARY_DIR}/migrations/cdserver/${file})
|
configure_file(${CMAKE_SOURCE_DIR}/migrations/cdserver/${file} ${PROJECT_BINARY_DIR}/migrations/cdserver/${file})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
# Add system specfic includes for Apple, Windows and Other Unix OS' (including Linux)
|
||||||
|
if (APPLE)
|
||||||
|
include_directories("/usr/local/include/")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Load all of our third party directories
|
||||||
|
add_subdirectory(thirdparty SYSTEM)
|
||||||
|
|
||||||
# Create our list of include directories
|
# Create our list of include directories
|
||||||
set(INCLUDED_DIRECTORIES
|
include_directories(
|
||||||
"dCommon"
|
|
||||||
"dCommon/dClient"
|
|
||||||
"dCommon/dEnums"
|
|
||||||
|
|
||||||
"dChatFilter"
|
|
||||||
|
|
||||||
"dGame"
|
|
||||||
"dGame/dBehaviors"
|
|
||||||
"dGame/dComponents"
|
|
||||||
"dGame/dGameMessages"
|
|
||||||
"dGame/dInventory"
|
|
||||||
"dGame/dMission"
|
|
||||||
"dGame/dEntity"
|
|
||||||
"dGame/dPropertyBehaviors"
|
|
||||||
"dGame/dPropertyBehaviors/ControlBehaviorMessages"
|
|
||||||
"dGame/dUtilities"
|
|
||||||
|
|
||||||
"dPhysics"
|
"dPhysics"
|
||||||
|
|
||||||
"dNavigation"
|
"dNavigation"
|
||||||
"dNavigation/dTerrain"
|
|
||||||
|
|
||||||
"dZoneManager"
|
|
||||||
|
|
||||||
"dDatabase"
|
|
||||||
"dDatabase/CDClientDatabase"
|
|
||||||
"dDatabase/CDClientDatabase/CDClientTables"
|
|
||||||
"dDatabase/GameDatabase"
|
|
||||||
"dDatabase/GameDatabase/ITables"
|
|
||||||
"dDatabase/GameDatabase/MySQL"
|
|
||||||
"dDatabase/GameDatabase/MySQL/Tables"
|
|
||||||
|
|
||||||
"dNet"
|
"dNet"
|
||||||
|
|
||||||
"thirdparty/magic_enum/include/magic_enum"
|
|
||||||
"thirdparty/raknet/Source"
|
|
||||||
"thirdparty/tinyxml2"
|
|
||||||
"thirdparty/recastnavigation"
|
|
||||||
"thirdparty/SQLite"
|
|
||||||
"thirdparty/cpplinq"
|
|
||||||
"thirdparty/cpp-httplib"
|
|
||||||
"thirdparty/MD5"
|
|
||||||
|
|
||||||
"tests"
|
"tests"
|
||||||
"tests/dCommonTests"
|
"tests/dCommonTests"
|
||||||
"tests/dGameTests"
|
"tests/dGameTests"
|
||||||
"tests/dGameTests/dComponentsTests"
|
"tests/dGameTests/dComponentsTests"
|
||||||
|
|
||||||
|
SYSTEM "thirdparty/magic_enum/include/magic_enum"
|
||||||
|
SYSTEM "thirdparty/raknet/Source"
|
||||||
|
SYSTEM "thirdparty/tinyxml2"
|
||||||
|
SYSTEM "thirdparty/recastnavigation"
|
||||||
|
SYSTEM "thirdparty/SQLite"
|
||||||
|
SYSTEM "thirdparty/cpplinq"
|
||||||
|
SYSTEM "thirdparty/cpp-httplib"
|
||||||
|
SYSTEM "thirdparty/MD5"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add system specfic includes for Apple, Windows and Other Unix OS' (including Linux)
|
# Add system specfic includes for Apple, Windows and Other Unix OS' (including Linux)
|
||||||
|
# TODO: Should probably not do this.
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
include_directories("/usr/local/include/")
|
include_directories("/usr/local/include/")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Actually include the directories from our list
|
|
||||||
foreach(dir ${INCLUDED_DIRECTORIES})
|
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/${dir})
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
if(NOT WIN32)
|
|
||||||
include_directories("${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt/include/bcrypt")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include_directories("${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt/include")
|
|
||||||
|
|
||||||
# Add linking directories:
|
# Add linking directories:
|
||||||
link_directories(${PROJECT_BINARY_DIR})
|
|
||||||
|
|
||||||
# Load all of our third party directories
|
|
||||||
add_subdirectory(thirdparty)
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast -Werror") # Warning flags
|
||||||
endif()
|
endif()
|
||||||
# Glob together all headers that need to be precompiled
|
|
||||||
file(
|
|
||||||
GLOB HEADERS_DDATABASE
|
|
||||||
LIST_DIRECTORIES false
|
|
||||||
${PROJECT_SOURCE_DIR}/dDatabase/CDClientDatabase/*.h
|
|
||||||
${PROJECT_SOURCE_DIR}/dDatabase/CDClientDatabase/CDClientTables/*.h
|
|
||||||
${PROJECT_SOURCE_DIR}/dDatabase/GameDatabase/ITables/*.h
|
|
||||||
${PROJECT_SOURCE_DIR}/thirdparty/SQLite/*.h
|
|
||||||
)
|
|
||||||
|
|
||||||
file(
|
file(
|
||||||
GLOB HEADERS_DZONEMANAGER
|
GLOB HEADERS_DZONEMANAGER
|
||||||
LIST_DIRECTORIES false
|
LIST_DIRECTORIES false
|
||||||
@@ -321,7 +290,7 @@ add_subdirectory(dPhysics)
|
|||||||
add_subdirectory(dServer)
|
add_subdirectory(dServer)
|
||||||
|
|
||||||
# Create a list of common libraries shared between all binaries
|
# Create a list of common libraries shared between all binaries
|
||||||
set(COMMON_LIBRARIES "dCommon" "dDatabase" "dNet" "raknet" "mariadbConnCpp" "magic_enum" "MD5")
|
set(COMMON_LIBRARIES "dCommon" "dDatabase" "dNet" "raknet" "MariaDB::ConnCpp" "magic_enum")
|
||||||
|
|
||||||
# Add platform specific common libraries
|
# Add platform specific common libraries
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
@@ -343,12 +312,6 @@ target_precompile_headers(
|
|||||||
${HEADERS_DZONEMANAGER}
|
${HEADERS_DZONEMANAGER}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Need to specify to use the CXX compiler language here or else we get errors including <string>.
|
|
||||||
target_precompile_headers(
|
|
||||||
dDatabase PRIVATE
|
|
||||||
"$<$<COMPILE_LANGUAGE:CXX>:${HEADERS_DDATABASE}>"
|
|
||||||
)
|
|
||||||
|
|
||||||
target_precompile_headers(
|
target_precompile_headers(
|
||||||
dCommon PRIVATE
|
dCommon PRIVATE
|
||||||
${HEADERS_DCOMMON}
|
${HEADERS_DCOMMON}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
PROJECT_VERSION_MAJOR=1
|
PROJECT_VERSION_MAJOR=2
|
||||||
PROJECT_VERSION_MINOR=1
|
PROJECT_VERSION_MINOR=3
|
||||||
PROJECT_VERSION_PATCH=1
|
PROJECT_VERSION_PATCH=0
|
||||||
|
|
||||||
# Debugging
|
# Debugging
|
||||||
# Set DYNAMIC to 1 to enable the -rdynamic flag for the linker, yielding some symbols in crashlogs.
|
# Set DYNAMIC to 1 to enable the -rdynamic flag for the linker, yielding some symbols in crashlogs.
|
||||||
|
|||||||
@@ -23,8 +23,7 @@ RUN --mount=type=cache,id=build-apt-cache,target=/var/cache/apt \
|
|||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Grab libraries and load them
|
# Grab libraries and load them
|
||||||
COPY --from=build /app/build/mariadbcpp/src/mariadb_connector_cpp-build/libmariadbcpp.so /usr/local/lib/
|
COPY --from=build /app/build/mariadbcpp/libmariadbcpp.so /usr/local/lib/
|
||||||
COPY --from=build /app/build/mariadbcpp/src/mariadb_connector_cpp-build/libmariadb/libmariadb/libmariadb.so.3 /usr/local/lib
|
|
||||||
RUN ldconfig
|
RUN ldconfig
|
||||||
|
|
||||||
# Server bins
|
# Server bins
|
||||||
@@ -32,7 +31,7 @@ COPY --from=build /app/build/*Server /app/
|
|||||||
|
|
||||||
# Necessary suplimentary files
|
# Necessary suplimentary files
|
||||||
COPY --from=build /app/build/*.ini /app/configs/
|
COPY --from=build /app/build/*.ini /app/configs/
|
||||||
COPY --from=build /app/build/vanity/*.* /app/vanity/*
|
COPY --from=build /app/build/vanity/*.* /app/vanity/
|
||||||
COPY --from=build /app/build/navmeshes /app/navmeshes
|
COPY --from=build /app/build/navmeshes /app/navmeshes
|
||||||
COPY --from=build /app/build/migrations /app/migrations
|
COPY --from=build /app/build/migrations /app/migrations
|
||||||
COPY --from=build /app/build/*.dcf /app/
|
COPY --from=build /app/build/*.dcf /app/
|
||||||
@@ -40,7 +39,7 @@ COPY --from=build /app/build/*.dcf /app/
|
|||||||
# backup of config and vanity files to copy to the host incase
|
# backup of config and vanity files to copy to the host incase
|
||||||
# of a mount clobbering the copy from above
|
# of a mount clobbering the copy from above
|
||||||
COPY --from=build /app/build/*.ini /app/default-configs/
|
COPY --from=build /app/build/*.ini /app/default-configs/
|
||||||
COPY --from=build /app/build/vanity/*.* /app/default-vanity/*
|
COPY --from=build /app/build/vanity/*.* /app/default-vanity/
|
||||||
|
|
||||||
# needed as the container runs with the root user
|
# needed as the container runs with the root user
|
||||||
# and therefore sudo doesn't exist
|
# and therefore sudo doesn't exist
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ git clone --recursive https://github.com/DarkflameUniverse/DarkflameServer
|
|||||||
|
|
||||||
### Windows packages
|
### Windows packages
|
||||||
Ensure that you have either the [MSVC C++ compiler](https://visualstudio.microsoft.com/vs/features/cplusplus/) (recommended) or the [Clang compiler](https://github.com/llvm/llvm-project/releases/) installed.
|
Ensure that you have either the [MSVC C++ compiler](https://visualstudio.microsoft.com/vs/features/cplusplus/) (recommended) or the [Clang compiler](https://github.com/llvm/llvm-project/releases/) installed.
|
||||||
You'll also need to download and install [CMake](https://cmake.org/download/) (version <font size="4">**CMake version 3.18**</font> or later!).
|
You'll also need to download and install [CMake](https://cmake.org/download/) (version <font size="4">**CMake version 3.25**</font> or later!).
|
||||||
|
|
||||||
### MacOS packages
|
### MacOS packages
|
||||||
Ensure you have [brew](https://brew.sh) installed.
|
Ensure you have [brew](https://brew.sh) installed.
|
||||||
@@ -73,7 +73,7 @@ sudo apt install build-essential gcc zlib1g-dev libssl-dev openssl mariadb-serve
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### Required CMake version
|
#### Required CMake version
|
||||||
This project uses <font size="4">**CMake version 3.18**</font> or higher and as such you will need to ensure you have this version installed.
|
This project uses <font size="4">**CMake version 3.25**</font> or higher and as such you will need to ensure you have this version installed.
|
||||||
You can check your CMake version by using the following command in a terminal.
|
You can check your CMake version by using the following command in a terminal.
|
||||||
```bash
|
```bash
|
||||||
cmake --version
|
cmake --version
|
||||||
|
|||||||
17
cmake/FindGoogleTest.cmake
Normal file
17
cmake/FindGoogleTest.cmake
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
message(STATUS "Fetching gtest...")
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
googletest
|
||||||
|
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||||
|
GIT_TAG release-1.12.1
|
||||||
|
)
|
||||||
|
|
||||||
|
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
||||||
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(GoogleTest)
|
||||||
|
|
||||||
|
message(STATUS "gtest fetched and is now ready.")
|
||||||
|
set(GoogleTest_FOUND TRUE)
|
||||||
@@ -23,14 +23,14 @@ if(WIN32 AND NOT MARIADB_BUILD_SOURCE)
|
|||||||
set(MARIADB_CONNECTOR_CPP_MSI "mariadb-connector-cpp-${MARIADB_CONNECTOR_CPP_VERSION}-win64.msi")
|
set(MARIADB_CONNECTOR_CPP_MSI "mariadb-connector-cpp-${MARIADB_CONNECTOR_CPP_VERSION}-win64.msi")
|
||||||
|
|
||||||
if(NOT EXISTS "${MARIADB_MSI_DIR}/${MARIADB_CONNECTOR_C_MSI}" )
|
if(NOT EXISTS "${MARIADB_MSI_DIR}/${MARIADB_CONNECTOR_C_MSI}" )
|
||||||
message("Downloading mariadb connector/c")
|
message(STATUS "Downloading mariadb connector/c")
|
||||||
file(DOWNLOAD https://dlm.mariadb.com/${MARIADB_CONNECTOR_C_BUCKET}/Connectors/c/connector-c-${MARIADB_CONNECTOR_C_VERSION}/${MARIADB_CONNECTOR_C_MSI}
|
file(DOWNLOAD https://dlm.mariadb.com/${MARIADB_CONNECTOR_C_BUCKET}/Connectors/c/connector-c-${MARIADB_CONNECTOR_C_VERSION}/${MARIADB_CONNECTOR_C_MSI}
|
||||||
"${MARIADB_MSI_DIR}/${MARIADB_CONNECTOR_C_MSI}"
|
"${MARIADB_MSI_DIR}/${MARIADB_CONNECTOR_C_MSI}"
|
||||||
EXPECTED_HASH MD5=${MARIADB_CONNECTOR_C_MD5})
|
EXPECTED_HASH MD5=${MARIADB_CONNECTOR_C_MD5})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT EXISTS "${MARIADB_MSI_DIR}/${MARIADB_CONNECTOR_CPP_MSI}" )
|
if(NOT EXISTS "${MARIADB_MSI_DIR}/${MARIADB_CONNECTOR_CPP_MSI}" )
|
||||||
message("Downloading mariadb connector/c++")
|
message(STATUS "Downloading mariadb connector/c++")
|
||||||
file(DOWNLOAD https://dlm.mariadb.com/${MARIADB_CONNECTOR_CPP_BUCKET}/Connectors/cpp/connector-cpp-${MARIADB_CONNECTOR_CPP_VERSION}/${MARIADB_CONNECTOR_CPP_MSI}
|
file(DOWNLOAD https://dlm.mariadb.com/${MARIADB_CONNECTOR_CPP_BUCKET}/Connectors/cpp/connector-cpp-${MARIADB_CONNECTOR_CPP_VERSION}/${MARIADB_CONNECTOR_CPP_MSI}
|
||||||
"${MARIADB_MSI_DIR}/${MARIADB_CONNECTOR_CPP_MSI}"
|
"${MARIADB_MSI_DIR}/${MARIADB_CONNECTOR_CPP_MSI}"
|
||||||
EXPECTED_HASH MD5=${MARIADB_CONNECTOR_CPP_MD5})
|
EXPECTED_HASH MD5=${MARIADB_CONNECTOR_CPP_MD5})
|
||||||
@@ -43,27 +43,28 @@ if(WIN32 AND NOT MARIADB_BUILD_SOURCE)
|
|||||||
file(TO_NATIVE_PATH "${MARIADB_MSI_DIR}/${MARIADB_CONNECTOR_C_MSI}" MSI_DIR)
|
file(TO_NATIVE_PATH "${MARIADB_MSI_DIR}/${MARIADB_CONNECTOR_C_MSI}" MSI_DIR)
|
||||||
execute_process(COMMAND msiexec /a ${MSI_DIR} /qn TARGETDIR=${MSIEXEC_TARGETDIR})
|
execute_process(COMMAND msiexec /a ${MSI_DIR} /qn TARGETDIR=${MSIEXEC_TARGETDIR})
|
||||||
endif()
|
endif()
|
||||||
|
set(MARIADBC_SHARED_LIBRARY_LOCATION "${MARIADB_C_CONNECTOR_DIR}/lib/libmariadb.dll")
|
||||||
|
|
||||||
if(NOT EXISTS "${MARIADB_CPP_CONNECTOR_DIR}")
|
if(NOT EXISTS "${MARIADB_CPP_CONNECTOR_DIR}")
|
||||||
file(TO_NATIVE_PATH "${MARIADB_MSI_DIR}/${MARIADB_CONNECTOR_CPP_MSI}" MSI_DIR)
|
file(TO_NATIVE_PATH "${MARIADB_MSI_DIR}/${MARIADB_CONNECTOR_CPP_MSI}" MSI_DIR)
|
||||||
execute_process(COMMAND msiexec /a ${MSI_DIR} /qn TARGETDIR=${MSIEXEC_TARGETDIR})
|
execute_process(COMMAND msiexec /a ${MSI_DIR} /qn TARGETDIR=${MSIEXEC_TARGETDIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(MARIADB_SHARED_LIBRARY_LOCATION "${MARIADB_CPP_CONNECTOR_DIR}/mariadbcpp.dll")
|
set(MARIADBCPP_SHARED_LIBRARY_LOCATION "${MARIADB_CPP_CONNECTOR_DIR}/mariadbcpp.dll")
|
||||||
set(MARIADB_IMPLIB_LOCATION "${MARIADB_CPP_CONNECTOR_DIR}/mariadbcpp.lib")
|
set(MARIADB_IMPLIB_LOCATION "${MARIADB_CPP_CONNECTOR_DIR}/mariadbcpp.lib")
|
||||||
set(MARIADB_INCLUDE_DIR "${MARIADB_CPP_CONNECTOR_DIR}/include/mariadb")
|
set(MARIADB_INCLUDE_DIR "${MARIADB_CPP_CONNECTOR_DIR}/include/mariadb")
|
||||||
|
|
||||||
add_custom_target(mariadb_connector_cpp)
|
add_custom_target(mariadb_connector_cpp)
|
||||||
add_custom_command(TARGET mariadb_connector_cpp POST_BUILD
|
add_custom_command(TARGET mariadb_connector_cpp POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
"${MARIADB_CPP_CONNECTOR_DIR}/mariadbcpp.dll"
|
"${MARIADBCPP_SHARED_LIBRARY_LOCATION}"
|
||||||
"${MARIADB_C_CONNECTOR_DIR}/lib/libmariadb.dll"
|
"${MARIADBC_SHARED_LIBRARY_LOCATION}"
|
||||||
"${PROJECT_BINARY_DIR}")
|
"${PROJECT_BINARY_DIR}")
|
||||||
|
|
||||||
# MariaDB uses plugins that the database needs to load, the prebuilt binaries by default will try to find the libraries in system directories,
|
# MariaDB uses plugins that the database needs to load, the prebuilt binaries by default will try to find the libraries in system directories,
|
||||||
# so set this define and the servers will set the MARIADB_PLUGIN_DIR environment variable to the appropriate directory.
|
# so set this define and the servers will set the MARIADB_PLUGIN_DIR environment variable to the appropriate directory.
|
||||||
# Plugin directory is determined at dll load time (this will happen before main()) so we need to delay the dll load so that we can set the environment variable
|
# Plugin directory is determined at dll load time (this will happen before main()) so we need to delay the dll load so that we can set the environment variable
|
||||||
add_link_options(/DELAYLOAD:${MARIADB_SHARED_LIBRARY_LOCATION})
|
add_link_options(/DELAYLOAD:${MARIADBCPP_SHARED_LIBRARY_LOCATION})
|
||||||
add_compile_definitions(MARIADB_PLUGIN_DIR_OVERRIDE="${MARIADB_CPP_CONNECTOR_DIR}/plugin")
|
add_compile_definitions(MARIADB_PLUGIN_DIR_OVERRIDE="${MARIADB_CPP_CONNECTOR_DIR}/plugin")
|
||||||
else() # Build from source
|
else() # Build from source
|
||||||
|
|
||||||
@@ -85,77 +86,61 @@ else() # Build from source
|
|||||||
-DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0)
|
-DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(MARIADBCPP_INSTALL_DIR ${PROJECT_BINARY_DIR}/prefix)
|
||||||
|
set(MARIADBCPP_LIBRARY_DIR ${PROJECT_BINARY_DIR}/mariadbcpp)
|
||||||
|
set(MARIADBCPP_PLUGIN_DIR ${MARIADBCPP_LIBRARY_DIR}/plugin)
|
||||||
|
set(MARIADBCPP_SOURCE_DIR ${PROJECT_SOURCE_DIR}/thirdparty/mariadb-connector-cpp)
|
||||||
|
set(MARIADB_INCLUDE_DIR "${MARIADBCPP_SOURCE_DIR}/include")
|
||||||
ExternalProject_Add(mariadb_connector_cpp
|
ExternalProject_Add(mariadb_connector_cpp
|
||||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/mariadb-connector-cpp
|
PREFIX "${PROJECT_BINARY_DIR}/thirdparty/mariadb-connector-cpp"
|
||||||
CMAKE_ARGS -Wno-dev
|
SOURCE_DIR ${MARIADBCPP_SOURCE_DIR}
|
||||||
-DCMAKE_BUILD_RPATH_USE_ORIGIN=${CMAKE_BUILD_RPATH_USE_ORIGIN}
|
INSTALL_DIR ${MARIADBCPP_INSTALL_DIR}
|
||||||
-DCMAKE_INSTALL_PREFIX=./mariadbcpp # Points the connector to the correct plugin directory
|
CMAKE_ARGS -Wno-dev
|
||||||
-DINSTALL_PLUGINDIR=plugin
|
-DWITH_UNIT_TESTS=OFF
|
||||||
${MARIADB_EXTRA_CMAKE_ARGS}
|
-DMARIADB_LINK_DYNAMIC=OFF
|
||||||
PREFIX "${PROJECT_BINARY_DIR}/mariadbcpp"
|
-DCMAKE_BUILD_RPATH_USE_ORIGIN=${CMAKE_BUILD_RPATH_USE_ORIGIN}
|
||||||
BUILD_COMMAND cmake --build . --config RelWithDebInfo -j${MARIADB_CONNECTOR_COMPILE_JOBS}
|
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||||
INSTALL_COMMAND "")
|
-DINSTALL_LIBDIR=${MARIADBCPP_LIBRARY_DIR}
|
||||||
|
-DINSTALL_PLUGINDIR=${MARIADBCPP_PLUGIN_DIR}
|
||||||
ExternalProject_Get_Property(mariadb_connector_cpp BINARY_DIR)
|
${MARIADB_EXTRA_CMAKE_ARGS}
|
||||||
|
BUILD_ALWAYS true
|
||||||
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(MARIADB_SHARED_LIBRARY_NAME mariadbcpp.dll)
|
set(MARIADB_SHARED_LIBRARY_NAME mariadbcpp.dll)
|
||||||
set(MARIADB_PLUGIN_SUFFIX .dll)
|
set(MARIADB_PLUGIN_SUFFIX .dll)
|
||||||
set(MARIADB_IMPLIB_LOCATION "${BINARY_DIR}/RelWithDebInfo/mariadbcpp.lib")
|
set(MARIADB_IMPLIB_LOCATION "${MARIADBCPP_LIBRARY_DIR}/mariadbcpp.lib")
|
||||||
|
|
||||||
# When built from source windows only seems to check same folder as exe instead specified folder, so use
|
# When built from source windows only seems to check same folder as exe instead specified folder, so use
|
||||||
# environment variable to force it
|
# environment variable to force it
|
||||||
add_link_options(/DELAYLOAD:mariadbcpp.dll)
|
add_link_options(/DELAYLOAD:mariadbcpp.dll)
|
||||||
add_compile_definitions(MARIADB_PLUGIN_DIR_OVERRIDE="${PROJECT_BINARY_DIR}/mariadbcpp/plugin")
|
add_compile_definitions(MARIADB_PLUGIN_DIR_OVERRIDE="${MARIADBCPP_PLUGIN_DIR}")
|
||||||
else()
|
else()
|
||||||
set(MARIADB_SHARED_LIBRARY_NAME libmariadbcpp${CMAKE_SHARED_LIBRARY_SUFFIX})
|
set(MARIADB_SHARED_LIBRARY_NAME libmariadbcpp${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
set(MARIADB_PLUGIN_SUFFIX .so)
|
set(MARIADB_PLUGIN_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
set(MARIADBCPP_SHARED_LIBRARY_LOCATION "${MARIADBCPP_LIBRARY_DIR}/${MARIADB_SHARED_LIBRARY_NAME}")
|
||||||
if(isMultiConfig)
|
if(WIN32)
|
||||||
set(MARIADB_SHARED_LIBRARY_LOCATION "${BINARY_DIR}/RelWithDebInfo/${MARIADB_SHARED_LIBRARY_NAME}")
|
set(MARIADBC_SHARED_LIBRARY_LOCATION "${MARIADBCPP_LIBRARY_DIR}/libmariadb.lib")
|
||||||
set(MARIADB_SHARED_LIBRARY_COPY_LOCATION "${PROJECT_BINARY_DIR}/$<CONFIG>")
|
|
||||||
set(MARIADB_PLUGINS_LOCATION "${BINARY_DIR}/libmariadb/RelWithDebInfo")
|
|
||||||
else()
|
|
||||||
set(MARIADB_SHARED_LIBRARY_LOCATION "${BINARY_DIR}/${MARIADB_SHARED_LIBRARY_NAME}")
|
|
||||||
set(MARIADB_SHARED_LIBRARY_COPY_LOCATION "${PROJECT_BINARY_DIR}")
|
|
||||||
set(MARIADB_PLUGINS_LOCATION "${BINARY_DIR}/libmariadb")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(MARIADB_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/thirdparty/mariadb-connector-cpp/include/")
|
|
||||||
|
|
||||||
add_custom_command(TARGET mariadb_connector_cpp POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory
|
|
||||||
${BINARY_DIR}/mariadbcpp/plugin
|
|
||||||
${MARIADB_SHARED_LIBRARY_COPY_LOCATION}
|
|
||||||
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
||||||
${MARIADB_SHARED_LIBRARY_LOCATION}
|
|
||||||
${MARIADB_SHARED_LIBRARY_COPY_LOCATION}
|
|
||||||
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
||||||
${MARIADB_PLUGINS_LOCATION}/caching_sha2_password${MARIADB_PLUGIN_SUFFIX}
|
|
||||||
${MARIADB_PLUGINS_LOCATION}/client_ed25519${MARIADB_PLUGIN_SUFFIX}
|
|
||||||
${MARIADB_PLUGINS_LOCATION}/dialog${MARIADB_PLUGIN_SUFFIX}
|
|
||||||
${MARIADB_PLUGINS_LOCATION}/mysql_clear_password${MARIADB_PLUGIN_SUFFIX}
|
|
||||||
${MARIADB_PLUGINS_LOCATION}/sha256_password${MARIADB_PLUGIN_SUFFIX}
|
|
||||||
${BINARY_DIR}/mariadbcpp/plugin)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Remove the CMakeLists.txt file from the tests folder for the maria-db-connector so we dont compile the tests.
|
|
||||||
if(EXISTS "${CMAKE_SOURCE_DIR}/thirdparty/mariadb-connector-cpp/test/CMakeLists.txt")
|
|
||||||
file(REMOVE "${CMAKE_SOURCE_DIR}/thirdparty/mariadb-connector-cpp/test/CMakeLists.txt")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Create mariadb connector library object
|
# Create mariadb connector library object
|
||||||
add_library(mariadbConnCpp SHARED IMPORTED GLOBAL)
|
add_library(MariaDB::ConnCpp SHARED IMPORTED GLOBAL)
|
||||||
set_property(TARGET mariadbConnCpp PROPERTY IMPORTED_LOCATION ${MARIADB_SHARED_LIBRARY_LOCATION})
|
add_dependencies(MariaDB::ConnCpp mariadb_connector_cpp)
|
||||||
|
set_target_properties(MariaDB::ConnCpp PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${MARIADBCPP_SHARED_LIBRARY_LOCATION}")
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set_property(TARGET mariadbConnCpp PROPERTY IMPORTED_IMPLIB ${MARIADB_IMPLIB_LOCATION})
|
set_target_properties(MariaDB::ConnCpp PROPERTIES
|
||||||
|
IMPORTED_IMPLIB "${MARIADB_IMPLIB_LOCATION}")
|
||||||
|
elseif(APPLE)
|
||||||
|
set_target_properties(MariaDB::ConnCpp PROPERTIES
|
||||||
|
IMPORTED_SONAME "libmariadbcpp")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Add directories to include lists
|
# Add directories to include lists
|
||||||
target_include_directories(mariadbConnCpp INTERFACE ${MARIADB_INCLUDE_DIR})
|
target_include_directories(MariaDB::ConnCpp SYSTEM INTERFACE ${MARIADB_INCLUDE_DIR})
|
||||||
add_dependencies(mariadbConnCpp mariadb_connector_cpp)
|
|
||||||
|
set(MariaDB_FOUND TRUE)
|
||||||
@@ -27,8 +27,8 @@ dChatFilter::dChatFilter(const std::string& filepath, bool dontGenerateDCF) {
|
|||||||
ExportWordlistToDCF(filepath + ".dcf", true);
|
ExportWordlistToDCF(filepath + ".dcf", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BinaryIO::DoesFileExist("blacklist.dcf")) {
|
if (BinaryIO::DoesFileExist("blocklist.dcf")) {
|
||||||
ReadWordlistDCF("blacklist.dcf", false);
|
ReadWordlistDCF("blocklist.dcf", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Read player names that are ok as well:
|
//Read player names that are ok as well:
|
||||||
@@ -44,20 +44,20 @@ dChatFilter::~dChatFilter() {
|
|||||||
m_DeniedWords.clear();
|
m_DeniedWords.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void dChatFilter::ReadWordlistPlaintext(const std::string& filepath, bool whiteList) {
|
void dChatFilter::ReadWordlistPlaintext(const std::string& filepath, bool allowList) {
|
||||||
std::ifstream file(filepath);
|
std::ifstream file(filepath);
|
||||||
if (file) {
|
if (file) {
|
||||||
std::string line;
|
std::string line;
|
||||||
while (std::getline(file, line)) {
|
while (std::getline(file, line)) {
|
||||||
line.erase(std::remove(line.begin(), line.end(), '\r'), line.end());
|
line.erase(std::remove(line.begin(), line.end(), '\r'), line.end());
|
||||||
std::transform(line.begin(), line.end(), line.begin(), ::tolower); //Transform to lowercase
|
std::transform(line.begin(), line.end(), line.begin(), ::tolower); //Transform to lowercase
|
||||||
if (whiteList) m_ApprovedWords.push_back(CalculateHash(line));
|
if (allowList) m_ApprovedWords.push_back(CalculateHash(line));
|
||||||
else m_DeniedWords.push_back(CalculateHash(line));
|
else m_DeniedWords.push_back(CalculateHash(line));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dChatFilter::ReadWordlistDCF(const std::string& filepath, bool whiteList) {
|
bool dChatFilter::ReadWordlistDCF(const std::string& filepath, bool allowList) {
|
||||||
std::ifstream file(filepath, std::ios::binary);
|
std::ifstream file(filepath, std::ios::binary);
|
||||||
if (file) {
|
if (file) {
|
||||||
fileHeader hdr;
|
fileHeader hdr;
|
||||||
@@ -70,13 +70,13 @@ bool dChatFilter::ReadWordlistDCF(const std::string& filepath, bool whiteList) {
|
|||||||
if (hdr.formatVersion == formatVersion) {
|
if (hdr.formatVersion == formatVersion) {
|
||||||
size_t wordsToRead = 0;
|
size_t wordsToRead = 0;
|
||||||
BinaryIO::BinaryRead(file, wordsToRead);
|
BinaryIO::BinaryRead(file, wordsToRead);
|
||||||
if (whiteList) m_ApprovedWords.reserve(wordsToRead);
|
if (allowList) m_ApprovedWords.reserve(wordsToRead);
|
||||||
else m_DeniedWords.reserve(wordsToRead);
|
else m_DeniedWords.reserve(wordsToRead);
|
||||||
|
|
||||||
size_t word = 0;
|
size_t word = 0;
|
||||||
for (size_t i = 0; i < wordsToRead; ++i) {
|
for (size_t i = 0; i < wordsToRead; ++i) {
|
||||||
BinaryIO::BinaryRead(file, word);
|
BinaryIO::BinaryRead(file, word);
|
||||||
if (whiteList) m_ApprovedWords.push_back(word);
|
if (allowList) m_ApprovedWords.push_back(word);
|
||||||
else m_DeniedWords.push_back(word);
|
else m_DeniedWords.push_back(word);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,14 +90,14 @@ bool dChatFilter::ReadWordlistDCF(const std::string& filepath, bool whiteList) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dChatFilter::ExportWordlistToDCF(const std::string& filepath, bool whiteList) {
|
void dChatFilter::ExportWordlistToDCF(const std::string& filepath, bool allowList) {
|
||||||
std::ofstream file(filepath, std::ios::binary | std::ios_base::out);
|
std::ofstream file(filepath, std::ios::binary | std::ios_base::out);
|
||||||
if (file) {
|
if (file) {
|
||||||
BinaryIO::BinaryWrite(file, uint32_t(dChatFilterDCF::header));
|
BinaryIO::BinaryWrite(file, uint32_t(dChatFilterDCF::header));
|
||||||
BinaryIO::BinaryWrite(file, uint32_t(dChatFilterDCF::formatVersion));
|
BinaryIO::BinaryWrite(file, uint32_t(dChatFilterDCF::formatVersion));
|
||||||
BinaryIO::BinaryWrite(file, size_t(whiteList ? m_ApprovedWords.size() : m_DeniedWords.size()));
|
BinaryIO::BinaryWrite(file, size_t(allowList ? m_ApprovedWords.size() : m_DeniedWords.size()));
|
||||||
|
|
||||||
for (size_t word : whiteList ? m_ApprovedWords : m_DeniedWords) {
|
for (size_t word : allowList ? m_ApprovedWords : m_DeniedWords) {
|
||||||
BinaryIO::BinaryWrite(file, word);
|
BinaryIO::BinaryWrite(file, word);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,10 +105,10 @@ void dChatFilter::ExportWordlistToDCF(const std::string& filepath, bool whiteLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::pair<uint8_t, uint8_t>> dChatFilter::IsSentenceOkay(const std::string& message, eGameMasterLevel gmLevel, bool whiteList) {
|
std::vector<std::pair<uint8_t, uint8_t>> dChatFilter::IsSentenceOkay(const std::string& message, eGameMasterLevel gmLevel, bool allowList) {
|
||||||
if (gmLevel > eGameMasterLevel::FORUM_MODERATOR) return { }; //If anything but a forum mod, return true.
|
if (gmLevel > eGameMasterLevel::FORUM_MODERATOR) return { }; //If anything but a forum mod, return true.
|
||||||
if (message.empty()) return { };
|
if (message.empty()) return { };
|
||||||
if (!whiteList && m_DeniedWords.empty()) return { { 0, message.length() } };
|
if (!allowList && m_DeniedWords.empty()) return { { 0, message.length() } };
|
||||||
|
|
||||||
std::stringstream sMessage(message);
|
std::stringstream sMessage(message);
|
||||||
std::string segment;
|
std::string segment;
|
||||||
@@ -126,16 +126,16 @@ std::vector<std::pair<uint8_t, uint8_t>> dChatFilter::IsSentenceOkay(const std::
|
|||||||
|
|
||||||
size_t hash = CalculateHash(segment);
|
size_t hash = CalculateHash(segment);
|
||||||
|
|
||||||
if (std::find(m_UserUnapprovedWordCache.begin(), m_UserUnapprovedWordCache.end(), hash) != m_UserUnapprovedWordCache.end() && whiteList) {
|
if (std::find(m_UserUnapprovedWordCache.begin(), m_UserUnapprovedWordCache.end(), hash) != m_UserUnapprovedWordCache.end() && allowList) {
|
||||||
listOfBadSegments.emplace_back(position, originalSegment.length());
|
listOfBadSegments.emplace_back(position, originalSegment.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::find(m_ApprovedWords.begin(), m_ApprovedWords.end(), hash) == m_ApprovedWords.end() && whiteList) {
|
if (std::find(m_ApprovedWords.begin(), m_ApprovedWords.end(), hash) == m_ApprovedWords.end() && allowList) {
|
||||||
m_UserUnapprovedWordCache.push_back(hash);
|
m_UserUnapprovedWordCache.push_back(hash);
|
||||||
listOfBadSegments.emplace_back(position, originalSegment.length());
|
listOfBadSegments.emplace_back(position, originalSegment.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::find(m_DeniedWords.begin(), m_DeniedWords.end(), hash) != m_DeniedWords.end() && !whiteList) {
|
if (std::find(m_DeniedWords.begin(), m_DeniedWords.end(), hash) != m_DeniedWords.end() && !allowList) {
|
||||||
m_UserUnapprovedWordCache.push_back(hash);
|
m_UserUnapprovedWordCache.push_back(hash);
|
||||||
listOfBadSegments.emplace_back(position, originalSegment.length());
|
listOfBadSegments.emplace_back(position, originalSegment.length());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ public:
|
|||||||
dChatFilter(const std::string& filepath, bool dontGenerateDCF);
|
dChatFilter(const std::string& filepath, bool dontGenerateDCF);
|
||||||
~dChatFilter();
|
~dChatFilter();
|
||||||
|
|
||||||
void ReadWordlistPlaintext(const std::string& filepath, bool whiteList);
|
void ReadWordlistPlaintext(const std::string& filepath, bool allowList);
|
||||||
bool ReadWordlistDCF(const std::string& filepath, bool whiteList);
|
bool ReadWordlistDCF(const std::string& filepath, bool allowList);
|
||||||
void ExportWordlistToDCF(const std::string& filepath, bool whiteList);
|
void ExportWordlistToDCF(const std::string& filepath, bool allowList);
|
||||||
std::vector<std::pair<uint8_t, uint8_t>> IsSentenceOkay(const std::string& message, eGameMasterLevel gmLevel, bool whiteList = true);
|
std::vector<std::pair<uint8_t, uint8_t>> IsSentenceOkay(const std::string& message, eGameMasterLevel gmLevel, bool allowList = true);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_DontGenerateDCF;
|
bool m_DontGenerateDCF;
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ set(DCHATSERVER_SOURCES
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_executable(ChatServer "ChatServer.cpp")
|
add_executable(ChatServer "ChatServer.cpp")
|
||||||
add_library(dChatServer ${DCHATSERVER_SOURCES})
|
target_include_directories(ChatServer PRIVATE "${PROJECT_SOURCE_DIR}/dChatFilter")
|
||||||
target_include_directories(dChatServer PRIVATE ${PROJECT_SOURCE_DIR}/dServer)
|
|
||||||
add_compile_definitions(ChatServer PRIVATE PROJECT_VERSION="\"${PROJECT_VERSION}\"")
|
add_compile_definitions(ChatServer PRIVATE PROJECT_VERSION="\"${PROJECT_VERSION}\"")
|
||||||
|
|
||||||
|
add_library(dChatServer ${DCHATSERVER_SOURCES})
|
||||||
|
target_include_directories(dChatServer PRIVATE "${PROJECT_SOURCE_DIR}/dServer")
|
||||||
|
|
||||||
target_link_libraries(dChatServer ${COMMON_LIBRARIES} dChatFilter)
|
target_link_libraries(dChatServer ${COMMON_LIBRARIES} dChatFilter)
|
||||||
target_link_libraries(ChatServer ${COMMON_LIBRARIES} dChatFilter dChatServer dServer)
|
target_link_libraries(ChatServer ${COMMON_LIBRARIES} dChatFilter dChatServer dServer)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "ChatIgnoreList.h"
|
#include "ChatIgnoreList.h"
|
||||||
#include "PlayerContainer.h"
|
#include "PlayerContainer.h"
|
||||||
#include "eChatInternalMessageType.h"
|
#include "eChatMessageType.h"
|
||||||
#include "BitStreamUtils.h"
|
#include "BitStreamUtils.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
// The only thing not auto-handled is instance activities force joining the team on the server.
|
// The only thing not auto-handled is instance activities force joining the team on the server.
|
||||||
|
|
||||||
void WriteOutgoingReplyHeader(RakNet::BitStream& bitStream, const LWOOBJID& receivingPlayer, const ChatIgnoreList::Response type) {
|
void WriteOutgoingReplyHeader(RakNet::BitStream& bitStream, const LWOOBJID& receivingPlayer, const ChatIgnoreList::Response type) {
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(receivingPlayer);
|
bitStream.Write(receivingPlayer);
|
||||||
|
|
||||||
//portion that will get routed:
|
//portion that will get routed:
|
||||||
@@ -59,7 +59,7 @@ void ChatIgnoreList::GetIgnoreList(Packet* packet) {
|
|||||||
bitStream.Write(LUWString(ignoredPlayer.playerName, 36));
|
bitStream.Write(LUWString(ignoredPlayer.playerName, 36));
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::server->Send(&bitStream, packet->systemAddress, false);
|
Game::server->Send(bitStream, packet->systemAddress, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatIgnoreList::AddIgnore(Packet* packet) {
|
void ChatIgnoreList::AddIgnore(Packet* packet) {
|
||||||
@@ -131,7 +131,7 @@ void ChatIgnoreList::AddIgnore(Packet* packet) {
|
|||||||
bitStream.Write(playerNameSend);
|
bitStream.Write(playerNameSend);
|
||||||
bitStream.Write(ignoredPlayerId);
|
bitStream.Write(ignoredPlayerId);
|
||||||
|
|
||||||
Game::server->Send(&bitStream, packet->systemAddress, false);
|
Game::server->Send(bitStream, packet->systemAddress, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatIgnoreList::RemoveIgnore(Packet* packet) {
|
void ChatIgnoreList::RemoveIgnore(Packet* packet) {
|
||||||
@@ -167,5 +167,5 @@ void ChatIgnoreList::RemoveIgnore(Packet* packet) {
|
|||||||
LUWString playerNameSend(removedIgnoreStr, 33);
|
LUWString playerNameSend(removedIgnoreStr, 33);
|
||||||
bitStream.Write(playerNameSend);
|
bitStream.Write(playerNameSend);
|
||||||
|
|
||||||
Game::server->Send(&bitStream, packet->systemAddress, false);
|
Game::server->Send(bitStream, packet->systemAddress, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __CHATIGNORELIST__H__
|
#ifndef CHATIGNORELIST_H
|
||||||
#define __CHATIGNORELIST__H__
|
#define CHATIGNORELIST_H
|
||||||
|
|
||||||
struct Packet;
|
struct Packet;
|
||||||
|
|
||||||
@@ -24,4 +24,4 @@ namespace ChatIgnoreList {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__CHATIGNORELIST__H__
|
#endif //!CHATIGNORELIST_H
|
||||||
|
|||||||
@@ -14,11 +14,11 @@
|
|||||||
#include "eObjectBits.h"
|
#include "eObjectBits.h"
|
||||||
#include "eConnectionType.h"
|
#include "eConnectionType.h"
|
||||||
#include "eChatMessageType.h"
|
#include "eChatMessageType.h"
|
||||||
#include "eChatInternalMessageType.h"
|
|
||||||
#include "eClientMessageType.h"
|
#include "eClientMessageType.h"
|
||||||
#include "eGameMessageType.h"
|
#include "eGameMessageType.h"
|
||||||
#include "StringifiedEnum.h"
|
#include "StringifiedEnum.h"
|
||||||
#include "eGameMasterLevel.h"
|
#include "eGameMasterLevel.h"
|
||||||
|
#include "ChatPackets.h"
|
||||||
|
|
||||||
void ChatPacketHandler::HandleFriendlistRequest(Packet* packet) {
|
void ChatPacketHandler::HandleFriendlistRequest(Packet* packet) {
|
||||||
//Get from the packet which player we want to do something with:
|
//Get from the packet which player we want to do something with:
|
||||||
@@ -60,7 +60,7 @@ void ChatPacketHandler::HandleFriendlistRequest(Packet* packet) {
|
|||||||
|
|
||||||
//Now, we need to send the friendlist to the server they came from:
|
//Now, we need to send the friendlist to the server they came from:
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(playerID);
|
bitStream.Write(playerID);
|
||||||
|
|
||||||
//portion that will get routed:
|
//portion that will get routed:
|
||||||
@@ -355,6 +355,67 @@ void ChatPacketHandler::HandleGMLevelUpdate(Packet* packet) {
|
|||||||
inStream.Read(player.gmLevel);
|
inStream.Read(player.gmLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ChatPacketHandler::HandleWho(Packet* packet) {
|
||||||
|
CINSTREAM_SKIP_HEADER;
|
||||||
|
FindPlayerRequest request;
|
||||||
|
request.Deserialize(inStream);
|
||||||
|
|
||||||
|
const auto& sender = Game::playerContainer.GetPlayerData(request.requestor);
|
||||||
|
if (!sender) return;
|
||||||
|
|
||||||
|
const auto& player = Game::playerContainer.GetPlayerData(request.playerName.GetAsString());
|
||||||
|
bool online = player;
|
||||||
|
|
||||||
|
CBITSTREAM;
|
||||||
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
|
bitStream.Write(request.requestor);
|
||||||
|
|
||||||
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CLIENT, eClientMessageType::WHO_RESPONSE);
|
||||||
|
bitStream.Write<uint8_t>(online);
|
||||||
|
bitStream.Write(player.zoneID.GetMapID());
|
||||||
|
bitStream.Write(player.zoneID.GetInstanceID());
|
||||||
|
bitStream.Write(player.zoneID.GetCloneID());
|
||||||
|
bitStream.Write(request.playerName);
|
||||||
|
|
||||||
|
SystemAddress sysAddr = sender.sysAddr;
|
||||||
|
SEND_PACKET;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChatPacketHandler::HandleShowAll(Packet* packet) {
|
||||||
|
CINSTREAM_SKIP_HEADER;
|
||||||
|
ShowAllRequest request;
|
||||||
|
request.Deserialize(inStream);
|
||||||
|
|
||||||
|
const auto& sender = Game::playerContainer.GetPlayerData(request.requestor);
|
||||||
|
if (!sender) return;
|
||||||
|
|
||||||
|
CBITSTREAM;
|
||||||
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
|
bitStream.Write(request.requestor);
|
||||||
|
|
||||||
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CLIENT, eClientMessageType::SHOW_ALL_RESPONSE);
|
||||||
|
bitStream.Write<uint8_t>(!request.displayZoneData && !request.displayIndividualPlayers);
|
||||||
|
bitStream.Write(Game::playerContainer.GetPlayerCount());
|
||||||
|
bitStream.Write(Game::playerContainer.GetSimCount());
|
||||||
|
bitStream.Write<uint8_t>(request.displayIndividualPlayers);
|
||||||
|
bitStream.Write<uint8_t>(request.displayZoneData);
|
||||||
|
if (request.displayZoneData || request.displayIndividualPlayers){
|
||||||
|
for (auto& [playerID, playerData ]: Game::playerContainer.GetAllPlayers()){
|
||||||
|
if (!playerData) continue;
|
||||||
|
bitStream.Write<uint8_t>(0); // structure packing
|
||||||
|
if (request.displayIndividualPlayers) bitStream.Write(LUWString(playerData.playerName));
|
||||||
|
if (request.displayZoneData) {
|
||||||
|
bitStream.Write(playerData.zoneID.GetMapID());
|
||||||
|
bitStream.Write(playerData.zoneID.GetInstanceID());
|
||||||
|
bitStream.Write(playerData.zoneID.GetCloneID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SystemAddress sysAddr = sender.sysAddr;
|
||||||
|
SEND_PACKET;
|
||||||
|
}
|
||||||
|
|
||||||
// the structure the client uses to send this packet is shared in many chat messages
|
// the structure the client uses to send this packet is shared in many chat messages
|
||||||
// that are sent to the server. Because of this, there are large gaps of unused data in chat messages
|
// that are sent to the server. Because of this, there are large gaps of unused data in chat messages
|
||||||
void ChatPacketHandler::HandleChatMessage(Packet* packet) {
|
void ChatPacketHandler::HandleChatMessage(Packet* packet) {
|
||||||
@@ -454,7 +515,7 @@ void ChatPacketHandler::HandlePrivateChatMessage(Packet* packet) {
|
|||||||
|
|
||||||
void ChatPacketHandler::SendPrivateChatMessage(const PlayerData& sender, const PlayerData& receiver, const PlayerData& routeTo, const LUWString& message, const eChatChannel channel, const eChatMessageResponseCode responseCode) {
|
void ChatPacketHandler::SendPrivateChatMessage(const PlayerData& sender, const PlayerData& receiver, const PlayerData& routeTo, const LUWString& message, const eChatChannel channel, const eChatMessageResponseCode responseCode) {
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(routeTo.playerID);
|
bitStream.Write(routeTo.playerID);
|
||||||
|
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::PRIVATE_CHAT_MESSAGE);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::PRIVATE_CHAT_MESSAGE);
|
||||||
@@ -696,7 +757,7 @@ void ChatPacketHandler::HandleTeamStatusRequest(Packet* packet) {
|
|||||||
|
|
||||||
void ChatPacketHandler::SendTeamInvite(const PlayerData& receiver, const PlayerData& sender) {
|
void ChatPacketHandler::SendTeamInvite(const PlayerData& receiver, const PlayerData& sender) {
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(receiver.playerID);
|
bitStream.Write(receiver.playerID);
|
||||||
|
|
||||||
//portion that will get routed:
|
//portion that will get routed:
|
||||||
@@ -711,7 +772,7 @@ void ChatPacketHandler::SendTeamInvite(const PlayerData& receiver, const PlayerD
|
|||||||
|
|
||||||
void ChatPacketHandler::SendTeamInviteConfirm(const PlayerData& receiver, bool bLeaderIsFreeTrial, LWOOBJID i64LeaderID, LWOZONEID i64LeaderZoneID, uint8_t ucLootFlag, uint8_t ucNumOfOtherPlayers, uint8_t ucResponseCode, std::u16string wsLeaderName) {
|
void ChatPacketHandler::SendTeamInviteConfirm(const PlayerData& receiver, bool bLeaderIsFreeTrial, LWOOBJID i64LeaderID, LWOZONEID i64LeaderZoneID, uint8_t ucLootFlag, uint8_t ucNumOfOtherPlayers, uint8_t ucResponseCode, std::u16string wsLeaderName) {
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(receiver.playerID);
|
bitStream.Write(receiver.playerID);
|
||||||
|
|
||||||
//portion that will get routed:
|
//portion that will get routed:
|
||||||
@@ -738,7 +799,7 @@ void ChatPacketHandler::SendTeamInviteConfirm(const PlayerData& receiver, bool b
|
|||||||
|
|
||||||
void ChatPacketHandler::SendTeamStatus(const PlayerData& receiver, LWOOBJID i64LeaderID, LWOZONEID i64LeaderZoneID, uint8_t ucLootFlag, uint8_t ucNumOfOtherPlayers, std::u16string wsLeaderName) {
|
void ChatPacketHandler::SendTeamStatus(const PlayerData& receiver, LWOOBJID i64LeaderID, LWOZONEID i64LeaderZoneID, uint8_t ucLootFlag, uint8_t ucNumOfOtherPlayers, std::u16string wsLeaderName) {
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(receiver.playerID);
|
bitStream.Write(receiver.playerID);
|
||||||
|
|
||||||
//portion that will get routed:
|
//portion that will get routed:
|
||||||
@@ -763,7 +824,7 @@ void ChatPacketHandler::SendTeamStatus(const PlayerData& receiver, LWOOBJID i64L
|
|||||||
|
|
||||||
void ChatPacketHandler::SendTeamSetLeader(const PlayerData& receiver, LWOOBJID i64PlayerID) {
|
void ChatPacketHandler::SendTeamSetLeader(const PlayerData& receiver, LWOOBJID i64PlayerID) {
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(receiver.playerID);
|
bitStream.Write(receiver.playerID);
|
||||||
|
|
||||||
//portion that will get routed:
|
//portion that will get routed:
|
||||||
@@ -780,7 +841,7 @@ void ChatPacketHandler::SendTeamSetLeader(const PlayerData& receiver, LWOOBJID i
|
|||||||
|
|
||||||
void ChatPacketHandler::SendTeamAddPlayer(const PlayerData& receiver, bool bIsFreeTrial, bool bLocal, bool bNoLootOnDeath, LWOOBJID i64PlayerID, std::u16string wsPlayerName, LWOZONEID zoneID) {
|
void ChatPacketHandler::SendTeamAddPlayer(const PlayerData& receiver, bool bIsFreeTrial, bool bLocal, bool bNoLootOnDeath, LWOOBJID i64PlayerID, std::u16string wsPlayerName, LWOZONEID zoneID) {
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(receiver.playerID);
|
bitStream.Write(receiver.playerID);
|
||||||
|
|
||||||
//portion that will get routed:
|
//portion that will get routed:
|
||||||
@@ -809,7 +870,7 @@ void ChatPacketHandler::SendTeamAddPlayer(const PlayerData& receiver, bool bIsFr
|
|||||||
|
|
||||||
void ChatPacketHandler::SendTeamRemovePlayer(const PlayerData& receiver, bool bDisband, bool bIsKicked, bool bIsLeaving, bool bLocal, LWOOBJID i64LeaderID, LWOOBJID i64PlayerID, std::u16string wsPlayerName) {
|
void ChatPacketHandler::SendTeamRemovePlayer(const PlayerData& receiver, bool bDisband, bool bIsKicked, bool bIsLeaving, bool bLocal, LWOOBJID i64LeaderID, LWOOBJID i64PlayerID, std::u16string wsPlayerName) {
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(receiver.playerID);
|
bitStream.Write(receiver.playerID);
|
||||||
|
|
||||||
//portion that will get routed:
|
//portion that will get routed:
|
||||||
@@ -835,7 +896,7 @@ void ChatPacketHandler::SendTeamRemovePlayer(const PlayerData& receiver, bool bD
|
|||||||
|
|
||||||
void ChatPacketHandler::SendTeamSetOffWorldFlag(const PlayerData& receiver, LWOOBJID i64PlayerID, LWOZONEID zoneID) {
|
void ChatPacketHandler::SendTeamSetOffWorldFlag(const PlayerData& receiver, LWOOBJID i64PlayerID, LWOZONEID zoneID) {
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(receiver.playerID);
|
bitStream.Write(receiver.playerID);
|
||||||
|
|
||||||
//portion that will get routed:
|
//portion that will get routed:
|
||||||
@@ -869,7 +930,7 @@ void ChatPacketHandler::SendFriendUpdate(const PlayerData& friendData, const Pla
|
|||||||
[bool] - is FTP*/
|
[bool] - is FTP*/
|
||||||
|
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(friendData.playerID);
|
bitStream.Write(friendData.playerID);
|
||||||
|
|
||||||
//portion that will get routed:
|
//portion that will get routed:
|
||||||
@@ -906,7 +967,7 @@ void ChatPacketHandler::SendFriendRequest(const PlayerData& receiver, const Play
|
|||||||
}
|
}
|
||||||
|
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(receiver.playerID);
|
bitStream.Write(receiver.playerID);
|
||||||
|
|
||||||
//portion that will get routed:
|
//portion that will get routed:
|
||||||
@@ -920,7 +981,7 @@ void ChatPacketHandler::SendFriendRequest(const PlayerData& receiver, const Play
|
|||||||
|
|
||||||
void ChatPacketHandler::SendFriendResponse(const PlayerData& receiver, const PlayerData& sender, eAddFriendResponseType responseCode, uint8_t isBestFriendsAlready, uint8_t isBestFriendRequest) {
|
void ChatPacketHandler::SendFriendResponse(const PlayerData& receiver, const PlayerData& sender, eAddFriendResponseType responseCode, uint8_t isBestFriendsAlready, uint8_t isBestFriendRequest) {
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(receiver.playerID);
|
bitStream.Write(receiver.playerID);
|
||||||
|
|
||||||
// Portion that will get routed:
|
// Portion that will get routed:
|
||||||
@@ -943,7 +1004,7 @@ void ChatPacketHandler::SendFriendResponse(const PlayerData& receiver, const Pla
|
|||||||
|
|
||||||
void ChatPacketHandler::SendRemoveFriend(const PlayerData& receiver, std::string& personToRemove, bool isSuccessful) {
|
void ChatPacketHandler::SendRemoveFriend(const PlayerData& receiver, std::string& personToRemove, bool isSuccessful) {
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::ROUTE_TO_PLAYER);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::WORLD_ROUTE_PACKET);
|
||||||
bitStream.Write(receiver.playerID);
|
bitStream.Write(receiver.playerID);
|
||||||
|
|
||||||
//portion that will get routed:
|
//portion that will get routed:
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ namespace ChatPacketHandler {
|
|||||||
void HandleFriendResponse(Packet* packet);
|
void HandleFriendResponse(Packet* packet);
|
||||||
void HandleRemoveFriend(Packet* packet);
|
void HandleRemoveFriend(Packet* packet);
|
||||||
void HandleGMLevelUpdate(Packet* packet);
|
void HandleGMLevelUpdate(Packet* packet);
|
||||||
|
void HandleWho(Packet* packet);
|
||||||
|
void HandleShowAll(Packet* packet);
|
||||||
|
|
||||||
void HandleChatMessage(Packet* packet);
|
void HandleChatMessage(Packet* packet);
|
||||||
void HandlePrivateChatMessage(Packet* packet);
|
void HandlePrivateChatMessage(Packet* packet);
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
#include "PlayerContainer.h"
|
#include "PlayerContainer.h"
|
||||||
#include "ChatPacketHandler.h"
|
#include "ChatPacketHandler.h"
|
||||||
#include "eChatMessageType.h"
|
#include "eChatMessageType.h"
|
||||||
#include "eChatInternalMessageType.h"
|
|
||||||
#include "eWorldMessageType.h"
|
#include "eWorldMessageType.h"
|
||||||
#include "ChatIgnoreList.h"
|
#include "ChatIgnoreList.h"
|
||||||
#include "StringifiedEnum.h"
|
#include "StringifiedEnum.h"
|
||||||
@@ -101,7 +100,7 @@ int main(int argc, char** argv) {
|
|||||||
//It's safe to pass 'localhost' here, as the IP is only used as the external IP.
|
//It's safe to pass 'localhost' here, as the IP is only used as the external IP.
|
||||||
std::string ourIP = "localhost";
|
std::string ourIP = "localhost";
|
||||||
const uint32_t maxClients = GeneralUtils::TryParse<uint32_t>(Game::config->GetValue("max_clients")).value_or(999);
|
const uint32_t maxClients = GeneralUtils::TryParse<uint32_t>(Game::config->GetValue("max_clients")).value_or(999);
|
||||||
const uint32_t ourPort = GeneralUtils::TryParse<uint32_t>(Game::config->GetValue("chat_server_port")).value_or(1501);
|
const uint32_t ourPort = GeneralUtils::TryParse<uint32_t>(Game::config->GetValue("chat_server_port")).value_or(2005);
|
||||||
const auto externalIPString = Game::config->GetValue("external_ip");
|
const auto externalIPString = Game::config->GetValue("external_ip");
|
||||||
if (!externalIPString.empty()) ourIP = externalIPString;
|
if (!externalIPString.empty()) ourIP = externalIPString;
|
||||||
|
|
||||||
@@ -180,49 +179,32 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HandlePacket(Packet* packet) {
|
void HandlePacket(Packet* packet) {
|
||||||
|
if (packet->length < 1) return;
|
||||||
if (packet->data[0] == ID_DISCONNECTION_NOTIFICATION || packet->data[0] == ID_CONNECTION_LOST) {
|
if (packet->data[0] == ID_DISCONNECTION_NOTIFICATION || packet->data[0] == ID_CONNECTION_LOST) {
|
||||||
LOG("A server has disconnected, erasing their connected players from the list.");
|
LOG("A server has disconnected, erasing their connected players from the list.");
|
||||||
}
|
} else if (packet->data[0] == ID_NEW_INCOMING_CONNECTION) {
|
||||||
|
|
||||||
if (packet->data[0] == ID_NEW_INCOMING_CONNECTION) {
|
|
||||||
LOG("A server is connecting, awaiting user list.");
|
LOG("A server is connecting, awaiting user list.");
|
||||||
}
|
} else if (packet->length < 4 || packet->data[0] != ID_USER_PACKET_ENUM) return; // Nothing left to process or not the right packet type
|
||||||
|
|
||||||
if (packet->length < 4) return; // Nothing left to process. Need 4 bytes to continue.
|
CINSTREAM;
|
||||||
|
inStream.SetReadOffset(BYTES_TO_BITS(1));
|
||||||
|
|
||||||
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::CHAT_INTERNAL) {
|
eConnectionType connection;
|
||||||
switch (static_cast<eChatInternalMessageType>(packet->data[3])) {
|
eChatMessageType chatMessageID;
|
||||||
case eChatInternalMessageType::PLAYER_ADDED_NOTIFICATION:
|
|
||||||
Game::playerContainer.InsertPlayer(packet);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case eChatInternalMessageType::PLAYER_REMOVED_NOTIFICATION:
|
inStream.Read(connection);
|
||||||
Game::playerContainer.RemovePlayer(packet);
|
if (connection != eConnectionType::CHAT) return;
|
||||||
break;
|
inStream.Read(chatMessageID);
|
||||||
|
|
||||||
case eChatInternalMessageType::MUTE_UPDATE:
|
switch (chatMessageID) {
|
||||||
|
case eChatMessageType::GM_MUTE:
|
||||||
Game::playerContainer.MuteUpdate(packet);
|
Game::playerContainer.MuteUpdate(packet);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eChatInternalMessageType::CREATE_TEAM:
|
case eChatMessageType::CREATE_TEAM:
|
||||||
Game::playerContainer.CreateTeamServer(packet);
|
Game::playerContainer.CreateTeamServer(packet);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eChatInternalMessageType::ANNOUNCEMENT: {
|
|
||||||
//we just forward this packet to every connected server
|
|
||||||
CINSTREAM;
|
|
||||||
Game::server->Send(&inStream, packet->systemAddress, true); //send to everyone except origin
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
LOG("Unknown CHAT_INTERNAL id: %i", int(packet->data[3]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::CHAT) {
|
|
||||||
eChatMessageType chat_message_type = static_cast<eChatMessageType>(packet->data[3]);
|
|
||||||
switch (chat_message_type) {
|
|
||||||
case eChatMessageType::GET_FRIENDS_LIST:
|
case eChatMessageType::GET_FRIENDS_LIST:
|
||||||
ChatPacketHandler::HandleFriendlistRequest(packet);
|
ChatPacketHandler::HandleFriendlistRequest(packet);
|
||||||
break;
|
break;
|
||||||
@@ -296,6 +278,23 @@ void HandlePacket(Packet* packet) {
|
|||||||
ChatPacketHandler::HandleGMLevelUpdate(packet);
|
ChatPacketHandler::HandleGMLevelUpdate(packet);
|
||||||
break;
|
break;
|
||||||
case eChatMessageType::LOGIN_SESSION_NOTIFY:
|
case eChatMessageType::LOGIN_SESSION_NOTIFY:
|
||||||
|
Game::playerContainer.InsertPlayer(packet);
|
||||||
|
break;
|
||||||
|
case eChatMessageType::GM_ANNOUNCE:{
|
||||||
|
// we just forward this packet to every connected server
|
||||||
|
inStream.ResetReadPointer();
|
||||||
|
Game::server->Send(inStream, packet->systemAddress, true); // send to everyone except origin
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case eChatMessageType::UNEXPECTED_DISCONNECT:
|
||||||
|
Game::playerContainer.RemovePlayer(packet);
|
||||||
|
break;
|
||||||
|
case eChatMessageType::WHO:
|
||||||
|
ChatPacketHandler::HandleWho(packet);
|
||||||
|
break;
|
||||||
|
case eChatMessageType::SHOW_ALL:
|
||||||
|
ChatPacketHandler::HandleShowAll(packet);
|
||||||
|
break;
|
||||||
case eChatMessageType::USER_CHANNEL_CHAT_MESSAGE:
|
case eChatMessageType::USER_CHANNEL_CHAT_MESSAGE:
|
||||||
case eChatMessageType::WORLD_DISCONNECT_REQUEST:
|
case eChatMessageType::WORLD_DISCONNECT_REQUEST:
|
||||||
case eChatMessageType::WORLD_PROXIMITY_RESPONSE:
|
case eChatMessageType::WORLD_PROXIMITY_RESPONSE:
|
||||||
@@ -308,7 +307,6 @@ void HandlePacket(Packet* packet) {
|
|||||||
case eChatMessageType::GUILD_KICK:
|
case eChatMessageType::GUILD_KICK:
|
||||||
case eChatMessageType::GUILD_GET_STATUS:
|
case eChatMessageType::GUILD_GET_STATUS:
|
||||||
case eChatMessageType::GUILD_GET_ALL:
|
case eChatMessageType::GUILD_GET_ALL:
|
||||||
case eChatMessageType::SHOW_ALL:
|
|
||||||
case eChatMessageType::BLUEPRINT_MODERATED:
|
case eChatMessageType::BLUEPRINT_MODERATED:
|
||||||
case eChatMessageType::BLUEPRINT_MODEL_READY:
|
case eChatMessageType::BLUEPRINT_MODEL_READY:
|
||||||
case eChatMessageType::PROPERTY_READY_FOR_APPROVAL:
|
case eChatMessageType::PROPERTY_READY_FOR_APPROVAL:
|
||||||
@@ -323,7 +321,6 @@ void HandlePacket(Packet* packet) {
|
|||||||
case eChatMessageType::CSR_REQUEST:
|
case eChatMessageType::CSR_REQUEST:
|
||||||
case eChatMessageType::CSR_REPLY:
|
case eChatMessageType::CSR_REPLY:
|
||||||
case eChatMessageType::GM_KICK:
|
case eChatMessageType::GM_KICK:
|
||||||
case eChatMessageType::GM_ANNOUNCE:
|
|
||||||
case eChatMessageType::WORLD_ROUTE_PACKET:
|
case eChatMessageType::WORLD_ROUTE_PACKET:
|
||||||
case eChatMessageType::GET_ZONE_POPULATIONS:
|
case eChatMessageType::GET_ZONE_POPULATIONS:
|
||||||
case eChatMessageType::REQUEST_MINIMUM_CHAT_MODE:
|
case eChatMessageType::REQUEST_MINIMUM_CHAT_MODE:
|
||||||
@@ -332,33 +329,18 @@ void HandlePacket(Packet* packet) {
|
|||||||
case eChatMessageType::UGCMANIFEST_REPORT_DONE_FILE:
|
case eChatMessageType::UGCMANIFEST_REPORT_DONE_FILE:
|
||||||
case eChatMessageType::UGCMANIFEST_REPORT_DONE_BLUEPRINT:
|
case eChatMessageType::UGCMANIFEST_REPORT_DONE_BLUEPRINT:
|
||||||
case eChatMessageType::UGCC_REQUEST:
|
case eChatMessageType::UGCC_REQUEST:
|
||||||
case eChatMessageType::WHO:
|
|
||||||
case eChatMessageType::WORLD_PLAYERS_PET_MODERATED_ACKNOWLEDGE:
|
case eChatMessageType::WORLD_PLAYERS_PET_MODERATED_ACKNOWLEDGE:
|
||||||
case eChatMessageType::ACHIEVEMENT_NOTIFY:
|
case eChatMessageType::ACHIEVEMENT_NOTIFY:
|
||||||
case eChatMessageType::GM_CLOSE_PRIVATE_CHAT_WINDOW:
|
case eChatMessageType::GM_CLOSE_PRIVATE_CHAT_WINDOW:
|
||||||
case eChatMessageType::UNEXPECTED_DISCONNECT:
|
|
||||||
case eChatMessageType::PLAYER_READY:
|
case eChatMessageType::PLAYER_READY:
|
||||||
case eChatMessageType::GET_DONATION_TOTAL:
|
case eChatMessageType::GET_DONATION_TOTAL:
|
||||||
case eChatMessageType::UPDATE_DONATION:
|
case eChatMessageType::UPDATE_DONATION:
|
||||||
case eChatMessageType::PRG_CSR_COMMAND:
|
case eChatMessageType::PRG_CSR_COMMAND:
|
||||||
case eChatMessageType::HEARTBEAT_REQUEST_FROM_WORLD:
|
case eChatMessageType::HEARTBEAT_REQUEST_FROM_WORLD:
|
||||||
case eChatMessageType::UPDATE_FREE_TRIAL_STATUS:
|
case eChatMessageType::UPDATE_FREE_TRIAL_STATUS:
|
||||||
LOG("Unhandled CHAT Message id: %s (%i)", StringifiedEnum::ToString(chat_message_type).data(), chat_message_type);
|
LOG("Unhandled CHAT Message id: %s (%i)", StringifiedEnum::ToString(chatMessageID).data(), chatMessageID);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG("Unknown CHAT Message id: %i", chat_message_type);
|
LOG("Unknown CHAT Message id: %i", chatMessageID);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::WORLD) {
|
|
||||||
switch (static_cast<eWorldMessageType>(packet->data[3])) {
|
|
||||||
case eWorldMessageType::ROUTE_PACKET: {
|
|
||||||
LOG("Routing packet from world");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
LOG("Unknown World id: %i", int(packet->data[3]));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
#include "BitStreamUtils.h"
|
#include "BitStreamUtils.h"
|
||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
#include "eConnectionType.h"
|
#include "eConnectionType.h"
|
||||||
#include "eChatInternalMessageType.h"
|
|
||||||
#include "ChatPackets.h"
|
#include "ChatPackets.h"
|
||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
|
#include "eChatMessageType.h"
|
||||||
|
|
||||||
void PlayerContainer::Initialize() {
|
void PlayerContainer::Initialize() {
|
||||||
m_MaxNumberOfBestFriends =
|
m_MaxNumberOfBestFriends =
|
||||||
@@ -36,19 +36,23 @@ void PlayerContainer::InsertPlayer(Packet* packet) {
|
|||||||
data.playerID = playerId;
|
data.playerID = playerId;
|
||||||
|
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
inStream.Read<uint32_t>(len);
|
if (!inStream.Read<uint32_t>(len)) return;
|
||||||
|
|
||||||
for (int i = 0; i < len; i++) {
|
if (len > 33) {
|
||||||
char character; inStream.Read<char>(character);
|
LOG("Received a really long player name, probably a fake packet %i.", len);
|
||||||
data.playerName += character;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
inStream.Read(data.zoneID);
|
data.playerName.resize(len);
|
||||||
inStream.Read(data.muteExpire);
|
inStream.ReadAlignedBytes(reinterpret_cast<unsigned char*>(data.playerName.data()), len);
|
||||||
inStream.Read(data.gmLevel);
|
|
||||||
|
if (!inStream.Read(data.zoneID)) return;
|
||||||
|
if (!inStream.Read(data.muteExpire)) return;
|
||||||
|
if (!inStream.Read(data.gmLevel)) return;
|
||||||
data.sysAddr = packet->systemAddress;
|
data.sysAddr = packet->systemAddress;
|
||||||
|
|
||||||
m_Names[data.playerID] = GeneralUtils::UTF8ToUTF16(data.playerName);
|
m_Names[data.playerID] = GeneralUtils::UTF8ToUTF16(data.playerName);
|
||||||
|
m_PlayerCount++;
|
||||||
|
|
||||||
LOG("Added user: %s (%llu), zone: %i", data.playerName.c_str(), data.playerID, data.zoneID.GetMapID());
|
LOG("Added user: %s (%llu), zone: %i", data.playerName.c_str(), data.playerID, data.zoneID.GetMapID());
|
||||||
|
|
||||||
@@ -87,6 +91,7 @@ void PlayerContainer::RemovePlayer(Packet* packet) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_PlayerCount--;
|
||||||
LOG("Removed user: %llu", playerID);
|
LOG("Removed user: %llu", playerID);
|
||||||
m_Players.erase(playerID);
|
m_Players.erase(playerID);
|
||||||
|
|
||||||
@@ -120,6 +125,11 @@ void PlayerContainer::CreateTeamServer(Packet* packet) {
|
|||||||
size_t membersSize = 0;
|
size_t membersSize = 0;
|
||||||
inStream.Read(membersSize);
|
inStream.Read(membersSize);
|
||||||
|
|
||||||
|
if (membersSize >= 4) {
|
||||||
|
LOG("Tried to create a team with more than 4 players");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<LWOOBJID> members;
|
std::vector<LWOOBJID> members;
|
||||||
|
|
||||||
members.reserve(membersSize);
|
members.reserve(membersSize);
|
||||||
@@ -145,12 +155,12 @@ void PlayerContainer::CreateTeamServer(Packet* packet) {
|
|||||||
|
|
||||||
void PlayerContainer::BroadcastMuteUpdate(LWOOBJID player, time_t time) {
|
void PlayerContainer::BroadcastMuteUpdate(LWOOBJID player, time_t time) {
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::MUTE_UPDATE);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::GM_MUTE);
|
||||||
|
|
||||||
bitStream.Write(player);
|
bitStream.Write(player);
|
||||||
bitStream.Write(time);
|
bitStream.Write(time);
|
||||||
|
|
||||||
Game::server->Send(&bitStream, UNASSIGNED_SYSTEM_ADDRESS, true);
|
Game::server->Send(bitStream, UNASSIGNED_SYSTEM_ADDRESS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TeamData* PlayerContainer::CreateLocalTeam(std::vector<LWOOBJID> members) {
|
TeamData* PlayerContainer::CreateLocalTeam(std::vector<LWOOBJID> members) {
|
||||||
@@ -352,7 +362,7 @@ void PlayerContainer::TeamStatusUpdate(TeamData* team) {
|
|||||||
|
|
||||||
void PlayerContainer::UpdateTeamsOnWorld(TeamData* team, bool deleteTeam) {
|
void PlayerContainer::UpdateTeamsOnWorld(TeamData* team, bool deleteTeam) {
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::TEAM_UPDATE);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::TEAM_GET_STATUS);
|
||||||
|
|
||||||
bitStream.Write(team->teamID);
|
bitStream.Write(team->teamID);
|
||||||
bitStream.Write(deleteTeam);
|
bitStream.Write(deleteTeam);
|
||||||
@@ -365,7 +375,7 @@ void PlayerContainer::UpdateTeamsOnWorld(TeamData* team, bool deleteTeam) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::server->Send(&bitStream, UNASSIGNED_SYSTEM_ADDRESS, true);
|
Game::server->Send(bitStream, UNASSIGNED_SYSTEM_ADDRESS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::u16string PlayerContainer::GetName(LWOOBJID playerID) {
|
std::u16string PlayerContainer::GetName(LWOOBJID playerID) {
|
||||||
@@ -390,7 +400,7 @@ LWOOBJID PlayerContainer::GetId(const std::u16string& playerName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlayerData& PlayerContainer::GetPlayerDataMutable(const LWOOBJID& playerID) {
|
PlayerData& PlayerContainer::GetPlayerDataMutable(const LWOOBJID& playerID) {
|
||||||
return m_Players[playerID];
|
return m_Players.contains(playerID) ? m_Players[playerID] : m_Players[LWOOBJID_EMPTY];
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerData& PlayerContainer::GetPlayerDataMutable(const std::string& playerName) {
|
PlayerData& PlayerContainer::GetPlayerDataMutable(const std::string& playerName) {
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ public:
|
|||||||
const PlayerData& GetPlayerData(const std::string& playerName);
|
const PlayerData& GetPlayerData(const std::string& playerName);
|
||||||
PlayerData& GetPlayerDataMutable(const LWOOBJID& playerID);
|
PlayerData& GetPlayerDataMutable(const LWOOBJID& playerID);
|
||||||
PlayerData& GetPlayerDataMutable(const std::string& playerName);
|
PlayerData& GetPlayerDataMutable(const std::string& playerName);
|
||||||
|
uint32_t GetPlayerCount() { return m_PlayerCount; };
|
||||||
|
uint32_t GetSimCount() { return m_SimCount; };
|
||||||
|
const std::map<LWOOBJID, PlayerData>& GetAllPlayers() { return m_Players; };
|
||||||
|
|
||||||
TeamData* CreateLocalTeam(std::vector<LWOOBJID> members);
|
TeamData* CreateLocalTeam(std::vector<LWOOBJID> members);
|
||||||
TeamData* CreateTeam(LWOOBJID leader, bool local = false);
|
TeamData* CreateTeam(LWOOBJID leader, bool local = false);
|
||||||
@@ -93,5 +96,7 @@ private:
|
|||||||
std::unordered_map<LWOOBJID, std::u16string> m_Names;
|
std::unordered_map<LWOOBJID, std::u16string> m_Names;
|
||||||
uint32_t m_MaxNumberOfBestFriends = 5;
|
uint32_t m_MaxNumberOfBestFriends = 5;
|
||||||
uint32_t m_MaxNumberOfFriends = 50;
|
uint32_t m_MaxNumberOfFriends = 50;
|
||||||
|
uint32_t m_PlayerCount = 0;
|
||||||
|
uint32_t m_SimCount = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,11 @@
|
|||||||
* AMF3 Deserializer written by EmosewaMC
|
* AMF3 Deserializer written by EmosewaMC
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AMFBaseValue* AMFDeserialize::Read(RakNet::BitStream* inStream) {
|
AMFBaseValue* AMFDeserialize::Read(RakNet::BitStream& inStream) {
|
||||||
if (!inStream) return nullptr;
|
|
||||||
AMFBaseValue* returnValue = nullptr;
|
AMFBaseValue* returnValue = nullptr;
|
||||||
// Read in the value type from the bitStream
|
// Read in the value type from the bitStream
|
||||||
eAmf marker;
|
eAmf marker;
|
||||||
inStream->Read(marker);
|
inStream.Read(marker);
|
||||||
// Based on the typing, create the value associated with that and return the base value class
|
// Based on the typing, create the value associated with that and return the base value class
|
||||||
switch (marker) {
|
switch (marker) {
|
||||||
case eAmf::Undefined: {
|
case eAmf::Undefined: {
|
||||||
@@ -79,13 +78,13 @@ AMFBaseValue* AMFDeserialize::Read(RakNet::BitStream* inStream) {
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t AMFDeserialize::ReadU29(RakNet::BitStream* inStream) {
|
uint32_t AMFDeserialize::ReadU29(RakNet::BitStream& inStream) {
|
||||||
bool byteFlag = true;
|
bool byteFlag = true;
|
||||||
uint32_t actualNumber{};
|
uint32_t actualNumber{};
|
||||||
uint8_t numberOfBytesRead{};
|
uint8_t numberOfBytesRead{};
|
||||||
while (byteFlag && numberOfBytesRead < 4) {
|
while (byteFlag && numberOfBytesRead < 4) {
|
||||||
uint8_t byte{};
|
uint8_t byte{};
|
||||||
inStream->Read(byte);
|
inStream.Read(byte);
|
||||||
// Parse the byte
|
// Parse the byte
|
||||||
if (numberOfBytesRead < 3) {
|
if (numberOfBytesRead < 3) {
|
||||||
byteFlag = byte & static_cast<uint8_t>(1 << 7);
|
byteFlag = byte & static_cast<uint8_t>(1 << 7);
|
||||||
@@ -101,7 +100,7 @@ uint32_t AMFDeserialize::ReadU29(RakNet::BitStream* inStream) {
|
|||||||
return actualNumber;
|
return actualNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string AMFDeserialize::ReadString(RakNet::BitStream* inStream) {
|
const std::string AMFDeserialize::ReadString(RakNet::BitStream& inStream) {
|
||||||
auto length = ReadU29(inStream);
|
auto length = ReadU29(inStream);
|
||||||
// Check if this is a reference
|
// Check if this is a reference
|
||||||
bool isReference = length % 2 == 1;
|
bool isReference = length % 2 == 1;
|
||||||
@@ -109,7 +108,7 @@ const std::string AMFDeserialize::ReadString(RakNet::BitStream* inStream) {
|
|||||||
length = length >> 1;
|
length = length >> 1;
|
||||||
if (isReference) {
|
if (isReference) {
|
||||||
std::string value(length, 0);
|
std::string value(length, 0);
|
||||||
inStream->Read(&value[0], length);
|
inStream.Read(&value[0], length);
|
||||||
// Empty strings are never sent by reference
|
// Empty strings are never sent by reference
|
||||||
if (!value.empty()) accessedElements.push_back(value);
|
if (!value.empty()) accessedElements.push_back(value);
|
||||||
return value;
|
return value;
|
||||||
@@ -119,20 +118,20 @@ const std::string AMFDeserialize::ReadString(RakNet::BitStream* inStream) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AMFBaseValue* AMFDeserialize::ReadAmfDouble(RakNet::BitStream* inStream) {
|
AMFBaseValue* AMFDeserialize::ReadAmfDouble(RakNet::BitStream& inStream) {
|
||||||
double value;
|
double value;
|
||||||
inStream->Read<double>(value);
|
inStream.Read<double>(value);
|
||||||
return new AMFDoubleValue(value);
|
return new AMFDoubleValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
AMFBaseValue* AMFDeserialize::ReadAmfArray(RakNet::BitStream* inStream) {
|
AMFBaseValue* AMFDeserialize::ReadAmfArray(RakNet::BitStream& inStream) {
|
||||||
auto arrayValue = new AMFArrayValue();
|
auto arrayValue = new AMFArrayValue();
|
||||||
|
|
||||||
// Read size of dense array
|
// Read size of dense array
|
||||||
auto sizeOfDenseArray = (ReadU29(inStream) >> 1);
|
const auto sizeOfDenseArray = (ReadU29(inStream) >> 1);
|
||||||
// Then read associative portion
|
// Then read associative portion
|
||||||
while (true) {
|
while (true) {
|
||||||
auto key = ReadString(inStream);
|
const auto key = ReadString(inStream);
|
||||||
// No more associative values when we encounter an empty string key
|
// No more associative values when we encounter an empty string key
|
||||||
if (key.size() == 0) break;
|
if (key.size() == 0) break;
|
||||||
arrayValue->Insert(key, Read(inStream));
|
arrayValue->Insert(key, Read(inStream));
|
||||||
@@ -144,10 +143,10 @@ AMFBaseValue* AMFDeserialize::ReadAmfArray(RakNet::BitStream* inStream) {
|
|||||||
return arrayValue;
|
return arrayValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
AMFBaseValue* AMFDeserialize::ReadAmfString(RakNet::BitStream* inStream) {
|
AMFBaseValue* AMFDeserialize::ReadAmfString(RakNet::BitStream& inStream) {
|
||||||
return new AMFStringValue(ReadString(inStream));
|
return new AMFStringValue(ReadString(inStream));
|
||||||
}
|
}
|
||||||
|
|
||||||
AMFBaseValue* AMFDeserialize::ReadAmfInteger(RakNet::BitStream* inStream) {
|
AMFBaseValue* AMFDeserialize::ReadAmfInteger(RakNet::BitStream& inStream) {
|
||||||
return new AMFIntValue(ReadU29(inStream));
|
return new AMFIntValue(ReadU29(inStream));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public:
|
|||||||
* @param inStream inStream to read value from.
|
* @param inStream inStream to read value from.
|
||||||
* @return Returns an AMFValue with all the information from the bitStream in it.
|
* @return Returns an AMFValue with all the information from the bitStream in it.
|
||||||
*/
|
*/
|
||||||
AMFBaseValue* Read(RakNet::BitStream* inStream);
|
AMFBaseValue* Read(RakNet::BitStream& inStream);
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Private method to read a U29 integer from a bitstream
|
* @brief Private method to read a U29 integer from a bitstream
|
||||||
@@ -23,7 +23,7 @@ private:
|
|||||||
* @param inStream bitstream to read data from
|
* @param inStream bitstream to read data from
|
||||||
* @return The number as an unsigned 29 bit integer
|
* @return The number as an unsigned 29 bit integer
|
||||||
*/
|
*/
|
||||||
uint32_t ReadU29(RakNet::BitStream* inStream);
|
static uint32_t ReadU29(RakNet::BitStream& inStream);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reads a string from a bitstream
|
* @brief Reads a string from a bitstream
|
||||||
@@ -31,7 +31,7 @@ private:
|
|||||||
* @param inStream bitStream to read data from
|
* @param inStream bitStream to read data from
|
||||||
* @return The read string
|
* @return The read string
|
||||||
*/
|
*/
|
||||||
const std::string ReadString(RakNet::BitStream* inStream);
|
const std::string ReadString(RakNet::BitStream& inStream);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read an AMFDouble value from a bitStream
|
* @brief Read an AMFDouble value from a bitStream
|
||||||
@@ -39,7 +39,7 @@ private:
|
|||||||
* @param inStream bitStream to read data from
|
* @param inStream bitStream to read data from
|
||||||
* @return Double value represented as an AMFValue
|
* @return Double value represented as an AMFValue
|
||||||
*/
|
*/
|
||||||
AMFBaseValue* ReadAmfDouble(RakNet::BitStream* inStream);
|
AMFBaseValue* ReadAmfDouble(RakNet::BitStream& inStream);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read an AMFArray from a bitStream
|
* @brief Read an AMFArray from a bitStream
|
||||||
@@ -47,7 +47,7 @@ private:
|
|||||||
* @param inStream bitStream to read data from
|
* @param inStream bitStream to read data from
|
||||||
* @return Array value represented as an AMFValue
|
* @return Array value represented as an AMFValue
|
||||||
*/
|
*/
|
||||||
AMFBaseValue* ReadAmfArray(RakNet::BitStream* inStream);
|
AMFBaseValue* ReadAmfArray(RakNet::BitStream& inStream);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read an AMFString from a bitStream
|
* @brief Read an AMFString from a bitStream
|
||||||
@@ -55,7 +55,7 @@ private:
|
|||||||
* @param inStream bitStream to read data from
|
* @param inStream bitStream to read data from
|
||||||
* @return String value represented as an AMFValue
|
* @return String value represented as an AMFValue
|
||||||
*/
|
*/
|
||||||
AMFBaseValue* ReadAmfString(RakNet::BitStream* inStream);
|
AMFBaseValue* ReadAmfString(RakNet::BitStream& inStream);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read an AMFInteger from a bitStream
|
* @brief Read an AMFInteger from a bitStream
|
||||||
@@ -63,7 +63,7 @@ private:
|
|||||||
* @param inStream bitStream to read data from
|
* @param inStream bitStream to read data from
|
||||||
* @return Integer value represented as an AMFValue
|
* @return Integer value represented as an AMFValue
|
||||||
*/
|
*/
|
||||||
AMFBaseValue* ReadAmfInteger(RakNet::BitStream* inStream);
|
AMFBaseValue* ReadAmfInteger(RakNet::BitStream& inStream);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of strings read so far saved to be read by reference.
|
* List of strings read so far saved to be read by reference.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __AMF3__H__
|
#ifndef AMF3_H
|
||||||
#define __AMF3__H__
|
#define AMF3_H
|
||||||
|
|
||||||
#include "dCommonVars.h"
|
#include "dCommonVars.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
@@ -42,6 +42,7 @@ class AMFValue : public AMFBaseValue {
|
|||||||
public:
|
public:
|
||||||
AMFValue() = default;
|
AMFValue() = default;
|
||||||
AMFValue(const ValueType value) : m_Data{ value } {}
|
AMFValue(const ValueType value) : m_Data{ value } {}
|
||||||
|
|
||||||
virtual ~AMFValue() override = default;
|
virtual ~AMFValue() override = default;
|
||||||
|
|
||||||
[[nodiscard]] constexpr eAmf GetValueType() const noexcept override;
|
[[nodiscard]] constexpr eAmf GetValueType() const noexcept override;
|
||||||
@@ -376,4 +377,4 @@ private:
|
|||||||
AMFDense m_Dense;
|
AMFDense m_Dense;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__AMF3__H__
|
#endif //!AMF3_H
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ void RakNet::BitStream::Write<AMFBaseValue&>(AMFBaseValue& value) {
|
|||||||
* A private function to write an value to a RakNet::BitStream
|
* A private function to write an value to a RakNet::BitStream
|
||||||
* RakNet writes in the correct byte order - do not reverse this.
|
* RakNet writes in the correct byte order - do not reverse this.
|
||||||
*/
|
*/
|
||||||
void WriteUInt29(RakNet::BitStream* bs, uint32_t v) {
|
void WriteUInt29(RakNet::BitStream& bs, uint32_t v) {
|
||||||
unsigned char b4 = static_cast<unsigned char>(v);
|
unsigned char b4 = static_cast<unsigned char>(v);
|
||||||
if (v < 0x00200000) {
|
if (v < 0x00200000) {
|
||||||
b4 = b4 & 0x7F;
|
b4 = b4 & 0x7F;
|
||||||
@@ -65,10 +65,10 @@ void WriteUInt29(RakNet::BitStream* bs, uint32_t v) {
|
|||||||
unsigned char b2;
|
unsigned char b2;
|
||||||
v = v >> 7;
|
v = v >> 7;
|
||||||
b2 = static_cast<unsigned char>(v) | 0x80;
|
b2 = static_cast<unsigned char>(v) | 0x80;
|
||||||
bs->Write(b2);
|
bs.Write(b2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bs->Write(b3);
|
bs.Write(b3);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unsigned char b1;
|
unsigned char b1;
|
||||||
@@ -82,19 +82,19 @@ void WriteUInt29(RakNet::BitStream* bs, uint32_t v) {
|
|||||||
v = v >> 7;
|
v = v >> 7;
|
||||||
b1 = static_cast<unsigned char>(v) | 0x80;
|
b1 = static_cast<unsigned char>(v) | 0x80;
|
||||||
|
|
||||||
bs->Write(b1);
|
bs.Write(b1);
|
||||||
bs->Write(b2);
|
bs.Write(b2);
|
||||||
bs->Write(b3);
|
bs.Write(b3);
|
||||||
}
|
}
|
||||||
|
|
||||||
bs->Write(b4);
|
bs.Write(b4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a flag number to a RakNet::BitStream
|
* Writes a flag number to a RakNet::BitStream
|
||||||
* RakNet writes in the correct byte order - do not reverse this.
|
* RakNet writes in the correct byte order - do not reverse this.
|
||||||
*/
|
*/
|
||||||
void WriteFlagNumber(RakNet::BitStream* bs, uint32_t v) {
|
void WriteFlagNumber(RakNet::BitStream& bs, uint32_t v) {
|
||||||
v = (v << 1) | 0x01;
|
v = (v << 1) | 0x01;
|
||||||
WriteUInt29(bs, v);
|
WriteUInt29(bs, v);
|
||||||
}
|
}
|
||||||
@@ -104,9 +104,9 @@ void WriteFlagNumber(RakNet::BitStream* bs, uint32_t v) {
|
|||||||
*
|
*
|
||||||
* RakNet writes in the correct byte order - do not reverse this.
|
* RakNet writes in the correct byte order - do not reverse this.
|
||||||
*/
|
*/
|
||||||
void WriteAMFString(RakNet::BitStream* bs, const std::string& str) {
|
void WriteAMFString(RakNet::BitStream& bs, const std::string& str) {
|
||||||
WriteFlagNumber(bs, static_cast<uint32_t>(str.size()));
|
WriteFlagNumber(bs, static_cast<uint32_t>(str.size()));
|
||||||
bs->Write(str.c_str(), static_cast<uint32_t>(str.size()));
|
bs.Write(str.c_str(), static_cast<uint32_t>(str.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,8 +114,8 @@ void WriteAMFString(RakNet::BitStream* bs, const std::string& str) {
|
|||||||
*
|
*
|
||||||
* RakNet writes in the correct byte order - do not reverse this.
|
* RakNet writes in the correct byte order - do not reverse this.
|
||||||
*/
|
*/
|
||||||
void WriteAMFU16(RakNet::BitStream* bs, uint16_t value) {
|
void WriteAMFU16(RakNet::BitStream& bs, uint16_t value) {
|
||||||
bs->Write(value);
|
bs.Write(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,8 +123,8 @@ void WriteAMFU16(RakNet::BitStream* bs, uint16_t value) {
|
|||||||
*
|
*
|
||||||
* RakNet writes in the correct byte order - do not reverse this.
|
* RakNet writes in the correct byte order - do not reverse this.
|
||||||
*/
|
*/
|
||||||
void WriteAMFU32(RakNet::BitStream* bs, uint32_t value) {
|
void WriteAMFU32(RakNet::BitStream& bs, uint32_t value) {
|
||||||
bs->Write(value);
|
bs.Write(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,40 +132,40 @@ void WriteAMFU32(RakNet::BitStream* bs, uint32_t value) {
|
|||||||
*
|
*
|
||||||
* RakNet writes in the correct byte order - do not reverse this.
|
* RakNet writes in the correct byte order - do not reverse this.
|
||||||
*/
|
*/
|
||||||
void WriteAMFU64(RakNet::BitStream* bs, uint64_t value) {
|
void WriteAMFU64(RakNet::BitStream& bs, uint64_t value) {
|
||||||
bs->Write(value);
|
bs.Write(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Writes an AMFIntegerValue to BitStream
|
// Writes an AMFIntegerValue to BitStream
|
||||||
template<>
|
template<>
|
||||||
void RakNet::BitStream::Write<AMFIntValue&>(AMFIntValue& value) {
|
void RakNet::BitStream::Write<AMFIntValue&>(AMFIntValue& value) {
|
||||||
WriteUInt29(this, value.GetValue());
|
WriteUInt29(*this, value.GetValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Writes an AMFDoubleValue to BitStream
|
// Writes an AMFDoubleValue to BitStream
|
||||||
template<>
|
template<>
|
||||||
void RakNet::BitStream::Write<AMFDoubleValue&>(AMFDoubleValue& value) {
|
void RakNet::BitStream::Write<AMFDoubleValue&>(AMFDoubleValue& value) {
|
||||||
double d = value.GetValue();
|
double d = value.GetValue();
|
||||||
WriteAMFU64(this, *reinterpret_cast<uint64_t*>(&d));
|
WriteAMFU64(*this, *reinterpret_cast<uint64_t*>(&d));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Writes an AMFStringValue to BitStream
|
// Writes an AMFStringValue to BitStream
|
||||||
template<>
|
template<>
|
||||||
void RakNet::BitStream::Write<AMFStringValue&>(AMFStringValue& value) {
|
void RakNet::BitStream::Write<AMFStringValue&>(AMFStringValue& value) {
|
||||||
WriteAMFString(this, value.GetValue());
|
WriteAMFString(*this, value.GetValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Writes an AMFArrayValue to BitStream
|
// Writes an AMFArrayValue to BitStream
|
||||||
template<>
|
template<>
|
||||||
void RakNet::BitStream::Write<AMFArrayValue&>(AMFArrayValue& value) {
|
void RakNet::BitStream::Write<AMFArrayValue&>(AMFArrayValue& value) {
|
||||||
uint32_t denseSize = value.GetDense().size();
|
uint32_t denseSize = value.GetDense().size();
|
||||||
WriteFlagNumber(this, denseSize);
|
WriteFlagNumber(*this, denseSize);
|
||||||
|
|
||||||
auto it = value.GetAssociative().begin();
|
auto it = value.GetAssociative().begin();
|
||||||
auto end = value.GetAssociative().end();
|
auto end = value.GetAssociative().end();
|
||||||
|
|
||||||
while (it != end) {
|
while (it != end) {
|
||||||
WriteAMFString(this, it->first);
|
WriteAMFString(*this, it->first);
|
||||||
this->Write<AMFBaseValue&>(*it->second);
|
this->Write<AMFBaseValue&>(*it->second);
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __BINARYIO__H__
|
#ifndef BINARYIO_H
|
||||||
#define __BINARYIO__H__
|
#define BINARYIO_H
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -71,4 +71,4 @@ namespace BinaryIO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //!__BINARYIO__H__
|
#endif //!BINARYIO_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __BINARYPATHFINDER__H__
|
#ifndef BINARYPATHFINDER_H
|
||||||
#define __BINARYPATHFINDER__H__
|
#define BINARYPATHFINDER_H
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
@@ -12,4 +12,4 @@ public:
|
|||||||
static std::filesystem::path GetBinaryDir();
|
static std::filesystem::path GetBinaryDir();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__BINARYPATHFINDER__H__
|
#endif //!BINARYPATHFINDER_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __BRICK__H__
|
#ifndef BRICK_H
|
||||||
#define __BRICK__H__
|
#define BRICK_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -8,4 +8,4 @@ struct Brick {
|
|||||||
uint32_t materialID;
|
uint32_t materialID;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__BRICK__H__
|
#endif //!BRICK_H
|
||||||
|
|||||||
@@ -30,11 +30,15 @@ foreach(file ${DCOMMON_DCLIENT_SOURCES})
|
|||||||
set(DCOMMON_SOURCES ${DCOMMON_SOURCES} "dClient/${file}")
|
set(DCOMMON_SOURCES ${DCOMMON_SOURCES} "dClient/${file}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/dCommon/)
|
|
||||||
|
|
||||||
add_library(dCommon STATIC ${DCOMMON_SOURCES})
|
add_library(dCommon STATIC ${DCOMMON_SOURCES})
|
||||||
|
target_include_directories(dCommon
|
||||||
target_link_libraries(dCommon bcrypt dDatabase tinyxml2)
|
PUBLIC "." "dClient" "dEnums"
|
||||||
|
PRIVATE
|
||||||
|
"${PROJECT_SOURCE_DIR}/dDatabase/GameDatabase"
|
||||||
|
"${PROJECT_SOURCE_DIR}/dDatabase/GameDatabase/ITables"
|
||||||
|
"${PROJECT_SOURCE_DIR}/dDatabase/CDClientDatabase"
|
||||||
|
"${PROJECT_SOURCE_DIR}/thirdparty/mariadb-connector-cpp/include"
|
||||||
|
)
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
@@ -65,4 +69,6 @@ else ()
|
|||||||
)
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_link_libraries(dCommon ZLIB::ZLIB)
|
target_link_libraries(dCommon
|
||||||
|
PRIVATE ZLIB::ZLIB bcrypt tinyxml2
|
||||||
|
INTERFACE dDatabase)
|
||||||
|
|||||||
@@ -120,6 +120,8 @@ void CatchUnhandled(int sig) {
|
|||||||
if (eptr) std::rethrow_exception(eptr);
|
if (eptr) std::rethrow_exception(eptr);
|
||||||
} catch(const std::exception& e) {
|
} catch(const std::exception& e) {
|
||||||
LOG("Caught exception: '%s'", e.what());
|
LOG("Caught exception: '%s'", e.what());
|
||||||
|
} catch (...) {
|
||||||
|
LOG("Caught unknown exception.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef INCLUDE_BACKTRACE
|
#ifndef INCLUDE_BACKTRACE
|
||||||
@@ -199,7 +201,7 @@ void OnTerminate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MakeBacktrace() {
|
void MakeBacktrace() {
|
||||||
struct sigaction sigact;
|
struct sigaction sigact{};
|
||||||
|
|
||||||
sigact.sa_sigaction = CritErrHdlr;
|
sigact.sa_sigaction = CritErrHdlr;
|
||||||
sigact.sa_flags = SA_RESTART | SA_SIGINFO;
|
sigact.sa_flags = SA_RESTART | SA_SIGINFO;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __DLUASSERT__H__
|
#ifndef DLUASSERT_H
|
||||||
#define __DLUASSERT__H__
|
#define DLUASSERT_H
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@@ -9,4 +9,4 @@
|
|||||||
# define DluAssert(expression)
|
# define DluAssert(expression)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //!__DLUASSERT__H__
|
#endif //!DLUASSERT_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __FDBTOSQLITE__H__
|
#ifndef FDBTOSQLITE_H
|
||||||
#define __FDBTOSQLITE__H__
|
#define FDBTOSQLITE_H
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@@ -142,4 +142,4 @@ namespace FdbToSqlite {
|
|||||||
}; //! class FdbToSqlite
|
}; //! class FdbToSqlite
|
||||||
}; //! namespace FdbToSqlite
|
}; //! namespace FdbToSqlite
|
||||||
|
|
||||||
#endif //!__FDBTOSQLITE__H__
|
#endif //!FDBTOSQLITE_H
|
||||||
|
|||||||
@@ -8,23 +8,23 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline size_t MinSize(size_t size, const std::basic_string_view<T>& string) {
|
static inline size_t MinSize(const size_t size, const std::basic_string_view<T> string) {
|
||||||
if (size == size_t(-1) || size > string.size()) {
|
if (size == SIZE_MAX || size > string.size()) {
|
||||||
return string.size();
|
return string.size();
|
||||||
} else {
|
} else {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsLeadSurrogate(char16_t c) {
|
inline bool IsLeadSurrogate(const char16_t c) {
|
||||||
return (0xD800 <= c) && (c <= 0xDBFF);
|
return (0xD800 <= c) && (c <= 0xDBFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsTrailSurrogate(char16_t c) {
|
inline bool IsTrailSurrogate(const char16_t c) {
|
||||||
return (0xDC00 <= c) && (c <= 0xDFFF);
|
return (0xDC00 <= c) && (c <= 0xDFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void PushUTF8CodePoint(std::string& ret, char32_t cp) {
|
inline void PushUTF8CodePoint(std::string& ret, const char32_t cp) {
|
||||||
if (cp <= 0x007F) {
|
if (cp <= 0x007F) {
|
||||||
ret.push_back(static_cast<uint8_t>(cp));
|
ret.push_back(static_cast<uint8_t>(cp));
|
||||||
} else if (cp <= 0x07FF) {
|
} else if (cp <= 0x07FF) {
|
||||||
@@ -46,16 +46,16 @@ inline void PushUTF8CodePoint(std::string& ret, char32_t cp) {
|
|||||||
|
|
||||||
constexpr const char16_t REPLACEMENT_CHARACTER = 0xFFFD;
|
constexpr const char16_t REPLACEMENT_CHARACTER = 0xFFFD;
|
||||||
|
|
||||||
bool _IsSuffixChar(uint8_t c) {
|
bool static _IsSuffixChar(const uint8_t c) {
|
||||||
return (c & 0xC0) == 0x80;
|
return (c & 0xC0) == 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneralUtils::_NextUTF8Char(std::string_view& slice, uint32_t& out) {
|
bool GeneralUtils::details::_NextUTF8Char(std::string_view& slice, uint32_t& out) {
|
||||||
size_t rem = slice.length();
|
const size_t rem = slice.length();
|
||||||
if (slice.empty()) return false;
|
if (slice.empty()) return false;
|
||||||
const uint8_t* bytes = reinterpret_cast<const uint8_t*>(&slice.front());
|
const uint8_t* bytes = reinterpret_cast<const uint8_t*>(&slice.front());
|
||||||
if (rem > 0) {
|
if (rem > 0) {
|
||||||
uint8_t first = bytes[0];
|
const uint8_t first = bytes[0];
|
||||||
if (first < 0x80) { // 1 byte character
|
if (first < 0x80) { // 1 byte character
|
||||||
out = static_cast<uint32_t>(first & 0x7F);
|
out = static_cast<uint32_t>(first & 0x7F);
|
||||||
slice.remove_prefix(1);
|
slice.remove_prefix(1);
|
||||||
@@ -64,7 +64,7 @@ bool GeneralUtils::_NextUTF8Char(std::string_view& slice, uint32_t& out) {
|
|||||||
// middle byte, not valid at start, fall through
|
// middle byte, not valid at start, fall through
|
||||||
} else if (first < 0xE0) { // two byte character
|
} else if (first < 0xE0) { // two byte character
|
||||||
if (rem > 1) {
|
if (rem > 1) {
|
||||||
uint8_t second = bytes[1];
|
const uint8_t second = bytes[1];
|
||||||
if (_IsSuffixChar(second)) {
|
if (_IsSuffixChar(second)) {
|
||||||
out = (static_cast<uint32_t>(first & 0x1F) << 6)
|
out = (static_cast<uint32_t>(first & 0x1F) << 6)
|
||||||
+ static_cast<uint32_t>(second & 0x3F);
|
+ static_cast<uint32_t>(second & 0x3F);
|
||||||
@@ -74,8 +74,8 @@ bool GeneralUtils::_NextUTF8Char(std::string_view& slice, uint32_t& out) {
|
|||||||
}
|
}
|
||||||
} else if (first < 0xF0) { // three byte character
|
} else if (first < 0xF0) { // three byte character
|
||||||
if (rem > 2) {
|
if (rem > 2) {
|
||||||
uint8_t second = bytes[1];
|
const uint8_t second = bytes[1];
|
||||||
uint8_t third = bytes[2];
|
const uint8_t third = bytes[2];
|
||||||
if (_IsSuffixChar(second) && _IsSuffixChar(third)) {
|
if (_IsSuffixChar(second) && _IsSuffixChar(third)) {
|
||||||
out = (static_cast<uint32_t>(first & 0x0F) << 12)
|
out = (static_cast<uint32_t>(first & 0x0F) << 12)
|
||||||
+ (static_cast<uint32_t>(second & 0x3F) << 6)
|
+ (static_cast<uint32_t>(second & 0x3F) << 6)
|
||||||
@@ -86,9 +86,9 @@ bool GeneralUtils::_NextUTF8Char(std::string_view& slice, uint32_t& out) {
|
|||||||
}
|
}
|
||||||
} else if (first < 0xF8) { // four byte character
|
} else if (first < 0xF8) { // four byte character
|
||||||
if (rem > 3) {
|
if (rem > 3) {
|
||||||
uint8_t second = bytes[1];
|
const uint8_t second = bytes[1];
|
||||||
uint8_t third = bytes[2];
|
const uint8_t third = bytes[2];
|
||||||
uint8_t fourth = bytes[3];
|
const uint8_t fourth = bytes[3];
|
||||||
if (_IsSuffixChar(second) && _IsSuffixChar(third) && _IsSuffixChar(fourth)) {
|
if (_IsSuffixChar(second) && _IsSuffixChar(third) && _IsSuffixChar(fourth)) {
|
||||||
out = (static_cast<uint32_t>(first & 0x07) << 18)
|
out = (static_cast<uint32_t>(first & 0x07) << 18)
|
||||||
+ (static_cast<uint32_t>(second & 0x3F) << 12)
|
+ (static_cast<uint32_t>(second & 0x3F) << 12)
|
||||||
@@ -107,7 +107,7 @@ bool GeneralUtils::_NextUTF8Char(std::string_view& slice, uint32_t& out) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// See <https://www.ietf.org/rfc/rfc2781.html#section-2.1>
|
/// See <https://www.ietf.org/rfc/rfc2781.html#section-2.1>
|
||||||
bool PushUTF16CodePoint(std::u16string& output, uint32_t U, size_t size) {
|
bool PushUTF16CodePoint(std::u16string& output, const uint32_t U, const size_t size) {
|
||||||
if (output.length() >= size) return false;
|
if (output.length() >= size) return false;
|
||||||
if (U < 0x10000) {
|
if (U < 0x10000) {
|
||||||
// If U < 0x10000, encode U as a 16-bit unsigned integer and terminate.
|
// If U < 0x10000, encode U as a 16-bit unsigned integer and terminate.
|
||||||
@@ -120,7 +120,7 @@ bool PushUTF16CodePoint(std::u16string& output, uint32_t U, size_t size) {
|
|||||||
// Let U' = U - 0x10000. Because U is less than or equal to 0x10FFFF,
|
// Let U' = U - 0x10000. Because U is less than or equal to 0x10FFFF,
|
||||||
// U' must be less than or equal to 0xFFFFF. That is, U' can be
|
// U' must be less than or equal to 0xFFFFF. That is, U' can be
|
||||||
// represented in 20 bits.
|
// represented in 20 bits.
|
||||||
uint32_t Ut = U - 0x10000;
|
const uint32_t Ut = U - 0x10000;
|
||||||
|
|
||||||
// Initialize two 16-bit unsigned integers, W1 and W2, to 0xD800 and
|
// Initialize two 16-bit unsigned integers, W1 and W2, to 0xD800 and
|
||||||
// 0xDC00, respectively. These integers each have 10 bits free to
|
// 0xDC00, respectively. These integers each have 10 bits free to
|
||||||
@@ -141,25 +141,25 @@ bool PushUTF16CodePoint(std::u16string& output, uint32_t U, size_t size) {
|
|||||||
} else return false;
|
} else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::u16string GeneralUtils::UTF8ToUTF16(const std::string_view& string, size_t size) {
|
std::u16string GeneralUtils::UTF8ToUTF16(const std::string_view string, const size_t size) {
|
||||||
size_t newSize = MinSize(size, string);
|
const size_t newSize = MinSize(size, string);
|
||||||
std::u16string output;
|
std::u16string output;
|
||||||
output.reserve(newSize);
|
output.reserve(newSize);
|
||||||
std::string_view iterator = string;
|
std::string_view iterator = string;
|
||||||
|
|
||||||
uint32_t c;
|
uint32_t c;
|
||||||
while (_NextUTF8Char(iterator, c) && PushUTF16CodePoint(output, c, size)) {}
|
while (details::_NextUTF8Char(iterator, c) && PushUTF16CodePoint(output, c, size)) {}
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Converts an std::string (ASCII) to UCS-2 / UTF-16
|
//! Converts an std::string (ASCII) to UCS-2 / UTF-16
|
||||||
std::u16string GeneralUtils::ASCIIToUTF16(const std::string_view& string, size_t size) {
|
std::u16string GeneralUtils::ASCIIToUTF16(const std::string_view string, const size_t size) {
|
||||||
size_t newSize = MinSize(size, string);
|
const size_t newSize = MinSize(size, string);
|
||||||
std::u16string ret;
|
std::u16string ret;
|
||||||
ret.reserve(newSize);
|
ret.reserve(newSize);
|
||||||
|
|
||||||
for (size_t i = 0; i < newSize; i++) {
|
for (size_t i = 0; i < newSize; ++i) {
|
||||||
char c = string[i];
|
const char c = string[i];
|
||||||
// Note: both 7-bit ascii characters and REPLACEMENT_CHARACTER fit in one char16_t
|
// Note: both 7-bit ascii characters and REPLACEMENT_CHARACTER fit in one char16_t
|
||||||
ret.push_back((c > 0 && c <= 127) ? static_cast<char16_t>(c) : REPLACEMENT_CHARACTER);
|
ret.push_back((c > 0 && c <= 127) ? static_cast<char16_t>(c) : REPLACEMENT_CHARACTER);
|
||||||
}
|
}
|
||||||
@@ -169,18 +169,18 @@ std::u16string GeneralUtils::ASCIIToUTF16(const std::string_view& string, size_t
|
|||||||
|
|
||||||
//! Converts a (potentially-ill-formed) UTF-16 string to UTF-8
|
//! Converts a (potentially-ill-formed) UTF-16 string to UTF-8
|
||||||
//! See: <http://simonsapin.github.io/wtf-8/#decoding-ill-formed-utf-16>
|
//! See: <http://simonsapin.github.io/wtf-8/#decoding-ill-formed-utf-16>
|
||||||
std::string GeneralUtils::UTF16ToWTF8(const std::u16string_view& string, size_t size) {
|
std::string GeneralUtils::UTF16ToWTF8(const std::u16string_view string, const size_t size) {
|
||||||
size_t newSize = MinSize(size, string);
|
const size_t newSize = MinSize(size, string);
|
||||||
std::string ret;
|
std::string ret;
|
||||||
ret.reserve(newSize);
|
ret.reserve(newSize);
|
||||||
|
|
||||||
for (size_t i = 0; i < newSize; i++) {
|
for (size_t i = 0; i < newSize; ++i) {
|
||||||
char16_t u = string[i];
|
const char16_t u = string[i];
|
||||||
if (IsLeadSurrogate(u) && (i + 1) < newSize) {
|
if (IsLeadSurrogate(u) && (i + 1) < newSize) {
|
||||||
char16_t next = string[i + 1];
|
const char16_t next = string[i + 1];
|
||||||
if (IsTrailSurrogate(next)) {
|
if (IsTrailSurrogate(next)) {
|
||||||
i += 1;
|
i += 1;
|
||||||
char32_t cp = 0x10000
|
const char32_t cp = 0x10000
|
||||||
+ ((static_cast<char32_t>(u) - 0xD800) << 10)
|
+ ((static_cast<char32_t>(u) - 0xD800) << 10)
|
||||||
+ (static_cast<char32_t>(next) - 0xDC00);
|
+ (static_cast<char32_t>(next) - 0xDC00);
|
||||||
PushUTF8CodePoint(ret, cp);
|
PushUTF8CodePoint(ret, cp);
|
||||||
@@ -195,40 +195,40 @@ std::string GeneralUtils::UTF16ToWTF8(const std::u16string_view& string, size_t
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneralUtils::CaseInsensitiveStringCompare(const std::string& a, const std::string& b) {
|
bool GeneralUtils::CaseInsensitiveStringCompare(const std::string_view a, const std::string_view b) {
|
||||||
return std::equal(a.begin(), a.end(), b.begin(), b.end(), [](char a, char b) { return tolower(a) == tolower(b); });
|
return std::equal(a.begin(), a.end(), b.begin(), b.end(), [](char a, char b) { return tolower(a) == tolower(b); });
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Bits
|
// MARK: Bits
|
||||||
|
|
||||||
//! Sets a specific bit in a signed 64-bit integer
|
//! Sets a specific bit in a signed 64-bit integer
|
||||||
int64_t GeneralUtils::SetBit(int64_t value, uint32_t index) {
|
int64_t GeneralUtils::SetBit(int64_t value, const uint32_t index) {
|
||||||
return value |= 1ULL << index;
|
return value |= 1ULL << index;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Clears a specific bit in a signed 64-bit integer
|
//! Clears a specific bit in a signed 64-bit integer
|
||||||
int64_t GeneralUtils::ClearBit(int64_t value, uint32_t index) {
|
int64_t GeneralUtils::ClearBit(int64_t value, const uint32_t index) {
|
||||||
return value &= ~(1ULL << index);
|
return value &= ~(1ULL << index);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Checks a specific bit in a signed 64-bit integer
|
//! Checks a specific bit in a signed 64-bit integer
|
||||||
bool GeneralUtils::CheckBit(int64_t value, uint32_t index) {
|
bool GeneralUtils::CheckBit(int64_t value, const uint32_t index) {
|
||||||
return value & (1ULL << index);
|
return value & (1ULL << index);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneralUtils::ReplaceInString(std::string& str, const std::string& from, const std::string& to) {
|
bool GeneralUtils::ReplaceInString(std::string& str, const std::string_view from, const std::string_view to) {
|
||||||
size_t start_pos = str.find(from);
|
const size_t start_pos = str.find(from);
|
||||||
if (start_pos == std::string::npos)
|
if (start_pos == std::string::npos)
|
||||||
return false;
|
return false;
|
||||||
str.replace(start_pos, from.length(), to);
|
str.replace(start_pos, from.length(), to);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::wstring> GeneralUtils::SplitString(std::wstring& str, wchar_t delimiter) {
|
std::vector<std::wstring> GeneralUtils::SplitString(const std::wstring_view str, const wchar_t delimiter) {
|
||||||
std::vector<std::wstring> vector = std::vector<std::wstring>();
|
std::vector<std::wstring> vector = std::vector<std::wstring>();
|
||||||
std::wstring current;
|
std::wstring current;
|
||||||
|
|
||||||
for (const auto& c : str) {
|
for (const wchar_t c : str) {
|
||||||
if (c == delimiter) {
|
if (c == delimiter) {
|
||||||
vector.push_back(current);
|
vector.push_back(current);
|
||||||
current = L"";
|
current = L"";
|
||||||
@@ -237,15 +237,15 @@ std::vector<std::wstring> GeneralUtils::SplitString(std::wstring& str, wchar_t d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector.push_back(current);
|
vector.push_back(std::move(current));
|
||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::u16string> GeneralUtils::SplitString(const std::u16string& str, char16_t delimiter) {
|
std::vector<std::u16string> GeneralUtils::SplitString(const std::u16string_view str, const char16_t delimiter) {
|
||||||
std::vector<std::u16string> vector = std::vector<std::u16string>();
|
std::vector<std::u16string> vector = std::vector<std::u16string>();
|
||||||
std::u16string current;
|
std::u16string current;
|
||||||
|
|
||||||
for (const auto& c : str) {
|
for (const char16_t c : str) {
|
||||||
if (c == delimiter) {
|
if (c == delimiter) {
|
||||||
vector.push_back(current);
|
vector.push_back(current);
|
||||||
current = u"";
|
current = u"";
|
||||||
@@ -254,17 +254,15 @@ std::vector<std::u16string> GeneralUtils::SplitString(const std::u16string& str,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector.push_back(current);
|
vector.push_back(std::move(current));
|
||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> GeneralUtils::SplitString(const std::string& str, char delimiter) {
|
std::vector<std::string> GeneralUtils::SplitString(const std::string_view str, const char delimiter) {
|
||||||
std::vector<std::string> vector = std::vector<std::string>();
|
std::vector<std::string> vector = std::vector<std::string>();
|
||||||
std::string current = "";
|
std::string current = "";
|
||||||
|
|
||||||
for (size_t i = 0; i < str.length(); i++) {
|
for (const char c : str) {
|
||||||
char c = str[i];
|
|
||||||
|
|
||||||
if (c == delimiter) {
|
if (c == delimiter) {
|
||||||
vector.push_back(current);
|
vector.push_back(current);
|
||||||
current = "";
|
current = "";
|
||||||
@@ -273,54 +271,53 @@ std::vector<std::string> GeneralUtils::SplitString(const std::string& str, char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector.push_back(current);
|
vector.push_back(std::move(current));
|
||||||
|
|
||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::u16string GeneralUtils::ReadWString(RakNet::BitStream* inStream) {
|
std::u16string GeneralUtils::ReadWString(RakNet::BitStream& inStream) {
|
||||||
uint32_t length;
|
uint32_t length;
|
||||||
inStream->Read<uint32_t>(length);
|
inStream.Read<uint32_t>(length);
|
||||||
|
|
||||||
std::u16string string;
|
std::u16string string;
|
||||||
for (auto i = 0; i < length; i++) {
|
for (uint32_t i = 0; i < length; ++i) {
|
||||||
uint16_t c;
|
uint16_t c;
|
||||||
inStream->Read(c);
|
inStream.Read(c);
|
||||||
string.push_back(c);
|
string.push_back(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> GeneralUtils::GetSqlFileNamesFromFolder(const std::string& folder) {
|
std::vector<std::string> GeneralUtils::GetSqlFileNamesFromFolder(const std::string_view folder) {
|
||||||
// Because we dont know how large the initial number before the first _ is we need to make it a map like so.
|
// Because we dont know how large the initial number before the first _ is we need to make it a map like so.
|
||||||
std::map<uint32_t, std::string> filenames{};
|
std::map<uint32_t, std::string> filenames{};
|
||||||
for (auto& t : std::filesystem::directory_iterator(folder)) {
|
for (const auto& t : std::filesystem::directory_iterator(folder)) {
|
||||||
auto filename = t.path().filename().string();
|
auto filename = t.path().filename().string();
|
||||||
auto index = std::stoi(GeneralUtils::SplitString(filename, '_').at(0));
|
const auto index = std::stoi(GeneralUtils::SplitString(filename, '_').at(0));
|
||||||
filenames.insert(std::make_pair(index, filename));
|
filenames.emplace(index, std::move(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now sort the map by the oldest migration.
|
// Now sort the map by the oldest migration.
|
||||||
std::vector<std::string> sortedFiles{};
|
std::vector<std::string> sortedFiles{};
|
||||||
auto fileIterator = filenames.begin();
|
auto fileIterator = filenames.cbegin();
|
||||||
std::map<uint32_t, std::string>::iterator oldest = filenames.begin();
|
auto oldest = filenames.cbegin();
|
||||||
while (!filenames.empty()) {
|
while (!filenames.empty()) {
|
||||||
if (fileIterator == filenames.end()) {
|
if (fileIterator == filenames.cend()) {
|
||||||
sortedFiles.push_back(oldest->second);
|
sortedFiles.push_back(oldest->second);
|
||||||
filenames.erase(oldest);
|
filenames.erase(oldest);
|
||||||
fileIterator = filenames.begin();
|
fileIterator = filenames.cbegin();
|
||||||
oldest = filenames.begin();
|
oldest = filenames.cbegin();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (oldest->first > fileIterator->first) oldest = fileIterator;
|
if (oldest->first > fileIterator->first) oldest = fileIterator;
|
||||||
fileIterator++;
|
++fileIterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sortedFiles;
|
return sortedFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DARKFLAME_PLATFORM_MACOS
|
#if !(__GNUC__ >= 11 || _MSC_VER >= 1924)
|
||||||
|
|
||||||
// MacOS floating-point parse function specializations
|
// MacOS floating-point parse function specializations
|
||||||
namespace GeneralUtils::details {
|
namespace GeneralUtils::details {
|
||||||
|
|||||||
@@ -3,17 +3,18 @@
|
|||||||
// C++
|
// C++
|
||||||
#include <charconv>
|
#include <charconv>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <random>
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <functional>
|
||||||
|
#include <optional>
|
||||||
|
#include <random>
|
||||||
|
#include <span>
|
||||||
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <optional>
|
|
||||||
#include <functional>
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <stdexcept>
|
|
||||||
#include "BitStream.h"
|
#include "BitStream.h"
|
||||||
#include "NiPoint3.h"
|
#include "NiPoint3.h"
|
||||||
|
|
||||||
#include "dPlatforms.h"
|
#include "dPlatforms.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
@@ -32,29 +33,31 @@ namespace GeneralUtils {
|
|||||||
//! Converts a plain ASCII string to a UTF-16 string
|
//! Converts a plain ASCII string to a UTF-16 string
|
||||||
/*!
|
/*!
|
||||||
\param string The string to convert
|
\param string The string to convert
|
||||||
\param size A size to trim the string to. Default is -1 (No trimming)
|
\param size A size to trim the string to. Default is SIZE_MAX (No trimming)
|
||||||
\return An UTF-16 representation of the string
|
\return An UTF-16 representation of the string
|
||||||
*/
|
*/
|
||||||
std::u16string ASCIIToUTF16(const std::string_view& string, size_t size = -1);
|
std::u16string ASCIIToUTF16(const std::string_view string, const size_t size = SIZE_MAX);
|
||||||
|
|
||||||
//! Converts a UTF-8 String to a UTF-16 string
|
//! Converts a UTF-8 String to a UTF-16 string
|
||||||
/*!
|
/*!
|
||||||
\param string The string to convert
|
\param string The string to convert
|
||||||
\param size A size to trim the string to. Default is -1 (No trimming)
|
\param size A size to trim the string to. Default is SIZE_MAX (No trimming)
|
||||||
\return An UTF-16 representation of the string
|
\return An UTF-16 representation of the string
|
||||||
*/
|
*/
|
||||||
std::u16string UTF8ToUTF16(const std::string_view& string, size_t size = -1);
|
std::u16string UTF8ToUTF16(const std::string_view string, const size_t size = SIZE_MAX);
|
||||||
|
|
||||||
//! Internal, do not use
|
namespace details {
|
||||||
bool _NextUTF8Char(std::string_view& slice, uint32_t& out);
|
//! Internal, do not use
|
||||||
|
bool _NextUTF8Char(std::string_view& slice, uint32_t& out);
|
||||||
|
}
|
||||||
|
|
||||||
//! Converts a UTF-16 string to a UTF-8 string
|
//! Converts a UTF-16 string to a UTF-8 string
|
||||||
/*!
|
/*!
|
||||||
\param string The string to convert
|
\param string The string to convert
|
||||||
\param size A size to trim the string to. Default is -1 (No trimming)
|
\param size A size to trim the string to. Default is SIZE_MAX (No trimming)
|
||||||
\return An UTF-8 representation of the string
|
\return An UTF-8 representation of the string
|
||||||
*/
|
*/
|
||||||
std::string UTF16ToWTF8(const std::u16string_view& string, size_t size = -1);
|
std::string UTF16ToWTF8(const std::u16string_view string, const size_t size = SIZE_MAX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares two basic strings but does so ignoring case sensitivity
|
* Compares two basic strings but does so ignoring case sensitivity
|
||||||
@@ -62,7 +65,7 @@ namespace GeneralUtils {
|
|||||||
* \param b the second string to compare against the first string
|
* \param b the second string to compare against the first string
|
||||||
* @return if the two strings are equal
|
* @return if the two strings are equal
|
||||||
*/
|
*/
|
||||||
bool CaseInsensitiveStringCompare(const std::string& a, const std::string& b);
|
bool CaseInsensitiveStringCompare(const std::string_view a, const std::string_view b);
|
||||||
|
|
||||||
// MARK: Bits
|
// MARK: Bits
|
||||||
|
|
||||||
@@ -70,9 +73,9 @@ namespace GeneralUtils {
|
|||||||
|
|
||||||
//! Sets a bit on a numerical value
|
//! Sets a bit on a numerical value
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void SetBit(T& value, eObjectBits bits) {
|
inline void SetBit(T& value, const eObjectBits bits) {
|
||||||
static_assert(std::is_arithmetic<T>::value, "Not an arithmetic type");
|
static_assert(std::is_arithmetic<T>::value, "Not an arithmetic type");
|
||||||
auto index = static_cast<size_t>(bits);
|
const auto index = static_cast<size_t>(bits);
|
||||||
if (index > (sizeof(T) * 8) - 1) {
|
if (index > (sizeof(T) * 8) - 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -82,9 +85,9 @@ namespace GeneralUtils {
|
|||||||
|
|
||||||
//! Clears a bit on a numerical value
|
//! Clears a bit on a numerical value
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void ClearBit(T& value, eObjectBits bits) {
|
inline void ClearBit(T& value, const eObjectBits bits) {
|
||||||
static_assert(std::is_arithmetic<T>::value, "Not an arithmetic type");
|
static_assert(std::is_arithmetic<T>::value, "Not an arithmetic type");
|
||||||
auto index = static_cast<size_t>(bits);
|
const auto index = static_cast<size_t>(bits);
|
||||||
if (index > (sizeof(T) * 8 - 1)) {
|
if (index > (sizeof(T) * 8 - 1)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -97,14 +100,14 @@ namespace GeneralUtils {
|
|||||||
\param value The value to set the bit for
|
\param value The value to set the bit for
|
||||||
\param index The index of the bit
|
\param index The index of the bit
|
||||||
*/
|
*/
|
||||||
int64_t SetBit(int64_t value, uint32_t index);
|
int64_t SetBit(int64_t value, const uint32_t index);
|
||||||
|
|
||||||
//! Clears a specific bit in a signed 64-bit integer
|
//! Clears a specific bit in a signed 64-bit integer
|
||||||
/*!
|
/*!
|
||||||
\param value The value to clear the bit from
|
\param value The value to clear the bit from
|
||||||
\param index The index of the bit
|
\param index The index of the bit
|
||||||
*/
|
*/
|
||||||
int64_t ClearBit(int64_t value, uint32_t index);
|
int64_t ClearBit(int64_t value, const uint32_t index);
|
||||||
|
|
||||||
//! Checks a specific bit in a signed 64-bit integer
|
//! Checks a specific bit in a signed 64-bit integer
|
||||||
/*!
|
/*!
|
||||||
@@ -112,19 +115,19 @@ namespace GeneralUtils {
|
|||||||
\param index The index of the bit
|
\param index The index of the bit
|
||||||
\return Whether or not the bit is set
|
\return Whether or not the bit is set
|
||||||
*/
|
*/
|
||||||
bool CheckBit(int64_t value, uint32_t index);
|
bool CheckBit(int64_t value, const uint32_t index);
|
||||||
|
|
||||||
bool ReplaceInString(std::string& str, const std::string& from, const std::string& to);
|
bool ReplaceInString(std::string& str, const std::string_view from, const std::string_view to);
|
||||||
|
|
||||||
std::u16string ReadWString(RakNet::BitStream* inStream);
|
std::u16string ReadWString(RakNet::BitStream& inStream);
|
||||||
|
|
||||||
std::vector<std::wstring> SplitString(std::wstring& str, wchar_t delimiter);
|
std::vector<std::wstring> SplitString(const std::wstring_view str, const wchar_t delimiter);
|
||||||
|
|
||||||
std::vector<std::u16string> SplitString(const std::u16string& str, char16_t delimiter);
|
std::vector<std::u16string> SplitString(const std::u16string_view str, const char16_t delimiter);
|
||||||
|
|
||||||
std::vector<std::string> SplitString(const std::string& str, char delimiter);
|
std::vector<std::string> SplitString(const std::string_view str, const char delimiter);
|
||||||
|
|
||||||
std::vector<std::string> GetSqlFileNamesFromFolder(const std::string& folder);
|
std::vector<std::string> GetSqlFileNamesFromFolder(const std::string_view folder);
|
||||||
|
|
||||||
// Concept constraining to enum types
|
// Concept constraining to enum types
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@@ -144,7 +147,7 @@ namespace GeneralUtils {
|
|||||||
|
|
||||||
// If a boolean, present an alias to an intermediate integral type for parsing
|
// If a boolean, present an alias to an intermediate integral type for parsing
|
||||||
template <Numeric T> requires std::same_as<T, bool>
|
template <Numeric T> requires std::same_as<T, bool>
|
||||||
struct numeric_parse<T> { using type = uint32_t; };
|
struct numeric_parse<T> { using type = uint8_t; };
|
||||||
|
|
||||||
// Shorthand type alias
|
// Shorthand type alias
|
||||||
template <Numeric T>
|
template <Numeric T>
|
||||||
@@ -156,8 +159,9 @@ namespace GeneralUtils {
|
|||||||
* @returns An std::optional containing the desired value if it is equivalent to the string
|
* @returns An std::optional containing the desired value if it is equivalent to the string
|
||||||
*/
|
*/
|
||||||
template <Numeric T>
|
template <Numeric T>
|
||||||
[[nodiscard]] std::optional<T> TryParse(const std::string_view str) {
|
[[nodiscard]] std::optional<T> TryParse(std::string_view str) {
|
||||||
numeric_parse_t<T> result;
|
numeric_parse_t<T> result;
|
||||||
|
while (!str.empty() && std::isspace(str.front())) str.remove_prefix(1);
|
||||||
|
|
||||||
const char* const strEnd = str.data() + str.size();
|
const char* const strEnd = str.data() + str.size();
|
||||||
const auto [parseEnd, ec] = std::from_chars(str.data(), strEnd, result);
|
const auto [parseEnd, ec] = std::from_chars(str.data(), strEnd, result);
|
||||||
@@ -166,7 +170,7 @@ namespace GeneralUtils {
|
|||||||
return isParsed ? static_cast<T>(result) : std::optional<T>{};
|
return isParsed ? static_cast<T>(result) : std::optional<T>{};
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DARKFLAME_PLATFORM_MACOS
|
#if !(__GNUC__ >= 11 || _MSC_VER >= 1924)
|
||||||
|
|
||||||
// MacOS floating-point parse helper function specializations
|
// MacOS floating-point parse helper function specializations
|
||||||
namespace details {
|
namespace details {
|
||||||
@@ -181,8 +185,10 @@ namespace GeneralUtils {
|
|||||||
* @returns An std::optional containing the desired value if it is equivalent to the string
|
* @returns An std::optional containing the desired value if it is equivalent to the string
|
||||||
*/
|
*/
|
||||||
template <std::floating_point T>
|
template <std::floating_point T>
|
||||||
[[nodiscard]] std::optional<T> TryParse(const std::string_view str) noexcept
|
[[nodiscard]] std::optional<T> TryParse(std::string_view str) noexcept
|
||||||
try {
|
try {
|
||||||
|
while (!str.empty() && std::isspace(str.front())) str.remove_prefix(1);
|
||||||
|
|
||||||
size_t parseNum;
|
size_t parseNum;
|
||||||
const T result = details::_parse<T>(str, parseNum);
|
const T result = details::_parse<T>(str, parseNum);
|
||||||
const bool isParsed = str.length() == parseNum;
|
const bool isParsed = str.length() == parseNum;
|
||||||
@@ -202,7 +208,7 @@ namespace GeneralUtils {
|
|||||||
* @returns An std::optional containing the desired NiPoint3 if it can be constructed from the string parameters
|
* @returns An std::optional containing the desired NiPoint3 if it can be constructed from the string parameters
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
[[nodiscard]] std::optional<NiPoint3> TryParse(const std::string& strX, const std::string& strY, const std::string& strZ) {
|
[[nodiscard]] std::optional<NiPoint3> TryParse(const std::string_view strX, const std::string_view strY, const std::string_view strZ) {
|
||||||
const auto x = TryParse<float>(strX);
|
const auto x = TryParse<float>(strX);
|
||||||
if (!x) return std::nullopt;
|
if (!x) return std::nullopt;
|
||||||
|
|
||||||
@@ -214,17 +220,17 @@ namespace GeneralUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The TryParse overload for handling NiPoint3 by passingn a reference to a vector of three strings
|
* The TryParse overload for handling NiPoint3 by passing a span of three strings
|
||||||
* @param str The string vector representing the X, Y, and Xcoordinates
|
* @param str The string vector representing the X, Y, and Z coordinates
|
||||||
* @returns An std::optional containing the desired NiPoint3 if it can be constructed from the string parameters
|
* @returns An std::optional containing the desired NiPoint3 if it can be constructed from the string parameters
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
[[nodiscard]] std::optional<NiPoint3> TryParse(const std::vector<std::string>& str) {
|
[[nodiscard]] std::optional<NiPoint3> TryParse(const std::span<const std::string> str) {
|
||||||
return (str.size() == 3) ? TryParse<NiPoint3>(str[0], str[1], str[2]) : std::nullopt;
|
return (str.size() == 3) ? TryParse<NiPoint3>(str[0], str[1], str[2]) : std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::u16string to_u16string(T value) {
|
std::u16string to_u16string(const T value) {
|
||||||
return GeneralUtils::ASCIIToUTF16(std::to_string(value));
|
return GeneralUtils::ASCIIToUTF16(std::to_string(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +249,7 @@ namespace GeneralUtils {
|
|||||||
\param max The maximum to generate to
|
\param max The maximum to generate to
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T GenerateRandomNumber(std::size_t min, std::size_t max) {
|
inline T GenerateRandomNumber(const std::size_t min, const std::size_t max) {
|
||||||
// Make sure it is a numeric type
|
// Make sure it is a numeric type
|
||||||
static_assert(std::is_arithmetic<T>::value, "Not an arithmetic type");
|
static_assert(std::is_arithmetic<T>::value, "Not an arithmetic type");
|
||||||
|
|
||||||
@@ -264,16 +270,16 @@ namespace GeneralUtils {
|
|||||||
* @returns The enum entry's value in its underlying type
|
* @returns The enum entry's value in its underlying type
|
||||||
*/
|
*/
|
||||||
template <Enum eType>
|
template <Enum eType>
|
||||||
constexpr typename std::underlying_type_t<eType> CastUnderlyingType(const eType entry) noexcept {
|
constexpr std::underlying_type_t<eType> ToUnderlying(const eType entry) noexcept {
|
||||||
return static_cast<typename std::underlying_type_t<eType>>(entry);
|
return static_cast<std::underlying_type_t<eType>>(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// on Windows we need to undef these or else they conflict with our numeric limits calls
|
// on Windows we need to undef these or else they conflict with our numeric limits calls
|
||||||
// DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS
|
// DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#undef min
|
#undef min
|
||||||
#undef max
|
#undef max
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T GenerateRandomNumber() {
|
inline T GenerateRandomNumber() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __LDFFORMAT__H__
|
#ifndef LDFFORMAT_H
|
||||||
#define __LDFFORMAT__H__
|
#define LDFFORMAT_H
|
||||||
|
|
||||||
// Custom Classes
|
// Custom Classes
|
||||||
#include "dCommonVars.h"
|
#include "dCommonVars.h"
|
||||||
@@ -31,22 +31,22 @@ public:
|
|||||||
|
|
||||||
virtual ~LDFBaseData() {}
|
virtual ~LDFBaseData() {}
|
||||||
|
|
||||||
virtual void WriteToPacket(RakNet::BitStream* packet) = 0;
|
virtual void WriteToPacket(RakNet::BitStream& packet) const = 0;
|
||||||
|
|
||||||
virtual const std::u16string& GetKey() = 0;
|
virtual const std::u16string& GetKey() const = 0;
|
||||||
|
|
||||||
virtual eLDFType GetValueType() = 0;
|
virtual eLDFType GetValueType() const = 0;
|
||||||
|
|
||||||
/** Gets a string from the key/value pair
|
/** Gets a string from the key/value pair
|
||||||
* @param includeKey Whether or not to include the key in the data
|
* @param includeKey Whether or not to include the key in the data
|
||||||
* @param includeTypeId Whether or not to include the type id in the data
|
* @param includeTypeId Whether or not to include the type id in the data
|
||||||
* @return The string representation of the data
|
* @return The string representation of the data
|
||||||
*/
|
*/
|
||||||
virtual std::string GetString(bool includeKey = true, bool includeTypeId = true) = 0;
|
virtual std::string GetString(bool includeKey = true, bool includeTypeId = true) const = 0;
|
||||||
|
|
||||||
virtual std::string GetValueAsString() = 0;
|
virtual std::string GetValueAsString() const = 0;
|
||||||
|
|
||||||
virtual LDFBaseData* Copy() = 0;
|
virtual LDFBaseData* Copy() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given an input string, return the data as a LDF key.
|
* Given an input string, return the data as a LDF key.
|
||||||
@@ -62,17 +62,17 @@ private:
|
|||||||
T value;
|
T value;
|
||||||
|
|
||||||
//! Writes the key to the packet
|
//! Writes the key to the packet
|
||||||
void WriteKey(RakNet::BitStream* packet) {
|
void WriteKey(RakNet::BitStream& packet) const {
|
||||||
packet->Write<uint8_t>(this->key.length() * sizeof(uint16_t));
|
packet.Write<uint8_t>(this->key.length() * sizeof(uint16_t));
|
||||||
for (uint32_t i = 0; i < this->key.length(); ++i) {
|
for (uint32_t i = 0; i < this->key.length(); ++i) {
|
||||||
packet->Write<uint16_t>(this->key[i]);
|
packet.Write<uint16_t>(this->key[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Writes the value to the packet
|
//! Writes the value to the packet
|
||||||
void WriteValue(RakNet::BitStream* packet) {
|
void WriteValue(RakNet::BitStream& packet) const {
|
||||||
packet->Write<uint8_t>(this->GetValueType());
|
packet.Write<uint8_t>(this->GetValueType());
|
||||||
packet->Write(this->value);
|
packet.Write(this->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -90,7 +90,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
\return The value
|
\return The value
|
||||||
*/
|
*/
|
||||||
const T& GetValue(void) { return this->value; }
|
const T& GetValue(void) const { return this->value; }
|
||||||
|
|
||||||
//! Sets the value
|
//! Sets the value
|
||||||
/*!
|
/*!
|
||||||
@@ -102,13 +102,13 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
\return The value string
|
\return The value string
|
||||||
*/
|
*/
|
||||||
std::string GetValueString(void) { return ""; }
|
std::string GetValueString(void) const { return ""; }
|
||||||
|
|
||||||
//! Writes the data to a packet
|
//! Writes the data to a packet
|
||||||
/*!
|
/*!
|
||||||
\param packet The packet
|
\param packet The packet
|
||||||
*/
|
*/
|
||||||
void WriteToPacket(RakNet::BitStream* packet) override {
|
void WriteToPacket(RakNet::BitStream& packet) const override {
|
||||||
this->WriteKey(packet);
|
this->WriteKey(packet);
|
||||||
this->WriteValue(packet);
|
this->WriteValue(packet);
|
||||||
}
|
}
|
||||||
@@ -117,13 +117,13 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
\return The key
|
\return The key
|
||||||
*/
|
*/
|
||||||
const std::u16string& GetKey(void) override { return this->key; }
|
const std::u16string& GetKey(void) const override { return this->key; }
|
||||||
|
|
||||||
//! Gets the LDF Type
|
//! Gets the LDF Type
|
||||||
/*!
|
/*!
|
||||||
\return The LDF value type
|
\return The LDF value type
|
||||||
*/
|
*/
|
||||||
eLDFType GetValueType(void) override { return LDF_TYPE_UNKNOWN; }
|
eLDFType GetValueType(void) const override { return LDF_TYPE_UNKNOWN; }
|
||||||
|
|
||||||
//! Gets the string data
|
//! Gets the string data
|
||||||
/*!
|
/*!
|
||||||
@@ -131,7 +131,7 @@ public:
|
|||||||
\param includeTypeId Whether or not to include the type id in the data
|
\param includeTypeId Whether or not to include the type id in the data
|
||||||
\return The string representation of the data
|
\return The string representation of the data
|
||||||
*/
|
*/
|
||||||
std::string GetString(const bool includeKey = true, const bool includeTypeId = true) override {
|
std::string GetString(const bool includeKey = true, const bool includeTypeId = true) const override {
|
||||||
if (GetValueType() == -1) {
|
if (GetValueType() == -1) {
|
||||||
return GeneralUtils::UTF16ToWTF8(this->key) + "=-1:<server variable>";
|
return GeneralUtils::UTF16ToWTF8(this->key) + "=-1:<server variable>";
|
||||||
}
|
}
|
||||||
@@ -154,11 +154,11 @@ public:
|
|||||||
return stream.str();
|
return stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetValueAsString() override {
|
std::string GetValueAsString() const override {
|
||||||
return this->GetValueString();
|
return this->GetValueString();
|
||||||
}
|
}
|
||||||
|
|
||||||
LDFBaseData* Copy() override {
|
LDFBaseData* Copy() const override {
|
||||||
return new LDFData<T>(key, value);
|
return new LDFData<T>(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,58 +166,58 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// LDF Types
|
// LDF Types
|
||||||
template<> inline eLDFType LDFData<std::u16string>::GetValueType(void) { return LDF_TYPE_UTF_16; };
|
template<> inline eLDFType LDFData<std::u16string>::GetValueType(void) const { return LDF_TYPE_UTF_16; };
|
||||||
template<> inline eLDFType LDFData<int32_t>::GetValueType(void) { return LDF_TYPE_S32; };
|
template<> inline eLDFType LDFData<int32_t>::GetValueType(void) const { return LDF_TYPE_S32; };
|
||||||
template<> inline eLDFType LDFData<float>::GetValueType(void) { return LDF_TYPE_FLOAT; };
|
template<> inline eLDFType LDFData<float>::GetValueType(void) const { return LDF_TYPE_FLOAT; };
|
||||||
template<> inline eLDFType LDFData<double>::GetValueType(void) { return LDF_TYPE_DOUBLE; };
|
template<> inline eLDFType LDFData<double>::GetValueType(void) const { return LDF_TYPE_DOUBLE; };
|
||||||
template<> inline eLDFType LDFData<uint32_t>::GetValueType(void) { return LDF_TYPE_U32; };
|
template<> inline eLDFType LDFData<uint32_t>::GetValueType(void) const { return LDF_TYPE_U32; };
|
||||||
template<> inline eLDFType LDFData<bool>::GetValueType(void) { return LDF_TYPE_BOOLEAN; };
|
template<> inline eLDFType LDFData<bool>::GetValueType(void) const { return LDF_TYPE_BOOLEAN; };
|
||||||
template<> inline eLDFType LDFData<uint64_t>::GetValueType(void) { return LDF_TYPE_U64; };
|
template<> inline eLDFType LDFData<uint64_t>::GetValueType(void) const { return LDF_TYPE_U64; };
|
||||||
template<> inline eLDFType LDFData<LWOOBJID>::GetValueType(void) { return LDF_TYPE_OBJID; };
|
template<> inline eLDFType LDFData<LWOOBJID>::GetValueType(void) const { return LDF_TYPE_OBJID; };
|
||||||
template<> inline eLDFType LDFData<std::string>::GetValueType(void) { return LDF_TYPE_UTF_8; };
|
template<> inline eLDFType LDFData<std::string>::GetValueType(void) const { return LDF_TYPE_UTF_8; };
|
||||||
|
|
||||||
// The specialized version for std::u16string (UTF-16)
|
// The specialized version for std::u16string (UTF-16)
|
||||||
template<>
|
template<>
|
||||||
inline void LDFData<std::u16string>::WriteValue(RakNet::BitStream* packet) {
|
inline void LDFData<std::u16string>::WriteValue(RakNet::BitStream& packet) const {
|
||||||
packet->Write<uint8_t>(this->GetValueType());
|
packet.Write<uint8_t>(this->GetValueType());
|
||||||
|
|
||||||
packet->Write<uint32_t>(this->value.length());
|
packet.Write<uint32_t>(this->value.length());
|
||||||
for (uint32_t i = 0; i < this->value.length(); ++i) {
|
for (uint32_t i = 0; i < this->value.length(); ++i) {
|
||||||
packet->Write<uint16_t>(this->value[i]);
|
packet.Write<uint16_t>(this->value[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The specialized version for bool
|
// The specialized version for bool
|
||||||
template<>
|
template<>
|
||||||
inline void LDFData<bool>::WriteValue(RakNet::BitStream* packet) {
|
inline void LDFData<bool>::WriteValue(RakNet::BitStream& packet) const {
|
||||||
packet->Write<uint8_t>(this->GetValueType());
|
packet.Write<uint8_t>(this->GetValueType());
|
||||||
|
|
||||||
packet->Write<uint8_t>(this->value);
|
packet.Write<uint8_t>(this->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The specialized version for std::string (UTF-8)
|
// The specialized version for std::string (UTF-8)
|
||||||
template<>
|
template<>
|
||||||
inline void LDFData<std::string>::WriteValue(RakNet::BitStream* packet) {
|
inline void LDFData<std::string>::WriteValue(RakNet::BitStream& packet) const {
|
||||||
packet->Write<uint8_t>(this->GetValueType());
|
packet.Write<uint8_t>(this->GetValueType());
|
||||||
|
|
||||||
packet->Write<uint32_t>(this->value.length());
|
packet.Write<uint32_t>(this->value.length());
|
||||||
for (uint32_t i = 0; i < this->value.length(); ++i) {
|
for (uint32_t i = 0; i < this->value.length(); ++i) {
|
||||||
packet->Write<uint8_t>(this->value[i]);
|
packet.Write<uint8_t>(this->value[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> inline std::string LDFData<std::u16string>::GetValueString() {
|
template<> inline std::string LDFData<std::u16string>::GetValueString() const {
|
||||||
return GeneralUtils::UTF16ToWTF8(this->value, this->value.size());
|
return GeneralUtils::UTF16ToWTF8(this->value, this->value.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> inline std::string LDFData<int32_t>::GetValueString() { return std::to_string(this->value); }
|
template<> inline std::string LDFData<int32_t>::GetValueString() const { return std::to_string(this->value); }
|
||||||
template<> inline std::string LDFData<float>::GetValueString() { return std::to_string(this->value); }
|
template<> inline std::string LDFData<float>::GetValueString() const { return std::to_string(this->value); }
|
||||||
template<> inline std::string LDFData<double>::GetValueString() { return std::to_string(this->value); }
|
template<> inline std::string LDFData<double>::GetValueString() const { return std::to_string(this->value); }
|
||||||
template<> inline std::string LDFData<uint32_t>::GetValueString() { return std::to_string(this->value); }
|
template<> inline std::string LDFData<uint32_t>::GetValueString() const { return std::to_string(this->value); }
|
||||||
template<> inline std::string LDFData<bool>::GetValueString() { return std::to_string(this->value); }
|
template<> inline std::string LDFData<bool>::GetValueString() const { return std::to_string(this->value); }
|
||||||
template<> inline std::string LDFData<uint64_t>::GetValueString() { return std::to_string(this->value); }
|
template<> inline std::string LDFData<uint64_t>::GetValueString() const { return std::to_string(this->value); }
|
||||||
template<> inline std::string LDFData<LWOOBJID>::GetValueString() { return std::to_string(this->value); }
|
template<> inline std::string LDFData<LWOOBJID>::GetValueString() const { return std::to_string(this->value); }
|
||||||
|
|
||||||
template<> inline std::string LDFData<std::string>::GetValueString() { return this->value; }
|
template<> inline std::string LDFData<std::string>::GetValueString() const { return this->value; }
|
||||||
|
|
||||||
#endif //!__LDFFORMAT__H__
|
#endif //!LDFFORMAT_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __NIPOINT3_H__
|
#ifndef NIPOINT3_H
|
||||||
#define __NIPOINT3_H__
|
#define NIPOINT3_H
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\file NiPoint3.hpp
|
\file NiPoint3.hpp
|
||||||
@@ -201,4 +201,4 @@ namespace NiPoint3Constant {
|
|||||||
// .inl file needed for code organization and to circumvent circular dependency issues
|
// .inl file needed for code organization and to circumvent circular dependency issues
|
||||||
#include "NiPoint3.inl"
|
#include "NiPoint3.inl"
|
||||||
|
|
||||||
#endif // !__NIPOINT3_H__
|
#endif // !NIPOINT3_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef __NIPOINT3_H__
|
#ifndef NIPOINT3_H
|
||||||
#error "This should only be included inline in NiPoint3.h: Do not include directly!"
|
#error "This should only be included inline in NiPoint3.h: Do not include directly!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __NIQUATERNION_H__
|
#ifndef NIQUATERNION_H
|
||||||
#define __NIQUATERNION_H__
|
#define NIQUATERNION_H
|
||||||
|
|
||||||
// Custom Classes
|
// Custom Classes
|
||||||
#include "NiPoint3.h"
|
#include "NiPoint3.h"
|
||||||
@@ -155,4 +155,4 @@ namespace NiQuaternionConstant {
|
|||||||
// Include constexpr and inline function definitions in a seperate file for readability
|
// Include constexpr and inline function definitions in a seperate file for readability
|
||||||
#include "NiQuaternion.inl"
|
#include "NiQuaternion.inl"
|
||||||
|
|
||||||
#endif // !__NIQUATERNION_H__
|
#endif // !NIQUATERNION_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef __NIQUATERNION_H__
|
#ifndef NIQUATERNION_H
|
||||||
#error "This should only be included inline in NiQuaternion.h: Do not include directly!"
|
#error "This should only be included inline in NiQuaternion.h: Do not include directly!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +1,19 @@
|
|||||||
#ifndef __POSITIONUPDATE__H__
|
#ifndef POSITIONUPDATE_H
|
||||||
#define __POSITIONUPDATE__H__
|
#define POSITIONUPDATE_H
|
||||||
|
|
||||||
#include "NiPoint3.h"
|
#include "NiPoint3.h"
|
||||||
#include "NiQuaternion.h"
|
#include "NiQuaternion.h"
|
||||||
|
|
||||||
|
|
||||||
struct RemoteInputInfo {
|
struct RemoteInputInfo {
|
||||||
RemoteInputInfo() {
|
|
||||||
m_RemoteInputX = 0;
|
|
||||||
m_RemoteInputY = 0;
|
|
||||||
m_IsPowersliding = false;
|
|
||||||
m_IsModified = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator=(const RemoteInputInfo& other) {
|
|
||||||
m_RemoteInputX = other.m_RemoteInputX;
|
|
||||||
m_RemoteInputY = other.m_RemoteInputY;
|
|
||||||
m_IsPowersliding = other.m_IsPowersliding;
|
|
||||||
m_IsModified = other.m_IsModified;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const RemoteInputInfo& other) {
|
bool operator==(const RemoteInputInfo& other) {
|
||||||
return m_RemoteInputX == other.m_RemoteInputX && m_RemoteInputY == other.m_RemoteInputY && m_IsPowersliding == other.m_IsPowersliding && m_IsModified == other.m_IsModified;
|
return m_RemoteInputX == other.m_RemoteInputX && m_RemoteInputY == other.m_RemoteInputY && m_IsPowersliding == other.m_IsPowersliding && m_IsModified == other.m_IsModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
float m_RemoteInputX;
|
float m_RemoteInputX = 0;
|
||||||
float m_RemoteInputY;
|
float m_RemoteInputY = 0;
|
||||||
bool m_IsPowersliding;
|
bool m_IsPowersliding = false;
|
||||||
bool m_IsModified;
|
bool m_IsModified = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LocalSpaceInfo {
|
struct LocalSpaceInfo {
|
||||||
@@ -47,4 +33,4 @@ struct PositionUpdate {
|
|||||||
RemoteInputInfo remoteInputInfo;
|
RemoteInputInfo remoteInputInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__POSITIONUPDATE__H__
|
#endif //!POSITIONUPDATE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __CLIENTVERSION_H__
|
#ifndef CLIENTVERSION_H
|
||||||
#define __CLIENTVERSION_H__
|
#define CLIENTVERSION_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -9,4 +9,4 @@ namespace ClientVersion {
|
|||||||
constexpr uint16_t minor = 64;
|
constexpr uint16_t minor = 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !__CLIENTVERSION_H__
|
#endif // !CLIENTVERSION_H
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "BinaryPathFinder.h"
|
#include "BinaryPathFinder.h"
|
||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __STRINGIFIEDENUM_H__
|
#ifndef STRINGIFIEDENUM_H
|
||||||
#define __STRINGIFIEDENUM_H__
|
#define STRINGIFIEDENUM_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "magic_enum.hpp"
|
#include "magic_enum.hpp"
|
||||||
@@ -26,4 +26,4 @@ namespace StringifiedEnum {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !__STRINGIFIEDENUM_H__
|
#endif // !STRINGIFIEDENUM_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __DCOMMONVARS__H__
|
#ifndef DCOMMONVARS_H
|
||||||
#define __DCOMMONVARS__H__
|
#define DCOMMONVARS_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -34,8 +34,8 @@ constexpr uint32_t lowFrameDelta = FRAMES_TO_MS(lowFramerate);
|
|||||||
#define CINSTREAM RakNet::BitStream inStream(packet->data, packet->length, false);
|
#define CINSTREAM RakNet::BitStream inStream(packet->data, packet->length, false);
|
||||||
#define CINSTREAM_SKIP_HEADER CINSTREAM if (inStream.GetNumberOfUnreadBits() >= BYTES_TO_BITS(HEADER_SIZE)) inStream.IgnoreBytes(HEADER_SIZE); else inStream.IgnoreBits(inStream.GetNumberOfUnreadBits());
|
#define CINSTREAM_SKIP_HEADER CINSTREAM if (inStream.GetNumberOfUnreadBits() >= BYTES_TO_BITS(HEADER_SIZE)) inStream.IgnoreBytes(HEADER_SIZE); else inStream.IgnoreBits(inStream.GetNumberOfUnreadBits());
|
||||||
#define CMSGHEADER BitStreamUtils::WriteHeader(bitStream, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
|
#define CMSGHEADER BitStreamUtils::WriteHeader(bitStream, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
|
||||||
#define SEND_PACKET Game::server->Send(&bitStream, sysAddr, false);
|
#define SEND_PACKET Game::server->Send(bitStream, sysAddr, false);
|
||||||
#define SEND_PACKET_BROADCAST Game::server->Send(&bitStream, UNASSIGNED_SYSTEM_ADDRESS, true);
|
#define SEND_PACKET_BROADCAST Game::server->Send(bitStream, UNASSIGNED_SYSTEM_ADDRESS, true);
|
||||||
|
|
||||||
//=========== TYPEDEFS ==========
|
//=========== TYPEDEFS ==========
|
||||||
|
|
||||||
@@ -158,4 +158,4 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__DCOMMONVARS__H__
|
#endif //!DCOMMONVARS_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __EADDFRIENDRESPONSECODE__H__
|
#ifndef EADDFRIENDRESPONSECODE_H
|
||||||
#define __EADDFRIENDRESPONSECODE__H__
|
#define EADDFRIENDRESPONSECODE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -12,4 +12,4 @@ enum class eAddFriendResponseCode : uint8_t {
|
|||||||
CANCELLED
|
CANCELLED
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ADDFRIENDRESPONSECODE__H__
|
#endif //!ADDFRIENDRESPONSECODE_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __EADDFRIENDRESPONSETYPE__H__
|
#ifndef EADDFRIENDRESPONSETYPE_H
|
||||||
#define __EADDFRIENDRESPONSETYPE__H__
|
#define EADDFRIENDRESPONSETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -21,4 +21,4 @@ enum class eAddFriendResponseType : uint8_t {
|
|||||||
FRIENDISFREETRIAL
|
FRIENDISFREETRIAL
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EADDFRIENDRESPONSETYPE__H__
|
#endif //!EADDFRIENDRESPONSETYPE_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __EANINMATIONFLAGS__H__
|
#ifndef EANINMATIONFLAGS_H
|
||||||
#define __EANINMATIONFLAGS__H__
|
#define EANINMATIONFLAGS_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -41,4 +41,4 @@ enum class eAnimationFlags : uint32_t {
|
|||||||
IDLE_MISC12
|
IDLE_MISC12
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EANINMATIONFLAGS__H__
|
#endif //!EANINMATIONFLAGS_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EAUTHMESSAGETYPE__H__
|
#ifndef EAUTHMESSAGETYPE_H
|
||||||
#define __EAUTHMESSAGETYPE__H__
|
#define EAUTHMESSAGETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -12,4 +12,4 @@ enum class eAuthMessageType : uint32_t {
|
|||||||
RUNTIME_CONFIG
|
RUNTIME_CONFIG
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EAUTHMESSAGETYPE__H__
|
#endif //!EAUTHMESSAGETYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EBASICATTACKSUCCESSTYPES__H__
|
#ifndef EBASICATTACKSUCCESSTYPES_H
|
||||||
#define __EBASICATTACKSUCCESSTYPES__H__
|
#define EBASICATTACKSUCCESSTYPES_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -9,4 +9,4 @@ enum class eBasicAttackSuccessTypes : uint8_t {
|
|||||||
FAILIMMUNE
|
FAILIMMUNE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EBASICATTACKSUCCESSTYPES__H__
|
#endif //!EBASICATTACKSUCCESSTYPES_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __EBLUEPRINTSAVERESPONSETYPE__H__
|
#ifndef EBLUEPRINTSAVERESPONSETYPE_H
|
||||||
#define __EBLUEPRINTSAVERESPONSETYPE__H__
|
#define EBLUEPRINTSAVERESPONSETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ enum class eBlueprintSaveResponseType : uint32_t {
|
|||||||
FindMatchesFailed
|
FindMatchesFailed
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EBLUEPRINTSAVERESPONSETYPE__H__
|
#endif //!EBLUEPRINTSAVERESPONSETYPE_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __EBUBBLETYPE__H__
|
#ifndef EBUBBLETYPE_H
|
||||||
#define __EBUBBLETYPE__H__
|
#define EBUBBLETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -11,4 +11,4 @@ enum class eBubbleType : uint32_t {
|
|||||||
SKUNK
|
SKUNK
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EBUBBLETYPE__H__
|
#endif //!EBUBBLETYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EBUILDTYPE__H__
|
#ifndef EBUILDTYPE_H
|
||||||
#define __EBUILDTYPE__H__
|
#define EBUILDTYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -9,4 +9,4 @@ enum class eBuildType :uint32_t {
|
|||||||
ON_PROPERTY
|
ON_PROPERTY
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EBUILDTYPE__H__
|
#endif //!EBUILDTYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ECHARACTERCREATIONRESPONSE__H__
|
#ifndef ECHARACTERCREATIONRESPONSE_H
|
||||||
#define __ECHARACTERCREATIONRESPONSE__H__
|
#define ECHARACTERCREATIONRESPONSE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -11,4 +11,4 @@ enum class eCharacterCreationResponse : uint8_t {
|
|||||||
CUSTOM_NAME_IN_USE
|
CUSTOM_NAME_IN_USE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ECHARACTERCREATIONRESPONSE__H__
|
#endif //!ECHARACTERCREATIONRESPONSE_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __ECHARACTERVERSION__H__
|
#ifndef ECHARACTERVERSION_H
|
||||||
#define __ECHARACTERVERSION__H__
|
#define ECHARACTERVERSION_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -18,4 +18,4 @@ enum class eCharacterVersion : uint32_t {
|
|||||||
UP_TO_DATE, // will become SPEED_BASE
|
UP_TO_DATE, // will become SPEED_BASE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ECHARACTERVERSION__H__
|
#endif //!ECHARACTERVERSION_H
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
#ifndef __ECHATINTERNALMESSAGETYPE__H__
|
|
||||||
#define __ECHATINTERNALMESSAGETYPE__H__
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
enum eChatInternalMessageType : uint32_t {
|
|
||||||
PLAYER_ADDED_NOTIFICATION = 0,
|
|
||||||
PLAYER_REMOVED_NOTIFICATION,
|
|
||||||
ADD_FRIEND,
|
|
||||||
ADD_BEST_FRIEND,
|
|
||||||
ADD_TO_TEAM,
|
|
||||||
ADD_BLOCK,
|
|
||||||
REMOVE_FRIEND,
|
|
||||||
REMOVE_BLOCK,
|
|
||||||
REMOVE_FROM_TEAM,
|
|
||||||
DELETE_TEAM,
|
|
||||||
REPORT,
|
|
||||||
PRIVATE_CHAT,
|
|
||||||
PRIVATE_CHAT_RESPONSE,
|
|
||||||
ANNOUNCEMENT,
|
|
||||||
MAIL_COUNT_UPDATE,
|
|
||||||
MAIL_SEND_NOTIFY,
|
|
||||||
REQUEST_USER_LIST,
|
|
||||||
FRIEND_LIST,
|
|
||||||
ROUTE_TO_PLAYER,
|
|
||||||
TEAM_UPDATE,
|
|
||||||
MUTE_UPDATE,
|
|
||||||
CREATE_TEAM,
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //!__ECHATINTERNALMESSAGETYPE__H__
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ECHATMESSAGETYPE__H__
|
#ifndef ECHATMESSAGETYPE_H
|
||||||
#define __ECHATMESSAGETYPE__H__
|
#define ECHATMESSAGETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -72,7 +72,9 @@ enum class eChatMessageType :uint32_t {
|
|||||||
UPDATE_DONATION,
|
UPDATE_DONATION,
|
||||||
PRG_CSR_COMMAND,
|
PRG_CSR_COMMAND,
|
||||||
HEARTBEAT_REQUEST_FROM_WORLD,
|
HEARTBEAT_REQUEST_FROM_WORLD,
|
||||||
UPDATE_FREE_TRIAL_STATUS
|
UPDATE_FREE_TRIAL_STATUS,
|
||||||
|
// CUSTOM DLU MESSAGE ID FOR INTERNAL USE
|
||||||
|
CREATE_TEAM,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ECHATMESSAGETYPE__H__
|
#endif //!ECHATMESSAGETYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ECINEMATICEVENT__H__
|
#ifndef ECINEMATICEVENT_H
|
||||||
#define __ECINEMATICEVENT__H__
|
#define ECINEMATICEVENT_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -9,4 +9,4 @@ enum class eCinematicEvent : uint32_t {
|
|||||||
ENDED,
|
ENDED,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ECINEMATICEVENT__H__
|
#endif //!ECINEMATICEVENT_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ECLIENTMESSAGETYPE__H__
|
#ifndef ECLIENTMESSAGETYPE_H
|
||||||
#define __ECLIENTMESSAGETYPE__H__
|
#define ECLIENTMESSAGETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -73,4 +73,4 @@ enum class eClientMessageType : uint32_t {
|
|||||||
UGC_DOWNLOAD_FAILED = 120
|
UGC_DOWNLOAD_FAILED = 120
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ECLIENTMESSAGETYPE__H__
|
#endif //!ECLIENTMESSAGETYPE_H
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
#ifndef __ECONNECTIONTYPE__H__
|
#ifndef ECONNECTIONTYPE_H
|
||||||
#define __ECONNECTIONTYPE__H__
|
#define ECONNECTIONTYPE_H
|
||||||
|
|
||||||
enum class eConnectionType : uint16_t {
|
enum class eConnectionType : uint16_t {
|
||||||
SERVER = 0,
|
SERVER = 0,
|
||||||
AUTH,
|
AUTH,
|
||||||
CHAT,
|
CHAT,
|
||||||
CHAT_INTERNAL,
|
WORLD = 4,
|
||||||
WORLD,
|
|
||||||
CLIENT,
|
CLIENT,
|
||||||
MASTER
|
MASTER
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ECONNECTIONTYPE__H__
|
#endif //!ECONNECTIONTYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ECONTROLSCHEME__H__
|
#ifndef ECONTROLSCHEME_H
|
||||||
#define __ECONTROLSCHEME__H__
|
#define ECONTROLSCHEME_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -15,4 +15,4 @@ enum class eControlScheme : uint32_t {
|
|||||||
SCHEME_WEAR_A_ROBOT //== freecam?
|
SCHEME_WEAR_A_ROBOT //== freecam?
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ECONTROLSCHEME__H__
|
#endif //!ECONTROLSCHEME_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ECYCLINGMODE__H__
|
#ifndef ECYCLINGMODE_H
|
||||||
#define __ECYCLINGMODE__H__
|
#define ECYCLINGMODE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -8,4 +8,4 @@ enum class eCyclingMode : uint32_t {
|
|||||||
DISALLOW_CYCLING
|
DISALLOW_CYCLING
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ECYCLINGMODE__H__
|
#endif //!ECYCLINGMODE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EENDBEHAVIOR__H__
|
#ifndef EENDBEHAVIOR_H
|
||||||
#define __EENDBEHAVIOR__H__
|
#define EENDBEHAVIOR_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -8,4 +8,4 @@ enum class eEndBehavior : uint32_t {
|
|||||||
WAIT
|
WAIT
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EENDBEHAVIOR__H__
|
#endif //!EENDBEHAVIOR_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EGAMEACTIVITY__H__
|
#ifndef EGAMEACTIVITY_H
|
||||||
#define __EGAMEACTIVITY__H__
|
#define EGAMEACTIVITY_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -12,4 +12,4 @@ enum class eGameActivity : uint32_t {
|
|||||||
PET_TAMING
|
PET_TAMING
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EGAMEACTIVITY__H__
|
#endif //!EGAMEACTIVITY_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EGAMEMASTERLEVEL__H__
|
#ifndef EGAMEMASTERLEVEL_H
|
||||||
#define __EGAMEMASTERLEVEL__H__
|
#define EGAMEMASTERLEVEL_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -17,4 +17,4 @@ enum class eGameMasterLevel : uint8_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //!__EGAMEMASTERLEVEL__H__
|
#endif //!EGAMEMASTERLEVEL_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EGAMEMESSAGETYPE__H__
|
#ifndef EGAMEMESSAGETYPE_H
|
||||||
#define __EGAMEMESSAGETYPE__H__
|
#define EGAMEMESSAGETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -790,9 +790,10 @@ enum class eGameMessageType : uint16_t {
|
|||||||
GET_MISSION_TYPE_STATES = 853,
|
GET_MISSION_TYPE_STATES = 853,
|
||||||
GET_TIME_PLAYED = 854,
|
GET_TIME_PLAYED = 854,
|
||||||
SET_MISSION_VIEWED = 855,
|
SET_MISSION_VIEWED = 855,
|
||||||
SLASH_COMMAND_TEXT_FEEDBACK = 856,
|
HKX_VEHICLE_LOADED = 856,
|
||||||
HANDLE_SLASH_COMMAND_KORE_DEBUGGER = 857,
|
SLASH_COMMAND_TEXT_FEEDBACK = 857,
|
||||||
BROADCAST_TEXT_TO_CHATBOX = 858,
|
BROADCAST_TEXT_TO_CHATBOX = 858,
|
||||||
|
HANDLE_SLASH_COMMAND_KORE_DEBUGGER = 859,
|
||||||
OPEN_PROPERTY_MANAGEMENT = 860,
|
OPEN_PROPERTY_MANAGEMENT = 860,
|
||||||
OPEN_PROPERTY_VENDOR = 861,
|
OPEN_PROPERTY_VENDOR = 861,
|
||||||
VOTE_ON_PROPERTY = 862,
|
VOTE_ON_PROPERTY = 862,
|
||||||
@@ -1610,4 +1611,4 @@ struct magic_enum::customize::enum_range<eGameMessageType> {
|
|||||||
static constexpr int max = 1772;
|
static constexpr int max = 1772;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EGAMEMESSAGETYPE__H__
|
#endif //!EGAMEMESSAGETYPE_H
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#ifndef __EHELPTYPE__H__
|
#ifndef EHELPTYPE_H
|
||||||
#define __EHELPTYPE__H__
|
#define EHELPTYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -38,4 +38,4 @@ enum class eHelpType : int32_t {
|
|||||||
UI_INVENTORY_FULL_CANNOT_PICKUP_ITEM = 86
|
UI_INVENTORY_FULL_CANNOT_PICKUP_ITEM = 86
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EHELPTYPE__H__
|
#endif //!EHELPTYPE_H
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __EINVENTORYTYPE__H__
|
#ifndef EINVENTORYTYPE_H
|
||||||
#define __EINVENTORYTYPE__H__
|
#define EINVENTORYTYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "magic_enum.hpp"
|
||||||
|
|
||||||
static const uint8_t NUMBER_OF_INVENTORIES = 17;
|
static const uint8_t NUMBER_OF_INVENTORIES = 17;
|
||||||
/**
|
/**
|
||||||
* Represents the different types of inventories an entity may have
|
* Represents the different types of inventories an entity may have
|
||||||
@@ -56,4 +59,10 @@ public:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EINVENTORYTYPE__H__
|
template <>
|
||||||
|
struct magic_enum::customize::enum_range<eInventoryType> {
|
||||||
|
static constexpr int min = 0;
|
||||||
|
static constexpr int max = 16;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //!EINVENTORYTYPE_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __EITEMSETPASSIVEABILITYID__H__
|
#ifndef EITEMSETPASSIVEABILITYID_H
|
||||||
#define __EITEMSETPASSIVEABILITYID__H__
|
#define EITEMSETPASSIVEABILITYID_H
|
||||||
|
|
||||||
enum class eItemSetPassiveAbilityID {
|
enum class eItemSetPassiveAbilityID {
|
||||||
EngineerRank1 = 2,
|
EngineerRank1 = 2,
|
||||||
@@ -55,4 +55,4 @@ enum class eItemSetPassiveAbilityID {
|
|||||||
LightningSpinjitzu = 52
|
LightningSpinjitzu = 52
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EITEMSETPASSIVEABILITYID__H__
|
#endif //!EITEMSETPASSIVEABILITYID_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __EITEMTYPE__H__
|
#ifndef EITEMTYPE_H
|
||||||
#define __EITEMTYPE__H__
|
#define EITEMTYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -33,4 +33,4 @@ enum class eItemType : int32_t {
|
|||||||
MOUNT
|
MOUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EITEMTYPE__H__
|
#endif //!EITEMTYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EKILLTYPE__H__
|
#ifndef EKILLTYPE_H
|
||||||
#define __EKILLTYPE__H__
|
#define EKILLTYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -8,4 +8,4 @@ enum class eKillType : uint32_t {
|
|||||||
SILENT
|
SILENT
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EKILLTYPE__H__
|
#endif //!EKILLTYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ELOGINRESPONSE__H__
|
#ifndef ELOGINRESPONSE_H
|
||||||
#define __ELOGINRESPONSE__H__
|
#define ELOGINRESPONSE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -21,4 +21,4 @@ enum class eLoginResponse : uint8_t {
|
|||||||
ACCOUNT_NOT_ACTIVATED
|
ACCOUNT_NOT_ACTIVATED
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ELOGINRESPONSE__H__
|
#endif //!ELOGINRESPONSE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ELOOTSOURCETYPE__H__
|
#ifndef ELOOTSOURCETYPE_H
|
||||||
#define __ELOOTSOURCETYPE__H__
|
#define ELOOTSOURCETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -28,4 +28,4 @@ enum class eLootSourceType : uint32_t {
|
|||||||
RELOCATE
|
RELOCATE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ELOOTSOURCETYPE__H__
|
#endif //!ELOOTSOURCETYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EMASTERMESSAGETYPE__H__
|
#ifndef EMASTERMESSAGETYPE_H
|
||||||
#define __EMASTERMESSAGETYPE__H__
|
#define EMASTERMESSAGETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -33,4 +33,4 @@ enum class eMasterMessageType : uint32_t {
|
|||||||
NEW_SESSION_ALERT
|
NEW_SESSION_ALERT
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EMASTERMESSAGETYPE__H__
|
#endif //!EMASTERMESSAGETYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EMATCHUPDATE__H__
|
#ifndef EMATCHUPDATE_H
|
||||||
#define __EMATCHUPDATE__H__
|
#define EMATCHUPDATE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -14,4 +14,4 @@ enum class eMatchUpdate : int32_t {
|
|||||||
PLAYER_UPDATE
|
PLAYER_UPDATE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EMATCHUPDATE__H__
|
#endif //!EMATCHUPDATE_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __EMISSIONLOCKSTATE__H__
|
#ifndef EMISSIONLOCKSTATE_H
|
||||||
#define __EMISSIONLOCKSTATE__H__
|
#define EMISSIONLOCKSTATE_H
|
||||||
|
|
||||||
enum class eMissionLockState : int {
|
enum class eMissionLockState : int {
|
||||||
LOCKED,
|
LOCKED,
|
||||||
@@ -9,4 +9,4 @@ enum class eMissionLockState : int {
|
|||||||
UNLOCKED,
|
UNLOCKED,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EMISSIONLOCKSTATE__H__
|
#endif //!EMISSIONLOCKSTATE_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __MISSIONSTATE__H__
|
#ifndef MISSIONSTATE_H
|
||||||
#define __MISSIONSTATE__H__
|
#define MISSIONSTATE_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the possible states a mission can be in
|
* Represents the possible states a mission can be in
|
||||||
@@ -53,4 +53,4 @@ enum class eMissionState : int {
|
|||||||
COMPLETE_READY_TO_COMPLETE = 12
|
COMPLETE_READY_TO_COMPLETE = 12
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__MISSIONSTATE__H__
|
#endif //!MISSIONSTATE_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __EMISSIONTASKTYPE__H__
|
#ifndef EMISSIONTASKTYPE_H
|
||||||
#define __EMISSIONTASKTYPE__H__
|
#define EMISSIONTASKTYPE_H
|
||||||
|
|
||||||
enum class eMissionTaskType : int {
|
enum class eMissionTaskType : int {
|
||||||
UNKNOWN = -1,
|
UNKNOWN = -1,
|
||||||
@@ -40,4 +40,4 @@ enum class eMissionTaskType : int {
|
|||||||
DONATION
|
DONATION
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EMISSIONTASKTYPE__H__
|
#endif //!EMISSIONTASKTYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EMOVEMENTPLATFORMSTATE__H__
|
#ifndef EMOVEMENTPLATFORMSTATE_H
|
||||||
#define __EMOVEMENTPLATFORMSTATE__H__
|
#define EMOVEMENTPLATFORMSTATE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -13,4 +13,4 @@ enum class eMovementPlatformState : uint32_t
|
|||||||
Stopped = 0b01100
|
Stopped = 0b01100
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EMOVEMENTPLATFORMSTATE__H__
|
#endif //!EMOVEMENTPLATFORMSTATE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EOBJECTBITS__H__
|
#ifndef EOBJECTBITS_H
|
||||||
#define __EOBJECTBITS__H__
|
#define EOBJECTBITS_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -10,4 +10,4 @@ enum class eObjectBits : size_t {
|
|||||||
CHARACTER = 60
|
CHARACTER = 60
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EOBJECTBITS__H__
|
#endif //!EOBJECTBITS_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EOBJECTWORLDSTATE__H__
|
#ifndef EOBJECTWORLDSTATE_H
|
||||||
#define __EOBJECTWORLDSTATE__H__
|
#define EOBJECTWORLDSTATE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -9,4 +9,4 @@ enum class eObjectWorldState : uint32_t {
|
|||||||
INVENTORY
|
INVENTORY
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EOBJECTWORLDSTATE__H__
|
#endif //!EOBJECTWORLDSTATE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EPACKAGETYPE__H__
|
#ifndef EPACKAGETYPE_H
|
||||||
#define __EPACKAGETYPE__H__
|
#define EPACKAGETYPE_H
|
||||||
|
|
||||||
enum class ePackageType {
|
enum class ePackageType {
|
||||||
INVALID = -1,
|
INVALID = -1,
|
||||||
@@ -10,4 +10,4 @@ enum class ePackageType {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //!__EPACKAGETYPE__H__
|
#endif //!EPACKAGETYPE_H
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#ifndef __EPERMISSIONMAP__H__
|
#ifndef EPERMISSIONMAP_H
|
||||||
#define __EPERMISSIONMAP__H__
|
#define EPERMISSIONMAP_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bitmap of permissions and restrictions for characters.
|
* Bitmap of permissions and restrictions for characters.
|
||||||
@@ -29,4 +29,4 @@ enum class ePermissionMap : uint64_t {
|
|||||||
RestrictedChatAccess = 0x1 << 6,
|
RestrictedChatAccess = 0x1 << 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EPERMISSIONMAP__H__
|
#endif //!EPERMISSIONMAP_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EPETABILITYTYPE__H__
|
#ifndef EPETABILITYTYPE_H
|
||||||
#define __EPETABILITYTYPE__H__
|
#define EPETABILITYTYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -10,4 +10,4 @@ enum class ePetAbilityType : uint32_t {
|
|||||||
DigAtPosition
|
DigAtPosition
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EPETABILITYTYPE__H__
|
#endif //!EPETABILITYTYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EPETTAMINGNOTIFYTYPE__H__
|
#ifndef EPETTAMINGNOTIFYTYPE_H
|
||||||
#define __EPETTAMINGNOTIFYTYPE__H__
|
#define EPETTAMINGNOTIFYTYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -12,4 +12,4 @@ enum class ePetTamingNotifyType : uint32_t {
|
|||||||
NAMINGPET
|
NAMINGPET
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EPETTAMINGNOTIFYTYPE__H__
|
#endif //!EPETTAMINGNOTIFYTYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EPHYSICSEFFECTTYPE__H__
|
#ifndef EPHYSICSEFFECTTYPE_H
|
||||||
#define __EPHYSICSEFFECTTYPE__H__
|
#define EPHYSICSEFFECTTYPE_H
|
||||||
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -12,4 +12,4 @@ enum class ePhysicsEffectType : uint32_t {
|
|||||||
FRICTION
|
FRICTION
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EPHYSICSEFFECTTYPE__H__
|
#endif //!EPHYSICSEFFECTTYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EPLAYERFLAG__H__
|
#ifndef EPLAYERFLAG_H
|
||||||
#define __EPLAYERFLAG__H__
|
#define EPLAYERFLAG_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -170,4 +170,4 @@ enum ePlayerFlag : int32_t {
|
|||||||
DLU_SKIP_CINEMATICS = 1'000'000,
|
DLU_SKIP_CINEMATICS = 1'000'000,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EPLAYERFLAG__H__
|
#endif //!EPLAYERFLAG_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EQUICKBUILDFAILREASON__H__
|
#ifndef EQUICKBUILDFAILREASON_H
|
||||||
#define __EQUICKBUILDFAILREASON__H__
|
#define EQUICKBUILDFAILREASON_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -10,4 +10,4 @@ enum class eQuickBuildFailReason : uint32_t {
|
|||||||
BUILD_ENDED
|
BUILD_ENDED
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EQUICKBUILDFAILREASON__H__
|
#endif //!EQUICKBUILDFAILREASON_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EQUICKBUILDSTATE__H__
|
#ifndef EQUICKBUILDSTATE_H
|
||||||
#define __EQUICKBUILDSTATE__H__
|
#define EQUICKBUILDSTATE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -12,4 +12,4 @@ enum class eQuickBuildState : uint32_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //!__EQUICKBUILDSTATE__H__
|
#endif //!EQUICKBUILDSTATE_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __ERACINGTASKPARAM__H__
|
#ifndef ERACINGTASKPARAM_H
|
||||||
#define __ERACINGTASKPARAM__H__
|
#define ERACINGTASKPARAM_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -22,4 +22,4 @@ enum class eRacingTaskParam : int32_t {
|
|||||||
SMASH_SPECIFIC_SMASHABLE
|
SMASH_SPECIFIC_SMASHABLE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ERACINGTASKPARAM__H__
|
#endif //!ERACINGTASKPARAM_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ERENAMERESPONSE__H__
|
#ifndef ERENAMERESPONSE_H
|
||||||
#define __ERENAMERESPONSE__H__
|
#define ERENAMERESPONSE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -12,4 +12,4 @@ enum class eRenameResponse : uint8_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //!__ERENAMERESPONSE__H__
|
#endif //!ERENAMERESPONSE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EREPLICACOMPONENTTYPE__H__
|
#ifndef EREPLICACOMPONENTTYPE_H
|
||||||
#define __EREPLICACOMPONENTTYPE__H__
|
#define EREPLICACOMPONENTTYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -124,4 +124,4 @@ enum class eReplicaComponentType : uint32_t {
|
|||||||
DESTROYABLE = 1000 // Actually 7
|
DESTROYABLE = 1000 // Actually 7
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EREPLICACOMPONENTTYPE__H__
|
#endif //!EREPLICACOMPONENTTYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EREPLICAPACKETTYPE__H__
|
#ifndef EREPLICAPACKETTYPE_H
|
||||||
#define __EREPLICAPACKETTYPE__H__
|
#define EREPLICAPACKETTYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -9,4 +9,4 @@ enum class eReplicaPacketType : uint8_t {
|
|||||||
DESTRUCTION
|
DESTRUCTION
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EREPLICAPACKETTYPE__H__
|
#endif //!EREPLICAPACKETTYPE_H
|
||||||
|
|||||||
21
dCommon/dEnums/eReponseMoveItemBetweenInventoryTypeCode.h
Normal file
21
dCommon/dEnums/eReponseMoveItemBetweenInventoryTypeCode.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef EREPONSEMOVEITEMBETWEENINVENTORYTYPECODE_H
|
||||||
|
#define EREPONSEMOVEITEMBETWEENINVENTORYTYPECODE_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
enum class eReponseMoveItemBetweenInventoryTypeCode : int32_t {
|
||||||
|
SUCCESS,
|
||||||
|
FAIL_GENERIC,
|
||||||
|
FAIL_INV_FULL,
|
||||||
|
FAIL_ITEM_NOT_FOUND,
|
||||||
|
FAIL_CANT_MOVE_TO_THAT_INV_TYPE,
|
||||||
|
FAIL_NOT_NEAR_BANK,
|
||||||
|
FAIL_CANT_SWAP_ITEMS,
|
||||||
|
FAIL_SOURCE_TYPE,
|
||||||
|
FAIL_WRONG_DEST_TYPE,
|
||||||
|
FAIL_SWAP_DEST_TYPE,
|
||||||
|
FAIL_CANT_MOVE_THINKING_HAT,
|
||||||
|
FAIL_DISMOUNT_BEFORE_MOVING
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //!EREPONSEMOVEITEMBETWEENINVENTORYTYPECODE_H
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ESERVERDISCONNECTIDENTIFIERS__H__
|
#ifndef ESERVERDISCONNECTIDENTIFIERS_H
|
||||||
#define __ESERVERDISCONNECTIDENTIFIERS__H__
|
#define ESERVERDISCONNECTIDENTIFIERS_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -21,4 +21,4 @@ enum class eServerDisconnectIdentifiers : uint32_t {
|
|||||||
PLAY_SCHEDULE_TIME_DONE
|
PLAY_SCHEDULE_TIME_DONE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ESERVERDISCONNECTIDENTIFIERS__H__
|
#endif //!ESERVERDISCONNECTIDENTIFIERS_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ESERVERMESSAGETYPE__H__
|
#ifndef ESERVERMESSAGETYPE_H
|
||||||
#define __ESERVERMESSAGETYPE__H__
|
#define ESERVERMESSAGETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
//! The Internal Server Packet Identifiers
|
//! The Internal Server Packet Identifiers
|
||||||
@@ -9,4 +9,4 @@ enum class eServerMessageType : uint32_t {
|
|||||||
GENERAL_NOTIFY
|
GENERAL_NOTIFY
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ESERVERMESSAGETYPE__H__
|
#endif //!ESERVERMESSAGETYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ESQLITEDATATYPE__H__
|
#ifndef ESQLITEDATATYPE_H
|
||||||
#define __ESQLITEDATATYPE__H__
|
#define ESQLITEDATATYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -13,4 +13,4 @@ enum class eSqliteDataType : int32_t {
|
|||||||
TEXT_8 = 8
|
TEXT_8 = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ESQLITEDATATYPE__H__
|
#endif //!ESQLITEDATATYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ESTATECHANGETYPE__H__
|
#ifndef ESTATECHANGETYPE_H
|
||||||
#define __ESTATECHANGETYPE__H__
|
#define ESTATECHANGETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -8,4 +8,4 @@ enum class eStateChangeType : uint32_t {
|
|||||||
POP
|
POP
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ESTATECHANGETYPE__H__
|
#endif //!ESTATECHANGETYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ETERMINATETYPE__H__
|
#ifndef ETERMINATETYPE_H
|
||||||
#define __ETERMINATETYPE__H__
|
#define ETERMINATETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -9,4 +9,4 @@ enum class eTerminateType : uint32_t {
|
|||||||
FROM_INTERACTION
|
FROM_INTERACTION
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ETERMINATETYPE__H__
|
#endif //!ETERMINATETYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ETRIGGERCOMMANDTYPE__H__
|
#ifndef ETRIGGERCOMMANDTYPE_H
|
||||||
#define __ETRIGGERCOMMANDTYPE__H__
|
#define ETRIGGERCOMMANDTYPE_H
|
||||||
|
|
||||||
// For info about Trigger Command see:
|
// For info about Trigger Command see:
|
||||||
// https://docs.lu-dev.net/en/latest/file-structures/lutriggers.html?highlight=trigger#possible-values-commands
|
// https://docs.lu-dev.net/en/latest/file-structures/lutriggers.html?highlight=trigger#possible-values-commands
|
||||||
@@ -116,4 +116,4 @@ public:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ETRIGGERCOMMANDTYPE__H__
|
#endif //!ETRIGGERCOMMANDTYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __ETRIGGEREVENTTYPE__H__
|
#ifndef ETRIGGEREVENTTYPE_H
|
||||||
#define __ETRIGGEREVENTTYPE__H__
|
#define ETRIGGEREVENTTYPE_H
|
||||||
|
|
||||||
enum class eTriggerEventType {
|
enum class eTriggerEventType {
|
||||||
INVALID,
|
INVALID,
|
||||||
@@ -50,4 +50,4 @@ public:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__ETRIGGEREVENTTYPE__H__
|
#endif //!ETRIGGEREVENTTYPE_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __EUNEQUIPPABLEACTIVETYPE__H__
|
#ifndef EUNEQUIPPABLEACTIVETYPE_H
|
||||||
#define __EUNEQUIPPABLEACTIVETYPE__H__
|
#define EUNEQUIPPABLEACTIVETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -11,4 +11,4 @@ enum class eUnequippableActiveType : int32_t {
|
|||||||
MOUNT
|
MOUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EUNEQUIPPABLEACTIVETYPE__H__
|
#endif //!EUNEQUIPPABLEACTIVETYPE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EUSEITEMRESPONSE__H__
|
#ifndef EUSEITEMRESPONSE_H
|
||||||
#define __EUSEITEMRESPONSE__H__
|
#define EUSEITEMRESPONSE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -9,4 +9,4 @@ enum class eUseItemResponse : uint32_t {
|
|||||||
MountsNotAllowed
|
MountsNotAllowed
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EUSEITEMRESPONSE__H__
|
#endif //!EUSEITEMRESPONSE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EVENDORTRANSACTIONRESULT__
|
#ifndef EVENDORTRANSACTIONRESULT_H
|
||||||
#define __EVENDORTRANSACTIONRESULT__
|
#define EVENDORTRANSACTIONRESULT_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -12,4 +12,4 @@ enum class eVendorTransactionResult : uint32_t {
|
|||||||
DONATION_FULL
|
DONATION_FULL
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !__EVENDORTRANSACTIONRESULT__
|
#endif // !EVENDORTRANSACTIONRESULT_H
|
||||||
|
|||||||
59
dCommon/dEnums/eWaypointCommandType.h
Normal file
59
dCommon/dEnums/eWaypointCommandType.h
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
|
||||||
|
#ifndef EWAYPOINTCOMMANDTYPES_H
|
||||||
|
#define EWAYPOINTCOMMANDTYPES_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
enum class eWaypointCommandType : uint32_t {
|
||||||
|
INVALID,
|
||||||
|
BOUNCE,
|
||||||
|
STOP,
|
||||||
|
GROUP_EMOTE,
|
||||||
|
SET_VARIABLE,
|
||||||
|
CAST_SKILL,
|
||||||
|
EQUIP_INVENTORY,
|
||||||
|
UNEQUIP_INVENTORY,
|
||||||
|
DELAY,
|
||||||
|
EMOTE,
|
||||||
|
TELEPORT,
|
||||||
|
PATH_SPEED,
|
||||||
|
REMOVE_NPC,
|
||||||
|
CHANGE_WAYPOINT,
|
||||||
|
DELETE_SELF,
|
||||||
|
KILL_SELF,
|
||||||
|
SPAWN_OBJECT,
|
||||||
|
PLAY_SOUND,
|
||||||
|
};
|
||||||
|
|
||||||
|
class WaypointCommandType {
|
||||||
|
public:
|
||||||
|
static eWaypointCommandType StringToWaypointCommandType(std::string commandString) {
|
||||||
|
const std::map<std::string, eWaypointCommandType> WaypointCommandTypeMap = {
|
||||||
|
{"bounce", eWaypointCommandType::BOUNCE},
|
||||||
|
{"stop", eWaypointCommandType::STOP},
|
||||||
|
{"groupemote", eWaypointCommandType::GROUP_EMOTE},
|
||||||
|
{"setvar", eWaypointCommandType::SET_VARIABLE},
|
||||||
|
{"castskill", eWaypointCommandType::CAST_SKILL},
|
||||||
|
{"eqInvent", eWaypointCommandType::EQUIP_INVENTORY},
|
||||||
|
{"unInvent", eWaypointCommandType::UNEQUIP_INVENTORY},
|
||||||
|
{"delay", eWaypointCommandType::DELAY},
|
||||||
|
{"femote", eWaypointCommandType::EMOTE},
|
||||||
|
{"emote", eWaypointCommandType::EMOTE},
|
||||||
|
{"teleport", eWaypointCommandType::TELEPORT},
|
||||||
|
{"pathspeed", eWaypointCommandType::PATH_SPEED},
|
||||||
|
{"removeNPC", eWaypointCommandType::REMOVE_NPC},
|
||||||
|
{"changeWP", eWaypointCommandType::CHANGE_WAYPOINT},
|
||||||
|
{"DeleteSelf", eWaypointCommandType::DELETE_SELF},
|
||||||
|
{"killself", eWaypointCommandType::KILL_SELF},
|
||||||
|
{"removeself", eWaypointCommandType::DELETE_SELF},
|
||||||
|
{"spawnOBJ", eWaypointCommandType::SPAWN_OBJECT},
|
||||||
|
{"playSound", eWaypointCommandType::PLAY_SOUND},
|
||||||
|
};
|
||||||
|
|
||||||
|
auto intermed = WaypointCommandTypeMap.find(commandString);
|
||||||
|
return (intermed != WaypointCommandTypeMap.end()) ? intermed->second : eWaypointCommandType::INVALID;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //!EWAYPOINTCOMMANDTYPES_H
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef __EWORLDMESSAGETYPE__H__
|
#ifndef EWORLDMESSAGETYPE_H
|
||||||
#define __EWORLDMESSAGETYPE__H__
|
#define EWORLDMESSAGETYPE_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -29,8 +29,8 @@ enum class eWorldMessageType : uint32_t {
|
|||||||
ROUTE_PACKET, // Social?
|
ROUTE_PACKET, // Social?
|
||||||
POSITION_UPDATE,
|
POSITION_UPDATE,
|
||||||
MAIL,
|
MAIL,
|
||||||
WORD_CHECK, // Whitelist word check
|
WORD_CHECK, // AllowList word check
|
||||||
STRING_CHECK, // Whitelist string check
|
STRING_CHECK, // AllowList string check
|
||||||
GET_PLAYERS_IN_ZONE,
|
GET_PLAYERS_IN_ZONE,
|
||||||
REQUEST_UGC_MANIFEST_INFO,
|
REQUEST_UGC_MANIFEST_INFO,
|
||||||
BLUEPRINT_GET_ALL_DATA_REQUEST,
|
BLUEPRINT_GET_ALL_DATA_REQUEST,
|
||||||
@@ -48,4 +48,4 @@ struct magic_enum::customize::enum_range<eWorldMessageType> {
|
|||||||
static constexpr int max = 91;
|
static constexpr int max = 91;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__EWORLDMESSAGETYPE__H__
|
#endif //!EWORLDMESSAGETYPE_H
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user