feat(Core/Modules): add separated lib for modules (#9281)
This commit is contained in:
@@ -7,6 +7,9 @@
|
|||||||
/modules/*
|
/modules/*
|
||||||
!/modules/*.md
|
!/modules/*.md
|
||||||
!/modules/*.sh
|
!/modules/*.sh
|
||||||
|
!/modules/CMakeLists.txt
|
||||||
|
!/modules/*.h
|
||||||
|
!/modules/*.cmake
|
||||||
/build*/
|
/build*/
|
||||||
/var/*
|
/var/*
|
||||||
!/var/build/.gitkeep
|
!/var/build/.gitkeep
|
||||||
|
|||||||
+5
-2
@@ -122,11 +122,11 @@ include(src/cmake/showoptions.cmake)
|
|||||||
|
|
||||||
add_subdirectory(deps)
|
add_subdirectory(deps)
|
||||||
|
|
||||||
if( SERVERS OR TOOLS)
|
if (SERVERS OR TOOLS)
|
||||||
add_subdirectory(src/common)
|
add_subdirectory(src/common)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( TOOLS )
|
if (TOOLS)
|
||||||
add_subdirectory(src/tools)
|
add_subdirectory(src/tools)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -139,6 +139,9 @@ CU_RUN_HOOK("BEFORE_SRC_LOAD")
|
|||||||
# add core sources
|
# add core sources
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
# add modules sources
|
||||||
|
add_subdirectory(modules)
|
||||||
|
|
||||||
CU_RUN_HOOK("AFTER_SRC_LOAD")
|
CU_RUN_HOOK("AFTER_SRC_LOAD")
|
||||||
|
|
||||||
if( BUILD_TESTING )
|
if( BUILD_TESTING )
|
||||||
|
|||||||
@@ -0,0 +1,378 @@
|
|||||||
|
#
|
||||||
|
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||||
|
#
|
||||||
|
# This file is free software; as a special exception the author gives
|
||||||
|
# unlimited permission to copy and/or distribute it, with or without
|
||||||
|
# modifications, as long as this notice is preserved.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
#
|
||||||
|
|
||||||
|
message("")
|
||||||
|
|
||||||
|
# Make the script module list available in the current scope
|
||||||
|
GetModuleSourceList(MODULES_MODULE_LIST)
|
||||||
|
|
||||||
|
# Make the native install offset available in this scope
|
||||||
|
GetInstallOffset(INSTALL_OFFSET)
|
||||||
|
|
||||||
|
# Sets the MODULES_${SOURCE_MODULE} variables
|
||||||
|
# when using predefined templates for script building
|
||||||
|
# like dynamic, static
|
||||||
|
# Sets MODULES_DEFAULT_LINKAGE
|
||||||
|
if(MODULES MATCHES "dynamic")
|
||||||
|
set(MODULES_DEFAULT_LINKAGE "dynamic")
|
||||||
|
elseif(MODULES MATCHES "static")
|
||||||
|
set(MODULES_DEFAULT_LINKAGE "static")
|
||||||
|
else()
|
||||||
|
set(MODULES_DEFAULT_LINKAGE "disabled")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Add support old api modules
|
||||||
|
CU_GET_GLOBAL("AC_ADD_SCRIPTS_LIST")
|
||||||
|
CU_GET_GLOBAL("AC_ADD_SCRIPTS_INCLUDE")
|
||||||
|
|
||||||
|
set("AC_SCRIPTS_INCLUDES" "")
|
||||||
|
set("AC_MODULE_LIST" "")
|
||||||
|
set("AC_SCRIPTS_LIST" "")
|
||||||
|
set(MOD_ELUNA_FOUND 0)
|
||||||
|
set(MOD_ELUNA_PATH "")
|
||||||
|
|
||||||
|
foreach(include ${AC_ADD_SCRIPTS_INCLUDE})
|
||||||
|
set("AC_SCRIPTS_INCLUDES" "#include \"${include}\"\n${AC_SCRIPTS_INCLUDES}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
foreach(void ${AC_ADD_SCRIPTS_LIST})
|
||||||
|
set("AC_MODULE_LIST" "void ${void};\n${AC_MODULE_LIST}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
foreach(scriptName ${AC_ADD_SCRIPTS_LIST})
|
||||||
|
set("AC_SCRIPTS_LIST" " ${scriptName};\n${AC_SCRIPTS_LIST}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
function(ConfigureElunaModule moduleName)
|
||||||
|
set(MOD_ELUNA_FOUND 1 PARENT_SCOPE)
|
||||||
|
GetPathToModuleSource(${SOURCE_MODULE} MODULE_SOURCE_PATH)
|
||||||
|
set(MOD_ELUNA_PATH ${MODULE_SOURCE_PATH} PARENT_SCOPE)
|
||||||
|
|
||||||
|
# Define eluna compile options
|
||||||
|
target_compile_options(game-interface
|
||||||
|
INTERFACE
|
||||||
|
-DAZEROTHCORE
|
||||||
|
-DWOTLK)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Set the MODULES_${SOURCE_MODULE} variables from the
|
||||||
|
# variables set above
|
||||||
|
foreach(SOURCE_MODULE ${MODULES_MODULE_LIST})
|
||||||
|
ModuleNameToVariable(${SOURCE_MODULE} MODULE_MODULE_VARIABLE)
|
||||||
|
|
||||||
|
if(${MODULE_MODULE_VARIABLE} STREQUAL "default")
|
||||||
|
set(${MODULE_MODULE_VARIABLE} ${MODULES_DEFAULT_LINKAGE})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Use only static for deprecated api loaders
|
||||||
|
if (AC_SCRIPTS_INCLUDES MATCHES "${SOURCE_MODULE}")
|
||||||
|
set(${MODULE_MODULE_VARIABLE} "static")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Use only static for mod-eluna-lua-engine
|
||||||
|
if (SOURCE_MODULE MATCHES "mod-eluna-lua-engine")
|
||||||
|
ConfigureElunaModule(${SOURCE_MODULE})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Build the Graph values
|
||||||
|
if(${MODULE_MODULE_VARIABLE} MATCHES "dynamic")
|
||||||
|
GetProjectNameOfModuleName(${SOURCE_MODULE} MODULE_SOURCE_PROJECT_NAME)
|
||||||
|
GetNativeSharedLibraryName(${MODULE_SOURCE_PROJECT_NAME} MODULE_PROJECT_LIBRARY)
|
||||||
|
list(APPEND MODULE_GRAPH_KEYS ${MODULE_SOURCE_PROJECT_NAME})
|
||||||
|
set(MODULE_GRAPH_VALUE_DISPLAY_${MODULE_SOURCE_PROJECT_NAME} ${MODULE_PROJECT_LIBRARY})
|
||||||
|
list(APPEND MODULE_GRAPH_VALUE_CONTAINS_MODULES_${MODULE_SOURCE_PROJECT_NAME} ${SOURCE_MODULE})
|
||||||
|
elseif(${MODULE_MODULE_VARIABLE} MATCHES "static")
|
||||||
|
list(APPEND MODULE_GRAPH_KEYS worldserver)
|
||||||
|
set(MODULE_GRAPH_VALUE_DISPLAY_worldserver worldserver)
|
||||||
|
list(APPEND MODULE_GRAPH_VALUE_CONTAINS_MODULES_worldserver ${SOURCE_MODULE})
|
||||||
|
else()
|
||||||
|
list(APPEND MODULE_GRAPH_KEYS disabled)
|
||||||
|
set(MODULE_GRAPH_VALUE_DISPLAY_disabled disabled)
|
||||||
|
list(APPEND MODULE_GRAPH_VALUE_CONTAINS_MODULES_disabled ${SOURCE_MODULE})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
list(SORT MODULE_GRAPH_KEYS)
|
||||||
|
list(REMOVE_DUPLICATES MODULE_GRAPH_KEYS)
|
||||||
|
|
||||||
|
# Display the module graph
|
||||||
|
message("* Modules configuration (${MODULES}):
|
||||||
|
|")
|
||||||
|
|
||||||
|
foreach(MODULE_GRAPH_KEY ${MODULE_GRAPH_KEYS})
|
||||||
|
if(NOT MODULE_GRAPH_KEY STREQUAL "disabled")
|
||||||
|
message(" +- ${MODULE_GRAPH_VALUE_DISPLAY_${MODULE_GRAPH_KEY}}")
|
||||||
|
else()
|
||||||
|
message(" | ${MODULE_GRAPH_VALUE_DISPLAY_${MODULE_GRAPH_KEY}}")
|
||||||
|
endif()
|
||||||
|
foreach(MODULE_GRAPH_PROJECT_ENTRY ${MODULE_GRAPH_VALUE_CONTAINS_MODULES_${MODULE_GRAPH_KEY}})
|
||||||
|
message(" | +- ${MODULE_GRAPH_PROJECT_ENTRY}")
|
||||||
|
endforeach()
|
||||||
|
message(" |")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
message("")
|
||||||
|
|
||||||
|
# Base sources which are used by every script project
|
||||||
|
if (USE_SCRIPTPCH)
|
||||||
|
set(PRIVATE_PCH_HEADER ModulesPCH.h)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
# Configures the scriptloader with the given name and stores the output in the LOADER_OUT variable.
|
||||||
|
# It is possible to expose multiple subdirectories from the same scriptloader through passing
|
||||||
|
# it to the variable arguments
|
||||||
|
function(ConfigureScriptLoader SCRIPTLOADER_NAME LOADER_OUT IS_DYNAMIC_SCRIPTLOADER)
|
||||||
|
# Deduces following variables which are referenced by thge template:
|
||||||
|
# ACORE_IS_DYNAMIC_SCRIPTLOADER
|
||||||
|
# ACORE_SCRIPTS_FORWARD_DECL
|
||||||
|
# ACORE_SCRIPTS_INVOKE
|
||||||
|
# ACORE_CURRENT_SCRIPT_PROJECT
|
||||||
|
|
||||||
|
# To generate export macros
|
||||||
|
set(ACORE_IS_DYNAMIC_SCRIPTLOADER ${IS_DYNAMIC_SCRIPTLOADER})
|
||||||
|
|
||||||
|
# To generate forward declarations of the loading functions
|
||||||
|
unset(ACORE_SCRIPTS_FORWARD_DECL)
|
||||||
|
unset(ACORE_SCRIPTS_INVOKE)
|
||||||
|
|
||||||
|
# The current script project which is built in
|
||||||
|
set(ACORE_CURRENT_SCRIPT_PROJECT ${SCRIPTLOADER_NAME})
|
||||||
|
|
||||||
|
foreach(LOCALE_SCRIPT_MODULE ${ARGN})
|
||||||
|
|
||||||
|
# Replace bad words
|
||||||
|
string(REGEX REPLACE - "_" LOCALE_SCRIPT_MODULE ${LOCALE_SCRIPT_MODULE})
|
||||||
|
|
||||||
|
# Determine the loader function ("Add##${NameOfDirectory}##Scripts()")
|
||||||
|
set(LOADER_FUNCTION
|
||||||
|
"Add${LOCALE_SCRIPT_MODULE}Scripts()")
|
||||||
|
|
||||||
|
# Generate the funciton call and the forward declarations
|
||||||
|
set(ACORE_SCRIPTS_FORWARD_DECL
|
||||||
|
"${ACORE_SCRIPTS_FORWARD_DECL}void ${LOADER_FUNCTION};\n")
|
||||||
|
|
||||||
|
set(ACORE_SCRIPTS_INVOKE
|
||||||
|
"${ACORE_SCRIPTS_INVOKE} ${LOADER_FUNCTION};\n")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(GENERATED_LOADER ${CMAKE_CURRENT_BINARY_DIR}/gen_scriptloader/${SCRIPTLOADER_NAME}/ModulesLoader.cpp)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ModulesLoader.cpp.in.cmake ${GENERATED_LOADER})
|
||||||
|
set(${LOADER_OUT} ${GENERATED_LOADER} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Generates the actual module projects
|
||||||
|
# Fills the STATIC_SCRIPT_MODULES and DYNAMIC_SCRIPT_MODULE_PROJECTS variables
|
||||||
|
# which contain the names which scripts are linked statically/dynamically and
|
||||||
|
# adds the sources of the static modules to the PRIVATE_SOURCES_MODULES variable.
|
||||||
|
foreach(SOURCE_MODULE ${MODULES_MODULE_LIST})
|
||||||
|
GetPathToModuleSource(${SOURCE_MODULE} MODULE_SOURCE_PATH)
|
||||||
|
ModuleNameToVariable(${SOURCE_MODULE} MODULE_MODULE_VARIABLE)
|
||||||
|
|
||||||
|
if(NOT (${MODULE_MODULE_VARIABLE} STREQUAL "disabled"))
|
||||||
|
list(APPEND MODULE_LIST__ ${SOURCE_MODULE})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if((${MODULE_MODULE_VARIABLE} STREQUAL "disabled") OR
|
||||||
|
(${MODULE_MODULE_VARIABLE} STREQUAL "static"))
|
||||||
|
|
||||||
|
# Uninstall disabled modules
|
||||||
|
GetProjectNameOfModuleName(${SOURCE_MODULE} MODULE_SOURCE_PROJECT_NAME)
|
||||||
|
GetNativeSharedLibraryName(${MODULE_SOURCE_PROJECT_NAME} SCRIPT_MODULE_OUTPUT_NAME)
|
||||||
|
list(APPEND DISABLED_SCRIPT_MODULE_PROJECTS ${INSTALL_OFFSET}/${SCRIPT_MODULE_OUTPUT_NAME})
|
||||||
|
if(${MODULE_MODULE_VARIABLE} STREQUAL "static")
|
||||||
|
|
||||||
|
# Add the module content to the whole static module
|
||||||
|
CollectSourceFiles(${MODULE_SOURCE_PATH} PRIVATE_SOURCES_MODULES)
|
||||||
|
CollectIncludeDirectories(${MODULE_SOURCE_PATH} PUBLIC_INCLUDES)
|
||||||
|
|
||||||
|
# Skip deprecated api loaders
|
||||||
|
if (AC_SCRIPTS_INCLUDES MATCHES "${SOURCE_MODULE}")
|
||||||
|
message("> Module (${SOURCE_MODULE}) using deprecated loader api")
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Add the module name to STATIC_SCRIPT_MODULES
|
||||||
|
list(APPEND STATIC_SCRIPT_MODULES ${SOURCE_MODULE})
|
||||||
|
|
||||||
|
endif()
|
||||||
|
elseif(${MODULE_MODULE_VARIABLE} STREQUAL "dynamic")
|
||||||
|
|
||||||
|
# Generate an own dynamic module which is loadable on runtime
|
||||||
|
# Add the module content to the whole static module
|
||||||
|
unset(MODULE_SOURCE_PRIVATE_SOURCES)
|
||||||
|
CollectSourceFiles(${MODULE_SOURCE_PATH} MODULE_SOURCE_PRIVATE_SOURCES)
|
||||||
|
CollectIncludeDirectories(${MODULE_SOURCE_PATH} PUBLIC_INCLUDES)
|
||||||
|
|
||||||
|
# Configure the scriptloader
|
||||||
|
ConfigureScriptLoader(${SOURCE_MODULE} SCRIPT_MODULE_PRIVATE_SCRIPTLOADER ON ${SOURCE_MODULE})
|
||||||
|
GetProjectNameOfModuleName(${SOURCE_MODULE} MODULE_SOURCE_PROJECT_NAME)
|
||||||
|
|
||||||
|
# Add the module name to DYNAMIC_SCRIPT_MODULES
|
||||||
|
list(APPEND DYNAMIC_SCRIPT_MODULE_PROJECTS ${MODULE_SOURCE_PROJECT_NAME})
|
||||||
|
|
||||||
|
# Create the script module project
|
||||||
|
add_library(${MODULE_SOURCE_PROJECT_NAME} SHARED
|
||||||
|
${MODULE_SOURCE_PRIVATE_SOURCES}
|
||||||
|
${SCRIPT_MODULE_PRIVATE_SCRIPTLOADER})
|
||||||
|
|
||||||
|
target_link_libraries(${MODULE_SOURCE_PROJECT_NAME}
|
||||||
|
PRIVATE
|
||||||
|
acore-core-interface
|
||||||
|
PUBLIC
|
||||||
|
game)
|
||||||
|
|
||||||
|
target_include_directories(${MODULE_SOURCE_PROJECT_NAME}
|
||||||
|
PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${PUBLIC_INCLUDES})
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_SOURCE_PROJECT_NAME}
|
||||||
|
PROPERTIES
|
||||||
|
FOLDER
|
||||||
|
"modules")
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
install(TARGETS ${MODULE_SOURCE_PROJECT_NAME}
|
||||||
|
DESTINATION ${INSTALL_OFFSET} COMPONENT ${MODULE_SOURCE_PROJECT_NAME})
|
||||||
|
elseif(WIN32)
|
||||||
|
install(TARGETS ${MODULE_SOURCE_PROJECT_NAME}
|
||||||
|
RUNTIME DESTINATION ${INSTALL_OFFSET} COMPONENT ${MODULE_SOURCE_PROJECT_NAME})
|
||||||
|
if(MSVC)
|
||||||
|
# Place the script modules in the script subdirectory
|
||||||
|
set_target_properties(${MODULE_SOURCE_PROJECT_NAME} PROPERTIES
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin/Debug/scripts
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin/Release/scripts
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/bin/RelWithDebInfo/scripts
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/bin/MinSizeRel/scripts)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unknown value \"${${MODULE_MODULE_VARIABLE}}\" for module (${SOURCE_MODULE})!")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Add the dynamic script modules to the worldserver as dependency
|
||||||
|
set(WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES ${DYNAMIC_SCRIPT_MODULE_PROJECTS} PARENT_SCOPE)
|
||||||
|
|
||||||
|
ConfigureScriptLoader("static" SCRIPT_MODULE_PRIVATE_SCRIPTLOADER OFF ${STATIC_SCRIPT_MODULES})
|
||||||
|
|
||||||
|
list(REMOVE_DUPLICATES SCRIPT_MODULE_PRIVATE_SCRIPTLOADER)
|
||||||
|
|
||||||
|
if (MOD_ELUNA_FOUND)
|
||||||
|
list(REMOVE_ITEM PRIVATE_SOURCES_MODULES ${MOD_ELUNA_PATH}/lualib/lua.c)
|
||||||
|
list(REMOVE_ITEM PRIVATE_SOURCES_MODULES ${MOD_ELUNA_PATH}/lualib/luac.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(modules STATIC
|
||||||
|
ModulesScriptLoader.h
|
||||||
|
${SCRIPT_MODULE_PRIVATE_SCRIPTLOADER}
|
||||||
|
${PRIVATE_SOURCES_MODULES})
|
||||||
|
|
||||||
|
target_link_libraries(modules
|
||||||
|
PRIVATE
|
||||||
|
acore-core-interface
|
||||||
|
PUBLIC
|
||||||
|
game-interface)
|
||||||
|
|
||||||
|
target_include_directories(modules
|
||||||
|
PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${PUBLIC_INCLUDES})
|
||||||
|
|
||||||
|
set_target_properties(scripts
|
||||||
|
PROPERTIES
|
||||||
|
FOLDER
|
||||||
|
"modules")
|
||||||
|
|
||||||
|
# Generate precompiled header
|
||||||
|
# if (USE_SCRIPTPCH)
|
||||||
|
# list(APPEND ALL_SCRIPT_PROJECTS modules ${DYNAMIC_SCRIPT_MODULE_PROJECTS})
|
||||||
|
# add_cxx_pch("${ALL_SCRIPT_PROJECTS}" ${PRIVATE_PCH_HEADER})
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
# Remove all shared libraries in the installl directory which
|
||||||
|
# are contained in the static library already.
|
||||||
|
if (DISABLED_SCRIPT_MODULE_PROJECTS)
|
||||||
|
install(CODE "
|
||||||
|
foreach(SCRIPT_TO_UNINSTALL ${DISABLED_SCRIPT_MODULE_PROJECTS})
|
||||||
|
if(EXISTS \"\${SCRIPT_TO_UNINSTALL}\")
|
||||||
|
message(STATUS \"Uninstalling: \${SCRIPT_TO_UNINSTALL}\")
|
||||||
|
file(REMOVE \"\${SCRIPT_TO_UNINSTALL}\")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Stores the absolut path of the given config module in the variable
|
||||||
|
function(GetPathToModuleConfig module variable)
|
||||||
|
set(${variable} "${CMAKE_SOURCE_DIR}/modules/${module}/conf" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
message(STATUS "* Modules config list:
|
||||||
|
|")
|
||||||
|
|
||||||
|
foreach(ModuleName ${MODULE_LIST__})
|
||||||
|
GetPathToModuleConfig(${ModuleName} MODULE_CONFIG_PATH)
|
||||||
|
|
||||||
|
set(MODULE_LIST ${MODULE_LIST}${ModuleName},)
|
||||||
|
|
||||||
|
file(GLOB MODULE_CONFIG_LIST RELATIVE
|
||||||
|
${MODULE_CONFIG_PATH}
|
||||||
|
${MODULE_CONFIG_PATH}/*.conf.dist)
|
||||||
|
|
||||||
|
message(STATUS " +- ${ModuleName}")
|
||||||
|
|
||||||
|
foreach(configFileName ${MODULE_CONFIG_LIST})
|
||||||
|
CopyModuleConfig("${MODULE_CONFIG_PATH}/${configFileName}")
|
||||||
|
set(CONFIG_LIST ${CONFIG_LIST}${configFileName},)
|
||||||
|
message(STATUS " | * ${configFileName}")
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Define modules list
|
||||||
|
target_compile_options(modules
|
||||||
|
INTERFACE
|
||||||
|
-DAC_MODULES_LIST=$<1:"${MODULE_LIST}">)
|
||||||
|
|
||||||
|
# Define modules config list
|
||||||
|
target_compile_options(modules
|
||||||
|
INTERFACE
|
||||||
|
-DCONFIG_FILE_LIST=$<1:"${CONFIG_LIST}">)
|
||||||
|
|
||||||
|
if (MOD_ELUNA_FOUND)
|
||||||
|
if (APPLE)
|
||||||
|
target_compile_definitions(modules
|
||||||
|
PUBLIC
|
||||||
|
LUA_USE_MACOSX)
|
||||||
|
elseif (UNIX)
|
||||||
|
target_compile_definitions(modules
|
||||||
|
PUBLIC
|
||||||
|
LUA_USE_LINUX)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
if (MSVC)
|
||||||
|
set(MSVC_CONFIGURATION_NAME $(ConfigurationName)/)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(TARGET modules
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/${MSVC_CONFIGURATION_NAME}lua_scripts/extensions/"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory "${MOD_ELUNA_PATH}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/${MSVC_CONFIGURATION_NAME}lua_scripts/extensions/")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(DIRECTORY "${MOD_ELUNA_PATH}/LuaEngine/extensions" DESTINATION "${CMAKE_INSTALL_PREFIX}/bin/lua_scripts/")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message("")
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Affero General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This file was created automatically from your script configuration!
|
||||||
|
// Use CMake to reconfigure this file, never change it on your own!
|
||||||
|
|
||||||
|
#cmakedefine ACORE_IS_DYNAMIC_SCRIPTLOADER
|
||||||
|
|
||||||
|
#include "Define.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
// Add deprecated api loaders include
|
||||||
|
@AC_SCRIPTS_INCLUDES@
|
||||||
|
// Includes list
|
||||||
|
@ACORE_SCRIPTS_FORWARD_DECL@
|
||||||
|
#ifdef ACORE_IS_DYNAMIC_SCRIPTLOADER
|
||||||
|
# include "revision.h"
|
||||||
|
# define AC_MODULES_API AC_API_EXPORT
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
/// Exposed in script module to return the name of the script module
|
||||||
|
/// contained in this shared library.
|
||||||
|
AC_MODULES_API char const* GetScriptModule()
|
||||||
|
{
|
||||||
|
return "@ACORE_CURRENT_SCRIPT_PROJECT@";
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
# include "ModulesScriptLoader.h"
|
||||||
|
# define AC_MODULES_API
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Exposed in script modules to register all scripts to the ScriptMgr.
|
||||||
|
AC_MODULES_API void AddModulesScripts()
|
||||||
|
{
|
||||||
|
// Modules
|
||||||
|
@ACORE_SCRIPTS_INVOKE@
|
||||||
|
// Deprecated api modules
|
||||||
|
@AC_SCRIPTS_LIST@}
|
||||||
|
|
||||||
|
/// Exposed in script modules to get the build directive of the module.
|
||||||
|
AC_MODULES_API char const* GetModulesBuildDirective()
|
||||||
|
{
|
||||||
|
return _BUILD_DIRECTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ACORE_IS_DYNAMIC_SCRIPTLOADER
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Affero General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MODULES_PRECOMPILED_H_
|
||||||
|
#define _MODULES_PRECOMPILED_H_
|
||||||
|
|
||||||
|
#include "ObjectMgr.h"
|
||||||
|
#include "ScriptedCreature.h"
|
||||||
|
#include "ScriptedGossip.h"
|
||||||
|
#include "ScriptMgr.h"
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Affero General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MODULES_SCRIPT_LOADER_H_
|
||||||
|
#define _MODULES_SCRIPT_LOADER_H_
|
||||||
|
|
||||||
|
void AddModulesScripts();
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -51,17 +51,17 @@ function(CopyModuleConfig configDir)
|
|||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
|
if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
|
||||||
add_custom_command(TARGET worldserver
|
add_custom_command(TARGET modules
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/${postPath}")
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/${postPath}")
|
||||||
add_custom_command(TARGET worldserver
|
add_custom_command(TARGET modules
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy "${configDir}" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/${postPath}")
|
COMMAND ${CMAKE_COMMAND} -E copy "${configDir}" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/${postPath}")
|
||||||
elseif(MINGW)
|
elseif(MINGW)
|
||||||
add_custom_command(TARGET worldserver
|
add_custom_command(TARGET modules
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/${postPath}")
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/${postPath}")
|
||||||
add_custom_command(TARGET worldserver
|
add_custom_command(TARGET modules
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy "${configDir} ${CMAKE_BINARY_DIR}/bin/${postPath}")
|
COMMAND ${CMAKE_COMMAND} -E copy "${configDir} ${CMAKE_BINARY_DIR}/bin/${postPath}")
|
||||||
endif()
|
endif()
|
||||||
@@ -74,35 +74,3 @@ function(CopyModuleConfig configDir)
|
|||||||
endif()
|
endif()
|
||||||
unset(postPath)
|
unset(postPath)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Stores the absolut path of the given config module in the variable
|
|
||||||
function(GetPathToModuleConfig module variable)
|
|
||||||
set(${variable} "${CMAKE_SOURCE_DIR}/modules/${module}/conf" PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# Creates a list of all configs modules
|
|
||||||
# and stores it in the given variable.
|
|
||||||
function(CollectModulesConfig)
|
|
||||||
file(GLOB LOCALE_MODULE_LIST RELATIVE
|
|
||||||
${CMAKE_SOURCE_DIR}/modules
|
|
||||||
${CMAKE_SOURCE_DIR}/modules/*)
|
|
||||||
|
|
||||||
message(STATUS "* Modules config list:")
|
|
||||||
|
|
||||||
foreach(CONFIG_MODULE ${LOCALE_MODULE_LIST})
|
|
||||||
GetPathToModuleConfig(${CONFIG_MODULE} MODULE_CONFIG_PATH)
|
|
||||||
|
|
||||||
file(GLOB MODULE_CONFIG_LIST RELATIVE
|
|
||||||
${MODULE_CONFIG_PATH}
|
|
||||||
${MODULE_CONFIG_PATH}/*.conf.dist)
|
|
||||||
|
|
||||||
foreach(configFileName ${MODULE_CONFIG_LIST})
|
|
||||||
CopyModuleConfig("${MODULE_CONFIG_PATH}/${configFileName}")
|
|
||||||
set(CONFIG_LIST ${CONFIG_LIST}${configFileName},)
|
|
||||||
message(STATUS " |- ${configFileName}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
endforeach()
|
|
||||||
message("")
|
|
||||||
add_definitions(-DCONFIG_FILE_LIST=$<1:"${CONFIG_LIST}">)
|
|
||||||
endfunction()
|
|
||||||
|
|||||||
@@ -71,18 +71,3 @@ function(IsDynamicLinkingModulesRequired variable)
|
|||||||
endforeach()
|
endforeach()
|
||||||
set(${variable} ${IS_REQUIRED} PARENT_SCOPE)
|
set(${variable} ${IS_REQUIRED} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Get list all modules
|
|
||||||
function(GetModuleList)
|
|
||||||
file(GLOB LOCALE_MODULE_LIST RELATIVE
|
|
||||||
${CMAKE_SOURCE_DIR}/modules
|
|
||||||
${CMAKE_SOURCE_DIR}/modules/*)
|
|
||||||
|
|
||||||
foreach(MODULE_DIR ${LOCALE_MODULE_LIST})
|
|
||||||
if(IS_DIRECTORY "${CMAKE_SOURCE_DIR}/modules/${MODULE_DIR}")
|
|
||||||
set(MODULE_LIST__ ${MODULE_LIST__}${MODULE_DIR},)
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_definitions(-DAC_MODULES_LIST=$<1:"${MODULE_LIST__}">)
|
|
||||||
endfunction()
|
|
||||||
|
|||||||
@@ -54,9 +54,6 @@ target_link_libraries(database
|
|||||||
PUBLIC
|
PUBLIC
|
||||||
common)
|
common)
|
||||||
|
|
||||||
# Add support auto update db for modules
|
|
||||||
GetModuleList()
|
|
||||||
|
|
||||||
set_target_properties(database
|
set_target_properties(database
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
FOLDER
|
FOLDER
|
||||||
|
|||||||
@@ -25,11 +25,11 @@
|
|||||||
#include <mysqld_error.h>
|
#include <mysqld_error.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
DatabaseLoader::DatabaseLoader(std::string const& logger, uint32 const defaultUpdateMask)
|
DatabaseLoader::DatabaseLoader(std::string const& logger, uint32 const defaultUpdateMask, std::string_view modulesList)
|
||||||
: _logger(logger), _autoSetup(sConfigMgr->GetOption<bool>("Updates.AutoSetup", true)),
|
: _logger(logger),
|
||||||
_updateFlags(sConfigMgr->GetOption<uint32>("Updates.EnableDatabases", defaultUpdateMask))
|
_modulesList(modulesList),
|
||||||
{
|
_autoSetup(sConfigMgr->GetOption<bool>("Updates.AutoSetup", true)),
|
||||||
}
|
_updateFlags(sConfigMgr->GetOption<uint32>("Updates.EnableDatabases", defaultUpdateMask)) { }
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
DatabaseLoader& DatabaseLoader::AddDatabase(DatabaseWorkerPool<T>& pool, std::string const& name)
|
DatabaseLoader& DatabaseLoader::AddDatabase(DatabaseWorkerPool<T>& pool, std::string const& name)
|
||||||
@@ -127,7 +127,7 @@ DatabaseLoader& DatabaseLoader::AddDatabase(DatabaseWorkerPool<T>& pool, std::st
|
|||||||
|
|
||||||
_update.push([this, name, &pool]() -> bool
|
_update.push([this, name, &pool]() -> bool
|
||||||
{
|
{
|
||||||
if (!DBUpdater<T>::Update(pool))
|
if (!DBUpdater<T>::Update(pool, _modulesList))
|
||||||
{
|
{
|
||||||
LOG_ERROR(_logger, "Could not update the %s database, see log for details.", name.c_str());
|
LOG_ERROR(_logger, "Could not update the %s database, see log for details.", name.c_str());
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class DatabaseWorkerPool;
|
|||||||
class AC_DATABASE_API DatabaseLoader
|
class AC_DATABASE_API DatabaseLoader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DatabaseLoader(std::string const& logger, uint32 const defaultUpdateMask = 0);
|
DatabaseLoader(std::string const& logger, uint32 const defaultUpdateMask = 0, std::string_view modulesList = {});
|
||||||
|
|
||||||
// Register a database to the loader (lazy implemented)
|
// Register a database to the loader (lazy implemented)
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
return _updateFlags;
|
return _updateFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
private :
|
private:
|
||||||
bool OpenDatabases();
|
bool OpenDatabases();
|
||||||
bool PopulateDatabases();
|
bool PopulateDatabases();
|
||||||
bool UpdateDatabases();
|
bool UpdateDatabases();
|
||||||
@@ -71,6 +71,7 @@ private :
|
|||||||
bool Process(std::queue<Predicate>& queue);
|
bool Process(std::queue<Predicate>& queue);
|
||||||
|
|
||||||
std::string const _logger;
|
std::string const _logger;
|
||||||
|
std::string_view _modulesList;
|
||||||
bool const _autoSetup;
|
bool const _autoSetup;
|
||||||
uint32 const _updateFlags;
|
uint32 const _updateFlags;
|
||||||
|
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ bool DBUpdater<T>::Create(DatabaseWorkerPool<T>& pool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
bool DBUpdater<T>::Update(DatabaseWorkerPool<T>& pool)
|
bool DBUpdater<T>::Update(DatabaseWorkerPool<T>& pool, std::string_view modulesList /*= {}*/)
|
||||||
{
|
{
|
||||||
if (!DBUpdaterUtil::CheckExecutable())
|
if (!DBUpdaterUtil::CheckExecutable())
|
||||||
return false;
|
return false;
|
||||||
@@ -260,7 +260,7 @@ bool DBUpdater<T>::Update(DatabaseWorkerPool<T>& pool)
|
|||||||
|
|
||||||
UpdateFetcher updateFetcher(sourceDirectory, [&](std::string const & query) { DBUpdater<T>::Apply(pool, query); },
|
UpdateFetcher updateFetcher(sourceDirectory, [&](std::string const & query) { DBUpdater<T>::Apply(pool, query); },
|
||||||
[&](Path const & file) { DBUpdater<T>::ApplyFile(pool, file); },
|
[&](Path const & file) { DBUpdater<T>::ApplyFile(pool, file); },
|
||||||
[&](std::string const & query) -> QueryResult { return DBUpdater<T>::Retrieve(pool, query); }, DBUpdater<T>::GetDBModuleName());
|
[&](std::string const & query) -> QueryResult { return DBUpdater<T>::Retrieve(pool, query); }, DBUpdater<T>::GetDBModuleName(), modulesList);
|
||||||
|
|
||||||
UpdateResult result;
|
UpdateResult result;
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public:
|
|||||||
static bool IsEnabled(uint32 const updateMask);
|
static bool IsEnabled(uint32 const updateMask);
|
||||||
static BaseLocation GetBaseLocationType();
|
static BaseLocation GetBaseLocationType();
|
||||||
static bool Create(DatabaseWorkerPool<T>& pool);
|
static bool Create(DatabaseWorkerPool<T>& pool);
|
||||||
static bool Update(DatabaseWorkerPool<T>& pool);
|
static bool Update(DatabaseWorkerPool<T>& pool, std::string_view modulesList = {});
|
||||||
static bool Update(DatabaseWorkerPool<T>& pool, std::vector<std::string> const* setDirectories);
|
static bool Update(DatabaseWorkerPool<T>& pool, std::vector<std::string> const* setDirectories);
|
||||||
static bool Populate(DatabaseWorkerPool<T>& pool);
|
static bool Populate(DatabaseWorkerPool<T>& pool);
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,17 @@ UpdateFetcher::UpdateFetcher(Path const& sourceDirectory,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateFetcher::UpdateFetcher(Path const& sourceDirectory,
|
||||||
|
std::function<void(std::string const&)> const& apply,
|
||||||
|
std::function<void(Path const& path)> const& applyFile,
|
||||||
|
std::function<QueryResult(std::string const&)> const& retrieve,
|
||||||
|
std::string const& dbModuleName,
|
||||||
|
std::string_view modulesList /*= {}*/) :
|
||||||
|
_sourceDirectory(std::make_unique<Path>(sourceDirectory)), _apply(apply), _applyFile(applyFile),
|
||||||
|
_retrieve(retrieve), _dbModuleName(dbModuleName), _setDirectories(nullptr), _modulesList(modulesList)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
UpdateFetcher::~UpdateFetcher()
|
UpdateFetcher::~UpdateFetcher()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -144,8 +155,10 @@ UpdateFetcher::DirectoryStorage UpdateFetcher::ReceiveIncludedDirectories() cons
|
|||||||
|
|
||||||
std::vector<std::string> moduleList;
|
std::vector<std::string> moduleList;
|
||||||
|
|
||||||
auto const& _modulesTokens = Acore::Tokenize(AC_MODULES_LIST, ',', true);
|
for (auto const& itr : Acore::Tokenize(_modulesList, ',', true))
|
||||||
for (auto const& itr : _modulesTokens) moduleList.emplace_back(itr);
|
{
|
||||||
|
moduleList.emplace_back(itr);
|
||||||
|
}
|
||||||
|
|
||||||
// data/sql
|
// data/sql
|
||||||
for (auto const& itr : moduleList)
|
for (auto const& itr : moduleList)
|
||||||
@@ -154,9 +167,11 @@ UpdateFetcher::DirectoryStorage UpdateFetcher::ReceiveIncludedDirectories() cons
|
|||||||
|
|
||||||
Path const p(path);
|
Path const p(path);
|
||||||
if (!is_directory(p))
|
if (!is_directory(p))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
DirectoryEntry const entry = {p, AppliedFileEntry::StateConvert("MODULE")};
|
DirectoryEntry const entry = { p, AppliedFileEntry::StateConvert("MODULE") };
|
||||||
directories.push_back(entry);
|
directories.push_back(entry);
|
||||||
|
|
||||||
LOG_TRACE("sql.updates", "Added applied modules file \"%s\" from remote.", p.filename().generic_string().c_str());
|
LOG_TRACE("sql.updates", "Added applied modules file \"%s\" from remote.", p.filename().generic_string().c_str());
|
||||||
|
|||||||
@@ -48,6 +48,14 @@ public:
|
|||||||
std::function<void(std::string const&)> const& apply,
|
std::function<void(std::string const&)> const& apply,
|
||||||
std::function<void(Path const& path)> const& applyFile,
|
std::function<void(Path const& path)> const& applyFile,
|
||||||
std::function<QueryResult(std::string const&)> const& retrieve, std::string const& dbModuleName, std::vector<std::string> const* setDirectories = nullptr);
|
std::function<QueryResult(std::string const&)> const& retrieve, std::string const& dbModuleName, std::vector<std::string> const* setDirectories = nullptr);
|
||||||
|
|
||||||
|
UpdateFetcher(Path const& updateDirectory,
|
||||||
|
std::function<void(std::string const&)> const& apply,
|
||||||
|
std::function<void(Path const& path)> const& applyFile,
|
||||||
|
std::function<QueryResult(std::string const&)> const& retrieve,
|
||||||
|
std::string const& dbModuleName,
|
||||||
|
std::string_view modulesList = {});
|
||||||
|
|
||||||
~UpdateFetcher();
|
~UpdateFetcher();
|
||||||
|
|
||||||
UpdateResult Update(bool const redundancyChecks, bool const allowRehash,
|
UpdateResult Update(bool const redundancyChecks, bool const allowRehash,
|
||||||
@@ -153,6 +161,7 @@ private:
|
|||||||
// modules
|
// modules
|
||||||
std::string const _dbModuleName;
|
std::string const _dbModuleName;
|
||||||
std::vector<std::string> const* _setDirectories;
|
std::vector<std::string> const* _setDirectories;
|
||||||
|
std::string_view _modulesList = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // UpdateFetcher_h__
|
#endif // UpdateFetcher_h__
|
||||||
|
|||||||
@@ -44,9 +44,6 @@
|
|||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
namespace Acore
|
namespace Acore
|
||||||
{
|
{
|
||||||
class BattlegroundChatBuilder
|
class BattlegroundChatBuilder
|
||||||
@@ -217,9 +214,7 @@ Battleground::~Battleground()
|
|||||||
for (uint32 i = 0; i < size; ++i)
|
for (uint32 i = 0; i < size; ++i)
|
||||||
DelObject(i);
|
DelObject(i);
|
||||||
|
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnBattlegroundDestroy(this);
|
||||||
sEluna->OnBGDestroy(this, GetBgTypeID(), GetInstanceID());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sBattlegroundMgr->RemoveBattleground(GetBgTypeID(), GetInstanceID());
|
sBattlegroundMgr->RemoveBattleground(GetBgTypeID(), GetInstanceID());
|
||||||
// unload map
|
// unload map
|
||||||
@@ -513,10 +508,6 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
|||||||
|
|
||||||
StartingEventOpenDoors();
|
StartingEventOpenDoors();
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnBGStart(this, GetBgTypeID(), GetInstanceID());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SendWarningToAll(StartMessageIds[BG_STARTING_EVENT_FOURTH]);
|
SendWarningToAll(StartMessageIds[BG_STARTING_EVENT_FOURTH]);
|
||||||
SetStatus(STATUS_IN_PROGRESS);
|
SetStatus(STATUS_IN_PROGRESS);
|
||||||
SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FOURTH]);
|
SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FOURTH]);
|
||||||
@@ -1063,9 +1054,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
|
|||||||
if (winmsg_id)
|
if (winmsg_id)
|
||||||
SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||||
|
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnBattlegroundEnd(this, winnerTeamId);
|
||||||
sEluna->OnBGEnd(this, GetBgTypeID(), GetInstanceID(), winnerTeamId);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Battleground::GetBonusHonorFromKill(uint32 kills) const
|
uint32 Battleground::GetBonusHonorFromKill(uint32 kills) const
|
||||||
|
|||||||
@@ -48,10 +48,6 @@
|
|||||||
#include <random>
|
#include <random>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/*** BATTLEGROUND MANAGER ***/
|
/*** BATTLEGROUND MANAGER ***/
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
@@ -994,9 +990,8 @@ void BattlegroundMgr::AddBattleground(Battleground* bg)
|
|||||||
m_BattlegroundTemplates[bg->GetBgTypeID()] = bg;
|
m_BattlegroundTemplates[bg->GetBgTypeID()] = bg;
|
||||||
else
|
else
|
||||||
m_Battlegrounds[bg->GetInstanceID()] = bg;
|
m_Battlegrounds[bg->GetInstanceID()] = bg;
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnBGCreate(bg, bg->GetBgTypeID(), bg->GetInstanceID());
|
sScriptMgr->OnBattlegroundCreate(bg);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundMgr::RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 instanceId)
|
void BattlegroundMgr::RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 instanceId)
|
||||||
|
|||||||
@@ -42,8 +42,7 @@ target_link_libraries(game-interface
|
|||||||
shared)
|
shared)
|
||||||
|
|
||||||
add_library(game STATIC
|
add_library(game STATIC
|
||||||
${PRIVATE_SOURCES}
|
${PRIVATE_SOURCES})
|
||||||
${ElunaLuaEngineFiles})
|
|
||||||
|
|
||||||
add_dependencies(game revision.h)
|
add_dependencies(game revision.h)
|
||||||
|
|
||||||
|
|||||||
@@ -35,10 +35,6 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Player* ChatHandler::GetPlayer() const
|
Player* ChatHandler::GetPlayer() const
|
||||||
{
|
{
|
||||||
return m_session ? m_session->GetPlayer() : nullptr;
|
return m_session ? m_session->GetPlayer() : nullptr;
|
||||||
|
|||||||
@@ -27,10 +27,6 @@
|
|||||||
#include "Tokenize.h"
|
#include "Tokenize.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using ChatSubCommandMap = std::map<std::string_view, Acore::Impl::ChatCommands::ChatCommandNode, StringCompareLessI_T>;
|
using ChatSubCommandMap = std::map<std::string_view, Acore::Impl::ChatCommands::ChatCommandNode, StringCompareLessI_T>;
|
||||||
|
|
||||||
void Acore::Impl::ChatCommands::ChatCommandNode::LoadFromBuilder(ChatCommandBuilder const& builder)
|
void Acore::Impl::ChatCommands::ChatCommandNode::LoadFromBuilder(ChatCommandBuilder const& builder)
|
||||||
@@ -334,27 +330,24 @@ namespace Acore::Impl::ChatCommands
|
|||||||
if (!handler.IsConsole())
|
if (!handler.IsConsole())
|
||||||
LogCommandUsage(*handler.GetSession(), cmdStr);
|
LogCommandUsage(*handler.GetSession(), cmdStr);
|
||||||
}
|
}
|
||||||
else if (!handler.HasSentErrorMessage())
|
else if (!handler.HasSentErrorMessage()) /* invocation failed, we should show usage */
|
||||||
{ /* invocation failed, we should show usage */
|
{
|
||||||
#ifdef ELUNA
|
if (!sScriptMgr->CanExecuteCommand(handler, cmdStr))
|
||||||
if (!sEluna->OnCommand(handler.IsConsole() ? nullptr : handler.GetSession()->GetPlayer(), std::string(cmdStr).c_str()))
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
cmd->SendCommandHelp(handler);
|
cmd->SendCommandHelp(handler);
|
||||||
handler.SetSentErrorMessage(true);
|
handler.SetSentErrorMessage(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ELUNA
|
if (!sScriptMgr->CanExecuteCommand(handler, cmdStr))
|
||||||
if (!sEluna->OnCommand(handler.IsConsole() ? nullptr : handler.GetSession()->GetPlayer(), std::string(cmdStr).c_str()))
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,10 +53,6 @@
|
|||||||
// there is probably some underlying problem with imports which should properly addressed
|
// there is probably some underlying problem with imports which should properly addressed
|
||||||
#include "GridNotifiersImpl.h"
|
#include "GridNotifiersImpl.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const
|
TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const
|
||||||
{
|
{
|
||||||
TrainerSpellMap::const_iterator itr = spellList.find(spell_id);
|
TrainerSpellMap::const_iterator itr = spellList.find(spell_id);
|
||||||
@@ -242,12 +238,8 @@ void Creature::AddToWorld()
|
|||||||
{
|
{
|
||||||
GetZoneScript()->OnCreatureCreate(this);
|
GetZoneScript()->OnCreatureCreate(this);
|
||||||
}
|
}
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnAddToWorld(this);
|
|
||||||
|
|
||||||
if (IsGuardian() && ToTempSummon() && ToTempSummon()->GetSummonerGUID().IsPlayer())
|
sScriptMgr->OnCreatureAddWorld(this);
|
||||||
sEluna->OnPetAddedToWorld(ToTempSummon()->GetSummonerUnit()->ToPlayer(), this);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,9 +247,8 @@ void Creature::RemoveFromWorld()
|
|||||||
{
|
{
|
||||||
if (IsInWorld())
|
if (IsInWorld())
|
||||||
{
|
{
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnCreatureRemoveWorld(this);
|
||||||
sEluna->OnRemoveFromWorld(this);
|
|
||||||
#endif
|
|
||||||
if (GetZoneScript())
|
if (GetZoneScript())
|
||||||
GetZoneScript()->OnCreatureRemove(this);
|
GetZoneScript()->OnCreatureRemove(this);
|
||||||
|
|
||||||
|
|||||||
@@ -38,10 +38,6 @@
|
|||||||
#include <G3D/CoordinateFrame.h>
|
#include <G3D/CoordinateFrame.h>
|
||||||
#include <G3D/Quat.h>
|
#include <G3D/Quat.h>
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GameObject::GameObject() : WorldObject(false), MovableMapObject(),
|
GameObject::GameObject() : WorldObject(false), MovableMapObject(),
|
||||||
m_model(nullptr), m_goValue(), m_AI(nullptr)
|
m_model(nullptr), m_goValue(), m_AI(nullptr)
|
||||||
{
|
{
|
||||||
@@ -161,9 +157,8 @@ void GameObject::AddToWorld()
|
|||||||
EnableCollision(GetGoState() == GO_STATE_READY || IsTransport()); // pussywizard: this startOpen is unneeded here, collision depends entirely on GOState
|
EnableCollision(GetGoState() == GO_STATE_READY || IsTransport()); // pussywizard: this startOpen is unneeded here, collision depends entirely on GOState
|
||||||
|
|
||||||
WorldObject::AddToWorld();
|
WorldObject::AddToWorld();
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnAddToWorld(this);
|
sScriptMgr->OnGameObjectAddWorld(this);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,9 +167,8 @@ void GameObject::RemoveFromWorld()
|
|||||||
///- Remove the gameobject from the accessor
|
///- Remove the gameobject from the accessor
|
||||||
if (IsInWorld())
|
if (IsInWorld())
|
||||||
{
|
{
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnGameObjectRemoveWorld(this);
|
||||||
sEluna->OnRemoveFromWorld(this);
|
|
||||||
#endif
|
|
||||||
if (m_zoneScript)
|
if (m_zoneScript)
|
||||||
m_zoneScript->OnGameObjectRemove(this);
|
m_zoneScript->OnGameObjectRemove(this);
|
||||||
|
|
||||||
@@ -411,9 +405,6 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u
|
|||||||
|
|
||||||
void GameObject::Update(uint32 diff)
|
void GameObject::Update(uint32 diff)
|
||||||
{
|
{
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->UpdateAI(this, diff);
|
|
||||||
#endif
|
|
||||||
if (AI())
|
if (AI())
|
||||||
AI()->UpdateAI(diff);
|
AI()->UpdateAI(diff);
|
||||||
else if (!AIM_Initialize())
|
else if (!AIM_Initialize())
|
||||||
@@ -840,6 +831,7 @@ void GameObject::Update(uint32 diff)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sScriptMgr->OnGameObjectUpdate(this, diff);
|
sScriptMgr->OnGameObjectUpdate(this, diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1424,10 +1416,6 @@ void GameObject::Use(Unit* user)
|
|||||||
|
|
||||||
if (Player* playerUser = user->ToPlayer())
|
if (Player* playerUser = user->ToPlayer())
|
||||||
{
|
{
|
||||||
#ifdef ELUNA
|
|
||||||
if (sEluna->OnGossipHello(playerUser, this))
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
if (sScriptMgr->OnGossipHello(playerUser, this))
|
if (sScriptMgr->OnGossipHello(playerUser, this))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -2287,11 +2275,10 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
|
|||||||
break;
|
break;
|
||||||
case GO_DESTRUCTIBLE_DAMAGED:
|
case GO_DESTRUCTIBLE_DAMAGED:
|
||||||
{
|
{
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnDamaged(this, eventInvoker);
|
|
||||||
#endif
|
|
||||||
EventInform(m_goInfo->building.damagedEvent);
|
EventInform(m_goInfo->building.damagedEvent);
|
||||||
|
|
||||||
sScriptMgr->OnGameObjectDamaged(this, eventInvoker);
|
sScriptMgr->OnGameObjectDamaged(this, eventInvoker);
|
||||||
|
|
||||||
if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
|
if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
|
||||||
if (Battleground* bg = bgMap->GetBG())
|
if (Battleground* bg = bgMap->GetBG())
|
||||||
bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.damagedEvent);
|
bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.damagedEvent);
|
||||||
@@ -2318,11 +2305,10 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
|
|||||||
}
|
}
|
||||||
case GO_DESTRUCTIBLE_DESTROYED:
|
case GO_DESTRUCTIBLE_DESTROYED:
|
||||||
{
|
{
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnDestroyed(this, eventInvoker);
|
|
||||||
#endif
|
|
||||||
sScriptMgr->OnGameObjectDestroyed(this, eventInvoker);
|
sScriptMgr->OnGameObjectDestroyed(this, eventInvoker);
|
||||||
|
|
||||||
EventInform(m_goInfo->building.destroyedEvent);
|
EventInform(m_goInfo->building.destroyedEvent);
|
||||||
|
|
||||||
if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
|
if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
|
||||||
{
|
{
|
||||||
if (Battleground* bg = bgMap->GetBG())
|
if (Battleground* bg = bgMap->GetBG())
|
||||||
@@ -2375,9 +2361,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
|
|||||||
void GameObject::SetLootState(LootState state, Unit* unit)
|
void GameObject::SetLootState(LootState state, Unit* unit)
|
||||||
{
|
{
|
||||||
m_lootState = state;
|
m_lootState = state;
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnLootStateChanged(this, state);
|
|
||||||
#endif
|
|
||||||
AI()->OnStateChanged(state, unit);
|
AI()->OnStateChanged(state, unit);
|
||||||
sScriptMgr->OnGameObjectLootStateChanged(this, state, unit);
|
sScriptMgr->OnGameObjectLootStateChanged(this, state, unit);
|
||||||
// pussywizard: lootState has nothing to do with collision, it depends entirely on GOState. Loot state is for timed close/open door and respawning, which then sets GOState
|
// pussywizard: lootState has nothing to do with collision, it depends entirely on GOState. Loot state is for timed close/open door and respawning, which then sets GOState
|
||||||
@@ -2400,10 +2384,9 @@ void GameObject::SetLootState(LootState state, Unit* unit)
|
|||||||
void GameObject::SetGoState(GOState state)
|
void GameObject::SetGoState(GOState state)
|
||||||
{
|
{
|
||||||
SetByteValue(GAMEOBJECT_BYTES_1, 0, state);
|
SetByteValue(GAMEOBJECT_BYTES_1, 0, state);
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnGameObjectStateChanged(this, state);
|
|
||||||
#endif
|
|
||||||
sScriptMgr->OnGameObjectStateChanged(this, state);
|
sScriptMgr->OnGameObjectStateChanged(this, state);
|
||||||
|
|
||||||
if (m_model)
|
if (m_model)
|
||||||
{
|
{
|
||||||
if (!IsInWorld())
|
if (!IsInWorld())
|
||||||
|
|||||||
@@ -55,11 +55,6 @@
|
|||||||
// there is probably some underlying problem with imports which should properly addressed
|
// there is probably some underlying problem with imports which should properly addressed
|
||||||
#include "GridNotifiersImpl.h"
|
#include "GridNotifiersImpl.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "ElunaEventMgr.h"
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
constexpr float VisibilityDistances[AsUnderlyingType(VisibilityDistanceType::Max)] =
|
constexpr float VisibilityDistances[AsUnderlyingType(VisibilityDistanceType::Max)] =
|
||||||
{
|
{
|
||||||
DEFAULT_VISIBILITY_DISTANCE,
|
DEFAULT_VISIBILITY_DISTANCE,
|
||||||
@@ -87,10 +82,7 @@ Object::Object() : m_PackGUID(sizeof(uint64) + 1)
|
|||||||
|
|
||||||
WorldObject::~WorldObject()
|
WorldObject::~WorldObject()
|
||||||
{
|
{
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnWorldObjectDestroy(this);
|
||||||
delete elunaEvents;
|
|
||||||
elunaEvents = nullptr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// this may happen because there are many !create/delete
|
// this may happen because there are many !create/delete
|
||||||
if (IsWorldObject() && m_currMap)
|
if (IsWorldObject() && m_currMap)
|
||||||
@@ -1106,23 +1098,20 @@ void MovementInfo::OutDebug()
|
|||||||
}
|
}
|
||||||
|
|
||||||
WorldObject::WorldObject(bool isWorldObject) : WorldLocation(),
|
WorldObject::WorldObject(bool isWorldObject) : WorldLocation(),
|
||||||
#ifdef ELUNA
|
|
||||||
elunaEvents(nullptr),
|
|
||||||
#endif
|
|
||||||
LastUsedScriptID(0), m_name(""), m_isActive(false), m_visibilityDistanceOverride(false), m_isWorldObject(isWorldObject), m_zoneScript(nullptr),
|
LastUsedScriptID(0), m_name(""), m_isActive(false), m_visibilityDistanceOverride(false), m_isWorldObject(isWorldObject), m_zoneScript(nullptr),
|
||||||
_zoneId(0), _areaId(0), _floorZ(INVALID_HEIGHT), _outdoors(false), _liquidData(), _updatePositionData(false), m_transport(nullptr),
|
_zoneId(0), _areaId(0), _floorZ(INVALID_HEIGHT), _outdoors(false), _liquidData(), _updatePositionData(false), m_transport(nullptr),
|
||||||
m_currMap(nullptr), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL), m_useCombinedPhases(true), m_notifyflags(0), m_executed_notifies(0)
|
m_currMap(nullptr), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL), m_useCombinedPhases(true), m_notifyflags(0), m_executed_notifies(0)
|
||||||
{
|
{
|
||||||
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST);
|
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST);
|
||||||
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE);
|
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE);
|
||||||
|
|
||||||
|
sScriptMgr->OnWorldObjectCreate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
void WorldObject::Update(uint32 time_diff)
|
void WorldObject::Update(uint32 time_diff)
|
||||||
{
|
{
|
||||||
elunaEvents->Update(time_diff);
|
sScriptMgr->OnWorldObjectUpdate(this, time_diff);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void WorldObject::SetWorldObject(bool on)
|
void WorldObject::SetWorldObject(bool on)
|
||||||
{
|
{
|
||||||
@@ -2227,22 +2216,23 @@ void WorldObject::SetMap(Map* map)
|
|||||||
{
|
{
|
||||||
ASSERT(map);
|
ASSERT(map);
|
||||||
ASSERT(!IsInWorld());
|
ASSERT(!IsInWorld());
|
||||||
|
|
||||||
if (m_currMap == map) // command add npc: first create, than loadfromdb
|
if (m_currMap == map) // command add npc: first create, than loadfromdb
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_currMap)
|
if (m_currMap)
|
||||||
{
|
{
|
||||||
LOG_FATAL("entities.object", "WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId());
|
LOG_FATAL("entities.object", "WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId());
|
||||||
ABORT();
|
ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currMap = map;
|
m_currMap = map;
|
||||||
m_mapId = map->GetId();
|
m_mapId = map->GetId();
|
||||||
m_InstanceId = map->GetInstanceId();
|
m_InstanceId = map->GetInstanceId();
|
||||||
|
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnWorldObjectSetMap(this, map);
|
||||||
delete elunaEvents;
|
|
||||||
// On multithread replace this with a pointer to map's Eluna pointer stored in a map
|
|
||||||
elunaEvents = new ElunaEventProcessor(&Eluna::GEluna, this);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (IsWorldObject())
|
if (IsWorldObject())
|
||||||
m_currMap->AddWorldObject(this);
|
m_currMap->AddWorldObject(this);
|
||||||
@@ -2252,13 +2242,13 @@ void WorldObject::ResetMap()
|
|||||||
{
|
{
|
||||||
ASSERT(m_currMap);
|
ASSERT(m_currMap);
|
||||||
ASSERT(!IsInWorld());
|
ASSERT(!IsInWorld());
|
||||||
if (IsWorldObject())
|
|
||||||
m_currMap->RemoveWorldObject(this);
|
|
||||||
|
|
||||||
#ifdef ELUNA
|
if (IsWorldObject())
|
||||||
delete elunaEvents;
|
{
|
||||||
elunaEvents = nullptr;
|
m_currMap->RemoveWorldObject(this);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnWorldObjectResetMap(this);
|
||||||
|
|
||||||
m_currMap = nullptr;
|
m_currMap = nullptr;
|
||||||
//maybe not for corpse
|
//maybe not for corpse
|
||||||
|
|||||||
@@ -33,9 +33,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
class ElunaEventProcessor;
|
class ElunaEventProcessor;
|
||||||
#endif
|
|
||||||
|
|
||||||
enum TempSummonType
|
enum TempSummonType
|
||||||
{
|
{
|
||||||
@@ -673,20 +671,13 @@ protected:
|
|||||||
public:
|
public:
|
||||||
~WorldObject() override;
|
~WorldObject() override;
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
virtual void Update(uint32 /*time_diff*/);
|
virtual void Update(uint32 /*time_diff*/);
|
||||||
#else
|
|
||||||
virtual void Update(uint32 /*time_diff*/) { };
|
|
||||||
#endif
|
|
||||||
void _Create(ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask);
|
void _Create(ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask);
|
||||||
|
|
||||||
void AddToWorld() override;
|
void AddToWorld() override;
|
||||||
void RemoveFromWorld() override;
|
void RemoveFromWorld() override;
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
ElunaEventProcessor* elunaEvents;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void GetNearPoint2D(WorldObject const* searcher, float& x, float& y, float distance, float absAngle, Position const* startPos = nullptr) const;
|
void GetNearPoint2D(WorldObject const* searcher, float& x, float& y, float distance, float absAngle, Position const* startPos = nullptr) const;
|
||||||
void GetNearPoint2D(float& x, float& y, float distance, float absAngle, Position const* startPos = nullptr) const;
|
void GetNearPoint2D(float& x, float& y, float distance, float absAngle, Position const* startPos = nullptr) const;
|
||||||
void GetNearPoint(WorldObject const* searcher, float& x, float& y, float& z, float searcher_size, float distance2d, float absAngle, float controlZ = 0, Position const* startPos = nullptr) const;
|
void GetNearPoint(WorldObject const* searcher, float& x, float& y, float& z, float searcher_size, float distance2d, float absAngle, float controlZ = 0, Position const* startPos = nullptr) const;
|
||||||
@@ -899,6 +890,8 @@ public:
|
|||||||
[[nodiscard]] bool HasAllowedLooter(ObjectGuid guid) const;
|
[[nodiscard]] bool HasAllowedLooter(ObjectGuid guid) const;
|
||||||
[[nodiscard]] GuidUnorderedSet const& GetAllowedLooters() const;
|
[[nodiscard]] GuidUnorderedSet const& GetAllowedLooters() const;
|
||||||
|
|
||||||
|
ElunaEventProcessor* elunaEvents;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
bool m_isActive;
|
bool m_isActive;
|
||||||
|
|||||||
@@ -35,10 +35,6 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Pet::Pet(Player* owner, PetType type) : Guardian(nullptr, owner ? owner->GetGUID() : ObjectGuid::Empty, true),
|
Pet::Pet(Player* owner, PetType type) : Guardian(nullptr, owner ? owner->GetGUID() : ObjectGuid::Empty, true),
|
||||||
m_usedTalentCount(0), m_removed(false), m_owner(owner),
|
m_usedTalentCount(0), m_removed(false), m_owner(owner),
|
||||||
m_happinessTimer(PET_LOSE_HAPPINES_INTERVAL), m_petType(type), m_duration(0),
|
m_happinessTimer(PET_LOSE_HAPPINES_INTERVAL), m_petType(type), m_duration(0),
|
||||||
@@ -98,10 +94,10 @@ void Pet::AddToWorld()
|
|||||||
GetCharmInfo()->SetIsReturning(false);
|
GetCharmInfo()->SetIsReturning(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
if (GetOwnerGUID().IsPlayer())
|
if (GetOwnerGUID().IsPlayer())
|
||||||
sEluna->OnPetAddedToWorld(GetOwner(), this);
|
{
|
||||||
#endif
|
sScriptMgr->OnPetAddToWorld(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pet::RemoveFromWorld()
|
void Pet::RemoveFromWorld()
|
||||||
|
|||||||
@@ -92,10 +92,6 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum CharacterFlags
|
enum CharacterFlags
|
||||||
{
|
{
|
||||||
CHARACTER_FLAG_NONE = 0x00000000,
|
CHARACTER_FLAG_NONE = 0x00000000,
|
||||||
@@ -4356,12 +4352,12 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
|
|||||||
// update visibility
|
// update visibility
|
||||||
UpdateObjectVisibility();
|
UpdateObjectVisibility();
|
||||||
|
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnPlayerResurrect(this, restore_percent, applySickness);
|
||||||
sEluna->OnResurrect(this);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(!applySickness)
|
if (!applySickness)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Characters from level 1-10 are not affected by resurrection sickness.
|
//Characters from level 1-10 are not affected by resurrection sickness.
|
||||||
//Characters from level 11-19 will suffer from one minute of sickness
|
//Characters from level 11-19 will suffer from one minute of sickness
|
||||||
@@ -8774,11 +8770,12 @@ void Player::StopCastingCharm()
|
|||||||
void Player::Say(std::string_view text, Language language, WorldObject const* /*= nullptr*/)
|
void Player::Say(std::string_view text, Language language, WorldObject const* /*= nullptr*/)
|
||||||
{
|
{
|
||||||
std::string _text(text);
|
std::string _text(text);
|
||||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_SAY, language, _text);
|
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_SAY, language, _text))
|
||||||
#ifdef ELUNA
|
{
|
||||||
if (!sEluna->OnChat(this, CHAT_MSG_SAY, language, _text))
|
|
||||||
return;
|
return;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnPlayerChat(this, CHAT_MSG_SAY, language, _text);
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_SAY, language, this, this, _text);
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_SAY, language, this, this, _text);
|
||||||
@@ -8793,11 +8790,13 @@ void Player::Say(uint32 textId, WorldObject const* target /*= nullptr*/)
|
|||||||
void Player::Yell(std::string_view text, Language language, WorldObject const* /*= nullptr*/)
|
void Player::Yell(std::string_view text, Language language, WorldObject const* /*= nullptr*/)
|
||||||
{
|
{
|
||||||
std::string _text(text);
|
std::string _text(text);
|
||||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_YELL, language, _text);
|
|
||||||
#ifdef ELUNA
|
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_YELL, language, _text))
|
||||||
if (!sEluna->OnChat(this, CHAT_MSG_YELL, language, _text))
|
{
|
||||||
return;
|
return;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnPlayerChat(this, CHAT_MSG_YELL, language, _text);
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_YELL, language, this, this, _text);
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_YELL, language, this, this, _text);
|
||||||
@@ -8812,11 +8811,13 @@ void Player::Yell(uint32 textId, WorldObject const* target /*= nullptr*/)
|
|||||||
void Player::TextEmote(std::string_view text, WorldObject const* /*= nullptr*/, bool /*= false*/)
|
void Player::TextEmote(std::string_view text, WorldObject const* /*= nullptr*/, bool /*= false*/)
|
||||||
{
|
{
|
||||||
std::string _text(text);
|
std::string _text(text);
|
||||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text);
|
|
||||||
#ifdef ELUNA
|
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text))
|
||||||
if (!sEluna->OnChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text))
|
{
|
||||||
return;
|
return;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnPlayerChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text);
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_EMOTE, LANG_UNIVERSAL, this, this, _text);
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_EMOTE, LANG_UNIVERSAL, this, this, _text);
|
||||||
@@ -8838,13 +8839,13 @@ void Player::Whisper(std::string_view text, Language language, Player* target, b
|
|||||||
language = LANG_UNIVERSAL; // whispers should always be readable
|
language = LANG_UNIVERSAL; // whispers should always be readable
|
||||||
|
|
||||||
std::string _text(text);
|
std::string _text(text);
|
||||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, target);
|
|
||||||
#ifdef ELUNA
|
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text, target))
|
||||||
if (!sEluna->OnChat(this, CHAT_MSG_WHISPER, language, _text, target))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, target);
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, language, this, this, _text);
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, language, this, this, _text);
|
||||||
@@ -12803,9 +12804,6 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
|
|||||||
if (loot->containerGUID)
|
if (loot->containerGUID)
|
||||||
sLootItemStorage->RemoveStoredLootItem(loot->containerGUID, item->itemid, item->count, loot, item->itemIndex);
|
sLootItemStorage->RemoveStoredLootItem(loot->containerGUID, item->itemid, item->count, loot, item->itemIndex);
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnLootItem(this, newitem, item->count, this->GetLootGUID());
|
|
||||||
#endif
|
|
||||||
sScriptMgr->OnLootItem(this, newitem, item->count, this->GetLootGUID());
|
sScriptMgr->OnLootItem(this, newitem, item->count, this->GetLootGUID());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -13235,9 +13233,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
|
|||||||
m_usedTalentCount += talentPointsChange;
|
m_usedTalentCount += talentPointsChange;
|
||||||
SetFreeTalentPoints(CurTalentPoints - talentPointsChange);
|
SetFreeTalentPoints(CurTalentPoints - talentPointsChange);
|
||||||
|
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnPlayerLearnTalents(this, talentId, talentRank, spellId);
|
||||||
sEluna->OnLearnTalents(this, talentId, talentRank, spellId);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRank)
|
void Player::LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRank)
|
||||||
|
|||||||
@@ -30,10 +30,6 @@
|
|||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/*** QUEST SYSTEM ***/
|
/*** QUEST SYSTEM ***/
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
@@ -429,10 +425,7 @@ void Player::AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver)
|
|||||||
switch (questGiver->GetTypeId())
|
switch (questGiver->GetTypeId())
|
||||||
{
|
{
|
||||||
case TYPEID_UNIT:
|
case TYPEID_UNIT:
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnQuestAccept(this, questGiver->ToCreature(), quest);
|
||||||
sEluna->OnQuestAccept(this, questGiver->ToCreature(), quest);
|
|
||||||
#endif
|
|
||||||
sScriptMgr->OnQuestAccept(this, (questGiver->ToCreature()), quest);
|
|
||||||
questGiver->ToCreature()->AI()->sQuestAccept(this, quest);
|
questGiver->ToCreature()->AI()->sQuestAccept(this, quest);
|
||||||
break;
|
break;
|
||||||
case TYPEID_ITEM:
|
case TYPEID_ITEM:
|
||||||
@@ -458,9 +451,6 @@ void Player::AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TYPEID_GAMEOBJECT:
|
case TYPEID_GAMEOBJECT:
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnQuestAccept(this, questGiver->ToGameObject(), quest);
|
|
||||||
#endif
|
|
||||||
sScriptMgr->OnQuestAccept(this, questGiver->ToGameObject(), quest);
|
sScriptMgr->OnQuestAccept(this, questGiver->ToGameObject(), quest);
|
||||||
questGiver->ToGameObject()->AI()->QuestAccept(this, quest);
|
questGiver->ToGameObject()->AI()->QuestAccept(this, quest);
|
||||||
break;
|
break;
|
||||||
@@ -1566,13 +1556,12 @@ QuestGiverStatus Player::GetQuestDialogStatus(Object* questgiver)
|
|||||||
QuestRelationBounds qr;
|
QuestRelationBounds qr;
|
||||||
QuestRelationBounds qir;
|
QuestRelationBounds qir;
|
||||||
|
|
||||||
|
sScriptMgr->GetDialogStatus(this, questgiver);
|
||||||
|
|
||||||
switch (questgiver->GetTypeId())
|
switch (questgiver->GetTypeId())
|
||||||
{
|
{
|
||||||
case TYPEID_GAMEOBJECT:
|
case TYPEID_GAMEOBJECT:
|
||||||
{
|
{
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->GetDialogStatus(this, questgiver->ToGameObject());
|
|
||||||
#endif
|
|
||||||
QuestGiverStatus questStatus = QuestGiverStatus(sScriptMgr->GetDialogStatus(this, questgiver->ToGameObject()));
|
QuestGiverStatus questStatus = QuestGiverStatus(sScriptMgr->GetDialogStatus(this, questgiver->ToGameObject()));
|
||||||
if (questStatus != DIALOG_STATUS_SCRIPTED_NO_STATUS)
|
if (questStatus != DIALOG_STATUS_SCRIPTED_NO_STATUS)
|
||||||
return questStatus;
|
return questStatus;
|
||||||
@@ -1582,9 +1571,6 @@ QuestGiverStatus Player::GetQuestDialogStatus(Object* questgiver)
|
|||||||
}
|
}
|
||||||
case TYPEID_UNIT:
|
case TYPEID_UNIT:
|
||||||
{
|
{
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->GetDialogStatus(this, questgiver->ToCreature());
|
|
||||||
#endif
|
|
||||||
QuestGiverStatus questStatus = QuestGiverStatus(sScriptMgr->GetDialogStatus(this, questgiver->ToCreature()));
|
QuestGiverStatus questStatus = QuestGiverStatus(sScriptMgr->GetDialogStatus(this, questgiver->ToCreature()));
|
||||||
if (questStatus != DIALOG_STATUS_SCRIPTED_NO_STATUS)
|
if (questStatus != DIALOG_STATUS_SCRIPTED_NO_STATUS)
|
||||||
return questStatus;
|
return questStatus;
|
||||||
|
|||||||
@@ -76,10 +76,6 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/*** STORAGE SYSTEM ***/
|
/*** STORAGE SYSTEM ***/
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
@@ -2340,13 +2336,6 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
|
|||||||
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
|
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryResult result = EQUIP_ERR_OK;
|
|
||||||
|
|
||||||
if (!sScriptMgr->CanUseItem(const_cast<Player*>(this), proto, result))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getLevel() < proto->RequiredLevel)
|
if (getLevel() < proto->RequiredLevel)
|
||||||
{
|
{
|
||||||
return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
|
return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
|
||||||
@@ -2358,13 +2347,12 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
|
|||||||
return EQUIP_ERR_CANT_DO_RIGHT_NOW;
|
return EQUIP_ERR_CANT_DO_RIGHT_NOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ELUNA
|
InventoryResult result = EQUIP_ERR_OK;
|
||||||
InventoryResult eres = sEluna->OnCanUseItem(this, proto->ItemId);
|
|
||||||
if (eres != EQUIP_ERR_OK)
|
if (!sScriptMgr->CanUseItem(const_cast<Player*>(this), proto, result))
|
||||||
{
|
{
|
||||||
return eres;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return EQUIP_ERR_OK;
|
return EQUIP_ERR_OK;
|
||||||
}
|
}
|
||||||
@@ -2851,9 +2839,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
|
|||||||
pItem2->SetState(ITEM_CHANGED, this);
|
pItem2->SetState(ITEM_CHANGED, this);
|
||||||
|
|
||||||
ApplyEquipCooldown(pItem2);
|
ApplyEquipCooldown(pItem2);
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnEquip(this, pItem2, bag, slot, update);
|
||||||
sEluna->OnEquip(this, pItem2, bag, slot);
|
|
||||||
#endif
|
|
||||||
return pItem2;
|
return pItem2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2861,10 +2847,6 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
|
|||||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
|
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
|
||||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);
|
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnEquip(this, pItem, bag, slot);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sScriptMgr->OnEquip(this, pItem, bag, slot, update);
|
sScriptMgr->OnEquip(this, pItem, bag, slot, update);
|
||||||
UpdateForQuestWorldObjects();
|
UpdateForQuestWorldObjects();
|
||||||
return pItem;
|
return pItem;
|
||||||
@@ -2889,9 +2871,7 @@ void Player::QuickEquipItem(uint16 pos, Item* pItem)
|
|||||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
|
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
|
||||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);
|
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);
|
||||||
|
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnEquip(this, pItem, (pos >> 8), slot, true);
|
||||||
sEluna->OnEquip(this, pItem, (pos >> 8), slot);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,11 +70,6 @@
|
|||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "ElunaEventMgr.h"
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float baseMoveSpeed[MAX_MOVE_TYPE] =
|
float baseMoveSpeed[MAX_MOVE_TYPE] =
|
||||||
{
|
{
|
||||||
2.5f, // MOVE_WALK
|
2.5f, // MOVE_WALK
|
||||||
@@ -387,9 +382,8 @@ Unit::~Unit()
|
|||||||
|
|
||||||
void Unit::Update(uint32 p_time)
|
void Unit::Update(uint32 p_time)
|
||||||
{
|
{
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnUnitUpdate(this, p_time);
|
||||||
elunaEvents->Update(p_time);
|
|
||||||
#endif
|
|
||||||
// WARNING! Order of execution here is important, do not change.
|
// WARNING! Order of execution here is important, do not change.
|
||||||
// Spells must be processed with event system BEFORE they go to _UpdateSpells.
|
// Spells must be processed with event system BEFORE they go to _UpdateSpells.
|
||||||
// Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad.
|
// Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad.
|
||||||
@@ -12991,10 +12985,11 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy, uint32 duration)
|
|||||||
|
|
||||||
controlled->SetInCombatState(PvP, enemy, duration);
|
controlled->SetInCombatState(PvP, enemy, duration);
|
||||||
}
|
}
|
||||||
#ifdef ELUNA
|
|
||||||
if (Player* player = this->ToPlayer())
|
if (Player* player = this->ToPlayer())
|
||||||
sEluna->OnPlayerEnterCombat(player, enemy);
|
{
|
||||||
#endif
|
sScriptMgr->OnPlayerEnterCombat(player, enemy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::ClearInCombat()
|
void Unit::ClearInCombat()
|
||||||
@@ -13025,10 +13020,11 @@ void Unit::ClearInCombat()
|
|||||||
for (uint8 i = 0; i < MAX_RUNES; ++i)
|
for (uint8 i = 0; i < MAX_RUNES; ++i)
|
||||||
player->SetGracePeriod(i, 0);
|
player->SetGracePeriod(i, 0);
|
||||||
}
|
}
|
||||||
#ifdef ELUNA
|
|
||||||
if (Player* player = this->ToPlayer())
|
if (Player* player = this->ToPlayer())
|
||||||
sEluna->OnPlayerLeaveCombat(player);
|
{
|
||||||
#endif
|
sScriptMgr->OnPlayerLeaveCombat(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::ClearInPetCombat()
|
void Unit::ClearInPetCombat()
|
||||||
|
|||||||
@@ -34,10 +34,6 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GameEventMgr* GameEventMgr::instance()
|
GameEventMgr* GameEventMgr::instance()
|
||||||
{
|
{
|
||||||
static GameEventMgr instance;
|
static GameEventMgr instance;
|
||||||
|
|||||||
@@ -6003,12 +6003,10 @@ uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, ui
|
|||||||
uint32 submask = 1 << ((i - 1) % 32);
|
uint32 submask = 1 << ((i - 1) % 32);
|
||||||
|
|
||||||
// skip not taxi network nodes
|
// skip not taxi network nodes
|
||||||
#ifndef ELUNA
|
|
||||||
if ((sTaxiNodesMask[field] & submask) == 0)
|
|
||||||
#else
|
|
||||||
if (field >= TaxiMaskSize || (sTaxiNodesMask[field] & submask) == 0)
|
if (field >= TaxiMaskSize || (sTaxiNodesMask[field] & submask) == 0)
|
||||||
#endif
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
float dist2 = (node->x - x) * (node->x - x) + (node->y - y) * (node->y - y) + (node->z - z) * (node->z - z);
|
float dist2 = (node->x - x) * (node->x - x) + (node->y - y) * (node->y - y) + (node->z - z) * (node->z - z);
|
||||||
if (found)
|
if (found)
|
||||||
|
|||||||
@@ -56,10 +56,6 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class LoginQueryHolder : public CharacterDatabaseQueryHolder
|
class LoginQueryHolder : public CharacterDatabaseQueryHolder
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -39,10 +39,6 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline bool isNasty(uint8 c)
|
inline bool isNasty(uint8 c)
|
||||||
{
|
{
|
||||||
if (c == '\t')
|
if (c == '\t')
|
||||||
@@ -431,11 +427,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||||||
if (type == CHAT_MSG_PARTY_LEADER && !group->IsLeader(sender->GetGUID()))
|
if (type == CHAT_MSG_PARTY_LEADER && !group->IsLeader(sender->GetGUID()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
if (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, group))
|
||||||
#ifdef ELUNA
|
{
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
|
||||||
return;
|
return;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, ChatMsg(type), Language(lang), sender, nullptr, msg);
|
ChatHandler::BuildChatPacket(data, ChatMsg(type), Language(lang), sender, nullptr, msg);
|
||||||
group->BroadcastPacket(&data, false, group->GetMemberGroup(GetPlayer()->GetGUID()));
|
group->BroadcastPacket(&data, false, group->GetMemberGroup(GetPlayer()->GetGUID()));
|
||||||
@@ -447,12 +445,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||||||
{
|
{
|
||||||
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()))
|
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()))
|
||||||
{
|
{
|
||||||
|
if (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, guild))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild);
|
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild);
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, guild))
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
guild->BroadcastToGuild(this, false, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
guild->BroadcastToGuild(this, false, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -464,12 +463,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||||||
{
|
{
|
||||||
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()))
|
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()))
|
||||||
{
|
{
|
||||||
|
if (sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, guild))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild);
|
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild);
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, guild))
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
guild->BroadcastToGuild(this, true, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
guild->BroadcastToGuild(this, true, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -486,11 +486,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
if (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, group))
|
||||||
#ifdef ELUNA
|
{
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
|
||||||
return;
|
return;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID, Language(lang), sender, nullptr, msg);
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID, Language(lang), sender, nullptr, msg);
|
||||||
group->BroadcastPacket(&data, false);
|
group->BroadcastPacket(&data, false);
|
||||||
@@ -507,11 +509,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
if (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, group))
|
||||||
#ifdef ELUNA
|
{
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
|
||||||
return;
|
return;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_LEADER, Language(lang), sender, nullptr, msg);
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_LEADER, Language(lang), sender, nullptr, msg);
|
||||||
group->BroadcastPacket(&data, false);
|
group->BroadcastPacket(&data, false);
|
||||||
@@ -523,13 +527,15 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||||||
if (!group || !group->isRaidGroup() || !(group->IsLeader(GetPlayer()->GetGUID()) || group->IsAssistant(GetPlayer()->GetGUID())) || group->isBGGroup())
|
if (!group || !group->isRaidGroup() || !(group->IsLeader(GetPlayer()->GetGUID()) || group->IsAssistant(GetPlayer()->GetGUID())) || group->isBGGroup())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
if (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, group))
|
||||||
#ifdef ELUNA
|
{
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
|
||||||
return;
|
return;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||||
|
|
||||||
|
// In battleground, raid warning is sent only to players in battleground - code is ok
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
//in battleground, raid warning is sent only to players in battleground - code is ok
|
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_WARNING, Language(lang), sender, nullptr, msg);
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_WARNING, Language(lang), sender, nullptr, msg);
|
||||||
group->BroadcastPacket(&data, false);
|
group->BroadcastPacket(&data, false);
|
||||||
}
|
}
|
||||||
@@ -541,11 +547,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||||||
if (!group || !group->isBGGroup())
|
if (!group || !group->isBGGroup())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
if (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, group))
|
||||||
#ifdef ELUNA
|
{
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
|
||||||
return;
|
return;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND, Language(lang), sender, nullptr, msg);
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND, Language(lang), sender, nullptr, msg);
|
||||||
group->BroadcastPacket(&data, false);
|
group->BroadcastPacket(&data, false);
|
||||||
@@ -558,11 +566,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||||||
if (!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetGUID()))
|
if (!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetGUID()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
if (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, group))
|
||||||
#ifdef ELUNA
|
{
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
|
||||||
return;
|
return;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND_LEADER, Language(lang), sender, nullptr, msg);
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND_LEADER, Language(lang), sender, nullptr, msg);
|
||||||
group->BroadcastPacket(&data, false);
|
group->BroadcastPacket(&data, false);
|
||||||
@@ -583,12 +593,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||||||
{
|
{
|
||||||
if (Channel* chn = cMgr->GetChannel(channel, sender))
|
if (Channel* chn = cMgr->GetChannel(channel, sender))
|
||||||
{
|
{
|
||||||
|
if (!sScriptMgr->CanPlayerUseChat(sender, type, lang, msg, chn))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sScriptMgr->OnPlayerChat(sender, type, lang, msg, chn);
|
sScriptMgr->OnPlayerChat(sender, type, lang, msg, chn);
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
if (!sEluna->OnChat(sender, type, lang, msg, chn))
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
chn->Say(sender->GetGUID(), msg.c_str(), lang);
|
chn->Say(sender->GetGUID(), msg.c_str(), lang);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -615,11 +626,12 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||||||
sender->ToggleAFK();
|
sender->ToggleAFK();
|
||||||
}
|
}
|
||||||
|
|
||||||
sScriptMgr->OnPlayerChat(sender, type, lang, msg);
|
if (!sScriptMgr->CanPlayerUseChat(sender, type, lang, msg))
|
||||||
#ifdef ELUNA
|
{
|
||||||
if (!sEluna->OnChat(sender, type, lang, msg))
|
|
||||||
return;
|
return;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnPlayerChat(sender, type, lang, msg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -642,11 +654,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||||||
sender->ToggleDND();
|
sender->ToggleDND();
|
||||||
}
|
}
|
||||||
|
|
||||||
sScriptMgr->OnPlayerChat(sender, type, lang, msg);
|
if (!sScriptMgr->CanPlayerUseChat(sender, type, lang, msg))
|
||||||
#ifdef ELUNA
|
{
|
||||||
if (!sEluna->OnChat(sender, type, lang, msg))
|
|
||||||
return;
|
return;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnPlayerChat(sender, type, lang, msg);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -26,13 +26,10 @@
|
|||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "Opcodes.h"
|
#include "Opcodes.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
#include "ScriptMgr.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
|
void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_LOOT_ITEM");
|
LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_LOOT_ITEM");
|
||||||
@@ -210,9 +207,9 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
|
|||||||
data << uint8(1); // "You loot..."
|
data << uint8(1); // "You loot..."
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnLootMoney(player, loot->gold);
|
sScriptMgr->OnLootMoney(player, loot->gold);
|
||||||
#endif
|
|
||||||
loot->gold = 0;
|
loot->gold = 0;
|
||||||
|
|
||||||
// Delete the money loot record from the DB
|
// Delete the money loot record from the DB
|
||||||
@@ -494,10 +491,6 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
|
|||||||
target->SendNewItem(newitem, uint32(item.count), false, false, true);
|
target->SendNewItem(newitem, uint32(item.count), false, false, true);
|
||||||
target->UpdateLootAchievements(&item, loot);
|
target->UpdateLootAchievements(&item, loot);
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnLootItem(target, newitem, item.count, lootguid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// mark as looted
|
// mark as looted
|
||||||
item.count = 0;
|
item.count = 0;
|
||||||
item.is_looted = true;
|
item.is_looted = true;
|
||||||
|
|||||||
@@ -51,10 +51,6 @@
|
|||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data)
|
void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_REPOP_REQUEST Message");
|
LOG_DEBUG("network", "WORLD: Recvd CMSG_REPOP_REQUEST Message");
|
||||||
@@ -79,10 +75,6 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data)
|
|||||||
GetPlayer()->KillPlayer();
|
GetPlayer()->KillPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnRepop(GetPlayer());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//this is spirit release confirm?
|
//this is spirit release confirm?
|
||||||
GetPlayer()->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
|
GetPlayer()->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
|
||||||
GetPlayer()->BuildPlayerRepop();
|
GetPlayer()->BuildPlayerRepop();
|
||||||
|
|||||||
@@ -31,10 +31,6 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
|
void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
|
||||||
{
|
{
|
||||||
ObjectGuid guid;
|
ObjectGuid guid;
|
||||||
@@ -93,11 +89,6 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData)
|
|||||||
//if (!creature->GetTransport()) // pussywizard: reverted with new spline (old: without this check, npc would stay in place and the transport would continue moving, so the npc falls off. NPCs on transports don't have waypoints, so stopmoving is not needed)
|
//if (!creature->GetTransport()) // pussywizard: reverted with new spline (old: without this check, npc would stay in place and the transport would continue moving, so the npc falls off. NPCs on transports don't have waypoints, so stopmoving is not needed)
|
||||||
creature->StopMoving();
|
creature->StopMoving();
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
if (sEluna->OnGossipHello(_player, creature))
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (sScriptMgr->OnGossipHello(_player, creature))
|
if (sScriptMgr->OnGossipHello(_player, creature))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -425,9 +416,9 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData)
|
|||||||
_player->AbandonQuest(questId); // remove all quest items player received before abandoning quest.
|
_player->AbandonQuest(questId); // remove all quest items player received before abandoning quest.
|
||||||
_player->RemoveActiveQuest(questId);
|
_player->RemoveActiveQuest(questId);
|
||||||
_player->RemoveTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, questId);
|
_player->RemoveTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, questId);
|
||||||
#ifdef ELUNA
|
|
||||||
sEluna->OnQuestAbandon(_player, questId);
|
sScriptMgr->OnQuestAbandon(_player, questId);
|
||||||
#endif
|
|
||||||
LOG_DEBUG("network.opcode", "Player %s abandoned quest %u", _player->GetGUID().ToString().c_str(), questId);
|
LOG_DEBUG("network.opcode", "Player %s abandoned quest %u", _player->GetGUID().ToString().c_str(), questId);
|
||||||
// check if Quest Tracker is enabled
|
// check if Quest Tracker is enabled
|
||||||
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER))
|
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER))
|
||||||
|
|||||||
@@ -32,10 +32,6 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets)
|
void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets)
|
||||||
{
|
{
|
||||||
// some spell cast packet including more data (for projectiles?)
|
// some spell cast packet including more data (for projectiles?)
|
||||||
|
|||||||
@@ -40,10 +40,6 @@
|
|||||||
#include "VMapMgr2.h"
|
#include "VMapMgr2.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
union u_map_magic
|
union u_map_magic
|
||||||
{
|
{
|
||||||
char asChar[4];
|
char asChar[4];
|
||||||
@@ -2999,37 +2995,38 @@ void InstanceMap::AfterPlayerUnlinkFromMap()
|
|||||||
|
|
||||||
void InstanceMap::CreateInstanceScript(bool load, std::string data, uint32 completedEncounterMask)
|
void InstanceMap::CreateInstanceScript(bool load, std::string data, uint32 completedEncounterMask)
|
||||||
{
|
{
|
||||||
if (instance_data != nullptr)
|
|
||||||
return;
|
|
||||||
#ifdef ELUNA
|
|
||||||
bool isElunaAI = false;
|
|
||||||
instance_data = sEluna->GetInstanceData(this);
|
|
||||||
if (instance_data)
|
if (instance_data)
|
||||||
isElunaAI = true;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isOtherAI = false;
|
||||||
|
|
||||||
|
sScriptMgr->OnBeforeCreateInstanceScript(this, instance_data, load, data, completedEncounterMask);
|
||||||
|
|
||||||
|
if (instance_data)
|
||||||
|
isOtherAI = true;
|
||||||
|
|
||||||
// if Eluna AI was fetched succesfully we should not call CreateInstanceData nor set the unused scriptID
|
// if Eluna AI was fetched succesfully we should not call CreateInstanceData nor set the unused scriptID
|
||||||
if (!isElunaAI)
|
if (!isOtherAI)
|
||||||
{
|
{
|
||||||
#endif
|
|
||||||
InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(GetId());
|
InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(GetId());
|
||||||
if (mInstance)
|
if (mInstance)
|
||||||
{
|
{
|
||||||
i_script_id = mInstance->ScriptId;
|
i_script_id = mInstance->ScriptId;
|
||||||
instance_data = sScriptMgr->CreateInstanceScript(this);
|
instance_data = sScriptMgr->CreateInstanceScript(this);
|
||||||
}
|
}
|
||||||
#ifdef ELUNA
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!instance_data)
|
if (!instance_data)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
// use mangos behavior if we are dealing with Eluna AI
|
// use mangos behavior if we are dealing with Eluna AI
|
||||||
// initialize should then be called only if load is false
|
// initialize should then be called only if load is false
|
||||||
if (!isElunaAI || !load)
|
if (!isOtherAI || !load)
|
||||||
#endif
|
{
|
||||||
instance_data->Initialize();
|
instance_data->Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
if (load)
|
if (load)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,12 +23,9 @@
|
|||||||
#include "MapMgr.h"
|
#include "MapMgr.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
#include "ScriptMgr.h"
|
||||||
#include "VMapFactory.h"
|
#include "VMapFactory.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
MapInstanced::MapInstanced(uint32 id) : Map(id, 0, DUNGEON_DIFFICULTY_NORMAL)
|
MapInstanced::MapInstanced(uint32 id) : Map(id, 0, DUNGEON_DIFFICULTY_NORMAL)
|
||||||
{
|
{
|
||||||
// initialize instanced maps list
|
// initialize instanced maps list
|
||||||
@@ -253,23 +250,17 @@ BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battlegroun
|
|||||||
bool MapInstanced::DestroyInstance(InstancedMaps::iterator& itr)
|
bool MapInstanced::DestroyInstance(InstancedMaps::iterator& itr)
|
||||||
{
|
{
|
||||||
itr->second->RemoveAllPlayers();
|
itr->second->RemoveAllPlayers();
|
||||||
|
|
||||||
if (itr->second->HavePlayers())
|
if (itr->second->HavePlayers())
|
||||||
{
|
{
|
||||||
++itr;
|
++itr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnDestroyInstance(this, itr->second);
|
||||||
|
|
||||||
itr->second->UnloadAll();
|
itr->second->UnloadAll();
|
||||||
|
|
||||||
// Free up the instance id and allow it to be reused for bgs and arenas (other instances are handled in the InstanceSaveMgr)
|
|
||||||
//if (itr->second->IsBattlegroundOrArena())
|
|
||||||
// sMapMgr->FreeInstanceId(itr->second->GetInstanceId());
|
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
//todo:[ELUNA] I'm not sure this is right.
|
|
||||||
sEluna->FreeInstanceId(itr->second->GetInstanceId());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// erase map
|
// erase map
|
||||||
delete itr->second;
|
delete itr->second;
|
||||||
m_InstancedMaps.erase(itr++);
|
m_InstancedMaps.erase(itr++);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class MapInstanced : public Map
|
|||||||
{
|
{
|
||||||
friend class MapMgr;
|
friend class MapMgr;
|
||||||
public:
|
public:
|
||||||
typedef std::unordered_map< uint32, Map*> InstancedMaps;
|
using InstancedMaps = std::unordered_map<uint32, Map*>;
|
||||||
|
|
||||||
MapInstanced(uint32 id);
|
MapInstanced(uint32 id);
|
||||||
~MapInstanced() override {}
|
~MapInstanced() override {}
|
||||||
|
|||||||
@@ -36,10 +36,6 @@
|
|||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
MapMgr::MapMgr()
|
MapMgr::MapMgr()
|
||||||
{
|
{
|
||||||
i_timer[3].SetInterval(sWorld->getIntConfig(CONFIG_INTERVAL_MAPUPDATE));
|
i_timer[3].SetInterval(sWorld->getIntConfig(CONFIG_INTERVAL_MAPUPDATE));
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Affero General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ModuleMgr.h"
|
||||||
|
#include "Log.h"
|
||||||
|
#include "Tokenize.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
std::string_view _modulesList = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void Acore::Module::SetEnableModulesList(std::string_view modulesList)
|
||||||
|
{
|
||||||
|
_modulesList = modulesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string_view> Acore::Module::GetEnableModulesList()
|
||||||
|
{
|
||||||
|
std::vector<std::string_view> _list;
|
||||||
|
|
||||||
|
for (auto const& modName : Acore::Tokenize(_modulesList, ',', false))
|
||||||
|
{
|
||||||
|
_list.emplace_back(modName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _list;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Affero General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MODULE_MGR_H_
|
||||||
|
#define _MODULE_MGR_H_
|
||||||
|
|
||||||
|
#include "Define.h"
|
||||||
|
#include <string_view>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Acore::Module
|
||||||
|
{
|
||||||
|
AC_COMMON_API void SetEnableModulesList(std::string_view modulesList);
|
||||||
|
AC_COMMON_API std::vector<std::string_view> GetEnableModulesList();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -43,43 +43,44 @@ class Battleground;
|
|||||||
class BattlegroundMap;
|
class BattlegroundMap;
|
||||||
class BattlegroundQueue;
|
class BattlegroundQueue;
|
||||||
class Channel;
|
class Channel;
|
||||||
|
class ChatHandler;
|
||||||
class Creature;
|
class Creature;
|
||||||
class CreatureAI;
|
class CreatureAI;
|
||||||
class DynamicObject;
|
class DynamicObject;
|
||||||
class GameObject;
|
class GameObject;
|
||||||
class GameObjectAI;
|
class GameObjectAI;
|
||||||
class Guild;
|
|
||||||
class GridMap;
|
class GridMap;
|
||||||
class Group;
|
class Group;
|
||||||
|
class Guild;
|
||||||
class InstanceMap;
|
class InstanceMap;
|
||||||
class InstanceScript;
|
class InstanceScript;
|
||||||
class Item;
|
class Item;
|
||||||
class Map;
|
class Map;
|
||||||
|
class MotionTransport;
|
||||||
class OutdoorPvP;
|
class OutdoorPvP;
|
||||||
class Player;
|
class Player;
|
||||||
class Quest;
|
class Quest;
|
||||||
class ScriptMgr;
|
class ScriptMgr;
|
||||||
class Spell;
|
class Spell;
|
||||||
class SpellScript;
|
|
||||||
class SpellInfo;
|
|
||||||
class SpellCastTargets;
|
class SpellCastTargets;
|
||||||
class Transport;
|
class SpellInfo;
|
||||||
|
class SpellScript;
|
||||||
class StaticTransport;
|
class StaticTransport;
|
||||||
class MotionTransport;
|
class Transport;
|
||||||
class Unit;
|
class Unit;
|
||||||
class Vehicle;
|
class Vehicle;
|
||||||
|
class WorldObject;
|
||||||
class WorldPacket;
|
class WorldPacket;
|
||||||
class WorldSocket;
|
class WorldSocket;
|
||||||
class WorldObject;
|
|
||||||
|
|
||||||
struct AchievementCriteriaData;
|
struct AchievementCriteriaData;
|
||||||
struct AuctionEntry;
|
struct AuctionEntry;
|
||||||
struct ConditionSourceInfo;
|
|
||||||
struct Condition;
|
struct Condition;
|
||||||
|
struct ConditionSourceInfo;
|
||||||
struct DungeonProgressionRequirements;
|
struct DungeonProgressionRequirements;
|
||||||
|
struct GroupQueueInfo;
|
||||||
struct ItemTemplate;
|
struct ItemTemplate;
|
||||||
struct OutdoorPvPData;
|
struct OutdoorPvPData;
|
||||||
struct GroupQueueInfo;
|
|
||||||
struct TargetInfo;
|
struct TargetInfo;
|
||||||
|
|
||||||
namespace Acore::ChatCommands
|
namespace Acore::ChatCommands
|
||||||
@@ -167,13 +168,24 @@ public:
|
|||||||
// being open; it is not.
|
// being open; it is not.
|
||||||
virtual void OnSocketClose(std::shared_ptr<WorldSocket> /*socket*/) { }
|
virtual void OnSocketClose(std::shared_ptr<WorldSocket> /*socket*/) { }
|
||||||
|
|
||||||
// Called when a packet is sent to a client. The packet object is a copy of the original packet, so reading
|
/**
|
||||||
// and modifying it is safe.
|
* @brief This hook called when a packet is sent to a client. The packet object is a copy of the original packet, so reading and modifying it is safe.
|
||||||
virtual void OnPacketSend(WorldSession* /*session*/, WorldPacket& /*packet*/) { }
|
*
|
||||||
|
* @param session Contains information about the WorldSession
|
||||||
|
* @param packet Contains information about the WorldPacket
|
||||||
|
* @return True if you want to continue sending the packet, false if you want to disallow sending the packet
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool CanPacketSend(WorldSession* /*session*/, WorldPacket& /*packet*/) { return true; }
|
||||||
|
|
||||||
// Called when a (valid) packet is received by a client. The packet object is a copy of the original packet, so
|
/**
|
||||||
// reading and modifying it is safe. Make sure to check WorldSession pointer before usage, it might be null in case of auth packets
|
* @brief Called when a (valid) packet is received by a client. The packet object is a copy of the original packet, so
|
||||||
virtual void OnPacketReceive(WorldSession* /*session*/, WorldPacket& /*packet*/) { }
|
* reading and modifying it is safe. Make sure to check WorldSession pointer before usage, it might be null in case of auth packets
|
||||||
|
*
|
||||||
|
* @param session Contains information about the WorldSession
|
||||||
|
* @param packet Contains information about the WorldPacket
|
||||||
|
* @return True if you want to continue receive the packet, false if you want to disallow receive the packet
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool CanPacketReceive(WorldSession* /*session*/, WorldPacket& /*packet*/) { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class WorldScript : public ScriptObject
|
class WorldScript : public ScriptObject
|
||||||
@@ -217,7 +229,12 @@ public:
|
|||||||
*
|
*
|
||||||
* @param version The cache version that we will be sending to the Client.
|
* @param version The cache version that we will be sending to the Client.
|
||||||
*/
|
*/
|
||||||
virtual void OnBeforeFinalizePlayerWorldSession(uint32& /*cacheVersion*/) {}
|
virtual void OnBeforeFinalizePlayerWorldSession(uint32& /*cacheVersion*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook runs after all scripts loading and before itialized
|
||||||
|
*/
|
||||||
|
virtual void OnBeforeWorldInitialized() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class FormulaScript : public ScriptObject
|
class FormulaScript : public ScriptObject
|
||||||
@@ -426,6 +443,14 @@ public:
|
|||||||
[[nodiscard]] virtual bool CanSetPhaseMask(Unit const* /*unit*/, uint32 /*newPhaseMask*/, bool /*update*/) { return true; }
|
[[nodiscard]] virtual bool CanSetPhaseMask(Unit const* /*unit*/, uint32 /*newPhaseMask*/, bool /*update*/) { return true; }
|
||||||
|
|
||||||
[[nodiscard]] virtual bool IsCustomBuildValuesUpdate(Unit const* /*unit*/, uint8 /*updateType*/, ByteBuffer& /*fieldBuffer*/, Player const* /*target*/, uint16 /*index*/) { return false; }
|
[[nodiscard]] virtual bool IsCustomBuildValuesUpdate(Unit const* /*unit*/, uint8 /*updateType*/, ByteBuffer& /*fieldBuffer*/, Player const* /*target*/, uint16 /*index*/) { return false; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook runs in Unit::Update
|
||||||
|
*
|
||||||
|
* @param unit Contains information about the Unit
|
||||||
|
* @param diff Contains information about the diff time
|
||||||
|
*/
|
||||||
|
virtual void OnUnitUpdate(Unit* /*unit*/, uint32 /*diff*/) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class MovementHandlerScript : public ScriptObject
|
class MovementHandlerScript : public ScriptObject
|
||||||
@@ -444,11 +469,62 @@ protected:
|
|||||||
AllMapScript(const char* name);
|
AllMapScript(const char* name);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Called when a player enters any Map
|
/**
|
||||||
|
* @brief This hook called when a player enters any Map
|
||||||
|
*
|
||||||
|
* @param map Contains information about the Map
|
||||||
|
* @param player Contains information about the Player
|
||||||
|
*/
|
||||||
virtual void OnPlayerEnterAll(Map* /*map*/, Player* /*player*/) { }
|
virtual void OnPlayerEnterAll(Map* /*map*/, Player* /*player*/) { }
|
||||||
|
|
||||||
// Called when a player leave any Map
|
/**
|
||||||
|
* @brief This hook called when a player leave any Map
|
||||||
|
*
|
||||||
|
* @param map Contains information about the Map
|
||||||
|
* @param player Contains information about the Player
|
||||||
|
*/
|
||||||
virtual void OnPlayerLeaveAll(Map* /*map*/, Player* /*player*/) { }
|
virtual void OnPlayerLeaveAll(Map* /*map*/, Player* /*player*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called before create instance script
|
||||||
|
*
|
||||||
|
* @param instanceMap Contains information about the WorldSession
|
||||||
|
* @param instanceData Contains information about the WorldPacket
|
||||||
|
* @param load if true loading instance save data
|
||||||
|
* @param data Contains information about the instance save data
|
||||||
|
* @param completedEncounterMask Contains information about the completed encouter mask
|
||||||
|
*/
|
||||||
|
virtual void OnBeforeCreateInstanceScript(InstanceMap* /*instanceMap*/, InstanceScript* /*instanceData*/, bool /*load*/, std::string /*data*/, uint32 /*completedEncounterMask*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called before destroy instance
|
||||||
|
*
|
||||||
|
* @param mapInstanced Contains information about the MapInstanced
|
||||||
|
* @param map Contains information about the Map
|
||||||
|
*/
|
||||||
|
virtual void OnDestroyInstance(MapInstanced* /*mapInstanced*/, Map* /*map*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called before creating map
|
||||||
|
*
|
||||||
|
* @param map Contains information about the Map
|
||||||
|
*/
|
||||||
|
virtual void OnCreateMap(Map* /*map*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called before destroing map
|
||||||
|
*
|
||||||
|
* @param map Contains information about the Map
|
||||||
|
*/
|
||||||
|
virtual void OnDestroyMap(Map* /*map*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called before updating map
|
||||||
|
*
|
||||||
|
* @param map Contains information about the Map
|
||||||
|
* @param diff Contains information about the diff time
|
||||||
|
*/
|
||||||
|
virtual void OnMapUpdate(Map* /*map*/, uint32 /*diff*/) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class AllCreatureScript : public ScriptObject
|
class AllCreatureScript : public ScriptObject
|
||||||
@@ -462,6 +538,147 @@ public:
|
|||||||
|
|
||||||
// Called from End of Creature SelectLevel.
|
// Called from End of Creature SelectLevel.
|
||||||
virtual void Creature_SelectLevel(const CreatureTemplate* /*cinfo*/, Creature* /*creature*/) { }
|
virtual void Creature_SelectLevel(const CreatureTemplate* /*cinfo*/, Creature* /*creature*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook runs after add creature in world
|
||||||
|
*
|
||||||
|
* @param creature Contains information about the Creature
|
||||||
|
*/
|
||||||
|
virtual void OnCreatureAddWorld(Creature* /*creature*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook runs after remove creature in world
|
||||||
|
*
|
||||||
|
* @param creature Contains information about the Creature
|
||||||
|
*/
|
||||||
|
virtual void OnCreatureRemoveWorld(Creature* /*creature*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called when a player opens a gossip dialog with the creature.
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player
|
||||||
|
* @param creature Contains information about the Creature
|
||||||
|
*
|
||||||
|
* @return False if you want to continue, true if you want to disable
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool CanCreatureGossipHello(Player* /*player*/, Creature* /*creature*/) { return false; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called when a player selects a gossip item in the creature's gossip menu.
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player
|
||||||
|
* @param creature Contains information about the Creature
|
||||||
|
* @param sender Contains information about the sender type
|
||||||
|
* @param action Contains information about the action id
|
||||||
|
*
|
||||||
|
* @return False if you want to continue, true if you want to disable
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool CanCreatureGossipSelect(Player* /*player*/, Creature* /*creature*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called when a player selects a gossip with a code in the creature's gossip menu.
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player
|
||||||
|
* @param creature Contains information about the Creature
|
||||||
|
* @param sender Contains information about the sender type
|
||||||
|
* @param action Contains information about the action id
|
||||||
|
* @param code Contains information about the code entered
|
||||||
|
*
|
||||||
|
* @return True if you want to continue, false if you want to disable
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool CanCreatureGossipSelectCode(Player* /*player*/, Creature* /*creature*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { return false; }
|
||||||
|
|
||||||
|
// Called when a player accepts a quest from the creature.
|
||||||
|
[[nodiscard]] virtual bool CanCreatureQuestAccept(Player* /*player*/, Creature* /*creature*/, Quest const* /*quest*/) { return false; }
|
||||||
|
|
||||||
|
// Called when a player selects a quest reward.
|
||||||
|
[[nodiscard]] virtual bool CanCreatureQuestReward(Player* /*player*/, Creature* /*creature*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
|
||||||
|
|
||||||
|
// Called when a CreatureAI object is needed for the creature.
|
||||||
|
[[nodiscard]] virtual CreatureAI* GetCreatureAI(Creature* /*creature*/) const { return nullptr; }
|
||||||
|
};
|
||||||
|
|
||||||
|
class AllItemScript : public ScriptObject
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
AllItemScript(const char* name);
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Called when a player accepts a quest from the item.
|
||||||
|
[[nodiscard]] virtual bool CanItemQuestAccept(Player* /*player*/, Item* /*item*/, Quest const* /*quest*/) { return true; }
|
||||||
|
|
||||||
|
// Called when a player uses the item.
|
||||||
|
[[nodiscard]] virtual bool CanItemUse(Player* /*player*/, Item* /*item*/, SpellCastTargets const& /*targets*/) { return false; }
|
||||||
|
|
||||||
|
// Called when the item is destroyed.
|
||||||
|
[[nodiscard]] virtual bool CanItemRemove(Player* /*player*/, Item* /*item*/) { return true; }
|
||||||
|
|
||||||
|
// Called when the item expires (is destroyed).
|
||||||
|
[[nodiscard]] virtual bool CanItemExpire(Player* /*player*/, ItemTemplate const* /*proto*/) { return true; }
|
||||||
|
|
||||||
|
// Called when a player selects an option in an item gossip window
|
||||||
|
virtual void OnItemGossipSelect(Player* /*player*/, Item* /*item*/, uint32 /*sender*/, uint32 /*action*/) { }
|
||||||
|
|
||||||
|
// Called when a player selects an option in an item gossip window
|
||||||
|
virtual void OnItemGossipSelectCode(Player* /*player*/, Item* /*item*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
class AllGameObjectScript : public ScriptObject
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
AllGameObjectScript(const char* name);
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief This hook runs after add game object in world
|
||||||
|
*
|
||||||
|
* @param go Contains information about the GameObject
|
||||||
|
*/
|
||||||
|
virtual void OnGameObjectAddWorld(GameObject* /*go*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook runs after remove game object in world
|
||||||
|
*
|
||||||
|
* @param go Contains information about the GameObject
|
||||||
|
*/
|
||||||
|
virtual void OnGameObjectRemoveWorld(GameObject* /*go*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook runs after remove game object in world
|
||||||
|
*
|
||||||
|
* @param go Contains information about the GameObject
|
||||||
|
*/
|
||||||
|
virtual void OnGameObjectUpdate(GameObject* /*go*/, uint32 /*diff*/) { }
|
||||||
|
|
||||||
|
// Called when a player opens a gossip dialog with the gameobject.
|
||||||
|
[[nodiscard]] virtual bool CanGameObjectGossipHello(Player* /*player*/, GameObject* /*go*/) { return false; }
|
||||||
|
|
||||||
|
// Called when a player selects a gossip item in the gameobject's gossip menu.
|
||||||
|
[[nodiscard]] virtual bool CanGameObjectGossipSelect(Player* /*player*/, GameObject* /*go*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
|
||||||
|
|
||||||
|
// Called when a player selects a gossip with a code in the gameobject's gossip menu.
|
||||||
|
[[nodiscard]] virtual bool CanGameObjectGossipSelectCode(Player* /*player*/, GameObject* /*go*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { return false; }
|
||||||
|
|
||||||
|
// Called when a player accepts a quest from the gameobject.
|
||||||
|
[[nodiscard]] virtual bool CanGameObjectQuestAccept(Player* /*player*/, GameObject* /*go*/, Quest const* /*quest*/) { return false; }
|
||||||
|
|
||||||
|
// Called when a player selects a quest reward.
|
||||||
|
[[nodiscard]] virtual bool CanGameObjectQuestReward(Player* /*player*/, GameObject* /*go*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
|
||||||
|
|
||||||
|
// Called when the game object is destroyed (destructible buildings only).
|
||||||
|
virtual void OnGameObjectDestroyed(GameObject* /*go*/, Player* /*player*/) { }
|
||||||
|
|
||||||
|
// Called when the game object is damaged (destructible buildings only).
|
||||||
|
virtual void OnGameObjectDamaged(GameObject* /*go*/, Player* /*player*/) { }
|
||||||
|
|
||||||
|
// Called when the game object loot state is changed.
|
||||||
|
virtual void OnGameObjectLootStateChanged(GameObject* /*go*/, uint32 /*state*/, Unit* /*unit*/) { }
|
||||||
|
|
||||||
|
// Called when the game object state is changed.
|
||||||
|
virtual void OnGameObjectStateChanged(GameObject* /*go*/, uint32 /*state*/) { }
|
||||||
|
|
||||||
|
// Called when a GameObjectAI object is needed for the gameobject.
|
||||||
|
virtual GameObjectAI* GetGameObjectAI(GameObject* /*go*/) const { return nullptr; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CreatureScript : public ScriptObject, public UpdatableScript<Creature>
|
class CreatureScript : public ScriptObject, public UpdatableScript<Creature>
|
||||||
@@ -1064,6 +1281,105 @@ public:
|
|||||||
|
|
||||||
virtual void OnSetServerSideVisibilityDetect(Player* /*player*/, ServerSideVisibilityType& /*type*/, AccountTypes& /*sec*/) { }
|
virtual void OnSetServerSideVisibilityDetect(Player* /*player*/, ServerSideVisibilityType& /*type*/, AccountTypes& /*sec*/) { }
|
||||||
|
|
||||||
|
virtual void OnPlayerResurrect(Player* /*player*/, float /*restore_percent*/, bool /*applySickness*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called before player sending message in default chat
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player sender
|
||||||
|
* @param type Contains information about the chat message type
|
||||||
|
* @param language Contains information about the language type
|
||||||
|
* @param msg Contains information about the message
|
||||||
|
*
|
||||||
|
* @return True if you want to continue sending the message, false if you want to disable sending the message
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool CanPlayerUseChat(Player* /*player*/, uint32 /*type*/, uint32 /*language*/, std::string& /*msg*/) { return true; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called before player sending message to other player via private
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player sender
|
||||||
|
* @param type Contains information about the chat message type
|
||||||
|
* @param language Contains information about the language type
|
||||||
|
* @param msg Contains information about the message
|
||||||
|
* @param receiver Contains information about the Player receiver
|
||||||
|
*
|
||||||
|
* @return True if you want to continue sending the message, false if you want to disable sending the message
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool CanPlayerUseChat(Player* /*player*/, uint32 /*type*/, uint32 /*language*/, std::string& /*msg*/, Player* /*receiver*/) { return true; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called before player sending message to group
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player sender
|
||||||
|
* @param type Contains information about the chat message type
|
||||||
|
* @param language Contains information about the language type
|
||||||
|
* @param msg Contains information about the message
|
||||||
|
* @param group Contains information about the Group
|
||||||
|
*
|
||||||
|
* @return True if you want to continue sending the message, false if you want to disable sending the message
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool CanPlayerUseChat(Player* /*player*/, uint32 /*type*/, uint32 /*language*/, std::string& /*msg*/, Group* /*group*/) { return true; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called before player sending message to guild
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player sender
|
||||||
|
* @param type Contains information about the chat message type
|
||||||
|
* @param language Contains information about the language type
|
||||||
|
* @param msg Contains information about the message
|
||||||
|
* @param guild Contains information about the Guild
|
||||||
|
*
|
||||||
|
* @return True if you want to continue sending the message, false if you want to disable sending the message
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool CanPlayerUseChat(Player* /*player*/, uint32 /*type*/, uint32 /*language*/, std::string& /*msg*/, Guild* /*guild*/) { return true; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called before player sending message to channel
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player sender
|
||||||
|
* @param type Contains information about the chat message type
|
||||||
|
* @param language Contains information about the language type
|
||||||
|
* @param msg Contains information about the message
|
||||||
|
* @param channel Contains information about the Channel
|
||||||
|
*
|
||||||
|
* @return True if you want to continue sending the message, false if you want to disable sending the message
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool CanPlayerUseChat(Player* /*player*/, uint32 /*type*/, uint32 /*language*/, std::string& /*msg*/, Channel* /*channel*/) { return true; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called after player learning talents
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player
|
||||||
|
* @param talentId Contains information about the talent id
|
||||||
|
* @param talentRank Contains information about the talent rank
|
||||||
|
* @param spellid Contains information about the spell id
|
||||||
|
*/
|
||||||
|
virtual void OnPlayerLearnTalents(Player* /*player*/, uint32 /*talentId*/, uint32 /*talentRank*/, uint32 /*spellid*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called after player entering combat
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player
|
||||||
|
* @param Unit Contains information about the Unit
|
||||||
|
*/
|
||||||
|
virtual void OnPlayerEnterCombat(Player* /*player*/, Unit* /*enemy*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called after player leave combat
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player
|
||||||
|
*/
|
||||||
|
virtual void OnPlayerLeaveCombat(Player* /*player*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called after player abandoning quest
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player
|
||||||
|
* @param questId Contains information about the quest id
|
||||||
|
*/
|
||||||
|
virtual void OnQuestAbandon(Player* /*player*/, uint32 /*questId*/) { }
|
||||||
|
|
||||||
// Passive Anticheat System
|
// Passive Anticheat System
|
||||||
virtual void AnticheatSetSkipOnePacketForASH(Player* /*player*/, bool /*apply*/) { }
|
virtual void AnticheatSetSkipOnePacketForASH(Player* /*player*/, bool /*apply*/) { }
|
||||||
virtual void AnticheatSetCanFlybyServer(Player* /*player*/, bool /*apply*/) { }
|
virtual void AnticheatSetCanFlybyServer(Player* /*player*/, bool /*apply*/) { }
|
||||||
@@ -1211,7 +1527,11 @@ protected:
|
|||||||
public:
|
public:
|
||||||
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
|
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
|
||||||
|
|
||||||
// Start Battlegroud
|
/**
|
||||||
|
* @brief This hook runs before start Battleground
|
||||||
|
*
|
||||||
|
* @param bg Contains information about the Battleground
|
||||||
|
*/
|
||||||
virtual void OnBattlegroundStart(Battleground* /*bg*/) { }
|
virtual void OnBattlegroundStart(Battleground* /*bg*/) { }
|
||||||
|
|
||||||
// End Battleground
|
// End Battleground
|
||||||
@@ -1262,6 +1582,28 @@ public:
|
|||||||
* @return True if you want to continue sending the message, false if you want to disable the message
|
* @return True if you want to continue sending the message, false if you want to disable the message
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual bool OnBeforeSendExitMessageArenaQueue(BattlegroundQueue* /*queue*/, GroupQueueInfo* /*ginfo*/) { return true; }
|
[[nodiscard]] virtual bool OnBeforeSendExitMessageArenaQueue(BattlegroundQueue* /*queue*/, GroupQueueInfo* /*ginfo*/) { return true; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook runs after end Battleground
|
||||||
|
*
|
||||||
|
* @param bg Contains information about the Battleground
|
||||||
|
* @param TeamId Contains information about the winneer team
|
||||||
|
*/
|
||||||
|
virtual void OnBattlegroundEnd(Battleground* /*bg*/, TeamId /*winner team*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook runs before Battleground destroy
|
||||||
|
*
|
||||||
|
* @param bg Contains information about the Battleground
|
||||||
|
*/
|
||||||
|
virtual void OnBattlegroundDestroy(Battleground* /*bg*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook runs after Battleground create
|
||||||
|
*
|
||||||
|
* @param bg Contains information about the Battleground
|
||||||
|
*/
|
||||||
|
virtual void OnBattlegroundCreate(Battleground* /*bg*/) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class ArenaTeamScript : public ScriptObject
|
class ArenaTeamScript : public ScriptObject
|
||||||
@@ -1307,6 +1649,36 @@ public:
|
|||||||
virtual void OnRemoveAuraScaleTargets(Spell* /*spell*/, TargetInfo& /*targetInfo*/, uint8 /*auraScaleMask*/, bool& /*needErase*/) { }
|
virtual void OnRemoveAuraScaleTargets(Spell* /*spell*/, TargetInfo& /*targetInfo*/, uint8 /*auraScaleMask*/, bool& /*needErase*/) { }
|
||||||
|
|
||||||
virtual void OnBeforeAuraRankForLevel(SpellInfo const* /*spellInfo*/, SpellInfo const* /*latestSpellInfo*/, uint8 /*level*/) { }
|
virtual void OnBeforeAuraRankForLevel(SpellInfo const* /*spellInfo*/, SpellInfo const* /*latestSpellInfo*/, uint8 /*level*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called after spell dummy effect
|
||||||
|
*
|
||||||
|
* @param caster Contains information about the WorldObject
|
||||||
|
* @param spellID Contains information about the spell id
|
||||||
|
* @param effIndex Contains information about the SpellEffIndex
|
||||||
|
* @param gameObjTarget Contains information about the GameObject
|
||||||
|
*/
|
||||||
|
virtual void OnDummyEffect(WorldObject* /*caster*/, uint32 /*spellID*/, SpellEffIndex /*effIndex*/, GameObject* /*gameObjTarget*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called after spell dummy effect
|
||||||
|
*
|
||||||
|
* @param caster Contains information about the WorldObject
|
||||||
|
* @param spellID Contains information about the spell id
|
||||||
|
* @param effIndex Contains information about the SpellEffIndex
|
||||||
|
* @param creatureTarget Contains information about the Creature
|
||||||
|
*/
|
||||||
|
virtual void OnDummyEffect(WorldObject* /*caster*/, uint32 /*spellID*/, SpellEffIndex /*effIndex*/, Creature* /*creatureTarget*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called after spell dummy effect
|
||||||
|
*
|
||||||
|
* @param caster Contains information about the WorldObject
|
||||||
|
* @param spellID Contains information about the spell id
|
||||||
|
* @param effIndex Contains information about the SpellEffIndex
|
||||||
|
* @param itemTarget Contains information about the Item
|
||||||
|
*/
|
||||||
|
virtual void OnDummyEffect(WorldObject* /*caster*/, uint32 /*spellID*/, SpellEffIndex /*effIndex*/, Item* /*itemTarget*/) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
// this class can be used to be extended by Modules
|
// this class can be used to be extended by Modules
|
||||||
@@ -1381,6 +1753,13 @@ public:
|
|||||||
[[nodiscard]] virtual bool CanUnlearnSpellDefault(Pet* /*pet*/, SpellInfo const* /*spellEntry*/) { return true; }
|
[[nodiscard]] virtual bool CanUnlearnSpellDefault(Pet* /*pet*/, SpellInfo const* /*spellEntry*/) { return true; }
|
||||||
|
|
||||||
[[nodiscard]] virtual bool CanResetTalents(Pet* /*pet*/) { return true; }
|
[[nodiscard]] virtual bool CanResetTalents(Pet* /*pet*/) { return true; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called after add pet in world
|
||||||
|
*
|
||||||
|
* @param pet Contains information about the Pet
|
||||||
|
*/
|
||||||
|
virtual void OnPetAddToWorld(Pet* /*pet*/) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class ArenaScript : public ScriptObject
|
class ArenaScript : public ScriptObject
|
||||||
@@ -1443,6 +1822,14 @@ public:
|
|||||||
virtual void OnPlayerSetPhase(const AuraEffect* /*auraEff*/, AuraApplication const* /*aurApp*/, uint8 /*mode*/, bool /*apply*/, uint32& /*newPhase*/) { }
|
virtual void OnPlayerSetPhase(const AuraEffect* /*auraEff*/, AuraApplication const* /*aurApp*/, uint8 /*mode*/, bool /*apply*/, uint32& /*newPhase*/) { }
|
||||||
|
|
||||||
virtual void OnInstanceSave(InstanceSave* /*instanceSave*/) { }
|
virtual void OnInstanceSave(InstanceSave* /*instanceSave*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called before get Quest Dialog Status
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player
|
||||||
|
* @param questgiver Contains information about the Object
|
||||||
|
*/
|
||||||
|
virtual void GetDialogStatus(Player* /*player*/, Object* /*questgiver*/) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CommandSC : public ScriptObject
|
class CommandSC : public ScriptObject
|
||||||
@@ -1455,7 +1842,15 @@ public:
|
|||||||
|
|
||||||
bool IsDatabaseBound() const { return false; }
|
bool IsDatabaseBound() const { return false; }
|
||||||
|
|
||||||
virtual void OnHandleDevCommand(Player* /*player*/, std::string& /*argstr*/) { }
|
virtual void OnHandleDevCommand(Player* /*player*/, std::string& /*argstr*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook runs execute chat command
|
||||||
|
*
|
||||||
|
* @param handler Contains information about the ChatHandler
|
||||||
|
* @param cmdStr Contains information about the command name
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool CanExecuteCommand(ChatHandler& /*handler*/, std::string_view /*cmdStr*/) { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class DatabaseScript : public ScriptObject
|
class DatabaseScript : public ScriptObject
|
||||||
@@ -1468,7 +1863,93 @@ public:
|
|||||||
|
|
||||||
bool IsDatabaseBound() const { return false; }
|
bool IsDatabaseBound() const { return false; }
|
||||||
|
|
||||||
virtual void OnAfterDatabasesLoaded(uint32 /*updateFlags*/) {}
|
virtual void OnAfterDatabasesLoaded(uint32 /*updateFlags*/) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
class WorldObjectScript : public ScriptObject
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
WorldObjectScript(const char* name);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
bool IsDatabaseBound() const { return false; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called before destroy world object
|
||||||
|
*
|
||||||
|
* @param object Contains information about the WorldObject
|
||||||
|
*/
|
||||||
|
virtual void OnWorldObjectDestroy(WorldObject* /*object*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called after create world object
|
||||||
|
*
|
||||||
|
* @param object Contains information about the WorldObject
|
||||||
|
*/
|
||||||
|
virtual void OnWorldObjectCreate(WorldObject* /*object*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called after world object set to map
|
||||||
|
*
|
||||||
|
* @param object Contains information about the WorldObject
|
||||||
|
*/
|
||||||
|
virtual void OnWorldObjectSetMap(WorldObject* /*object*/, Map* /*map*/ ) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called after world object reset
|
||||||
|
*
|
||||||
|
* @param object Contains information about the WorldObject
|
||||||
|
*/
|
||||||
|
virtual void OnWorldObjectResetMap(WorldObject* /*object*/) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called after world object update
|
||||||
|
*
|
||||||
|
* @param object Contains information about the WorldObject
|
||||||
|
* @param diff Contains information about the diff time
|
||||||
|
*/
|
||||||
|
virtual void OnWorldObjectUpdate(WorldObject* /*object*/, uint32 /*diff*/) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
class LootScript : public ScriptObject
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
LootScript(const char* name);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
bool IsDatabaseBound() const { return false; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This hook called before money loot
|
||||||
|
*
|
||||||
|
* @param player Contains information about the Player
|
||||||
|
* @param gold Contains information about money
|
||||||
|
*/
|
||||||
|
virtual void OnLootMoney(Player* /*player*/, uint32 /*gold*/) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElunaScript : public ScriptObject
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
ElunaScript(const char* name);
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief This hook called when the weather changes in the zone this script is associated with.
|
||||||
|
*
|
||||||
|
* @param weather Contains information about the Weather
|
||||||
|
* @param state Contains information about the WeatherState
|
||||||
|
* @param grade Contains information about the grade
|
||||||
|
*/
|
||||||
|
virtual void OnWeatherChange(Weather* /*weather*/, WeatherState /*state*/, float /*grade*/) { }
|
||||||
|
|
||||||
|
// Called when the area trigger is activated by a player.
|
||||||
|
[[nodiscard]] virtual bool CanAreaTrigger(Player* /*player*/, AreaTrigger const* /*trigger*/) { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Manages registration, loading, and execution of scripts.
|
// Manages registration, loading, and execution of scripts.
|
||||||
@@ -1493,6 +1974,7 @@ public: /* Initialization */
|
|||||||
uint32 GetScriptCount() const { return _scriptCount; }
|
uint32 GetScriptCount() const { return _scriptCount; }
|
||||||
|
|
||||||
typedef void(*ScriptLoaderCallbackType)();
|
typedef void(*ScriptLoaderCallbackType)();
|
||||||
|
typedef void(*ModulesLoaderCallbackType)();
|
||||||
|
|
||||||
/// Sets the script loader callback which is invoked to load scripts
|
/// Sets the script loader callback which is invoked to load scripts
|
||||||
/// (Workaround for circular dependency game <-> scripts)
|
/// (Workaround for circular dependency game <-> scripts)
|
||||||
@@ -1501,6 +1983,13 @@ public: /* Initialization */
|
|||||||
_script_loader_callback = script_loader_callback;
|
_script_loader_callback = script_loader_callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets the modules loader callback which is invoked to load modules
|
||||||
|
/// (Workaround for circular dependency game <-> modules)
|
||||||
|
void SetModulesLoader(ModulesLoaderCallbackType script_loader_callback)
|
||||||
|
{
|
||||||
|
_modules_loader_callback = script_loader_callback;
|
||||||
|
}
|
||||||
|
|
||||||
public: /* Unloading */
|
public: /* Unloading */
|
||||||
void Unload();
|
void Unload();
|
||||||
|
|
||||||
@@ -1514,8 +2003,8 @@ public: /* ServerScript */
|
|||||||
void OnNetworkStop();
|
void OnNetworkStop();
|
||||||
void OnSocketOpen(std::shared_ptr<WorldSocket> socket);
|
void OnSocketOpen(std::shared_ptr<WorldSocket> socket);
|
||||||
void OnSocketClose(std::shared_ptr<WorldSocket> socket);
|
void OnSocketClose(std::shared_ptr<WorldSocket> socket);
|
||||||
void OnPacketReceive(WorldSession* session, WorldPacket const& packet);
|
bool CanPacketReceive(WorldSession* session, WorldPacket const& packet);
|
||||||
void OnPacketSend(WorldSession* session, WorldPacket const& packet);
|
bool CanPacketSend(WorldSession* session, WorldPacket const& packet);
|
||||||
|
|
||||||
public: /* WorldScript */
|
public: /* WorldScript */
|
||||||
void OnLoadCustomDatabaseTable();
|
void OnLoadCustomDatabaseTable();
|
||||||
@@ -1529,6 +2018,7 @@ public: /* WorldScript */
|
|||||||
void OnWorldUpdate(uint32 diff);
|
void OnWorldUpdate(uint32 diff);
|
||||||
void OnStartup();
|
void OnStartup();
|
||||||
void OnShutdown();
|
void OnShutdown();
|
||||||
|
void OnBeforeWorldInitialized();
|
||||||
|
|
||||||
public: /* FormulaScript */
|
public: /* FormulaScript */
|
||||||
void OnHonorCalculation(float& honor, uint8 level, float multiplier);
|
void OnHonorCalculation(float& honor, uint8 level, float multiplier);
|
||||||
@@ -1573,6 +2063,8 @@ public: /* CreatureScript */
|
|||||||
uint32 GetDialogStatus(Player* player, Creature* creature);
|
uint32 GetDialogStatus(Player* player, Creature* creature);
|
||||||
CreatureAI* GetCreatureAI(Creature* creature);
|
CreatureAI* GetCreatureAI(Creature* creature);
|
||||||
void OnCreatureUpdate(Creature* creature, uint32 diff);
|
void OnCreatureUpdate(Creature* creature, uint32 diff);
|
||||||
|
void OnCreatureAddWorld(Creature* creature);
|
||||||
|
void OnCreatureRemoveWorld(Creature* creature);
|
||||||
|
|
||||||
public: /* GameObjectScript */
|
public: /* GameObjectScript */
|
||||||
bool OnGossipHello(Player* player, GameObject* go);
|
bool OnGossipHello(Player* player, GameObject* go);
|
||||||
@@ -1587,6 +2079,8 @@ public: /* GameObjectScript */
|
|||||||
void OnGameObjectStateChanged(GameObject* go, uint32 state);
|
void OnGameObjectStateChanged(GameObject* go, uint32 state);
|
||||||
void OnGameObjectUpdate(GameObject* go, uint32 diff);
|
void OnGameObjectUpdate(GameObject* go, uint32 diff);
|
||||||
GameObjectAI* GetGameObjectAI(GameObject* go);
|
GameObjectAI* GetGameObjectAI(GameObject* go);
|
||||||
|
void OnGameObjectAddWorld(GameObject* go);
|
||||||
|
void OnGameObjectRemoveWorld(GameObject* go);
|
||||||
|
|
||||||
public: /* AreaTriggerScript */
|
public: /* AreaTriggerScript */
|
||||||
bool OnAreaTrigger(Player* player, AreaTrigger const* trigger);
|
bool OnAreaTrigger(Player* player, AreaTrigger const* trigger);
|
||||||
@@ -1773,6 +2267,18 @@ public: /* PlayerScript */
|
|||||||
bool CanInitTrade(Player* player, Player* target);
|
bool CanInitTrade(Player* player, Player* target);
|
||||||
void OnSetServerSideVisibility(Player* player, ServerSideVisibilityType& type, AccountTypes& sec);
|
void OnSetServerSideVisibility(Player* player, ServerSideVisibilityType& type, AccountTypes& sec);
|
||||||
void OnSetServerSideVisibilityDetect(Player* player, ServerSideVisibilityType& type, AccountTypes& sec);
|
void OnSetServerSideVisibilityDetect(Player* player, ServerSideVisibilityType& type, AccountTypes& sec);
|
||||||
|
void OnPlayerResurrect(Player* player, float restore_percent, bool applySickness);
|
||||||
|
bool CanPlayerUseChat(Player* player, uint32 type, uint32 language, std::string& msg);
|
||||||
|
bool CanPlayerUseChat(Player* player, uint32 type, uint32 language, std::string& msg, Player* receiver);
|
||||||
|
bool CanPlayerUseChat(Player* player, uint32 type, uint32 language, std::string& msg, Group* group);
|
||||||
|
bool CanPlayerUseChat(Player* player, uint32 type, uint32 language, std::string& msg, Guild* guild);
|
||||||
|
bool CanPlayerUseChat(Player* player, uint32 type, uint32 language, std::string& msg, Channel* channel);
|
||||||
|
void OnPlayerLearnTalents(Player* player, uint32 talentId, uint32 talentRank, uint32 spellid);
|
||||||
|
void OnPlayerEnterCombat(Player* player, Unit* enemy);
|
||||||
|
void OnPlayerLeaveCombat(Player* player);
|
||||||
|
void OnQuestAbandon(Player* player, uint32 questId);
|
||||||
|
|
||||||
|
// Anti cheat
|
||||||
void AnticheatSetSkipOnePacketForASH(Player* player, bool apply);
|
void AnticheatSetSkipOnePacketForASH(Player* player, bool apply);
|
||||||
void AnticheatSetCanFlybyServer(Player* player, bool apply);
|
void AnticheatSetCanFlybyServer(Player* player, bool apply);
|
||||||
void AnticheatSetUnderACKmount(Player* player);
|
void AnticheatSetUnderACKmount(Player* player);
|
||||||
@@ -1850,6 +2356,7 @@ public: /* UnitScript */
|
|||||||
bool IsNeedModHealPercent(Unit const* unit, AuraEffect* auraEff, float& doneTotalMod, SpellInfo const* spellProto);
|
bool IsNeedModHealPercent(Unit const* unit, AuraEffect* auraEff, float& doneTotalMod, SpellInfo const* spellProto);
|
||||||
bool CanSetPhaseMask(Unit const* unit, uint32 newPhaseMask, bool update);
|
bool CanSetPhaseMask(Unit const* unit, uint32 newPhaseMask, bool update);
|
||||||
bool IsCustomBuildValuesUpdate(Unit const* unit, uint8 updateType, ByteBuffer& fieldBuffer, Player const* target, uint16 index);
|
bool IsCustomBuildValuesUpdate(Unit const* unit, uint8 updateType, ByteBuffer& fieldBuffer, Player const* target, uint16 index);
|
||||||
|
void OnUnitUpdate(Unit* unit, uint32 diff);
|
||||||
|
|
||||||
public: /* MovementHandlerScript */
|
public: /* MovementHandlerScript */
|
||||||
void OnPlayerMove(Player* player, MovementInfo movementInfo, uint32 opcode);
|
void OnPlayerMove(Player* player, MovementInfo movementInfo, uint32 opcode);
|
||||||
@@ -1860,9 +2367,8 @@ public: /* AllCreatureScript */
|
|||||||
void Creature_SelectLevel(const CreatureTemplate* cinfo, Creature* creature);
|
void Creature_SelectLevel(const CreatureTemplate* cinfo, Creature* creature);
|
||||||
|
|
||||||
public: /* AllMapScript */
|
public: /* AllMapScript */
|
||||||
//listener functions are called by OnPlayerEnterMap and OnPlayerLeaveMap
|
void OnBeforeCreateInstanceScript(InstanceMap* instanceMap, InstanceScript* instanceData, bool load, std::string data, uint32 completedEncounterMask);
|
||||||
//void OnPlayerEnterAll(Map* map, Player* player);
|
void OnDestroyInstance(MapInstanced* mapInstanced, Map* map);
|
||||||
//void OnPlayerLeaveAll(Map* map, Player* player);
|
|
||||||
|
|
||||||
public: /* BGScript */
|
public: /* BGScript */
|
||||||
void OnBattlegroundStart(Battleground* bg);
|
void OnBattlegroundStart(Battleground* bg);
|
||||||
@@ -1880,6 +2386,9 @@ public: /* BGScript */
|
|||||||
bool CanSendMessageBGQueue(BattlegroundQueue* queue, Player* leader, Battleground* bg, PvPDifficultyEntry const* bracketEntry);
|
bool CanSendMessageBGQueue(BattlegroundQueue* queue, Player* leader, Battleground* bg, PvPDifficultyEntry const* bracketEntry);
|
||||||
bool OnBeforeSendJoinMessageArenaQueue(BattlegroundQueue* queue, Player* leader, GroupQueueInfo* ginfo, PvPDifficultyEntry const* bracketEntry, bool isRated);
|
bool OnBeforeSendJoinMessageArenaQueue(BattlegroundQueue* queue, Player* leader, GroupQueueInfo* ginfo, PvPDifficultyEntry const* bracketEntry, bool isRated);
|
||||||
bool OnBeforeSendExitMessageArenaQueue(BattlegroundQueue* queue, GroupQueueInfo* ginfo);
|
bool OnBeforeSendExitMessageArenaQueue(BattlegroundQueue* queue, GroupQueueInfo* ginfo);
|
||||||
|
void OnBattlegroundEnd(Battleground* bg, TeamId winnerTeamId);
|
||||||
|
void OnBattlegroundDestroy(Battleground* bg);
|
||||||
|
void OnBattlegroundCreate(Battleground* bg);
|
||||||
|
|
||||||
public: /* Arena Team Script */
|
public: /* Arena Team Script */
|
||||||
void OnGetSlotByType(const uint32 type, uint8& slot);
|
void OnGetSlotByType(const uint32 type, uint8& slot);
|
||||||
@@ -1899,6 +2408,9 @@ public: /* SpellSC */
|
|||||||
void OnScaleAuraUnitAdd(Spell* spell, Unit* target, uint32 effectMask, bool checkIfValid, bool implicit, uint8 auraScaleMask, TargetInfo& targetInfo);
|
void OnScaleAuraUnitAdd(Spell* spell, Unit* target, uint32 effectMask, bool checkIfValid, bool implicit, uint8 auraScaleMask, TargetInfo& targetInfo);
|
||||||
void OnRemoveAuraScaleTargets(Spell* spell, TargetInfo& targetInfo, uint8 auraScaleMask, bool& needErase);
|
void OnRemoveAuraScaleTargets(Spell* spell, TargetInfo& targetInfo, uint8 auraScaleMask, bool& needErase);
|
||||||
void OnBeforeAuraRankForLevel(SpellInfo const* spellInfo, SpellInfo const* latestSpellInfo, uint8 level);
|
void OnBeforeAuraRankForLevel(SpellInfo const* spellInfo, SpellInfo const* latestSpellInfo, uint8 level);
|
||||||
|
void OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, GameObject* gameObjTarget);
|
||||||
|
void OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, Creature* creatureTarget);
|
||||||
|
void OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, Item* itemTarget);
|
||||||
|
|
||||||
public: /* GameEventScript */
|
public: /* GameEventScript */
|
||||||
void OnGameEventStart(uint16 EventID);
|
void OnGameEventStart(uint16 EventID);
|
||||||
@@ -1909,53 +2421,71 @@ public: /* MailScript */
|
|||||||
|
|
||||||
public: /* AchievementScript */
|
public: /* AchievementScript */
|
||||||
|
|
||||||
void SetRealmCompleted(AchievementEntry const* achievement);
|
void SetRealmCompleted(AchievementEntry const* achievement);
|
||||||
bool IsCompletedCriteria(AchievementMgr* mgr, AchievementCriteriaEntry const* achievementCriteria, AchievementEntry const* achievement, CriteriaProgress const* progress);
|
bool IsCompletedCriteria(AchievementMgr* mgr, AchievementCriteriaEntry const* achievementCriteria, AchievementEntry const* achievement, CriteriaProgress const* progress);
|
||||||
bool IsRealmCompleted(AchievementGlobalMgr const* globalmgr, AchievementEntry const* achievement, std::chrono::system_clock::time_point completionTime);
|
bool IsRealmCompleted(AchievementGlobalMgr const* globalmgr, AchievementEntry const* achievement, std::chrono::system_clock::time_point completionTime);
|
||||||
void OnBeforeCheckCriteria(AchievementMgr* mgr, AchievementCriteriaEntryList const* achievementCriteriaList);
|
void OnBeforeCheckCriteria(AchievementMgr* mgr, AchievementCriteriaEntryList const* achievementCriteriaList);
|
||||||
bool CanCheckCriteria(AchievementMgr* mgr, AchievementCriteriaEntry const* achievementCriteria);
|
bool CanCheckCriteria(AchievementMgr* mgr, AchievementCriteriaEntry const* achievementCriteria);
|
||||||
|
|
||||||
public: /* PetScript */
|
public: /* PetScript */
|
||||||
|
|
||||||
void OnInitStatsForLevel(Guardian* guardian, uint8 petlevel);
|
void OnInitStatsForLevel(Guardian* guardian, uint8 petlevel);
|
||||||
void OnCalculateMaxTalentPointsForLevel(Pet* pet, uint8 level, uint8& points);
|
void OnCalculateMaxTalentPointsForLevel(Pet* pet, uint8 level, uint8& points);
|
||||||
bool CanUnlearnSpellSet(Pet* pet, uint32 level, uint32 spell);
|
bool CanUnlearnSpellSet(Pet* pet, uint32 level, uint32 spell);
|
||||||
bool CanUnlearnSpellDefault(Pet* pet, SpellInfo const* spellEntry);
|
bool CanUnlearnSpellDefault(Pet* pet, SpellInfo const* spellEntry);
|
||||||
bool CanResetTalents(Pet* pet);
|
bool CanResetTalents(Pet* pet);
|
||||||
|
|
||||||
public: /* ArenaScript */
|
public: /* ArenaScript */
|
||||||
|
|
||||||
bool CanAddMember(ArenaTeam* team, ObjectGuid PlayerGuid);
|
bool CanAddMember(ArenaTeam* team, ObjectGuid PlayerGuid);
|
||||||
void OnGetPoints(ArenaTeam* team, uint32 memberRating, float& points);
|
void OnGetPoints(ArenaTeam* team, uint32 memberRating, float& points);
|
||||||
bool CanSaveToDB(ArenaTeam* team);
|
bool CanSaveToDB(ArenaTeam* team);
|
||||||
|
|
||||||
public: /* MiscScript */
|
public: /* MiscScript */
|
||||||
|
|
||||||
void OnConstructObject(Object* origin);
|
void OnConstructObject(Object* origin);
|
||||||
void OnDestructObject(Object* origin);
|
void OnDestructObject(Object* origin);
|
||||||
void OnConstructPlayer(Player* origin);
|
void OnConstructPlayer(Player* origin);
|
||||||
void OnDestructPlayer(Player* origin);
|
void OnDestructPlayer(Player* origin);
|
||||||
void OnConstructGroup(Group* origin);
|
void OnConstructGroup(Group* origin);
|
||||||
void OnDestructGroup(Group* origin);
|
void OnDestructGroup(Group* origin);
|
||||||
void OnConstructInstanceSave(InstanceSave* origin);
|
void OnConstructInstanceSave(InstanceSave* origin);
|
||||||
void OnDestructInstanceSave(InstanceSave* origin);
|
void OnDestructInstanceSave(InstanceSave* origin);
|
||||||
void OnItemCreate(Item* item, ItemTemplate const* itemProto, Player const* owner);
|
void OnItemCreate(Item* item, ItemTemplate const* itemProto, Player const* owner);
|
||||||
bool CanApplySoulboundFlag(Item* item, ItemTemplate const* proto);
|
bool CanApplySoulboundFlag(Item* item, ItemTemplate const* proto);
|
||||||
bool CanItemApplyEquipSpell(Player* player, Item* item);
|
bool CanItemApplyEquipSpell(Player* player, Item* item);
|
||||||
bool CanSendAuctionHello(WorldSession const* session, ObjectGuid guid, Creature* creature);
|
bool CanSendAuctionHello(WorldSession const* session, ObjectGuid guid, Creature* creature);
|
||||||
void ValidateSpellAtCastSpell(Player* player, uint32& oldSpellId, uint32& spellId, uint8& castCount, uint8& castFlags);
|
void ValidateSpellAtCastSpell(Player* player, uint32& oldSpellId, uint32& spellId, uint8& castCount, uint8& castFlags);
|
||||||
void OnPlayerSetPhase(const AuraEffect* auraEff, AuraApplication const* aurApp, uint8 mode, bool apply, uint32& newPhase);
|
void OnPlayerSetPhase(const AuraEffect* auraEff, AuraApplication const* aurApp, uint8 mode, bool apply, uint32& newPhase);
|
||||||
void ValidateSpellAtCastSpellResult(Player* player, Unit* mover, Spell* spell, uint32 oldSpellId, uint32 spellId);
|
void ValidateSpellAtCastSpellResult(Player* player, Unit* mover, Spell* spell, uint32 oldSpellId, uint32 spellId);
|
||||||
void OnAfterLootTemplateProcess(Loot* loot, LootTemplate const* tab, LootStore const& store, Player* lootOwner, bool personal, bool noEmptyError, uint16 lootMode);
|
void OnAfterLootTemplateProcess(Loot* loot, LootTemplate const* tab, LootStore const& store, Player* lootOwner, bool personal, bool noEmptyError, uint16 lootMode);
|
||||||
void OnInstanceSave(InstanceSave* instanceSave);
|
void OnInstanceSave(InstanceSave* instanceSave);
|
||||||
|
void GetDialogStatus(Player* player, Object* questgiver);
|
||||||
|
|
||||||
public: /* CommandSC */
|
public: /* CommandSC */
|
||||||
|
|
||||||
void OnHandleDevCommand(Player* player, std::string& argstr);
|
void OnHandleDevCommand(Player* player, std::string& argstr);
|
||||||
|
bool CanExecuteCommand(ChatHandler& handler, std::string_view cmdStr);
|
||||||
|
|
||||||
public: /* DatabaseScript */
|
public: /* DatabaseScript */
|
||||||
|
|
||||||
void OnAfterDatabasesLoaded(uint32 updateFlags);
|
void OnAfterDatabasesLoaded(uint32 updateFlags);
|
||||||
|
|
||||||
|
public: /* WorldObjectScript */
|
||||||
|
|
||||||
|
void OnWorldObjectDestroy(WorldObject* object);
|
||||||
|
void OnWorldObjectCreate(WorldObject* object);
|
||||||
|
void OnWorldObjectSetMap(WorldObject* object, Map* map);
|
||||||
|
void OnWorldObjectResetMap(WorldObject* object);
|
||||||
|
void OnWorldObjectUpdate(WorldObject* object, uint32 diff);
|
||||||
|
|
||||||
|
public: /* PetScript */
|
||||||
|
|
||||||
|
void OnPetAddToWorld(Pet* pet);
|
||||||
|
|
||||||
|
public: /* LootScript */
|
||||||
|
|
||||||
|
void OnLootMoney(Player* player, uint32 gold);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32 _scriptCount;
|
uint32 _scriptCount;
|
||||||
@@ -1964,6 +2494,7 @@ private:
|
|||||||
std::atomic<long> _scheduledScripts;
|
std::atomic<long> _scheduledScripts;
|
||||||
|
|
||||||
ScriptLoaderCallbackType _script_loader_callback;
|
ScriptLoaderCallbackType _script_loader_callback;
|
||||||
|
ModulesLoaderCallbackType _modules_loader_callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Acore::SpellScripts
|
namespace Acore::SpellScripts
|
||||||
|
|||||||
@@ -51,10 +51,6 @@
|
|||||||
#include "WorldSocket.h"
|
#include "WorldSocket.h"
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
std::string const DefaultPlayerName = "<none>";
|
std::string const DefaultPlayerName = "<none>";
|
||||||
@@ -254,12 +250,10 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
|||||||
}
|
}
|
||||||
#endif // !ACORE_DEBUG
|
#endif // !ACORE_DEBUG
|
||||||
|
|
||||||
sScriptMgr->OnPacketSend(this, *packet);
|
if (!sScriptMgr->CanPacketSend(this, *packet))
|
||||||
|
{
|
||||||
#ifdef ELUNA
|
|
||||||
if (!sEluna->OnPacketSend(this, *packet))
|
|
||||||
return;
|
return;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
LOG_TRACE("network.opcode", "S->C: %s %s", GetPlayerInfo().c_str(), GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet->GetOpcode())).c_str());
|
LOG_TRACE("network.opcode", "S->C: %s %s", GetPlayerInfo().c_str(), GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet->GetOpcode())).c_str());
|
||||||
m_Socket->SendPacket(*packet);
|
m_Socket->SendPacket(*packet);
|
||||||
@@ -346,11 +340,11 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
|||||||
}
|
}
|
||||||
else if (_player->IsInWorld() && AntiDOS.EvaluateOpcode(*packet, currentTime))
|
else if (_player->IsInWorld() && AntiDOS.EvaluateOpcode(*packet, currentTime))
|
||||||
{
|
{
|
||||||
sScriptMgr->OnPacketReceive(this, *packet);
|
if (!sScriptMgr->CanPacketReceive(this, *packet))
|
||||||
#ifdef ELUNA
|
{
|
||||||
if (!sEluna->OnPacketReceive(this, *packet))
|
|
||||||
break;
|
break;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
opHandle->Call(this, *packet);
|
opHandle->Call(this, *packet);
|
||||||
LogUnprocessedTail(packet);
|
LogUnprocessedTail(packet);
|
||||||
}
|
}
|
||||||
@@ -358,11 +352,11 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
|||||||
case STATUS_TRANSFER:
|
case STATUS_TRANSFER:
|
||||||
if (_player && !_player->IsInWorld() && AntiDOS.EvaluateOpcode(*packet, currentTime))
|
if (_player && !_player->IsInWorld() && AntiDOS.EvaluateOpcode(*packet, currentTime))
|
||||||
{
|
{
|
||||||
sScriptMgr->OnPacketReceive(this, *packet);
|
if (!sScriptMgr->CanPacketReceive(this, *packet))
|
||||||
#ifdef ELUNA
|
{
|
||||||
if (!sEluna->OnPacketReceive(this, *packet))
|
|
||||||
break;
|
break;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
opHandle->Call(this, *packet);
|
opHandle->Call(this, *packet);
|
||||||
LogUnprocessedTail(packet);
|
LogUnprocessedTail(packet);
|
||||||
}
|
}
|
||||||
@@ -373,11 +367,11 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
|||||||
|
|
||||||
if (AntiDOS.EvaluateOpcode(*packet, currentTime))
|
if (AntiDOS.EvaluateOpcode(*packet, currentTime))
|
||||||
{
|
{
|
||||||
sScriptMgr->OnPacketReceive(this, *packet);
|
if (!sScriptMgr->CanPacketReceive(this, *packet))
|
||||||
#ifdef ELUNA
|
{
|
||||||
if (!sEluna->OnPacketReceive(this, *packet))
|
|
||||||
break;
|
break;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
opHandle->Call(this, *packet);
|
opHandle->Call(this, *packet);
|
||||||
LogUnprocessedTail(packet);
|
LogUnprocessedTail(packet);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,10 +40,6 @@
|
|||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class Aura;
|
class Aura;
|
||||||
//
|
//
|
||||||
// EFFECT HANDLER NOTES
|
// EFFECT HANDLER NOTES
|
||||||
@@ -6231,11 +6227,12 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit*
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef ELUNA
|
|
||||||
Creature* c = target->ToCreature();
|
Creature* c = target->ToCreature();
|
||||||
if (c && caster)
|
if (c && caster)
|
||||||
sEluna->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature());
|
{
|
||||||
#endif
|
sScriptMgr->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature());
|
||||||
|
}
|
||||||
|
|
||||||
LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
|
LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,11 +15,6 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "ElunaUtility.h"
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "Spell.h"
|
#include "Spell.h"
|
||||||
#include "ArenaSpectator.h"
|
#include "ArenaSpectator.h"
|
||||||
#include "BattlefieldMgr.h"
|
#include "BattlefieldMgr.h"
|
||||||
@@ -3586,9 +3581,7 @@ void Spell::_cast(bool skipCheck)
|
|||||||
{
|
{
|
||||||
// now that we've done the basic check, now run the scripts
|
// now that we've done the basic check, now run the scripts
|
||||||
// should be done before the spell is actually executed
|
// should be done before the spell is actually executed
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnPlayerSpellCast(playerCaster, this, skipCheck);
|
||||||
sEluna->OnSpellCast(playerCaster, this, skipCheck);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// As of 3.0.2 pets begin attacking their owner's target immediately
|
// As of 3.0.2 pets begin attacking their owner's target immediately
|
||||||
// Let any pets know we've attacked something. Check DmgClass for harmful spells only
|
// Let any pets know we've attacked something. Check DmgClass for harmful spells only
|
||||||
|
|||||||
@@ -62,10 +62,6 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pEffect SpellEffects[TOTAL_SPELL_EFFECTS] =
|
pEffect SpellEffects[TOTAL_SPELL_EFFECTS] =
|
||||||
{
|
{
|
||||||
&Spell::EffectNULL, // 0
|
&Spell::EffectNULL, // 0
|
||||||
@@ -788,14 +784,19 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
|
|||||||
// normal DB scripted effect
|
// normal DB scripted effect
|
||||||
LOG_DEBUG("spells.aura", "Spell ScriptStart spellid %u in EffectDummy(%u)", m_spellInfo->Id, effIndex);
|
LOG_DEBUG("spells.aura", "Spell ScriptStart spellid %u in EffectDummy(%u)", m_spellInfo->Id, effIndex);
|
||||||
m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effIndex << 24)), m_caster, unitTarget);
|
m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effIndex << 24)), m_caster, unitTarget);
|
||||||
#ifdef ELUNA
|
|
||||||
if (gameObjTarget)
|
if (gameObjTarget)
|
||||||
sEluna->OnDummyEffect(m_caster, m_spellInfo->Id, effIndex, gameObjTarget);
|
{
|
||||||
|
sScriptMgr->OnDummyEffect(m_caster, m_spellInfo->Id, effIndex, gameObjTarget);
|
||||||
|
}
|
||||||
else if (unitTarget && unitTarget->GetTypeId() == TYPEID_UNIT)
|
else if (unitTarget && unitTarget->GetTypeId() == TYPEID_UNIT)
|
||||||
sEluna->OnDummyEffect(m_caster, m_spellInfo->Id, effIndex, unitTarget->ToCreature());
|
{
|
||||||
|
sScriptMgr->OnDummyEffect(m_caster, m_spellInfo->Id, effIndex, unitTarget->ToCreature());
|
||||||
|
}
|
||||||
else if (itemTarget)
|
else if (itemTarget)
|
||||||
sEluna->OnDummyEffect(m_caster, m_spellInfo->Id, effIndex, itemTarget);
|
{
|
||||||
#endif
|
sScriptMgr->OnDummyEffect(m_caster, m_spellInfo->Id, effIndex, itemTarget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
|
void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
|
||||||
|
|||||||
@@ -92,10 +92,6 @@
|
|||||||
#include <boost/asio/ip/address.hpp>
|
#include <boost/asio/ip/address.hpp>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::atomic_long World::m_stopEvent = false;
|
std::atomic_long World::m_stopEvent = false;
|
||||||
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
|
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
|
||||||
uint32 World::m_worldLoopCounter = 0;
|
uint32 World::m_worldLoopCounter = 0;
|
||||||
@@ -444,15 +440,6 @@ void World::LoadConfigSettings(bool reload)
|
|||||||
// Set realm id and enable db logging
|
// Set realm id and enable db logging
|
||||||
sLog->SetRealmId(realm.Id.Realm);
|
sLog->SetRealmId(realm.Id.Realm);
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
///- Initialize Lua Engine
|
|
||||||
if (!reload)
|
|
||||||
{
|
|
||||||
LOG_INFO("eluna", "Initialize Eluna Lua Engine...");
|
|
||||||
Eluna::Initialize();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sScriptMgr->OnBeforeConfigLoad(reload);
|
sScriptMgr->OnBeforeConfigLoad(reload);
|
||||||
|
|
||||||
///- Read the player limit and the Message of the day from the config file
|
///- Read the player limit and the Message of the day from the config file
|
||||||
@@ -2081,12 +2068,7 @@ void World::SetInitialWorldSettings()
|
|||||||
LOG_INFO("server.loading", "Load Channels...");
|
LOG_INFO("server.loading", "Load Channels...");
|
||||||
ChannelMgr::LoadChannels();
|
ChannelMgr::LoadChannels();
|
||||||
|
|
||||||
#ifdef ELUNA
|
sScriptMgr->OnBeforeWorldInitialized();
|
||||||
///- Run eluna scripts.
|
|
||||||
// in multithread foreach: run scripts
|
|
||||||
sEluna->RunScripts();
|
|
||||||
sEluna->OnConfigLoad(false, false); // Must be done after Eluna is initialized and scripts have run.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS))
|
if (sWorld->getBoolConfig(CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,26 +53,6 @@ if(SCRIPTS MATCHES "minimal")
|
|||||||
list(APPEND SCRIPTS_WHITELIST Commands Spells)
|
list(APPEND SCRIPTS_WHITELIST Commands Spells)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Add support old api modules
|
|
||||||
CU_GET_GLOBAL("AC_ADD_SCRIPTS_LIST")
|
|
||||||
CU_GET_GLOBAL("AC_ADD_SCRIPTS_INCLUDE")
|
|
||||||
|
|
||||||
set("AC_SCRIPTS_INCLUDES" "")
|
|
||||||
set("AC_MODULE_LIST" "")
|
|
||||||
set("AC_SCRIPTS_LIST" "")
|
|
||||||
|
|
||||||
foreach(include ${AC_ADD_SCRIPTS_INCLUDE})
|
|
||||||
set("AC_SCRIPTS_INCLUDES" "#include \"${include}\"\n${AC_SCRIPTS_INCLUDES}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
foreach(void ${AC_ADD_SCRIPTS_LIST})
|
|
||||||
set("AC_MODULE_LIST" "void ${void};\n${AC_MODULE_LIST}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
foreach(scriptName ${AC_ADD_SCRIPTS_LIST})
|
|
||||||
set("AC_SCRIPTS_LIST" " ${scriptName};\n${AC_SCRIPTS_LIST}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# Set the SCRIPTS_${SCRIPT_MODULE} variables from the
|
# Set the SCRIPTS_${SCRIPT_MODULE} variables from the
|
||||||
# variables set above
|
# variables set above
|
||||||
foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
||||||
@@ -109,47 +89,8 @@ foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Set the MODULES_${SOURCE_MODULE} variables from the
|
|
||||||
# variables set above
|
|
||||||
foreach(SOURCE_MODULE ${MODULES_MODULE_LIST})
|
|
||||||
ModuleNameToVariable(${SOURCE_MODULE} MODULE_MODULE_VARIABLE)
|
|
||||||
|
|
||||||
if(${MODULE_MODULE_VARIABLE} STREQUAL "default")
|
|
||||||
set(${MODULE_MODULE_VARIABLE} ${MODULES_DEFAULT_LINKAGE})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Use only static for deprecated api loaders
|
|
||||||
if (AC_SCRIPTS_INCLUDES MATCHES "${SOURCE_MODULE}")
|
|
||||||
set(${MODULE_MODULE_VARIABLE} "static")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Use only static for mod-eluna-lua-engine
|
|
||||||
if (SOURCE_MODULE MATCHES "mod-eluna-lua-engine")
|
|
||||||
set(${MODULE_MODULE_VARIABLE} "static")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Build the Graph values
|
|
||||||
if(${MODULE_MODULE_VARIABLE} MATCHES "dynamic")
|
|
||||||
GetProjectNameOfModuleName(${SOURCE_MODULE} MODULE_SOURCE_PROJECT_NAME)
|
|
||||||
GetNativeSharedLibraryName(${MODULE_SOURCE_PROJECT_NAME} MODULE_PROJECT_LIBRARY)
|
|
||||||
list(APPEND MODULE_GRAPH_KEYS ${MODULE_SOURCE_PROJECT_NAME})
|
|
||||||
set(MODULE_GRAPH_VALUE_DISPLAY_${MODULE_SOURCE_PROJECT_NAME} ${MODULE_PROJECT_LIBRARY})
|
|
||||||
list(APPEND MODULE_GRAPH_VALUE_CONTAINS_MODULES_${MODULE_SOURCE_PROJECT_NAME} ${SOURCE_MODULE})
|
|
||||||
elseif(${MODULE_MODULE_VARIABLE} MATCHES "static")
|
|
||||||
list(APPEND MODULE_GRAPH_KEYS worldserver)
|
|
||||||
set(MODULE_GRAPH_VALUE_DISPLAY_worldserver worldserver)
|
|
||||||
list(APPEND MODULE_GRAPH_VALUE_CONTAINS_MODULES_worldserver ${SOURCE_MODULE})
|
|
||||||
else()
|
|
||||||
list(APPEND MODULE_GRAPH_KEYS disabled)
|
|
||||||
set(MODULE_GRAPH_VALUE_DISPLAY_disabled disabled)
|
|
||||||
list(APPEND MODULE_GRAPH_VALUE_CONTAINS_MODULES_disabled ${SOURCE_MODULE})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
list(SORT SCRIPT_GRAPH_KEYS)
|
list(SORT SCRIPT_GRAPH_KEYS)
|
||||||
list(SORT MODULE_GRAPH_KEYS)
|
|
||||||
list(REMOVE_DUPLICATES SCRIPT_GRAPH_KEYS)
|
list(REMOVE_DUPLICATES SCRIPT_GRAPH_KEYS)
|
||||||
list(REMOVE_DUPLICATES MODULE_GRAPH_KEYS)
|
|
||||||
|
|
||||||
# Display the script graph
|
# Display the script graph
|
||||||
message("* Script configuration (${SCRIPTS}):
|
message("* Script configuration (${SCRIPTS}):
|
||||||
@@ -169,24 +110,6 @@ endforeach()
|
|||||||
|
|
||||||
message("")
|
message("")
|
||||||
|
|
||||||
# Display the module graph
|
|
||||||
message("* Modules configuration (${MODULES}):
|
|
||||||
|")
|
|
||||||
|
|
||||||
foreach(MODULE_GRAPH_KEY ${MODULE_GRAPH_KEYS})
|
|
||||||
if(NOT MODULE_GRAPH_KEY STREQUAL "disabled")
|
|
||||||
message(" +- ${MODULE_GRAPH_VALUE_DISPLAY_${MODULE_GRAPH_KEY}}")
|
|
||||||
else()
|
|
||||||
message(" | ${MODULE_GRAPH_VALUE_DISPLAY_${MODULE_GRAPH_KEY}}")
|
|
||||||
endif()
|
|
||||||
foreach(MODULE_GRAPH_PROJECT_ENTRY ${MODULE_GRAPH_VALUE_CONTAINS_MODULES_${MODULE_GRAPH_KEY}})
|
|
||||||
message(" | +- ${MODULE_GRAPH_PROJECT_ENTRY}")
|
|
||||||
endforeach()
|
|
||||||
message(" |")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
message("")
|
|
||||||
|
|
||||||
# Base sources which are used by every script project
|
# Base sources which are used by every script project
|
||||||
if(USE_SCRIPTPCH)
|
if(USE_SCRIPTPCH)
|
||||||
set(PRIVATE_PCH_HEADER ScriptPCH.h)
|
set(PRIVATE_PCH_HEADER ScriptPCH.h)
|
||||||
@@ -310,98 +233,6 @@ foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Generates the actual module projects
|
|
||||||
# Fills the STATIC_SCRIPT_MODULES and DYNAMIC_SCRIPT_MODULE_PROJECTS variables
|
|
||||||
# which contain the names which scripts are linked statically/dynamically and
|
|
||||||
# adds the sources of the static modules to the PRIVATE_SOURCES_MODULES variable.
|
|
||||||
foreach(SOURCE_MODULE ${MODULES_MODULE_LIST})
|
|
||||||
GetPathToModuleSource(${SOURCE_MODULE} MODULE_SOURCE_PATH)
|
|
||||||
ModuleNameToVariable(${SOURCE_MODULE} MODULE_MODULE_VARIABLE)
|
|
||||||
|
|
||||||
if((${MODULE_MODULE_VARIABLE} STREQUAL "disabled") OR
|
|
||||||
(${MODULE_MODULE_VARIABLE} STREQUAL "static"))
|
|
||||||
|
|
||||||
# Uninstall disabled modules
|
|
||||||
GetProjectNameOfModuleName(${SOURCE_MODULE} MODULE_SOURCE_PROJECT_NAME)
|
|
||||||
GetNativeSharedLibraryName(${MODULE_SOURCE_PROJECT_NAME} SCRIPT_MODULE_OUTPUT_NAME)
|
|
||||||
list(APPEND DISABLED_SCRIPT_MODULE_PROJECTS ${INSTALL_OFFSET}/${SCRIPT_MODULE_OUTPUT_NAME})
|
|
||||||
if(${MODULE_MODULE_VARIABLE} STREQUAL "static")
|
|
||||||
|
|
||||||
# Add the module content to the whole static module
|
|
||||||
CollectSourceFiles(${MODULE_SOURCE_PATH} PRIVATE_SOURCES_MODULES)
|
|
||||||
CollectIncludeDirectories(${MODULE_SOURCE_PATH} PUBLIC_INCLUDES)
|
|
||||||
|
|
||||||
# Skip deprecated api loaders
|
|
||||||
if (AC_SCRIPTS_INCLUDES MATCHES "${SOURCE_MODULE}")
|
|
||||||
message("> Module (${SOURCE_MODULE}) using deprecated loader api")
|
|
||||||
continue()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Skip mod-eluna-lua-engine
|
|
||||||
if (SOURCE_MODULE MATCHES "mod-eluna-lua-engine")
|
|
||||||
continue()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add the module name to STATIC_SCRIPT_MODULES
|
|
||||||
list(APPEND STATIC_SCRIPT_MODULES ${SOURCE_MODULE})
|
|
||||||
|
|
||||||
endif()
|
|
||||||
elseif(${MODULE_MODULE_VARIABLE} STREQUAL "dynamic")
|
|
||||||
|
|
||||||
# Generate an own dynamic module which is loadable on runtime
|
|
||||||
# Add the module content to the whole static module
|
|
||||||
unset(MODULE_SOURCE_PRIVATE_SOURCES)
|
|
||||||
CollectSourceFiles(${MODULE_SOURCE_PATH} MODULE_SOURCE_PRIVATE_SOURCES)
|
|
||||||
CollectIncludeDirectories(${MODULE_SOURCE_PATH} PUBLIC_INCLUDES)
|
|
||||||
|
|
||||||
# Configure the scriptloader
|
|
||||||
ConfigureScriptLoader(${SOURCE_MODULE} SCRIPT_MODULE_PRIVATE_SCRIPTLOADER ON ${SOURCE_MODULE})
|
|
||||||
GetProjectNameOfModuleName(${SOURCE_MODULE} MODULE_SOURCE_PROJECT_NAME)
|
|
||||||
|
|
||||||
# Add the module name to DYNAMIC_SCRIPT_MODULES
|
|
||||||
list(APPEND DYNAMIC_SCRIPT_MODULE_PROJECTS ${MODULE_SOURCE_PROJECT_NAME})
|
|
||||||
|
|
||||||
# Create the script module project
|
|
||||||
add_library(${MODULE_SOURCE_PROJECT_NAME} SHARED
|
|
||||||
${MODULE_SOURCE_PRIVATE_SOURCES}
|
|
||||||
${SCRIPT_MODULE_PRIVATE_SCRIPTLOADER})
|
|
||||||
|
|
||||||
target_link_libraries(${MODULE_SOURCE_PROJECT_NAME}
|
|
||||||
PRIVATE
|
|
||||||
acore-core-interface
|
|
||||||
PUBLIC
|
|
||||||
game)
|
|
||||||
|
|
||||||
target_include_directories(${MODULE_SOURCE_PROJECT_NAME}
|
|
||||||
PUBLIC
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${PUBLIC_INCLUDES})
|
|
||||||
|
|
||||||
set_target_properties(${MODULE_SOURCE_PROJECT_NAME}
|
|
||||||
PROPERTIES
|
|
||||||
FOLDER
|
|
||||||
"scripts")
|
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
install(TARGETS ${MODULE_SOURCE_PROJECT_NAME}
|
|
||||||
DESTINATION ${INSTALL_OFFSET} COMPONENT ${MODULE_SOURCE_PROJECT_NAME})
|
|
||||||
elseif(WIN32)
|
|
||||||
install(TARGETS ${MODULE_SOURCE_PROJECT_NAME}
|
|
||||||
RUNTIME DESTINATION ${INSTALL_OFFSET} COMPONENT ${MODULE_SOURCE_PROJECT_NAME})
|
|
||||||
if(MSVC)
|
|
||||||
# Place the script modules in the script subdirectory
|
|
||||||
set_target_properties(${MODULE_SOURCE_PROJECT_NAME} PROPERTIES
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin/Debug/scripts
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin/Release/scripts
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/bin/RelWithDebInfo/scripts
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/bin/MinSizeRel/scripts)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Unknown value \"${${MODULE_MODULE_VARIABLE}}\" for module (${SOURCE_MODULE})!")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# Add the dynamic script modules to the worldserver as dependency
|
# Add the dynamic script modules to the worldserver as dependency
|
||||||
set(WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES ${DYNAMIC_SCRIPT_MODULE_PROJECTS} PARENT_SCOPE)
|
set(WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES ${DYNAMIC_SCRIPT_MODULE_PROJECTS} PARENT_SCOPE)
|
||||||
|
|
||||||
@@ -412,8 +243,7 @@ list(REMOVE_DUPLICATES SCRIPT_MODULE_PRIVATE_SCRIPTLOADER)
|
|||||||
add_library(scripts STATIC
|
add_library(scripts STATIC
|
||||||
ScriptLoader.h
|
ScriptLoader.h
|
||||||
${SCRIPT_MODULE_PRIVATE_SCRIPTLOADER}
|
${SCRIPT_MODULE_PRIVATE_SCRIPTLOADER}
|
||||||
${PRIVATE_SOURCES_SCRIPTS}
|
${PRIVATE_SOURCES_SCRIPTS})
|
||||||
${PRIVATE_SOURCES_MODULES})
|
|
||||||
|
|
||||||
target_link_libraries(scripts
|
target_link_libraries(scripts
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "GitRevision.h"
|
#include "GitRevision.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
|
#include "ModuleMgr.h"
|
||||||
#include "MySQLThreading.h"
|
#include "MySQLThreading.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Realm.h"
|
#include "Realm.h"
|
||||||
@@ -219,6 +220,14 @@ public:
|
|||||||
handler->PSendSysMessage("LoginDatabase queue size: %zu", LoginDatabase.QueueSize());
|
handler->PSendSysMessage("LoginDatabase queue size: %zu", LoginDatabase.QueueSize());
|
||||||
handler->PSendSysMessage("CharacterDatabase queue size: %zu", CharacterDatabase.QueueSize());
|
handler->PSendSysMessage("CharacterDatabase queue size: %zu", CharacterDatabase.QueueSize());
|
||||||
handler->PSendSysMessage("WorldDatabase queue size: %zu", WorldDatabase.QueueSize());
|
handler->PSendSysMessage("WorldDatabase queue size: %zu", WorldDatabase.QueueSize());
|
||||||
|
|
||||||
|
handler->SendSysMessage("> List enable modules:");
|
||||||
|
|
||||||
|
for (auto const& modName : Acore::Module::GetEnableModulesList())
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(Acore::StringFormatFmt("- {}", modName));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
// Add deprecated api loaders include
|
|
||||||
@AC_SCRIPTS_INCLUDES@
|
|
||||||
// Add module scripts define
|
|
||||||
@AC_MODULE_LIST@
|
|
||||||
// Add default scripts include
|
// Add default scripts include
|
||||||
@ACORE_SCRIPTS_FORWARD_DECL@
|
@ACORE_SCRIPTS_FORWARD_DECL@
|
||||||
#ifdef ACORE_IS_DYNAMIC_SCRIPTLOADER
|
#ifdef ACORE_IS_DYNAMIC_SCRIPTLOADER
|
||||||
@@ -56,10 +52,8 @@ AC_SCRIPT_API char const* GetScriptModule()
|
|||||||
/// Exposed in script modules to register all scripts to the ScriptMgr.
|
/// Exposed in script modules to register all scripts to the ScriptMgr.
|
||||||
AC_SCRIPT_API void AddScripts()
|
AC_SCRIPT_API void AddScripts()
|
||||||
{
|
{
|
||||||
// Default scripts and modules
|
// Default scripts
|
||||||
@ACORE_SCRIPTS_INVOKE@
|
@ACORE_SCRIPTS_INVOKE@}
|
||||||
// Deprecated api modules
|
|
||||||
@AC_SCRIPTS_LIST@}
|
|
||||||
|
|
||||||
/// Exposed in script modules to get the build directive of the module.
|
/// Exposed in script modules to get the build directive of the module.
|
||||||
AC_SCRIPT_API char const* GetBuildDirective()
|
AC_SCRIPT_API char const* GetBuildDirective()
|
||||||
|
|||||||
@@ -184,7 +184,6 @@ public:
|
|||||||
[[nodiscard]] T const* LookupEntry(uint32 id) const { return (id >= _indexTableSize) ? nullptr : _indexTable.AsT[id]; }
|
[[nodiscard]] T const* LookupEntry(uint32 id) const { return (id >= _indexTableSize) ? nullptr : _indexTable.AsT[id]; }
|
||||||
[[nodiscard]] T const* AssertEntry(uint32 id) const { return ASSERT_NOTNULL(LookupEntry(id)); }
|
[[nodiscard]] T const* AssertEntry(uint32 id) const { return ASSERT_NOTNULL(LookupEntry(id)); }
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
void SetEntry(uint32 id, T* t)
|
void SetEntry(uint32 id, T* t)
|
||||||
{
|
{
|
||||||
if (id >= _indexTableSize)
|
if (id >= _indexTableSize)
|
||||||
@@ -203,7 +202,6 @@ public:
|
|||||||
delete _indexTable.AsT[id];
|
delete _indexTable.AsT[id];
|
||||||
_indexTable.AsT[id] = t;
|
_indexTable.AsT[id] = t;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
[[nodiscard]] uint32 GetNumRows() const { return _indexTableSize; }
|
[[nodiscard]] uint32 GetNumRows() const { return _indexTableSize; }
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ target_link_libraries(worldserver
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
acore-core-interface
|
acore-core-interface
|
||||||
PUBLIC
|
PUBLIC
|
||||||
|
modules
|
||||||
scripts
|
scripts
|
||||||
game
|
game
|
||||||
gsoap
|
gsoap
|
||||||
@@ -68,9 +69,13 @@ set_target_properties(worldserver
|
|||||||
FOLDER
|
FOLDER
|
||||||
"server")
|
"server")
|
||||||
|
|
||||||
|
# Add all dynamic projects as dependency to the worldserver
|
||||||
|
if(WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES)
|
||||||
|
add_dependencies(worldserver ${WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
# Install config
|
# Install config
|
||||||
CopyDefaultConfig(worldserver)
|
CopyDefaultConfig(worldserver)
|
||||||
CollectModulesConfig()
|
|
||||||
|
|
||||||
if( UNIX )
|
if( UNIX )
|
||||||
install(TARGETS worldserver DESTINATION bin)
|
install(TARGETS worldserver DESTINATION bin)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "IoContext.h"
|
#include "IoContext.h"
|
||||||
#include "MapMgr.h"
|
#include "MapMgr.h"
|
||||||
#include "Metric.h"
|
#include "Metric.h"
|
||||||
|
#include "ModulesScriptLoader.h"
|
||||||
#include "MySQLThreading.h"
|
#include "MySQLThreading.h"
|
||||||
#include "ObjectAccessor.h"
|
#include "ObjectAccessor.h"
|
||||||
#include "OpenSSLCrypto.h"
|
#include "OpenSSLCrypto.h"
|
||||||
@@ -61,9 +62,7 @@
|
|||||||
#include <openssl/crypto.h>
|
#include <openssl/crypto.h>
|
||||||
#include <openssl/opensslv.h>
|
#include <openssl/opensslv.h>
|
||||||
|
|
||||||
#ifdef ELUNA
|
#include "ModuleMgr.h"
|
||||||
#include "LuaEngine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "ServiceWin32.h"
|
#include "ServiceWin32.h"
|
||||||
@@ -279,6 +278,8 @@ int main(int argc, char** argv)
|
|||||||
SetProcessPriority("server.worldserver", sConfigMgr->GetOption<int32>(CONFIG_PROCESSOR_AFFINITY, 0), sConfigMgr->GetOption<bool>(CONFIG_HIGH_PRIORITY, false));
|
SetProcessPriority("server.worldserver", sConfigMgr->GetOption<int32>(CONFIG_PROCESSOR_AFFINITY, 0), sConfigMgr->GetOption<bool>(CONFIG_HIGH_PRIORITY, false));
|
||||||
|
|
||||||
sScriptMgr->SetScriptLoader(AddScripts);
|
sScriptMgr->SetScriptLoader(AddScripts);
|
||||||
|
sScriptMgr->SetModulesLoader(AddModulesScripts);
|
||||||
|
|
||||||
std::shared_ptr<void> sScriptMgrHandle(nullptr, [](void*)
|
std::shared_ptr<void> sScriptMgrHandle(nullptr, [](void*)
|
||||||
{
|
{
|
||||||
sScriptMgr->Unload();
|
sScriptMgr->Unload();
|
||||||
@@ -315,6 +316,8 @@ int main(int argc, char** argv)
|
|||||||
sMetric->Unload();
|
sMetric->Unload();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Acore::Module::SetEnableModulesList(AC_MODULES_LIST);
|
||||||
|
|
||||||
// Loading modules configs
|
// Loading modules configs
|
||||||
sConfigMgr->PrintLoadedModulesConfigs();
|
sConfigMgr->PrintLoadedModulesConfigs();
|
||||||
|
|
||||||
@@ -329,10 +332,6 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
sOutdoorPvPMgr->Die(); // unload it before MapMgr
|
sOutdoorPvPMgr->Die(); // unload it before MapMgr
|
||||||
sMapMgr->UnloadAll(); // unload all grids (including locked in memory)
|
sMapMgr->UnloadAll(); // unload all grids (including locked in memory)
|
||||||
|
|
||||||
#ifdef ELUNA
|
|
||||||
Eluna::Uninitialize();
|
|
||||||
#endif
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Start the Remote Access port (acceptor) if enabled
|
// Start the Remote Access port (acceptor) if enabled
|
||||||
@@ -448,7 +447,7 @@ bool StartDB()
|
|||||||
MySQL::Library_Init();
|
MySQL::Library_Init();
|
||||||
|
|
||||||
// Load databases
|
// Load databases
|
||||||
DatabaseLoader loader("server.worldserver");
|
DatabaseLoader loader("server.worldserver", DatabaseLoader::DATABASE_NONE, AC_MODULES_LIST);
|
||||||
loader
|
loader
|
||||||
.AddDatabase(LoginDatabase, "Login")
|
.AddDatabase(LoginDatabase, "Login")
|
||||||
.AddDatabase(CharacterDatabase, "Character")
|
.AddDatabase(CharacterDatabase, "Character")
|
||||||
|
|||||||
Reference in New Issue
Block a user