diff options
163 files changed, 3145 insertions, 3469 deletions
diff --git a/dep/jemalloc/VERSION b/dep/jemalloc/VERSION index aa85f5a2acf..585f53edd80 100644 --- a/dep/jemalloc/VERSION +++ b/dep/jemalloc/VERSION @@ -1 +1 @@ -2.2.5-0-gfc1bb70e5f0d9a58b39efa39cc549b5af5104760 +2.1.0-0-g1c4b088b08d3bc7617a34387e196ce03716160bf diff --git a/dep/jemalloc/include/jemalloc/internal/arena.h b/dep/jemalloc/include/jemalloc/internal/arena.h index b80c118d811..9556c2c68f7 100644 --- a/dep/jemalloc/include/jemalloc/internal/arena.h +++ b/dep/jemalloc/include/jemalloc/internal/arena.h @@ -19,7 +19,6 @@ #ifdef JEMALLOC_TINY /* Smallest size class to support. */ # define LG_TINY_MIN LG_SIZEOF_PTR -# define TINY_MIN (1U << LG_TINY_MIN) #endif /* @@ -46,10 +45,9 @@ * point is implicitly RUN_BFP bits to the left. * * Note that it is possible to set RUN_MAX_OVRHD low enough that it cannot be - * honored for some/all object sizes, since when heap profiling is enabled - * there is one pointer of header overhead per object (plus a constant). This - * constraint is relaxed (ignored) for runs that are so small that the - * per-region overhead is greater than: + * honored for some/all object sizes, since there is one bit of header overhead + * per object (plus a constant). This constraint is relaxed (ignored) for runs + * that are so small that the per-region overhead is greater than: * * (RUN_MAX_OVRHD / (reg_size << (3+RUN_BFP)) */ @@ -58,10 +56,6 @@ #define RUN_MAX_OVRHD 0x0000003dU #define RUN_MAX_OVRHD_RELAX 0x00001800U -/* Maximum number of regions in one run. */ -#define LG_RUN_MAXREGS 11 -#define RUN_MAXREGS (1U << LG_RUN_MAXREGS) - /* * The minimum ratio of active:dirty pages per arena is computed as: * @@ -75,7 +69,6 @@ typedef struct arena_chunk_map_s arena_chunk_map_t; typedef struct arena_chunk_s arena_chunk_t; typedef struct arena_run_s arena_run_t; -typedef struct arena_bin_info_s arena_bin_info_t; typedef struct arena_bin_s arena_bin_t; typedef struct arena_s arena_t; @@ -112,7 +105,7 @@ struct arena_chunk_map_s { * Run address (or size) and various flags are stored together. The bit * layout looks like (assuming 32-bit system): * - * ???????? ???????? ????---- ----dula + * ???????? ???????? ????---- ----dzla * * ? : Unallocated: Run address for first/last pages, unset for internal * pages. @@ -120,7 +113,7 @@ struct arena_chunk_map_s { * Large: Run size for first page, unset for trailing pages. * - : Unused. * d : dirty? - * u : unzeroed? + * z : zeroed? * l : large? * a : allocated? * @@ -136,30 +129,30 @@ struct arena_chunk_map_s { * [dula] : bit unset * * Unallocated (clean): - * ssssssss ssssssss ssss---- ----du-a + * ssssssss ssssssss ssss---- ----du-- * xxxxxxxx xxxxxxxx xxxx---- -----Uxx - * ssssssss ssssssss ssss---- ----dU-a + * ssssssss ssssssss ssss---- ----dU-- * * Unallocated (dirty): - * ssssssss ssssssss ssss---- ----D--a + * ssssssss ssssssss ssss---- ----D--- * xxxxxxxx xxxxxxxx xxxx---- ----xxxx - * ssssssss ssssssss ssss---- ----D--a + * ssssssss ssssssss ssss---- ----D--- * * Small: - * pppppppp pppppppp pppp---- ----d--A - * pppppppp pppppppp pppp---- -------A - * pppppppp pppppppp pppp---- ----d--A + * pppppppp pppppppp pppp---- ----d--a + * pppppppp pppppppp pppp---- -------a + * pppppppp pppppppp pppp---- ----d--a * * Large: - * ssssssss ssssssss ssss---- ----D-LA + * ssssssss ssssssss ssss---- ----D-la * xxxxxxxx xxxxxxxx xxxx---- ----xxxx - * -------- -------- -------- ----D-LA + * -------- -------- -------- ----D-la * * Large (sampled, size <= PAGE_SIZE): - * ssssssss ssssssss sssscccc ccccD-LA + * ssssssss ssssssss sssscccc ccccD-la * * Large (not sampled, size == PAGE_SIZE): - * ssssssss ssssssss ssss---- ----D-LA + * ssssssss ssssssss ssss---- ----D-la */ size_t bits; #ifdef JEMALLOC_PROF @@ -213,52 +206,16 @@ struct arena_run_s { /* Bin this run is associated with. */ arena_bin_t *bin; - /* Index of next region that has never been allocated, or nregs. */ - uint32_t nextind; + /* Stack of available freed regions, or NULL. */ + void *avail; + + /* Next region that has never been allocated, or run boundary. */ + void *next; /* Number of free regions in run. */ unsigned nfree; }; -/* - * Read-only information associated with each element of arena_t's bins array - * is stored separately, partly to reduce memory usage (only one copy, rather - * than one per arena), but mainly to avoid false cacheline sharing. - */ -struct arena_bin_info_s { - /* Size of regions in a run for this bin's size class. */ - size_t reg_size; - - /* Total size of a run for this bin's size class. */ - size_t run_size; - - /* Total number of regions in a run for this bin's size class. */ - uint32_t nregs; - - /* - * Offset of first bitmap_t element in a run header for this bin's size - * class. - */ - uint32_t bitmap_offset; - - /* - * Metadata used to manipulate bitmaps for runs associated with this - * bin. - */ - bitmap_info_t bitmap_info; - -#ifdef JEMALLOC_PROF - /* - * Offset of first (prof_ctx_t *) in a run header for this bin's size - * class, or 0 if (opt_prof == false). - */ - uint32_t ctx0_offset; -#endif - - /* Offset of first region in a run for this bin's size class. */ - uint32_t reg0_offset; -}; - struct arena_bin_s { /* * All operations on runcur, runs, and stats require that lock be @@ -283,6 +240,26 @@ struct arena_bin_s { */ arena_run_tree_t runs; + /* Size of regions in a run for this bin's size class. */ + size_t reg_size; + + /* Total size of a run for this bin's size class. */ + size_t run_size; + + /* Total number of regions in a run for this bin's size class. */ + uint32_t nregs; + +#ifdef JEMALLOC_PROF + /* + * Offset of first (prof_ctx_t *) in a run header for this bin's size + * class, or 0 if (opt_prof == false). + */ + uint32_t ctx0_offset; +#endif + + /* Offset of first region in a run for this bin's size class. */ + uint32_t reg0_offset; + #ifdef JEMALLOC_STATS /* Bin statistics. */ malloc_bin_stats_t stats; @@ -299,18 +276,8 @@ struct arena_s { unsigned ind; /* - * Number of threads currently assigned to this arena. This field is - * protected by arenas_lock. - */ - unsigned nthreads; - - /* - * There are three classes of arena operations from a locking - * perspective: - * 1) Thread asssignment (modifies nthreads) is protected by - * arenas_lock. - * 2) Bin-related operations are protected by bin locks. - * 3) Chunk- and run-related operations are protected by this mutex. + * All non-bin-related operations on this arena require that lock be + * locked. */ malloc_mutex_t lock; @@ -380,35 +347,45 @@ struct arena_s { /* * bins is used to store trees of free regions of the following sizes, - * assuming a 64-bit system with 16-byte quantum, 4 KiB page size, and - * default MALLOC_CONF. + * assuming a 16-byte quantum, 4 KiB page size, and default + * JEMALLOC_OPTIONS. * * bins[i] | size | * --------+--------+ - * 0 | 8 | + * 0 | 2 | + * 1 | 4 | + * 2 | 8 | * --------+--------+ - * 1 | 16 | - * 2 | 32 | - * 3 | 48 | + * 3 | 16 | + * 4 | 32 | + * 5 | 48 | * : : - * 6 | 96 | - * 7 | 112 | - * 8 | 128 | + * 8 | 96 | + * 9 | 112 | + * 10 | 128 | * --------+--------+ - * 9 | 192 | - * 10 | 256 | - * 11 | 320 | - * 12 | 384 | - * 13 | 448 | - * 14 | 512 | + * 11 | 192 | + * 12 | 256 | + * 13 | 320 | + * 14 | 384 | + * 15 | 448 | + * 16 | 512 | + * --------+--------+ + * 17 | 768 | + * 18 | 1024 | + * 19 | 1280 | + * : : + * 27 | 3328 | + * 28 | 3584 | + * 29 | 3840 | * --------+--------+ - * 15 | 768 | - * 16 | 1024 | - * 17 | 1280 | + * 30 | 4 KiB | + * 31 | 6 KiB | + * 33 | 8 KiB | * : : - * 25 | 3328 | - * 26 | 3584 | - * 27 | 3840 | + * 43 | 28 KiB | + * 44 | 30 KiB | + * 45 | 32 KiB | * --------+--------+ */ arena_bin_t bins[1]; /* Dynamically sized. */ @@ -420,16 +397,8 @@ struct arena_s { extern size_t opt_lg_qspace_max; extern size_t opt_lg_cspace_max; -extern ssize_t opt_lg_dirty_mult; -/* - * small_size2bin is a compact lookup table that rounds request sizes up to - * size classes. In order to reduce cache footprint, the table is compressed, - * and all accesses are via the SMALL_SIZE2BIN macro. - */ +extern ssize_t opt_lg_dirty_mult; extern uint8_t const *small_size2bin; -#define SMALL_SIZE2BIN(s) (small_size2bin[(s-1) >> LG_TINY_MIN]) - -extern arena_bin_info_t *arena_bin_info; /* Various bin-related settings. */ #ifdef JEMALLOC_TINY /* Number of (2^n)-spaced tiny bins. */ @@ -496,9 +465,8 @@ bool arena_boot(void); #ifdef JEMALLOC_H_INLINES #ifndef JEMALLOC_ENABLE_INLINE -size_t arena_bin_index(arena_t *arena, arena_bin_t *bin); -unsigned arena_run_regind(arena_run_t *run, arena_bin_info_t *bin_info, - const void *ptr); +unsigned arena_run_regind(arena_run_t *run, arena_bin_t *bin, + const void *ptr, size_t size); # ifdef JEMALLOC_PROF prof_ctx_t *arena_prof_ctx_get(const void *ptr); void arena_prof_ctx_set(const void *ptr, prof_ctx_t *ctx); @@ -507,37 +475,21 @@ void arena_dalloc(arena_t *arena, arena_chunk_t *chunk, void *ptr); #endif #if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_ARENA_C_)) -JEMALLOC_INLINE size_t -arena_bin_index(arena_t *arena, arena_bin_t *bin) -{ - size_t binind = bin - arena->bins; - assert(binind < nbins); - return (binind); -} - JEMALLOC_INLINE unsigned -arena_run_regind(arena_run_t *run, arena_bin_info_t *bin_info, const void *ptr) +arena_run_regind(arena_run_t *run, arena_bin_t *bin, const void *ptr, + size_t size) { unsigned shift, diff, regind; - size_t size; - dassert(run->magic == ARENA_RUN_MAGIC); - /* - * Freeing a pointer lower than region zero can cause assertion - * failure. - */ - assert((uintptr_t)ptr >= (uintptr_t)run + - (uintptr_t)bin_info->reg0_offset); + assert(run->magic == ARENA_RUN_MAGIC); /* * Avoid doing division with a variable divisor if possible. Using * actual division here can reduce allocator throughput by over 20%! */ - diff = (unsigned)((uintptr_t)ptr - (uintptr_t)run - - bin_info->reg0_offset); + diff = (unsigned)((uintptr_t)ptr - (uintptr_t)run - bin->reg0_offset); /* Rescale (factor powers of 2 out of the numerator and denominator). */ - size = bin_info->reg_size; shift = ffs(size) - 1; diff >>= shift; size >>= shift; @@ -560,8 +512,8 @@ arena_run_regind(arena_run_t *run, arena_bin_info_t *bin_info, const void *ptr) * divide by 0, and 1 and 2 are both powers of two, which are * handled above. */ -#define SIZE_INV_SHIFT ((sizeof(unsigned) << 3) - LG_RUN_MAXREGS) -#define SIZE_INV(s) (((1U << SIZE_INV_SHIFT) / (s)) + 1) +#define SIZE_INV_SHIFT 21 +#define SIZE_INV(s) (((1U << SIZE_INV_SHIFT) / (s)) + 1) static const unsigned size_invs[] = { SIZE_INV(3), SIZE_INV(4), SIZE_INV(5), SIZE_INV(6), SIZE_INV(7), @@ -581,7 +533,7 @@ arena_run_regind(arena_run_t *run, arena_bin_info_t *bin_info, const void *ptr) #undef SIZE_INV_SHIFT } assert(diff == regind * size); - assert(regind < bin_info->nregs); + assert(regind < bin->nregs); return (regind); } @@ -608,14 +560,13 @@ arena_prof_ctx_get(const void *ptr) arena_run_t *run = (arena_run_t *)((uintptr_t)chunk + (uintptr_t)((pageind - (mapbits >> PAGE_SHIFT)) << PAGE_SHIFT)); - size_t binind = arena_bin_index(chunk->arena, run->bin); - arena_bin_info_t *bin_info = &arena_bin_info[binind]; + arena_bin_t *bin = run->bin; unsigned regind; - dassert(run->magic == ARENA_RUN_MAGIC); - regind = arena_run_regind(run, bin_info, ptr); + assert(run->magic == ARENA_RUN_MAGIC); + regind = arena_run_regind(run, bin, ptr, bin->reg_size); ret = *(prof_ctx_t **)((uintptr_t)run + - bin_info->ctx0_offset + (regind * + bin->ctx0_offset + (regind * sizeof(prof_ctx_t *))); } } else @@ -643,16 +594,12 @@ arena_prof_ctx_set(const void *ptr, prof_ctx_t *ctx) (uintptr_t)((pageind - (mapbits >> PAGE_SHIFT)) << PAGE_SHIFT)); arena_bin_t *bin = run->bin; - size_t binind; - arena_bin_info_t *bin_info; unsigned regind; - dassert(run->magic == ARENA_RUN_MAGIC); - binind = arena_bin_index(chunk->arena, bin); - bin_info = &arena_bin_info[binind]; - regind = arena_run_regind(run, bin_info, ptr); + assert(run->magic == ARENA_RUN_MAGIC); + regind = arena_run_regind(run, bin, ptr, bin->reg_size); - *((prof_ctx_t **)((uintptr_t)run + bin_info->ctx0_offset + *((prof_ctx_t **)((uintptr_t)run + bin->ctx0_offset + (regind * sizeof(prof_ctx_t *)))) = ctx; } else assert((uintptr_t)ctx == (uintptr_t)1U); @@ -668,7 +615,7 @@ arena_dalloc(arena_t *arena, arena_chunk_t *chunk, void *ptr) arena_chunk_map_t *mapelm; assert(arena != NULL); - dassert(arena->magic == ARENA_MAGIC); + assert(arena->magic == ARENA_MAGIC); assert(chunk->arena == arena); assert(ptr != NULL); assert(CHUNK_ADDR2BASE(ptr) != ptr); @@ -691,18 +638,11 @@ arena_dalloc(arena_t *arena, arena_chunk_t *chunk, void *ptr) run = (arena_run_t *)((uintptr_t)chunk + (uintptr_t)((pageind - (mapelm->bits >> PAGE_SHIFT)) << PAGE_SHIFT)); - dassert(run->magic == ARENA_RUN_MAGIC); + assert(run->magic == ARENA_RUN_MAGIC); + assert(((uintptr_t)ptr - ((uintptr_t)run + + (uintptr_t)run->bin->reg0_offset)) % + run->bin->reg_size == 0); bin = run->bin; -#ifdef JEMALLOC_DEBUG - { - size_t binind = arena_bin_index(arena, bin); - arena_bin_info_t *bin_info = - &arena_bin_info[binind]; - assert(((uintptr_t)ptr - ((uintptr_t)run + - (uintptr_t)bin_info->reg0_offset)) % - bin_info->reg_size == 0); - } -#endif malloc_mutex_lock(&bin->lock); arena_dalloc_bin(arena, chunk, ptr, mapelm); malloc_mutex_unlock(&bin->lock); diff --git a/dep/jemalloc/include/jemalloc/internal/atomic.h b/dep/jemalloc/include/jemalloc/internal/atomic.h deleted file mode 100644 index 9a298623f8a..00000000000 --- a/dep/jemalloc/include/jemalloc/internal/atomic.h +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************/ -#ifdef JEMALLOC_H_TYPES - -#endif /* JEMALLOC_H_TYPES */ -/******************************************************************************/ -#ifdef JEMALLOC_H_STRUCTS - -#endif /* JEMALLOC_H_STRUCTS */ -/******************************************************************************/ -#ifdef JEMALLOC_H_EXTERNS - -#define atomic_read_uint64(p) atomic_add_uint64(p, 0) -#define atomic_read_uint32(p) atomic_add_uint32(p, 0) - -#if (LG_SIZEOF_PTR == 3) -# define atomic_read_z(p) \ - (size_t)atomic_add_uint64((uint64_t *)p, (uint64_t)0) -# define atomic_add_z(p, x) \ - (size_t)atomic_add_uint64((uint64_t *)p, (uint64_t)x) -# define atomic_sub_z(p, x) \ - (size_t)atomic_sub_uint64((uint64_t *)p, (uint64_t)x) -#elif (LG_SIZEOF_PTR == 2) -# define atomic_read_z(p) \ - (size_t)atomic_add_uint32((uint32_t *)p, (uint32_t)0) -# define atomic_add_z(p, x) \ - (size_t)atomic_add_uint32((uint32_t *)p, (uint32_t)x) -# define atomic_sub_z(p, x) \ - (size_t)atomic_sub_uint32((uint32_t *)p, (uint32_t)x) -#endif - -#endif /* JEMALLOC_H_EXTERNS */ -/******************************************************************************/ -#ifdef JEMALLOC_H_INLINES - -#ifndef JEMALLOC_ENABLE_INLINE -uint64_t atomic_add_uint64(uint64_t *p, uint64_t x); -uint64_t atomic_sub_uint64(uint64_t *p, uint64_t x); -uint32_t atomic_add_uint32(uint32_t *p, uint32_t x); -uint32_t atomic_sub_uint32(uint32_t *p, uint32_t x); -#endif - -#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_ATOMIC_C_)) -/******************************************************************************/ -/* 64-bit operations. */ -#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 -JEMALLOC_INLINE uint64_t -atomic_add_uint64(uint64_t *p, uint64_t x) -{ - - return (__sync_add_and_fetch(p, x)); -} - -JEMALLOC_INLINE uint64_t -atomic_sub_uint64(uint64_t *p, uint64_t x) -{ - - return (__sync_sub_and_fetch(p, x)); -} -#elif (defined(JEMALLOC_OSATOMIC)) -JEMALLOC_INLINE uint64_t -atomic_add_uint64(uint64_t *p, uint64_t x) -{ - - return (OSAtomicAdd64((int64_t)x, (int64_t *)p)); -} - -JEMALLOC_INLINE uint64_t -atomic_sub_uint64(uint64_t *p, uint64_t x) -{ - - return (OSAtomicAdd64(-((int64_t)x), (int64_t *)p)); -} -#elif (defined(__amd64_) || defined(__x86_64__)) -JEMALLOC_INLINE uint64_t -atomic_add_uint64(uint64_t *p, uint64_t x) -{ - - asm volatile ( - "lock; xaddq %0, %1;" - : "+r" (x), "=m" (*p) /* Outputs. */ - : "m" (*p) /* Inputs. */ - ); - - return (x); -} - -JEMALLOC_INLINE uint64_t -atomic_sub_uint64(uint64_t *p, uint64_t x) -{ - - x = (uint64_t)(-(int64_t)x); - asm volatile ( - "lock; xaddq %0, %1;" - : "+r" (x), "=m" (*p) /* Outputs. */ - : "m" (*p) /* Inputs. */ - ); - - return (x); -} -#else -# if (LG_SIZEOF_PTR == 3) -# error "Missing implementation for 64-bit atomic operations" -# endif -#endif - -/******************************************************************************/ -/* 32-bit operations. */ -#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 -JEMALLOC_INLINE uint32_t -atomic_add_uint32(uint32_t *p, uint32_t x) -{ - - return (__sync_add_and_fetch(p, x)); -} - -JEMALLOC_INLINE uint32_t -atomic_sub_uint32(uint32_t *p, uint32_t x) -{ - - return (__sync_sub_and_fetch(p, x)); -} -#elif (defined(JEMALLOC_OSATOMIC)) -JEMALLOC_INLINE uint32_t -atomic_add_uint32(uint32_t *p, uint32_t x) -{ - - return (OSAtomicAdd32((int32_t)x, (int32_t *)p)); -} - -JEMALLOC_INLINE uint32_t -atomic_sub_uint32(uint32_t *p, uint32_t x) -{ - - return (OSAtomicAdd32(-((int32_t)x), (int32_t *)p)); -} -#elif (defined(__i386__) || defined(__amd64_) || defined(__x86_64__)) -JEMALLOC_INLINE uint32_t -atomic_add_uint32(uint32_t *p, uint32_t x) -{ - - asm volatile ( - "lock; xaddl %0, %1;" - : "+r" (x), "=m" (*p) /* Outputs. */ - : "m" (*p) /* Inputs. */ - ); - - return (x); -} - -JEMALLOC_INLINE uint32_t -atomic_sub_uint32(uint32_t *p, uint32_t x) -{ - - x = (uint32_t)(-(int32_t)x); - asm volatile ( - "lock; xaddl %0, %1;" - : "+r" (x), "=m" (*p) /* Outputs. */ - : "m" (*p) /* Inputs. */ - ); - - return (x); -} -#else -# error "Missing implementation for 32-bit atomic operations" -#endif -#endif - -#endif /* JEMALLOC_H_INLINES */ -/******************************************************************************/ diff --git a/dep/jemalloc/include/jemalloc/internal/bitmap.h b/dep/jemalloc/include/jemalloc/internal/bitmap.h deleted file mode 100644 index 605ebac58c1..00000000000 --- a/dep/jemalloc/include/jemalloc/internal/bitmap.h +++ /dev/null @@ -1,184 +0,0 @@ -/******************************************************************************/ -#ifdef JEMALLOC_H_TYPES - -/* Maximum bitmap bit count is 2^LG_BITMAP_MAXBITS. */ -#define LG_BITMAP_MAXBITS LG_RUN_MAXREGS - -typedef struct bitmap_level_s bitmap_level_t; -typedef struct bitmap_info_s bitmap_info_t; -typedef unsigned long bitmap_t; -#define LG_SIZEOF_BITMAP LG_SIZEOF_LONG - -/* Number of bits per group. */ -#define LG_BITMAP_GROUP_NBITS (LG_SIZEOF_BITMAP + 3) -#define BITMAP_GROUP_NBITS (ZU(1) << LG_BITMAP_GROUP_NBITS) -#define BITMAP_GROUP_NBITS_MASK (BITMAP_GROUP_NBITS-1) - -/* Maximum number of levels possible. */ -#define BITMAP_MAX_LEVELS \ - (LG_BITMAP_MAXBITS / LG_SIZEOF_BITMAP) \ - + !!(LG_BITMAP_MAXBITS % LG_SIZEOF_BITMAP) - -#endif /* JEMALLOC_H_TYPES */ -/******************************************************************************/ -#ifdef JEMALLOC_H_STRUCTS - -struct bitmap_level_s { - /* Offset of this level's groups within the array of groups. */ - size_t group_offset; -}; - -struct bitmap_info_s { - /* Logical number of bits in bitmap (stored at bottom level). */ - size_t nbits; - - /* Number of levels necessary for nbits. */ - unsigned nlevels; - - /* - * Only the first (nlevels+1) elements are used, and levels are ordered - * bottom to top (e.g. the bottom level is stored in levels[0]). - */ - bitmap_level_t levels[BITMAP_MAX_LEVELS+1]; -}; - -#endif /* JEMALLOC_H_STRUCTS */ -/******************************************************************************/ -#ifdef JEMALLOC_H_EXTERNS - -void bitmap_info_init(bitmap_info_t *binfo, size_t nbits); -size_t bitmap_info_ngroups(const bitmap_info_t *binfo); -size_t bitmap_size(size_t nbits); -void bitmap_init(bitmap_t *bitmap, const bitmap_info_t *binfo); - -#endif /* JEMALLOC_H_EXTERNS */ -/******************************************************************************/ -#ifdef JEMALLOC_H_INLINES - -#ifndef JEMALLOC_ENABLE_INLINE -bool bitmap_full(bitmap_t *bitmap, const bitmap_info_t *binfo); -bool bitmap_get(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit); -void bitmap_set(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit); -size_t bitmap_sfu(bitmap_t *bitmap, const bitmap_info_t *binfo); -void bitmap_unset(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit); -#endif - -#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_BITMAP_C_)) -JEMALLOC_INLINE bool -bitmap_full(bitmap_t *bitmap, const bitmap_info_t *binfo) -{ - unsigned rgoff = binfo->levels[binfo->nlevels].group_offset - 1; - bitmap_t rg = bitmap[rgoff]; - /* The bitmap is full iff the root group is 0. */ - return (rg == 0); -} - -JEMALLOC_INLINE bool -bitmap_get(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit) -{ - size_t goff; - bitmap_t g; - - assert(bit < binfo->nbits); - goff = bit >> LG_BITMAP_GROUP_NBITS; - g = bitmap[goff]; - return (!(g & (1LU << (bit & BITMAP_GROUP_NBITS_MASK)))); -} - -JEMALLOC_INLINE void -bitmap_set(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit) -{ - size_t goff; - bitmap_t *gp; - bitmap_t g; - - assert(bit < binfo->nbits); - assert(bitmap_get(bitmap, binfo, bit) == false); - goff = bit >> LG_BITMAP_GROUP_NBITS; - gp = &bitmap[goff]; - g = *gp; - assert(g & (1LU << (bit & BITMAP_GROUP_NBITS_MASK))); - g ^= 1LU << (bit & BITMAP_GROUP_NBITS_MASK); - *gp = g; - assert(bitmap_get(bitmap, binfo, bit)); - /* Propagate group state transitions up the tree. */ - if (g == 0) { - unsigned i; - for (i = 1; i < binfo->nlevels; i++) { - bit = goff; - goff = bit >> LG_BITMAP_GROUP_NBITS; - gp = &bitmap[binfo->levels[i].group_offset + goff]; - g = *gp; - assert(g & (1LU << (bit & BITMAP_GROUP_NBITS_MASK))); - g ^= 1LU << (bit & BITMAP_GROUP_NBITS_MASK); - *gp = g; - if (g != 0) - break; - } - } -} - -/* sfu: set first unset. */ -JEMALLOC_INLINE size_t -bitmap_sfu(bitmap_t *bitmap, const bitmap_info_t *binfo) -{ - size_t bit; - bitmap_t g; - unsigned i; - - assert(bitmap_full(bitmap, binfo) == false); - - i = binfo->nlevels - 1; - g = bitmap[binfo->levels[i].group_offset]; - bit = ffsl(g) - 1; - while (i > 0) { - i--; - g = bitmap[binfo->levels[i].group_offset + bit]; - bit = (bit << LG_BITMAP_GROUP_NBITS) + (ffsl(g) - 1); - } - - bitmap_set(bitmap, binfo, bit); - return (bit); -} - -JEMALLOC_INLINE void -bitmap_unset(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit) -{ - size_t goff; - bitmap_t *gp; - bitmap_t g; - bool propagate; - - assert(bit < binfo->nbits); - assert(bitmap_get(bitmap, binfo, bit)); - goff = bit >> LG_BITMAP_GROUP_NBITS; - gp = &bitmap[goff]; - g = *gp; - propagate = (g == 0); - assert((g & (1LU << (bit & BITMAP_GROUP_NBITS_MASK))) == 0); - g ^= 1LU << (bit & BITMAP_GROUP_NBITS_MASK); - *gp = g; - assert(bitmap_get(bitmap, binfo, bit) == false); - /* Propagate group state transitions up the tree. */ - if (propagate) { - unsigned i; - for (i = 1; i < binfo->nlevels; i++) { - bit = goff; - goff = bit >> LG_BITMAP_GROUP_NBITS; - gp = &bitmap[binfo->levels[i].group_offset + goff]; - g = *gp; - propagate = (g == 0); - assert((g & (1LU << (bit & BITMAP_GROUP_NBITS_MASK))) - == 0); - g ^= 1LU << (bit & BITMAP_GROUP_NBITS_MASK); - *gp = g; - if (propagate == false) - break; - } - } -} - -#endif - -#endif /* JEMALLOC_H_INLINES */ -/******************************************************************************/ diff --git a/dep/jemalloc/include/jemalloc/internal/chunk.h b/dep/jemalloc/include/jemalloc/internal/chunk.h index 54b6a3ec886..a60f0ad7498 100644 --- a/dep/jemalloc/include/jemalloc/internal/chunk.h +++ b/dep/jemalloc/include/jemalloc/internal/chunk.h @@ -50,7 +50,7 @@ extern size_t map_bias; /* Number of arena chunk header pages. */ extern size_t arena_maxclass; /* Max size class for arenas. */ void *chunk_alloc(size_t size, bool base, bool *zero); -void chunk_dealloc(void *chunk, size_t size, bool unmap); +void chunk_dealloc(void *chunk, size_t size); bool chunk_boot(void); #endif /* JEMALLOC_H_EXTERNS */ diff --git a/dep/jemalloc/include/jemalloc/internal/ckh.h b/dep/jemalloc/include/jemalloc/internal/ckh.h index 3e4ad4c85f9..d4e391b6360 100644 --- a/dep/jemalloc/include/jemalloc/internal/ckh.h +++ b/dep/jemalloc/include/jemalloc/internal/ckh.h @@ -31,7 +31,7 @@ struct ckhc_s { struct ckh_s { #ifdef JEMALLOC_DEBUG -#define CKH_MAGIC 0x3af2489d +#define CKH_MAGIG 0x3af2489d uint32_t magic; #endif diff --git a/dep/jemalloc/include/jemalloc/internal/ctl.h b/dep/jemalloc/include/jemalloc/internal/ctl.h index f1f5eb70a2a..8776ad135a7 100644 --- a/dep/jemalloc/include/jemalloc/internal/ctl.h +++ b/dep/jemalloc/include/jemalloc/internal/ctl.h @@ -29,7 +29,6 @@ struct ctl_node_s { struct ctl_arena_stats_s { bool initialized; - unsigned nthreads; size_t pactive; size_t pdirty; #ifdef JEMALLOC_STATS diff --git a/dep/jemalloc/include/jemalloc/internal/hash.h b/dep/jemalloc/include/jemalloc/internal/hash.h index 8a46ce30803..d12cdb8359f 100644 --- a/dep/jemalloc/include/jemalloc/internal/hash.h +++ b/dep/jemalloc/include/jemalloc/internal/hash.h @@ -17,7 +17,7 @@ uint64_t hash(const void *key, size_t len, uint64_t seed); #endif -#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_HASH_C_)) +#if (defined(JEMALLOC_ENABLE_INLINE) || defined(HASH_C_)) /* * The following hash function is based on MurmurHash64A(), placed into the * public domain by Austin Appleby. See http://murmurhash.googlepages.com/ for @@ -26,7 +26,7 @@ uint64_t hash(const void *key, size_t len, uint64_t seed); JEMALLOC_INLINE uint64_t hash(const void *key, size_t len, uint64_t seed) { - const uint64_t m = 0xc6a4a7935bd1e995LLU; + const uint64_t m = 0xc6a4a7935bd1e995; const int r = 47; uint64_t h = seed ^ (len * m); const uint64_t *data = (const uint64_t *)key; @@ -62,7 +62,7 @@ hash(const void *key, size_t len, uint64_t seed) h *= m; h ^= h >> r; - return (h); + return h; } #endif diff --git a/dep/jemalloc/include/jemalloc/internal/jemalloc_internal.h b/dep/jemalloc/include/jemalloc/internal/jemalloc_internal.h index cd554bea1b9..611f0c665a1 100644 --- a/dep/jemalloc/include/jemalloc/internal/jemalloc_internal.h +++ b/dep/jemalloc/include/jemalloc/internal/jemalloc_internal.h @@ -33,12 +33,6 @@ #define JEMALLOC_MANGLE #include "../jemalloc.h" -#include "jemalloc/internal/private_namespace.h" - -#if (defined(JEMALLOC_OSATOMIC) || defined(JEMALLOC_OSSPIN)) -#include <libkern/OSAtomic.h> -#endif - #ifdef JEMALLOC_ZONE #include <mach/mach_error.h> #include <mach/mach_init.h> @@ -61,9 +55,8 @@ extern void (*JEMALLOC_P(malloc_message))(void *wcbopaque, const char *s); * Define a custom assert() in order to reduce the chances of deadlock during * assertion failure. */ -#ifndef assert -# ifdef JEMALLOC_DEBUG -# define assert(e) do { \ +#ifdef JEMALLOC_DEBUG +# define assert(e) do { \ if (!(e)) { \ char line_buf[UMAX2S_BUFSIZE]; \ malloc_write("<jemalloc>: "); \ @@ -77,15 +70,8 @@ extern void (*JEMALLOC_P(malloc_message))(void *wcbopaque, const char *s); abort(); \ } \ } while (0) -# else -# define assert(e) -# endif -#endif - -#ifdef JEMALLOC_DEBUG -# define dassert(e) assert(e) #else -# define dassert(e) +#define assert(e) #endif /* @@ -160,19 +146,12 @@ extern void (*JEMALLOC_P(malloc_message))(void *wcbopaque, const char *s); #define QUANTUM_CEILING(a) \ (((a) + QUANTUM_MASK) & ~QUANTUM_MASK) -#define LONG ((size_t)(1U << LG_SIZEOF_LONG)) -#define LONG_MASK (LONG - 1) - -/* Return the smallest long multiple that is >= a. */ -#define LONG_CEILING(a) \ - (((a) + LONG_MASK) & ~LONG_MASK) - #define SIZEOF_PTR (1U << LG_SIZEOF_PTR) -#define PTR_MASK (SIZEOF_PTR - 1) -/* Return the smallest (void *) multiple that is >= a. */ -#define PTR_CEILING(a) \ - (((a) + PTR_MASK) & ~PTR_MASK) +/* We can't use TLS in non-PIC programs, since TLS relies on loader magic. */ +#if (!defined(PIC) && !defined(NO_TLS)) +# define NO_TLS +#endif /* * Maximum size of L1 cache line. This is used to avoid cache line aliasing. @@ -219,7 +198,6 @@ extern void (*JEMALLOC_P(malloc_message))(void *wcbopaque, const char *s); #define PAGE_CEILING(s) \ (((s) + PAGE_MASK) & ~PAGE_MASK) -#include "jemalloc/internal/atomic.h" #include "jemalloc/internal/jemprn.h" #include "jemalloc/internal/ckh.h" #include "jemalloc/internal/stats.h" @@ -228,7 +206,6 @@ extern void (*JEMALLOC_P(malloc_message))(void *wcbopaque, const char *s); #include "jemalloc/internal/mb.h" #include "jemalloc/internal/extent.h" #include "jemalloc/internal/arena.h" -#include "jemalloc/internal/bitmap.h" #include "jemalloc/internal/base.h" #include "jemalloc/internal/chunk.h" #include "jemalloc/internal/huge.h" @@ -244,14 +221,12 @@ extern void (*JEMALLOC_P(malloc_message))(void *wcbopaque, const char *s); /******************************************************************************/ #define JEMALLOC_H_STRUCTS -#include "jemalloc/internal/atomic.h" #include "jemalloc/internal/jemprn.h" #include "jemalloc/internal/ckh.h" #include "jemalloc/internal/stats.h" #include "jemalloc/internal/ctl.h" #include "jemalloc/internal/mutex.h" #include "jemalloc/internal/mb.h" -#include "jemalloc/internal/bitmap.h" #include "jemalloc/internal/extent.h" #include "jemalloc/internal/arena.h" #include "jemalloc/internal/base.h" @@ -265,13 +240,6 @@ extern void (*JEMALLOC_P(malloc_message))(void *wcbopaque, const char *s); #endif #include "jemalloc/internal/prof.h" -#ifdef JEMALLOC_STATS -typedef struct { - uint64_t allocated; - uint64_t deallocated; -} thread_allocated_t; -#endif - #undef JEMALLOC_H_STRUCTS /******************************************************************************/ #define JEMALLOC_H_EXTERNS @@ -301,7 +269,6 @@ extern size_t lg_pagesize; extern unsigned ncpus; extern malloc_mutex_t arenas_lock; /* Protects arenas initialization. */ -extern pthread_key_t arenas_tsd; #ifndef NO_TLS /* * Map of pthread_self() --> arenas[???], used for selecting an arena to use @@ -311,9 +278,9 @@ extern __thread arena_t *arenas_tls JEMALLOC_ATTR(tls_model("initial-exec")); # define ARENA_GET() arenas_tls # define ARENA_SET(v) do { \ arenas_tls = (v); \ - pthread_setspecific(arenas_tsd, (void *)(v)); \ } while (0) #else +extern pthread_key_t arenas_tsd; # define ARENA_GET() ((arena_t *)pthread_getspecific(arenas_tsd)) # define ARENA_SET(v) do { \ pthread_setspecific(arenas_tsd, (void *)(v)); \ @@ -328,28 +295,45 @@ extern arena_t **arenas; extern unsigned narenas; #ifdef JEMALLOC_STATS +typedef struct { + uint64_t allocated; + uint64_t deallocated; +} thread_allocated_t; # ifndef NO_TLS extern __thread thread_allocated_t thread_allocated_tls; -# define ALLOCATED_GET() (thread_allocated_tls.allocated) -# define ALLOCATEDP_GET() (&thread_allocated_tls.allocated) -# define DEALLOCATED_GET() (thread_allocated_tls.deallocated) -# define DEALLOCATEDP_GET() (&thread_allocated_tls.deallocated) +# define ALLOCATED_GET() thread_allocated_tls.allocated +# define DEALLOCATED_GET() thread_allocated_tls.deallocated # define ALLOCATED_ADD(a, d) do { \ thread_allocated_tls.allocated += a; \ thread_allocated_tls.deallocated += d; \ } while (0) # else extern pthread_key_t thread_allocated_tsd; -thread_allocated_t *thread_allocated_get_hard(void); - -# define ALLOCATED_GET() (thread_allocated_get()->allocated) -# define ALLOCATEDP_GET() (&thread_allocated_get()->allocated) -# define DEALLOCATED_GET() (thread_allocated_get()->deallocated) -# define DEALLOCATEDP_GET() (&thread_allocated_get()->deallocated) +# define ALLOCATED_GET() \ + (uint64_t)((pthread_getspecific(thread_allocated_tsd) != NULL) \ + ? ((thread_allocated_t *) \ + pthread_getspecific(thread_allocated_tsd))->allocated : 0) +# define DEALLOCATED_GET() \ + (uint64_t)((pthread_getspecific(thread_allocated_tsd) != NULL) \ + ? ((thread_allocated_t \ + *)pthread_getspecific(thread_allocated_tsd))->deallocated : \ + 0) # define ALLOCATED_ADD(a, d) do { \ - thread_allocated_t *thread_allocated = thread_allocated_get(); \ - thread_allocated->allocated += (a); \ - thread_allocated->deallocated += (d); \ + thread_allocated_t *thread_allocated = (thread_allocated_t *) \ + pthread_getspecific(thread_allocated_tsd); \ + if (thread_allocated != NULL) { \ + thread_allocated->allocated += (a); \ + thread_allocated->deallocated += (d); \ + } else { \ + thread_allocated = (thread_allocated_t *) \ + imalloc(sizeof(thread_allocated_t)); \ + if (thread_allocated != NULL) { \ + pthread_setspecific(thread_allocated_tsd, \ + thread_allocated); \ + thread_allocated->allocated = (a); \ + thread_allocated->deallocated = (d); \ + } \ + } \ } while (0) # endif #endif @@ -360,14 +344,12 @@ int buferror(int errnum, char *buf, size_t buflen); void jemalloc_prefork(void); void jemalloc_postfork(void); -#include "jemalloc/internal/atomic.h" #include "jemalloc/internal/jemprn.h" #include "jemalloc/internal/ckh.h" #include "jemalloc/internal/stats.h" #include "jemalloc/internal/ctl.h" #include "jemalloc/internal/mutex.h" #include "jemalloc/internal/mb.h" -#include "jemalloc/internal/bitmap.h" #include "jemalloc/internal/extent.h" #include "jemalloc/internal/arena.h" #include "jemalloc/internal/base.h" @@ -385,7 +367,6 @@ void jemalloc_postfork(void); /******************************************************************************/ #define JEMALLOC_H_INLINES -#include "jemalloc/internal/atomic.h" #include "jemalloc/internal/jemprn.h" #include "jemalloc/internal/ckh.h" #include "jemalloc/internal/stats.h" @@ -403,9 +384,6 @@ size_t s2u(size_t size); size_t sa2u(size_t size, size_t alignment, size_t *run_size_p); void malloc_write(const char *s); arena_t *choose_arena(void); -# if (defined(JEMALLOC_STATS) && defined(NO_TLS)) -thread_allocated_t *thread_allocated_get(void); -# endif #endif #if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_C_)) @@ -436,10 +414,10 @@ s2u(size_t size) { if (size <= small_maxclass) - return (arena_bin_info[SMALL_SIZE2BIN(size)].reg_size); + return arenas[0]->bins[small_size2bin[size]].reg_size; if (size <= arena_maxclass) - return (PAGE_CEILING(size)); - return (CHUNK_CEILING(size)); + return PAGE_CEILING(size); + return CHUNK_CEILING(size); } /* @@ -480,8 +458,10 @@ sa2u(size_t size, size_t alignment, size_t *run_size_p) } if (usize <= arena_maxclass && alignment <= PAGE_SIZE) { - if (usize <= small_maxclass) - return (arena_bin_info[SMALL_SIZE2BIN(usize)].reg_size); + if (usize <= small_maxclass) { + return + (arenas[0]->bins[small_size2bin[usize]].reg_size); + } return (PAGE_CEILING(usize)); } else { size_t run_size; @@ -564,22 +544,8 @@ choose_arena(void) return (ret); } - -#if (defined(JEMALLOC_STATS) && defined(NO_TLS)) -JEMALLOC_INLINE thread_allocated_t * -thread_allocated_get(void) -{ - thread_allocated_t *thread_allocated = (thread_allocated_t *) - pthread_getspecific(thread_allocated_tsd); - - if (thread_allocated == NULL) - return (thread_allocated_get_hard()); - return (thread_allocated); -} -#endif #endif -#include "jemalloc/internal/bitmap.h" #include "jemalloc/internal/rtree.h" #include "jemalloc/internal/tcache.h" #include "jemalloc/internal/arena.h" @@ -591,7 +557,7 @@ thread_allocated_get(void) #ifndef JEMALLOC_ENABLE_INLINE void *imalloc(size_t size); void *icalloc(size_t size); -void *ipalloc(size_t usize, size_t alignment, bool zero); +void *ipalloc(size_t size, size_t alignment, bool zero); size_t isalloc(const void *ptr); # ifdef JEMALLOC_IVSALLOC size_t ivsalloc(const void *ptr); @@ -625,39 +591,28 @@ icalloc(size_t size) } JEMALLOC_INLINE void * -ipalloc(size_t usize, size_t alignment, bool zero) +ipalloc(size_t size, size_t alignment, bool zero) { void *ret; + size_t usize; + size_t run_size +# ifdef JEMALLOC_CC_SILENCE + = 0 +# endif + ; - assert(usize != 0); - assert(usize == sa2u(usize, alignment, NULL)); - + usize = sa2u(size, alignment, &run_size); + if (usize == 0) + return (NULL); if (usize <= arena_maxclass && alignment <= PAGE_SIZE) ret = arena_malloc(usize, zero); - else { - size_t run_size -#ifdef JEMALLOC_CC_SILENCE - = 0 -#endif - ; - - /* - * Ideally we would only ever call sa2u() once per aligned - * allocation request, and the caller of this function has - * already done so once. However, it's rather burdensome to - * require every caller to pass in run_size, especially given - * that it's only relevant to large allocations. Therefore, - * just call it again here in order to get run_size. - */ - sa2u(usize, alignment, &run_size); - if (run_size <= arena_maxclass) { - ret = arena_palloc(choose_arena(), usize, run_size, - alignment, zero); - } else if (alignment <= chunksize) - ret = huge_malloc(usize, zero); - else - ret = huge_palloc(usize, alignment, zero); - } + else if (run_size <= arena_maxclass) { + ret = arena_palloc(choose_arena(), usize, run_size, alignment, + zero); + } else if (alignment <= chunksize) + ret = huge_malloc(usize, zero); + else + ret = huge_palloc(usize, alignment, zero); assert(((uintptr_t)ret & (alignment - 1)) == 0); return (ret); @@ -674,7 +629,7 @@ isalloc(const void *ptr) chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); if (chunk != ptr) { /* Region. */ - dassert(chunk->arena->magic == ARENA_MAGIC); + assert(chunk->arena->magic == ARENA_MAGIC); #ifdef JEMALLOC_PROF ret = arena_salloc_demote(ptr); @@ -728,7 +683,7 @@ iralloc(void *ptr, size_t size, size_t extra, size_t alignment, bool zero, if (alignment != 0 && ((uintptr_t)ptr & ((uintptr_t)alignment-1)) != 0) { - size_t usize, copysize; + size_t copysize; /* * Existing object alignment is inadquate; allocate new space @@ -736,18 +691,12 @@ iralloc(void *ptr, size_t size, size_t extra, size_t alignment, bool zero, */ if (no_move) return (NULL); - usize = sa2u(size + extra, alignment, NULL); - if (usize == 0) - return (NULL); - ret = ipalloc(usize, alignment, zero); + ret = ipalloc(size + extra, alignment, zero); if (ret == NULL) { if (extra == 0) return (NULL); /* Try again, without extra this time. */ - usize = sa2u(size, alignment, NULL); - if (usize == 0) - return (NULL); - ret = ipalloc(usize, alignment, zero); + ret = ipalloc(size, alignment, zero); if (ret == NULL) return (NULL); } diff --git a/dep/jemalloc/include/jemalloc/internal/mb.h b/dep/jemalloc/include/jemalloc/internal/mb.h index dc9f2a54262..1707aa91d68 100644 --- a/dep/jemalloc/include/jemalloc/internal/mb.h +++ b/dep/jemalloc/include/jemalloc/internal/mb.h @@ -17,7 +17,7 @@ void mb_write(void); #endif -#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_MB_C_)) +#if (defined(JEMALLOC_ENABLE_INLINE) || defined(MB_C_)) #ifdef __i386__ /* * According to the Intel Architecture Software Developer's Manual, current diff --git a/dep/jemalloc/include/jemalloc/internal/mutex.h b/dep/jemalloc/include/jemalloc/internal/mutex.h index 62947ced55e..dcca01edd5d 100644 --- a/dep/jemalloc/include/jemalloc/internal/mutex.h +++ b/dep/jemalloc/include/jemalloc/internal/mutex.h @@ -1,11 +1,7 @@ /******************************************************************************/ #ifdef JEMALLOC_H_TYPES -#ifdef JEMALLOC_OSSPIN -typedef OSSpinLock malloc_mutex_t; -#else typedef pthread_mutex_t malloc_mutex_t; -#endif #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP # define MALLOC_MUTEX_INITIALIZER PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP @@ -45,26 +41,17 @@ JEMALLOC_INLINE void malloc_mutex_lock(malloc_mutex_t *mutex) { - if (isthreaded) { -#ifdef JEMALLOC_OSSPIN - OSSpinLockLock(mutex); -#else + if (isthreaded) pthread_mutex_lock(mutex); -#endif - } } JEMALLOC_INLINE bool malloc_mutex_trylock(malloc_mutex_t *mutex) { - if (isthreaded) { -#ifdef JEMALLOC_OSSPIN - return (OSSpinLockTry(mutex) == false); -#else + if (isthreaded) return (pthread_mutex_trylock(mutex) != 0); -#endif - } else + else return (false); } @@ -72,13 +59,8 @@ JEMALLOC_INLINE void malloc_mutex_unlock(malloc_mutex_t *mutex) { - if (isthreaded) { -#ifdef JEMALLOC_OSSPIN - OSSpinLockUnlock(mutex); -#else + if (isthreaded) pthread_mutex_unlock(mutex); -#endif - } } #endif diff --git a/dep/jemalloc/include/jemalloc/internal/private_namespace.h b/dep/jemalloc/include/jemalloc/internal/private_namespace.h deleted file mode 100644 index d4f5f96d7b2..00000000000 --- a/dep/jemalloc/include/jemalloc/internal/private_namespace.h +++ /dev/null @@ -1,195 +0,0 @@ -#define arena_bin_index JEMALLOC_N(arena_bin_index) -#define arena_boot JEMALLOC_N(arena_boot) -#define arena_dalloc JEMALLOC_N(arena_dalloc) -#define arena_dalloc_bin JEMALLOC_N(arena_dalloc_bin) -#define arena_dalloc_large JEMALLOC_N(arena_dalloc_large) -#define arena_malloc JEMALLOC_N(arena_malloc) -#define arena_malloc_large JEMALLOC_N(arena_malloc_large) -#define arena_malloc_small JEMALLOC_N(arena_malloc_small) -#define arena_new JEMALLOC_N(arena_new) -#define arena_palloc JEMALLOC_N(arena_palloc) -#define arena_prof_accum JEMALLOC_N(arena_prof_accum) -#define arena_prof_ctx_get JEMALLOC_N(arena_prof_ctx_get) -#define arena_prof_ctx_set JEMALLOC_N(arena_prof_ctx_set) -#define arena_prof_promoted JEMALLOC_N(arena_prof_promoted) -#define arena_purge_all JEMALLOC_N(arena_purge_all) -#define arena_ralloc JEMALLOC_N(arena_ralloc) -#define arena_ralloc_no_move JEMALLOC_N(arena_ralloc_no_move) -#define arena_run_regind JEMALLOC_N(arena_run_regind) -#define arena_salloc JEMALLOC_N(arena_salloc) -#define arena_salloc_demote JEMALLOC_N(arena_salloc_demote) -#define arena_stats_merge JEMALLOC_N(arena_stats_merge) -#define arena_tcache_fill_small JEMALLOC_N(arena_tcache_fill_small) -#define arenas_bin_i_index JEMALLOC_N(arenas_bin_i_index) -#define arenas_extend JEMALLOC_N(arenas_extend) -#define arenas_lrun_i_index JEMALLOC_N(arenas_lrun_i_index) -#define atomic_add_uint32 JEMALLOC_N(atomic_add_uint32) -#define atomic_add_uint64 JEMALLOC_N(atomic_add_uint64) -#define atomic_sub_uint32 JEMALLOC_N(atomic_sub_uint32) -#define atomic_sub_uint64 JEMALLOC_N(atomic_sub_uint64) -#define base_alloc JEMALLOC_N(base_alloc) -#define base_boot JEMALLOC_N(base_boot) -#define base_node_alloc JEMALLOC_N(base_node_alloc) -#define base_node_dealloc JEMALLOC_N(base_node_dealloc) -#define bitmap_full JEMALLOC_N(bitmap_full) -#define bitmap_get JEMALLOC_N(bitmap_get) -#define bitmap_info_init JEMALLOC_N(bitmap_info_init) -#define bitmap_info_ngroups JEMALLOC_N(bitmap_info_ngroups) -#define bitmap_init JEMALLOC_N(bitmap_init) -#define bitmap_set JEMALLOC_N(bitmap_set) -#define bitmap_sfu JEMALLOC_N(bitmap_sfu) -#define bitmap_size JEMALLOC_N(bitmap_size) -#define bitmap_unset JEMALLOC_N(bitmap_unset) -#define bt_init JEMALLOC_N(bt_init) -#define buferror JEMALLOC_N(buferror) -#define choose_arena JEMALLOC_N(choose_arena) -#define choose_arena_hard JEMALLOC_N(choose_arena_hard) -#define chunk_alloc JEMALLOC_N(chunk_alloc) -#define chunk_alloc_dss JEMALLOC_N(chunk_alloc_dss) -#define chunk_alloc_mmap JEMALLOC_N(chunk_alloc_mmap) -#define chunk_alloc_mmap_noreserve JEMALLOC_N(chunk_alloc_mmap_noreserve) -#define chunk_alloc_swap JEMALLOC_N(chunk_alloc_swap) -#define chunk_boot JEMALLOC_N(chunk_boot) -#define chunk_dealloc JEMALLOC_N(chunk_dealloc) -#define chunk_dealloc_dss JEMALLOC_N(chunk_dealloc_dss) -#define chunk_dealloc_mmap JEMALLOC_N(chunk_dealloc_mmap) -#define chunk_dealloc_swap JEMALLOC_N(chunk_dealloc_swap) -#define chunk_dss_boot JEMALLOC_N(chunk_dss_boot) -#define chunk_in_dss JEMALLOC_N(chunk_in_dss) -#define chunk_in_swap JEMALLOC_N(chunk_in_swap) -#define chunk_mmap_boot JEMALLOC_N(chunk_mmap_boot) -#define chunk_swap_boot JEMALLOC_N(chunk_swap_boot) -#define chunk_swap_enable JEMALLOC_N(chunk_swap_enable) -#define ckh_bucket_search JEMALLOC_N(ckh_bucket_search) -#define ckh_count JEMALLOC_N(ckh_count) -#define ckh_delete JEMALLOC_N(ckh_delete) -#define ckh_evict_reloc_insert JEMALLOC_N(ckh_evict_reloc_insert) -#define ckh_insert JEMALLOC_N(ckh_insert) -#define ckh_isearch JEMALLOC_N(ckh_isearch) -#define ckh_iter JEMALLOC_N(ckh_iter) -#define ckh_new JEMALLOC_N(ckh_new) -#define ckh_pointer_hash JEMALLOC_N(ckh_pointer_hash) -#define ckh_pointer_keycomp JEMALLOC_N(ckh_pointer_keycomp) -#define ckh_rebuild JEMALLOC_N(ckh_rebuild) -#define ckh_remove JEMALLOC_N(ckh_remove) -#define ckh_search JEMALLOC_N(ckh_search) -#define ckh_string_hash JEMALLOC_N(ckh_string_hash) -#define ckh_string_keycomp JEMALLOC_N(ckh_string_keycomp) -#define ckh_try_bucket_insert JEMALLOC_N(ckh_try_bucket_insert) -#define ckh_try_insert JEMALLOC_N(ckh_try_insert) -#define create_zone JEMALLOC_N(create_zone) -#define ctl_boot JEMALLOC_N(ctl_boot) -#define ctl_bymib JEMALLOC_N(ctl_bymib) -#define ctl_byname JEMALLOC_N(ctl_byname) -#define ctl_nametomib JEMALLOC_N(ctl_nametomib) -#define extent_tree_ad_first JEMALLOC_N(extent_tree_ad_first) -#define extent_tree_ad_insert JEMALLOC_N(extent_tree_ad_insert) -#define extent_tree_ad_iter JEMALLOC_N(extent_tree_ad_iter) -#define extent_tree_ad_iter_recurse JEMALLOC_N(extent_tree_ad_iter_recurse) -#define extent_tree_ad_iter_start JEMALLOC_N(extent_tree_ad_iter_start) -#define extent_tree_ad_last JEMALLOC_N(extent_tree_ad_last) -#define extent_tree_ad_new JEMALLOC_N(extent_tree_ad_new) -#define extent_tree_ad_next JEMALLOC_N(extent_tree_ad_next) -#define extent_tree_ad_nsearch JEMALLOC_N(extent_tree_ad_nsearch) -#define extent_tree_ad_prev JEMALLOC_N(extent_tree_ad_prev) -#define extent_tree_ad_psearch JEMALLOC_N(extent_tree_ad_psearch) -#define extent_tree_ad_remove JEMALLOC_N(extent_tree_ad_remove) -#define extent_tree_ad_reverse_iter JEMALLOC_N(extent_tree_ad_reverse_iter) -#define extent_tree_ad_reverse_iter_recurse JEMALLOC_N(extent_tree_ad_reverse_iter_recurse) -#define extent_tree_ad_reverse_iter_start JEMALLOC_N(extent_tree_ad_reverse_iter_start) -#define extent_tree_ad_search JEMALLOC_N(extent_tree_ad_search) -#define extent_tree_szad_first JEMALLOC_N(extent_tree_szad_first) -#define extent_tree_szad_insert JEMALLOC_N(extent_tree_szad_insert) -#define extent_tree_szad_iter JEMALLOC_N(extent_tree_szad_iter) -#define extent_tree_szad_iter_recurse JEMALLOC_N(extent_tree_szad_iter_recurse) -#define extent_tree_szad_iter_start JEMALLOC_N(extent_tree_szad_iter_start) -#define extent_tree_szad_last JEMALLOC_N(extent_tree_szad_last) -#define extent_tree_szad_new JEMALLOC_N(extent_tree_szad_new) -#define extent_tree_szad_next JEMALLOC_N(extent_tree_szad_next) -#define extent_tree_szad_nsearch JEMALLOC_N(extent_tree_szad_nsearch) -#define extent_tree_szad_prev JEMALLOC_N(extent_tree_szad_prev) -#define extent_tree_szad_psearch JEMALLOC_N(extent_tree_szad_psearch) -#define extent_tree_szad_remove JEMALLOC_N(extent_tree_szad_remove) -#define extent_tree_szad_reverse_iter JEMALLOC_N(extent_tree_szad_reverse_iter) -#define extent_tree_szad_reverse_iter_recurse JEMALLOC_N(extent_tree_szad_reverse_iter_recurse) -#define extent_tree_szad_reverse_iter_start JEMALLOC_N(extent_tree_szad_reverse_iter_start) -#define extent_tree_szad_search JEMALLOC_N(extent_tree_szad_search) -#define hash JEMALLOC_N(hash) -#define huge_boot JEMALLOC_N(huge_boot) -#define huge_dalloc JEMALLOC_N(huge_dalloc) -#define huge_malloc JEMALLOC_N(huge_malloc) -#define huge_palloc JEMALLOC_N(huge_palloc) -#define huge_prof_ctx_get JEMALLOC_N(huge_prof_ctx_get) -#define huge_prof_ctx_set JEMALLOC_N(huge_prof_ctx_set) -#define huge_ralloc JEMALLOC_N(huge_ralloc) -#define huge_ralloc_no_move JEMALLOC_N(huge_ralloc_no_move) -#define huge_salloc JEMALLOC_N(huge_salloc) -#define iallocm JEMALLOC_N(iallocm) -#define icalloc JEMALLOC_N(icalloc) -#define idalloc JEMALLOC_N(idalloc) -#define imalloc JEMALLOC_N(imalloc) -#define ipalloc JEMALLOC_N(ipalloc) -#define iralloc JEMALLOC_N(iralloc) -#define isalloc JEMALLOC_N(isalloc) -#define ivsalloc JEMALLOC_N(ivsalloc) -#define jemalloc_darwin_init JEMALLOC_N(jemalloc_darwin_init) -#define jemalloc_postfork JEMALLOC_N(jemalloc_postfork) -#define jemalloc_prefork JEMALLOC_N(jemalloc_prefork) -#define malloc_cprintf JEMALLOC_N(malloc_cprintf) -#define malloc_mutex_destroy JEMALLOC_N(malloc_mutex_destroy) -#define malloc_mutex_init JEMALLOC_N(malloc_mutex_init) -#define malloc_mutex_lock JEMALLOC_N(malloc_mutex_lock) -#define malloc_mutex_trylock JEMALLOC_N(malloc_mutex_trylock) -#define malloc_mutex_unlock JEMALLOC_N(malloc_mutex_unlock) -#define malloc_printf JEMALLOC_N(malloc_printf) -#define malloc_write JEMALLOC_N(malloc_write) -#define mb_write JEMALLOC_N(mb_write) -#define pow2_ceil JEMALLOC_N(pow2_ceil) -#define prof_backtrace JEMALLOC_N(prof_backtrace) -#define prof_boot0 JEMALLOC_N(prof_boot0) -#define prof_boot1 JEMALLOC_N(prof_boot1) -#define prof_boot2 JEMALLOC_N(prof_boot2) -#define prof_ctx_get JEMALLOC_N(prof_ctx_get) -#define prof_ctx_set JEMALLOC_N(prof_ctx_set) -#define prof_free JEMALLOC_N(prof_free) -#define prof_gdump JEMALLOC_N(prof_gdump) -#define prof_idump JEMALLOC_N(prof_idump) -#define prof_lookup JEMALLOC_N(prof_lookup) -#define prof_malloc JEMALLOC_N(prof_malloc) -#define prof_mdump JEMALLOC_N(prof_mdump) -#define prof_realloc JEMALLOC_N(prof_realloc) -#define prof_sample_accum_update JEMALLOC_N(prof_sample_accum_update) -#define prof_sample_threshold_update JEMALLOC_N(prof_sample_threshold_update) -#define prof_tdata_init JEMALLOC_N(prof_tdata_init) -#define pthread_create JEMALLOC_N(pthread_create) -#define rtree_get JEMALLOC_N(rtree_get) -#define rtree_get_locked JEMALLOC_N(rtree_get_locked) -#define rtree_new JEMALLOC_N(rtree_new) -#define rtree_set JEMALLOC_N(rtree_set) -#define s2u JEMALLOC_N(s2u) -#define sa2u JEMALLOC_N(sa2u) -#define stats_arenas_i_bins_j_index JEMALLOC_N(stats_arenas_i_bins_j_index) -#define stats_arenas_i_index JEMALLOC_N(stats_arenas_i_index) -#define stats_arenas_i_lruns_j_index JEMALLOC_N(stats_arenas_i_lruns_j_index) -#define stats_cactive_add JEMALLOC_N(stats_cactive_add) -#define stats_cactive_get JEMALLOC_N(stats_cactive_get) -#define stats_cactive_sub JEMALLOC_N(stats_cactive_sub) -#define stats_print JEMALLOC_N(stats_print) -#define szone2ozone JEMALLOC_N(szone2ozone) -#define tcache_alloc_easy JEMALLOC_N(tcache_alloc_easy) -#define tcache_alloc_large JEMALLOC_N(tcache_alloc_large) -#define tcache_alloc_small JEMALLOC_N(tcache_alloc_small) -#define tcache_alloc_small_hard JEMALLOC_N(tcache_alloc_small_hard) -#define tcache_bin_flush_large JEMALLOC_N(tcache_bin_flush_large) -#define tcache_bin_flush_small JEMALLOC_N(tcache_bin_flush_small) -#define tcache_boot JEMALLOC_N(tcache_boot) -#define tcache_create JEMALLOC_N(tcache_create) -#define tcache_dalloc_large JEMALLOC_N(tcache_dalloc_large) -#define tcache_dalloc_small JEMALLOC_N(tcache_dalloc_small) -#define tcache_destroy JEMALLOC_N(tcache_destroy) -#define tcache_event JEMALLOC_N(tcache_event) -#define tcache_get JEMALLOC_N(tcache_get) -#define tcache_stats_merge JEMALLOC_N(tcache_stats_merge) -#define thread_allocated_get JEMALLOC_N(thread_allocated_get) -#define thread_allocated_get_hard JEMALLOC_N(thread_allocated_get_hard) -#define u2s JEMALLOC_N(u2s) diff --git a/dep/jemalloc/include/jemalloc/internal/prof.h b/dep/jemalloc/include/jemalloc/internal/prof.h index e9064ba6e73..7864000b88b 100644 --- a/dep/jemalloc/include/jemalloc/internal/prof.h +++ b/dep/jemalloc/include/jemalloc/internal/prof.h @@ -227,60 +227,9 @@ bool prof_boot2(void); /******************************************************************************/ #ifdef JEMALLOC_H_INLINES -#define PROF_ALLOC_PREP(nignore, size, ret) do { \ - prof_tdata_t *prof_tdata; \ - prof_bt_t bt; \ - \ - assert(size == s2u(size)); \ - \ - prof_tdata = PROF_TCACHE_GET(); \ - if (prof_tdata == NULL) { \ - prof_tdata = prof_tdata_init(); \ - if (prof_tdata == NULL) { \ - ret = NULL; \ - break; \ - } \ - } \ - \ - if (opt_prof_active == false) { \ - /* Sampling is currently inactive, so avoid sampling. */\ - ret = (prof_thr_cnt_t *)(uintptr_t)1U; \ - } else if (opt_lg_prof_sample == 0) { \ - /* Don't bother with sampling logic, since sampling */\ - /* interval is 1. */\ - bt_init(&bt, prof_tdata->vec); \ - prof_backtrace(&bt, nignore, prof_bt_max); \ - ret = prof_lookup(&bt); \ - } else { \ - if (prof_tdata->threshold == 0) { \ - /* Initialize. Seed the prng differently for */\ - /* each thread. */\ - prof_tdata->prn_state = \ - (uint64_t)(uintptr_t)&size; \ - prof_sample_threshold_update(prof_tdata); \ - } \ - \ - /* Determine whether to capture a backtrace based on */\ - /* whether size is enough for prof_accum to reach */\ - /* prof_tdata->threshold. However, delay updating */\ - /* these variables until prof_{m,re}alloc(), because */\ - /* we don't know for sure that the allocation will */\ - /* succeed. */\ - /* */\ - /* Use subtraction rather than addition to avoid */\ - /* potential integer overflow. */\ - if (size >= prof_tdata->threshold - \ - prof_tdata->accum) { \ - bt_init(&bt, prof_tdata->vec); \ - prof_backtrace(&bt, nignore, prof_bt_max); \ - ret = prof_lookup(&bt); \ - } else \ - ret = (prof_thr_cnt_t *)(uintptr_t)1U; \ - } \ -} while (0) - #ifndef JEMALLOC_ENABLE_INLINE void prof_sample_threshold_update(prof_tdata_t *prof_tdata); +prof_thr_cnt_t *prof_alloc_prep(size_t size); prof_ctx_t *prof_ctx_get(const void *ptr); void prof_ctx_set(const void *ptr, prof_ctx_t *ctx); bool prof_sample_accum_update(size_t size); @@ -298,22 +247,8 @@ prof_sample_threshold_update(prof_tdata_t *prof_tdata) double u; /* - * Compute sample threshold as a geometrically distributed random + * Compute prof_sample_threshold as a geometrically distributed random * variable with mean (2^opt_lg_prof_sample). - * - * __ __ - * | log(u) | 1 - * prof_tdata->threshold = | -------- |, where p = ------------------- - * | log(1-p) | opt_lg_prof_sample - * 2 - * - * For more information on the math, see: - * - * Non-Uniform Random Variate Generation - * Luc Devroye - * Springer-Verlag, New York, 1986 - * pp 500 - * (http://cg.scs.carleton.ca/~luc/rnbookindex.html) */ prn64(r, 53, prof_tdata->prn_state, (uint64_t)6364136223846793005LLU, (uint64_t)1442695040888963407LLU); @@ -323,6 +258,71 @@ prof_sample_threshold_update(prof_tdata_t *prof_tdata) + (uint64_t)1U; } +JEMALLOC_INLINE prof_thr_cnt_t * +prof_alloc_prep(size_t size) +{ +#ifdef JEMALLOC_ENABLE_INLINE + /* This function does not have its own stack frame, because it is inlined. */ +# define NIGNORE 1 +#else +# define NIGNORE 2 +#endif + prof_thr_cnt_t *ret; + prof_tdata_t *prof_tdata; + prof_bt_t bt; + + assert(size == s2u(size)); + + prof_tdata = PROF_TCACHE_GET(); + if (prof_tdata == NULL) { + prof_tdata = prof_tdata_init(); + if (prof_tdata == NULL) + return (NULL); + } + + if (opt_prof_active == false) { + /* Sampling is currently inactive, so avoid sampling. */ + ret = (prof_thr_cnt_t *)(uintptr_t)1U; + } else if (opt_lg_prof_sample == 0) { + /* + * Don't bother with sampling logic, since sampling interval is + * 1. + */ + bt_init(&bt, prof_tdata->vec); + prof_backtrace(&bt, NIGNORE, prof_bt_max); + ret = prof_lookup(&bt); + } else { + if (prof_tdata->threshold == 0) { + /* + * Initialize. Seed the prng differently for each + * thread. + */ + prof_tdata->prn_state = (uint64_t)(uintptr_t)&size; + prof_sample_threshold_update(prof_tdata); + } + + /* + * Determine whether to capture a backtrace based on whether + * size is enough for prof_accum to reach + * prof_tdata->threshold. However, delay updating these + * variables until prof_{m,re}alloc(), because we don't know + * for sure that the allocation will succeed. + * + * Use subtraction rather than addition to avoid potential + * integer overflow. + */ + if (size >= prof_tdata->threshold - prof_tdata->accum) { + bt_init(&bt, prof_tdata->vec); + prof_backtrace(&bt, NIGNORE, prof_bt_max); + ret = prof_lookup(&bt); + } else + ret = (prof_thr_cnt_t *)(uintptr_t)1U; + } + + return (ret); +#undef NIGNORE +} + JEMALLOC_INLINE prof_ctx_t * prof_ctx_get(const void *ptr) { @@ -334,7 +334,7 @@ prof_ctx_get(const void *ptr) chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); if (chunk != ptr) { /* Region. */ - dassert(chunk->arena->magic == ARENA_MAGIC); + assert(chunk->arena->magic == ARENA_MAGIC); ret = arena_prof_ctx_get(ptr); } else @@ -353,7 +353,7 @@ prof_ctx_set(const void *ptr, prof_ctx_t *ctx) chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); if (chunk != ptr) { /* Region. */ - dassert(chunk->arena->magic == ARENA_MAGIC); + assert(chunk->arena->magic == ARENA_MAGIC); arena_prof_ctx_set(ptr, ctx); } else @@ -374,7 +374,7 @@ prof_sample_accum_update(size_t size) /* Take care to avoid integer overflow. */ if (size >= prof_tdata->threshold - prof_tdata->accum) { prof_tdata->accum -= (prof_tdata->threshold - size); - /* Compute new sample threshold. */ + /* Compute new prof_sample_threshold. */ prof_sample_threshold_update(prof_tdata); while (prof_tdata->accum >= prof_tdata->threshold) { prof_tdata->accum -= prof_tdata->threshold; @@ -401,7 +401,7 @@ prof_malloc(const void *ptr, size_t size, prof_thr_cnt_t *cnt) * always possible to tell in advance how large an * object's usable size will be, so there should never * be a difference between the size passed to - * PROF_ALLOC_PREP() and prof_malloc(). + * prof_alloc_prep() and prof_malloc(). */ assert((uintptr_t)cnt == (uintptr_t)1U); } @@ -445,7 +445,7 @@ prof_realloc(const void *ptr, size_t size, prof_thr_cnt_t *cnt, if (prof_sample_accum_update(size)) { /* * Don't sample. The size passed to - * PROF_ALLOC_PREP() was larger than what + * prof_alloc_prep() was larger than what * actually got allocated, so a backtrace was * captured for this allocation, even though * its actual size was insufficient to cross diff --git a/dep/jemalloc/include/jemalloc/internal/rtree.h b/dep/jemalloc/include/jemalloc/internal/rtree.h index 95d6355a5f4..9d58ebac545 100644 --- a/dep/jemalloc/include/jemalloc/internal/rtree.h +++ b/dep/jemalloc/include/jemalloc/internal/rtree.h @@ -49,7 +49,7 @@ void *rtree_get(rtree_t *rtree, uintptr_t key); bool rtree_set(rtree_t *rtree, uintptr_t key, void *val); #endif -#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_RTREE_C_)) +#if (defined(JEMALLOC_ENABLE_INLINE) || defined(RTREE_C_)) #define RTREE_GET_GENERATE(f) \ /* The least significant bits of the key are ignored. */ \ JEMALLOC_INLINE void * \ diff --git a/dep/jemalloc/include/jemalloc/internal/stats.h b/dep/jemalloc/include/jemalloc/internal/stats.h index 2a9b31d9ffc..3fc2080a34b 100644 --- a/dep/jemalloc/include/jemalloc/internal/stats.h +++ b/dep/jemalloc/include/jemalloc/internal/stats.h @@ -154,10 +154,6 @@ struct chunk_stats_s { extern bool opt_stats_print; -#ifdef JEMALLOC_STATS -extern size_t stats_cactive; -#endif - char *u2s(uint64_t x, unsigned base, char *s); #ifdef JEMALLOC_STATS void malloc_cprintf(void (*write)(void *, const char *), void *cbopaque, @@ -170,38 +166,9 @@ void stats_print(void (*write)(void *, const char *), void *cbopaque, #endif /* JEMALLOC_H_EXTERNS */ /******************************************************************************/ -#ifdef JEMALLOC_H_INLINES #ifdef JEMALLOC_STATS +#ifdef JEMALLOC_H_INLINES -#ifndef JEMALLOC_ENABLE_INLINE -size_t stats_cactive_get(void); -void stats_cactive_add(size_t size); -void stats_cactive_sub(size_t size); -#endif - -#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_STATS_C_)) -JEMALLOC_INLINE size_t -stats_cactive_get(void) -{ - - return (atomic_read_z(&stats_cactive)); -} - -JEMALLOC_INLINE void -stats_cactive_add(size_t size) -{ - - atomic_add_z(&stats_cactive, size); -} - -JEMALLOC_INLINE void -stats_cactive_sub(size_t size) -{ - - atomic_sub_z(&stats_cactive, size); -} -#endif - -#endif /* JEMALLOC_STATS */ #endif /* JEMALLOC_H_INLINES */ +#endif /* JEMALLOC_STATS */ /******************************************************************************/ diff --git a/dep/jemalloc/include/jemalloc/internal/tcache.h b/dep/jemalloc/include/jemalloc/internal/tcache.h index da3c68c5770..1ad91a9b1e0 100644 --- a/dep/jemalloc/include/jemalloc/internal/tcache.h +++ b/dep/jemalloc/include/jemalloc/internal/tcache.h @@ -2,7 +2,6 @@ /******************************************************************************/ #ifdef JEMALLOC_H_TYPES -typedef struct tcache_bin_info_s tcache_bin_info_t; typedef struct tcache_bin_s tcache_bin_t; typedef struct tcache_s tcache_t; @@ -33,22 +32,15 @@ typedef struct tcache_s tcache_t; /******************************************************************************/ #ifdef JEMALLOC_H_STRUCTS -/* - * Read-only information associated with each element of tcache_t's tbins array - * is stored separately, mainly to reduce memory usage. - */ -struct tcache_bin_info_s { - unsigned ncached_max; /* Upper limit on ncached. */ -}; - struct tcache_bin_s { # ifdef JEMALLOC_STATS tcache_bin_stats_t tstats; # endif - int low_water; /* Min # cached since last GC. */ - unsigned lg_fill_div; /* Fill (ncached_max >> lg_fill_div). */ + unsigned low_water; /* Min # cached since last GC. */ + unsigned high_water; /* Max # cached since last GC. */ unsigned ncached; /* # of cached objects. */ - void **avail; /* Stack of available objects. */ + unsigned ncached_max; /* Upper limit on ncached. */ + void *avail; /* Chain of available objects. */ }; struct tcache_s { @@ -62,12 +54,6 @@ struct tcache_s { unsigned ev_cnt; /* Event count since incremental GC. */ unsigned next_gc_bin; /* Next bin to GC. */ tcache_bin_t tbins[1]; /* Dynamically sized. */ - /* - * The pointer stacks associated with tbins follow as a contiguous - * array. During tcache initialization, the avail pointer in each - * element of tbins is initialized to point to the proper offset within - * this array. - */ }; #endif /* JEMALLOC_H_STRUCTS */ @@ -78,8 +64,6 @@ extern bool opt_tcache; extern ssize_t opt_lg_tcache_max; extern ssize_t opt_lg_tcache_gc_sweep; -extern tcache_bin_info_t *tcache_bin_info; - /* Map of thread-specific caches. */ #ifndef NO_TLS extern __thread tcache_t *tcache_tls @@ -126,7 +110,7 @@ void tcache_destroy(tcache_t *tcache); #ifdef JEMALLOC_STATS void tcache_stats_merge(tcache_t *tcache, arena_t *arena); #endif -bool tcache_boot(void); +void tcache_boot(void); #endif /* JEMALLOC_H_EXTERNS */ /******************************************************************************/ @@ -185,7 +169,6 @@ tcache_event(tcache_t *tcache) if (tcache->ev_cnt == tcache_gc_incr) { size_t binind = tcache->next_gc_bin; tcache_bin_t *tbin = &tcache->tbins[binind]; - tcache_bin_info_t *tbin_info = &tcache_bin_info[binind]; if (tbin->low_water > 0) { /* @@ -209,22 +192,9 @@ tcache_event(tcache_t *tcache) #endif ); } - /* - * Reduce fill count by 2X. Limit lg_fill_div such that - * the fill count is always at least 1. - */ - if ((tbin_info->ncached_max >> (tbin->lg_fill_div+1)) - >= 1) - tbin->lg_fill_div++; - } else if (tbin->low_water < 0) { - /* - * Increase fill count by 2X. Make sure lg_fill_div - * stays greater than 0. - */ - if (tbin->lg_fill_div > 1) - tbin->lg_fill_div--; } tbin->low_water = tbin->ncached; + tbin->high_water = tbin->ncached; tcache->next_gc_bin++; if (tcache->next_gc_bin == nhbins) @@ -238,14 +208,13 @@ tcache_alloc_easy(tcache_bin_t *tbin) { void *ret; - if (tbin->ncached == 0) { - tbin->low_water = -1; + if (tbin->ncached == 0) return (NULL); - } tbin->ncached--; - if ((int)tbin->ncached < tbin->low_water) + if (tbin->ncached < tbin->low_water) tbin->low_water = tbin->ncached; - ret = tbin->avail[tbin->ncached]; + ret = tbin->avail; + tbin->avail = *(void **)ret; return (ret); } @@ -256,7 +225,7 @@ tcache_alloc_small(tcache_t *tcache, size_t size, bool zero) size_t binind; tcache_bin_t *tbin; - binind = SMALL_SIZE2BIN(size); + binind = small_size2bin[size]; assert(binind < nbins); tbin = &tcache->tbins[binind]; ret = tcache_alloc_easy(tbin); @@ -265,7 +234,7 @@ tcache_alloc_small(tcache_t *tcache, size_t size, bool zero) if (ret == NULL) return (NULL); } - assert(arena_salloc(ret) == arena_bin_info[binind].reg_size); + assert(arena_salloc(ret) == tcache->arena->bins[binind].reg_size); if (zero == false) { #ifdef JEMALLOC_FILL @@ -281,7 +250,7 @@ tcache_alloc_small(tcache_t *tcache, size_t size, bool zero) tbin->tstats.nrequests++; #endif #ifdef JEMALLOC_PROF - tcache->prof_accumbytes += arena_bin_info[binind].reg_size; + tcache->prof_accumbytes += tcache->arena->bins[binind].reg_size; #endif tcache_event(tcache); return (ret); @@ -345,7 +314,6 @@ tcache_dalloc_small(tcache_t *tcache, void *ptr) arena_run_t *run; arena_bin_t *bin; tcache_bin_t *tbin; - tcache_bin_info_t *tbin_info; size_t pageind, binind; arena_chunk_map_t *mapelm; @@ -357,7 +325,7 @@ tcache_dalloc_small(tcache_t *tcache, void *ptr) mapelm = &chunk->map[pageind-map_bias]; run = (arena_run_t *)((uintptr_t)chunk + (uintptr_t)((pageind - (mapelm->bits >> PAGE_SHIFT)) << PAGE_SHIFT)); - dassert(run->magic == ARENA_RUN_MAGIC); + assert(run->magic == ARENA_RUN_MAGIC); bin = run->bin; binind = ((uintptr_t)bin - (uintptr_t)&arena->bins) / sizeof(arena_bin_t); @@ -365,22 +333,23 @@ tcache_dalloc_small(tcache_t *tcache, void *ptr) #ifdef JEMALLOC_FILL if (opt_junk) - memset(ptr, 0x5a, arena_bin_info[binind].reg_size); + memset(ptr, 0x5a, bin->reg_size); #endif tbin = &tcache->tbins[binind]; - tbin_info = &tcache_bin_info[binind]; - if (tbin->ncached == tbin_info->ncached_max) { - tcache_bin_flush_small(tbin, binind, (tbin_info->ncached_max >> - 1) + if (tbin->ncached == tbin->ncached_max) { + tcache_bin_flush_small(tbin, binind, (tbin->ncached_max >> 1) #if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) , tcache #endif ); } - assert(tbin->ncached < tbin_info->ncached_max); - tbin->avail[tbin->ncached] = ptr; + assert(tbin->ncached < tbin->ncached_max); + *(void **)ptr = tbin->avail; + tbin->avail = ptr; tbin->ncached++; + if (tbin->ncached > tbin->high_water) + tbin->high_water = tbin->ncached; tcache_event(tcache); } @@ -392,7 +361,6 @@ tcache_dalloc_large(tcache_t *tcache, void *ptr, size_t size) arena_chunk_t *chunk; size_t pageind, binind; tcache_bin_t *tbin; - tcache_bin_info_t *tbin_info; assert((size & PAGE_MASK) == 0); assert(arena_salloc(ptr) > small_maxclass); @@ -409,18 +377,19 @@ tcache_dalloc_large(tcache_t *tcache, void *ptr, size_t size) #endif tbin = &tcache->tbins[binind]; - tbin_info = &tcache_bin_info[binind]; - if (tbin->ncached == tbin_info->ncached_max) { - tcache_bin_flush_large(tbin, binind, (tbin_info->ncached_max >> - 1) + if (tbin->ncached == tbin->ncached_max) { + tcache_bin_flush_large(tbin, binind, (tbin->ncached_max >> 1) #if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) , tcache #endif ); } - assert(tbin->ncached < tbin_info->ncached_max); - tbin->avail[tbin->ncached] = ptr; + assert(tbin->ncached < tbin->ncached_max); + *(void **)ptr = tbin->avail; + tbin->avail = ptr; tbin->ncached++; + if (tbin->ncached > tbin->high_water) + tbin->high_water = tbin->ncached; tcache_event(tcache); } diff --git a/dep/jemalloc/include/jemalloc/jemalloc.h b/dep/jemalloc/include/jemalloc/jemalloc.h index 3842e28115e..287dac46ed2 100644 --- a/dep/jemalloc/include/jemalloc/jemalloc.h +++ b/dep/jemalloc/include/jemalloc/jemalloc.h @@ -7,19 +7,19 @@ extern "C" { #include <limits.h> #include <strings.h> -#define JEMALLOC_VERSION "2.2.5-0-gfc1bb70e5f0d9a58b39efa39cc549b5af5104760" +#define JEMALLOC_VERSION "2.1.0-0-g1c4b088b08d3bc7617a34387e196ce03716160bf" #define JEMALLOC_VERSION_MAJOR 2 -#define JEMALLOC_VERSION_MINOR 2 -#define JEMALLOC_VERSION_BUGFIX 5 +#define JEMALLOC_VERSION_MINOR 1 +#define JEMALLOC_VERSION_BUGFIX 0 #define JEMALLOC_VERSION_NREV 0 -#define JEMALLOC_VERSION_GID "fc1bb70e5f0d9a58b39efa39cc549b5af5104760" +#define JEMALLOC_VERSION_GID "1c4b088b08d3bc7617a34387e196ce03716160bf" #include "jemalloc_defs.h" #ifndef JEMALLOC_P # define JEMALLOC_P(s) s #endif -#define ALLOCM_LG_ALIGN(la) (la) +#define ALLOCM_LG_ALIGN ((int)0x3f) #if LG_SIZEOF_PTR == 2 #define ALLOCM_ALIGN(a) (ffs(a)-1) #else diff --git a/dep/jemalloc/include/jemalloc/jemalloc_defs.h b/dep/jemalloc/include/jemalloc/jemalloc_defs.h index f0f8fa71a4d..a641b56da03 100644 --- a/dep/jemalloc/include/jemalloc/jemalloc_defs.h +++ b/dep/jemalloc/include/jemalloc/jemalloc_defs.h @@ -20,32 +20,11 @@ #endif /* - * JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs. - * For shared libraries, symbol visibility mechanisms prevent these symbols - * from being exported, but for static libraries, naming collisions are a real - * possibility. - */ -#define JEMALLOC_PRIVATE_NAMESPACE "" -#define JEMALLOC_N(string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix) string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix - -/* * Hyper-threaded CPUs may need a special instruction inside spin loops in * order to yield to another virtual CPU. */ #define CPU_SPINWAIT __asm__ volatile("pause") -/* - * Defined if OSAtomic*() functions are available, as provided by Darwin, and - * documented in the atomic(3) manual page. - */ -/* #undef JEMALLOC_OSATOMIC */ - -/* - * Defined if OSSpin*() functions are available, as provided by Darwin, and - * documented in the spinlock(3) manual page. - */ -/* #undef JEMALLOC_OSSPIN */ - /* Defined if __attribute__((...)) syntax is supported. */ #define JEMALLOC_HAVE_ATTR #ifdef JEMALLOC_HAVE_ATTR @@ -75,21 +54,18 @@ /* Use libgcc for profile backtracing if defined. */ /* #undef JEMALLOC_PROF_LIBGCC */ -/* Use gcc intrinsics for profile backtracing if defined. */ -/* #undef JEMALLOC_PROF_GCC */ - /* * JEMALLOC_TINY enables support for tiny objects, which are smaller than one * quantum. */ -#define JEMALLOC_TINY +/* #undef JEMALLOC_TINY */ /* * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects. * This makes it possible to allocate/deallocate objects without any locking * when the cache is in the steady state. */ -#define JEMALLOC_TCACHE +/* #undef JEMALLOC_TCACHE */ /* * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage @@ -110,7 +86,7 @@ /* #undef JEMALLOC_SYSV */ /* Support lazy locking (avoid locking unless a second thread is launched). */ -#define JEMALLOC_LAZY_LOCK +/* #undef JEMALLOC_LAZY_LOCK */ /* Determine page size at run time if defined. */ /* #undef DYNAMIC_PAGE_SHIFT */ @@ -157,12 +133,9 @@ /* #undef JEMALLOC_PURGE_MADVISE_FREE */ /* sizeof(void *) == 2^LG_SIZEOF_PTR. */ -#define LG_SIZEOF_PTR 3 +#define LG_SIZEOF_PTR 2 /* sizeof(int) == 2^LG_SIZEOF_INT. */ #define LG_SIZEOF_INT 2 -/* sizeof(long) == 2^LG_SIZEOF_LONG. */ -#define LG_SIZEOF_LONG 3 - #endif /* JEMALLOC_DEFS_H_ */ diff --git a/dep/jemalloc/src/arena.c b/dep/jemalloc/src/arena.c index d166ca1ec4d..7f939b3cd77 100644 --- a/dep/jemalloc/src/arena.c +++ b/dep/jemalloc/src/arena.c @@ -8,7 +8,6 @@ size_t opt_lg_qspace_max = LG_QSPACE_MAX_DEFAULT; size_t opt_lg_cspace_max = LG_CSPACE_MAX_DEFAULT; ssize_t opt_lg_dirty_mult = LG_DIRTY_MULT_DEFAULT; uint8_t const *small_size2bin; -arena_bin_info_t *arena_bin_info; /* Various bin-related settings. */ unsigned nqbins; @@ -26,27 +25,26 @@ size_t mspace_mask; /* * const_small_size2bin is a static constant lookup table that in the common - * case can be used as-is for small_size2bin. + * case can be used as-is for small_size2bin. For dynamically linked programs, + * this avoids a page of memory overhead per process. */ -#if (LG_TINY_MIN == 2) -#define S2B_4(i) i, +#define S2B_1(i) i, +#define S2B_2(i) S2B_1(i) S2B_1(i) +#define S2B_4(i) S2B_2(i) S2B_2(i) #define S2B_8(i) S2B_4(i) S2B_4(i) -#elif (LG_TINY_MIN == 3) -#define S2B_8(i) i, -#else -# error "Unsupported LG_TINY_MIN" -#endif #define S2B_16(i) S2B_8(i) S2B_8(i) #define S2B_32(i) S2B_16(i) S2B_16(i) #define S2B_64(i) S2B_32(i) S2B_32(i) #define S2B_128(i) S2B_64(i) S2B_64(i) #define S2B_256(i) S2B_128(i) S2B_128(i) /* - * The number of elements in const_small_size2bin is dependent on the - * definition for SUBPAGE. + * The number of elements in const_small_size2bin is dependent on page size + * and on the definition for SUBPAGE. If SUBPAGE changes, the '- 255' must also + * change, along with the addition/removal of static lookup table element + * definitions. */ -static JEMALLOC_ATTR(aligned(CACHELINE)) - const uint8_t const_small_size2bin[] = { +static const uint8_t const_small_size2bin[STATIC_PAGE_SIZE - 255] = { + S2B_1(0xffU) /* 0 */ #if (LG_QUANTUM == 4) /* 16-byte quantum **********************/ # ifdef JEMALLOC_TINY @@ -175,6 +173,7 @@ static void arena_run_trim_tail(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, size_t oldsize, size_t newsize, bool dirty); static arena_run_t *arena_bin_nonfull_run_get(arena_t *arena, arena_bin_t *bin); static void *arena_bin_malloc_hard(arena_t *arena, arena_bin_t *bin); +static size_t arena_bin_run_size_calc(arena_bin_t *bin, size_t min_run_size); static void arena_dissociate_bin_run(arena_chunk_t *chunk, arena_run_t *run, arena_bin_t *bin); static void arena_dalloc_bin_run(arena_t *arena, arena_chunk_t *chunk, @@ -192,9 +191,6 @@ static bool small_size2bin_init(void); static void small_size2bin_validate(void); #endif static bool small_size2bin_init_hard(void); -static size_t bin_info_run_size_calc(arena_bin_info_t *bin_info, - size_t min_run_size); -static bool bin_info_init(void); /******************************************************************************/ @@ -250,48 +246,57 @@ rb_gen(static JEMALLOC_ATTR(unused), arena_avail_tree_, arena_avail_tree_t, arena_chunk_map_t, u.rb_link, arena_avail_comp) static inline void * -arena_run_reg_alloc(arena_run_t *run, arena_bin_info_t *bin_info) +arena_run_reg_alloc(arena_run_t *run, arena_bin_t *bin) { void *ret; - unsigned regind; - bitmap_t *bitmap = (bitmap_t *)((uintptr_t)run + - (uintptr_t)bin_info->bitmap_offset); - dassert(run->magic == ARENA_RUN_MAGIC); + assert(run->magic == ARENA_RUN_MAGIC); assert(run->nfree > 0); - assert(bitmap_full(bitmap, &bin_info->bitmap_info) == false); - regind = bitmap_sfu(bitmap, &bin_info->bitmap_info); - ret = (void *)((uintptr_t)run + (uintptr_t)bin_info->reg0_offset + - (uintptr_t)(bin_info->reg_size * regind)); run->nfree--; - if (regind == run->nextind) - run->nextind++; - assert(regind < run->nextind); + ret = run->avail; + if (ret != NULL) { + /* Double free can cause assertion failure.*/ + assert(ret != NULL); + /* Write-after free can cause assertion failure. */ + assert((uintptr_t)ret >= (uintptr_t)run + + (uintptr_t)bin->reg0_offset); + assert((uintptr_t)ret < (uintptr_t)run->next); + assert(((uintptr_t)ret - ((uintptr_t)run + + (uintptr_t)bin->reg0_offset)) % (uintptr_t)bin->reg_size == + 0); + run->avail = *(void **)ret; + return (ret); + } + ret = run->next; + run->next = (void *)((uintptr_t)ret + (uintptr_t)bin->reg_size); + assert(ret != NULL); return (ret); } static inline void arena_run_reg_dalloc(arena_run_t *run, void *ptr) { - arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); - size_t binind = arena_bin_index(chunk->arena, run->bin); - arena_bin_info_t *bin_info = &arena_bin_info[binind]; - unsigned regind = arena_run_regind(run, bin_info, ptr); - bitmap_t *bitmap = (bitmap_t *)((uintptr_t)run + - (uintptr_t)bin_info->bitmap_offset); - - assert(run->nfree < bin_info->nregs); + + assert(run->nfree < run->bin->nregs); /* Freeing an interior pointer can cause assertion failure. */ assert(((uintptr_t)ptr - ((uintptr_t)run + - (uintptr_t)bin_info->reg0_offset)) % (uintptr_t)bin_info->reg_size + (uintptr_t)run->bin->reg0_offset)) % (uintptr_t)run->bin->reg_size == 0); + /* + * Freeing a pointer lower than region zero can cause assertion + * failure. + */ assert((uintptr_t)ptr >= (uintptr_t)run + - (uintptr_t)bin_info->reg0_offset); - /* Freeing an unallocated pointer can cause assertion failure. */ - assert(bitmap_get(bitmap, &bin_info->bitmap_info, regind)); + (uintptr_t)run->bin->reg0_offset); + /* + * Freeing a pointer past in the run's frontier can cause assertion + * failure. + */ + assert((uintptr_t)ptr < (uintptr_t)run->next); - bitmap_unset(bitmap, &bin_info->bitmap_info, regind); + *(void **)ptr = run->avail; + run->avail = ptr; run->nfree++; } @@ -315,9 +320,6 @@ arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large, size_t old_ndirty, run_ind, total_pages, need_pages, rem_pages, i; size_t flag_dirty; arena_avail_tree_t *runs_avail; -#ifdef JEMALLOC_STATS - size_t cactive_diff; -#endif chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); old_ndirty = chunk->ndirty; @@ -336,13 +338,6 @@ arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large, rem_pages = total_pages - need_pages; arena_avail_tree_remove(runs_avail, &chunk->map[run_ind-map_bias]); -#ifdef JEMALLOC_STATS - /* Update stats_cactive if nactive is crossing a chunk multiple. */ - cactive_diff = CHUNK_CEILING((arena->nactive + need_pages) << - PAGE_SHIFT) - CHUNK_CEILING(arena->nactive << PAGE_SHIFT); - if (cactive_diff != 0) - stats_cactive_add(cactive_diff); -#endif arena->nactive += need_pages; /* Keep track of trailing unused pages for later use. */ @@ -569,7 +564,7 @@ arena_chunk_dealloc(arena_t *arena, arena_chunk_t *chunk) arena->ndirty -= spare->ndirty; } malloc_mutex_unlock(&arena->lock); - chunk_dealloc((void *)spare, chunksize, true); + chunk_dealloc((void *)spare, chunksize); malloc_mutex_lock(&arena->lock); #ifdef JEMALLOC_STATS arena->stats.mapped -= chunksize; @@ -730,9 +725,6 @@ arena_chunk_purge(arena_t *arena, arena_chunk_t *chunk) assert(pageind + npages <= chunk_npages); if (mapelm->bits & CHUNK_MAP_DIRTY) { size_t i; -#ifdef JEMALLOC_STATS - size_t cactive_diff; -#endif arena_avail_tree_remove( &arena->runs_avail_dirty, mapelm); @@ -755,17 +747,6 @@ arena_chunk_purge(arena_t *arena, arena_chunk_t *chunk) CHUNK_MAP_ALLOCATED; } -#ifdef JEMALLOC_STATS - /* - * Update stats_cactive if nactive is crossing a - * chunk multiple. - */ - cactive_diff = CHUNK_CEILING((arena->nactive + - npages) << PAGE_SHIFT) - - CHUNK_CEILING(arena->nactive << PAGE_SHIFT); - if (cactive_diff != 0) - stats_cactive_add(cactive_diff); -#endif arena->nactive += npages; /* Append to list for later processing. */ ql_elm_new(mapelm, u.ql_link); @@ -782,12 +763,8 @@ arena_chunk_purge(arena_t *arena, arena_chunk_t *chunk) chunk + (uintptr_t)(pageind << PAGE_SHIFT)); assert((mapelm->bits >> PAGE_SHIFT) == 0); - dassert(run->magic == ARENA_RUN_MAGIC); - size_t binind = arena_bin_index(arena, - run->bin); - arena_bin_info_t *bin_info = - &arena_bin_info[binind]; - pageind += bin_info->run_size >> PAGE_SHIFT; + assert(run->magic == ARENA_RUN_MAGIC); + pageind += run->bin->run_size >> PAGE_SHIFT; } } } @@ -868,10 +845,9 @@ arena_purge(arena_t *arena, bool all) } assert(ndirty == arena->ndirty); #endif - assert(arena->ndirty > arena->npurgatory || all); - assert(arena->ndirty - arena->npurgatory > chunk_npages || all); - assert((arena->nactive >> opt_lg_dirty_mult) < (arena->ndirty - - arena->npurgatory) || all); + assert(arena->ndirty > arena->npurgatory); + assert(arena->ndirty > chunk_npages || all); + assert((arena->nactive >> opt_lg_dirty_mult) < arena->ndirty || all); #ifdef JEMALLOC_STATS arena->stats.npurge++; @@ -883,10 +859,8 @@ arena_purge(arena_t *arena, bool all) * multiple threads from racing to reduce ndirty below the threshold. */ npurgatory = arena->ndirty - arena->npurgatory; - if (all == false) { - assert(npurgatory >= arena->nactive >> opt_lg_dirty_mult); + if (all == false) npurgatory -= arena->nactive >> opt_lg_dirty_mult; - } arena->npurgatory += npurgatory; while (npurgatory > 0) { @@ -957,9 +931,6 @@ arena_run_dalloc(arena_t *arena, arena_run_t *run, bool dirty) arena_chunk_t *chunk; size_t size, run_ind, run_pages, flag_dirty; arena_avail_tree_t *runs_avail; -#ifdef JEMALLOC_STATS - size_t cactive_diff; -#endif chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); run_ind = (size_t)(((uintptr_t)run - (uintptr_t)chunk) @@ -975,19 +946,9 @@ arena_run_dalloc(arena_t *arena, arena_run_t *run, bool dirty) CHUNK_MAP_LARGE) != 0); assert((chunk->map[run_ind+(size>>PAGE_SHIFT)-1-map_bias].bits & CHUNK_MAP_ALLOCATED) != 0); - } else { - size_t binind = arena_bin_index(arena, run->bin); - arena_bin_info_t *bin_info = &arena_bin_info[binind]; - size = bin_info->run_size; - } + } else + size = run->bin->run_size; run_pages = (size >> PAGE_SHIFT); -#ifdef JEMALLOC_STATS - /* Update stats_cactive if nactive is crossing a chunk multiple. */ - cactive_diff = CHUNK_CEILING(arena->nactive << PAGE_SHIFT) - - CHUNK_CEILING((arena->nactive - run_pages) << PAGE_SHIFT); - if (cactive_diff != 0) - stats_cactive_sub(cactive_diff); -#endif arena->nactive -= run_pages; /* @@ -1213,8 +1174,6 @@ arena_bin_nonfull_run_get(arena_t *arena, arena_bin_t *bin) { arena_chunk_map_t *mapelm; arena_run_t *run; - size_t binind; - arena_bin_info_t *bin_info; /* Look for a usable run. */ mapelm = arena_run_tree_first(&bin->runs); @@ -1238,23 +1197,18 @@ arena_bin_nonfull_run_get(arena_t *arena, arena_bin_t *bin) } /* No existing runs have any space available. */ - binind = arena_bin_index(arena, bin); - bin_info = &arena_bin_info[binind]; - /* Allocate a new run. */ malloc_mutex_unlock(&bin->lock); /******************************/ malloc_mutex_lock(&arena->lock); - run = arena_run_alloc(arena, bin_info->run_size, false, false); + run = arena_run_alloc(arena, bin->run_size, false, false); if (run != NULL) { - bitmap_t *bitmap = (bitmap_t *)((uintptr_t)run + - (uintptr_t)bin_info->bitmap_offset); - /* Initialize run internals. */ run->bin = bin; - run->nextind = 0; - run->nfree = bin_info->nregs; - bitmap_init(bitmap, &bin_info->bitmap_info); + run->avail = NULL; + run->next = (void *)((uintptr_t)run + + (uintptr_t)bin->reg0_offset); + run->nfree = bin->nregs; #ifdef JEMALLOC_DEBUG run->magic = ARENA_RUN_MAGIC; #endif @@ -1305,12 +1259,8 @@ static void * arena_bin_malloc_hard(arena_t *arena, arena_bin_t *bin) { void *ret; - size_t binind; - arena_bin_info_t *bin_info; arena_run_t *run; - binind = arena_bin_index(arena, bin); - bin_info = &arena_bin_info[binind]; bin->runcur = NULL; run = arena_bin_nonfull_run_get(arena, bin); if (bin->runcur != NULL && bin->runcur->nfree > 0) { @@ -1318,22 +1268,22 @@ arena_bin_malloc_hard(arena_t *arena, arena_bin_t *bin) * Another thread updated runcur while this one ran without the * bin lock in arena_bin_nonfull_run_get(). */ - dassert(bin->runcur->magic == ARENA_RUN_MAGIC); + assert(bin->runcur->magic == ARENA_RUN_MAGIC); assert(bin->runcur->nfree > 0); - ret = arena_run_reg_alloc(bin->runcur, bin_info); + ret = arena_run_reg_alloc(bin->runcur, bin); if (run != NULL) { arena_chunk_t *chunk; /* * arena_run_alloc() may have allocated run, or it may - * have pulled run from the bin's run tree. Therefore + * have pulled it from the bin's run tree. Therefore * it is unsafe to make any assumptions about how run * has previously been used, and arena_bin_lower_run() * must be called, as if a region were just deallocated * from the run. */ chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); - if (run->nfree == bin_info->nregs) + if (run->nfree == bin->nregs) arena_dalloc_bin_run(arena, chunk, run, bin); else arena_bin_lower_run(arena, chunk, run, bin); @@ -1346,10 +1296,10 @@ arena_bin_malloc_hard(arena_t *arena, arena_bin_t *bin) bin->runcur = run; - dassert(bin->runcur->magic == ARENA_RUN_MAGIC); + assert(bin->runcur->magic == ARENA_RUN_MAGIC); assert(bin->runcur->nfree > 0); - return (arena_run_reg_alloc(bin->runcur, bin_info)); + return (arena_run_reg_alloc(bin->runcur, bin)); } #ifdef JEMALLOC_PROF @@ -1389,19 +1339,18 @@ arena_tcache_fill_small(arena_t *arena, tcache_bin_t *tbin, size_t binind #endif bin = &arena->bins[binind]; malloc_mutex_lock(&bin->lock); - for (i = 0, nfill = (tcache_bin_info[binind].ncached_max >> - tbin->lg_fill_div); i < nfill; i++) { + for (i = 0, nfill = (tbin->ncached_max >> 1); i < nfill; i++) { if ((run = bin->runcur) != NULL && run->nfree > 0) - ptr = arena_run_reg_alloc(run, &arena_bin_info[binind]); + ptr = arena_run_reg_alloc(run, bin); else ptr = arena_bin_malloc_hard(arena, bin); if (ptr == NULL) break; - /* Insert such that low regions get used first. */ - tbin->avail[nfill - 1 - i] = ptr; + *(void **)ptr = tbin->avail; + tbin->avail = ptr; } #ifdef JEMALLOC_STATS - bin->stats.allocated += i * arena_bin_info[binind].reg_size; + bin->stats.allocated += (i - tbin->ncached) * bin->reg_size; bin->stats.nmalloc += i; bin->stats.nrequests += tbin->tstats.nrequests; bin->stats.nfills++; @@ -1409,9 +1358,119 @@ arena_tcache_fill_small(arena_t *arena, tcache_bin_t *tbin, size_t binind #endif malloc_mutex_unlock(&bin->lock); tbin->ncached = i; + if (tbin->ncached > tbin->high_water) + tbin->high_water = tbin->ncached; } #endif +/* + * Calculate bin->run_size such that it meets the following constraints: + * + * *) bin->run_size >= min_run_size + * *) bin->run_size <= arena_maxclass + * *) run header overhead <= RUN_MAX_OVRHD (or header overhead relaxed). + * *) run header size < PAGE_SIZE + * + * bin->nregs and bin->reg0_offset are also calculated here, since these + * settings are all interdependent. + */ +static size_t +arena_bin_run_size_calc(arena_bin_t *bin, size_t min_run_size) +{ + size_t try_run_size, good_run_size; + uint32_t try_nregs, good_nregs; + uint32_t try_hdr_size, good_hdr_size; +#ifdef JEMALLOC_PROF + uint32_t try_ctx0_offset, good_ctx0_offset; +#endif + uint32_t try_reg0_offset, good_reg0_offset; + + assert(min_run_size >= PAGE_SIZE); + assert(min_run_size <= arena_maxclass); + + /* + * Calculate known-valid settings before entering the run_size + * expansion loop, so that the first part of the loop always copies + * valid settings. + * + * The do..while loop iteratively reduces the number of regions until + * the run header and the regions no longer overlap. A closed formula + * would be quite messy, since there is an interdependency between the + * header's mask length and the number of regions. + */ + try_run_size = min_run_size; + try_nregs = ((try_run_size - sizeof(arena_run_t)) / bin->reg_size) + + 1; /* Counter-act try_nregs-- in loop. */ + do { + try_nregs--; + try_hdr_size = sizeof(arena_run_t); +#ifdef JEMALLOC_PROF + if (opt_prof && prof_promote == false) { + /* Pad to a quantum boundary. */ + try_hdr_size = QUANTUM_CEILING(try_hdr_size); + try_ctx0_offset = try_hdr_size; + /* Add space for one (prof_ctx_t *) per region. */ + try_hdr_size += try_nregs * sizeof(prof_ctx_t *); + } else + try_ctx0_offset = 0; +#endif + try_reg0_offset = try_run_size - (try_nregs * bin->reg_size); + } while (try_hdr_size > try_reg0_offset); + + /* run_size expansion loop. */ + do { + /* + * Copy valid settings before trying more aggressive settings. + */ + good_run_size = try_run_size; + good_nregs = try_nregs; + good_hdr_size = try_hdr_size; +#ifdef JEMALLOC_PROF + good_ctx0_offset = try_ctx0_offset; +#endif + good_reg0_offset = try_reg0_offset; + + /* Try more aggressive settings. */ + try_run_size += PAGE_SIZE; + try_nregs = ((try_run_size - sizeof(arena_run_t)) / + bin->reg_size) + 1; /* Counter-act try_nregs-- in loop. */ + do { + try_nregs--; + try_hdr_size = sizeof(arena_run_t); +#ifdef JEMALLOC_PROF + if (opt_prof && prof_promote == false) { + /* Pad to a quantum boundary. */ + try_hdr_size = QUANTUM_CEILING(try_hdr_size); + try_ctx0_offset = try_hdr_size; + /* + * Add space for one (prof_ctx_t *) per region. + */ + try_hdr_size += try_nregs * + sizeof(prof_ctx_t *); + } +#endif + try_reg0_offset = try_run_size - (try_nregs * + bin->reg_size); + } while (try_hdr_size > try_reg0_offset); + } while (try_run_size <= arena_maxclass + && try_run_size <= arena_maxclass + && RUN_MAX_OVRHD * (bin->reg_size << 3) > RUN_MAX_OVRHD_RELAX + && (try_reg0_offset << RUN_BFP) > RUN_MAX_OVRHD * try_run_size + && try_hdr_size < PAGE_SIZE); + + assert(good_hdr_size <= good_reg0_offset); + + /* Copy final settings. */ + bin->run_size = good_run_size; + bin->nregs = good_nregs; +#ifdef JEMALLOC_PROF + bin->ctx0_offset = good_ctx0_offset; +#endif + bin->reg0_offset = good_reg0_offset; + + return (good_run_size); +} + void * arena_malloc_small(arena_t *arena, size_t size, bool zero) { @@ -1420,14 +1479,14 @@ arena_malloc_small(arena_t *arena, size_t size, bool zero) arena_run_t *run; size_t binind; - binind = SMALL_SIZE2BIN(size); + binind = small_size2bin[size]; assert(binind < nbins); bin = &arena->bins[binind]; - size = arena_bin_info[binind].reg_size; + size = bin->reg_size; malloc_mutex_lock(&bin->lock); if ((run = bin->runcur) != NULL && run->nfree > 0) - ret = arena_run_reg_alloc(run, &arena_bin_info[binind]); + ret = arena_run_reg_alloc(run, bin); else ret = arena_bin_malloc_hard(arena, bin); @@ -1631,13 +1690,11 @@ arena_salloc(const void *ptr) arena_run_t *run = (arena_run_t *)((uintptr_t)chunk + (uintptr_t)((pageind - (mapbits >> PAGE_SHIFT)) << PAGE_SHIFT)); - dassert(run->magic == ARENA_RUN_MAGIC); - size_t binind = arena_bin_index(chunk->arena, run->bin); - arena_bin_info_t *bin_info = &arena_bin_info[binind]; + assert(run->magic == ARENA_RUN_MAGIC); assert(((uintptr_t)ptr - ((uintptr_t)run + - (uintptr_t)bin_info->reg0_offset)) % bin_info->reg_size == + (uintptr_t)run->bin->reg0_offset)) % run->bin->reg_size == 0); - ret = bin_info->reg_size; + ret = run->bin->reg_size; } else { assert(((uintptr_t)ptr & PAGE_MASK) == 0); ret = mapbits & ~PAGE_MASK; @@ -1657,11 +1714,10 @@ arena_prof_promoted(const void *ptr, size_t size) assert(ptr != NULL); assert(CHUNK_ADDR2BASE(ptr) != ptr); assert(isalloc(ptr) == PAGE_SIZE); - assert(size <= small_maxclass); chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT; - binind = SMALL_SIZE2BIN(size); + binind = small_size2bin[size]; assert(binind < nbins); chunk->map[pageind-map_bias].bits = (chunk->map[pageind-map_bias].bits & ~CHUNK_MAP_CLASS_MASK) | ((binind+1) << CHUNK_MAP_CLASS_SHIFT); @@ -1685,13 +1741,11 @@ arena_salloc_demote(const void *ptr) arena_run_t *run = (arena_run_t *)((uintptr_t)chunk + (uintptr_t)((pageind - (mapbits >> PAGE_SHIFT)) << PAGE_SHIFT)); - dassert(run->magic == ARENA_RUN_MAGIC); - size_t binind = arena_bin_index(chunk->arena, run->bin); - arena_bin_info_t *bin_info = &arena_bin_info[binind]; + assert(run->magic == ARENA_RUN_MAGIC); assert(((uintptr_t)ptr - ((uintptr_t)run + - (uintptr_t)bin_info->reg0_offset)) % bin_info->reg_size == + (uintptr_t)run->bin->reg0_offset)) % run->bin->reg_size == 0); - ret = bin_info->reg_size; + ret = run->bin->reg_size; } else { assert(((uintptr_t)ptr & PAGE_MASK) == 0); ret = mapbits & ~PAGE_MASK; @@ -1700,7 +1754,7 @@ arena_salloc_demote(const void *ptr) size_t binind = ((mapbits & CHUNK_MAP_CLASS_MASK) >> CHUNK_MAP_CLASS_SHIFT) - 1; assert(binind < nbins); - ret = arena_bin_info[binind].reg_size; + ret = chunk->arena->bins[binind].reg_size; } assert(ret != 0); } @@ -1717,22 +1771,17 @@ arena_dissociate_bin_run(arena_chunk_t *chunk, arena_run_t *run, /* Dissociate run from bin. */ if (run == bin->runcur) bin->runcur = NULL; - else { - size_t binind = arena_bin_index(chunk->arena, bin); - arena_bin_info_t *bin_info = &arena_bin_info[binind]; - - if (bin_info->nregs != 1) { - size_t run_pageind = (((uintptr_t)run - - (uintptr_t)chunk)) >> PAGE_SHIFT; - arena_chunk_map_t *run_mapelm = - &chunk->map[run_pageind-map_bias]; - /* - * This block's conditional is necessary because if the - * run only contains one region, then it never gets - * inserted into the non-full runs tree. - */ - arena_run_tree_remove(&bin->runs, run_mapelm); - } + else if (bin->nregs != 1) { + size_t run_pageind = (((uintptr_t)run - (uintptr_t)chunk)) >> + PAGE_SHIFT; + arena_chunk_map_t *run_mapelm = + &chunk->map[run_pageind-map_bias]; + /* + * This block's conditional is necessary because if the run + * only contains one region, then it never gets inserted into + * the non-full runs tree. + */ + arena_run_tree_remove(&bin->runs, run_mapelm); } } @@ -1740,24 +1789,18 @@ static void arena_dalloc_bin_run(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, arena_bin_t *bin) { - size_t binind; - arena_bin_info_t *bin_info; size_t npages, run_ind, past; assert(run != bin->runcur); assert(arena_run_tree_search(&bin->runs, &chunk->map[ (((uintptr_t)run-(uintptr_t)chunk)>>PAGE_SHIFT)-map_bias]) == NULL); - binind = arena_bin_index(chunk->arena, run->bin); - bin_info = &arena_bin_info[binind]; - malloc_mutex_unlock(&bin->lock); /******************************/ - npages = bin_info->run_size >> PAGE_SHIFT; + npages = bin->run_size >> PAGE_SHIFT; run_ind = (size_t)(((uintptr_t)run - (uintptr_t)chunk) >> PAGE_SHIFT); - past = (size_t)(PAGE_CEILING((uintptr_t)run + - (uintptr_t)bin_info->reg0_offset + (uintptr_t)(run->nextind * - bin_info->reg_size) - (uintptr_t)chunk) >> PAGE_SHIFT); + past = (size_t)((PAGE_CEILING((uintptr_t)run->next) - (uintptr_t)chunk) + >> PAGE_SHIFT); malloc_mutex_lock(&arena->lock); /* @@ -1774,7 +1817,7 @@ arena_dalloc_bin_run(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, chunk->map[run_ind+npages-1-map_bias].bits = CHUNK_MAP_LARGE | (chunk->map[run_ind+npages-1-map_bias].bits & CHUNK_MAP_FLAGS_MASK); - chunk->map[run_ind-map_bias].bits = bin_info->run_size | + chunk->map[run_ind-map_bias].bits = bin->run_size | CHUNK_MAP_LARGE | (chunk->map[run_ind-map_bias].bits & CHUNK_MAP_FLAGS_MASK); arena_run_trim_tail(arena, chunk, run, (npages << PAGE_SHIFT), @@ -1843,12 +1886,10 @@ arena_dalloc_bin(arena_t *arena, arena_chunk_t *chunk, void *ptr, pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT; run = (arena_run_t *)((uintptr_t)chunk + (uintptr_t)((pageind - (mapelm->bits >> PAGE_SHIFT)) << PAGE_SHIFT)); - dassert(run->magic == ARENA_RUN_MAGIC); + assert(run->magic == ARENA_RUN_MAGIC); bin = run->bin; - size_t binind = arena_bin_index(arena, bin); - arena_bin_info_t *bin_info = &arena_bin_info[binind]; #if (defined(JEMALLOC_FILL) || defined(JEMALLOC_STATS)) - size = bin_info->reg_size; + size = bin->reg_size; #endif #ifdef JEMALLOC_FILL @@ -1857,7 +1898,7 @@ arena_dalloc_bin(arena_t *arena, arena_chunk_t *chunk, void *ptr, #endif arena_run_reg_dalloc(run, ptr); - if (run->nfree == bin_info->nregs) { + if (run->nfree == bin->nregs) { arena_dissociate_bin_run(chunk, run, bin); arena_dalloc_bin_run(arena, chunk, run, bin); } else if (run->nfree == 1 && run != bin->runcur) @@ -2091,7 +2132,7 @@ arena_ralloc_large(void *ptr, size_t oldsize, size_t size, size_t extra, chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); arena = chunk->arena; - dassert(arena->magic == ARENA_MAGIC); + assert(arena->magic == ARENA_MAGIC); if (psize < oldsize) { #ifdef JEMALLOC_FILL @@ -2129,11 +2170,11 @@ arena_ralloc_no_move(void *ptr, size_t oldsize, size_t size, size_t extra, */ if (oldsize <= arena_maxclass) { if (oldsize <= small_maxclass) { - assert(arena_bin_info[SMALL_SIZE2BIN(oldsize)].reg_size - == oldsize); + assert(choose_arena()->bins[small_size2bin[ + oldsize]].reg_size == oldsize); if ((size + extra <= small_maxclass && - SMALL_SIZE2BIN(size + extra) == - SMALL_SIZE2BIN(oldsize)) || (size <= oldsize && + small_size2bin[size + extra] == + small_size2bin[oldsize]) || (size <= oldsize && size + extra >= oldsize)) { #ifdef JEMALLOC_FILL if (opt_junk && size < oldsize) { @@ -2169,29 +2210,24 @@ arena_ralloc(void *ptr, size_t oldsize, size_t size, size_t extra, if (ret != NULL) return (ret); + /* * size and oldsize are different enough that we need to move the * object. In that case, fall back to allocating new space and * copying. */ - if (alignment != 0) { - size_t usize = sa2u(size + extra, alignment, NULL); - if (usize == 0) - return (NULL); - ret = ipalloc(usize, alignment, zero); - } else + if (alignment != 0) + ret = ipalloc(size + extra, alignment, zero); + else ret = arena_malloc(size + extra, zero); if (ret == NULL) { if (extra == 0) return (NULL); /* Try again, this time without extra. */ - if (alignment != 0) { - size_t usize = sa2u(size, alignment, NULL); - if (usize == 0) - return (NULL); - ret = ipalloc(usize, alignment, zero); - } else + if (alignment != 0) + ret = ipalloc(size, alignment, zero); + else ret = arena_malloc(size, zero); if (ret == NULL) @@ -2215,9 +2251,9 @@ arena_new(arena_t *arena, unsigned ind) { unsigned i; arena_bin_t *bin; + size_t prev_run_size; arena->ind = ind; - arena->nthreads = 0; if (malloc_mutex_init(&arena->lock)) return (true); @@ -2251,6 +2287,8 @@ arena_new(arena_t *arena, unsigned ind) arena_avail_tree_new(&arena->runs_avail_dirty); /* Initialize bins. */ + prev_run_size = PAGE_SIZE; + i = 0; #ifdef JEMALLOC_TINY /* (2^n)-spaced tiny bins. */ @@ -2260,6 +2298,11 @@ arena_new(arena_t *arena, unsigned ind) return (true); bin->runcur = NULL; arena_run_tree_new(&bin->runs); + + bin->reg_size = (1U << (LG_TINY_MIN + i)); + + prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); + #ifdef JEMALLOC_STATS memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); #endif @@ -2273,6 +2316,11 @@ arena_new(arena_t *arena, unsigned ind) return (true); bin->runcur = NULL; arena_run_tree_new(&bin->runs); + + bin->reg_size = (i - ntbins + 1) << LG_QUANTUM; + + prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); + #ifdef JEMALLOC_STATS memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); #endif @@ -2285,6 +2333,12 @@ arena_new(arena_t *arena, unsigned ind) return (true); bin->runcur = NULL; arena_run_tree_new(&bin->runs); + + bin->reg_size = cspace_min + ((i - (ntbins + nqbins)) << + LG_CACHELINE); + + prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); + #ifdef JEMALLOC_STATS memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); #endif @@ -2297,6 +2351,12 @@ arena_new(arena_t *arena, unsigned ind) return (true); bin->runcur = NULL; arena_run_tree_new(&bin->runs); + + bin->reg_size = sspace_min + ((i - (ntbins + nqbins + ncbins)) + << LG_SUBPAGE); + + prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); + #ifdef JEMALLOC_STATS memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); #endif @@ -2315,39 +2375,40 @@ small_size2bin_validate(void) { size_t i, size, binind; + assert(small_size2bin[0] == 0xffU); i = 1; # ifdef JEMALLOC_TINY /* Tiny. */ for (; i < (1U << LG_TINY_MIN); i++) { size = pow2_ceil(1U << LG_TINY_MIN); binind = ffs((int)(size >> (LG_TINY_MIN + 1))); - assert(SMALL_SIZE2BIN(i) == binind); + assert(small_size2bin[i] == binind); } for (; i < qspace_min; i++) { size = pow2_ceil(i); binind = ffs((int)(size >> (LG_TINY_MIN + 1))); - assert(SMALL_SIZE2BIN(i) == binind); + assert(small_size2bin[i] == binind); } # endif /* Quantum-spaced. */ for (; i <= qspace_max; i++) { size = QUANTUM_CEILING(i); binind = ntbins + (size >> LG_QUANTUM) - 1; - assert(SMALL_SIZE2BIN(i) == binind); + assert(small_size2bin[i] == binind); } /* Cacheline-spaced. */ for (; i <= cspace_max; i++) { size = CACHELINE_CEILING(i); binind = ntbins + nqbins + ((size - cspace_min) >> LG_CACHELINE); - assert(SMALL_SIZE2BIN(i) == binind); + assert(small_size2bin[i] == binind); } /* Sub-page. */ for (; i <= sspace_max; i++) { size = SUBPAGE_CEILING(i); binind = ntbins + nqbins + ncbins + ((size - sspace_min) >> LG_SUBPAGE); - assert(SMALL_SIZE2BIN(i) == binind); + assert(small_size2bin[i] == binind); } } #endif @@ -2358,12 +2419,12 @@ small_size2bin_init(void) if (opt_lg_qspace_max != LG_QSPACE_MAX_DEFAULT || opt_lg_cspace_max != LG_CSPACE_MAX_DEFAULT - || (sizeof(const_small_size2bin) != ((small_maxclass-1) >> - LG_TINY_MIN) + 1)) + || sizeof(const_small_size2bin) != small_maxclass + 1) return (small_size2bin_init_hard()); small_size2bin = const_small_size2bin; #ifdef JEMALLOC_DEBUG + assert(sizeof(const_small_size2bin) == small_maxclass + 1); small_size2bin_validate(); #endif return (false); @@ -2374,52 +2435,49 @@ small_size2bin_init_hard(void) { size_t i, size, binind; uint8_t *custom_small_size2bin; -#define CUSTOM_SMALL_SIZE2BIN(s) \ - custom_small_size2bin[(s-1) >> LG_TINY_MIN] assert(opt_lg_qspace_max != LG_QSPACE_MAX_DEFAULT || opt_lg_cspace_max != LG_CSPACE_MAX_DEFAULT - || (sizeof(const_small_size2bin) != ((small_maxclass-1) >> - LG_TINY_MIN) + 1)); + || sizeof(const_small_size2bin) != small_maxclass + 1); - custom_small_size2bin = (uint8_t *) - base_alloc(small_maxclass >> LG_TINY_MIN); + custom_small_size2bin = (uint8_t *)base_alloc(small_maxclass + 1); if (custom_small_size2bin == NULL) return (true); + custom_small_size2bin[0] = 0xffU; i = 1; #ifdef JEMALLOC_TINY /* Tiny. */ - for (; i < (1U << LG_TINY_MIN); i += TINY_MIN) { + for (; i < (1U << LG_TINY_MIN); i++) { size = pow2_ceil(1U << LG_TINY_MIN); binind = ffs((int)(size >> (LG_TINY_MIN + 1))); - CUSTOM_SMALL_SIZE2BIN(i) = binind; + custom_small_size2bin[i] = binind; } - for (; i < qspace_min; i += TINY_MIN) { + for (; i < qspace_min; i++) { size = pow2_ceil(i); binind = ffs((int)(size >> (LG_TINY_MIN + 1))); - CUSTOM_SMALL_SIZE2BIN(i) = binind; + custom_small_size2bin[i] = binind; } #endif /* Quantum-spaced. */ - for (; i <= qspace_max; i += TINY_MIN) { + for (; i <= qspace_max; i++) { size = QUANTUM_CEILING(i); binind = ntbins + (size >> LG_QUANTUM) - 1; - CUSTOM_SMALL_SIZE2BIN(i) = binind; + custom_small_size2bin[i] = binind; } /* Cacheline-spaced. */ - for (; i <= cspace_max; i += TINY_MIN) { + for (; i <= cspace_max; i++) { size = CACHELINE_CEILING(i); binind = ntbins + nqbins + ((size - cspace_min) >> LG_CACHELINE); - CUSTOM_SMALL_SIZE2BIN(i) = binind; + custom_small_size2bin[i] = binind; } /* Sub-page. */ - for (; i <= sspace_max; i += TINY_MIN) { + for (; i <= sspace_max; i++) { size = SUBPAGE_CEILING(i); binind = ntbins + nqbins + ncbins + ((size - sspace_min) >> LG_SUBPAGE); - CUSTOM_SMALL_SIZE2BIN(i) = binind; + custom_small_size2bin[i] = binind; } small_size2bin = custom_small_size2bin; @@ -2427,190 +2485,6 @@ small_size2bin_init_hard(void) small_size2bin_validate(); #endif return (false); -#undef CUSTOM_SMALL_SIZE2BIN -} - -/* - * Calculate bin_info->run_size such that it meets the following constraints: - * - * *) bin_info->run_size >= min_run_size - * *) bin_info->run_size <= arena_maxclass - * *) run header overhead <= RUN_MAX_OVRHD (or header overhead relaxed). - * *) bin_info->nregs <= RUN_MAXREGS - * - * bin_info->nregs, bin_info->bitmap_offset, and bin_info->reg0_offset are also - * calculated here, since these settings are all interdependent. - */ -static size_t -bin_info_run_size_calc(arena_bin_info_t *bin_info, size_t min_run_size) -{ - size_t try_run_size, good_run_size; - uint32_t try_nregs, good_nregs; - uint32_t try_hdr_size, good_hdr_size; - uint32_t try_bitmap_offset, good_bitmap_offset; -#ifdef JEMALLOC_PROF - uint32_t try_ctx0_offset, good_ctx0_offset; -#endif - uint32_t try_reg0_offset, good_reg0_offset; - - assert(min_run_size >= PAGE_SIZE); - assert(min_run_size <= arena_maxclass); - - /* - * Calculate known-valid settings before entering the run_size - * expansion loop, so that the first part of the loop always copies - * valid settings. - * - * The do..while loop iteratively reduces the number of regions until - * the run header and the regions no longer overlap. A closed formula - * would be quite messy, since there is an interdependency between the - * header's mask length and the number of regions. - */ - try_run_size = min_run_size; - try_nregs = ((try_run_size - sizeof(arena_run_t)) / bin_info->reg_size) - + 1; /* Counter-act try_nregs-- in loop. */ - if (try_nregs > RUN_MAXREGS) { - try_nregs = RUN_MAXREGS - + 1; /* Counter-act try_nregs-- in loop. */ - } - do { - try_nregs--; - try_hdr_size = sizeof(arena_run_t); - /* Pad to a long boundary. */ - try_hdr_size = LONG_CEILING(try_hdr_size); - try_bitmap_offset = try_hdr_size; - /* Add space for bitmap. */ - try_hdr_size += bitmap_size(try_nregs); -#ifdef JEMALLOC_PROF - if (opt_prof && prof_promote == false) { - /* Pad to a quantum boundary. */ - try_hdr_size = QUANTUM_CEILING(try_hdr_size); - try_ctx0_offset = try_hdr_size; - /* Add space for one (prof_ctx_t *) per region. */ - try_hdr_size += try_nregs * sizeof(prof_ctx_t *); - } else - try_ctx0_offset = 0; -#endif - try_reg0_offset = try_run_size - (try_nregs * - bin_info->reg_size); - } while (try_hdr_size > try_reg0_offset); - - /* run_size expansion loop. */ - do { - /* - * Copy valid settings before trying more aggressive settings. - */ - good_run_size = try_run_size; - good_nregs = try_nregs; - good_hdr_size = try_hdr_size; - good_bitmap_offset = try_bitmap_offset; -#ifdef JEMALLOC_PROF - good_ctx0_offset = try_ctx0_offset; -#endif - good_reg0_offset = try_reg0_offset; - - /* Try more aggressive settings. */ - try_run_size += PAGE_SIZE; - try_nregs = ((try_run_size - sizeof(arena_run_t)) / - bin_info->reg_size) - + 1; /* Counter-act try_nregs-- in loop. */ - if (try_nregs > RUN_MAXREGS) { - try_nregs = RUN_MAXREGS - + 1; /* Counter-act try_nregs-- in loop. */ - } - do { - try_nregs--; - try_hdr_size = sizeof(arena_run_t); - /* Pad to a long boundary. */ - try_hdr_size = LONG_CEILING(try_hdr_size); - try_bitmap_offset = try_hdr_size; - /* Add space for bitmap. */ - try_hdr_size += bitmap_size(try_nregs); -#ifdef JEMALLOC_PROF - if (opt_prof && prof_promote == false) { - /* Pad to a quantum boundary. */ - try_hdr_size = QUANTUM_CEILING(try_hdr_size); - try_ctx0_offset = try_hdr_size; - /* - * Add space for one (prof_ctx_t *) per region. - */ - try_hdr_size += try_nregs * - sizeof(prof_ctx_t *); - } -#endif - try_reg0_offset = try_run_size - (try_nregs * - bin_info->reg_size); - } while (try_hdr_size > try_reg0_offset); - } while (try_run_size <= arena_maxclass - && try_run_size <= arena_maxclass - && RUN_MAX_OVRHD * (bin_info->reg_size << 3) > RUN_MAX_OVRHD_RELAX - && (try_reg0_offset << RUN_BFP) > RUN_MAX_OVRHD * try_run_size - && try_nregs < RUN_MAXREGS); - - assert(good_hdr_size <= good_reg0_offset); - - /* Copy final settings. */ - bin_info->run_size = good_run_size; - bin_info->nregs = good_nregs; - bin_info->bitmap_offset = good_bitmap_offset; -#ifdef JEMALLOC_PROF - bin_info->ctx0_offset = good_ctx0_offset; -#endif - bin_info->reg0_offset = good_reg0_offset; - - return (good_run_size); -} - -static bool -bin_info_init(void) -{ - arena_bin_info_t *bin_info; - unsigned i; - size_t prev_run_size; - - arena_bin_info = base_alloc(sizeof(arena_bin_info_t) * nbins); - if (arena_bin_info == NULL) - return (true); - - prev_run_size = PAGE_SIZE; - i = 0; -#ifdef JEMALLOC_TINY - /* (2^n)-spaced tiny bins. */ - for (; i < ntbins; i++) { - bin_info = &arena_bin_info[i]; - bin_info->reg_size = (1U << (LG_TINY_MIN + i)); - prev_run_size = bin_info_run_size_calc(bin_info, prev_run_size); - bitmap_info_init(&bin_info->bitmap_info, bin_info->nregs); - } -#endif - - /* Quantum-spaced bins. */ - for (; i < ntbins + nqbins; i++) { - bin_info = &arena_bin_info[i]; - bin_info->reg_size = (i - ntbins + 1) << LG_QUANTUM; - prev_run_size = bin_info_run_size_calc(bin_info, prev_run_size); - bitmap_info_init(&bin_info->bitmap_info, bin_info->nregs); - } - - /* Cacheline-spaced bins. */ - for (; i < ntbins + nqbins + ncbins; i++) { - bin_info = &arena_bin_info[i]; - bin_info->reg_size = cspace_min + ((i - (ntbins + nqbins)) << - LG_CACHELINE); - prev_run_size = bin_info_run_size_calc(bin_info, prev_run_size); - bitmap_info_init(&bin_info->bitmap_info, bin_info->nregs); - } - - /* Subpage-spaced bins. */ - for (; i < nbins; i++) { - bin_info = &arena_bin_info[i]; - bin_info->reg_size = sspace_min + ((i - (ntbins + nqbins + - ncbins)) << LG_SUBPAGE); - prev_run_size = bin_info_run_size_calc(bin_info, prev_run_size); - bitmap_info_init(&bin_info->bitmap_info, bin_info->nregs); - } - - return (false); } bool @@ -2671,6 +2545,9 @@ arena_boot(void) abort(); } + if (small_size2bin_init()) + return (true); + /* * Compute the header size such that it is large enough to contain the * page map. The page map is biased to omit entries for the header @@ -2694,11 +2571,5 @@ arena_boot(void) arena_maxclass = chunksize - (map_bias << PAGE_SHIFT); - if (small_size2bin_init()) - return (true); - - if (bin_info_init()) - return (true); - return (false); } diff --git a/dep/jemalloc/src/atomic.c b/dep/jemalloc/src/atomic.c deleted file mode 100644 index 77ee313113b..00000000000 --- a/dep/jemalloc/src/atomic.c +++ /dev/null @@ -1,2 +0,0 @@ -#define JEMALLOC_ATOMIC_C_ -#include "jemalloc/internal/jemalloc_internal.h" diff --git a/dep/jemalloc/src/bitmap.c b/dep/jemalloc/src/bitmap.c deleted file mode 100644 index b47e2629093..00000000000 --- a/dep/jemalloc/src/bitmap.c +++ /dev/null @@ -1,90 +0,0 @@ -#define JEMALLOC_BITMAP_C_ -#include "jemalloc/internal/jemalloc_internal.h" - -/******************************************************************************/ -/* Function prototypes for non-inline static functions. */ - -static size_t bits2groups(size_t nbits); - -/******************************************************************************/ - -static size_t -bits2groups(size_t nbits) -{ - - return ((nbits >> LG_BITMAP_GROUP_NBITS) + - !!(nbits & BITMAP_GROUP_NBITS_MASK)); -} - -void -bitmap_info_init(bitmap_info_t *binfo, size_t nbits) -{ - unsigned i; - size_t group_count; - - assert(nbits > 0); - assert(nbits <= (ZU(1) << LG_BITMAP_MAXBITS)); - - /* - * Compute the number of groups necessary to store nbits bits, and - * progressively work upward through the levels until reaching a level - * that requires only one group. - */ - binfo->levels[0].group_offset = 0; - group_count = bits2groups(nbits); - for (i = 1; group_count > 1; i++) { - assert(i < BITMAP_MAX_LEVELS); - binfo->levels[i].group_offset = binfo->levels[i-1].group_offset - + group_count; - group_count = bits2groups(group_count); - } - binfo->levels[i].group_offset = binfo->levels[i-1].group_offset - + group_count; - binfo->nlevels = i; - binfo->nbits = nbits; -} - -size_t -bitmap_info_ngroups(const bitmap_info_t *binfo) -{ - - return (binfo->levels[binfo->nlevels].group_offset << LG_SIZEOF_BITMAP); -} - -size_t -bitmap_size(size_t nbits) -{ - bitmap_info_t binfo; - - bitmap_info_init(&binfo, nbits); - return (bitmap_info_ngroups(&binfo)); -} - -void -bitmap_init(bitmap_t *bitmap, const bitmap_info_t *binfo) -{ - size_t extra; - unsigned i; - - /* - * Bits are actually inverted with regard to the external bitmap - * interface, so the bitmap starts out with all 1 bits, except for - * trailing unused bits (if any). Note that each group uses bit 0 to - * correspond to the first logical bit in the group, so extra bits - * are the most significant bits of the last group. - */ - memset(bitmap, 0xffU, binfo->levels[binfo->nlevels].group_offset << - LG_SIZEOF_BITMAP); - extra = (BITMAP_GROUP_NBITS - (binfo->nbits & BITMAP_GROUP_NBITS_MASK)) - & BITMAP_GROUP_NBITS_MASK; - if (extra != 0) - bitmap[binfo->levels[1].group_offset - 1] >>= extra; - for (i = 1; i < binfo->nlevels; i++) { - size_t group_count = binfo->levels[i].group_offset - - binfo->levels[i-1].group_offset; - extra = (BITMAP_GROUP_NBITS - (group_count & - BITMAP_GROUP_NBITS_MASK)) & BITMAP_GROUP_NBITS_MASK; - if (extra != 0) - bitmap[binfo->levels[i+1].group_offset - 1] >>= extra; - } -} diff --git a/dep/jemalloc/src/chunk.c b/dep/jemalloc/src/chunk.c index d190c6f49b3..301519e8042 100644 --- a/dep/jemalloc/src/chunk.c +++ b/dep/jemalloc/src/chunk.c @@ -70,7 +70,7 @@ RETURN: #ifdef JEMALLOC_IVSALLOC if (base == false && ret != NULL) { if (rtree_set(chunks_rtree, (uintptr_t)ret, ret)) { - chunk_dealloc(ret, size, true); + chunk_dealloc(ret, size); return (NULL); } } @@ -108,7 +108,7 @@ RETURN: } void -chunk_dealloc(void *chunk, size_t size, bool unmap) +chunk_dealloc(void *chunk, size_t size) { assert(chunk != NULL); @@ -125,17 +125,15 @@ chunk_dealloc(void *chunk, size_t size, bool unmap) malloc_mutex_unlock(&chunks_mtx); #endif - if (unmap) { #ifdef JEMALLOC_SWAP - if (swap_enabled && chunk_dealloc_swap(chunk, size) == false) - return; + if (swap_enabled && chunk_dealloc_swap(chunk, size) == false) + return; #endif #ifdef JEMALLOC_DSS - if (chunk_dealloc_dss(chunk, size) == false) - return; + if (chunk_dealloc_dss(chunk, size) == false) + return; #endif - chunk_dealloc_mmap(chunk, size); - } + chunk_dealloc_mmap(chunk, size); } bool diff --git a/dep/jemalloc/src/chunk_mmap.c b/dep/jemalloc/src/chunk_mmap.c index 164e86e7b38..bc367559774 100644 --- a/dep/jemalloc/src/chunk_mmap.c +++ b/dep/jemalloc/src/chunk_mmap.c @@ -206,15 +206,13 @@ chunk_alloc_mmap_internal(size_t size, bool noreserve) void * chunk_alloc_mmap(size_t size) { - - return (chunk_alloc_mmap_internal(size, false)); + return chunk_alloc_mmap_internal(size, false); } void * chunk_alloc_mmap_noreserve(size_t size) { - - return (chunk_alloc_mmap_internal(size, true)); + return chunk_alloc_mmap_internal(size, true); } void diff --git a/dep/jemalloc/src/ckh.c b/dep/jemalloc/src/ckh.c index 43fcc25239d..682a8db65bf 100644 --- a/dep/jemalloc/src/ckh.c +++ b/dep/jemalloc/src/ckh.c @@ -34,7 +34,7 @@ * respectively. * ******************************************************************************/ -#define JEMALLOC_CKH_C_ +#define CKH_C_ #include "jemalloc/internal/jemalloc_internal.h" /******************************************************************************/ @@ -73,7 +73,7 @@ ckh_isearch(ckh_t *ckh, const void *key) size_t hash1, hash2, bucket, cell; assert(ckh != NULL); - dassert(ckh->magic == CKH_MAGIC); + assert(ckh->magic = CKH_MAGIG); ckh->hash(key, ckh->lg_curbuckets, &hash1, &hash2); @@ -262,15 +262,9 @@ ckh_grow(ckh_t *ckh) lg_prevbuckets = ckh->lg_curbuckets; lg_curcells = ckh->lg_curbuckets + LG_CKH_BUCKET_CELLS; while (true) { - size_t usize; - lg_curcells++; - usize = sa2u(sizeof(ckhc_t) << lg_curcells, CACHELINE, NULL); - if (usize == 0) { - ret = true; - goto RETURN; - } - tab = (ckhc_t *)ipalloc(usize, CACHELINE, true); + tab = (ckhc_t *)ipalloc(sizeof(ckhc_t) << lg_curcells, + ZU(1) << LG_CACHELINE, true); if (tab == NULL) { ret = true; goto RETURN; @@ -301,7 +295,7 @@ static void ckh_shrink(ckh_t *ckh) { ckhc_t *tab, *ttab; - size_t lg_curcells, usize; + size_t lg_curcells; unsigned lg_prevbuckets; /* @@ -310,10 +304,8 @@ ckh_shrink(ckh_t *ckh) */ lg_prevbuckets = ckh->lg_curbuckets; lg_curcells = ckh->lg_curbuckets + LG_CKH_BUCKET_CELLS - 1; - usize = sa2u(sizeof(ckhc_t) << lg_curcells, CACHELINE, NULL); - if (usize == 0) - return; - tab = (ckhc_t *)ipalloc(usize, CACHELINE, true); + tab = (ckhc_t *)ipalloc(sizeof(ckhc_t) << lg_curcells, + ZU(1) << LG_CACHELINE, true); if (tab == NULL) { /* * An OOM error isn't worth propagating, since it doesn't @@ -348,7 +340,7 @@ bool ckh_new(ckh_t *ckh, size_t minitems, ckh_hash_t *hash, ckh_keycomp_t *keycomp) { bool ret; - size_t mincells, usize; + size_t mincells; unsigned lg_mincells; assert(minitems > 0); @@ -383,19 +375,15 @@ ckh_new(ckh_t *ckh, size_t minitems, ckh_hash_t *hash, ckh_keycomp_t *keycomp) ckh->hash = hash; ckh->keycomp = keycomp; - usize = sa2u(sizeof(ckhc_t) << lg_mincells, CACHELINE, NULL); - if (usize == 0) { - ret = true; - goto RETURN; - } - ckh->tab = (ckhc_t *)ipalloc(usize, CACHELINE, true); + ckh->tab = (ckhc_t *)ipalloc(sizeof(ckhc_t) << lg_mincells, + (ZU(1) << LG_CACHELINE), true); if (ckh->tab == NULL) { ret = true; goto RETURN; } #ifdef JEMALLOC_DEBUG - ckh->magic = CKH_MAGIC; + ckh->magic = CKH_MAGIG; #endif ret = false; @@ -408,7 +396,7 @@ ckh_delete(ckh_t *ckh) { assert(ckh != NULL); - dassert(ckh->magic == CKH_MAGIC); + assert(ckh->magic = CKH_MAGIG); #ifdef CKH_VERBOSE malloc_printf( @@ -433,7 +421,7 @@ ckh_count(ckh_t *ckh) { assert(ckh != NULL); - dassert(ckh->magic == CKH_MAGIC); + assert(ckh->magic = CKH_MAGIG); return (ckh->count); } @@ -464,7 +452,7 @@ ckh_insert(ckh_t *ckh, const void *key, const void *data) bool ret; assert(ckh != NULL); - dassert(ckh->magic == CKH_MAGIC); + assert(ckh->magic = CKH_MAGIG); assert(ckh_search(ckh, key, NULL, NULL)); #ifdef CKH_COUNT @@ -489,7 +477,7 @@ ckh_remove(ckh_t *ckh, const void *searchkey, void **key, void **data) size_t cell; assert(ckh != NULL); - dassert(ckh->magic == CKH_MAGIC); + assert(ckh->magic = CKH_MAGIG); cell = ckh_isearch(ckh, searchkey); if (cell != SIZE_T_MAX) { @@ -521,7 +509,7 @@ ckh_search(ckh_t *ckh, const void *searchkey, void **key, void **data) size_t cell; assert(ckh != NULL); - dassert(ckh->magic == CKH_MAGIC); + assert(ckh->magic = CKH_MAGIG); cell = ckh_isearch(ckh, searchkey); if (cell != SIZE_T_MAX) { @@ -556,7 +544,7 @@ ckh_string_hash(const void *key, unsigned minbits, size_t *hash1, size_t *hash2) } else { ret1 = h; ret2 = hash(key, strlen((const char *)key), - 0x8432a476666bbc13LLU); + 0x8432a476666bbc13U); } *hash1 = ret1; diff --git a/dep/jemalloc/src/ctl.c b/dep/jemalloc/src/ctl.c index e5336d36949..3c8adab90a3 100644 --- a/dep/jemalloc/src/ctl.c +++ b/dep/jemalloc/src/ctl.c @@ -182,7 +182,6 @@ CTL_PROTO(stats_arenas_i_lruns_j_highruns) CTL_PROTO(stats_arenas_i_lruns_j_curruns) INDEX_PROTO(stats_arenas_i_lruns_j) #endif -CTL_PROTO(stats_arenas_i_nthreads) CTL_PROTO(stats_arenas_i_pactive) CTL_PROTO(stats_arenas_i_pdirty) #ifdef JEMALLOC_STATS @@ -193,7 +192,6 @@ CTL_PROTO(stats_arenas_i_purged) #endif INDEX_PROTO(stats_arenas_i) #ifdef JEMALLOC_STATS -CTL_PROTO(stats_cactive) CTL_PROTO(stats_allocated) CTL_PROTO(stats_active) CTL_PROTO(stats_mapped) @@ -436,7 +434,6 @@ static const ctl_node_t stats_arenas_i_lruns_node[] = { #endif static const ctl_node_t stats_arenas_i_node[] = { - {NAME("nthreads"), CTL(stats_arenas_i_nthreads)}, {NAME("pactive"), CTL(stats_arenas_i_pactive)}, {NAME("pdirty"), CTL(stats_arenas_i_pdirty)} #ifdef JEMALLOC_STATS @@ -461,7 +458,6 @@ static const ctl_node_t stats_arenas_node[] = { static const ctl_node_t stats_node[] = { #ifdef JEMALLOC_STATS - {NAME("cactive"), CTL(stats_cactive)}, {NAME("allocated"), CTL(stats_allocated)}, {NAME("active"), CTL(stats_active)}, {NAME("mapped"), CTL(stats_mapped)}, @@ -624,7 +620,6 @@ ctl_arena_refresh(arena_t *arena, unsigned i) ctl_arena_clear(astats); - sstats->nthreads += astats->nthreads; #ifdef JEMALLOC_STATS ctl_arena_stats_amerge(astats, arena); /* Merge into sum stats as well. */ @@ -662,17 +657,10 @@ ctl_refresh(void) * Clear sum stats, since they will be merged into by * ctl_arena_refresh(). */ - ctl_stats.arenas[narenas].nthreads = 0; ctl_arena_clear(&ctl_stats.arenas[narenas]); malloc_mutex_lock(&arenas_lock); memcpy(tarenas, arenas, sizeof(arena_t *) * narenas); - for (i = 0; i < narenas; i++) { - if (arenas[i] != NULL) - ctl_stats.arenas[i].nthreads = arenas[i]->nthreads; - else - ctl_stats.arenas[i].nthreads = 0; - } malloc_mutex_unlock(&arenas_lock); for (i = 0; i < narenas; i++) { bool initialized = (tarenas[i] != NULL); @@ -1126,8 +1114,8 @@ thread_arena_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, unsigned newind, oldind; newind = oldind = choose_arena()->ind; - WRITE(newind, unsigned); - READ(oldind, unsigned); + WRITE(oldind, unsigned); + READ(newind, unsigned); if (newind != oldind) { arena_t *arena; @@ -1141,8 +1129,6 @@ thread_arena_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, malloc_mutex_lock(&arenas_lock); if ((arena = arenas[newind]) == NULL) arena = arenas_extend(newind); - arenas[oldind]->nthreads--; - arenas[newind]->nthreads++; malloc_mutex_unlock(&arenas_lock); if (arena == NULL) { ret = EAGAIN; @@ -1151,13 +1137,6 @@ thread_arena_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, /* Set new arena association. */ ARENA_SET(arena); -#ifdef JEMALLOC_TCACHE - { - tcache_t *tcache = TCACHE_GET(); - if (tcache != NULL) - tcache->arena = arena; - } -#endif } ret = 0; @@ -1167,9 +1146,9 @@ RETURN: #ifdef JEMALLOC_STATS CTL_RO_NL_GEN(thread_allocated, ALLOCATED_GET(), uint64_t); -CTL_RO_NL_GEN(thread_allocatedp, ALLOCATEDP_GET(), uint64_t *); +CTL_RO_NL_GEN(thread_allocatedp, &ALLOCATED_GET(), uint64_t *); CTL_RO_NL_GEN(thread_deallocated, DEALLOCATED_GET(), uint64_t); -CTL_RO_NL_GEN(thread_deallocatedp, DEALLOCATEDP_GET(), uint64_t *); +CTL_RO_NL_GEN(thread_deallocatedp, &DEALLOCATED_GET(), uint64_t *); #endif /******************************************************************************/ @@ -1305,9 +1284,9 @@ CTL_RO_NL_GEN(opt_overcommit, opt_overcommit, bool) /******************************************************************************/ -CTL_RO_NL_GEN(arenas_bin_i_size, arena_bin_info[mib[2]].reg_size, size_t) -CTL_RO_NL_GEN(arenas_bin_i_nregs, arena_bin_info[mib[2]].nregs, uint32_t) -CTL_RO_NL_GEN(arenas_bin_i_run_size, arena_bin_info[mib[2]].run_size, size_t) +CTL_RO_NL_GEN(arenas_bin_i_size, arenas[0]->bins[mib[2]].reg_size, size_t) +CTL_RO_NL_GEN(arenas_bin_i_nregs, arenas[0]->bins[mib[2]].nregs, uint32_t) +CTL_RO_NL_GEN(arenas_bin_i_run_size, arenas[0]->bins[mib[2]].run_size, size_t) const ctl_node_t * arenas_bin_i_index(const size_t *mib, size_t miblen, size_t i) { @@ -1552,7 +1531,6 @@ stats_arenas_i_lruns_j_index(const size_t *mib, size_t miblen, size_t j) } #endif -CTL_RO_GEN(stats_arenas_i_nthreads, ctl_stats.arenas[mib[2]].nthreads, unsigned) CTL_RO_GEN(stats_arenas_i_pactive, ctl_stats.arenas[mib[2]].pactive, size_t) CTL_RO_GEN(stats_arenas_i_pdirty, ctl_stats.arenas[mib[2]].pdirty, size_t) #ifdef JEMALLOC_STATS @@ -1584,7 +1562,6 @@ RETURN: } #ifdef JEMALLOC_STATS -CTL_RO_GEN(stats_cactive, &stats_cactive, size_t *) CTL_RO_GEN(stats_allocated, ctl_stats.allocated, size_t) CTL_RO_GEN(stats_active, ctl_stats.active, size_t) CTL_RO_GEN(stats_mapped, ctl_stats.mapped, size_t) diff --git a/dep/jemalloc/src/hash.c b/dep/jemalloc/src/hash.c index cfa4da0275c..6a13d7a03c0 100644 --- a/dep/jemalloc/src/hash.c +++ b/dep/jemalloc/src/hash.c @@ -1,2 +1,2 @@ -#define JEMALLOC_HASH_C_ +#define HASH_C_ #include "jemalloc/internal/jemalloc_internal.h" diff --git a/dep/jemalloc/src/huge.c b/dep/jemalloc/src/huge.c index a4f9b054ed5..0aadc4339a9 100644 --- a/dep/jemalloc/src/huge.c +++ b/dep/jemalloc/src/huge.c @@ -50,7 +50,6 @@ huge_malloc(size_t size, bool zero) malloc_mutex_lock(&huge_mtx); extent_tree_ad_insert(&huge, node); #ifdef JEMALLOC_STATS - stats_cactive_add(csize); huge_nmalloc++; huge_allocated += csize; #endif @@ -84,7 +83,7 @@ huge_palloc(size_t size, size_t alignment, bool zero) * alignment, in order to assure the alignment can be achieved, then * unmap leading and trailing chunks. */ - assert(alignment > chunksize); + assert(alignment >= chunksize); chunk_size = CHUNK_CEILING(size); @@ -110,12 +109,12 @@ huge_palloc(size_t size, size_t alignment, bool zero) if (offset == 0) { /* Trim trailing space. */ chunk_dealloc((void *)((uintptr_t)ret + chunk_size), alloc_size - - chunk_size, true); + - chunk_size); } else { size_t trailsize; /* Trim leading space. */ - chunk_dealloc(ret, alignment - offset, true); + chunk_dealloc(ret, alignment - offset); ret = (void *)((uintptr_t)ret + (alignment - offset)); @@ -124,7 +123,7 @@ huge_palloc(size_t size, size_t alignment, bool zero) /* Trim trailing space. */ assert(trailsize < alloc_size); chunk_dealloc((void *)((uintptr_t)ret + chunk_size), - trailsize, true); + trailsize); } } @@ -135,7 +134,6 @@ huge_palloc(size_t size, size_t alignment, bool zero) malloc_mutex_lock(&huge_mtx); extent_tree_ad_insert(&huge, node); #ifdef JEMALLOC_STATS - stats_cactive_add(chunk_size); huge_nmalloc++; huge_allocated += chunk_size; #endif @@ -194,7 +192,7 @@ huge_ralloc(void *ptr, size_t oldsize, size_t size, size_t extra, * different size class. In that case, fall back to allocating new * space and copying. */ - if (alignment > chunksize) + if (alignment != 0) ret = huge_palloc(size + extra, alignment, zero); else ret = huge_malloc(size + extra, zero); @@ -203,7 +201,7 @@ huge_ralloc(void *ptr, size_t oldsize, size_t size, size_t extra, if (extra == 0) return (NULL); /* Try again, this time without extra. */ - if (alignment > chunksize) + if (alignment != 0) ret = huge_palloc(size, alignment, zero); else ret = huge_malloc(size, zero); @@ -234,13 +232,6 @@ huge_ralloc(void *ptr, size_t oldsize, size_t size, size_t extra, ) { size_t newsize = huge_salloc(ret); - /* - * Remove ptr from the tree of huge allocations before - * performing the remap operation, in order to avoid the - * possibility of another thread acquiring that mapping before - * this one removes it from the tree. - */ - huge_dalloc(ptr, false); if (mremap(ptr, oldsize, newsize, MREMAP_MAYMOVE|MREMAP_FIXED, ret) == MAP_FAILED) { /* @@ -260,8 +251,9 @@ huge_ralloc(void *ptr, size_t oldsize, size_t size, size_t extra, if (opt_abort) abort(); memcpy(ret, ptr, copysize); - chunk_dealloc_mmap(ptr, oldsize); - } + idalloc(ptr); + } else + huge_dalloc(ptr, false); } else #endif { @@ -286,7 +278,6 @@ huge_dalloc(void *ptr, bool unmap) extent_tree_ad_remove(&huge, node); #ifdef JEMALLOC_STATS - stats_cactive_sub(node->size); huge_ndalloc++; huge_allocated -= node->size; #endif @@ -301,10 +292,9 @@ huge_dalloc(void *ptr, bool unmap) memset(node->addr, 0x5a, node->size); #endif #endif + chunk_dealloc(node->addr, node->size); } - chunk_dealloc(node->addr, node->size, unmap); - base_node_dealloc(node); } diff --git a/dep/jemalloc/src/jemalloc.c b/dep/jemalloc/src/jemalloc.c index a161c2e26e1..2aebc51dd19 100644 --- a/dep/jemalloc/src/jemalloc.c +++ b/dep/jemalloc/src/jemalloc.c @@ -7,10 +7,12 @@ malloc_mutex_t arenas_lock; arena_t **arenas; unsigned narenas; +static unsigned next_arena; -pthread_key_t arenas_tsd; #ifndef NO_TLS __thread arena_t *arenas_tls JEMALLOC_ATTR(tls_model("initial-exec")); +#else +pthread_key_t arenas_tsd; #endif #ifdef JEMALLOC_STATS @@ -28,13 +30,7 @@ static bool malloc_initialized = false; static pthread_t malloc_initializer = (unsigned long)0; /* Used to avoid initialization races. */ -static malloc_mutex_t init_lock = -#ifdef JEMALLOC_OSSPIN - 0 -#else - MALLOC_MUTEX_INITIALIZER -#endif - ; +static malloc_mutex_t init_lock = MALLOC_MUTEX_INITIALIZER; #ifdef DYNAMIC_PAGE_SHIFT size_t pagesize; @@ -74,7 +70,6 @@ size_t opt_narenas = 0; static void wrtmessage(void *cbopaque, const char *s); static void stats_print_atexit(void); static unsigned malloc_ncpus(void); -static void arenas_cleanup(void *arg); #if (defined(JEMALLOC_STATS) && defined(NO_TLS)) static void thread_allocated_cleanup(void *arg); #endif @@ -84,7 +79,6 @@ static void malloc_conf_error(const char *msg, const char *k, size_t klen, const char *v, size_t vlen); static void malloc_conf_init(void); static bool malloc_init_hard(void); -static int imemalign(void **memptr, size_t alignment, size_t size); /******************************************************************************/ /* malloc_message() setup. */ @@ -153,53 +147,13 @@ choose_arena_hard(void) arena_t *ret; if (narenas > 1) { - unsigned i, choose, first_null; - - choose = 0; - first_null = narenas; malloc_mutex_lock(&arenas_lock); - assert(arenas[0] != NULL); - for (i = 1; i < narenas; i++) { - if (arenas[i] != NULL) { - /* - * Choose the first arena that has the lowest - * number of threads assigned to it. - */ - if (arenas[i]->nthreads < - arenas[choose]->nthreads) - choose = i; - } else if (first_null == narenas) { - /* - * Record the index of the first uninitialized - * arena, in case all extant arenas are in use. - * - * NB: It is possible for there to be - * discontinuities in terms of initialized - * versus uninitialized arenas, due to the - * "thread.arena" mallctl. - */ - first_null = i; - } - } - - if (arenas[choose] == 0 || first_null == narenas) { - /* - * Use an unloaded arena, or the least loaded arena if - * all arenas are already initialized. - */ - ret = arenas[choose]; - } else { - /* Initialize a new arena. */ - ret = arenas_extend(first_null); - } - ret->nthreads++; + if ((ret = arenas[next_arena]) == NULL) + ret = arenas_extend(next_arena); + next_arena = (next_arena + 1) % narenas; malloc_mutex_unlock(&arenas_lock); - } else { + } else ret = arenas[0]; - malloc_mutex_lock(&arenas_lock); - ret->nthreads++; - malloc_mutex_unlock(&arenas_lock); - } ARENA_SET(ret); @@ -259,28 +213,6 @@ stats_print_atexit(void) JEMALLOC_P(malloc_stats_print)(NULL, NULL, NULL); } -#if (defined(JEMALLOC_STATS) && defined(NO_TLS)) -thread_allocated_t * -thread_allocated_get_hard(void) -{ - thread_allocated_t *thread_allocated = (thread_allocated_t *) - imalloc(sizeof(thread_allocated_t)); - if (thread_allocated == NULL) { - static thread_allocated_t static_thread_allocated = {0, 0}; - malloc_write("<jemalloc>: Error allocating TSD;" - " mallctl(\"thread.{de,}allocated[p]\", ...)" - " will be inaccurate\n"); - if (opt_abort) - abort(); - return (&static_thread_allocated); - } - pthread_setspecific(thread_allocated_tsd, thread_allocated); - thread_allocated->allocated = 0; - thread_allocated->deallocated = 0; - return (thread_allocated); -} -#endif - /* * End miscellaneous support functions. */ @@ -305,16 +237,6 @@ malloc_ncpus(void) return (ret); } -static void -arenas_cleanup(void *arg) -{ - arena_t *arena = (arena_t *)arg; - - malloc_mutex_lock(&arenas_lock); - arena->nthreads--; - malloc_mutex_unlock(&arenas_lock); -} - #if (defined(JEMALLOC_STATS) && defined(NO_TLS)) static void thread_allocated_cleanup(void *arg) @@ -499,8 +421,8 @@ malloc_conf_init(void) if ((opts = getenv(envname)) != NULL) { /* * Do nothing; opts is already initialized to - * the value of the MALLOC_CONF environment - * variable. + * the value of the JEMALLOC_OPTIONS + * environment variable. */ } else { /* No configuration specified. */ @@ -689,7 +611,7 @@ malloc_init_hard(void) result = sysconf(_SC_PAGESIZE); assert(result != -1); - pagesize = (size_t)result; + pagesize = (unsigned)result; /* * We assume that pagesize is a power of 2 when calculating @@ -749,10 +671,7 @@ malloc_init_hard(void) } #ifdef JEMALLOC_TCACHE - if (tcache_boot()) { - malloc_mutex_unlock(&init_lock); - return (true); - } + tcache_boot(); #endif if (huge_boot()) { @@ -769,14 +688,6 @@ malloc_init_hard(void) } #endif - if (malloc_mutex_init(&arenas_lock)) - return (true); - - if (pthread_key_create(&arenas_tsd, arenas_cleanup) != 0) { - malloc_mutex_unlock(&init_lock); - return (true); - } - /* * Create enough scaffolding to allow recursive allocation in * malloc_ncpus(). @@ -801,7 +712,8 @@ malloc_init_hard(void) * threaded mode. */ ARENA_SET(arenas[0]); - arenas[0]->nthreads++; + + malloc_mutex_init(&arenas_lock); #ifdef JEMALLOC_PROF if (prof_boot2()) { @@ -841,6 +753,15 @@ malloc_init_hard(void) malloc_write(")\n"); } + next_arena = (narenas > 0) ? 1 : 0; + +#ifdef NO_TLS + if (pthread_key_create(&arenas_tsd, NULL) != 0) { + malloc_mutex_unlock(&init_lock); + return (true); + } +#endif + /* Allocate and initialize arenas. */ arenas = (arena_t **)base_alloc(sizeof(arena_t *) * narenas); if (arenas == NULL) { @@ -872,6 +793,7 @@ malloc_init_hard(void) return (false); } + #ifdef JEMALLOC_ZONE JEMALLOC_ATTR(constructor) void @@ -940,8 +862,7 @@ JEMALLOC_P(malloc)(size_t size) #ifdef JEMALLOC_PROF if (opt_prof) { usize = s2u(size); - PROF_ALLOC_PREP(1, usize, cnt); - if (cnt == NULL) { + if ((cnt = prof_alloc_prep(usize)) == NULL) { ret = NULL; goto OOM; } @@ -990,23 +911,19 @@ RETURN: } JEMALLOC_ATTR(nonnull(1)) -#ifdef JEMALLOC_PROF -/* - * Avoid any uncertainty as to how many backtrace frames to ignore in - * PROF_ALLOC_PREP(). - */ -JEMALLOC_ATTR(noinline) -#endif -static int -imemalign(void **memptr, size_t alignment, size_t size) +JEMALLOC_ATTR(visibility("default")) +int +JEMALLOC_P(posix_memalign)(void **memptr, size_t alignment, size_t size) { int ret; + void *result; +#if (defined(JEMALLOC_PROF) || defined(JEMALLOC_STATS)) size_t usize -#ifdef JEMALLOC_CC_SILENCE +# ifdef JEMALLOC_CC_SILENCE = 0 -#endif +# endif ; - void *result; +#endif #ifdef JEMALLOC_PROF prof_thr_cnt_t *cnt # ifdef JEMALLOC_CC_SILENCE @@ -1056,38 +973,34 @@ imemalign(void **memptr, size_t alignment, size_t size) goto RETURN; } - usize = sa2u(size, alignment, NULL); - if (usize == 0) { - result = NULL; - ret = ENOMEM; - goto RETURN; - } - #ifdef JEMALLOC_PROF if (opt_prof) { - PROF_ALLOC_PREP(2, usize, cnt); - if (cnt == NULL) { + usize = sa2u(size, alignment, NULL); + if ((cnt = prof_alloc_prep(usize)) == NULL) { result = NULL; ret = EINVAL; } else { if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && usize <= small_maxclass) { - assert(sa2u(small_maxclass+1, - alignment, NULL) != 0); - result = ipalloc(sa2u(small_maxclass+1, - alignment, NULL), alignment, false); + result = ipalloc(small_maxclass+1, + alignment, false); if (result != NULL) { arena_prof_promoted(result, usize); } } else { - result = ipalloc(usize, alignment, + result = ipalloc(size, alignment, false); } } } else #endif - result = ipalloc(usize, alignment, false); + { +#ifdef JEMALLOC_STATS + usize = sa2u(size, alignment, NULL); +#endif + result = ipalloc(size, alignment, false); + } } if (result == NULL) { @@ -1119,15 +1032,6 @@ RETURN: return (ret); } -JEMALLOC_ATTR(nonnull(1)) -JEMALLOC_ATTR(visibility("default")) -int -JEMALLOC_P(posix_memalign)(void **memptr, size_t alignment, size_t size) -{ - - return imemalign(memptr, alignment, size); -} - JEMALLOC_ATTR(malloc) JEMALLOC_ATTR(visibility("default")) void * @@ -1183,8 +1087,7 @@ JEMALLOC_P(calloc)(size_t num, size_t size) #ifdef JEMALLOC_PROF if (opt_prof) { usize = s2u(num_size); - PROF_ALLOC_PREP(1, usize, cnt); - if (cnt == NULL) { + if ((cnt = prof_alloc_prep(usize)) == NULL) { ret = NULL; goto RETURN; } @@ -1297,9 +1200,7 @@ JEMALLOC_P(realloc)(void *ptr, size_t size) if (opt_prof) { usize = s2u(size); old_ctx = prof_ctx_get(ptr); - PROF_ALLOC_PREP(1, usize, cnt); - if (cnt == NULL) { - old_ctx = NULL; + if ((cnt = prof_alloc_prep(usize)) == NULL) { ret = NULL; goto OOM; } @@ -1309,13 +1210,8 @@ JEMALLOC_P(realloc)(void *ptr, size_t size) false, false); if (ret != NULL) arena_prof_promoted(ret, usize); - else - old_ctx = NULL; - } else { + } else ret = iralloc(ptr, size, 0, 0, false, false); - if (ret == NULL) - old_ctx = NULL; - } } else #endif { @@ -1353,8 +1249,7 @@ OOM: #ifdef JEMALLOC_PROF if (opt_prof) { usize = s2u(size); - PROF_ALLOC_PREP(1, usize, cnt); - if (cnt == NULL) + if ((cnt = prof_alloc_prep(usize)) == NULL) ret = NULL; else { if (prof_promote && (uintptr_t)cnt != @@ -1459,7 +1354,7 @@ JEMALLOC_P(memalign)(size_t alignment, size_t size) #ifdef JEMALLOC_CC_SILENCE int result = #endif - imemalign(&ret, alignment, size); + JEMALLOC_P(posix_memalign)(&ret, alignment, size); #ifdef JEMALLOC_CC_SILENCE if (result != 0) return (NULL); @@ -1478,7 +1373,7 @@ JEMALLOC_P(valloc)(size_t size) #ifdef JEMALLOC_CC_SILENCE int result = #endif - imemalign(&ret, PAGE_SIZE, size); + JEMALLOC_P(posix_memalign)(&ret, PAGE_SIZE, size); #ifdef JEMALLOC_CC_SILENCE if (result != 0) return (NULL); @@ -1559,18 +1454,15 @@ JEMALLOC_P(mallctlbymib)(const size_t *mib, size_t miblen, void *oldp, } JEMALLOC_INLINE void * -iallocm(size_t usize, size_t alignment, bool zero) +iallocm(size_t size, size_t alignment, bool zero) { - assert(usize == ((alignment == 0) ? s2u(usize) : sa2u(usize, alignment, - NULL))); - if (alignment != 0) - return (ipalloc(usize, alignment, zero)); + return (ipalloc(size, alignment, zero)); else if (zero) - return (icalloc(usize)); + return (icalloc(size)); else - return (imalloc(usize)); + return (imalloc(size)); } JEMALLOC_ATTR(nonnull(1)) @@ -1593,43 +1485,38 @@ JEMALLOC_P(allocm)(void **ptr, size_t *rsize, size_t size, int flags) if (malloc_init()) goto OOM; - usize = (alignment == 0) ? s2u(size) : sa2u(size, alignment, NULL); - if (usize == 0) - goto OOM; - #ifdef JEMALLOC_PROF if (opt_prof) { - PROF_ALLOC_PREP(1, usize, cnt); - if (cnt == NULL) + usize = (alignment == 0) ? s2u(size) : sa2u(size, alignment, + NULL); + if ((cnt = prof_alloc_prep(usize)) == NULL) goto OOM; if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && usize <= small_maxclass) { - size_t usize_promoted = (alignment == 0) ? - s2u(small_maxclass+1) : sa2u(small_maxclass+1, - alignment, NULL); - assert(usize_promoted != 0); - p = iallocm(usize_promoted, alignment, zero); + p = iallocm(small_maxclass+1, alignment, zero); if (p == NULL) goto OOM; arena_prof_promoted(p, usize); } else { - p = iallocm(usize, alignment, zero); + p = iallocm(size, alignment, zero); if (p == NULL) goto OOM; } - prof_malloc(p, usize, cnt); + if (rsize != NULL) *rsize = usize; } else #endif { - p = iallocm(usize, alignment, zero); + p = iallocm(size, alignment, zero); if (p == NULL) goto OOM; #ifndef JEMALLOC_STATS if (rsize != NULL) #endif { + usize = (alignment == 0) ? s2u(size) : sa2u(size, + alignment, NULL); #ifdef JEMALLOC_STATS if (rsize != NULL) #endif @@ -1672,6 +1559,7 @@ JEMALLOC_P(rallocm)(void **ptr, size_t *rsize, size_t size, size_t extra, bool no_move = flags & ALLOCM_NO_MOVE; #ifdef JEMALLOC_PROF prof_thr_cnt_t *cnt; + prof_ctx_t *old_ctx; #endif assert(ptr != NULL); @@ -1686,33 +1574,25 @@ JEMALLOC_P(rallocm)(void **ptr, size_t *rsize, size_t size, size_t extra, /* * usize isn't knowable before iralloc() returns when extra is * non-zero. Therefore, compute its maximum possible value and - * use that in PROF_ALLOC_PREP() to decide whether to capture a + * use that in prof_alloc_prep() to decide whether to capture a * backtrace. prof_realloc() will use the actual usize to * decide whether to sample. */ size_t max_usize = (alignment == 0) ? s2u(size+extra) : sa2u(size+extra, alignment, NULL); - prof_ctx_t *old_ctx = prof_ctx_get(p); old_size = isalloc(p); - PROF_ALLOC_PREP(1, max_usize, cnt); - if (cnt == NULL) + old_ctx = prof_ctx_get(p); + if ((cnt = prof_alloc_prep(max_usize)) == NULL) goto OOM; - /* - * Use minimum usize to determine whether promotion may happen. - */ - if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U - && ((alignment == 0) ? s2u(size) : sa2u(size, - alignment, NULL)) <= small_maxclass) { + if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && max_usize + <= small_maxclass) { q = iralloc(p, small_maxclass+1, (small_maxclass+1 >= size+extra) ? 0 : size+extra - (small_maxclass+1), alignment, zero, no_move); if (q == NULL) goto ERR; - if (max_usize < PAGE_SIZE) { - usize = max_usize; - arena_prof_promoted(q, usize); - } else - usize = isalloc(q); + usize = isalloc(q); + arena_prof_promoted(q, usize); } else { q = iralloc(p, size, extra, alignment, zero, no_move); if (q == NULL) @@ -1720,8 +1600,6 @@ JEMALLOC_P(rallocm)(void **ptr, size_t *rsize, size_t size, size_t extra, usize = isalloc(q); } prof_realloc(q, usize, cnt, old_size, old_ctx); - if (rsize != NULL) - *rsize = usize; } else #endif { diff --git a/dep/jemalloc/src/mb.c b/dep/jemalloc/src/mb.c index dc2c0a256fd..30a1a2e997a 100644 --- a/dep/jemalloc/src/mb.c +++ b/dep/jemalloc/src/mb.c @@ -1,2 +1,2 @@ -#define JEMALLOC_MB_C_ +#define MB_C_ #include "jemalloc/internal/jemalloc_internal.h" diff --git a/dep/jemalloc/src/mutex.c b/dep/jemalloc/src/mutex.c index ca89ef1c962..3ecb18a340e 100644 --- a/dep/jemalloc/src/mutex.c +++ b/dep/jemalloc/src/mutex.c @@ -55,9 +55,6 @@ pthread_create(pthread_t *__restrict thread, bool malloc_mutex_init(malloc_mutex_t *mutex) { -#ifdef JEMALLOC_OSSPIN - *mutex = 0; -#else pthread_mutexattr_t attr; if (pthread_mutexattr_init(&attr) != 0) @@ -73,7 +70,6 @@ malloc_mutex_init(malloc_mutex_t *mutex) } pthread_mutexattr_destroy(&attr); -#endif return (false); } @@ -81,10 +77,8 @@ void malloc_mutex_destroy(malloc_mutex_t *mutex) { -#ifndef JEMALLOC_OSSPIN if (pthread_mutex_destroy(mutex) != 0) { malloc_write("<jemalloc>: Error in pthread_mutex_destroy()\n"); abort(); } -#endif } diff --git a/dep/jemalloc/src/prof.c b/dep/jemalloc/src/prof.c index 8a144b4e46c..636cccef52a 100644 --- a/dep/jemalloc/src/prof.c +++ b/dep/jemalloc/src/prof.c @@ -3,15 +3,15 @@ #ifdef JEMALLOC_PROF /******************************************************************************/ +#ifdef JEMALLOC_PROF_LIBGCC +#include <unwind.h> +#endif + #ifdef JEMALLOC_PROF_LIBUNWIND #define UNW_LOCAL_ONLY #include <libunwind.h> #endif -#ifdef JEMALLOC_PROF_LIBGCC -#include <unwind.h> -#endif - /******************************************************************************/ /* Data. */ @@ -169,7 +169,39 @@ prof_leave(void) prof_gdump(); } -#ifdef JEMALLOC_PROF_LIBUNWIND +#ifdef JEMALLOC_PROF_LIBGCC +static _Unwind_Reason_Code +prof_unwind_init_callback(struct _Unwind_Context *context, void *arg) +{ + + return (_URC_NO_REASON); +} + +static _Unwind_Reason_Code +prof_unwind_callback(struct _Unwind_Context *context, void *arg) +{ + prof_unwind_data_t *data = (prof_unwind_data_t *)arg; + + if (data->nignore > 0) + data->nignore--; + else { + data->bt->vec[data->bt->len] = (void *)_Unwind_GetIP(context); + data->bt->len++; + if (data->bt->len == data->max) + return (_URC_END_OF_STACK); + } + + return (_URC_NO_REASON); +} + +void +prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max) +{ + prof_unwind_data_t data = {bt, nignore, max}; + + _Unwind_Backtrace(prof_unwind_callback, &data); +} +#elif defined(JEMALLOC_PROF_LIBUNWIND) void prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max) { @@ -204,41 +236,7 @@ prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max) break; } } -#endif -#ifdef JEMALLOC_PROF_LIBGCC -static _Unwind_Reason_Code -prof_unwind_init_callback(struct _Unwind_Context *context, void *arg) -{ - - return (_URC_NO_REASON); -} - -static _Unwind_Reason_Code -prof_unwind_callback(struct _Unwind_Context *context, void *arg) -{ - prof_unwind_data_t *data = (prof_unwind_data_t *)arg; - - if (data->nignore > 0) - data->nignore--; - else { - data->bt->vec[data->bt->len] = (void *)_Unwind_GetIP(context); - data->bt->len++; - if (data->bt->len == data->max) - return (_URC_END_OF_STACK); - } - - return (_URC_NO_REASON); -} - -void -prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max) -{ - prof_unwind_data_t data = {bt, nignore, max}; - - _Unwind_Backtrace(prof_unwind_callback, &data); -} -#endif -#ifdef JEMALLOC_PROF_GCC +#else void prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max) { @@ -434,7 +432,6 @@ prof_lookup(prof_bt_t *bt) prof_ctx_t *p; void *v; } ctx; - bool new_ctx; /* * This thread's cache lacks bt. Look for it in the global @@ -471,26 +468,12 @@ prof_lookup(prof_bt_t *bt) idalloc(ctx.v); return (NULL); } - /* - * Artificially raise curobjs, in order to avoid a race - * condition with prof_ctx_merge()/prof_ctx_destroy(). - * - * No locking is necessary for ctx here because no other - * threads have had the opportunity to fetch it from - * bt2ctx yet. - */ - ctx.p->cnt_merged.curobjs++; - new_ctx = true; - } else { - /* - * Artificially raise curobjs, in order to avoid a race - * condition with prof_ctx_merge()/prof_ctx_destroy(). - */ - malloc_mutex_lock(&ctx.p->lock); - ctx.p->cnt_merged.curobjs++; - malloc_mutex_unlock(&ctx.p->lock); - new_ctx = false; } + /* + * Acquire ctx's lock before releasing bt2ctx_mtx, in order to + * avoid a race condition with prof_ctx_destroy(). + */ + malloc_mutex_lock(&ctx.p->lock); prof_leave(); /* Link a prof_thd_cnt_t into ctx for this thread. */ @@ -503,9 +486,8 @@ prof_lookup(prof_bt_t *bt) */ ret.p = ql_last(&prof_tdata->lru_ql, lru_link); assert(ret.v != NULL); - if (ckh_remove(&prof_tdata->bt2cnt, ret.p->ctx->bt, - NULL, NULL)) - assert(false); + ckh_remove(&prof_tdata->bt2cnt, ret.p->ctx->bt, NULL, + NULL); ql_remove(&prof_tdata->lru_ql, ret.p, lru_link); prof_ctx_merge(ret.p->ctx, ret.p); /* ret can now be re-used. */ @@ -516,8 +498,7 @@ prof_lookup(prof_bt_t *bt) /* Allocate and partially initialize a new cnt. */ ret.v = imalloc(sizeof(prof_thr_cnt_t)); if (ret.p == NULL) { - if (new_ctx) - prof_ctx_destroy(ctx.p); + malloc_mutex_unlock(&ctx.p->lock); return (NULL); } ql_elm_new(ret.p, cnts_link); @@ -528,15 +509,12 @@ prof_lookup(prof_bt_t *bt) ret.p->epoch = 0; memset(&ret.p->cnts, 0, sizeof(prof_cnt_t)); if (ckh_insert(&prof_tdata->bt2cnt, btkey.v, ret.v)) { - if (new_ctx) - prof_ctx_destroy(ctx.p); + malloc_mutex_unlock(&ctx.p->lock); idalloc(ret.v); return (NULL); } ql_head_insert(&prof_tdata->lru_ql, ret.p, lru_link); - malloc_mutex_lock(&ctx.p->lock); ql_tail_insert(&ctx.p->cnts_ql, ret.p, cnts_link); - ctx.p->cnt_merged.curobjs--; malloc_mutex_unlock(&ctx.p->lock); } else { /* Move ret to the front of the LRU. */ @@ -650,10 +628,11 @@ prof_ctx_destroy(prof_ctx_t *ctx) /* * Check that ctx is still unused by any thread cache before destroying - * it. prof_lookup() artificially raises ctx->cnt_merge.curobjs in - * order to avoid a race condition with this function, as does - * prof_ctx_merge() in order to avoid a race between the main body of - * prof_ctx_merge() and entry into this function. + * it. prof_lookup() interlocks bt2ctx_mtx and ctx->lock in order to + * avoid a race condition with this function, and prof_ctx_merge() + * artificially raises ctx->cnt_merged.curobjs in order to avoid a race + * between the main body of prof_ctx_merge() and entry into this + * function. */ prof_enter(); malloc_mutex_lock(&ctx->lock); @@ -662,8 +641,7 @@ prof_ctx_destroy(prof_ctx_t *ctx) assert(ctx->cnt_merged.accumobjs == 0); assert(ctx->cnt_merged.accumbytes == 0); /* Remove ctx from bt2ctx. */ - if (ckh_remove(&bt2ctx, ctx->bt, NULL, NULL)) - assert(false); + ckh_remove(&bt2ctx, ctx->bt, NULL, NULL); prof_leave(); /* Destroy ctx. */ malloc_mutex_unlock(&ctx->lock); @@ -671,10 +649,7 @@ prof_ctx_destroy(prof_ctx_t *ctx) malloc_mutex_destroy(&ctx->lock); idalloc(ctx); } else { - /* - * Compensate for increment in prof_ctx_merge() or - * prof_lookup(). - */ + /* Compensate for increment in prof_ctx_merge(). */ ctx->cnt_merged.curobjs--; malloc_mutex_unlock(&ctx->lock); prof_leave(); @@ -1081,7 +1056,7 @@ prof_bt_hash(const void *key, unsigned minbits, size_t *hash1, size_t *hash2) } else { ret1 = h; ret2 = hash(bt->vec, bt->len * sizeof(void *), - 0x8432a476666bbc13LLU); + 0x8432a476666bbc13U); } *hash1 = ret1; @@ -1118,6 +1093,7 @@ prof_tdata_init(void) prof_tdata->vec = imalloc(sizeof(void *) * prof_bt_max); if (prof_tdata->vec == NULL) { + ckh_delete(&prof_tdata->bt2cnt); idalloc(prof_tdata); return (NULL); @@ -1135,26 +1111,33 @@ prof_tdata_init(void) static void prof_tdata_cleanup(void *arg) { - prof_thr_cnt_t *cnt; - prof_tdata_t *prof_tdata = (prof_tdata_t *)arg; + prof_tdata_t *prof_tdata; - /* - * Delete the hash table. All of its contents can still be iterated - * over via the LRU. - */ - ckh_delete(&prof_tdata->bt2cnt); + prof_tdata = PROF_TCACHE_GET(); + if (prof_tdata != NULL) { + prof_thr_cnt_t *cnt; - /* Iteratively merge cnt's into the global stats and delete them. */ - while ((cnt = ql_last(&prof_tdata->lru_ql, lru_link)) != NULL) { - ql_remove(&prof_tdata->lru_ql, cnt, lru_link); - prof_ctx_merge(cnt->ctx, cnt); - idalloc(cnt); - } + /* + * Delete the hash table. All of its contents can still be + * iterated over via the LRU. + */ + ckh_delete(&prof_tdata->bt2cnt); - idalloc(prof_tdata->vec); + /* + * Iteratively merge cnt's into the global stats and delete + * them. + */ + while ((cnt = ql_last(&prof_tdata->lru_ql, lru_link)) != NULL) { + prof_ctx_merge(cnt->ctx, cnt); + ql_remove(&prof_tdata->lru_ql, cnt, lru_link); + idalloc(cnt); + } - idalloc(prof_tdata); - PROF_TCACHE_SET(NULL); + idalloc(prof_tdata->vec); + + idalloc(prof_tdata); + PROF_TCACHE_SET(NULL); + } } void diff --git a/dep/jemalloc/src/rtree.c b/dep/jemalloc/src/rtree.c index eb0ff1e24af..7753743c5e6 100644 --- a/dep/jemalloc/src/rtree.c +++ b/dep/jemalloc/src/rtree.c @@ -1,4 +1,4 @@ -#define JEMALLOC_RTREE_C_ +#define RTREE_C_ #include "jemalloc/internal/jemalloc_internal.h" rtree_t * @@ -20,10 +20,7 @@ rtree_new(unsigned bits) memset(ret, 0, offsetof(rtree_t, level2bits) + (sizeof(unsigned) * height)); - if (malloc_mutex_init(&ret->mutex)) { - /* Leak the rtree. */ - return (NULL); - } + malloc_mutex_init(&ret->mutex); ret->height = height; if (bits_per_level * height > bits) ret->level2bits[0] = bits % bits_per_level; diff --git a/dep/jemalloc/src/stats.c b/dep/jemalloc/src/stats.c index dc172e425c0..3dfe0d232a6 100644 --- a/dep/jemalloc/src/stats.c +++ b/dep/jemalloc/src/stats.c @@ -39,10 +39,6 @@ bool opt_stats_print = false; -#ifdef JEMALLOC_STATS -size_t stats_cactive = 0; -#endif - /******************************************************************************/ /* Function prototypes for non-inline static functions. */ @@ -323,7 +319,6 @@ static void stats_arena_print(void (*write_cb)(void *, const char *), void *cbopaque, unsigned i) { - unsigned nthreads; size_t pagesize, pactive, pdirty, mapped; uint64_t npurge, nmadvise, purged; size_t small_allocated; @@ -333,9 +328,6 @@ stats_arena_print(void (*write_cb)(void *, const char *), void *cbopaque, CTL_GET("arenas.pagesize", &pagesize, size_t); - CTL_I_GET("stats.arenas.0.nthreads", &nthreads, unsigned); - malloc_cprintf(write_cb, cbopaque, - "assigned threads: %u\n", nthreads); CTL_I_GET("stats.arenas.0.pactive", &pactive, size_t); CTL_I_GET("stats.arenas.0.pdirty", &pdirty, size_t); CTL_I_GET("stats.arenas.0.npurge", &npurge, uint64_t); @@ -677,26 +669,21 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque, #ifdef JEMALLOC_STATS { int err; - size_t sszp, ssz; - size_t *cactive; + size_t ssz; size_t allocated, active, mapped; size_t chunks_current, chunks_high, swap_avail; uint64_t chunks_total; size_t huge_allocated; uint64_t huge_nmalloc, huge_ndalloc; - sszp = sizeof(size_t *); ssz = sizeof(size_t); - CTL_GET("stats.cactive", &cactive, size_t *); CTL_GET("stats.allocated", &allocated, size_t); CTL_GET("stats.active", &active, size_t); CTL_GET("stats.mapped", &mapped, size_t); malloc_cprintf(write_cb, cbopaque, - "Allocated: %zu, active: %zu, mapped: %zu\n", - allocated, active, mapped); - malloc_cprintf(write_cb, cbopaque, - "Current active ceiling: %zu\n", atomic_read_z(cactive)); + "Allocated: %zu, active: %zu, mapped: %zu\n", allocated, + active, mapped); /* Print chunk stats. */ CTL_GET("stats.chunks.total", &chunks_total, uint64_t); @@ -748,7 +735,7 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque, ninitialized++; } - if (ninitialized > 1 || unmerged == false) { + if (ninitialized > 1) { /* Print merged arena stats. */ malloc_cprintf(write_cb, cbopaque, "\nMerged arenas stats:\n"); diff --git a/dep/jemalloc/src/tcache.c b/dep/jemalloc/src/tcache.c index 31c329e1613..cbbe7a113a9 100644 --- a/dep/jemalloc/src/tcache.c +++ b/dep/jemalloc/src/tcache.c @@ -8,9 +8,6 @@ bool opt_tcache = true; ssize_t opt_lg_tcache_max = LG_TCACHE_MAXCLASS_DEFAULT; ssize_t opt_lg_tcache_gc_sweep = LG_TCACHE_GC_SWEEP_DEFAULT; -tcache_bin_info_t *tcache_bin_info; -static unsigned stack_nelms; /* Total stack elms per tcache. */ - /* Map of thread-specific caches. */ #ifndef NO_TLS __thread tcache_t *tcache_tls JEMALLOC_ATTR(tls_model("initial-exec")); @@ -58,19 +55,18 @@ tcache_bin_flush_small(tcache_bin_t *tbin, size_t binind, unsigned rem #endif ) { - void *ptr; + void *flush, *deferred, *ptr; unsigned i, nflush, ndeferred; -#ifdef JEMALLOC_STATS - bool merged_stats = false; -#endif + bool first_pass; assert(binind < nbins); assert(rem <= tbin->ncached); + assert(tbin->ncached > 0 || tbin->avail == NULL); - for (nflush = tbin->ncached - rem; nflush > 0; nflush = ndeferred) { + for (flush = tbin->avail, nflush = tbin->ncached - rem, first_pass = + true; flush != NULL; flush = deferred, nflush = ndeferred) { /* Lock the arena bin associated with the first object. */ - arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE( - tbin->avail[0]); + arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(flush); arena_t *arena = chunk->arena; arena_bin_t *bin = &arena->bins[binind]; @@ -86,17 +82,17 @@ tcache_bin_flush_small(tcache_bin_t *tbin, size_t binind, unsigned rem malloc_mutex_lock(&bin->lock); #ifdef JEMALLOC_STATS if (arena == tcache->arena) { - assert(merged_stats == false); - merged_stats = true; bin->stats.nflushes++; bin->stats.nrequests += tbin->tstats.nrequests; tbin->tstats.nrequests = 0; } #endif + deferred = NULL; ndeferred = 0; for (i = 0; i < nflush; i++) { - ptr = tbin->avail[i]; + ptr = flush; assert(ptr != NULL); + flush = *(void **)ptr; chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); if (chunk->arena == arena) { size_t pageind = ((uintptr_t)ptr - @@ -111,31 +107,21 @@ tcache_bin_flush_small(tcache_bin_t *tbin, size_t binind, unsigned rem * locked. Stash the object, so that it can be * handled in a future pass. */ - tbin->avail[ndeferred] = ptr; + *(void **)ptr = deferred; + deferred = ptr; ndeferred++; } } malloc_mutex_unlock(&bin->lock); + + if (first_pass) { + tbin->avail = flush; + first_pass = false; + } } -#ifdef JEMALLOC_STATS - if (merged_stats == false) { - /* - * The flush loop didn't happen to flush to this thread's - * arena, so the stats didn't get merged. Manually do so now. - */ - arena_bin_t *bin = &tcache->arena->bins[binind]; - malloc_mutex_lock(&bin->lock); - bin->stats.nflushes++; - bin->stats.nrequests += tbin->tstats.nrequests; - tbin->tstats.nrequests = 0; - malloc_mutex_unlock(&bin->lock); - } -#endif - memmove(tbin->avail, &tbin->avail[tbin->ncached - rem], - rem * sizeof(void *)); tbin->ncached = rem; - if ((int)tbin->ncached < tbin->low_water) + if (tbin->ncached < tbin->low_water) tbin->low_water = tbin->ncached; } @@ -146,19 +132,18 @@ tcache_bin_flush_large(tcache_bin_t *tbin, size_t binind, unsigned rem #endif ) { - void *ptr; + void *flush, *deferred, *ptr; unsigned i, nflush, ndeferred; -#ifdef JEMALLOC_STATS - bool merged_stats = false; -#endif + bool first_pass; assert(binind < nhbins); assert(rem <= tbin->ncached); + assert(tbin->ncached > 0 || tbin->avail == NULL); - for (nflush = tbin->ncached - rem; nflush > 0; nflush = ndeferred) { + for (flush = tbin->avail, nflush = tbin->ncached - rem, first_pass = + true; flush != NULL; flush = deferred, nflush = ndeferred) { /* Lock the arena associated with the first object. */ - arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE( - tbin->avail[0]); + arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(flush); arena_t *arena = chunk->arena; malloc_mutex_lock(&arena->lock); @@ -170,7 +155,6 @@ tcache_bin_flush_large(tcache_bin_t *tbin, size_t binind, unsigned rem tcache->prof_accumbytes = 0; #endif #ifdef JEMALLOC_STATS - merged_stats = true; arena->stats.nrequests_large += tbin->tstats.nrequests; arena->stats.lstats[binind - nbins].nrequests += tbin->tstats.nrequests; @@ -179,10 +163,12 @@ tcache_bin_flush_large(tcache_bin_t *tbin, size_t binind, unsigned rem #if (defined(JEMALLOC_PROF) || defined(JEMALLOC_STATS)) } #endif + deferred = NULL; ndeferred = 0; for (i = 0; i < nflush; i++) { - ptr = tbin->avail[i]; + ptr = flush; assert(ptr != NULL); + flush = *(void **)ptr; chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); if (chunk->arena == arena) arena_dalloc_large(arena, chunk, ptr); @@ -193,32 +179,21 @@ tcache_bin_flush_large(tcache_bin_t *tbin, size_t binind, unsigned rem * Stash the object, so that it can be handled * in a future pass. */ - tbin->avail[ndeferred] = ptr; + *(void **)ptr = deferred; + deferred = ptr; ndeferred++; } } malloc_mutex_unlock(&arena->lock); + + if (first_pass) { + tbin->avail = flush; + first_pass = false; + } } -#ifdef JEMALLOC_STATS - if (merged_stats == false) { - /* - * The flush loop didn't happen to flush to this thread's - * arena, so the stats didn't get merged. Manually do so now. - */ - arena_t *arena = tcache->arena; - malloc_mutex_lock(&arena->lock); - arena->stats.nrequests_large += tbin->tstats.nrequests; - arena->stats.lstats[binind - nbins].nrequests += - tbin->tstats.nrequests; - tbin->tstats.nrequests = 0; - malloc_mutex_unlock(&arena->lock); - } -#endif - memmove(tbin->avail, &tbin->avail[tbin->ncached - rem], - rem * sizeof(void *)); tbin->ncached = rem; - if ((int)tbin->ncached < tbin->low_water) + if (tbin->ncached < tbin->low_water) tbin->low_water = tbin->ncached; } @@ -226,14 +201,10 @@ tcache_t * tcache_create(arena_t *arena) { tcache_t *tcache; - size_t size, stack_offset; + size_t size; unsigned i; size = offsetof(tcache_t, tbins) + (sizeof(tcache_bin_t) * nhbins); - /* Naturally align the pointer stacks. */ - size = PTR_CEILING(size); - stack_offset = size; - size += stack_nelms * sizeof(void *); /* * Round up to the nearest multiple of the cacheline size, in order to * avoid the possibility of false cacheline sharing. @@ -246,8 +217,6 @@ tcache_create(arena_t *arena) if (size <= small_maxclass) tcache = (tcache_t *)arena_malloc_small(arena, size, true); - else if (size <= tcache_maxclass) - tcache = (tcache_t *)arena_malloc_large(arena, size, true); else tcache = (tcache_t *)icalloc(size); @@ -264,12 +233,15 @@ tcache_create(arena_t *arena) tcache->arena = arena; assert((TCACHE_NSLOTS_SMALL_MAX & 1U) == 0); - for (i = 0; i < nhbins; i++) { - tcache->tbins[i].lg_fill_div = 1; - tcache->tbins[i].avail = (void **)((uintptr_t)tcache + - (uintptr_t)stack_offset); - stack_offset += tcache_bin_info[i].ncached_max * sizeof(void *); + for (i = 0; i < nbins; i++) { + if ((arena->bins[i].nregs << 1) <= TCACHE_NSLOTS_SMALL_MAX) { + tcache->tbins[i].ncached_max = (arena->bins[i].nregs << + 1); + } else + tcache->tbins[i].ncached_max = TCACHE_NSLOTS_SMALL_MAX; } + for (; i < nhbins; i++) + tcache->tbins[i].ncached_max = TCACHE_NSLOTS_LARGE; TCACHE_SET(tcache); @@ -280,7 +252,6 @@ void tcache_destroy(tcache_t *tcache) { unsigned i; - size_t tcache_size; #ifdef JEMALLOC_STATS /* Unlink from list of extant tcaches. */ @@ -337,8 +308,7 @@ tcache_destroy(tcache_t *tcache) } #endif - tcache_size = arena_salloc(tcache); - if (tcache_size <= small_maxclass) { + if (arena_salloc(tcache) <= small_maxclass) { arena_chunk_t *chunk = CHUNK_ADDR2BASE(tcache); arena_t *arena = chunk->arena; size_t pageind = ((uintptr_t)tcache - (uintptr_t)chunk) >> @@ -352,13 +322,6 @@ tcache_destroy(tcache_t *tcache) malloc_mutex_lock(&bin->lock); arena_dalloc_bin(arena, chunk, tcache, mapelm); malloc_mutex_unlock(&bin->lock); - } else if (tcache_size <= tcache_maxclass) { - arena_chunk_t *chunk = CHUNK_ADDR2BASE(tcache); - arena_t *arena = chunk->arena; - - malloc_mutex_lock(&arena->lock); - arena_dalloc_large(arena, chunk, tcache); - malloc_mutex_unlock(&arena->lock); } else idalloc(tcache); } @@ -415,13 +378,11 @@ tcache_stats_merge(tcache_t *tcache, arena_t *arena) } #endif -bool +void tcache_boot(void) { if (opt_tcache) { - unsigned i; - /* * If necessary, clamp opt_lg_tcache_max, now that * small_maxclass and arena_maxclass are known. @@ -436,28 +397,6 @@ tcache_boot(void) nhbins = nbins + (tcache_maxclass >> PAGE_SHIFT); - /* Initialize tcache_bin_info. */ - tcache_bin_info = (tcache_bin_info_t *)base_alloc(nhbins * - sizeof(tcache_bin_info_t)); - if (tcache_bin_info == NULL) - return (true); - stack_nelms = 0; - for (i = 0; i < nbins; i++) { - if ((arena_bin_info[i].nregs << 1) <= - TCACHE_NSLOTS_SMALL_MAX) { - tcache_bin_info[i].ncached_max = - (arena_bin_info[i].nregs << 1); - } else { - tcache_bin_info[i].ncached_max = - TCACHE_NSLOTS_SMALL_MAX; - } - stack_nelms += tcache_bin_info[i].ncached_max; - } - for (; i < nhbins; i++) { - tcache_bin_info[i].ncached_max = TCACHE_NSLOTS_LARGE; - stack_nelms += tcache_bin_info[i].ncached_max; - } - /* Compute incremental GC event threshold. */ if (opt_lg_tcache_gc_sweep >= 0) { tcache_gc_incr = ((1U << opt_lg_tcache_gc_sweep) / @@ -473,8 +412,6 @@ tcache_boot(void) abort(); } } - - return (false); } /******************************************************************************/ #endif /* JEMALLOC_TCACHE */ diff --git a/sql/updates/world/2012_04_22_00_world_sai.sql b/sql/updates/world/2012_04_22_00_world_sai.sql new file mode 100644 index 00000000000..f223883c8a7 --- /dev/null +++ b/sql/updates/world/2012_04_22_00_world_sai.sql @@ -0,0 +1,63 @@ +-- SAI for Tabard Vendor Elizabeth Ross +SET @ROSS := 28776; +SET @GOSSIP := 9832; + +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@ROSS; + +DELETE FROM `gossip_menu_option` WHERE `menu_id`=@GOSSIP AND `id`>0 AND `id`<11; +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`) VALUES +(@GOSSIP, 1, 0, 'I''ve lost my Blood Knight Tabard.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 2, 0, 'I''ve lost my Tabard of the Hand.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 3, 0, 'I''ve lost my Tabard of the Protector.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 4, 0, 'I''ve lost my Green Trophy Tabard of the Illidari.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 5, 0, 'I''ve lost my Purple Trophy Tabard of the Illidari.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 6, 0, 'I''ve lost my Tabard of Summer Skies.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 7, 0, 'I''ve lost my Tabard of Summer Flames.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 8, 0, 'I''ve lost my Loremaster''s Colors.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 9, 0, 'I''ve lost my Tabard of the Explorer.', 1, 1, 0, 0, 0, 0, ''), +(@GOSSIP, 10, 0, 'I''ve lost my Tabard of the Achiever.', 1, 1, 0, 0, 0, 0, ''); + +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ROSS AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ROSS, 0, 0, 10, 62, 0, 100, 0, @GOSSIP, 1, 0, 0, 11, 54974, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Blood Knight Tabard'), +(@ROSS, 0, 1, 10, 62, 0, 100, 0, @GOSSIP, 2, 0, 0, 11, 54976, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Tabard of the Hand'), +(@ROSS, 0, 2, 10, 62, 0, 100, 0, @GOSSIP, 3, 0, 0, 11, 55008, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Tabard of the Protector'), +(@ROSS, 0, 3, 10, 62, 0, 100, 0, @GOSSIP, 4, 0, 0, 11, 54977, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Green Trophy Tabard of the Illidari'), +(@ROSS, 0, 4, 10, 62, 0, 100, 0, @GOSSIP, 5, 0, 0, 11, 54982, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Purple Trophy Tabard of the Illidari'), +(@ROSS, 0, 5, 10, 62, 0, 100, 0, @GOSSIP, 6, 0, 0, 11, 62768, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Tabard of Summer Skies'), +(@ROSS, 0, 6, 10, 62, 0, 100, 0, @GOSSIP, 7, 0, 0, 11, 62769, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Tabard of Summer Flames'), +(@ROSS, 0, 7, 10, 62, 0, 100, 0, @GOSSIP, 8, 0, 0, 11, 58194, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Loremaster''s Colors'), +(@ROSS, 0, 8, 10, 62, 0, 100, 0, @GOSSIP, 9, 0, 0, 11, 58224, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Tabard of the Explorer'), +(@ROSS, 0, 9, 10, 62, 0, 100, 0, @GOSSIP, 10, 0, 0, 11, 55006, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Cast Spell Create Tabard of the Achiever'), +(@ROSS, 0, 10, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Elizabeth Ross - On Gossip Select - Close Gossip'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=@GOSSIP; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,@GOSSIP,1,0,2,25549,1,1,1,0,'','Only show gossip if player doesn''t have Blood Knight Tabard'), +(15,@GOSSIP,1,0,8,9737,0,0,0,0,'','Only show gossip if player already finished quest True Masters of Light'), +(15,@GOSSIP,2,0,2,24344,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of the Hand'), +(15,@GOSSIP,2,0,8,9762,0,0,0,0,'','Only show gossip if player already finished quest The Unwritten Prophecy'), +(15,@GOSSIP,3,0,2,28788,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of the protector'), +(15,@GOSSIP,3,0,8,10259,0,0,0,0,'','Only show gossip if player already finished quest Into the Breach'), +(15,@GOSSIP,4,0,2,31404,1,1,1,0,'','Only show gossip if player doesn''t have Green Trophy Tabard of Illidari'), +(15,@GOSSIP,4,0,2,31405,1,1,1,0,'','Only show gossip if player doesn''t have Purple Trophy Tabard of Illidari'), +(15,@GOSSIP,4,0,2,31408,1,1,1,0,'','Only show gossip if player doesn''t have Offering of the Sha''tar'), +(15,@GOSSIP,4,0,8,10781,0,0,0,0,'','Only show gossip if player already finished quest Battle of the Crimson Watch'), +(15,@GOSSIP,5,0,2,31404,1,1,1,0,'','Only show gossip if player doesn''t have Green Trophy Tabard of Illidari'), +(15,@GOSSIP,5,0,2,31405,1,1,1,0,'','Only show gossip if player doesn''t have Purple Trophy Tabard of Illidari'), +(15,@GOSSIP,5,0,2,31408,1,1,1,0,'','Only show gossip if player doesn''t have Offering of the Sha''tar'), +(15,@GOSSIP,5,0,8,10781,0,0,0,0,'','Only show gossip if player already finished quest Battle of the Crimson Watch'), +(15,@GOSSIP,6,0,2,35279,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of Summer Skies'), +(15,@GOSSIP,6,0,2,35280,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of Summer Flames'), +(15,@GOSSIP,6,0,8,11972,0,0,0,0,'','Only show gossip if player already finished quest Shards of Ahune'), +(15,@GOSSIP,7,0,2,35279,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of Summer Skies'), +(15,@GOSSIP,7,0,2,35280,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of Summer Flames'), +(15,@GOSSIP,7,0,8,11972,0,0,0,0,'','Only show gossip if player already finished quest Shards of Ahune'), +(15,@GOSSIP,8,0,2,43300,1,1,1,0,'','Only show gossip if player doesn''t have Loremaster''s Colors'), +(15,@GOSSIP,8,0,17,1681,0,0,0,0,'','Only show gossip if player have achievement Loremaster (A)'), +(15,@GOSSIP,8,1,2,43300,1,1,1,0,'','Only show gossip if player doesn''t have Loremaster''s Colors'), +(15,@GOSSIP,8,1,17,1682,0,0,0,0,'','Only show gossip if player have achievement Loremaster (H)'), +(15,@GOSSIP,9,0,2,43348,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of the Explorer'), +(15,@GOSSIP,9,0,17,45,0,0,0,0,'','Only show gossip if player have achievement Explore Northrend'), +(15,@GOSSIP,10,0,2,40643,1,1,1,0,'','Only show gossip if player doesn''t have Tabard of the Explorer'), +(15,@GOSSIP,10,0,17,1021,0,0,0,0,'','Only show gossip if player have achievement Twenty-Five Tabards'); diff --git a/sql/updates/world/2012_04_23_00_world_creatures.sql b/sql/updates/world/2012_04_23_00_world_creatures.sql new file mode 100644 index 00000000000..3730fabf552 --- /dev/null +++ b/sql/updates/world/2012_04_23_00_world_creatures.sql @@ -0,0 +1,12 @@ +UPDATE `creature_template` SET `flags_extra`=0x82,`ModelId1`=1126,`ModelId2`=16925 WHERE `entry` IN (38008,38641,38773,38774); -- Blood Orb Controller +UPDATE `creature_template` SET `flags_extra`=0x80,`ModelId1`=19725,`ModelId2`=31095,`baseattacktime`=2000,`speed_walk`=0.8,`speed_run`=0.28571 WHERE `entry` IN (38454,38775,38776,38777); -- Kinetic Bomb +UPDATE `creature_template` SET `exp`=2,`baseattacktime`=2000,`ModelId1`=19725,`ModelId2`=21342 WHERE `entry`=38458; -- Kinetic Bomb Target +UPDATE `creature_template` SET `baseattacktime`=2000,`speed_walk`=4.4,`ModelId1`=19725,`ModelId2`=26767 WHERE `entry` IN (38332,38451); -- Ball of Flame +UPDATE `creature_template` SET `flags_extra`=0x80 WHERE `entry`=37950; -- Valithria Dreamwalker +UPDATE `creature_template` SET `InhabitType`=4 WHERE `InhabitType`&4 AND `flags_extra`&0x80; -- make flying triggers fly +UPDATE `creature_template` SET `InhabitType`=4,`HoverHeight`=12 WHERE `entry`=37126; -- Sister Svalna +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry`=37950; -- Valithria Dreamwalker +UPDATE `creature_model_info` SET `bounding_radius`=1,`combat_reach`=0,`gender`=0 WHERE `modelid`=31095; -- Kinetic Bomb +UPDATE `creature_model_info` SET `bounding_radius`=0.5,`combat_reach`=1,`gender`=0 WHERE `modelid`=21342; -- Kinetic Bomb Target +UPDATE `creature_model_info` SET `bounding_radius`=0.5,`combat_reach`=1,`gender`=0 WHERE `modelid`=26767; -- Ball of Flame +UPDATE `creature_template_addon` SET `bytes1`=50331648,`bytes2`=1,`mount`=0,`emote`=0,`auras`=NULL WHERE `entry`=38454; -- Kinetic Bomb diff --git a/sql/updates/world/2012_04_23_01_world_conditions.sql b/sql/updates/world/2012_04_23_01_world_conditions.sql new file mode 100644 index 00000000000..c731426aa3f --- /dev/null +++ b/sql/updates/world/2012_04_23_01_world_conditions.sql @@ -0,0 +1,5 @@ +-- setup alternate conditions for spell 46488 +DELETE FROM `conditions` WHERE `SourceEntry` = 46488 AND `ElseGroup` = 1; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,1,46488,0,1,31,1,3,26817,0,0,0,'',''), +(13,1,46488,0,1,36,1,0,0,0,1,0,'',''); diff --git a/sql/updates/world/2012_04_23_02_world_prospecting_loot_template.sql b/sql/updates/world/2012_04_23_02_world_prospecting_loot_template.sql new file mode 100644 index 00000000000..6ea44d92722 --- /dev/null +++ b/sql/updates/world/2012_04_23_02_world_prospecting_loot_template.sql @@ -0,0 +1,112 @@ +SET @TinRef := 13000; +SET @TBC1 := @TinRef+1; +SET @TBC2 := @TinRef+2; +SET @WOTLK1 := @TinRef+3; +SET @WOTLK2 := @TinRef+4; +SET @WOTLK3 := @TinRef+5; + +SET @Copper := 2770; +SET @Tin := 2771; +SET @Iron := 2772; +SET @Mithril := 3858; +SET @Thorium := 10620; +SET @FelIron := 23424; +SET @Adamantite := 23425; +SET @Cobalt := 36909; +SET @Saronite := 36912; +SET @Titanium := 36910; + +-- Reference Loot Templates +DELETE FROM `reference_loot_template` WHERE `entry` BETWEEN @TinRef AND @TinRef+5; +INSERT INTO `reference_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES +-- Stupid Tin +(@TinRef,1529,0,1,1,1,1), -- Jade +(@TinRef,3864,0,1,1,1,1), -- Citrine +(@TinRef,7909,0,1,1,1,1), -- Aquamarine +-- TBC Greens +(@TBC1,21929,0,1,1,1,2), -- Flame Spessarite +(@TBC1,23077,0,1,1,1,2), -- Blood Garnet +(@TBC1,23079,0,1,1,1,2), -- Deep Peridot +(@TBC1,23107,0,1,1,1,2), -- Shadow Draenite +(@TBC1,23112,0,1,1,1,2), -- Golden Draenite +(@TBC1,23117,0,1,1,1,2), -- Azure Moonstone +-- TBC Blues +(@TBC2,23436,0,1,1,1,1), -- Living Ruby +(@TBC2,23437,0,1,1,1,1), -- Talasite +(@TBC2,23438,0,1,1,1,1), -- Star of Elune +(@TBC2,23439,0,1,1,1,1), -- Noble Topaz +(@TBC2,23440,0,1,1,1,1), -- Dawnstone +(@TBC2,23441,0,1,1,1,1), -- Nightseye +-- WOTLK Greens +(@WOTLK1,36917,0,1,1,1,2), -- Bloodstone +(@WOTLK1,36920,0,1,1,1,2), -- Sun Crystal +(@WOTLK1,36923,0,1,1,1,2), -- Chalcedony +(@WOTLK1,36926,0,1,1,1,2), -- Shadow Crystal +(@WOTLK1,36929,0,1,1,1,2), -- Huge Citrine +(@WOTLK1,36932,0,1,1,1,2), -- Dark Jade +-- WOTLK Blues +(@WOTLK2,36918,0,1,1,1,2), -- Scarlet Ruby +(@WOTLK2,36921,0,1,1,1,2), -- Autumn's Glow +(@WOTLK2,36924,0,1,1,1,2), -- Sky Sapphire +(@WOTLK2,36927,0,1,1,1,2), -- Twilight Opal +(@WOTLK2,36930,0,1,1,1,2), -- Monarch Topaz +(@WOTLK2,36933,0,1,1,1,2), -- Forest Emerald +-- WOTLK Epics +(@WOTLK3,36919,0,1,1,1,1), -- Cardinal Ruby +(@WOTLK3,36922,0,1,1,1,1), -- King's Amber +(@WOTLK3,36925,0,1,1,1,1), -- Majestic Zircon +(@WOTLK3,36928,0,1,1,1,1), -- Dreadstone +(@WOTLK3,36931,0,1,1,1,1), -- Ametrine +(@WOTLK3,36934,0,1,1,1,1); -- Eye of Zul +-- -------------------------------------------------------- +-- Prospecting Loot Templates +DELETE FROM `prospecting_loot_template` WHERE `entry` IN (@Copper,@Tin,@Iron,@Mithril,@Thorium,@FelIron,@Adamantite,@Cobalt,@Saronite,@Titanium); +INSERT INTO `prospecting_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES +-- Copper Ore +(@Copper,774,0,1,1,1,1), -- Malachite +(@Copper,818,0,1,1,1,1), -- Tigerseye +(@Copper,1210,10,1,0,1,1), -- Shadowgem +-- Tin Ore +(@Tin,1210,0,1,1,1,2), -- Shadowgem +(@Tin,1705,0,1,1,1,2), -- Lesser Moonstone +(@Tin,1206,0,1,1,1,2), -- Moss Agate +(@Tin,1,10,1,0,-@TinRef,1), -- One Rare gem chance +-- Iron Ore +(@Iron,1529,30,1,1,1,2), -- Jade +(@Iron,1705,30,1,1,1,2), -- Lesser Moonstone +(@Iron,3864,30,1,1,1,2), -- Citrine +(@Iron,7909,5,1,1,1,1), -- Aquamarine +(@Iron,7910,5,1,1,1,1), -- Star Ruby +-- Mithril Ore +(@Mithril,3864,30,1,1,1,2), -- Citrine +(@Mithril,7909,30,1,1,1,2), -- Aquamarine +(@Mithril,7910,30,1,1,1,2), -- Star Ruby +(@Mithril,12361,2.5,1,1,1,1), -- Blue Sapphire +(@Mithril,12364,2.5,1,1,1,1), -- Huge Emerald +(@Mithril,12799,2.5,1,1,1,1), -- Large Opal +(@Mithril,12800,2.5,1,1,1,1), -- Azerothian Diamond +-- Thorium Ore +(@Thorium,7910,30,1,1,1,2), -- Star Ruby +(@Thorium,12361,15,1,1,1,2), -- Blue Sapphire +(@Thorium,12364,15,1,1,1,2), -- Huge Emerald +(@Thorium,12799,15,1,1,1,2), -- Large Opal +(@Thorium,12800,15,1,1,1,2), -- Azerothian Diamond +(@Thorium,1,10,1,1,-@TBC1,1), -- one from TBC Greens +-- Fel Iron Ore +(@FelIron,1,95,1,1,-@TBC1,1), -- One from TBC Greens +(@FelIron,2,05,1,1,-@TBC2,1), -- One from TBC Blues +-- Adamantite Ore +(@Adamantite,24243,100,1,0,1,1), -- Adamantite Powder +(@Adamantite,1,100,1,1,-@TBC1,1), -- One from TBC Greens +(@Adamantite,2, 10,1,1,-@TBC2,1), -- One from TBC Blues +-- Cobalt Ore +(@Cobalt,1,95,1,1,-@WOTLK1,1), -- One from WOTLK Greens +(@Cobalt,2,05,1,1,-@WOTLK2,1), -- One from WOTLK Blues +-- Saronite Ore +(@Saronite,1,85,1,1,-@WOTLK1,2), -- One from WOTLK Greens +(@Saronite,2,15,1,1,-@WOTLK2,1), -- One from WOTLK Blues +-- Titanium Ore +(@Titanium,46849,75,1,0,1,1), -- Titanium Powder +(@Titanium,1,75,1,1,-@WOTLK1,2), -- Two from WOTLK Greens +(@Titanium,2,25,1,1,-@WOTLK2,1), -- One from WOTLK Blues +(@Titanium,3,20,1,0,-@WOTLK3,1); -- One from WOTLK Epics diff --git a/sql/updates/world/2012_04_23_03_world_skinning_loot_template.sql b/sql/updates/world/2012_04_23_03_world_skinning_loot_template.sql new file mode 100644 index 00000000000..a1aa9e070f2 --- /dev/null +++ b/sql/updates/world/2012_04_23_03_world_skinning_loot_template.sql @@ -0,0 +1,44 @@ +UPDATE `creature_template` SET `skinloot`=entry WHERE `entry` IN (30260, 32517, 27641, 28860); +UPDATE `creature_template` SET `skinloot`=70202 WHERE `entry` IN (25774,29693); +UPDATE `creature_template` SET `skinloot`=70203 WHERE `entry`=28257; +UPDATE `creature_template` SET `skinloot`=70207 WHERE `entry`=34137; +UPDATE `creature_template` SET `skinloot`=70208 WHERE `entry` IN (32572,25448,25716,25713); +UPDATE `creature_template` SET `skinloot`=70210 WHERE `entry` IN (33528,40419,26723,31134,36891); +UPDATE `creature_template` SET `skinloot`=70211 WHERE `entry` IN (28847,30206,29875,29931,28203,30432); +UPDATE `creature_template` SET `skinloot`=70212 WHERE `entry` IN (27645,32377,29838,26628,26622,32490,38453,32485,26633,32400,32361,29768,29735,26641,27644,27642,26735,26730,26722,33776,35189,26716,26672,29664,29774); +UPDATE `creature_template` SET `skinloot`=70213 WHERE `entry` IN (27483,29312); +UPDATE `creature_template` SET `skinloot`=70214 WHERE `entry` IN (37217,34564); +UPDATE `creature_template` SET `skinloot`=27641 WHERE `entry` IN (31385,34269,34270,27641,30905,30353); + +DELETE FROM `skinning_loot_template` WHERE entry IN (30260,32517,70212,70213,70214,28860,27641); +INSERT INTO `skinning_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +-- Stoic Mammoth +(30260,33568,100,0,1,3), -- Borean Leather +(30260,42542,-50,0,1,1), -- Stoic Mammoth Hide +-- Loque'nahak +(32517,33568,0,1,1,3), -- Borean Leather +(32517,44128,2,1,1,1), -- Arctic Fur +(32517,44687,100,0,1,1), -- Loque'Nahak's Pelt +-- skinloot 70212 +(70212,33568,0,1,1,3), -- Borean Leather +(70212,44128,1,1,1,1), -- Arctic Fur +-- skinloot 70213 +(70213,33568,0,1,5,12), -- Borean Leather +(70213,44128,1,1,1,1), -- Arctic Fur +-- skinloot 70214 +(70214,33568,0,1,12,16), -- Borean Leather +(70214,44128,25,1,1,1), -- Arctic Fur +-- Sartharion +(28860,33568,0,1,8,12), -- Borean Leather +(28860,38557,0,1,8,12),-- Icy Dragonscale +(28860,44128,1,1,1,1), -- Arctic Fur +-- Centrifuge Construct +(27641,41337,85,0,1,3), -- Whizzed-Out Gizmo +(27641,41338,80,0,1,3), -- Sprung Whirlygig +(27641,39690,15,0,1,3), -- Volatile Blasting Trigger +(27641,39684,8,0,1,1), -- Hair Trigger +(27641,36813,8,0,1,3), -- Sprung Sprocket +(27641,39681,8,0,2,4), -- Handful of Cobalt Bolts +(27641,49050,2,0,1,1), -- Schematic: Jeeves +(27641,39682,1,0,1,1), -- Overcharged Capacitor +(27641,39685,1,0,1,1); -- Indestructible Frame diff --git a/sql/updates/world/2012_04_23_04_world_creature_loot_template.sql b/sql/updates/world/2012_04_23_04_world_creature_loot_template.sql new file mode 100644 index 00000000000..94d2b092d12 --- /dev/null +++ b/sql/updates/world/2012_04_23_04_world_creature_loot_template.sql @@ -0,0 +1,2 @@ +-- Correct dropchance for Mote of Life, wowhead was wrong (as usual) +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=18.5307 WHERE `entry`=22307 AND `item`=22575; diff --git a/sql/updates/world/2012_04_23_05_world_creature_loot_template.sql b/sql/updates/world/2012_04_23_05_world_creature_loot_template.sql new file mode 100644 index 00000000000..ddf0780d362 --- /dev/null +++ b/sql/updates/world/2012_04_23_05_world_creature_loot_template.sql @@ -0,0 +1,3 @@ +-- Update the dropchance to 100% if on quest +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=-100 WHERE `entry`=21477 AND `item`=31372; -- Rocknail Flayer Carcass +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=-100 WHERE `entry`=21478 AND `item`=31373; -- Rocknail Flayer Giblets diff --git a/sql/updates/world/2012_04_24_00_world_command.sql b/sql/updates/world/2012_04_24_00_world_command.sql new file mode 100644 index 00000000000..25912392347 --- /dev/null +++ b/sql/updates/world/2012_04_24_00_world_command.sql @@ -0,0 +1,10 @@ +DELETE FROM `command` WHERE `name` IN ('modify tp','modify bwalk','modify swim','modify fly','modify arena','modify aspeed','modify morph'); +INSERT INTO `command` (`name`, `security`, `help`) VALUES ('modify speed all', 1, 'Syntax: .modify aspeed #rate\r\n\r\nModify all speeds -run,swim,run back,swim back- of the selected player to "normalbase speed for this move type"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify speed backwalk', 1, 'Syntax: .modify speed backwalk #rate\r\n\r\nModify the speed of the selected player while running backwards to "normal walk back speed"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify speed fly', 1, '.modify speed fly #rate\nModify the flying speed of the selected player to "normal flying speed"*rate. If no player is selected, modify your speed.\n #rate may range from 0.1 to 50.'), +('modify speed swim', 1, 'Syntax: .modify speed swim #rate\r\n\r\nModify the swim speed of the selected player to "normal swim speed"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify speed walk', 1, 'Syntax: .modify speed bwalk #rate\r\n\r\nModify the speed of the selected player while running to "normal walk speed"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify talentpoints', 1, 'Syntax: .modify talentpoints #amount\r\n\r\nSet free talent points for selected character or character\'s pet. It will be reset to default expected at next levelup/login/quest reward.'), +('morph', 2, 'Syntax: .morph #displayid\r\n\r\nChange your current model id to #displayid.'), +('modify arenapoints', 1, 'Syntax: .modify arenapoints #value\r\nAdd $amount arena points to the selected player.'); +UPDATE `command` SET `help`='Syntax: .modify speed $speedtype #rate\r\n\r\nModify the running speed of the selected player to "normal base run speed"= 1. If no player is selected, modify your speed.\r\n\r\n$speedtypes may be fly, all, walk, backwalk, or swim.\r\n\r\n #rate may range from 0.1 to 50.' WHERE `name`='modify speed' LIMIT 1; diff --git a/sql/updates/world/2012_04_24_01_world_spell_proc_event.sql b/sql/updates/world/2012_04_24_01_world_spell_proc_event.sql new file mode 100644 index 00000000000..6e997931bb5 --- /dev/null +++ b/sql/updates/world/2012_04_24_01_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +-- Honor Among Thieves proc chance +UPDATE `spell_proc_event` SET `CustomChance`=33 WHERE `entry`=51698; -- Rank 1 +UPDATE `spell_proc_event` SET `CustomChance`=66 WHERE `entry`=51700; -- Rank 2 +UPDATE `spell_proc_event` SET `CustomChance`=100 WHERE `entry`=51701; -- Rank 3 diff --git a/sql/updates/world/2012_04_24_02_world_warden_checks.sql b/sql/updates/world/2012_04_24_02_world_warden_checks.sql new file mode 100644 index 00000000000..74539f99fb3 --- /dev/null +++ b/sql/updates/world/2012_04_24_02_world_warden_checks.sql @@ -0,0 +1,8 @@ +UPDATE `warden_checks` SET `comment`='Swimming_FallCalc - movement state' WHERE `id`=15; +UPDATE `warden_checks` SET `comment`='CreateMovementStatus' WHERE `id`=72; +UPDATE `warden_checks` SET `comment`='OnStartSwim OnSplineStartSwim - movement state' WHERE `id`=170; +UPDATE `warden_checks` SET `comment`='DefaultServerLogin - account name' WHERE `id`=198; +UPDATE `warden_checks` SET `comment`='Login Checksum - authentication process' WHERE `id`=320; +UPDATE `warden_checks` SET `comment`='CalcFallStartElevation - (some kind of wall climb)' WHERE `id`=329; +UPDATE `warden_checks` SET `comment`='Code injection at 0x40100A' WHERE `id`=381; +UPDATE `warden_checks` SET `comment`='Login State - (May be false positive)' WHERE `id`=437; diff --git a/sql/updates/world/2012_04_24_03_world_spell_script_names.sql b/sql/updates/world/2012_04_24_03_world_spell_script_names.sql new file mode 100644 index 00000000000..a53d8bd585c --- /dev/null +++ b/sql/updates/world/2012_04_24_03_world_spell_script_names.sql @@ -0,0 +1,4 @@ +-- Earthen Power +DELETE FROM `spell_script_names` WHERE `spell_id`=59566; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(59566,'spell_sha_earthen_power'); diff --git a/sql/updates/world/2012_04_24_04_world_spell_proc_event.sql b/sql/updates/world/2012_04_24_04_world_spell_proc_event.sql new file mode 100644 index 00000000000..5ba6f24ccf8 --- /dev/null +++ b/sql/updates/world/2012_04_24_04_world_spell_proc_event.sql @@ -0,0 +1,4 @@ + -- Rogue T9 2P - Should proc only from Rupture ticks. +DELETE FROM `spell_proc_event` WHERE `entry` IN(67209); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `procFlags`) VALUES +(67209, 0x01, 8, 0x100000, 0x50000); diff --git a/sql/updates/world/2012_04_24_05_world_creature_loot_template.sql b/sql/updates/world/2012_04_24_05_world_creature_loot_template.sql new file mode 100644 index 00000000000..c524999b492 --- /dev/null +++ b/sql/updates/world/2012_04_24_05_world_creature_loot_template.sql @@ -0,0 +1,9 @@ +-- Apply same loot template to below mentioned Bloodsail NPCs as that of Bloodsail Raider 1561 +-- (Mage 1562, Swashbuckler 1563, Warlock 1564, Sea Dog 1565) +UPDATE `creature_template` SET `lootid`=1561 WHERE `entry` IN (1562,1563,1564,1565); +-- Remove Loot from `creature_loot_template` for above mentioned NPCs because it contains only 2 items. +-- Those 2 items, along with complete loot template for these mobs is applied in query above. +DELETE FROM `creature_loot_template` WHERE `entry` IN (1562,1563,1564,1565); +-- Remove loot and gold drop from Bloodsail Warlock's Minions +UPDATE `creature_template` SET `lootid`=0, `mingold`=0 AND `maxgold`=0 WHERE `entry` IN (10928,12922); +DELETE FROM `creature_loot_template` WHERE `entry` IN (10928,12922); diff --git a/sql/updates/world/2012_04_24_06_world_misc.sql b/sql/updates/world/2012_04_24_06_world_misc.sql new file mode 100644 index 00000000000..2e095a76cd9 --- /dev/null +++ b/sql/updates/world/2012_04_24_06_world_misc.sql @@ -0,0 +1,31 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` = 46485; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(46485,'spell_item_greatmothers_soulcatcher'); + +DELETE FROM `conditions` WHERE `SourceEntry` IN (46485,46488); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,1,46485,0,1,31,1,3,26817,0,0,0,'',''), +(13,1,46485,0,1,36,1,0,0,0,1,0,'',''), +(13,1,46488,0,1,31,1,3,26817,0,0,0,'',''), +(13,1,46488,0,1,36,1,0,0,0,1,0,'',''); + +-- Gnome Soul SAI +SET @ENTRY := 26096; +SET @SPELL_ARCANE_EXPLOSION := 35426; +UPDATE creature_template SET AIName="SmartAI" WHERE entry=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,1,54,0,100,0,0,0,0,0,33,@ENTRY,0,0,0,0,0,7,0,0,0,0,0,0,0,"Gnome Soul - On Just Summoned - Quest Credit"), +(@ENTRY,0,1,2,61,0,100,0,0,0,0,0,45,1,1,0,0,0,0,19,25814,10,1,0,0,0,0,"Gnome Soul - On Just Summoned - Set Data Fizzcrank Mechagnome"), +(@ENTRY,0,2,0,61,0,100,0,0,0,0,0,69,1,0,0,0,0,0,7,0,0,0,0,0,0,0,"Gnome Soul - On Just Summoned - Move to Summoner"), + +(@ENTRY,0,3,4,34,0,100,0,1,0,0,0,11,@SPELL_ARCANE_EXPLOSION,0,0,0,0,0,1,0,0,0,0,0,0,0,"Gnome Soul - Reached Summoner - Cast Arcane Explosion Visual"), +(@ENTRY,0,4,0,61,0,100,0,0,0,0,0,41,1000,0,0,0,0,0,1,0,0,0,0,0,0,0,"Gnome Soul - Reached Summoner - Forced Despawn"); + +-- Fizzcrank Mechagnome SAI +SET @ENTRY := 25814; +UPDATE creature_template SET AIName="SmartAI" WHERE entry=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,4,0,100,0,0,0,0,0,1,1,10000,0,0,0,0,0,0,0,0,0,0,0,0,"Fizzcrank Mechagnome - Chance Say on Aggro"), +(@ENTRY,1,0,0,38,0,100,0,1,1,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Fizzcrank Mechagnome - On Data Set - Forced Despawn"); diff --git a/sql/updates/world/2012_04_25_00_world_misc.sql b/sql/updates/world/2012_04_25_00_world_misc.sql new file mode 100644 index 00000000000..3d2f20fdc8c --- /dev/null +++ b/sql/updates/world/2012_04_25_00_world_misc.sql @@ -0,0 +1,3 @@ +UPDATE `smart_scripts` SET `source_type`=0,`id`=1 WHERE `entryorguid`=24814 AND `source_type`=1 AND `event_type`=38; +UPDATE `conditions` SET `SourceTypeOrReferenceId`=17 WHERE `SourceEntry` IN (46485,46488); +UPDATE `conditions` SET `ElseGroup`=0 WHERE `SourceEntry` IN (46485,46488) AND `ConditionValue1`=26817; diff --git a/sql/updates/world/2012_04_25_01_world_spell_script_names.sql b/sql/updates/world/2012_04_25_01_world_spell_script_names.sql new file mode 100644 index 00000000000..e42f1979229 --- /dev/null +++ b/sql/updates/world/2012_04_25_01_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` = 33110; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(33110,'spell_pri_prayer_of_mending_heal');
\ No newline at end of file diff --git a/sql/updates/world/2012_04_25_02_world_spell_script_names.sql b/sql/updates/world/2012_04_25_02_world_spell_script_names.sql new file mode 100644 index 00000000000..ea6b95559c6 --- /dev/null +++ b/sql/updates/world/2012_04_25_02_world_spell_script_names.sql @@ -0,0 +1,11 @@ +DELETE FROM `spell_scripts` WHERE `id` IN (15998,25952,29435,45980,51592,51910,52267,54420); +DELETE FROM `spell_script_names` WHERE `spell_id` IN (15998,25952,29435,45980,51592,51910,52267,54420); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(15998, 'spell_gen_despawn_self'), +(25952, 'spell_gen_despawn_self'), +(29435, 'spell_gen_despawn_self'), +(45980, 'spell_gen_despawn_self'), +(51592, 'spell_gen_despawn_self'), +(51910, 'spell_gen_despawn_self'), +(52267, 'spell_gen_despawn_self'), +(54420, 'spell_gen_despawn_self');
\ No newline at end of file diff --git a/sql/updates/world/2012_04_25_03_world_spell_group.sql b/sql/updates/world/2012_04_25_03_world_spell_group.sql new file mode 100644 index 00000000000..a6fa90ad41d --- /dev/null +++ b/sql/updates/world/2012_04_25_03_world_spell_group.sql @@ -0,0 +1,11 @@ +DELETE FROM `spell_group` WHERE `id` IN (1117,1118); +INSERT INTO `spell_group` (`id`,`spell_id`) VALUES +(1117,25898), +(1117,25899), +(1118,20911), +(1118,20217); + +DELETE FROM `spell_group_stack_rules` WHERE `group_id` in (1117,1118); +INSERT INTO `spell_group_stack_rules` (`group_id`,`stack_rule`) VALUES +(1117,3), +(1118,3); diff --git a/sql/updates/world/2012_04_26_00_world_conditions.sql b/sql/updates/world/2012_04_26_00_world_conditions.sql new file mode 100644 index 00000000000..8d525cad057 --- /dev/null +++ b/sql/updates/world/2012_04_26_00_world_conditions.sql @@ -0,0 +1 @@ +UPDATE `conditions` SET `ElseGroup` = 0, `SourceGroup` = 0 WHERE `SourceEntry` IN (46485,46488); diff --git a/sql/updates/world/2012_04_26_01_world_smart_scripts.sql b/sql/updates/world/2012_04_26_01_world_smart_scripts.sql new file mode 100644 index 00000000000..e90e7b58433 --- /dev/null +++ b/sql/updates/world/2012_04_26_01_world_smart_scripts.sql @@ -0,0 +1 @@ +UPDATE `smart_scripts` SET `source_type` = 0, `id` = 1 WHERE `entryorguid` = 25814 AND `source_type` = 1 AND `id` = 0; diff --git a/sql/updates/world/2012_04_27_00_world_instance_icc.sql b/sql/updates/world/2012_04_27_00_world_instance_icc.sql new file mode 100644 index 00000000000..6738e4904ab --- /dev/null +++ b/sql/updates/world/2012_04_27_00_world_instance_icc.sql @@ -0,0 +1,5 @@ +DELETE FROM `creature_text` WHERE `entry`=37813 AND `groupid`=14; +INSERT INTO `creature_text` (`entry`,`groupid`,`text`,`type`,`comment`) VALUES (37813,14,'%s''s Blood Beasts gain the scent of blood!',41,'Deathbringer Saurfang - EMOTE_SCENT_OF_BLOOD'); +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=72771; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`Comment`) VALUES +(13,3,72771,31,3,38508,'Deathbringer Saurfang - Scent of Blood on Blood Beast'); diff --git a/sql/updates/world/2012_04_28_00_world_reference_loot_template.sql b/sql/updates/world/2012_04_28_00_world_reference_loot_template.sql new file mode 100644 index 00000000000..b59ba90fdbc --- /dev/null +++ b/sql/updates/world/2012_04_28_00_world_reference_loot_template.sql @@ -0,0 +1,158 @@ +-- The Descent into Madness +-- References +-- ------------------------------- +-- -- Variables and definitions -- +-- ------------------------------- +-- Set References +SET @Vezax10Ref := 34373; +SET @Vezax25Ref := @Vezax10Ref+1; +SET @Yogg10Ref := @Vezax10Ref+2; +SET @Yogg25Ref := @Vezax10Ref+3; +SET @Chest := 12034; +SET @Shoulder := 12035; +SET @EmblemRef := 34349; +SET @Recipe := 34154; +SET @Vezax10 := 33271; +SET @Vezax25 := 33449; +SET @Yogg10 := 33288; +SET @Yogg25 := 33955; + +-- ------------------------- +-- -- Reference Templates -- +-- ------------------------- +-- Delete previous templates if existing +DELETE FROM `reference_loot_template` WHERE `entry` IN (34131,34132,34133,34164,34165); +DELETE FROM `reference_loot_template` WHERE `entry` IN (@Vezax10Ref,@Vezax25Ref,@Yogg10Ref,@Yogg25Ref,@Chest,@Shoulder); +INSERT INTO `reference_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES +-- Vezax 10 man +(@Vezax10Ref,46014,0,1,1,1,1), -- Saronite Animus Cloak +(@Vezax10Ref,46008,0,1,1,1,1), -- Choker of the Abyss +(@Vezax10Ref,46010,0,1,1,1,1), -- Darkstone Ring +(@Vezax10Ref,45996,0,1,1,1,1), -- Hoperender +(@Vezax10Ref,46015,0,1,1,1,1), -- Pendant of Endless Despair +(@Vezax10Ref,46013,0,1,1,1,1), -- Underworld Mantle +(@Vezax10Ref,46012,0,1,1,1,1), -- Vestments of the Piercing Light +(@Vezax10Ref,46009,0,1,1,1,1), -- Bindings of the Depths +(@Vezax10Ref,45997,0,1,1,1,1), -- Gauntlets of the Wretched +(@Vezax10Ref,46011,0,1,1,1,1), -- Shadowbite +-- Vezax 25 man +(@Vezax25Ref,45513,0,1,1,1,1), -- Boots of the Forgotten Dephts +(@Vezax25Ref,45509,0,1,1,1,1), -- Idol of the Corruptor +(@Vezax25Ref,45501,0,1,1,1,1), -- Boots of the Underdweller +(@Vezax25Ref,45512,0,1,1,1,1), -- Grips of the Unbroken +(@Vezax25Ref,45503,0,1,1,1,1), -- Metallic Loop of the Sufferer +(@Vezax25Ref,45505,0,1,1,1,1), -- Belt of Clinging Hope +(@Vezax25Ref,45502,0,1,1,1,1), -- Helm of the Faceless +(@Vezax25Ref,45145,0,1,1,1,1), -- Libram of the Sacred Shield +(@Vezax25Ref,45508,0,1,1,1,1), -- Belt of the Darkspeaker +(@Vezax25Ref,45504,0,1,1,1,1), -- Darkcore Leggings +(@Vezax25Ref,45514,0,1,1,1,1), -- Mantle of the Unknowing +(@Vezax25Ref,45515,0,1,1,1,1), -- Ring of the Vacant Eye +(@Vezax25Ref,45507,0,1,1,1,1), -- The General's Heart +-- Yogg 10 man +(@Yogg10Ref,46016,0,1,1,1,1), -- Abaddon +(@Yogg10Ref,46018,0,1,1,1,1), -- Deliverance +(@Yogg10Ref,46019,0,1,1,1,1), -- Leggings of the Insatiable +(@Yogg10Ref,46021,0,1,1,1,1), -- Royal Seal of King Llane +(@Yogg10Ref,46022,0,1,1,1,1), -- Pendant of a Thousand Maws +(@Yogg10Ref,46024,0,1,1,1,1), -- Kingsbane +(@Yogg10Ref,46025,0,1,1,1,1), -- Devotion +(@Yogg10Ref,46028,0,1,1,1,1), -- Faceguard of the Eyeless Horror +(@Yogg10Ref,46030,0,1,1,1,1), -- Threads of the Dragon Council +(@Yogg10Ref,46031,0,1,1,1,1), -- Touch of Madness +-- Yogg 25 man +(@Yogg25Ref,45521,0,1,1,1,1), -- Earthshaper +(@Yogg25Ref,45522,0,1,1,1,1), -- Blood of the Old God +(@Yogg25Ref,45523,0,1,1,1,1), -- Garona's Guise +(@Yogg25Ref,45524,0,1,1,1,1), -- Chestguard of Insidious Intent +(@Yogg25Ref,45525,0,1,1,1,1), -- Godbane Signet +(@Yogg25Ref,45527,0,1,1,1,1), -- Soulscribe +(@Yogg25Ref,45529,0,1,1,1,1), -- Shawl of Haunted Memories +(@Yogg25Ref,45530,0,1,1,1,1), -- Sanity's Bond +(@Yogg25Ref,45531,0,1,1,1,1), -- Chestguard of the Fallen God +(@Yogg25Ref,45532,0,1,1,1,1), -- Cowl of Dark Whispers +-- Chest for Yogg +(@Chest,45635,0,1,1,1,1), -- Chestguard of the Wayward Conqueror +(@Chest,45636,0,1,1,1,1), -- Chestguard of the Wayward Protector +(@Chest,45637,0,1,1,1,1), -- Chestguard of the Wayward Vanquisher +(@Shoulder,45656,0,1,1,1,1), -- Mantle of the Wayward Conqueror +(@Shoulder,45657,0,1,1,1,1), -- Mantle of the Wayward Protector +(@Shoulder,45658,0,1,1,1,1); -- Mantle of the Wayward Vanquisher + +DELETE FROM `creature_loot_template` WHERE `entry` IN(@Vezax10,@Vezax25,@Yogg10,@Yogg25); +INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES +-- ---------------------------------------------------------- +-- General Vezax +-- ---------------------------------------------------------- +-- 10 man mode +(@Vezax10,1,100,3,0,-@Vezax10Ref,2), -- 2x Normal Loot Item +(@Vezax10,47241,100,3,0,1,1), -- 1x Emblem of Triumph +-- hardmode loot 10 +(@Vezax10,46032,0,2,1,1,1), -- Drape of the Faceless General +(@Vezax10,46034,0,2,1,1,1), -- Leggings of Profound Darkness +(@Vezax10,46033,0,2,1,1,1), -- Tortured Earth +(@Vezax10,46035,0,2,1,1,1), -- Aesuga, Hand of the Ardent Champion +(@Vezax10,46036,0,2,1,1,1), -- Void Sabre +-- 25 man mode +(@Vezax25,1,100,3,0,-@Vezax25Ref,3), -- 3x Normal Loot Item +(@Vezax25,47241,100,3,0,1,1), -- 1x Emblem of Triumph +(@Vezax25,2,10,1,0,-@Recipe,1), -- Chance on Recipe +(@Vezax25,3,10,1,0,-34350,1), -- Chance on Runed Orb +-- hardmode loot 25 +(@Vezax25,45498,0,2,1,1,1), -- Lotrafen, Spear of the Damned +(@Vezax25,45511,0,2,1,1,1), -- Scepter of Lost Souls +(@Vezax25,45516,0,2,1,1,1), -- Voldrethar, Dark Blade of Oblivion +(@Vezax25,45517,0,2,1,1,1), -- Pendulum of Infinity +(@Vezax25,45519,0,2,1,1,1), -- Vestments of the Blind Denizen +(@Vezax25,45518,0,2,1,1,1), -- Flare of the Heavens +(@Vezax25,45520,0,2,1,1,1), -- Handwraps of the Vigilant +-- ---------------------------------------------------------- +-- Yogg Saron +-- ---------------------------------------------------------- +-- 10 man +-- All modes +(@Yogg10,1,100,31,0,-@Yogg10Ref,1), -- 1x Normal Loot item for modes 0&1&2&3&4 +(@Yogg10,2,100,31,0,-@Chest,1), -- 1x Tier token for modes 0&1&2&3&4 +(@Yogg10,47241,100,31,0,1,1), -- 1x Emblem of Triumph for modes 0&1&2&3&4 +-- Extra for <3 watchers +(@Yogg10,3,100,30,0,-@EmblemRef,1), -- additional Emblem for modes2&3 +-- Extra for <2 watchers +(@Yogg10,4,100,28,0,-34350,1), -- Runed Orb for 0&1&2 +(@Yogg10,5,10,28,0,-@Recipe,1), -- Chance on Recipe for 0&1&2 +-- Extra for <1 watchers +(@Yogg10,6,100,24,0,-@EmblemRef,1), -- additional Emblem for 0&1 +(@Yogg10,7,100,24,0,-@Recipe,1), -- Garanteed Recipe for 0&1 +-- Hardmode 10 loot +(@Yogg10,46067,0,24,1,1,1), -- Hammer of Crushing Whispers +(@Yogg10,46068,0,24,1,1,1), -- Amice of Inconceivable Horror +(@Yogg10,46095,0,24,1,1,1), -- Soul-Devouring Cinch +(@Yogg10,46096,0,24,1,1,1), -- Signet of Soft Lament +(@Yogg10,46097,0,24,1,1,1), -- Caress of Insanity +-- Extra for 0 watchers +(@Yogg10,46312,100,16,0,1,1), -- Vanquished Clutches of Yogg-Saron +-- 25 man mode +-- All modes +(@Yogg25,1,100,31,0,-@Yogg25Ref,2), -- 2x Normal Loot item for modes 0&1&2&3&4 +(@Yogg25,2,100,31,0,-@Shoulder,2), -- 2x Tier token for modes 0&1&2&3&4 +(@Yogg25,47241,100,31,0,1,1), -- 1x Emblem of Triumph for modes 0&1&2&3&4 +(@Yogg25,3,10,31,0,-34350,1), -- Chance on Runed Orb for modes 0&1&2&3&4 +(@Yogg25,4,10,31,0,-@Recipe,1), -- Chance on Recipe for 0&1&2&3&4 +(@Yogg25,45897,100,31,0,1,1), -- Fragment of Val'anyr +-- Extra for <3 watchers +(@Yogg25,5,100,30,0,-@EmblemRef,1), -- additional Emblem for modes2&3 +-- Extra for <2 watchers +(@Yogg25,6,100,28,0,-34350,1), -- Runed Orb for 0&1&2 +-- Extra for <1 watchers +(@Yogg25,7,100,24,0,-@EmblemRef,1), -- additional Emblem for 0&1 +(@Yogg25,8,100,24,0,-@Recipe,1), -- Garanteed Recipe for 0&1 +-- Hardmode 25 loot +(@Yogg25,45533,0,24,1,1,1), -- Dark Edge of Depravity +(@Yogg25,45534,0,24,1,1,1), -- Seal of the Betrayed King +(@Yogg25,45535,0,24,1,1,1), -- Show of Faith +(@Yogg25,45536,0,24,1,1,1), -- Legguards of Cunning Deception +(@Yogg25,45537,0,24,1,1,1), -- Threads of the False Oracle +-- Extra for 0 watchers +(@Yogg25,45693,100,16,0,1,1); -- Mimiron's Head + +-- Cleanups +DELETE FROM `conditions` WHERE `SourceEntry`=45897 AND `SourceGroup`=33955;
\ No newline at end of file diff --git a/sql/updates/world/2012_04_28_01_world_reference_loot_template.sql b/sql/updates/world/2012_04_28_01_world_reference_loot_template.sql new file mode 100644 index 00000000000..e46c45e497a --- /dev/null +++ b/sql/updates/world/2012_04_28_01_world_reference_loot_template.sql @@ -0,0 +1,22 @@ +SET @Triumph :=47241; +-- Cleanup some unneeded references +DELETE FROM `reference_loot_template` WHERE `entry` IN (34167,34168,34169); +UPDATE `creature_loot_template` SET `mincountOrRef`=-34349 WHERE `mincountOrRef` IN (-34167,-34168,-34169); +-- Fix this weird defined reference for ulduar +UPDATE `reference_loot_template` SET `ChanceOrQuestChance`=100,`groupid`=0 WHERE `entry`=34349; +-- Remove Emblem of Triumph from reference_loot +DELETE FROM `reference_loot_template` WHERE `item`=@Triumph AND `entry`IN (12025,35034,35040,35049); +-- Actual Emblem on creature as it should be +DELETE FROM `creature_loot_template` WHERE `entry` IN (30397,30398,31365,31367,31656,31679) AND `item`=@Triumph; +INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES +(30397,@Triumph,100,1,0,1,1), -- Commander Kolurg (1) +(30398,@Triumph,100,1,0,1,1), -- Commander Stoutbeard (1) +(31365,@Triumph,100,1,0,1,1), -- Drakkari Colossus (1) +(31367,@Triumph,100,1,0,1,1), -- Drakkari Elemental (1) +(31656,@Triumph,100,1,0,1,1), -- Dalronn the Controller (1) +(31679,@Triumph,100,1,0,1,1); -- Skarvald the Constructor (1) +-- Similar action for gameobjects +DELETE FROM `gameobject_loot_template` WHERE `entry` IN (27416,27417) AND `item`=@Triumph; +INSERT INTO `gameobject_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES +(27417,@Triumph,100,1,0,1,1), -- Confessor's Cache +(27416,@Triumph,100,1,0,1,1); -- Eadric's Cache diff --git a/sql/updates/world/2012_05_01_00_world_creature.sql b/sql/updates/world/2012_05_01_00_world_creature.sql new file mode 100644 index 00000000000..c0509d0d132 --- /dev/null +++ b/sql/updates/world/2012_05_01_00_world_creature.sql @@ -0,0 +1,9 @@ +-- Add missing Challe & Orphan Matron Aria Spawns +SET @GUID := 41876; +DELETE FROM `creature` WHERE `guid` BETWEEN @GUID AND @GUID+1; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`) VALUES +(@GUID,23101,530,1,1,0,0,-480.4989,7499.029,181.2889,3.560472,120,0,0,1,0,0), +(@GUID+1,34365,571,1,1,0,0,5716.604,642.8611,646.2927,5.88176,120,0,0,1,0,0); +-- Add to game event creature +DELETE FROM `game_event_creature` WHERE `guid`=@GUID+1; +INSERT INTO `game_event_creature` (`eventEntry`,`guid`) VALUES (10,@GUID+1); diff --git a/sql/updates/world/2012_05_02_00_world_creature_loot_template.sql b/sql/updates/world/2012_05_02_00_world_creature_loot_template.sql new file mode 100644 index 00000000000..f0721e63635 --- /dev/null +++ b/sql/updates/world/2012_05_02_00_world_creature_loot_template.sql @@ -0,0 +1,8 @@ +DELETE FROM `creature_loot_template` WHERE `entry` IN(38064,38103); +INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES +-- Precious 25 man +(38103,1,100,1,0,-35069,2), -- Two From ICC Trashgenerated on Precious +(38103,52019,30,1,0,1,1), -- Precious Ribbon on Precious +(38064,1,100,1,0,-35069,2); -- Two From ICC Trashgenerated on Stinky +-- add skinning loot for Stinky & Precious +UPDATE `creature_template` SET `skinloot`=70214 WHERE `entry` IN (37025,38064,37217,38103); diff --git a/sql/updates/world/2012_05_03_00_world_creature.sql b/sql/updates/world/2012_05_03_00_world_creature.sql new file mode 100644 index 00000000000..d906dba78bc --- /dev/null +++ b/sql/updates/world/2012_05_03_00_world_creature.sql @@ -0,0 +1,29 @@ +SET @GUID1 := 42158; +SET @GUID2 := 42159; +-- add creature +DELETE FROM creature WHERE guid IN (@GUID1,@GUID2); +INSERT INTO `creature` +(`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`) +VALUES +(@GUID1 ,38453,571,1,1,3561.821,-2736.367,136.0317,0), -- Arcturis in Grizzly Hills +(@GUID2,35189,571,1,1,7101.845,-1443.734,924.2609,0.178631); -- Skoll in The Storm Peaks +-- Update template +UPDATE `creature_template` SET `faction_A` = 190, `faction_H`=190 WHERE `entry` IN (38453,35189); +SET @NPC= @GUID1*10; +-- Add pathing for Arcturis +DELETE FROM `creature_addon` WHERE `guid` = @GUID1; +INSERT INTO `creature_addon` (`guid`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(@GUID1,@NPC,0,0,0,0,''); -- Add path for Acturis +-- Add waypoint data for the path: +DELETE FROM `waypoint_data` WHERE `id`=@NPC; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`) VALUES +(@NPC,1,3563.499,-2737.698,137.1898), +(@NPC,2,3565.249,-2738.698,138.4398), +(@NPC,3,3566.749,-2739.948,139.9398), +(@NPC,4,3568.249,-2740.698,140.6898), +(@NPC,5,3567.839,-2741.380,141.9256), +(@NPC,6,3569.999,-2741.948,142.1898), +(@NPC,7,3570.749,-2742.448,143.1898), +(@NPC,8,3572.676,-2743.528,144.8479); +-- Spawntimefix +UPDATE `creature` SET `spawntimesecs`=39600 WHERE `guid` IN (@GUID1,@GUID2); -- Set the spawntime to 11 hours for Arcturis & Skoll diff --git a/sql/updates/world/2012_05_03_01_world_cos_misc.sql b/sql/updates/world/2012_05_03_01_world_cos_misc.sql new file mode 100644 index 00000000000..6c2ea6d3a95 --- /dev/null +++ b/sql/updates/world/2012_05_03_01_world_cos_misc.sql @@ -0,0 +1,153 @@ +UPDATE `script_texts` SET `emote` = 432 WHERE `entry` IN (-1595111); +UPDATE `script_texts` SET `emote` = 396 WHERE `entry` IN (-1595070,-1595075,-1595078,-1595079,-1595088,-1595103,-1595106,-1595107,-1595108,-1595109,-1595113,-1595114,-1595115,-1595116); +UPDATE `script_texts` SET `emote` = 397 WHERE `entry` IN (-1595071,-1595084,-1595093); +UPDATE `script_texts` SET `emote` = 274 WHERE `entry` IN (-1595091); +UPDATE `script_texts` SET `emote` = 5 WHERE `entry` IN (-1595073,-1595118); +UPDATE `script_texts` SET `emote` = 6 WHERE `entry` IN (-1595076); +UPDATE `script_texts` SET `emote` = 1 WHERE `entry` IN (-1595083,-1595100,-1595104,-1595120); +UPDATE `script_texts` SET `emote` = 0 WHERE `entry` IN (-1595009,-1595010,-1595081,-1595082,-1595085,-1595119); + +UPDATE `script_texts` SET `type` = 1 WHERE `entry` IN (-1595009,-1595010,-1595087,-1595094,-1595095,-1595093); +UPDATE `script_texts` SET `type` = 0 WHERE `entry` IN (-1595077,-1595078,-1595119); + +UPDATE `script_texts` SET `content_default` = "Champions, meet me at the Town Hall at once. We must take the fight to Mal'Ganis." WHERE `entry` = -1595095; +UPDATE `script_texts` SET `content_default` = "Follow me, I know the way through." WHERE `entry` = -1595096; +UPDATE `script_texts` SET `content_default` = "Take position here, and I will lead a small force inside Stratholme to begin the culling. We must contain and purge the infected for the sake of all of Lordaeron!" WHERE entry = -1595087; +UPDATE `script_texts` SET `content_default` = "Ah, you've finally arrived Prince Arthas. You're here just in the nick of time." WHERE `entry` = -1595097; +UPDATE `script_texts` SET `content_default` = "Yes, I'm glad I could get to you before the plague." WHERE `entry` = -1595098; +UPDATE `script_texts` SET `content_default` = "As if I could forget. Listen, Uther, there's something about the plague you should know..." WHERE `entry` = -1595072; +UPDATE `script_texts` SET `content_default` = "There's no need for you to understand, Arthas. All you need to do is die." WHERE `entry` = -1595100; +UPDATE `script_texts` SET `content_default` = "More vile sorcery! Be ready for anything!" WHERE `entry` = -1595102; +UPDATE `script_texts` SET `content_default` = "Watch your backs: they have us surrounded in this hall." WHERE `entry` = -1595104; +UPDATE `script_texts` SET `content_default` = "Mal'Ganis is not making this easy." WHERE `entry` = -1595106; +UPDATE `script_texts` SET `content_default` = "What else can he put in my way?" WHERE `entry` = -1595108; +UPDATE `script_texts` SET `content_default` = "I do what I must for Lordaeron, and neither your words nor your actions will stop me." WHERE `entry` = -1595109; +UPDATE `script_texts` SET `content_default` = "The quickest path to Mal'Ganis lies behind that bookshelf ahead." WHERE `entry` = -1595110; +UPDATE `script_texts` SET `content_default` = "I'm relieved this secret passage still works." WHERE `entry` = -1595112; +UPDATE `script_texts` SET `content_default` = "Let's move through here as quickly as possible. If the undead don't kill us, the fires might." WHERE `entry` = -1595113; +UPDATE `script_texts` SET `content_default` = "Rest a moment and clear your lungs, but we must move again soon." WHERE `entry` = -1595114; +UPDATE `script_texts` SET `content_default` = "That's enough; we must move again. Mal'Ganis awaits." WHERE `entry` = -1595115; +UPDATE `script_texts` SET `content_default` = "At last some good luck. Market Row has not caught fire yet. Mal'Ganis is supposed to be in Crusaders' Square, which is just ahead. Tell me when you're ready to move forward." WHERE `entry` = -1595116; +UPDATE `script_texts` SET `content_default` = "Justice will be done." WHERE `entry` = -1595117; +UPDATE `script_texts` SET `content_default` = "We're going to finish this right now, Mal'Ganis. Just you... and me." WHERE `entry` = -1595118; + +UPDATE `script_texts` SET `comment` = concat(`comment`,". NEEDS VERIFICATION") WHERE `entry` IN (-1595101,-1595105); + +SET @GUID := 88474; +INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, +`MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) +VALUES +(@GUID+00,27737,595,3,1,25543,0,2319.89,1285.78,131.407,1.72169,60,10,0,630,0,1,0,0,0), +(@GUID+01,27737,595,3,1,10979,0,2308.12,1304.21,127.601,4.39662,60,10,0,630,0,1,0,0,0), +(@GUID+02,27737,595,3,1,25542,0,2335.47,1262.04,132.921,1.42079,60,10,0,630,0,1,0,0,0), +(@GUID+03,27737,595,3,1,25543,0,2297.73,1338.75,124.622,2.5574,60,10,0,630,0,1,0,0,0), +(@GUID+04,27737,595,3,1,10979,0,2322.65,1265.39,133.033,5.6524,60,10,0,630,0,1,0,0,0), +(@GUID+05,27737,595,3,1,10973,0,2277.83,1331.92,124.19,3.48045,60,10,0,630,0,1,0,0,0), +(@GUID+06,27737,595,3,1,25543,0,2294.18,1316.93,125.672,6.05649,60,10,0,630,0,1,0,0,0), +(@GUID+07,27737,595,3,1,10973,0,2310.56,1369,128.372,5.03364,60,10,0,630,0,1,0,0,0), +(@GUID+08,27737,595,3,1,10979,0,2306.15,1322.85,125.708,4.99133,60,10,0,630,0,1,0,0,0), +(@GUID+09,27737,595,3,1,10973,0,2320.14,1297.48,129.694,1.35248,60,10,0,630,0,1,0,0,0), +(@GUID+10,27737,595,3,1,25542,0,2291.57,1327.27,124.545,5.32358,60,10,0,630,0,1,0,0,0), +(@GUID+11,27737,595,3,1,25542,0,2308.04,1352.65,126.907,5.83741,60,10,0,630,0,1,0,0,0), +(@GUID+12,27737,595,3,1,10979,0,2329.44,1281.11,132.636,2.25207,60,10,0,630,0,1,0,0,0), +(@GUID+13,27737,595,3,1,0,0,2407.32,1423.8,131.522,6.24743,60,10,0,706,0,1,0,0,0), +(@GUID+14,27737,595,3,1,0,0,2417.26,1428.41,131.652,6.20423,60,10,0,730,0,1,0,0,0), +(@GUID+15,27737,595,3,1,0,0,2420.48,1419.99,130.716,0.0977616,60,10,0,706,0,1,0,0,0), +(@GUID+16,27737,595,3,1,0,0,2426.63,1413.41,130.464,0.404064,60,10,0,730,0,1,0,0,0), +(@GUID+17,27737,595,3,1,0,0,2430.46,1417.6,130.557,0.125247,60,10,0,730,0,1,0,0,0), +(@GUID+18,27737,595,3,1,0,0,2433.94,1427.03,131.18,0.0584885,60,10,0,706,0,1,0,0,0), +(@GUID+19,27737,595,3,1,0,0,2446.5,1428.37,131.013,6.10606,60,10,0,756,0,1,0,0,0), +(@GUID+20,27737,595,3,1,0,0,2449.49,1423.35,130.588,5.77619,60,10,0,706,0,1,0,0,0), +(@GUID+21,27737,595,3,1,0,0,2441.92,1424.41,130.606,6.07857,60,10,0,706,0,1,0,0,0), +(@GUID+22,27737,595,3,1,0,0,2450.6,1438.61,132.213,4.74889,60,10,0,730,0,1,0,0,0), +(@GUID+23,27737,595,3,1,0,0,2460.17,1436.46,131.501,4.73711,60,10,0,756,0,1,0,0,0), +(@GUID+24,27737,595,3,1,0,0,2444.68,1421.68,130.324,6.01338,60,10,0,756,0,1,0,0,0), +(@GUID+25,27737,595,3,1,0,0,2456.87,1419.07,130.488,5.39763,60,10,0,706,0,1,0,0,0), +(@GUID+26,27737,595,3,1,0,0,2464.27,1422.15,130.976,5.22092,60,10,0,756,0,1,0,0,0), +(@GUID+27,27737,595,3,1,0,0,2468.21,1403.06,130.39,5.6364,60,10,0,756,0,1,0,0,0), +(@GUID+28,27737,595,3,1,0,0,2460.88,1406.8,130.508,5.96234,60,10,0,756,0,1,0,0,0), +(@GUID+29,27737,595,3,1,0,0,2485.77,1398.35,130.795,4.71591,60,10,0,756,0,1,0,0,0), +(@GUID+30,27737,595,3,1,0,0,2485.79,1380.46,130.15,5.02928,60,10,0,730,0,1,0,0,0), +(@GUID+31,27737,595,3,1,0,0,2475.77,1396.31,130.124,4.84079,60,10,0,730,0,1,0,0,0), +(@GUID+32,27737,595,3,1,0,0,2476.92,1387.21,129.401,5.05128,60,10,0,730,0,1,0,0,0), +(@GUID+33,27737,595,3,1,0,0,2483.24,1389.37,130.123,4.74104,60,10,0,730,0,1,0,0,0), +(@GUID+34,27737,595,3,1,0,0,2480.2,1370.15,129.533,5.79583,60,10,0,706,0,1,0,0,0), +(@GUID+35,27737,595,3,1,0,0,2481.54,1375.11,129.642,5.4644,60,10,0,730,0,1,0,0,0), +(@GUID+36,27737,595,3,1,0,0,2489.44,1359.42,131.233,5.378,60,10,0,730,0,1,0,0,0), +(@GUID+37,27737,595,3,1,0,0,2486.59,1356.19,131.876,5.7275,60,10,0,756,0,1,0,0,0), +(@GUID+38,27737,595,3,1,0,0,2495.53,1348.61,133.072,5.52722,60,10,0,730,0,1,0,0,0), +(@GUID+39,27737,595,3,1,0,0,2504.48,1349.65,132.856,5.11881,60,10,0,730,0,1,0,0,0), +(@GUID+40,27737,595,3,1,0,0,2493.11,1380.29,130.24,4.93189,60,10,0,706,0,1,0,0,0), +(@GUID+41,27737,595,3,1,0,0,2487.18,1392.64,130.512,4.93818,60,10,0,706,0,1,0,0,0), +(@GUID+42,27737,595,3,1,0,0,2506.49,1336.89,132.794,5.19343,60,10,0,756,0,1,0,0,0), +(@GUID+43,27737,595,3,1,0,0,2518.2,1306.39,130.623,4.81723,60,10,0,756,0,1,0,0,0), +(@GUID+44,27737,595,3,1,0,0,2513.4,1299.67,130.868,4.4206,60,10,0,756,0,1,0,0,0), +(@GUID+45,27737,595,3,1,0,0,2511.45,1291.47,130.808,5.00729,60,10,0,756,0,1,0,0,0), +(@GUID+46,27737,595,3,1,0,0,2518.56,1292.32,130.528,5.16438,60,10,0,756,0,1,0,0,0), +(@GUID+47,27737,595,3,1,0,0,2515.49,1279.85,129.214,5.28847,60,10,0,730,0,1,0,0,0), +(@GUID+48,27737,595,3,1,0,0,2514.37,1285.92,129.934,5.70473,60,10,0,706,0,1,0,0,0), +(@GUID+49,27737,595,3,1,0,0,2522.65,1274.29,128.576,5.44634,60,10,0,706,0,1,0,0,0), +(@GUID+50,27737,595,3,1,0,0,2535.38,1275.77,127.42,5.49817,60,10,0,756,0,1,0,0,0), +(@GUID+51,27737,595,3,1,0,0,2537.59,1273.1,127.05,5.02693,60,10,0,730,0,1,0,0,0), +(@GUID+52,27737,595,3,1,0,0,2547.49,1261.7,126.44,4.78425,60,10,0,730,0,1,0,0,0), +(@GUID+53,27737,595,3,1,0,0,2534.36,1261.06,127.125,4.3994,60,10,0,756,0,1,0,0,0), +(@GUID+54,27737,595,3,1,0,0,2532.69,1251.44,127.452,5.4479,60,10,0,730,0,1,0,0,0), +(@GUID+55,27737,595,3,1,0,0,2551.84,1252.35,125.455,5.04342,60,10,0,706,0,1,0,0,0), +(@GUID+56,27737,595,3,1,0,0,2536.1,1244,126.928,5.16515,60,10,0,756,0,1,0,0,0), +(@GUID+57,27737,595,3,1,0,0,2543.63,1247.23,126.131,5.19735,60,10,0,706,0,1,0,0,0), +(@GUID+58,27737,595,3,1,0,0,2554.21,1238.95,125.475,4.64836,60,10,0,730,0,1,0,0,0), +(@GUID+59,27737,595,3,1,0,0,2548.89,1227.37,126.375,5.31517,60,10,0,756,0,1,0,0,0), +(@GUID+60,27737,595,3,1,0,0,2560.46,1225.4,125.496,4.85335,60,10,0,706,0,1,0,0,0), +(@GUID+61,27737,595,3,1,0,0,2555.11,1218.55,125.944,5.11646,60,10,0,730,0,1,0,0,0), +(@GUID+62,27737,595,3,1,0,0,2561.91,1211.56,125.38,5.5877,60,10,0,730,0,1,0,0,0), +(@GUID+63,27737,595,3,1,0,0,2568.67,1202.96,125.509,4.96095,60,10,0,756,0,1,0,0,0), +(@GUID+64,27737,595,3,1,0,0,2571.93,1193.48,125.619,5.07641,60,10,0,756,0,1,0,0,0), +(@GUID+65,27737,595,3,1,0,0,2577.77,1180.88,125.562,4.64522,60,10,0,756,0,1,0,0,0), +(@GUID+66,27737,595,3,1,0,0,2574.2,1166.63,126.089,4.44966,60,10,0,706,0,1,0,0,0), +(@GUID+67,27737,595,3,1,0,0,2564.78,1166.82,127.092,4.2266,60,10,0,756,0,1,0,0,0), +(@GUID+68,27737,595,3,1,0,0,2577.56,1158.41,126.385,4.07738,60,10,0,756,0,1,0,0,0), +(@GUID+69,27737,595,3,1,0,0,2567.93,1176.56,126.2,4.7489,60,10,0,706,0,1,0,0,0), +(@GUID+70,27737,595,3,1,0,0,2559.28,1189.46,126.642,4.73319,60,10,0,756,0,1,0,0,0), +(@GUID+71,27737,595,3,1,0,0,2554.14,1213.37,126.599,5.13845,60,10,0,706,0,1,0,0,0), +(@GUID+72,27737,595,3,1,0,0,2560.58,1218.48,125.281,4.97351,60,10,0,730,0,1,0,0,0), +(@GUID+73,27737,595,3,1,0,0,2570.2,1170.58,126.311,4.64365,60,10,0,756,0,1,0,0,0), +(@GUID+74,27729,595,3,1,0,0,2496.57,1354.66,132.217,5.13691,120,5,0,63000,0,1,0,0,0), +(@GUID+75,27729,595,3,1,0,0,2494.22,1365.17,130.812,5.15654,120,5,0,63000,0,1,0,0,0), +(@GUID+76,27729,595,3,1,0,0,2440.41,1434.46,131.456,5.69372,120,5,0,63000,0,1,0,0,0), +(@GUID+77,27729,595,3,1,0,0,2433.18,1421.13,130.644,0.046706,120,5,0,63000,0,1,0,0,0), +(@GUID+78,27734,595,3,1,0,0,2546.07,1239.17,125.945,5.07801,120,5,0,63000,0,1,0,0,0), +(@GUID+79,27734,595,3,1,0,0,2458.58,1426.22,131.056,5.42984,120,5,0,63000,0,1,0,0,0), +(@GUID+80,27736,595,3,1,0,0,2488.11,1364.91,130.402,5.35524,120,5,0,130330,0,1,0,0,0), +(@GUID+81,28199,595,3,1,0,0,2527.63,1267.59,128.168,5.12906,120,5,0,63000,0,1,0,0,0), +(@GUID+82,28199,595,3,1,0,0,2528.06,1284.34,128.877,5.14869,120,5,0,63000,0,1,0,0,0), +(@GUID+83,28199,595,3,1,0,0,2466.27,1414.57,130.977,5.18637,120,5,0,63000,0,1,0,0,0), +(@GUID+84,28200,595,3,1,0,0,2570.51,1181.4,125.809,4.61855,120,5,0,50400,44070,1,0,0,0), +(@GUID+85,28200,595,3,1,0,0,2560.45,1202.05,126.031,4.85417,120,5,0,50400,44070,1,0,0,0), +(@GUID+86,28200,595,3,1,0,0,2487.85,1373.29,130.236,5.078,120,5,0,50400,44070,1,0,0,0), +(@GUID+87,28200,595,3,1,0,0,2416.7,1416.52,130.379,0.191224,120,5,0,50400,44070,1,0,0,0), +(@GUID+88,28200,595,3,1,0,0,2424.42,1422.68,130.868,0.25327,120,5,0,50400,44070,1,0,0,0), +(@GUID+89,28201,595,3,1,0,0,2540.67,1254.82,126.274,4.97198,120,5,0,130330,0,1,0,0,0), +(@GUID+90,28201,595,3,1,0,0,2410.03,1417.19,130.577,0.191229,120,5,0,130330,0,1,0,0,0), +(@GUID+91,28249,595,3,1,0,0,2562.66,1177.9,126.716,4.77171,120,5,0,63000,0,1,0,0,0), +(@GUID+92,28249,595,3,1,0,0,2566.72,1190.41,125.837,4.7992,120,5,0,63000,0,1,0,0,0), +(@GUID+93,28249,595,3,1,0,0,2472.34,1404.76,130.752,5.20601,120,5,0,63000,0,1,0,0,0), +(@GUID+94,28249,595,3,1,0,0,2460.59,1413.26,130.46,5.4377,120,5,0,63000,0,1,0,0,0), +(@GUID+95,28249,595,3,1,0,0,2415.04,1423.52,131.111,0.214785,120,5,0,63000,0,1,0,0,0); + +DELETE FROM `script_texts` WHERE entry BETWEEN -1595052 AND -1595048; +INSERT INTO `script_texts` (npc_entry,entry, content_default, comment) VALUES +(27913,-1595048, "Scourge forces have been spotted near the Elder's Square Gate!","Spawns near elder's square gate."), +(27913,-1595059, "Scourge forces have been spotted near the Town Hall!","Spawns near town hall."), +(27913,-1595050, "Scourge forces have been spotted near the King's Square fountain!","Spawns near king's square."), +(27913,-1595051, "Scourge forces have been spotted near the Market Row Gate!", "Spawns near market row gate."), +(27913,-1595052, "Scourge forces have been spotted near the Festival Lane Gate!", "Spawns near festval lane gate."); + +UPDATE `creature_template` SET `dynamicflags` = 0 WHERE `entry` IN (32273,32313); +UPDATE `areatrigger_teleport` SET id = 5181 WHERE id = 5148; +UPDATE `creature_template` SET `flags_extra` = 128 WHERE `entry` = 20562; +UPDATE `script_waypoint` SET location_x = 2449.32, location_y = 1191.09 WHERE entry = 26499 AND pointid = 26; + +UPDATE `creature_template` SET `lootid` = 32273 WHERE `entry` IN (32273, 32313); + +-- thx warpten (fix for credit spell) +UPDATE `spell_dbc` SET `Attributes` = '8388992', `AttributesEx2` = '5', `AttributesEx3` = '269484288' WHERE `Id` = 58630; diff --git a/sql/updates/world/2012_05_03_02_world_quest_template.sql b/sql/updates/world/2012_05_03_02_world_quest_template.sql new file mode 100644 index 00000000000..49953bd2166 --- /dev/null +++ b/sql/updates/world/2012_05_03_02_world_quest_template.sql @@ -0,0 +1,28 @@ +-- Wolvar Orphan quest order +UPDATE `quest_template` SET `prevquestid`=13927,`exclusivegroup`=-13930 WHERE `id` IN (13930,13934,13951); +UPDATE `quest_template` SET `prevquestid`=13930,`exclusivegroup`=-13955 WHERE `id` IN (13955,13957); +UPDATE `quest_template` SET `prevquestid`=13955,`exclusivegroup`=0 WHERE `id`=13938; +UPDATE `quest_template` SET `prevquestid`=13938,`exclusivegroup`=0 WHERE `id`=13960; +-- Oracle Orphan quest order +UPDATE `quest_template` SET `prevquestid`=13926,`exclusivegroup`=-13929 WHERE `id` IN (13929,13933,13950); +UPDATE `quest_template` SET `prevquestid`=13929,`exclusivegroup`=-13954 WHERE `id` IN (13954,13956); +UPDATE `quest_template` SET `prevquestid`=13954,`exclusivegroup`=0 WHERE `id`=13937; +UPDATE `quest_template` SET `prevquestid`=13937,`exclusivegroup`=0 WHERE `id`=13959; +-- Human Orphan quest order +UPDATE `quest_template` SET `prevquestid`=1468,`exclusivegroup`=-1479 WHERE `id` IN (1479,1558,1687); +UPDATE `quest_template` SET `prevquestid`=1479,`exclusivegroup`=-558 WHERE `id` IN (558,4822); +UPDATE `quest_template` SET `prevquestid`=558,`exclusivegroup`=0 WHERE `id`=171; +-- Orcish Orphan quest order +UPDATE `quest_template` SET `prevquestid`=172,`exclusivegroup`=-910 WHERE `id` IN (910,911,1800); +UPDATE `quest_template` SET `prevquestid`=910,`exclusivegroup`=-915 WHERE `id` IN (915,925); +UPDATE `quest_template` SET `prevquestid`=915,`exclusivegroup`=0 WHERE `id`=5502; +-- Draenei Orphan quest order +UPDATE `quest_template` SET `prevquestid`=10943,`exclusivegroup`=-10950 WHERE `id` IN (10950,10952,10954); +UPDATE `quest_template` SET `prevquestid`=10950,`exclusivegroup`=-10956 WHERE `id` IN (10956,10962); +UPDATE `quest_template` SET `NextQuestIdChain`=10968 WHERE `id`=10956; +UPDATE `quest_template` SET `prevquestid`=10968,`exclusivegroup`=0 WHERE `id`=10966; +-- Blood Elf Orphan quest order +UPDATE `quest_template` SET `prevquestid`=10942,`exclusivegroup`=-10945 WHERE `id` IN (10945,10951,10953); +UPDATE `quest_template` SET `prevquestid`=10945,`exclusivegroup`=-10960 WHERE `id` IN (10960,10963); +UPDATE `quest_template` SET `prevquestid`=10960,`exclusivegroup`=0 WHERE `id`=11975; +UPDATE `quest_template` SET `prevquestid`=11975,`exclusivegroup`=0 WHERE `id`=10967; diff --git a/sql/updates/world/2012_05_03_03_world_creature_questrelation.sql b/sql/updates/world/2012_05_03_03_world_creature_questrelation.sql new file mode 100644 index 00000000000..1da4f6d29ad --- /dev/null +++ b/sql/updates/world/2012_05_03_03_world_creature_questrelation.sql @@ -0,0 +1,2 @@ +-- Set correct NPC for A Warden of the Alliance +UPDATE `creature_questrelation` SET `id`=14305 WHERE `quest`=171; diff --git a/sql/updates/world/2012_05_03_04_world_game_event_creature_quest.sql b/sql/updates/world/2012_05_03_04_world_game_event_creature_quest.sql new file mode 100644 index 00000000000..62fd4415549 --- /dev/null +++ b/sql/updates/world/2012_05_03_04_world_game_event_creature_quest.sql @@ -0,0 +1,57 @@ +DELETE FROM `creature_questrelation` WHERE `id` IN (14305,14444,22817,22818,33532,33533,34365); +DELETE FROM `game_event_creature_quest` WHERE `eventEntry`=10; +INSERT INTO `game_event_creature_quest` (`eventEntry`,`id`,`quest`) VALUES +-- Alliance +(10,14450,1468), -- Orphan Matron Nightingale - Children's Week +(10,14305,1479), -- Human Orphan - The Bough of the Eternals +(10,14305,1558), -- Human Orphan - The Stonewrought Dam +(10,14305,1687), -- Human Orphan - Spooky Lighthouse +(10,14305,558), -- Human Orphan - Jaina's Autograph +(10,14305,4822), -- Human Orphan - You Scream, I Scream... +-- Horde +(10,14451,172), -- Orphan Matron Battlewail - Children's Week +(10,14444,910), -- Orcish Orphan - Down at the Docks +(10,14444,911), -- Orcish Orphan - Gateway to the Frontier +(10,14444,1800), -- Orcish Orphan - Lordaeron Throne Room +(10,14444,915), -- Orcish Orphan - You Scream, I Scream... +(10,14444,925), -- Orcish Orphan - Cairne's Hoofprint +(10,14444,5502), -- Orcish Orphan - A Warden of the Horde +-- Outlands: Blood Elfs +(10,22819,10942), -- Orphan Matron Mercy - Children's Week +(10,22817,10945), -- Blood Elf Orphan - Hch'uu and the Mushroom People +(10,22817,10951), -- Blood Elf Orphan - A Trip to the Dark Portal +(10,22817,10953), -- Blood Elf Orphan - Visit the Throne of the Elements +(10,22817,11975), -- Blood Elf Orphan - Now, When I Grow Up... +(10,22817,10963), -- Blood Elf Orphan - Time to Visit the Caverns +(10,22817,10967), -- Blood Elf Orphan - Back to the Orphanage +-- Outlands: Draenei +(10,22819,10943), -- Orphan Matron Mercy - Children's Week +(10,22818,10950), -- Draenei Orphan - Auchindoun and the Ring of Observance +(10,22818,10952), -- Draenei Orphan - A Trip to the Dark Portal +(10,22818,10954), -- Draenei Orphan - Jheel is at Aeris Landing! +(10,22818,10956), -- Draenei Orphan - The Seat of the Naaru +(10,22818,10962), -- Draenei Orphan - Time to Visit the Caverns +(10,22818,10966), -- Draenei Orphan - Back to the Orphanage +-- Northrend: Wolvar +(10,34365,13927), -- Orphan Matron Aria - Little Orphan Kekek Of The Wolvar +(10,33532,13930), -- Wolvar Orphan - Home Of The Bear-Men +(10,33532,13934), -- Wolvar Orphan - The Bronze Dragonshrine +(10,33532,13951), -- Wolvar Orphan - Playmates! +(10,33532,13955), -- Wolvar Orphan - The Dragon Queen +(10,33532,13957), -- Wolvar Orphan - The Mighty Hemet Nesingwary +(10,33532,13960), -- Wolvar Orphan - Back To The Orphanage +-- Northrend: Oracles +(10,34365,13926), -- Orphan Matron Aria - Little Orphan Roo Of The Oracles +(10,33533,13929), -- Oracle Orphan - The Biggest Tree Ever! +(10,33533,13933), -- Oracle Orphan - The Bronze Dragonshrine +(10,33533,13937), -- Oracle Orphan - A Trip To The Wonderworks +(10,33533,13950), -- Oracle Orphan - Playmates! +(10,33533,13954), -- Oracle Orphan - The Dragon Queen +(10,33533,13956), -- Oracle Orphan - Meeting a Great One +(10,33533,13959); -- Oracle Orphan - Back To The Orphanage + +-- Removed "When I Grow Up..." and replace it with "Now, When I Grow Up..." +UPDATE `quest_template` SET `prevquestid`=10945,`exclusivegroup`=-11975 WHERE `id` IN (11975,10963); +DELETE FROM `disables` WHERE `sourceType`=1 AND `entry`=10960; +INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES +(1,10960,0,'','','Deprecated quest: When I grow up...'); diff --git a/sql/updates/world/2012_05_04_00_world_waypoints.sql b/sql/updates/world/2012_05_04_00_world_waypoints.sql new file mode 100644 index 00000000000..a07bde59d49 --- /dev/null +++ b/sql/updates/world/2012_05_04_00_world_waypoints.sql @@ -0,0 +1,137 @@ +-- Thrallmar Grunt pathing +SET @NPC := 57505; +SET @PATH := @NPC*10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=168.3949,`position_y`=2641.357,`position_z`=86.32077 WHERE `guid`=@NPC; +UPDATE `creature_addon` SET `path_id`=@PATH WHERE `guid`=@NPC; +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,168.3949,2641.357,86.32077,0,0,0,100,0), +(@PATH,2,186.5067,2615.882,87.28357,0,0,0,100,0), +(@PATH,3,188.9113,2601.655,87.28357,0,0,0,100,0), +(@PATH,4,198.3909,2602.661,87.28357,0,0,0,100,0), +(@PATH,5,201.5686,2609.845,87.28357,0,0,0,100,0), +(@PATH,6,187.2484,2616.44,87.28357,0,0,0,100,0), +(@PATH,7,168.7871,2641.268,86.32077,0,0,0,100,0), +(@PATH,8,155.2003,2681.998,84.82113,0,0,0,100,0), +(@PATH,9,194.6133,2692.07,90.61374,0,0,0,100,0), +(@PATH,10,215.4427,2693.589,90.69872,0,0,0,100,0), +(@PATH,11,219.0203,2692.25,90.69665,0,0,0,100,0), +(@PATH,12,225.5117,2680.063,90.68996,0,0,0,100,0), +(@PATH,13,235.309,2679.308,90.69373,0,0,0,100,0), +(@PATH,14,246.9184,2682.646,90.70419,0,0,0,100,0), +(@PATH,15,252.4411,2688.479,90.70386,0,0,0,100,0), +(@PATH,16,255.0155,2699.197,90.70283,0,0,0,100,0), +(@PATH,17,251.5234,2707.998,90.70486,0,0,0,100,0), +(@PATH,18,243.2346,2712.791,90.70392,0,0,0,100,0), +(@PATH,19,231.9871,2713.626,90.70399,0,0,0,100,0), +(@PATH,20,221.1457,2709.591,90.69753,0,0,0,100,0), +(@PATH,21,218.8803,2695.845,90.69318,0,0,0,100,0), +(@PATH,22,215.4517,2693.612,90.69869,0,0,0,100,0), +(@PATH,23,194.7944,2692.039,90.65273,0,0,0,100,0), +(@PATH,24,175.8115,2687.591,86.68189,0,0,0,100,0), +(@PATH,25,155.2143,2682.375,84.82113,0,0,0,100,0), +(@PATH,26,131.8727,2679.832,84.56969,0,0,0,100,0), +(@PATH,27,130.0859,2666.262,84.1262,0,0,0,100,0), +(@PATH,28,153.1291,2650.22,86.15128,0,0,0,100,0); + +-- Remove dup Thrallmar Grunt spawn +DELETE FROM `creature` WHERE `guid`=57532; +DELETE FROM `creature_addon` WHERE `guid`=57532; + +-- Bat Rider Guard pathing +SET @NPC := 54840; +SET @PATH := @NPC*10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=156.9029,`position_y`=2554.784,`position_z`=170.8949 WHERE `guid`=@NPC; +UPDATE `creature_addon` SET `path_id`=@PATH WHERE `guid`=@NPC; +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,156.9029,2554.784,170.8949,0,0,0,100,0), +(@PATH,2,52.51677,2602.816,139.7838,0,0,0,100,0), +(@PATH,3,42.10146,2627.056,139.7838,0,0,0,100,0), +(@PATH,4,37.17329,2663.729,139.7838,0,0,0,100,0), +(@PATH,5,62.91933,2687.96,139.7838,0,0,0,100,0), +(@PATH,6,96.1871,2688.141,148.4226,0,0,0,100,0), +(@PATH,7,129.818,2690.786,151.256,0,0,0,100,0), +(@PATH,8,165.6888,2715.398,170.8949,0,0,0,100,0), +(@PATH,9,199.7751,2744.93,170.8949,0,0,0,100,0), +(@PATH,10,246.0857,2761.154,170.8949,0,0,0,100,0), +(@PATH,11,295.0904,2757.991,170.8949,0,0,0,100,0), +(@PATH,12,309.3468,2726.089,170.8949,0,0,0,100,0), +(@PATH,13,303.8448,2682.588,170.8949,0,0,0,100,0), +(@PATH,14,289.3104,2650.866,170.8949,0,0,0,100,0), +(@PATH,15,261.2743,2618.831,170.8949,0,0,0,100,0), +(@PATH,16,233.6436,2578.997,170.8949,0,0,0,100,0), +(@PATH,17,199.3375,2546.226,170.8949,0,0,0,100,0); + +-- Bat Rider Guard pathing +SET @NPC := 54841; +SET @PATH := @NPC*10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=65.97776,`position_y`=2661.205,`position_z`=163.6752 WHERE `guid`=@NPC; +UPDATE `creature_addon` SET `path_id`=@PATH WHERE `guid`=@NPC; +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,65.97776,2661.205,163.6752,0,0,0,100,0), +(@PATH,2,85.52612,2668.312,163.6752,0,0,0,100,0), +(@PATH,3,119.9537,2689.26,163.6752,0,0,0,100,0), +(@PATH,4,121.8238,2721.88,163.6752,0,0,0,100,0), +(@PATH,5,142.6907,2750.891,163.6752,0,0,0,100,0), +(@PATH,6,149.9812,2788.504,163.6752,0,0,0,100,0), +(@PATH,7,142.9353,2830.464,163.6752,0,0,0,100,0), +(@PATH,8,115.1711,2822.444,163.6752,0,0,0,100,0), +(@PATH,9,57.16672,2791.644,163.6752,0,0,0,100,0), +(@PATH,10,38.80463,2758.823,163.6752,0,0,0,100,0), +(@PATH,11,19.69282,2714.784,163.6752,0,0,0,100,0), +(@PATH,12,23.22027,2677.714,163.6752,0,0,0,100,0); + +-- Bat Rider Guard pathing +SET @NPC := 54842; +SET @PATH := @NPC*10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=263.5968,`position_y`=2694.818,`position_z`=169.7312 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`) VALUES (@NPC,@PATH,4097); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,263.5968,2694.818,169.7312,0,0,0,100,0), +(@PATH,2,184.0861,2784.899,154.4534,0,0,0,100,0), +(@PATH,3,154.2815,2754.787,154.3701,0,0,0,100,0), +(@PATH,4,127.0308,2740.488,154.3701,0,0,0,100,0), +(@PATH,5,118.0444,2706.509,154.3701,0,0,0,100,0), +(@PATH,6,115.7577,2669.386,158.6756,0,0,0,100,0), +(@PATH,7,131.4314,2622.531,162.1478,0,0,0,100,0), +(@PATH,8,154.8241,2607.207,164.4812,0,0,0,100,0), +(@PATH,9,176.3283,2571.343,168.5645,0,0,0,100,0), +(@PATH,10,221.6267,2559.683,172.1201,0,0,0,100,0), +(@PATH,11,245.392,2593.423,169.8978,0,0,0,100,0), +(@PATH,12,251.0069,2617.749,169.7312,0,0,0,100,0), +(@PATH,13,263.0581,2644.614,169.7312,0,0,0,100,0); + +-- Bat Rider Guard pathing +SET @NPC := 54843; +SET @PATH := @NPC*10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=62.42025,`position_y`=2785.719,`position_z`=192.1124 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`) VALUES (@NPC,@PATH,4097); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,62.42025,2785.719,192.1124,0,0,0,100,0), +(@PATH,2,159.9371,2842.977,208.279,0,0,0,100,0), +(@PATH,3,183.0578,2845.035,208.279,0,0,0,100,0), +(@PATH,4,211.2432,2864.757,214.2235,0,0,0,100,0), +(@PATH,5,238.1182,2871.979,220.9457,0,0,0,100,0), +(@PATH,6,252.9173,2853.913,220.9457,0,0,0,100,0), +(@PATH,7,255.0203,2812.634,220.9457,0,0,0,100,0), +(@PATH,8,240.4993,2780.929,220.9457,0,0,0,100,0), +(@PATH,9,195.4901,2773.965,209.3901,0,0,0,100,0), +(@PATH,10,162.1341,2742.294,212.9179,0,0,0,100,0), +(@PATH,11,125.4935,2720.611,197.9457,0,0,0,100,0), +(@PATH,12,93.49241,2699.757,192.1124,0,0,0,100,0), +(@PATH,13,58.35324,2681.49,192.1124,0,0,0,100,0), +(@PATH,14,22.8833,2715.123,192.1124,0,0,0,100,0), +(@PATH,15,30.10514,2764.5,192.1124,0,0,0,100,0); + +-- Fix Bat Rider Guard InhabitType +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry`=15242; + +-- Remove dup Bat Rider Guard spawns +DELETE FROM `creature` WHERE `guid` IN (54839,54844,54845); +DELETE FROM `creature_addon` WHERE `guid` IN (54839,54844,54845); diff --git a/sql/updates/world/2012_05_04_01_world_sai.sql b/sql/updates/world/2012_05_04_01_world_sai.sql new file mode 100644 index 00000000000..7021fc92548 --- /dev/null +++ b/sql/updates/world/2012_05_04_01_world_sai.sql @@ -0,0 +1,32 @@ +-- Speech by Martik Tor'seldoi, Thrallmar +SET @ENTRY := 16577; +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=9 AND `entryorguid`=@ENTRY*100; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,1,0,100,0,30000,50000,360000,360000,80,@ENTRY*100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Martik Tor''seldoi - OOC - Load script every 6 min ooc'), +(@ENTRY,0,1,0,25,0,100,0,0,0,0,0,11,18100,32,0,0,0,0,1,0,0,0,0,0,0,0, 'Martik Tor''seldoi - Reset - Cast Frost Armor'), +(@ENTRY*100,9,0,0,0,0,100,0,1000,1000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Martik Tor''seldoi Say text 0'), +(@ENTRY*100,9,1,0,0,0,100,0,3000,3000,0,0,5,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Martik Tor''seldoi emote'), +(@ENTRY*100,9,2,0,0,0,100,0,3000,3000,0,0,5,6,0,0,0,0,0,1,0,0,0,0,0,0,0,'Martik Tor''seldoi emote'), +(@ENTRY*100,9,3,0,0,0,100,0,3000,3000,0,0,1,0,0,0,0,0,0,10,57487,16578,0,0,0,0,0,'Blood Elf Pilgrim Say text 0'), +(@ENTRY*100,9,4,0,0,0,100,0,3000,3000,0,0,5,6,0,0,0,0,0,10,57487,16578,0,0,0,0,0,'Blood Elf Pilgrim emote'), +(@ENTRY*100,9,5,0,0,0,100,0,3000,3000,0,0,66,0,0,0,0,0,0,10,57487,16578,0,0,0,0,0,'Martik Tor''seldoi turn to'), +(@ENTRY*100,9,6,0,0,0,100,0,1000,1000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Martik Tor''seldoi Say text 1'), +(@ENTRY*100,9,7,0,0,0,100,0,4000,4000,0,0,1,1,0,0,0,0,0,10,57487,16578,0,0,0,0,0,'Blood Elf Pilgrim Say text 1'), +(@ENTRY*100,9,8,0,0,0,100,0,3000,3000,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Martik Tor''seldoi Say text 2'), +(@ENTRY*100,9,9,0,0,0,100,0,3000,3000,0,0,5,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Martik Tor''seldoi emote'), +(@ENTRY*100,9,10,0,0,0,100,0,3000,3000,0,0,5,273,0,0,0,0,0,1,0,0,0,0,0,0,0,'Martik Tor''seldoi emote'), +(@ENTRY*100,9,11,0,0,0,100,0,3000,3000,0,0,1,2,0,0,0,0,0,10,57487,16578,0,0,0,0,0,'Blood Elf Pilgrim Say text 2'), +(@ENTRY*100,9,12,0,0,0,100,0,1000,1000,0,0,5,15,0,0,0,0,0,9,16578,0,20,0,0,0,0,'Blood Elf Pilgrim emote'), +(@ENTRY*100,9,13,0,0,0,100,0,3000,3000,0,0,66,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Martik Tor''seldoi turn to'); +-- NPC talk text insert from sniff +DELETE FROM `creature_text` WHERE `entry` IN (16577,16578); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(16577,0,0, 'Brothers and sisters, I have been to the promised land. I have tasted in the sublim energy. I have felt bliss - bliss so engrossing and all encompassing that I was left wondering if I had stumbled upon the dreams of gods.!',12,0,100,5,0,0, 'Martik Tor''seldoi'), +(16577,1,0, 'In paradise, you merely reach out and take from the Nether.',12,0,100,1,0,0, 'Martik Tor''seldoi'), +(16577,2,0, 'From the very air! Tendrils of arcane energy light up the obsidian sky as plumes of raw magic rise up from fissures in the land. Kneel and drink from the fissure as you do from a stream or well. Pluck a tendril from the heavens as if it were an apple hanging from a branch.',12,0,100,5,0,0, 'Martik Tor''seldoi'), +(16578,0,0, 'Tell us more, Martik. What is it? What does it feel like?',12,0,100,1,0,0, 'Blood Elf Pilgrim'), +(16578,1,0, 'But how?',12,0,100,6,0,0, 'Blood Elf Pilgrim'), +(16578,2,0, '%s smiles/gasps.',16,0,100,0,0,0, 'Blood Elf Pilgrim'); diff --git a/sql/updates/world/2012_05_05_00_world_sai.sql b/sql/updates/world/2012_05_05_00_world_sai.sql new file mode 100644 index 00000000000..e03c36337af --- /dev/null +++ b/sql/updates/world/2012_05_05_00_world_sai.sql @@ -0,0 +1,205 @@ +-- Forge of Souls Trash update + +-- Npc Updates + +-- Spiteful Apparition +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry`=36551; +UPDATE `creature` SET `spawndist`=20,`MovementType`=1,`curhealth`=1,`curmana`=0 WHERE `id`=36551; +DELETE FROM `creature_template_addon` WHERE `entry`=36551; +INSERT INTO `creature_template_addon` (`entry`,`bytes2`,`auras`) VALUES (36551,1, '69105 69136'); +-- Spiteful Apparition (Ambient) +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry`=36967; +UPDATE `creature` SET `spawndist`=20,`MovementType`=1,`curhealth`=1,`curmana`=0 WHERE `id`=36967; +DELETE FROM `creature_template_addon` WHERE `entry`=36967; +INSERT INTO `creature_template_addon` (`entry`,`bytes2`,`auras`) VALUES (36967,1, '69663 69658'); +-- Spectral Warden +UPDATE `creature_addon` SET `auras`='69144' WHERE `guid` IN (SELECT `guid` FROM `creature` WHERE `id`=36666); + +-- SAI Updates + +-- Spiteful Apparition SAI +SET @ENTRY := 36551; -- NPC entry +SET @SPELL1 := 41253; -- Greater Invisibility +SET @SPELL2 := 68895; -- Spite (Normal) +SET @SPELL3 := 70212; -- Spite (Heroic) +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,25,0,100,6,0,0,0,0,11,@SPELL1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Spiteful Apparition - On Reset - Cast Greater Invisibility'), +(@ENTRY,0,1,0,10,0,100,6,0,10,3000,4000,28,@SPELL1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Spiteful Apparition - OOC range - Remove Greater Invisibility'), +(@ENTRY,0,2,0,0,0,100,2,7000,9000,7000,9000,11,@SPELL2,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Spiteful Apparition - Combat - Cast Spite "Normal"'), +(@ENTRY,0,3,0,0,0,100,4,7000,9000,7000,9000,11,@SPELL3,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Spiteful Apparition - Combat - Cast Spite "Heroic"'); + +-- Soulguard Reaper SAI +SET @ENTRY := 36499; -- NPC entry +SET @SPELL1 := 68797; -- Soulguard Channel +SET @SPELL2 := 69058; -- Shadow Lance +SET @SPELL3 := 69060; -- Frost Nova (Normal) +SET @SPELL4 := 70209; -- Frost Nova (Heroic) +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,1,0,100,7,0,0,0,0,11,@SPELL1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Reaper - OOC - Cast Soulguard Channel'), +(@ENTRY,0,1,0,0,0,100,6,5000,6000,7000,9000,11,@SPELL2,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Soulguard Reaper - Combat - Cast Shadow Lance'), +(@ENTRY,0,2,0,0,0,100,2,7000,9000,8000,10000,11,@SPELL3,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Soulguard Reaper - Combat - Cast Frost Nova "Normal"'), +(@ENTRY,0,3,0,0,0,100,4,7000,9000,8000,10000,11,@SPELL4,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Soulguard Reaper - Combat - Cast Frost Nova "Heroic"'), +(@ENTRY,0,4,0,4,0,100,6,0,0,0,0,39,30,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Reaper - Aggro - Call for help'); + +-- Soulguard Beam Focus Target +SET @ENTRY := 36508; -- NPC entry +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid` IN (-201770,-201785,-201741); +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(-201770,0,0,0,1,0,100,6,1000,1000,5000,5000,45,0,1,0,0,0,0,19,36620,60,0,0,0,0,0, 'Soulguard Beam Focus Target - OOC - Set data on Soulguard Adept'), +(-201785,0,0,0,1,0,100,6,1000,1000,5000,5000,45,0,1,0,0,0,0,19,36620,60,0,0,0,0,0, 'Soulguard Beam Focus Target - OOC - Set data on Soulguard Adept'), +(-201741,0,0,0,1,0,100,6,1000,1000,5000,5000,45,0,1,0,0,0,0,19,36620,60,0,0,0,0,0, 'Soulguard Beam Focus Target - OOC - Set data on Soulguard Adept'), +(-201741,0,1,0,1,0,100,6,1000,1000,5000,5000,45,0,1,0,0,0,0,19,36564,60,0,0,0,0,0, 'Soulguard Beam Focus Target - OOC - Set data on Soulguard Bonecaster'); + +-- Spectral Warden SAI +SET @ENTRY := 36666; -- NPC entry +SET @SPELL1 := 69633; -- Veil of Shadow +SET @SPELL2 := 69148; -- Wail of Souls (Normal) +SET @SPELL3 := 70210; -- Wail of Souls (Heroic) +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,6,5000,6000,9000,10000,11,@SPELL1,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Spectral Warden - Combat - Cast Veil of Shadow'), +(@ENTRY,0,1,0,0,0,100,2,9000,11000,5000,6000,11,@SPELL1,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Spectral Warden - Combat - Cast Wail of Souls'), +(@ENTRY,0,2,0,0,0,100,4,9000,11000,5000,6000,11,@SPELL2,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Spectral Warden - Combat - Cast Wail of Souls'); + +-- Soulguard Watchman SAI +SET @ENTRY := 36478; -- NPC entry +SET @SPELL1 := 69056; -- Shroud of Runes +SET @SPELL2 := 69053; -- Unholy Rage +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,50,6,0,10000,16000,20000,11,@SPELL1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Watchman - Combat - Cast Shroud of Runes'), +(@ENTRY,0,1,2,0,0,100,6,8000,16000,32000,40000,11,@SPELL2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Watchman - Combat - Cast Unholy Rage'), +(@ENTRY,0,2,0,61,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Watchman - Combat - Say 0'), +(@ENTRY,0,3,0,4,0,100,6,0,0,0,0,39,20,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Watchman - Aggro - Call for help'); +-- NPC talk text insert +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0, '%s goes into a frenzy!',16,0,100,0,0,0, 'Soulguard Watchman'); + +-- Soul Horror SAI +SET @ENTRY := 36522; -- NPC entry +SET @SPELL1 := 69088; -- Soul Strike (Normal) +SET @SPELL2 := 70211; -- Soul Strike (Heroic) +SET @SPELL3 := 69107; -- Killing Spree Invis Aura +SET @SPELL4 := 69106; -- Killing Spree Aura +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,5000,6000,5000,6000,11,@SPELL1,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Soul Horror - Combat - Cast Soul Strike'), +(@ENTRY,0,1,0,0,0,100,4,5000,6000,5000,6000,11,@SPELL2,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Soul Horror - Combat - Cast Soul Strike'), +(@ENTRY,0,4,0,4,0,100,6,0,0,0,0,39,35,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soul Horror - Aggro - Call for help'); + +-- Soulguard Animator SAI +SET @ENTRY := 36516; -- NPC entry +SET @SPELL1 := 68834; -- Soulguard Channel Beam02 +SET @SPELL2 := 69562; -- Raise Dead +SET @SPELL3 := 69131; -- Soul Sickness +SET @SPELL4 := 69128; -- Soul Siphon +SET @SPELL5 := 69068; -- Shadow Bolt (Normal) +SET @SPELL6 := 70208; -- Shadow Bolt (Heroic) +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,1,0,100,7,1000,1000,1000,1000,11,@SPELL1,0,0,0,0,0,9,36522,1,15,0,0,0,0, 'Soulguard Animator - OOC - Cast Soulguard Channel Beam02'), +(@ENTRY,0,1,0,0,1,100,6,20000,25000,20000,25000,11,@SPELL2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Animator - Combat - Cast Raise Dead'), +(@ENTRY,0,2,0,0,0,100,6,7000,9000,9000,11000,11,@SPELL3,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Soulguard Animator - Combat - Cast Soul Sickness'), +(@ENTRY,0,3,0,0,0,100,6,9000,11000,7000,9000,11,@SPELL4,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Soulguard Animator - Combat - Cast Soul Siphon'), +(@ENTRY,0,4,0,0,0,100,2,4000,5000,3500,4500,11,@SPELL5,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Soulguard Animator - Combat - Cast Shadow Bolt "Normal"'), +(@ENTRY,0,5,0,0,0,100,4,4000,5000,3500,4500,11,@SPELL6,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Soulguard Animator - Combat - Cast Shadow Bolt "Heroic"'), +(@ENTRY,0,6,7,4,0,100,6,0,0,0,0,39,35,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Animator - Aggro - Call for help'), +(@ENTRY,0,7,0,61,0,100,6,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Animator - Aggro - Set phase 1'), +(@ENTRY,0,8,9,38,0,100,7,0,2,0,0,45,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Animator - Data set 2 - Set data'), +(@ENTRY,0,9,0,61,0,100,6,0,0,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Animator - Data set 2 - Set phase 2'), +(@ENTRY,0,10,11,38,0,100,7,0,3,0,0,45,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Animator - Data set 3 - Set data'), +(@ENTRY,0,11,0,61,0,100,6,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Animator - Data set 3 - Set phase 1'); + +-- Soulguard Adept SAI +SET @ENTRY := 36620; -- NPC entry +SET @SPELL1 := 68834; -- Soulguard Channel Beam02 +SET @SPELL2 := 69562; -- Raise Dead +SET @SPELL3 := 69068; -- Shadow Bolt (Normal) +SET @SPELL4 := 70208; -- Shadow Bolt (Heroic) +SET @SPELL5 := 69066; -- Drain Life (Normal) +SET @SPELL6 := 70213; -- Drain Life (Heroic) +SET @SPELL7 := 69564; -- Shadow Mend (Normal) +SET @SPELL8 := 70205; -- Shadow Mend (Heroic) +SET @SPELL9 := 68797; -- Soulguard Channel +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,1,0,100,7,1000,1000,1000,1000,11,@SPELL1,0,0,0,0,0,9,36522,1,15,0,0,0,0, 'Soulguard Adept - OOC - Cast Soulguard Channel Beam02'), +(@ENTRY,0,1,0,0,4,100,6,20000,25000,20000,25000,11,@SPELL2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Adept - Combat - Cast Raise Dead'), +(@ENTRY,0,2,0,0,0,100,2,7000,8000,3500,4500,11,@SPELL3,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Soulguard Adept - Combat - Cast Shadow Bolt "Normal"'), +(@ENTRY,0,3,0,0,0,100,4,7000,8000,3500,4500,11,@SPELL4,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Soulguard Adept - Combat - Cast Shadow Bolt "Heroic"'), +(@ENTRY,0,4,0,0,0,100,2,6000,7000,8000,10000,11,@SPELL5,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Soulguard Adept - Combat - Cast Drain Life "Normal"'), +(@ENTRY,0,5,0,0,0,100,4,6000,7000,8000,10000,11,@SPELL6,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Soulguard Adept - Combat - Cast Drain Life "Heroic"'), +(@ENTRY,0,6,0,0,0,100,2,30000,35000,18000,22000,11,@SPELL7,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Soulguard Adept - Combat - Cast Shadow Mend "Normal"'), +(@ENTRY,0,7,0,0,0,100,4,30000,35000,18000,22000,11,@SPELL8,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Soulguard Adept - Combat - Cast Shadow Mend "Heroic"'), +(@ENTRY,0,8,0,25,0,100,6,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Adept - On Reset - Set phase 1'), +(@ENTRY,0,9,0,38,1,100,6,0,1,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Adept - On dataset 0 1 - Set phase 2'), +(@ENTRY,0,10,0,1,2,100,7,0,0,0,0,11,@SPELL9,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Adept - OOC - Cast Soulguard Channel'), +(@ENTRY,0,11,12,4,0,100,6,0,0,0,0,39,35,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Adept - Aggro - Call for help'), +(@ENTRY,0,12,0,61,0,100,6,0,0,0,0,22,3,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Adept - Aggro - Set phase 3'), +(@ENTRY,0,13,14,38,0,100,7,0,2,0,0,45,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Adept - Data set 2 - Set data'), +(@ENTRY,0,14,0,61,0,100,6,0,0,0,0,22,4,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Adept - Data set 2 - Set phase 4'), +(@ENTRY,0,15,16,38,0,100,7,0,3,0,0,45,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Adept - Data set 3 - Set data'), +(@ENTRY,0,16,0,61,0,100,6,0,0,0,0,22,3,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Adept - Data set 3 - Set phase 3'); + +-- Soulguard Bonecaster SAI +SET @ENTRY := 36564; -- NPC entry +SET @SPELL1 := 68834; -- Soulguard Channel Beam02 +SET @SPELL2 := 69562; -- Raise Dead +SET @SPELL3 := 69080; -- Bone Volley (Normal) +SET @SPELL4 := 70206; -- Bone Volley (Heroic) +SET @SPELL5 := 69069; -- Shield of Bones (Normal) +SET @SPELL6 := 70207; -- Shield of Bones (Heroic) +SET @SPELL7 := 68797; -- Soulguard Channel +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,1,0,100,7,1000,1000,1000,1000,11,@SPELL1,0,0,0,0,0,9,36522,1,15,0,0,0,0, 'Soulguard Bonecaster - OOC - Cast Soulguard Channel Beam02'), +(@ENTRY,0,1,0,0,4,100,6,20000,25000,20000,25000,11,@SPELL2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Bonecaster - Combat - Cast Raise Dead'), +(@ENTRY,0,2,0,0,0,100,2,5000,7000,6000,8000,11,@SPELL3,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Soulguard Bonecaster - Combat - Cast Bone Volley "Normal"'), +(@ENTRY,0,3,0,0,0,100,4,5000,7000,6000,8000,11,@SPELL4,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Soulguard Bonecaster - Combat - Cast Bone Volley "Heroic"'), +(@ENTRY,0,4,0,0,0,100,2,5000,7000,7000,9000,11,@SPELL5,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Soulguard Bonecaster - Combat - Cast Shield of Bones "Normal"'), +(@ENTRY,0,5,0,0,0,100,4,5000,7000,7000,9000,11,@SPELL6,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Soulguard Bonecaster - Combat - Cast Shield of Bones "Heroic"'), +(@ENTRY,0,6,0,25,0,100,6,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Bonecaster - On Reset - Set phase 1'), +(@ENTRY,0,7,0,38,1,100,6,0,1,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Bonecaster - On dataset 0 1 - Set phase 2'), +(@ENTRY,0,8,0,1,2,100,7,0,0,0,0,11,@SPELL7,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Bonecaster - OOC - Cast Soulguard Channel'), +(@ENTRY,0,9,10,4,0,100,6,0,0,0,0,39,35,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Bonecaster - Aggro - Call for help'), +(@ENTRY,0,10,0,61,0,100,6,0,0,0,0,22,3,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Bonecaster - Aggro - Set phase 3'), +(@ENTRY,0,11,12,38,0,100,7,0,2,0,0,45,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Bonecaster - Data set 2 - Set data'), +(@ENTRY,0,12,0,61,0,100,6,0,0,0,0,22,4,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Bonecaster - Data set 2 - Set phase 4'), +(@ENTRY,0,13,14,38,0,100,7,0,3,0,0,45,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Bonecaster - Data set 3 - Set data'), +(@ENTRY,0,14,0,61,0,100,6,0,0,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Soulguard Bonecaster - Data set 3 - Set phase 3'); + +-- Ghoul Minion SAI +SET @ENTRY := 36916; -- NPC entry +SET @SPELL1 := 69088; -- Soul Strike (Normal) +SET @SPELL2 := 70211; -- Soul Strike (Heroic) +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,1,54,0,100,6,0,0,0,0,45,0,2,0,0,0,0,23,0,0,0,0,0,0,0, 'Ghoul Minion - Just Summoned - Set Data Summoner'), +(@ENTRY,0,1,0,61,0,100,6,0,0,0,0,89,5,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Ghoul Minion - Just Summoned - Set Random Movement'), +(@ENTRY,0,2,0,0,0,100,6,115000,115000,115000,115000,37,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Ghoul Minion - combat - die after 2 min'), +(@ENTRY,0,3,0,1,0,100,6,15000,15000,15000,15000,37,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Ghoul Minion - OOC - die after 15 sec'), +(@ENTRY,0,4,5,6,0,100,6,15000,15000,15000,15000,45,0,3,0,0,0,0,23,0,0,0,0,0,0,0, 'Ghoul Minion - on Death - Set data summoner'), +(@ENTRY,0,5,0,61,0,100,6,15000,15000,15000,15000,41,3000,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Ghoul Minion - on Death - despawn after 3 sec'); diff --git a/sql/updates/world/2012_05_05_01_world_creature_template.sql b/sql/updates/world/2012_05_05_01_world_creature_template.sql new file mode 100644 index 00000000000..2eeaf2f40d2 --- /dev/null +++ b/sql/updates/world/2012_05_05_01_world_creature_template.sql @@ -0,0 +1,2 @@ +-- Set proper faction for Ymirjar Skycaller (Heroic) +UPDATE `creature_template` SET `faction_A`=1885,`faction_H`=1885 WHERE `entry`=37643; diff --git a/sql/updates/world/2012_05_05_02_world_gameobject.sql b/sql/updates/world/2012_05_05_02_world_gameobject.sql new file mode 100644 index 00000000000..c0b2c6b147b --- /dev/null +++ b/sql/updates/world/2012_05_05_02_world_gameobject.sql @@ -0,0 +1,10 @@ +-- Add some missing Blood of Heroes spawns +SET @GUID := 5276; +DELETE FROM `gameobject` WHERE `guid` BETWEEN @GUID AND @GUID+5; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(@GUID,176213,0,1,1,1529.10242,-1427.06946,65.49049,-3.001947,0,0,-0.9975634,0.06976615,7200,100,1), +(@GUID+1,176213,0,1,1,1705.87439,-4690.138,48.9742165,-3.08918333,0,0,-0.9996567,0.02620165,7200,100,1), +(@GUID+2,176213,0,1,1,1846.79382,-3825.265,135.5159,1.83259487,0,0,0.7933531,0.6087617,7200,100,1), +(@GUID+3,176213,0,1,1,1748.16333,-4453.13525,74.26272,-2.0594883,0,0,0,0,7200,100,1), +(@GUID+4,176213,0,1,1,2159.835,-2442.754,62.0804,-0.4886912,0,0,-0.2419214,0.9702958,7200,100,1), +(@GUID+5,176213,0,1,1,1342.557,-1382.568,46.89193,2.775069,0,0,0.9832544,0.182238,7200,100,1); diff --git a/sql/updates/world/2012_05_05_03_world_sai.sql b/sql/updates/world/2012_05_05_03_world_sai.sql new file mode 100644 index 00000000000..fce3b5bc957 --- /dev/null +++ b/sql/updates/world/2012_05_05_03_world_sai.sql @@ -0,0 +1,17 @@ +-- Wrathbone Laborer SAI +SET @ENTRY := 36830; -- NPC entry +SET @SPELL1 := 70302; -- Blinding Dirt +SET @SPELL2 := 70278; -- Puncture Wound (Normal) +SET @SPELL3 := 70279; -- Puncture Wound (Heroic) +SET @SPELL4 := 69572; -- Shovelled! (Normal) +SET @SPELL5 := 70280; -- Shovelled! (Heroic) +UPDATE `creature_template` SET `unit_flags`=`unit_flags`&~256,`AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,6,7000,8000,10000,11000,11,@SPELL1,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Blinding Dirt'), +(@ENTRY,0,1,0,0,0,100,2,8000,9000,9000,10000,11,@SPELL2,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Puncture Wound (Normal)'), +(@ENTRY,0,2,0,0,0,100,4,8000,9000,9000,10000,11,@SPELL3,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Puncture Wound (Heroic)'), +(@ENTRY,0,3,0,0,0,100,2,5000,6000,7000,8000,11,@SPELL4,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Shovelled! (Normal)'), +(@ENTRY,0,4,0,0,0,100,4,5000,6000,7000,8000,11,@SPELL5,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Shovelled! (Heroic)'), +(@ENTRY,0,5,0,1,0,100,6,1000,3000,3000,3000,5,38,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Wrathbone Laborer - OOC - emote'); diff --git a/sql/updates/world/2012_05_05_04_world_creature_template.sql b/sql/updates/world/2012_05_05_04_world_creature_template.sql new file mode 100644 index 00000000000..7c4f13dd667 --- /dev/null +++ b/sql/updates/world/2012_05_05_04_world_creature_template.sql @@ -0,0 +1,27 @@ +-- Fix InhabitType for Eye of the Lich King +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry`=36913; +-- Updates From CDawg +-- Wrathbone Laborer (heroic) - fix hostility and adds equipment +UPDATE `creature_template` SET `unit_flags`=`unit_flags`&~256,`equipment_id`=104 WHERE `entry`=37638; +-- Wrathbone Siegesmith (Heroic) add equipment +UPDATE `creature_template` SET `equipment_id`=122 WHERE `entry`=37639; +-- Fallen Warrior add equipment +UPDATE `creature_template` SET `equipment_id`=2328 WHERE `entry`=37612; +-- Forgemaster Garfrost add equipment +UPDATE `creature_template` SET `equipment_id`=2325 WHERE `entry`=37613; +-- Deathwhisper Necrolyte add equipment +UPDATE `creature_template` SET `equipment_id`=2365 WHERE `entry`=37609; +-- Deathwhisper Shadowcaster - add equipment +UPDATE `creature_template` SET `equipment_id`=2365 WHERE `entry`=38025; +-- Alliance slaves add equipments +UPDATE `creature_template` SET `equipment_id`=254 WHERE `entry`=37645; +UPDATE `creature_template` SET `equipment_id`=254 WHERE `entry`=37646; +UPDATE `creature_template` SET `equipment_id`=254 WHERE `entry`=37647; +UPDATE `creature_template` SET `equipment_id`=254 WHERE `entry`=37648; +-- horde slaves add equipments +UPDATE `creature_template` SET `equipment_id`=254 WHERE `entry`=37649; +UPDATE `creature_template` SET `equipment_id`=254 WHERE `entry`=37650; +UPDATE `creature_template` SET `equipment_id`=254 WHERE `entry`=37651; +UPDATE `creature_template` SET `equipment_id`=254 WHERE `entry`=37652; +-- Ymirjar Skycaller (heroic) - Fix unit flags and add equipment +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|32832,`equipment_id`=2438 WHERE `entry`=37643; diff --git a/sql/updates/world/2012_05_05_05_world_creature_template.sql b/sql/updates/world/2012_05_05_05_world_creature_template.sql new file mode 100644 index 00000000000..a2f2a217252 --- /dev/null +++ b/sql/updates/world/2012_05_05_05_world_creature_template.sql @@ -0,0 +1,2 @@ +-- Fix skillup on some target dummys +UPDATE `creature_template` SET `flags_extra`=`flags_extra`|262144 WHERE `entry` IN (31144,2674,2673); diff --git a/sql/updates/world/2012_05_05_06_world_sai.sql b/sql/updates/world/2012_05_05_06_world_sai.sql new file mode 100644 index 00000000000..7b064af4a4e --- /dev/null +++ b/sql/updates/world/2012_05_05_06_world_sai.sql @@ -0,0 +1,13 @@ +-- Wrathbone Laborer SAI +SET @ENTRY := 36830; -- NPC entry +SET @SPELL1 := 70302; -- Blinding Dirt +SET @SPELL2 := 70278; -- Puncture Wound +SET @SPELL3 := 69572; -- Shovelled! +UPDATE `creature_template` SET `unit_flags`=`unit_flags`&~256,`AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,6,7000,8000,10000,11000,11,@SPELL1,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Blinding Dirt'), +(@ENTRY,0,1,0,0,0,100,6,8000,9000,9000,10000,11,@SPELL2,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Puncture Wound (Normal)'), +(@ENTRY,0,2,0,0,0,100,6,5000,6000,7000,8000,11,@SPELL3,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Shovelled! (Normal)'), +(@ENTRY,0,3,0,1,0,100,6,1000,3000,3000,3000,5,38,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Wrathbone Laborer - OOC - emote'); diff --git a/sql/updates/world/2012_05_06_00_world_creature_template.sql b/sql/updates/world/2012_05_06_00_world_creature_template.sql new file mode 100644 index 00000000000..30dbf85c28d --- /dev/null +++ b/sql/updates/world/2012_05_06_00_world_creature_template.sql @@ -0,0 +1,5 @@ +-- Gold for Toc based on old.wowhead +UPDATE `creature_template` SET `mingold`=850000,`maxgold`=950000 WHERE `entry` IN(34797,35447,35448,35449); -- Icehowl +UPDATE `creature_template` SET `mingold`=550000,`maxgold`=650000 WHERE `entry` IN(34780,35216,35268,35269); -- Lord Jaraxxus +UPDATE `creature_template` SET `mingold`=650000,`maxgold`=700000 WHERE `entry` IN(34497,35350,35351,35352,34496,35347,35348,35359); -- Fjola Lightbane & Eydis Darkbane +UPDATE `creature_template` SET `mingold`=500000,`maxgold`=600000 WHERE `entry` IN(34564,34566,35615,35616); -- Anub'arak diff --git a/sql/updates/world/2012_05_06_01_world_creature_template.sql b/sql/updates/world/2012_05_06_01_world_creature_template.sql new file mode 100644 index 00000000000..fa0c9af5805 --- /dev/null +++ b/sql/updates/world/2012_05_06_01_world_creature_template.sql @@ -0,0 +1,11 @@ +-- Based on old.wowhead.com +UPDATE `creature_template` SET `mingold`=1600000,`maxgold`=1800000 WHERE `entry` IN (33113,34003); -- Flame Levithian +UPDATE `creature_template` SET `mingold`=1100000,`maxgold`=1300000 WHERE `entry` IN (33118,33190); -- Ignis the Furnace Master +UPDATE `creature_template` SET `mingold`=280000,`maxgold`=360000 WHERE `entry` IN (33186,33724); -- Razorscale +UPDATE `creature_template` SET `mingold`=670000,`maxgold`=750000 WHERE `entry` IN (33293,33885); -- XT-002 Deconstructor +UPDATE `creature_template` SET `mingold`=1680000,`maxgold`=1900000 WHERE `entry` IN (32857,33694); -- Stormcaller Brundir +UPDATE `creature_template` SET `mingold`=1680000,`maxgold`=1900000 WHERE `entry` IN (32927,33692); -- Runemaster Molgeim +UPDATE `creature_template` SET `mingold`=1680000,`maxgold`=1900000 WHERE `entry` IN (32867,33693); -- Steelbreaker +UPDATE `creature_template` SET `mingold`=1220000,`maxgold`=1500000 WHERE `entry` IN (33515,34175); -- Auriaya +UPDATE `creature_template` SET `mingold`=1650000,`maxgold`=1950000 WHERE `entry` IN (33271,33449); -- General Vezax +UPDATE `creature_template` SET `mingold`=2020000,`maxgold`=2220000 WHERE `entry` IN (33288,33955); -- Yogg-Saron diff --git a/sql/updates/world/2012_05_07_00_world_waypoints.sql b/sql/updates/world/2012_05_07_00_world_waypoints.sql new file mode 100644 index 00000000000..f24b7c9c254 --- /dev/null +++ b/sql/updates/world/2012_05_07_00_world_waypoints.sql @@ -0,0 +1,73 @@ +-- Wrathbone Siegesmith pathing +SET @NPC := 202159; +SET @PATH := @NPC*10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=646.5851,`position_y`=-191.1892,`position_z`=526.8476 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`) VALUES (@NPC,@PATH,1); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,646.5851,-191.1892,526.8476,0,0,0,100,0), +(@PATH,2,648.8837,-181.967,526.7226,0,0,0,100,0), +(@PATH,3,649.4167,-179.4531,526.7226,14000,0,0,100,0), +(@PATH,4,652.1736,-183.3594,526.7226,0,0,0,100,0), +(@PATH,5,648.5643,-188.309,526.8476,0,0,0,100,0), +(@PATH,6,642.5313,-193.4826,527.3874,0,0,0,100,0), +(@PATH,7,633.688,-200.741,528.941,12000,0,0,100,0), +(@PATH,8,641.9254,-196.5747,528.9726,0,0,0,100,0); + +-- Wrathbone Siegesmith pathing +SET @NPC := 201855; +SET @PATH := @NPC*10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=723.5469,`position_y`=-170.9497,`position_z`=527.5121 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`) VALUES (@NPC,@PATH,1); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,723.5469,-170.9497,527.5121,13000,0,0,100,0), +(@PATH,2,726.6484,-173.3438,527.1627,0,0,0,100,0), +(@PATH,3,726.6484,-174.3438,527.1627,0,0,0,100,0), +(@PATH,4,725.25,-175.2379,526.8134,0,0,0,100,0), +(@PATH,5,722.0521,-181.5122,526.8134,0,0,0,100,0), +(@PATH,6,721.2031,-187.8142,526.8134,0,0,0,100,0), +(@PATH,7,717.7917,-194.4358,526.8134,0,0,0,100,0), +(@PATH,8,719.3073,-202.2691,527.1509,0,0,0,100,0), +(@PATH,9,720.3403,-206.1198,527.7932,12000,0,0,100,0), +(@PATH,10,717.6111,-199.5035,526.9384,0,0,0,100,0), +(@PATH,11,717.566,-189.0642,526.8134,0,0,0,100,0), +(@PATH,12,718.5764,-182.3958,526.8134,0,0,0,100,0), +(@PATH,13,719.9531,-176.0729,526.8134,0,0,0,100,0); + +-- Forgemaster Garfrost pathing +SET @NPC := 201992; +SET @PATH := @NPC*10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=712.1371,`position_y`=-215.7014,`position_z`=527.066 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`auras`) VALUES (@NPC,@PATH,1,'68792'); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,712.1371,-215.7014,527.066,0,0,0,100,0), +(@PATH,2,719.507,-227.8559,527.066,3000,0,0,100,0), +(@PATH,3,712.1371,-215.7014,527.066,0,0,0,100,0), +(@PATH,4,685.1805,-207.349,526.8424,0,0,0,100,0), +(@PATH,5,664.5191,-203.3472,526.816,0,0,0,100,0), +(@PATH,6,645.033,-208.5295,528.941,0,0,0,100,0), +(@PATH,7,653.0729,-194.3681,526.7226,0,0,0,100,0), +(@PATH,8,664.8646,-195.2135,526.7226,0,0,0,100,0), +(@PATH,9,686.0816,-213.8264,526.8424,0,0,0,100,0), +(@PATH,10,697.9757,-221.6215,526.8424,0,0,0,100,0), +(@PATH,11,708.0903,-211.908,527.066,0,0,0,100,0), +(@PATH,12,717.8924,-204.6979,527.191,0,0,0,100,0), +(@PATH,13,699.0504,-201.3438,526.8424,0,0,0,100,0), +(@PATH,14,672.066,-201.1493,526.8424,0,0,0,100,0), +(@PATH,15,655.9496,-203.4931,526.816,0,0,0,100,0), +(@PATH,16,672.066,-201.1493,526.8424,0,0,0,100,0), +(@PATH,17,699.0504,-201.3438,526.8424,0,0,0,100,0), +(@PATH,18,717.8924,-204.6979,527.191,0,0,0,100,0), +(@PATH,19,708.0903,-211.908,527.066,0,0,0,100,0), +(@PATH,20,697.9757,-221.6215,526.8424,0,0,0,100,0), +(@PATH,21,686.0816,-213.8264,526.8424,0,0,0,100,0), +(@PATH,22,664.8646,-195.2135,526.7226,0,0,0,100,0), +(@PATH,23,653.0729,-194.3681,526.7226,0,0,0,100,0), +(@PATH,24,645.033,-208.5295,528.941,0,0,0,100,0), +(@PATH,25,664.5191,-203.3472,526.816,0,0,0,100,0), +(@PATH,26,685.1805,-207.349,526.8424,0,0,0,100,0); diff --git a/sql/updates/world/2012_05_07_01_world_sai.sql b/sql/updates/world/2012_05_07_01_world_sai.sql new file mode 100644 index 00000000000..83676d31df9 --- /dev/null +++ b/sql/updates/world/2012_05_07_01_world_sai.sql @@ -0,0 +1,51 @@ +-- Ymirjar Skycaller SAI addition +SET @ENTRY := 31260; -- NPC entry +UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY AND `id`=2; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,2,0,25,0,100,6,0,0,0,0,11,46598,0,0,0,0,0,19,36891,20,0,0,0,0,0, 'Ymirjar Skycaller - Reset - Cast Ride Vehicle Hardcoded'); + +-- Wrathbone Laborer SAI +SET @ENTRY := -201800; -- NPC entry +SET @SPELL1 := 70302; -- Blinding Dirt +SET @SPELL2 := 70278; -- Puncture Wound +SET @SPELL3 := 69572; -- Shovelled! +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,6,7000,8000,10000,11000,11,@SPELL1,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Blinding Dirt'), +(@ENTRY,0,1,0,0,0,100,6,8000,9000,9000,10000,11,@SPELL2,0,0,0,0,0,2,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Puncture Wound (Normal)'), +(@ENTRY,0,2,0,0,0,100,6,5000,6000,7000,8000,11,@SPELL3,0,0,0,0,0,5,0,0,0,0,0,0,0, 'Wrathbone Laborer - Combat - Cast Shovelled! (Normal)'); + +-- Wrathbone Laborer pathing +SET @NPC := 201800; +SET @PATH := @NPC*10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=584.4202,`position_y`=188.9149,`position_z`=509.6726 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`) VALUES (@NPC,@PATH,1); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,584.4202,188.9149,509.6726,0,0,0,100,0), +(@PATH,2,583.6736,193.9653,509.7404,3000,0,48,100,0), +(@PATH,3,583.6736,193.9653,509.7404,3000,0,48,100,0), +(@PATH,4,583.6736,193.9653,509.7404,3000,0,48,100,0), +(@PATH,5,583.6736,193.9653,509.7404,3000,0,48,100,0), +(@PATH,6,594.0781,190.2622,508.8613,0,0,0,100,0), +(@PATH,7,604.9809,191.5451,507.6583,0,0,0,100,0), +(@PATH,8,617.8438,191.3455,507.5206,0,0,0,100,0), +(@PATH,9,633.1597,186.8281,508.6275,3000,0,48,100,0), +(@PATH,10,633.1597,186.8281,508.6275,3000,0,48,100,0), +(@PATH,11,624.3472,190.9705,507.7706,0,0,0,100,0), +(@PATH,12,613.3229,189.9236,507.3956,0,0,0,100,0), +(@PATH,13,604.5156,189.651,507.3956,0,0,0,100,0), +(@PATH,14,593.9844,187.4479,508.9778,0,0,0,100,0), +(@PATH,15,584.4202,188.9149,509.6726,0,0,0,100,0); +DELETE FROM `waypoint_scripts` WHERE `id`=48; +INSERT INTO `waypoint_scripts` (`id`,`delay`,`command`,`datalong`,`guid`) VALUES +(48,0,1,38,67); + +-- Add Overlord Drakuru riders to Stonespine Gargoyle +UPDATE creature_template SET InhabitType=4,`flags_extra`=`flags_extra`|128 WHERE entry=28717; +DELETE FROM `creature` WHERE `id`=28717 AND `map`=658; +DELETE FROM `vehicle_template_accessory` WHERE `entry`=36896; +INSERT INTO `vehicle_template_accessory` (`entry`,`accessory_entry`,`seat_id`,`minion`,`description`,`summontype`,`summontimer`) VALUES +(36896,28717,1,0, 'Overlord Drakuru on Stonespine Gargoyle',6,30000); diff --git a/sql/updates/world/2012_05_08_00_world_sai.sql b/sql/updates/world/2012_05_08_00_world_sai.sql new file mode 100644 index 00000000000..8a776b5f2d2 --- /dev/null +++ b/sql/updates/world/2012_05_08_00_world_sai.sql @@ -0,0 +1,89 @@ +-- [Q] Arelion's Mistress +-- Viera Sunwhisper SAI +-- Twinkle SAI +SET @ENTRY_VIERA := 17226; +SET @ENTRY_TWINKLE := 17230; +SET @QUEST_PLEASURES := 9483; +SET @SPELL_RETRIBUTION := 30077; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN (@ENTRY_VIERA,@ENTRY_TWINKLE); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY_VIERA,@ENTRY_TWINKLE,@ENTRY_VIERA*100,@ENTRY_VIERA*100+1); +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY_VIERA,0,0,0,20,0,100,0,@QUEST_PLEASURES,0,0,0,80,@ENTRY_VIERA*100,0,0,0,0,0,1,0,0,0,0,0,0,0,'Viera Sunwhisper - On Quest Finish - Run Script'), +(@ENTRY_VIERA*100,9,0,0,0,0,100,0,0,0,0,0,81,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Viera Sunwhisper - On Script - Remove Quest Flag"), +(@ENTRY_VIERA*100,9,1,0,0,0,100,0,2000,2000,0,0,53,0,@ENTRY_VIERA,0,0,0,0,1,0,0,0,0,0,0,0,'Viera Sunwhisper - On Script - Start WP 1'), +(@ENTRY_VIERA*100,9,2,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'Viera Sunwhisper - On Script - Say Line 0'), +(@ENTRY_VIERA*100,9,3,0,0,0,100,0,0,0,0,0,91,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Viera Sunwhisper - On Script - Stand Up'), +(@ENTRY_VIERA*100,9,4,0,0,0,100,0,6500,6500,0,0,45,0,1,0,0,0,0,10,61963,@ENTRY_TWINKLE,0,0,0,0,0,'Viera Sunwhisper - On Script - Set Data 0 1 Twinkle'), +(@ENTRY_VIERA,0,1,2,40,0,100,0,10,@ENTRY_VIERA,0,0,66,0,0,0,0,0,0,11,@ENTRY_TWINKLE,15,0,0,0,0,0,'Viera Sunwhisper - On WP 10 - Face Twinkle'), +(@ENTRY_VIERA,0,2,0,61,0,100,0,0,0,0,0,54,1000000,0,0,0,0,0,1,0,0,0,0,0,0,0,'Viera Sunwhisper - On WP 10 - Pause WP'), + +(@ENTRY_TWINKLE,0,0,0,38,0,100,0,0,1,0,0,53,1,@ENTRY_TWINKLE,0,0,0,0,1,0,0,0,0,0,0,0,'Twinkle - On Data 0 1 Set - Start WP 1 (run)'), +(@ENTRY_TWINKLE,0,1,0,40,0,100,0,13,@ENTRY_TWINKLE,0,0,54,1000000,0,0,0,0,0,1,0,0,0,0,0,0,0,'Twinkle - On WP 13 - Pause WP'), +(@ENTRY_TWINKLE,0,2,0,38,0,100,0,1,2,0,0,53,1,@ENTRY_TWINKLE*10,0,0,0,0,1,0,0,0,0,0,0,0,'Twinkle - On Data Set 1 2 - Start WP 2 (run)'), +(@ENTRY_TWINKLE,0,3,0,40,0,100,0,4,@ENTRY_TWINKLE*10,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Viera Sunwhisper - On WP 4 (2) - Force Despawn'), + +(@ENTRY_VIERA,0,3,0,8,0,100,0,@SPELL_RETRIBUTION,0,0,0,80,@ENTRY_VIERA*100+1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Viera Sunwhisper - On Spellhit - Run Second Script'), +(@ENTRY_VIERA*100+1,9,0,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Viera Sunwhisper - On Script - Say Line 1'), +(@ENTRY_VIERA*100+1,9,1,0,0,0,100,0,0,0,0,0,33,@ENTRY_VIERA,0,0,0,0,0,7,0,0,0,0,0,0,0,'Viera Sunwhisper - On Script - Quest Credit'), +(@ENTRY_VIERA*100+1,9,2,0,0,0,100,0,3000,3000,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Viera Sunwhisper - On Script - Say Line 2'), +(@ENTRY_VIERA*100+1,9,3,0,0,0,100,0,5000,5000,0,0,1,0,0,0,0,0,0,9,@ENTRY_TWINKLE,0,25,0,0,0,0,'Twinkle - On Script - Say Line 0'), +(@ENTRY_VIERA*100+1,9,4,0,0,0,100,0,2000,2000,0,0,1,3,0,0,0,0,0,1,0,0,0,0,0,0,0,'Viera Sunwhisper - On Script - Say Line 3'), +(@ENTRY_VIERA*100+1,9,5,0,0,0,100,0,0,0,0,0,45,1,2,0,0,0,0,10,61963,@ENTRY_TWINKLE,0,0,0,0,0,'Viera Sunwhisper - On Script - Set Data 1 2 Twinkle'), +(@ENTRY_VIERA*100+1,9,6,0,0,0,100,0,0,0,0,0,53,1,@ENTRY_VIERA*10,0,0,0,0,1,0,0,0,0,0,0,0,'Viera Sunwhisper - On Script - Start WP 2 (run)'), +(@ENTRY_VIERA,0,4,0,40,0,100,0,4,@ENTRY_VIERA*10,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Viera Sunwhisper - On WP 4 (2) - Force Despawn'); + +-- Waypoints for Viera Sunwhisper +DELETE FROM `waypoints` WHERE `entry` IN (@ENTRY_VIERA,@ENTRY_VIERA*10); +INSERT INTO `waypoints` (`entry`,`pointid`,`position_x`,`position_y`,`position_z`,`point_comment`) VALUES +(@ENTRY_VIERA,1,-653.739197,4145.138184,64.200729,'Viera Sunwhisper'), +(@ENTRY_VIERA,2,-658.875732,4147.715332,64.168304,'Viera Sunwhisper'), +(@ENTRY_VIERA,3,-681.465088,4147.636230,64.118073,'Viera Sunwhisper'), +(@ENTRY_VIERA,4,-686.400696,4161.865234,59.707859,'Viera Sunwhisper'), +(@ENTRY_VIERA,5,-695.956909,4179.237305,57.618931,'Viera Sunwhisper'), +(@ENTRY_VIERA,6,-699.832153,4189.959473,57.503750,'Viera Sunwhisper'), +(@ENTRY_VIERA,7,-708.518616,4184.436035,55.275894,'Viera Sunwhisper'), +(@ENTRY_VIERA,8,-716.137268,4178.130371,52.637508,'Viera Sunwhisper'), +(@ENTRY_VIERA,9,-719.865295,4174.992676,51.554867,'Viera Sunwhisper'), +(@ENTRY_VIERA,10,-720.839417,4162.232422,50.805923,'Viera Sunwhisper'), + +(@ENTRY_VIERA*10,1,-722.323486,4147.936523,50.337898,'Viera Sunwhisper'), +(@ENTRY_VIERA*10,2,-726.639343,4125.156250,48.479683,'Viera Sunwhisper'), +(@ENTRY_VIERA*10,3,-727.648315,4109.684082,47.528461,'Viera Sunwhisper'), +(@ENTRY_VIERA*10,4,-727.874329,4093.438721,46.446579,'Viera Sunwhisper'); + +-- Waypoints for Twinkle +DELETE FROM `waypoints` WHERE `entry` IN (@ENTRY_TWINKLE,@ENTRY_TWINKLE*10); +INSERT INTO `waypoints` (`entry`,`pointid`,`position_x`,`position_y`,`position_z`,`point_comment`) VALUES +(@ENTRY_TWINKLE,1,-605.445190,4165.205078,64.081802,'Twinkle'), +(@ENTRY_TWINKLE,2,-619.293335,4161.776855,63.217815,'Twinkle'), +(@ENTRY_TWINKLE,3,-629.536560,4153.708984,64.067123,'Twinkle'), +(@ENTRY_TWINKLE,4,-644.773438,4151.062988,64.174675,'Twinkle'), +(@ENTRY_TWINKLE,5,-658.875732,4147.715332,64.168304,'Twinkle'), +(@ENTRY_TWINKLE,6,-681.465088,4147.636230,64.118073,'Twinkle'), +(@ENTRY_TWINKLE,7,-686.400696,4161.865234,59.707859,'Twinkle'), +(@ENTRY_TWINKLE,8,-695.956909,4179.237305,57.618931,'Twinkle'), +(@ENTRY_TWINKLE,9,-699.832153,4189.959473,57.503750,'Twinkle'), +(@ENTRY_TWINKLE,10,-708.518616,4184.436035,55.275894,'Twinkle'), +(@ENTRY_TWINKLE,11,-716.137268,4178.130371,52.637508,'Twinkle'), +(@ENTRY_TWINKLE,12,-719.865295,4174.992676,51.554867,'Twinkle'), +(@ENTRY_TWINKLE,13,-720.636292,4166.637695,50.815567,'Twinkle'), + +(@ENTRY_TWINKLE*10,1,-722.323486,4147.936523,50.337898,'Twinkle'), +(@ENTRY_TWINKLE*10,2,-726.639343,4125.156250,48.479683,'Twinkle'), +(@ENTRY_TWINKLE*10,3,-727.648315,4109.684082,47.528461,'Twinkle'), +(@ENTRY_TWINKLE*10,4,-727.874329,4093.438721,46.446579,'Twinkle'); + +-- Spawn spell focus object on correct position +DELETE FROM `gameobject` WHERE `id`=300071 AND `guid`=303; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(303,300071,530,1,1,-720.803,4162.77,50.7916,4.61029,0,0,0.742267,-0.670104,300,0,1); + +-- Texts +DELETE FROM `creature_text` WHERE `entry` IN (@ENTRY_VIERA,@ENTRY_TWINKLE); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY_VIERA,0,0,"Ok, let's go. I know just the perfect spot!",12,0,100,0,0,0,'Viera Sunwhisper'), +(@ENTRY_VIERA,1,0,"I can't wait to try this wine!",12,0,100,0,0,0,'Viera Sunwhisper'), +(@ENTRY_VIERA,2,0,"What... is happening... to me? Get this cat away from me!",12,0,100,0,0,0,'Viera Sunwhisper'), +(@ENTRY_VIERA,3,0,"%s scurries away, attempting to flee from Twinkle",16,0,100,0,0,0,'Viera Sunwhisper'), + +(@ENTRY_TWINKLE,0,0,"%s looks at Viera Sunwhisper with very hungry eyes",16,0,100,0,0,0,'Twinkle'); diff --git a/sql/updates/world/2012_05_08_01_world_gameobject.sql b/sql/updates/world/2012_05_08_01_world_gameobject.sql new file mode 100644 index 00000000000..b83d02b4762 --- /dev/null +++ b/sql/updates/world/2012_05_08_01_world_gameobject.sql @@ -0,0 +1,5 @@ +-- Add Missing Ice Wall, Pit of Saron +SET @GUID := 305; +DELETE FROM `gameobject` WHERE `guid`=@GUID; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(@GUID,201885,658,3,1,932.2674,-80.6684,591.6761,2.286379,0,0,0,0,300,100,1); diff --git a/sql/updates/world/2012_05_08_01_world_misc.sql b/sql/updates/world/2012_05_08_01_world_misc.sql new file mode 100644 index 00000000000..8f19132fa27 --- /dev/null +++ b/sql/updates/world/2012_05_08_01_world_misc.sql @@ -0,0 +1,9 @@ +-- Spell area spells for entering POS +DELETE FROM `spell_area` WHERE `spell` IN (70056,70057); +INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES +(70056,4904,0,0,0,0,690,2,1), -- Send Script Event (22717) +(70057,4904,0,0,0,0,1101,2,1); -- Send Script Event (22718) + +-- Fix flags and equipment for Ymirjar Deathbringer +UPDATE `creature_template` SET `unit_flags`=`unit_flags`&~256 WHERE `entry` IN (36892,37641); +UPDATE `creature_template` SET `equipment_id`=2444 WHERE `entry`=37641; diff --git a/sql/updates/world/2012_05_09_00_world_spell_target_position.sql b/sql/updates/world/2012_05_09_00_world_spell_target_position.sql new file mode 100644 index 00000000000..a6e9d7289b7 --- /dev/null +++ b/sql/updates/world/2012_05_09_00_world_spell_target_position.sql @@ -0,0 +1,7 @@ +DELETE FROM `spell_target_position` WHERE `id` IN (67834, 68081); +INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`target_position_y`,`target_position_z`,`target_orientation`) VALUES +(67834, 571, 3167.01, 5586.04, 880.067, 0), +(68081, 571, 5857.252, 516.8015, 599.82, 2.987); + +UPDATE `spell_target_position` SET `target_position_x`=6136.89,`target_position_y`=4785.55,`target_position_z`=100.673 WHERE `id`=67835; +UPDATE `spell_target_position` SET `target_position_x`=8301.39,`target_position_y`=1501.34,`target_position_z`=870.555 WHERE `id`=67836; diff --git a/sql/updates/world/2012_05_09_01_world_commands.sql b/sql/updates/world/2012_05_09_01_world_commands.sql new file mode 100644 index 00000000000..dcd4c9130eb --- /dev/null +++ b/sql/updates/world/2012_05_09_01_world_commands.sql @@ -0,0 +1,8 @@ +DELETE FROM `trinity_string` WHERE `entry` = 555; +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES +(555,"SetData performed on [GUID: %u, entry: %u, name: %s] Field: %u, Data: %u, with %s"); + +DELETE FROM `command` WHERE `name` = "npc set data"; +INSERT INTO `command` (`name`,`security`,`help`) VALUES +("npc set data", 3, "Syntax: .npc set data $field $data +Sets data for the selected creature. Used for testing Scripting"); diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index 9963ade54f9..8076f800356 100755 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -91,10 +91,15 @@ AccountOpResult DeleteAccount(uint32 accountId) stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_TUTORIALS); stmt->setUInt32(0, accountId); CharacterDatabase.Execute(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ACCOUNT_DATA); stmt->setUInt32(0, accountId); CharacterDatabase.Execute(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_BAN); + stmt->setUInt32(0, accountId); + CharacterDatabase.Execute(stmt); + SQLTransaction trans = LoginDatabase.BeginTransaction(); stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT); @@ -109,6 +114,10 @@ AccountOpResult DeleteAccount(uint32 accountId) stmt->setUInt32(0, accountId); trans->Append(stmt); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_BANNED); + stmt->setUInt32(0, accountId); + trans->Append(stmt); + LoginDatabase.CommitTransaction(trans); return AOR_OK; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 8a11edf85e6..ccc6a2305b4 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -86,11 +86,8 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff) setWaterFallTimer(BG_DS_WATERFALL_WARNING_DURATION); setWaterFallStatus(BG_DS_WATERFALL_STATUS_WARNING); } - else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision and perform knockback + else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision and start knockback timer { - if (Creature* waterSpout = GetBgMap()->GetCreature(BgCreatures[BG_DS_NPC_WATERFALL_KNOCKBACK])) - waterSpout->CastSpell(waterSpout, BG_DS_SPELL_WATER_SPOUT, true); - if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1])) gob->SetGoState(GO_STATE_READY); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index 12ed91fc922..aaf08ba1313 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -66,9 +66,9 @@ enum BattlegroundDSData { // These values are NOT blizzlike... need the correct data! BG_DS_WATERFALL_TIMER_MIN = 30000, BG_DS_WATERFALL_TIMER_MAX = 60000, - BG_DS_WATERFALL_WARNING_DURATION = 7000, - BG_DS_WATERFALL_DURATION = 10000, - BG_DS_WATERFALL_KNOCKBACK_TIMER = 500, + BG_DS_WATERFALL_WARNING_DURATION = 5000, + BG_DS_WATERFALL_DURATION = 30000, + BG_DS_WATERFALL_KNOCKBACK_TIMER = 1500, BG_DS_PIPE_KNOCKBACK_FIRST_DELAY = 5000, BG_DS_PIPE_KNOCKBACK_DELAY = 3000, @@ -118,7 +118,7 @@ class BattlegroundDS : public Battleground void setWaterFallStatus(uint8 status) { _waterfallStatus = status; }; uint32 getWaterFallTimer() { return _waterfallTimer; }; void setWaterFallTimer(uint32 timer) { _waterfallTimer = timer; }; - uint32 getWaterFallKnockbackTimer() { return _waterfallTimer; }; + uint32 getWaterFallKnockbackTimer() { return _waterfallKnockbackTimer; }; void setWaterFallKnockbackTimer(uint32 timer) { _waterfallKnockbackTimer = timer; }; uint8 getPipeKnockBackCount() { return _pipeKnockBackCount; }; void setPipeKnockBackCount(uint8 count) { _pipeKnockBackCount = count; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 45335ae7b8b..ccc9493e234 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -931,7 +931,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period) float o = 1; // creates the Gameobject - if (!t->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_MO_TRANSPORT), goEntry, mapid, x, y, z, o, 100, 0)) + if (!t->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_MO_TRANSPORT), goEntry, mapid, x, y, z, o, 255, 0)) { delete t; return NULL; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 6d784488aad..977897b8d48 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -534,16 +534,16 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui if (eventType == go->GetGOInfo()->building.damagedEvent) { - uint32 i = GetGateIDFromDestroyEventID(eventType); + uint32 i = getGateIdFromDamagedOrDestroyEventId(eventType); GateStatus[i] = BG_SA_GATE_DAMAGED; - uint32 uws = GetWorldStateFromGateID(i); + uint32 uws = getWorldStateFromGateId(i); if (uws) UpdateWorldState(uws, GateStatus[i]); } if (eventType == go->GetGOInfo()->building.destroyedEvent) { - if (go->GetGOInfo()->building.destroyedEvent == 19837) + if (go->GetGOInfo()->building.destroyedEvent == BG_SA_EVENT_ANCIENT_GATE_DESTROYED) SendWarningToAll(LANG_BG_SA_CHAMBER_BREACHED); else SendWarningToAll(LANG_BG_SA_WAS_DESTROYED, go->GetGOInfo()->name.c_str()); @@ -603,7 +603,7 @@ void BattlegroundSA::DemolisherStartState(bool start) void BattlegroundSA::DestroyGate(Player* player, GameObject* go) { - uint32 i = GetGateIDFromDestroyEventID(go->GetGOInfo()->building.destroyedEvent); + uint32 i = getGateIdFromDamagedOrDestroyEventId(go->GetGOInfo()->building.destroyedEvent); if (!GateStatus[i]) return; @@ -612,7 +612,7 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go) if (g->GetGOValue()->Building.Health == 0) { GateStatus[i] = BG_SA_GATE_DESTROYED; - uint32 uws = GetWorldStateFromGateID(i); + uint32 uws = getWorldStateFromGateId(i); if (uws) UpdateWorldState(uws, GateStatus[i]); bool rewardHonor = true; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 76a772ff978..c18806490f2 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -30,8 +30,8 @@ class BattlegroundSAScore : public BattlegroundScore uint8 gates_destroyed; }; -#define BG_SA_FLAG_AMOUNT 3 -#define BG_SA_DEMOLISHER_AMOUNT 4 +#define BG_SA_FLAG_AMOUNT 3 +#define BG_SA_DEMOLISHER_AMOUNT 4 enum BG_SA_Status { @@ -45,45 +45,66 @@ enum BG_SA_Status enum BG_SA_GateState { - BG_SA_GATE_OK = 1, - BG_SA_GATE_DAMAGED = 2, - BG_SA_GATE_DESTROYED = 3 + BG_SA_GATE_OK = 1, + BG_SA_GATE_DAMAGED = 2, + BG_SA_GATE_DESTROYED = 3 +}; + +enum BG_SA_EventIdGate +{ + BG_SA_EVENT_BLUE_GATE_DAMAGED = 19040, + BG_SA_EVENT_BLUE_GATE_DESTROYED = 19045, + + BG_SA_EVENT_GREEN_GATE_DAMAGED = 19041, + BG_SA_EVENT_GREEN_GATE_DESTROYED = 19046, + + BG_SA_EVENT_RED_GATE_DAMAGED = 19042, + BG_SA_EVENT_RED_GATE_DESTROYED = 19047, + + BG_SA_EVENT_PURPLE_GATE_DAMAGED = 19043, + BG_SA_EVENT_PURPLE_GATE_DESTROYED = 19048, + + BG_SA_EVENT_YELLOW_GATE_DAMAGED = 19044, + BG_SA_EVENT_YELLOW_GATE_DESTROYED = 19049, + + BG_SA_EVENT_ANCIENT_GATE_DAMAGED = 19836, + BG_SA_EVENT_ANCIENT_GATE_DESTROYED = 19837 }; enum BG_SA_Timers { - BG_SA_BOAT_START = 60*IN_MILLISECONDS, - BG_SA_WARMUPLENGTH = 120*IN_MILLISECONDS, - BG_SA_ROUNDLENGTH = 600*IN_MILLISECONDS + BG_SA_BOAT_START = 60 * IN_MILLISECONDS, + BG_SA_WARMUPLENGTH = 120 * IN_MILLISECONDS, + BG_SA_ROUNDLENGTH = 600 * IN_MILLISECONDS }; enum BG_SA_WorldStates { - BG_SA_TIMER_MINS = 3559, - BG_SA_TIMER_SEC_TENS = 3560, - BG_SA_TIMER_SEC_DECS = 3561, - BG_SA_ALLY_ATTACKS = 4352, - BG_SA_HORDE_ATTACKS = 4353, - BG_SA_PURPLE_GATEWS = 3614, - BG_SA_RED_GATEWS = 3617, - BG_SA_BLUE_GATEWS = 3620, - BG_SA_GREEN_GATEWS = 3623, - BG_SA_YELLOW_GATEWS = 3638, - BG_SA_ANCIENT_GATEWS = 3849, - BG_SA_LEFT_GY_ALLIANCE = 3635, - BG_SA_RIGHT_GY_ALLIANCE = 3636, - BG_SA_CENTER_GY_ALLIANCE = 3637, - BG_SA_RIGHT_ATT_TOKEN_ALL = 3627, - BG_SA_LEFT_ATT_TOKEN_ALL = 3626, - BG_SA_LEFT_ATT_TOKEN_HRD = 3629, - BG_SA_RIGHT_ATT_TOKEN_HRD = 3628, - BG_SA_HORDE_DEFENCE_TOKEN = 3631, - BG_SA_ALLIANCE_DEFENCE_TOKEN = 3630, - BG_SA_RIGHT_GY_HORDE = 3632, - BG_SA_LEFT_GY_HORDE = 3633, - BG_SA_CENTER_GY_HORDE = 3634, - BG_SA_BONUS_TIMER = 0xdf3, - BG_SA_ENABLE_TIMER = 3564, + BG_SA_TIMER_MINS = 3559, + BG_SA_TIMER_SEC_TENS = 3560, + BG_SA_TIMER_SEC_DECS = 3561, + BG_SA_ALLY_ATTACKS = 4352, + BG_SA_HORDE_ATTACKS = 4353, + BG_SA_PURPLE_GATEWS = 3614, + BG_SA_RED_GATEWS = 3617, + BG_SA_BLUE_GATEWS = 3620, + BG_SA_GREEN_GATEWS = 3623, + BG_SA_YELLOW_GATEWS = 3638, + BG_SA_ANCIENT_GATEWS = 3849, + BG_SA_LEFT_GY_ALLIANCE = 3635, + BG_SA_RIGHT_GY_ALLIANCE = 3636, + BG_SA_CENTER_GY_ALLIANCE = 3637, + BG_SA_RIGHT_ATT_TOKEN_ALL = 3627, + BG_SA_LEFT_ATT_TOKEN_ALL = 3626, + BG_SA_LEFT_ATT_TOKEN_HRD = 3629, + BG_SA_RIGHT_ATT_TOKEN_HRD = 3628, + BG_SA_HORDE_DEFENCE_TOKEN = 3631, + BG_SA_ALLIANCE_DEFENCE_TOKEN = 3630, + BG_SA_RIGHT_GY_HORDE = 3632, + BG_SA_LEFT_GY_HORDE = 3633, + BG_SA_CENTER_GY_HORDE = 3634, + BG_SA_BONUS_TIMER = 0xdf3, + BG_SA_ENABLE_TIMER = 3564, }; enum npc @@ -122,14 +143,14 @@ enum BG_SA_NPCs enum BG_SA_Boat { - BG_SA_BOAT_ONE_A =193182, - BG_SA_BOAT_TWO_H =193183, - BG_SA_BOAT_ONE_H =193184, - BG_SA_BOAT_TWO_A =193185, + BG_SA_BOAT_ONE_A = 193182, + BG_SA_BOAT_TWO_H = 193183, + BG_SA_BOAT_ONE_H = 193184, + BG_SA_BOAT_TWO_A = 193185, }; -const uint32 BG_SA_NpcEntries[BG_SA_MAXNPC] = - { +uint32 const BG_SA_NpcEntries[BG_SA_MAXNPC] = +{ NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, @@ -140,25 +161,25 @@ const uint32 BG_SA_NpcEntries[BG_SA_MAXNPC] = NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, - //4 beach demolishers + // 4 beach demolishers NPC_DEMOLISHER_SA, NPC_DEMOLISHER_SA, NPC_DEMOLISHER_SA, NPC_DEMOLISHER_SA, - //Triggers + // Triggers 23472, 23472, 23472, 23472, 23472, - //Used Demolisher Salesman + // Used Demolisher Salesman NPC_RIGGER_SPARKLIGHT, NPC_GORGRIL_RIGSPARK - }; +}; -const float BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] = +float const BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] = { - //Cannons + // Cannons { 1436.429f, 110.05f, 41.407f, 5.4f }, { 1404.9023f, 84.758f, 41.183f, 5.46f }, { 1068.693f, -86.951f, 93.81f, 0.02f }, @@ -169,21 +190,21 @@ const float BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] = { 1249.634f, -224.189f, 66.72f, 0.635f }, { 1236.213f, 92.287f, 64.965f, 5.751f }, { 1215.11f, 57.772f, 64.739f, 5.78f }, - //Demolishers + // Demolishers { 1611.597656f, -117.270073f, 8.719355f, 2.513274f}, { 1575.562500f, -158.421875f, 5.024450f, 2.129302f}, { 1618.047729f, 61.424641f, 7.248210f, 3.979351f}, { 1575.103149f, 98.873344f, 2.830360f, 3.752458f}, - //trigger + // Triggers { 1453.49f, -250.453f, 30.896f, 4.2883f}, { 1377.05f, 97.036f, 30.8605f, 2.46539f}, { 1186.05f, 58.8048f, 56.5491f, 2.75992f}, { 1042.83f, -72.839f, 84.8145f, 3.58615f}, { 1233.62f, -250.49f, 55.4036f, 3.7016f}, - //Npcs + // Npcs { 1348.644165f, -298.786469f, 31.080130f, 1.710423f}, { 1358.191040f, 195.527786f, 31.018187f, 4.171337f}, - //Demolishers2 + // Demolishers 2 { 1371.055786f, -317.071136f, 35.007359f, 1.947460f}, { 1424.034912f, -260.195190f, 31.084425f, 2.820013f}, { 1353.139893f, 223.745438f, 35.265411f, 4.343684f}, @@ -221,7 +242,7 @@ enum BG_SA_Objects BG_SA_MAXOBJ = BG_SA_BOMB+68 }; -const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = +float const BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = { { 1411.57f, 108.163f, 28.692f, 5.441f }, { 1055.452f, -108.1f, 82.134f, 0.034f }, @@ -230,30 +251,30 @@ const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = { 1214.681f, 81.21f, 53.413f, 5.745f }, { 878.555f, -108.2f, 117.845f, 0.0f }, { 836.5f, -108.8f, 120.219f, 0.0f }, - //Ships + // Ships { 2679.696777f, -826.891235f, 3.712860f, 5.78367f}, //rot2 1 rot3 0.0002f { 2574.003662f, 981.261475f, 2.603424f, 0.807696f}, - //Sigils + // Sigils { 1414.054f, 106.72f, 41.442f, 5.441f }, { 1060.63f, -107.8f, 94.7f, 0.034f }, { 1433.383f, -216.4f, 43.642f, 0.9736f }, { 1230.75f, -210.724f, 67.611f, 0.5023f }, { 1217.8f, 79.532f, 66.58f, 5.745f }, - //Flagpoles + // Flagpoles { 1215.114258f, -65.711861f, 70.084267f, -3.124123f}, {1338.863892f, -153.336533f, 30.895121f, -2.530723f}, {1309.124268f, 9.410645f, 30.893402f, -1.623156f}, - //Flags + // Flags { 1215.108032f, -65.715767f, 70.084267f, -3.124123f}, { 1338.859253f, -153.327316f, 30.895077f, -2.530723f}, { 1309.192017f, 9.416233f, 30.893402f, 1.518436f}, - //Portal + // Portal {1468.380005f, -225.798996f, 30.896200f, 0.0f}, //blue {1394.270020f, 72.551399f, 31.054300f, 0.0f}, //green {1065.260010f, -89.79501f, 81.073402f, 0.0f}, //yellow {1216.069946f, 47.904301f, 54.278198f, 0.0f}, //purple {1255.569946f, -233.548996f, 56.43699f, 0.0f}, //red - //Bombs + // Bombs {1333.45f, 211.354f, 31.0538f, 5.03666f}, {1334.29f, 209.582f, 31.0532f, 1.28088f}, {1332.72f, 210.049f, 31.0532f, 1.28088f}, @@ -337,7 +358,7 @@ const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = * to get horde ones. */ -const uint32 BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] = +uint32 const BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] = { 190722, 190727, @@ -367,7 +388,7 @@ const uint32 BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] = 190753 }; -const uint32 BG_SA_Factions[2] = +uint32 const BG_SA_Factions[2] = { 1732, 1735, @@ -392,13 +413,13 @@ const uint32 BG_SA_GYEntries[BG_SA_MAX_GY] = 1348, }; -const float BG_SA_GYOrientation[BG_SA_MAX_GY] = +float const BG_SA_GYOrientation[BG_SA_MAX_GY] = { 6.202f, - 1.926f, //right capturable GY - 3.917f, //left capturable GY - 3.104f, //center, capturable - 6.148f, //defender last GY + 1.926f, // right capturable GY + 3.917f, // left capturable GY + 3.104f, // center, capturable + 6.148f, // defender last GY }; struct BG_SA_RoundScore @@ -443,34 +464,60 @@ class BattlegroundSA : public Battleground /// Called when a player use a gamobject (relic) virtual void EventPlayerUsedGO(Player* Source, GameObject* object); /// Return gate id, relative to bg data, according to gameobject id - uint32 GetGateIDFromDestroyEventID(uint32 id) + uint32 getGateIdFromDamagedOrDestroyEventId(uint32 id) { - uint32 i = 0; switch (id) { - case 19046: i = BG_SA_GREEN_GATE; break; //Green gate destroyed - case 19045: i = BG_SA_BLUE_GATE; break; //blue gate - case 19047: i = BG_SA_RED_GATE; break; //red gate - case 19048: i = BG_SA_PURPLE_GATE; break; //purple gate - case 19049: i = BG_SA_YELLOW_GATE; break; //yellow gate - case 19837: i = BG_SA_ANCIENT_GATE; break; //ancient gate + // Green gate + case BG_SA_EVENT_GREEN_GATE_DAMAGED: + case BG_SA_EVENT_GREEN_GATE_DESTROYED: + return BG_SA_GREEN_GATE; + // Blue gate + case BG_SA_EVENT_BLUE_GATE_DAMAGED: + case BG_SA_EVENT_BLUE_GATE_DESTROYED: + return BG_SA_BLUE_GATE; + // Red gate + case BG_SA_EVENT_RED_GATE_DAMAGED: + case BG_SA_EVENT_RED_GATE_DESTROYED: + return BG_SA_RED_GATE; + // Purple gate + case BG_SA_EVENT_PURPLE_GATE_DAMAGED: + case BG_SA_EVENT_PURPLE_GATE_DESTROYED: + return BG_SA_PURPLE_GATE; + // Yellow gate + case BG_SA_EVENT_YELLOW_GATE_DAMAGED: + case BG_SA_EVENT_YELLOW_GATE_DESTROYED: + return BG_SA_YELLOW_GATE; + // Ancient gate + case BG_SA_EVENT_ANCIENT_GATE_DAMAGED: + case BG_SA_EVENT_ANCIENT_GATE_DESTROYED: + return BG_SA_ANCIENT_GATE; + default: + break; } - return i; + return 0; } /// Return worldstate id, according to door id - uint32 GetWorldStateFromGateID(uint32 id) + uint32 getWorldStateFromGateId(uint32 id) { - uint32 uws = 0; switch (id) { - case BG_SA_GREEN_GATE: uws = BG_SA_GREEN_GATEWS; break; - case BG_SA_YELLOW_GATE: uws = BG_SA_YELLOW_GATEWS; break; - case BG_SA_BLUE_GATE: uws = BG_SA_BLUE_GATEWS; break; - case BG_SA_RED_GATE: uws = BG_SA_RED_GATEWS; break; - case BG_SA_PURPLE_GATE: uws = BG_SA_PURPLE_GATEWS; break; - case BG_SA_ANCIENT_GATE: uws = BG_SA_ANCIENT_GATEWS; break; + case BG_SA_GREEN_GATE: + return BG_SA_GREEN_GATEWS; + case BG_SA_YELLOW_GATE: + return BG_SA_YELLOW_GATEWS; + case BG_SA_BLUE_GATE: + return BG_SA_BLUE_GATEWS; + case BG_SA_RED_GATE: + return BG_SA_RED_GATEWS; + case BG_SA_PURPLE_GATE: + return BG_SA_PURPLE_GATEWS; + case BG_SA_ANCIENT_GATE: + return BG_SA_ANCIENT_GATEWS; + default: + break; } - return uws; + return 0; } /// Called on battleground ending diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 495178f18dd..d100dc645a2 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -476,7 +476,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target } //Alliance flag on ground(not in base) (returned or picked up again from ground!) - if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) + if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY) { if (Source->GetTeam() == ALLIANCE) { @@ -510,7 +510,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target } //Horde flag on ground(not in base) (returned or picked up again) - if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) + if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY) { if (Source->GetTeam() == HORDE) { diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 042f16be3cc..cc64a8e22dd 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -359,7 +359,6 @@ ChatCommand* ChatHandler::getCommandTable() { "summon", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleSummonCommand>, "", NULL }, { "groupsummon", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleGroupSummonCommand>, "", NULL }, { "commands", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleCommandsCommand>, "", NULL }, - { "demorph", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleDeMorphCommand>, "", NULL }, { "die", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleDieCommand>, "", NULL }, { "revive", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleReviveCommand>, "", NULL }, { "dismount", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleDismountCommand>, "", NULL }, diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp index cc638193b5a..52bdcd15163 100755 --- a/src/server/game/Chat/Commands/Level2.cpp +++ b/src/server/game/Chat/Commands/Level2.cpp @@ -205,22 +205,6 @@ bool ChatHandler::HandleItemMoveCommand(const char* args) return true; } -//demorph player or unit -bool ChatHandler::HandleDeMorphCommand(const char* /*args*/) -{ - Unit* target = getSelectedUnit(); - if (!target) - target = m_session->GetPlayer(); - - // check online security - else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target, 0)) - return false; - - target->DeMorph(); - - return true; -} - //kick player bool ChatHandler::HandleKickPlayerCommand(const char *args) { diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index ed89041ff66..acdf2b16f2a 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -135,7 +135,7 @@ CreatureBaseStats const* CreatureBaseStats::GetBaseStats(uint8 level, uint8 unit bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { - m_owner.ForcedDespawn(); + m_owner.DespawnOrUnsummon(); // since we are here, we are not TempSummon as object type cannot change during runtime return true; } @@ -1128,7 +1128,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) stmt->setUInt8(index++, uint8(GetDefaultMovementType())); stmt->setUInt32(index++, npcflag); stmt->setUInt32(index++, unit_flags); - stmt->setUInt32(index, dynamicflags); + stmt->setUInt32(index++, dynamicflags); trans->Append(stmt); WorldDatabase.CommitTransaction(trans); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index f6d03ca38b2..f6021a7d7ec 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -635,7 +635,6 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature void RemoveCorpse(bool setSpawnTime = true); - void ForcedDespawn(uint32 timeMSToDespawn = 0); void DespawnOrUnsummon(uint32 msTimeToDespawn = 0); time_t const& GetRespawnTime() const { return m_respawnTime; } @@ -763,6 +762,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature bool IsInvisibleDueToDespawn() const; bool CanAlwaysSee(WorldObject const* obj) const; private: + void ForcedDespawn(uint32 timeMSToDespawn = 0); + //WaypointMovementGenerator vars uint32 m_waypointID; uint32 m_path_id; diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index f58dd6b2e4d..e871f99b38c 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -222,9 +222,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3 SetGoType(GameobjectTypes(goinfo->type)); SetGoState(go_state); - - SetGoArtKit(0); // unknown what this is - SetByteValue(GAMEOBJECT_BYTES_1, 2, artKit); + SetGoArtKit(artKit); switch (goinfo->type) { diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 70b680c6ae0..fc1b56c4b8c 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -627,6 +627,11 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* dynamicFlags &= ~UNIT_DYNFLAG_LOOTABLE; } + // unit UNIT_DYNFLAG_TRACK_UNIT should only be sent to caster of SPELL_AURA_MOD_STALKED auras + if (Unit const* unit = ToUnit()) + if (dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT) + if (!unit->HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, target->GetGUID())) + dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT; *data << dynamicFlags; } // FG: pretend that OTHER players in own group are friendly ("blue") diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 7c70fe9358e..d38489ef5a9 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -17606,6 +17606,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) uint32 zoneId = GetZoneId(); std::map<uint64, Bag*> bagMap; // fast guid lookup for bags + std::map<uint64, Item*> invalidBagMap; // fast guid lookup for bags std::list<Item*> problematicItems; SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -17650,9 +17651,15 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) // Remember bags that may contain items in them if (err == EQUIP_ERR_OK) + { if (IsBagPos(item->GetPos())) if (Bag* pBag = item->ToBag()) bagMap[item->GetGUIDLow()] = pBag; + } + else + if (IsBagPos(item->GetPos())) + if (Bag* pBag = item->ToBag()) + invalidBagMap[item->GetGUIDLow()] = item; } else { @@ -17666,6 +17673,21 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) if (err == EQUIP_ERR_OK) item = StoreItem(dest, item, true); } + else if (invalidBagMap.find(bagGuid) != invalidBagMap.end()) + { + std::map<uint64, Item*>::iterator itr = invalidBagMap.find(bagGuid); + if (std::find(problematicItems.begin(),problematicItems.end(),itr->second) != problematicItems.end()) + err = EQUIP_ERR_INT_BAG_ERROR; + } + else + { + sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which doesnt have a valid bag (Bag GUID: %u, slot: %u). Possible cheat?", + GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot); + item->DeleteFromInventoryDB(trans); + delete item; + continue; + } + } // Item's state may have changed after storing diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 81a505b7acc..9578605ac6f 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -52,7 +52,7 @@ void MapManager::LoadTransports() uint32 period = fields[3].GetUInt32(); uint32 scriptId = sObjectMgr->GetScriptId(fields[4].GetCString()); - const GameObjectTemplate* goinfo = sObjectMgr->GetGameObjectTemplate(entry); + GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo) { @@ -86,7 +86,7 @@ void MapManager::LoadTransports() float o = 1.0f; // creates the Gameobject - if (!t->Create(lowguid, entry, mapid, x, y, z, o, 100, 0)) + if (!t->Create(lowguid, entry, mapid, x, y, z, o, 255, 0)) { delete t; continue; @@ -217,8 +217,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); - //SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); - SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64)); + SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); SetUInt32Value(GAMEOBJECT_LEVEL, m_period); SetEntry(goinfo->entry); diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 4ce05ff40d3..c297ce1e792 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -285,9 +285,6 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ // return; // Something went wrong in the spellsystem //} - // This is not good, we have to send update twice - accessory->SendMovementFlagUpdate(); - if (GetBase()->GetTypeId() == TYPEID_UNIT) sScriptMgr->OnInstallAccessory(this, accessory); } @@ -352,6 +349,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) unit->m_movementInfo.t_pos.m_orientation = 0; unit->m_movementInfo.t_time = 0; // 1 for player unit->m_movementInfo.t_seat = seat->first; + unit->m_movementInfo.t_guid = _me->GetGUID(); if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index a8492726e75..d5e85d2cf2f 100755 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1124,8 +1124,6 @@ void GameEventMgr::UnApplyEvent(uint16 event_id) UpdateEventNPCVendor(event_id, false); // update bg holiday UpdateBattlegroundSettings(); - // check for seasonal quest reset. - sWorld->ResetEventSeasonalQuests(event_id); } void GameEventMgr::ApplyNewEvent(uint16 event_id) @@ -1160,6 +1158,8 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id) UpdateEventNPCVendor(event_id, true); // update bg holiday UpdateBattlegroundSettings(); + // check for seasonal quest reset. + sWorld->ResetEventSeasonalQuests(event_id); } void GameEventMgr::UpdateEventNPCFlags(uint16 event_id) diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index e81822e72be..6ca31b22e37 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -972,7 +972,7 @@ namespace Trinity return; // too far - if (!u->IsWithinDistInMap(i_enemy, i_range)) + if (!u->IsWithinDistInMap(i_funit, i_range)) return; // only if see assisted creature's enemy diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index f1217e58b3f..b3d663e1850 100755 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -46,7 +46,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->SetSemaphoreTeleportFar(false); // get the teleport destination - WorldLocation &loc = GetPlayer()->GetTeleportDest(); + WorldLocation const loc = GetPlayer()->GetTeleportDest(); // possible errors in the coordinate validity check if (!MapManager::IsValidMapCoord(loc)) diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 4b07d19bd7a..aec72835d86 100755 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -522,8 +522,9 @@ enum TrinityStrings LANG_YOURS_EXPLORE_SET_ALL = 553, LANG_YOURS_EXPLORE_SET_NOTHING = 554, + LANG_NPC_SETDATA = 555, + //! Old ones now free: - // LANG_HOVER_ENABLED = 555, // LANG_HOVER_DISABLED = 556, LANG_YOURS_LEVEL_UP = 557, diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp index 311b69c06b7..a8bdb698432 100755 --- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp @@ -25,7 +25,6 @@ void HomeMovementGenerator<Creature>::Initialize(Creature & owner) { - owner.AddUnitState(UNIT_STATE_EVADE); _setTargetLocation(owner); } diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 81fe1606ede..25730f92161 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -107,7 +107,7 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature) i_currentNode = (i_currentNode+1) % i_path->size(); } - const WaypointData *node = i_path->at(i_currentNode); + WaypointData const* node = i_path->at(i_currentNode); m_isArrivalDone = false; @@ -116,7 +116,8 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature) Movement::MoveSplineInit init(creature); init.MoveTo(node->x, node->y, node->z); - if (node->orientation != 100 && node->delay != 0) + //! Accepts angles such as 0.00001 and -0.00001, 0 must be ignored, default value in waypoint table + if (node->orientation && node->delay) init.SetFacing(node->orientation); init.SetWalk(!node->run); diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 476b0082617..f64d0953e86 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -61,7 +61,6 @@ void AddSC_reload_commandscript(); void AddSC_tele_commandscript(); void AddSC_titles_commandscript(); void AddSC_wp_commandscript(); -void AddSC_gps_commandscript(); #ifdef SCRIPTS //world @@ -664,7 +663,6 @@ void AddCommandScripts() AddSC_tele_commandscript(); AddSC_titles_commandscript(); AddSC_wp_commandscript(); - AddSC_gps_commandscript(); } void AddWorldScripts() diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index c6ccfaa8004..aa6013fae3d 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -76,7 +76,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x02F*/ { "SMSG_DEBUG_AISTATE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x030*/ { "CMSG_DISABLE_PVP_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x031*/ { "CMSG_ADVANCE_SPAWN_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, - /*0x032*/ { "SMSG_DESTRUCTIBLE_BUILDING_DAMAGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x032*/ { "SMSG_DESTRUCTIBLE_BUILDING_DAMAGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x033*/ { "CMSG_AUTH_SRP6_BEGIN", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x034*/ { "CMSG_AUTH_SRP6_PROOF", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x035*/ { "CMSG_AUTH_SRP6_RECODE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, @@ -558,7 +558,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x211*/ { "CMSG_GMTICKET_GETTICKET", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGMTicketGetTicketOpcode }, /*0x212*/ { "SMSG_GMTICKET_GETTICKET", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x213*/ { "CMSG_UNLEARN_TALENTS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, - /*0x214*/ { "SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, + /*0x214*/ { "SMSG_UPDATE_INSTANCE_ENCOUNTER_UNIT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x215*/ { "SMSG_GAMEOBJECT_DESPAWN_ANIM", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x216*/ { "MSG_CORPSE_QUERY", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleCorpseQueryOpcode }, /*0x217*/ { "CMSG_GMTICKET_DELETETICKET", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGMTicketDeleteOpcode }, diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 172a5612000..e3d220d744f 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1620,7 +1620,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const { // Use the new aura to see on what stance the target will be uint32 newStance = (1<<((newAura ? newAura->GetMiscValue() : 0)-1)); - + // If the stances are not compatible with the spell, remove it if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && !(itr->second->GetBase()->GetSpellInfo()->Stances & newStance)) target->RemoveAura(itr); @@ -6484,7 +6484,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) // damage caster for heal amount if (target != caster && GetSpellInfo()->AttributesEx2 & SPELL_ATTR2_HEALTH_FUNNEL) { - uint32 funnelDamage = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); // damage is not affected by spell power + uint32 funnelDamage = GetSpellInfo()->ManaPerSecond; // damage is not affected by spell power if ((int32)funnelDamage > gain) funnelDamage = gain; uint32 funnelAbsorb = 0; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index f055d669925..28b089f91cd 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5333,8 +5333,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Id == 781 && !m_caster->isInCombat()) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - Unit* target = m_targets.GetUnitTarget(); - if (m_caster == target && m_caster->HasUnitState(UNIT_STATE_ROOT)) + if (m_caster->HasUnitState(UNIT_STATE_ROOT)) { if (m_caster->GetTypeId() == TYPEID_PLAYER) return SPELL_FAILED_ROOTED; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 7a6030d634c..06493dd070a 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1090,10 +1090,6 @@ void Spell::EffectForceCast(SpellEffIndex effIndex) case 52349: // Overtake unitTarget->CastCustomSpell(unitTarget, spellInfo->Id, &damage, NULL, NULL, true, NULL, NULL, m_originalCasterGUID); return; - case 72378: // Blood Nova - case 73058: // Blood Nova - m_caster->CastSpell(unitTarget, damage, true); // additional spell cast - break; } } @@ -5734,9 +5730,9 @@ void Spell::EffectSummonDeadPet(SpellEffIndex /*effIndex*/) } if (!pet) return; - + player->GetMap()->CreatureRelocation(pet, x, y, z, player->GetOrientation()); - + pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); pet->setDeathState(ALIVE); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 3de87790be9..06e4978eb58 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1602,7 +1602,7 @@ void SpellMgr::LoadSpellGroups() uint32 group_id = fields[0].GetUInt32(); if (group_id <= SPELL_GROUP_DB_RANGE_MIN && group_id >= SPELL_GROUP_CORE_RANGE_MAX) { - sLog->outErrorDb("SpellGroup id %u listed in `spell_groups` is in core range, but is not defined in core!", group_id); + sLog->outErrorDb("SpellGroup id %u listed in `spell_group` is in core range, but is not defined in core!", group_id); continue; } int32 spell_id = fields[1].GetInt32(); @@ -1618,7 +1618,7 @@ void SpellMgr::LoadSpellGroups() { if (groups.find(abs(itr->second)) == groups.end()) { - sLog->outErrorDb("SpellGroup id %u listed in `spell_groups` does not exist", abs(itr->second)); + sLog->outErrorDb("SpellGroup id %u listed in `spell_group` does not exist", abs(itr->second)); mSpellGroupSpell.erase(itr++); } else @@ -3346,13 +3346,22 @@ void SpellMgr::LoadDbcDataCorrections() case 70835: // Bone Storm (Lord Marrowgar) case 70836: // Bone Storm (Lord Marrowgar) case 72864: // Death Plague (Rotting Frost Giant) - case 72378: // Blood Nova (Deathbringer Saurfang) - case 73058: // Blood Nova (Deathbringer Saurfang) case 71160: // Plague Stench (Stinky) case 71161: // Plague Stench (Stinky) case 71123: // Decimate (Stinky & Precious) spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_100_YARDS; // 100yd break; + case 72378: // Blood Nova (Deathbringer Saurfang) + case 73058: // Blood Nova (Deathbringer Saurfang) + spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; + spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; + break; + case 72769: // Scent of Blood (Deathbringer Saurfang) + spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; + // no break + case 72771: // Scent of Blood (Deathbringer Saurfang) + spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; + break; case 72723: // Resistant Skin (Deathbringer Saurfang adds) // this spell initially granted Shadow damage immunity, however it was removed but the data was left in client spellInfo->Effect[2] = 0; diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 44a2dd4dedb..e6ce80c20f0 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -320,29 +320,34 @@ SpellInfo const* SpellScript::GetSpellInfo() return m_spell->GetSpellInfo(); } -WorldLocation const* SpellScript::GetTargetDest() +WorldLocation const* SpellScript::GetExplTargetDest() { if (m_spell->m_targets.HasDst()) return m_spell->m_targets.GetDstPos(); return NULL; } -void SpellScript::SetTargetDest(WorldLocation& loc) +void SpellScript::SetExplTargetDest(WorldLocation& loc) { m_spell->m_targets.SetDst(loc); } -Unit* SpellScript::GetTargetUnit() +WorldObject* SpellScript::GetExplTargetWorldObject() +{ + return m_spell->m_targets.GetObjectTarget(); +} + +Unit* SpellScript::GetExplTargetUnit() { return m_spell->m_targets.GetUnitTarget(); } -GameObject* SpellScript::GetTargetGObj() +GameObject* SpellScript::GetExplTargetGObj() { return m_spell->m_targets.GetGOTarget(); } -Item* SpellScript::GetTargetItem() +Item* SpellScript::GetExplTargetItem() { return m_spell->m_targets.GetItemTarget(); } diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 26393040a1e..7b194b7827f 100755 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -295,25 +295,35 @@ class SpellScript : public _SpellScript SpellInfo const* GetSpellInfo(); SpellValue const* GetSpellValue(); - // methods useable after spell targets are set - // accessors to the "focus" targets of the spell - // note: do not confuse these with spell hit targets + // methods useable after spell is prepared + // accessors to the explicit targets of the spell + // explicit target - target selected by caster (player, game client, or script - DoCast(explicitTarget, ...), required for spell to be cast + // examples: + // -shadowstep - explicit target is the unit you want to go behind of + // -chain heal - explicit target is the unit to be healed first + // -holy nova/arcane explosion - explicit target = NULL because target you are selecting doesn't affect how spell targets are selected + // you can determine if spell requires explicit targets by dbc columns: + // - Targets - mask of explicit target types + // - ImplicitTargetXX set to TARGET_XXX_TARGET_YYY, _TARGET_ here means that explicit target is used by the effect, so spell needs one too + // returns: WorldLocation which was selected as a spell destination or NULL - WorldLocation const* GetTargetDest(); + WorldLocation const* GetExplTargetDest(); - void SetTargetDest(WorldLocation& loc); + void SetExplTargetDest(WorldLocation& loc); - // returns: Unit which was selected as a spell target or NULL - Unit* GetTargetUnit(); + // returns: WorldObject which was selected as an explicit spell target or NULL if there's no target + WorldObject* GetExplTargetWorldObject(); - // returns: GameObject which was selected as a spell target or NULL - GameObject* GetTargetGObj(); + // returns: Unit which was selected as an explicit spell target or NULL if there's no target + Unit* GetExplTargetUnit(); - // returns: Item which was selected as a spell target or NULL - Item* GetTargetItem(); + // returns: GameObject which was selected as an explicit spell target or NULL if there's no target + GameObject* GetExplTargetGObj(); - // methods useable only during spell hit on target, or during spell launch on target: + // returns: Item which was selected as an explicit spell target or NULL if there's no target + Item* GetExplTargetItem(); + // methods useable only during spell hit on target, or during spell launch on target: // returns: target of current effect if it was Unit otherwise NULL Unit* GetHitUnit(); // returns: target of current effect if it was Creature otherwise NULL diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index d14e71aac4a..86fe984e197 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -17,7 +17,6 @@ set(scripts_STAT_SRCS Commands/cs_gm.cpp Commands/cs_go.cpp Commands/cs_gobject.cpp - Commands/cs_gps.cpp Commands/cs_honor.cpp Commands/cs_learn.cpp Commands/cs_misc.cpp diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 679bb450800..c7bcde01e9b 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -95,6 +95,7 @@ public: static ChatCommand commandTable[] = { { "debug", SEC_MODERATOR, true, NULL, "", debugCommandTable }, + { "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL }, { NULL, SEC_PLAYER, false, NULL, "", NULL } }; return commandTable; @@ -1319,6 +1320,16 @@ public: return true; } + + static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + sLog->outSQLDev("(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + + handler->PSendSysMessage("Waypoint SQL written to SQL Developer log"); + return true; + } }; void AddSC_debug_commandscript() diff --git a/src/server/scripts/Commands/cs_gps.cpp b/src/server/scripts/Commands/cs_gps.cpp deleted file mode 100644 index 59e2ec90905..00000000000 --- a/src/server/scripts/Commands/cs_gps.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* ScriptData -Name: gps_commandscript -%Complete: 100 -Comment: GPS/WPGPS commands -Category: commandscripts -EndScriptData */ - -#include "ObjectAccessor.h" -#include "ScriptMgr.h" -#include "Chat.h" -#include "CellImpl.h" - -class gps_commandscript : public CommandScript -{ -public: - gps_commandscript() : CommandScript("gps_commandscript") { } - - ChatCommand* GetCommands() const - { - static ChatCommand commandTable[] = - { - { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL }, - { "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - return commandTable; - } - - static bool HandleGPSCommand(ChatHandler* handler, char const* args) - { - WorldObject* object = NULL; - if (*args) - { - uint64 guid = handler->extractGuidFromLink((char*)args); - if (guid) - object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); - - if (!object) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - } - else - { - object = handler->getSelectedUnit(); - - if (!object) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - } - - CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY()); - Cell cell(cellCoord); - - uint32 zoneId, areaId; - object->GetZoneAndAreaId(zoneId, areaId); - - MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId()); - AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId); - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId); - - float zoneX = object->GetPositionX(); - float zoneY = object->GetPositionY(); - - Map2ZoneCoordinates(zoneX, zoneY, zoneId); - - Map const* map = object->GetMap(); - float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); - float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); - - GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY()); - - // 63? WHY? - int gridX = 63 - gridCoord.x_coord; - int gridY = 63 - gridCoord.y_coord; - - uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0; - uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0; - - if (haveVMap) - { - if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ())) - handler->PSendSysMessage("You are outdoors"); - else - handler->PSendSysMessage("You are indoors"); - } - else - handler->PSendSysMessage("no VMAP available for area info"); - - handler->PSendSysMessage(LANG_MAP_POSITION, - object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"), - zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"), - areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"), - object->GetPhaseMask(), - object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(), - cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(), - zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap); - - LiquidData liquidStatus; - ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus); - - if (status) - handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status); - - return true; - } - - static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - - sLog->outSQLDev("(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); - - handler->PSendSysMessage("Waypoint SQL written to SQL Developer log"); - return true; - } -}; - -void AddSC_gps_commandscript() -{ - new gps_commandscript(); -} diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 5f0434e5c55..7c431566f52 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -17,6 +17,9 @@ #include "ScriptPCH.h"
#include "Chat.h"
+#include "ObjectAccessor.h"
+#include "ScriptMgr.h"
+#include "CellImpl.h"
class misc_commandscript : public CommandScript
{
@@ -27,7 +30,8 @@ public: {
static ChatCommand commandTable[] =
{
- { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
+ { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
+ { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
return commandTable;
@@ -64,6 +68,90 @@ public: handler->SetSentErrorMessage(true);
return false;
}
+
+ static bool HandleGPSCommand(ChatHandler* handler, char const* args)
+ {
+ WorldObject* object = NULL;
+ if (*args)
+ {
+ uint64 guid = handler->extractGuidFromLink((char*)args);
+ if (guid)
+ object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
+
+ if (!object)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+ else
+ {
+ object = handler->getSelectedUnit();
+
+ if (!object)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
+ Cell cell(cellCoord);
+
+ uint32 zoneId, areaId;
+ object->GetZoneAndAreaId(zoneId, areaId);
+
+ MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId());
+ AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
+ AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
+
+ float zoneX = object->GetPositionX();
+ float zoneY = object->GetPositionY();
+
+ Map2ZoneCoordinates(zoneX, zoneY, zoneId);
+
+ Map const* map = object->GetMap();
+ float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
+ float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
+
+ GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
+
+ // 63? WHY?
+ int gridX = 63 - gridCoord.x_coord;
+ int gridY = 63 - gridCoord.y_coord;
+
+ uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
+ uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
+
+ if (haveVMap)
+ {
+ if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()))
+ handler->PSendSysMessage("You are outdoors");
+ else
+ handler->PSendSysMessage("You are indoors");
+ }
+ else
+ handler->PSendSysMessage("no VMAP available for area info");
+
+ handler->PSendSysMessage(LANG_MAP_POSITION,
+ object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ object->GetPhaseMask(),
+ object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
+ cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
+ zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap);
+
+ LiquidData liquidStatus;
+ ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus);
+
+ if (status)
+ handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
+
+ return true;
+ }
};
void AddSC_misc_commandscript()
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index bb3a4d65b76..b6feccc10c6 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -33,6 +33,16 @@ public: ChatCommand* GetCommands() const { + static ChatCommand modifyspeedCommandTable[] = + { + { "fly", SEC_MODERATOR, false, &HandleModifyFlyCommand, "", NULL }, + { "all", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL }, + { "walk", SEC_MODERATOR, false, &HandleModifySpeedCommand, "", NULL }, + { "backwalk", SEC_MODERATOR, false, &HandleModifyBWalkCommand, "", NULL }, + { "swim", SEC_MODERATOR, false, &HandleModifySwimCommand, "", NULL }, + { "", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; static ChatCommand modifyCommandTable[] = { { "hp", SEC_MODERATOR, false, &HandleModifyHPCommand, "", NULL }, @@ -41,29 +51,26 @@ public: { "runicpower", SEC_MODERATOR, false, &HandleModifyRunicPowerCommand, "", NULL }, { "energy", SEC_MODERATOR, false, &HandleModifyEnergyCommand, "", NULL }, { "money", SEC_MODERATOR, false, &HandleModifyMoneyCommand, "", NULL }, - { "speed", SEC_MODERATOR, false, &HandleModifySpeedCommand, "", NULL }, - { "swim", SEC_MODERATOR, false, &HandleModifySwimCommand, "", NULL }, { "scale", SEC_MODERATOR, false, &HandleModifyScaleCommand, "", NULL }, { "bit", SEC_MODERATOR, false, &HandleModifyBitCommand, "", NULL }, - { "bwalk", SEC_MODERATOR, false, &HandleModifyBWalkCommand, "", NULL }, - { "fly", SEC_MODERATOR, false, &HandleModifyFlyCommand, "", NULL }, - { "aspeed", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL }, { "faction", SEC_MODERATOR, false, &HandleModifyFactionCommand, "", NULL }, { "spell", SEC_MODERATOR, false, &HandleModifySpellCommand, "", NULL }, - { "tp", SEC_MODERATOR, false, &HandleModifyTalentCommand, "", NULL }, + { "talentpoints", SEC_MODERATOR, false, &HandleModifyTalentCommand, "", NULL }, { "mount", SEC_MODERATOR, false, &HandleModifyMountCommand, "", NULL }, { "honor", SEC_MODERATOR, false, &HandleModifyHonorCommand, "", NULL }, - { "rep", SEC_GAMEMASTER, false, &HandleModifyRepCommand, "", NULL }, - { "arena", SEC_MODERATOR, false, &HandleModifyArenaCommand, "", NULL }, + { "reputation", SEC_GAMEMASTER, false, &HandleModifyRepCommand, "", NULL }, + { "arenapoints", SEC_MODERATOR, false, &HandleModifyArenaCommand, "", NULL }, { "drunk", SEC_MODERATOR, false, &HandleModifyDrunkCommand, "", NULL }, { "standstate", SEC_GAMEMASTER, false, &HandleModifyStandStateCommand, "", NULL }, - { "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL }, { "phase", SEC_ADMINISTRATOR, false, &HandleModifyPhaseCommand, "", NULL }, { "gender", SEC_GAMEMASTER, false, &HandleModifyGenderCommand, "", NULL }, + { "speed", SEC_MODERATOR, false, NULL, "", modifyspeedCommandTable }, { NULL, 0, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { + { "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL }, + { "demorph", SEC_GAMEMASTER, false, &HandleDeMorphCommand, "", NULL }, { "modify", SEC_MODERATOR, false, NULL, "", modifyCommandTable }, { NULL, 0, false, NULL, "", NULL } }; @@ -1376,6 +1383,21 @@ public: return true; } +//demorph player or unit + static bool HandleDeMorphCommand(ChatHandler* handler, const char* /*args*/) + { + Unit* target = handler->getSelectedUnit(); + if (!target) + target = handler->GetSession()->GetPlayer(); + + // check online security + else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0)) + return false; + + target->DeMorph(); + + return true; + } }; void AddSC_modify_commandscript() diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index a9959c60201..2c5136ed428 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "Transport.h" #include "CreatureGroups.h" #include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand +#include "CreatureAI.h" class npc_commandscript : public CommandScript { @@ -73,6 +74,7 @@ public: { "phase", SEC_GAMEMASTER, false, &HandleNpcSetPhaseCommand, "", NULL }, { "spawndist", SEC_GAMEMASTER, false, &HandleNpcSetSpawnDistCommand, "", NULL }, { "spawntime", SEC_GAMEMASTER, false, &HandleNpcSetSpawnTimeCommand, "", NULL }, + { "data", SEC_ADMINISTRATOR, false, &HandleNpcSetDataCommand, "", NULL }, //{ TODO: fix or remove these commands { "name", SEC_GAMEMASTER, false, &HandleNpcSetNameCommand, "", NULL }, { "subname", SEC_GAMEMASTER, false, &HandleNpcSetSubNameCommand, "", NULL }, @@ -524,6 +526,39 @@ public: return true; } + //set data of creature for testing scripting + static bool HandleNpcSetDataCommand(ChatHandler* handler, const char* args) + { + if (!*args) + return false; + + char* arg1 = strtok((char*)args, " "); + char* arg2 = strtok((char*)NULL, ""); + + if (!arg1 || !arg2) + return false; + + uint32 data_1 = (uint32)atoi(arg1); + uint32 data_2 = (uint32)atoi(arg2); + + if (!data_1 || !data_2) + return false; + + Creature* creature = handler->getSelectedCreature(); + + if (!creature) + { + handler->SendSysMessage(LANG_SELECT_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + creature->AI()->SetData(data_1, data_2); + std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set"); + handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName(), data_1, data_2, AIorScript); + return true; + } + //npc follow handling static bool HandleNpcFollowCommand(ChatHandler* handler, const char* /*args*/) { diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 37808e2b924..bf887bec164 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -664,7 +664,7 @@ public: { CAST_PLR(charmer)->GroupEventHappens(12687, me); charmer->RemoveAurasDueToSpell(SPELL_EFFECT_OVERTAKE); - CAST_CRE(who)->ForcedDespawn(); + CAST_CRE(who)->DespawnOrUnsummon(); //CAST_CRE(who)->Respawn(true); } @@ -767,7 +767,7 @@ public: //Todo: Creatures must not be removed, but, must instead // stand next to Gothik and be commanded into the pit // and dig into the ground. - CAST_CRE(who)->ForcedDespawn(); + CAST_CRE(who)->DespawnOrUnsummon(); if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE) owner->RemoveAllMinionsByEntry(GHOULS); diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index 8c721c141af..70d7f43135c 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -102,7 +102,7 @@ class spell_ex_5581 : public SpellScriptLoader { // in this hook you can add additional requirements for spell caster (and throw a client error if reqs're not passed) // in this case we're disallowing to select non-player as a target of the spell - //if (!GetTargetUnit() || GetTargetUnit()->ToPlayer()) + //if (!GetExplTargetUnit() || GetExplTargetUnit()->ToPlayer()) //return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; } diff --git a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp index ffc2fb3fb61..6c692a6738b 100644 --- a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp @@ -193,7 +193,7 @@ public: if (type == POINT_MOTION_TYPE && id == 1) { DoScriptText(SAY_DIRECTION, me); - me->ForcedDespawn(); + me->DespawnOrUnsummon(); } } }; diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp index 88bc3352ea1..fe5bedf4c98 100644 --- a/src/server/scripts/Kalimdor/durotar.cpp +++ b/src/server/scripts/Kalimdor/durotar.cpp @@ -264,7 +264,7 @@ class npc_tiger_matriarch : public CreatureScript vehSummoner->RemoveAurasDueToSpell(SPELL_SPIRIT_OF_THE_TIGER_RIDER); vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER); } - me->ForcedDespawn(); + me->DespawnOrUnsummon(); } void DamageTaken(Unit* attacker, uint32& damage) @@ -287,7 +287,7 @@ class npc_tiger_matriarch : public CreatureScript vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER); } - me->ForcedDespawn(); + me->DespawnOrUnsummon(); } } diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index 4a1b67ba477..e4ed3793385 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -713,7 +713,7 @@ class spell_ooze_zap : public SpellScriptLoader if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue())) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct - if (!GetTargetUnit()) + if (!GetExplTargetUnit()) return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; @@ -847,7 +847,7 @@ public: player->KilledMonsterCredit(NPC_THERAMORE_PRISONER, 0); prisoner->AI()->Talk(SAY_FREE); // We also emote cry here (handled in creature_text.emote) - prisoner->ForcedDespawn(6000); + prisoner->DespawnOrUnsummon(6000); } return true; } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index c718c0cee5f..f329b940e1f 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -104,7 +104,7 @@ enum BossSpells SPELL_SPIKE_TELE = 66170, }; -#define SPELL_PERMAFROST_HELPER RAID_MODE<uint32>(66193, 67856, 67855, 67857) +#define SPELL_PERMAFROST_HELPER RAID_MODE<uint32>(66193, 67855, 67856, 67857) enum SummonActions { diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 241d6239f82..cf84abb482f 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -769,7 +769,7 @@ class spell_powering_up : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetTargetUnit()) + if (Unit* target = GetExplTargetUnit()) if (urand(0, 99) < 15) target->CastSpell(target, spellId, true); } diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp index 3158d58716f..1469e26fd20 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp @@ -18,53 +18,6 @@ #include "ScriptPCH.h" #include "forge_of_souls.h" -enum Spells -{ - //Spiteful Apparition - SPELL_SPITE = 68895, - H_SPELL_SPITE = 70212, - - //Spectral Warden - SPELL_VEIL_OF_SHADOWS = 69633, - SPELL_WAIL_OF_SOULS = 69148, - H_SPELL_WAIL_OF_SOULS = 70210, - - //Soulguard Watchman - SPELL_SHROUD_OF_RUNES = 69056, - SPELL_UNHOLY_RAGE = 69053, - - //Soulguard Reaper - SPELL_FROST_NOVA = 69060, - H_SPELL_FROST_NOVA = 70209, - SPELL_SHADOW_LANCE = 69058, - - //Soulguard Bonecaster - SPELL_BONE_VOLLEY = 69080, - H_SPELL_BONE_VOLLEY = 70206, - SPELL_RAISE_DEAD = 69562, - SPELL_SHIELD_OF_BONES = 69069, - H_SPELL_SHIELD_OF_BONES = 70207, - - //Soulguard Animator - // Raise dead 69562 - SPELL_SHADOW_BOLT = 69068, - H_SPELL_SHADOW_BOLT = 70208, - SPELL_SOUL_SICKNESS = 69131, - SPELL_SOUL_SIPHON = 69128, - - //Soulguard Adept - //Raise dead 69562 - //Shadow Bolt 69068/70208 - SPELL_DRAIN_LIFE = 69066, - H_SPELL_DRAIN_LIFE = 70213, - SPELL_SHADOW_MEND = 69564, - H_SPELL_SHADOW_MEND = 70205, - - //Soul Horror - SPELL_SOUL_STRIKE = 69088, - H_SPELL_SOUL_STRIKE = 70211, -}; - enum Events { EVENT_NONE, @@ -78,38 +31,6 @@ enum Events EVENT_INTRO_6, EVENT_INTRO_7, EVENT_INTRO_8, - - //Spiteful Apparition - EVENT_SPITE, - - //Spectral Warden - EVENT_VEIL_OF_SHADOWS, - EVENT_WAIL_OF_SOULS, - - //Soulguard Watchman - EVENT_SHROUD_OF_RUNES, - EVENT_UNHOLY_RAGE, - - //Soulguard Reaper - EVENT_FROST_NOVA, - EVENT_SHADOW_LANCE, - - //Soulguard Bonecaster - EVENT_BONE_VOLLEY, - EVENT_RAISE_DEAD, - EVENT_SHIELD_OF_BONES, - - //Soulguard Animator - EVENT_SHADOW_BOLT, - EVENT_SOUL_SICKNESS, - EVENT_SOUL_SIPHON, - - //Soulguard Adept - EVENT_DRAIN_LIFE, - EVENT_SHADOW_MEND, - - //Soul Horror - EVENT_SOUL_STRIKE, }; /****************************************SYLVANAS************************************/ @@ -410,508 +331,8 @@ public: } }; -class mob_spiteful_apparition : public CreatureScript -{ -public: - mob_spiteful_apparition() : CreatureScript("mob_spiteful_apparition") { } - - struct mob_spiteful_apparitionAI: public ScriptedAI - { - mob_spiteful_apparitionAI(Creature* creature) : ScriptedAI(creature) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SPITE, 8000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_SPITE: - DoCastVictim(SPELL_SPITE); - events.RescheduleEvent(EVENT_SPITE, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_spiteful_apparitionAI(creature); - } -}; - -class mob_spectral_warden : public CreatureScript -{ -public: - mob_spectral_warden() : CreatureScript("mob_spectral_warden") { } - - struct mob_spectral_wardenAI: public ScriptedAI - { - mob_spectral_wardenAI(Creature* creature) : ScriptedAI(creature) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_VEIL_OF_SHADOWS, 5000); - events.ScheduleEvent(EVENT_WAIL_OF_SOULS, 10000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_VEIL_OF_SHADOWS: - DoCastVictim(SPELL_VEIL_OF_SHADOWS); - events.RescheduleEvent(EVENT_VEIL_OF_SHADOWS, 10000); - return; - case EVENT_WAIL_OF_SOULS: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_WAIL_OF_SOULS); - events.RescheduleEvent(EVENT_WAIL_OF_SOULS, 5000); - return; - } - } - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_spectral_wardenAI(creature); - } -}; - -class mob_soulguard_watchman : public CreatureScript -{ -public: - mob_soulguard_watchman() : CreatureScript("mob_soulguard_watchman") { } - - struct mob_soulguard_watchmanAI: public ScriptedAI - { - mob_soulguard_watchmanAI(Creature* creature) : ScriptedAI(creature) { } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SHROUD_OF_RUNES, 1000); - events.ScheduleEvent(EVENT_UNHOLY_RAGE, 1000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_SHROUD_OF_RUNES: - DoCast(me, SPELL_SHROUD_OF_RUNES); - events.RescheduleEvent(EVENT_SHROUD_OF_RUNES, 5000); - return; - case EVENT_UNHOLY_RAGE: - DoCast(me, SPELL_UNHOLY_RAGE); - events.RescheduleEvent(EVENT_UNHOLY_RAGE, 99999); - return; - } - } - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_watchmanAI(creature); - } -}; - -class mob_soulguard_reaper : public CreatureScript -{ -public: - mob_soulguard_reaper() : CreatureScript("mob_soulguard_reaper") { } - - struct mob_soulguard_reaperAI: public ScriptedAI - { - mob_soulguard_reaperAI(Creature* creature) : ScriptedAI(creature) { } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_FROST_NOVA, 8000); - events.ScheduleEvent(EVENT_SHADOW_LANCE, 5000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_FROST_NOVA: - DoCast(me, SPELL_FROST_NOVA); - events.RescheduleEvent(EVENT_FROST_NOVA, 9600); - return; - case EVENT_SHADOW_LANCE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SHADOW_LANCE); - events.RescheduleEvent(EVENT_SHADOW_LANCE, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_reaperAI(creature); - } -}; - -class mob_soulguard_bonecaster : public CreatureScript -{ -public: - mob_soulguard_bonecaster() : CreatureScript("mob_soulguard_bonecaster") { } - - struct mob_soulguard_bonecasterAI: public ScriptedAI - { - mob_soulguard_bonecasterAI(Creature* creature) : ScriptedAI(creature) { } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_BONE_VOLLEY, 6000); - events.ScheduleEvent(EVENT_RAISE_DEAD, 25000); - events.ScheduleEvent(EVENT_SHIELD_OF_BONES, 6000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_BONE_VOLLEY: - DoCastAOE(SPELL_BONE_VOLLEY); - events.RescheduleEvent(EVENT_BONE_VOLLEY, 7000); - return; - case EVENT_RAISE_DEAD: - DoCast(me, SPELL_RAISE_DEAD); - events.RescheduleEvent(EVENT_RAISE_DEAD, 25000); - return; - case EVENT_SHIELD_OF_BONES: - DoCast(me, SPELL_SHIELD_OF_BONES); - events.RescheduleEvent(EVENT_SHIELD_OF_BONES, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_bonecasterAI(creature); - } -}; - -class mob_soulguard_animator : public CreatureScript -{ -public: - mob_soulguard_animator() : CreatureScript("mob_soulguard_animator") { } - - struct mob_soulguard_animatorAI : public ScriptedAI - { - mob_soulguard_animatorAI(Creature* creature) : ScriptedAI(creature) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_RAISE_DEAD, 25000); - events.ScheduleEvent(EVENT_SHADOW_BOLT, 5000); - events.ScheduleEvent(EVENT_SOUL_SICKNESS, 8000); - events.ScheduleEvent(EVENT_SOUL_SIPHON, 10000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_RAISE_DEAD: - DoCast(me, SPELL_RAISE_DEAD); - events.RescheduleEvent(EVENT_RAISE_DEAD, 25000); - return; - case EVENT_SHADOW_BOLT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SHADOW_BOLT); - events.RescheduleEvent(EVENT_SHADOW_BOLT, 5000); - return; - case EVENT_SOUL_SICKNESS: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SOUL_SICKNESS); - events.RescheduleEvent(EVENT_SOUL_SICKNESS, 10000); - return; - case EVENT_SOUL_SIPHON: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SOUL_SIPHON); - events.RescheduleEvent(EVENT_SOUL_SIPHON, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_animatorAI(creature); - } -}; - -class mob_soulguard_adept : public CreatureScript -{ -public: - mob_soulguard_adept() : CreatureScript("mob_soulguard_adept") { } - - struct mob_soulguard_adeptAI: public ScriptedAI - { - mob_soulguard_adeptAI(Creature* creature) : ScriptedAI(creature) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_RAISE_DEAD, 25000); - events.ScheduleEvent(EVENT_SHADOW_BOLT, 8000); - events.ScheduleEvent(EVENT_DRAIN_LIFE, 7000); - events.ScheduleEvent(EVENT_SHADOW_MEND, 35000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_RAISE_DEAD: - DoCast(me, SPELL_RAISE_DEAD); - events.RescheduleEvent(EVENT_RAISE_DEAD, 25000); - return; - case EVENT_SHADOW_BOLT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SHADOW_BOLT); - events.RescheduleEvent(EVENT_SHADOW_BOLT, 4000); - return; - case EVENT_DRAIN_LIFE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_DRAIN_LIFE); - events.RescheduleEvent(EVENT_DRAIN_LIFE, 9000); - return; - case EVENT_SHADOW_MEND: - DoCast(me, SPELL_SHADOW_MEND); - events.RescheduleEvent(EVENT_SHADOW_MEND, 20000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_adeptAI(creature); - } -}; - -class mob_soul_horror : public CreatureScript -{ -public: - mob_soul_horror() : CreatureScript("mob_soul_horror") { } - - struct mob_soul_horrorAI : public ScriptedAI - { - mob_soul_horrorAI(Creature* creature) : ScriptedAI(creature) { } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SOUL_STRIKE, 6000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_SOUL_STRIKE: - DoCast(me->getVictim(), SPELL_SOUL_STRIKE); - events.RescheduleEvent(EVENT_SOUL_STRIKE, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soul_horrorAI(creature); - } -}; - void AddSC_forge_of_souls() { new npc_sylvanas_fos(); new npc_jaina_fos(); - new mob_spiteful_apparition(); - new mob_spectral_warden(); - new mob_soulguard_watchman(); - new mob_soulguard_reaper(); - new mob_soulguard_bonecaster(); - new mob_soulguard_animator(); - new mob_soulguard_adept(); - new mob_soul_horror(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index 70d72e52e67..b6c821ef66a 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -25,9 +25,6 @@ enum eSpells SPELL_HELLFIRE = 69586, SPELL_TACTICAL_BLINK = 69584, SPELL_FROST_BREATH = 69527, //Iceborn Proto-Drake - SPELL_BLINDING_DIRT = 70302, //Wrathbone Laborer - SPELL_PUNCTURE_WOUND = 70278, - SPELL_SHOVELLED = 69572, SPELL_LEAPING_FACE_MAUL = 69504, // Geist Ambusher }; @@ -36,11 +33,6 @@ enum eEvents // Ymirjar Flamebearer EVENT_FIREBALL = 1, EVENT_TACTICAL_BLINK = 2, - - //Wrathbone Laborer - EVENT_BLINDING_DIRT = 3, - EVENT_PUNCTURE_WOUND = 4, - EVENT_SHOVELLED = 5, }; class mob_ymirjar_flamebearer : public CreatureScript @@ -157,73 +149,6 @@ class mob_iceborn_protodrake : public CreatureScript } }; -class mob_wrathbone_laborer : public CreatureScript -{ - public: - mob_wrathbone_laborer() : CreatureScript("mob_wrathbone_laborer") { } - - struct mob_wrathbone_laborerAI: public ScriptedAI - { - mob_wrathbone_laborerAI(Creature* creature) : ScriptedAI(creature) - { - } - - void Reset() - { - _events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - _events.ScheduleEvent(EVENT_BLINDING_DIRT, 8000); - _events.ScheduleEvent(EVENT_PUNCTURE_WOUND, 9000); - _events.ScheduleEvent(EVENT_SHOVELLED, 5000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = _events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_BLINDING_DIRT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 10.0f, true)) - DoCast(target, SPELL_BLINDING_DIRT); - _events.RescheduleEvent(EVENT_BLINDING_DIRT, 10000); - return; - case EVENT_PUNCTURE_WOUND: - DoCastVictim(SPELL_PUNCTURE_WOUND); - _events.RescheduleEvent(EVENT_PUNCTURE_WOUND, 9000); - return; - case EVENT_SHOVELLED: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, -5.0f)) - DoCast(target, SPELL_SHOVELLED); - _events.RescheduleEvent(EVENT_SHOVELLED, 7000); - return; - } - } - - DoMeleeAttackIfReady(); - } - - private: - EventMap _events; - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_wrathbone_laborerAI(creature); - } -}; - class mob_geist_ambusher : public CreatureScript { public: @@ -310,7 +235,6 @@ class spell_trash_mob_glacial_strike : public SpellScriptLoader void AddSC_pit_of_saron() { new mob_ymirjar_flamebearer(); - new mob_wrathbone_laborer(); new mob_iceborn_protodrake(); new mob_geist_ambusher(); new spell_trash_mob_glacial_strike(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index de104a78e43..d091a87dbfe 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -103,6 +103,7 @@ enum Spells SPELL_UNSTABLE = 72059, SPELL_KINETIC_BOMB_VISUAL = 72054, SPELL_KINETIC_BOMB_EXPLOSION = 72052, + SPELL_KINETIC_BOMB_KNOCKBACK = 72087, // Shock Vortex SPELL_SHOCK_VORTEX_PERIODIC = 71945, @@ -443,20 +444,12 @@ class boss_prince_keleseth_icc : public CreatureScript { summons.Summon(summon); Position pos; - pos.Relocate(summon); + me->GetPosition(&pos); float maxRange = me->GetDistance2d(summon); float angle = me->GetAngle(summon); - // prevent spawning outside of room - while (!me->IsWithinLOS(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ())) - { - maxRange -= 5.0f; - if (maxRange < 5.0f) - break; - - summon->MovePosition(pos, float(rand_norm() * maxRange), angle); - } - + me->MovePositionToFirstCollision(pos, maxRange, angle); summon->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); + summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN); } void DamageDealt(Unit* /*target*/, uint32& damage, DamageEffectType damageType) @@ -894,6 +887,7 @@ class boss_prince_valanar_icc : public CreatureScript summon->GetPosition(x, y, z); float ground_Z = summon->GetMap()->GetHeight(summon->GetPhaseMask(), x, y, z, true, 500.0f); summon->GetMotionMaster()->MovePoint(POINT_KINETIC_BOMB_IMPACT, x, y, ground_Z); + summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); break; } case NPC_SHOCK_VORTEX: @@ -1073,7 +1067,7 @@ class npc_blood_queen_lana_thel : public CreatureScript if (_introDone) return; - if (!me->IsWithinDistInMap(who, 35.0f)) + if (!me->IsWithinDistInMap(who, 35.0f, false)) return; _introDone = true; @@ -1232,12 +1226,12 @@ class npc_kinetic_bomb : public CreatureScript void Reset() { _events.Reset(); - me->SetDisplayId(DISPLAY_KINETIC_BOMB); + me->SetWalk(true); me->CastSpell(me, SPELL_UNSTABLE, true); me->CastSpell(me, SPELL_KINETIC_BOMB_VISUAL, true); me->SetReactState(REACT_PASSIVE); - me->SetSpeed(MOVE_FLIGHT, IsHeroic() ? 0.3f : 0.15f, true); me->GetPosition(_x, _y, _groundZ); + me->DespawnOrUnsummon(60000); _groundZ = me->GetMap()->GetHeight(me->GetPhaseMask(), _x, _y, _groundZ, true, 500.0f); } @@ -1247,9 +1241,9 @@ class npc_kinetic_bomb : public CreatureScript _events.ScheduleEvent(EVENT_BOMB_DESPAWN, 1000); else if (action == ACTION_KINETIC_BOMB_JUMP) { - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveJump(_x, _y, me->GetPositionZ() + 7.0f, 1.0f, 7.0f); - _events.ScheduleEvent(EVENT_CONTINUE_FALLING, 700); + if (!me->HasAura(SPELL_KINETIC_BOMB_KNOCKBACK)) + me->GetMotionMaster()->MoveCharge(_x, _y, me->GetPositionZ() + 100.0f, me->GetSpeed(MOVE_RUN), 0); + _events.RescheduleEvent(EVENT_CONTINUE_FALLING, 3000); } } @@ -1263,10 +1257,10 @@ class npc_kinetic_bomb : public CreatureScript { case EVENT_BOMB_DESPAWN: me->SetVisible(false); + me->DespawnOrUnsummon(5000); break; case EVENT_CONTINUE_FALLING: - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(POINT_KINETIC_BOMB_IMPACT, _x, _y, _groundZ); + me->GetMotionMaster()->MoveCharge(_x, _y, _groundZ, me->GetSpeed(MOVE_WALK), POINT_KINETIC_BOMB_IMPACT); break; default: break; @@ -1329,17 +1323,16 @@ class npc_dark_nucleus : public CreatureScript void DamageTaken(Unit* attacker, uint32& /*damage*/) { - if (attacker == me) + if (attacker == me || attacker == me->getVictim()) return; - if (!_lockedTarget) - if (me->getVictim() == attacker) - _lockedTarget = true; + me->DeleteThreatList(); + me->AddThreat(attacker, 500000000.0f); } - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 const diff) { - if (!me->isInCombat()) + if (!UpdateVictim()) return; if (_targetAuraCheck <= diff) @@ -1355,23 +1348,6 @@ class npc_dark_nucleus : public CreatureScript } else _targetAuraCheck -= diff; - - if (!_lockedTarget) - { - if (Unit* victim = me->SelectVictim()) - { - if (me->getVictim() && me->getVictim() != victim) - { - me->getVictim()->RemoveAurasDueToSpell(SPELL_SHADOW_RESONANCE_RESIST, me->GetGUID()); - _lockedTarget = true; - } - - _lockedTarget = true; - AttackStart(victim); - DoCast(victim, SPELL_SHADOW_RESONANCE_RESIST); - me->ClearUnitState(UNIT_STATE_CASTING); - } - } } private: @@ -1521,10 +1497,11 @@ class spell_valanar_kinetic_bomb : public SpellScriptLoader void ChangeSummonPos(SpellEffIndex /*effIndex*/) { - WorldLocation summonPos = *GetTargetDest(); + WorldLocation summonPos = *GetExplTargetDest(); Position offset = {0.0f, 0.0f, 20.0f, 0.0f}; summonPos.RelocateOffset(offset); - SetTargetDest(summonPos); + SetExplTargetDest(summonPos); + GetHitDest()->RelocateOffset(offset); } void Register() @@ -1586,7 +1563,7 @@ class spell_valanar_kinetic_bomb_knockback : public SpellScriptLoader void Register() { - AfterHit += SpellHitFn(spell_valanar_kinetic_bomb_knockback_SpellScript::KnockIntoAir); + BeforeHit += SpellHitFn(spell_valanar_kinetic_bomb_knockback_SpellScript::KnockIntoAir); } }; @@ -1663,7 +1640,7 @@ class spell_blood_council_shadow_prison_damage : public SpellScriptLoader void AddExtraDamage() { if (Aura* aur = GetHitUnit()->GetAura(GetSpellInfo()->Id)) - if (AuraEffect const* eff = aur->GetEffect(1)) + if (AuraEffect const* eff = aur->GetEffect(EFFECT_1)) SetHitDamage(GetHitDamage() + eff->GetAmount()); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index b6544fd9a2a..f086e8dc9cf 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -522,7 +522,7 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader SpellCastResult CheckTarget() { - if (IsVampire(GetTargetUnit())) + if (IsVampire(GetExplTargetUnit())) { SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES); return SPELL_FAILED_CUSTOM_ERROR; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 249eed01643..afc7c503bee 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -39,6 +39,7 @@ enum ScriptTexts SAY_FRENZY = 11, SAY_BERSERK = 12, SAY_DEATH = 13, + EMOTE_SCENT_OF_BLOOD = 14, // High Overlord Saurfang SAY_INTRO_HORDE_1 = 0, @@ -145,6 +146,7 @@ enum EventTypes EVENT_BOILING_BLOOD = 20, EVENT_BLOOD_NOVA = 21, EVENT_RUNE_OF_BLOOD = 22, + EVENT_SCENT_OF_BLOOD = 52, EVENT_OUTRO_ALLIANCE_1 = 23, EVENT_OUTRO_ALLIANCE_2 = 24, @@ -297,7 +299,7 @@ class boss_deathbringer_saurfang : public CreatureScript Talk(SAY_AGGRO); events.ScheduleEvent(EVENT_SUMMON_BLOOD_BEAST, 30000, 0, PHASE_COMBAT); - events.ScheduleEvent(EVENT_BERSERK, 480000, 0, PHASE_COMBAT); + events.ScheduleEvent(EVENT_BERSERK, IsHeroic() ? 360000 : 480000, 0, PHASE_COMBAT); events.ScheduleEvent(EVENT_BOILING_BLOOD, 15500, 0, PHASE_COMBAT); events.ScheduleEvent(EVENT_BLOOD_NOVA, 17000, 0, PHASE_COMBAT); events.ScheduleEvent(EVENT_RUNE_OF_BLOOD, 20000, 0, PHASE_COMBAT); @@ -374,16 +376,13 @@ class boss_deathbringer_saurfang : public CreatureScript if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) summon->AI()->AttackStart(target); - if (IsHeroic()) - DoCast(summon, SPELL_SCENT_OF_BLOOD); - - summon->AI()->DoCast(summon, SPELL_BLOOD_LINK_BEAST, true); - summon->AI()->DoCast(summon, SPELL_RESISTANT_SKIN, true); + summon->CastSpell(summon, SPELL_BLOOD_LINK_BEAST, true); + summon->CastSpell(summon, SPELL_RESISTANT_SKIN, true); summons.Summon(summon); DoZoneInCombat(summon); } - void SummonedCreatureDespawn(Creature* summon) + void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) { summons.Despawn(summon); } @@ -463,18 +462,13 @@ class boss_deathbringer_saurfang : public CreatureScript DoCast(me, SPELL_SUMMON_BLOOD_BEAST_25_MAN+i25); Talk(SAY_BLOOD_BEASTS); events.ScheduleEvent(EVENT_SUMMON_BLOOD_BEAST, 40000, 0, PHASE_COMBAT); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SCENT_OF_BLOOD, 10000, 0, PHASE_COMBAT); break; case EVENT_BLOOD_NOVA: - { - // select at range only - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, -10.0f, true); - if (!target) - target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true); // noone? select melee - if (target) - DoCast(target, SPELL_BLOOD_NOVA_TRIGGER); + DoCastAOE(SPELL_BLOOD_NOVA_TRIGGER); events.ScheduleEvent(EVENT_BLOOD_NOVA, urand(20000, 25000), 0, PHASE_COMBAT); break; - } case EVENT_RUNE_OF_BLOOD: DoCastVictim(SPELL_RUNE_OF_BLOOD); events.ScheduleEvent(EVENT_RUNE_OF_BLOOD, urand(20000, 25000), 0, PHASE_COMBAT); @@ -487,6 +481,13 @@ class boss_deathbringer_saurfang : public CreatureScript DoCast(me, SPELL_BERSERK); Talk(SAY_BERSERK); break; + case EVENT_SCENT_OF_BLOOD: + if (!summons.empty()) + { + Talk(EMOTE_SCENT_OF_BLOOD); + DoCastAOE(SPELL_SCENT_OF_BLOOD); + } + break; default: break; } @@ -1237,10 +1238,16 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader unitList.push_back(target); } + void HandleForceCast(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), TRIGGERED_FULL_MASK); + } + void Register() { OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_deathbringer_blood_nova_targeting_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); } Unit* target; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 273f2a20b4b..a0fca522f61 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -544,7 +544,7 @@ class boss_professor_putricide : public CreatureScript void UpdateAI(uint32 const diff) { - if ((!UpdateVictim() && !(events.GetPhaseMask() & PHASE_MASK_NOT_SELF)) || !CheckInRoom()) + if ((!(events.GetPhaseMask() & PHASE_MASK_NOT_SELF) && !UpdateVictim()) || !CheckInRoom()) return; events.Update(diff); @@ -1280,11 +1280,11 @@ class spell_putricide_mutation_init : public SpellScriptLoader SpellCastResult CheckRequirementInternal(SpellCustomErrors& extendedError) { - InstanceScript* instance = GetTargetUnit()->GetInstanceScript(); + InstanceScript* instance = GetExplTargetUnit()->GetInstanceScript(); if (!instance) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - Creature* professor = ObjectAccessor::GetCreature(*GetTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE)); + Creature* professor = ObjectAccessor::GetCreature(*GetExplTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE)); if (!professor) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; @@ -1305,17 +1305,17 @@ class spell_putricide_mutation_init : public SpellScriptLoader SpellCastResult CheckRequirement() { - if (!GetTargetUnit()) + if (!GetExplTargetUnit()) return SPELL_FAILED_BAD_TARGETS; - if (GetTargetUnit()->GetTypeId() != TYPEID_PLAYER) + if (GetExplTargetUnit()->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER; SpellCustomErrors extension = SPELL_CUSTOM_ERROR_NONE; SpellCastResult result = CheckRequirementInternal(extension); if (result != SPELL_CAST_OK) { - Spell::SendCastResult(GetTargetUnit()->ToPlayer(), GetSpellInfo(), 0, result, extension); + Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), 0, result, extension); return result; } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index 85de6789784..a4ab13f6ada 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -716,13 +716,13 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader void CheckTarget(SpellEffIndex effIndex) { PreventHitDefaultEffect(EFFECT_0); - if (!GetTargetDest()) + if (!GetExplTargetDest()) return; uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell; float x, y, z; - GetTargetDest()->GetPosition(x, y, z); + GetExplTargetDest()->GetPosition(x, y, z); // let Rotface handle the cast - caster dies before this executes if (InstanceScript* script = GetCaster()->GetInstanceScript()) if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE))) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index ab924d1b543..6039ace44ab 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -713,6 +713,7 @@ class npc_spinestalker : public CreatureScript me->SetDisableGravity(false); me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->SetHomePosition(SpinestalkerLandPos); + me->SetFacingTo(SpinestalkerLandPos.GetOrientation()); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -839,6 +840,7 @@ class npc_rimefang : public CreatureScript me->SetDisableGravity(false); me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->SetHomePosition(RimefangLandPos); + me->SetFacingTo(RimefangLandPos.GetOrientation()); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } @@ -1342,7 +1344,7 @@ class spell_rimefang_icy_blast : public SpellScriptLoader void HandleTriggerMissile(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - if (Position const* pos = GetTargetDest()) + if (Position const* pos = GetExplTargetDest()) if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICY_BLAST, *pos, TEMPSUMMON_TIMED_DESPAWN, 40000)) summon->CastSpell(summon, SPELL_ICY_BLAST_AREA, true); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 2eb894a5153..4dab215d1da 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -2470,7 +2470,7 @@ class spell_the_lich_king_summon_into_air : public SpellScriptLoader void ModDestHeight(SpellEffIndex effIndex) { static Position const offset = {0.0f, 0.0f, 15.0f, 0.0f}; - WorldLocation* dest = const_cast<WorldLocation*>(GetTargetDest()); + WorldLocation* dest = const_cast<WorldLocation*>(GetExplTargetDest()); dest->RelocateOffset(offset); // spirit bombs get higher if (GetSpellInfo()->Effects[effIndex].MiscValue == NPC_SPIRIT_BOMB) @@ -2727,7 +2727,7 @@ class spell_the_lich_king_vile_spirits_visual : public SpellScriptLoader void ModDestHeight(SpellEffIndex /*effIndex*/) { Position offset = {0.0f, 0.0f, 15.0f, 0.0f}; - const_cast<WorldLocation*>(GetTargetDest())->RelocateOffset(offset); + const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset); } void Register() diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index ed1ca4d20fb..c40a521c794 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -262,7 +262,7 @@ class ValithriaDespawner : public BasicEvent if (CreatureData const* data = creature->GetCreatureData()) creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation); - creature->ForcedDespawn(); + creature->DespawnOrUnsummon(); creature->SetCorpseDelay(corpseDelay); creature->SetRespawnDelay(respawnDelay); @@ -1087,7 +1087,7 @@ class npc_dream_cloud : public CreatureScript me->GetMotionMaster()->MoveIdle(); // must use originalCaster the same for all clouds to allow stacking me->CastSpell(me, EMERALD_VIGOR, false, NULL, NULL, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); - me->ForcedDespawn(100); + me->DespawnOrUnsummon(100); break; default: break; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index c99fde1739c..5b208768b0c 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -346,7 +346,7 @@ class FrostwingGauntletRespawner if (CreatureData const* data = creature->GetCreatureData()) creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation); - creature->ForcedDespawn(); + creature->DespawnOrUnsummon(); creature->SetCorpseDelay(corpseDelay); creature->SetRespawnDelay(respawnDelay); @@ -796,7 +796,8 @@ class boss_sister_svalna : public CreatureScript { _JustReachedHome(); me->SetReactState(REACT_PASSIVE); - me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); } void DoAction(int32 const action) @@ -838,13 +839,14 @@ class boss_sister_svalna : public CreatureScript void MovementInform(uint32 type, uint32 id) { - if (type != POINT_MOTION_TYPE || id != POINT_LAND) + if (type != EFFECT_MOTION_TYPE || id != POINT_LAND) return; _isEventInProgress = false; me->setActive(false); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); } void SpellHitTarget(Unit* target, SpellInfo const* spell) @@ -1921,10 +1923,10 @@ class spell_svalna_revive_champion : public SpellScriptLoader Position pos; caster->GetPosition(&pos); caster->GetNearPosition(pos, 5.0f, 0.0f); - pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, 20.0f); - pos.m_positionZ += 0.05f; + //pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f); + //pos.m_positionZ += 0.05f; caster->SetHomePosition(pos); - caster->GetMotionMaster()->MovePoint(POINT_LAND, pos); + caster->GetMotionMaster()->MoveLand(POINT_LAND, pos, caster->GetSpeed(MOVE_FLIGHT)); } void Register() diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index 6f87d7fcd2a..661b3530bb8 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -1267,7 +1267,7 @@ class spell_algalon_cosmic_smash : public SpellScriptLoader void ModDestHeight(SpellEffIndex /*effIndex*/) { Position offset = {0.0f, 0.0f, 65.0f, 0.0f}; - const_cast<WorldLocation*>(GetTargetDest())->RelocateOffset(offset); + const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset); GetHitDest()->RelocateOffset(offset); } @@ -1294,10 +1294,10 @@ class spell_algalon_cosmic_smash_damage : public SpellScriptLoader void RecalculateDamage() { - if (!GetTargetDest() || !GetHitUnit()) + if (!GetExplTargetDest() || !GetHitUnit()) return; - float distance = GetHitUnit()->GetDistance2d(GetTargetDest()->GetPositionX(), GetTargetDest()->GetPositionY()); + float distance = GetHitUnit()->GetDistance2d(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY()); if (distance > 6.0f) SetHitDamage(int32(float(GetHitDamage()) / distance) * 2); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp index 6c2c08f07a0..472ff153d73 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp @@ -298,14 +298,14 @@ class npc_auriaya_seeping_trigger : public CreatureScript void Reset() { - me->ForcedDespawn(600000); + me->DespawnOrUnsummon(600000); DoCast(me, SPELL_SEEPING_ESSENCE); } void UpdateAI(uint32 const /*diff*/) { if (instance->GetBossState(BOSS_AURIAYA) != IN_PROGRESS) - me->ForcedDespawn(); + me->DespawnOrUnsummon(); } private: diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 462c767f599..0e453eceaa1 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1743,7 +1743,7 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader { // use 99 because it is 3d search std::list<WorldObject*> targetList; - Trinity::WorldObjectSpellAreaTargetCheck check(99, GetTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, NULL); + Trinity::WorldObjectSpellAreaTargetCheck check(99, GetExplTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, NULL); Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> searcher(GetCaster(), targetList, check); GetCaster()->GetMap()->VisitAll(GetCaster()->m_positionX, GetCaster()->m_positionY, 99, searcher); float minDist = 99 * 99; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 4ea38a7642d..a3c9cb847e5 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -507,7 +507,7 @@ class boss_freya : public CreatureScript for (uint8 n = 0; n < 3; ++n) { summons.remove(Elemental[n][i]->GetGUID()); - Elemental[n][i]->ForcedDespawn(5000); + Elemental[n][i]->DespawnOrUnsummon(5000); trioDefeated[i] = true; Elemental[n][i]->CastSpell(me, SPELL_REMOVE_10STACK, true); } @@ -664,12 +664,12 @@ class boss_freya : public CreatureScript case NPC_DETONATING_LASHER: summoned->CastSpell(me, SPELL_REMOVE_2STACK, true); summoned->CastSpell(who, SPELL_DETONATE, true); - summoned->ForcedDespawn(5000); + summoned->DespawnOrUnsummon(5000); summons.remove(summoned->GetGUID()); break; case NPC_ANCIENT_CONSERVATOR: summoned->CastSpell(me, SPELL_REMOVE_25STACK, true); - summoned->ForcedDespawn(5000); + summoned->DespawnOrUnsummon(5000); summons.remove(summoned->GetGUID()); break; } @@ -1385,7 +1385,7 @@ class npc_healthy_spore : public CreatureScript if (lifeTimer <= diff) { me->RemoveAurasDueToSpell(SPELL_GROW); - me->ForcedDespawn(2200); + me->DespawnOrUnsummon(2200); lifeTimer = urand(22000, 30000); } else @@ -1423,7 +1423,7 @@ class npc_eonars_gift : public CreatureScript { me->RemoveAurasDueToSpell(SPELL_GROW); DoCast(SPELL_LIFEBINDERS_GIFT); - me->ForcedDespawn(2500); + me->DespawnOrUnsummon(2500); lifeBindersGiftTimer = 12000; } else diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index a1323b07899..e8e938dc06b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -1006,7 +1006,7 @@ class spell_razorscale_devouring_flame : public SpellScriptLoader PreventHitDefaultEffect(effIndex); Unit* caster = GetCaster(); uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); - WorldLocation const* summonLocation = GetTargetDest(); + WorldLocation const* summonLocation = GetExplTargetDest(); if (!caster || !summonLocation) return; diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp index f83538b344c..8b51618eedd 100644 --- a/src/server/scripts/Northrend/borean_tundra.cpp +++ b/src/server/scripts/Northrend/borean_tundra.cpp @@ -186,7 +186,7 @@ public: if (owner->GetTypeId() == TYPEID_PLAYER) { owner->CastSpell(owner, 46231, true); - CAST_CRE(who)->ForcedDespawn(); + CAST_CRE(who)->DespawnOrUnsummon(); } } } diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index 251bdb8278a..15239e9f836 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -550,7 +550,7 @@ public: // drake unsummoned, passengers dropped if (!me->IsOnVehicle(drake) && !hasEmptySeats) - me->ForcedDespawn(3000); + me->DespawnOrUnsummon(3000); if (enter_timer <= 0) return; @@ -605,7 +605,7 @@ public: me->ExitVehicle(); me->CastSpell(me, SPELL_SUMMON_LIBERATED, true); - me->ForcedDespawn(500); + me->DespawnOrUnsummon(500); // drake is empty now, deliver credit for drake and despawn him if (drake->GetVehicleKit()->HasEmptySeat(1) && @@ -616,7 +616,7 @@ public: if (rider->ToPlayer()) rider->ToPlayer()->KilledMonsterCredit(29709, 0); - drake->ForcedDespawn(0); + drake->DespawnOrUnsummon(0); } } } diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index 7a371170d7d..cf0955ed89c 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -855,7 +855,7 @@ class npc_simon_bunny : public CreatureScript if (GameObject* relic = me->FindNearestGameObject(large ? GO_APEXIS_MONUMENT : GO_APEXIS_RELIC, searchDistance)) relic->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - me->ForcedDespawn(1000); + me->DespawnOrUnsummon(1000); } /* diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp index 8080a1402af..871a2f200bb 100644 --- a/src/server/scripts/Outland/nagrand.cpp +++ b/src/server/scripts/Outland/nagrand.cpp @@ -450,7 +450,7 @@ public: { if (Say_Timer <= diff) { - me->ForcedDespawn(); + me->DespawnOrUnsummon(); ReleasedFromCage = false; } else @@ -689,7 +689,7 @@ class go_warmaul_prison : public GameObjectScript player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0); prisoner->AI()->Talk(SAY_FREE, player->GetGUID()); - prisoner->ForcedDespawn(6000); + prisoner->DespawnOrUnsummon(6000); } return true; } diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp index 388d18697b9..afc18c71b92 100644 --- a/src/server/scripts/Outland/netherstorm.cpp +++ b/src/server/scripts/Outland/netherstorm.cpp @@ -1057,7 +1057,7 @@ class go_captain_tyralius_prison : public GameObjectScript player->KilledMonsterCredit(NPC_CAPTAIN_TYRALIUS, 0); tyralius->AI()->Talk(SAY_FREE); - tyralius->ForcedDespawn(8000); + tyralius->DespawnOrUnsummon(8000); } return true; } diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 5d874faf411..13190ed013f 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -775,7 +775,7 @@ class spell_dk_death_grip : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { int32 damage = GetEffectValue(); - Position const* pos = GetTargetDest(); + Position const* pos = GetExplTargetDest(); if (Unit* target = GetHitUnit()) { if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 380cac4e5ee..898350dbd71 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -237,7 +237,7 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader } else { - unitList.remove(GetTargetUnit()); + unitList.remove(GetExplTargetUnit()); std::list<Unit*> tempTargets; for (std::list<Unit*>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith(*itr)) @@ -279,7 +279,7 @@ class spell_dru_starfall_aoe : public SpellScriptLoader void FilterTargets(std::list<Unit*>& unitList) { - unitList.remove(GetTargetUnit()); + unitList.remove(GetExplTargetUnit()); } void Register() diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 2d431331691..501c7c47676 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -169,7 +169,7 @@ class spell_gen_burn_brutallus : public SpellScriptLoader } }; -enum eCannibalizeSpells +enum CannibalizeSpells { SPELL_CANNIBALIZE_TRIGGERED = 20578, }; @@ -224,7 +224,7 @@ class spell_gen_cannibalize : public SpellScriptLoader }; // 45472 Parachute -enum eParachuteSpells +enum ParachuteSpells { SPELL_PARACHUTE = 45472, SPELL_PARACHUTE_BUFF = 44795, @@ -365,7 +365,7 @@ class spell_gen_remove_flight_auras : public SpellScriptLoader }; // 66118 Leeching Swarm -enum eLeechingSwarmSpells +enum LeechingSwarmSpells { SPELL_LEECHING_SWARM_DMG = 66240, SPELL_LEECHING_SWARM_HEAL = 66125, @@ -481,7 +481,7 @@ class spell_gen_elune_candle : public SpellScriptLoader }; // 24750 Trick -enum eTrickSpells +enum TrickSpells { SPELL_PIRATE_COSTUME_MALE = 24708, SPELL_PIRATE_COSTUME_FEMALE = 24709, @@ -557,7 +557,7 @@ class spell_gen_trick : public SpellScriptLoader }; // 24751 Trick or Treat -enum eTrickOrTreatSpells +enum TrickOrTreatSpells { SPELL_TRICK = 24714, SPELL_TREAT = 24715, @@ -1282,7 +1282,7 @@ class spell_gen_launch : public SpellScriptLoader void Launch() { - WorldLocation const* const position = GetTargetDest(); + WorldLocation const* const position = GetExplTargetDest(); if (Player* player = GetHitPlayer()) { @@ -2656,6 +2656,38 @@ class spell_gen_count_pct_from_max_hp : public SpellScriptLoader int32 _damagePct; }; +class spell_gen_despawn_self : public SpellScriptLoader +{ +public: + spell_gen_despawn_self() : SpellScriptLoader("spell_gen_despawn_self") { } + + class spell_gen_despawn_self_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_despawn_self_SpellScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } + + void HandleDummy(SpellEffIndex effIndex) + { + if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_DUMMY || GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_SCRIPT_EFFECT) + GetCaster()->ToCreature()->DespawnOrUnsummon(); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_despawn_self_SpellScript::HandleDummy, EFFECT_ALL, SPELL_EFFECT_ANY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_despawn_self_SpellScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -2709,4 +2741,5 @@ void AddSC_generic_spell_scripts() new spell_gen_wg_water(); new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp"); new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50); + new spell_gen_despawn_self(); } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 891c7b79270..53a78e42c3c 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -287,8 +287,8 @@ class spell_hun_masters_call : public SpellScriptLoader target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, castMask); // there is a possibility that this effect should access effect 0 (dummy) target, but i dubt that // it's more likely that on on retail it's possible to call target selector based on dbc values - // anyways, we're using GetTargetUnit() here and it's ok - if (Unit* ally = GetTargetUnit()) + // anyways, we're using GetExplTargetUnit() here and it's ok + if (Unit* ally = GetExplTargetUnit()) { target->CastSpell(ally, GetEffectValue(), castMask); target->CastSpell(ally, GetSpellInfo()->Effects[EFFECT_0].CalcValue(), castMask); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 666477e68e7..eb2d3187636 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1744,6 +1744,7 @@ class spell_item_rocket_boots : public SpellScriptLoader if (Battleground* bg = caster->GetBattleground()) bg->EventPlayerDroppedFlag(caster); + caster->RemoveSpellCooldown(SPELL_ROCKET_BOOTS_PROC); caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, NULL); } @@ -2005,7 +2006,7 @@ class spell_item_muisek_vessel : public SpellScriptLoader { if (Creature* target = GetHitCreature()) if (target->isDead()) - target->ForcedDespawn(); + target->DespawnOrUnsummon(); } void Register() @@ -2020,6 +2021,37 @@ class spell_item_muisek_vessel : public SpellScriptLoader } }; +enum GreatmothersSoulcather +{ + SPELL_FORCE_CAST_SUMMON_GNOME_SOUL = 46486, +}; +class spell_item_greatmothers_soulcatcher : public SpellScriptLoader +{ +public: + spell_item_greatmothers_soulcatcher() : SpellScriptLoader("spell_item_greatmothers_soulcatcher") { } + + class spell_item_greatmothers_soulcatcher_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_greatmothers_soulcatcher_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(GetCaster(),SPELL_FORCE_CAST_SUMMON_GNOME_SOUL); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_greatmothers_soulcatcher_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_greatmothers_soulcatcher_SpellScript(); + } +}; + void AddSC_item_spell_scripts() { // 23074 Arcanite Dragonling @@ -2072,4 +2104,5 @@ void AddSC_item_spell_scripts() new spell_item_uded(); new spell_item_chicken_cover(); new spell_item_muisek_vessel(); + new spell_item_greatmothers_soulcatcher(); } diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 9f7f7d847e1..cf8cae68c58 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -288,10 +288,9 @@ class spell_pal_holy_shock : public SpellScriptLoader SpellCastResult CheckCast() { Player* caster = GetCaster()->ToPlayer(); - if (GetTargetUnit()) - if (Player* target = GetTargetUnit()->ToPlayer()) - if (caster->GetTeam() != target->GetTeam() && !caster->IsValidAttackTarget(target)) - return SPELL_FAILED_BAD_TARGETS; + if (Unit* target = GetExplTargetUnit()) + if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target)) + return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; } diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index d2bba2b8bc3..8088004c9d1 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -227,10 +227,9 @@ class spell_pri_penance : public SpellScriptLoader SpellCastResult CheckCast() { Player* caster = GetCaster()->ToPlayer(); - if (GetTargetUnit()) - if (Player* target = GetTargetUnit()->ToPlayer()) - if (caster->GetTeam() != target->GetTeam() && !caster->IsValidAttackTarget(target)) - return SPELL_FAILED_BAD_TARGETS; + if (Unit* target = GetExplTargetUnit()) + if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target)) + return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; } @@ -291,12 +290,53 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader } }; +enum PrayerOfMending +{ + SPELL_T9_HEALING_2_PIECE = 67201, +}; +// Prayer of Mending Heal +class spell_pri_prayer_of_mending_heal : public SpellScriptLoader +{ +public: + spell_pri_prayer_of_mending_heal() : SpellScriptLoader("spell_pri_prayer_of_mending_heal") { } + + class spell_pri_prayer_of_mending_heal_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pri_prayer_of_mending_heal_SpellScript); + + void HandleHeal(SpellEffIndex /*effIndex*/) + { + if (Unit* caster = GetOriginalCaster()) + { + if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_T9_HEALING_2_PIECE,EFFECT_0)) + { + int32 heal = GetHitHeal(); + AddPctN(heal, aurEff->GetAmount()); + SetHitHeal(heal); + } + } + + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_pri_prayer_of_mending_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_pri_prayer_of_mending_heal_SpellScript(); + } +}; + void AddSC_priest_spell_scripts() { new spell_pri_guardian_spirit(); - new spell_pri_mana_burn; - new spell_pri_pain_and_suffering_proc; - new spell_pri_penance; + new spell_pri_mana_burn(); + new spell_pri_pain_and_suffering_proc(); + new spell_pri_penance(); new spell_pri_reflective_shield_trigger(); new spell_pri_mind_sear(); + new spell_pri_prayer_of_mending_heal(); } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 48faf83cd2f..9d042da0789 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -275,7 +275,7 @@ class spell_q11396_11399_scourging_crystal_controller : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetTargetUnit()) + if (Unit* target = GetExplTargetUnit()) if (target->GetTypeId() == TYPEID_UNIT && target->HasAura(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3)) // Make sure nobody else is channeling the same target if (!target->HasAura(SPELL_SCOURGING_CRYSTAL_CONTROLLER)) @@ -837,7 +837,7 @@ class spell_q12659_ahunaes_knife : public SpellScriptLoader Player* caster = GetCaster()->ToPlayer(); if (Creature* target = GetHitCreature()) { - target->ForcedDespawn(); + target->DespawnOrUnsummon(); caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY, 0); } } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 00e89391a7e..7e2756f28a5 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -215,13 +215,12 @@ class spell_sha_earthbind_totem : public SpellScriptLoader void HandleEffectPeriodic(AuraEffect const* aurEff) { - if (Unit* target = GetTarget()) - if (Unit* caster = aurEff->GetBase()->GetCaster()) - if (TempSummon* summon = caster->ToTempSummon()) - if (Unit* owner = summon->GetOwner()) - if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0)) - if (roll_chance_i(aur->GetBaseAmount()) && target->HasAuraWithMechanic(1 << MECHANIC_SNARE)) - caster->CastSpell(caster, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true, NULL, aurEff); + if (!GetCaster()) + return; + if (Player* owner = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0)) + if (roll_chance_i(aur->GetBaseAmount())) + GetTarget()->CastSpell((Unit*)NULL, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true); } void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -252,6 +251,46 @@ class spell_sha_earthbind_totem : public SpellScriptLoader } }; +class EarthenPowerTargetSelector +{ + public: + EarthenPowerTargetSelector() { } + + bool operator() (Unit* target) + { + if (!target->HasAuraWithMechanic(1 << MECHANIC_SNARE)) + return true; + + return false; + } +}; + +class spell_sha_earthen_power : public SpellScriptLoader +{ + public: + spell_sha_earthen_power() : SpellScriptLoader("spell_sha_earthen_power") { } + + class spell_sha_earthen_power_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sha_earthen_power_SpellScript); + + void FilterTargets(std::list<Unit*>& unitList) + { + unitList.remove_if(EarthenPowerTargetSelector()); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_earthen_power_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_earthen_power_SpellScript(); + } +}; + class spell_sha_bloodlust : public SpellScriptLoader { public: @@ -270,7 +309,7 @@ class spell_sha_bloodlust : public SpellScriptLoader void RemoveInvalidTargets(std::list<Unit*>& targets) { - targets.remove_if (Trinity::UnitAuraCheck(true, SHAMAN_SPELL_SATED)); + targets.remove_if(Trinity::UnitAuraCheck(true, SHAMAN_SPELL_SATED)); } void ApplyDebuff() @@ -619,6 +658,7 @@ void AddSC_shaman_spell_scripts() new spell_sha_fire_nova(); new spell_sha_mana_tide_totem(); new spell_sha_earthbind_totem(); + new spell_sha_earthen_power(); new spell_sha_bloodlust(); new spell_sha_heroism(); new spell_sha_ancestral_awakening_proc(); diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 1f7e8171e46..838b9e4f932 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -301,8 +301,8 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader void FilterTargets(std::list<Unit*>& unitList) { - if (GetTargetUnit()) - unitList.remove(GetTargetUnit()); + if (GetExplTargetUnit()) + unitList.remove(GetExplTargetUnit()); } void Register() diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index d2c35b514e1..bb271139b6a 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -400,8 +400,7 @@ class spell_warr_bloodthirst : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { int32 damage = GetEffectValue(); - if (GetHitUnit()) - GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_BLOODTHIRST, &damage, NULL, NULL, true, NULL); + GetCaster()->CastCustomSpell(GetCaster(), SPELL_BLOODTHIRST, &damage, NULL, NULL, true, NULL); } void Register() diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 60ddf8990a7..790a9d0f814 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -1174,7 +1174,7 @@ class go_gjalerbron_cage : public GameObjectScript player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, 0); prisoner->AI()->Talk(SAY_FREE); - prisoner->ForcedDespawn(6000); + prisoner->DespawnOrUnsummon(6000); } } return true; @@ -1201,7 +1201,7 @@ class go_large_gjalerbron_cage : public GameObjectScript { go->UseDoorOrButton(); player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, (*itr)->GetGUID()); - (*itr)->ForcedDespawn(6000); + (*itr)->DespawnOrUnsummon(6000); (*itr)->AI()->Talk(SAY_FREE); } } @@ -1235,7 +1235,7 @@ class go_veil_skith_cage : public GameObjectScript { go->UseDoorOrButton(); player->KilledMonsterCredit(NPC_CAPTIVE_CHILD, (*itr)->GetGUID()); - (*itr)->ForcedDespawn(5000); + (*itr)->DespawnOrUnsummon(5000); (*itr)->GetMotionMaster()->MovePoint(1, go->GetPositionX()+5, go->GetPositionY(), go->GetPositionZ()); (*itr)->AI()->Talk(SAY_FREE_0); (*itr)->GetMotionMaster()->Clear(); diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 61b997bba35..ecd1a439a58 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1975,33 +1975,31 @@ public: class npc_lightwell : public CreatureScript { -public: - npc_lightwell() : CreatureScript("npc_lightwell") { } - - struct npc_lightwellAI : public PassiveAI - { - npc_lightwellAI(Creature* creature) : PassiveAI(creature) {} + public: + npc_lightwell() : CreatureScript("npc_lightwell") { } - void Reset() + struct npc_lightwellAI : public PassiveAI { - DoCast(me, 59907, false); // Spell for Lightwell Charges - } + npc_lightwellAI(Creature* creature) : PassiveAI(creature) + { + DoCast(me, 59907, false); + } - void EnterEvadeMode() - { - if (!me->isAlive()) - return; + void EnterEvadeMode() + { + if (!me->isAlive()) + return; - me->DeleteThreatList(); - me->CombatStop(true); - me->ResetPlayerDamageReq(); - } - }; + me->DeleteThreatList(); + me->CombatStop(true); + me->ResetPlayerDamageReq(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_lightwellAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_lightwellAI(creature); + } }; enum eTrainingDummy @@ -2099,34 +2097,26 @@ public: class npc_shadowfiend : public CreatureScript { -public: - npc_shadowfiend() : CreatureScript("npc_shadowfiend") { } - - struct npc_shadowfiendAI : public ScriptedAI - { - npc_shadowfiendAI(Creature* creature) : ScriptedAI(creature) {} + public: + npc_shadowfiend() : CreatureScript("npc_shadowfiend") { } - void DamageTaken(Unit* /*killer*/, uint32& damage) + struct npc_shadowfiendAI : public ScriptedAI { - if (me->isSummon()) - if (Unit* owner = me->ToTempSummon()->GetSummoner()) - if (owner->HasAura(GLYPH_OF_SHADOWFIEND) && damage >= me->GetHealth()) - owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true); - } + npc_shadowfiendAI(Creature* creature) : ScriptedAI(creature) {} - void UpdateAI(uint32 const /*diff*/) - { - if (!UpdateVictim()) - return; + void DamageTaken(Unit* /*killer*/, uint32& damage) + { + if (me->isSummon()) + if (Unit* owner = me->ToTempSummon()->GetSummoner()) + if (owner->HasAura(GLYPH_OF_SHADOWFIEND) && damage >= me->GetHealth()) + owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true); + } + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const + { + return new npc_shadowfiendAI(creature); } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_shadowfiendAI(creature); - } }; /*###### @@ -2193,7 +2183,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_fire_elementalAI(creature); } @@ -2238,7 +2228,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_earth_elementalAI(creature); } @@ -2248,78 +2238,111 @@ public: # npc_wormhole ######*/ -#define GOSSIP_ENGINEERING1 "Borean Tundra." -#define GOSSIP_ENGINEERING2 "Howling Fjord." -#define GOSSIP_ENGINEERING3 "Sholazar Basin." -#define GOSSIP_ENGINEERING4 "Icecrown." -#define GOSSIP_ENGINEERING5 "Storm Peaks." +#define GOSSIP_ENGINEERING1 "Borean Tundra" +#define GOSSIP_ENGINEERING2 "Howling Fjord" +#define GOSSIP_ENGINEERING3 "Sholazar Basin" +#define GOSSIP_ENGINEERING4 "Icecrown" +#define GOSSIP_ENGINEERING5 "Storm Peaks" +#define GOSSIP_ENGINEERING6 "Underground..." -enum eWormhole +enum WormholeSpells { - SPELL_HOWLING_FJORD = 67838, + SPELL_BOREAN_TUNDRA = 67834, SPELL_SHOLAZAR_BASIN = 67835, SPELL_ICECROWN = 67836, SPELL_STORM_PEAKS = 67837, + SPELL_HOWLING_FJORD = 67838, + SPELL_UNDERGROUND = 68081, + + TEXT_WORMHOLE = 907, - TEXT_WORMHOLE = 907 + DATA_SHOW_UNDERGROUND = 1, }; class npc_wormhole : public CreatureScript { -public: - npc_wormhole() : CreatureScript("npc_wormhole") { } + public: + npc_wormhole() : CreatureScript("npc_wormhole") {} - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isSummon()) + struct npc_wormholeAI : public PassiveAI + { + npc_wormholeAI(Creature* creature) : PassiveAI(creature) {} + + void InitializeAI() + { + _showUnderground = urand(0, 100) == 0; // Guessed value, it is really rare though + } + + uint32 GetData(uint32 type) + { + return (type == DATA_SHOW_UNDERGROUND && _showUnderground) ? 1 : 0; + } + + private: + bool _showUnderground; + }; + + bool OnGossipHello(Player* player, Creature* creature) { - if (player == creature->ToTempSummon()->GetSummoner()) + if (creature->isSummon()) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + if (player == creature->ToTempSummon()->GetSummoner()) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - player->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, creature->GetGUID()); + if (creature->AI()->GetData(DATA_SHOW_UNDERGROUND)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + + player->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, creature->GetGUID()); + } } + + return true; } - return true; - } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - bool roll = urand(0, 1); + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) + { + player->PlayerTalkClass->ClearMenus(); - switch (action) + switch (action) + { + case GOSSIP_ACTION_INFO_DEF + 1: // Borean Tundra + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_BOREAN_TUNDRA, false); + break; + case GOSSIP_ACTION_INFO_DEF + 2: // Howling Fjord + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_HOWLING_FJORD, false); + break; + case GOSSIP_ACTION_INFO_DEF + 3: // Sholazar Basin + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_SHOLAZAR_BASIN, false); + break; + case GOSSIP_ACTION_INFO_DEF + 4: // Icecrown + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_ICECROWN, false); + break; + case GOSSIP_ACTION_INFO_DEF + 5: // Storm peaks + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_STORM_PEAKS, false); + break; + case GOSSIP_ACTION_INFO_DEF + 6: // Underground + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_UNDERGROUND, false); + break; + } + + return true; + } + + CreatureAI* GetAI(Creature* creature) const { - case GOSSIP_ACTION_INFO_DEF + 1: //Borean Tundra - player->CLOSE_GOSSIP_MENU(); - if (roll) //At the moment we don't have chance on spell_target_position table so we hack this - player->TeleportTo(571, 4305.505859f, 5450.839844f, 63.005806f, 0.627286f); - else - player->TeleportTo(571, 3201.936279f, 5630.123535f, 133.658798f, 3.855272f); - break; - case GOSSIP_ACTION_INFO_DEF + 2: //Howling Fjord - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_HOWLING_FJORD, true); - break; - case GOSSIP_ACTION_INFO_DEF + 3: //Sholazar Basin - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_SHOLAZAR_BASIN, true); - break; - case GOSSIP_ACTION_INFO_DEF + 4: //Icecrown - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_ICECROWN, true); - break; - case GOSSIP_ACTION_INFO_DEF + 5: //Storm peaks - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_STORM_PEAKS, true); - break; + return new npc_wormholeAI(creature); } - return true; - } }; /*###### @@ -2530,172 +2553,6 @@ public: }; /*###### -## npc_tabard_vendor -######*/ - -enum -{ - QUEST_TRUE_MASTERS_OF_LIGHT = 9737, - QUEST_THE_UNWRITTEN_PROPHECY = 9762, - QUEST_INTO_THE_BREACH = 10259, - QUEST_BATTLE_OF_THE_CRIMSON_WATCH = 10781, - QUEST_SHARDS_OF_AHUNE = 11972, - - ACHIEVEMENT_EXPLORE_NORTHREND = 45, - ACHIEVEMENT_TWENTYFIVE_TABARDS = 1021, - ACHIEVEMENT_THE_LOREMASTER_A = 1681, - ACHIEVEMENT_THE_LOREMASTER_H = 1682, - - ITEM_TABARD_OF_THE_HAND = 24344, - ITEM_TABARD_OF_THE_BLOOD_KNIGHT = 25549, - ITEM_TABARD_OF_THE_PROTECTOR = 28788, - ITEM_OFFERING_OF_THE_SHATAR = 31408, - ITEM_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI = 31404, - ITEM_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI = 31405, - ITEM_TABARD_OF_THE_SUMMER_SKIES = 35279, - ITEM_TABARD_OF_THE_SUMMER_FLAMES = 35280, - ITEM_TABARD_OF_THE_ACHIEVER = 40643, - ITEM_LOREMASTERS_COLORS = 43300, - ITEM_TABARD_OF_THE_EXPLORER = 43348, - - SPELL_TABARD_OF_THE_BLOOD_KNIGHT = 54974, - SPELL_TABARD_OF_THE_HAND = 54976, - SPELL_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI = 54977, - SPELL_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI = 54982, - SPELL_TABARD_OF_THE_ACHIEVER = 55006, - SPELL_TABARD_OF_THE_PROTECTOR = 55008, - SPELL_LOREMASTERS_COLORS = 58194, - SPELL_TABARD_OF_THE_EXPLORER = 58224, - SPELL_TABARD_OF_SUMMER_SKIES = 62768, - SPELL_TABARD_OF_SUMMER_FLAMES = 62769 -}; - -#define GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT "I've lost my Tabard of Blood Knight." -#define GOSSIP_LOST_TABARD_OF_THE_HAND "I've lost my Tabard of the Hand." -#define GOSSIP_LOST_TABARD_OF_THE_PROTECTOR "I've lost my Tabard of the Protector." -#define GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI "I've lost my Green Trophy Tabard of the Illidari." -#define GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI "I've lost my Purple Trophy Tabard of the Illidari." -#define GOSSIP_LOST_TABARD_OF_SUMMER_SKIES "I've lost my Tabard of Summer Skies." -#define GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES "I've lost my Tabard of Summer Flames." -#define GOSSIP_LOST_LOREMASTERS_COLORS "I've lost my Loremaster's Colors." -#define GOSSIP_LOST_TABARD_OF_THE_EXPLORER "I've lost my Tabard of the Explorer." -#define GOSSIP_LOST_TABARD_OF_THE_ACHIEVER "I've lost my Tabard of the Achiever." - -class npc_tabard_vendor : public CreatureScript -{ -public: - npc_tabard_vendor() : CreatureScript("npc_tabard_vendor") { } - - bool OnGossipHello(Player* player, Creature* creature) - { - bool lostBloodKnight = false; - bool lostHand = false; - bool lostProtector = false; - bool lostIllidari = false; - bool lostSummer = false; - - //Tabard of the Blood Knight - if (player->GetQuestRewardStatus(QUEST_TRUE_MASTERS_OF_LIGHT) && !player->HasItemCount(ITEM_TABARD_OF_THE_BLOOD_KNIGHT, 1, true)) - lostBloodKnight = true; - - //Tabard of the Hand - if (player->GetQuestRewardStatus(QUEST_THE_UNWRITTEN_PROPHECY) && !player->HasItemCount(ITEM_TABARD_OF_THE_HAND, 1, true)) - lostHand = true; - - //Tabard of the Protector - if (player->GetQuestRewardStatus(QUEST_INTO_THE_BREACH) && !player->HasItemCount(ITEM_TABARD_OF_THE_PROTECTOR, 1, true)) - lostProtector = true; - - //Green Trophy Tabard of the Illidari - //Purple Trophy Tabard of the Illidari - if (player->GetQuestRewardStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) && - (!player->HasItemCount(ITEM_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) && - !player->HasItemCount(ITEM_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) && - !player->HasItemCount(ITEM_OFFERING_OF_THE_SHATAR, 1, true))) - lostIllidari = true; - - //Tabard of Summer Skies - //Tabard of Summer Flames - if (player->GetQuestRewardStatus(QUEST_SHARDS_OF_AHUNE) && - !player->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_SKIES, 1, true) && - !player->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_FLAMES, 1, true)) - lostSummer = true; - - if (lostBloodKnight || lostHand || lostProtector || lostIllidari || lostSummer) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - - if (lostBloodKnight) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - - if (lostHand) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_HAND, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - - if (lostProtector) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_PROTECTOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - - if (lostIllidari) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - } - - if (lostSummer) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_SKIES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - } - - player->SEND_GOSSIP_MENU(13583, creature->GetGUID()); - } - else - player->GetSession()->SendListInventory(creature->GetGUID()); - - return true; - } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - switch (action) - { - case GOSSIP_ACTION_TRADE: - player->GetSession()->SendListInventory(creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 1: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_THE_BLOOD_KNIGHT, false); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_THE_HAND, false); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_THE_PROTECTOR, false); - break; - case GOSSIP_ACTION_INFO_DEF + 4: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, false); - break; - case GOSSIP_ACTION_INFO_DEF + 5: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, false); - break; - case GOSSIP_ACTION_INFO_DEF + 6: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_SUMMER_SKIES, false); - break; - case GOSSIP_ACTION_INFO_DEF + 7: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_SUMMER_FLAMES, false); - break; - } - return true; - } -}; - -/*###### ## npc_experience ######*/ @@ -3031,7 +2888,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_fireworkAI(creature); } @@ -3158,7 +3015,6 @@ void AddSC_npcs_special() new npc_wormhole(); new npc_pet_trainer(); new npc_locksmith(); - new npc_tabard_vendor(); new npc_experience(); new npc_fire_elemental(); new npc_earth_elemental(); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 772a52b62cf..d315c6417ea 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -33,6 +33,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_CHAR_CREATE_INFO, "SELECT level, race, class FROM characters WHERE account = ? LIMIT 0, ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_INS_CHARACTER_BAN, "INSERT INTO character_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?, 1)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_UPD_CHARACTER_BAN, "UPDATE character_banned SET active = 0 WHERE guid = ? AND active != 0", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_DEL_CHARACTER_BAN, "DELETE cb FROM character_banned cb INNER JOIN characters c ON c.guid = cb.guid WHERE c.account = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_SEL_BANINFO, "SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate, banreason, bannedby FROM character_banned WHERE guid = ? ORDER BY bandate ASC", CONNECTION_SYNCH) PREPARE_STATEMENT(CHAR_SEL_GUID_BY_NAME_FILTER, "SELECT guid, name FROM characters WHERE name LIKE CONCAT('%%', ?, '%%')", CONNECTION_SYNCH) PREPARE_STATEMENT(CHAR_SEL_BANINFO_LIST, "SELECT bandate, unbandate, bannedby, banreason FROM character_banned WHERE guid = ? ORDER BY unbandate", CONNECTION_SYNCH) @@ -435,8 +436,8 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_PET_SPELL, "SELECT spell, active FROM pet_spell WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_PET_SPELL_COOLDOWN, "SELECT spell, time FROM pet_spell_cooldown WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_PET_DECLINED_NAME, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_pet_declinedname WHERE owner = ? AND id = ?", CONNECTION_SYNCH); - PREPARE_STATEMENT(CHAR_SEL_CHAR_GUID_BY_NAME, "SELECT characters.guid FROM characters WHERE characters.name = ?", CONNECTION_SYNCH); - PREPARE_STATEMENT(CHAR_DEL_CHAR_AURA_FROZEN, "DELETE FROM character_aura WHERE character_aura.spell = 9454 AND character_aura.guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_GUID_BY_NAME, "SELECT guid FROM characters WHERE name = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_DEL_CHAR_AURA_FROZEN, "DELETE FROM character_aura WHERE spell = 9454 AND guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM, "SELECT COUNT(itemEntry) FROM character_inventory ci INNER JOIN item_instance ii ON ii.guid = ci.item WHERE itemEntry = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_MAIL_COUNT_ITEM, "SELECT COUNT(itemEntry) FROM mail_items mi INNER JOIN item_instance ii ON ii.guid = mi.item_guid WHERE itemEntry = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM,"SELECT COUNT(itemEntry) FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE itemEntry = ?", CONNECTION_SYNCH); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index d2c9f3b3ac4..cf6bbd7bdfa 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -53,6 +53,7 @@ enum CharacterDatabaseStatements CHAR_SEL_CHAR_CREATE_INFO, CHAR_INS_CHARACTER_BAN, CHAR_UPD_CHARACTER_BAN, + CHAR_DEL_CHARACTER_BAN, CHAR_SEL_BANINFO, CHAR_SEL_GUID_BY_NAME_FILTER, CHAR_SEL_BANINFO_LIST, diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index 70d874be31d..028d927a720 100755 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -33,6 +33,7 @@ void LoginDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_BANNED_ALL, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id", CONNECTION_SYNCH); PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 AND username LIKE CONCAT('%%', ?, '%%') GROUP BY account.id", CONNECTION_SYNCH); PREPARE_STATEMENT(LOGIN_INS_ACCOUNT_AUTO_BANNED, "INSERT INTO account_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity realmd', 'Failed login autoban', 1)", CONNECTION_ASYNC) + PREPARE_STATEMENT(LOGIN_DEL_ACCOUNT_BANNED, "DELETE FROM account_banned WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_SEL_SESSIONKEY, "SELECT a.sessionkey, a.id, aa.gmlevel FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE username = ?", CONNECTION_SYNCH) PREPARE_STATEMENT(LOGIN_UPD_VS, "UPDATE account SET v = ?, s = ? WHERE username = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(LOGIN_UPD_LOGONPROOF, "UPDATE account SET sessionkey = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE username = ?", CONNECTION_ASYNC) @@ -86,5 +87,4 @@ void LoginDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC); - } diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h index 2b9d94cbceb..7c2a94eec94 100755 --- a/src/server/shared/Database/Implementation/LoginDatabase.h +++ b/src/server/shared/Database/Implementation/LoginDatabase.h @@ -51,6 +51,7 @@ enum LoginDatabaseStatements LOGIN_SEL_ACCOUNT_BANNED_ALL, LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME, LOGIN_INS_ACCOUNT_AUTO_BANNED, + LOGIN_DEL_ACCOUNT_BANNED, LOGIN_SEL_SESSIONKEY, LOGIN_UPD_VS, LOGIN_UPD_LOGONPROOF, |