mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-01-11 15:27:07 +00:00
Merge branch 'DarkflameUniverse:main' into PetFixes
This commit is contained in:
commit
c575fd9a6c
@ -3,8 +3,8 @@ Dockerfile
|
|||||||
*.md
|
*.md
|
||||||
logo.png
|
logo.png
|
||||||
versions.txt
|
versions.txt
|
||||||
build.sh
|
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
.env
|
.env
|
||||||
docker/__pycache__
|
docker/__pycache__
|
||||||
.env.example
|
.env.example
|
||||||
|
build
|
||||||
|
56
.github/workflows/build-and-push-docker.yml
vendored
Normal file
56
.github/workflows/build-and-push-docker.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push-image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Log in to the Container registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
# generate Docker tags based on the following events/attributes
|
||||||
|
tags: |
|
||||||
|
type=ref,event=pr
|
||||||
|
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -122,3 +122,4 @@ docker/__pycache__
|
|||||||
docker-compose.override.yml
|
docker-compose.override.yml
|
||||||
|
|
||||||
!*Test.bin
|
!*Test.bin
|
||||||
|
!cmake/*
|
||||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -14,9 +14,6 @@
|
|||||||
path = thirdparty/mariadb-connector-cpp
|
path = thirdparty/mariadb-connector-cpp
|
||||||
url = https://github.com/mariadb-corporation/mariadb-connector-cpp.git
|
url = https://github.com/mariadb-corporation/mariadb-connector-cpp.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
[submodule "thirdparty/AccountManager"]
|
|
||||||
path = thirdparty/AccountManager
|
|
||||||
url = https://github.com/DarkflameUniverse/AccountManager
|
|
||||||
[submodule "thirdparty/magic_enum"]
|
[submodule "thirdparty/magic_enum"]
|
||||||
path = thirdparty/magic_enum
|
path = thirdparty/magic_enum
|
||||||
url = https://github.com/Neargye/magic_enum.git
|
url = https://github.com/Neargye/magic_enum.git
|
||||||
|
146
CMakeLists.txt
146
CMakeLists.txt
@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.18)
|
|||||||
project(Darkflame)
|
project(Darkflame)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
|
|
||||||
set (CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
# Read variables from file
|
# Read variables from file
|
||||||
FILE(READ "${CMAKE_SOURCE_DIR}/CMakeVariables.txt" variables)
|
FILE(READ "${CMAKE_SOURCE_DIR}/CMakeVariables.txt" variables)
|
||||||
@ -14,14 +15,13 @@ string(REPLACE "\n" ";" variables ${variables})
|
|||||||
foreach(variable ${variables})
|
foreach(variable ${variables})
|
||||||
# If the string contains a #, skip it
|
# If the string contains a #, skip it
|
||||||
if(NOT "${variable}" MATCHES "#")
|
if(NOT "${variable}" MATCHES "#")
|
||||||
|
|
||||||
# Split the variable into name and value
|
# Split the variable into name and value
|
||||||
string(REPLACE "=" ";" variable ${variable})
|
string(REPLACE "=" ";" variable ${variable})
|
||||||
|
|
||||||
# Check that the length of the variable is 2 (name and value)
|
# Check that the length of the variable is 2 (name and value)
|
||||||
list(LENGTH variable length)
|
list(LENGTH variable length)
|
||||||
if(${length} EQUAL 2)
|
|
||||||
|
|
||||||
|
if(${length} EQUAL 2)
|
||||||
list(GET variable 0 variable_name)
|
list(GET variable 0 variable_name)
|
||||||
list(GET variable 1 variable_value)
|
list(GET variable 1 variable_value)
|
||||||
|
|
||||||
@ -53,15 +53,16 @@ set(RECASTNAVIGATION_EXAMPLES OFF CACHE BOOL "" FORCE)
|
|||||||
if(UNIX)
|
if(UNIX)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17 -O2 -Wuninitialized -fPIC")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17 -O2 -Wuninitialized -fPIC")
|
||||||
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0 _GLIBCXX_USE_CXX17_ABI=0)
|
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0 _GLIBCXX_USE_CXX17_ABI=0)
|
||||||
|
|
||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -lstdc++fs")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -lstdc++fs")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (${DYNAMIC} AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(${DYNAMIC} AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (${GGDB})
|
if(${GGDB})
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -97,47 +98,64 @@ 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" "blacklist.dcf")
|
||||||
message(STATUS "Checking resource file integrity")
|
message(STATUS "Checking resource file integrity")
|
||||||
foreach (resource_file ${RESOURCE_FILES})
|
|
||||||
|
include(Utils)
|
||||||
|
UpdateConfigOption(${PROJECT_BINARY_DIR}/authconfig.ini "port" "auth_server_port")
|
||||||
|
UpdateConfigOption(${PROJECT_BINARY_DIR}/chatconfig.ini "port" "chat_server_port")
|
||||||
|
UpdateConfigOption(${PROJECT_BINARY_DIR}/masterconfig.ini "port" "master_server_port")
|
||||||
|
|
||||||
|
foreach(resource_file ${RESOURCE_FILES})
|
||||||
set(file_size 0)
|
set(file_size 0)
|
||||||
if (EXISTS ${PROJECT_BINARY_DIR}/${resource_file})
|
|
||||||
|
if(EXISTS ${PROJECT_BINARY_DIR}/${resource_file})
|
||||||
file(SIZE ${PROJECT_BINARY_DIR}/${resource_file} file_size)
|
file(SIZE ${PROJECT_BINARY_DIR}/${resource_file} file_size)
|
||||||
endif()
|
endif()
|
||||||
if (${file_size} EQUAL 0)
|
|
||||||
|
if(${file_size} EQUAL 0)
|
||||||
configure_file(
|
configure_file(
|
||||||
${CMAKE_SOURCE_DIR}/resources/${resource_file} ${PROJECT_BINARY_DIR}/${resource_file}
|
${CMAKE_SOURCE_DIR}/resources/${resource_file} ${PROJECT_BINARY_DIR}/${resource_file}
|
||||||
COPYONLY
|
COPYONLY
|
||||||
)
|
)
|
||||||
message(STATUS "Moved " ${resource_file} " to project binary directory")
|
message(STATUS "Moved " ${resource_file} " to project binary directory")
|
||||||
elseif (resource_file MATCHES ".ini")
|
elseif(resource_file MATCHES ".ini")
|
||||||
message(STATUS "Checking " ${resource_file} " for missing config options")
|
message(STATUS "Checking " ${resource_file} " for missing config options")
|
||||||
file(READ ${PROJECT_BINARY_DIR}/${resource_file} current_file_contents)
|
file(READ ${PROJECT_BINARY_DIR}/${resource_file} current_file_contents)
|
||||||
string(REPLACE "\\\n" "" current_file_contents ${current_file_contents})
|
string(REPLACE "\\\n" "" current_file_contents ${current_file_contents})
|
||||||
string(REPLACE "\n" ";" current_file_contents ${current_file_contents})
|
string(REPLACE "\n" ";" current_file_contents ${current_file_contents})
|
||||||
set(parsed_current_file_contents "")
|
set(parsed_current_file_contents "")
|
||||||
|
|
||||||
# Remove comment lines so they do not interfere with the variable parsing
|
# Remove comment lines so they do not interfere with the variable parsing
|
||||||
foreach (line ${current_file_contents})
|
foreach(line ${current_file_contents})
|
||||||
string(FIND ${line} "#" is_comment)
|
string(FIND ${line} "#" is_comment)
|
||||||
if (NOT ${is_comment} EQUAL 0)
|
|
||||||
|
if(NOT ${is_comment} EQUAL 0)
|
||||||
string(APPEND parsed_current_file_contents ${line})
|
string(APPEND parsed_current_file_contents ${line})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
file(READ ${CMAKE_SOURCE_DIR}/resources/${resource_file} depot_file_contents)
|
file(READ ${CMAKE_SOURCE_DIR}/resources/${resource_file} depot_file_contents)
|
||||||
string(REPLACE "\\\n" "" depot_file_contents ${depot_file_contents})
|
string(REPLACE "\\\n" "" depot_file_contents ${depot_file_contents})
|
||||||
string(REPLACE "\n" ";" depot_file_contents ${depot_file_contents})
|
string(REPLACE "\n" ";" depot_file_contents ${depot_file_contents})
|
||||||
set(line_to_add "")
|
set(line_to_add "")
|
||||||
foreach (line ${depot_file_contents})
|
|
||||||
|
foreach(line ${depot_file_contents})
|
||||||
string(FIND ${line} "#" is_comment)
|
string(FIND ${line} "#" is_comment)
|
||||||
if (NOT ${is_comment} EQUAL 0)
|
|
||||||
|
if(NOT ${is_comment} EQUAL 0)
|
||||||
string(REPLACE "=" ";" line_split ${line})
|
string(REPLACE "=" ";" line_split ${line})
|
||||||
list(GET line_split 0 variable_name)
|
list(GET line_split 0 variable_name)
|
||||||
if (NOT ${parsed_current_file_contents} MATCHES ${variable_name})
|
|
||||||
|
if(NOT ${parsed_current_file_contents} MATCHES ${variable_name})
|
||||||
message(STATUS "Adding missing config option " ${variable_name} " to " ${resource_file})
|
message(STATUS "Adding missing config option " ${variable_name} " to " ${resource_file})
|
||||||
set(line_to_add ${line_to_add} ${line})
|
set(line_to_add ${line_to_add} ${line})
|
||||||
foreach (line_to_append ${line_to_add})
|
|
||||||
|
foreach(line_to_append ${line_to_add})
|
||||||
file(APPEND ${PROJECT_BINARY_DIR}/${resource_file} "\n" ${line_to_append})
|
file(APPEND ${PROJECT_BINARY_DIR}/${resource_file} "\n" ${line_to_append})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
file(APPEND ${PROJECT_BINARY_DIR}/${resource_file} "\n")
|
file(APPEND ${PROJECT_BINARY_DIR}/${resource_file} "\n")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(line_to_add "")
|
set(line_to_add "")
|
||||||
else()
|
else()
|
||||||
set(line_to_add ${line_to_add} ${line})
|
set(line_to_add ${line_to_add} ${line})
|
||||||
@ -145,10 +163,11 @@ foreach (resource_file ${RESOURCE_FILES})
|
|||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
message(STATUS "Resource file integrity check complete")
|
message(STATUS "Resource file integrity check complete")
|
||||||
|
|
||||||
# if navmeshes directory does not exist, create it
|
# if navmeshes directory does not exist, create it
|
||||||
if (NOT EXISTS ${PROJECT_BINARY_DIR}/navmeshes)
|
if(NOT EXISTS ${PROJECT_BINARY_DIR}/navmeshes)
|
||||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/navmeshes)
|
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/navmeshes)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -160,6 +179,7 @@ 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" "NPC.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)
|
||||||
endforeach()
|
endforeach()
|
||||||
@ -167,6 +187,7 @@ endforeach()
|
|||||||
# Move our migrations for MasterServer to run
|
# Move our migrations for MasterServer to run
|
||||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/migrations/dlu/)
|
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/migrations/dlu/)
|
||||||
file(GLOB SQL_FILES ${CMAKE_SOURCE_DIR}/migrations/dlu/*.sql)
|
file(GLOB SQL_FILES ${CMAKE_SOURCE_DIR}/migrations/dlu/*.sql)
|
||||||
|
|
||||||
foreach(file ${SQL_FILES})
|
foreach(file ${SQL_FILES})
|
||||||
get_filename_component(file ${file} NAME)
|
get_filename_component(file ${file} NAME)
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/migrations/dlu/${file} ${PROJECT_BINARY_DIR}/migrations/dlu/${file})
|
configure_file(${CMAKE_SOURCE_DIR}/migrations/dlu/${file} ${PROJECT_BINARY_DIR}/migrations/dlu/${file})
|
||||||
@ -174,6 +195,7 @@ endforeach()
|
|||||||
|
|
||||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/migrations/cdserver/)
|
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/migrations/cdserver/)
|
||||||
file(GLOB SQL_FILES ${CMAKE_SOURCE_DIR}/migrations/cdserver/*.sql)
|
file(GLOB SQL_FILES ${CMAKE_SOURCE_DIR}/migrations/cdserver/*.sql)
|
||||||
|
|
||||||
foreach(file ${SQL_FILES})
|
foreach(file ${SQL_FILES})
|
||||||
get_filename_component(file ${file} NAME)
|
get_filename_component(file ${file} NAME)
|
||||||
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})
|
||||||
@ -215,78 +237,6 @@ set(INCLUDED_DIRECTORIES
|
|||||||
|
|
||||||
"dNet"
|
"dNet"
|
||||||
|
|
||||||
"dScripts"
|
|
||||||
"dScripts/02_server"
|
|
||||||
"dScripts/ai"
|
|
||||||
"dScripts/client"
|
|
||||||
"dScripts/EquipmentScripts"
|
|
||||||
"dScripts/EquipmentTriggers"
|
|
||||||
"dScripts/zone"
|
|
||||||
"dScripts/02_server/DLU"
|
|
||||||
"dScripts/02_server/Enemy"
|
|
||||||
"dScripts/02_server/Equipment"
|
|
||||||
"dScripts/02_server/Map"
|
|
||||||
"dScripts/02_server/Minigame"
|
|
||||||
"dScripts/02_server/Objects"
|
|
||||||
"dScripts/02_server/Pets"
|
|
||||||
"dScripts/02_server/Enemy/AG"
|
|
||||||
"dScripts/02_server/Enemy/AM"
|
|
||||||
"dScripts/02_server/Enemy/FV"
|
|
||||||
"dScripts/02_server/Enemy/General"
|
|
||||||
"dScripts/02_server/Enemy/Survival"
|
|
||||||
"dScripts/02_server/Enemy/VE"
|
|
||||||
"dScripts/02_server/Enemy/Waves"
|
|
||||||
"dScripts/02_server/Map/AG"
|
|
||||||
"dScripts/02_server/Map/AG_Spider_Queen"
|
|
||||||
"dScripts/02_server/Map/AM"
|
|
||||||
"dScripts/02_server/Map/FV"
|
|
||||||
"dScripts/02_server/Map/General"
|
|
||||||
"dScripts/02_server/Map/GF"
|
|
||||||
"dScripts/02_server/Map/njhub"
|
|
||||||
"dScripts/02_server/Map/NS"
|
|
||||||
"dScripts/02_server/Map/NT"
|
|
||||||
"dScripts/02_server/Map/PR"
|
|
||||||
"dScripts/02_server/Map/Property"
|
|
||||||
"dScripts/02_server/Map/SS"
|
|
||||||
"dScripts/02_server/Map/VE"
|
|
||||||
"dScripts/02_server/Map/FV/Racing"
|
|
||||||
"dScripts/02_server/Map/General/Ninjago"
|
|
||||||
"dScripts/02_server/Map/njhub/boss_instance"
|
|
||||||
"dScripts/02_server/Map/NS/Waves"
|
|
||||||
"dScripts/02_server/Map/Property/AG_Med"
|
|
||||||
"dScripts/02_server/Map/Property/AG_Small"
|
|
||||||
"dScripts/02_server/Map/Property/NS_Med"
|
|
||||||
"dScripts/02_server/Minigame/General"
|
|
||||||
"dScripts/ai/ACT"
|
|
||||||
"dScripts/ai/AG"
|
|
||||||
"dScripts/ai/FV"
|
|
||||||
"dScripts/ai/GENERAL"
|
|
||||||
"dScripts/ai/GF"
|
|
||||||
"dScripts/ai/MINIGAME"
|
|
||||||
"dScripts/ai/MINIGAME/Objects"
|
|
||||||
"dScripts/ai/NP"
|
|
||||||
"dScripts/ai/NS"
|
|
||||||
"dScripts/ai/PETS"
|
|
||||||
"dScripts/ai/PROPERTY"
|
|
||||||
"dScripts/ai/RACING"
|
|
||||||
"dScripts/ai/SPEC"
|
|
||||||
"dScripts/ai/WILD"
|
|
||||||
"dScripts/ai/ACT/FootRace"
|
|
||||||
"dScripts/ai/MINIGAME/SG_GF"
|
|
||||||
"dScripts/ai/MINIGAME/SG_GF/SERVER"
|
|
||||||
"dScripts/ai/NS/NS_PP_01"
|
|
||||||
"dScripts/ai/NS/WH"
|
|
||||||
"dScripts/ai/PROPERTY/AG"
|
|
||||||
"dScripts/ai/RACING/OBJECTS"
|
|
||||||
"dScripts/client/ai"
|
|
||||||
"dScripts/client/ai/PR"
|
|
||||||
"dScripts/zone/AG"
|
|
||||||
"dScripts/zone/LUPs"
|
|
||||||
"dScripts/zone/PROPERTY"
|
|
||||||
"dScripts/zone/PROPERTY/FV"
|
|
||||||
"dScripts/zone/PROPERTY/GF"
|
|
||||||
"dScripts/zone/PROPERTY/NS"
|
|
||||||
|
|
||||||
"thirdparty/magic_enum/include/magic_enum"
|
"thirdparty/magic_enum/include/magic_enum"
|
||||||
"thirdparty/raknet/Source"
|
"thirdparty/raknet/Source"
|
||||||
"thirdparty/tinyxml2"
|
"thirdparty/tinyxml2"
|
||||||
@ -301,20 +251,20 @@ set(INCLUDED_DIRECTORIES
|
|||||||
)
|
)
|
||||||
|
|
||||||
# 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)
|
||||||
if (APPLE)
|
if(APPLE)
|
||||||
include_directories("/usr/local/include/")
|
include_directories("/usr/local/include/")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Actually include the directories from our list
|
# Actually include the directories from our list
|
||||||
foreach (dir ${INCLUDED_DIRECTORIES})
|
foreach(dir ${INCLUDED_DIRECTORIES})
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/${dir})
|
include_directories(${PROJECT_SOURCE_DIR}/${dir})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if (NOT WIN32)
|
if(NOT WIN32)
|
||||||
include_directories("${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt/include/bcrypt")
|
include_directories("${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt/include/bcrypt")
|
||||||
endif()
|
endif()
|
||||||
include_directories("${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt/include")
|
|
||||||
|
|
||||||
|
include_directories("${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt/include")
|
||||||
|
|
||||||
# Add linking directories:
|
# Add linking directories:
|
||||||
link_directories(${PROJECT_BINARY_DIR})
|
link_directories(${PROJECT_BINARY_DIR})
|
||||||
@ -368,10 +318,10 @@ add_subdirectory(dPhysics)
|
|||||||
set(COMMON_LIBRARIES "dCommon" "dDatabase" "dNet" "raknet" "mariadbConnCpp" "magic_enum")
|
set(COMMON_LIBRARIES "dCommon" "dDatabase" "dNet" "raknet" "mariadbConnCpp" "magic_enum")
|
||||||
|
|
||||||
# Add platform specific common libraries
|
# Add platform specific common libraries
|
||||||
if (UNIX)
|
if(UNIX)
|
||||||
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} "dl" "pthread")
|
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} "dl" "pthread")
|
||||||
|
|
||||||
if (NOT APPLE AND ${INCLUDE_BACKTRACE})
|
if(NOT APPLE AND ${INCLUDE_BACKTRACE})
|
||||||
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} "backtrace")
|
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} "backtrace")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -382,12 +332,6 @@ add_subdirectory(dAuthServer)
|
|||||||
add_subdirectory(dChatServer)
|
add_subdirectory(dChatServer)
|
||||||
add_subdirectory(dMasterServer) # Add MasterServer last so it can rely on the other binaries
|
add_subdirectory(dMasterServer) # Add MasterServer last so it can rely on the other binaries
|
||||||
|
|
||||||
# Add our precompiled headers
|
|
||||||
target_precompile_headers(
|
|
||||||
dGame PRIVATE
|
|
||||||
${HEADERS_DGAME}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_precompile_headers(
|
target_precompile_headers(
|
||||||
dZoneManager PRIVATE
|
dZoneManager PRIVATE
|
||||||
${HEADERS_DZONEMANAGER}
|
${HEADERS_DZONEMANAGER}
|
||||||
@ -409,6 +353,6 @@ target_precompile_headers(
|
|||||||
"$<$<COMPILE_LANGUAGE:CXX>:${PROJECT_SOURCE_DIR}/thirdparty/tinyxml2/tinyxml2.h>"
|
"$<$<COMPILE_LANGUAGE:CXX>:${PROJECT_SOURCE_DIR}/thirdparty/tinyxml2/tinyxml2.h>"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (${ENABLE_TESTING})
|
if(${ENABLE_TESTING})
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
46
Docker.md
46
Docker.md
@ -1,46 +0,0 @@
|
|||||||
# Run the Darkflame Server inside Docker
|
|
||||||
|
|
||||||
## What you need
|
|
||||||
|
|
||||||
- [Docker](https://docs.docker.com/get-docker/) (Docker Desktop or on Linux normal Docker)
|
|
||||||
- [Docker Compose](https://docs.docker.com/compose/install/) (Included in Docker Desktop)
|
|
||||||
- LEGO® Universe Client. Check the main [README](./README.md) for details on this.
|
|
||||||
|
|
||||||
## Run server inside Docker
|
|
||||||
|
|
||||||
1. Copy `.env.example` and save it as `.env` inside the root directory of this repository
|
|
||||||
2. Edit the `.env` file and add your path to the root directory of your LEGO® Universe Client after `CLIENT_PATH=`
|
|
||||||
3. Update other values in the `.env` file as needed (be sure to update passwords!)
|
|
||||||
4. Run `docker compose up -d --build`
|
|
||||||
5. Run `docker compose exec darkflame /app/MasterServer -a` and setup your admin account
|
|
||||||
6. Follow the directions [here](https://github.com/DarkflameUniverse/AccountManager) to setup regular user accounts. The server will be accessible at: `http://<EXTERNAL_IP>:5000`
|
|
||||||
7. Now you can see the output of the server with `docker compose logs -f --tail 100` or `docker compose logs -f --tail 100`. This can help you understand issues and there you can also see when the server finishes it's startup.
|
|
||||||
8. You're ready to connect your client!
|
|
||||||
|
|
||||||
**NOTE #1**: If you're running an older version of Docker, you may need to use the command `docker-compose` instead of `docker compose`.
|
|
||||||
|
|
||||||
**NOTE #2**: To stop the server simply run `docker compose down` and to restart it just run `docker compose up -d` again. No need to run all the steps above every time.
|
|
||||||
|
|
||||||
**NOTE #3**: Docker buildkit needs to be enabled. https://docs.docker.com/develop/develop-images/build_enhancements/#to-enable-buildkit-builds
|
|
||||||
|
|
||||||
**NOTE #4**: Make sure to run the following in the repo root directory after cloning so submodules are also downloaded.
|
|
||||||
```
|
|
||||||
git submodule update --init --recursive
|
|
||||||
```
|
|
||||||
**NOTE #5**: If DarkflameSetup fails due to not having cdclient.fdb, rename CDClient.fdb (in the same folder) to cdclient.fdb
|
|
||||||
|
|
||||||
## Disable brickbuildfix
|
|
||||||
|
|
||||||
If you don't need the http server running on port 80 do this:
|
|
||||||
|
|
||||||
1. Create a file with the name `docker-compose.override.yml` in the root of the repository
|
|
||||||
2. Paste this content:
|
|
||||||
|
|
||||||
```yml
|
|
||||||
services:
|
|
||||||
brickbuildfix:
|
|
||||||
profiles:
|
|
||||||
- donotstart
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Now run `docker compose up -d`
|
|
@ -1,58 +0,0 @@
|
|||||||
# Installation under Windows
|
|
||||||
## First Run
|
|
||||||
1. Navigate to the [Docker download page](https://www.docker.com/products/docker-desktop) and download docker.
|
|
||||||
|
|
||||||
![Docker Download Page](docker/images/Docker_Download_Page.png)
|
|
||||||
|
|
||||||
2. Once the file has finished downloading, run it and proceed through the installation. Make sure, "Install required Windows components for WSL 2" is checked.
|
|
||||||
|
|
||||||
![Docker Desktop Installer Configuration](docker/images/Docker_Desktop_Installer_Configuration.png)
|
|
||||||
|
|
||||||
3. If necessary, restart your computer.
|
|
||||||
4. After the restart, Docker Desktop will automatically open. If it does not, simply start it like any other program.
|
|
||||||
5. If a window "WSL 2 Installation is incomplete." pops up, follow the link and click "WSL2 Linux kernel update package for x64 machines". Run the downloaded file and once that finishes, click "Restart" in the Docker Desktop window.
|
|
||||||
|
|
||||||
![WSL 2 download](docker/images/WSL_2_download.png)
|
|
||||||
|
|
||||||
6. Wait until Docker Desktop has started. You may skip the tutorial.
|
|
||||||
7. You may want to disable "Open Docker Dashboard at startup" in _Settings_ -> _General_
|
|
||||||
|
|
||||||
![Disable Dashboard Autostart](docker/images/DD_General_Settings.png)
|
|
||||||
|
|
||||||
8. Install [Git for Windows](https://git-scm.com/download/win). During the installation, simply confirming the defaults is sufficient.
|
|
||||||
9. In the folder you wish to save the Server, right click and select "Git Bash Here".
|
|
||||||
10. Type `git clone --recursive https://github.com/DarkflameUniverse/DarkflameServer`
|
|
||||||
11. Once the command has completed (you can see you path again and can enter commands), close the window.
|
|
||||||
12. Inside the downloaded folder, copy `.env.example` and name the copy `.env`
|
|
||||||
13. Open `.env` with Notepad by right-clicking it and selecting _Open With_ -> _More apps_ -> _Notepad_.
|
|
||||||
14. Change the text after `CLIENT_PATH=` to the location of your client. This folder must contain either a folder `client` or `legouniverse.exe`.
|
|
||||||
> If you need the extra performance, place the client files in `\\wsl$\<your linux OS>\...` to avoid working across file systems, see [Docker Best Practices](https://docs.docker.com/desktop/windows/wsl/#best-practices) and [WSL documentation](https://docs.microsoft.com/en-us/windows/wsl/filesystems#file-storage-and-performance-across-file-systems).
|
|
||||||
|
|
||||||
15. Optionally, you can change the number after `BUILD_THREADS=` to the number of cores / threads your processor has. If your computer crashes while building, you can try to reduce this value.
|
|
||||||
16. After `ACCOUNT_MANAGER_SECRET=` paste a "SHA 256-bit Key" from https://keygen.io/
|
|
||||||
17. If you are not only hosting a local server, change the value after `EXTERNAL_IP=` to the external IP address of your computer.
|
|
||||||
18. Change the two values `SECRET_VALUE_CHANGE_ME` to passwords only you know. Save and close the file.
|
|
||||||
19. In the extracted folder hit Shift+Right Click and select "Open PowerShell window here".
|
|
||||||
|
|
||||||
![Open PowerShell](docker/images/Open_Powershell.png)
|
|
||||||
|
|
||||||
17. In the new window, paste (with right click) or type `docker compose up -d --build` and confirm with enter.
|
|
||||||
18. Once you see the blinking cursor and the path again, setup has finished and the server is already running.
|
|
||||||
|
|
||||||
![setup done](docker/images/setup_finished.png)
|
|
||||||
|
|
||||||
19. Create an admin account by pasting `docker compose exec darkflame /app/MasterServer -a` and following the prompts.
|
|
||||||
|
|
||||||
![admin account creation](docker/images/Account_Creation.png)
|
|
||||||
|
|
||||||
20. You can now login with these credentials at `http://your_ip:5000` (replace your_ip with your external IP). There you can create your account for playing as well as generate keys for other people to join; use these at `http://your_ip:5000/activate`
|
|
||||||
|
|
||||||
## Normal Use
|
|
||||||
1. In Docker Desktop you should now see an entry `darkflameserver-main` and when you click on it all containers but `DarkflameSetup` should eventually be green. That means the server is running.
|
|
||||||
|
|
||||||
![server running](docker/images/Docker_Compose_Finished.png)
|
|
||||||
|
|
||||||
2. For troubleshooting, you can check the logs of the various parts by clicking their entry.
|
|
||||||
3. You can start and stop the server with the corresponding buttons. Once all containers are grey, the server has shut down, and when all containers but `DarkflameSetup` are green, the server is running. Note that starting and stopping takes some time, please be patient.
|
|
||||||
|
|
||||||
![start stop buttons](docker/images/DD_Server_Startstop.png)
|
|
51
Dockerfile
Normal file
51
Dockerfile
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
FROM gcc:12 as build
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN set -ex; \
|
||||||
|
apt-get update; \
|
||||||
|
apt-get install -y cmake
|
||||||
|
|
||||||
|
COPY . /app/
|
||||||
|
COPY --chmod=0500 ./build.sh /app/
|
||||||
|
|
||||||
|
RUN sed -i 's/MARIADB_CONNECTOR_COMPILE_JOBS__=.*/MARIADB_CONNECTOR_COMPILE_JOBS__=2/' /app/CMakeVariables.txt
|
||||||
|
|
||||||
|
RUN ./build.sh
|
||||||
|
|
||||||
|
FROM debian:12 as runtime
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN --mount=type=cache,id=build-apt-cache,target=/var/cache/apt \
|
||||||
|
apt update && \
|
||||||
|
apt install -y libssl3 libcurl4 && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# 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/src/mariadb_connector_cpp-build/libmariadb/libmariadb/libmariadb.so.3 /usr/local/lib
|
||||||
|
RUN ldconfig
|
||||||
|
|
||||||
|
# Server bins
|
||||||
|
COPY --from=build /app/build/*Server /app/
|
||||||
|
|
||||||
|
# Necessary suplimentary files
|
||||||
|
COPY --from=build /app/build/*.ini /app/configs/
|
||||||
|
COPY --from=build /app/build/vanity/*.* /app/vanity/*
|
||||||
|
COPY --from=build /app/build/navmeshes /app/navmeshes
|
||||||
|
COPY --from=build /app/build/migrations /app/migrations
|
||||||
|
COPY --from=build /app/build/*.dcf /app/
|
||||||
|
|
||||||
|
# backup of config and vanity files to copy to the host incase
|
||||||
|
# of a mount clobbering the copy from above
|
||||||
|
COPY --from=build /app/build/*.ini /app/default-configs/
|
||||||
|
COPY --from=build /app/build/vanity/*.* /app/default-vanity/*
|
||||||
|
|
||||||
|
# needed as the container runs with the root user
|
||||||
|
# and therefore sudo doesn't exist
|
||||||
|
ENV USE_SUDO_AUTH=0
|
||||||
|
ENV DLU_CONFIG_DIR=/app/configs/
|
||||||
|
|
||||||
|
COPY --chmod=0500 ./entrypoint.sh /app/
|
||||||
|
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
37
README.md
37
README.md
@ -37,6 +37,7 @@ If you would like a setup for a single player server only on a Windows machine,
|
|||||||
* [Verify your setup](#verify-your-setup)
|
* [Verify your setup](#verify-your-setup)
|
||||||
* [Running the server](#running-the-server)
|
* [Running the server](#running-the-server)
|
||||||
* [User Guide](#user-guide)
|
* [User Guide](#user-guide)
|
||||||
|
* [Docker](#docker)
|
||||||
|
|
||||||
## Clone the repository
|
## Clone the repository
|
||||||
If you are on Windows, you will need to download and install git from [here](https://git-scm.com/download/win)
|
If you are on Windows, you will need to download and install git from [here](https://git-scm.com/download/win)
|
||||||
@ -347,6 +348,42 @@ certutil -hashfile <file> SHA1
|
|||||||
Known good *SHA1* checksum of the Darkflame Universe client:
|
Known good *SHA1* checksum of the Darkflame Universe client:
|
||||||
- `91498e09b83ce69f46baf9e521d48f23fe502985` (packed client, zip compressed)
|
- `91498e09b83ce69f46baf9e521d48f23fe502985` (packed client, zip compressed)
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
|
||||||
|
## Standalone
|
||||||
|
|
||||||
|
For standalone deployment, you can use the image provided via Github's Container Repository:
|
||||||
|
`ghcr.io/darkflameuniverse/darkflameserver`
|
||||||
|
|
||||||
|
This assumes that you have a database deployed to your host or in another docker container.
|
||||||
|
|
||||||
|
A basic deployment of this contianer would look like:
|
||||||
|
```sh
|
||||||
|
# example docker contianer deployment
|
||||||
|
docker run -it \
|
||||||
|
-v /path/to/configs/:/app/configs \
|
||||||
|
-v /path/to/logs/:/app/logs \
|
||||||
|
-v /path/to/dumps/:/app/dumps \
|
||||||
|
-v /path/to/res:/app/res:ro \
|
||||||
|
-v /path/to/resServer:/app/resServer \
|
||||||
|
-e DUMP_FOLDER=/app/dumps \
|
||||||
|
-p 1001:1001/udp \
|
||||||
|
-p 2005:2005/udp \
|
||||||
|
-p 3000-3300:3000-3300/udp \
|
||||||
|
ghcr.io/darkflameuniverse/darkflameserver:latest
|
||||||
|
```
|
||||||
|
You will need to replace the `/path/to/`'s to reflect the paths on your host.
|
||||||
|
|
||||||
|
Any config option in the `.ini`'s can be overridden with environmental variables: Ex: `log_to_console=1` from `shared_config.ini` would be overidden like `-e LOG_TO_CONSOLE=0`
|
||||||
|
|
||||||
|
## Compose
|
||||||
|
|
||||||
|
See the [compose](docker-compose.yml) file in the root of the repo.
|
||||||
|
|
||||||
|
This compose file is for a full deployment: MariaDB, DarkflameServer, and Nexus Dashboard.
|
||||||
|
|
||||||
|
All of the environmental options are listed in the compose file so the can be pass through, or you can edit the compose file to suit your specific needs
|
||||||
|
|
||||||
# Development Documentation
|
# Development Documentation
|
||||||
This is a Work in Progress, but below are some quick links to documentaion for systems and structs in the server
|
This is a Work in Progress, but below are some quick links to documentaion for systems and structs in the server
|
||||||
[Networked message structs](https://lcdruniverse.org/lu_packets/lu_packets/index.html)
|
[Networked message structs](https://lcdruniverse.org/lu_packets/lu_packets/index.html)
|
||||||
|
51
cmake/Utils.cmake
Normal file
51
cmake/Utils.cmake
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# Parses a config file for a specific option and appends the new option if it does not exist
|
||||||
|
# If the new option does exist, this function will do nothing.
|
||||||
|
# file_name: The name of the file to parse
|
||||||
|
# old_option_name: The name of the option to find
|
||||||
|
# new_option_name: The name of the option to add
|
||||||
|
function(UpdateConfigOption file_name old_option_name new_option_name)
|
||||||
|
string(APPEND old_option_name "=")
|
||||||
|
string(APPEND new_option_name "=")
|
||||||
|
message(STATUS "Checking " ${file_name} " for " ${old_option_name} " and adding " ${new_option_name} " if it does not exist")
|
||||||
|
if(NOT EXISTS ${file_name})
|
||||||
|
message(STATUS ${file_name} " does not exist. Doing nothing")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
file(READ ${file_name} current_file_contents)
|
||||||
|
string(REPLACE "\\\n" "" current_file_contents ${current_file_contents})
|
||||||
|
string(REPLACE "\n" ";" current_file_contents ${current_file_contents})
|
||||||
|
set(parsed_current_file_contents "")
|
||||||
|
|
||||||
|
# Remove comment lines so they do not interfere with the variable parsing
|
||||||
|
foreach(line ${current_file_contents})
|
||||||
|
string(FIND ${line} "#" is_comment)
|
||||||
|
|
||||||
|
if(NOT ${is_comment} EQUAL 0)
|
||||||
|
string(APPEND parsed_current_file_contents ${line})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(found_new_option -1)
|
||||||
|
set(found_old_option -1)
|
||||||
|
set(current_value -1)
|
||||||
|
|
||||||
|
foreach(line ${current_file_contents})
|
||||||
|
string(FIND ${line} ${old_option_name} old_option_in_file)
|
||||||
|
|
||||||
|
if(${old_option_in_file} EQUAL 0)
|
||||||
|
set(found_old_option 1)
|
||||||
|
set(current_value ${line})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(FIND ${line} ${new_option_name} found_new_option_in_file)
|
||||||
|
|
||||||
|
if(${found_new_option_in_file} EQUAL 0)
|
||||||
|
set(found_new_option 1)
|
||||||
|
endif()
|
||||||
|
endforeach(line ${current_file_contents})
|
||||||
|
|
||||||
|
if(${found_old_option} EQUAL 1 AND NOT ${found_new_option} EQUAL 1)
|
||||||
|
string(REPLACE ${old_option_name} ${new_option_name} current_value ${current_value})
|
||||||
|
file(APPEND ${file_name} "\n" ${current_value})
|
||||||
|
endif()
|
||||||
|
endfunction()
|
@ -1,6 +1,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <csignal>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ namespace Game {
|
|||||||
Logger* logger = nullptr;
|
Logger* logger = nullptr;
|
||||||
dServer* server = nullptr;
|
dServer* server = nullptr;
|
||||||
dConfig* config = nullptr;
|
dConfig* config = nullptr;
|
||||||
bool shouldShutdown = false;
|
Game::signal_t lastSignal = 0;
|
||||||
std::mt19937 randomEngine;
|
std::mt19937 randomEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,6 +43,9 @@ int main(int argc, char** argv) {
|
|||||||
Diagnostics::SetProcessFileName(argv[0]);
|
Diagnostics::SetProcessFileName(argv[0]);
|
||||||
Diagnostics::Initialize();
|
Diagnostics::Initialize();
|
||||||
|
|
||||||
|
std::signal(SIGINT, Game::OnSignal);
|
||||||
|
std::signal(SIGTERM, Game::OnSignal);
|
||||||
|
|
||||||
//Create all the objects we need to run our service:
|
//Create all the objects we need to run our service:
|
||||||
Game::logger = SetupLogger();
|
Game::logger = SetupLogger();
|
||||||
if (!Game::logger) return EXIT_FAILURE;
|
if (!Game::logger) return EXIT_FAILURE;
|
||||||
@ -74,6 +78,7 @@ int main(int argc, char** argv) {
|
|||||||
masterIP = masterInfo->ip;
|
masterIP = masterInfo->ip;
|
||||||
masterPort = masterInfo->port;
|
masterPort = masterInfo->port;
|
||||||
}
|
}
|
||||||
|
LOG("Master is at %s:%d", masterIP.c_str(), masterPort);
|
||||||
|
|
||||||
Game::randomEngine = std::mt19937(time(0));
|
Game::randomEngine = std::mt19937(time(0));
|
||||||
|
|
||||||
@ -81,9 +86,9 @@ int main(int argc, char** argv) {
|
|||||||
uint32_t maxClients = 50;
|
uint32_t maxClients = 50;
|
||||||
uint32_t ourPort = 1001; //LU client is hardcoded to use this for auth port, so I'm making it the default.
|
uint32_t ourPort = 1001; //LU client is hardcoded to use this for auth port, so I'm making it the default.
|
||||||
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
|
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
|
||||||
if (Game::config->GetValue("port") != "") ourPort = std::atoi(Game::config->GetValue("port").c_str());
|
if (Game::config->GetValue("auth_server_port") != "") ourPort = std::atoi(Game::config->GetValue("auth_server_port").c_str());
|
||||||
|
|
||||||
Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, false, true, Game::logger, masterIP, masterPort, ServerType::Auth, Game::config, &Game::shouldShutdown);
|
Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, false, true, Game::logger, masterIP, masterPort, ServerType::Auth, Game::config, &Game::lastSignal);
|
||||||
|
|
||||||
//Run it until server gets a kill message from Master:
|
//Run it until server gets a kill message from Master:
|
||||||
auto t = std::chrono::high_resolution_clock::now();
|
auto t = std::chrono::high_resolution_clock::now();
|
||||||
@ -96,13 +101,16 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
AuthPackets::LoadClaimCodes();
|
AuthPackets::LoadClaimCodes();
|
||||||
|
|
||||||
while (!Game::shouldShutdown) {
|
Game::logger->Flush(); // once immediately before main loop
|
||||||
|
while (!Game::ShouldShutdown()) {
|
||||||
//Check if we're still connected to master:
|
//Check if we're still connected to master:
|
||||||
if (!Game::server->GetIsConnectedToMaster()) {
|
if (!Game::server->GetIsConnectedToMaster()) {
|
||||||
framesSinceMasterDisconnect++;
|
framesSinceMasterDisconnect++;
|
||||||
|
|
||||||
if (framesSinceMasterDisconnect >= authFramerate)
|
if (framesSinceMasterDisconnect >= authFramerate) {
|
||||||
|
LOG("No connection to master!");
|
||||||
break; //Exit our loop, shut down.
|
break; //Exit our loop, shut down.
|
||||||
|
}
|
||||||
} else framesSinceMasterDisconnect = 0;
|
} else framesSinceMasterDisconnect = 0;
|
||||||
|
|
||||||
//In world we'd update our other systems here.
|
//In world we'd update our other systems here.
|
||||||
@ -141,6 +149,7 @@ int main(int argc, char** argv) {
|
|||||||
std::this_thread::sleep_until(t);
|
std::this_thread::sleep_until(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG("Exited Main Loop! (signal %d)", Game::lastSignal);
|
||||||
//Delete our objects here:
|
//Delete our objects here:
|
||||||
Database::Destroy("AuthServer");
|
Database::Destroy("AuthServer");
|
||||||
delete Game::server;
|
delete Game::server;
|
||||||
|
@ -33,7 +33,7 @@ namespace Game {
|
|||||||
dConfig* config = nullptr;
|
dConfig* config = nullptr;
|
||||||
dChatFilter* chatFilter = nullptr;
|
dChatFilter* chatFilter = nullptr;
|
||||||
AssetManager* assetManager = nullptr;
|
AssetManager* assetManager = nullptr;
|
||||||
bool shouldShutdown = false;
|
Game::signal_t lastSignal = 0;
|
||||||
std::mt19937 randomEngine;
|
std::mt19937 randomEngine;
|
||||||
PlayerContainer playerContainer;
|
PlayerContainer playerContainer;
|
||||||
}
|
}
|
||||||
@ -48,6 +48,9 @@ int main(int argc, char** argv) {
|
|||||||
Diagnostics::SetProcessFileName(argv[0]);
|
Diagnostics::SetProcessFileName(argv[0]);
|
||||||
Diagnostics::Initialize();
|
Diagnostics::Initialize();
|
||||||
|
|
||||||
|
std::signal(SIGINT, Game::OnSignal);
|
||||||
|
std::signal(SIGTERM, Game::OnSignal);
|
||||||
|
|
||||||
//Create all the objects we need to run our service:
|
//Create all the objects we need to run our service:
|
||||||
Game::logger = SetupLogger();
|
Game::logger = SetupLogger();
|
||||||
if (!Game::logger) return EXIT_FAILURE;
|
if (!Game::logger) return EXIT_FAILURE;
|
||||||
@ -99,9 +102,9 @@ int main(int argc, char** argv) {
|
|||||||
uint32_t maxClients = 50;
|
uint32_t maxClients = 50;
|
||||||
uint32_t ourPort = 1501;
|
uint32_t ourPort = 1501;
|
||||||
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
|
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
|
||||||
if (Game::config->GetValue("port") != "") ourPort = std::atoi(Game::config->GetValue("port").c_str());
|
if (Game::config->GetValue("chat_server_port") != "") ourPort = std::atoi(Game::config->GetValue("chat_server_port").c_str());
|
||||||
|
|
||||||
Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, false, true, Game::logger, masterIP, masterPort, ServerType::Chat, Game::config, &Game::shouldShutdown);
|
Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, false, true, Game::logger, masterIP, masterPort, ServerType::Chat, Game::config, &Game::lastSignal);
|
||||||
|
|
||||||
Game::chatFilter = new dChatFilter(Game::assetManager->GetResPath().string() + "/chatplus_en_us", bool(std::stoi(Game::config->GetValue("dont_generate_dcf"))));
|
Game::chatFilter = new dChatFilter(Game::assetManager->GetResPath().string() + "/chatplus_en_us", bool(std::stoi(Game::config->GetValue("dont_generate_dcf"))));
|
||||||
|
|
||||||
@ -118,7 +121,8 @@ int main(int argc, char** argv) {
|
|||||||
uint32_t framesSinceMasterDisconnect = 0;
|
uint32_t framesSinceMasterDisconnect = 0;
|
||||||
uint32_t framesSinceLastSQLPing = 0;
|
uint32_t framesSinceLastSQLPing = 0;
|
||||||
|
|
||||||
while (!Game::shouldShutdown) {
|
Game::logger->Flush(); // once immediately before main loop
|
||||||
|
while (!Game::ShouldShutdown()) {
|
||||||
//Check if we're still connected to master:
|
//Check if we're still connected to master:
|
||||||
if (!Game::server->GetIsConnectedToMaster()) {
|
if (!Game::server->GetIsConnectedToMaster()) {
|
||||||
framesSinceMasterDisconnect++;
|
framesSinceMasterDisconnect++;
|
||||||
|
@ -5,6 +5,7 @@ set(DCOMMON_SOURCES
|
|||||||
"dConfig.cpp"
|
"dConfig.cpp"
|
||||||
"Diagnostics.cpp"
|
"Diagnostics.cpp"
|
||||||
"Logger.cpp"
|
"Logger.cpp"
|
||||||
|
"Game.cpp"
|
||||||
"GeneralUtils.cpp"
|
"GeneralUtils.cpp"
|
||||||
"LDFFormat.cpp"
|
"LDFFormat.cpp"
|
||||||
"MD5.cpp"
|
"MD5.cpp"
|
||||||
|
7
dCommon/Game.cpp
Normal file
7
dCommon/Game.cpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include "Game.h"
|
||||||
|
|
||||||
|
namespace Game {
|
||||||
|
void OnSignal(int signal) {
|
||||||
|
lastSignal = signal;
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
#include <csignal>
|
||||||
|
|
||||||
class dServer;
|
class dServer;
|
||||||
class Logger;
|
class Logger;
|
||||||
@ -16,6 +17,7 @@ class dZoneManager;
|
|||||||
class PlayerContainer;
|
class PlayerContainer;
|
||||||
|
|
||||||
namespace Game {
|
namespace Game {
|
||||||
|
using signal_t = volatile std::sig_atomic_t;
|
||||||
extern Logger* logger;
|
extern Logger* logger;
|
||||||
extern dServer* server;
|
extern dServer* server;
|
||||||
extern InstanceManager* im;
|
extern InstanceManager* im;
|
||||||
@ -25,9 +27,14 @@ namespace Game {
|
|||||||
extern RakPeerInterface* chatServer;
|
extern RakPeerInterface* chatServer;
|
||||||
extern AssetManager* assetManager;
|
extern AssetManager* assetManager;
|
||||||
extern SystemAddress chatSysAddr;
|
extern SystemAddress chatSysAddr;
|
||||||
extern bool shouldShutdown;
|
extern signal_t lastSignal;
|
||||||
extern EntityManager* entityManager;
|
extern EntityManager* entityManager;
|
||||||
extern dZoneManager* zoneManager;
|
extern dZoneManager* zoneManager;
|
||||||
extern PlayerContainer playerContainer;
|
extern PlayerContainer playerContainer;
|
||||||
extern std::string projectVersion;
|
extern std::string projectVersion;
|
||||||
|
|
||||||
|
inline bool ShouldShutdown() {
|
||||||
|
return lastSignal != 0;
|
||||||
|
}
|
||||||
|
void OnSignal(int signal);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
Writer::~Writer() {
|
Writer::~Writer() {
|
||||||
|
// Flush before we close
|
||||||
|
Flush();
|
||||||
// Dont try to close stdcout...
|
// Dont try to close stdcout...
|
||||||
if (!m_Outfile || m_IsConsoleWriter) return;
|
if (!m_Outfile || m_IsConsoleWriter) return;
|
||||||
|
|
||||||
@ -14,7 +16,7 @@ Writer::~Writer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Writer::Log(const char* time, const char* message) {
|
void Writer::Log(const char* time, const char* message) {
|
||||||
if (!m_Outfile) return;
|
if (!m_Outfile || !m_Enabled) return;
|
||||||
|
|
||||||
fputs(time, m_Outfile);
|
fputs(time, m_Outfile);
|
||||||
fputs(message, m_Outfile);
|
fputs(message, m_Outfile);
|
||||||
|
@ -8,58 +8,27 @@ set(DGAME_SOURCES "Character.cpp"
|
|||||||
"User.cpp"
|
"User.cpp"
|
||||||
"UserManager.cpp")
|
"UserManager.cpp")
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${PROJECT_SOURCE_DIR}/dScripts
|
||||||
|
${PROJECT_SOURCE_DIR}/dGame
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(dGameBase ${DGAME_SOURCES})
|
||||||
|
target_precompile_headers(dGameBase PRIVATE ${HEADERS_DGAME})
|
||||||
|
target_link_libraries(dGameBase
|
||||||
|
PUBLIC dDatabase dPhysics
|
||||||
|
INTERFACE dComponents dEntity)
|
||||||
|
|
||||||
add_subdirectory(dBehaviors)
|
add_subdirectory(dBehaviors)
|
||||||
|
|
||||||
foreach(file ${DGAME_DBEHAVIORS_SOURCES})
|
|
||||||
set(DGAME_SOURCES ${DGAME_SOURCES} "dBehaviors/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(dComponents)
|
add_subdirectory(dComponents)
|
||||||
|
|
||||||
foreach(file ${DGAME_DCOMPONENTS_SOURCES})
|
|
||||||
set(DGAME_SOURCES ${DGAME_SOURCES} "dComponents/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(dEntity)
|
add_subdirectory(dEntity)
|
||||||
|
|
||||||
foreach(file ${DGAME_DENTITY_SOURCES})
|
|
||||||
set(DGAME_SOURCES ${DGAME_SOURCES} "dEntity/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(dGameMessages)
|
add_subdirectory(dGameMessages)
|
||||||
|
|
||||||
foreach(file ${DGAME_DGAMEMESSAGES_SOURCES})
|
|
||||||
set(DGAME_SOURCES ${DGAME_SOURCES} "dGameMessages/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(dInventory)
|
add_subdirectory(dInventory)
|
||||||
|
|
||||||
foreach(file ${DGAME_DINVENTORY_SOURCES})
|
|
||||||
set(DGAME_SOURCES ${DGAME_SOURCES} "dInventory/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(dMission)
|
add_subdirectory(dMission)
|
||||||
|
|
||||||
foreach(file ${DGAME_DMISSION_SOURCES})
|
|
||||||
set(DGAME_SOURCES ${DGAME_SOURCES} "dMission/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(dPropertyBehaviors)
|
add_subdirectory(dPropertyBehaviors)
|
||||||
|
|
||||||
foreach(file ${DGAME_DPROPERTYBEHAVIORS_SOURCES})
|
|
||||||
set(DGAME_SOURCES ${DGAME_SOURCES} "dPropertyBehaviors/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(dUtilities)
|
add_subdirectory(dUtilities)
|
||||||
|
|
||||||
foreach(file ${DGAME_DUTILITIES_SOURCES})
|
add_library(dGame INTERFACE)
|
||||||
set(DGAME_SOURCES ${DGAME_SOURCES} "dUtilities/${file}")
|
target_link_libraries(dGame INTERFACE
|
||||||
endforeach()
|
dGameBase dBehaviors dComponents dEntity dGameMessages dInventory dMission dPropertyBehaviors dUtilities dScripts
|
||||||
|
)
|
||||||
foreach(file ${DSCRIPTS_SOURCES})
|
|
||||||
set(DGAME_SOURCES ${DGAME_SOURCES} "${PROJECT_SOURCE_DIR}/dScripts/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_library(dGame STATIC ${DGAME_SOURCES})
|
|
||||||
|
|
||||||
target_link_libraries(dGame dDatabase Recast Detour)
|
|
||||||
|
@ -263,7 +263,7 @@ void UserManager::CreateCharacter(const SystemAddress& sysAddr, Packet* packet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Now that the name is ok, we can get an objectID from Master:
|
//Now that the name is ok, we can get an objectID from Master:
|
||||||
ObjectIDManager::Instance()->RequestPersistentID([=](uint32_t objectID) {
|
ObjectIDManager::Instance()->RequestPersistentID([=, this](uint32_t objectID) {
|
||||||
if (Database::Get()->GetCharacterInfo(objectID)) {
|
if (Database::Get()->GetCharacterInfo(objectID)) {
|
||||||
LOG("Character object id unavailable, check object_id_tracker!");
|
LOG("Character object id unavailable, check object_id_tracker!");
|
||||||
WorldPackets::SendCharacterCreationResponse(sysAddr, eCharacterCreationResponse::OBJECT_ID_UNAVAILABLE);
|
WorldPackets::SendCharacterCreationResponse(sysAddr, eCharacterCreationResponse::OBJECT_ID_UNAVAILABLE);
|
||||||
|
@ -54,4 +54,9 @@ set(DGAME_DBEHAVIORS_SOURCES "AirMovementBehavior.cpp"
|
|||||||
"TargetCasterBehavior.cpp"
|
"TargetCasterBehavior.cpp"
|
||||||
"TauntBehavior.cpp"
|
"TauntBehavior.cpp"
|
||||||
"VentureVisionBehavior.cpp"
|
"VentureVisionBehavior.cpp"
|
||||||
"VerifyBehavior.cpp" PARENT_SCOPE)
|
"VerifyBehavior.cpp")
|
||||||
|
|
||||||
|
add_library(dBehaviors STATIC ${DGAME_DBEHAVIORS_SOURCES})
|
||||||
|
target_link_libraries(dBehaviors PUBLIC dPhysics)
|
||||||
|
target_include_directories(dBehaviors PUBLIC ".")
|
||||||
|
target_precompile_headers(dBehaviors REUSE_FROM dGameBase)
|
||||||
|
@ -33,7 +33,7 @@ ActivityComponent::ActivityComponent(Entity* parent, int32_t activityID) : Compo
|
|||||||
if (activityID > 0) m_ActivityID = activityID;
|
if (activityID > 0) m_ActivityID = activityID;
|
||||||
else m_ActivityID = parent->GetVar<int32_t>(u"activityID");
|
else m_ActivityID = parent->GetVar<int32_t>(u"activityID");
|
||||||
CDActivitiesTable* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
|
CDActivitiesTable* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
|
||||||
std::vector<CDActivities> activities = activitiesTable->Query([=](CDActivities entry) {return (entry.ActivityID == m_ActivityID); });
|
std::vector<CDActivities> activities = activitiesTable->Query([this](CDActivities entry) {return (entry.ActivityID == m_ActivityID); });
|
||||||
|
|
||||||
for (CDActivities activity : activities) {
|
for (CDActivities activity : activities) {
|
||||||
m_ActivityInfo = activity;
|
m_ActivityInfo = activity;
|
||||||
@ -93,7 +93,7 @@ void ActivityComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIniti
|
|||||||
|
|
||||||
void ActivityComponent::ReloadConfig() {
|
void ActivityComponent::ReloadConfig() {
|
||||||
CDActivitiesTable* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
|
CDActivitiesTable* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
|
||||||
std::vector<CDActivities> activities = activitiesTable->Query([=](CDActivities entry) {return (entry.ActivityID == m_ActivityID); });
|
std::vector<CDActivities> activities = activitiesTable->Query([this](CDActivities entry) {return (entry.ActivityID == m_ActivityID); });
|
||||||
for (auto activity : activities) {
|
for (auto activity : activities) {
|
||||||
auto mapID = m_ActivityInfo.instanceMapID;
|
auto mapID = m_ActivityInfo.instanceMapID;
|
||||||
if (static_cast<Leaderboard::Type>(activity.leaderboardType) == Leaderboard::Type::Racing && Game::config->GetValue("solo_racing") == "1") {
|
if (static_cast<Leaderboard::Type>(activity.leaderboardType) == Leaderboard::Type::Racing && Game::config->GetValue("solo_racing") == "1") {
|
||||||
@ -532,7 +532,7 @@ void ActivityInstance::RewardParticipant(Entity* participant) {
|
|||||||
|
|
||||||
// First, get the activity data
|
// First, get the activity data
|
||||||
auto* activityRewardsTable = CDClientManager::Instance().GetTable<CDActivityRewardsTable>();
|
auto* activityRewardsTable = CDClientManager::Instance().GetTable<CDActivityRewardsTable>();
|
||||||
std::vector<CDActivityRewards> activityRewards = activityRewardsTable->Query([=](CDActivityRewards entry) { return (entry.objectTemplate == m_ActivityInfo.ActivityID); });
|
std::vector<CDActivityRewards> activityRewards = activityRewardsTable->Query([this](CDActivityRewards entry) { return (entry.objectTemplate == m_ActivityInfo.ActivityID); });
|
||||||
|
|
||||||
if (!activityRewards.empty()) {
|
if (!activityRewards.empty()) {
|
||||||
uint32_t minCoins = 0;
|
uint32_t minCoins = 0;
|
||||||
|
@ -95,10 +95,16 @@ void BuffComponent::Update(float deltaTime) {
|
|||||||
|
|
||||||
if (buff.second.time <= 0.0f) {
|
if (buff.second.time <= 0.0f) {
|
||||||
RemoveBuff(buff.first);
|
RemoveBuff(buff.first);
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_BuffsToRemove.empty()) return;
|
||||||
|
|
||||||
|
for (const auto& buff : m_BuffsToRemove) {
|
||||||
|
m_Buffs.erase(buff);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_BuffsToRemove.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& GetFxName(const std::string& buffname) {
|
const std::string& GetFxName(const std::string& buffname) {
|
||||||
@ -216,7 +222,7 @@ void BuffComponent::RemoveBuff(int32_t id, bool fromUnEquip, bool removeImmunity
|
|||||||
|
|
||||||
GameMessages::SendRemoveBuff(m_Parent, fromUnEquip, removeImmunity, id);
|
GameMessages::SendRemoveBuff(m_Parent, fromUnEquip, removeImmunity, id);
|
||||||
|
|
||||||
m_Buffs.erase(iter);
|
m_BuffsToRemove.push_back(id);
|
||||||
|
|
||||||
RemoveBuffEffect(id);
|
RemoveBuffEffect(id);
|
||||||
}
|
}
|
||||||
|
@ -140,6 +140,9 @@ private:
|
|||||||
*/
|
*/
|
||||||
std::map<int32_t, Buff> m_Buffs;
|
std::map<int32_t, Buff> m_Buffs;
|
||||||
|
|
||||||
|
// Buffs to remove at the end of the update frame.
|
||||||
|
std::vector<int32_t> m_BuffsToRemove;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parameters (=effects) for each buff
|
* Parameters (=effects) for each buff
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
set(DGAME_DCOMPONENTS_SOURCES "ActivityComponent.cpp"
|
set(DGAME_DCOMPONENTS_SOURCES
|
||||||
|
"ActivityComponent.cpp"
|
||||||
"BaseCombatAIComponent.cpp"
|
"BaseCombatAIComponent.cpp"
|
||||||
"BouncerComponent.cpp"
|
"BouncerComponent.cpp"
|
||||||
"BuffComponent.cpp"
|
"BuffComponent.cpp"
|
||||||
@ -46,5 +47,11 @@ set(DGAME_DCOMPONENTS_SOURCES "ActivityComponent.cpp"
|
|||||||
"HavokVehiclePhysicsComponent.cpp"
|
"HavokVehiclePhysicsComponent.cpp"
|
||||||
"VendorComponent.cpp"
|
"VendorComponent.cpp"
|
||||||
"MiniGameControlComponent.cpp"
|
"MiniGameControlComponent.cpp"
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_library(dComponents STATIC ${DGAME_DCOMPONENTS_SOURCES})
|
||||||
|
target_include_directories(dComponents PRIVATE ${PROJECT_SOURCE_DIR}/dScripts/02_server/Map/General) # PetDigServer.h
|
||||||
|
target_precompile_headers(dComponents REUSE_FROM dGameBase)
|
||||||
|
target_link_libraries(dComponents
|
||||||
|
PUBLIC dPhysics dDatabase
|
||||||
|
INTERFACE dUtilities dCommon dBehaviors dChatFilter dMission dInventory)
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
#include "ModelComponent.h"
|
#include "ModelComponent.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
|
|
||||||
|
#include "Game.h"
|
||||||
|
#include "Logger.h"
|
||||||
|
|
||||||
|
#include "BehaviorStates.h"
|
||||||
|
#include "ControlBehaviorMsgs.h"
|
||||||
|
|
||||||
ModelComponent::ModelComponent(Entity* parent) : Component(parent) {
|
ModelComponent::ModelComponent(Entity* parent) : Component(parent) {
|
||||||
m_OriginalPosition = m_Parent->GetDefaultPosition();
|
m_OriginalPosition = m_Parent->GetDefaultPosition();
|
||||||
m_OriginalRotation = m_Parent->GetDefaultRotation();
|
m_OriginalRotation = m_Parent->GetDefaultRotation();
|
||||||
@ -29,3 +35,40 @@ void ModelComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialU
|
|||||||
outBitStream->Write1(); // Is this model paused
|
outBitStream->Write1(); // Is this model paused
|
||||||
if (bIsInitialUpdate) outBitStream->Write0(); // We are not writing model editing info
|
if (bIsInitialUpdate) outBitStream->Write0(); // We are not writing model editing info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelComponent::UpdatePendingBehaviorId(const int32_t newId) {
|
||||||
|
for (auto& behavior : m_Behaviors) if (behavior.GetBehaviorId() == -1) behavior.SetBehaviorId(newId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelComponent::SendBehaviorListToClient(AMFArrayValue& args) const {
|
||||||
|
args.Insert("objectID", std::to_string(m_Parent->GetObjectID()));
|
||||||
|
|
||||||
|
auto* behaviorArray = args.InsertArray("behaviors");
|
||||||
|
for (auto& behavior : m_Behaviors) {
|
||||||
|
auto* behaviorArgs = behaviorArray->PushArray();
|
||||||
|
behavior.SendBehaviorListToClient(*behaviorArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelComponent::VerifyBehaviors() {
|
||||||
|
for (auto& behavior : m_Behaviors) behavior.VerifyLastEditedState();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelComponent::SendBehaviorBlocksToClient(int32_t behaviorToSend, AMFArrayValue& args) const {
|
||||||
|
args.Insert("BehaviorID", std::to_string(behaviorToSend));
|
||||||
|
args.Insert("objectID", std::to_string(m_Parent->GetObjectID()));
|
||||||
|
for (auto& behavior : m_Behaviors) if (behavior.GetBehaviorId() == behaviorToSend) behavior.SendBehaviorBlocksToClient(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelComponent::AddBehavior(AddMessage& msg) {
|
||||||
|
// Can only have 1 of the loot behaviors
|
||||||
|
for (auto& behavior : m_Behaviors) if (behavior.GetBehaviorId() == msg.GetBehaviorId()) return;
|
||||||
|
m_Behaviors.insert(m_Behaviors.begin() + msg.GetBehaviorIndex(), PropertyBehavior());
|
||||||
|
m_Behaviors.at(msg.GetBehaviorIndex()).HandleMsg(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelComponent::MoveToInventory(MoveToInventoryMessage& msg) {
|
||||||
|
if (msg.GetBehaviorIndex() >= m_Behaviors.size() || m_Behaviors.at(msg.GetBehaviorIndex()).GetBehaviorId() != msg.GetBehaviorId()) return;
|
||||||
|
m_Behaviors.erase(m_Behaviors.begin() + msg.GetBehaviorIndex());
|
||||||
|
// TODO move to the inventory
|
||||||
|
}
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include "dCommonVars.h"
|
#include "dCommonVars.h"
|
||||||
#include "RakNetTypes.h"
|
#include "RakNetTypes.h"
|
||||||
#include "NiPoint3.h"
|
#include "NiPoint3.h"
|
||||||
@ -6,7 +9,15 @@
|
|||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
#include "eReplicaComponentType.h"
|
#include "eReplicaComponentType.h"
|
||||||
|
|
||||||
|
#include "Action.h"
|
||||||
|
#include "PropertyBehavior.h"
|
||||||
|
#include "StripUiPosition.h"
|
||||||
|
|
||||||
|
class AddMessage;
|
||||||
|
class AMFArrayValue;
|
||||||
|
class BehaviorMessageBase;
|
||||||
class Entity;
|
class Entity;
|
||||||
|
class MoveToInventoryMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component that represents entities that are a model, e.g. collectible models and BBB models.
|
* Component that represents entities that are a model, e.g. collectible models and BBB models.
|
||||||
@ -43,7 +54,68 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetRotation(const NiQuaternion& rot) { m_OriginalRotation = rot; }
|
void SetRotation(const NiQuaternion& rot) { m_OriginalRotation = rot; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main gateway for all behavior messages to be passed to their respective behaviors.
|
||||||
|
*
|
||||||
|
* @tparam Msg The message type to pass
|
||||||
|
* @param args the arguments of the message to be deserialized
|
||||||
|
*/
|
||||||
|
template<typename Msg>
|
||||||
|
void HandleControlBehaviorsMsg(AMFArrayValue* args) {
|
||||||
|
static_assert(std::is_base_of_v<BehaviorMessageBase, Msg>, "Msg must be a BehaviorMessageBase");
|
||||||
|
Msg msg(args);
|
||||||
|
for (auto& behavior : m_Behaviors) {
|
||||||
|
if (behavior.GetBehaviorId() == msg.GetBehaviorId()) {
|
||||||
|
behavior.HandleMsg(msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we somehow added more than 5 behaviors, resize to 5.
|
||||||
|
if (m_Behaviors.size() > 5) m_Behaviors.resize(5);
|
||||||
|
|
||||||
|
// Do not allow more than 5 to be added. The client UI will break if you do!
|
||||||
|
if (m_Behaviors.size() == 5) return;
|
||||||
|
|
||||||
|
auto newBehavior = m_Behaviors.insert(m_Behaviors.begin(), PropertyBehavior());
|
||||||
|
// Generally if we are inserting a new behavior, it is because the client is creating a new behavior.
|
||||||
|
// However if we are testing behaviors the behavior will not exist on the initial pass, so we set the ID here to that of the msg.
|
||||||
|
// This will either set the ID to -1 (no change in the current default) or set the ID to the ID of the behavior we are testing.
|
||||||
|
newBehavior->SetBehaviorId(msg.GetBehaviorId());
|
||||||
|
newBehavior->HandleMsg(msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
void AddBehavior(AddMessage& msg);
|
||||||
|
|
||||||
|
void MoveToInventory(MoveToInventoryMessage& msg);
|
||||||
|
|
||||||
|
// Updates the pending behavior ID to the new ID.
|
||||||
|
void UpdatePendingBehaviorId(const int32_t newId);
|
||||||
|
|
||||||
|
// Sends the behavior list to the client.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The behaviors AMFArray will have up to 5 elements in the dense portion.
|
||||||
|
* Each element in the dense portion will be made up of another AMFArray
|
||||||
|
* with the following information mapped in the associative portion
|
||||||
|
* "id": Behavior ID cast to an AMFString
|
||||||
|
* "isLocked": AMFTrue or AMFFalse of whether or not the behavior is locked
|
||||||
|
* "isLoot": AMFTrue or AMFFalse of whether or not the behavior is a custom behavior (true if custom)
|
||||||
|
* "name": The name of the behavior formatted as an AMFString
|
||||||
|
*/
|
||||||
|
void SendBehaviorListToClient(AMFArrayValue& args) const;
|
||||||
|
|
||||||
|
void SendBehaviorBlocksToClient(int32_t behaviorToSend, AMFArrayValue& args) const;
|
||||||
|
|
||||||
|
void VerifyBehaviors();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* The behaviors of the model
|
||||||
|
* Note: This is a vector because the order of the behaviors matters when serializing to the client.
|
||||||
|
* Note: No two PropertyBehaviors should have the same behavior ID.
|
||||||
|
*/
|
||||||
|
std::vector<PropertyBehavior> m_Behaviors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The original position of the model
|
* The original position of the model
|
||||||
|
@ -312,7 +312,7 @@ void RacingControlComponent::OnRequestDie(Entity* player) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Respawn the player in 2 seconds, as was done in live. Not sure if this value is in a setting somewhere else...
|
// Respawn the player in 2 seconds, as was done in live. Not sure if this value is in a setting somewhere else...
|
||||||
vehicle->AddCallbackTimer(2.0f, [=]() {
|
vehicle->AddCallbackTimer(2.0f, [=, this]() {
|
||||||
if (!vehicle || !this->m_Parent) return;
|
if (!vehicle || !this->m_Parent) return;
|
||||||
GameMessages::SendRacingResetPlayerToLastReset(
|
GameMessages::SendRacingResetPlayerToLastReset(
|
||||||
m_Parent->GetObjectID(), racingPlayer.playerID,
|
m_Parent->GetObjectID(), racingPlayer.playerID,
|
||||||
|
@ -1,2 +1,7 @@
|
|||||||
set(DGAME_DENTITY_SOURCES "EntityCallbackTimer.cpp"
|
set(DGAME_DENTITY_SOURCES
|
||||||
"EntityTimer.cpp" PARENT_SCOPE)
|
"EntityCallbackTimer.cpp"
|
||||||
|
"EntityTimer.cpp")
|
||||||
|
|
||||||
|
add_library(dEntity STATIC ${DGAME_DENTITY_SOURCES})
|
||||||
|
target_include_directories(dEntity PUBLIC ".")
|
||||||
|
target_precompile_headers(dEntity REUSE_FROM dGameBase)
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
set(DGAME_DGAMEMESSAGES_SOURCES "GameMessageHandler.cpp"
|
set(DGAME_DGAMEMESSAGES_SOURCES
|
||||||
|
"GameMessageHandler.cpp"
|
||||||
"GameMessages.cpp"
|
"GameMessages.cpp"
|
||||||
"PropertyDataMessage.cpp"
|
"PropertyDataMessage.cpp"
|
||||||
"PropertySelectQueryProperty.cpp" PARENT_SCOPE)
|
"PropertySelectQueryProperty.cpp")
|
||||||
|
|
||||||
|
add_library(dGameMessages STATIC ${DGAME_DGAMEMESSAGES_SOURCES})
|
||||||
|
target_link_libraries(dGameMessages PUBLIC dDatabase)
|
||||||
|
target_precompile_headers(dGameMessages REUSE_FROM dGameBase)
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
set(DGAME_DINVENTORY_SOURCES "EquippedItem.cpp"
|
set(DGAME_DINVENTORY_SOURCES
|
||||||
|
"EquippedItem.cpp"
|
||||||
"Inventory.cpp"
|
"Inventory.cpp"
|
||||||
"Item.cpp"
|
"Item.cpp"
|
||||||
"ItemSet.cpp"
|
"ItemSet.cpp"
|
||||||
"ItemSetPassiveAbility.cpp" PARENT_SCOPE)
|
"ItemSetPassiveAbility.cpp")
|
||||||
|
|
||||||
|
add_library(dInventory STATIC ${DGAME_DINVENTORY_SOURCES})
|
||||||
|
target_precompile_headers(dInventory REUSE_FROM dGameBase)
|
||||||
|
@ -249,7 +249,7 @@ bool Item::IsEquipped() const {
|
|||||||
bool Item::Consume() {
|
bool Item::Consume() {
|
||||||
auto* skillsTable = CDClientManager::Instance().GetTable<CDObjectSkillsTable>();
|
auto* skillsTable = CDClientManager::Instance().GetTable<CDObjectSkillsTable>();
|
||||||
|
|
||||||
auto skills = skillsTable->Query([=](const CDObjectSkills entry) {
|
auto skills = skillsTable->Query([this](const CDObjectSkills entry) {
|
||||||
return entry.objectTemplate == static_cast<uint32_t>(lot);
|
return entry.objectTemplate == static_cast<uint32_t>(lot);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
set(DGAME_DMISSION_SOURCES "Mission.cpp"
|
set(DGAME_DMISSION_SOURCES
|
||||||
|
"Mission.cpp"
|
||||||
"MissionPrerequisites.cpp"
|
"MissionPrerequisites.cpp"
|
||||||
"MissionTask.cpp" PARENT_SCOPE)
|
"MissionTask.cpp")
|
||||||
|
|
||||||
|
add_library(dMission STATIC ${DGAME_DMISSION_SOURCES})
|
||||||
|
target_link_libraries(dMission PUBLIC dDatabase)
|
||||||
|
target_precompile_headers(dMission REUSE_FROM dGameBase)
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
set(DGAME_DPROPERTYBEHAVIORS_SOURCES
|
set(DGAME_DPROPERTYBEHAVIORS_SOURCES
|
||||||
|
"PropertyBehavior.cpp"
|
||||||
|
"State.cpp"
|
||||||
|
"Strip.cpp"
|
||||||
"BlockDefinition.cpp"
|
"BlockDefinition.cpp"
|
||||||
"ControlBehaviors.cpp"
|
"ControlBehaviors.cpp"
|
||||||
)
|
)
|
||||||
@ -9,4 +12,5 @@ foreach(file ${DGAME_DPROPERTYBEHAVIORS_CONTROLBEHAVIORMESSAGES})
|
|||||||
set(DGAME_DPROPERTYBEHAVIORS_SOURCES ${DGAME_DPROPERTYBEHAVIORS_SOURCES} "ControlBehaviorMessages/${file}")
|
set(DGAME_DPROPERTYBEHAVIORS_SOURCES ${DGAME_DPROPERTYBEHAVIORS_SOURCES} "ControlBehaviorMessages/${file}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(DGAME_DPROPERTYBEHAVIORS_SOURCES ${DGAME_DPROPERTYBEHAVIORS_SOURCES} PARENT_SCOPE)
|
add_library(dPropertyBehaviors STATIC ${DGAME_DPROPERTYBEHAVIORS_SOURCES})
|
||||||
|
target_precompile_headers(dPropertyBehaviors REUSE_FROM dGameBase)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
|
#include "Amf3.h"
|
||||||
|
|
||||||
Action::Action() {
|
Action::Action() {
|
||||||
type = "";
|
type = "";
|
||||||
@ -12,20 +13,34 @@ Action::Action(AMFArrayValue* arguments) {
|
|||||||
valueParameterName = "";
|
valueParameterName = "";
|
||||||
valueParameterString = "";
|
valueParameterString = "";
|
||||||
valueParameterDouble = 0.0;
|
valueParameterDouble = 0.0;
|
||||||
for (auto& typeValueMap : arguments->GetAssociative()) {
|
for (auto& [paramName, paramValue] : arguments->GetAssociative()) {
|
||||||
if (typeValueMap.first == "Type") {
|
if (paramName == "Type") {
|
||||||
if (typeValueMap.second->GetValueType() != eAmf::String) continue;
|
if (paramValue->GetValueType() != eAmf::String) continue;
|
||||||
type = static_cast<AMFStringValue*>(typeValueMap.second)->GetValue();
|
type = static_cast<AMFStringValue*>(paramValue)->GetValue();
|
||||||
} else {
|
} else {
|
||||||
valueParameterName = typeValueMap.first;
|
valueParameterName = paramName;
|
||||||
// Message is the only known string parameter
|
// Message is the only known string parameter
|
||||||
if (valueParameterName == "Message") {
|
if (valueParameterName == "Message") {
|
||||||
if (typeValueMap.second->GetValueType() != eAmf::String) continue;
|
if (paramValue->GetValueType() != eAmf::String) continue;
|
||||||
valueParameterString = static_cast<AMFStringValue*>(typeValueMap.second)->GetValue();
|
valueParameterString = static_cast<AMFStringValue*>(paramValue)->GetValue();
|
||||||
} else {
|
} else {
|
||||||
if (typeValueMap.second->GetValueType() != eAmf::Double) continue;
|
if (paramValue->GetValueType() != eAmf::Double) continue;
|
||||||
valueParameterDouble = static_cast<AMFDoubleValue*>(typeValueMap.second)->GetValue();
|
valueParameterDouble = static_cast<AMFDoubleValue*>(paramValue)->GetValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Action::SendBehaviorBlocksToClient(AMFArrayValue& args) const {
|
||||||
|
auto* actionArgs = args.PushArray();
|
||||||
|
actionArgs->Insert("Type", type);
|
||||||
|
|
||||||
|
auto valueParameterName = GetValueParameterName();
|
||||||
|
if (valueParameterName.empty()) return;
|
||||||
|
|
||||||
|
if (valueParameterName == "Message") {
|
||||||
|
actionArgs->Insert(valueParameterName, valueParameterString);
|
||||||
|
} else {
|
||||||
|
actionArgs->Insert(valueParameterName, valueParameterDouble);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#ifndef __ACTION__H__
|
#ifndef __ACTION__H__
|
||||||
#define __ACTION__H__
|
#define __ACTION__H__
|
||||||
|
|
||||||
#include "BehaviorMessageBase.h"
|
#include <string>
|
||||||
|
|
||||||
|
class AMFArrayValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sent if a ControlBehavior message has an Action associated with it
|
* @brief Sent if a ControlBehavior message has an Action associated with it
|
||||||
@ -11,10 +13,12 @@ class Action {
|
|||||||
public:
|
public:
|
||||||
Action();
|
Action();
|
||||||
Action(AMFArrayValue* arguments);
|
Action(AMFArrayValue* arguments);
|
||||||
const std::string& GetType() { return type; };
|
const std::string& GetType() const { return type; };
|
||||||
const std::string& GetValueParameterName() { return valueParameterName; };
|
const std::string& GetValueParameterName() const { return valueParameterName; };
|
||||||
const std::string& GetValueParameterString() { return valueParameterString; };
|
const std::string& GetValueParameterString() const { return valueParameterString; };
|
||||||
const double GetValueParameterDouble() { return valueParameterDouble; };
|
const double GetValueParameterDouble() const { return valueParameterDouble; };
|
||||||
|
|
||||||
|
void SendBehaviorBlocksToClient(AMFArrayValue& args) const;
|
||||||
private:
|
private:
|
||||||
std::string type;
|
std::string type;
|
||||||
std::string valueParameterName;
|
std::string valueParameterName;
|
||||||
|
@ -14,8 +14,8 @@ class ActionContext {
|
|||||||
public:
|
public:
|
||||||
ActionContext();
|
ActionContext();
|
||||||
ActionContext(AMFArrayValue* arguments, std::string customStateKey = "stateID", std::string customStripKey = "stripID");
|
ActionContext(AMFArrayValue* arguments, std::string customStateKey = "stateID", std::string customStripKey = "stripID");
|
||||||
const StripId GetStripId() { return stripId; };
|
const StripId GetStripId() const { return stripId; };
|
||||||
const BehaviorState GetStateId() { return stateId; };
|
const BehaviorState GetStateId() const { return stateId; };
|
||||||
private:
|
private:
|
||||||
BehaviorState GetBehaviorStateFromArgument(AMFArrayValue* arguments, const std::string& key);
|
BehaviorState GetBehaviorStateFromArgument(AMFArrayValue* arguments, const std::string& key);
|
||||||
StripId GetStripIdFromArgument(AMFArrayValue* arguments, const std::string& key);
|
StripId GetStripIdFromArgument(AMFArrayValue* arguments, const std::string& key);
|
||||||
|
@ -14,11 +14,11 @@ class AMFArrayValue;
|
|||||||
class AddActionMessage : public BehaviorMessageBase {
|
class AddActionMessage : public BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
AddActionMessage(AMFArrayValue* arguments);
|
AddActionMessage(AMFArrayValue* arguments);
|
||||||
const uint32_t GetActionIndex() { return actionIndex; };
|
int32_t GetActionIndex() const { return actionIndex; };
|
||||||
Action GetAction() { return action; };
|
Action GetAction() const { return action; };
|
||||||
ActionContext GetActionContext() { return actionContext; };
|
ActionContext GetActionContext() const { return actionContext; };
|
||||||
private:
|
private:
|
||||||
uint32_t actionIndex;
|
int32_t actionIndex = -1;
|
||||||
ActionContext actionContext;
|
ActionContext actionContext;
|
||||||
Action action;
|
Action action;
|
||||||
};
|
};
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
class AddMessage : public BehaviorMessageBase {
|
class AddMessage : public BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
AddMessage(AMFArrayValue* arguments);
|
AddMessage(AMFArrayValue* arguments);
|
||||||
const uint32_t GetBehaviorIndex() { return behaviorIndex; };
|
const uint32_t GetBehaviorIndex() const { return behaviorIndex; };
|
||||||
private:
|
private:
|
||||||
uint32_t behaviorIndex;
|
uint32_t behaviorIndex;
|
||||||
};
|
};
|
||||||
|
@ -19,9 +19,9 @@ class AMFArrayValue;
|
|||||||
class AddStripMessage : public BehaviorMessageBase {
|
class AddStripMessage : public BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
AddStripMessage(AMFArrayValue* arguments);
|
AddStripMessage(AMFArrayValue* arguments);
|
||||||
StripUiPosition GetPosition() { return position; };
|
StripUiPosition GetPosition() const { return position; };
|
||||||
ActionContext GetActionContext() { return actionContext; };
|
ActionContext GetActionContext() const { return actionContext; };
|
||||||
std::vector<Action> GetActionsToAdd() { return actionsToAdd; };
|
std::vector<Action> GetActionsToAdd() const { return actionsToAdd; };
|
||||||
private:
|
private:
|
||||||
StripUiPosition position;
|
StripUiPosition position;
|
||||||
ActionContext actionContext;
|
ActionContext actionContext;
|
||||||
|
@ -5,29 +5,27 @@
|
|||||||
#include "dCommonVars.h"
|
#include "dCommonVars.h"
|
||||||
|
|
||||||
BehaviorMessageBase::BehaviorMessageBase(AMFArrayValue* arguments) {
|
BehaviorMessageBase::BehaviorMessageBase(AMFArrayValue* arguments) {
|
||||||
behaviorId = 0;
|
|
||||||
behaviorId = GetBehaviorIdFromArgument(arguments);
|
behaviorId = GetBehaviorIdFromArgument(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t BehaviorMessageBase::GetBehaviorIdFromArgument(AMFArrayValue* arguments) {
|
int32_t BehaviorMessageBase::GetBehaviorIdFromArgument(AMFArrayValue* arguments) {
|
||||||
const auto* key = "BehaviorID";
|
const auto* key = "BehaviorID";
|
||||||
auto* behaviorIDValue = arguments->Get<std::string>(key);
|
auto* behaviorIDValue = arguments->Get<std::string>(key);
|
||||||
int32_t behaviorID = -1;
|
|
||||||
|
|
||||||
if (behaviorIDValue && behaviorIDValue->GetValueType() == eAmf::String) {
|
if (behaviorIDValue && behaviorIDValue->GetValueType() == eAmf::String) {
|
||||||
behaviorID = std::stoul(behaviorIDValue->GetValue());
|
GeneralUtils::TryParse(behaviorIDValue->GetValue(), behaviorId);
|
||||||
} else if (arguments->Get(key)->GetValueType() != eAmf::Undefined) {
|
} else if (arguments->Get(key) && arguments->Get(key)->GetValueType() != eAmf::Undefined) {
|
||||||
throw std::invalid_argument("Unable to find behavior ID");
|
throw std::invalid_argument("Unable to find behavior ID");
|
||||||
}
|
}
|
||||||
|
|
||||||
return behaviorID;
|
return behaviorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t BehaviorMessageBase::GetActionIndexFromArgument(AMFArrayValue* arguments, const std::string& keyName) {
|
int32_t BehaviorMessageBase::GetActionIndexFromArgument(AMFArrayValue* arguments, const std::string& keyName) {
|
||||||
auto* actionIndexAmf = arguments->Get<double>(keyName);
|
auto* actionIndexAmf = arguments->Get<double>(keyName);
|
||||||
if (!actionIndexAmf) {
|
if (!actionIndexAmf) {
|
||||||
throw std::invalid_argument("Unable to find actionIndex");
|
throw std::invalid_argument("Unable to find actionIndex");
|
||||||
}
|
}
|
||||||
|
|
||||||
return static_cast<uint32_t>(actionIndexAmf->GetValue());
|
return static_cast<int32_t>(actionIndexAmf->GetValue());
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,6 @@
|
|||||||
#include "Amf3.h"
|
#include "Amf3.h"
|
||||||
#include "dCommonVars.h"
|
#include "dCommonVars.h"
|
||||||
|
|
||||||
#include "Game.h"
|
|
||||||
#include "Logger.h"
|
|
||||||
|
|
||||||
enum class BehaviorState : uint32_t;
|
enum class BehaviorState : uint32_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,12 +15,14 @@ enum class BehaviorState : uint32_t;
|
|||||||
*/
|
*/
|
||||||
class BehaviorMessageBase {
|
class BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
const uint32_t GetBehaviorId() { return behaviorId; };
|
static inline int32_t DefaultBehaviorId = -1;
|
||||||
protected:
|
const int32_t GetBehaviorId() const { return behaviorId; };
|
||||||
|
bool IsDefaultBehaviorId() { return behaviorId == DefaultBehaviorId; };
|
||||||
BehaviorMessageBase(AMFArrayValue* arguments);
|
BehaviorMessageBase(AMFArrayValue* arguments);
|
||||||
|
protected:
|
||||||
int32_t GetBehaviorIdFromArgument(AMFArrayValue* arguments);
|
int32_t GetBehaviorIdFromArgument(AMFArrayValue* arguments);
|
||||||
uint32_t GetActionIndexFromArgument(AMFArrayValue* arguments, const std::string& keyName = "actionIndex");
|
int32_t GetActionIndexFromArgument(AMFArrayValue* arguments, const std::string& keyName = "actionIndex");
|
||||||
int32_t behaviorId = -1;
|
int32_t behaviorId = DefaultBehaviorId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__BEHAVIORMESSAGEBASE__H__
|
#endif //!__BEHAVIORMESSAGEBASE__H__
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef __CONTROLBEHAVIORMSGS__H__
|
||||||
|
#define __CONTROLBEHAVIORMSGS__H__
|
||||||
|
|
||||||
|
#include "Action.h"
|
||||||
|
#include "ActionContext.h"
|
||||||
|
#include "AddActionMessage.h"
|
||||||
|
#include "AddMessage.h"
|
||||||
|
#include "AddStripMessage.h"
|
||||||
|
#include "BehaviorMessageBase.h"
|
||||||
|
#include "ControlBehaviorMsgs.h"
|
||||||
|
#include "MergeStripsMessage.h"
|
||||||
|
#include "MigrateActionsMessage.h"
|
||||||
|
#include "MoveToInventoryMessage.h"
|
||||||
|
#include "RearrangeStripMessage.h"
|
||||||
|
#include "RemoveActionsMessage.h"
|
||||||
|
#include "RemoveStripMessage.h"
|
||||||
|
#include "RenameMessage.h"
|
||||||
|
#include "SplitStripMessage.h"
|
||||||
|
#include "StripUiPosition.h"
|
||||||
|
#include "UpdateActionMessage.h"
|
||||||
|
#include "UpdateStripUiMessage.h"
|
||||||
|
|
||||||
|
#endif //!__CONTROLBEHAVIORMSGS__H__
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef __MERGESTRIPSMESSAGE__H__
|
#ifndef __MERGESTRIPSMESSAGE__H__
|
||||||
#define __MERGESTRIPSMESSAGE__H__
|
#define __MERGESTRIPSMESSAGE__H__
|
||||||
|
|
||||||
|
#include "Action.h"
|
||||||
#include "ActionContext.h"
|
#include "ActionContext.h"
|
||||||
#include "BehaviorMessageBase.h"
|
#include "BehaviorMessageBase.h"
|
||||||
|
|
||||||
@ -13,13 +14,16 @@ class AMFArrayValue;
|
|||||||
class MergeStripsMessage : public BehaviorMessageBase {
|
class MergeStripsMessage : public BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
MergeStripsMessage(AMFArrayValue* arguments);
|
MergeStripsMessage(AMFArrayValue* arguments);
|
||||||
const uint32_t GetDstActionIndex() { return dstActionIndex; };
|
int32_t GetDstActionIndex() const { return dstActionIndex; };
|
||||||
ActionContext GetSourceActionContext() { return sourceActionContext; };
|
ActionContext GetSourceActionContext() const { return sourceActionContext; };
|
||||||
ActionContext GetDestinationActionContext() { return destinationActionContext; };
|
ActionContext GetDestinationActionContext() const { return destinationActionContext; };
|
||||||
|
const std::vector<Action>& GetMigratedActions() const { return migratedActions; };
|
||||||
|
void SetMigratedActions(std::vector<Action>::const_iterator start, std::vector<Action>::const_iterator end) { migratedActions.assign(start, end); };
|
||||||
private:
|
private:
|
||||||
|
std::vector<Action> migratedActions;
|
||||||
ActionContext sourceActionContext;
|
ActionContext sourceActionContext;
|
||||||
ActionContext destinationActionContext;
|
ActionContext destinationActionContext;
|
||||||
uint32_t dstActionIndex;
|
int32_t dstActionIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__MERGESTRIPSMESSAGE__H__
|
#endif //!__MERGESTRIPSMESSAGE__H__
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef __MIGRATEACTIONSMESSAGE__H__
|
#ifndef __MIGRATEACTIONSMESSAGE__H__
|
||||||
#define __MIGRATEACTIONSMESSAGE__H__
|
#define __MIGRATEACTIONSMESSAGE__H__
|
||||||
|
|
||||||
|
#include "Action.h"
|
||||||
#include "ActionContext.h"
|
#include "ActionContext.h"
|
||||||
#include "BehaviorMessageBase.h"
|
#include "BehaviorMessageBase.h"
|
||||||
|
|
||||||
@ -13,15 +14,18 @@ class AMFArrayValue;
|
|||||||
class MigrateActionsMessage : public BehaviorMessageBase {
|
class MigrateActionsMessage : public BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
MigrateActionsMessage(AMFArrayValue* arguments);
|
MigrateActionsMessage(AMFArrayValue* arguments);
|
||||||
const uint32_t GetSrcActionIndex() { return srcActionIndex; };
|
int32_t GetSrcActionIndex() const { return srcActionIndex; };
|
||||||
const uint32_t GetDstActionIndex() { return dstActionIndex; };
|
int32_t GetDstActionIndex() const { return dstActionIndex; };
|
||||||
ActionContext GetSourceActionContext() { return sourceActionContext; };
|
ActionContext GetSourceActionContext() const { return sourceActionContext; };
|
||||||
ActionContext GetDestinationActionContext() { return destinationActionContext; };
|
ActionContext GetDestinationActionContext() const { return destinationActionContext; };
|
||||||
|
const std::vector<Action>& GetMigratedActions() const { return migratedActions; };
|
||||||
|
void SetMigratedActions(std::vector<Action>::const_iterator start, std::vector<Action>::const_iterator end) { migratedActions.assign(start, end); };
|
||||||
private:
|
private:
|
||||||
|
std::vector<Action> migratedActions;
|
||||||
ActionContext sourceActionContext;
|
ActionContext sourceActionContext;
|
||||||
ActionContext destinationActionContext;
|
ActionContext destinationActionContext;
|
||||||
uint32_t srcActionIndex;
|
int32_t srcActionIndex;
|
||||||
uint32_t dstActionIndex;
|
int32_t dstActionIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__MIGRATEACTIONSMESSAGE__H__
|
#endif //!__MIGRATEACTIONSMESSAGE__H__
|
||||||
|
@ -13,7 +13,7 @@ class AMFArrayValue;
|
|||||||
class MoveToInventoryMessage : public BehaviorMessageBase {
|
class MoveToInventoryMessage : public BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
MoveToInventoryMessage(AMFArrayValue* arguments);
|
MoveToInventoryMessage(AMFArrayValue* arguments);
|
||||||
const uint32_t GetBehaviorIndex() { return behaviorIndex; };
|
const uint32_t GetBehaviorIndex() const { return behaviorIndex; };
|
||||||
private:
|
private:
|
||||||
uint32_t behaviorIndex;
|
uint32_t behaviorIndex;
|
||||||
};
|
};
|
||||||
|
@ -11,13 +11,13 @@
|
|||||||
class RearrangeStripMessage : public BehaviorMessageBase {
|
class RearrangeStripMessage : public BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
RearrangeStripMessage(AMFArrayValue* arguments);
|
RearrangeStripMessage(AMFArrayValue* arguments);
|
||||||
const uint32_t GetSrcActionIndex() { return srcActionIndex; };
|
int32_t GetSrcActionIndex() const { return srcActionIndex; };
|
||||||
const uint32_t GetDstActionIndex() { return dstActionIndex; };
|
int32_t GetDstActionIndex() const { return dstActionIndex; };
|
||||||
ActionContext GetActionContext() { return actionContext; };
|
ActionContext GetActionContext() const { return actionContext; };
|
||||||
private:
|
private:
|
||||||
ActionContext actionContext;
|
ActionContext actionContext;
|
||||||
uint32_t srcActionIndex;
|
int32_t srcActionIndex;
|
||||||
uint32_t dstActionIndex;
|
int32_t dstActionIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__REARRANGESTRIPMESSAGE__H__
|
#endif //!__REARRANGESTRIPMESSAGE__H__
|
||||||
|
@ -13,11 +13,11 @@ class AMFArrayValue;
|
|||||||
class RemoveActionsMessage : public BehaviorMessageBase {
|
class RemoveActionsMessage : public BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
RemoveActionsMessage(AMFArrayValue* arguments);
|
RemoveActionsMessage(AMFArrayValue* arguments);
|
||||||
const uint32_t GetActionIndex() { return actionIndex; };
|
int32_t GetActionIndex() const { return actionIndex; };
|
||||||
ActionContext GetActionContext() { return actionContext; };
|
ActionContext GetActionContext() const { return actionContext; };
|
||||||
private:
|
private:
|
||||||
ActionContext actionContext;
|
ActionContext actionContext;
|
||||||
uint32_t actionIndex;
|
int32_t actionIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__REMOVEACTIONSMESSAGE__H__
|
#endif //!__REMOVEACTIONSMESSAGE__H__
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
class RemoveStripMessage : public BehaviorMessageBase {
|
class RemoveStripMessage : public BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
RemoveStripMessage(AMFArrayValue* arguments);
|
RemoveStripMessage(AMFArrayValue* arguments);
|
||||||
ActionContext GetActionContext() { return actionContext; };
|
ActionContext GetActionContext() const { return actionContext; };
|
||||||
private:
|
private:
|
||||||
ActionContext actionContext;
|
ActionContext actionContext;
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@ class AMFArrayValue;
|
|||||||
class RenameMessage : public BehaviorMessageBase {
|
class RenameMessage : public BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
RenameMessage(AMFArrayValue* arguments);
|
RenameMessage(AMFArrayValue* arguments);
|
||||||
const std::string& GetName() { return name; };
|
const std::string& GetName() const { return name; };
|
||||||
private:
|
private:
|
||||||
std::string name;
|
std::string name;
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef __SPLITSTRIPMESSAGE__H__
|
#ifndef __SPLITSTRIPMESSAGE__H__
|
||||||
#define __SPLITSTRIPMESSAGE__H__
|
#define __SPLITSTRIPMESSAGE__H__
|
||||||
|
|
||||||
|
#include "Action.h"
|
||||||
#include "ActionContext.h"
|
#include "ActionContext.h"
|
||||||
#include "BehaviorMessageBase.h"
|
#include "BehaviorMessageBase.h"
|
||||||
#include "StripUiPosition.h"
|
#include "StripUiPosition.h"
|
||||||
@ -14,15 +15,19 @@ class AMFArrayValue;
|
|||||||
class SplitStripMessage : public BehaviorMessageBase {
|
class SplitStripMessage : public BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
SplitStripMessage(AMFArrayValue* arguments);
|
SplitStripMessage(AMFArrayValue* arguments);
|
||||||
ActionContext GetSourceActionContext() { return sourceActionContext; };
|
ActionContext GetSourceActionContext() const { return sourceActionContext; };
|
||||||
ActionContext GetDestinationActionContext() { return destinationActionContext; };
|
ActionContext GetDestinationActionContext() const { return destinationActionContext; };
|
||||||
const uint32_t GetSrcActionIndex() { return srcActionIndex; };
|
int32_t GetSrcActionIndex() const { return srcActionIndex; };
|
||||||
StripUiPosition GetPosition() { return destinationPosition; };
|
StripUiPosition GetPosition() const { return destinationPosition; };
|
||||||
|
const std::vector<Action>& GetTransferredActions() const { return transferredActions; };
|
||||||
|
void SetTransferredActions(std::vector<Action>::const_iterator begin, std::vector<Action>::const_iterator end) { transferredActions.assign(begin, end); };
|
||||||
private:
|
private:
|
||||||
ActionContext sourceActionContext;
|
ActionContext sourceActionContext;
|
||||||
ActionContext destinationActionContext;
|
ActionContext destinationActionContext;
|
||||||
uint32_t srcActionIndex;
|
int32_t srcActionIndex;
|
||||||
StripUiPosition destinationPosition;
|
StripUiPosition destinationPosition;
|
||||||
|
|
||||||
|
std::vector<Action> transferredActions;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__SPLITSTRIPMESSAGE__H__
|
#endif //!__SPLITSTRIPMESSAGE__H__
|
||||||
|
@ -20,3 +20,9 @@ StripUiPosition::StripUiPosition(AMFArrayValue* arguments, std::string uiKeyName
|
|||||||
yPosition = yPositionValue->GetValue();
|
yPosition = yPositionValue->GetValue();
|
||||||
xPosition = xPositionValue->GetValue();
|
xPosition = xPositionValue->GetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StripUiPosition::SendBehaviorBlocksToClient(AMFArrayValue& args) const {
|
||||||
|
auto* uiArgs = args.InsertArray("ui");
|
||||||
|
uiArgs->Insert("x", xPosition);
|
||||||
|
uiArgs->Insert("y", yPosition);
|
||||||
|
}
|
||||||
|
@ -11,8 +11,9 @@ class StripUiPosition {
|
|||||||
public:
|
public:
|
||||||
StripUiPosition();
|
StripUiPosition();
|
||||||
StripUiPosition(AMFArrayValue* arguments, std::string uiKeyName = "ui");
|
StripUiPosition(AMFArrayValue* arguments, std::string uiKeyName = "ui");
|
||||||
double GetX() { return xPosition; };
|
void SendBehaviorBlocksToClient(AMFArrayValue& args) const;
|
||||||
double GetY() { return yPosition; };
|
double GetX() const { return xPosition; };
|
||||||
|
double GetY() const { return yPosition; };
|
||||||
private:
|
private:
|
||||||
double xPosition;
|
double xPosition;
|
||||||
double yPosition;
|
double yPosition;
|
||||||
|
@ -14,11 +14,11 @@ class AMFArrayValue;
|
|||||||
class UpdateActionMessage : public BehaviorMessageBase {
|
class UpdateActionMessage : public BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
UpdateActionMessage(AMFArrayValue* arguments);
|
UpdateActionMessage(AMFArrayValue* arguments);
|
||||||
const uint32_t GetActionIndex() { return actionIndex; };
|
int32_t GetActionIndex() const { return actionIndex; };
|
||||||
ActionContext GetActionContext() { return actionContext; };
|
ActionContext GetActionContext() const { return actionContext; };
|
||||||
Action GetAction() { return action; };
|
Action GetAction() const { return action; };
|
||||||
private:
|
private:
|
||||||
uint32_t actionIndex;
|
int32_t actionIndex;
|
||||||
ActionContext actionContext;
|
ActionContext actionContext;
|
||||||
Action action;
|
Action action;
|
||||||
};
|
};
|
||||||
|
@ -14,8 +14,8 @@ class AMFArrayValue;
|
|||||||
class UpdateStripUiMessage : public BehaviorMessageBase {
|
class UpdateStripUiMessage : public BehaviorMessageBase {
|
||||||
public:
|
public:
|
||||||
UpdateStripUiMessage(AMFArrayValue* arguments);
|
UpdateStripUiMessage(AMFArrayValue* arguments);
|
||||||
StripUiPosition GetPosition() { return position; };
|
StripUiPosition GetPosition() const { return position; };
|
||||||
ActionContext GetActionContext() { return actionContext; };
|
ActionContext GetActionContext() const { return actionContext; };
|
||||||
private:
|
private:
|
||||||
StripUiPosition position;
|
StripUiPosition position;
|
||||||
ActionContext actionContext;
|
ActionContext actionContext;
|
||||||
|
@ -30,221 +30,49 @@
|
|||||||
#include "UpdateActionMessage.h"
|
#include "UpdateActionMessage.h"
|
||||||
#include "UpdateStripUiMessage.h"
|
#include "UpdateStripUiMessage.h"
|
||||||
|
|
||||||
void ControlBehaviors::RequestUpdatedID(int32_t behaviorID, ModelComponent* modelComponent, Entity* modelOwner, const SystemAddress& sysAddr) {
|
void ControlBehaviors::RequestUpdatedID(ControlBehaviorContext& context) {
|
||||||
// auto behavior = modelComponent->FindBehavior(behaviorID);
|
ObjectIDManager::Instance()->RequestPersistentID(
|
||||||
// if (behavior->GetBehaviorID() == -1 || behavior->GetShouldSetNewID()) {
|
[context](uint32_t persistentId) {
|
||||||
// ObjectIDManager::Instance()->RequestPersistentID(
|
if (!context) {
|
||||||
// [behaviorID, behavior, modelComponent, modelOwner, sysAddr](uint32_t persistentId) {
|
LOG("Model to update behavior ID for is null. Cannot update ID.");
|
||||||
// behavior->SetShouldGetNewID(false);
|
return;
|
||||||
// behavior->SetIsTemplated(false);
|
}
|
||||||
// behavior->SetBehaviorID(persistentId);
|
// This updates the behavior ID of the behavior should this be a new behavior
|
||||||
|
AMFArrayValue args;
|
||||||
|
|
||||||
// // This updates the behavior ID of the behavior should this be a new behavior
|
args.Insert("behaviorID", std::to_string(persistentId));
|
||||||
// AMFArrayValue args;
|
args.Insert("objectID", std::to_string(context.modelComponent->GetParent()->GetObjectID()));
|
||||||
|
|
||||||
// AMFStringValue* behaviorIDString = new AMFStringValue();
|
GameMessages::SendUIMessageServerToSingleClient(context.modelOwner, context.modelOwner->GetSystemAddress(), "UpdateBehaviorID", args);
|
||||||
// behaviorIDString->SetValue(std::to_string(persistentId));
|
context.modelComponent->UpdatePendingBehaviorId(persistentId);
|
||||||
// args.InsertValue("behaviorID", behaviorIDString);
|
|
||||||
|
|
||||||
// AMFStringValue* objectIDAsString = new AMFStringValue();
|
ControlBehaviors::Instance().SendBehaviorListToClient(context);
|
||||||
// objectIDAsString->SetValue(std::to_string(modelComponent->GetParent()->GetObjectID()));
|
});
|
||||||
// args.InsertValue("objectID", objectIDAsString);
|
|
||||||
|
|
||||||
// GameMessages::SendUIMessageServerToSingleClient(modelOwner, sysAddr, "UpdateBehaviorID", &args);
|
|
||||||
// ControlBehaviors::SendBehaviorListToClient(modelComponent->GetParent(), sysAddr, modelOwner);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlBehaviors::SendBehaviorListToClient(Entity* modelEntity, const SystemAddress& sysAddr, Entity* modelOwner) {
|
void ControlBehaviors::SendBehaviorListToClient(const ControlBehaviorContext& context) {
|
||||||
auto* modelComponent = modelEntity->GetComponent<ModelComponent>();
|
if (!context) return;
|
||||||
|
|
||||||
if (!modelComponent) return;
|
|
||||||
|
|
||||||
AMFArrayValue behaviorsToSerialize;
|
AMFArrayValue behaviorsToSerialize;
|
||||||
|
context.modelComponent->SendBehaviorListToClient(behaviorsToSerialize);
|
||||||
|
|
||||||
/**
|
GameMessages::SendUIMessageServerToSingleClient(context.modelOwner, context.modelOwner->GetSystemAddress(), "UpdateBehaviorList", behaviorsToSerialize);
|
||||||
* The behaviors AMFArray will have up to 5 elements in the dense portion.
|
|
||||||
* Each element in the dense portion will be made up of another AMFArray
|
|
||||||
* with the following information mapped in the associative portion
|
|
||||||
* "id": Behavior ID cast to an AMFString
|
|
||||||
* "isLocked": AMFTrue or AMFFalse of whether or not the behavior is locked
|
|
||||||
* "isLoot": AMFTrue or AMFFalse of whether or not the behavior is a custom behavior (true if custom)
|
|
||||||
* "name": The name of the behavior formatted as an AMFString
|
|
||||||
*/
|
|
||||||
|
|
||||||
behaviorsToSerialize.Insert("behaviors");
|
|
||||||
behaviorsToSerialize.Insert("objectID", std::to_string(modelComponent->GetParent()->GetObjectID()));
|
|
||||||
|
|
||||||
GameMessages::SendUIMessageServerToSingleClient(modelOwner, sysAddr, "UpdateBehaviorList", behaviorsToSerialize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::ModelTypeChanged(AMFArrayValue* arguments, ModelComponent* ModelComponent) {
|
|
||||||
auto* modelTypeAmf = arguments->Get<double>("ModelType");
|
|
||||||
if (!modelTypeAmf) return;
|
|
||||||
|
|
||||||
uint32_t modelType = static_cast<uint32_t>(modelTypeAmf->GetValue());
|
|
||||||
|
|
||||||
//TODO Update the model type here
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::ToggleExecutionUpdates() {
|
|
||||||
//TODO do something with this info
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::AddStrip(AMFArrayValue* arguments) {
|
|
||||||
AddStripMessage addStripMessage(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::RemoveStrip(AMFArrayValue* arguments) {
|
|
||||||
RemoveStripMessage removeStrip(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::MergeStrips(AMFArrayValue* arguments) {
|
|
||||||
MergeStripsMessage mergeStripsMessage(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::SplitStrip(AMFArrayValue* arguments) {
|
|
||||||
SplitStripMessage splitStripMessage(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::UpdateStripUI(AMFArrayValue* arguments) {
|
|
||||||
UpdateStripUiMessage updateStripUiMessage(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::AddAction(AMFArrayValue* arguments) {
|
|
||||||
AddActionMessage addActionMessage(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::MigrateActions(AMFArrayValue* arguments) {
|
|
||||||
MigrateActionsMessage migrateActionsMessage(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::RearrangeStrip(AMFArrayValue* arguments) {
|
|
||||||
RearrangeStripMessage rearrangeStripMessage(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::Add(AMFArrayValue* arguments) {
|
|
||||||
AddMessage addMessage(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::RemoveActions(AMFArrayValue* arguments) {
|
|
||||||
RemoveActionsMessage removeActionsMessage(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::Rename(Entity* modelEntity, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) {
|
|
||||||
RenameMessage renameMessage(arguments);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO This is also supposed to serialize the state of the behaviors in progress but those aren't implemented yet
|
// TODO This is also supposed to serialize the state of the behaviors in progress but those aren't implemented yet
|
||||||
void ControlBehaviors::SendBehaviorBlocksToClient(ModelComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) {
|
void ControlBehaviors::SendBehaviorBlocksToClient(ControlBehaviorContext& context) {
|
||||||
// uint32_t behaviorID = ControlBehaviors::GetBehaviorIDFromArgument(arguments);
|
if (!context) return;
|
||||||
|
BehaviorMessageBase behaviorMsg(context.arguments);
|
||||||
|
|
||||||
// auto modelBehavior = modelComponent->FindBehavior(behaviorID);
|
context.modelComponent->VerifyBehaviors();
|
||||||
|
AMFArrayValue behavior;
|
||||||
// if (!modelBehavior) return;
|
context.modelComponent->SendBehaviorBlocksToClient(behaviorMsg.GetBehaviorId(), behavior);
|
||||||
|
GameMessages::SendUIMessageServerToSingleClient(context.modelOwner, context.modelOwner->GetSystemAddress(), "UpdateBehaviorBlocks", behavior);
|
||||||
// modelBehavior->VerifyStates();
|
|
||||||
|
|
||||||
// auto states = modelBehavior->GetBehaviorStates();
|
|
||||||
|
|
||||||
// // Begin serialization.
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * for each state
|
|
||||||
// * strip id
|
|
||||||
// * ui info
|
|
||||||
// * x
|
|
||||||
// * y
|
|
||||||
// * actions
|
|
||||||
// * action1
|
|
||||||
// * action2
|
|
||||||
// * ...
|
|
||||||
// * behaviorID of strip
|
|
||||||
// * objectID of strip
|
|
||||||
// */
|
|
||||||
// LWOOBJID targetObjectID = LWOOBJID_EMPTY;
|
|
||||||
// behaviorID = 0;
|
|
||||||
// AMFArrayValue behaviorInfo;
|
|
||||||
|
|
||||||
// AMFArrayValue* stateSerialize = new AMFArrayValue();
|
|
||||||
|
|
||||||
// for (auto it = states.begin(); it != states.end(); it++) {
|
|
||||||
// LOG("Begin serialization of state %i!\n", it->first);
|
|
||||||
// AMFArrayValue* state = new AMFArrayValue();
|
|
||||||
|
|
||||||
// AMFDoubleValue* stateAsDouble = new AMFDoubleValue();
|
|
||||||
// stateAsDouble->SetValue(it->first);
|
|
||||||
// state->InsertValue("id", stateAsDouble);
|
|
||||||
|
|
||||||
// AMFArrayValue* strips = new AMFArrayValue();
|
|
||||||
// auto stripsInState = it->second->GetStrips();
|
|
||||||
// for (auto strip = stripsInState.begin(); strip != stripsInState.end(); strip++) {
|
|
||||||
// LOG("Begin serialization of strip %i!\n", strip->first);
|
|
||||||
// AMFArrayValue* thisStrip = new AMFArrayValue();
|
|
||||||
|
|
||||||
// AMFDoubleValue* stripID = new AMFDoubleValue();
|
|
||||||
// stripID->SetValue(strip->first);
|
|
||||||
// thisStrip->InsertValue("id", stripID);
|
|
||||||
|
|
||||||
// AMFArrayValue* uiArray = new AMFArrayValue();
|
|
||||||
// AMFDoubleValue* yPosition = new AMFDoubleValue();
|
|
||||||
// yPosition->SetValue(strip->second->GetYPosition());
|
|
||||||
// uiArray->InsertValue("y", yPosition);
|
|
||||||
|
|
||||||
// AMFDoubleValue* xPosition = new AMFDoubleValue();
|
|
||||||
// xPosition->SetValue(strip->second->GetXPosition());
|
|
||||||
// uiArray->InsertValue("x", xPosition);
|
|
||||||
|
|
||||||
// thisStrip->InsertValue("ui", uiArray);
|
|
||||||
// targetObjectID = modelComponent->GetParent()->GetObjectID();
|
|
||||||
// behaviorID = modelBehavior->GetBehaviorID();
|
|
||||||
|
|
||||||
// AMFArrayValue* stripSerialize = new AMFArrayValue();
|
|
||||||
// for (auto behaviorAction : strip->second->GetActions()) {
|
|
||||||
// LOG("Begin serialization of action %s!\n", behaviorAction->actionName.c_str());
|
|
||||||
// AMFArrayValue* thisAction = new AMFArrayValue();
|
|
||||||
|
|
||||||
// AMFStringValue* actionName = new AMFStringValue();
|
|
||||||
// actionName->SetValue(behaviorAction->actionName);
|
|
||||||
// thisAction->InsertValue("Type", actionName);
|
|
||||||
|
|
||||||
// if (behaviorAction->parameterValueString != "")
|
|
||||||
// {
|
|
||||||
// AMFStringValue* valueAsString = new AMFStringValue();
|
|
||||||
// valueAsString->SetValue(behaviorAction->parameterValueString);
|
|
||||||
// thisAction->InsertValue(behaviorAction->parameterName, valueAsString);
|
|
||||||
// }
|
|
||||||
// else if (behaviorAction->parameterValueDouble != 0.0)
|
|
||||||
// {
|
|
||||||
// AMFDoubleValue* valueAsDouble = new AMFDoubleValue();
|
|
||||||
// valueAsDouble->SetValue(behaviorAction->parameterValueDouble);
|
|
||||||
// thisAction->InsertValue(behaviorAction->parameterName, valueAsDouble);
|
|
||||||
// }
|
|
||||||
// stripSerialize->PushBackValue(thisAction);
|
|
||||||
// }
|
|
||||||
// thisStrip->InsertValue("actions", stripSerialize);
|
|
||||||
// strips->PushBackValue(thisStrip);
|
|
||||||
// }
|
|
||||||
// state->InsertValue("strips", strips);
|
|
||||||
// stateSerialize->PushBackValue(state);
|
|
||||||
// }
|
|
||||||
// behaviorInfo.InsertValue("states", stateSerialize);
|
|
||||||
|
|
||||||
// AMFStringValue* objectidAsString = new AMFStringValue();
|
|
||||||
// objectidAsString->SetValue(std::to_string(targetObjectID));
|
|
||||||
// behaviorInfo.InsertValue("objectID", objectidAsString);
|
|
||||||
|
|
||||||
// AMFStringValue* behaviorIDAsString = new AMFStringValue();
|
|
||||||
// behaviorIDAsString->SetValue(std::to_string(behaviorID));
|
|
||||||
// behaviorInfo.InsertValue("BehaviorID", behaviorIDAsString);
|
|
||||||
|
|
||||||
// GameMessages::SendUIMessageServerToSingleClient(modelOwner, sysAddr, "UpdateBehaviorBlocks", &behaviorInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlBehaviors::UpdateAction(AMFArrayValue* arguments) {
|
void ControlBehaviors::UpdateAction(AMFArrayValue* arguments) {
|
||||||
UpdateActionMessage updateActionMessage(arguments);
|
UpdateActionMessage updateActionMessage(arguments);
|
||||||
auto* blockDefinition = GetBlockInfo(updateActionMessage.GetAction().GetType());
|
auto blockDefinition = GetBlockInfo(updateActionMessage.GetAction().GetType());
|
||||||
|
|
||||||
if (!blockDefinition) {
|
if (!blockDefinition) {
|
||||||
LOG("Received undefined block type %s. Ignoring.", updateActionMessage.GetAction().GetType().c_str());
|
LOG("Received undefined block type %s. Ignoring.", updateActionMessage.GetAction().GetType().c_str());
|
||||||
@ -266,75 +94,83 @@ void ControlBehaviors::UpdateAction(AMFArrayValue* arguments) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlBehaviors::MoveToInventory(ModelComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) {
|
|
||||||
// This closes the UI menu should it be open while the player is removing behaviors
|
|
||||||
AMFArrayValue args;
|
|
||||||
|
|
||||||
args.Insert("visible", false);
|
|
||||||
|
|
||||||
GameMessages::SendUIMessageServerToSingleClient(modelOwner, modelOwner->GetParentUser()->GetSystemAddress(), "ToggleBehaviorEditor", args);
|
|
||||||
|
|
||||||
MoveToInventoryMessage moveToInventoryMessage(arguments);
|
|
||||||
|
|
||||||
SendBehaviorListToClient(modelComponent->GetParent(), sysAddr, modelOwner);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlBehaviors::ProcessCommand(Entity* modelEntity, const SystemAddress& sysAddr, AMFArrayValue* arguments, std::string command, Entity* modelOwner) {
|
void ControlBehaviors::ProcessCommand(Entity* modelEntity, const SystemAddress& sysAddr, AMFArrayValue* arguments, std::string command, Entity* modelOwner) {
|
||||||
if (!isInitialized || !modelEntity || !modelOwner || !arguments) return;
|
if (!isInitialized || !modelEntity || !modelOwner || !arguments) return;
|
||||||
auto* modelComponent = modelEntity->GetComponent<ModelComponent>();
|
auto* modelComponent = modelEntity->GetComponent<ModelComponent>();
|
||||||
|
|
||||||
if (!modelComponent) return;
|
if (!modelComponent) return;
|
||||||
|
|
||||||
if (command == "sendBehaviorListToClient")
|
ControlBehaviorContext context(arguments, modelComponent, modelOwner);
|
||||||
SendBehaviorListToClient(modelEntity, sysAddr, modelOwner);
|
|
||||||
else if (command == "modelTypeChanged")
|
if (command == "sendBehaviorListToClient") {
|
||||||
ModelTypeChanged(arguments, modelComponent);
|
SendBehaviorListToClient(context);
|
||||||
else if (command == "toggleExecutionUpdates")
|
} else if (command == "modelTypeChanged") {
|
||||||
ToggleExecutionUpdates();
|
auto* modelType = arguments->Get<double>("ModelType");
|
||||||
else if (command == "addStrip")
|
if (!modelType) return;
|
||||||
AddStrip(arguments);
|
|
||||||
else if (command == "removeStrip")
|
modelEntity->SetVar<int>(u"modelType", modelType->GetValue());
|
||||||
RemoveStrip(arguments);
|
} else if (command == "toggleExecutionUpdates") {
|
||||||
else if (command == "mergeStrips")
|
// TODO
|
||||||
MergeStrips(arguments);
|
} else if (command == "addStrip") {
|
||||||
else if (command == "splitStrip")
|
if (BehaviorMessageBase(context.arguments).IsDefaultBehaviorId()) RequestUpdatedID(context);
|
||||||
SplitStrip(arguments);
|
|
||||||
else if (command == "updateStripUI")
|
context.modelComponent->HandleControlBehaviorsMsg<AddStripMessage>(context.arguments);
|
||||||
UpdateStripUI(arguments);
|
} else if (command == "removeStrip") {
|
||||||
else if (command == "addAction")
|
context.modelComponent->HandleControlBehaviorsMsg<RemoveStripMessage>(arguments);
|
||||||
AddAction(arguments);
|
} else if (command == "mergeStrips") {
|
||||||
else if (command == "migrateActions")
|
context.modelComponent->HandleControlBehaviorsMsg<MergeStripsMessage>(arguments);
|
||||||
MigrateActions(arguments);
|
} else if (command == "splitStrip") {
|
||||||
else if (command == "rearrangeStrip")
|
context.modelComponent->HandleControlBehaviorsMsg<SplitStripMessage>(arguments);
|
||||||
RearrangeStrip(arguments);
|
} else if (command == "updateStripUI") {
|
||||||
else if (command == "add")
|
context.modelComponent->HandleControlBehaviorsMsg<UpdateStripUiMessage>(arguments);
|
||||||
Add(arguments);
|
} else if (command == "addAction") {
|
||||||
else if (command == "removeActions")
|
context.modelComponent->HandleControlBehaviorsMsg<AddActionMessage>(arguments);
|
||||||
RemoveActions(arguments);
|
} else if (command == "migrateActions") {
|
||||||
else if (command == "rename")
|
context.modelComponent->HandleControlBehaviorsMsg<MigrateActionsMessage>(arguments);
|
||||||
Rename(modelEntity, sysAddr, modelOwner, arguments);
|
} else if (command == "rearrangeStrip") {
|
||||||
else if (command == "sendBehaviorBlocksToClient")
|
context.modelComponent->HandleControlBehaviorsMsg<RearrangeStripMessage>(arguments);
|
||||||
SendBehaviorBlocksToClient(modelComponent, sysAddr, modelOwner, arguments);
|
} else if (command == "add") {
|
||||||
else if (command == "moveToInventory")
|
AddMessage msg(context.arguments);
|
||||||
MoveToInventory(modelComponent, sysAddr, modelOwner, arguments);
|
context.modelComponent->AddBehavior(msg);
|
||||||
else if (command == "updateAction")
|
SendBehaviorListToClient(context);
|
||||||
UpdateAction(arguments);
|
} else if (command == "removeActions") {
|
||||||
else
|
context.modelComponent->HandleControlBehaviorsMsg<RemoveActionsMessage>(arguments);
|
||||||
LOG("Unknown behavior command (%s)\n", command.c_str());
|
} else if (command == "rename") {
|
||||||
|
context.modelComponent->HandleControlBehaviorsMsg<RenameMessage>(arguments);
|
||||||
|
|
||||||
|
// Send the list back to the client so the name is updated.
|
||||||
|
SendBehaviorListToClient(context);
|
||||||
|
} else if (command == "sendBehaviorBlocksToClient") {
|
||||||
|
SendBehaviorBlocksToClient(context);
|
||||||
|
} else if (command == "moveToInventory") {
|
||||||
|
MoveToInventoryMessage msg(arguments);
|
||||||
|
context.modelComponent->MoveToInventory(msg);
|
||||||
|
|
||||||
|
AMFArrayValue args;
|
||||||
|
args.Insert("BehaviorID", std::to_string(msg.GetBehaviorId()));
|
||||||
|
GameMessages::SendUIMessageServerToSingleClient(modelOwner, modelOwner->GetParentUser()->GetSystemAddress(), "BehaviorRemoved", args);
|
||||||
|
|
||||||
|
SendBehaviorListToClient(context);
|
||||||
|
} else if (command == "updateAction") {
|
||||||
|
context.modelComponent->HandleControlBehaviorsMsg<UpdateActionMessage>(arguments);
|
||||||
|
} else {
|
||||||
|
LOG("Unknown behavior command (%s)", command.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlBehaviors::ControlBehaviors() {
|
ControlBehaviors::ControlBehaviors() {
|
||||||
auto blocksBuffer = Game::assetManager->GetFile("ui\\ingame\\blocksdef.xml");
|
auto blocksBuffer = Game::assetManager->GetFile("ui\\ingame\\blocksdef.xml");
|
||||||
if (!blocksBuffer) {
|
if (!blocksBuffer) {
|
||||||
LOG("Failed to open blocksdef.xml");
|
LOG("Failed to open blocksdef.xml, property behaviors will be disabled for this zone! "
|
||||||
|
"(This is a necessary file for cheat detection and ensuring we do not send unexpected values to the client)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tinyxml2::XMLDocument m_Doc;
|
tinyxml2::XMLDocument m_Doc;
|
||||||
|
|
||||||
std::string read{};
|
std::string read;
|
||||||
|
|
||||||
std::string buffer{};
|
std::string buffer;
|
||||||
bool commentBlockStart = false;
|
bool commentBlockStart = false;
|
||||||
while (std::getline(blocksBuffer, read)) {
|
while (std::getline(blocksBuffer, read)) {
|
||||||
// tinyxml2 should handle comment blocks but the client has one that fails the processing.
|
// tinyxml2 should handle comment blocks but the client has one that fails the processing.
|
||||||
@ -371,14 +207,14 @@ ControlBehaviors::ControlBehaviors() {
|
|||||||
while (block) {
|
while (block) {
|
||||||
blockName = block->Name();
|
blockName = block->Name();
|
||||||
|
|
||||||
BlockDefinition* blockDefinition = new BlockDefinition();
|
auto& blockDefinition = blockTypes[blockName];
|
||||||
std::string name{};
|
std::string name{};
|
||||||
std::string typeName{};
|
std::string typeName{};
|
||||||
|
|
||||||
auto* argument = block->FirstChildElement("Argument");
|
auto* argument = block->FirstChildElement("Argument");
|
||||||
if (argument) {
|
if (argument) {
|
||||||
auto* defaultDefinition = argument->FirstChildElement("DefaultValue");
|
auto* defaultDefinition = argument->FirstChildElement("DefaultValue");
|
||||||
if (defaultDefinition) blockDefinition->SetDefaultValue(defaultDefinition->GetText());
|
if (defaultDefinition) blockDefinition.SetDefaultValue(defaultDefinition->GetText());
|
||||||
|
|
||||||
auto* typeDefinition = argument->FirstChildElement("Type");
|
auto* typeDefinition = argument->FirstChildElement("Type");
|
||||||
if (typeDefinition) typeName = typeDefinition->GetText();
|
if (typeDefinition) typeName = typeDefinition->GetText();
|
||||||
@ -388,23 +224,23 @@ ControlBehaviors::ControlBehaviors() {
|
|||||||
|
|
||||||
// Now we parse the blocksdef file for the relevant information
|
// Now we parse the blocksdef file for the relevant information
|
||||||
if (typeName == "String") {
|
if (typeName == "String") {
|
||||||
blockDefinition->SetMaximumValue(50); // The client has a hardcoded limit of 50 characters in a string field
|
blockDefinition.SetMaximumValue(50); // The client has a hardcoded limit of 50 characters in a string field
|
||||||
} else if (typeName == "Float" || typeName == "Integer") {
|
} else if (typeName == "Float" || typeName == "Integer") {
|
||||||
auto* maximumDefinition = argument->FirstChildElement("Maximum");
|
auto* maximumDefinition = argument->FirstChildElement("Maximum");
|
||||||
if (maximumDefinition) blockDefinition->SetMaximumValue(std::stof(maximumDefinition->GetText()));
|
if (maximumDefinition) blockDefinition.SetMaximumValue(std::stof(maximumDefinition->GetText()));
|
||||||
|
|
||||||
auto* minimumDefinition = argument->FirstChildElement("Minimum");
|
auto* minimumDefinition = argument->FirstChildElement("Minimum");
|
||||||
if (minimumDefinition) blockDefinition->SetMinimumValue(std::stof(minimumDefinition->GetText()));
|
if (minimumDefinition) blockDefinition.SetMinimumValue(std::stof(minimumDefinition->GetText()));
|
||||||
} else if (typeName == "Enumeration") {
|
} else if (typeName == "Enumeration") {
|
||||||
auto* values = argument->FirstChildElement("Values");
|
auto* values = argument->FirstChildElement("Values");
|
||||||
if (values) {
|
if (values) {
|
||||||
auto* value = values->FirstChildElement("Value");
|
auto* value = values->FirstChildElement("Value");
|
||||||
while (value) {
|
while (value) {
|
||||||
if (value->GetText() == blockDefinition->GetDefaultValue()) blockDefinition->GetDefaultValue() = std::to_string(blockDefinition->GetMaximumValue());
|
if (value->GetText() == blockDefinition.GetDefaultValue()) blockDefinition.GetDefaultValue() = std::to_string(blockDefinition.GetMaximumValue());
|
||||||
blockDefinition->SetMaximumValue(blockDefinition->GetMaximumValue() + 1);
|
blockDefinition.SetMaximumValue(blockDefinition.GetMaximumValue() + 1);
|
||||||
value = value->NextSiblingElement("Value");
|
value = value->NextSiblingElement("Value");
|
||||||
}
|
}
|
||||||
blockDefinition->SetMaximumValue(blockDefinition->GetMaximumValue() - 1); // Maximum value is 0 indexed
|
blockDefinition.SetMaximumValue(blockDefinition.GetMaximumValue() - 1); // Maximum value is 0 indexed
|
||||||
} else {
|
} else {
|
||||||
values = argument->FirstChildElement("EnumerationSource");
|
values = argument->FirstChildElement("EnumerationSource");
|
||||||
if (!values) {
|
if (!values) {
|
||||||
@ -421,8 +257,8 @@ ControlBehaviors::ControlBehaviors() {
|
|||||||
std::string serviceName = serviceNameNode->GetText();
|
std::string serviceName = serviceNameNode->GetText();
|
||||||
if (serviceName == "GetBehaviorSoundList") {
|
if (serviceName == "GetBehaviorSoundList") {
|
||||||
auto res = CDClientDatabase::ExecuteQuery("SELECT MAX(id) as countSounds FROM UGBehaviorSounds;");
|
auto res = CDClientDatabase::ExecuteQuery("SELECT MAX(id) as countSounds FROM UGBehaviorSounds;");
|
||||||
blockDefinition->SetMaximumValue(res.getIntField("countSounds"));
|
blockDefinition.SetMaximumValue(res.getIntField("countSounds"));
|
||||||
blockDefinition->SetDefaultValue("0");
|
blockDefinition.SetDefaultValue("0");
|
||||||
} else {
|
} else {
|
||||||
LOG("Unsupported Enumeration ServiceType (%s)", serviceName.c_str());
|
LOG("Unsupported Enumeration ServiceType (%s)", serviceName.c_str());
|
||||||
continue;
|
continue;
|
||||||
@ -433,19 +269,18 @@ ControlBehaviors::ControlBehaviors() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blockTypes.insert(std::make_pair(blockName, blockDefinition));
|
|
||||||
block = block->NextSiblingElement();
|
block = block->NextSiblingElement();
|
||||||
}
|
}
|
||||||
blockSections = blockSections->NextSiblingElement();
|
blockSections = blockSections->NextSiblingElement();
|
||||||
}
|
}
|
||||||
isInitialized = true;
|
isInitialized = true;
|
||||||
LOG_DEBUG("Created all base block classes");
|
LOG_DEBUG("Created all base block classes");
|
||||||
for (auto b : blockTypes) {
|
for (auto& [name, block] : blockTypes) {
|
||||||
LOG_DEBUG("block name is %s default %s min %f max %f", b.first.c_str(), b.second->GetDefaultValue().c_str(), b.second->GetMinimumValue(), b.second->GetMaximumValue());
|
LOG_DEBUG("block name is %s default %s min %f max %f", name.c_str(), block.GetDefaultValue().c_str(), block.GetMinimumValue(), block.GetMaximumValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockDefinition* ControlBehaviors::GetBlockInfo(const BlockName& blockName) {
|
std::optional<BlockDefinition> ControlBehaviors::GetBlockInfo(const BlockName& blockName) {
|
||||||
auto blockDefinition = blockTypes.find(blockName);
|
auto blockDefinition = blockTypes.find(blockName);
|
||||||
return blockDefinition != blockTypes.end() ? blockDefinition->second : nullptr;
|
return blockDefinition != blockTypes.end() ? std::optional(blockDefinition->second) : std::nullopt;
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,13 @@
|
|||||||
#define __CONTROLBEHAVIORS__H__
|
#define __CONTROLBEHAVIORS__H__
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "BlockDefinition.h"
|
||||||
#include "Singleton.h"
|
#include "Singleton.h"
|
||||||
|
|
||||||
class AMFArrayValue;
|
class AMFArrayValue;
|
||||||
class BlockDefinition;
|
|
||||||
class Entity;
|
class Entity;
|
||||||
class ModelComponent;
|
class ModelComponent;
|
||||||
class SystemAddress;
|
class SystemAddress;
|
||||||
@ -17,6 +18,18 @@ class SystemAddress;
|
|||||||
// Type definition to clarify what is used where
|
// Type definition to clarify what is used where
|
||||||
typedef std::string BlockName; //! A block name
|
typedef std::string BlockName; //! A block name
|
||||||
|
|
||||||
|
struct ControlBehaviorContext {
|
||||||
|
ControlBehaviorContext(AMFArrayValue* args, ModelComponent* modelComponent, Entity* modelOwner) : arguments(args), modelComponent(modelComponent), modelOwner(modelOwner) {};
|
||||||
|
|
||||||
|
operator bool() const {
|
||||||
|
return arguments != nullptr && modelComponent != nullptr && modelOwner != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
AMFArrayValue* arguments;
|
||||||
|
Entity* modelOwner;
|
||||||
|
ModelComponent* modelComponent;
|
||||||
|
};
|
||||||
|
|
||||||
class ControlBehaviors: public Singleton<ControlBehaviors> {
|
class ControlBehaviors: public Singleton<ControlBehaviors> {
|
||||||
public:
|
public:
|
||||||
ControlBehaviors();
|
ControlBehaviors();
|
||||||
@ -39,27 +52,13 @@ public:
|
|||||||
*
|
*
|
||||||
* @return A pair of the block parameter name to its typing
|
* @return A pair of the block parameter name to its typing
|
||||||
*/
|
*/
|
||||||
BlockDefinition* GetBlockInfo(const BlockName& blockName);
|
std::optional<BlockDefinition> GetBlockInfo(const BlockName& blockName);
|
||||||
private:
|
private:
|
||||||
void RequestUpdatedID(int32_t behaviorID, ModelComponent* modelComponent, Entity* modelOwner, const SystemAddress& sysAddr);
|
void RequestUpdatedID(ControlBehaviorContext& context);
|
||||||
void SendBehaviorListToClient(Entity* modelEntity, const SystemAddress& sysAddr, Entity* modelOwner);
|
void SendBehaviorListToClient(const ControlBehaviorContext& context);
|
||||||
void ModelTypeChanged(AMFArrayValue* arguments, ModelComponent* ModelComponent);
|
void SendBehaviorBlocksToClient(ControlBehaviorContext& context);
|
||||||
void ToggleExecutionUpdates();
|
|
||||||
void AddStrip(AMFArrayValue* arguments);
|
|
||||||
void RemoveStrip(AMFArrayValue* arguments);
|
|
||||||
void MergeStrips(AMFArrayValue* arguments);
|
|
||||||
void SplitStrip(AMFArrayValue* arguments);
|
|
||||||
void UpdateStripUI(AMFArrayValue* arguments);
|
|
||||||
void AddAction(AMFArrayValue* arguments);
|
|
||||||
void MigrateActions(AMFArrayValue* arguments);
|
|
||||||
void RearrangeStrip(AMFArrayValue* arguments);
|
|
||||||
void Add(AMFArrayValue* arguments);
|
|
||||||
void RemoveActions(AMFArrayValue* arguments);
|
|
||||||
void Rename(Entity* modelEntity, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments);
|
|
||||||
void SendBehaviorBlocksToClient(ModelComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments);
|
|
||||||
void UpdateAction(AMFArrayValue* arguments);
|
void UpdateAction(AMFArrayValue* arguments);
|
||||||
void MoveToInventory(ModelComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments);
|
std::map<BlockName, BlockDefinition> blockTypes{};
|
||||||
std::map<BlockName, BlockDefinition*> blockTypes{};
|
|
||||||
|
|
||||||
// If false, property behaviors will not be able to be edited.
|
// If false, property behaviors will not be able to be edited.
|
||||||
bool isInitialized = false;
|
bool isInitialized = false;
|
||||||
|
131
dGame/dPropertyBehaviors/PropertyBehavior.cpp
Normal file
131
dGame/dPropertyBehaviors/PropertyBehavior.cpp
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
#include "PropertyBehavior.h"
|
||||||
|
|
||||||
|
#include "Amf3.h"
|
||||||
|
#include "BehaviorStates.h"
|
||||||
|
#include "ControlBehaviorMsgs.h"
|
||||||
|
|
||||||
|
PropertyBehavior::PropertyBehavior() {
|
||||||
|
m_LastEditedState = BehaviorState::HOME_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void PropertyBehavior::HandleMsg(AddStripMessage& msg) {
|
||||||
|
m_States[msg.GetActionContext().GetStateId()].HandleMsg(msg);
|
||||||
|
m_LastEditedState = msg.GetActionContext().GetStateId();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void PropertyBehavior::HandleMsg(AddActionMessage& msg) {
|
||||||
|
m_States[msg.GetActionContext().GetStateId()].HandleMsg(msg);
|
||||||
|
m_LastEditedState = msg.GetActionContext().GetStateId();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void PropertyBehavior::HandleMsg(RearrangeStripMessage& msg) {
|
||||||
|
m_States[msg.GetActionContext().GetStateId()].HandleMsg(msg);
|
||||||
|
m_LastEditedState = msg.GetActionContext().GetStateId();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void PropertyBehavior::HandleMsg(UpdateActionMessage& msg) {
|
||||||
|
m_States[msg.GetActionContext().GetStateId()].HandleMsg(msg);
|
||||||
|
m_LastEditedState = msg.GetActionContext().GetStateId();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void PropertyBehavior::HandleMsg(UpdateStripUiMessage& msg) {
|
||||||
|
m_States[msg.GetActionContext().GetStateId()].HandleMsg(msg);
|
||||||
|
m_LastEditedState = msg.GetActionContext().GetStateId();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void PropertyBehavior::HandleMsg(RemoveStripMessage& msg) {
|
||||||
|
m_States[msg.GetActionContext().GetStateId()].HandleMsg(msg);
|
||||||
|
m_LastEditedState = msg.GetActionContext().GetStateId();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void PropertyBehavior::HandleMsg(RemoveActionsMessage& msg) {
|
||||||
|
m_States[msg.GetActionContext().GetStateId()].HandleMsg(msg);
|
||||||
|
m_LastEditedState = msg.GetActionContext().GetStateId();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void PropertyBehavior::HandleMsg(SplitStripMessage& msg) {
|
||||||
|
m_States[msg.GetSourceActionContext().GetStateId()].HandleMsg(msg);
|
||||||
|
m_States[msg.GetDestinationActionContext().GetStateId()].HandleMsg(msg);
|
||||||
|
m_LastEditedState = msg.GetDestinationActionContext().GetStateId();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void PropertyBehavior::HandleMsg(MigrateActionsMessage& msg) {
|
||||||
|
m_States[msg.GetSourceActionContext().GetStateId()].HandleMsg(msg);
|
||||||
|
m_States[msg.GetDestinationActionContext().GetStateId()].HandleMsg(msg);
|
||||||
|
m_LastEditedState = msg.GetDestinationActionContext().GetStateId();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void PropertyBehavior::HandleMsg(MergeStripsMessage& msg) {
|
||||||
|
m_States[msg.GetSourceActionContext().GetStateId()].HandleMsg(msg);
|
||||||
|
m_States[msg.GetDestinationActionContext().GetStateId()].HandleMsg(msg);
|
||||||
|
m_LastEditedState = msg.GetDestinationActionContext().GetStateId();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void PropertyBehavior::HandleMsg(RenameMessage& msg) {
|
||||||
|
m_Name = msg.GetName();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void PropertyBehavior::HandleMsg(AddMessage& msg) {
|
||||||
|
// TODO Parse the corresponding behavior xml file.
|
||||||
|
m_BehaviorId = msg.GetBehaviorId();
|
||||||
|
isLoot = m_BehaviorId != 7965;
|
||||||
|
};
|
||||||
|
|
||||||
|
void PropertyBehavior::SetBehaviorId(int32_t behaviorId) {
|
||||||
|
m_BehaviorId = behaviorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyBehavior::SendBehaviorListToClient(AMFArrayValue& args) const {
|
||||||
|
args.Insert("id", std::to_string(m_BehaviorId));
|
||||||
|
args.Insert("name", m_Name);
|
||||||
|
args.Insert("isLocked", isLocked);
|
||||||
|
args.Insert("isLoot", isLoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyBehavior::VerifyLastEditedState() {
|
||||||
|
if (!m_States[m_LastEditedState].IsEmpty()) return;
|
||||||
|
|
||||||
|
for (const auto& [stateId, state] : m_States) {
|
||||||
|
if (state.IsEmpty()) continue;
|
||||||
|
|
||||||
|
LOG_DEBUG("Updating last edited state to %i because %i is empty.", stateId, m_LastEditedState);
|
||||||
|
m_LastEditedState = stateId;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_DEBUG("No states found, sending default state");
|
||||||
|
|
||||||
|
m_LastEditedState = BehaviorState::HOME_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyBehavior::SendBehaviorBlocksToClient(AMFArrayValue& args) const {
|
||||||
|
auto* stateArray = args.InsertArray("states");
|
||||||
|
|
||||||
|
auto lastState = BehaviorState::HOME_STATE;
|
||||||
|
for (auto& [stateId, state] : m_States) {
|
||||||
|
if (state.IsEmpty()) continue;
|
||||||
|
|
||||||
|
LOG_DEBUG("Serializing state %i", stateId);
|
||||||
|
auto* stateArgs = stateArray->PushArray();
|
||||||
|
stateArgs->Insert("id", static_cast<double>(stateId));
|
||||||
|
state.SendBehaviorBlocksToClient(*stateArgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto* executionState = args.InsertArray("executionState");
|
||||||
|
executionState->Insert("stateID", static_cast<double>(m_LastEditedState));
|
||||||
|
executionState->InsertArray("strips");
|
||||||
|
|
||||||
|
// TODO Serialize the execution state of the behavior
|
||||||
|
}
|
49
dGame/dPropertyBehaviors/PropertyBehavior.h
Normal file
49
dGame/dPropertyBehaviors/PropertyBehavior.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#ifndef __PROPERTYBEHAVIOR__H__
|
||||||
|
#define __PROPERTYBEHAVIOR__H__
|
||||||
|
|
||||||
|
#include "State.h"
|
||||||
|
|
||||||
|
enum class BehaviorState : uint32_t;
|
||||||
|
|
||||||
|
class AMFArrayValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the Entity of a Property Behavior and holds data associated with the behavior
|
||||||
|
*/
|
||||||
|
class PropertyBehavior {
|
||||||
|
public:
|
||||||
|
PropertyBehavior();
|
||||||
|
template<typename Msg>
|
||||||
|
void HandleMsg(Msg& msg);
|
||||||
|
|
||||||
|
// If the last edited state has no strips, this method will set the last edited state to the first state that has strips.
|
||||||
|
void VerifyLastEditedState();
|
||||||
|
void SendBehaviorListToClient(AMFArrayValue& args) const;
|
||||||
|
void SendBehaviorBlocksToClient(AMFArrayValue& args) const;
|
||||||
|
|
||||||
|
int32_t GetBehaviorId() const { return m_BehaviorId; }
|
||||||
|
void SetBehaviorId(int32_t id);
|
||||||
|
private:
|
||||||
|
|
||||||
|
// The states this behavior has.
|
||||||
|
std::map<BehaviorState, State> m_States;
|
||||||
|
|
||||||
|
// The name of this behavior.
|
||||||
|
std::string m_Name = "New Behavior";
|
||||||
|
|
||||||
|
// Whether this behavior is locked and cannot be edited.
|
||||||
|
bool isLocked = false;
|
||||||
|
|
||||||
|
// Whether this behavior is custom or pre-fab.
|
||||||
|
bool isLoot = false;
|
||||||
|
|
||||||
|
// The last state that was edited. This is used so when the client re-opens the behavior editor, it will open to the last edited state.
|
||||||
|
// If the last edited state has no strips, it will open to the first state that has strips.
|
||||||
|
BehaviorState m_LastEditedState;
|
||||||
|
|
||||||
|
// The behavior id for this behavior. This is expected to be fully unique, however an id of -1 means this behavior was just created
|
||||||
|
// and needs to be assigned an id.
|
||||||
|
int32_t m_BehaviorId = -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //!__PROPERTYBEHAVIOR__H__
|
137
dGame/dPropertyBehaviors/State.cpp
Normal file
137
dGame/dPropertyBehaviors/State.cpp
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
#include "State.h"
|
||||||
|
|
||||||
|
#include "Amf3.h"
|
||||||
|
#include "ControlBehaviorMsgs.h"
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void State::HandleMsg(AddStripMessage& msg) {
|
||||||
|
if (m_Strips.size() <= msg.GetActionContext().GetStripId()) {
|
||||||
|
m_Strips.resize(msg.GetActionContext().GetStripId() + 1);
|
||||||
|
}
|
||||||
|
m_Strips.at(msg.GetActionContext().GetStripId()).HandleMsg(msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void State::HandleMsg(AddActionMessage& msg) {
|
||||||
|
if (m_Strips.size() <= msg.GetActionContext().GetStripId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Strips.at(msg.GetActionContext().GetStripId()).HandleMsg(msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void State::HandleMsg(UpdateStripUiMessage& msg) {
|
||||||
|
if (m_Strips.size() <= msg.GetActionContext().GetStripId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Strips.at(msg.GetActionContext().GetStripId()).HandleMsg(msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void State::HandleMsg(RemoveActionsMessage& msg) {
|
||||||
|
if (m_Strips.size() <= msg.GetActionContext().GetStripId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Strips.at(msg.GetActionContext().GetStripId()).HandleMsg(msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void State::HandleMsg(RearrangeStripMessage& msg) {
|
||||||
|
if (m_Strips.size() <= msg.GetActionContext().GetStripId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Strips.at(msg.GetActionContext().GetStripId()).HandleMsg(msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void State::HandleMsg(UpdateActionMessage& msg) {
|
||||||
|
if (m_Strips.size() <= msg.GetActionContext().GetStripId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Strips.at(msg.GetActionContext().GetStripId()).HandleMsg(msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void State::HandleMsg(RemoveStripMessage& msg) {
|
||||||
|
if (m_Strips.size() <= msg.GetActionContext().GetStripId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Strips.at(msg.GetActionContext().GetStripId()).HandleMsg(msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void State::HandleMsg(SplitStripMessage& msg) {
|
||||||
|
if (msg.GetTransferredActions().empty()) {
|
||||||
|
if (m_Strips.size() <= msg.GetSourceActionContext().GetStripId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Strips.at(msg.GetSourceActionContext().GetStripId()).HandleMsg(msg);
|
||||||
|
} else {
|
||||||
|
if (m_Strips.size() <= msg.GetDestinationActionContext().GetStripId()) {
|
||||||
|
m_Strips.resize(msg.GetDestinationActionContext().GetStripId() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Strips.at(msg.GetDestinationActionContext().GetStripId()).HandleMsg(msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void State::HandleMsg(MergeStripsMessage& msg) {
|
||||||
|
if (msg.GetMigratedActions().empty()) {
|
||||||
|
if (m_Strips.size() <= msg.GetSourceActionContext().GetStripId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Strips.at(msg.GetSourceActionContext().GetStripId()).HandleMsg(msg);
|
||||||
|
} else {
|
||||||
|
if (m_Strips.size() <= msg.GetDestinationActionContext().GetStripId()) {
|
||||||
|
m_Strips.resize(msg.GetDestinationActionContext().GetStripId() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Strips.at(msg.GetDestinationActionContext().GetStripId()).HandleMsg(msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void State::HandleMsg(MigrateActionsMessage& msg) {
|
||||||
|
if (msg.GetMigratedActions().empty()) {
|
||||||
|
if (m_Strips.size() <= msg.GetSourceActionContext().GetStripId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Strips.at(msg.GetSourceActionContext().GetStripId()).HandleMsg(msg);
|
||||||
|
} else {
|
||||||
|
if (m_Strips.size() <= msg.GetDestinationActionContext().GetStripId()) {
|
||||||
|
m_Strips.resize(msg.GetDestinationActionContext().GetStripId() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Strips.at(msg.GetDestinationActionContext().GetStripId()).HandleMsg(msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
bool State::IsEmpty() const {
|
||||||
|
for (auto& strip : m_Strips) {
|
||||||
|
if (!strip.IsEmpty()) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void State::SendBehaviorBlocksToClient(AMFArrayValue& args) const {
|
||||||
|
auto* strips = args.InsertArray("strips");
|
||||||
|
for (int32_t stripId = 0; stripId < m_Strips.size(); stripId++) {
|
||||||
|
auto& strip = m_Strips.at(stripId);
|
||||||
|
if (strip.IsEmpty()) continue;
|
||||||
|
|
||||||
|
auto* stripArgs = strips->PushArray();
|
||||||
|
stripArgs->Insert("id", static_cast<double>(stripId));
|
||||||
|
|
||||||
|
strip.SendBehaviorBlocksToClient(*stripArgs);
|
||||||
|
}
|
||||||
|
};
|
19
dGame/dPropertyBehaviors/State.h
Normal file
19
dGame/dPropertyBehaviors/State.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef __STATE__H__
|
||||||
|
#define __STATE__H__
|
||||||
|
|
||||||
|
#include "Strip.h"
|
||||||
|
|
||||||
|
class AMFArrayValue;
|
||||||
|
|
||||||
|
class State {
|
||||||
|
public:
|
||||||
|
template<typename Msg>
|
||||||
|
void HandleMsg(Msg& msg);
|
||||||
|
|
||||||
|
void SendBehaviorBlocksToClient(AMFArrayValue& args) const;
|
||||||
|
bool IsEmpty() const;
|
||||||
|
private:
|
||||||
|
std::vector<Strip> m_Strips;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //!__STATE__H__
|
87
dGame/dPropertyBehaviors/Strip.cpp
Normal file
87
dGame/dPropertyBehaviors/Strip.cpp
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
#include "Strip.h"
|
||||||
|
|
||||||
|
#include "Amf3.h"
|
||||||
|
#include "ControlBehaviorMsgs.h"
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Strip::HandleMsg(AddStripMessage& msg) {
|
||||||
|
m_Actions = msg.GetActionsToAdd();
|
||||||
|
m_Position = msg.GetPosition();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Strip::HandleMsg(AddActionMessage& msg) {
|
||||||
|
if (msg.GetActionIndex() == -1) return;
|
||||||
|
|
||||||
|
m_Actions.insert(m_Actions.begin() + msg.GetActionIndex(), msg.GetAction());
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Strip::HandleMsg(UpdateStripUiMessage& msg) {
|
||||||
|
m_Position = msg.GetPosition();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Strip::HandleMsg(RemoveStripMessage& msg) {
|
||||||
|
m_Actions.clear();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Strip::HandleMsg(RemoveActionsMessage& msg) {
|
||||||
|
if (msg.GetActionIndex() >= m_Actions.size()) return;
|
||||||
|
m_Actions.erase(m_Actions.begin() + msg.GetActionIndex(), m_Actions.end());
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Strip::HandleMsg(UpdateActionMessage& msg) {
|
||||||
|
if (msg.GetActionIndex() >= m_Actions.size()) return;
|
||||||
|
m_Actions.at(msg.GetActionIndex()) = msg.GetAction();
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Strip::HandleMsg(RearrangeStripMessage& msg) {
|
||||||
|
if (msg.GetDstActionIndex() >= m_Actions.size() || msg.GetSrcActionIndex() >= m_Actions.size() || msg.GetSrcActionIndex() <= msg.GetDstActionIndex()) return;
|
||||||
|
std::rotate(m_Actions.begin() + msg.GetDstActionIndex(), m_Actions.begin() + msg.GetSrcActionIndex(), m_Actions.end());
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Strip::HandleMsg(SplitStripMessage& msg) {
|
||||||
|
if (msg.GetTransferredActions().empty() && !m_Actions.empty()) {
|
||||||
|
auto startToMove = m_Actions.begin() + msg.GetSrcActionIndex();
|
||||||
|
msg.SetTransferredActions(startToMove, m_Actions.end());
|
||||||
|
m_Actions.erase(startToMove, m_Actions.end());
|
||||||
|
} else {
|
||||||
|
m_Actions = msg.GetTransferredActions();
|
||||||
|
m_Position = msg.GetPosition();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Strip::HandleMsg(MergeStripsMessage& msg) {
|
||||||
|
if (msg.GetMigratedActions().empty() && !m_Actions.empty()) {
|
||||||
|
msg.SetMigratedActions(m_Actions.begin(), m_Actions.end());
|
||||||
|
m_Actions.erase(m_Actions.begin(), m_Actions.end());
|
||||||
|
} else {
|
||||||
|
m_Actions.insert(m_Actions.begin() + msg.GetDstActionIndex(), msg.GetMigratedActions().begin(), msg.GetMigratedActions().end());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Strip::HandleMsg(MigrateActionsMessage& msg) {
|
||||||
|
if (msg.GetMigratedActions().empty() && !m_Actions.empty()) {
|
||||||
|
auto startToMove = m_Actions.begin() + msg.GetSrcActionIndex();
|
||||||
|
msg.SetMigratedActions(startToMove, m_Actions.end());
|
||||||
|
m_Actions.erase(startToMove, m_Actions.end());
|
||||||
|
} else {
|
||||||
|
m_Actions.insert(m_Actions.begin() + msg.GetDstActionIndex(), msg.GetMigratedActions().begin(), msg.GetMigratedActions().end());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void Strip::SendBehaviorBlocksToClient(AMFArrayValue& args) const {
|
||||||
|
m_Position.SendBehaviorBlocksToClient(args);
|
||||||
|
|
||||||
|
auto* actions = args.InsertArray("actions");
|
||||||
|
for (auto& action : m_Actions) {
|
||||||
|
action.SendBehaviorBlocksToClient(*actions);
|
||||||
|
}
|
||||||
|
};
|
23
dGame/dPropertyBehaviors/Strip.h
Normal file
23
dGame/dPropertyBehaviors/Strip.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef __STRIP__H__
|
||||||
|
#define __STRIP__H__
|
||||||
|
|
||||||
|
#include "Action.h"
|
||||||
|
#include "StripUiPosition.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class AMFArrayValue;
|
||||||
|
|
||||||
|
class Strip {
|
||||||
|
public:
|
||||||
|
template<typename Msg>
|
||||||
|
void HandleMsg(Msg& msg);
|
||||||
|
|
||||||
|
void SendBehaviorBlocksToClient(AMFArrayValue& args) const;
|
||||||
|
bool IsEmpty() const { return m_Actions.empty(); }
|
||||||
|
private:
|
||||||
|
std::vector<Action> m_Actions;
|
||||||
|
StripUiPosition m_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //!__STRIP__H__
|
@ -5,4 +5,10 @@ set(DGAME_DUTILITIES_SOURCES "BrickDatabase.cpp"
|
|||||||
"Mail.cpp"
|
"Mail.cpp"
|
||||||
"Preconditions.cpp"
|
"Preconditions.cpp"
|
||||||
"SlashCommandHandler.cpp"
|
"SlashCommandHandler.cpp"
|
||||||
"VanityUtilities.cpp" PARENT_SCOPE)
|
"VanityUtilities.cpp")
|
||||||
|
|
||||||
|
add_library(dUtilities STATIC ${DGAME_DUTILITIES_SOURCES})
|
||||||
|
target_precompile_headers(dUtilities REUSE_FROM dGameBase)
|
||||||
|
target_link_libraries(dUtilities
|
||||||
|
PUBLIC dDatabase dPhysics
|
||||||
|
INTERFACE dZoneManager)
|
||||||
|
@ -294,21 +294,20 @@ void VanityUtilities::ParseXML(const std::string& file) {
|
|||||||
auto* partyPhrases = npcs->FirstChildElement("partyphrases");
|
auto* partyPhrases = npcs->FirstChildElement("partyphrases");
|
||||||
|
|
||||||
if (partyPhrases == nullptr) {
|
if (partyPhrases == nullptr) {
|
||||||
LOG("Failed to parse party phrases");
|
LOG("No party phrases found");
|
||||||
return;
|
} else {
|
||||||
}
|
for (auto* phrase = partyPhrases->FirstChildElement("phrase"); phrase != nullptr;
|
||||||
|
phrase = phrase->NextSiblingElement("phrase")) {
|
||||||
for (auto* phrase = partyPhrases->FirstChildElement("phrase"); phrase != nullptr;
|
// Get the phrase
|
||||||
phrase = phrase->NextSiblingElement("phrase")) {
|
auto* text = phrase->GetText();
|
||||||
// Get the phrase
|
|
||||||
auto* text = phrase->GetText();
|
if (text == nullptr) {
|
||||||
|
LOG("Failed to parse party phrase");
|
||||||
if (text == nullptr) {
|
continue;
|
||||||
LOG("Failed to parse party phrase");
|
}
|
||||||
continue;
|
|
||||||
|
m_PartyPhrases.push_back(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_PartyPhrases.push_back(text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto* npc = npcs->FirstChildElement("npc"); npc != nullptr; npc = npc->NextSiblingElement("npc")) {
|
for (auto* npc = npcs->FirstChildElement("npc"); npc != nullptr; npc = npc->NextSiblingElement("npc")) {
|
||||||
|
@ -134,7 +134,7 @@ void InstanceManager::RemoveInstance(Instance* instance) {
|
|||||||
if (m_Instances[i] == instance) {
|
if (m_Instances[i] == instance) {
|
||||||
instance->SetShutdownComplete(true);
|
instance->SetShutdownComplete(true);
|
||||||
|
|
||||||
if (!Game::shouldShutdown) RedirectPendingRequests(instance);
|
if (!Game::ShouldShutdown()) RedirectPendingRequests(instance);
|
||||||
|
|
||||||
delete m_Instances[i];
|
delete m_Instances[i];
|
||||||
|
|
||||||
|
@ -47,12 +47,13 @@ namespace Game {
|
|||||||
InstanceManager* im = nullptr;
|
InstanceManager* im = nullptr;
|
||||||
dConfig* config = nullptr;
|
dConfig* config = nullptr;
|
||||||
AssetManager* assetManager = nullptr;
|
AssetManager* assetManager = nullptr;
|
||||||
bool shouldShutdown = false;
|
Game::signal_t lastSignal = 0;
|
||||||
|
bool universeShutdownRequested = false;
|
||||||
std::mt19937 randomEngine;
|
std::mt19937 randomEngine;
|
||||||
} //namespace Game
|
} //namespace Game
|
||||||
|
|
||||||
bool shutdownSequenceStarted = false;
|
bool shutdownSequenceStarted = false;
|
||||||
void ShutdownSequence(int32_t signal = -1);
|
int ShutdownSequence(int32_t signal = -1);
|
||||||
int32_t FinalizeShutdown(int32_t signal = -1);
|
int32_t FinalizeShutdown(int32_t signal = -1);
|
||||||
Logger* SetupLogger();
|
Logger* SetupLogger();
|
||||||
void HandlePacket(Packet* packet);
|
void HandlePacket(Packet* packet);
|
||||||
@ -73,8 +74,8 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
//Triggers the shutdown sequence at application exit
|
//Triggers the shutdown sequence at application exit
|
||||||
std::atexit([]() { ShutdownSequence(); });
|
std::atexit([]() { ShutdownSequence(); });
|
||||||
signal(SIGINT, [](int32_t signal) { ShutdownSequence(EXIT_FAILURE); });
|
std::signal(SIGINT, Game::OnSignal);
|
||||||
signal(SIGTERM, [](int32_t signal) { ShutdownSequence(EXIT_FAILURE); });
|
std::signal(SIGTERM, Game::OnSignal);
|
||||||
|
|
||||||
//Create all the objects we need to run our service:
|
//Create all the objects we need to run our service:
|
||||||
Game::logger = SetupLogger();
|
Game::logger = SetupLogger();
|
||||||
@ -149,31 +150,40 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MigrationRunner::RunMigrations();
|
MigrationRunner::RunMigrations();
|
||||||
|
const auto resServerPath = BinaryPathFinder::GetBinaryDir() / "resServer";
|
||||||
const bool cdServerExists = std::filesystem::exists(BinaryPathFinder::GetBinaryDir() / "resServer" / "CDServer.sqlite");
|
const bool cdServerExists = std::filesystem::exists(resServerPath / "CDServer.sqlite");
|
||||||
const bool oldCDServerExists = std::filesystem::exists(Game::assetManager->GetResPath() / "CDServer.sqlite");
|
const bool oldCDServerExists = std::filesystem::exists(Game::assetManager->GetResPath() / "CDServer.sqlite");
|
||||||
const bool fdbExists = std::filesystem::exists(Game::assetManager->GetResPath() / "cdclient.fdb");
|
const bool fdbExists = std::filesystem::exists(Game::assetManager->GetResPath() / "cdclient.fdb");
|
||||||
|
const bool resServerPathExists = std::filesystem::is_directory(resServerPath);
|
||||||
|
|
||||||
|
if (!resServerPathExists) {
|
||||||
|
LOG("%s does not exist, creating it.", (resServerPath).c_str());
|
||||||
|
if(!std::filesystem::create_directories(resServerPath)){
|
||||||
|
LOG("Failed to create %s", (resServerPath).string().c_str());
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!cdServerExists) {
|
if (!cdServerExists) {
|
||||||
if (oldCDServerExists) {
|
if (oldCDServerExists) {
|
||||||
// If the file doesn't exist in the new CDServer location, copy it there. We copy because we may not have write permissions from the previous directory.
|
// If the file doesn't exist in the new CDServer location, copy it there. We copy because we may not have write permissions from the previous directory.
|
||||||
LOG("CDServer.sqlite is not located at resServer, but is located at res path. Copying file...");
|
LOG("CDServer.sqlite is not located at resServer, but is located at res path. Copying file...");
|
||||||
std::filesystem::copy_file(Game::assetManager->GetResPath() / "CDServer.sqlite", BinaryPathFinder::GetBinaryDir() / "resServer" / "CDServer.sqlite");
|
std::filesystem::copy_file(Game::assetManager->GetResPath() / "CDServer.sqlite", resServerPath / "CDServer.sqlite");
|
||||||
} else {
|
} else {
|
||||||
LOG("%s could not be found in resServer or res. Looking for %s to convert to sqlite.",
|
LOG("%s could not be found in resServer or res. Looking for %s to convert to sqlite.",
|
||||||
(BinaryPathFinder::GetBinaryDir() / "resServer" / "CDServer.sqlite").c_str(),
|
(resServerPath / "CDServer.sqlite").string().c_str(),
|
||||||
(Game::assetManager->GetResPath() / "cdclient.fdb").c_str());
|
(Game::assetManager->GetResPath() / "cdclient.fdb").string().c_str());
|
||||||
|
|
||||||
auto cdclientStream = Game::assetManager->GetFile("cdclient.fdb");
|
auto cdclientStream = Game::assetManager->GetFile("cdclient.fdb");
|
||||||
if (!cdclientStream) {
|
if (!cdclientStream) {
|
||||||
LOG("Failed to load %s", (Game::assetManager->GetResPath() / "cdclient.fdb").c_str());
|
LOG("Failed to load %s", (Game::assetManager->GetResPath() / "cdclient.fdb").string().c_str());
|
||||||
throw std::runtime_error("Aborting initialization due to missing cdclient.fdb.");
|
throw std::runtime_error("Aborting initialization due to missing cdclient.fdb.");
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG("Found %s. Converting to SQLite", (Game::assetManager->GetResPath() / "cdclient.fdb").c_str());
|
LOG("Found %s. Converting to SQLite", (Game::assetManager->GetResPath() / "cdclient.fdb").string().c_str());
|
||||||
Game::logger->Flush();
|
Game::logger->Flush();
|
||||||
|
|
||||||
if (FdbToSqlite::Convert((BinaryPathFinder::GetBinaryDir() / "resServer").string()).ConvertDatabase(cdclientStream) == false) {
|
if (FdbToSqlite::Convert(resServerPath.string()).ConvertDatabase(cdclientStream) == false) {
|
||||||
LOG("Failed to convert fdb to sqlite.");
|
LOG("Failed to convert fdb to sqlite.");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
@ -284,9 +294,9 @@ int main(int argc, char** argv) {
|
|||||||
uint32_t maxClients = 999;
|
uint32_t maxClients = 999;
|
||||||
uint32_t ourPort = 1000;
|
uint32_t ourPort = 1000;
|
||||||
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
|
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
|
||||||
if (Game::config->GetValue("port") != "") ourPort = std::stoi(Game::config->GetValue("port"));
|
if (Game::config->GetValue("master_server_port") != "") ourPort = std::stoi(Game::config->GetValue("master_server_port"));
|
||||||
|
|
||||||
Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, true, false, Game::logger, "", 0, ServerType::Master, Game::config, &Game::shouldShutdown);
|
Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, true, false, Game::logger, "", 0, ServerType::Master, Game::config, &Game::lastSignal);
|
||||||
|
|
||||||
//Query for the database for a server labeled "master"
|
//Query for the database for a server labeled "master"
|
||||||
|
|
||||||
@ -321,7 +331,8 @@ int main(int argc, char** argv) {
|
|||||||
uint32_t framesSinceLastSQLPing = 0;
|
uint32_t framesSinceLastSQLPing = 0;
|
||||||
uint32_t framesSinceKillUniverseCommand = 0;
|
uint32_t framesSinceKillUniverseCommand = 0;
|
||||||
|
|
||||||
while (true) {
|
Game::logger->Flush();
|
||||||
|
while (!Game::ShouldShutdown()) {
|
||||||
//In world we'd update our other systems here.
|
//In world we'd update our other systems here.
|
||||||
|
|
||||||
//Check for packets here:
|
//Check for packets here:
|
||||||
@ -355,10 +366,10 @@ int main(int argc, char** argv) {
|
|||||||
framesSinceLastSQLPing++;
|
framesSinceLastSQLPing++;
|
||||||
|
|
||||||
//10m shutdown for universe kill command
|
//10m shutdown for universe kill command
|
||||||
if (Game::shouldShutdown) {
|
if (Game::universeShutdownRequested) {
|
||||||
if (framesSinceKillUniverseCommand >= shutdownUniverseTime) {
|
if (framesSinceKillUniverseCommand >= shutdownUniverseTime) {
|
||||||
//Break main loop and exit
|
//Break main loop and exit
|
||||||
break;
|
Game::lastSignal = -1;
|
||||||
} else
|
} else
|
||||||
framesSinceKillUniverseCommand++;
|
framesSinceKillUniverseCommand++;
|
||||||
}
|
}
|
||||||
@ -402,7 +413,7 @@ int main(int argc, char** argv) {
|
|||||||
t += std::chrono::milliseconds(masterFrameDelta);
|
t += std::chrono::milliseconds(masterFrameDelta);
|
||||||
std::this_thread::sleep_until(t);
|
std::this_thread::sleep_until(t);
|
||||||
}
|
}
|
||||||
return FinalizeShutdown(EXIT_SUCCESS);
|
return ShutdownSequence(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger* SetupLogger() {
|
Logger* SetupLogger() {
|
||||||
@ -799,7 +810,7 @@ void HandlePacket(Packet* packet) {
|
|||||||
|
|
||||||
case eMasterMessageType::SHUTDOWN_UNIVERSE: {
|
case eMasterMessageType::SHUTDOWN_UNIVERSE: {
|
||||||
LOG("Received shutdown universe command, shutting down in 10 minutes.");
|
LOG("Received shutdown universe command, shutting down in 10 minutes.");
|
||||||
Game::shouldShutdown = true;
|
Game::universeShutdownRequested = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,9 +820,12 @@ void HandlePacket(Packet* packet) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShutdownSequence(int32_t signal) {
|
int ShutdownSequence(int32_t signal) {
|
||||||
|
if (!Game::logger) return -1;
|
||||||
|
LOG("Recieved Signal %d", signal);
|
||||||
if (shutdownSequenceStarted) {
|
if (shutdownSequenceStarted) {
|
||||||
return;
|
LOG("Duplicate Shutdown Sequence");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Game::im) {
|
if (!Game::im) {
|
||||||
@ -820,7 +834,7 @@ void ShutdownSequence(int32_t signal) {
|
|||||||
|
|
||||||
Game::im->SetIsShuttingDown(true);
|
Game::im->SetIsShuttingDown(true);
|
||||||
shutdownSequenceStarted = true;
|
shutdownSequenceStarted = true;
|
||||||
Game::shouldShutdown = true;
|
Game::lastSignal = -1;
|
||||||
|
|
||||||
{
|
{
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
@ -889,16 +903,20 @@ void ShutdownSequence(int32_t signal) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FinalizeShutdown(signal);
|
return FinalizeShutdown(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t FinalizeShutdown(int32_t signal) {
|
int32_t FinalizeShutdown(int32_t signal) {
|
||||||
//Delete our objects here:
|
//Delete our objects here:
|
||||||
Database::Destroy("MasterServer");
|
Database::Destroy("MasterServer");
|
||||||
if (Game::config) delete Game::config;
|
if (Game::config) delete Game::config;
|
||||||
|
Game::config = nullptr;
|
||||||
if (Game::im) delete Game::im;
|
if (Game::im) delete Game::im;
|
||||||
|
Game::im = nullptr;
|
||||||
if (Game::server) delete Game::server;
|
if (Game::server) delete Game::server;
|
||||||
|
Game::server = nullptr;
|
||||||
if (Game::logger) delete Game::logger;
|
if (Game::logger) delete Game::logger;
|
||||||
|
Game::logger = nullptr;
|
||||||
|
|
||||||
if (signal != EXIT_SUCCESS) exit(signal);
|
if (signal != EXIT_SUCCESS) exit(signal);
|
||||||
return signal;
|
return signal;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "BinaryPathFinder.h"
|
#include "BinaryPathFinder.h"
|
||||||
|
|
||||||
void StartChatServer() {
|
void StartChatServer() {
|
||||||
if (Game::shouldShutdown) {
|
if (Game::ShouldShutdown()) {
|
||||||
LOG("Currently shutting down. Chat will not be restarted.");
|
LOG("Currently shutting down. Chat will not be restarted.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -24,7 +24,7 @@ void StartChatServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StartAuthServer() {
|
void StartAuthServer() {
|
||||||
if (Game::shouldShutdown) {
|
if (Game::ShouldShutdown()) {
|
||||||
LOG("Currently shutting down. Auth will not be restarted.");
|
LOG("Currently shutting down. Auth will not be restarted.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,9 @@ void AuthPackets::SendHandshake(dServer* server, const SystemAddress& sysAddr, c
|
|||||||
RakNet::BitStream bitStream;
|
RakNet::BitStream bitStream;
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::SERVER, eServerMessageType::VERSION_CONFIRM);
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::SERVER, eServerMessageType::VERSION_CONFIRM);
|
||||||
uint32_t netVersion;
|
uint32_t netVersion;
|
||||||
if (!GeneralUtils::TryParse(Game::config->GetValue("client_net_version"), netVersion)) {
|
const std::string& expectedVersion = Game::config->GetValue("client_net_version");
|
||||||
|
LOG("Expected Version: '%s'", expectedVersion.c_str());
|
||||||
|
if (!GeneralUtils::TryParse(expectedVersion, netVersion)) {
|
||||||
LOG("Failed to parse client_net_version. Cannot authenticate to %s:%i", nextServerIP.c_str(), nextServerPort);
|
LOG("Failed to parse client_net_version. Cannot authenticate to %s:%i", nextServerIP.c_str(), nextServerPort);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -8,4 +8,10 @@ set(DNET_SOURCES "AuthPackets.cpp"
|
|||||||
"ZoneInstanceManager.cpp")
|
"ZoneInstanceManager.cpp")
|
||||||
|
|
||||||
add_library(dNet STATIC ${DNET_SOURCES})
|
add_library(dNet STATIC ${DNET_SOURCES})
|
||||||
target_link_libraries(dNet dCommon dDatabase)
|
target_include_directories(dNet PRIVATE
|
||||||
|
${PROJECT_SOURCE_DIR}/dGame/dComponents
|
||||||
|
${PROJECT_SOURCE_DIR}/dScripts # transitive through components
|
||||||
|
)
|
||||||
|
target_link_libraries(dNet
|
||||||
|
PUBLIC dCommon dDatabase
|
||||||
|
INTERFACE dZoneManager)
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
}
|
}
|
||||||
} ReceiveDownloadCompleteCB;
|
} ReceiveDownloadCompleteCB;
|
||||||
|
|
||||||
dServer::dServer(const std::string& ip, int port, int instanceID, int maxConnections, bool isInternal, bool useEncryption, Logger* logger, const std::string masterIP, int masterPort, ServerType serverType, dConfig* config, bool* shouldShutdown, unsigned int zoneID) {
|
dServer::dServer(const std::string& ip, int port, int instanceID, int maxConnections, bool isInternal, bool useEncryption, Logger* logger, const std::string masterIP, int masterPort, ServerType serverType, dConfig* config, Game::signal_t* lastSignal, unsigned int zoneID) {
|
||||||
mIP = ip;
|
mIP = ip;
|
||||||
mPort = port;
|
mPort = port;
|
||||||
mZoneID = zoneID;
|
mZoneID = zoneID;
|
||||||
@ -55,7 +55,7 @@ dServer::dServer(const std::string& ip, int port, int instanceID, int maxConnect
|
|||||||
mReplicaManager = nullptr;
|
mReplicaManager = nullptr;
|
||||||
mServerType = serverType;
|
mServerType = serverType;
|
||||||
mConfig = config;
|
mConfig = config;
|
||||||
mShouldShutdown = shouldShutdown;
|
mShouldShutdown = lastSignal;
|
||||||
//Attempt to start our server here:
|
//Attempt to start our server here:
|
||||||
mIsOkay = Startup();
|
mIsOkay = Startup();
|
||||||
|
|
||||||
@ -75,7 +75,9 @@ dServer::dServer(const std::string& ip, int port, int instanceID, int maxConnect
|
|||||||
//Connect to master if we are not master:
|
//Connect to master if we are not master:
|
||||||
if (serverType != ServerType::Master) {
|
if (serverType != ServerType::Master) {
|
||||||
SetupForMasterConnection();
|
SetupForMasterConnection();
|
||||||
ConnectToMaster();
|
if (!ConnectToMaster()) {
|
||||||
|
LOG("Failed ConnectToMaster!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set up Replica if we're a world server:
|
//Set up Replica if we're a world server:
|
||||||
@ -129,7 +131,7 @@ Packet* dServer::ReceiveFromMaster() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eMasterMessageType::SHUTDOWN:
|
case eMasterMessageType::SHUTDOWN:
|
||||||
*mShouldShutdown = true;
|
*mShouldShutdown = -2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//When we handle these packets in World instead dServer, we just return the packet's pointer.
|
//When we handle these packets in World instead dServer, we just return the packet's pointer.
|
||||||
@ -236,10 +238,12 @@ void dServer::Shutdown() {
|
|||||||
void dServer::SetupForMasterConnection() {
|
void dServer::SetupForMasterConnection() {
|
||||||
mMasterSocketDescriptor = SocketDescriptor(uint16_t(mPort + 1), 0);
|
mMasterSocketDescriptor = SocketDescriptor(uint16_t(mPort + 1), 0);
|
||||||
mMasterPeer = RakNetworkFactory::GetRakPeerInterface();
|
mMasterPeer = RakNetworkFactory::GetRakPeerInterface();
|
||||||
mMasterPeer->Startup(1, 30, &mMasterSocketDescriptor, 1);
|
bool ret = mMasterPeer->Startup(1, 30, &mMasterSocketDescriptor, 1);
|
||||||
|
if (!ret) LOG("Failed MasterPeer Startup!");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dServer::ConnectToMaster() {
|
bool dServer::ConnectToMaster() {
|
||||||
|
//LOG("Connection to Master %s:%d", mMasterIP.c_str(), mMasterPort);
|
||||||
return mMasterPeer->Connect(mMasterIP.c_str(), mMasterPort, "3.25 DARKFLAME1", 15);
|
return mMasterPeer->Connect(mMasterIP.c_str(), mMasterPort, "3.25 DARKFLAME1", 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <csignal>
|
||||||
#include "RakPeerInterface.h"
|
#include "RakPeerInterface.h"
|
||||||
#include "ReplicaManager.h"
|
#include "ReplicaManager.h"
|
||||||
#include "NetworkIDManager.h"
|
#include "NetworkIDManager.h"
|
||||||
@ -15,6 +16,10 @@ enum class ServerType : uint32_t {
|
|||||||
World
|
World
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace Game {
|
||||||
|
using signal_t = volatile std::sig_atomic_t;
|
||||||
|
}
|
||||||
|
|
||||||
class dServer {
|
class dServer {
|
||||||
public:
|
public:
|
||||||
// Default constructor should only used for testing!
|
// Default constructor should only used for testing!
|
||||||
@ -31,7 +36,7 @@ public:
|
|||||||
int masterPort,
|
int masterPort,
|
||||||
ServerType serverType,
|
ServerType serverType,
|
||||||
dConfig* config,
|
dConfig* config,
|
||||||
bool* shouldShutdown,
|
Game::signal_t* shouldShutdown,
|
||||||
unsigned int zoneID = 0);
|
unsigned int zoneID = 0);
|
||||||
~dServer();
|
~dServer();
|
||||||
|
|
||||||
@ -81,9 +86,9 @@ private:
|
|||||||
NetworkIDManager* mNetIDManager = nullptr;
|
NetworkIDManager* mNetIDManager = nullptr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not to shut down the server. Pointer to Game::shouldShutdown.
|
* Whether or not to shut down the server. Pointer to Game::lastSignal.
|
||||||
*/
|
*/
|
||||||
bool* mShouldShutdown = nullptr;
|
Game::signal_t* mShouldShutdown = nullptr;
|
||||||
SocketDescriptor mSocketDescriptor;
|
SocketDescriptor mSocketDescriptor;
|
||||||
std::string mIP;
|
std::string mIP;
|
||||||
int mPort;
|
int mPort;
|
||||||
|
@ -7,4 +7,6 @@ set(DPHYSICS_SOURCES "dpCollisionChecks.cpp"
|
|||||||
"dpWorld.cpp")
|
"dpWorld.cpp")
|
||||||
|
|
||||||
add_library(dPhysics STATIC ${DPHYSICS_SOURCES})
|
add_library(dPhysics STATIC ${DPHYSICS_SOURCES})
|
||||||
target_link_libraries(dPhysics Recast Detour)
|
target_link_libraries(dPhysics
|
||||||
|
PUBLIC Recast Detour
|
||||||
|
INTERFACE dNavigation)
|
||||||
|
@ -8,10 +8,6 @@ endforeach()
|
|||||||
|
|
||||||
add_subdirectory(Enemy)
|
add_subdirectory(Enemy)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Enemy/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(Equipment)
|
add_subdirectory(Equipment)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_EQUIPMENT})
|
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_EQUIPMENT})
|
||||||
@ -20,10 +16,6 @@ endforeach()
|
|||||||
|
|
||||||
add_subdirectory(Map)
|
add_subdirectory(Map)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Map/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(Minigame)
|
add_subdirectory(Minigame)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MINIGAME})
|
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MINIGAME})
|
||||||
@ -38,8 +30,15 @@ endforeach()
|
|||||||
|
|
||||||
add_subdirectory(Pets)
|
add_subdirectory(Pets)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_PETS})
|
add_library(dScriptsServer STATIC ${DSCRIPTS_SOURCES_02_SERVER})
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Pets/${file}")
|
target_include_directories(dScriptsServer PUBLIC "."
|
||||||
endforeach()
|
"DLU"
|
||||||
|
"Equipment"
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} PARENT_SCOPE)
|
"Minigame"
|
||||||
|
"Minigame/General"
|
||||||
|
"Objects"
|
||||||
|
"Pets")
|
||||||
|
target_link_libraries(dScriptsServer INTERFACE
|
||||||
|
dScriptsServerEnemy
|
||||||
|
dScriptsServerMap)
|
||||||
|
target_precompile_headers(dScriptsServer REUSE_FROM dScriptsBase)
|
||||||
|
@ -42,4 +42,15 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY_WAVES})
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} "Waves/${file}")
|
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} "Waves/${file}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} PARENT_SCOPE)
|
add_library(dScriptsServerEnemy STATIC ${DSCRIPTS_SOURCES_02_SERVER_ENEMY})
|
||||||
|
target_link_libraries(dScriptsServerEnemy dScriptsBase)
|
||||||
|
target_include_directories(dScriptsServerEnemy PUBLIC "."
|
||||||
|
"AG"
|
||||||
|
"AM"
|
||||||
|
"FV"
|
||||||
|
"General"
|
||||||
|
"Survival"
|
||||||
|
"VE"
|
||||||
|
"Waves"
|
||||||
|
)
|
||||||
|
target_precompile_headers(dScriptsServerEnemy REUSE_FROM dScriptsBase)
|
||||||
|
@ -12,5 +12,8 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG
|
|||||||
"AgMonumentRaceGoal.cpp"
|
"AgMonumentRaceGoal.cpp"
|
||||||
"AgMonumentRaceCancel.cpp"
|
"AgMonumentRaceCancel.cpp"
|
||||||
"NpcCowboyServer.cpp"
|
"NpcCowboyServer.cpp"
|
||||||
"NpcPirateServer.cpp"
|
"NpcPirateServer.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsServerMapAG ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG})
|
||||||
|
target_include_directories(dScriptsServerMapAG PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsServerMapAG REUSE_FROM dScriptsBase)
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN
|
set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN
|
||||||
"ZoneAgSpiderQueen.cpp"
|
"ZoneAgSpiderQueen.cpp"
|
||||||
"SpiderBossTreasureChestServer.cpp"
|
"SpiderBossTreasureChestServer.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsServerMapAGSpiderQueen ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN})
|
||||||
|
target_include_directories(dScriptsServerMapAGSpiderQueen PUBLIC ".")
|
||||||
|
target_link_libraries(dScriptsServerMapAGSpiderQueen dScriptsServerMapProperty)
|
||||||
|
target_precompile_headers(dScriptsServerMapAGSpiderQueen REUSE_FROM dScriptsBase)
|
||||||
|
@ -15,5 +15,8 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AM
|
|||||||
"AmSkullkinDrillStand.cpp"
|
"AmSkullkinDrillStand.cpp"
|
||||||
"AmSkullkinTower.cpp"
|
"AmSkullkinTower.cpp"
|
||||||
"AmBlueX.cpp"
|
"AmBlueX.cpp"
|
||||||
"AmTeapotServer.cpp"
|
"AmTeapotServer.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsServerMapAM ${DSCRIPTS_SOURCES_02_SERVER_MAP_AM})
|
||||||
|
target_include_directories(dScriptsServerMapAM PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsServerMapAM REUSE_FROM dScriptsBase)
|
||||||
|
@ -1,81 +1,29 @@
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP)
|
|
||||||
|
|
||||||
add_subdirectory(AG)
|
add_subdirectory(AG)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "AG/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(AG_Spider_Queen)
|
add_subdirectory(AG_Spider_Queen)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "AG_Spider_Queen/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(AM)
|
add_subdirectory(AM)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_AM})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "AM/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(FV)
|
add_subdirectory(FV)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "FV/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(General)
|
add_subdirectory(General)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "General/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(GF)
|
add_subdirectory(GF)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_GF})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "GF/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(njhub)
|
add_subdirectory(njhub)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "njhub/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(NS)
|
add_subdirectory(NS)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "NS/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(NT)
|
add_subdirectory(NT)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NT})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "NT/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(PR)
|
add_subdirectory(PR)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_PR})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "PR/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(Property)
|
add_subdirectory(Property)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "Property/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(SS)
|
add_subdirectory(SS)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_SS})
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "SS/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(VE)
|
add_subdirectory(VE)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_VE})
|
add_library(dScriptsServerMap INTERFACE)
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "VE/${file}")
|
target_link_libraries(dScriptsServerMap INTERFACE
|
||||||
endforeach()
|
dScriptsServerMapAG
|
||||||
|
dScriptsServerMapAGSpiderQueen
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} PARENT_SCOPE)
|
dScriptsServerMapAM
|
||||||
|
dScriptsServerMapFV
|
||||||
|
dScriptsServerMapGeneral
|
||||||
|
dScriptsServerMapGF
|
||||||
|
dScriptsServerMapNJHub
|
||||||
|
dScriptsServerMapNS
|
||||||
|
dScriptsServerMapNT
|
||||||
|
dScriptsServerMapPR
|
||||||
|
dScriptsServerMapProperty
|
||||||
|
dScriptsServerMapSS
|
||||||
|
dScriptsServerMapVE)
|
||||||
|
@ -11,4 +11,6 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV_RACING})
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_FV ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV} "Racing/${file}")
|
set(DSCRIPTS_SOURCES_02_SERVER_MAP_FV ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV} "Racing/${file}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_FV ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV} PARENT_SCOPE)
|
add_library(dScriptsServerMapFV ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV})
|
||||||
|
target_include_directories(dScriptsServerMapFV PUBLIC "." "Racing")
|
||||||
|
target_precompile_headers(dScriptsServerMapFV REUSE_FROM dScriptsBase)
|
||||||
|
@ -2,5 +2,8 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_GF
|
|||||||
"GfTikiTorch.cpp"
|
"GfTikiTorch.cpp"
|
||||||
"GfCaptainsCannon.cpp"
|
"GfCaptainsCannon.cpp"
|
||||||
"MastTeleport.cpp"
|
"MastTeleport.cpp"
|
||||||
"SpawnLionServer.cpp"
|
"SpawnLionServer.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsServerMapGF ${DSCRIPTS_SOURCES_02_SERVER_MAP_GF})
|
||||||
|
target_include_directories(dScriptsServerMapGF PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsServerMapGF REUSE_FROM dScriptsBase)
|
||||||
|
@ -7,7 +7,6 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL
|
|||||||
"ForceVolumeServer.cpp"
|
"ForceVolumeServer.cpp"
|
||||||
"GrowingFlower.cpp"
|
"GrowingFlower.cpp"
|
||||||
"ImaginationBackpackHealServer.cpp"
|
"ImaginationBackpackHealServer.cpp"
|
||||||
"InvalidScript.cpp"
|
|
||||||
"MailBoxServer.cpp"
|
"MailBoxServer.cpp"
|
||||||
"NjRailSwitch.cpp"
|
"NjRailSwitch.cpp"
|
||||||
"PetDigServer.cpp"
|
"PetDigServer.cpp"
|
||||||
@ -28,4 +27,6 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL_NINJAGO})
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL} "Ninjago/${file}")
|
set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL} "Ninjago/${file}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL} PARENT_SCOPE)
|
add_library(dScriptsServerMapGeneral ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL})
|
||||||
|
target_include_directories(dScriptsServerMapGeneral PUBLIC "." "Ninjago")
|
||||||
|
target_precompile_headers(dScriptsServerMapGeneral REUSE_FROM dScriptsBase)
|
||||||
|
@ -10,4 +10,6 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS_WAVES})
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NS ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS} "Waves/${file}")
|
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NS ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS} "Waves/${file}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NS ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS} PARENT_SCOPE)
|
add_library(dScriptsServerMapNS ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS})
|
||||||
|
target_include_directories(dScriptsServerMapNS PUBLIC "." "Waves")
|
||||||
|
target_precompile_headers(dScriptsServerMapNS REUSE_FROM dScriptsBase)
|
||||||
|
@ -25,5 +25,8 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_NT
|
|||||||
"NtVentureSpeedPadServer.cpp"
|
"NtVentureSpeedPadServer.cpp"
|
||||||
"NtVentureCannonServer.cpp"
|
"NtVentureCannonServer.cpp"
|
||||||
"NtBcSubmitServer.cpp"
|
"NtBcSubmitServer.cpp"
|
||||||
"NtNaomiBreadcrumbServer.cpp"
|
"NtNaomiBreadcrumbServer.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsServerMapNT ${DSCRIPTS_SOURCES_02_SERVER_MAP_NT})
|
||||||
|
target_include_directories(dScriptsServerMapNT PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsServerMapNT REUSE_FROM dScriptsBase)
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PR
|
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PR
|
||||||
"HydrantBroken.cpp"
|
"HydrantBroken.cpp"
|
||||||
"PrSeagullFly.cpp"
|
"PrSeagullFly.cpp"
|
||||||
"SpawnGryphonServer.cpp"
|
"SpawnGryphonServer.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsServerMapPR ${DSCRIPTS_SOURCES_02_SERVER_MAP_PR})
|
||||||
|
target_include_directories(dScriptsServerMapPR PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsServerMapPR REUSE_FROM dScriptsBase)
|
||||||
|
@ -19,4 +19,9 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY_NS_MED})
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY} "NS_Med/${file}")
|
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY} "NS_Med/${file}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY} PARENT_SCOPE)
|
add_library(dScriptsServerMapProperty ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY})
|
||||||
|
target_precompile_headers(dScriptsServerMapProperty REUSE_FROM dScriptsBase)
|
||||||
|
target_include_directories(dScriptsServerMapProperty PUBLIC "."
|
||||||
|
"AG_Med"
|
||||||
|
"AG_Small"
|
||||||
|
"NS_Med")
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_SS
|
set(DSCRIPTS_SOURCES_02_SERVER_MAP_SS
|
||||||
"SsModularBuildServer.cpp"
|
"SsModularBuildServer.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsServerMapSS ${DSCRIPTS_SOURCES_02_SERVER_MAP_SS})
|
||||||
|
target_include_directories(dScriptsServerMapSS PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsServerMapSS REUSE_FROM dScriptsBase)
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_VE
|
set(DSCRIPTS_SOURCES_02_SERVER_MAP_VE
|
||||||
"VeMissionConsole.cpp"
|
"VeMissionConsole.cpp"
|
||||||
"VeEpsilonServer.cpp"
|
"VeEpsilonServer.cpp"
|
||||||
"VeBricksampleServer.cpp"
|
"VeBricksampleServer.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsServerMapVE ${DSCRIPTS_SOURCES_02_SERVER_MAP_VE})
|
||||||
|
target_include_directories(dScriptsServerMapVE PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsServerMapVE REUSE_FROM dScriptsBase)
|
||||||
|
@ -28,4 +28,11 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB_BOSS_INSTANCE})
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB} "boss_instance/${file}")
|
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB} "boss_instance/${file}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB} PARENT_SCOPE)
|
add_library(dScriptsServerMapNJHub ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB})
|
||||||
|
target_include_directories(dScriptsServerMapNJHub PUBLIC "." "boss_instance")
|
||||||
|
target_link_libraries(dScriptsServerMapNJHub
|
||||||
|
dScriptsServerPets
|
||||||
|
dScriptsServerMapAM
|
||||||
|
dScriptsServerMapGeneral
|
||||||
|
)
|
||||||
|
target_precompile_headers(dScriptsServerMapNJHub REUSE_FROM dScriptsBase)
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_PETS
|
set(DSCRIPTS_SOURCES_02_SERVER_PETS
|
||||||
"PetFromDigServer.cpp"
|
"PetFromDigServer.cpp"
|
||||||
"PetFromObjectServer.cpp"
|
"PetFromObjectServer.cpp"
|
||||||
"DamagingPets.cpp"
|
"DamagingPets.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsServerPets STATIC ${DSCRIPTS_SOURCES_02_SERVER_PETS})
|
||||||
|
target_include_directories(dScriptsServerPets PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsServerPets REUSE_FROM dScriptsBase)
|
||||||
|
|
||||||
|
@ -7,48 +7,44 @@ set(DSCRIPTS_SOURCES
|
|||||||
"BaseWavesGenericEnemy.cpp"
|
"BaseWavesGenericEnemy.cpp"
|
||||||
"BaseWavesServer.cpp"
|
"BaseWavesServer.cpp"
|
||||||
"ChooseYourDestinationNsToNt.cpp"
|
"ChooseYourDestinationNsToNt.cpp"
|
||||||
"CppScripts.cpp"
|
|
||||||
"Darkitect.cpp"
|
"Darkitect.cpp"
|
||||||
|
"InvalidScript.cpp"
|
||||||
"NPCAddRemoveItem.cpp"
|
"NPCAddRemoveItem.cpp"
|
||||||
"NtFactionSpyServer.cpp"
|
"NtFactionSpyServer.cpp"
|
||||||
"ScriptComponent.cpp"
|
"ScriptComponent.cpp"
|
||||||
"ScriptedPowerupSpawner.cpp"
|
"ScriptedPowerupSpawner.cpp"
|
||||||
"SpawnPetBaseServer.cpp")
|
"SpawnPetBaseServer.cpp")
|
||||||
|
|
||||||
|
link_libraries(dDatabase dPhysics)
|
||||||
|
|
||||||
|
add_library(dScriptsBase STATIC ${DSCRIPTS_SOURCES})
|
||||||
|
target_include_directories(dScriptsBase PUBLIC .)
|
||||||
|
target_link_libraries(dScriptsBase
|
||||||
|
INTERFACE dGameBase)
|
||||||
|
target_precompile_headers(dScriptsBase PRIVATE ${HEADERS_DGAME})
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${PROJECT_SOURCE_DIR}/dScripts
|
||||||
|
${PROJECT_SOURCE_DIR}/dGame
|
||||||
|
)
|
||||||
|
link_libraries(dScriptsBase)
|
||||||
|
# dComponents
|
||||||
|
|
||||||
add_subdirectory(02_server)
|
add_subdirectory(02_server)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER})
|
|
||||||
set(DSCRIPTS_SOURCES ${DSCRIPTS_SOURCES} "02_server/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(ai)
|
add_subdirectory(ai)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI})
|
|
||||||
set(DSCRIPTS_SOURCES ${DSCRIPTS_SOURCES} "ai/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(client)
|
add_subdirectory(client)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_CLIENT})
|
|
||||||
set(DSCRIPTS_SOURCES ${DSCRIPTS_SOURCES} "client/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(EquipmentScripts)
|
add_subdirectory(EquipmentScripts)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_EQUIPMENTSCRIPTS})
|
|
||||||
set(DSCRIPTS_SOURCES ${DSCRIPTS_SOURCES} "EquipmentScripts/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(EquipmentTriggers)
|
add_subdirectory(EquipmentTriggers)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_EQUIPMENTTRIGGERSSCRIPTS})
|
|
||||||
set(DSCRIPTS_SOURCES ${DSCRIPTS_SOURCES} "EquipmentTriggers/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(zone)
|
add_subdirectory(zone)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_ZONE})
|
add_library(dScripts STATIC "CppScripts.cpp")
|
||||||
set(DSCRIPTS_SOURCES ${DSCRIPTS_SOURCES} "zone/${file}")
|
target_precompile_headers(dScripts REUSE_FROM dScriptsBase)
|
||||||
endforeach()
|
target_include_directories(dScripts PUBLIC ".")
|
||||||
|
target_link_libraries(dScripts
|
||||||
set(DSCRIPTS_SOURCES ${DSCRIPTS_SOURCES} PARENT_SCOPE)
|
dScriptsBase
|
||||||
|
dScriptsServer
|
||||||
|
dScriptsAI
|
||||||
|
dScriptsClient
|
||||||
|
dScriptsEquipmentScripts
|
||||||
|
dScriptsEquipmentTriggers
|
||||||
|
dScriptsZone)
|
||||||
|
@ -6,5 +6,8 @@ set(DSCRIPTS_SOURCES_EQUIPMENTSCRIPTS
|
|||||||
"PersonalFortress.cpp"
|
"PersonalFortress.cpp"
|
||||||
"BuccaneerValiantShip.cpp"
|
"BuccaneerValiantShip.cpp"
|
||||||
"FireFirstSkillonStartup.cpp"
|
"FireFirstSkillonStartup.cpp"
|
||||||
"StunImmunity.cpp"
|
"StunImmunity.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsEquipmentScripts STATIC ${DSCRIPTS_SOURCES_EQUIPMENTSCRIPTS})
|
||||||
|
target_include_directories(dScriptsEquipmentScripts PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsEquipmentScripts REUSE_FROM dScriptsBase)
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
set(DSCRIPTS_SOURCES_EQUIPMENTTRIGGERSSCRIPTS
|
set(DSCRIPTS_SOURCES_EQUIPMENTTRIGGERSSCRIPTS
|
||||||
"CoilBackpackBase.cpp"
|
"CoilBackpackBase.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsEquipmentTriggers STATIC ${DSCRIPTS_SOURCES_EQUIPMENTTRIGGERSSCRIPTS})
|
||||||
|
target_include_directories(dScriptsEquipmentTriggers PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsEquipmentTriggers REUSE_FROM dScriptsBase)
|
||||||
|
@ -9,4 +9,6 @@ foreach(file ${DSCRIPTS_SOURCES_AI_ACT_FOOTRACE})
|
|||||||
set(DSCRIPTS_SOURCES_AI_ACT ${DSCRIPTS_SOURCES_AI_ACT} "FootRace/${file}")
|
set(DSCRIPTS_SOURCES_AI_ACT ${DSCRIPTS_SOURCES_AI_ACT} "FootRace/${file}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(DSCRIPTS_SOURCES_AI_ACT ${DSCRIPTS_SOURCES_AI_ACT} PARENT_SCOPE)
|
add_library(dScriptsAiAct STATIC ${DSCRIPTS_SOURCES_AI_ACT})
|
||||||
|
target_include_directories(dScriptsAiAct PUBLIC "." "FootRace")
|
||||||
|
target_precompile_headers(dScriptsAiAct REUSE_FROM dScriptsBase)
|
||||||
|
@ -14,5 +14,8 @@ set(DSCRIPTS_SOURCES_AI_AG
|
|||||||
"AgDarkSpiderling.cpp"
|
"AgDarkSpiderling.cpp"
|
||||||
"AgPicnicBlanket.cpp"
|
"AgPicnicBlanket.cpp"
|
||||||
"AgStagePlatforms.cpp"
|
"AgStagePlatforms.cpp"
|
||||||
"AgQbWall.cpp"
|
"AgQbWall.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsAiAG STATIC ${DSCRIPTS_SOURCES_AI_AG})
|
||||||
|
target_include_directories(dScriptsAiAG PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsAiAG REUSE_FROM dScriptsBase)
|
||||||
|
@ -1,81 +1,32 @@
|
|||||||
set(DSCRIPTS_SOURCES_AI)
|
set(DSCRIPTS_SOURCES_AI)
|
||||||
|
|
||||||
add_subdirectory(ACT)
|
add_subdirectory(ACT)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI_ACT})
|
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} "ACT/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(AG)
|
add_subdirectory(AG)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI_AG})
|
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} "AG/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(FV)
|
add_subdirectory(FV)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI_FV})
|
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} "FV/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(GENERAL)
|
add_subdirectory(GENERAL)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI_GENERAL})
|
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} "GENERAL/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(GF)
|
add_subdirectory(GF)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI_GF})
|
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} "GF/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(MINIGAME)
|
add_subdirectory(MINIGAME)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI_MINIGAME})
|
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} "MINIGAME/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(NP)
|
add_subdirectory(NP)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI_NP})
|
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} "NP/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(NS)
|
add_subdirectory(NS)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI_NS})
|
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} "NS/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(PETS)
|
add_subdirectory(PETS)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI_PETS})
|
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} "PETS/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(PROPERTY)
|
add_subdirectory(PROPERTY)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI_PROPERTY})
|
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} "PROPERTY/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(RACING)
|
add_subdirectory(RACING)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI_RACING})
|
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} "RACING/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(SPEC)
|
add_subdirectory(SPEC)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI_SPEC})
|
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} "SPEC/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_subdirectory(WILD)
|
add_subdirectory(WILD)
|
||||||
|
|
||||||
foreach(file ${DSCRIPTS_SOURCES_AI_WILD})
|
add_library(dScriptsAI INTERFACE)
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} "WILD/${file}")
|
target_link_libraries(dScriptsAI INTERFACE
|
||||||
endforeach()
|
dScriptsAiAct
|
||||||
|
dScriptsAiAG
|
||||||
set(DSCRIPTS_SOURCES_AI ${DSCRIPTS_SOURCES_AI} PARENT_SCOPE)
|
dScriptsAiFV
|
||||||
|
dScriptsAiGeneral
|
||||||
|
dScriptsAiGF
|
||||||
|
dScriptsAiMinigame
|
||||||
|
dScriptsAiNP
|
||||||
|
dScriptsAiNS
|
||||||
|
dScriptsAiPets
|
||||||
|
dScriptsAiProperty
|
||||||
|
dScriptsAiRacing
|
||||||
|
dScriptsAiSpec
|
||||||
|
dScriptsAiWild
|
||||||
|
)
|
||||||
|
@ -16,5 +16,9 @@ set(DSCRIPTS_SOURCES_AI_FV
|
|||||||
"FvPassThroughWall.cpp"
|
"FvPassThroughWall.cpp"
|
||||||
"FvBounceOverWall.cpp"
|
"FvBounceOverWall.cpp"
|
||||||
"FvMaelstromGeyser.cpp"
|
"FvMaelstromGeyser.cpp"
|
||||||
"TriggerGas.cpp"
|
"TriggerGas.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsAiFV STATIC ${DSCRIPTS_SOURCES_AI_FV})
|
||||||
|
target_include_directories(dScriptsAiFV PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsAiFV REUSE_FROM dScriptsBase)
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
set(DSCRIPTS_SOURCES_AI_GENERAL
|
set(DSCRIPTS_SOURCES_AI_GENERAL
|
||||||
"InstanceExitTransferPlayerToLastNonInstance.cpp"
|
"InstanceExitTransferPlayerToLastNonInstance.cpp"
|
||||||
"LegoDieRoll.cpp"
|
"LegoDieRoll.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsAiGeneral STATIC ${DSCRIPTS_SOURCES_AI_GENERAL})
|
||||||
|
target_include_directories(dScriptsAiGeneral PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsAiGeneral REUSE_FROM dScriptsBase)
|
||||||
|
|
||||||
|
@ -10,5 +10,8 @@ set(DSCRIPTS_SOURCES_AI_GF
|
|||||||
"GfArchway.cpp"
|
"GfArchway.cpp"
|
||||||
"GfMaelstromGeyser.cpp"
|
"GfMaelstromGeyser.cpp"
|
||||||
"PirateRep.cpp"
|
"PirateRep.cpp"
|
||||||
"GfParrotCrash.cpp"
|
"GfParrotCrash.cpp")
|
||||||
PARENT_SCOPE)
|
|
||||||
|
add_library(dScriptsAiGF STATIC ${DSCRIPTS_SOURCES_AI_GF})
|
||||||
|
target_include_directories(dScriptsAiGF PUBLIC ".")
|
||||||
|
target_precompile_headers(dScriptsAiGF REUSE_FROM dScriptsBase)
|
||||||
|
@ -12,4 +12,6 @@ foreach(file ${DSCRIPTS_SOURCES_AI_MINIGAME_OBJECTS})
|
|||||||
set(DSCRIPTS_SOURCES_AI_MINIGAME ${DSCRIPTS_SOURCES_AI_MINIGAME} "Objects/${file}")
|
set(DSCRIPTS_SOURCES_AI_MINIGAME ${DSCRIPTS_SOURCES_AI_MINIGAME} "Objects/${file}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(DSCRIPTS_SOURCES_AI_MINIGAME ${DSCRIPTS_SOURCES_AI_MINIGAME} PARENT_SCOPE)
|
add_library(dScriptsAiMinigame STATIC ${DSCRIPTS_SOURCES_AI_MINIGAME})
|
||||||
|
target_include_directories(dScriptsAiMinigame PUBLIC "." "Objects" "SG_GF" "SG_GF/SERVER")
|
||||||
|
target_precompile_headers(dScriptsAiMinigame REUSE_FROM dScriptsBase)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user