diff --git a/README.md b/README.md index 69f8e802dd0..614dea777f0 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,12 @@ [![Issue Stats](http://www.issuestats.com/github/TrinityCore/TrinityCore/badge/issue)](http://www.issuestats.com/github/TrinityCore/TrinityCore) [![Issue Stats](http://www.issuestats.com/github/TrinityCore/TrinityCore/badge/pr)](http://www.issuestats.com/github/TrinityCore/TrinityCore) [![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=1310)](https://www.bountysource.com/trackers/1310-trinity-core?utm_source=1310&utm_medium=shield&utm_campaign=TRACKER_BADGE) -[![Issue Stats](http://www.issuestats.com/github/TrinityCore/TrinityCore/badge/pr)](http://www.issuestats.com/github/TrinityCore/TrinityCore) -[![Issue Stats](http://www.issuestats.com/github/TrinityCore/TrinityCore/badge/issue)](http://www.issuestats.com/github/TrinityCore/TrinityCore) -`6.x`: [![6.x Build Status](https://travis-ci.org/TrinityCore/TrinityCore.svg?branch=6.x)](https://travis-ci.org/TrinityCore/TrinityCore) -`4.3.4`: [![4.3.4 Build Status](https://travis-ci.org/TrinityCore/TrinityCore.svg?branch=4.3.4)](https://travis-ci.org/TrinityCore/TrinityCore) -`3.3.5`: [![3.3.5 Build Status](https://travis-ci.org/TrinityCore/TrinityCore.svg?branch=3.3.5)](https://travis-ci.org/TrinityCore/TrinityCore) +## Build Status + +6.x | 4.3.4 | 3.3.5 +:------------: | :------------: | :------------: +[![6.x Build Status](https://travis-ci.org/TrinityCore/TrinityCore.svg?branch=6.x)](https://travis-ci.org/TrinityCore/TrinityCore) | [![4.3.4 Build Status](https://travis-ci.org/TrinityCore/TrinityCore.svg?branch=4.3.4)](https://travis-ci.org/TrinityCore/TrinityCore) | [![3.3.5 Build Status](https://travis-ci.org/TrinityCore/TrinityCore.svg?branch=3.3.5)](https://travis-ci.org/TrinityCore/TrinityCore) +[![Coverity Scan Build Status](https://scan.coverity.com/projects/435/badge.svg)](https://scan.coverity.com/projects/435) | | [![Coverity Scan Build Status](https://scan.coverity.com/projects/4656/badge.svg)](https://scan.coverity.com/projects/4656) ## Introduction diff --git a/cmake/macros/FindBoost.cmake b/cmake/macros/FindBoost.cmake index d90a9c12c16..3c6af49dcaa 100644 --- a/cmake/macros/FindBoost.cmake +++ b/cmake/macros/FindBoost.cmake @@ -1,136 +1,165 @@ -# - Find Boost include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(Boost -# [version] [EXACT] # Minimum or EXACT version e.g. 1.36.0 -# [REQUIRED] # Fail with error if Boost is not found -# [COMPONENTS ...] # Boost libraries by their canonical name -# ) # e.g. "date_time" for "libboost_date_time" +#.rst: +# FindBoost +# --------- +# +# Find Boost include dirs and libraries +# +# Use this module by invoking find_package with the form:: +# +# find_package(Boost +# [version] [EXACT] # Minimum or EXACT version e.g. 1.36.0 +# [REQUIRED] # Fail with error if Boost is not found +# [COMPONENTS ...] # Boost libraries by their canonical name +# ) # e.g. "date_time" for "libboost_date_time" +# # This module finds headers and requested component libraries OR a CMake # package configuration file provided by a "Boost CMake" build. For the # latter case skip to the "Boost CMake" section below. For the former -# case results are reported in variables: -# Boost_FOUND - True if headers and requested libraries were found -# Boost_INCLUDE_DIRS - Boost include directories -# Boost_LIBRARY_DIRS - Link directories for Boost libraries -# Boost_LIBRARIES - Boost component libraries to be linked -# Boost__FOUND - True if component was found ( is upper-case) -# Boost__LIBRARY - Libraries to link for component (may include -# target_link_libraries debug/optimized keywords) -# Boost_VERSION - BOOST_VERSION value from boost/version.hpp -# Boost_LIB_VERSION - Version string appended to library filenames -# Boost_MAJOR_VERSION - Boost major version number (X in X.y.z) -# Boost_MINOR_VERSION - Boost minor version number (Y in x.Y.z) -# Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z) -# Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows) -# - Pass to add_definitions() to have diagnostic -# information about Boost's automatic linking -# displayed during compilation +# case results are reported in variables:: # -# This module reads hints about search locations from variables: -# BOOST_ROOT - Preferred installation prefix -# (or BOOSTROOT) -# BOOST_INCLUDEDIR - Preferred include directory e.g. /include -# BOOST_LIBRARYDIR - Preferred library directory e.g. /lib -# Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations not -# specified by these hint variables. Default is OFF. -# Boost_ADDITIONAL_VERSIONS -# - List of Boost versions not known to this module -# (Boost install locations may contain the version) -# and saves search results persistently in CMake cache entries: -# Boost_INCLUDE_DIR - Directory containing Boost headers -# Boost_LIBRARY_DIR - Directory containing Boost libraries -# Boost__LIBRARY_DEBUG - Component library debug variant -# Boost__LIBRARY_RELEASE - Component library release variant -# Users may set these hints or results as cache entries. Projects should -# not read these entries directly but instead use the above result variables. -# Note that some hint names start in upper-case "BOOST". One may specify -# these as environment variables if they are not specified as CMake variables -# or cache entries. +# Boost_FOUND - True if headers and requested libraries were found +# Boost_INCLUDE_DIRS - Boost include directories +# Boost_LIBRARY_DIRS - Link directories for Boost libraries +# Boost_LIBRARIES - Boost component libraries to be linked +# Boost__FOUND - True if component was found ( is upper-case) +# Boost__LIBRARY - Libraries to link for component (may include +# target_link_libraries debug/optimized keywords) +# Boost_VERSION - BOOST_VERSION value from boost/version.hpp +# Boost_LIB_VERSION - Version string appended to library filenames +# Boost_MAJOR_VERSION - Boost major version number (X in X.y.z) +# Boost_MINOR_VERSION - Boost minor version number (Y in x.Y.z) +# Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z) +# Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows) +# - Pass to add_definitions() to have diagnostic +# information about Boost's automatic linking +# displayed during compilation # -# This module first searches for the Boost header files using the above hint -# variables (excluding BOOST_LIBRARYDIR) and saves the result in -# Boost_INCLUDE_DIR. Then it searches for requested component libraries using -# the above hints (excluding BOOST_INCLUDEDIR and Boost_ADDITIONAL_VERSIONS), -# "lib" directories near Boost_INCLUDE_DIR, and the library name configuration -# settings below. It saves the library directory in Boost_LIBRARY_DIR and -# individual library locations in Boost__LIBRARY_DEBUG and -# Boost__LIBRARY_RELEASE. When one changes settings used by previous -# searches in the same build tree (excluding environment variables) this -# module discards previous search results affected by the changes and searches -# again. +# This module reads hints about search locations from variables:: +# +# BOOST_ROOT - Preferred installation prefix +# (or BOOSTROOT) +# BOOST_INCLUDEDIR - Preferred include directory e.g. /include +# BOOST_LIBRARYDIR - Preferred library directory e.g. /lib +# Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations not +# specified by these hint variables. Default is OFF. +# Boost_ADDITIONAL_VERSIONS +# - List of Boost versions not known to this module +# (Boost install locations may contain the version) +# +# and saves search results persistently in CMake cache entries:: +# +# Boost_INCLUDE_DIR - Directory containing Boost headers +# Boost_LIBRARY_DIR - Directory containing Boost libraries +# Boost__LIBRARY_DEBUG - Component library debug variant +# Boost__LIBRARY_RELEASE - Component library release variant +# +# Users may set these hints or results as cache entries. Projects +# should not read these entries directly but instead use the above +# result variables. Note that some hint names start in upper-case +# "BOOST". One may specify these as environment variables if they are +# not specified as CMake variables or cache entries. +# +# This module first searches for the Boost header files using the above +# hint variables (excluding BOOST_LIBRARYDIR) and saves the result in +# Boost_INCLUDE_DIR. Then it searches for requested component libraries +# using the above hints (excluding BOOST_INCLUDEDIR and +# Boost_ADDITIONAL_VERSIONS), "lib" directories near Boost_INCLUDE_DIR, +# and the library name configuration settings below. It saves the +# library directory in Boost_LIBRARY_DIR and individual library +# locations in Boost__LIBRARY_DEBUG and Boost__LIBRARY_RELEASE. +# When one changes settings used by previous searches in the same build +# tree (excluding environment variables) this module discards previous +# search results affected by the changes and searches again. +# +# Boost libraries come in many variants encoded in their file name. +# Users or projects may tell this module which variant to find by +# setting variables:: +# +# Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded +# libraries ('mt' tag). Default is ON. +# Boost_USE_STATIC_LIBS - Set to ON to force the use of the static +# libraries. Default is OFF. +# Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use +# libraries linked statically to the C++ runtime +# ('s' tag). Default is platform dependent. +# Boost_USE_DEBUG_RUNTIME - Set to ON or OFF to specify whether to use +# libraries linked to the MS debug C++ runtime +# ('g' tag). Default is ON. +# Boost_USE_DEBUG_PYTHON - Set to ON to use libraries compiled with a +# debug Python build ('y' tag). Default is OFF. +# Boost_USE_STLPORT - Set to ON to use libraries compiled with +# STLPort ('p' tag). Default is OFF. +# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS +# - Set to ON to use libraries compiled with +# STLPort deprecated "native iostreams" +# ('n' tag). Default is OFF. +# Boost_COMPILER - Set to the compiler-specific library suffix +# (e.g. "-gcc43"). Default is auto-computed +# for the C++ compiler in use. +# Boost_THREADAPI - Suffix for "thread" component library name, +# such as "pthread" or "win32". Names with +# and without this suffix will both be tried. +# Boost_NAMESPACE - Alternate namespace used to build boost with +# e.g. if set to "myboost", will search for +# myboost_thread instead of boost_thread. +# +# Other variables one may set to control this module are:: +# +# Boost_DEBUG - Set to ON to enable debug output from FindBoost. +# Please enable this before filing any bug report. +# Boost_DETAILED_FAILURE_MSG +# - Set to ON to add detailed information to the +# failure message even when the REQUIRED option +# is not given to the find_package call. +# Boost_REALPATH - Set to ON to resolve symlinks for discovered +# libraries to assist with packaging. For example, +# the "system" component library may be resolved to +# "/usr/lib/libboost_system.so.1.42.0" instead of +# "/usr/lib/libboost_system.so". This does not +# affect linking and should not be enabled unless +# the user needs this information. # -# Boost libraries come in many variants encoded in their file name. Users or -# projects may tell this module which variant to find by setting variables: -# Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded -# libraries ('mt' tag). Default is ON. -# Boost_USE_STATIC_LIBS - Set to ON to force the use of the static -# libraries. Default is OFF. -# Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use -# libraries linked statically to the C++ runtime -# ('s' tag). Default is platform dependent. -# Boost_USE_DEBUG_PYTHON - Set to ON to use libraries compiled with a -# debug Python build ('y' tag). Default is OFF. -# Boost_USE_STLPORT - Set to ON to use libraries compiled with -# STLPort ('p' tag). Default is OFF. -# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS -# - Set to ON to use libraries compiled with -# STLPort deprecated "native iostreams" -# ('n' tag). Default is OFF. -# Boost_COMPILER - Set to the compiler-specific library suffix -# (e.g. "-gcc43"). Default is auto-computed -# for the C++ compiler in use. -# Boost_THREADAPI - Suffix for "thread" component library name, -# such as "pthread" or "win32". Names with -# and without this suffix will both be tried. -# Other variables one may set to control this module are: -# Boost_DEBUG - Set to ON to enable debug output from FindBoost. -# Please enable this before filing any bug report. -# Boost_DETAILED_FAILURE_MSG -# - Set to ON to add detailed information to the -# failure message even when the REQUIRED option -# is not given to the find_package call. -# Boost_REALPATH - Set to ON to resolve symlinks for discovered -# libraries to assist with packaging. For example, -# the "system" component library may be resolved to -# "/usr/lib/libboost_system.so.1.42.0" instead of -# "/usr/lib/libboost_system.so". This does not -# affect linking and should not be enabled unless -# the user needs this information. # On Visual Studio and Borland compilers Boost headers request automatic -# linking to corresponding libraries. This requires matching libraries to be -# linked explicitly or available in the link library search path. In this -# case setting Boost_USE_STATIC_LIBS to OFF may not achieve dynamic linking. -# Boost automatic linking typically requests static libraries with a few -# exceptions (such as Boost.Python). Use -# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) +# linking to corresponding libraries. This requires matching libraries +# to be linked explicitly or available in the link library search path. +# In this case setting Boost_USE_STATIC_LIBS to OFF may not achieve +# dynamic linking. Boost automatic linking typically requests static +# libraries with a few exceptions (such as Boost.Python). Use:: +# +# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) +# # to ask Boost to report information about automatic linking requests. # -# Example to find Boost headers only: -# find_package(Boost 1.36.0) -# if(Boost_FOUND) -# include_directories(${Boost_INCLUDE_DIRS}) -# add_executable(foo foo.cc) -# endif() -# Example to find Boost headers and some libraries: -# set(Boost_USE_STATIC_LIBS ON) -# set(Boost_USE_MULTITHREADED ON) -# set(Boost_USE_STATIC_RUNTIME OFF) -# find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...) -# if(Boost_FOUND) -# include_directories(${Boost_INCLUDE_DIRS}) -# add_executable(foo foo.cc) -# target_link_libraries(foo ${Boost_LIBRARIES}) -# endif() +# Example to find Boost headers only:: # -# Boost CMake ---------------------------------------------------------- +# find_package(Boost 1.36.0) +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# endif() +# +# Example to find Boost headers and some *static* libraries:: +# +# set(Boost_USE_STATIC_LIBS ON) # only find static libs +# set(Boost_USE_MULTITHREADED ON) +# set(Boost_USE_STATIC_RUNTIME OFF) +# find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...) +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# target_link_libraries(foo ${Boost_LIBRARIES}) +# endif() +# +# Boost CMake +# ^^^^^^^^^^^ # # If Boost was built using the boost-cmake project it provides a package -# configuration file for use with find_package's Config mode. This module -# looks for the package configuration file called BoostConfig.cmake or -# boost-config.cmake and stores the result in cache entry "Boost_DIR". If -# found, the package configuration file is loaded and this module returns with -# no further action. See documentation of the Boost CMake package -# configuration for details on what it provides. +# configuration file for use with find_package's Config mode. This +# module looks for the package configuration file called +# BoostConfig.cmake or boost-config.cmake and stores the result in cache +# entry "Boost_DIR". If found, the package configuration file is loaded +# and this module returns with no further action. See documentation of +# the Boost CMake package configuration for details on what it provides. # # Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake. @@ -279,15 +308,20 @@ endmacro() macro(_Boost_FIND_LIBRARY var) find_library(${var} ${ARGN}) - # If we found the first library save Boost_LIBRARY_DIR. - if(${var} AND NOT Boost_LIBRARY_DIR) - get_filename_component(_dir "${${var}}" PATH) - set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE) + if(${var}) + # If this is the first library found then save Boost_LIBRARY_DIR. + if(NOT Boost_LIBRARY_DIR) + get_filename_component(_dir "${${var}}" PATH) + set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE) + endif() + elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) + # Try component-specific hints but do not save Boost_LIBRARY_DIR. + find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN}) endif() # If Boost_LIBRARY_DIR is known then search only there. if(Boost_LIBRARY_DIR) - set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH) + set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) endif() endmacro() @@ -341,9 +375,9 @@ endfunction() # Guesses Boost's compiler prefix used in built library names # Returns the guess by setting the variable pointed to by _ret function(_Boost_GUESS_COMPILER_PREFIX _ret) - if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel" - OR ${CMAKE_CXX_COMPILER} MATCHES "icl" - OR ${CMAKE_CXX_COMPILER} MATCHES "icpc") + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" + OR CMAKE_CXX_COMPILER MATCHES "icl" + OR CMAKE_CXX_COMPILER MATCHES "icpc") if(WIN32) set (_boost_COMPILER "-iw") else() @@ -369,7 +403,7 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) set(_boost_COMPILER "-vc6") # yes, this is correct elseif (BORLAND) set(_boost_COMPILER "-bcb") - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") set(_boost_COMPILER "-sw") elseif (MINGW) if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) @@ -425,6 +459,9 @@ endfunction() if(NOT DEFINED Boost_USE_MULTITHREADED) set(Boost_USE_MULTITHREADED TRUE) endif() +if(NOT DEFINED Boost_USE_DEBUG_RUNTIME) + set(Boost_USE_DEBUG_RUNTIME TRUE) +endif() # Check the version of Boost against the requested version. if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR) @@ -441,7 +478,7 @@ else() # The user has not requested an exact version. Among known # versions, find those that are acceptable to the user request. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54" + "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1" "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" @@ -598,12 +635,12 @@ if(NOT Boost_INCLUDE_DIR) set(_boost_BOOSTIFIED_VERSION) # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 - if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") - string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" - _boost_BOOSTIFIED_VERSION ${_boost_VER}) - elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+") - string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" - _boost_BOOSTIFIED_VERSION ${_boost_VER}) + if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)") + set(_boost_BOOSTIFIED_VERSION + "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}") + elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)") + set(_boost_BOOSTIFIED_VERSION + "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}") endif() list(APPEND _boost_PATH_SUFFIXES @@ -651,7 +688,7 @@ if(Boost_INCLUDE_DIR) set(_Boost_VERSION_REGEX "([0-9]+)") set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"") foreach(v VERSION LIB_VERSION) - if("${_boost_VERSION_HPP_CONTENTS}" MATCHES ".*#define BOOST_${v} ${_Boost_${v}_REGEX}.*") + if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_${v} ${_Boost_${v}_REGEX}") set(Boost_${v} "${CMAKE_MATCH_1}") endif() endforeach() @@ -705,11 +742,25 @@ else() "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") endif() +# ------------------------------------------------------------------------ +# Prefix initialization +# ------------------------------------------------------------------------ + +set(Boost_LIB_PREFIX "") +if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) + set(Boost_LIB_PREFIX "lib") +endif() + +if ( NOT Boost_NAMESPACE ) + set(Boost_NAMESPACE "boost") +endif() + # ------------------------------------------------------------------------ # Suffix initialization and compiler suffix detection. # ------------------------------------------------------------------------ set(_Boost_VARS_NAME + Boost_NAMESPACE Boost_COMPILER Boost_THREADAPI Boost_USE_DEBUG_PYTHON @@ -722,11 +773,6 @@ set(_Boost_VARS_NAME _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME}) # Setting some more suffixes for the library -set(Boost_LIB_PREFIX "") -if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) - set(Boost_LIB_PREFIX "lib") -endif() - if (Boost_COMPILER) set(_boost_COMPILER ${Boost_COMPILER}) if(Boost_DEBUG) @@ -768,7 +814,7 @@ if(Boost_USE_STATIC_RUNTIME) endif() # g using debug versions of the standard and runtime # support libraries -if(WIN32) +if(WIN32 AND Boost_USE_DEBUG_RUNTIME) if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g") @@ -811,7 +857,7 @@ if(_Boost_CHANGE_LIBDIR AND NOT _Boost_LIBRARY_DIR_CHANGED) endif() if(Boost_LIBRARY_DIR) - set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH) + set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) else() set(_boost_LIBRARY_SEARCH_DIRS "") if(BOOST_LIBRARYDIR) @@ -910,22 +956,45 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) set( _boost_docstring_release "Boost ${COMPONENT} library (release)") set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") + # Compute component-specific hints. + set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "") + if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR + ${COMPONENT} STREQUAL "graph_parallel") + foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES}) + if(IS_ABSOLUTE "${lib}") + get_filename_component(libdir "${lib}" PATH) + string(REPLACE "\\" "/" libdir "${libdir}") + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir}) + endif() + endforeach() + endif() + + # Consolidate and report component-specific hints. + if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) + list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Component-specific library search paths for ${COMPONENT}: " + "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}") + endif() + endif() + # # Find RELEASE libraries # set(_boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT} ) + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} ) if(_boost_STATIC_RUNTIME_WORKAROUND) set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") list(APPEND _boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) endif() if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) @@ -949,19 +1018,19 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) # Find DEBUG libraries # set(_boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} - ${Boost_LIB_PREFIX}boost_${COMPONENT} ) + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} ) if(_boost_STATIC_RUNTIME_WORKAROUND) set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") list(APPEND _boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) endif() if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES}) @@ -1034,7 +1103,7 @@ if(Boost_FOUND) "${Boost_ERROR_REASON} Boost libraries:\n") foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) set(Boost_ERROR_REASON - "${Boost_ERROR_REASON} boost_${COMPONENT}\n") + "${Boost_ERROR_REASON} ${Boost_NAMESPACE}_${COMPONENT}\n") endforeach() list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED) diff --git a/cmake/platform/unix/settings.cmake b/cmake/platform/unix/settings.cmake index ab54124b5a1..04d21863f6c 100644 --- a/cmake/platform/unix/settings.cmake +++ b/cmake/platform/unix/settings.cmake @@ -40,5 +40,5 @@ elseif(CMAKE_C_COMPILER MATCHES "icc") elseif(CMAKE_C_COMPILER MATCHES "clang" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") include(${CMAKE_SOURCE_DIR}/cmake/compiler/clang/settings.cmake) else() -add_definitions(-D_BUILD_DIRECTIVE='"${CMAKE_BUILD_TYPE}"') + add_definitions(-D_BUILD_DIRECTIVE='"${CMAKE_BUILD_TYPE}"') endif() diff --git a/sql/updates/world/2015_04_07_01_world.sql b/sql/updates/world/2015_04_07_01_world.sql deleted file mode 100644 index e000a43fe1c..00000000000 --- a/sql/updates/world/2015_04_07_01_world.sql +++ /dev/null @@ -1,21 +0,0 @@ -SET @GUID := 69717; -- 4 creature guid Set by TC -SET @OGUID := 5510; -- 1 GOB guid set by TC -DELETE FROM `creature` WHERE `id`=23142; -INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`,`curhealth`) VALUES -(@GUID+0, 23142, 530, 1, 1, -5121.06, 598.424, 84.7603, 0.0581088, 600, 6542), -(@GUID+1, 23142, 530, 1, 1, -5119.60, 601.834, 84.8180, 5.1726200, 600, 6542), -(@GUID+2, 23142, 530, 1, 1, -5115.02, 601.537, 85.0292, 4.0204400, 600, 6542), -(@GUID+3, 23142, 530, 1, 1, -5114.25, 597.062, 85.1574, 2.7049000, 600, 6542); - -DELETE FROM `gameobject` WHERE `guid` IN (@OGUID); -INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES -(@OGUID,50983,530,1,1, -5116.788574, 631.188660, 85.055522,0.949811,0,0,0.457254, 0.889336, 300, 0, 1); - -DELETE FROM `creature_equip_template` WHERE `entry`=23146; -INSERT INTO `creature_equip_template` (`entry`, `id`, `itemEntry1`, `itemEntry2`, `itemEntry3`, `VerifiedBuild`) VALUES (23146, 1, 31603, 0, 0, 0); -UPDATE `creature` SET `position_x`= -5158.237305, `position_y`= 584.302612, `position_z`= 81.074142, `orientation`= 5.954358 WHERE `guid`= 78136; -UPDATE `creature` SET `position_x`= -5156.172363, `position_y`= 590.695251, `position_z`= 80.769630, `orientation`= 5.502757 WHERE `guid`= 78135; -UPDATE `creature` SET `position_x`= -5152.365723, `position_y`= 592.303040, `position_z`= 81.361931, `orientation`= 4.705578 WHERE `guid`= 78137; -UPDATE `creature` SET `position_x`= -5113.345703, `position_y`= 623.850159, `position_z`= 86.736343, `orientation`= 1.033840 WHERE `guid`= 78160; -UPDATE `creature` SET `position_x`= -5123.593750, `position_y`= 626.638916, `position_z`= 86.629669, `orientation`= 1.395123 WHERE `guid`= 78159; -UPDATE `creature` SET `position_x`= -5165.503418, `position_y`= 568.109131, `position_z`= 80.523895, `orientation`= 2.707489 WHERE `guid`= 52107; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 612ce923163..7e3975441d2 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1332,7 +1332,31 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_SET_COUNTER: { - StoreCounter(e.action.setCounter.counterId, e.action.setCounter.value, e.action.setCounter.reset); + if (ObjectList* targets = GetTargets(e, unit)) + { + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + { + if (IsCreature(*itr)) + { + if (SmartAI* ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI())) + ai->GetScript()->StoreCounter(e.action.setCounter.counterId, e.action.setCounter.value, e.action.setCounter.reset); + else + TC_LOG_ERROR("sql.sql", "SmartScript: Action target for SMART_ACTION_SET_COUNTER is not using SmartAI, skipping"); + } + else if (IsGameObject(*itr)) + { + if (SmartGameObjectAI* ai = CAST_AI(SmartGameObjectAI, (*itr)->ToGameObject()->AI())) + ai->GetScript()->StoreCounter(e.action.setCounter.counterId, e.action.setCounter.value, e.action.setCounter.reset); + else + TC_LOG_ERROR("sql.sql", "SmartScript: Action target for SMART_ACTION_SET_COUNTER is not using SmartGameObjectAI, skipping"); + } + } + + delete targets; + } + else + StoreCounter(e.action.setCounter.counterId, e.action.setCounter.value, e.action.setCounter.reset); + break; } case SMART_ACTION_WP_START: diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index d20b80f2b8e..f800796133e 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -100,7 +100,8 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND { "Alive", false, false, false }, { "Health Value", true, true, false }, { "Health Pct", true, true, false }, - { "Realm Achievement", true, false, false } + { "Realm Achievement", true, false, false }, + { "In Water", false, false, false } }; // Checks if object meets the condition @@ -429,6 +430,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) condMeets = true; break; } + case CONDITION_IN_WATER: + { + if (Unit* unit = object->ToUnit()) + condMeets = unit->IsInWater(); + break; + } default: condMeets = false; break; @@ -604,6 +611,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() case CONDITION_REALM_ACHIEVEMENT: mask |= GRID_MAP_TYPE_MASK_ALL; break; + case CONDITION_IN_WATER: + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + break; default: ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -2109,6 +2119,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } break; } + case CONDITION_IN_WATER: + break; default: break; } diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index eba3a8ef835..0df297b4a90 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -74,6 +74,7 @@ enum ConditionTypes CONDITION_HP_PCT = 38, // hpPct ComparisonType 0 true if unit's hp matches given pct CONDITION_TERRAIN_SWAP = 39, // terrainSwap 0 0 true if object is in terrainswap CONDITION_REALM_ACHIEVEMENT = 40, // achievement_id 0 0 true if realm achievement is complete + CONDITION_IN_WATER = 40, // 0 0 0 true if unit in water CONDITION_MAX = 41 // MAX }; diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index aeacfc9deb1..d7b4bab7516 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -782,10 +782,10 @@ void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& playe } } } - + if (eraseDungeon) dungeons.erase(itDungeon); - + lockMap[guid][dungeonId] = it2->second; } } @@ -1268,14 +1268,6 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* if (player->GetMapId() == uint32(dungeon->map)) player->TeleportToBGEntryPoint(); - // in the case were we are the last in lfggroup then we must disband when porting out of the instance - if (group->GetMembersCount() == 1) - { - group->Disband(); - TC_LOG_DEBUG("lfg.teleport", "Player %s is last in lfggroup so we disband the group.", - player->GetName().c_str()); - } - return; } diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 40e82ae64eb..492b56ef0ac 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -99,7 +99,17 @@ void LFGPlayerScript::OnMapChanged(Player* player) player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true); } else + { + Group* group = player->GetGroup(); + if (group && group->GetMembersCount() == 1) + { + sLFGMgr->LeaveLfg(group->GetGUID()); + group->Disband(); + TC_LOG_DEBUG("lfg", "LFGPlayerScript::OnMapChanged, Player %s(%s) is last in the lfggroup so we disband the group.", + player->GetName().c_str(), player->GetGUID().ToString().c_str()); + } player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW); + } } LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript") { } diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index c8b6dc4f42b..f80ff6cd888 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -192,6 +192,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields) Object::_Create(guid, 0, HIGHGUID_CORPSE); + SetObjectScale(1.0f); SetUInt32Value(CORPSE_FIELD_DISPLAY_ID, fields[5].GetUInt32()); _LoadIntoDataField(fields[6].GetCString(), CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END); SetUInt32Value(CORPSE_FIELD_BYTES_1, fields[7].GetUInt32()); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 83f80e32c21..e59b232852f 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -190,6 +190,12 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 /*phase return false; } + if (goinfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT) + { + TC_LOG_ERROR("sql.sql", "Gameobject (GUID: %u Entry: %u) not created: gameobject type GAMEOBJECT_TYPE_MO_TRANSPORT cannot be manually created.", guidlow, name_id); + return false; + } + if (goinfo->type == GAMEOBJECT_TYPE_TRANSPORT) m_updateFlag |= UPDATEFLAG_TRANSPORT; @@ -2291,8 +2297,11 @@ void GameObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* t } case GAMEOBJECT_TYPE_MO_TRANSPORT: { - float timer = float(m_goValue.Transport.PathProgress % GetUInt32Value(GAMEOBJECT_LEVEL)); - pathProgress = int16(timer / float(GetUInt32Value(GAMEOBJECT_LEVEL)) * 65535.0f); + if (uint32 transportPeriod = GetTransportPeriod()) + { + float timer = float(m_goValue.Transport.PathProgress % transportPeriod); + pathProgress = int16(timer / float(transportPeriod) * 65535.0f); + } break; } default: diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 4da96d7ebfc..b1626f1c904 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -731,7 +731,7 @@ class GameObject : public WorldObject, public GridObject, public Map void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); } GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); } void SetGoState(GOState state); - uint32 GetTransportPeriod() const; + virtual uint32 GetTransportPeriod() const; void SetTransportState(GOState state, uint32 stopFrame = 0); uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); } void SetGoArtKit(uint8 artkit); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ad47953bbc6..70811146ef7 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1997,7 +1997,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, ByteBuffer* dataBuffer, B if (!ValidateAppearance(uint8(plrRace), uint8(plrClass), gender, hairStyle, hairColor, face, facialHair, skin)) { TC_LOG_ERROR("entities.player.loading", "Player %u has wrong Appearance values (Hair/Skin/Color), forcing recustomize", guid); - + if (!(atLoginFlags & AT_LOGIN_CUSTOMIZE)) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); @@ -25688,7 +25688,7 @@ uint32 Player::CalculateTalentsPoints() const return uint32(talentPointsForLevel * sWorld->getRate(RATE_TALENT)); } -bool Player::canFlyInZone(uint32 mapid, uint32 zone) const +bool Player::CanFlyInZone(uint32 mapid, uint32 zone) const { // continent checked in SpellInfo::CheckLocation at cast and area update uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 62c1e8f5b0e..835ab7bbae5 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2348,7 +2348,7 @@ class Player : public Unit, public GridObject void SetFallInformation(uint32 time, float z); void HandleFall(MovementInfo const& movementInfo); - bool canFlyInZone(uint32 mapid, uint32 zone) const; + bool CanFlyInZone(uint32 mapid, uint32 zone) const; void SetClientControl(Unit* target, bool allowMove); diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index b7ce00c0491..1315a724f09 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -125,7 +125,7 @@ void Transport::Update(uint32 diff) if (IsMoving() || !_pendingStop) m_goValue.Transport.PathProgress += diff; - uint32 timer = m_goValue.Transport.PathProgress % GetPeriod(); + uint32 timer = m_goValue.Transport.PathProgress % GetTransportPeriod(); // Set current waypoint // Desired outcome: _currentFrame->DepartureTime < timer < _nextFrame->ArriveTime @@ -147,8 +147,8 @@ void Transport::Update(uint32 diff) if (_pendingStop && GetGoState() != GO_STATE_READY) { SetGoState(GO_STATE_READY); - m_goValue.Transport.PathProgress = (m_goValue.Transport.PathProgress / GetPeriod()); - m_goValue.Transport.PathProgress *= GetPeriod(); + m_goValue.Transport.PathProgress = (m_goValue.Transport.PathProgress / GetTransportPeriod()); + m_goValue.Transport.PathProgress *= GetTransportPeriod(); m_goValue.Transport.PathProgress += _currentFrame->ArriveTime; } break; // its a stop frame and we are waiting diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h index 5cae8225409..5b3bd8a53be 100644 --- a/src/server/game/Entities/Transport/Transport.h +++ b/src/server/game/Entities/Transport/Transport.h @@ -79,7 +79,7 @@ class Transport : public GameObject, public TransportBase TransportBase::CalculatePassengerOffset(x, y, z, o, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); } - uint32 GetPeriod() const { return GetUInt32Value(GAMEOBJECT_LEVEL); } + uint32 GetTransportPeriod() const override { return GetUInt32Value(GAMEOBJECT_LEVEL); } void SetPeriod(uint32 period) { SetUInt32Value(GAMEOBJECT_LEVEL, period); } uint32 GetTimer() const { return GetGOValue()->Transport.PathProgress; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index c0802d050b0..5d47d39ed4e 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10214,7 +10214,7 @@ void Unit::ClearInCombat() if (HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED)) SetUInt32Value(UNIT_DYNAMIC_FLAGS, creature->GetCreatureTemplate()->dynamicflags); - if (creature->IsPet()) + if (creature->IsPet() || creature->IsGuardian()) { if (Unit* owner = GetOwner()) for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) @@ -11264,7 +11264,7 @@ void Unit::ModSpellCastTime(SpellInfo const* spellInfo, int32 & castTime, Spell* if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell); - if (!(spellInfo->HasAttribute(SPELL_ATTR0_ABILITY) || spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL) || spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL) || spellInfo->HasAttribute(SPELL_ATTR3_NO_DONE_BONUS)) && + if (!(spellInfo->HasAttribute(SPELL_ATTR0_ABILITY) || spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL) || spellInfo->HasAttribute(SPELL_ATTR3_NO_DONE_BONUS)) && ((GetTypeId() == TYPEID_PLAYER && spellInfo->SpellFamilyName) || GetTypeId() == TYPEID_UNIT)) castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED)); else if (spellInfo->HasAttribute(SPELL_ATTR0_REQ_AMMO) && !spellInfo->HasAttribute(SPELL_ATTR2_AUTOREPEAT_FLAG)) @@ -12543,7 +12543,6 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u uint32 Id = i->aura->GetId(); AuraApplication* aurApp = i->aura->GetApplicationOfTarget(GetGUID()); - ASSERT(aurApp); bool prepare = i->aura->CallScriptPrepareProcHandlers(aurApp, eventInfo); @@ -13981,18 +13980,11 @@ void Unit::SetControlled(bool apply, UnitState state) { case UNIT_STATE_STUNNED: SetStunned(true); - // i need to stop fear on stun and root or i will get teleport to destination issue as MVMGEN for fear keeps going on - if (HasUnitState(UNIT_STATE_FLEEING)) - SetFeared(false); CastStop(); break; case UNIT_STATE_ROOT: if (!HasUnitState(UNIT_STATE_STUNNED)) - { SetRooted(true); - if (HasUnitState(UNIT_STATE_FLEEING)) - SetFeared(false); - } break; case UNIT_STATE_CONFUSED: if (!HasUnitState(UNIT_STATE_STUNNED)) @@ -14076,10 +14068,9 @@ void Unit::SetStunned(bool apply) SetTarget(ObjectGuid::Empty); SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - // Creature specific - if (GetTypeId() != TYPEID_PLAYER) - StopMoving(); - else + StopMoving(); + + if (GetTypeId() == TYPEID_PLAYER) SetStandState(UNIT_STAND_STATE_STAND); SetRooted(true); @@ -14112,6 +14103,7 @@ void Unit::SetRooted(bool apply, bool packetOnly /*= false*/) // setting MOVEMENTFLAG_ROOT RemoveUnitMovementFlag(MOVEMENTFLAG_MASK_MOVING); AddUnitMovementFlag(MOVEMENTFLAG_ROOT); + StopMoving(); } else RemoveUnitMovementFlag(MOVEMENTFLAG_ROOT); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 0a6a258d06d..7467290faa6 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -6768,7 +6768,7 @@ void ObjectMgr::LoadGameObjectTemplate() { if (got.moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[got.moTransport.taxiPathId].empty()) TC_LOG_ERROR("sql.sql", "GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.", - entry, got.type, got.moTransport.taxiPathId, got.moTransport.taxiPathId); + entry, got.type, got.moTransport.taxiPathId, got.moTransport.taxiPathId); } if (uint32 transportMap = got.moTransport.mapID) _transportMaps.insert(transportMap); diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index bb66c3cf567..85f472d0515 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1354,7 +1354,7 @@ void WorldSession::HandleAlterAppearance(WorldPacket& recvData) if (bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender())) return; - if (!Player::ValidateAppearance(_player->getRace(), _player->getClass(), _player->getGender(), bs_hair->hair_id, Color, uint8(_player->GetUInt32Value(PLAYER_FLAGS) >> 8), bs_facialHair->hair_id, bs_skinColor ? bs_skinColor->hair_id : 0)) + if (!Player::ValidateAppearance(_player->getRace(), _player->getClass(), _player->getGender(), bs_hair->hair_id, Color, _player->GetByteValue(PLAYER_BYTES, 1), bs_facialHair->hair_id, bs_skinColor ? bs_skinColor->hair_id : _player->GetByteValue(PLAYER_BYTES, 0))) return; GameObject* go = _player->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_BARBER_CHAIR, 5.0f); diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 828afa696c9..496f8e9e82c 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -858,7 +858,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootItem const& li) { b << uint32(li.itemid); b << uint32(li.count); // nr of items of this type - b << uint32(sObjectMgr->GetItemTemplate(li.itemid)->DisplayInfoID); + b << uint32(ASSERT_NOTNULL(sObjectMgr->GetItemTemplate(li.itemid))->DisplayInfoID); b << uint32(li.randomSuffix); b << uint32(li.randomPropertyId); //b << uint8(0); // slot type - will send after this function call diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 6b4d3ec579a..1a08bc3ad5b 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5969,7 +5969,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c if (isAreaAura) damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()) * caster->SpellDamagePctDone(target, m_spellInfo, DOT); else - damage = std::max(int32(damage * GetDonePct()), 0); + damage = std::max(int32(damage * GetDonePct()), 0); damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); @@ -6392,6 +6392,9 @@ void AuraEffect::HandleProcTriggerSpellWithValueAuraProc(AuraApplication* aurApp void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo) { + if (!aurApp) + return; + Unit* target = aurApp->GetTarget(); Unit* triggerTarget = eventInfo.GetProcTarget(); SpellNonMeleeDamage damageInfo(target, triggerTarget, GetId(), GetSpellInfo()->SchoolMask); diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp index 747d84de9c5..d1662f3a97c 100644 --- a/src/server/scripts/Commands/cs_lfg.cpp +++ b/src/server/scripts/Commands/cs_lfg.cpp @@ -19,7 +19,9 @@ #include "Chat.h" #include "Language.h" #include "LFGMgr.h" +#include "ObjectMgr.h" #include "Group.h" +#include "GroupMgr.h" #include "Player.h" void GetPlayerInfo(ChatHandler* handler, Player* player) @@ -74,25 +76,55 @@ public: static bool HandleLfgGroupInfoCommand(ChatHandler* handler, char const* args) { - Player* target = NULL; - std::string playerName; - if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName)) + Player* playerTarget; + ObjectGuid guidTarget; + std::string nameTarget; + + ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atoul(args))); + + if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget)) + { + playerTarget = ObjectAccessor::FindPlayer(parseGUID); + guidTarget = parseGUID; + } + else if (!handler->extractPlayerTarget((char*)args, &playerTarget, &guidTarget, &nameTarget)) return false; - Group* grp = target->GetGroup(); - if (!grp) + Group* groupTarget = NULL; + + if (playerTarget) + groupTarget = playerTarget->GetGroup(); + else { - handler->PSendSysMessage(LANG_LFG_NOT_IN_GROUP, playerName.c_str()); - return true; + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER); + stmt->setUInt32(0, guidTarget.GetCounter()); + PreparedQueryResult resultGroup = CharacterDatabase.Query(stmt); + if (resultGroup) + groupTarget = sGroupMgr->GetGroupByDbStoreId((*resultGroup)[0].GetUInt32()); + } + if (!groupTarget) + { + handler->PSendSysMessage(LANG_LFG_NOT_IN_GROUP, nameTarget.c_str()); + handler->SetSentErrorMessage(true); + return false; } - ObjectGuid guid = grp->GetGUID(); + ObjectGuid guid = groupTarget->GetGUID(); std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid)); - handler->PSendSysMessage(LANG_LFG_GROUP_INFO, grp->isLFGGroup(), + handler->PSendSysMessage(LANG_LFG_GROUP_INFO, groupTarget->isLFGGroup(), state.c_str(), sLFGMgr->GetDungeon(guid)); - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) - GetPlayerInfo(handler, itr->GetSource()); + Group::MemberSlotList const& members = groupTarget->GetMemberSlots(); + + for (Group::MemberSlotList::const_iterator itr = members.begin(); itr != members.end(); ++itr) + { + Group::MemberSlot const& slot = *itr; + Player* p = ObjectAccessor::FindPlayer((*itr).guid); + if (p) + GetPlayerInfo(handler, p); + else + handler->PSendSysMessage("%s is offline.", slot.name.c_str()); + } return true; } diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 116ba5e6929..a3045a3b800 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1995,7 +1995,7 @@ public: PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_MUTE_INFO); stmt->setUInt32(0, accountId); PreparedQueryResult result = LoginDatabase.Query(stmt); - + if (!result) { handler->PSendSysMessage(LANG_COMMAND_MUTEHISTORY_EMPTY, accountName); @@ -2006,16 +2006,16 @@ public: do { Field* fields = result->Fetch(); - + // we have to manually set the string for mutedate time_t sqlTime = fields[0].GetUInt32(); tm timeinfo; char buffer[80]; - + // set it to string localtime_r(&sqlTime, &timeinfo); strftime(buffer, sizeof(buffer),"%Y-%m-%d %I:%M%p", &timeinfo); - + handler->PSendSysMessage(LANG_COMMAND_MUTEHISTORY_OUTPUT, buffer, fields[1].GetUInt32(), fields[2].GetCString(), fields[3].GetCString()); } while (result->NextRow()); return true; diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index ec2f41cc625..cae26735568 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -41,14 +41,17 @@ enum Says enum Spells { - SPELL_GROUND_TREMOR = 6524, - SPELL_ARCHAEDAS_AWAKEN = 10347, - SPELL_BOSS_OBJECT_VISUAL = 11206, - SPELL_BOSS_AGGRO = 10340, - SPELL_SUB_BOSS_AGGRO = 11568, - SPELL_AWAKEN_VAULT_WALKER = 10258, - SPELL_AWAKEN_EARTHEN_GUARDIAN = 10252, - SPELL_SELF_DESTRUCT = 9874 + SPELL_GROUND_TREMOR = 6524, + SPELL_ARCHAEDAS_AWAKEN = 10347, + SPELL_BOSS_OBJECT_VISUAL = 11206, + SPELL_BOSS_AGGRO = 10340, + SPELL_SUB_BOSS_AGGRO = 11568, + SPELL_AWAKEN_VAULT_WALKER = 10258, + SPELL_AWAKEN_EARTHEN_GUARDIAN = 10252, + SPELL_SELF_DESTRUCT = 9874, + SPELL_FREEZE_ANIM = 16245, + SPELL_MINION_FREEZE_ANIM = 10255 + }; class boss_archaedas : public CreatureScript @@ -96,6 +99,7 @@ class boss_archaedas : public CreatureScript me->setFaction(35); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + me->AddAura(SPELL_FREEZE_ANIM, me); } void ActivateMinion(ObjectGuid uiGuid, bool flag) @@ -109,6 +113,7 @@ class boss_archaedas : public CreatureScript minion->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); minion->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); minion->setFaction(14); + minion->RemoveAura(SPELL_MINION_FREEZE_ANIM); } } @@ -258,6 +263,7 @@ class npc_archaedas_minions : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); me->RemoveAllAuras(); + me->AddAura(SPELL_MINION_FREEZE_ANIM, me); } void EnterCombat(Unit* /*who*/) override @@ -297,7 +303,7 @@ class npc_archaedas_minions : public CreatureScript { bWakingUp = false; bAmIAwake = true; - // AttackStart(ObjectAccessor::GetUnit(*me, instance->GetGuidData(0))); // whoWokeArchaedasGUID + AttackStart(ObjectAccessor::GetUnit(*me, instance->GetGuidData(0))); // whoWokeArchaedasGUID return; // dont want to continue until we finish the AttackStart method } @@ -346,6 +352,7 @@ class npc_stonekeepers : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); me->RemoveAllAuras(); + me->AddAura(SPELL_MINION_FREEZE_ANIM, me); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp index de899c04e1a..7f0faa138ec 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp @@ -28,10 +28,9 @@ EndScriptData */ enum Ironaya { - SAY_AGGRO = 0, SPELL_ARCINGSMASH = 8374, SPELL_KNOCKAWAY = 10101, - SPELL_WSTOMP = 11876, + SPELL_WSTOMP = 11876 }; class boss_ironaya : public CreatureScript @@ -66,10 +65,7 @@ class boss_ironaya : public CreatureScript Initialize(); } - void EnterCombat(Unit* /*who*/) override - { - Talk(SAY_AGGRO); - } + void EnterCombat(Unit* /*who*/) override { } void UpdateAI(uint32 uiDiff) override { diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index 9d33d41af62..11699d4ec43 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -18,12 +18,13 @@ /* ScriptData SDName: instance_uldaman -SD%Complete: 99 +SD%Complete: 80% SDComment: Need some cosmetics updates when archeadas door are closing (Guardians Waypoints). SDCategory: Uldaman EndScriptData */ #include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "InstanceScript.h" #include "uldaman.h" @@ -31,6 +32,8 @@ enum Spells { SPELL_ARCHAEDAS_AWAKEN = 10347, SPELL_AWAKEN_VAULT_WALKER = 10258, + SPELL_FREEZE_ANIM = 16245, + SPELL_MINION_FREEZE_ANIM = 10255 }; enum Events @@ -38,6 +41,13 @@ enum Events EVENT_SUB_BOSS_AGGRO = 2228 }; +enum IronayaTalk +{ + SAY_AGGRO = 0 +}; + +const Position IronayaPoint = { -231.228f, 246.6135f, -49.01617f, 0.0f }; + class instance_uldaman : public InstanceMapScript { public: @@ -136,9 +146,9 @@ class instance_uldaman : public InstanceMapScript { creature->setFaction(35); creature->RemoveAllAuras(); - //creature->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_ANIMATION_FROZEN); creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + creature->AddAura(SPELL_MINION_FREEZE_ANIM, creature); } void SetDoor(ObjectGuid guid, bool open) @@ -171,6 +181,8 @@ class instance_uldaman : public InstanceMapScript target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); target->setFaction(14); target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + target->RemoveAura(SPELL_MINION_FREEZE_ANIM); + return; // only want the first one we find } // if we get this far than all four are dead so open the door @@ -190,11 +202,13 @@ class instance_uldaman : public InstanceMapScript Creature* target = instance->GetCreature(*i); if (!target || !target->IsAlive() || target->getFaction() == 14) continue; - archaedas->CastSpell(target, SPELL_AWAKEN_VAULT_WALKER, true); - target->CastSpell(target, SPELL_ARCHAEDAS_AWAKEN, true); target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); target->setFaction(14); + target->RemoveAura(SPELL_MINION_FREEZE_ANIM); + archaedas->CastSpell(target, SPELL_AWAKEN_VAULT_WALKER, true); + target->CastSpell(target, SPELL_ARCHAEDAS_AWAKEN, true); + return; // only want the first one we find } } @@ -241,6 +255,7 @@ class instance_uldaman : public InstanceMapScript if (ObjectAccessor::GetUnit(*archaedas, target)) { + archaedas->RemoveAura(SPELL_FREEZE_ANIM); archaedas->CastSpell(archaedas, SPELL_ARCHAEDAS_AWAKEN, false); whoWokeuiArchaedasGUID = target; } @@ -255,6 +270,12 @@ class instance_uldaman : public InstanceMapScript ironaya->setFaction(415); ironaya->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); ironaya->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + ironaya->GetMotionMaster()->Clear(); + ironaya->GetMotionMaster()->MovePoint(0, IronayaPoint); + ironaya->SetHomePosition(IronayaPoint); + + ironaya->AI()->Talk(SAY_AGGRO); } void RespawnMinions() diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index 1a98c081570..a9abb2c045d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -694,7 +694,7 @@ class boss_gazakroth : public CreatureScript public: boss_gazakroth() : CreatureScript("boss_gazakroth") { } - + struct boss_gazakrothAI : public boss_hexlord_addAI { boss_gazakrothAI(Creature* creature) : boss_hexlord_addAI(creature) @@ -706,7 +706,7 @@ class boss_gazakroth : public CreatureScript { firebolt_timer = 2 * IN_MILLISECONDS; } - + void Reset() override { Initialize(); diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp index ca281bab60a..d7d06a2e3ab 100644 --- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp +++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp @@ -50,7 +50,7 @@ enum Sylvanas SAY_SUNSORROW_WHISPER = 0, SOUND_CREDIT = 10896, - + NPC_HIGHBORNE_LAMENTER = 21628, NPC_HIGHBORNE_BUNNY = 21641, NPC_AMBASSADOR_SUNSORROW = 16287, diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp index 0311ed61c6a..ecda065fda9 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp @@ -32,8 +32,7 @@ enum Spells SPELL_CURSE_OF_EXERTION = 52772, SPELL_TIME_WARP = 52766, //Time slows down, reducing attack, casting and movement speed by 70% for 6 sec. SPELL_TIME_STOP = 58848, //Stops time in a 50 yard sphere for 2 sec. - SPELL_WOUNDING_STRIKE = 52771, //Used only on the tank - H_SPELL_WOUNDING_STRIKE = 58830 + SPELL_WOUNDING_STRIKE = 52771 //Used only on the tank }; enum Yells @@ -45,109 +44,78 @@ enum Yells SAY_DEATH = 4 }; +enum Events +{ + EVENT_CURSE_OF_EXERTION = 1, + EVENT_TIME_WARP, + EVENT_TIME_STOP, + EVENT_WOUNDING_STRIKE +}; + class boss_epoch : public CreatureScript { -public: - boss_epoch() : CreatureScript("boss_epoch") { } + public: + boss_epoch() : CreatureScript("boss_epoch") { } - CreatureAI* GetAI(Creature* creature) const override - { - return GetInstanceAI(creature); - } - - struct boss_epochAI : public ScriptedAI - { - boss_epochAI(Creature* creature) : ScriptedAI(creature) + struct boss_epochAI : public BossAI { - Initialize(); - instance = creature->GetInstanceScript(); - } + boss_epochAI(Creature* creature) : BossAI(creature, DATA_EPOCH) { } - void Initialize() - { - uiStep = 1; - uiStepTimer = 26000; - uiCurseOfExertionTimer = 9300; - uiTimeWarpTimer = 25300; - uiTimeStopTimer = 21300; - uiWoundingStrikeTimer = 5300; - } - - uint8 uiStep; - - uint32 uiStepTimer; - uint32 uiWoundingStrikeTimer; - uint32 uiTimeWarpTimer; - uint32 uiTimeStopTimer; - uint32 uiCurseOfExertionTimer; - - InstanceScript* instance; - - void Reset() override - { - Initialize(); - - instance->SetBossState(DATA_EPOCH, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) override - { - Talk(SAY_AGGRO); - - instance->SetBossState(DATA_EPOCH, IN_PROGRESS); - } - - void UpdateAI(uint32 diff) override - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiCurseOfExertionTimer < diff) + void EnterCombat(Unit* /*who*/) override { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_CURSE_OF_EXERTION); - uiCurseOfExertionTimer = 9300; - } else uiCurseOfExertionTimer -= diff; + Talk(SAY_AGGRO); + _EnterCombat(); - if (uiWoundingStrikeTimer < diff) + events.ScheduleEvent(EVENT_CURSE_OF_EXERTION, 9300); + events.ScheduleEvent(EVENT_TIME_WARP, 25300); + events.ScheduleEvent(EVENT_TIME_STOP, 21300); + events.ScheduleEvent(EVENT_WOUNDING_STRIKE, 5300); + } + + void ExecuteEvent(uint32 eventId) override { - DoCastVictim(SPELL_WOUNDING_STRIKE); - uiWoundingStrikeTimer = 5300; - } else uiWoundingStrikeTimer -= diff; + switch (eventId) + { + case EVENT_CURSE_OF_EXERTION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_CURSE_OF_EXERTION); + events.ScheduleEvent(EVENT_CURSE_OF_EXERTION, 9300); + break; + case EVENT_TIME_WARP: + Talk(SAY_TIME_WARP); + DoCastAOE(SPELL_TIME_WARP); + events.ScheduleEvent(EVENT_TIME_WARP, 25300); + break; + case EVENT_TIME_STOP: + DoCastAOE(SPELL_TIME_STOP); + events.ScheduleEvent(EVENT_TIME_STOP, 21300); + break; + case EVENT_WOUNDING_STRIKE: + DoCastVictim(SPELL_WOUNDING_STRIKE); + events.ScheduleEvent(EVENT_WOUNDING_STRIKE, 5300); + break; + default: + break; + } + } - if (uiTimeStopTimer < diff) + void JustDied(Unit* /*killer*/) override { - DoCastAOE(SPELL_TIME_STOP); - uiTimeStopTimer = 21300; - } else uiTimeStopTimer -= diff; + Talk(SAY_DEATH); + _JustDied(); + } - if (uiTimeWarpTimer < diff) + void KilledUnit(Unit* victim) override { - Talk(SAY_TIME_WARP); - DoCastAOE(SPELL_TIME_WARP); - uiTimeWarpTimer = 25300; - } else uiTimeWarpTimer -= diff; + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); + } + }; - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) override + CreatureAI* GetAI(Creature* creature) const override { - Talk(SAY_DEATH); - - instance->SetBossState(DATA_EPOCH, DONE); + return GetInstanceAI(creature); } - - void KilledUnit(Unit* victim) override - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; - - Talk(SAY_SLAY); - } - }; - }; void AddSC_boss_epoch() diff --git a/src/server/scripts/Kalimdor/zone_desolace.cpp b/src/server/scripts/Kalimdor/zone_desolace.cpp index 09d0ac1ee92..c128d5dd434 100644 --- a/src/server/scripts/Kalimdor/zone_desolace.cpp +++ b/src/server/scripts/Kalimdor/zone_desolace.cpp @@ -85,12 +85,20 @@ public: DoCast(me, SPELL_KODO_KOMBO_DESPAWN_BUFF, true); me->UpdateEntry(NPC_TAMED_KODO); + me->CombatStop(); + me->DeleteThreatList(); + me->SetSpeed(MOVE_RUN, 0.6f, true); me->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, me->GetFollowAngle()); + me->setActive(true); } } else if (spell->Id == SPELL_KODO_KOMBO_GOSSIP) { me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + me->setActive(false); me->DespawnOrUnsummon(60000); } } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 0c797f3bc85..75bcc018038 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -2412,14 +2412,14 @@ enum QuelDelarMisc Position const QuelDelarCenterPos = { 5309.259f, 2006.390f, 718.046f, 0.0f }; Position const QuelDelarSummonPos = { 5298.473f, 1994.852f, 709.424f, 3.979351f }; Position const QuelDelarMovement[] = -{ +{ { 5292.870f, 1998.950f, 718.046f, 0.0f }, { 5295.819f, 1991.912f, 707.707f, 0.0f }, { 5295.301f, 1989.782f, 708.696f, 0.0f } }; Position const UtherQuelDelarMovement[] = -{ +{ { 5336.830f, 1981.700f, 709.319f, 0.0f }, { 5314.350f, 1993.440f, 707.726f, 0.0f } }; diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 28a8f171b61..3a07271b509 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -128,7 +128,6 @@ enum Spells SPELL_ARCANE_BARRAGE_DAMAGE = 63934, // the actual damage - cast by affected player by script spell // Transition /II-III/ - SPELL_SUMMOM_RED_DRAGON_BUDYY = 56070, SPELL_RIDE_RED_DRAGON_BUDDY = 56071, SPELL_SUMMON_RED_DRAGON_BUDDY_F_CAST = 58846, // After implicitly hit player targets they will force cast 56070 on self SPELL_DESTROY_PLATFORM_CHANNEL = 58842, diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h b/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h index b6a0d3f9b62..d9b921b38a1 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h @@ -80,7 +80,8 @@ enum InstanceSpells SPELL_VORTEX_5 = 56263, // damage | used to enter to the vehicle SPELL_PORTAL_OPENED = 61236, SPELL_RIDE_RED_DRAGON_TRIGGERED = 56072, - SPELL_IRIS_OPENED = 61012 // visual when starting encounter + SPELL_IRIS_OPENED = 61012, // visual when starting encounter + SPELL_SUMMOM_RED_DRAGON_BUDDY = 56070 }; #endif diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index 6938f3d252e..107f5db7260 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -39,6 +39,12 @@ public: SetBossNumber(MAX_ENCOUNTER); } + void OnPlayerEnter(Player* player) override + { + if (GetBossState(DATA_MALYGOS_EVENT) == DONE) + player->CastSpell(player, SPELL_SUMMOM_RED_DRAGON_BUDDY, true); + } + bool SetBossState(uint32 type, EncounterState state) override { if (!InstanceScript::SetBossState(type, state)) diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp index 384694cdd40..453423bd287 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp @@ -197,7 +197,7 @@ public: ++_healthAmountModifier; } } - + private: uint32 _healthAmountModifier; bool _isIntroDone; diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index 536cae08483..3853b0aedfc 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -89,7 +89,7 @@ class boss_volkhan : public CreatureScript { public: boss_volkhan() : CreatureScript("boss_volkhan") { } - + struct boss_volkhanAI : public BossAI { boss_volkhanAI(Creature* creature) : BossAI(creature, DATA_VOLKHAN) @@ -104,7 +104,7 @@ public: m_bCanShatterGolem = false; m_uiDelay_Timer = 1000; m_uiSummonPhase = 0; - GolemsShattered = 0; + GolemsShattered = 0; m_uiHealthAmountModifier = 1; } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp index 1e2ca666378..6233c7e8953 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp @@ -330,7 +330,7 @@ public: DespawnDwarf(); - instance->SetBossState(DATA_BRANN_EVENT, NOT_STARTED); + instance->SetBossState(DATA_TRIBUNAL_OF_AGES, NOT_STARTED); } } @@ -362,8 +362,10 @@ public: break; case 13: Talk(SAY_EVENT_INTRO_1); + instance->SetBossState(DATA_TRIBUNAL_OF_AGES, IN_PROGRESS); SetEscortPaused(true); JumpToNextStep(20000); + // @todo: There should be a pause here and a gossip should start the next step. break; case 17: Talk(SAY_EVENT_INTRO_2); @@ -421,9 +423,9 @@ public: Start(); } - void DamageTaken(Unit* /*done_by*/, uint32 & /*damage*/) override + void DamageTaken(Unit* /*done_by*/, uint32& /*damage*/) override { - if (brannSparklinNews) + if (instance->GetBossState(DATA_TRIBUNAL_OF_AGES) == IN_PROGRESS) brannSparklinNews = false; } @@ -442,9 +444,8 @@ public: switch (uiStep) { case 1: - if (instance->GetBossState(DATA_BRANN_EVENT) != NOT_STARTED) + if (instance->GetBossState(DATA_TRIBUNAL_OF_AGES) != NOT_STARTED) return; - instance->SetBossState(DATA_BRANN_EVENT, IN_PROGRESS); bIsBattle = false; Talk(SAY_ESCORT_START); SetRun(true); @@ -582,7 +583,7 @@ public: break; case 29: Talk(SAY_EVENT_END_02); - instance->SetBossState(DATA_BRANN_EVENT, DONE); + instance->SetBossState(DATA_TRIBUNAL_OF_AGES, DONE); me->CastSpell(me, SPELL_REWARD_ACHIEVEMENT, true); JumpToNextStep(5500); break; @@ -715,9 +716,7 @@ public: class achievement_brann_spankin_new : public AchievementCriteriaScript { public: - achievement_brann_spankin_new() : AchievementCriteriaScript("achievement_brann_spankin_new") - { - } + achievement_brann_spankin_new() : AchievementCriteriaScript("achievement_brann_spankin_new") { } bool OnCheck(Player* /*player*/, Unit* target) override { diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h index 2ed47b42bbc..df56aadfe22 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h @@ -28,7 +28,7 @@ enum DataTypes // Encounter States/Boss GUIDs DATA_KRYSTALLUS = 0, DATA_MAIDEN_OF_GRIEF = 1, - DATA_BRANN_EVENT = 2, + DATA_TRIBUNAL_OF_AGES = 2, DATA_SJONNIR = 3, // Additional data diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp index a70d1ff3a0d..c67e31c4cc0 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp @@ -23,8 +23,8 @@ DoorData const doorData[] = { - { GO_SJONNIR_DOOR, DATA_BRANN_EVENT, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, - { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END + { GO_SJONNIR_DOOR, DATA_TRIBUNAL_OF_AGES, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END }; class instance_halls_of_stone : public InstanceMapScript @@ -90,7 +90,7 @@ class instance_halls_of_stone : public InstanceMapScript case GO_TRIBUNAL_CHEST: case GO_TRIBUNAL_CHEST_HERO: TribunalChestGUID = go->GetGUID(); - if (GetBossState(DATA_BRANN_EVENT) == DONE) + if (GetBossState(DATA_TRIBUNAL_OF_AGES) == DONE) go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); break; case GO_TRIBUNAL_SKY_FLOOR: @@ -156,7 +156,7 @@ class instance_halls_of_stone : public InstanceMapScript switch (type) { - case DATA_BRANN_EVENT: + case DATA_TRIBUNAL_OF_AGES: if (state == DONE) { if (GameObject* go = instance->GetGameObject(TribunalChestGUID)) @@ -178,7 +178,7 @@ class instance_halls_of_stone : public InstanceMapScript switch (bossId) { case DATA_SJONNIR: - if (GetBossState(DATA_BRANN_EVENT) != DONE) + if (GetBossState(DATA_TRIBUNAL_OF_AGES) != DONE) return false; break; default: diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index ea50969ecb8..ef9ad806c89 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -794,9 +794,11 @@ public: trigger->CastSpell(trigger, spellInfoLightning, true, 0, 0, trigger->GetGUID()); // Kill all mobs registered with SetGuidData(ADD_TRASH_MOB) - for (GuidSet::const_iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr) + for (GuidSet::const_iterator itr = trashMobs.begin(); itr != trashMobs.end();) { Creature* creature = instance->GetCreature(*itr); + // Increment the iterator before killing the creature because the kill will remove itr from trashMobs + ++itr; if (creature && creature->IsAlive()) trigger->Kill(creature); } diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index 4574f45649f..1741a6d928e 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -1706,7 +1706,7 @@ public: break; } creature->SetStandState(UNIT_STAND_STATE_STAND); - creature->AI()->Talk(SAY_1); + creature->AI()->Talk(SAY_1, player); ENSURE_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); } return true; diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp index 15fa6d836cd..83fd3859716 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -826,11 +826,11 @@ class spell_infected_worgen_bite : public SpellScriptLoader { public: spell_infected_worgen_bite() : SpellScriptLoader("spell_infected_worgen_bite") { } - + class spell_infected_worgen_bite_AuraScript : public AuraScript { PrepareAuraScript(spell_infected_worgen_bite_AuraScript); - + void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); @@ -841,7 +841,7 @@ class spell_infected_worgen_bite : public SpellScriptLoader target->CastSpell(target, SPELL_WORGENS_CALL, true); } } - + void Register() override { AfterEffectApply += AuraEffectApplyFn(spell_infected_worgen_bite_AuraScript::HandleAfterEffectApply, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAPPLY); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp index 1657b178327..d7ba0a34939 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp @@ -275,8 +275,8 @@ class instance_serpent_shrine : public InstanceMapScript if (data == DONE) { HandleGameObject(BridgePart[0], true); - HandleGameObject(BridgePart[0], true); - HandleGameObject(BridgePart[0], true); + HandleGameObject(BridgePart[1], true); + HandleGameObject(BridgePart[2], true); } break; case DATA_TRASH: diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp index 30444caa496..4cc522c7523 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp @@ -43,7 +43,7 @@ class go_main_chambers_access_panel : public GameObjectScript } }; -ObjectData const gameObjectData[] = +ObjectData const gameObjectData[] = { { GO_ACCESS_PANEL_HYDRO, DATA_ACCESS_PANEL_HYDRO }, { GO_ACCESS_PANEL_MEK, DATA_ACCESS_PANEL_MEK }, diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp index fb44a403d86..dfc5f5992a6 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp @@ -108,6 +108,7 @@ class boss_grand_warlock_nethekurse : public CreatureScript void Reset() override { + _Reset(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Initialize(); @@ -115,9 +116,8 @@ class boss_grand_warlock_nethekurse : public CreatureScript void JustDied(Unit* /*killer*/) override { + _JustDied(); Talk(SAY_DIE); - - instance->SetBossState(DATA_NETHEKURSE, DONE); } void SetData(uint32 data, uint32 value) override diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp index 7d00cd97126..a950882eddd 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp @@ -160,6 +160,7 @@ class boss_warbringer_omrogg : public CreatureScript void Reset() override { + _Reset(); if (Unit* LeftHead = ObjectAccessor::GetUnit(*me, LeftHeadGUID)) { LeftHead->setDeathState(JUST_DIED); @@ -257,14 +258,14 @@ class boss_warbringer_omrogg : public CreatureScript Creature* LeftHead = ObjectAccessor::GetCreature(*me, LeftHeadGUID); Creature* RightHead = ObjectAccessor::GetCreature(*me, RightHeadGUID); + _JustDied(); + if (!LeftHead || !RightHead) return; LeftHead->AI()->Talk(YELL_DIE_L); RightHead->AI()->SetData(SETDATA_DATA, SETDATA_YELL); - - instance->SetBossState(DATA_OMROGG, DONE); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp index b44ae46c78c..21ed710f4d8 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp @@ -35,7 +35,10 @@ enum Says { SAY_AGGRO = 0, SAY_SLAY = 1, - SAY_DEATH = 2 + SAY_DEATH = 2, + + SAY_CALL_EXECUTIONER_A = 3, + SAY_CALL_EXECUTIONER_H = 4 }; enum Spells @@ -84,10 +87,28 @@ class boss_warchief_kargath_bladefist : public CreatureScript resetcheck_timer = 5000; } + void SetData(uint32 type, uint32 data) override + { + if (type == 1) + { + switch (data) + { + case ALLIANCE: + Talk(SAY_CALL_EXECUTIONER_A); + break; + case HORDE: + Talk(SAY_CALL_EXECUTIONER_H); + break; + default: + break; + } + } + } + void Reset() override { removeAdds(); - + _Reset(); me->SetSpeed(MOVE_RUN, 2); me->SetWalk(false); @@ -96,10 +117,9 @@ class boss_warchief_kargath_bladefist : public CreatureScript void JustDied(Unit* /*killer*/) override { + _JustDied(); Talk(SAY_DEATH); removeAdds(); - - instance->SetBossState(DATA_KARGATH, DONE); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp index c6b08bdada1..6939b15585a 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp @@ -24,9 +24,30 @@ SDCategory: Hellfire Citadel, Shattered Halls EndScriptData */ #include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "InstanceScript.h" +#include "Player.h" +#include "SpellAuras.h" #include "shattered_halls.h" +enum Spells +{ + SPELL_CLEAVE = 15284, + + SPELL_EXECUTE_1 = 39288, + SPELL_EXECUTE_2, + SPELL_EXECUTE_3 +}; + +DoorData const doorData[] = +{ + {GO_GRAND_WARLOCK_CHAMBER_DOOR_1, DATA_NETHEKURSE, DOOR_TYPE_PASSAGE, BOUNDARY_S }, + {GO_GRAND_WARLOCK_CHAMBER_DOOR_2, DATA_NETHEKURSE, DOOR_TYPE_PASSAGE, BOUNDARY_N }, + {0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE} +}; + class instance_shattered_halls : public InstanceMapScript { public: @@ -43,6 +64,43 @@ class instance_shattered_halls : public InstanceMapScript { SetHeaders(DataHeader); SetBossNumber(EncounterCount); + LoadDoorData(doorData); + executionTimer = 0; + executed = 0; + _team = 0; + } + + void OnPlayerEnter(Player* player) override + { + Aura* ex = nullptr; + + if (!_team) + _team = player->GetTeam(); + + player->RemoveAurasDueToSpell(SPELL_EXECUTE_1); + player->RemoveAurasDueToSpell(SPELL_EXECUTE_2); + player->RemoveAurasDueToSpell(SPELL_EXECUTE_3); + + if (!executionTimer || executionerGUID.IsEmpty()) + return; + + switch (executed) + { + case 0: + ex = player->AddAura(SPELL_EXECUTE_1, player); + break; + case 1: + ex = player->AddAura(SPELL_EXECUTE_2, player); + break; + case 2: + ex = player->AddAura(SPELL_EXECUTE_3, player); + break; + default: + break; + } + + if (ex) + ex->SetDuration(executionTimer); } void OnGameObjectCreate(GameObject* go) override @@ -50,21 +108,53 @@ class instance_shattered_halls : public InstanceMapScript switch (go->GetEntry()) { case GO_GRAND_WARLOCK_CHAMBER_DOOR_1: - nethekurseDoor1GUID = go->GetGUID(); - break; case GO_GRAND_WARLOCK_CHAMBER_DOOR_2: - nethekurseDoor2GUID = go->GetGUID(); + AddDoor(go, true); + default: + break; + } + } + + void OnGameObjectRemove(GameObject* go) override + { + switch (go->GetEntry()) + { + case GO_GRAND_WARLOCK_CHAMBER_DOOR_1: + case GO_GRAND_WARLOCK_CHAMBER_DOOR_2: + AddDoor(go, false); + default: break; } } void OnCreatureCreate(Creature* creature) override { + if (!_team) + { + Map::PlayerList const &players = instance->GetPlayers(); + if (!players.isEmpty()) + if (Player* player = players.begin()->GetSource()) + _team = player->GetTeam(); + } + switch (creature->GetEntry()) { case NPC_GRAND_WARLOCK_NETHEKURSE: nethekurseGUID = creature->GetGUID(); break; + case NPC_KARGATH_BLADEFIST: + kargathGUID = creature->GetGUID(); + break; + case NPC_RANDY_WHIZZLESPROCKET: + if (_team == HORDE) + creature->UpdateEntry(NPC_DRISELLA); + break; + case NPC_SHATTERED_EXECUTIONER: + executionTimer = 55 * MINUTE * IN_MILLISECONDS; + DoCastSpellOnPlayers(SPELL_EXECUTE_1); + executionerGUID = creature->GetGUID(); + SaveToDB(); + break; } } @@ -75,18 +165,20 @@ class instance_shattered_halls : public InstanceMapScript switch (type) { - case DATA_NETHEKURSE: - if (state == IN_PROGRESS) + case DATA_SHATTERED_EXECUTIONER: + if (state == DONE) { - HandleGameObject(nethekurseDoor1GUID, false); - HandleGameObject(nethekurseDoor2GUID, false); - } - else - { - HandleGameObject(nethekurseDoor1GUID, true); - HandleGameObject(nethekurseDoor2GUID, true); + DoRemoveAurasDueToSpellOnPlayers(SPELL_EXECUTE_1); + DoRemoveAurasDueToSpellOnPlayers(SPELL_EXECUTE_2); + DoRemoveAurasDueToSpellOnPlayers(SPELL_EXECUTE_3); + executionTimer = 0; + SaveToDB(); } break; + case DATA_KARGATH: + if (Creature* executioner = instance->GetCreature(executionerGUID)) + executioner->AI()->Reset(); + break; case DATA_OMROGG: break; } @@ -100,24 +192,305 @@ class instance_shattered_halls : public InstanceMapScript case NPC_GRAND_WARLOCK_NETHEKURSE: return nethekurseGUID; break; - case GO_GRAND_WARLOCK_CHAMBER_DOOR_1: - return nethekurseDoor1GUID; + case NPC_KARGATH_BLADEFIST: + return kargathGUID; break; - case GO_GRAND_WARLOCK_CHAMBER_DOOR_2: - return nethekurseDoor2GUID; + case NPC_SHATTERED_EXECUTIONER: + return executionerGUID; + break; + default: + return ObjectGuid::Empty; break; } - return ObjectGuid::Empty; + } + + void WriteSaveDataMore(std::ostringstream& data) override + { + if (!instance->IsHeroic()) + return; + + data << uint32(executed) << ' ' + << executionTimer << ' '; + } + + void ReadSaveDataMore(std::istringstream& data) override + { + if (!instance->IsHeroic()) + return; + + uint32 readbuff; + data >> readbuff; + executed = uint8(readbuff); + data >> readbuff; + + if (executed > VictimCount) + { + executed = VictimCount; + executionTimer = 0; + return; + } + + if (!readbuff) + return; + + Creature* executioner = nullptr; + + instance->LoadGrid(Executioner.GetPositionX(), Executioner.GetPositionY()); + if (Creature* kargath = instance->GetCreature(kargathGUID)) + if (executionerGUID.IsEmpty()) + executioner = kargath->SummonCreature(NPC_SHATTERED_EXECUTIONER, Executioner); + + if (executioner) + for (uint8 i = executed; i < VictimCount; ++i) + executioner->SummonCreature(executionerVictims[i](GetData(DATA_TEAM_IN_INSTANCE)), executionerVictims[i].GetPos()); + + executionTimer = readbuff; + } + + uint32 GetData(uint32 type) const override + { + switch (type) + { + case DATA_PRISONERS_EXECUTED: + return executed; + break; + case DATA_TEAM_IN_INSTANCE: + return _team; + break; + default: + return 0; + break; + } + } + + void Update(uint32 diff) override + { + if (!executionTimer) + return; + + if (executionTimer <= diff) + { + switch (++executed) + { + case 1: + DoRemoveAurasDueToSpellOnPlayers(SPELL_EXECUTE_1); + DoCastSpellOnPlayers(SPELL_EXECUTE_2); + executionTimer = 10 * MINUTE * IN_MILLISECONDS; + break; + case 2: + DoRemoveAurasDueToSpellOnPlayers(SPELL_EXECUTE_2); + DoCastSpellOnPlayers(SPELL_EXECUTE_3); + executionTimer = 15 * MINUTE * IN_MILLISECONDS; + break; + default: + DoRemoveAurasDueToSpellOnPlayers(SPELL_EXECUTE_3); + executionTimer = 0; + break; + } + + if (Creature* executioner = instance->GetCreature(executionerGUID)) + executioner->AI()->SetData(1, executed); + + SaveToDB(); + } + else + executionTimer -= diff; } protected: ObjectGuid nethekurseGUID; - ObjectGuid nethekurseDoor1GUID; - ObjectGuid nethekurseDoor2GUID; + ObjectGuid kargathGUID; + ObjectGuid executionerGUID; + + uint8 executed; + uint32 executionTimer; + uint32 _team; }; }; +class at_nethekurse_exit : public AreaTriggerScript +{ + public: + at_nethekurse_exit() : AreaTriggerScript("at_nethekurse_exit") { }; + + bool OnTrigger(Player* player, AreaTriggerEntry const*) override + { + if (InstanceScript* is = player->GetInstanceScript()) + { + if (is->instance->IsHeroic()) + { + Creature* executioner = nullptr; + + is->instance->LoadGrid(Executioner.GetPositionX(), Executioner.GetPositionY()); + if (Creature* kargath = ObjectAccessor::GetCreature(*player, is->GetGuidData(NPC_KARGATH_BLADEFIST))) + { + if (is->GetGuidData(NPC_SHATTERED_EXECUTIONER).IsEmpty()) + { + executioner = kargath->SummonCreature(NPC_SHATTERED_EXECUTIONER, Executioner); + kargath->AI()->SetData(1, is->GetData(DATA_TEAM_IN_INSTANCE)); + } + } + + if (executioner) + for (uint8 i = 0; i < VictimCount; ++i) + executioner->SummonCreature(executionerVictims[i](is->GetData(DATA_TEAM_IN_INSTANCE)), executionerVictims[i].GetPos()); + } + } + + return false; + } +}; + +class boss_shattered_executioner : public CreatureScript +{ + public: + boss_shattered_executioner() : CreatureScript("boss_shattered_executioner") { } + + struct boss_shattered_executionerAI : public BossAI + { + boss_shattered_executionerAI(Creature* creature) : BossAI(creature, DATA_SHATTERED_EXECUTIONER) + { + Initialize(); + }; + + void Initialize() + { + cleaveTimer = 500; + me->ResetLootMode(); + switch (instance->GetData(DATA_PRISONERS_EXECUTED)) + { + case 0: + me->AddLootMode(LOOT_MODE_HARD_MODE_3); + case 1: + me->AddLootMode(LOOT_MODE_HARD_MODE_2); + case 2: + me->AddLootMode(LOOT_MODE_HARD_MODE_1); + } + } + + void Reset() override + { + _Reset(); + if (instance->GetBossState(DATA_KARGATH) == DONE) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + else + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + + Initialize(); + } + + void JustSummoned(Creature*) override { } + + void JustDied(Unit*) override + { + _JustDied(); + Map::PlayerList const &players = instance->instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + Player* pl = itr->GetSource(); + uint32 qId = pl->GetTeam() == ALLIANCE ? QUEST_IMPRISONED_A : QUEST_IMPRISONED_H; + if (pl->GetQuestStatus(qId) != QUEST_STATUS_NONE && pl->GetQuestStatus(qId) != QUEST_STATUS_FAILED) + pl->CompleteQuest(qId); + } + } + + void SetData(uint32 type, uint32 data) override + { + if (type == 1) + { + uint32 entry = executionerVictims[data - 1](instance->GetData(DATA_TEAM_IN_INSTANCE)); + if (Creature* victim = me->FindNearestCreature(entry, 30.0f, true)) + me->Kill(victim); + + if (data == 1) + { + Map::PlayerList const &players = instance->instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + Player* pl = itr->GetSource(); + uint32 qId = pl->GetTeam() == ALLIANCE ? QUEST_IMPRISONED_A : QUEST_IMPRISONED_H; + if (pl->GetQuestStatus(qId) == QUEST_STATUS_INCOMPLETE) + pl->FailQuest(qId); + } + } + + switch (data) + { + case 3: + me->RemoveLootMode(LOOT_MODE_HARD_MODE_1); + case 2: + me->RemoveLootMode(LOOT_MODE_HARD_MODE_2); + case 1: + me->RemoveLootMode(LOOT_MODE_HARD_MODE_3); + default: + break; + } + } + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + if (cleaveTimer <= diff) + { + DoCast(SPELL_CLEAVE); + cleaveTimer = urand(5000, 7000); + } + else + cleaveTimer -= diff; + + DoMeleeAttackIfReady(); + } + private: + uint32 cleaveTimer; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetInstanceAI(creature); + } +}; + +class spell_kargath_executioner : public SpellScriptLoader +{ + public: + spell_kargath_executioner() : SpellScriptLoader("spell_kargath_executioner") { } + + class spell_kargath_executioner_AuraScript : public AuraScript + { + PrepareAuraScript(spell_kargath_executioner_AuraScript); + + bool AreaCheck(Unit* target) + { + if (target->GetMap()->GetId() != 540) + return false; + + return true; + } + + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void Register() override + { + DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_kargath_executioner_AuraScript::AreaCheck); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_kargath_executioner_AuraScript(); + } +}; + void AddSC_instance_shattered_halls() { new instance_shattered_halls(); + new at_nethekurse_exit(); + new boss_shattered_executioner(); + new spell_kargath_executioner(); } diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h index 90cbbe2a438..adc07bec2ff 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h @@ -21,18 +21,41 @@ #define DataHeader "SH" -uint32 const EncounterCount = 3; +uint32 const EncounterCount = 4; +uint32 const VictimCount = 3; enum DataTypes { - DATA_NETHEKURSE = 1, - DATA_OMROGG = 2, - DATA_KARGATH = 3 + DATA_NETHEKURSE = 0, + DATA_OMROGG = 1, + DATA_KARGATH = 2, + + DATA_SHATTERED_EXECUTIONER = 3, + DATA_PRISONERS_EXECUTED = 4, + + DATA_TEAM_IN_INSTANCE = 5 }; enum CreatureIds { - NPC_GRAND_WARLOCK_NETHEKURSE = 16807 + NPC_GRAND_WARLOCK_NETHEKURSE = 16807, + NPC_KARGATH_BLADEFIST = 16808, + + NPC_SHATTERED_EXECUTIONER = 17301, + + // Alliance Ids + NPC_RANDY_WHIZZLESPROCKET = 17288, + + NPC_CAPTAIN_ALINA = 17290, + NPC_ALLIANCE_VICTIM_1 = 17289, + NPC_ALLIANCE_VICTIM_2 = 17292, + + // Horde Ids + NPC_DRISELLA = 17294, + + NPC_CAPTAIN_BONESHATTER = 17296, + NPC_HORDE_VICTIM_1 = 17295, + NPC_HORDE_VICTIM_2 = 17297 }; enum GameobjectIds @@ -41,4 +64,33 @@ enum GameobjectIds GO_GRAND_WARLOCK_CHAMBER_DOOR_2 = 182540 }; +enum QuestIds +{ + QUEST_IMPRISONED_A = 9524, + QUEST_IMPRISONED_H = 9525 +}; + +const Position Executioner = { 152.8524f, -83.63912f, 2.021005f, 0.06981317f }; + +struct FactionSpawnerHelper +{ + FactionSpawnerHelper(uint32 allianceEntry, uint32 hordeEntry, const Position& pos) : _allianceNPC(allianceEntry), _hordeNPC(hordeEntry), _spawnPos(pos) { } + + inline uint32 operator()(uint32 teamID) const { return teamID == ALLIANCE ? _allianceNPC : _hordeNPC; } + inline const Position GetPos() const { return _spawnPos; } + +private: + const uint32 _allianceNPC; + const uint32 _hordeNPC; + const Position _spawnPos; +}; + +const FactionSpawnerHelper executionerVictims[VictimCount] = +{ + { NPC_CAPTAIN_ALINA, NPC_CAPTAIN_BONESHATTER, { 138.8807f, -84.22707f, 1.992269f, 0.06981317f } }, + { NPC_ALLIANCE_VICTIM_1, NPC_HORDE_VICTIM_1, { 151.2411f, -91.02930f, 2.019741f, 1.57079600f } }, + { NPC_ALLIANCE_VICTIM_2, NPC_HORDE_VICTIM_2, { 151.0459f, -77.51981f, 2.021008f, 4.74729500f } } +}; + + #endif diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp index 213f31b280f..03e2154792b 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp @@ -283,7 +283,7 @@ class boss_harbinger_skyriss_illusion : public CreatureScript { boss_harbinger_skyriss_illusionAI(Creature* creature) : ScriptedAI(creature) { } - void Reset() override + void Reset() override { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp index bacc6533d4f..aaf006f6c5f 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -24,8 +24,6 @@ SDCategory: Blade's Edge Mountains EndScriptData */ /* ContentData -npc_bloodmaul_brutebane -npc_bloodmaul_brute npc_nether_drake npc_daranelle go_legion_obelisk @@ -43,171 +41,6 @@ EndContentData */ #include "SpellAuras.h" #include "SpellAuraEffects.h" -/*###### -## npc_bloodmaul_brutebane -######*/ - -enum Bloodmaul -{ - NPC_OGRE_BRUTE = 19995, - NPC_QUEST_CREDIT = 21241, - GO_KEG = 184315, - QUEST_GETTING_THE_BLADESPIRE_TANKED = 10512, - QUEST_BLADESPIRE_KEGGER = 10545 -}; - -class npc_bloodmaul_brutebane : public CreatureScript -{ -public: - npc_bloodmaul_brutebane() : CreatureScript("npc_bloodmaul_brutebane") { } - - struct npc_bloodmaul_brutebaneAI : public ScriptedAI - { - npc_bloodmaul_brutebaneAI(Creature* creature) : ScriptedAI(creature) - { - if (Creature* Ogre = me->FindNearestCreature(NPC_OGRE_BRUTE, 50, true)) - { - Ogre->SetReactState(REACT_DEFENSIVE); - Ogre->GetMotionMaster()->MovePoint(1, me->GetPositionX()-1, me->GetPositionY()+1, me->GetPositionZ()); - } - } - - void UpdateAI(uint32 /*diff*/) override { } - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_bloodmaul_brutebaneAI(creature); - } -}; - -/*###### -## npc_bloodmaul_brute -######*/ - -enum BloodmaulBrute -{ - EVENT_CLEAVE = 1, - EVENT_DEBILITATING_STRIKE = 2, - SAY_AGGRO = 0, - SAY_DEATH = 1, - SAY_ENRAGE = 2, - SPELL_CLEAVE = 15496, - SPELL_DEBILITATING_STRIKE = 37577, - SPELL_ENRAGE = 8599, - QUEST_INTO_THE_SOULGRINDER = 11000 -}; - -class npc_bloodmaul_brute : public CreatureScript -{ -public: - npc_bloodmaul_brute() : CreatureScript("npc_bloodmaul_brute") { } - - struct npc_bloodmaul_bruteAI : public ScriptedAI - { - npc_bloodmaul_bruteAI(Creature* creature) : ScriptedAI(creature) - { - hp30 = false; - } - - void Reset() override - { - PlayerGUID.Clear(); - hp30 = false; - } - - void EnterCombat(Unit* /*who*/) override - { - if (urand (0, 100) < 35) - Talk(SAY_AGGRO); - - events.ScheduleEvent(EVENT_CLEAVE, urand(9000,12000)); - events.ScheduleEvent(EVENT_DEBILITATING_STRIKE, 15000); - } - - void JustDied(Unit* killer) override - { - if (killer->GetTypeId() == TYPEID_PLAYER) - if (killer->ToPlayer()->GetQuestRewardStatus(QUEST_INTO_THE_SOULGRINDER)) - Talk(SAY_DEATH); - } - - void MoveInLineOfSight(Unit* who) override - { - if (!who || (!who->IsAlive())) - return; - - if (me->IsWithinDistInMap(who, 50.0f)) - { - if (who->GetTypeId() == TYPEID_PLAYER) - if (who->ToPlayer()->GetQuestStatus(QUEST_GETTING_THE_BLADESPIRE_TANKED) == QUEST_STATUS_INCOMPLETE - || who->ToPlayer()->GetQuestStatus(QUEST_BLADESPIRE_KEGGER) == QUEST_STATUS_INCOMPLETE) - PlayerGUID = who->GetGUID(); - } - } - - void MovementInform(uint32 /*type*/, uint32 id) override - { - if (id == 1) - { - if (GameObject* Keg = me->FindNearestGameObject(GO_KEG, 20)) - Keg->Delete(); - - me->HandleEmoteCommand(7); - me->SetReactState(REACT_AGGRESSIVE); - me->GetMotionMaster()->MoveTargetedHome(); - - Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); - Creature* Credit = me->FindNearestCreature(NPC_QUEST_CREDIT, 50, true); - if (player && Credit) - player->KilledMonster(Credit->GetCreatureTemplate(), Credit->GetGUID()); - } - } - - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_CLEAVE: - DoCast(me, SPELL_CLEAVE); - events.ScheduleEvent(EVENT_CLEAVE, urand(9000,12000)); - break; - case EVENT_DEBILITATING_STRIKE: - DoCastVictim(SPELL_DEBILITATING_STRIKE); - events.ScheduleEvent(EVENT_DEBILITATING_STRIKE, urand(18000,22000)); - break; - } - } - - if (!hp30 && HealthBelowPct(30)) - { - hp30 = true; - Talk(SAY_ENRAGE); - DoCast(me, SPELL_ENRAGE); - } - - DoMeleeAttackIfReady(); - } - - private: - EventMap events; - ObjectGuid PlayerGUID; - bool hp30; - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_bloodmaul_bruteAI(creature); - } -}; - /*###### ## npc_nether_drake ######*/ @@ -1193,8 +1026,6 @@ class spell_oscillating_field : public SpellScriptLoader void AddSC_blades_edge_mountains() { - new npc_bloodmaul_brutebane(); - new npc_bloodmaul_brute(); new npc_nether_drake(); new npc_daranelle(); new go_legion_obelisk(); diff --git a/src/server/shared/Database/AdhocStatement.h b/src/server/shared/Database/AdhocStatement.h index 8d9365900d9..8195d9add98 100644 --- a/src/server/shared/Database/AdhocStatement.h +++ b/src/server/shared/Database/AdhocStatement.h @@ -40,4 +40,4 @@ class BasicStatementTask : public SQLOperation QueryResultPromise* m_result; }; -#endif \ No newline at end of file +#endif diff --git a/src/server/shared/Database/Transaction.h b/src/server/shared/Database/Transaction.h index 43850b1d016..a51c96ea93b 100644 --- a/src/server/shared/Database/Transaction.h +++ b/src/server/shared/Database/Transaction.h @@ -61,8 +61,8 @@ class TransactionTask : public SQLOperation friend class DatabaseWorker; public: - TransactionTask(SQLTransaction trans) : m_trans(trans) { } ; - ~TransactionTask(){ }; + TransactionTask(SQLTransaction trans) : m_trans(trans) { } + ~TransactionTask() { } protected: bool Execute() override; diff --git a/src/server/shared/Define.h b/src/server/shared/Define.h index 8b85a08fa80..99c89e584f3 100644 --- a/src/server/shared/Define.h +++ b/src/server/shared/Define.h @@ -78,9 +78,9 @@ #endif //!COREDEBUG #if COMPILER == COMPILER_GNU -# define ATTR_NORETURN __attribute__((noreturn)) -# define ATTR_PRINTF(F, V) __attribute__ ((format (printf, F, V))) -# define ATTR_DEPRECATED __attribute__((deprecated)) +# define ATTR_NORETURN __attribute__((__noreturn__)) +# define ATTR_PRINTF(F, V) __attribute__ ((__format__ (__printf__, F, V))) +# define ATTR_DEPRECATED __attribute__((__deprecated__)) #else //COMPILER != COMPILER_GNU # define ATTR_NORETURN # define ATTR_PRINTF(F, V) diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index ba23d879ec2..31db3ae1b86 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -88,7 +88,7 @@ void Appender::write(LogMessage* message) if (flags & APPENDER_FLAGS_PREFIX_LOGFILTERTYPE) ss << '[' << message->type << "] "; - message->prefix = std::move(ss.str()); + message->prefix = ss.str(); _write(message); } diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index 3892adbe3be..5a8d610a36b 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -55,7 +55,7 @@ void AppenderFile::_write(LogMessage const* message) FILE* file = OpenFile(namebuf, "a", backup || exceedMaxSize); if (!file) return; - fprintf(file, "%s%s", message->prefix.c_str(), message->text.c_str()); + fprintf(file, "%s%s\n", message->prefix.c_str(), message->text.c_str()); fflush(file); fileSize += uint64(message->Size()); fclose(file); diff --git a/src/server/shared/Networking/Socket.h b/src/server/shared/Networking/Socket.h index 396d4bb3aab..1989411bccb 100644 --- a/src/server/shared/Networking/Socket.h +++ b/src/server/shared/Networking/Socket.h @@ -50,6 +50,7 @@ public: virtual ~Socket() { + _closed = true; boost::system::error_code error; _socket.close(error); } @@ -97,26 +98,6 @@ public: std::bind(&Socket::ReadHandlerInternal, this->shared_from_this(), std::placeholders::_1, std::placeholders::_2)); } - void ReadData(std::size_t size) - { - if (!IsOpen()) - return; - - boost::system::error_code error; - - std::size_t bytesRead = boost::asio::read(_socket, boost::asio::buffer(_readBuffer.GetWritePointer(), size), error); - - _readBuffer.WriteCompleted(bytesRead); - - if (error || bytesRead != size) - { - TC_LOG_DEBUG("network", "Socket::ReadData: %s errored with: %i (%s)", GetRemoteIpAddress().to_string().c_str(), error.value(), - error.message().c_str()); - - CloseSocket(); - } - } - void QueuePacket(MessageBuffer&& buffer, std::unique_lock& guard) { _writeQueue.push(std::move(buffer)); diff --git a/src/server/shared/Threading/ProducerConsumerQueue.h b/src/server/shared/Threading/ProducerConsumerQueue.h index ab01568309b..e2f13e5c339 100644 --- a/src/server/shared/Threading/ProducerConsumerQueue.h +++ b/src/server/shared/Threading/ProducerConsumerQueue.h @@ -70,7 +70,9 @@ public: { std::unique_lock lock(_queueLock); - _condition.wait(lock, [this]() { return !_queue.empty() || _shutdown; }); + // we could be using .wait(lock, predicate) overload here but some threading error analysis tools produce false positives + while (_queue.empty() && !_shutdown) + _condition.wait(lock); if (_queue.empty() || _shutdown) return; diff --git a/src/server/shared/Updater/UpdateFetcher.cpp b/src/server/shared/Updater/UpdateFetcher.cpp index 2b12f39780c..a4bdd193743 100644 --- a/src/server/shared/Updater/UpdateFetcher.cpp +++ b/src/server/shared/Updater/UpdateFetcher.cpp @@ -158,7 +158,7 @@ uint32 UpdateFetcher::Update(bool const redundancyChecks, bool const allowRehash { LocaleFileStorage const available = GetFileList(); AppliedFileStorage applied = ReceiveAppliedFiles(); - + // Fill hash to name cache HashToFileNameStorage hashToName; for (auto entry : applied) diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index a46ab082306..425c95711ce 100644 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -690,8 +690,9 @@ class EventMap /** * @name RepeatEvent - * @brief Repeats the mostly recently executed event. - * @param time Time until the event occurs. Equivalent to Repeat(urand(minTime, maxTime). + * @brief Repeats the mostly recently executed event, Equivalent to Repeat(urand(minTime, maxTime). + * @param minTime Minimum time until the event occurs. + * @param maxTime Maximum time until the event occurs. */ void Repeat(uint32 minTime, uint32 maxTime) { @@ -841,7 +842,7 @@ class EventMap /** * @name GetTimeUntilEvent * @brief Returns time in milliseconds until next event. - * @param Id of the event. + * @param eventId of the event. * @return Time of next event. */ uint32 GetTimeUntilEvent(uint32 eventId) const; diff --git a/src/tools/vmap4_extractor/vec3d.h b/src/tools/vmap4_extractor/vec3d.h index a0c22729052..211f5f26c72 100644 --- a/src/tools/vmap4_extractor/vec3d.h +++ b/src/tools/vmap4_extractor/vec3d.h @@ -103,7 +103,7 @@ public: float length() const { - return sqrt(x*x+y*y+z*z); + return std::sqrt(x*x+y*y+z*z); } Vec3D& normalize() @@ -209,7 +209,7 @@ public: float length() const { - return sqrt(x*x+y*y); + return std::sqrt(x*x+y*y); } Vec2D& normalize()