diff --git a/CMakeLists.txt b/CMakeLists.txt index 56ea65e5d7a..90922cd77e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,8 @@ endif() include(CheckPlatform) +include(GroupSources) + # basic packagesearching and setup (further support will be needed, this is a preliminary release!) set(OPENSSL_EXPECTED_VERSION 1.0.0) diff --git a/cmake/macros/GroupSources.cmake b/cmake/macros/GroupSources.cmake new file mode 100644 index 00000000000..3acb03e7b4c --- /dev/null +++ b/cmake/macros/GroupSources.cmake @@ -0,0 +1,46 @@ +# Copyright (C) 2008-2015 TrinityCore +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +macro(GroupSources dir) + # Skip this if WITH_SOURCE_TREE is not set (empty string). + if (NOT ${_WITH_SOURCE_TREE} STREQUAL "") + # Include all header and c files + file(GLOB_RECURSE elements RELATIVE ${dir} *.h *.hpp *.c *.cpp *.cc) + + foreach(element ${elements}) + # Extract filename and directory + get_filename_component(element_name ${element} NAME) + get_filename_component(element_dir ${element} DIRECTORY) + + if (NOT ${element_dir} STREQUAL "") + # If the file is in a subdirectory use it as source group. + if (${_WITH_SOURCE_TREE} STREQUAL "flat") + # Build flat structure by using only the first subdirectory. + string(FIND ${element_dir} "/" delemiter_pos) + if (NOT ${delemiter_pos} EQUAL -1) + string(SUBSTRING ${element_dir} 0 ${delemiter_pos} group_name) + source_group("${group_name}" FILES ${dir}/${element}) + else() + # Build hierarchical structure. + # File is in root directory. + source_group("${element_dir}" FILES ${dir}/${element}) + endif() + else() + # Use the full hierarchical structure to build source_groups. + string(REPLACE "/" "\\" group_name ${element_dir}) + source_group("${group_name}" FILES ${dir}/${element}) + endif() + else() + # If the file is in the root directory, place it in the root source_group. + source_group("\\" FILES ${dir}/${element}) + endif() + endforeach() + endif() +endmacro() diff --git a/cmake/options.cmake b/cmake/options.cmake index 83783fdc1b6..486cc909605 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -15,4 +15,6 @@ option(USE_SCRIPTPCH "Use precompiled headers when compiling scripts" option(USE_COREPCH "Use precompiled headers when compiling servers" 1) option(WITH_WARNINGS "Show all warnings during compile" 0) option(WITH_COREDEBUG "Include additional debug-code in core" 0) +set(WITH_SOURCE_TREE "no" CACHE STRING "Build the source tree for IDE's.") +set_property(CACHE WITH_SOURCE_TREE PROPERTY STRINGS no flat hierarchical) option(WITHOUT_GIT "Disable the GIT testing routines" 0) diff --git a/cmake/showoptions.cmake b/cmake/showoptions.cmake index ea4820a01f0..bb848a2a9c0 100644 --- a/cmake/showoptions.cmake +++ b/cmake/showoptions.cmake @@ -62,6 +62,29 @@ else() message("* Use coreside debug : No (default)") endif() +if( WITH_SOURCE_TREE STREQUAL "flat" OR WITH_SOURCE_TREE STREQUAL "hierarchical" ) + # TODO: Remove this after Debian 8 is released and set general required version to 2.8.12 + # Debian 7 is shipped with CMake 2.8.9 . But DIRECTORY flag of get_filename_component requires 2.8.12 . + if (NOT CMAKE_VERSION VERSION_LESS 2.8.12) + message("* Show source tree : Yes - ${WITH_SOURCE_TREE}") + set(_WITH_SOURCE_TREE ${WITH_SOURCE_TREE} CACHE INTERNAL "WITH_SOURCE_TREE support enabled.") + else() + message("* Show source tree : No (default)") + + message("") + message(" *** WITH_SOURCE_TREE - WARNING!") + message(" *** This functionality is ONLY supported on CMake 2.8.12 or higher.") + message(" *** You are running ${CMAKE_VERSION}, which does not have the functions needed") + message(" *** to create a sourcetree - this option is thus forced to disabled!") + message("") + + set(_WITH_SOURCE_TREE "" CACHE INTERNAL "WITH_SOURCE_TREE support disabled.") + endif() +else() + message("* Show source tree : No (default)") + set(_WITH_SOURCE_TREE "" CACHE INTERNAL "WITH_SOURCE_TREE support disabled.") +endif() + if ( WITHOUT_GIT ) message("* Use GIT revision hash : No") message("") diff --git a/dep/PackageList.txt b/dep/PackageList.txt index 7f571917080..5db9ee46e1d 100644 --- a/dep/PackageList.txt +++ b/dep/PackageList.txt @@ -14,7 +14,7 @@ bzip2 (a freely available, patent free, high-quality data compressor) cppformat (type safe format library) https://github.com/cppformat/cppformat - Version: 1.1.0 bf8636c9596fbfddded3d0f5879abc7579c9f4dd + Version: 1.1.0 fd53bb6fb88a23e38ec4fe331bfe95d7372d49c9 G3D (a commercial-grade C++ 3D engine available as Open Source (BSD License) http://g3d.sourceforge.net/ diff --git a/dep/cppformat/format.cc b/dep/cppformat/format.cc index 86fac25a524..fe4f1b18733 100644 --- a/dep/cppformat/format.cc +++ b/dep/cppformat/format.cc @@ -67,25 +67,7 @@ using fmt::internal::Arg; # if FMT_EXCEPTIONS # define FMT_THROW(x) throw x # else -# ifndef NDEBUG -# define FMT_THROW(x) assert(false && #x) -# elif defined _MSC_VER -# define FMT_THROW(x) __assume(0) -# elif defined __clang__ || FMT_GCC_VERSION >= 405 -# define FMT_THROW(x) __builtin_unreachable() -# else -# define FMT_THROW(x) std::abort() -# endif -# endif -#endif - -#ifndef FMT_NORETURN -# if defined __GNUC__ || defined __clang__ -# define FMT_NORETURN __attribute__((__noreturn__)) -# elif defined _MSC_VER -# define FMT_NORETURN __declspec(noreturn) -# else -# define FMT_NORETURN +# define FMT_THROW(x) assert(false) # endif #endif @@ -176,6 +158,9 @@ int safe_strerror( char *&buffer_; std::size_t buffer_size_; + // A noop assignment operator to avoid bogus warnings. + void operator=(const StrError &) {} + // Handle the result of XSI-compliant version of strerror_r. int handle(int result) { // glibc versions before 2.13 return result in errno. @@ -226,14 +211,14 @@ void format_error_code(fmt::Writer &out, int error_code, // bad_alloc. out.clear(); static const char SEP[] = ": "; - static const char _ERR[] = "error "; + static const char ERROR_STR[] = "error "; fmt::internal::IntTraits::MainType ec_value = error_code; - // Subtract 2 to account for terminating null characters in SEP and _ERR. - std::size_t error_code_size = - sizeof(SEP) + sizeof(_ERR) + fmt::internal::count_digits(ec_value) - 2; + // Subtract 2 to account for terminating null characters in SEP and ERROR_STR. + std::size_t error_code_size = sizeof(SEP) + sizeof(ERROR_STR) - 2; + error_code_size += fmt::internal::count_digits(ec_value); if (message.size() <= fmt::internal::INLINE_BUFFER_SIZE - error_code_size) out << message << SEP; - out << _ERR << error_code; + out << ERROR_STR << error_code; assert(out.size() <= fmt::internal::INLINE_BUFFER_SIZE); } @@ -304,8 +289,7 @@ class WidthHandler : public fmt::internal::ArgVisitor { public: explicit WidthHandler(fmt::FormatSpec &spec) : spec_(spec) {} - FMT_NORETURN - unsigned visit_unhandled_arg() { + void report_unhandled_arg() { FMT_THROW(fmt::FormatError("width is not integer")); } @@ -326,8 +310,7 @@ class WidthHandler : public fmt::internal::ArgVisitor { class PrecisionHandler : public fmt::internal::ArgVisitor { public: - FMT_NORETURN - unsigned visit_unhandled_arg() { + void report_unhandled_arg() { FMT_THROW(fmt::FormatError("precision is not integer")); } diff --git a/dep/cppformat/format.h b/dep/cppformat/format.h index 0a67f3f977d..8d54bf521c7 100644 --- a/dep/cppformat/format.h +++ b/dep/cppformat/format.h @@ -100,6 +100,7 @@ inline uint32_t clzll(uint64_t x) { #endif #ifdef __clang__ +# pragma clang diagnostic push # pragma clang diagnostic ignored "-Wdocumentation" #endif @@ -282,7 +283,6 @@ class FormatError : public std::runtime_error { }; namespace internal { - // The number of characters to store in the MemoryBuffer object itself // to avoid dynamic memory allocation. enum { INLINE_BUFFER_SIZE = 500 }; @@ -297,8 +297,9 @@ inline stdext::checked_array_iterator make_ptr(T *ptr, std::size_t size) { template inline T *make_ptr(T *ptr, std::size_t) { return ptr; } #endif +} // namespace internal -// A buffer for POD types. It supports a subset of std::vector's operations. +/** A buffer supporting a subset of ``std::vector``'s operations. */ template class Buffer { private: @@ -312,25 +313,31 @@ class Buffer { Buffer(T *ptr = 0, std::size_t capacity = 0) : ptr_(ptr), size_(0), capacity_(capacity) {} + /** + Increases the buffer capacity to hold at least *size* elements updating + ``ptr_`` and ``capacity_``. + */ virtual void grow(std::size_t size) = 0; public: virtual ~Buffer() {} - // Returns the size of this buffer. + /** Returns the size of this buffer. */ std::size_t size() const { return size_; } - // Returns the capacity of this buffer. + /** Returns the capacity of this buffer. */ std::size_t capacity() const { return capacity_; } - // Resizes the buffer. If T is a POD type new elements are not initialized. + /** + Resizes the buffer. If T is a POD type new elements may not be initialized. + */ void resize(std::size_t new_size) { if (new_size > capacity_) grow(new_size); size_ = new_size; } - // Reserves space to store at least capacity elements. + /** Reserves space to store at least *capacity* elements. */ void reserve(std::size_t capacity) { if (capacity > capacity_) grow(capacity); @@ -344,7 +351,7 @@ class Buffer { ptr_[size_++] = value; } - // Appends data to the end of the buffer. + /** Appends data to the end of the buffer. */ void append(const T *begin, const T *end); T &operator[](std::size_t index) { return ptr_[index]; } @@ -356,10 +363,12 @@ void Buffer::append(const T *begin, const T *end) { std::ptrdiff_t num_elements = end - begin; if (size_ + num_elements > capacity_) grow(size_ + num_elements); - std::copy(begin, end, make_ptr(ptr_, capacity_) + size_); + std::copy(begin, end, internal::make_ptr(ptr_, capacity_) + size_); size_ += num_elements; } +namespace internal { + // A memory buffer for POD types with the first SIZE elements stored in // the object itself. template > @@ -438,10 +447,9 @@ void MemoryBuffer::grow(std::size_t size) { // A fixed-size buffer. template -class FixedBuffer : public fmt::internal::Buffer { +class FixedBuffer : public fmt::Buffer { public: - FixedBuffer(Char *array, std::size_t size) - : fmt::internal::Buffer(array, size) {} + FixedBuffer(Char *array, std::size_t size) : fmt::Buffer(array, size) {} protected: void grow(std::size_t size); @@ -692,21 +700,16 @@ void format_windows_error(fmt::Writer &out, int error_code, fmt::StringRef message) FMT_NOEXCEPT; #endif -// Computes max(Arg, 1) at compile time. It is used to avoid errors about +// Computes max(N, 1) at compile time. It is used to avoid errors about // allocating an array of 0 size. -template +template struct NonZero { - enum { VALUE = Arg }; + enum { VALUE = N > 0 ? N : 1 }; }; -template <> -struct NonZero<0> { - enum { VALUE = 1 }; -}; - -// The value of a formatting argument. It is a POD type to allow storage in +// A formatting argument. It is a POD type to allow storage in // internal::MemoryBuffer. -struct Value { +struct Arg { template struct StringValue { const Char *value; @@ -735,9 +738,7 @@ struct Value { StringValue wstring; CustomValue custom; }; -}; -struct Arg : Value { enum Type { NONE, // Integer types should go first, @@ -781,15 +782,31 @@ class IsConvertibleToInt { enum { value = (sizeof(check(get())) == sizeof(yes)) }; }; +#define FMT_CONVERTIBLE_TO_INT(Type) \ + template <> \ + class IsConvertibleToInt { \ + public: \ + enum { value = 1 }; \ + } + +// Silence warnings about convering float to int. +FMT_CONVERTIBLE_TO_INT(float); +FMT_CONVERTIBLE_TO_INT(double); +FMT_CONVERTIBLE_TO_INT(long double); + template struct EnableIf {}; template struct EnableIf { typedef T type; }; -// Makes a Value object from any type. +// A helper function to suppress bogus "conditional expression is constant" +// warnings. +inline bool check(bool value) { return value; } + +// Makes an Arg object from any type. template -class MakeValue : public Value { +class MakeValue : public Arg { private: // The following two methods are private to disallow formatting of // arbitrary pointers. If you want to output a pointer cast it to @@ -846,7 +863,7 @@ class MakeValue : public Value { MakeValue(long value) { // To minimize the number of types we need to deal with, long is // translated either to int or to long long depending on its size. - if (sizeof(long) == sizeof(int)) + if (check(sizeof(long) == sizeof(int))) int_value = static_cast(value); else long_long_value = value; @@ -856,7 +873,7 @@ class MakeValue : public Value { } MakeValue(unsigned long value) { - if (sizeof(unsigned long) == sizeof(unsigned)) + if (check(sizeof(unsigned long) == sizeof(unsigned))) uint_value = static_cast(value); else ulong_long_value = value; @@ -949,7 +966,12 @@ class MakeValue : public Value { template class ArgVisitor { public: - Result visit_unhandled_arg() { return Result(); } + void report_unhandled_arg() {} + + Result visit_unhandled_arg() { + FMT_DISPATCH(report_unhandled_arg()); + return Result(); + } Result visit_int(int value) { return FMT_DISPATCH(visit_any_int(value)); @@ -1015,7 +1037,7 @@ class ArgVisitor { case Arg::CHAR: return FMT_DISPATCH(visit_char(arg.int_value)); case Arg::CSTRING: { - Value::StringValue str = arg.string; + Arg::StringValue str = arg.string; str.size = 0; return FMT_DISPATCH(visit_string(str)); } @@ -1040,42 +1062,49 @@ template class ArgFormatter; } // namespace internal -/** - An argument list. - */ +/** An argument list. */ class ArgList { private: + // To reduce compiled code size per formatting function call, types of first + // MAX_PACKED_ARGS arguments are passed in the types_ field. uint64_t types_; - const internal::Value *values_; + const internal::Arg *args_; + + internal::Arg::Type type(unsigned index) const { + unsigned shift = index * 4; + uint64_t mask = 0xf; + return static_cast( + (types_ & (mask << shift)) >> shift); + } public: - // Maximum number of arguments that can be passed in ArgList. - enum { MAX_ARGS = 16 }; + // Maximum number of arguments with packed types. + enum { MAX_PACKED_ARGS = 16 }; ArgList() : types_(0) {} - ArgList(ULongLong types, const internal::Value *values) - : types_(types), values_(values) {} + ArgList(ULongLong types, const internal::Arg *args) + : types_(types), args_(args) {} - /** - Returns the argument at specified index. - */ + /** Returns the argument at specified index. */ internal::Arg operator[](unsigned index) const { using internal::Arg; Arg arg; - if (index >= MAX_ARGS) { + if (index < MAX_PACKED_ARGS) { + Arg::Type arg_type = type(index); + if (arg_type != Arg::NONE) + arg = args_[index]; + arg.type = arg_type; + return arg; + } + if (type(MAX_PACKED_ARGS - 1) == Arg::NONE) { arg.type = Arg::NONE; return arg; } - unsigned shift = index * 4; - uint64_t mask = 0xf; - Arg::Type type = - static_cast((types_ & (mask << shift)) >> shift); - arg.type = type; - if (type != Arg::NONE) { - internal::Value &value = arg; - value = values_[index]; + for (unsigned i = MAX_PACKED_ARGS; i <= index; ++i) { + if (args_[i].type == Arg::NONE) + return args_[i]; } - return arg; + return args_[index]; } }; @@ -1434,11 +1463,11 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) { # define FMT_VARIADIC_VOID(func, arg_type) \ template \ void func(arg_type arg1, const Args & ... args) { \ - const fmt::internal::Value values[ \ + const fmt::internal::Arg array[ \ fmt::internal::NonZero::VALUE] = { \ fmt::internal::MakeValue(args)... \ }; \ - func(arg1, ArgList(fmt::internal::make_type(args...), values)); \ + func(arg1, ArgList(fmt::internal::make_type(args...), array)); \ } // Defines a variadic constructor. @@ -1446,11 +1475,11 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) { template \ ctor(arg0_type arg0, arg1_type arg1, const Args & ... args) { \ using fmt::internal::MakeValue; \ - const fmt::internal::Value values[ \ + const fmt::internal::Arg array[ \ fmt::internal::NonZero::VALUE] = { \ MakeValue(args)... \ }; \ - func(arg0, arg1, ArgList(fmt::internal::make_type(args...), values)); \ + func(arg0, arg1, ArgList(fmt::internal::make_type(args...), array)); \ } #else @@ -1463,9 +1492,9 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) { # define FMT_WRAP1(func, arg_type, n) \ template \ inline void func(arg_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) { \ - const fmt::internal::Value vals[] = {FMT_GEN(n, FMT_MAKE_REF)}; \ + const fmt::internal::Arg args[] = {FMT_GEN(n, FMT_MAKE_REF)}; \ func(arg1, fmt::ArgList( \ - fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), vals)); \ + fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), args)); \ } // Emulates a variadic function returning void on a pre-C++11 compiler. @@ -1480,9 +1509,9 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) { # define FMT_CTOR(ctor, func, arg0_type, arg1_type, n) \ template \ ctor(arg0_type arg0, arg1_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) { \ - const fmt::internal::Value vals[] = {FMT_GEN(n, FMT_MAKE_REF)}; \ + const fmt::internal::Arg args[] = {FMT_GEN(n, FMT_MAKE_REF)}; \ func(arg0, arg1, fmt::ArgList( \ - fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), vals)); \ + fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), args)); \ } // Emulates a variadic constructor on a pre-C++11 compiler. @@ -1592,7 +1621,7 @@ template class BasicWriter { private: // Output buffer. - internal::Buffer &buffer_; + Buffer &buffer_; FMT_DISALLOW_COPY_AND_ASSIGN(BasicWriter); @@ -1672,7 +1701,7 @@ class BasicWriter { /** Constructs a ``BasicWriter`` object. */ - explicit BasicWriter(internal::Buffer &b) : buffer_(b) {} + explicit BasicWriter(Buffer &b) : buffer_(b) {} public: /** @@ -2275,10 +2304,8 @@ template void format(BasicFormatter &f, const Char *&format_str, const T &value) { std::basic_ostringstream os; os << value; - internal::Arg arg; - internal::Value &arg_value = arg; std::basic_string str = os.str(); - arg_value = internal::MakeValue(str); + internal::Arg arg = internal::MakeValue(str); arg.type = static_cast( internal::MakeValue::type(str)); format_str = f.format(format_str, arg); @@ -2575,16 +2602,46 @@ inline void format_decimal(char *&buffer, T value) { #define FMT_GET_ARG_NAME(type, index) arg##index #if FMT_USE_VARIADIC_TEMPLATES + +namespace fmt { +namespace internal { +inline void do_set_types(Arg *) {} + +template +inline void do_set_types(Arg *args, const T &arg, const Args & ... tail) { + args->type = static_cast(MakeValue::type(arg)); + do_set_types(args + 1, tail...); +} + +template +inline void set_types(Arg *array, const Args & ... args) { + do_set_types(array, args...); + array[sizeof...(Args)].type = Arg::NONE; +} + +// Computes the argument array size by adding 1 to N, which is the number of +// arguments, if N is zero, because array of zero size is invalid, or if N +// is greater than ArgList::MAX_PACKED_ARGS to accommodate for an extra +// argument that marks the end of the list. +template +struct ArgArraySize { + enum { VALUE = N + (N == 0 || N > ArgList::MAX_PACKED_ARGS ? 1 : 0) }; +}; +} +} + # define FMT_VARIADIC_(Char, ReturnType, func, call, ...) \ template \ ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), \ const Args & ... args) { \ - using fmt::internal::Value; \ - const Value values[fmt::internal::NonZero::VALUE] = { \ + using fmt::internal::Arg; \ + Arg array[fmt::internal::ArgArraySize::VALUE] = { \ fmt::internal::MakeValue(args)... \ }; \ - call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), fmt::ArgList( \ - fmt::internal::make_type(args...), values)); \ + if (fmt::internal::check((sizeof...(Args) > fmt::ArgList::MAX_PACKED_ARGS))) \ + set_types(array, args...); \ + call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), \ + fmt::ArgList(fmt::internal::make_type(args...), array)); \ } #else // Defines a wrapper for a function taking __VA_ARGS__ arguments @@ -2593,9 +2650,9 @@ inline void format_decimal(char *&buffer, T value) { template \ inline ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), \ FMT_GEN(n, FMT_MAKE_ARG)) { \ - const fmt::internal::Value vals[] = {FMT_GEN(n, FMT_MAKE_REF_##Char)}; \ + const fmt::internal::Arg args[] = {FMT_GEN(n, FMT_MAKE_REF_##Char)}; \ call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), fmt::ArgList( \ - fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), vals)); \ + fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), args)); \ } # define FMT_VARIADIC_(Char, ReturnType, func, call, ...) \ diff --git a/sql/updates/world/2015_04_07_01_world.sql b/sql/updates/world/2015_04_07_01_world.sql new file mode 100644 index 00000000000..e000a43fe1c --- /dev/null +++ b/sql/updates/world/2015_04_07_01_world.sql @@ -0,0 +1,21 @@ +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/authserver/CMakeLists.txt b/src/server/authserver/CMakeLists.txt index 994a645c528..7c76df5d06c 100644 --- a/src/server/authserver/CMakeLists.txt +++ b/src/server/authserver/CMakeLists.txt @@ -66,6 +66,8 @@ include_directories( ${VALGRIND_INCLUDE_DIR} ) +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + add_executable(authserver ${authserver_SRCS} ${authserver_PCH_SRC} diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 26f1c872150..c748e9d28a8 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -34,9 +34,7 @@ #include "RealmList.h" #include "SystemConfig.h" #include "Util.h" -#include #include -#include #include #include #include diff --git a/src/server/collision/CMakeLists.txt b/src/server/collision/CMakeLists.txt index 84f7de76543..f0f5cef5985 100644 --- a/src/server/collision/CMakeLists.txt +++ b/src/server/collision/CMakeLists.txt @@ -81,6 +81,8 @@ include_directories( ${VALGRIND_INCLUDE_DIR} ) +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + add_library(collision STATIC ${collision_STAT_SRCS} ${collision_STAT_PCH_SRC} diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp index f85fceb7b39..f9fcff96ad2 100644 --- a/src/server/collision/Management/VMapManager2.cpp +++ b/src/server/collision/Management/VMapManager2.cpp @@ -236,9 +236,11 @@ namespace VMAP { floor = info.ground_Z; ASSERT(floor < std::numeric_limits::max()); + ASSERT(info.hitModel); type = info.hitModel->GetLiquidType(); // entry from LiquidType.dbc if (reqLiquidType && !(GetLiquidFlagsPtr(type) & reqLiquidType)) return false; + ASSERT(info.hitInstance); if (info.hitInstance->GetLiquidLevel(pos, info, level)) return true; } diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index 172c556b9a7..c5d7443ce68 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -24,7 +24,6 @@ #include #include #include -#include using G3D::Vector3; using G3D::AABox; diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index 05bd5d360c6..0355d2e848c 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -24,8 +24,6 @@ #include "GameObjectModel.h" #include "Log.h" #include "GameObject.h" -#include "Creature.h" -#include "TemporarySummon.h" #include "Object.h" #include "DBCStores.h" #include "World.h" diff --git a/src/server/collision/Models/ModelInstance.cpp b/src/server/collision/Models/ModelInstance.cpp index 025352eeb58..45440a99666 100644 --- a/src/server/collision/Models/ModelInstance.cpp +++ b/src/server/collision/Models/ModelInstance.cpp @@ -19,7 +19,6 @@ #include "ModelInstance.h" #include "WorldModel.h" #include "MapTree.h" -#include "VMapDefinitions.h" using G3D::Vector3; using G3D::Ray; diff --git a/src/server/collision/Models/WorldModel.cpp b/src/server/collision/Models/WorldModel.cpp index 3af120045cb..86ab9366c71 100644 --- a/src/server/collision/Models/WorldModel.cpp +++ b/src/server/collision/Models/WorldModel.cpp @@ -17,7 +17,6 @@ */ #include "WorldModel.h" -#include "ModelInstance.h" #include "VMapDefinitions.h" #include "MapTree.h" diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp index 14e5faaf723..7fd1493cbde 100644 --- a/src/server/game/AI/CoreAI/GuardAI.cpp +++ b/src/server/game/AI/CoreAI/GuardAI.cpp @@ -19,9 +19,6 @@ #include "GuardAI.h" #include "Errors.h" #include "Player.h" -#include "ObjectAccessor.h" -#include "World.h" -#include "CreatureAIImpl.h" int GuardAI::Permissible(Creature const* creature) { diff --git a/src/server/game/AI/CoreAI/PassiveAI.cpp b/src/server/game/AI/CoreAI/PassiveAI.cpp index fb16d39dab3..5c482120b21 100644 --- a/src/server/game/AI/CoreAI/PassiveAI.cpp +++ b/src/server/game/AI/CoreAI/PassiveAI.cpp @@ -18,7 +18,6 @@ #include "PassiveAI.h" #include "Creature.h" -#include "TemporarySummon.h" PassiveAI::PassiveAI(Creature* c) : CreatureAI(c) { me->SetReactState(REACT_PASSIVE); } PossessedAI::PossessedAI(Creature* c) : CreatureAI(c) { me->SetReactState(REACT_PASSIVE); } diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index f532e4cd862..abb6126ca2c 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -20,12 +20,10 @@ #include "Errors.h" #include "Pet.h" #include "Player.h" -#include "DBCStores.h" #include "Spell.h" #include "ObjectAccessor.h" #include "SpellMgr.h" #include "Creature.h" -#include "World.h" #include "Util.h" #include "Group.h" #include "SpellInfo.h" diff --git a/src/server/game/AI/CoreAI/ReactorAI.cpp b/src/server/game/AI/CoreAI/ReactorAI.cpp index ebb57038737..9ab86047dc8 100644 --- a/src/server/game/AI/CoreAI/ReactorAI.cpp +++ b/src/server/game/AI/CoreAI/ReactorAI.cpp @@ -18,10 +18,6 @@ #include "ByteBuffer.h" #include "ReactorAI.h" -#include "Errors.h" -#include "Log.h" -#include "ObjectAccessor.h" -#include "CreatureAIImpl.h" int ReactorAI::Permissible(const Creature* creature) { diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp index 533bfa90d96..9a16d2303b2 100644 --- a/src/server/game/AI/CoreAI/TotemAI.cpp +++ b/src/server/game/AI/CoreAI/TotemAI.cpp @@ -19,10 +19,8 @@ #include "TotemAI.h" #include "Totem.h" #include "Creature.h" -#include "DBCStores.h" #include "ObjectAccessor.h" #include "SpellMgr.h" - #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp index 9d025e3c2e2..07bd49bdcc6 100644 --- a/src/server/game/AI/CreatureAISelector.cpp +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -21,7 +21,6 @@ #include "PassiveAI.h" #include "MovementGenerator.h" -#include "Pet.h" #include "TemporarySummon.h" #include "CreatureAIFactory.h" #include "ScriptMgr.h" diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 7b17f2268fe..3da37811e93 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -17,14 +17,12 @@ */ #include "ScriptedCreature.h" -#include "Item.h" #include "Spell.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "Cell.h" #include "CellImpl.h" #include "ObjectMgr.h" -#include "TemporarySummon.h" // Spell summary for ScriptedAI::SelectSpell struct TSpellSummary diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 76f08952664..20a7ca05d93 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -21,11 +21,7 @@ #include "GridDefines.h" #include "GridNotifiers.h" #include "SpellMgr.h" -#include "GridNotifiersImpl.h" #include "Cell.h" -#include "CellImpl.h" -#include "InstanceScript.h" -#include "ScriptedCreature.h" #include "Group.h" #include "SmartAI.h" #include "ScriptMgr.h" diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 53b906ff1d9..612ce923163 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -35,7 +35,6 @@ #include "SmartScript.h" #include "SpellMgr.h" #include "Vehicle.h" -#include "MoveSplineInit.h" #include "GameEventMgr.h" SmartScript::SmartScript() diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 72926ce7396..8d5d59e2566 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -17,18 +17,12 @@ #include "DatabaseEnv.h" #include "ObjectMgr.h" -#include "ObjectDefines.h" #include "GridDefines.h" #include "GridNotifiers.h" #include "SpellMgr.h" -#include "GridNotifiersImpl.h" #include "Cell.h" -#include "CellImpl.h" -#include "InstanceScript.h" -#include "ScriptedCreature.h" #include "GameEventMgr.h" #include "CreatureTextMgr.h" -#include "SpellMgr.h" #include "SpellInfo.h" #include "SmartScriptMgr.h" diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index f50dd26ac8f..e6f3e136cb8 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -30,7 +30,6 @@ #include "Item.h" #include "Language.h" #include "Log.h" -#include enum eAuctionHouse { diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 744dce5e925..b24c59512c7 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -21,7 +21,6 @@ #include "CellImpl.h" #include "CreatureTextMgr.h" #include "GridNotifiers.h" -#include "GridNotifiersImpl.h" #include "Group.h" #include "GroupMgr.h" #include "Map.h" diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp index 099835e5396..9cac42b88c7 100644 --- a/src/server/game/Battlefield/BattlefieldMgr.cpp +++ b/src/server/game/Battlefield/BattlefieldMgr.cpp @@ -17,7 +17,6 @@ #include "BattlefieldMgr.h" #include "BattlefieldWG.h" -#include "ObjectMgr.h" #include "Player.h" BattlefieldMgr::BattlefieldMgr() diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 869561eade4..f3b3eaec433 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -28,12 +28,10 @@ #include "Group.h" #include "GuildMgr.h" #include "Guild.h" -#include "MapManager.h" #include "Object.h" #include "ObjectMgr.h" #include "Player.h" #include "ReputationMgr.h" -#include "SpellAuraEffects.h" #include "SpellAuras.h" #include "Util.h" #include "WorldPacket.h" diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index bd4e98c09b4..e50ee597307 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -22,7 +22,6 @@ #include "World.h" #include "WorldPacket.h" -#include "ArenaTeam.h" #include "BattlegroundMgr.h" #include "BattlegroundAV.h" #include "BattlegroundAB.h" @@ -39,7 +38,6 @@ #include "BattlegroundBFG.h" #include "Chat.h" #include "Map.h" -#include "MapInstanced.h" #include "MapManager.h" #include "Player.h" #include "GameEventMgr.h" diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 27157cb2982..ee29fa9eef7 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -24,8 +24,8 @@ #include "Group.h" #include "Log.h" #include "Language.h" -#include "ObjectMgr.h" #include "Player.h" +#include "ObjectAccessor.h" /*********************************************************/ /*** BATTLEGROUND QUEUE SYSTEM ***/ diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 1c003dd309b..0052a0caf2a 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -17,9 +17,7 @@ */ #include "BattlegroundAB.h" -#include "World.h" #include "WorldPacket.h" -#include "ObjectMgr.h" #include "BattlegroundMgr.h" #include "Creature.h" #include "Language.h" diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index adec9ec9255..1bc26f764b5 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -26,7 +26,6 @@ #include "Language.h" #include "Player.h" #include "ScriptedCreature.h" -#include "SpellAuras.h" #include "WorldSession.h" BattlegroundAV::BattlegroundAV() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 6bf8d29c3b6..931e156821d 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -18,7 +18,6 @@ #include "BattlegroundEY.h" #include "ObjectMgr.h" -#include "World.h" #include "WorldPacket.h" #include "BattlegroundMgr.h" #include "Creature.h" diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 502061ac5f3..58294d4305e 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -25,7 +25,6 @@ #include "ObjectMgr.h" #include "Vehicle.h" #include "Transport.h" -#include "WorldSession.h" #include "ScriptedCreature.h" BattlegroundIC::BattlegroundIC() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index e222abfac7b..97cdfab5f2a 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -23,7 +23,6 @@ #include "Player.h" #include "ScriptedCreature.h" #include "WorldPacket.h" -#include "WorldSession.h" BattlegroundSA::BattlegroundSA() { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index ec372de56c4..db612d0c669 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -17,14 +17,12 @@ */ #include "BattlegroundWS.h" -#include "Creature.h" #include "GameObject.h" #include "Language.h" #include "Object.h" #include "ObjectMgr.h" #include "BattlegroundMgr.h" #include "Player.h" -#include "World.h" #include "WorldPacket.h" // these variables aren't used outside of this file, so declare them only here diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt index 1473550983c..4a909869955 100644 --- a/src/server/game/CMakeLists.txt +++ b/src/server/game/CMakeLists.txt @@ -212,6 +212,8 @@ include_directories( ${ZMQ_INCLUDE_DIR} ) +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + add_library(game STATIC ${game_STAT_SRCS} ${game_STAT_PCH_SRC} diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 2b2d776b486..af337ee2e29 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -32,7 +32,6 @@ #include "Opcodes.h" #include "Player.h" #include "UpdateMask.h" -#include "SpellMgr.h" #include "ScriptMgr.h" #include "ChatLink.h" diff --git a/src/server/game/Combat/HostileRefManager.cpp b/src/server/game/Combat/HostileRefManager.cpp index 85afdf64607..245cc77eec3 100644 --- a/src/server/game/Combat/HostileRefManager.cpp +++ b/src/server/game/Combat/HostileRefManager.cpp @@ -20,7 +20,6 @@ #include "ThreatManager.h" #include "Unit.h" #include "DBCStructure.h" -#include "SpellMgr.h" #include "SpellInfo.h" HostileRefManager::~HostileRefManager() diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 1f928c76da6..ef64aa05a42 100644 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -19,8 +19,6 @@ #include "ThreatManager.h" #include "Unit.h" #include "Creature.h" -#include "CreatureAI.h" -#include "Map.h" #include "Player.h" #include "ObjectAccessor.h" #include "UnitEvents.h" diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index c9bb4cf871a..639ff0e2b1b 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -49,6 +49,7 @@ struct WMOAreaTableTripple }; typedef std::map WMOAreaInfoByTripple; +typedef std::multimap CharSectionsMap; DBCStorage sAreaStore(AreaTableEntryfmt); DBCStorage sAreaGroupStore(AreaGroupEntryfmt); @@ -69,6 +70,8 @@ DBCStorage sBattlemasterListStore(BattlemasterListEntryf DBCStorage sBarberShopStyleStore(BarberShopStyleEntryfmt); DBCStorage sCharStartOutfitStore(CharStartOutfitEntryfmt); std::map sCharStartOutfitMap; +DBCStorage sCharSectionsStore(CharSectionsEntryfmt); +CharSectionsMap sCharSectionMap; DBCStorage sCharTitlesStore(CharTitlesEntryfmt); DBCStorage sChatChannelsStore(ChatChannelsEntryfmt); DBCStorage sChrClassesStore(ChrClassesEntryfmt); @@ -360,6 +363,12 @@ void LoadDBCStores(const std::string& dataPath) if (CharStartOutfitEntry const* outfit = sCharStartOutfitStore.LookupEntry(i)) sCharStartOutfitMap[outfit->Race | (outfit->Class << 8) | (outfit->Gender << 16)] = outfit; + LoadDBC(availableDbcLocales, bad_dbc_files, sCharSectionsStore, dbcPath, "CharSections.dbc"); + for (uint32 i = 0; i < sCharSectionsStore.GetNumRows(); ++i) + if (CharSectionsEntry const* entry = sCharSectionsStore.LookupEntry(i)) + if (entry->Race && ((1 << (entry->Race - 1)) & RACEMASK_ALL_PLAYABLE) != 0) //ignore Nonplayable races + sCharSectionMap.insert({ entry->GenType | (entry->Gender << 8) | (entry->Race << 16), entry }); + LoadDBC(availableDbcLocales, bad_dbc_files, sCharTitlesStore, dbcPath, "CharTitles.dbc");//15595 LoadDBC(availableDbcLocales, bad_dbc_files, sChatChannelsStore, dbcPath, "ChatChannels.dbc");//15595 LoadDBC(availableDbcLocales, bad_dbc_files, sChrClassesStore, dbcPath, "ChrClasses.dbc");//15595 @@ -1132,6 +1141,18 @@ CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, ui return itr->second; } +CharSectionsEntry const* GetCharSectionEntry(uint8 race, CharSectionType genType, uint8 gender, uint8 type, uint8 color) +{ + std::pair eqr = sCharSectionMap.equal_range(uint32(genType) | uint32(gender << 8) | uint32(race << 16)); + for (CharSectionsMap::const_iterator itr = eqr.first; itr != eqr.second; ++itr) + { + if (itr->second->Type == type && itr->second->Color == color) + return itr->second; + } + + return NULL; +} + uint32 GetPowerIndexByClass(uint32 powerType, uint32 classId) { return PowersByClass[classId][powerType]; diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index c0666652f6b..c980eac6456 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -77,6 +77,7 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 lev PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id); CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, uint8 gender); +CharSectionsEntry const* GetCharSectionEntry(uint8 race, CharSectionType genType, uint8 gender, uint8 type, uint8 color); uint32 GetPowerIndexByClass(uint32 powerType, uint32 classId); LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty); @@ -103,6 +104,7 @@ extern DBCStorage sBarberShopStyleStore; extern DBCStorage sBattlemasterListStore; extern DBCStorage sChatChannelsStore; extern DBCStorage sCharStartOutfitStore; +extern DBCStorage sCharSectionsStore; extern DBCStorage sCharTitlesStore; extern DBCStorage sChrClassesStore; extern DBCStorage sChrRacesStore; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 974b22eb259..dcbd172b8e0 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -684,6 +684,33 @@ struct CharStartOutfitEntry uint32 PetFamilyEntry; // 78 Pet Family Entry for starting pet }; +enum CharSectionFlags +{ + SECTION_FLAG_PLAYER = 0x01, + SECTION_FLAG_DEATH_KNIGHT = 0x04 +}; + +enum CharSectionType +{ + SECTION_TYPE_SKIN = 0, + SECTION_TYPE_FACE = 1, + SECTION_TYPE_FACIAL_HAIR = 2, + SECTION_TYPE_HAIR = 3, + SECTION_TYPE_UNDERWEAR = 4 +}; + +struct CharSectionsEntry +{ + //uint32 Id; + uint32 Race; + uint32 Gender; + uint32 GenType; + //char* TexturePath[3]; + uint32 Flags; + uint32 Type; + uint32 Color; +}; + struct CharTitlesEntry { uint32 ID; // 0, title ids, for example in Quest::GetCharTitleId() diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index 168c74da2f7..34e3e121b79 100644 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -37,6 +37,7 @@ char const BannedAddOnsfmt[] = "nxxxxxxxxxx"; char const BarberShopStyleEntryfmt[] = "nixxxiii"; char const BattlemasterListEntryfmt[] = "niiiiiiiiixsiiiixxxx"; char const CharStartOutfitEntryfmt[] = "dbbbXiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxii"; +char const CharSectionsEntryfmt[] = "diiixxxiii"; char const CharTitlesEntryfmt[] = "nxssix"; char const ChatChannelsEntryfmt[] = "nixsx"; char const ChrClassesEntryfmt[] = "nixsxxxixiiiii"; diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 35724212146..aeacfc9deb1 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -21,7 +21,6 @@ #include "DisableMgr.h" #include "ObjectMgr.h" #include "SocialMgr.h" -#include "Language.h" #include "LFGMgr.h" #include "LFGScripts.h" #include "LFGGroupData.h" @@ -1269,6 +1268,14 @@ 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/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index 82ac2f3ab33..e396271d999 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -23,9 +23,6 @@ #include "LFGQueue.h" #include "LFGMgr.h" #include "Log.h" -#include "ObjectMgr.h" -#include "World.h" -#include "GroupMgr.h" namespace lfg { diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 1f746057a17..c8b6dc4f42b 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -22,9 +22,6 @@ #include "UpdateMask.h" #include "ObjectAccessor.h" #include "DatabaseEnv.h" -#include "Opcodes.h" -#include "GossipDef.h" -#include "World.h" Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type) { diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 97a8d110c35..19e7d627389 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -34,12 +34,9 @@ #include "InstanceScript.h" #include "Log.h" #include "LootMgr.h" -#include "MapManager.h" #include "MoveSpline.h" -#include "MoveSplineInit.h" #include "ObjectMgr.h" #include "Opcodes.h" -#include "OutdoorPvPMgr.h" #include "Player.h" #include "PoolMgr.h" #include "QuestDef.h" @@ -48,10 +45,8 @@ #include "TemporarySummon.h" #include "Util.h" #include "Vehicle.h" -#include "WaypointMovementGenerator.h" #include "World.h" #include "WorldPacket.h" - #include "Transport.h" TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const @@ -2231,12 +2226,7 @@ void Creature::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs continue; uint32 unSpellId = m_spells[i]; - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(unSpellId); - if (!spellInfo) - { - ASSERT(spellInfo); - continue; - } + SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(unSpellId); // Not send cooldown for this spells if (spellInfo->IsCooldownStartedOnEvent()) diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index 22fdbc9626b..26f889e104c 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -19,7 +19,6 @@ #include "Log.h" #include "ObjectAccessor.h" #include "CreatureAI.h" -#include "ObjectMgr.h" #include "TemporarySummon.h" #include "Pet.h" #include "Player.h" diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index aa90e7edb5f..1d436e72d82 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -18,12 +18,10 @@ #include "Common.h" #include "UpdateMask.h" -#include "Opcodes.h" #include "World.h" #include "ObjectAccessor.h" #include "DatabaseEnv.h" #include "GridNotifiers.h" -#include "CellImpl.h" #include "GridNotifiersImpl.h" #include "ScriptMgr.h" #include "Transport.h" diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 37eeb290b1e..83f80e32c21 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -20,7 +20,6 @@ #include "Battleground.h" #include "CellImpl.h" #include "CreatureAISelector.h" -#include "DynamicTree.h" #include "GameObjectModel.h" #include "GridNotifiersImpl.h" #include "Group.h" @@ -33,7 +32,6 @@ #include "UpdateFieldFlags.h" #include "World.h" #include "Transport.h" -#include GameObject::GameObject() : WorldObject(false), MapObject(), m_model(NULL), m_goValue(), m_AI(NULL) diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 1e2a3d81d17..18ae5792795 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -675,6 +675,7 @@ void Object::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* targe uint32* flags = NULL; uint32 visibleFlag = GetUpdateFieldData(target, flags); + ASSERT(flags); for (uint16 index = 0; index < m_valuesCount; ++index) { diff --git a/src/server/game/Entities/Object/ObjectGuid.cpp b/src/server/game/Entities/Object/ObjectGuid.cpp index a4048c56110..036f50511cb 100644 --- a/src/server/game/Entities/Object/ObjectGuid.cpp +++ b/src/server/game/Entities/Object/ObjectGuid.cpp @@ -18,7 +18,6 @@ #include "ObjectGuid.h" #include "World.h" -#include "ObjectMgr.h" #include #include diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 2f6e3d593c2..47bf519de67 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -26,7 +26,6 @@ #include "Formulas.h" #include "SpellAuras.h" #include "SpellAuraEffects.h" -#include "CreatureAI.h" #include "Unit.h" #include "Util.h" #include "Group.h" diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ec5e6cd2735..93a6b14ad3a 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -978,8 +978,6 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) { //FIXME: outfitId not used in player creating /// @todo need more checks against packet modifications - // should check that skin, face, hair* are valid via DBC per race/class - // also do it in Player::BuildEnumData, Player::LoadFromDB Object::_Create(guidlow, 0, HIGHGUID_PLAYER); @@ -1021,6 +1019,13 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) return false; } + if (!ValidateAppearance(createInfo->Race, createInfo->Class, createInfo->Gender, createInfo->HairStyle, createInfo->HairColor, createInfo->Face, createInfo->FacialHair, createInfo->Skin, true)) + { + TC_LOG_ERROR("entities.player", "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with invalid appearance attributes - refusing to do so", + GetSession()->GetAccountId(), m_name.c_str()); + return false; + } + uint32 RaceClassGender = (createInfo->Race) | (createInfo->Class << 8) | (createInfo->Gender << 16); SetUInt32Value(UNIT_FIELD_BYTES_0, (RaceClassGender | (powertype << 24))); @@ -1987,6 +1992,24 @@ bool Player::BuildEnumData(PreparedQueryResult result, ByteBuffer* dataBuffer, B uint32 atLoginFlags = fields[15].GetUInt16(); Tokenizer equipment(fields[19].GetString(), ' '); uint8 slot = fields[21].GetUInt8(); + uint32 playerBytes2 = fields[6].GetUInt32(); + + uint16 atLoginFlags = fields[15].GetUInt16(); + + if (!ValidateAppearance(uint8(plrRace), uint8(plrClass), gender, uint8(playerBytes >> 16), uint8(playerBytes >> 24), uint8(playerBytes >> 8), uint8(playerBytes2), uint8(playerBytes))) + { + 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); + stmt->setUInt16(0, uint16(AT_LOGIN_CUSTOMIZE)); + stmt->setUInt32(1, guid); + CharacterDatabase.Execute(stmt); + atLoginFlags |= AT_LOGIN_CUSTOMIZE; + } + } + uint32 charFlags = 0; if (playerFlags & PLAYER_FLAGS_HIDE_HELM) @@ -9968,7 +9991,7 @@ uint32 Player::GetXPRestBonus(uint32 xp) SetRestBonus(GetRestBonus() - rested_bonus); - TC_LOG_DEBUG("entities.player", "Player gain %u xp (+ %u Rested Bonus). Rested points=%f", xp+rested_bonus, rested_bonus, GetRestBonus()); + TC_LOG_DEBUG("entities.player", "GetXPRestBonus: Player %s (%u) gain %u xp (+%u Rested Bonus). Rested points=%f", GetName().c_str(), GetGUIDLow(), xp+rested_bonus, rested_bonus, GetRestBonus()); return rested_bonus; } @@ -17374,6 +17397,20 @@ bool Player::LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder) SetUInt32Value(PLAYER_BYTES_2, fields[10].GetUInt32()); SetByteValue(PLAYER_BYTES_3, 0, fields[5].GetUInt8()); SetByteValue(PLAYER_BYTES_3, 1, fields[45].GetUInt8()); + + if (!ValidateAppearance( + fields[3].GetUInt8(), // race + fields[4].GetUInt8(), // class + gender, GetByteValue(PLAYER_BYTES, 2), // hair type + GetByteValue(PLAYER_BYTES, 3), //hair color + uint8(fields[9].GetUInt32() >> 8), // face + GetByteValue(PLAYER_BYTES_2, 0), // facial hair + GetByteValue(PLAYER_BYTES, 0))) // skin color + { + TC_LOG_ERROR("entities.player", "Player %s has wrong Appearance values (Hair/Skin/Color), can't be loaded.", guid.ToString().c_str()); + return false; + } + SetUInt32Value(PLAYER_FLAGS, fields[11].GetUInt32()); SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[44].GetUInt32()); @@ -21849,12 +21886,7 @@ void Player::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) if (itr->second->state == PLAYERSPELL_REMOVED) continue; uint32 unSpellId = itr->first; - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(unSpellId); - if (!spellInfo) - { - ASSERT(spellInfo); - continue; - } + SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(unSpellId); // Not send cooldown for this spells if (spellInfo->IsCooldownStartedOnEvent()) @@ -22498,9 +22530,9 @@ void Player::SetPvP(bool state) (*itr)->SetPvP(state); } -void Player::UpdatePvP(bool state, bool override) +void Player::UpdatePvP(bool state, bool _override) { - if (!state || override) + if (!state || _override) { SetPvP(state); pvpInfo.EndTimer = 0; @@ -25655,11 +25687,11 @@ uint32 Player::CalculateTalentsPoints() const return uint32(talentPointsForLevel * sWorld->getRate(RATE_TALENT)); } -bool Player::IsKnowHowFlyIn(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); - return v_map != 571 || HasSpell(54197); // Cold Weather Flying + return v_map != 571 || HasSpell(54197); // 54197 = Cold Weather Flying } void Player::LearnSpellHighestRank(uint32 spellid) @@ -28066,3 +28098,58 @@ void Player::SendSupercededSpell(uint32 oldSpell, uint32 newSpell) data << uint32(newSpell) << uint32(oldSpell); GetSession()->SendPacket(&data); } + +bool Player::ValidateAppearance(uint8 race, uint8 class_, uint8 gender, uint8 hairID, uint8 hairColor, uint8 faceID, uint8 facialHair, uint8 skinColor, bool create /*=false*/) +{ + // Check skin color + // For Skin type is always 0 + if (CharSectionsEntry const* entry = GetCharSectionEntry(race, SECTION_TYPE_SKIN, gender, 0, skinColor)) + { // Skin Color defined as Face color, too, we check skin & face in one pass + if (CharSectionsEntry const* entry2 = GetCharSectionEntry(race, SECTION_TYPE_FACE, gender, faceID, skinColor)) + { + // Check DeathKnight exclusive + if (((entry->Flags & SECTION_FLAG_DEATH_KNIGHT) || (entry2->Flags & SECTION_FLAG_DEATH_KNIGHT)) && class_ != CLASS_DEATH_KNIGHT) + return false; + if (create && !((entry->Flags & SECTION_FLAG_PLAYER) && (entry2->Flags & SECTION_FLAG_PLAYER))) + return false; + } + else + return false; + } + else + return false; + + // These combinations don't have an entry of Type SECTION_TYPE_FACIAL_HAIR, exclude them from that check + bool excludeCheck = (race == RACE_TAUREN) || (race == RACE_DRAENEI) || (gender == GENDER_FEMALE && race != RACE_NIGHTELF && race != RACE_UNDEAD_PLAYER); + + // Check Hair + if (CharSectionsEntry const* entry = GetCharSectionEntry(race, SECTION_TYPE_HAIR, gender, hairID, hairColor)) + { + if ((entry->Flags & SECTION_FLAG_DEATH_KNIGHT) && class_ != CLASS_DEATH_KNIGHT) + return false; + if (create && !(entry->Flags & SECTION_FLAG_PLAYER)) + return false; + + if (!excludeCheck) + { + if (CharSectionsEntry const* entry2 = GetCharSectionEntry(race, SECTION_TYPE_FACIAL_HAIR, gender, facialHair, hairColor)) + { + if ((entry2->Flags & SECTION_FLAG_DEATH_KNIGHT) && class_ != CLASS_DEATH_KNIGHT) + return false; + if (create && !(entry2->Flags & SECTION_FLAG_PLAYER)) + return false; + } + else + return false; + } + else + { + // @TODO: Bound checking for facialHair ID (used clientside for markings, tauren beard, etc.) + // Not present in DBC + } + } + else + return false; + + return true; +} \ No newline at end of file diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 1716002f836..62c1e8f5b0e 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1683,6 +1683,7 @@ class Player : public Unit, public GridObject static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, ObjectGuid guid); static bool IsValidGender(uint8 Gender) { return Gender <= GENDER_FEMALE; } + static bool ValidateAppearance(uint8 race, uint8 class_, uint8 gender, uint8 hairID, uint8 hairColor, uint8 faceID, uint8 facialHair, uint8 skinColor, bool create = false); static bool IsValidClass(uint8 Class) { return ((1 << (Class - 1)) & CLASSMASK_ALL_PLAYABLE) != 0; } static bool IsValidRace(uint8 Race) { return ((1 << (Race - 1)) & RACEMASK_ALL_PLAYABLE) != 0; } @@ -2347,7 +2348,7 @@ class Player : public Unit, public GridObject void SetFallInformation(uint32 time, float z); void HandleFall(MovementInfo const& movementInfo); - bool IsKnowHowFlyIn(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/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index 8762e6c5832..99e74d07183 100644 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.cpp @@ -17,9 +17,7 @@ */ #include "Totem.h" -#include "Log.h" #include "Group.h" -#include "ObjectMgr.h" #include "Opcodes.h" #include "Player.h" #include "SpellMgr.h" diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index a51a326c410..b7ce00c0491 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -20,14 +20,10 @@ #include "Transport.h" #include "MapManager.h" #include "ObjectMgr.h" -#include "Path.h" #include "ScriptMgr.h" -#include "WorldPacket.h" #include "DBCStores.h" -#include "World.h" #include "GameObjectAI.h" #include "Vehicle.h" -#include "MapReference.h" #include "Player.h" #include "Cell.h" #include "CellImpl.h" @@ -340,6 +336,8 @@ GameObject* Transport::CreateGOPassenger(uint32 guid, GameObjectData const* data return NULL; } + ASSERT(data); + float x = data->posX; float y = data->posY; float z = data->posZ; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 3cc4ba3b070..c0802d050b0 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -35,7 +35,6 @@ #include "InstanceSaveMgr.h" #include "InstanceScript.h" #include "Log.h" -#include "MapManager.h" #include "MoveSpline.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" @@ -5384,7 +5383,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (RandomSpells.empty()) // shouldn't happen return false; - uint8 rand_spell = irand(0, (RandomSpells.size() - 1)); + uint8 rand_spell = urand(0, (RandomSpells.size() - 1)); CastSpell(target, RandomSpells[rand_spell], true, castItem, triggeredByAura, originalCaster); for (std::vector::iterator itr = RandomSpells.begin(); itr != RandomSpells.end(); ++itr) { @@ -5430,7 +5429,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (RandomSpells.empty()) // shouldn't happen return false; - uint8 rand_spell = irand(0, (RandomSpells.size() - 1)); + uint8 rand_spell = urand(0, (RandomSpells.size() - 1)); CastSpell(target, RandomSpells[rand_spell], true, castItem, triggeredByAura, originalCaster); for (std::vector::iterator itr = RandomSpells.begin(); itr != RandomSpells.end(); ++itr) { @@ -12544,6 +12543,7 @@ 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); diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 7939c93d688..c6d32365f57 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -22,12 +22,8 @@ #include "Vehicle.h" #include "Unit.h" #include "Util.h" -#include "WorldPacket.h" #include "ScriptMgr.h" #include "CreatureAI.h" -#include "ZoneScript.h" -#include "SpellMgr.h" -#include "SpellInfo.h" #include "MoveSplineInit.h" #include "TemporarySummon.h" #include "EventProcessor.h" diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 51a8014bd89..d72016dc6f7 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -24,7 +24,6 @@ #include "Language.h" #include "Log.h" #include "MapManager.h" -#include "GossipDef.h" #include "Player.h" #include "BattlegroundMgr.h" #include "UnitAI.h" diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index fe70ab86eae..b08ba0e5694 100644 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -20,28 +20,20 @@ #include #include "ObjectAccessor.h" -#include "CellImpl.h" #include "Corpse.h" #include "Creature.h" #include "DynamicObject.h" #include "GameObject.h" #include "GridNotifiers.h" -#include "GridNotifiersImpl.h" #include "Item.h" #include "Map.h" -#include "MapInstanced.h" -#include "MapManager.h" #include "ObjectDefines.h" #include "ObjectMgr.h" -#include "Opcodes.h" #include "Pet.h" #include "Player.h" -#include "Vehicle.h" #include "World.h" #include "WorldPacket.h" -#include - ObjectAccessor::ObjectAccessor() { } ObjectAccessor::~ObjectAccessor() { } diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp index d5562a9a3c7..abf66c1221b 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp +++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp @@ -21,12 +21,9 @@ #include "WorldPacket.h" #include "WorldSession.h" #include "UpdateData.h" -#include "Item.h" -#include "Map.h" #include "Transport.h" #include "ObjectAccessor.h" #include "CellImpl.h" -#include "SpellInfo.h" using namespace Trinity; diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index f4478d62480..e982cf08fa1 100644 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -20,7 +20,6 @@ #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Creature.h" -#include "Vehicle.h" #include "GameObject.h" #include "DynamicObject.h" #include "Corpse.h" diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 9f46f7c7d49..fb55d32689d 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -31,7 +31,6 @@ #include "BattlegroundMgr.h" #include "MapManager.h" #include "InstanceSaveMgr.h" -#include "MapInstanced.h" #include "Util.h" #include "LFGMgr.h" #include "UpdateFieldFlags.h" diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp index 8d5e07c4d3b..adb76846379 100644 --- a/src/server/game/Handlers/AddonHandler.cpp +++ b/src/server/game/Handlers/AddonHandler.cpp @@ -18,7 +18,6 @@ #include "zlib.h" #include "AddonHandler.h" -#include "DatabaseEnv.h" #include "Opcodes.h" #include "Log.h" diff --git a/src/server/game/Handlers/BattlefieldHandler.cpp b/src/server/game/Handlers/BattlefieldHandler.cpp index d0ca0c077dc..b11d3d3ccaf 100644 --- a/src/server/game/Handlers/BattlefieldHandler.cpp +++ b/src/server/game/Handlers/BattlefieldHandler.cpp @@ -15,8 +15,6 @@ * with this program. If not, see . */ -#include "ObjectAccessor.h" -#include "ObjectMgr.h" #include "Opcodes.h" #include "Player.h" #include "WorldPacket.h" diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index f17933ab877..bb66c3cf567 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1354,6 +1354,9 @@ 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)) + return; + GameObject* go = _player->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_BARBER_CHAIR, 5.0f); if (!go) { @@ -1438,9 +1441,8 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) >> customizeInfo.FacialHair >> customizeInfo.Face; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AT_LOGIN); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA); stmt->setUInt32(0, customizeInfo.Guid.GetCounter()); - // TODO: Make async with callback PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -1450,6 +1452,29 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) } Field* fields = result->Fetch(); + uint8 plrRace = fields[0].GetUInt8(); + uint8 plrClass = fields[1].GetUInt8(); + uint8 plrGender = fields[2].GetUInt8(); + + if (!Player::ValidateAppearance(plrRace, plrClass, plrGender, customizeInfo.HairStyle, customizeInfo.HairColor, customizeInfo.Face, customizeInfo.FacialHair, customizeInfo.Skin, true)) + { + SendCharCustomize(CHAR_CREATE_ERROR, customizeInfo); + return; + } + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AT_LOGIN); + + stmt->setUInt32(0, customizeInfo.Guid.GetCounter()); + // TODO: Make async with callback + result = CharacterDatabase.Query(stmt); + + if (!result) + { + SendCharCustomize(CHAR_CREATE_ERROR, customizeInfo); + return; + } + + fields = result->Fetch(); uint32 at_loginFlags = fields[0].GetUInt16(); if (!(at_loginFlags & AT_LOGIN_CUSTOMIZE)) diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 0f0602a19ee..98c5fcefd6d 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -34,7 +34,6 @@ #include "Log.h" #include "Opcodes.h" #include "Player.h" -#include "SpellAuras.h" #include "SpellAuraEffects.h" #include "Util.h" #include "ScriptMgr.h" diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp index ea990c83f46..39ba593c8d9 100644 --- a/src/server/game/Handlers/CombatHandler.cpp +++ b/src/server/game/Handlers/CombatHandler.cpp @@ -22,9 +22,7 @@ #include "WorldSession.h" #include "ObjectAccessor.h" #include "CreatureAI.h" -#include "ObjectDefines.h" #include "Vehicle.h" -#include "VehicleDefines.h" #include "Player.h" #include "Opcodes.h" diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp index 37d89274909..954fb66a9db 100644 --- a/src/server/game/Handlers/DuelHandler.cpp +++ b/src/server/game/Handlers/DuelHandler.cpp @@ -20,8 +20,6 @@ #include "WorldPacket.h" #include "WorldSession.h" #include "Log.h" -#include "Opcodes.h" -#include "UpdateData.h" #include "Player.h" void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp index 558deb28cb0..75ca49cb612 100644 --- a/src/server/game/Handlers/GuildHandler.cpp +++ b/src/server/game/Handlers/GuildHandler.cpp @@ -23,10 +23,7 @@ #include "ObjectMgr.h" #include "GuildMgr.h" #include "Log.h" -#include "Opcodes.h" #include "Guild.h" -#include "GossipDef.h" -#include "SocialMgr.h" void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket) { diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index eb4c393dbc7..3a101618d3c 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -24,8 +24,6 @@ #include "ObjectMgr.h" #include "Player.h" #include "Item.h" -#include "UpdateData.h" -#include "ObjectAccessor.h" #include "SpellInfo.h" #include "DB2Stores.h" #include diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index 77fc2c97f04..a3055b7d836 100644 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -634,10 +634,10 @@ void WorldSession::SendLfgJoinResult(lfg::LfgJoinResultData const& joinData) void WorldSession::SendLfgQueueStatus(lfg::LfgQueueStatusData const& queueData) { - TC_LOG_DEBUG("lfg", "SMSG_LFG_QUEUE_STATUS %s dungeon: %u, waitTime: %d, " + TC_LOG_DEBUG("lfg", "SMSG_LFG_QUEUE_STATUS %s state: %s, dungeon: %u, waitTime: %d, " "avgWaitTime: %d, waitTimeTanks: %d, waitTimeHealer: %d, waitTimeDps: %d, " "queuedTime: %u, tanks: %u, healers: %u, dps: %u", - GetPlayerInfo().c_str(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, + GetPlayerInfo().c_str(), lfg::GetStateString(sLFGMgr->GetState(GetPlayer()->GetGUID())).c_str(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, queueData.waitTimeTank, queueData.waitTimeHealer, queueData.waitTimeDps, queueData.queuedTime, queueData.tanks, queueData.healers, queueData.dps); diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index f863b8a0b62..d60d5c65cce 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -28,9 +28,6 @@ #include "ObjectMgr.h" #include "GuildMgr.h" #include "WorldSession.h" -#include "BigNumber.h" -#include "SHA1.h" -#include "UpdateData.h" #include "LootMgr.h" #include "Chat.h" #include "zlib.h" @@ -38,19 +35,14 @@ #include "Object.h" #include "Battleground.h" #include "OutdoorPvP.h" -#include "Pet.h" #include "SocialMgr.h" -#include "CellImpl.h" #include "AccountMgr.h" -#include "Vehicle.h" #include "CreatureAI.h" #include "DBCEnums.h" #include "ScriptMgr.h" #include "MapManager.h" -#include "InstanceScript.h" #include "GameObjectAI.h" #include "Group.h" -#include "AccountMgr.h" #include "Spell.h" #include "BattlegroundMgr.h" #include "Battlefield.h" diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index 343b660b040..4419faf5f45 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -23,7 +23,6 @@ #include "Log.h" #include "Corpse.h" #include "Player.h" -#include "SpellAuras.h" #include "MapManager.h" #include "Transport.h" #include "Battleground.h" diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index cc699b97adb..44e5831a7bd 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -27,8 +27,6 @@ #include "SpellMgr.h" #include "Player.h" #include "GossipDef.h" -#include "UpdateMask.h" -#include "ObjectAccessor.h" #include "Creature.h" #include "Pet.h" #include "ReputationMgr.h" diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index bf63b5093cf..c58f2a6c8a5 100644 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.cpp @@ -28,8 +28,6 @@ #include "Opcodes.h" #include "Guild.h" #include "ArenaTeam.h" -#include "GossipDef.h" -#include "SocialMgr.h" #define CHARTER_DISPLAY_ID 16161 diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 0a040bc515e..bf949f8aadc 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -17,7 +17,6 @@ */ #include "Common.h" -#include "Language.h" #include "DatabaseEnv.h" #include "WorldPacket.h" #include "WorldSession.h" @@ -28,7 +27,6 @@ #include "Player.h" #include "UpdateMask.h" #include "NPCHandler.h" -#include "Pet.h" #include "MapManager.h" void WorldSession::SendNameQueryOpcode(ObjectGuid guid) diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp index 59adbbe5358..56bfb926247 100644 --- a/src/server/game/Handlers/SkillHandler.cpp +++ b/src/server/game/Handlers/SkillHandler.cpp @@ -17,13 +17,11 @@ */ #include "Common.h" -#include "DatabaseEnv.h" #include "Log.h" #include "ObjectAccessor.h" #include "Opcodes.h" #include "Player.h" #include "Pet.h" -#include "UpdateMask.h" #include "WorldPacket.h" #include "WorldSession.h" diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 28a6e4746d8..d2f64eca178 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -27,9 +27,6 @@ #include "Opcodes.h" #include "Spell.h" #include "Totem.h" -#include "TemporarySummon.h" -#include "SpellAuras.h" -#include "CreatureAI.h" #include "ScriptMgr.h" #include "GameObjectAI.h" #include "SpellAuraEffects.h" diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index eb0828b545e..c1fe7ddbb9e 100644 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.cpp @@ -24,7 +24,6 @@ #include "Log.h" #include "ObjectMgr.h" #include "Player.h" -#include "UpdateMask.h" #include "Path.h" #include "WaypointMovementGenerator.h" diff --git a/src/server/game/Handlers/VoiceChatHandler.cpp b/src/server/game/Handlers/VoiceChatHandler.cpp index d9cd7226721..77c563a5f6f 100644 --- a/src/server/game/Handlers/VoiceChatHandler.cpp +++ b/src/server/game/Handlers/VoiceChatHandler.cpp @@ -19,7 +19,6 @@ #include "Common.h" #include "WorldPacket.h" #include "WorldSession.h" -#include "Opcodes.h" #include "Log.h" void WorldSession::HandleVoiceSessionEnableOpcode(WorldPacket& recvData) diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 9d6b00382fe..4de2f679136 100644 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -21,15 +21,12 @@ #include "GridNotifiers.h" #include "Log.h" #include "GridStates.h" -#include "CellImpl.h" #include "Map.h" #include "MapManager.h" #include "MapInstanced.h" #include "InstanceSaveMgr.h" #include "Timer.h" -#include "GridNotifiersImpl.h" #include "Config.h" -#include "Transport.h" #include "ObjectMgr.h" #include "World.h" #include "Group.h" diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index f3ad6d85511..623152114a2 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -28,7 +28,6 @@ #include "Group.h" #include "InstanceScript.h" #include "MapInstanced.h" -#include "MapManager.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Pet.h" diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 42603211a58..47fc4e27f82 100644 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -27,7 +27,6 @@ #include "InstanceScript.h" #include "Config.h" #include "World.h" -#include "CellImpl.h" #include "Corpse.h" #include "ObjectMgr.h" #include "Language.h" diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 04aac0fd3d1..d90dc650733 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -30,7 +30,6 @@ #include "RandomMovementGenerator.h" #include "MoveSpline.h" #include "MoveSplineInit.h" -#include inline bool isStatic(MovementGenerator *mv) { diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp index cbfc181fe9f..f0c0311280f 100755 --- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp @@ -17,10 +17,8 @@ */ #include "Creature.h" -#include "MapManager.h" #include "ConfusedMovementGenerator.h" #include "PathGenerator.h" -#include "VMapFactory.h" #include "MoveSplineInit.h" #include "MoveSpline.h" #include "Player.h" diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp index cea25fefbda..fa17846a1ff 100644 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp @@ -18,7 +18,6 @@ #include "Creature.h" #include "CreatureAI.h" -#include "MapManager.h" #include "FleeingMovementGenerator.h" #include "PathGenerator.h" #include "ObjectAccessor.h" diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp index ff28f3855a6..4245bffb864 100644 --- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp @@ -19,7 +19,6 @@ #include "HomeMovementGenerator.h" #include "Creature.h" #include "CreatureAI.h" -#include "WorldPacket.h" #include "MoveSplineInit.h" #include "MoveSpline.h" diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp index 0341af299be..86f0e6e20eb 100644 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp @@ -17,9 +17,7 @@ */ #include "Creature.h" -#include "MapManager.h" #include "RandomMovementGenerator.h" -#include "ObjectAccessor.h" #include "Map.h" #include "Util.h" #include "CreatureGroups.h" diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index a3db2c8e2ed..77d8f10bff5 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -19,7 +19,6 @@ #include "WaypointMovementGenerator.h" //Extended headers #include "ObjectMgr.h" -#include "World.h" #include "Transport.h" //Flightmaster grid preloading #include "MapManager.h" diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index 937ce90b23b..9c6d9f625b8 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -21,7 +21,6 @@ #include "MovementPacketBuilder.h" #include "Unit.h" #include "Transport.h" -#include "Vehicle.h" #include "WorldPacket.h" #include "Opcodes.h" diff --git a/src/server/game/Movement/Spline/MovementUtil.cpp b/src/server/game/Movement/Spline/MovementUtil.cpp index 3f629238948..21ce4001c89 100644 --- a/src/server/game/Movement/Spline/MovementUtil.cpp +++ b/src/server/game/Movement/Spline/MovementUtil.cpp @@ -18,7 +18,6 @@ #include "MoveSplineFlag.h" #include -#include namespace Movement { diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index cf7be3de5ce..c8bc68d0ddf 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -20,7 +20,6 @@ #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Map.h" -#include "MapManager.h" #include "Group.h" #include "WorldPacket.h" #include "GridNotifiers.h" @@ -509,7 +508,7 @@ bool OPvPCapturePoint::HandleCustomSpell(Player* player, uint32 /*spellId*/, Gam { if (!player->IsOutdoorPvPActive()) return false; - return false; + return true; } bool OutdoorPvP::HandleOpenGo(Player* player, ObjectGuid guid) diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index d643bc5da41..3f561539917 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -170,7 +170,7 @@ PoolObject* PoolGroup::RollOne(ActivePoolData& spawns, uint32 triggerFrom) } if (!EqualChanced.empty()) { - int32 index = irand(0, EqualChanced.size()-1); + uint32 index = urand(0, EqualChanced.size()-1); // Triggering object is marked as spawned at this time and can be also rolled (respawn case) // so this need explicit check for this case if (EqualChanced[index].guid == triggerFrom || !spawns.IsActiveObject(EqualChanced[index].guid)) diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index ab9c2e32cc8..3beaa7daa9b 100644 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -21,8 +21,6 @@ #include "GridNotifiersImpl.h" #include "GossipDef.h" #include "Map.h" -#include "MapManager.h" -#include "MapRefManager.h" #include "ObjectMgr.h" #include "Pet.h" #include "ScriptedCreature.h" diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index d5d429cb2af..c6bda4d5d1f 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -269,6 +269,7 @@ void WorldSession::SendPacket(WorldPacket* packet, bool forced /*= false*/) sScriptMgr->OnPacketSend(this, *packet); + TC_LOG_TRACE("network.opcode", "S->C: %s %s", GetPlayerInfo().c_str(), GetOpcodeNameForLogging(packet->GetOpcode()).c_str()); m_Socket->SendPacket(*packet); } @@ -856,7 +857,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) if (size > 0xFFFFF) { - TC_LOG_ERROR("misc", "WorldSession::ReadAddonsInfo addon info too big, size %u", size); + TC_LOG_DEBUG("addon", "WorldSession::ReadAddonsInfo: AddOnInfo too big, size %u", size); return; } @@ -886,7 +887,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) addonInfo >> enabled >> crc >> unk1; - TC_LOG_DEBUG("misc", "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1); + TC_LOG_DEBUG("addon", "AddOn: %s (CRC: 0x%x) - enabled: 0x%x - Unknown2: 0x%x", addonName.c_str(), crc, enabled, unk1); AddonInfo addon(addonName, enabled, crc, 2, true); @@ -894,15 +895,14 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) if (savedAddon) { if (addon.CRC != savedAddon->CRC) - TC_LOG_ERROR("misc", "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC); + TC_LOG_WARN("addon", " Addon: %s: modified (CRC: 0x%x) - accountID %d)", addon.Name.c_str(), savedAddon->CRC, GetAccountId()); else - TC_LOG_DEBUG("misc", "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC); + TC_LOG_DEBUG("addon", "Addon: %s: validated (CRC: 0x%x) - accountID %d", addon.Name.c_str(), savedAddon->CRC, GetAccountId()); } else { AddonMgr::SaveAddon(addon); - - TC_LOG_DEBUG("misc", "ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC); + TC_LOG_WARN("addon", "Addon: %s: unknown (CRC: 0x%x) - accountId %d (storing addon name and checksum to database)", addon.Name.c_str(), addon.CRC, GetAccountId()); } /// @todo Find out when to not use CRC/pubkey, and other possible states. @@ -911,10 +911,10 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) uint32 currentTime; addonInfo >> currentTime; - TC_LOG_DEBUG("network", "ADDON: CurrentTime: %u", currentTime); + TC_LOG_DEBUG("addon", "AddOn: CurrentTime: %u", currentTime); } else - TC_LOG_ERROR("misc", "Addon packet uncompress error!"); + TC_LOG_DEBUG("addon", "AddOn: Addon packet uncompress error!"); } void WorldSession::SendAddonsInfo() @@ -953,8 +953,8 @@ void WorldSession::SendAddonsInfo() data << uint8(usepk); if (usepk) // if CRC is wrong, add public key (client need it) { - TC_LOG_DEBUG("misc", "ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey", - itr->CRC, itr->Name.c_str(), STANDARD_ADDON_CRC); + TC_LOG_DEBUG("addon", "AddOn: %s: CRC checksum mismatch: got 0x%x - expected 0x%x - sending pubkey to accountID %d", + itr->Name.c_str(), itr->CRC, STANDARD_ADDON_CRC, GetAccountId()); data.append(addonPublicKey, sizeof(addonPublicKey)); } diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 0bcba385d4e..4924a67f4ae 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -65,7 +65,13 @@ void WorldSocket::HandleSendAuthSession() packet << uint32(_authSeed); packet << uint8(1); - SendPacket(packet); + +void WorldSocket::OnClose() +{ + { + std::lock_guard sessionGuard(_worldSessionLock); + _worldSession = nullptr; + } } void WorldSocket::ReadHandler() @@ -92,7 +98,10 @@ void WorldSocket::ReadHandler() // We just received nice new header if (!ReadHeaderHandler()) + { + CloseSocket(); return; + } } // We have full read header, now check the data payload @@ -113,7 +122,10 @@ void WorldSocket::ReadHandler() // just received fresh new payload if (!ReadDataHandler()) + { + CloseSocket(); return; + } _headerBuffer.Reset(); } @@ -169,24 +181,27 @@ bool WorldSocket::ReadDataHandler() if (sPacketLog->CanLogPacket()) sPacketLog->LogPacket(packet, CLIENT_TO_SERVER, GetRemoteIpAddress(), GetRemotePort()); - TC_LOG_TRACE("network.opcode", "C->S: %s %s", (_worldSession ? _worldSession->GetPlayerInfo() : GetRemoteIpAddress().to_string()).c_str(), GetOpcodeNameForLogging(opcode).c_str()); + std::unique_lock sessionGuard(_worldSessionLock, std::defer_lock); switch (opcode) { case CMSG_PING: - HandlePing(packet); - break; + LogOpcodeText(opcode, sessionGuard); + return HandlePing(packet); case CMSG_AUTH_SESSION: + LogOpcodeText(opcode, sessionGuard); if (_worldSession) { + // locking just to safely log offending user is probably overkill but we are disconnecting him anyway + if (sessionGuard.try_lock()) TC_LOG_ERROR("network", "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", _worldSession->GetPlayerInfo().c_str()); - break; + return false; } HandleAuthSession(packet); break; case CMSG_KEEP_ALIVE: - TC_LOG_DEBUG("network", "%s", GetOpcodeNameForLogging(opcode).c_str()); + LogOpcodeText(opcode, sessionGuard); sScriptMgr->OnPacketReceive(_worldSession, packet); break; case CMSG_LOG_DISCONNECT: @@ -204,6 +219,8 @@ bool WorldSocket::ReadDataHandler() } default: { + sessionGuard.lock(); + LogOpcodeText(opcode, sessionGuard); if (!_worldSession) { TC_LOG_ERROR("network.opcode", "ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); @@ -253,7 +270,26 @@ bool WorldSocket::ReadDataHandler() return true; } -void WorldSocket::SendPacket(WorldPacket& packet) +void WorldSocket::LogOpcodeText(uint16 opcode, std::unique_lock const& guard) const +{ + if (!guard) + { + TC_LOG_TRACE("network.opcode", "C->S: %s %s", GetRemoteIpAddress().to_string().c_str(), GetOpcodeNameForLogging(opcode).c_str()); + } + else + { + TC_LOG_TRACE("network.opcode", "C->S: %s %s", (_worldSession ? _worldSession->GetPlayerInfo() : GetRemoteIpAddress().to_string()).c_str(), + GetOpcodeNameForLogging(opcode).c_str()); + } +} + +void WorldSocket::SendPacketAndLogOpcode(WorldPacket const& packet) +{ + TC_LOG_TRACE("network.opcode", "S->C: %s %s", GetRemoteIpAddress().to_string().c_str(), GetOpcodeNameForLogging(packet.GetOpcode()).c_str()); + SendPacket(packet); +} + +void WorldSocket::SendPacket(WorldPacket const& packet) { if (!IsOpen()) return; @@ -264,8 +300,6 @@ void WorldSocket::SendPacket(WorldPacket& packet) if (_worldSession && packet.size() > 0x400 && !packet.IsCompressed()) packet.Compress(_worldSession->GetCompressionStream()); - TC_LOG_TRACE("network.opcode", "S->C: %s %s", (_worldSession ? _worldSession->GetPlayerInfo() : GetRemoteIpAddress().to_string()).c_str(), GetOpcodeNameForLogging(packet.GetOpcode()).c_str()); - ServerPktHeader header(packet.size() + 2, packet.GetOpcode()); std::unique_lock guard(_writeLock); @@ -570,10 +604,10 @@ void WorldSocket::SendAuthResponseError(uint8 code) packet.WriteBit(0); // has account info packet << uint8(code); - SendPacket(packet); + SendPacketAndLogOpcode(packet); } -void WorldSocket::HandlePing(WorldPacket& recvPacket) +bool WorldSocket::HandlePing(WorldPacket& recvPacket) { uint32 ping; uint32 latency; @@ -602,13 +636,14 @@ void WorldSocket::HandlePing(WorldPacket& recvPacket) if (maxAllowed && _OverSpeedPings > maxAllowed) { + std::unique_lock sessionGuard(_worldSessionLock); + if (_worldSession && !_worldSession->HasPermission(rbac::RBAC_PERM_SKIP_CHECK_OVERSPEED_PING)) { TC_LOG_ERROR("network", "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)", _worldSession->GetPlayerInfo().c_str(), GetRemoteIpAddress().to_string().c_str()); - CloseSocket(); - return; + return false; } } } @@ -616,20 +651,23 @@ void WorldSocket::HandlePing(WorldPacket& recvPacket) _OverSpeedPings = 0; } - if (_worldSession) { - _worldSession->SetLatency(latency); - _worldSession->ResetClientTimeDelay(); - } - else - { - TC_LOG_ERROR("network", "WorldSocket::HandlePing: peer sent CMSG_PING, but is not authenticated or got recently kicked, address = %s", GetRemoteIpAddress().to_string().c_str()); + std::lock_guard sessionGuard(_worldSessionLock); - CloseSocket(); - return; + if (_worldSession) + { + _worldSession->SetLatency(latency); + _worldSession->ResetClientTimeDelay(); + } + else + { + TC_LOG_ERROR("network", "WorldSocket::HandlePing: peer sent CMSG_PING, but is not authenticated or got recently kicked, address = %s", GetRemoteIpAddress().to_string().c_str()); + return false; + } } WorldPacket packet(SMSG_PONG, 4); packet << ping; - return SendPacket(packet); + SendPacketAndLogOpcode(packet); + return true; } diff --git a/src/server/game/Server/WorldSocket.h b/src/server/game/Server/WorldSocket.h index 085bc6d5f42..f310ec324f8 100644 --- a/src/server/game/Server/WorldSocket.h +++ b/src/server/game/Server/WorldSocket.h @@ -59,19 +59,25 @@ public: void Start() override; - void SendPacket(WorldPacket& packet); + void SendPacket(WorldPacket const& packet); protected: + void OnClose() override; void ReadHandler() override; bool ReadHeaderHandler(); bool ReadDataHandler(); private: + /// writes network.opcode log + /// accessing WorldSession is not threadsafe, only do it when holding _worldSessionLock + void LogOpcodeText(uint16 opcode, std::unique_lock const& guard) const; + /// sends and logs network.opcode without accessing WorldSession + void SendPacketAndLogOpcode(WorldPacket const& packet); void HandleSendAuthSession(); void HandleAuthSession(WorldPacket& recvPacket); void SendAuthResponseError(uint8 code); - void HandlePing(WorldPacket& recvPacket); + bool HandlePing(WorldPacket& recvPacket); uint32 _authSeed; WorldPacketCrypt _authCrypt; @@ -79,7 +85,9 @@ private: std::chrono::steady_clock::time_point _LastPingTime; uint32 _OverSpeedPings; + std::mutex _worldSessionLock; WorldSession* _worldSession; + bool _authed; MessageBuffer _headerBuffer; MessageBuffer _packetBuffer; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index e4c1a42eaf1..6b4d3ec579a 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -32,7 +32,6 @@ #include "OutdoorPvPMgr.h" #include "Formulas.h" #include "GridNotifiers.h" -#include "GridNotifiersImpl.h" #include "CellImpl.h" #include "ScriptMgr.h" #include "Vehicle.h" diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index e4b49322c9d..7fc78bdab41 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -31,13 +31,10 @@ #include "Player.h" #include "Pet.h" #include "Unit.h" -#include "Totem.h" #include "Spell.h" #include "DynamicObject.h" #include "Guild.h" -#include "Group.h" #include "UpdateData.h" -#include "MapManager.h" #include "ObjectAccessor.h" #include "CellImpl.h" #include "SharedDefines.h" diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 33d5b382b1c..a5d01cf30b8 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -32,10 +32,6 @@ #include "DynamicObject.h" #include "SpellAuras.h" #include "SpellAuraEffects.h" -#include "Group.h" -#include "UpdateData.h" -#include "MapManager.h" -#include "ObjectAccessor.h" #include "SharedDefines.h" #include "Pet.h" #include "GameObject.h" @@ -43,20 +39,14 @@ #include "Creature.h" #include "Totem.h" #include "CreatureAI.h" -#include "BattlegroundMgr.h" #include "Battleground.h" #include "OutdoorPvPMgr.h" #include "Language.h" #include "SocialMgr.h" #include "Util.h" -#include "VMapFactory.h" #include "TemporarySummon.h" -#include "CellImpl.h" #include "GridNotifiers.h" -#include "GridNotifiersImpl.h" -#include "SkillDiscovery.h" #include "Formulas.h" -#include "Vehicle.h" #include "ScriptMgr.h" #include "GameObjectAI.h" #include "AccountMgr.h" diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 9b468d3fc61..34d53402d03 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1657,10 +1657,10 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a return SPELL_FAILED_NOT_HERE; break; } + } } } } - return SPELL_CAST_OK; } diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index ab1b7b468dd..621b5dd319d 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -19,15 +19,11 @@ #include "SpellMgr.h" #include "SpellInfo.h" #include "ObjectMgr.h" -#include "SpellAuras.h" #include "SpellAuraDefines.h" #include "SharedDefines.h" #include "DBCStores.h" -#include "World.h" #include "Chat.h" -#include "Spell.h" #include "BattlegroundMgr.h" -#include "MapManager.h" #include "BattlefieldWG.h" #include "BattlefieldMgr.h" #include "Player.h" @@ -3079,6 +3075,10 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->Effects[EFFECT_0].TriggerSpell = 36325; // They Must Burn Bomb Drop (DND) break; case 49838: // Stop Time + case 69438: // Sample Satisfaction + case 69445: // Perfume Spritz + case 69489: // Chocolate Sample + case 69563: // Cologne Spritz spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; break; case 61407: // Energize Cores diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 96977804f70..b347a982132 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -19,7 +19,6 @@ #include "Spell.h" #include "SpellAuras.h" #include "SpellScript.h" -#include "SpellMgr.h" bool _SpellScript::_Validate(SpellInfo const* entry) { diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index aed2d73c422..ecf7697db0d 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -22,10 +22,8 @@ #include "Log.h" #include "Opcodes.h" #include "ByteBuffer.h" -#include #include #include "World.h" -#include "Player.h" #include "Util.h" #include "Warden.h" #include "AccountMgr.h" diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index c2d095e6530..df9cd4786ad 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -21,7 +21,6 @@ #include "WorldSession.h" #include "Log.h" #include "Database/DatabaseEnv.h" -#include "Util.h" #include "WardenCheckMgr.h" #include "Warden.h" diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index 6e96fc51f2c..fa29afef661 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -32,7 +32,6 @@ #include "WardenWin.h" #include "WardenModuleWin.h" #include "WardenCheckMgr.h" -#include "AccountMgr.h" WardenWin::WardenWin() : Warden(), _serverTicks(0) {} diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp index 9ad77761123..7cb237e4f24 100644 --- a/src/server/game/Weather/Weather.cpp +++ b/src/server/game/Weather/Weather.cpp @@ -25,7 +25,6 @@ #include "Player.h" #include "World.h" #include "Log.h" -#include "ObjectMgr.h" #include "Util.h" #include "ScriptMgr.h" #include "Opcodes.h" @@ -194,8 +193,10 @@ bool Weather::ReGenerate() void Weather::SendWeatherUpdateToPlayer(Player* player) { - WorldPacket data(SMSG_WEATHER, (4+4+4)); - data << uint32(GetWeatherState()) << (float)m_grade << uint8(0); + WorldPacket data(SMSG_WEATHER, (4 + 4 + 1)); + data << uint32(GetWeatherState()); + data << (float)m_grade; + data << uint8(0); player->GetSession()->SendPacket(&data); } @@ -210,7 +211,7 @@ bool Weather::UpdateWeather() WeatherState state = GetWeatherState(); - WorldPacket data(SMSG_WEATHER, (4+4+4)); + WorldPacket data(SMSG_WEATHER, (4 + 4 + 1)); data << uint32(state); data << (float)m_grade; data << uint8(0); diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 8f599b8514b..19b0031bb64 100644 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -144,8 +144,10 @@ void LoadWeatherData() void SendFineWeatherUpdateToPlayer(Player* player) { - WorldPacket data(SMSG_WEATHER, (4+4+4)); - data << (uint32)WEATHER_STATE_FINE << (float)0.0f << uint8(0); + WorldPacket data(SMSG_WEATHER, (4 + 4 + 1)); + data << (uint32)WEATHER_STATE_FINE; + data << (float)0.0f; + data << uint8(0); player->GetSession()->SendPacket(&data); } diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 77500080044..60b7a5b3779 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1955,28 +1955,24 @@ void World::SetInitialWorldSettings() sLog->SetRealmId(realmId); } -void World::RecordTimeDiff(const char *text, ...) +void World::ResetTimeDiffRecord() { if (m_updateTimeCount != 1) return; - if (!text) - { - m_currentTime = getMSTime(); + + m_currentTime = getMSTime(); +} + +void World::RecordTimeDiff(std::string const& text) +{ + if (m_updateTimeCount != 1) return; - } uint32 thisTime = getMSTime(); uint32 diff = getMSTimeDiff(m_currentTime, thisTime); if (diff > m_int_configs[CONFIG_MIN_LOG_UPDATE]) - { - va_list ap; - char str[256]; - va_start(ap, text); - vsnprintf(str, 256, text, ap); - va_end(ap); - TC_LOG_INFO("misc", "Difftime %s: %u.", str, diff); - } + TC_LOG_INFO("misc", "Difftime %s: %u.", text.c_str(), diff); m_currentTime = thisTime; } @@ -2096,7 +2092,7 @@ void World::Update(uint32 diff) } ///
  • Handle session updates when the timer has passed - RecordTimeDiff(NULL); + ResetTimeDiffRecord(); UpdateSessions(diff); RecordTimeDiff("UpdateSessions"); @@ -2143,7 +2139,7 @@ void World::Update(uint32 diff) ///
  • Handle all other objects ///- Update objects when the timer has passed (maps, transport, creatures, ...) - RecordTimeDiff(NULL); + ResetTimeDiffRecord(); sMapMgr->Update(diff); RecordTimeDiff("UpdateMapMgr"); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index d970cbaf0ae..176a1093380 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -761,7 +761,8 @@ class World void LoadDBVersion(); char const* GetDBVersion() const { return m_DBVersion.c_str(); } - void RecordTimeDiff(const char * text, ...); + void ResetTimeDiffRecord(); + void RecordTimeDiff(std::string const& text); void LoadAutobroadcasts(); diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt index bca1bec7f71..3d569e35010 100644 --- a/src/server/scripts/CMakeLists.txt +++ b/src/server/scripts/CMakeLists.txt @@ -149,6 +149,8 @@ include_directories( ${VALGRIND_INCLUDE_DIR} ) +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + add_library(scripts STATIC ${scripts_STAT_SRCS} ${scripts_STAT_PCH_SRC} diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp index 308a841df2a..747d84de9c5 100644 --- a/src/server/scripts/Commands/cs_lfg.cpp +++ b/src/server/scripts/Commands/cs_lfg.cpp @@ -47,15 +47,15 @@ public: { { "player", rbac::RBAC_PERM_COMMAND_LFG_PLAYER, false, &HandleLfgPlayerInfoCommand, "", NULL }, { "group", rbac::RBAC_PERM_COMMAND_LFG_GROUP, false, &HandleLfgGroupInfoCommand, "", NULL }, - { "queue", rbac::RBAC_PERM_COMMAND_LFG_QUEUE, false, &HandleLfgQueueInfoCommand, "", NULL }, - { "clean", rbac::RBAC_PERM_COMMAND_LFG_CLEAN, false, &HandleLfgCleanCommand, "", NULL }, - { "options", rbac::RBAC_PERM_COMMAND_LFG_OPTIONS, false, &HandleLfgOptionsCommand, "", NULL }, + { "queue", rbac::RBAC_PERM_COMMAND_LFG_QUEUE, true, &HandleLfgQueueInfoCommand, "", NULL }, + { "clean", rbac::RBAC_PERM_COMMAND_LFG_CLEAN, true, &HandleLfgCleanCommand, "", NULL }, + { "options", rbac::RBAC_PERM_COMMAND_LFG_OPTIONS, true, &HandleLfgOptionsCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { - { "lfg", rbac::RBAC_PERM_COMMAND_LFG, false, NULL, "", lfgCommandTable }, + { "lfg", rbac::RBAC_PERM_COMMAND_LFG, true, NULL, "", lfgCommandTable }, { NULL, 0, false, NULL, "", NULL } }; return commandTable; @@ -118,7 +118,7 @@ public: static bool HandleLfgQueueInfoCommand(ChatHandler* handler, char const* args) { - handler->SendSysMessage(sLFGMgr->DumpQueueInfo(atoi(args) != 0).c_str()); + handler->SendSysMessage(sLFGMgr->DumpQueueInfo(*args != '\0').c_str()); return true; } diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 4f44db5b6d8..116ba5e6929 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -25,7 +25,6 @@ #include "InstanceSaveMgr.h" #include "Language.h" #include "MovementGenerator.h" -#include "ObjectAccessor.h" #include "Opcodes.h" #include "SpellAuras.h" #include "TargetedMovementGenerator.h" diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index 5e83c0c8653..8965b64767a 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -126,7 +126,7 @@ public: if (dist(xn, yn, xh, yh) >= dist(xn, yn, xp, yp) || dist(xp, yp, xh, yh) >= dist(xn, yn, xp, yp)) return false; // check distance from the beam - return (abs((xn-xp)*yh+(yp-yn)*xh-xn*yp+xp*yn)/dist(xn, yn, xp, yp) < 1.5f); + return (std::abs((xn-xp)*yh+(yp-yn)*xh-xn*yp+xp*yn)/dist(xn, yn, xp, yp) < 1.5f); } float dist(float xa, float ya, float xb, float yb) // auxiliary method for distance diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index 1302c618e6f..e3ab206ac21 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -268,7 +268,7 @@ public: return ObjectGuid::Empty; } - void Load(char const* chrIn) + void Load(char const* chrIn) override { if (!chrIn) { diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index b21b2f8a73c..3df07562d50 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -1657,7 +1657,7 @@ public: { npc_the_lich_king_tirion_dawnAI(Creature* creature) : ScriptedAI(creature) { Reset(); } void Reset() override { } - void AttackStart(Unit* /*who*/) { } // very sample, just don't make them aggreesive override + void AttackStart(Unit* /*who*/) override { } // very sample, just don't make them aggreesive void UpdateAI(uint32 /*diff*/) override { } void JustDied(Unit* /*killer*/) override { } }; diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index be544449b67..a085463f7ce 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -236,7 +236,7 @@ public: OUT_LOAD_INST_DATA_COMPLETE; } - void Update(uint32 uiDiff) + void Update(uint32 uiDiff) override { if (GetData(TYPE_FENRUS) != DONE) return; diff --git a/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp b/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp index 73a8cd10168..a375468786b 100644 --- a/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp @@ -108,7 +108,7 @@ class npc_professor_phizzlethorpe : public CreatureScript Talk(SAY_AGGRO); } - void sQuestAccept(Player* player, Quest const* quest) + void sQuestAccept(Player* player, Quest const* quest) override { if (quest->GetQuestId() == QUEST_SUNKEN_TREASURE) { diff --git a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp index a09a66fbb43..0a66039dbfd 100644 --- a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp @@ -74,7 +74,7 @@ public: summoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); } - void sQuestAccept(Player* player, Quest const* quest) + void sQuestAccept(Player* player, Quest const* quest) override { if (quest->GetQuestId() == QUEST_RESQUE_OOX_09) { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index f672871922a..b5d2931377f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -421,7 +421,7 @@ public: gossipStep = 0; } - void AttackStart(Unit* who) + void AttackStart(Unit* who) override { if (who && !who->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) npc_escortAI::AttackStart(who); diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp index 2b00254167d..d8966ec76c1 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp @@ -76,7 +76,7 @@ public: } } - void Update(uint32 /*diff*/) + void Update(uint32 /*diff*/) override { if (WardKeeperDeath == WARD_KEEPERS_NR) if (GameObject* go = instance->GetGameObject(DoorWardGUID)) diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp index f8873b06a75..d16a86f350f 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp @@ -57,7 +57,7 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript } } - bool SetBossState(uint32 bossId, EncounterState state) + bool SetBossState(uint32 bossId, EncounterState state) override { if (!InstanceScript::SetBossState(bossId, state)) return false; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index 50fd94e66ee..65ffb7fd696 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -99,7 +99,7 @@ struct boss_twinemperorsAI : public ScriptedAI uint32 EnrageTimer; virtual bool IAmVeklor() = 0; - virtual void Reset() = 0; + virtual void Reset() override = 0; virtual void CastSpellOnBug(Creature* target) = 0; void TwinReset() @@ -400,7 +400,7 @@ public: struct boss_veknilashAI : public boss_twinemperorsAI { - bool IAmVeklor() {return false;} + bool IAmVeklor() override {return false;} boss_veknilashAI(Creature* creature) : boss_twinemperorsAI(creature) { Initialize(); @@ -425,7 +425,7 @@ public: me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); } - void CastSpellOnBug(Creature* target) + void CastSpellOnBug(Creature* target) override { target->setFaction(14); target->AI()->AttackStart(me->getThreatManager().getHostilTarget()); @@ -488,7 +488,7 @@ public: struct boss_veklorAI : public boss_twinemperorsAI { - bool IAmVeklor() {return true;} + bool IAmVeklor() override {return true;} boss_veklorAI(Creature* creature) : boss_twinemperorsAI(creature) { Initialize(); @@ -516,7 +516,7 @@ public: me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true); } - void CastSpellOnBug(Creature* target) + void CastSpellOnBug(Creature* target) override { target->setFaction(14); target->AddAura(SPELL_EXPLODEBUG, target); diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index 244261a86c1..46e831b0f83 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -220,7 +220,7 @@ public: }; } - virtual void Update(uint32 diff) + virtual void Update(uint32 diff) override { switch (PyramidPhase) { diff --git a/src/server/scripts/Kalimdor/zone_ashenvale.cpp b/src/server/scripts/Kalimdor/zone_ashenvale.cpp index 76b43729517..b8e6bfb85e8 100644 --- a/src/server/scripts/Kalimdor/zone_ashenvale.cpp +++ b/src/server/scripts/Kalimdor/zone_ashenvale.cpp @@ -24,7 +24,6 @@ SDCategory: Ashenvale Forest EndScriptData */ /* ContentData -npc_torek npc_ruul_snowhoof EndContentData */ @@ -33,132 +32,6 @@ EndContentData */ #include "ScriptedEscortAI.h" #include "Player.h" -/*#### -# npc_torek -####*/ - -enum Torek -{ - SAY_READY = 0, - SAY_MOVE = 1, - SAY_PREPARE = 2, - SAY_WIN = 3, - SAY_END = 4, - SPELL_REND = 11977, - SPELL_THUNDERCLAP = 8078, - QUEST_TOREK_ASSULT = 6544, - NPC_SPLINTERTREE_RAIDER = 12859, - NPC_DURIEL = 12860, - NPC_SILVERWING_SENTINEL = 12896, - NPC_SILVERWING_WARRIOR = 12897, - FACTION_QUEST = 113 -}; - -class npc_torek : public CreatureScript -{ -public: - npc_torek() : CreatureScript("npc_torek") { } - - struct npc_torekAI : public npc_escortAI - { - npc_torekAI(Creature* creature) : npc_escortAI(creature) - { - Initialize(); - } - - void Initialize() - { - rend_Timer = 5000; - thunderclap_Timer = 8000; - _completed = false; - } - - void Reset() override - { - Initialize(); - } - - void EnterCombat(Unit* /*who*/) override { } - - void JustSummoned(Creature* summoned) override - { - summoned->AI()->AttackStart(me); - } - - void sQuestAccept(Player* player, Quest const* quest) - { - if (quest->GetQuestId() == QUEST_TOREK_ASSULT) - { - /// @todo find companions, make them follow Torek, at any time (possibly done by core/database in future?) - Talk(SAY_READY, player); - me->setFaction(FACTION_QUEST); - npc_escortAI::Start(true, true, player->GetGUID()); - } - } - - void WaypointReached(uint32 waypointId) override - { - if (Player* player = GetPlayerForEscort()) - { - switch (waypointId) - { - case 1: - Talk(SAY_MOVE, player); - break; - case 8: - Talk(SAY_PREPARE, player); - break; - case 19: - /// @todo verify location and creatures amount. - me->SummonCreature(NPC_DURIEL, 1776.73f, -2049.06f, 109.83f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(NPC_SILVERWING_SENTINEL, 1774.64f, -2049.41f, 109.83f, 1.40f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(NPC_SILVERWING_WARRIOR, 1778.73f, -2049.50f, 109.83f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 20: - Talk(SAY_WIN, player); - _completed = true; - player->GroupEventHappens(QUEST_TOREK_ASSULT, me); - break; - case 21: - Talk(SAY_END, player); - break; - } - } - } - - void UpdateAI(uint32 diff) override - { - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (rend_Timer <= diff) - { - DoCastVictim(SPELL_REND); - rend_Timer = 20000; - } else rend_Timer -= diff; - - if (thunderclap_Timer <= diff) - { - DoCast(me, SPELL_THUNDERCLAP); - thunderclap_Timer = 30000; - } else thunderclap_Timer -= diff; - } - - private: - uint32 rend_Timer; - uint32 thunderclap_Timer; - bool _completed; - - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_torekAI(creature); - } -}; - /*#### # npc_ruul_snowhoof ####*/ @@ -169,6 +42,7 @@ enum RuulSnowhoof NPC_THISTLEFUR_TOTEMIC = 3922, NPC_THISTLEFUR_PATHFINDER = 3926, QUEST_FREEDOM_TO_RUUL = 6482, + FACTION_QUEST = 113, GO_CAGE = 178147 }; @@ -204,7 +78,7 @@ public: summoned->AI()->AttackStart(me); } - void sQuestAccept(Player* player, Quest const* quest) + void sQuestAccept(Player* player, Quest const* quest) override { if (quest->GetQuestId() == QUEST_FREEDOM_TO_RUUL) { @@ -346,7 +220,7 @@ public: summoned->AI()->AttackStart(me); } - void sQuestAccept(Player* player, Quest const* quest) + void sQuestAccept(Player* player, Quest const* quest) override { if (quest->GetQuestId() == QUEST_VORSHA) { @@ -472,7 +346,6 @@ class go_naga_brazier : public GameObjectScript void AddSC_ashenvale() { - new npc_torek(); new npc_ruul_snowhoof(); new npc_muglash(); new go_naga_brazier(); diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp index 006c776cd11..5df11a573a1 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -350,7 +350,7 @@ public: Talk(SAY_AGGRO, who); } - void sQuestAccept(Player* player, Quest const* quest) + void sQuestAccept(Player* player, Quest const* quest) override { if (quest->GetQuestId() == QUEST_A_CRY_FOR_SAY_HELP) { diff --git a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp index 3ea7cf0155c..ab2e82171f1 100644 --- a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp @@ -29,11 +29,12 @@ EndContentData */ #include "Player.h" #include "Group.h" -#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "PassiveAI.h" +#include "CellImpl.h" /*###### ## npc_webbed_creature @@ -360,7 +361,10 @@ public: struct npc_demolitionist_legosoAI : public npc_escortAI { - npc_demolitionist_legosoAI(Creature* creature) : npc_escortAI(creature) { } + npc_demolitionist_legosoAI(Creature* creature) : npc_escortAI(creature) + { + Initialize(); + } void sQuestAccept(Player* player, Quest const* quest) override { @@ -394,11 +398,16 @@ public: } } - void Reset() override + void Initialize() { _phase = PHASE_NONE; _moveTimer = 0; _eventStarterGuidLow = 0; + } + + void Reset() override + { + Initialize(); me->SetCanDualWield(true); _events.Reset(); diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp index 194daf21807..ec1291c6d18 100644 --- a/src/server/scripts/Kalimdor/zone_winterspring.cpp +++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp @@ -451,7 +451,7 @@ public: } } - void JustDidDialogueStep(int32 entry) + void JustDidDialogueStep(int32 entry) override { switch (entry) { @@ -550,7 +550,7 @@ public: } } - Creature* GetSpeakerByEntry(int32 entry) + Creature* GetSpeakerByEntry(int32 entry) override { switch (entry) { diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index 1482e884614..bb190e94cc8 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -108,7 +108,7 @@ class boss_prince_taldaram : public CreatureScript events.ScheduleEvent(EVENT_CONJURE_FLAME_SPHERES, 5000); } - void JustSummoned(Creature* summon) + void JustSummoned(Creature* summon) override { BossAI::JustSummoned(summon); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp index ec668952a68..3130bf20a0c 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -44,7 +44,7 @@ class instance_ruby_sanctum : public InstanceMapScript BaltharusSharedHealth = 0; } - void OnPlayerEnter(Player* /*player*/) + void OnPlayerEnter(Player* /*player*/) override { if (!GetGuidData(DATA_HALION_CONTROLLER) && GetBossState(DATA_HALION) != DONE && GetBossState(DATA_GENERAL_ZARITHRIAN) == DONE) { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index 5f27830fd07..15bdedc75db 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -1873,7 +1873,7 @@ class spell_igb_rocket_pack_useable : public SpellScriptLoader { PrepareAuraScript(spell_igb_rocket_pack_useable_AuraScript); - bool Load() + bool Load() override { return GetOwner()->GetInstanceScript() != nullptr; } @@ -2001,7 +2001,7 @@ class spell_igb_cannon_blast : public SpellScriptLoader { PrepareSpellScript(spell_igb_cannon_blast_SpellScript); - bool Load() + bool Load() override { return GetCaster()->GetTypeId() == TYPEID_UNIT; } @@ -2343,7 +2343,7 @@ class spell_igb_gunship_fall_teleport : public SpellScriptLoader { PrepareSpellScript(spell_igb_gunship_fall_teleport_SpellScript); - bool Load() + bool Load() override { return GetCaster()->GetInstanceScript() != nullptr; } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index cd684cb714a..3c05c9da79a 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -317,7 +317,7 @@ class instance_icecrown_citadel : public InstanceMapScript } // Weekly quest spawn prevention - uint32 GetCreatureEntry(uint32 /*guidLow*/, CreatureData const* data) + uint32 GetCreatureEntry(uint32 /*guidLow*/, CreatureData const* data) override { uint32 entry = data->id; switch (entry) diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp index 173c6618cb0..3a431ab3ac0 100644 --- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp +++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp @@ -564,7 +564,7 @@ class instance_naxxramas : public InstanceMapScript return true; } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target = NULL*/, uint32 /*miscvalue1 = 0*/) + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target = NULL*/, uint32 /*miscvalue1 = 0*/) override { switch (criteria_id) { diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp index 74be65c62c2..41645a6ebb8 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp @@ -78,7 +78,7 @@ public: frenzy = false; } - void Reset() + void Reset() override { BossAI::Reset(); Initialize(); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index 4841950d9d3..64403ad40ca 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -458,7 +458,7 @@ class spell_general_vezax_mark_of_the_faceless : public SpellScriptLoader { PrepareAuraScript(spell_general_vezax_mark_of_the_faceless_AuraScript); - bool Validate(SpellInfo const* /*spellInfo*/) + bool Validate(SpellInfo const* /*spellInfo*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_THE_FACELESS_DAMAGE)) return false; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp index a7a9f8dde88..181fb49ba2e 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp @@ -1128,7 +1128,7 @@ class npc_ominous_cloud : public CreatureScript void UpdateAI(uint32 /*diff*/) override { } - void DoAction(int32 action) override + void DoAction(int32 /*action*/) override { me->GetMotionMaster()->MoveCirclePath(YoggSaronSpawnPos.GetPositionX(), YoggSaronSpawnPos.GetPositionY(), me->GetPositionZ() + 5.0f, me->GetDistance2d(YoggSaronSpawnPos.GetPositionX(), YoggSaronSpawnPos.GetPositionY()), true, 16); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 49ed9609a03..ca3ea3a60ed 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -448,7 +448,7 @@ class instance_ulduar : public InstanceMapScript } } - void OnGameObjectCreate(GameObject* gameObject) + void OnGameObjectCreate(GameObject* gameObject) override { switch (gameObject->GetEntry()) { diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index 571f73ea628..483beda43ee 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -141,7 +141,7 @@ class boss_ingvar_the_plunderer : public CreatureScript damage = 0; } - void DoAction(int32 actionId) + void DoAction(int32 actionId) override { if (actionId == ACTION_START_PHASE_2) StartZombiePhase(); diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index a462c68e084..ea50969ecb8 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -802,7 +802,7 @@ public: } } - void ProcessEvent(WorldObject* /*go*/, uint32 uiEventId) + void ProcessEvent(WorldObject* /*go*/, uint32 uiEventId) override { switch (uiEventId) { diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h index a08e141294d..9c76b35937e 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h @@ -184,9 +184,9 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint public: OPvPCapturePointZM_GraveYard(OutdoorPvP* pvp); - bool Update(uint32 diff); + bool Update(uint32 diff) override; - void ChangeState() { } + void ChangeState() override { } void FillInitialWorldStates(WorldPacket & data); @@ -196,11 +196,11 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint void SetBeaconState(uint32 controlling_team); // not good atm - bool HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid); + bool HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid) override; - bool HandleDropFlag(Player* player, uint32 spellId); + bool HandleDropFlag(Player* player, uint32 spellId) override; - bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso); + bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso) override; uint32 GetGraveYardState() const; diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp index 2b5ad18022a..9667b4e3bb0 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp @@ -93,7 +93,7 @@ class boss_ambassador_hellmaw : public CreatureScript { } - void DoAction(int32 actionId) + void DoAction(int32 actionId) override { if (actionId == ACTION_AMBASSADOR_HELLMAW_INTRO) DoIntro(); diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp index 9d2737c8ba5..f984272f4d5 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp @@ -92,7 +92,7 @@ class instance_shadow_labyrinth : public InstanceMapScript } } - void OnUnitDeath(Unit* unit) + void OnUnitDeath(Unit* unit) override { Creature* creature = unit->ToCreature(); if (!creature) diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index 2750476db76..096777163a6 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -280,7 +280,7 @@ public: Map::PlayerList const &PlayerList = map->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - if (i->GetSource() && i->GetSource()->IsAlive() && me->HasInArc(float(diff/20000*M_PI*2), i->GetSource()) && me->IsWithinDist(i->GetSource(), SPOUT_DIST) && !i->GetSource()->IsInWater()) + if (i->GetSource() && i->GetSource()->IsAlive() && me->HasInArc(diff/20000.f*float(M_PI)*2.f, i->GetSource()) && me->IsWithinDist(i->GetSource(), SPOUT_DIST) && !i->GetSource()->IsInWater()) DoCast(i->GetSource(), SPELL_SPOUT, true); // only knock back players in arc, in 100yards, not in water } } diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp index 374ce3cd957..88dbeff09f5 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp @@ -123,7 +123,7 @@ public: instance->SetBossState(DATA_MAULGAR, DONE); } - void DoAction(int32 actionId) + void DoAction(int32 actionId) override { if (actionId == ACTION_ADD_DEATH) Talk(SAY_OGRE_DEATH); 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 0d7fe11956b..7d00cd97126 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp @@ -416,7 +416,7 @@ class npc_omrogg_heads : public CreatureScript void EnterCombat(Unit* /*who*/) override { } - void SetData(uint32 data, uint32 value) + void SetData(uint32 data, uint32 value) override { if (data == SETDATA_DATA && value == SETDATA_YELL) { diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index ee12d8c4d0d..6021e38d3cf 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -316,10 +316,10 @@ class boss_high_astromancer_solarian : public CreatureScript Portals[i][2] = PORTAL_Z; } } - if ((abs(Portals[2][0] - Portals[1][0]) < 7) && (abs(Portals[2][1] - Portals[1][1]) < 7)) + if ((std::abs(Portals[2][0] - Portals[1][0]) < 7) && (std::abs(Portals[2][1] - Portals[1][1]) < 7)) { int i=1; - if (abs(CENTER_X + 26.0f - Portals[2][0]) < 7) + if (std::abs(CENTER_X + 26.0f - Portals[2][0]) < 7) i = -1; Portals[2][0] = Portals[2][0]+7*i; Portals[2][1] = Portal_Y(Portals[2][0], LARGE_PORTAL_RADIUS); diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp index 4955a2201e5..b2d63315029 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp @@ -42,7 +42,7 @@ class instance_mechanar : public InstanceMapScript LoadDoorData(doorData); } - void OnGameObjectCreate(GameObject* gameObject) + void OnGameObjectCreate(GameObject* gameObject) override { switch (gameObject->GetEntry()) { diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp index 72355b05ec1..bacc6533d4f 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -29,7 +29,6 @@ npc_bloodmaul_brute npc_nether_drake npc_daranelle go_legion_obelisk -go_thunderspike EndContentData */ #include "ScriptMgr.h" @@ -507,31 +506,6 @@ public: } }; -/*###### -## go_thunderspike -######*/ - -enum TheThunderspike -{ - NPC_GOR_GRIMGUT = 21319, - QUEST_THUNDERSPIKE = 10526, -}; - -class go_thunderspike : public GameObjectScript -{ - public: - go_thunderspike() : GameObjectScript("go_thunderspike") { } - - bool OnGossipHello(Player* player, GameObject* go) override - { - if (player->GetQuestStatus(QUEST_THUNDERSPIKE) == QUEST_STATUS_INCOMPLETE && !go->FindNearestCreature(NPC_GOR_GRIMGUT, 25.0f, true)) - if (Creature* gorGrimgut = go->SummonCreature(NPC_GOR_GRIMGUT, -2413.4f, 6914.48f, 25.01f, 3.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000)) - gorGrimgut->AI()->AttackStart(player); - - return true; - } -}; - enum SimonGame { NPC_SIMON_BUNNY = 22923, @@ -1224,7 +1198,6 @@ void AddSC_blades_edge_mountains() new npc_nether_drake(); new npc_daranelle(); new go_legion_obelisk(); - new go_thunderspike(); new npc_simon_bunny(); new go_simon_cluster(); new go_apexis_relic(); diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp index 97777cd5f6e..2a568a84a7c 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp @@ -289,7 +289,7 @@ public: summoned->AI()->AttackStart(me); } - void sQuestAccept(Player* player, Quest const* quest) + void sQuestAccept(Player* player, Quest const* quest) override { if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH) { diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index c661e19a98d..318214978ae 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -31,7 +31,6 @@ npc_enslaved_netherwing_drake npc_drake_dealer_hurlunk npcs_flanis_swiftwing_and_kagrosh npc_karynaku -npc_overlord_morghor npc_earthmender_wilda npc_torloth_the_magnificent npc_illidari_spawn @@ -676,331 +675,6 @@ class npc_karynaku : public CreatureScript } }; -/*#### -# npc_overlord_morghor -# this whole script is wrong and needs a rewrite.even the illidan npc used is the wrong one.npc id 23467 may be the correct one -####*/ -enum OverlordData -{ - QUEST_LORD_ILLIDAN_STORMRAGE = 11108, - - C_ILLIDAN = 22083, - C_YARZILL = 23141, - - SPELL_ONE = 39990, // Red Lightning Bolt - SPELL_TWO = 41528, // Mark of Stormrage - SPELL_THREE = 40216, // Dragonaw Faction - SPELL_FOUR = 42016, // Dragonaw Trasform - - OVERLORD_SAY_1 = 0, - OVERLORD_SAY_2 = 1, - //OVERLORD_SAY_3 = 2, - OVERLORD_SAY_4 = 3, - OVERLORD_SAY_5 = 4, - OVERLORD_SAY_6 = 5, - - OVERLORD_YELL_1 = 6, - OVERLORD_YELL_2 = 7, - - LORD_ILLIDAN_SAY_1 = 0, - LORD_ILLIDAN_SAY_2 = 1, - LORD_ILLIDAN_SAY_3 = 2, - LORD_ILLIDAN_SAY_4 = 3, - LORD_ILLIDAN_SAY_5 = 4, - LORD_ILLIDAN_SAY_6 = 5, - LORD_ILLIDAN_SAY_7 = 6, - - YARZILL_THE_MERC_SAY = 0 -}; - -class npc_overlord_morghor : public CreatureScript -{ -public: - npc_overlord_morghor() : CreatureScript("npc_overlord_morghor") { } - - bool OnQuestAccept(Player* player, Creature* creature, const Quest *_Quest) override - { - if (_Quest->GetQuestId() == QUEST_LORD_ILLIDAN_STORMRAGE) - { - ENSURE_AI(npc_overlord_morghor::npc_overlord_morghorAI, creature->AI())->PlayerGUID = player->GetGUID(); - ENSURE_AI(npc_overlord_morghor::npc_overlord_morghorAI, creature->AI())->StartEvent(); - return true; - } - return false; - } - - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_overlord_morghorAI(creature); - } - - struct npc_overlord_morghorAI : public ScriptedAI - { - npc_overlord_morghorAI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - } - - void Initialize() - { - PlayerGUID.Clear(); - IllidanGUID.Clear(); - - ConversationTimer = 0; - Step = 0; - - Event = false; - } - - ObjectGuid PlayerGUID; - ObjectGuid IllidanGUID; - - uint32 ConversationTimer; - uint32 Step; - - bool Event; - - void Reset() override - { - Initialize(); - me->SetUInt32Value(UNIT_NPC_FLAGS, 2); - } - - void StartEvent() - { - me->SetUInt32Value(UNIT_NPC_FLAGS, 0); - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - Unit* Illidan = me->SummonCreature(C_ILLIDAN, -5107.83f, 602.584f, 85.2393f, 4.92598f, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (Illidan) - { - IllidanGUID = Illidan->GetGUID(); - Illidan->SetVisible(false); - } - if (PlayerGUID) - { - Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); - if (player) - Talk(OVERLORD_SAY_1, player); - } - ConversationTimer = 4200; - Step = 0; - Event = true; - } - - uint32 NextStep(uint32 Step) - { - Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); - Creature* Illi = ObjectAccessor::GetCreature(*me, IllidanGUID); - - if (!player) - { - EnterEvadeMode(); - return 0; - } - - switch (Step) - { - case 0: - return 0; - break; - case 1: - me->GetMotionMaster()->MovePoint(0, -5104.41f, 595.297f, 85.6838f); - return 9000; - break; - case 2: - Talk(OVERLORD_YELL_1, player); - return 4500; - break; - case 3: - me->SetInFront(player); - return 3200; - break; - case 4: - Talk(OVERLORD_SAY_2, player); - return 2000; - break; - case 5: - if (Illi) - { - Illi->SetVisible(true); - Illi->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Illi->SetDisplayId(21526); - } - return 350; - break; - case 6: - if (Illi) - { - Illi->CastSpell(Illi, SPELL_ONE, true); - Illi->SetTarget(me->GetGUID()); - me->SetTarget(IllidanGUID); - } - return 2000; - break; - case 7: - Talk(OVERLORD_YELL_2); - return 4500; - break; - case 8: - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); - return 2500; - break; - case 9: - // missing text "Lord Illidan, this is the Dragonmaw that I, and others, have told you about. He will lead us to victory!" - return 5000; - break; - case 10: - if (Illi) - Illi->AI()->Talk(LORD_ILLIDAN_SAY_1); - return 5000; - break; - case 11: - Talk(OVERLORD_SAY_4, player); - return 6000; - break; - case 12: - if (Illi) - Illi->AI()->Talk(LORD_ILLIDAN_SAY_2); - return 5500; - break; - case 13: - if (Illi) - Illi->AI()->Talk(LORD_ILLIDAN_SAY_3); - return 4000; - break; - case 14: - if (Illi) - Illi->SetTarget(PlayerGUID); - return 1500; - break; - case 15: - if (Illi) - Illi->AI()->Talk(LORD_ILLIDAN_SAY_4); - return 1500; - break; - case 16: - if (Illi) - Illi->CastSpell(player, SPELL_TWO, true); - player->RemoveAurasDueToSpell(SPELL_THREE); - player->RemoveAurasDueToSpell(SPELL_FOUR); - return 5000; - break; - case 17: - if (Illi) - Illi->AI()->Talk(LORD_ILLIDAN_SAY_5); - return 5000; - break; - case 18: - if (Illi) - Illi->AI()->Talk(LORD_ILLIDAN_SAY_6); - return 5000; - break; - case 19: - if (Illi) - Illi->AI()->Talk(LORD_ILLIDAN_SAY_7); - return 5000; - break; - case 20: - if (Illi) - { - Illi->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - Illi->SetDisableGravity(true); - } - return 500; - break; - case 21: - Talk(OVERLORD_SAY_5); - return 500; - break; - case 22: - if (Illi) - { - Illi->SetVisible(false); - Illi->setDeathState(JUST_DIED); - } - return 1000; - break; - case 23: - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - return 2000; - break; - case 24: - me->SetTarget(PlayerGUID); - return 5000; - break; - case 25: - Talk(OVERLORD_SAY_6); - return 2000; - break; - case 26: - player->GroupEventHappens(QUEST_LORD_ILLIDAN_STORMRAGE, me); - return 6000; - break; - case 27: - { - Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50.0f); - if (Yarzill) - Yarzill->SetTarget(PlayerGUID); - return 500; - } - break; - case 28: - player->RemoveAurasDueToSpell(SPELL_TWO); - player->RemoveAurasDueToSpell(41519); - player->CastSpell(player, SPELL_THREE, true); - player->CastSpell(player, SPELL_FOUR, true); - return 1000; - break; - case 29: - { - if (Creature* Yarzill = me->FindNearestCreature(C_YARZILL, 50.0f)) - Yarzill->AI()->Talk(YARZILL_THE_MERC_SAY, player); - return 5000; - } - break; - case 30: - { - if (Creature* Yarzill = me->FindNearestCreature(C_YARZILL, 50.0f)) - Yarzill->SetTarget(ObjectGuid::Empty); - return 5000; - } - break; - case 31: - { - if (Creature* Yarzill = me->FindNearestCreature(C_YARZILL, 50.0f)) - Yarzill->CastSpell(player, 41540, true); - return 1000; - } - break; - case 32: - me->GetMotionMaster()->MovePoint(0, -5085.77f, 577.231f, 86.6719f); - return 5000; - break; - case 33: - me->SetTarget(ObjectGuid::Empty); - Reset(); - return 100; - break; - default : - return 0; - break; - } - } - - void UpdateAI(uint32 diff) override - { - if (!ConversationTimer) - return; - - if (ConversationTimer <= diff) - { - if (Event && PlayerGUID) - ConversationTimer = NextStep(++Step); - } else ConversationTimer -= diff; - } - }; -}; - /*#### # npc_earthmender_wilda ####*/ @@ -2026,7 +1700,6 @@ void AddSC_shadowmoon_valley() new npc_drake_dealer_hurlunk(); new npcs_flanis_swiftwing_and_kagrosh(); new npc_karynaku(); - new npc_overlord_morghor(); new npc_earthmender_wilda(); new npc_lord_illidan_stormrage(); new go_crystal_prison(); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 615b1fae856..d03ecb83597 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -477,7 +477,7 @@ class spell_item_flask_of_the_north : public SpellScriptLoader break; } - caster->CastSpell(caster, possibleSpells[irand(0, (possibleSpells.size() - 1))], true, NULL); + caster->CastSpell(caster, possibleSpells[urand(0, (possibleSpells.size() - 1))], true, NULL); } void Register() override diff --git a/src/server/shared/CMakeLists.txt b/src/server/shared/CMakeLists.txt index 4be94e334da..abc019863b1 100644 --- a/src/server/shared/CMakeLists.txt +++ b/src/server/shared/CMakeLists.txt @@ -84,6 +84,8 @@ include_directories( ${VALGRIND_INCLUDE_DIR} ) +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + add_library(shared STATIC ${shared_STAT_SRCS} ${shared_STAT_PCH_SRC} diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp index 1e1f8c7c3c6..ea426a5d33e 100644 --- a/src/server/shared/Configuration/Config.cpp +++ b/src/server/shared/Configuration/Config.cpp @@ -21,7 +21,6 @@ #include #include #include "Config.h" -#include "Errors.h" using namespace boost::property_tree; diff --git a/src/server/shared/Cryptography/ARC4.cpp b/src/server/shared/Cryptography/ARC4.cpp index 28c3da8d228..d1082b39347 100644 --- a/src/server/shared/Cryptography/ARC4.cpp +++ b/src/server/shared/Cryptography/ARC4.cpp @@ -17,7 +17,6 @@ */ #include "ARC4.h" -#include ARC4::ARC4(uint8 len) : m_ctx() { diff --git a/src/server/shared/Cryptography/BigNumber.cpp b/src/server/shared/Cryptography/BigNumber.cpp index 7886411697f..7eee9b418cb 100644 --- a/src/server/shared/Cryptography/BigNumber.cpp +++ b/src/server/shared/Cryptography/BigNumber.cpp @@ -18,7 +18,6 @@ #include "Cryptography/BigNumber.h" #include -#include #include #include #include diff --git a/src/server/shared/Database/DatabaseWorker.cpp b/src/server/shared/Database/DatabaseWorker.cpp index 1fe638552a0..56757ce12a0 100644 --- a/src/server/shared/Database/DatabaseWorker.cpp +++ b/src/server/shared/Database/DatabaseWorker.cpp @@ -18,8 +18,6 @@ #include "DatabaseEnv.h" #include "DatabaseWorker.h" #include "SQLOperation.h" -#include "MySQLConnection.h" -#include "MySQLThreading.h" #include "ProducerConsumerQueue.h" DatabaseWorker::DatabaseWorker(ProducerConsumerQueue* newQueue, MySQLConnection* connection) diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index deafbf3e80d..6bc204fbf76 100644 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -28,6 +28,7 @@ #include "QueryResult.h" #include "QueryHolder.h" #include "AdhocStatement.h" +#include "StringFormat.h" #include #include @@ -170,18 +171,13 @@ class DatabaseWorkerPool //! Enqueues a one-way SQL operation in string format -with variable args- that will be executed asynchronously. //! This method should only be used for queries that are only executed once, e.g during startup. - void PExecute(const char* sql, ...) + template + void PExecute(const char* sql, Args const&... args) { if (!sql) return; - va_list ap; - char szQuery[MAX_QUERY_LEN]; - va_start(ap, sql); - vsnprintf(szQuery, MAX_QUERY_LEN, sql, ap); - va_end(ap); - - Execute(szQuery); + Execute(Trinity::StringFormat(sql, args...).c_str()); } //! Enqueues a one-way SQL operation in prepared statement format that will be executed asynchronously. @@ -210,18 +206,13 @@ class DatabaseWorkerPool //! Directly executes a one-way SQL operation in string format -with variable args-, that will block the calling thread until finished. //! This method should only be used for queries that are only executed once, e.g during startup. - void DirectPExecute(const char* sql, ...) + template + void DirectPExecute(const char* sql, Args const&... args) { if (!sql) return; - va_list ap; - char szQuery[MAX_QUERY_LEN]; - va_start(ap, sql); - vsnprintf(szQuery, MAX_QUERY_LEN, sql, ap); - va_end(ap); - - return DirectExecute(szQuery); + DirectExecute(Trinity::StringFormat(sql, args...).c_str()); } //! Directly executes a one-way SQL operation in prepared statement format, that will block the calling thread until finished. @@ -260,34 +251,24 @@ class DatabaseWorkerPool //! Directly executes an SQL query in string format -with variable args- that will block the calling thread until finished. //! Returns reference counted auto pointer, no need for manual memory management in upper level code. - QueryResult PQuery(const char* sql, T* conn, ...) + template + QueryResult PQuery(const char* sql, T* conn, Args const&... args) { if (!sql) return QueryResult(NULL); - va_list ap; - char szQuery[MAX_QUERY_LEN]; - va_start(ap, conn); - vsnprintf(szQuery, MAX_QUERY_LEN, sql, ap); - va_end(ap); - - return Query(szQuery, conn); + return Query(Trinity::StringFormat(sql, args...).c_str(), conn); } //! Directly executes an SQL query in string format -with variable args- that will block the calling thread until finished. //! Returns reference counted auto pointer, no need for manual memory management in upper level code. - QueryResult PQuery(const char* sql, ...) + template + QueryResult PQuery(const char* sql, Args const&... args) { if (!sql) return QueryResult(NULL); - va_list ap; - char szQuery[MAX_QUERY_LEN]; - va_start(ap, sql); - vsnprintf(szQuery, MAX_QUERY_LEN, sql, ap); - va_end(ap); - - return Query(szQuery); + return Query(Trinity::StringFormat(sql, args...).c_str()); } //! Directly executes an SQL query in prepared format that will block the calling thread until finished. @@ -328,15 +309,10 @@ class DatabaseWorkerPool //! Enqueues a query in string format -with variable args- that will set the value of the QueryResultFuture return object as soon as the query is executed. //! The return value is then processed in ProcessQueryCallback methods. - QueryResultFuture AsyncPQuery(const char* sql, ...) + template + QueryResultFuture AsyncPQuery(const char* sql, Args const&... args) { - va_list ap; - char szQuery[MAX_QUERY_LEN]; - va_start(ap, sql); - vsnprintf(szQuery, MAX_QUERY_LEN, sql, ap); - va_end(ap); - - return AsyncQuery(szQuery); + return AsyncQuery(Trinity::StringFormat(sql, args...).c_str()); } //! Enqueues a query in prepared format that will set the value of the PreparedQueryResultFuture return object as soon as the query is executed. diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index a16559a55dc..10f4a7baa18 100644 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -22,11 +22,9 @@ #include #endif #include -#include #include #include "MySQLConnection.h" -#include "MySQLThreading.h" #include "QueryResult.h" #include "SQLOperation.h" #include "PreparedStatement.h" diff --git a/src/server/shared/Database/QueryHolder.cpp b/src/server/shared/Database/QueryHolder.cpp index 75b96e1996c..2fdb3825526 100644 --- a/src/server/shared/Database/QueryHolder.cpp +++ b/src/server/shared/Database/QueryHolder.cpp @@ -40,29 +40,6 @@ bool SQLQueryHolder::SetQuery(size_t index, const char *sql) return true; } -bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...) -{ - if (!format) - { - TC_LOG_ERROR("sql.sql", "Query (index: %u) is empty.", uint32(index)); - return false; - } - - va_list ap; - char szQuery [MAX_QUERY_LEN]; - va_start(ap, format); - int res = vsnprintf(szQuery, MAX_QUERY_LEN, format, ap); - va_end(ap); - - if (res == -1) - { - TC_LOG_ERROR("sql.sql", "SQL Query truncated (and not execute) for format: %s", format); - return false; - } - - return SetQuery(index, szQuery); -} - bool SQLQueryHolder::SetPreparedQuery(size_t index, PreparedStatement* stmt) { if (m_queries.size() <= index) diff --git a/src/server/shared/Database/QueryHolder.h b/src/server/shared/Database/QueryHolder.h index 6fd1901447e..4102bba1223 100644 --- a/src/server/shared/Database/QueryHolder.h +++ b/src/server/shared/Database/QueryHolder.h @@ -29,8 +29,9 @@ class SQLQueryHolder public: SQLQueryHolder() { } ~SQLQueryHolder(); - bool SetQuery(size_t index, const char *sql); - bool SetPQuery(size_t index, const char *format, ...) ATTR_PRINTF(3, 4); + bool SetQuery(size_t index, const char* sql); + template + bool SetPQuery(size_t index, const char* sql, Args const&... args) { return SetQuery(index, Trinity::StringFormat(sql, args...).c_str()); } bool SetPreparedQuery(size_t index, PreparedStatement* stmt); void SetSize(size_t size); QueryResult GetResult(size_t index); diff --git a/src/server/shared/Database/Transaction.cpp b/src/server/shared/Database/Transaction.cpp index 9f36d198bde..f657411f716 100644 --- a/src/server/shared/Database/Transaction.cpp +++ b/src/server/shared/Database/Transaction.cpp @@ -30,17 +30,6 @@ void Transaction::Append(const char* sql) m_queries.push_back(data); } -void Transaction::PAppend(const char* sql, ...) -{ - va_list ap; - char szQuery [MAX_QUERY_LEN]; - va_start(ap, sql); - vsnprintf(szQuery, MAX_QUERY_LEN, sql, ap); - va_end(ap); - - Append(szQuery); -} - //- Append a prepared statement to the transaction void Transaction::Append(PreparedStatement* stmt) { diff --git a/src/server/shared/Database/Transaction.h b/src/server/shared/Database/Transaction.h index 83d59006ddc..43850b1d016 100644 --- a/src/server/shared/Database/Transaction.h +++ b/src/server/shared/Database/Transaction.h @@ -19,6 +19,7 @@ #define _TRANSACTION_H #include "SQLOperation.h" +#include "StringFormat.h" //- Forward declare (don't include header to prevent circular includes) class PreparedStatement; @@ -38,7 +39,8 @@ class Transaction void Append(PreparedStatement* statement); void Append(const char* sql); - void PAppend(const char* sql, ...); + template + void PAppend(const char* sql, Args const&... args) { Append(Trinity::StringFormat(sql, args...).c_str()); } size_t GetSize() const { return m_queries.size(); } diff --git a/src/server/shared/Dynamic/ObjectRegistry.h b/src/server/shared/Dynamic/ObjectRegistry.h index be253f947a7..1eb9368be61 100644 --- a/src/server/shared/Dynamic/ObjectRegistry.h +++ b/src/server/shared/Dynamic/ObjectRegistry.h @@ -47,12 +47,12 @@ class ObjectRegistry } /// Inserts a registry item - bool InsertItem(T *obj, Key key, bool override = false) + bool InsertItem(T *obj, Key key, bool _override = false) { typename RegistryMapType::iterator iter = i_registeredObjects.find(key); if ( iter != i_registeredObjects.end() ) { - if ( !override ) + if ( !_override ) return false; delete iter->second; i_registeredObjects.erase(iter); diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index c9a4432039f..a2150733c6b 100644 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -25,7 +25,6 @@ #include "AppenderDB.h" #include "LogOperation.h" -#include #include #include diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index d4653960b15..e22a06e635e 100644 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -64,7 +64,7 @@ class Log template inline void outMessage(std::string const& filter, LogLevel const level, const char* fmt, Args const&... args) { - write(std::move(std::unique_ptr(new LogMessage(level, filter, std::move(Trinity::StringFormat(fmt, args...)))))); + write(std::unique_ptr(new LogMessage(level, filter, Trinity::StringFormat(fmt, args...)))); } template diff --git a/src/server/shared/Networking/Socket.h b/src/server/shared/Networking/Socket.h index f7a1b954cb0..396d4bb3aab 100644 --- a/src/server/shared/Networking/Socket.h +++ b/src/server/shared/Networking/Socket.h @@ -62,7 +62,7 @@ public: return false; #ifndef TC_SOCKET_USE_IOCP - std::unique_lock guard(_writeLock, std::try_to_lock); + std::unique_lock guard(_writeLock); if (!guard) return true; @@ -140,6 +140,8 @@ public: if (shutdownError) TC_LOG_DEBUG("network", "Socket::CloseSocket: %s errored when shutting down socket: %i (%s)", GetRemoteIpAddress().to_string().c_str(), shutdownError.value(), shutdownError.message().c_str()); + + OnClose(); } /// Marks the socket for closing after write buffer becomes empty @@ -148,6 +150,8 @@ public: MessageBuffer& GetReadBuffer() { return _readBuffer; } protected: + virtual void OnClose() { } + virtual void ReadHandler() = 0; bool AsyncProcessQueue(std::unique_lock&) diff --git a/src/server/shared/Updater/DBUpdater.cpp b/src/server/shared/Updater/DBUpdater.cpp index 15226577504..e5c571e4517 100644 --- a/src/server/shared/Updater/DBUpdater.cpp +++ b/src/server/shared/Updater/DBUpdater.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -240,11 +239,19 @@ bool DBUpdater::Update(DatabaseWorkerPool& pool) [&](Path const& file) { DBUpdater::ApplyFile(pool, file); }, [&](std::string const& query) -> QueryResult { return DBUpdater::Retrieve(pool, query); }); - uint32 const count = updateFetcher.Update( - sConfigMgr->GetBoolDefault("Updates.Redundancy", true), - sConfigMgr->GetBoolDefault("Updates.AllowRehash", true), - sConfigMgr->GetBoolDefault("Updates.ArchivedRedundancy", false), - sConfigMgr->GetIntDefault("Updates.CleanDeadRefMaxCount", 3)); + uint32 count; + try + { + count = updateFetcher.Update( + sConfigMgr->GetBoolDefault("Updates.Redundancy", true), + sConfigMgr->GetBoolDefault("Updates.AllowRehash", true), + sConfigMgr->GetBoolDefault("Updates.ArchivedRedundancy", false), + sConfigMgr->GetIntDefault("Updates.CleanDeadRefMaxCount", 3)); + } + catch (UpdateException&) + { + return false; + } if (!count) TC_LOG_INFO("sql.updates", ">> %s database is up-to-date!", DBUpdater::GetTableName().c_str()); @@ -299,7 +306,14 @@ bool DBUpdater::Populate(DatabaseWorkerPool& pool) // Update database TC_LOG_INFO("sql.updates", ">> Applying \'%s\'...", base.generic_string().c_str()); - ApplyFile(pool, base); + try + { + ApplyFile(pool, base); + } + catch (UpdateException&) + { + return false; + } TC_LOG_INFO("sql.updates", ">> Done!"); return true; diff --git a/src/server/shared/Updater/UpdateFetcher.h b/src/server/shared/Updater/UpdateFetcher.h index 094e353f274..fa142547873 100644 --- a/src/server/shared/Updater/UpdateFetcher.h +++ b/src/server/shared/Updater/UpdateFetcher.h @@ -27,7 +27,7 @@ class UpdateFetcher { - using Path = boost::filesystem::path; + typedef boost::filesystem::path Path; public: UpdateFetcher(Path const& updateDirectory, @@ -53,6 +53,9 @@ private: struct AppliedFileEntry { + AppliedFileEntry(std::string const& name_, std::string const& hash_, State state_, uint64 timestamp_) + : name(name_), hash(hash_), state(state_), timestamp(timestamp_) { } + std::string const name; std::string const hash; @@ -79,12 +82,14 @@ private: struct DirectoryEntry { + DirectoryEntry(Path const& path_, State state_) : path(path_), state(state_) { } + Path const path; State const state; }; - using LocaleFileEntry = std::pair; + typedef std::pair LocaleFileEntry; struct PathCompare { @@ -94,11 +99,11 @@ private: } }; - using LocaleFileStorage = std::set; - using HashToFileNameStorage = std::unordered_map; - using AppliedFileStorage = std::unordered_map; - using DirectoryStorage = std::vector; - using SQLUpdate = std::shared_ptr; + typedef std::set LocaleFileStorage; + typedef std::unordered_map HashToFileNameStorage; + typedef std::unordered_map AppliedFileStorage; + typedef std::vector DirectoryStorage; + typedef std::shared_ptr SQLUpdate; LocaleFileStorage GetFileList() const; void FillFileListRecursively(Path const& path, LocaleFileStorage& storage, State const state, uint32 const depth) const; diff --git a/src/server/shared/Utilities/ServiceWin32.cpp b/src/server/shared/Utilities/ServiceWin32.cpp index c73949fc6a3..3e5e416b1a3 100644 --- a/src/server/shared/Utilities/ServiceWin32.cpp +++ b/src/server/shared/Utilities/ServiceWin32.cpp @@ -255,7 +255,7 @@ bool WinServiceRun() if (!StartServiceCtrlDispatcher(serviceTable)) { - TC_LOG_ERROR("server.worldserver", "StartService Failed. Error [%u]", ::GetLastError()); + TC_LOG_ERROR("server.worldserver", "StartService Failed. Error [%u]", uint32(::GetLastError())); return false; } return true; diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index a7ba5b29a7c..93f35c798fd 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -149,6 +149,8 @@ include_directories( ${ZMQ_INCLUDE_DIR} ) +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + add_executable(worldserver ${worldserver_SRCS} ${worldserver_PCH_SRC} diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index 6e961922b0e..ad9ae28f712 100644 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -23,21 +23,16 @@ #include "Common.h" #include "ObjectMgr.h" #include "World.h" -#include "WorldSession.h" #include "Configuration/Config.h" -#include "AccountMgr.h" -#include "Chat.h" #include "CliRunnable.h" -#include "Language.h" #include "Log.h" -#include "MapManager.h" -#include "Player.h" #include "Util.h" #if PLATFORM != PLATFORM_WINDOWS #include #include +#include "Chat.h" char* command_finder(const char* text, int state) { diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 0b0a91d14a8..add4b2d5b67 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -318,7 +318,7 @@ void ShutdownCLIThread(std::thread* cliThread) errorBuffer = "Unknown error"; TC_LOG_DEBUG("server.worldserver", "Error cancelling I/O of CliThread, error code %u, detail: %s", - errorCode, errorBuffer); + uint32(errorCode), errorBuffer); LocalFree(errorBuffer); // send keyboard input to safely unblock the CLI thread diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 5d50b4ad5f4..0ffc11ba987 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -3233,6 +3233,7 @@ Logger.sql.sql=5,Console DBErrors Logger.sql.updates=3,Console Server #Logger.achievement=3,Console Server +#Logger.addon=3,Console Server #Logger.ahbot=3,Console Server #Logger.auctionHouse=3,Console Server #Logger.bg.arena=3,Console Server diff --git a/src/tools/vmap4_assembler/CMakeLists.txt b/src/tools/vmap4_assembler/CMakeLists.txt index 436247261ff..bb1971b3ed9 100644 --- a/src/tools/vmap4_assembler/CMakeLists.txt +++ b/src/tools/vmap4_assembler/CMakeLists.txt @@ -16,7 +16,6 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/collision ${CMAKE_SOURCE_DIR}/src/server/collision/Maps ${CMAKE_SOURCE_DIR}/src/server/collision/Models - ${ACE_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ) diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp index e490015359f..e1eae10ff77 100644 --- a/src/tools/vmap4_extractor/vmapexport.cpp +++ b/src/tools/vmap4_extractor/vmapexport.cpp @@ -358,7 +358,7 @@ bool ExtractSingleWmo(std::string& fname) for (uint32 i = 0; i < froot.nGroups; ++i) { char temp[1024]; - strcpy(temp, fname.c_str()); + strncpy(temp, fname.c_str(), 1024); temp[fname.length()-4] = 0; char groupFileName[1024]; sprintf(groupFileName, "%s_%03u.wmo", temp, i); @@ -445,7 +445,9 @@ bool processArgv(int argc, char ** argv, const char *versionString) if((i+1)getRecord (x).getUInt(0); - strcpy(map_ids[x].name,dbc->getRecord(x).getString(1)); - printf("Map - %s\n",map_ids[x].name); - } + map_ids[x].id = dbc->getRecord(x).getUInt(0); + const char* map_name = dbc->getRecord(x).getString(1); + size_t max_map_name_length = sizeof(map_ids[x].name); + if (strlen(map_name) >= max_map_name_length) + { + delete dbc; + delete[] map_ids; + printf("FATAL ERROR: Map name too long.\n"); + return 1; + } + + strncpy(map_ids[x].name, map_name, max_map_name_length); + map_ids[x].name[max_map_name_length - 1] = '\0'; + printf("Map - %s\n", map_ids[x].name); + } delete dbc; ParsMapFiles(); diff --git a/src/tools/vmap4_extractor/wdtfile.cpp b/src/tools/vmap4_extractor/wdtfile.cpp index 254cfdaedb3..5aefbd4ecef 100644 --- a/src/tools/vmap4_extractor/wdtfile.cpp +++ b/src/tools/vmap4_extractor/wdtfile.cpp @@ -105,6 +105,7 @@ bool WDTFile::init(char* /*map_id*/, unsigned int mapID) } delete[] gWmoInstansName; + gWmoInstansName = NULL; } } WDT.seek((int)nextpos);