mirror of
https://github.com/azerothcore/azerothcore-wotlk.git
synced 2025-12-15 14:50:44 -08:00
feat(Core/Modules): add separated lib for modules (#9281)
This commit is contained in:
parent
8668a03e14
commit
51adbffae4
56 changed files with 1904 additions and 1014 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -7,6 +7,9 @@
|
|||
/modules/*
|
||||
!/modules/*.md
|
||||
!/modules/*.sh
|
||||
!/modules/CMakeLists.txt
|
||||
!/modules/*.h
|
||||
!/modules/*.cmake
|
||||
/build*/
|
||||
/var/*
|
||||
!/var/build/.gitkeep
|
||||
|
|
|
|||
|
|
@ -122,11 +122,11 @@ include(src/cmake/showoptions.cmake)
|
|||
|
||||
add_subdirectory(deps)
|
||||
|
||||
if( SERVERS OR TOOLS)
|
||||
if (SERVERS OR TOOLS)
|
||||
add_subdirectory(src/common)
|
||||
endif()
|
||||
|
||||
if( TOOLS )
|
||||
if (TOOLS)
|
||||
add_subdirectory(src/tools)
|
||||
endif()
|
||||
|
||||
|
|
@ -139,6 +139,9 @@ CU_RUN_HOOK("BEFORE_SRC_LOAD")
|
|||
# add core sources
|
||||
add_subdirectory(src)
|
||||
|
||||
# add modules sources
|
||||
add_subdirectory(modules)
|
||||
|
||||
CU_RUN_HOOK("AFTER_SRC_LOAD")
|
||||
|
||||
if( BUILD_TESTING )
|
||||
|
|
|
|||
378
modules/CMakeLists.txt
Normal file
378
modules/CMakeLists.txt
Normal file
|
|
@ -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("")
|
||||
64
modules/ModulesLoader.cpp.in.cmake
Normal file
64
modules/ModulesLoader.cpp.in.cmake
Normal file
|
|
@ -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
|
||||
26
modules/ModulesPCH.h
Normal file
26
modules/ModulesPCH.h
Normal file
|
|
@ -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
|
||||
23
modules/ModulesScriptLoader.h
Normal file
23
modules/ModulesScriptLoader.h
Normal file
|
|
@ -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("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
|
||||
add_custom_command(TARGET worldserver
|
||||
add_custom_command(TARGET modules
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/${postPath}")
|
||||
add_custom_command(TARGET worldserver
|
||||
add_custom_command(TARGET modules
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${configDir}" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/${postPath}")
|
||||
elseif(MINGW)
|
||||
add_custom_command(TARGET worldserver
|
||||
add_custom_command(TARGET modules
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/${postPath}")
|
||||
add_custom_command(TARGET worldserver
|
||||
add_custom_command(TARGET modules
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${configDir} ${CMAKE_BINARY_DIR}/bin/${postPath}")
|
||||
endif()
|
||||
|
|
@ -74,35 +74,3 @@ function(CopyModuleConfig configDir)
|
|||
endif()
|
||||
unset(postPath)
|
||||
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()
|
||||
set(${variable} ${IS_REQUIRED} PARENT_SCOPE)
|
||||
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
|
||||
common)
|
||||
|
||||
# Add support auto update db for modules
|
||||
GetModuleList()
|
||||
|
||||
set_target_properties(database
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@
|
|||
#include <mysqld_error.h>
|
||||
#include <thread>
|
||||
|
||||
DatabaseLoader::DatabaseLoader(std::string const& logger, uint32 const defaultUpdateMask)
|
||||
: _logger(logger), _autoSetup(sConfigMgr->GetOption<bool>("Updates.AutoSetup", true)),
|
||||
_updateFlags(sConfigMgr->GetOption<uint32>("Updates.EnableDatabases", defaultUpdateMask))
|
||||
{
|
||||
}
|
||||
DatabaseLoader::DatabaseLoader(std::string const& logger, uint32 const defaultUpdateMask, std::string_view modulesList)
|
||||
: _logger(logger),
|
||||
_modulesList(modulesList),
|
||||
_autoSetup(sConfigMgr->GetOption<bool>("Updates.AutoSetup", true)),
|
||||
_updateFlags(sConfigMgr->GetOption<uint32>("Updates.EnableDatabases", defaultUpdateMask)) { }
|
||||
|
||||
template <class T>
|
||||
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
|
||||
{
|
||||
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());
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class DatabaseWorkerPool;
|
|||
class AC_DATABASE_API DatabaseLoader
|
||||
{
|
||||
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)
|
||||
template <class T>
|
||||
|
|
@ -57,7 +57,7 @@ public:
|
|||
return _updateFlags;
|
||||
}
|
||||
|
||||
private :
|
||||
private:
|
||||
bool OpenDatabases();
|
||||
bool PopulateDatabases();
|
||||
bool UpdateDatabases();
|
||||
|
|
@ -71,6 +71,7 @@ private :
|
|||
bool Process(std::queue<Predicate>& queue);
|
||||
|
||||
std::string const _logger;
|
||||
std::string_view _modulesList;
|
||||
bool const _autoSetup;
|
||||
uint32 const _updateFlags;
|
||||
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ bool DBUpdater<T>::Create(DatabaseWorkerPool<T>& pool)
|
|||
}
|
||||
|
||||
template<class T>
|
||||
bool DBUpdater<T>::Update(DatabaseWorkerPool<T>& pool)
|
||||
bool DBUpdater<T>::Update(DatabaseWorkerPool<T>& pool, std::string_view modulesList /*= {}*/)
|
||||
{
|
||||
if (!DBUpdaterUtil::CheckExecutable())
|
||||
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); },
|
||||
[&](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;
|
||||
try
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public:
|
|||
static bool IsEnabled(uint32 const updateMask);
|
||||
static BaseLocation GetBaseLocationType();
|
||||
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 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()
|
||||
{
|
||||
}
|
||||
|
|
@ -144,8 +155,10 @@ UpdateFetcher::DirectoryStorage UpdateFetcher::ReceiveIncludedDirectories() cons
|
|||
|
||||
std::vector<std::string> moduleList;
|
||||
|
||||
auto const& _modulesTokens = Acore::Tokenize(AC_MODULES_LIST, ',', true);
|
||||
for (auto const& itr : _modulesTokens) moduleList.emplace_back(itr);
|
||||
for (auto const& itr : Acore::Tokenize(_modulesList, ',', true))
|
||||
{
|
||||
moduleList.emplace_back(itr);
|
||||
}
|
||||
|
||||
// data/sql
|
||||
for (auto const& itr : moduleList)
|
||||
|
|
@ -154,9 +167,11 @@ UpdateFetcher::DirectoryStorage UpdateFetcher::ReceiveIncludedDirectories() cons
|
|||
|
||||
Path const p(path);
|
||||
if (!is_directory(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
DirectoryEntry const entry = {p, AppliedFileEntry::StateConvert("MODULE")};
|
||||
DirectoryEntry const entry = { p, AppliedFileEntry::StateConvert("MODULE") };
|
||||
directories.push_back(entry);
|
||||
|
||||
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(Path const& path)> const& applyFile,
|
||||
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();
|
||||
|
||||
UpdateResult Update(bool const redundancyChecks, bool const allowRehash,
|
||||
|
|
@ -153,6 +161,7 @@ private:
|
|||
// modules
|
||||
std::string const _dbModuleName;
|
||||
std::vector<std::string> const* _setDirectories;
|
||||
std::string_view _modulesList = {};
|
||||
};
|
||||
|
||||
#endif // UpdateFetcher_h__
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@
|
|||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
namespace Acore
|
||||
{
|
||||
class BattlegroundChatBuilder
|
||||
|
|
@ -217,9 +214,7 @@ Battleground::~Battleground()
|
|||
for (uint32 i = 0; i < size; ++i)
|
||||
DelObject(i);
|
||||
|
||||
#ifdef ELUNA
|
||||
sEluna->OnBGDestroy(this, GetBgTypeID(), GetInstanceID());
|
||||
#endif
|
||||
sScriptMgr->OnBattlegroundDestroy(this);
|
||||
|
||||
sBattlegroundMgr->RemoveBattleground(GetBgTypeID(), GetInstanceID());
|
||||
// unload map
|
||||
|
|
@ -513,10 +508,6 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
|||
|
||||
StartingEventOpenDoors();
|
||||
|
||||
#ifdef ELUNA
|
||||
sEluna->OnBGStart(this, GetBgTypeID(), GetInstanceID());
|
||||
#endif
|
||||
|
||||
SendWarningToAll(StartMessageIds[BG_STARTING_EVENT_FOURTH]);
|
||||
SetStatus(STATUS_IN_PROGRESS);
|
||||
SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FOURTH]);
|
||||
|
|
@ -1063,9 +1054,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
|
|||
if (winmsg_id)
|
||||
SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
|
||||
#ifdef ELUNA
|
||||
sEluna->OnBGEnd(this, GetBgTypeID(), GetInstanceID(), winnerTeamId);
|
||||
#endif
|
||||
sScriptMgr->OnBattlegroundEnd(this, winnerTeamId);
|
||||
}
|
||||
|
||||
uint32 Battleground::GetBonusHonorFromKill(uint32 kills) const
|
||||
|
|
|
|||
|
|
@ -48,10 +48,6 @@
|
|||
#include <random>
|
||||
#include <unordered_map>
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
/*********************************************************/
|
||||
/*** BATTLEGROUND MANAGER ***/
|
||||
/*********************************************************/
|
||||
|
|
@ -994,9 +990,8 @@ void BattlegroundMgr::AddBattleground(Battleground* bg)
|
|||
m_BattlegroundTemplates[bg->GetBgTypeID()] = bg;
|
||||
else
|
||||
m_Battlegrounds[bg->GetInstanceID()] = bg;
|
||||
#ifdef ELUNA
|
||||
sEluna->OnBGCreate(bg, bg->GetBgTypeID(), bg->GetInstanceID());
|
||||
#endif
|
||||
|
||||
sScriptMgr->OnBattlegroundCreate(bg);
|
||||
}
|
||||
|
||||
void BattlegroundMgr::RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 instanceId)
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ target_link_libraries(game-interface
|
|||
shared)
|
||||
|
||||
add_library(game STATIC
|
||||
${PRIVATE_SOURCES}
|
||||
${ElunaLuaEngineFiles})
|
||||
${PRIVATE_SOURCES})
|
||||
|
||||
add_dependencies(game revision.h)
|
||||
|
||||
|
|
|
|||
|
|
@ -35,10 +35,6 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
Player* ChatHandler::GetPlayer() const
|
||||
{
|
||||
return m_session ? m_session->GetPlayer() : nullptr;
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@
|
|||
#include "Tokenize.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
using ChatSubCommandMap = std::map<std::string_view, Acore::Impl::ChatCommands::ChatCommandNode, StringCompareLessI_T>;
|
||||
|
||||
void Acore::Impl::ChatCommands::ChatCommandNode::LoadFromBuilder(ChatCommandBuilder const& builder)
|
||||
|
|
@ -334,27 +330,24 @@ namespace Acore::Impl::ChatCommands
|
|||
if (!handler.IsConsole())
|
||||
LogCommandUsage(*handler.GetSession(), cmdStr);
|
||||
}
|
||||
else if (!handler.HasSentErrorMessage())
|
||||
{ /* invocation failed, we should show usage */
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnCommand(handler.IsConsole() ? nullptr : handler.GetSession()->GetPlayer(), std::string(cmdStr).c_str()))
|
||||
else if (!handler.HasSentErrorMessage()) /* invocation failed, we should show usage */
|
||||
{
|
||||
if (!sScriptMgr->CanExecuteCommand(handler, cmdStr))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
cmd->SendCommandHelp(handler);
|
||||
handler.SetSentErrorMessage(true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnCommand(handler.IsConsole() ? nullptr : handler.GetSession()->GetPlayer(), std::string(cmdStr).c_str()))
|
||||
if (!sScriptMgr->CanExecuteCommand(handler, cmdStr))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,10 +53,6 @@
|
|||
// there is probably some underlying problem with imports which should properly addressed
|
||||
#include "GridNotifiersImpl.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const
|
||||
{
|
||||
TrainerSpellMap::const_iterator itr = spellList.find(spell_id);
|
||||
|
|
@ -242,12 +238,8 @@ void Creature::AddToWorld()
|
|||
{
|
||||
GetZoneScript()->OnCreatureCreate(this);
|
||||
}
|
||||
#ifdef ELUNA
|
||||
sEluna->OnAddToWorld(this);
|
||||
|
||||
if (IsGuardian() && ToTempSummon() && ToTempSummon()->GetSummonerGUID().IsPlayer())
|
||||
sEluna->OnPetAddedToWorld(ToTempSummon()->GetSummonerUnit()->ToPlayer(), this);
|
||||
#endif
|
||||
sScriptMgr->OnCreatureAddWorld(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -255,9 +247,8 @@ void Creature::RemoveFromWorld()
|
|||
{
|
||||
if (IsInWorld())
|
||||
{
|
||||
#ifdef ELUNA
|
||||
sEluna->OnRemoveFromWorld(this);
|
||||
#endif
|
||||
sScriptMgr->OnCreatureRemoveWorld(this);
|
||||
|
||||
if (GetZoneScript())
|
||||
GetZoneScript()->OnCreatureRemove(this);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,10 +38,6 @@
|
|||
#include <G3D/CoordinateFrame.h>
|
||||
#include <G3D/Quat.h>
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
GameObject::GameObject() : WorldObject(false), MovableMapObject(),
|
||||
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
|
||||
|
||||
WorldObject::AddToWorld();
|
||||
#ifdef ELUNA
|
||||
sEluna->OnAddToWorld(this);
|
||||
#endif
|
||||
|
||||
sScriptMgr->OnGameObjectAddWorld(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -172,9 +167,8 @@ void GameObject::RemoveFromWorld()
|
|||
///- Remove the gameobject from the accessor
|
||||
if (IsInWorld())
|
||||
{
|
||||
#ifdef ELUNA
|
||||
sEluna->OnRemoveFromWorld(this);
|
||||
#endif
|
||||
sScriptMgr->OnGameObjectRemoveWorld(this);
|
||||
|
||||
if (m_zoneScript)
|
||||
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)
|
||||
{
|
||||
#ifdef ELUNA
|
||||
sEluna->UpdateAI(this, diff);
|
||||
#endif
|
||||
if (AI())
|
||||
AI()->UpdateAI(diff);
|
||||
else if (!AIM_Initialize())
|
||||
|
|
@ -840,6 +831,7 @@ void GameObject::Update(uint32 diff)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sScriptMgr->OnGameObjectUpdate(this, diff);
|
||||
}
|
||||
|
||||
|
|
@ -1424,10 +1416,6 @@ void GameObject::Use(Unit* user)
|
|||
|
||||
if (Player* playerUser = user->ToPlayer())
|
||||
{
|
||||
#ifdef ELUNA
|
||||
if (sEluna->OnGossipHello(playerUser, this))
|
||||
return;
|
||||
#endif
|
||||
if (sScriptMgr->OnGossipHello(playerUser, this))
|
||||
return;
|
||||
|
||||
|
|
@ -2287,11 +2275,10 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
|
|||
break;
|
||||
case GO_DESTRUCTIBLE_DAMAGED:
|
||||
{
|
||||
#ifdef ELUNA
|
||||
sEluna->OnDamaged(this, eventInvoker);
|
||||
#endif
|
||||
EventInform(m_goInfo->building.damagedEvent);
|
||||
|
||||
sScriptMgr->OnGameObjectDamaged(this, eventInvoker);
|
||||
|
||||
if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
|
||||
if (Battleground* bg = bgMap->GetBG())
|
||||
bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.damagedEvent);
|
||||
|
|
@ -2318,11 +2305,10 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
|
|||
}
|
||||
case GO_DESTRUCTIBLE_DESTROYED:
|
||||
{
|
||||
#ifdef ELUNA
|
||||
sEluna->OnDestroyed(this, eventInvoker);
|
||||
#endif
|
||||
sScriptMgr->OnGameObjectDestroyed(this, eventInvoker);
|
||||
|
||||
EventInform(m_goInfo->building.destroyedEvent);
|
||||
|
||||
if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
|
||||
{
|
||||
if (Battleground* bg = bgMap->GetBG())
|
||||
|
|
@ -2375,9 +2361,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
|
|||
void GameObject::SetLootState(LootState state, Unit* unit)
|
||||
{
|
||||
m_lootState = state;
|
||||
#ifdef ELUNA
|
||||
sEluna->OnLootStateChanged(this, state);
|
||||
#endif
|
||||
|
||||
AI()->OnStateChanged(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
|
||||
|
|
@ -2400,10 +2384,9 @@ void GameObject::SetLootState(LootState state, Unit* unit)
|
|||
void GameObject::SetGoState(GOState state)
|
||||
{
|
||||
SetByteValue(GAMEOBJECT_BYTES_1, 0, state);
|
||||
#ifdef ELUNA
|
||||
sEluna->OnGameObjectStateChanged(this, state);
|
||||
#endif
|
||||
|
||||
sScriptMgr->OnGameObjectStateChanged(this, state);
|
||||
|
||||
if (m_model)
|
||||
{
|
||||
if (!IsInWorld())
|
||||
|
|
|
|||
|
|
@ -55,11 +55,6 @@
|
|||
// there is probably some underlying problem with imports which should properly addressed
|
||||
#include "GridNotifiersImpl.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "ElunaEventMgr.h"
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
constexpr float VisibilityDistances[AsUnderlyingType(VisibilityDistanceType::Max)] =
|
||||
{
|
||||
DEFAULT_VISIBILITY_DISTANCE,
|
||||
|
|
@ -87,10 +82,7 @@ Object::Object() : m_PackGUID(sizeof(uint64) + 1)
|
|||
|
||||
WorldObject::~WorldObject()
|
||||
{
|
||||
#ifdef ELUNA
|
||||
delete elunaEvents;
|
||||
elunaEvents = nullptr;
|
||||
#endif
|
||||
sScriptMgr->OnWorldObjectDestroy(this);
|
||||
|
||||
// this may happen because there are many !create/delete
|
||||
if (IsWorldObject() && m_currMap)
|
||||
|
|
@ -1106,23 +1098,20 @@ void MovementInfo::OutDebug()
|
|||
}
|
||||
|
||||
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),
|
||||
_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_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST);
|
||||
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE);
|
||||
|
||||
sScriptMgr->OnWorldObjectCreate(this);
|
||||
}
|
||||
|
||||
#ifdef ELUNA
|
||||
void WorldObject::Update(uint32 time_diff)
|
||||
{
|
||||
elunaEvents->Update(time_diff);
|
||||
sScriptMgr->OnWorldObjectUpdate(this, time_diff);
|
||||
}
|
||||
#endif
|
||||
|
||||
void WorldObject::SetWorldObject(bool on)
|
||||
{
|
||||
|
|
@ -2227,22 +2216,23 @@ void WorldObject::SetMap(Map* map)
|
|||
{
|
||||
ASSERT(map);
|
||||
ASSERT(!IsInWorld());
|
||||
|
||||
if (m_currMap == map) // command add npc: first create, than loadfromdb
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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());
|
||||
ABORT();
|
||||
}
|
||||
|
||||
m_currMap = map;
|
||||
m_mapId = map->GetId();
|
||||
m_InstanceId = map->GetInstanceId();
|
||||
|
||||
#ifdef ELUNA
|
||||
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
|
||||
sScriptMgr->OnWorldObjectSetMap(this, map);
|
||||
|
||||
if (IsWorldObject())
|
||||
m_currMap->AddWorldObject(this);
|
||||
|
|
@ -2252,13 +2242,13 @@ void WorldObject::ResetMap()
|
|||
{
|
||||
ASSERT(m_currMap);
|
||||
ASSERT(!IsInWorld());
|
||||
if (IsWorldObject())
|
||||
m_currMap->RemoveWorldObject(this);
|
||||
|
||||
#ifdef ELUNA
|
||||
delete elunaEvents;
|
||||
elunaEvents = nullptr;
|
||||
#endif
|
||||
if (IsWorldObject())
|
||||
{
|
||||
m_currMap->RemoveWorldObject(this);
|
||||
}
|
||||
|
||||
sScriptMgr->OnWorldObjectResetMap(this);
|
||||
|
||||
m_currMap = nullptr;
|
||||
//maybe not for corpse
|
||||
|
|
|
|||
|
|
@ -33,9 +33,7 @@
|
|||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#ifdef ELUNA
|
||||
class ElunaEventProcessor;
|
||||
#endif
|
||||
|
||||
enum TempSummonType
|
||||
{
|
||||
|
|
@ -673,20 +671,13 @@ protected:
|
|||
public:
|
||||
~WorldObject() override;
|
||||
|
||||
#ifdef ELUNA
|
||||
virtual void Update(uint32 /*time_diff*/);
|
||||
#else
|
||||
virtual void Update(uint32 /*time_diff*/) { };
|
||||
#endif
|
||||
|
||||
void _Create(ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask);
|
||||
|
||||
void AddToWorld() 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(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;
|
||||
|
|
@ -899,6 +890,8 @@ public:
|
|||
[[nodiscard]] bool HasAllowedLooter(ObjectGuid guid) const;
|
||||
[[nodiscard]] GuidUnorderedSet const& GetAllowedLooters() const;
|
||||
|
||||
ElunaEventProcessor* elunaEvents;
|
||||
|
||||
protected:
|
||||
std::string m_name;
|
||||
bool m_isActive;
|
||||
|
|
|
|||
|
|
@ -35,10 +35,6 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
Pet::Pet(Player* owner, PetType type) : Guardian(nullptr, owner ? owner->GetGUID() : ObjectGuid::Empty, true),
|
||||
m_usedTalentCount(0), m_removed(false), m_owner(owner),
|
||||
m_happinessTimer(PET_LOSE_HAPPINES_INTERVAL), m_petType(type), m_duration(0),
|
||||
|
|
@ -98,10 +94,10 @@ void Pet::AddToWorld()
|
|||
GetCharmInfo()->SetIsReturning(false);
|
||||
}
|
||||
|
||||
#ifdef ELUNA
|
||||
if (GetOwnerGUID().IsPlayer())
|
||||
sEluna->OnPetAddedToWorld(GetOwner(), this);
|
||||
#endif
|
||||
{
|
||||
sScriptMgr->OnPetAddToWorld(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Pet::RemoveFromWorld()
|
||||
|
|
|
|||
|
|
@ -92,10 +92,6 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
enum CharacterFlags
|
||||
{
|
||||
CHARACTER_FLAG_NONE = 0x00000000,
|
||||
|
|
@ -4356,12 +4352,12 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
|
|||
// update visibility
|
||||
UpdateObjectVisibility();
|
||||
|
||||
#ifdef ELUNA
|
||||
sEluna->OnResurrect(this);
|
||||
#endif
|
||||
sScriptMgr->OnPlayerResurrect(this, restore_percent, applySickness);
|
||||
|
||||
if(!applySickness)
|
||||
if (!applySickness)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Characters from level 1-10 are not affected by resurrection 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*/)
|
||||
{
|
||||
std::string _text(text);
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_SAY, language, _text);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(this, CHAT_MSG_SAY, language, _text))
|
||||
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_SAY, language, _text))
|
||||
{
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_SAY, language, _text);
|
||||
|
||||
WorldPacket data;
|
||||
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*/)
|
||||
{
|
||||
std::string _text(text);
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_YELL, language, _text);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(this, CHAT_MSG_YELL, language, _text))
|
||||
|
||||
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_YELL, language, _text))
|
||||
{
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_YELL, language, _text);
|
||||
|
||||
WorldPacket data;
|
||||
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*/)
|
||||
{
|
||||
std::string _text(text);
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text))
|
||||
|
||||
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text))
|
||||
{
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text);
|
||||
|
||||
WorldPacket data;
|
||||
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
|
||||
|
||||
std::string _text(text);
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, target);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(this, CHAT_MSG_WHISPER, language, _text, target))
|
||||
|
||||
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text, target))
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, target);
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, language, this, this, _text);
|
||||
|
|
@ -12803,9 +12804,6 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
|
|||
if (loot->containerGUID)
|
||||
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());
|
||||
}
|
||||
else
|
||||
|
|
@ -13235,9 +13233,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
|
|||
m_usedTalentCount += talentPointsChange;
|
||||
SetFreeTalentPoints(CurTalentPoints - talentPointsChange);
|
||||
|
||||
#ifdef ELUNA
|
||||
sEluna->OnLearnTalents(this, talentId, talentRank, spellId);
|
||||
#endif
|
||||
sScriptMgr->OnPlayerLearnTalents(this, talentId, talentRank, spellId);
|
||||
}
|
||||
|
||||
void Player::LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRank)
|
||||
|
|
|
|||
|
|
@ -30,10 +30,6 @@
|
|||
#include "SpellMgr.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
/*********************************************************/
|
||||
/*** QUEST SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
|
@ -429,10 +425,7 @@ void Player::AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver)
|
|||
switch (questGiver->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
#ifdef ELUNA
|
||||
sEluna->OnQuestAccept(this, questGiver->ToCreature(), quest);
|
||||
#endif
|
||||
sScriptMgr->OnQuestAccept(this, (questGiver->ToCreature()), quest);
|
||||
sScriptMgr->OnQuestAccept(this, questGiver->ToCreature(), quest);
|
||||
questGiver->ToCreature()->AI()->sQuestAccept(this, quest);
|
||||
break;
|
||||
case TYPEID_ITEM:
|
||||
|
|
@ -458,9 +451,6 @@ void Player::AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver)
|
|||
break;
|
||||
}
|
||||
case TYPEID_GAMEOBJECT:
|
||||
#ifdef ELUNA
|
||||
sEluna->OnQuestAccept(this, questGiver->ToGameObject(), quest);
|
||||
#endif
|
||||
sScriptMgr->OnQuestAccept(this, questGiver->ToGameObject(), quest);
|
||||
questGiver->ToGameObject()->AI()->QuestAccept(this, quest);
|
||||
break;
|
||||
|
|
@ -1566,13 +1556,12 @@ QuestGiverStatus Player::GetQuestDialogStatus(Object* questgiver)
|
|||
QuestRelationBounds qr;
|
||||
QuestRelationBounds qir;
|
||||
|
||||
sScriptMgr->GetDialogStatus(this, questgiver);
|
||||
|
||||
switch (questgiver->GetTypeId())
|
||||
{
|
||||
case TYPEID_GAMEOBJECT:
|
||||
{
|
||||
#ifdef ELUNA
|
||||
sEluna->GetDialogStatus(this, questgiver->ToGameObject());
|
||||
#endif
|
||||
QuestGiverStatus questStatus = QuestGiverStatus(sScriptMgr->GetDialogStatus(this, questgiver->ToGameObject()));
|
||||
if (questStatus != DIALOG_STATUS_SCRIPTED_NO_STATUS)
|
||||
return questStatus;
|
||||
|
|
@ -1582,9 +1571,6 @@ QuestGiverStatus Player::GetQuestDialogStatus(Object* questgiver)
|
|||
}
|
||||
case TYPEID_UNIT:
|
||||
{
|
||||
#ifdef ELUNA
|
||||
sEluna->GetDialogStatus(this, questgiver->ToCreature());
|
||||
#endif
|
||||
QuestGiverStatus questStatus = QuestGiverStatus(sScriptMgr->GetDialogStatus(this, questgiver->ToCreature()));
|
||||
if (questStatus != DIALOG_STATUS_SCRIPTED_NO_STATUS)
|
||||
return questStatus;
|
||||
|
|
|
|||
|
|
@ -76,10 +76,6 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
/*********************************************************/
|
||||
/*** STORAGE SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
|
@ -2340,13 +2336,6 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
|
|||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
#ifdef ELUNA
|
||||
InventoryResult eres = sEluna->OnCanUseItem(this, proto->ItemId);
|
||||
if (eres != EQUIP_ERR_OK)
|
||||
InventoryResult result = EQUIP_ERR_OK;
|
||||
|
||||
if (!sScriptMgr->CanUseItem(const_cast<Player*>(this), proto, result))
|
||||
{
|
||||
return eres;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
return EQUIP_ERR_OK;
|
||||
}
|
||||
|
|
@ -2851,9 +2839,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
|
|||
pItem2->SetState(ITEM_CHANGED, this);
|
||||
|
||||
ApplyEquipCooldown(pItem2);
|
||||
#ifdef ELUNA
|
||||
sEluna->OnEquip(this, pItem2, bag, slot);
|
||||
#endif
|
||||
sScriptMgr->OnEquip(this, pItem2, bag, slot, update);
|
||||
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_EPIC_ITEM, pItem->GetEntry(), slot);
|
||||
|
||||
#ifdef ELUNA
|
||||
sEluna->OnEquip(this, pItem, bag, slot);
|
||||
#endif
|
||||
|
||||
sScriptMgr->OnEquip(this, pItem, bag, slot, update);
|
||||
UpdateForQuestWorldObjects();
|
||||
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_EPIC_ITEM, pItem->GetEntry(), slot);
|
||||
|
||||
#ifdef ELUNA
|
||||
sEluna->OnEquip(this, pItem, (pos >> 8), slot);
|
||||
#endif
|
||||
sScriptMgr->OnEquip(this, pItem, (pos >> 8), slot, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,11 +70,6 @@
|
|||
#include "WorldSession.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "ElunaEventMgr.h"
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
float baseMoveSpeed[MAX_MOVE_TYPE] =
|
||||
{
|
||||
2.5f, // MOVE_WALK
|
||||
|
|
@ -387,9 +382,8 @@ Unit::~Unit()
|
|||
|
||||
void Unit::Update(uint32 p_time)
|
||||
{
|
||||
#ifdef ELUNA
|
||||
elunaEvents->Update(p_time);
|
||||
#endif
|
||||
sScriptMgr->OnUnitUpdate(this, p_time);
|
||||
|
||||
// WARNING! Order of execution here is important, do not change.
|
||||
// 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.
|
||||
|
|
@ -12991,10 +12985,11 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy, uint32 duration)
|
|||
|
||||
controlled->SetInCombatState(PvP, enemy, duration);
|
||||
}
|
||||
#ifdef ELUNA
|
||||
|
||||
if (Player* player = this->ToPlayer())
|
||||
sEluna->OnPlayerEnterCombat(player, enemy);
|
||||
#endif
|
||||
{
|
||||
sScriptMgr->OnPlayerEnterCombat(player, enemy);
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::ClearInCombat()
|
||||
|
|
@ -13025,10 +13020,11 @@ void Unit::ClearInCombat()
|
|||
for (uint8 i = 0; i < MAX_RUNES; ++i)
|
||||
player->SetGracePeriod(i, 0);
|
||||
}
|
||||
#ifdef ELUNA
|
||||
|
||||
if (Player* player = this->ToPlayer())
|
||||
sEluna->OnPlayerLeaveCombat(player);
|
||||
#endif
|
||||
{
|
||||
sScriptMgr->OnPlayerLeaveCombat(player);
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::ClearInPetCombat()
|
||||
|
|
|
|||
|
|
@ -34,10 +34,6 @@
|
|||
#include "WorldPacket.h"
|
||||
#include <time.h>
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
GameEventMgr* 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);
|
||||
|
||||
// skip not taxi network nodes
|
||||
#ifndef ELUNA
|
||||
if ((sTaxiNodesMask[field] & submask) == 0)
|
||||
#else
|
||||
if (field >= TaxiMaskSize || (sTaxiNodesMask[field] & submask) == 0)
|
||||
#endif
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float dist2 = (node->x - x) * (node->x - x) + (node->y - y) * (node->y - y) + (node->z - z) * (node->z - z);
|
||||
if (found)
|
||||
|
|
|
|||
|
|
@ -56,10 +56,6 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
class LoginQueryHolder : public CharacterDatabaseQueryHolder
|
||||
{
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -39,10 +39,6 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
inline bool isNasty(uint8 c)
|
||||
{
|
||||
if (c == '\t')
|
||||
|
|
@ -431,11 +427,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||
if (type == CHAT_MSG_PARTY_LEADER && !group->IsLeader(sender->GetGUID()))
|
||||
return;
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
if (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, group))
|
||||
{
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, ChatMsg(type), Language(lang), sender, nullptr, msg);
|
||||
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 (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, guild))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -464,12 +463,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||
{
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()))
|
||||
{
|
||||
if (sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, guild))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -486,11 +486,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||
return;
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
if (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, group))
|
||||
{
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID, Language(lang), sender, nullptr, msg);
|
||||
group->BroadcastPacket(&data, false);
|
||||
|
|
@ -507,11 +509,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||
return;
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
if (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, group))
|
||||
{
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_LEADER, Language(lang), sender, nullptr, msg);
|
||||
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())
|
||||
return;
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
if (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, group))
|
||||
{
|
||||
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;
|
||||
//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);
|
||||
group->BroadcastPacket(&data, false);
|
||||
}
|
||||
|
|
@ -541,11 +547,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||
if (!group || !group->isBGGroup())
|
||||
return;
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
if (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, group))
|
||||
{
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND, Language(lang), sender, nullptr, msg);
|
||||
group->BroadcastPacket(&data, false);
|
||||
|
|
@ -558,11 +566,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||
if (!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetGUID()))
|
||||
return;
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
if (!sScriptMgr->CanPlayerUseChat(GetPlayer(), type, lang, msg, group))
|
||||
{
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND_LEADER, Language(lang), sender, nullptr, msg);
|
||||
group->BroadcastPacket(&data, false);
|
||||
|
|
@ -583,12 +593,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||
{
|
||||
if (Channel* chn = cMgr->GetChannel(channel, sender))
|
||||
{
|
||||
if (!sScriptMgr->CanPlayerUseChat(sender, type, lang, msg, chn))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -615,11 +626,12 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||
sender->ToggleAFK();
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(sender, type, lang, msg);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(sender, type, lang, msg))
|
||||
if (!sScriptMgr->CanPlayerUseChat(sender, type, lang, msg))
|
||||
{
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(sender, type, lang, msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -642,11 +654,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
|||
sender->ToggleDND();
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(sender, type, lang, msg);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(sender, type, lang, msg))
|
||||
if (!sScriptMgr->CanPlayerUseChat(sender, type, lang, msg))
|
||||
{
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(sender, type, lang, msg);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -26,13 +26,10 @@
|
|||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
|
||||
{
|
||||
LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_LOOT_ITEM");
|
||||
|
|
@ -210,9 +207,9 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
|
|||
data << uint8(1); // "You loot..."
|
||||
SendPacket(&data);
|
||||
}
|
||||
#ifdef ELUNA
|
||||
sEluna->OnLootMoney(player, loot->gold);
|
||||
#endif
|
||||
|
||||
sScriptMgr->OnLootMoney(player, loot->gold);
|
||||
|
||||
loot->gold = 0;
|
||||
|
||||
// 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->UpdateLootAchievements(&item, loot);
|
||||
|
||||
#ifdef ELUNA
|
||||
sEluna->OnLootItem(target, newitem, item.count, lootguid);
|
||||
#endif
|
||||
|
||||
// mark as looted
|
||||
item.count = 0;
|
||||
item.is_looted = true;
|
||||
|
|
|
|||
|
|
@ -51,10 +51,6 @@
|
|||
#include "WorldSession.h"
|
||||
#include <zlib.h>
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_REPOP_REQUEST Message");
|
||||
|
|
@ -79,10 +75,6 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data)
|
|||
GetPlayer()->KillPlayer();
|
||||
}
|
||||
|
||||
#ifdef ELUNA
|
||||
sEluna->OnRepop(GetPlayer());
|
||||
#endif
|
||||
|
||||
//this is spirit release confirm?
|
||||
GetPlayer()->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
|
||||
GetPlayer()->BuildPlayerRepop();
|
||||
|
|
|
|||
|
|
@ -31,10 +31,6 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
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)
|
||||
creature->StopMoving();
|
||||
|
||||
#ifdef ELUNA
|
||||
if (sEluna->OnGossipHello(_player, creature))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (sScriptMgr->OnGossipHello(_player, creature))
|
||||
return;
|
||||
|
||||
|
|
@ -425,9 +416,9 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData)
|
|||
_player->AbandonQuest(questId); // remove all quest items player received before abandoning quest.
|
||||
_player->RemoveActiveQuest(questId);
|
||||
_player->RemoveTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, questId);
|
||||
#ifdef ELUNA
|
||||
sEluna->OnQuestAbandon(_player, questId);
|
||||
#endif
|
||||
|
||||
sScriptMgr->OnQuestAbandon(_player, questId);
|
||||
|
||||
LOG_DEBUG("network.opcode", "Player %s abandoned quest %u", _player->GetGUID().ToString().c_str(), questId);
|
||||
// check if Quest Tracker is enabled
|
||||
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER))
|
||||
|
|
|
|||
|
|
@ -32,10 +32,6 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets)
|
||||
{
|
||||
// some spell cast packet including more data (for projectiles?)
|
||||
|
|
|
|||
|
|
@ -40,10 +40,6 @@
|
|||
#include "VMapMgr2.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
union u_map_magic
|
||||
{
|
||||
char asChar[4];
|
||||
|
|
@ -2999,37 +2995,38 @@ void InstanceMap::AfterPlayerUnlinkFromMap()
|
|||
|
||||
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)
|
||||
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 (!isElunaAI)
|
||||
if (!isOtherAI)
|
||||
{
|
||||
#endif
|
||||
InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(GetId());
|
||||
if (mInstance)
|
||||
{
|
||||
i_script_id = mInstance->ScriptId;
|
||||
instance_data = sScriptMgr->CreateInstanceScript(this);
|
||||
}
|
||||
#ifdef ELUNA
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!instance_data)
|
||||
return;
|
||||
|
||||
#ifdef ELUNA
|
||||
// use mangos behavior if we are dealing with Eluna AI
|
||||
// initialize should then be called only if load is false
|
||||
if (!isElunaAI || !load)
|
||||
#endif
|
||||
if (!isOtherAI || !load)
|
||||
{
|
||||
instance_data->Initialize();
|
||||
}
|
||||
|
||||
if (load)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,12 +23,9 @@
|
|||
#include "MapMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "VMapFactory.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
MapInstanced::MapInstanced(uint32 id) : Map(id, 0, DUNGEON_DIFFICULTY_NORMAL)
|
||||
{
|
||||
// initialize instanced maps list
|
||||
|
|
@ -253,23 +250,17 @@ BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battlegroun
|
|||
bool MapInstanced::DestroyInstance(InstancedMaps::iterator& itr)
|
||||
{
|
||||
itr->second->RemoveAllPlayers();
|
||||
|
||||
if (itr->second->HavePlayers())
|
||||
{
|
||||
++itr;
|
||||
return false;
|
||||
}
|
||||
|
||||
sScriptMgr->OnDestroyInstance(this, itr->second);
|
||||
|
||||
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
|
||||
delete itr->second;
|
||||
m_InstancedMaps.erase(itr++);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class MapInstanced : public Map
|
|||
{
|
||||
friend class MapMgr;
|
||||
public:
|
||||
typedef std::unordered_map< uint32, Map*> InstancedMaps;
|
||||
using InstancedMaps = std::unordered_map<uint32, Map*>;
|
||||
|
||||
MapInstanced(uint32 id);
|
||||
~MapInstanced() override {}
|
||||
|
|
|
|||
|
|
@ -36,10 +36,6 @@
|
|||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
MapMgr::MapMgr()
|
||||
{
|
||||
i_timer[3].SetInterval(sWorld->getIntConfig(CONFIG_INTERVAL_MAPUPDATE));
|
||||
|
|
|
|||
42
src/server/game/Modules/ModuleMgr.cpp
Normal file
42
src/server/game/Modules/ModuleMgr.cpp
Normal file
|
|
@ -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;
|
||||
}
|
||||
31
src/server/game/Modules/ModuleMgr.h
Normal file
31
src/server/game/Modules/ModuleMgr.h
Normal file
|
|
@ -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 BattlegroundQueue;
|
||||
class Channel;
|
||||
class ChatHandler;
|
||||
class Creature;
|
||||
class CreatureAI;
|
||||
class DynamicObject;
|
||||
class GameObject;
|
||||
class GameObjectAI;
|
||||
class Guild;
|
||||
class GridMap;
|
||||
class Group;
|
||||
class Guild;
|
||||
class InstanceMap;
|
||||
class InstanceScript;
|
||||
class Item;
|
||||
class Map;
|
||||
class MotionTransport;
|
||||
class OutdoorPvP;
|
||||
class Player;
|
||||
class Quest;
|
||||
class ScriptMgr;
|
||||
class Spell;
|
||||
class SpellScript;
|
||||
class SpellInfo;
|
||||
class SpellCastTargets;
|
||||
class Transport;
|
||||
class SpellInfo;
|
||||
class SpellScript;
|
||||
class StaticTransport;
|
||||
class MotionTransport;
|
||||
class Transport;
|
||||
class Unit;
|
||||
class Vehicle;
|
||||
class WorldObject;
|
||||
class WorldPacket;
|
||||
class WorldSocket;
|
||||
class WorldObject;
|
||||
|
||||
struct AchievementCriteriaData;
|
||||
struct AuctionEntry;
|
||||
struct ConditionSourceInfo;
|
||||
struct Condition;
|
||||
struct ConditionSourceInfo;
|
||||
struct DungeonProgressionRequirements;
|
||||
struct GroupQueueInfo;
|
||||
struct ItemTemplate;
|
||||
struct OutdoorPvPData;
|
||||
struct GroupQueueInfo;
|
||||
struct TargetInfo;
|
||||
|
||||
namespace Acore::ChatCommands
|
||||
|
|
@ -167,13 +168,24 @@ public:
|
|||
// being open; it is not.
|
||||
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.
|
||||
virtual void OnPacketSend(WorldSession* /*session*/, WorldPacket& /*packet*/) { }
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
* @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
|
||||
virtual void OnPacketReceive(WorldSession* /*session*/, WorldPacket& /*packet*/) { }
|
||||
/**
|
||||
* @brief 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
|
||||
*
|
||||
* @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
|
||||
|
|
@ -217,7 +229,12 @@ public:
|
|||
*
|
||||
* @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
|
||||
|
|
@ -426,6 +443,14 @@ public:
|
|||
[[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; }
|
||||
|
||||
/**
|
||||
* @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
|
||||
|
|
@ -444,11 +469,62 @@ protected:
|
|||
AllMapScript(const char* name);
|
||||
|
||||
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*/) { }
|
||||
|
||||
// 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*/) { }
|
||||
|
||||
/**
|
||||
* @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
|
||||
|
|
@ -462,6 +538,147 @@ public:
|
|||
|
||||
// Called from End of Creature SelectLevel.
|
||||
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>
|
||||
|
|
@ -1064,6 +1281,105 @@ public:
|
|||
|
||||
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
|
||||
virtual void AnticheatSetSkipOnePacketForASH(Player* /*player*/, bool /*apply*/) { }
|
||||
virtual void AnticheatSetCanFlybyServer(Player* /*player*/, bool /*apply*/) { }
|
||||
|
|
@ -1211,7 +1527,11 @@ protected:
|
|||
public:
|
||||
[[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*/) { }
|
||||
|
||||
// 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
|
||||
*/
|
||||
[[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
|
||||
|
|
@ -1307,6 +1649,36 @@ public:
|
|||
virtual void OnRemoveAuraScaleTargets(Spell* /*spell*/, TargetInfo& /*targetInfo*/, uint8 /*auraScaleMask*/, bool& /*needErase*/) { }
|
||||
|
||||
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
|
||||
|
|
@ -1381,6 +1753,13 @@ public:
|
|||
[[nodiscard]] virtual bool CanUnlearnSpellDefault(Pet* /*pet*/, SpellInfo const* /*spellEntry*/) { 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
|
||||
|
|
@ -1443,6 +1822,14 @@ public:
|
|||
virtual void OnPlayerSetPhase(const AuraEffect* /*auraEff*/, AuraApplication const* /*aurApp*/, uint8 /*mode*/, bool /*apply*/, uint32& /*newPhase*/) { }
|
||||
|
||||
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
|
||||
|
|
@ -1455,7 +1842,15 @@ public:
|
|||
|
||||
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
|
||||
|
|
@ -1468,7 +1863,93 @@ public:
|
|||
|
||||
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.
|
||||
|
|
@ -1493,6 +1974,7 @@ public: /* Initialization */
|
|||
uint32 GetScriptCount() const { return _scriptCount; }
|
||||
|
||||
typedef void(*ScriptLoaderCallbackType)();
|
||||
typedef void(*ModulesLoaderCallbackType)();
|
||||
|
||||
/// Sets the script loader callback which is invoked to load scripts
|
||||
/// (Workaround for circular dependency game <-> scripts)
|
||||
|
|
@ -1501,6 +1983,13 @@ public: /* Initialization */
|
|||
_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 */
|
||||
void Unload();
|
||||
|
||||
|
|
@ -1514,8 +2003,8 @@ public: /* ServerScript */
|
|||
void OnNetworkStop();
|
||||
void OnSocketOpen(std::shared_ptr<WorldSocket> socket);
|
||||
void OnSocketClose(std::shared_ptr<WorldSocket> socket);
|
||||
void OnPacketReceive(WorldSession* session, WorldPacket const& packet);
|
||||
void OnPacketSend(WorldSession* session, WorldPacket const& packet);
|
||||
bool CanPacketReceive(WorldSession* session, WorldPacket const& packet);
|
||||
bool CanPacketSend(WorldSession* session, WorldPacket const& packet);
|
||||
|
||||
public: /* WorldScript */
|
||||
void OnLoadCustomDatabaseTable();
|
||||
|
|
@ -1529,6 +2018,7 @@ public: /* WorldScript */
|
|||
void OnWorldUpdate(uint32 diff);
|
||||
void OnStartup();
|
||||
void OnShutdown();
|
||||
void OnBeforeWorldInitialized();
|
||||
|
||||
public: /* FormulaScript */
|
||||
void OnHonorCalculation(float& honor, uint8 level, float multiplier);
|
||||
|
|
@ -1573,6 +2063,8 @@ public: /* CreatureScript */
|
|||
uint32 GetDialogStatus(Player* player, Creature* creature);
|
||||
CreatureAI* GetCreatureAI(Creature* creature);
|
||||
void OnCreatureUpdate(Creature* creature, uint32 diff);
|
||||
void OnCreatureAddWorld(Creature* creature);
|
||||
void OnCreatureRemoveWorld(Creature* creature);
|
||||
|
||||
public: /* GameObjectScript */
|
||||
bool OnGossipHello(Player* player, GameObject* go);
|
||||
|
|
@ -1587,6 +2079,8 @@ public: /* GameObjectScript */
|
|||
void OnGameObjectStateChanged(GameObject* go, uint32 state);
|
||||
void OnGameObjectUpdate(GameObject* go, uint32 diff);
|
||||
GameObjectAI* GetGameObjectAI(GameObject* go);
|
||||
void OnGameObjectAddWorld(GameObject* go);
|
||||
void OnGameObjectRemoveWorld(GameObject* go);
|
||||
|
||||
public: /* AreaTriggerScript */
|
||||
bool OnAreaTrigger(Player* player, AreaTrigger const* trigger);
|
||||
|
|
@ -1773,6 +2267,18 @@ public: /* PlayerScript */
|
|||
bool CanInitTrade(Player* player, Player* target);
|
||||
void OnSetServerSideVisibility(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 AnticheatSetCanFlybyServer(Player* player, bool apply);
|
||||
void AnticheatSetUnderACKmount(Player* player);
|
||||
|
|
@ -1850,6 +2356,7 @@ public: /* UnitScript */
|
|||
bool IsNeedModHealPercent(Unit const* unit, AuraEffect* auraEff, float& doneTotalMod, SpellInfo const* spellProto);
|
||||
bool CanSetPhaseMask(Unit const* unit, uint32 newPhaseMask, bool update);
|
||||
bool IsCustomBuildValuesUpdate(Unit const* unit, uint8 updateType, ByteBuffer& fieldBuffer, Player const* target, uint16 index);
|
||||
void OnUnitUpdate(Unit* unit, uint32 diff);
|
||||
|
||||
public: /* MovementHandlerScript */
|
||||
void OnPlayerMove(Player* player, MovementInfo movementInfo, uint32 opcode);
|
||||
|
|
@ -1860,9 +2367,8 @@ public: /* AllCreatureScript */
|
|||
void Creature_SelectLevel(const CreatureTemplate* cinfo, Creature* creature);
|
||||
|
||||
public: /* AllMapScript */
|
||||
//listener functions are called by OnPlayerEnterMap and OnPlayerLeaveMap
|
||||
//void OnPlayerEnterAll(Map* map, Player* player);
|
||||
//void OnPlayerLeaveAll(Map* map, Player* player);
|
||||
void OnBeforeCreateInstanceScript(InstanceMap* instanceMap, InstanceScript* instanceData, bool load, std::string data, uint32 completedEncounterMask);
|
||||
void OnDestroyInstance(MapInstanced* mapInstanced, Map* map);
|
||||
|
||||
public: /* BGScript */
|
||||
void OnBattlegroundStart(Battleground* bg);
|
||||
|
|
@ -1880,6 +2386,9 @@ public: /* BGScript */
|
|||
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 OnBeforeSendExitMessageArenaQueue(BattlegroundQueue* queue, GroupQueueInfo* ginfo);
|
||||
void OnBattlegroundEnd(Battleground* bg, TeamId winnerTeamId);
|
||||
void OnBattlegroundDestroy(Battleground* bg);
|
||||
void OnBattlegroundCreate(Battleground* bg);
|
||||
|
||||
public: /* Arena Team Script */
|
||||
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 OnRemoveAuraScaleTargets(Spell* spell, TargetInfo& targetInfo, uint8 auraScaleMask, bool& needErase);
|
||||
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 */
|
||||
void OnGameEventStart(uint16 EventID);
|
||||
|
|
@ -1909,53 +2421,71 @@ public: /* MailScript */
|
|||
|
||||
public: /* AchievementScript */
|
||||
|
||||
void SetRealmCompleted(AchievementEntry const* achievement);
|
||||
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);
|
||||
void OnBeforeCheckCriteria(AchievementMgr* mgr, AchievementCriteriaEntryList const* achievementCriteriaList);
|
||||
bool CanCheckCriteria(AchievementMgr* mgr, AchievementCriteriaEntry const* achievementCriteria);
|
||||
void SetRealmCompleted(AchievementEntry const* achievement);
|
||||
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);
|
||||
void OnBeforeCheckCriteria(AchievementMgr* mgr, AchievementCriteriaEntryList const* achievementCriteriaList);
|
||||
bool CanCheckCriteria(AchievementMgr* mgr, AchievementCriteriaEntry const* achievementCriteria);
|
||||
|
||||
public: /* PetScript */
|
||||
public: /* PetScript */
|
||||
|
||||
void OnInitStatsForLevel(Guardian* guardian, uint8 petlevel);
|
||||
void OnCalculateMaxTalentPointsForLevel(Pet* pet, uint8 level, uint8& points);
|
||||
bool CanUnlearnSpellSet(Pet* pet, uint32 level, uint32 spell);
|
||||
bool CanUnlearnSpellDefault(Pet* pet, SpellInfo const* spellEntry);
|
||||
bool CanResetTalents(Pet* pet);
|
||||
void OnInitStatsForLevel(Guardian* guardian, uint8 petlevel);
|
||||
void OnCalculateMaxTalentPointsForLevel(Pet* pet, uint8 level, uint8& points);
|
||||
bool CanUnlearnSpellSet(Pet* pet, uint32 level, uint32 spell);
|
||||
bool CanUnlearnSpellDefault(Pet* pet, SpellInfo const* spellEntry);
|
||||
bool CanResetTalents(Pet* pet);
|
||||
|
||||
public: /* ArenaScript */
|
||||
public: /* ArenaScript */
|
||||
|
||||
bool CanAddMember(ArenaTeam* team, ObjectGuid PlayerGuid);
|
||||
void OnGetPoints(ArenaTeam* team, uint32 memberRating, float& points);
|
||||
bool CanSaveToDB(ArenaTeam* team);
|
||||
bool CanAddMember(ArenaTeam* team, ObjectGuid PlayerGuid);
|
||||
void OnGetPoints(ArenaTeam* team, uint32 memberRating, float& points);
|
||||
bool CanSaveToDB(ArenaTeam* team);
|
||||
|
||||
public: /* MiscScript */
|
||||
public: /* MiscScript */
|
||||
|
||||
void OnConstructObject(Object* origin);
|
||||
void OnDestructObject(Object* origin);
|
||||
void OnConstructPlayer(Player* origin);
|
||||
void OnDestructPlayer(Player* origin);
|
||||
void OnConstructGroup(Group* origin);
|
||||
void OnDestructGroup(Group* origin);
|
||||
void OnConstructInstanceSave(InstanceSave* origin);
|
||||
void OnDestructInstanceSave(InstanceSave* origin);
|
||||
void OnItemCreate(Item* item, ItemTemplate const* itemProto, Player const* owner);
|
||||
bool CanApplySoulboundFlag(Item* item, ItemTemplate const* proto);
|
||||
bool CanItemApplyEquipSpell(Player* player, Item* item);
|
||||
bool CanSendAuctionHello(WorldSession const* session, ObjectGuid guid, Creature* creature);
|
||||
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 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 OnInstanceSave(InstanceSave* instanceSave);
|
||||
void OnConstructObject(Object* origin);
|
||||
void OnDestructObject(Object* origin);
|
||||
void OnConstructPlayer(Player* origin);
|
||||
void OnDestructPlayer(Player* origin);
|
||||
void OnConstructGroup(Group* origin);
|
||||
void OnDestructGroup(Group* origin);
|
||||
void OnConstructInstanceSave(InstanceSave* origin);
|
||||
void OnDestructInstanceSave(InstanceSave* origin);
|
||||
void OnItemCreate(Item* item, ItemTemplate const* itemProto, Player const* owner);
|
||||
bool CanApplySoulboundFlag(Item* item, ItemTemplate const* proto);
|
||||
bool CanItemApplyEquipSpell(Player* player, Item* item);
|
||||
bool CanSendAuctionHello(WorldSession const* session, ObjectGuid guid, Creature* creature);
|
||||
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 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 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:
|
||||
uint32 _scriptCount;
|
||||
|
|
@ -1964,6 +2494,7 @@ private:
|
|||
std::atomic<long> _scheduledScripts;
|
||||
|
||||
ScriptLoaderCallbackType _script_loader_callback;
|
||||
ModulesLoaderCallbackType _modules_loader_callback;
|
||||
};
|
||||
|
||||
namespace Acore::SpellScripts
|
||||
|
|
|
|||
|
|
@ -51,10 +51,6 @@
|
|||
#include "WorldSocket.h"
|
||||
#include <zlib.h>
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string const DefaultPlayerName = "<none>";
|
||||
|
|
@ -254,12 +250,10 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
|||
}
|
||||
#endif // !ACORE_DEBUG
|
||||
|
||||
sScriptMgr->OnPacketSend(this, *packet);
|
||||
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnPacketSend(this, *packet))
|
||||
if (!sScriptMgr->CanPacketSend(this, *packet))
|
||||
{
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
LOG_TRACE("network.opcode", "S->C: %s %s", GetPlayerInfo().c_str(), GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet->GetOpcode())).c_str());
|
||||
m_Socket->SendPacket(*packet);
|
||||
|
|
@ -346,11 +340,11 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
|||
}
|
||||
else if (_player->IsInWorld() && AntiDOS.EvaluateOpcode(*packet, currentTime))
|
||||
{
|
||||
sScriptMgr->OnPacketReceive(this, *packet);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnPacketReceive(this, *packet))
|
||||
if (!sScriptMgr->CanPacketReceive(this, *packet))
|
||||
{
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
opHandle->Call(this, *packet);
|
||||
LogUnprocessedTail(packet);
|
||||
}
|
||||
|
|
@ -358,11 +352,11 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
|||
case STATUS_TRANSFER:
|
||||
if (_player && !_player->IsInWorld() && AntiDOS.EvaluateOpcode(*packet, currentTime))
|
||||
{
|
||||
sScriptMgr->OnPacketReceive(this, *packet);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnPacketReceive(this, *packet))
|
||||
if (!sScriptMgr->CanPacketReceive(this, *packet))
|
||||
{
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
opHandle->Call(this, *packet);
|
||||
LogUnprocessedTail(packet);
|
||||
}
|
||||
|
|
@ -373,11 +367,11 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
|||
|
||||
if (AntiDOS.EvaluateOpcode(*packet, currentTime))
|
||||
{
|
||||
sScriptMgr->OnPacketReceive(this, *packet);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnPacketReceive(this, *packet))
|
||||
if (!sScriptMgr->CanPacketReceive(this, *packet))
|
||||
{
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
opHandle->Call(this, *packet);
|
||||
LogUnprocessedTail(packet);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,10 +40,6 @@
|
|||
#include "Vehicle.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
class Aura;
|
||||
//
|
||||
// EFFECT HANDLER NOTES
|
||||
|
|
@ -6231,11 +6227,12 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit*
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef ELUNA
|
||||
Creature* c = target->ToCreature();
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,11 +15,6 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "ElunaUtility.h"
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
#include "Spell.h"
|
||||
#include "ArenaSpectator.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
|
||||
// should be done before the spell is actually executed
|
||||
#ifdef ELUNA
|
||||
sEluna->OnSpellCast(playerCaster, this, skipCheck);
|
||||
#endif
|
||||
sScriptMgr->OnPlayerSpellCast(playerCaster, this, skipCheck);
|
||||
|
||||
// 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
|
||||
|
|
|
|||
|
|
@ -62,10 +62,6 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
pEffect SpellEffects[TOTAL_SPELL_EFFECTS] =
|
||||
{
|
||||
&Spell::EffectNULL, // 0
|
||||
|
|
@ -788,14 +784,19 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
|
|||
// normal DB scripted effect
|
||||
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);
|
||||
#ifdef ELUNA
|
||||
|
||||
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)
|
||||
sEluna->OnDummyEffect(m_caster, m_spellInfo->Id, effIndex, unitTarget->ToCreature());
|
||||
{
|
||||
sScriptMgr->OnDummyEffect(m_caster, m_spellInfo->Id, effIndex, unitTarget->ToCreature());
|
||||
}
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -92,10 +92,6 @@
|
|||
#include <boost/asio/ip/address.hpp>
|
||||
#include <cmath>
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
std::atomic_long World::m_stopEvent = false;
|
||||
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
|
||||
uint32 World::m_worldLoopCounter = 0;
|
||||
|
|
@ -444,15 +440,6 @@ void World::LoadConfigSettings(bool reload)
|
|||
// Set realm id and enable db logging
|
||||
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);
|
||||
|
||||
///- 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...");
|
||||
ChannelMgr::LoadChannels();
|
||||
|
||||
#ifdef ELUNA
|
||||
///- 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
|
||||
sScriptMgr->OnBeforeWorldInitialized();
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,26 +53,6 @@ if(SCRIPTS MATCHES "minimal")
|
|||
list(APPEND SCRIPTS_WHITELIST Commands Spells)
|
||||
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
|
||||
# variables set above
|
||||
foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
||||
|
|
@ -109,47 +89,8 @@ foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
|||
endif()
|
||||
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 MODULE_GRAPH_KEYS)
|
||||
list(REMOVE_DUPLICATES SCRIPT_GRAPH_KEYS)
|
||||
list(REMOVE_DUPLICATES MODULE_GRAPH_KEYS)
|
||||
|
||||
# Display the script graph
|
||||
message("* Script configuration (${SCRIPTS}):
|
||||
|
|
@ -169,24 +110,6 @@ endforeach()
|
|||
|
||||
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
|
||||
if(USE_SCRIPTPCH)
|
||||
set(PRIVATE_PCH_HEADER ScriptPCH.h)
|
||||
|
|
@ -310,98 +233,6 @@ foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
|||
endif()
|
||||
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
|
||||
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
|
||||
ScriptLoader.h
|
||||
${SCRIPT_MODULE_PRIVATE_SCRIPTLOADER}
|
||||
${PRIVATE_SOURCES_SCRIPTS}
|
||||
${PRIVATE_SOURCES_MODULES})
|
||||
${PRIVATE_SOURCES_SCRIPTS})
|
||||
|
||||
target_link_libraries(scripts
|
||||
PRIVATE
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "Config.h"
|
||||
#include "GitRevision.h"
|
||||
#include "Language.h"
|
||||
#include "ModuleMgr.h"
|
||||
#include "MySQLThreading.h"
|
||||
#include "Player.h"
|
||||
#include "Realm.h"
|
||||
|
|
@ -219,6 +220,14 @@ public:
|
|||
handler->PSendSysMessage("LoginDatabase queue size: %zu", LoginDatabase.QueueSize());
|
||||
handler->PSendSysMessage("CharacterDatabase queue size: %zu", CharacterDatabase.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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,10 +24,6 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
// Add deprecated api loaders include
|
||||
@AC_SCRIPTS_INCLUDES@
|
||||
// Add module scripts define
|
||||
@AC_MODULE_LIST@
|
||||
// Add default scripts include
|
||||
@ACORE_SCRIPTS_FORWARD_DECL@
|
||||
#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.
|
||||
AC_SCRIPT_API void AddScripts()
|
||||
{
|
||||
// Default scripts and modules
|
||||
@ACORE_SCRIPTS_INVOKE@
|
||||
// Deprecated api modules
|
||||
@AC_SCRIPTS_LIST@}
|
||||
// Default scripts
|
||||
@ACORE_SCRIPTS_INVOKE@}
|
||||
|
||||
/// Exposed in script modules to get the build directive of the module.
|
||||
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* AssertEntry(uint32 id) const { return ASSERT_NOTNULL(LookupEntry(id)); }
|
||||
|
||||
#ifdef ELUNA
|
||||
void SetEntry(uint32 id, T* t)
|
||||
{
|
||||
if (id >= _indexTableSize)
|
||||
|
|
@ -203,7 +202,6 @@ public:
|
|||
delete _indexTable.AsT[id];
|
||||
_indexTable.AsT[id] = t;
|
||||
}
|
||||
#endif
|
||||
|
||||
[[nodiscard]] uint32 GetNumRows() const { return _indexTableSize; }
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ target_link_libraries(worldserver
|
|||
PRIVATE
|
||||
acore-core-interface
|
||||
PUBLIC
|
||||
modules
|
||||
scripts
|
||||
game
|
||||
gsoap
|
||||
|
|
@ -68,9 +69,13 @@ set_target_properties(worldserver
|
|||
FOLDER
|
||||
"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
|
||||
CopyDefaultConfig(worldserver)
|
||||
CollectModulesConfig()
|
||||
|
||||
if( UNIX )
|
||||
install(TARGETS worldserver DESTINATION bin)
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "IoContext.h"
|
||||
#include "MapMgr.h"
|
||||
#include "Metric.h"
|
||||
#include "ModulesScriptLoader.h"
|
||||
#include "MySQLThreading.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "OpenSSLCrypto.h"
|
||||
|
|
@ -61,9 +62,7 @@
|
|||
#include <openssl/crypto.h>
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
#include "ModuleMgr.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#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));
|
||||
|
||||
sScriptMgr->SetScriptLoader(AddScripts);
|
||||
sScriptMgr->SetModulesLoader(AddModulesScripts);
|
||||
|
||||
std::shared_ptr<void> sScriptMgrHandle(nullptr, [](void*)
|
||||
{
|
||||
sScriptMgr->Unload();
|
||||
|
|
@ -315,6 +316,8 @@ int main(int argc, char** argv)
|
|||
sMetric->Unload();
|
||||
});
|
||||
|
||||
Acore::Module::SetEnableModulesList(AC_MODULES_LIST);
|
||||
|
||||
// Loading modules configs
|
||||
sConfigMgr->PrintLoadedModulesConfigs();
|
||||
|
||||
|
|
@ -329,10 +332,6 @@ int main(int argc, char** argv)
|
|||
|
||||
sOutdoorPvPMgr->Die(); // unload it before MapMgr
|
||||
sMapMgr->UnloadAll(); // unload all grids (including locked in memory)
|
||||
|
||||
#ifdef ELUNA
|
||||
Eluna::Uninitialize();
|
||||
#endif
|
||||
});
|
||||
|
||||
// Start the Remote Access port (acceptor) if enabled
|
||||
|
|
@ -448,7 +447,7 @@ bool StartDB()
|
|||
MySQL::Library_Init();
|
||||
|
||||
// Load databases
|
||||
DatabaseLoader loader("server.worldserver");
|
||||
DatabaseLoader loader("server.worldserver", DatabaseLoader::DATABASE_NONE, AC_MODULES_LIST);
|
||||
loader
|
||||
.AddDatabase(LoginDatabase, "Login")
|
||||
.AddDatabase(CharacterDatabase, "Character")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue