diff --git a/contrib/Makefile.am b/contrib/Makefile.am
deleted file mode 100644
index d39f2caa8..000000000
--- a/contrib/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (C) 2005-2009 MaNGOS
-#
-# 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, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-## Process this file with automake to produce Makefile.in
-
-## Sub-directories to parse
-SUBDIRS = extractor
-
-## Additional files to include when running 'make dist'
-# Nothing yet.
diff --git a/contrib/extractor/CMakeLists.txt b/contrib/extractor/CMakeLists.txt
new file mode 100644
index 000000000..a00dda120
--- /dev/null
+++ b/contrib/extractor/CMakeLists.txt
@@ -0,0 +1,21 @@
+# Copyright (C) 2005-2009 MaNGOS project
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+cmake_minimum_required (VERSION 2.6)
+project (MANGOS_MAP_EXTRACTOR)
+
+add_subdirectory (libmpq)
+
+include_directories (${MANGOS_MAP_EXTRACTOR_SOURCE_DIR}/libmpq)
+link_directories (${MANGOS_MAP_EXTRACTOR_SOURCE_DIR}/libmpq)
+
+add_executable (ad adt.cpp dbcfile.cpp mpq_libmpq.cpp System.cpp)
+
+target_link_libraries (ad libmpq)
diff --git a/contrib/extractor/Makefile.am b/contrib/extractor/Makefile.am
deleted file mode 100644
index b84617069..000000000
--- a/contrib/extractor/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-# The top-level input Makefile for mpq-tools
-
-# Any directories which should be built and installed.
-SUBDIRS = libmpq
-
-# The directories which are part of the distribution.
-DIST_SUBDIRS = $(SUBDIRS)
-
-EXTRA_DIST = \
- README.linux
diff --git a/contrib/extractor/README.linux b/contrib/extractor/README.linux
index e1ebdb8bb..1986831e7 100644
--- a/contrib/extractor/README.linux
+++ b/contrib/extractor/README.linux
@@ -1,13 +1,7 @@
Linux instructions
------------------
-1. Configure and build MaNGOS.
-2. cd contrib/map_extractor/libmpq/
+1. install cmake
+2. cmake -i
3. make
-4. cd ..
-5. make
-6. run ad
-
-if there are any problems create folder named .deps in contrib/map_extractor/
-it is old bug from first extractor and i am too lasy to fix it :)
-
+4. ./ad
diff --git a/contrib/extractor/libmpq/CMakeLists.txt b/contrib/extractor/libmpq/CMakeLists.txt
new file mode 100644
index 000000000..c00120c6e
--- /dev/null
+++ b/contrib/extractor/libmpq/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Copyright (C) 2005-2009 MaNGOS project
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+add_library (libmpq common.cpp explode.cpp extract.cpp huffman.cpp mpq.cpp parser.cpp wave.cpp )
+# link libmpq with zlib
+target_link_libraries (libmpq z)
diff --git a/contrib/extractor/libmpq/Makefile.am b/contrib/extractor/libmpq/Makefile.am
deleted file mode 100644
index 192bd1369..000000000
--- a/contrib/extractor/libmpq/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-# The input Makefile for the main mpq-tools
-
-lib_LTLIBRARIES = libmpq.la
-noinst_HEADERS = explode.h huffman.h wave.h common.h
-
-# The directory where the include files will be installed.
-libmpq_includedir = $(includedir)/libmpq
-
-# Which header files to install.
-libmpq_include_HEADERS = mpq.h
-
-libmpq_la_SOURCES = $(GENERAL_SRCS)
-libmpq_la_LDFLAGS = -release $(LIBMPQ_VERSION)
-libmpq_la_LIBADD = @Z_LIBS@
-
-GENERAL_SRCS = \
- common.c \
- huffman.c \
- extract.c \
- explode.c \
- mpq.c \
- parser.c \
- wave.c
diff --git a/sql/characters.sql b/sql/characters.sql
index 701a2cee8..078afe024 100644
--- a/sql/characters.sql
+++ b/sql/characters.sql
@@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` (
- `required_7075_01_characters_character_spell` bit(1) default NULL
+ `required_7113_01_characters_character_achievement_progress` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
--
diff --git a/sql/mangos.sql b/sql/mangos.sql
index 1854d1492..686c3a8fc 100644
--- a/sql/mangos.sql
+++ b/sql/mangos.sql
@@ -22,7 +22,7 @@
DROP TABLE IF EXISTS `db_version`;
CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
- `required_7075_02_mangos_spell_learn_spell` bit(1) default NULL
+ `required_7133_02_mangos_spell_loot_template` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
--
@@ -2661,7 +2661,7 @@ INSERT INTO `mangos_string` VALUES
(518,'%d - |cffffffff|Hitemset:%d|h[%s %s]|h|r ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(519,'|cffffffff|Htele:%s|h[%s]|h|r ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(520,'%d - |cffffffff|Hspell:%d|h[%s]|h|r ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
-(521,'%d - |cffffffff|Hskill:%d|h[%s %s]|h|r %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(521,'%d - |cffffffff|Hskill:%d|h[%s %s]|h|r %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(522,'Game Object (GUID: %u) not found',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(523,'>> Game Object %s (GUID: %u) at %f %f %f. Orientation %f.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(524,'Selected object:\n|cffffffff|Hitemset:%d|h[%s]|h|r\nGUID: %u ID: %u\nX: %f Y: %f Z: %f MapId: %u\nOrientation: %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
@@ -2841,7 +2841,7 @@ INSERT INTO `mangos_string` VALUES
(1106,'%d - %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1107,'%d - %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1108,'%d - %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
-(1109,'%d - %s %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(1109,'%d - %s %s %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1110,'%d - %s X:%f Y:%f Z:%f MapId:%d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1111,'%d - %s X:%f Y:%f Z:%f MapId:%d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1112,'Failed to open file: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
@@ -2853,7 +2853,8 @@ INSERT INTO `mangos_string` VALUES
(1118,'%d - guild: %s (guid: %u) %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1119,'You must use male or female as gender.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1120,'You change gender of %s to %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
-(1121,'Your gender changed to %s by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+(1121,'Your gender changed to %s by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(1122,'(%u/%u +perm %u +temp %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
/*!40000 ALTER TABLE `mangos_string` ENABLE KEYS */;
UNLOCK TABLES;
@@ -9291,6 +9292,105 @@ INSERT INTO `player_levelstats` VALUES
/*!40000 ALTER TABLE `player_levelstats` ENABLE KEYS */;
UNLOCK TABLES;
+-- ----------------------------
+-- Table structure for player_xp_for_level
+-- ----------------------------
+DROP TABLE IF EXISTS `player_xp_for_level`;
+CREATE TABLE `player_xp_for_level` (
+ `lvl` int(3) unsigned NOT NULL,
+ `xp_for_next_level` int(10) unsigned NOT NULL,
+ PRIMARY KEY (`lvl`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Dumping data for table `player_xp_for_level`
+--
+
+LOCK TABLES `player_xp_for_level` WRITE;
+/*!40000 ALTER TABLE `player_xp_for_level` DISABLE KEYS */;
+INSERT INTO `player_xp_for_level` VALUES
+('1', '400'),
+('2', '900'),
+('3', '1400'),
+('4', '2100'),
+('5', '2800'),
+('6', '3600'),
+('7', '4500'),
+('8', '5400'),
+('9', '6500'),
+('10', '7600'),
+('11', '8700'),
+('12', '9800'),
+('13', '11000'),
+('14', '12300'),
+('15', '13600'),
+('16', '15000'),
+('17', '16400'),
+('18', '17800'),
+('19', '19300'),
+('20', '20800'),
+('21', '22400'),
+('22', '24000'),
+('23', '25500'),
+('24', '27200'),
+('25', '28900'),
+('26', '30500'),
+('27', '32200'),
+('28', '33900'),
+('29', '36300'),
+('30', '38800'),
+('31', '41600'),
+('32', '44600'),
+('33', '48000'),
+('34', '51400'),
+('35', '55000'),
+('36', '58700'),
+('37', '62400'),
+('38', '66200'),
+('39', '70200'),
+('40', '74300'),
+('41', '78500'),
+('42', '82800'),
+('43', '87100'),
+('44', '91600'),
+('45', '96300'),
+('46', '101000'),
+('47', '105800'),
+('48', '110700'),
+('49', '115700'),
+('50', '120900'),
+('51', '126100'),
+('52', '131500'),
+('53', '137000'),
+('54', '142500'),
+('55', '148200'),
+('56', '154000'),
+('57', '159900'),
+('58', '165800'),
+('59', '172000'),
+('60', '290000'),
+('61', '317000'),
+('62', '349000'),
+('63', '386000'),
+('64', '428000'),
+('65', '475000'),
+('66', '527000'),
+('67', '585000'),
+('68', '648000'),
+('69', '717000'),
+('70', '1523800'),
+('71', '1539600'),
+('72', '1555700'),
+('73', '1571800'),
+('74', '1587900'),
+('75', '1604200'),
+('76', '1620700'),
+('77', '1637400'),
+('78', '1653900'),
+('79', '1670800');
+/*!40000 ALTER TABLE `player_xp_for_level` ENABLE KEYS */;
+UNLOCK TABLES;
+
--
-- Table structure for table `playercreateinfo`
--
@@ -12899,8 +12999,9 @@ DROP TABLE IF EXISTS `skill_discovery_template`;
CREATE TABLE `skill_discovery_template` (
`spellId` mediumint(8) unsigned NOT NULL default '0' COMMENT 'SpellId of the discoverable spell',
`reqSpell` mediumint(8) unsigned NOT NULL default '0' COMMENT 'spell requirement',
+ `reqSkillValue` smallint(5) unsigned NOT NULL default '0' COMMENT 'skill points requirement',
`chance` float NOT NULL default '0' COMMENT 'chance to discover',
- PRIMARY KEY (`spellId`)
+ PRIMARY KEY (`spellId`,`reqSpell`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Skill Discovery System';
--
@@ -16124,6 +16225,33 @@ INSERT INTO `spell_learn_spell` VALUES
/*!40000 ALTER TABLE `spell_learn_spell` ENABLE KEYS */;
UNLOCK TABLES;
+--
+-- Table structure for table `spell_loot_template`
+--
+
+DROP TABLE IF EXISTS `spell_loot_template`;
+CREATE TABLE `spell_loot_template` (
+ `entry` mediumint(8) unsigned NOT NULL default '0',
+ `item` mediumint(8) unsigned NOT NULL default '0',
+ `ChanceOrQuestChance` float NOT NULL default '100',
+ `groupid` tinyint(3) unsigned NOT NULL default '0',
+ `mincountOrRef` mediumint(9) NOT NULL default '1',
+ `maxcount` tinyint(3) unsigned NOT NULL default '1',
+ `lootcondition` tinyint(3) unsigned NOT NULL default '0',
+ `condition_value1` mediumint(8) unsigned NOT NULL default '0',
+ `condition_value2` mediumint(8) unsigned NOT NULL default '0',
+ PRIMARY KEY (`entry`,`item`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Loot System';
+
+--
+-- Dumping data for table `spell_loot_template`
+--
+
+LOCK TABLES `spell_loot_template` WRITE;
+/*!40000 ALTER TABLE `spell_loot_template` DISABLE KEYS */;
+/*!40000 ALTER TABLE `spell_loot_template` ENABLE KEYS */;
+UNLOCK TABLES;
+
--
-- Table structure for table `spell_pet_auras`
--
@@ -16324,7 +16452,7 @@ INSERT INTO `spell_proc_event` VALUES
(15362, 0x00000000, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
(15363, 0x00000000, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
(15600, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 0),
-(16164, 0x00000000, 11, 0x90100003, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
+(16164, 0x00000000, 11, 0x901000C3, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
(16176, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
(16180, 0x00000000, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
(16196, 0x00000000, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
@@ -16548,6 +16676,8 @@ INSERT INTO `spell_proc_event` VALUES
(31833, 0x00000000, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(31835, 0x00000000, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(31836, 0x00000000, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
+(31871, 0x00000000, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0),
+(31872, 0x00000000, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0),
(31876, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(31877, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(31878, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
@@ -16629,9 +16759,9 @@ INSERT INTO `spell_proc_event` VALUES
(35080, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 60),
(35083, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60),
(35086, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60),
-(35100, 0x00000000, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
-(35102, 0x00000000, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
-(35103, 0x00000000, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
+(35100, 0x00000000, 9, 0x00003001, 0x00000000, 0x00000000, 0x00010140, 0x00000000, 0.000000, 0.000000, 0),
+(35102, 0x00000000, 9, 0x00003001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
+(35103, 0x00000000, 9, 0x00003001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(35121, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
(36096, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0),
(36111, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
@@ -16709,6 +16839,7 @@ INSERT INTO `spell_proc_event` VALUES
(42136, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 90),
(42368, 0x00000000, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(42370, 0x00000000, 11, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
+(42770, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0),
(43019, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0),
(43020, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0),
(43338, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
@@ -16722,6 +16853,9 @@ INSERT INTO `spell_proc_event` VALUES
(43748, 0x00000000, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(43750, 0x00000000, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(43819, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0),
+(44394, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0),
+(44395, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0),
+(44396, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0),
(44404, 0x00000000, 3, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(44445, 0x00000000, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(44446, 0x00000000, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
@@ -16786,11 +16920,11 @@ INSERT INTO `spell_proc_event` VALUES
(47515, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
(47516, 0x00000000, 6, 0x00001800, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(47517, 0x00000000, 6, 0x00001800, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
-(47535, 0x00000000, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0),
-(47536, 0x00000000, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0),
-(47537, 0x00000000, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0),
-(47538, 0x00000000, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0),
-(47539, 0x00000000, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0),
+(47535, 0x00000000, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
+(47536, 0x00000000, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
+(47537, 0x00000000, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
+(47538, 0x00000000, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
+(47539, 0x00000000, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(47549, 0x00000000, 6, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(47551, 0x00000000, 6, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(47552, 0x00000000, 6, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
@@ -16798,9 +16932,9 @@ INSERT INTO `spell_proc_event` VALUES
(47556, 0x00000000, 6, 0x00001800, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(47557, 0x00000000, 6, 0x00001800, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(47572, 0x00000000, 6, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
-(47580, 0x00000000, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
-(47581, 0x00000000, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
-(47582, 0x00000000, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
+(47580, 0x00000000, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0),
+(47581, 0x00000000, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0),
+(47582, 0x00000000, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0),
(48110, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 0),
(48111, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 0),
(48112, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 0),
@@ -17029,6 +17163,7 @@ INSERT INTO `spell_proc_event` VALUES
(60818, 0x00000000, 10, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(60826, 0x00000000, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(61188, 0x00000000, 5, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
+(61257, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x000202A8, 0x00010000, 0.000000, 0.000000, 0),
(61324, 0x00000000, 10, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0);
/*!40000 ALTER TABLE `spell_proc_event` ENABLE KEYS */;
UNLOCK TABLES;
diff --git a/sql/updates/2008_12_22_19_characters_item_instance.sql b/sql/updates/2008_12_22_19_characters_item_instance.sql
index 96f31ff47..e737e24da 100644
--- a/sql/updates/2008_12_22_19_characters_item_instance.sql
+++ b/sql/updates/2008_12_22_19_characters_item_instance.sql
@@ -4,8 +4,8 @@ UPDATE item_instance SET data = REPLACE(data,' ',' ');
UPDATE item_instance SET data = CONCAT(TRIM(data),' ');
UPDATE item_instance SET data= CONCAT(
- SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',30),' ',-30),' 0 0 0 ',
- SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',60),' ',-60+30),' 0 ')
+ SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',54),' ',-54),' 0 0 0 ',
+ SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',60),' ',-60+54),' 0 ')
WHERE SUBSTRING_INDEX(data,' ',60) = data AND SUBSTRING_INDEX(data,' ',60-1) <> data;
UPDATE item_instance SET data= CONCAT(
diff --git a/sql/updates/7077_01_characters_character_spell.sql b/sql/updates/7077_01_characters_character_spell.sql
new file mode 100644
index 000000000..b68f99b1d
--- /dev/null
+++ b/sql/updates/7077_01_characters_character_spell.sql
@@ -0,0 +1,214 @@
+ALTER TABLE character_db_version CHANGE COLUMN required_7075_01_characters_character_spell required_7077_01_characters_character_spell bit;
+
+UPDATE IGNORE character_spell SET spell = 2018 WHERE spell = 2020;
+DELETE FROM character_spell WHERE spell = 2020;
+
+UPDATE IGNORE character_spell SET spell = 2018 WHERE spell = 2020;
+DELETE FROM character_spell WHERE spell = 2020;
+
+UPDATE IGNORE character_spell SET spell = 3100 WHERE spell = 2021;
+DELETE FROM character_spell WHERE spell = 2021;
+
+UPDATE IGNORE character_spell SET spell = 3104 WHERE spell = 2154;
+DELETE FROM character_spell WHERE spell = 2154;
+
+UPDATE IGNORE character_spell SET spell = 2108 WHERE spell = 2155;
+DELETE FROM character_spell WHERE spell = 2155;
+
+UPDATE IGNORE character_spell SET spell = 2259 WHERE spell = 2275;
+DELETE FROM character_spell WHERE spell = 2275;
+
+UPDATE IGNORE character_spell SET spell = 3101 WHERE spell = 2280;
+DELETE FROM character_spell WHERE spell = 2280;
+
+UPDATE IGNORE character_spell SET spell = 2366 WHERE spell = 2372;
+DELETE FROM character_spell WHERE spell = 2372;
+
+UPDATE IGNORE character_spell SET spell = 2368 WHERE spell = 2373;
+DELETE FROM character_spell WHERE spell = 2373;
+
+UPDATE IGNORE character_spell SET spell = 2550 WHERE spell = 2551;
+DELETE FROM character_spell WHERE spell = 2551;
+
+UPDATE IGNORE character_spell SET spell = 2575 WHERE spell = 2581;
+DELETE FROM character_spell WHERE spell = 2581;
+
+UPDATE IGNORE character_spell SET spell = 2576 WHERE spell = 2582;
+DELETE FROM character_spell WHERE spell = 2582;
+
+UPDATE IGNORE character_spell SET spell = 3273 WHERE spell = 3279;
+DELETE FROM character_spell WHERE spell = 3279;
+
+UPDATE IGNORE character_spell SET spell = 3274 WHERE spell = 3280;
+DELETE FROM character_spell WHERE spell = 3280;
+
+UPDATE IGNORE character_spell SET spell = 3102 WHERE spell = 3412;
+DELETE FROM character_spell WHERE spell = 3412;
+
+UPDATE IGNORE character_spell SET spell = 3464 WHERE spell = 3465;
+DELETE FROM character_spell WHERE spell = 3465;
+
+UPDATE IGNORE character_spell SET spell = 3538 WHERE spell = 3539;
+DELETE FROM character_spell WHERE spell = 3539;
+
+UPDATE IGNORE character_spell SET spell = 3564 WHERE spell = 3568;
+DELETE FROM character_spell WHERE spell = 3568;
+
+UPDATE IGNORE character_spell SET spell = 3570 WHERE spell = 3571;
+DELETE FROM character_spell WHERE spell = 3571;
+
+UPDATE IGNORE character_spell SET spell = 3811 WHERE spell = 3812;
+DELETE FROM character_spell WHERE spell = 3812;
+
+UPDATE IGNORE character_spell SET spell = 3908 WHERE spell = 3911;
+DELETE FROM character_spell WHERE spell = 3911;
+
+UPDATE IGNORE character_spell SET spell = 3909 WHERE spell = 3912;
+DELETE FROM character_spell WHERE spell = 3912;
+
+UPDATE IGNORE character_spell SET spell = 3910 WHERE spell = 3913;
+DELETE FROM character_spell WHERE spell = 3913;
+
+UPDATE IGNORE character_spell SET spell = 4036 WHERE spell = 4039;
+DELETE FROM character_spell WHERE spell = 4039;
+
+UPDATE IGNORE character_spell SET spell = 4037 WHERE spell = 4040;
+DELETE FROM character_spell WHERE spell = 4040;
+
+UPDATE IGNORE character_spell SET spell = 4038 WHERE spell = 4041;
+DELETE FROM character_spell WHERE spell = 4041;
+
+UPDATE IGNORE character_spell SET spell = 7620 WHERE spell = 7733;
+DELETE FROM character_spell WHERE spell = 7733;
+
+UPDATE IGNORE character_spell SET spell = 7731 WHERE spell = 7734;
+DELETE FROM character_spell WHERE spell = 7734;
+
+UPDATE IGNORE character_spell SET spell = 8613 WHERE spell = 8615;
+DELETE FROM character_spell WHERE spell = 8615;
+
+UPDATE IGNORE character_spell SET spell = 8617 WHERE spell = 8619;
+DELETE FROM character_spell WHERE spell = 8619;
+
+UPDATE IGNORE character_spell SET spell = 8618 WHERE spell = 8620;
+DELETE FROM character_spell WHERE spell = 8620;
+
+UPDATE IGNORE character_spell SET spell = 9785 WHERE spell = 9786;
+DELETE FROM character_spell WHERE spell = 9786;
+
+UPDATE IGNORE character_spell SET spell = 10248 WHERE spell = 10249;
+DELETE FROM character_spell WHERE spell = 10249;
+
+UPDATE IGNORE character_spell SET spell = 10662 WHERE spell = 10663;
+DELETE FROM character_spell WHERE spell = 10663;
+
+UPDATE IGNORE character_spell SET spell = 10768 WHERE spell = 10769;
+DELETE FROM character_spell WHERE spell = 10769;
+
+UPDATE IGNORE character_spell SET spell = 11611 WHERE spell = 11612;
+DELETE FROM character_spell WHERE spell = 11612;
+
+UPDATE IGNORE character_spell SET spell = 11993 WHERE spell = 11994;
+DELETE FROM character_spell WHERE spell = 11994;
+
+UPDATE IGNORE character_spell SET spell = 12180 WHERE spell = 12181;
+DELETE FROM character_spell WHERE spell = 12181;
+
+UPDATE IGNORE character_spell SET spell = 12656 WHERE spell = 12657;
+DELETE FROM character_spell WHERE spell = 12657;
+
+UPDATE IGNORE character_spell SET spell = 25229 WHERE spell = 25245;
+DELETE FROM character_spell WHERE spell = 25245;
+
+UPDATE IGNORE character_spell SET spell = 25230 WHERE spell = 25246;
+DELETE FROM character_spell WHERE spell = 25246;
+
+UPDATE IGNORE character_spell SET spell = 26790 WHERE spell = 26791;
+DELETE FROM character_spell WHERE spell = 26791;
+
+UPDATE IGNORE character_spell SET spell = 28596 WHERE spell = 28597;
+DELETE FROM character_spell WHERE spell = 28597;
+
+UPDATE IGNORE character_spell SET spell = 28695 WHERE spell = 28696;
+DELETE FROM character_spell WHERE spell = 28696;
+
+UPDATE IGNORE character_spell SET spell = 28894 WHERE spell = 28896;
+DELETE FROM character_spell WHERE spell = 28896;
+
+UPDATE IGNORE character_spell SET spell = 28895 WHERE spell = 28899;
+DELETE FROM character_spell WHERE spell = 28899;
+
+UPDATE IGNORE character_spell SET spell = 28897 WHERE spell = 28901;
+DELETE FROM character_spell WHERE spell = 28901;
+
+UPDATE IGNORE character_spell SET spell = 29354 WHERE spell = 29355;
+DELETE FROM character_spell WHERE spell = 29355;
+
+UPDATE IGNORE character_spell SET spell = 29844 WHERE spell = 29845;
+DELETE FROM character_spell WHERE spell = 29845;
+
+UPDATE IGNORE character_spell SET spell = 30350 WHERE spell = 30351;
+DELETE FROM character_spell WHERE spell = 30351;
+
+UPDATE IGNORE character_spell SET spell = 32549 WHERE spell = 32550;
+DELETE FROM character_spell WHERE spell = 32550;
+
+UPDATE IGNORE character_spell SET spell = 32678 WHERE spell = 32679;
+DELETE FROM character_spell WHERE spell = 32679;
+
+UPDATE IGNORE character_spell SET spell = 45357 WHERE spell = 45375;
+DELETE FROM character_spell WHERE spell = 45375;
+
+UPDATE IGNORE character_spell SET spell = 45358 WHERE spell = 45376;
+DELETE FROM character_spell WHERE spell = 45376;
+
+UPDATE IGNORE character_spell SET spell = 45359 WHERE spell = 45377;
+DELETE FROM character_spell WHERE spell = 45377;
+
+UPDATE IGNORE character_spell SET spell = 45360 WHERE spell = 45378;
+DELETE FROM character_spell WHERE spell = 45378;
+
+UPDATE IGNORE character_spell SET spell = 45361 WHERE spell = 45379;
+DELETE FROM character_spell WHERE spell = 45379;
+
+UPDATE IGNORE character_spell SET spell = 45363 WHERE spell = 45380;
+DELETE FROM character_spell WHERE spell = 45380;
+
+UPDATE IGNORE character_spell SET spell = 45542 WHERE spell = 50299;
+DELETE FROM character_spell WHERE spell = 50299;
+
+UPDATE IGNORE character_spell SET spell = 50305 WHERE spell = 50307;
+DELETE FROM character_spell WHERE spell = 50307;
+
+UPDATE IGNORE character_spell SET spell = 50310 WHERE spell = 50309;
+DELETE FROM character_spell WHERE spell = 50309;
+
+UPDATE IGNORE character_spell SET spell = 51294 WHERE spell = 51293;
+DELETE FROM character_spell WHERE spell = 51293;
+
+UPDATE IGNORE character_spell SET spell = 51296 WHERE spell = 51295;
+DELETE FROM character_spell WHERE spell = 51295;
+
+UPDATE IGNORE character_spell SET spell = 51300 WHERE spell = 51298;
+DELETE FROM character_spell WHERE spell = 51298;
+
+UPDATE IGNORE character_spell SET spell = 51302 WHERE spell = 51301;
+DELETE FROM character_spell WHERE spell = 51301;
+
+UPDATE IGNORE character_spell SET spell = 51304 WHERE spell = 51303;
+DELETE FROM character_spell WHERE spell = 51303;
+
+UPDATE IGNORE character_spell SET spell = 51306 WHERE spell = 51305;
+DELETE FROM character_spell WHERE spell = 51305;
+
+UPDATE IGNORE character_spell SET spell = 51309 WHERE spell = 51308;
+DELETE FROM character_spell WHERE spell = 51308;
+
+UPDATE IGNORE character_spell SET spell = 51311 WHERE spell = 51310;
+DELETE FROM character_spell WHERE spell = 51310;
+
+UPDATE IGNORE character_spell SET spell = 51313 WHERE spell = 51312;
+DELETE FROM character_spell WHERE spell = 51312;
+
+UPDATE IGNORE character_spell SET spell = 33095 WHERE spell = 54084;
+DELETE FROM character_spell WHERE spell = 54084;
diff --git a/sql/updates/7078_01_mangos_spell_proc_event.sql b/sql/updates/7078_01_mangos_spell_proc_event.sql
new file mode 100644
index 000000000..b5df2f7fa
--- /dev/null
+++ b/sql/updates/7078_01_mangos_spell_proc_event.sql
@@ -0,0 +1,23 @@
+ALTER TABLE db_version CHANGE COLUMN required_7075_02_mangos_spell_learn_spell required_7078_01_mangos_spell_proc_event bit;
+
+-- (31871) Divine Purpose (Rank 1)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (31871);
+INSERT INTO `spell_proc_event` VALUES (31871, 0x00, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0);
+
+-- (31872) Divine Purpose (Rank 2)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (31872);
+INSERT INTO `spell_proc_event` VALUES (31872, 0x00, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0);
+
+-- (44394) Incanter's Absorption (Rank 1)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (44394);
+INSERT INTO `spell_proc_event` VALUES (44394, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0);
+
+-- (44395) Incanter's Absorption (Rank 2)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (44395);
+INSERT INTO `spell_proc_event` VALUES (44395, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0);
+
+-- (44396) Incanter's Absorption (Rank 3)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (44396);
+INSERT INTO `spell_proc_event` VALUES (44396, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0);
+
+
\ No newline at end of file
diff --git a/sql/updates/7092_01_mangos_player_xp_for_level.sql b/sql/updates/7092_01_mangos_player_xp_for_level.sql
new file mode 100644
index 000000000..aa4fabd28
--- /dev/null
+++ b/sql/updates/7092_01_mangos_player_xp_for_level.sql
@@ -0,0 +1,93 @@
+ALTER TABLE db_version CHANGE COLUMN required_7078_01_mangos_spell_proc_event required_7092_01_mangos_player_xp_for_level bit;
+
+DROP TABLE IF EXISTS `player_xp_for_level`;
+CREATE TABLE `player_xp_for_level` (
+ `lvl` int(3) unsigned NOT NULL,
+ `xp_for_next_level` int(10) unsigned NOT NULL,
+ PRIMARY KEY (`lvl`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Dumping data for table `player_xp_for_level`
+--
+
+INSERT INTO `player_xp_for_level` VALUES
+('1', '400'),
+('2', '900'),
+('3', '1400'),
+('4', '2100'),
+('5', '2800'),
+('6', '3600'),
+('7', '4500'),
+('8', '5400'),
+('9', '6500'),
+('10', '7600'),
+('11', '8700'),
+('12', '9800'),
+('13', '11000'),
+('14', '12300'),
+('15', '13600'),
+('16', '15000'),
+('17', '16400'),
+('18', '17800'),
+('19', '19300'),
+('20', '20800'),
+('21', '22400'),
+('22', '24000'),
+('23', '25500'),
+('24', '27200'),
+('25', '28900'),
+('26', '30500'),
+('27', '32200'),
+('28', '33900'),
+('29', '36300'),
+('30', '38800'),
+('31', '41600'),
+('32', '44600'),
+('33', '48000'),
+('34', '51400'),
+('35', '55000'),
+('36', '58700'),
+('37', '62400'),
+('38', '66200'),
+('39', '70200'),
+('40', '74300'),
+('41', '78500'),
+('42', '82800'),
+('43', '87100'),
+('44', '91600'),
+('45', '96300'),
+('46', '101000'),
+('47', '105800'),
+('48', '110700'),
+('49', '115700'),
+('50', '120900'),
+('51', '126100'),
+('52', '131500'),
+('53', '137000'),
+('54', '142500'),
+('55', '148200'),
+('56', '154000'),
+('57', '159900'),
+('58', '165800'),
+('59', '172000'),
+('60', '290000'),
+('61', '317000'),
+('62', '349000'),
+('63', '386000'),
+('64', '428000'),
+('65', '475000'),
+('66', '527000'),
+('67', '585000'),
+('68', '648000'),
+('69', '717000'),
+('70', '1523800'),
+('71', '1539600'),
+('72', '1555700'),
+('73', '1571800'),
+('74', '1587900'),
+('75', '1604200'),
+('76', '1620700'),
+('77', '1637400'),
+('78', '1653900'),
+('79', '1670800');
\ No newline at end of file
diff --git a/sql/updates/7097_01_mangos_spell_proc_event.sql b/sql/updates/7097_01_mangos_spell_proc_event.sql
new file mode 100644
index 000000000..abccb36c5
--- /dev/null
+++ b/sql/updates/7097_01_mangos_spell_proc_event.sql
@@ -0,0 +1,58 @@
+ALTER TABLE db_version CHANGE COLUMN required_7092_01_mangos_player_xp_for_level required_7097_01_mangos_spell_proc_event bit;
+
+-- (35100) Concussive Barrage (Rank 1)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (35100);
+INSERT INTO `spell_proc_event` VALUES (35100, 0x00, 9, 0x00003001, 0x00000000, 0x00000000, 0x00010140, 0x00000000, 0.000000, 0.000000, 0);
+
+-- (35102) Concussive Barrage (Rank 2)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (35102);
+INSERT INTO `spell_proc_event` VALUES (35102, 0x00, 9, 0x00003001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0);
+
+-- (35103) Concussive Barrage (Rank 3)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (35103);
+INSERT INTO `spell_proc_event` VALUES (35103, 0x00, 9, 0x00003001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0);
+
+-- (16164) Elemental Focus ()
+DELETE FROM `spell_proc_event` WHERE `entry` IN (16164);
+INSERT INTO `spell_proc_event` VALUES (16164, 0x00, 11, 0x901000C3, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0);
+
+-- (42770) Second Wind (Rank 2)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (42770);
+INSERT INTO `spell_proc_event` VALUES (42770, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0);
+
+-- (47580) Pain and Suffering (Rank 1)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (47580);
+INSERT INTO `spell_proc_event` VALUES (47580, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0);
+
+-- (47581) Pain and Suffering (Rank 2)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (47581);
+INSERT INTO `spell_proc_event` VALUES (47581, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0);
+
+-- (47582) Pain and Suffering (Rank 3)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (47582);
+INSERT INTO `spell_proc_event` VALUES (47582, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0);
+
+-- (47535) Rapture (Rank 1)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (47535);
+INSERT INTO `spell_proc_event` VALUES (47535, 0x00, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0);
+
+-- (47536) Rapture (Rank 2)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (47536);
+INSERT INTO `spell_proc_event` VALUES (47536, 0x00, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0);
+
+-- (47537) Rapture (Rank 3)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (47537);
+INSERT INTO `spell_proc_event` VALUES (47537, 0x00, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0);
+
+-- (47538) Rapture (Rank 4)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (47538);
+INSERT INTO `spell_proc_event` VALUES (47538, 0x00, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0);
+
+-- (47539) Rapture (Rank 5)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (47539);
+INSERT INTO `spell_proc_event` VALUES (47539, 0x00, 6, 0x00001800, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0);
+
+-- (61257) Runic Power Back on Snare/Root (Rank 5)
+DELETE FROM `spell_proc_event` WHERE `entry` IN (61257);
+INSERT INTO `spell_proc_event` VALUES (61257, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000202A8, 0x00010000, 0.000000, 0.000000, 0);
+
diff --git a/sql/updates/7100_01_characters_character_spell.sql b/sql/updates/7100_01_characters_character_spell.sql
new file mode 100644
index 000000000..4d65b6c15
--- /dev/null
+++ b/sql/updates/7100_01_characters_character_spell.sql
@@ -0,0 +1,39 @@
+ALTER TABLE character_db_version CHANGE COLUMN required_7077_01_characters_character_spell required_7100_01_characters_character_spell bit;
+
+/* Warrior cleanup */
+DELETE FROM `character_spell` WHERE `spell` IN (1715,7372,7373); /* Hamstring old */
+DELETE FROM `character_spell` WHERE `spell` IN (72,17671,1672); /* Mortar Disturb old */
+DELETE FROM `character_spell` WHERE `spell` IN (7384,7887,11584,11586); /* Overpower old */
+DELETE FROM `character_spell` WHERE `spell`=23881; /* Bloodthirst old */
+DELETE FROM `character_spell` WHERE `spell` IN (6552,6554); /* Pummel old */
+DELETE FROM `character_spell` WHERE `spell` IN (694,7400,7402,20559,20560,25266); /* Mocking Blow old */
+/* Druid cleanup */
+DELETE FROM `character_spell` WHERE `spell`=22842; /* Frenzied Regeneration old */
+/* Hunter cleanup */
+DELETE FROM `character_spell` WHERE `spell`=14268; /* Wing Clip r1 old */
+DELETE FROM `character_spell` WHERE `spell`=14267; /* Wing Clip r2 old */
+/* Rogue */
+DELETE FROM `character_spell` WHERE `spell` IN (1766,1767,1768,1769,38768); /* Kick old */
+DELETE FROM `character_spell` WHERE `spell` IN (1776,1777,8629,11285,11286,38764);/* Gouge old */
+DELETE FROM `character_spell` WHERE `spell`=2842; /* Poisons old */
+
+/* Hunter's training spells for pets */
+DELETE FROM `character_spell` WHERE `spell` IN (2949,2975,2976,2977,2980,2981,2982,3666,3667,4630,6327,6359,6362,
+ 7370,7832,7833,7834,7835,7871,7872,7873,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886,8318,8319,11764,
+ 11765,11768,11769,11772,11773,11776,11777,11781,11782,11783,11786,11787,17254,17262,17263,17264,17265,17266,
+ 17267,17268,17736,17753,17754,17755,17776,17855,17856,17857,17859,17860,19439,19444,19445,19446,19447,19481,
+ 19577,19648,19650,19661,19662,19663,19664,19737,19738,19739,20270,20312,20313,20314,20315,20316,20317,20318,
+ 20319,20320,20321,20322,20323,20324,20326,20327,20329,20377,20378,20379,20380,20381,20382,20383,20384,20385,
+ 20386,20387,20388,20389,20390,20391,20392,20393,20394,20395,20396,20397,20398,20399,20400,20401,20402,20403,
+ 20404,20405,20406,20407,20408,20426,20427,20428,20429,20430,20431,20432,20433,20434,20435,23100,23111,23112,
+ 23146,23149,23150,24424,24440,24441,24451,24454,24455,24463,24464,24475,24476,24477,24580,24581,24582,24584,
+ 24588,24589,24599,24607,24608,24609,24641,26065,26094,26184,26185,26186,26189,26190,26202,27347,27348,27349,
+ 27361,27366,27484,27485,27486,27487,27488,27489,27490,27491,27492,27493,27494,27495,27496,27497,27500,28343,
+ 33703,35299,35300,35302,35303,35304,35305,35306,35307,35308);
+DELETE FROM `character_spell` WHERE `spell` IN (1853,14922,14923,14924,14925,14926,14927,27344);
+DELETE FROM `character_spell` WHERE `spell` IN (27353,24516,24515,24514,24490);
+DELETE FROM `character_spell` WHERE `spell` IN (27354,24513,24512,24511,24494,2119);
+UPDATE IGNORE character_spell SET spell = 2108 WHERE spell = 3104;
+DELETE FROM character_spell WHERE spell = 3104;
+/* This cleanup character_action. This is like delete from character_action where type=0 and action not in character_spell for same player */
+DELETE FROM ca,cs USING `character_action` ca LEFT JOIN `character_spell` cs ON ca.`guid`=cs.`guid` AND ca.`action`=cs.`spell` WHERE ca.`type`=0 AND cs.`guid` IS NULL;
diff --git a/sql/updates/7107_01_mangos_string.sql b/sql/updates/7107_01_mangos_string.sql
new file mode 100644
index 000000000..bd4ee1ce6
--- /dev/null
+++ b/sql/updates/7107_01_mangos_string.sql
@@ -0,0 +1,7 @@
+ALTER TABLE db_version CHANGE COLUMN required_7097_01_mangos_spell_proc_event required_7107_01_mangos_string bit;
+
+DELETE FROM `mangos_string` WHERE `entry` IN (521,1109,1122);
+INSERT INTO `mangos_string` VALUES
+(521,'%d - |cffffffff|Hskill:%d|h[%s %s]|h|r %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(1109,'%d - %s %s %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(1122,'(%u/%u +perm %u +temp %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
diff --git a/sql/updates/7113_01_characters_character_achievement_progress.sql b/sql/updates/7113_01_characters_character_achievement_progress.sql
new file mode 100644
index 000000000..6e38cd998
--- /dev/null
+++ b/sql/updates/7113_01_characters_character_achievement_progress.sql
@@ -0,0 +1,3 @@
+ALTER TABLE character_db_version CHANGE COLUMN required_7100_01_characters_character_spell required_7113_01_characters_character_achievement_progress bit;
+
+DELETE FROM character_achievement_progress WHERE counter=0;
diff --git a/sql/updates/7118_01_mangos_skill_discovery_template.sql b/sql/updates/7118_01_mangos_skill_discovery_template.sql
new file mode 100644
index 000000000..f854855e6
--- /dev/null
+++ b/sql/updates/7118_01_mangos_skill_discovery_template.sql
@@ -0,0 +1,6 @@
+ALTER TABLE db_version CHANGE COLUMN required_7107_01_mangos_string required_7118_01_mangos_skill_discovery_template bit;
+
+ALTER TABLE skill_discovery_template
+ DROP PRIMARY KEY,
+ ADD PRIMARY KEY (`spellId`,`reqSpell`),
+ ADD COLUMN reqClass tinyint(2) unsigned NOT NULL default '0' COMMENT 'class requirement' AFTER reqSpell;
diff --git a/sql/updates/7133_01_mangos_skill_discovery_template.sql b/sql/updates/7133_01_mangos_skill_discovery_template.sql
new file mode 100644
index 000000000..85653618c
--- /dev/null
+++ b/sql/updates/7133_01_mangos_skill_discovery_template.sql
@@ -0,0 +1,5 @@
+ALTER TABLE db_version CHANGE COLUMN required_7118_01_mangos_skill_discovery_template required_7133_01_mangos_skill_discovery_template bit;
+
+ALTER TABLE skill_discovery_template
+ DROP `reqClass`,
+ ADD COLUMN `reqSkillValue` smallint(5) unsigned NOT NULL default '0' COMMENT 'skill points requirement' AFTER reqSpell;
diff --git a/sql/updates/7133_02_mangos_spell_loot_template.sql b/sql/updates/7133_02_mangos_spell_loot_template.sql
new file mode 100644
index 000000000..29b1681fb
--- /dev/null
+++ b/sql/updates/7133_02_mangos_spell_loot_template.sql
@@ -0,0 +1,15 @@
+ALTER TABLE db_version CHANGE COLUMN required_7133_01_mangos_skill_discovery_template required_7133_02_mangos_spell_loot_template bit;
+
+DROP TABLE IF EXISTS `spell_loot_template`;
+CREATE TABLE `spell_loot_template` (
+ `entry` mediumint(8) unsigned NOT NULL default '0',
+ `item` mediumint(8) unsigned NOT NULL default '0',
+ `ChanceOrQuestChance` float NOT NULL default '100',
+ `groupid` tinyint(3) unsigned NOT NULL default '0',
+ `mincountOrRef` mediumint(9) NOT NULL default '1',
+ `maxcount` tinyint(3) unsigned NOT NULL default '1',
+ `lootcondition` tinyint(3) unsigned NOT NULL default '0',
+ `condition_value1` mediumint(8) unsigned NOT NULL default '0',
+ `condition_value2` mediumint(8) unsigned NOT NULL default '0',
+ PRIMARY KEY (`entry`,`item`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Loot System';
diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am
index 33bc07947..f44216ebb 100644
--- a/sql/updates/Makefile.am
+++ b/sql/updates/Makefile.am
@@ -135,6 +135,16 @@ pkgdata_DATA = \
7074_01_mangos_playercreateinfo_spell.sql \
7075_01_characters_character_spell.sql \
7075_02_mangos_spell_learn_spell.sql \
+ 7077_01_characters_character_spell.sql \
+ 7078_01_mangos_spell_proc_event.sql \
+ 7092_01_mangos_player_xp_for_level.sql \
+ 7097_01_mangos_spell_proc_event.sql \
+ 7100_01_characters_character_spell.sql \
+ 7107_01_mangos_string.sql \
+ 7113_01_characters_character_achievement_progress.sql \
+ 7118_01_mangos_skill_discovery_template.sql \
+ 7133_01_mangos_skill_discovery_template.sql \
+ 7133_02_mangos_spell_loot_template.sql \
README
## Additional files to include when running 'make dist'
@@ -250,4 +260,14 @@ EXTRA_DIST = \
7074_01_mangos_playercreateinfo_spell.sql \
7075_01_characters_character_spell.sql \
7075_02_mangos_spell_learn_spell.sql \
+ 7077_01_characters_character_spell.sql \
+ 7078_01_mangos_spell_proc_event.sql \
+ 7092_01_mangos_player_xp_for_level.sql \
+ 7097_01_mangos_spell_proc_event.sql \
+ 7100_01_characters_character_spell.sql \
+ 7107_01_mangos_string.sql \
+ 7113_01_characters_character_achievement_progress.sql \
+ 7118_01_mangos_skill_discovery_template.sql \
+ 7133_01_mangos_skill_discovery_template.sql \
+ 7133_02_mangos_spell_loot_template.sql \
README
diff --git a/src/framework/GameSystem/NGrid.h b/src/framework/GameSystem/NGrid.h
index b93e5d9a9..0271bd11a 100644
--- a/src/framework/GameSystem/NGrid.h
+++ b/src/framework/GameSystem/NGrid.h
@@ -74,12 +74,12 @@ class MANGOS_DLL_DECL NGrid
const GridType& operator()(unsigned short x, unsigned short y) const { return i_cells[x][y]; }
GridType& operator()(unsigned short x, unsigned short y) { return i_cells[x][y]; }
- inline const uint32& GetGridId(void) const { return i_gridId; }
- inline void SetGridId(const uint32 id) const { i_gridId = id; }
- inline grid_state_t GetGridState(void) const { return i_cellstate; }
- inline void SetGridState(grid_state_t s) { i_cellstate = s; }
- inline int32 getX() const { return i_x; }
- inline int32 getY() const { return i_y; }
+ const uint32& GetGridId(void) const { return i_gridId; }
+ void SetGridId(const uint32 id) const { i_gridId = id; }
+ grid_state_t GetGridState(void) const { return i_cellstate; }
+ void SetGridState(grid_state_t s) { i_cellstate = s; }
+ int32 getX() const { return i_x; }
+ int32 getY() const { return i_y; }
void link(GridRefManager >* pTo)
{
diff --git a/src/framework/Policies/ObjectLifeTime.h b/src/framework/Policies/ObjectLifeTime.h
index dab37a98c..82bf4ea8e 100644
--- a/src/framework/Policies/ObjectLifeTime.h
+++ b/src/framework/Policies/ObjectLifeTime.h
@@ -32,7 +32,7 @@ namespace MaNGOS
class MANGOS_DLL_DECL ObjectLifeTime
{
public:
- inline static void ScheduleCall(void (*destroyer)() )
+ static void ScheduleCall(void (*destroyer)() )
{
at_exit( destroyer );
}
@@ -42,7 +42,7 @@ namespace MaNGOS
};
template
- inline void ObjectLifeTime::OnDeadReference(void)// We don't handle Dead Reference for now
+ void ObjectLifeTime::OnDeadReference(void) // We don't handle Dead Reference for now
{
throw std::runtime_error("Dead Reference");
}
diff --git a/src/framework/Utilities/LinkedReference/Reference.h b/src/framework/Utilities/LinkedReference/Reference.h
index d74723a42..42e4b0484 100644
--- a/src/framework/Utilities/LinkedReference/Reference.h
+++ b/src/framework/Utilities/LinkedReference/Reference.h
@@ -42,7 +42,7 @@ template class Reference : public LinkedListElement
virtual ~Reference() {}
// Create new link
- inline void link(TO* toObj, FROM* fromObj)
+ void link(TO* toObj, FROM* fromObj)
{
assert(fromObj); // fromObj MUST not be NULL
if(isValid())
@@ -57,16 +57,16 @@ template class Reference : public LinkedListElement
// We don't need the reference anymore. Call comes from the refFrom object
// Tell our refTo object, that the link is cut
- inline void unlink() { targetObjectDestroyLink(); delink(); iRefTo = NULL; iRefFrom = NULL; }
+ void unlink() { targetObjectDestroyLink(); delink(); iRefTo = NULL; iRefFrom = NULL; }
// Link is invalid due to destruction of referenced target object. Call comes from the refTo object
// Tell our refFrom object, that the link is cut
- inline void invalidate() // the iRefFrom MUST remain!!
+ void invalidate() // the iRefFrom MUST remain!!
{
sourceObjectDestroyLink(); delink(); iRefTo = NULL;
}
- inline bool isValid() const // Only check the iRefTo
+ bool isValid() const // Only check the iRefTo
{
return iRefTo != NULL;
}
@@ -81,10 +81,10 @@ template class Reference : public LinkedListElement
Reference * nocheck_prev() { return((Reference *) LinkedListElement::nocheck_prev()); }
Reference const * nocheck_prev() const { return((Reference const *) LinkedListElement::nocheck_prev()); }
- inline TO* operator ->() const { return iRefTo; }
- inline TO* getTarget() const { return iRefTo; }
+ TO* operator ->() const { return iRefTo; }
+ TO* getTarget() const { return iRefTo; }
- inline FROM* getSource() const { return iRefFrom; }
+ FROM* getSource() const { return iRefFrom; }
};
//=====================================================
diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index fb6684892..2ae665c16 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -141,7 +141,8 @@ void AchievementMgr::SaveToDB()
if(!m_criteriaProgress.empty())
{
/// prepare deleting and insert
- bool need_execute = false;
+ bool need_execute_del = false;
+ bool need_execute_ins = false;
std::ostringstream ssdel;
std::ostringstream ssins;
for(CriteriaProgressMap::iterator iter = m_criteriaProgress.begin(); iter!=m_criteriaProgress.end(); ++iter)
@@ -149,36 +150,53 @@ void AchievementMgr::SaveToDB()
if(!iter->second.changed)
continue;
- /// first new/changed record prefix
- if(!need_execute)
+ // deleted data (including 0 progress state)
{
- ssdel << "DELETE FROM character_achievement_progress WHERE guid = " << GetPlayer()->GetGUIDLow() << " AND criteria IN (";
- ssins << "INSERT INTO character_achievement_progress (guid, criteria, counter, date) VALUES ";
- need_execute = true;
- }
- /// next new/changed record prefix
- else
- {
- ssdel << ", ";
- ssins << ", ";
+ /// first new/changed record prefix (for any counter value)
+ if(!need_execute_del)
+ {
+ ssdel << "DELETE FROM character_achievement_progress WHERE guid = " << GetPlayer()->GetGUIDLow() << " AND criteria IN (";
+ need_execute_del = true;
+ }
+ /// next new/changed record prefix
+ else
+ ssdel << ", ";
+
+ // new/changed record data
+ ssdel << iter->first;
}
- // new/changed record data
- ssdel << iter->first;
- ssins << "(" << GetPlayer()->GetGUIDLow() << ", " << iter->first << ", " << iter->second.counter << ", " << iter->second.date << ")";
+ // store data only for real progress
+ if(iter->second.counter != 0)
+ {
+ /// first new/changed record prefix
+ if(!need_execute_ins)
+ {
+ ssins << "INSERT INTO character_achievement_progress (guid, criteria, counter, date) VALUES ";
+ need_execute_ins = true;
+ }
+ /// next new/changed record prefix
+ else
+ ssins << ", ";
- /// mark as saved in db
+ // new/changed record data
+ ssins << "(" << GetPlayer()->GetGUIDLow() << ", " << iter->first << ", " << iter->second.counter << ", " << iter->second.date << ")";
+ }
+
+ /// mark as updated in db
iter->second.changed = false;
}
- if(need_execute)
+ if(need_execute_del) // DELETE ... IN (.... _)_
ssdel << ")";
- if(need_execute)
+ if(need_execute_del || need_execute_ins)
{
CharacterDatabase.BeginTransaction ();
- CharacterDatabase.Execute( ssdel.str().c_str() );
- CharacterDatabase.Execute( ssins.str().c_str() );
+ if(need_execute_del)
+ CharacterDatabase.Execute( ssdel.str().c_str() );
+ if(need_execute_ins)
+ CharacterDatabase.Execute( ssins.str().c_str() );
CharacterDatabase.CommitTransaction ();
}
}
@@ -386,6 +404,10 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
if(GetPlayer()->HasSpell(achievementCriteria->learn_spell.spellID))
SetCriteriaProgress(achievementCriteria, 1);
break;
+ case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT:
+ if(m_completedAchievements.find(achievementCriteria->complete_achievement.linkedAchievement) != m_completedAchievements.end())
+ SetCriteriaProgress(achievementCriteria, 1);
+ break;
case ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP:
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
if(!miscvalue1)
@@ -628,7 +650,7 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE:
return progress->counter >= achievementCriteria->kill_creature.creatureCount;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT:
- return m_completedAchievements.find(achievementCriteria->complete_achievement.linkedAchievement) != m_completedAchievements.end();
+ return progress->counter >= 1;
case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL:
return progress->counter >= achievementCriteria->reach_skill_level.skillLevel;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT:
@@ -729,6 +751,10 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
if(iter == m_criteriaProgress.end())
{
+ // not create record for 0 counter
+ if(newValue == 0)
+ return;
+
progress = &m_criteriaProgress[entry->ID];
progress->counter = newValue;
progress->date = time(NULL);
@@ -738,8 +764,11 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
progress = &iter->second;
if(relative)
newValue += progress->counter;
+
+ // not update (not mark as changed) if counter will have same value
if(progress->counter == newValue)
return;
+
progress->counter = newValue;
}
diff --git a/src/game/AuctionHouseObject.h b/src/game/AuctionHouseObject.h
index 077991e8c..927063eb6 100644
--- a/src/game/AuctionHouseObject.h
+++ b/src/game/AuctionHouseObject.h
@@ -82,20 +82,12 @@ class AuctionHouseObject
AuctionEntry* GetAuction(uint32 id) const
{
AuctionEntryMap::const_iterator itr = AuctionsMap.find( id );
- if( itr != AuctionsMap.end() )
- return itr->second;
- return NULL;
+ return itr != AuctionsMap.end() ? itr->second : NULL;
}
bool RemoveAuction(uint32 id)
{
- AuctionEntryMap::iterator i = AuctionsMap.find(id);
- if (i == AuctionsMap.end())
- {
- return false;
- }
- AuctionsMap.erase(i);
- return true;
+ return AuctionsMap.erase(id) ? true : false;
}
private:
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp
index 24b64ad22..1e2e42f4a 100644
--- a/src/game/BattleGround.cpp
+++ b/src/game/BattleGround.cpp
@@ -116,7 +116,7 @@ BattleGround::~BattleGround()
this->RemoveFromBGFreeSlotQueue();
}
-void BattleGround::Update(time_t diff)
+void BattleGround::Update(uint32 diff)
{
if(!GetPlayersSize() && !GetRemovedPlayersSize() && !GetReviveQueueSize())
//BG is empty
@@ -552,7 +552,7 @@ void BattleGround::EndBattleGround(uint32 winner)
sBattleGroundMgr.BuildPvpLogDataPacket(&data, this);
plr->GetSession()->SendPacket(&data);
- uint32 bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(GetTypeID(), GetArenaType());
+ uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetTeam(), plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime());
plr->GetSession()->SendPacket(&data);
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
@@ -573,7 +573,7 @@ void BattleGround::EndBattleGround(uint32 winner)
}
// inform invited players about the removal
- sBattleGroundMgr.m_BattleGroundQueues[sBattleGroundMgr.BGQueueTypeId(GetTypeID(), GetArenaType())].BGEndedRemoveInvites(this);
+ sBattleGroundMgr.m_BattleGroundQueues[BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType())].BGEndedRemoveInvites(this);
if(Source)
{
@@ -769,7 +769,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
if(!team) team = plr->GetTeam();
uint32 bgTypeId = GetTypeID();
- uint32 bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(GetTypeID(), GetArenaType());
+ uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
// if arena, remove the specific arena auras
if(isArena())
{
@@ -1403,7 +1403,7 @@ void BattleGround::EndNow()
SetStatus(STATUS_WAIT_LEAVE);
SetEndTime(TIME_TO_AUTOREMOVE);
// inform invited players about the removal
- sBattleGroundMgr.m_BattleGroundQueues[sBattleGroundMgr.BGQueueTypeId(GetTypeID(), GetArenaType())].BGEndedRemoveInvites(this);
+ sBattleGroundMgr.m_BattleGroundQueues[BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType())].BGEndedRemoveInvites(this);
}
// Battleground messages are localized using the dbc lang, they are not client language dependent
diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h
index 6727c1a97..1e03c12cb 100644
--- a/src/game/BattleGround.h
+++ b/src/game/BattleGround.h
@@ -254,7 +254,7 @@ class BattleGround
BattleGround();
/*BattleGround(const BattleGround& bg);*/
virtual ~BattleGround();
- virtual void Update(time_t diff); // must be implemented in BG subclass of BG specific update code, but must in begginning call parent version
+ virtual void Update(uint32 diff); // must be implemented in BG subclass of BG specific update code, but must in begginning call parent version
virtual bool SetupBattleGround() // must be implemented in BG subclass
{
return true;
diff --git a/src/game/BattleGroundAA.cpp b/src/game/BattleGroundAA.cpp
index cc2404614..fcf9bd4ce 100644
--- a/src/game/BattleGroundAA.cpp
+++ b/src/game/BattleGroundAA.cpp
@@ -30,7 +30,7 @@ BattleGroundAA::~BattleGroundAA()
}
-void BattleGroundAA::Update(time_t diff)
+void BattleGroundAA::Update(uint32 diff)
{
BattleGround::Update(diff);
}
diff --git a/src/game/BattleGroundAA.h b/src/game/BattleGroundAA.h
index 767e4eb55..b144acae3 100644
--- a/src/game/BattleGroundAA.h
+++ b/src/game/BattleGroundAA.h
@@ -35,7 +35,7 @@ class BattleGroundAA : public BattleGround
public:
BattleGroundAA();
~BattleGroundAA();
- void Update(time_t diff);
+ void Update(uint32 diff);
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player *plr);
diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp
index 0a5186937..45421f908 100644
--- a/src/game/BattleGroundAB.cpp
+++ b/src/game/BattleGroundAB.cpp
@@ -38,7 +38,7 @@ BattleGroundAB::~BattleGroundAB()
{
}
-void BattleGroundAB::Update(time_t diff)
+void BattleGroundAB::Update(uint32 diff)
{
BattleGround::Update(diff);
diff --git a/src/game/BattleGroundAB.h b/src/game/BattleGroundAB.h
index 97615dc1c..e76f35209 100644
--- a/src/game/BattleGroundAB.h
+++ b/src/game/BattleGroundAB.h
@@ -236,7 +236,7 @@ class BattleGroundAB : public BattleGround
BattleGroundAB();
~BattleGroundAB();
- void Update(time_t diff);
+ void Update(uint32 diff);
void AddPlayer(Player *plr);
void RemovePlayer(Player *plr,uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp
index 99866f3f8..c444bcbb2 100644
--- a/src/game/BattleGroundAV.cpp
+++ b/src/game/BattleGroundAV.cpp
@@ -34,7 +34,7 @@ BattleGroundAV::~BattleGroundAV()
}
-void BattleGroundAV::Update(time_t diff)
+void BattleGroundAV::Update(uint32 diff)
{
BattleGround::Update(diff);
}
diff --git a/src/game/BattleGroundAV.h b/src/game/BattleGroundAV.h
index c77a6af88..c2e12a872 100644
--- a/src/game/BattleGroundAV.h
+++ b/src/game/BattleGroundAV.h
@@ -42,7 +42,7 @@ class BattleGroundAV : public BattleGround
public:
BattleGroundAV();
~BattleGroundAV();
- void Update(time_t diff);
+ void Update(uint32 diff);
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player *plr);
diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp
index cb38b0b80..cae899421 100644
--- a/src/game/BattleGroundBE.cpp
+++ b/src/game/BattleGroundBE.cpp
@@ -35,7 +35,7 @@ BattleGroundBE::~BattleGroundBE()
}
-void BattleGroundBE::Update(time_t diff)
+void BattleGroundBE::Update(uint32 diff)
{
BattleGround::Update(diff);
diff --git a/src/game/BattleGroundBE.h b/src/game/BattleGroundBE.h
index c66d1b1b9..4e5663d03 100644
--- a/src/game/BattleGroundBE.h
+++ b/src/game/BattleGroundBE.h
@@ -55,7 +55,7 @@ class BattleGroundBE : public BattleGround
public:
BattleGroundBE();
~BattleGroundBE();
- void Update(time_t diff);
+ void Update(uint32 diff);
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player *plr);
diff --git a/src/game/BattleGroundDS.cpp b/src/game/BattleGroundDS.cpp
index 276c0c84c..825a52967 100644
--- a/src/game/BattleGroundDS.cpp
+++ b/src/game/BattleGroundDS.cpp
@@ -30,7 +30,7 @@ BattleGroundDS::~BattleGroundDS()
}
-void BattleGroundDS::Update(time_t diff)
+void BattleGroundDS::Update(uint32 diff)
{
BattleGround::Update(diff);
}
diff --git a/src/game/BattleGroundDS.h b/src/game/BattleGroundDS.h
index afcb8f092..7f9de8ca7 100644
--- a/src/game/BattleGroundDS.h
+++ b/src/game/BattleGroundDS.h
@@ -35,7 +35,7 @@ class BattleGroundDS : public BattleGround
public:
BattleGroundDS();
~BattleGroundDS();
- void Update(time_t diff);
+ void Update(uint32 diff);
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player *plr);
diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp
index 7adca00f4..dcfc38337 100644
--- a/src/game/BattleGroundEY.cpp
+++ b/src/game/BattleGroundEY.cpp
@@ -42,7 +42,7 @@ BattleGroundEY::~BattleGroundEY()
{
}
-void BattleGroundEY::Update(time_t diff)
+void BattleGroundEY::Update(uint32 diff)
{
BattleGround::Update(diff);
// after bg start we get there (once)
diff --git a/src/game/BattleGroundEY.h b/src/game/BattleGroundEY.h
index 8e19472b2..38291313d 100644
--- a/src/game/BattleGroundEY.h
+++ b/src/game/BattleGroundEY.h
@@ -298,7 +298,7 @@ class BattleGroundEY : public BattleGround
public:
BattleGroundEY();
~BattleGroundEY();
- void Update(time_t diff);
+ void Update(uint32 diff);
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player *plr);
diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp
index 323ec1a73..0158cd36b 100644
--- a/src/game/BattleGroundHandler.cpp
+++ b/src/game/BattleGroundHandler.cpp
@@ -94,7 +94,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from: " I64FMT, guid);
// can do this, since it's battleground, not arena
- uint32 bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(bgTypeId, 0);
+ uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, 0);
// ignore if player is already in BG
if(_player->InBattleGround())
@@ -368,7 +368,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
uint32 bgQueueTypeId = 0;
// get the bg what we were invited to
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus;
- bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(bgTypeId,type);
+ bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId,type);
itrPlayerStatus = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].find(_player->GetGUID());
if(itrPlayerStatus == sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].end())
@@ -529,7 +529,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
BattleGround *bg = _player->GetBattleGround();
if(bg)
{
- uint32 bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
+ uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
uint32 queueSlot = _player->GetBattleGroundQueueIndex(bgQueueTypeId);
if((bg->GetStatus() <= STATUS_IN_PROGRESS))
{
@@ -539,7 +539,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
{
uint32 queue_id = _player->GetBattleGroundQueueId(i); // battlegroundqueueid stores the type id, not the instance id, so this is definitely wrong
- uint8 arenatype = sBattleGroundMgr.BGArenaType(queue_id);
+ uint8 arenatype = BattleGroundMgr::BGArenaType(queue_id);
uint8 isRated = 0;
if (i == queueSlot || !queue_id) // we need to get the instance ids
continue;
@@ -551,7 +551,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
arenatype = itrPlayerStatus->second.GroupInfo->ArenaType;
isRated = itrPlayerStatus->second.GroupInfo->IsRated;
}
- BattleGround *bg2 = sBattleGroundMgr.GetBattleGroundTemplate(sBattleGroundMgr.BGTemplateId(queue_id)); // try this
+ BattleGround *bg2 = sBattleGroundMgr.GetBattleGroundTemplate(BattleGroundMgr::BGTemplateId(queue_id)); // try this
if(bg2)
{
//in this call is small bug, this call should be filled by player's waiting time in queue
@@ -570,8 +570,8 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
uint32 queue_id = _player->GetBattleGroundQueueId(i);
if(!queue_id)
continue;
- uint32 bgTypeId = sBattleGroundMgr.BGTemplateId(queue_id);
- uint8 arenatype = sBattleGroundMgr.BGArenaType(queue_id);
+ uint32 bgTypeId = BattleGroundMgr::BGTemplateId(queue_id);
+ uint8 arenatype = BattleGroundMgr::BGArenaType(queue_id);
uint8 isRated = 0;
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = sBattleGroundMgr.m_BattleGroundQueues[queue_id].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].find(_player->GetGUID());
@@ -699,7 +699,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
}
uint8 bgTypeId = bg->GetTypeID();
- uint32 bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(bgTypeId, arenatype);
+ uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
// check queueing conditions
if(!asGroup)
diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp
index fe97ecca3..66c03df3b 100644
--- a/src/game/BattleGroundMgr.cpp
+++ b/src/game/BattleGroundMgr.cpp
@@ -37,7 +37,6 @@
#include "MapInstanced.h"
#include "ObjectMgr.h"
#include "ProgressBar.h"
-#include "World.h"
#include "Chat.h"
#include "ArenaTeam.h"
@@ -246,7 +245,7 @@ void BattleGroundQueue::AddPlayer(Player *plr, GroupQueueInfo *ginfo)
ginfo->Players[plr->GetGUID()] = &info;
}
-void BattleGroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
+void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCount)
{
Player *plr = objmgr.GetPlayer(guid);
@@ -349,7 +348,7 @@ void BattleGroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
if(Player *plr2 = objmgr.GetPlayer(group->Players.begin()->first))
{
BattleGround * bg = sBattleGroundMgr.GetBattleGroundTemplate(group->BgTypeId);
- uint32 bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(group->BgTypeId,group->ArenaType);
+ uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(group->BgTypeId,group->ArenaType);
uint32 queueSlot = plr2->GetBattleGroundQueueIndex(bgQueueTypeId);
plr2->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs
WorldPacket data;
@@ -362,7 +361,7 @@ void BattleGroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
}
}
-void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, uint64 playerGUID, bool isAddedToQueue)
+void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playerGUID, bool isAddedToQueue)
{
if(ginfo->ArenaType) //if Arena
@@ -452,7 +451,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
// not yet invited
// set invitation
ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID();
- uint32 bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
+ uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
// loop through the players
for(std::map::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
{
@@ -547,7 +546,7 @@ void BattleGroundQueue::BGEndedRemoveInvites(BattleGround *bg)
{
uint32 queue_id = bg->GetQueueType();
uint32 bgInstanceId = bg->GetInstanceID();
- uint32 bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
+ uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
QueuedGroupsList::iterator itr, next;
for(itr = m_QueuedGroups[queue_id].begin(); itr != m_QueuedGroups[queue_id].end(); itr = next)
{
@@ -617,7 +616,7 @@ void BattleGroundQueue::Update(uint32 bgTypeId, uint32 queue_id, uint8 arenatype
if (m_QueuedGroups[queue_id].empty())
return;
- uint32 bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(bgTypeId, arenatype);
+ uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
//battleground with free slot for player should be always the last in this queue
BGFreeSlotQueueType::iterator itr, next;
@@ -995,7 +994,7 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bg->GetTypeID());
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue
{
- uint32 bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
+ uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue
{
@@ -1032,7 +1031,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
sLog.outDebug("Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.",plr->GetGUIDLow(),m_BgInstanceGUID);
- uint32 bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
+ uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue
{
@@ -1075,16 +1074,10 @@ void BGQueueRemoveEvent::Abort(uint64 /*e_time*/)
/*** BATTLEGROUND MANAGER ***/
/*********************************************************/
-BattleGroundMgr::BattleGroundMgr()
+BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false)
{
m_BattleGrounds.clear();
- m_AutoDistributePoints = (bool)sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS);
- m_MaxRatingDifference = sWorld.getConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE);
- m_RatingDiscardTimer = sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER);
- m_PrematureFinishTimer = sWorld.getConfig(CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER);
- m_NextRatingDiscardUpdate = m_RatingDiscardTimer;
- m_AutoDistributionTimeChecker = 0;
- m_ArenaTesting = false;
+ m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER);
}
BattleGroundMgr::~BattleGroundMgr()
@@ -1102,7 +1095,7 @@ BattleGroundMgr::~BattleGroundMgr()
}
// used to update running battlegrounds, and delete finished ones
-void BattleGroundMgr::Update(time_t diff)
+void BattleGroundMgr::Update(uint32 diff)
{
BattleGroundSet::iterator itr, next;
for(itr = m_BattleGrounds.begin(); itr != m_BattleGrounds.end(); itr = next)
@@ -1120,7 +1113,7 @@ void BattleGroundMgr::Update(time_t diff)
}
}
// if rating difference counts, maybe force-update queues
- if(m_MaxRatingDifference)
+ if(sWorld.getConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE))
{
// it's time to force update
if(m_NextRatingDiscardUpdate < diff)
@@ -1129,12 +1122,12 @@ void BattleGroundMgr::Update(time_t diff)
m_BattleGroundQueues[BATTLEGROUND_QUEUE_2v2].Update(BATTLEGROUND_AA,6,ARENA_TYPE_2v2,true,0);
m_BattleGroundQueues[BATTLEGROUND_QUEUE_3v3].Update(BATTLEGROUND_AA,6,ARENA_TYPE_3v3,true,0);
m_BattleGroundQueues[BATTLEGROUND_QUEUE_5v5].Update(BATTLEGROUND_AA,6,ARENA_TYPE_5v5,true,0);
- m_NextRatingDiscardUpdate = m_RatingDiscardTimer;
+ m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER);
}
else
m_NextRatingDiscardUpdate -= diff;
}
- if(m_AutoDistributePoints)
+ if(sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
{
if(m_AutoDistributionTimeChecker < diff)
{
@@ -1692,7 +1685,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
void BattleGroundMgr::InitAutomaticArenaPointDistribution()
{
- if(m_AutoDistributePoints)
+ if(sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
{
sLog.outDebug("Initializing Automatic Arena Point Distribution");
QueryResult * result = CharacterDatabase.Query("SELECT NextArenaPointDistributionTime FROM saved_variables");
@@ -1761,7 +1754,7 @@ void BattleGroundMgr::DistributeArenaPoints()
sWorld.SendGlobalText("Done flushing Arena points.", NULL);
}
-void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, uint64 guid, Player* plr, uint32 bgTypeId)
+void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player* plr, uint32 bgTypeId)
{
uint32 PlayerLevel = 10;
@@ -1817,7 +1810,7 @@ void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId)
}
}
-void BattleGroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, uint64 guid)
+void BattleGroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, const uint64& guid)
{
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
uint32 time_ = 30000 - bg->GetLastResurrectTime(); // resurrect every 30 seconds
@@ -1827,14 +1820,7 @@ void BattleGroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *
pl->GetSession()->SendPacket(&data);
}
-void BattleGroundMgr::RemoveBattleGround(uint32 instanceID)
-{
- BattleGroundSet::iterator itr = m_BattleGrounds.find(instanceID);
- if(itr!=m_BattleGrounds.end())
- m_BattleGrounds.erase(itr);
-}
-
-bool BattleGroundMgr::IsArenaType(uint32 bgTypeId) const
+bool BattleGroundMgr::IsArenaType(uint32 bgTypeId)
{
return ( bgTypeId == BATTLEGROUND_AA ||
bgTypeId == BATTLEGROUND_BE ||
@@ -1842,82 +1828,77 @@ bool BattleGroundMgr::IsArenaType(uint32 bgTypeId) const
bgTypeId == BATTLEGROUND_RL );
}
-bool BattleGroundMgr::IsBattleGroundType(uint32 bgTypeId) const
-{
- return !IsArenaType(bgTypeId);
-}
-
-uint32 BattleGroundMgr::BGQueueTypeId(uint32 bgTypeId, uint8 arenaType) const
+uint32 BattleGroundMgr::BGQueueTypeId(uint32 bgTypeId, uint8 arenaType)
{
switch(bgTypeId)
{
- case BATTLEGROUND_WS:
- return BATTLEGROUND_QUEUE_WS;
- case BATTLEGROUND_AB:
- return BATTLEGROUND_QUEUE_AB;
- case BATTLEGROUND_AV:
- return BATTLEGROUND_QUEUE_AV;
- case BATTLEGROUND_EY:
- return BATTLEGROUND_QUEUE_EY;
- case BATTLEGROUND_SA:
- return BATTLEGROUND_QUEUE_SA;
- case BATTLEGROUND_AA:
- case BATTLEGROUND_NA:
- case BATTLEGROUND_RL:
- case BATTLEGROUND_BE:
- case BATTLEGROUND_DS:
- case BATTLEGROUND_RV:
- switch(arenaType)
- {
- case ARENA_TYPE_2v2:
- return BATTLEGROUND_QUEUE_2v2;
- case ARENA_TYPE_3v3:
- return BATTLEGROUND_QUEUE_3v3;
- case ARENA_TYPE_5v5:
- return BATTLEGROUND_QUEUE_5v5;
+ case BATTLEGROUND_WS:
+ return BATTLEGROUND_QUEUE_WS;
+ case BATTLEGROUND_AB:
+ return BATTLEGROUND_QUEUE_AB;
+ case BATTLEGROUND_AV:
+ return BATTLEGROUND_QUEUE_AV;
+ case BATTLEGROUND_EY:
+ return BATTLEGROUND_QUEUE_EY;
+ case BATTLEGROUND_SA:
+ return BATTLEGROUND_QUEUE_SA;
+ case BATTLEGROUND_AA:
+ case BATTLEGROUND_NA:
+ case BATTLEGROUND_RL:
+ case BATTLEGROUND_BE:
+ case BATTLEGROUND_DS:
+ case BATTLEGROUND_RV:
+ switch(arenaType)
+ {
+ case ARENA_TYPE_2v2:
+ return BATTLEGROUND_QUEUE_2v2;
+ case ARENA_TYPE_3v3:
+ return BATTLEGROUND_QUEUE_3v3;
+ case ARENA_TYPE_5v5:
+ return BATTLEGROUND_QUEUE_5v5;
+ default:
+ return 0;
+ }
default:
return 0;
- }
- default:
- return 0;
}
}
-uint32 BattleGroundMgr::BGTemplateId(uint32 bgQueueTypeId) const
+uint32 BattleGroundMgr::BGTemplateId(uint32 bgQueueTypeId)
{
switch(bgQueueTypeId)
{
- case BATTLEGROUND_QUEUE_WS:
- return BATTLEGROUND_WS;
- case BATTLEGROUND_QUEUE_AB:
- return BATTLEGROUND_AB;
- case BATTLEGROUND_QUEUE_AV:
- return BATTLEGROUND_AV;
- case BATTLEGROUND_QUEUE_EY:
- return BATTLEGROUND_EY;
- case BATTLEGROUND_QUEUE_SA:
- return BATTLEGROUND_SA;
- case BATTLEGROUND_QUEUE_2v2:
- case BATTLEGROUND_QUEUE_3v3:
- case BATTLEGROUND_QUEUE_5v5:
- return BATTLEGROUND_AA;
- default:
- return 0;
+ case BATTLEGROUND_QUEUE_WS:
+ return BATTLEGROUND_WS;
+ case BATTLEGROUND_QUEUE_AB:
+ return BATTLEGROUND_AB;
+ case BATTLEGROUND_QUEUE_AV:
+ return BATTLEGROUND_AV;
+ case BATTLEGROUND_QUEUE_EY:
+ return BATTLEGROUND_EY;
+ case BATTLEGROUND_QUEUE_SA:
+ return BATTLEGROUND_SA;
+ case BATTLEGROUND_QUEUE_2v2:
+ case BATTLEGROUND_QUEUE_3v3:
+ case BATTLEGROUND_QUEUE_5v5:
+ return BATTLEGROUND_AA;
+ default:
+ return 0;
}
}
-uint8 BattleGroundMgr::BGArenaType(uint32 bgQueueTypeId) const
+uint8 BattleGroundMgr::BGArenaType(uint32 bgQueueTypeId)
{
switch(bgQueueTypeId)
{
- case BATTLEGROUND_QUEUE_2v2:
- return ARENA_TYPE_2v2;
- case BATTLEGROUND_QUEUE_3v3:
- return ARENA_TYPE_3v3;
- case BATTLEGROUND_QUEUE_5v5:
- return ARENA_TYPE_5v5;
- default:
- return 0;
+ case BATTLEGROUND_QUEUE_2v2:
+ return ARENA_TYPE_2v2;
+ case BATTLEGROUND_QUEUE_3v3:
+ return ARENA_TYPE_3v3;
+ case BATTLEGROUND_QUEUE_5v5:
+ return ARENA_TYPE_5v5;
+ default:
+ return 0;
}
}
diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h
index ad11436fc..5b5a017ef 100644
--- a/src/game/BattleGroundMgr.h
+++ b/src/game/BattleGroundMgr.h
@@ -20,7 +20,7 @@
#define __BATTLEGROUNDMGR_H
#include "BattleGround.h"
-#include "Policies/Singleton.h"
+#include "World.h"
class BattleGround;
@@ -72,10 +72,10 @@ class BattleGroundQueue
GroupQueueInfo * AddGroup(Player * leader, uint32 BgTypeId, uint8 ArenaType, bool isRated, uint32 ArenaRating, uint32 ArenaTeamId = 0);
void AddPlayer(Player *plr, GroupQueueInfo *ginfo);
- void RemovePlayer(uint64 guid, bool decreaseInvitedCount);
+ void RemovePlayer(const uint64& guid, bool decreaseInvitedCount);
void DecreaseGroupLength(uint32 queueId, uint32 AsGroup);
void BGEndedRemoveInvites(BattleGround * bg);
- void AnnounceWorld(GroupQueueInfo *ginfo, uint64 playerGUID, bool isAddedToQueue);
+ void AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playerGUID, bool isAddedToQueue);
typedef std::map QueuedPlayersMap;
QueuedPlayersMap m_QueuedPlayers[MAX_BATTLEGROUND_QUEUES];
@@ -137,7 +137,7 @@ class BattleGroundQueue
class BGQueueInviteEvent : public BasicEvent
{
public:
- BGQueueInviteEvent(uint64 pl_guid, uint32 BgInstanceGUID) : m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID) {};
+ BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID) : m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID) {};
virtual ~BGQueueInviteEvent() {};
virtual bool Execute(uint64 e_time, uint32 p_time);
@@ -153,7 +153,10 @@ class BGQueueInviteEvent : public BasicEvent
class BGQueueRemoveEvent : public BasicEvent
{
public:
- BGQueueRemoveEvent(uint64 pl_guid, uint32 bgInstanceGUID, uint32 playersTeam) : m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_PlayersTeam(playersTeam) {};
+ BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, uint32 playersTeam) :
+ m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_PlayersTeam(playersTeam)
+ {
+ };
virtual ~BGQueueRemoveEvent() {};
virtual bool Execute(uint64 e_time, uint32 p_time);
@@ -170,33 +173,31 @@ class BattleGroundMgr
/* Construction */
BattleGroundMgr();
~BattleGroundMgr();
- void Update(time_t diff);
+ void Update(uint32 diff);
/* Packet Building */
void BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr);
void BuildPlayerLeftBattleGroundPacket(WorldPacket *data, Player *plr);
- void BuildBattleGroundListPacket(WorldPacket *data, uint64 guid, Player *plr, uint32 bgTypeId);
+ void BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player *plr, uint32 bgTypeId);
void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, uint32 bgTypeId);
void BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value);
void BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg);
void BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint32 team, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint32 arenatype = 0, uint8 israted = 0);
void BuildPlaySoundPacket(WorldPacket *data, uint32 soundid);
+ void SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, const uint64& guid);
/* Player invitation */
// called from Queue update, or from Addplayer to queue
void InvitePlayer(Player* plr, uint32 bgInstanceGUID, uint32 team);
/* Battlegrounds */
BattleGroundSet::iterator GetBattleGroundsBegin() { return m_BattleGrounds.begin(); };
- BattleGroundSet::iterator GetBattleGroundsEnd() { return m_BattleGrounds.end(); };
+ BattleGroundSet::iterator GetBattleGroundsEnd() { return m_BattleGrounds.end(); };
BattleGround* GetBattleGround(uint32 ID)
{
BattleGroundSet::iterator i = m_BattleGrounds.find(ID);
- if(i != m_BattleGrounds.end())
- return i->second;
- else
- return NULL;
+ return ( (i != m_BattleGrounds.end()) ? i->second : NULL );
};
BattleGround * GetBattleGroundTemplate(uint32 bgTypeId);
@@ -204,8 +205,8 @@ class BattleGroundMgr
uint32 CreateBattleGround(uint32 bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO);
- inline void AddBattleGround(uint32 ID, BattleGround* BG) { m_BattleGrounds[ID] = BG; };
- void RemoveBattleGround(uint32 instanceID);
+ void AddBattleGround(uint32 ID, BattleGround* BG) { m_BattleGrounds[ID] = BG; };
+ void RemoveBattleGround(uint32 instanceID) { m_BattleGrounds.erase(instanceID); }
void CreateInitialBattleGrounds();
@@ -217,34 +218,28 @@ class BattleGroundMgr
BGFreeSlotQueueType BGFreeSlotQueue[MAX_BATTLEGROUND_TYPES];
- void SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, uint64 guid);
-
- bool IsArenaType(uint32 bgTypeId) const;
- bool IsBattleGroundType(uint32 bgTypeId) const;
- uint32 BGQueueTypeId(uint32 bgTypeId, uint8 arenaType) const;
- uint32 BGTemplateId(uint32 bgQueueTypeId) const;
- uint8 BGArenaType(uint32 bgQueueTypeId) const;
-
- uint32 GetMaxRatingDifference() const {return m_MaxRatingDifference;}
- uint32 GetRatingDiscardTimer() const {return m_RatingDiscardTimer;}
+ uint32 GetMaxRatingDifference() const { return sWorld.getConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE); }
+ uint32 GetRatingDiscardTimer() const { return sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER); }
+ uint32 GetPrematureFinishTime() const { return sWorld.getConfig(CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER); }
void InitAutomaticArenaPointDistribution();
void DistributeArenaPoints();
- uint32 GetPrematureFinishTime() const {return m_PrematureFinishTimer;}
void ToggleArenaTesting();
- const bool isArenaTesting() const { return m_ArenaTesting; }
+ bool isArenaTesting() const { return m_ArenaTesting; }
+
+ static bool IsArenaType(uint32 bgTypeId);
+ static bool IsBattleGroundType(uint32 bgTypeId) { return !BattleGroundMgr::IsArenaType(bgTypeId); }
+ static uint32 BGQueueTypeId(uint32 bgTypeId, uint8 arenaType);
+ static uint32 BGTemplateId(uint32 bgQueueTypeId);
+ static uint8 BGArenaType(uint32 bgQueueTypeId);
private:
/* Battlegrounds */
BattleGroundSet m_BattleGrounds;
- uint32 m_MaxRatingDifference;
- uint32 m_RatingDiscardTimer;
uint32 m_NextRatingDiscardUpdate;
- bool m_AutoDistributePoints;
uint64 m_NextAutoDistributionTime;
uint32 m_AutoDistributionTimeChecker;
- uint32 m_PrematureFinishTimer;
bool m_ArenaTesting;
};
diff --git a/src/game/BattleGroundNA.cpp b/src/game/BattleGroundNA.cpp
index 63bfed9e8..4321dd657 100644
--- a/src/game/BattleGroundNA.cpp
+++ b/src/game/BattleGroundNA.cpp
@@ -35,7 +35,7 @@ BattleGroundNA::~BattleGroundNA()
}
-void BattleGroundNA::Update(time_t diff)
+void BattleGroundNA::Update(uint32 diff)
{
BattleGround::Update(diff);
diff --git a/src/game/BattleGroundNA.h b/src/game/BattleGroundNA.h
index 64ccf0a5a..866dbca42 100644
--- a/src/game/BattleGroundNA.h
+++ b/src/game/BattleGroundNA.h
@@ -56,7 +56,7 @@ class BattleGroundNA : public BattleGround
public:
BattleGroundNA();
~BattleGroundNA();
- void Update(time_t diff);
+ void Update(uint32 diff);
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player *plr);
diff --git a/src/game/BattleGroundRL.cpp b/src/game/BattleGroundRL.cpp
index ee9beb181..281cdd706 100644
--- a/src/game/BattleGroundRL.cpp
+++ b/src/game/BattleGroundRL.cpp
@@ -35,7 +35,7 @@ BattleGroundRL::~BattleGroundRL()
}
-void BattleGroundRL::Update(time_t diff)
+void BattleGroundRL::Update(uint32 diff)
{
BattleGround::Update(diff);
diff --git a/src/game/BattleGroundRL.h b/src/game/BattleGroundRL.h
index 2c0a67778..427ed9402 100644
--- a/src/game/BattleGroundRL.h
+++ b/src/game/BattleGroundRL.h
@@ -52,7 +52,7 @@ class BattleGroundRL : public BattleGround
public:
BattleGroundRL();
~BattleGroundRL();
- void Update(time_t diff);
+ void Update(uint32 diff);
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player *plr);
diff --git a/src/game/BattleGroundRV.cpp b/src/game/BattleGroundRV.cpp
index 20c7d11f8..a66f0ce30 100644
--- a/src/game/BattleGroundRV.cpp
+++ b/src/game/BattleGroundRV.cpp
@@ -30,7 +30,7 @@ BattleGroundRV::~BattleGroundRV()
}
-void BattleGroundRV::Update(time_t diff)
+void BattleGroundRV::Update(uint32 diff)
{
BattleGround::Update(diff);
}
diff --git a/src/game/BattleGroundRV.h b/src/game/BattleGroundRV.h
index 9f515e35b..2d2ad12c9 100644
--- a/src/game/BattleGroundRV.h
+++ b/src/game/BattleGroundRV.h
@@ -35,7 +35,7 @@ class BattleGroundRV : public BattleGround
public:
BattleGroundRV();
~BattleGroundRV();
- void Update(time_t diff);
+ void Update(uint32 diff);
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player *plr);
diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp
index d7bc422ca..20a692976 100644
--- a/src/game/BattleGroundSA.cpp
+++ b/src/game/BattleGroundSA.cpp
@@ -29,7 +29,7 @@ BattleGroundSA::~BattleGroundSA()
}
-void BattleGroundSA::Update(time_t diff)
+void BattleGroundSA::Update(uint32 diff)
{
BattleGround::Update(diff);
}
diff --git a/src/game/BattleGroundSA.h b/src/game/BattleGroundSA.h
index 6727c7a1f..331a41455 100644
--- a/src/game/BattleGroundSA.h
+++ b/src/game/BattleGroundSA.h
@@ -35,7 +35,7 @@ class BattleGroundSA : public BattleGround
public:
BattleGroundSA();
~BattleGroundSA();
- void Update(time_t diff);
+ void Update(uint32 diff);
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player *plr);
diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp
index 6e70739fa..6071688f6 100644
--- a/src/game/BattleGroundWS.cpp
+++ b/src/game/BattleGroundWS.cpp
@@ -36,7 +36,7 @@ BattleGroundWS::~BattleGroundWS()
{
}
-void BattleGroundWS::Update(time_t diff)
+void BattleGroundWS::Update(uint32 diff)
{
BattleGround::Update(diff);
diff --git a/src/game/BattleGroundWS.h b/src/game/BattleGroundWS.h
index 56a7b3061..d5756d42e 100644
--- a/src/game/BattleGroundWS.h
+++ b/src/game/BattleGroundWS.h
@@ -134,7 +134,7 @@ class BattleGroundWS : public BattleGround
/* Construction */
BattleGroundWS();
~BattleGroundWS();
- void Update(time_t diff);
+ void Update(uint32 diff);
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player *plr);
diff --git a/src/game/Cell.h b/src/game/Cell.h
index f826b9e06..32dec557f 100644
--- a/src/game/Cell.h
+++ b/src/game/Cell.h
@@ -91,13 +91,13 @@ struct MANGOS_DLL_DECL Cell
y = data.Part.grid_y*MAX_NUMBER_OF_CELLS + data.Part.cell_y;
}
- inline bool DiffCell(const Cell &cell) const
+ bool DiffCell(const Cell &cell) const
{
return( data.Part.cell_x != cell.data.Part.cell_x ||
data.Part.cell_y != cell.data.Part.cell_y );
}
- inline bool DiffGrid(const Cell &cell) const
+ bool DiffGrid(const Cell &cell) const
{
return( data.Part.grid_x != cell.data.Part.grid_x ||
data.Part.grid_y != cell.data.Part.grid_y );
diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp
index 42132fea2..3d04c8a26 100644
--- a/src/game/CharacterHandler.cpp
+++ b/src/game/CharacterHandler.cpp
@@ -1206,7 +1206,7 @@ void WorldSession::HandleRemoveGlyph( WorldPacket & recv_data )
uint32 slot;
recv_data >> slot;
- if(slot > 5)
+ if(slot > MAX_GLYPH_SLOT_INDEX)
{
sLog.outDebug("Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot);
return;
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 449267f87..06e3937c1 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -284,6 +284,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "spell_chain", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellChainCommand, "", NULL },
{ "spell_elixir", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellElixirCommand, "", NULL },
{ "spell_learn_spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellLearnSpellCommand, "", NULL },
+ { "spell_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesSpellCommand, "", NULL },
{ "spell_pet_auras", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellPetAurasCommand, "", NULL },
{ "spell_proc_event", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellProcEventCommand, "", NULL },
{ "spell_script_target", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellScriptTargetCommand, "", NULL },
diff --git a/src/game/Chat.h b/src/game/Chat.h
index 12352f88a..13d044892 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -233,6 +233,7 @@ class ChatHandler
bool HandleReloadLootTemplatesReferenceCommand(const char* args);
bool HandleReloadLootTemplatesQuestMailCommand(const char* args);
bool HandleReloadLootTemplatesSkinningCommand(const char* args);
+ bool HandleReloadLootTemplatesSpellCommand(const char* args);
bool HandleReloadMangosStringCommand(const char* args);
bool HandleReloadNpcGossipCommand(const char* args);
bool HandleReloadNpcOptionCommand(const char* args);
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 30195fa52..28cb26d94 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -813,10 +813,8 @@ void Creature::sendPreparedGossip(Player* player)
if(!player)
return;
- GossipMenu& gossipmenu = player->PlayerTalkClass->GetGossipMenu();
-
// in case empty gossip menu open quest menu if any
- if (gossipmenu.Empty() && GetNpcTextId() == 0)
+ if (player->PlayerTalkClass->GetGossipMenu().Empty() && !player->PlayerTalkClass->GetQuestMenu().Empty())
{
player->SendPreparedQuest(GetGUID());
return;
@@ -1547,12 +1545,12 @@ bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo)
return Unit::IsImmunedToSpell(spellInfo);
}
-bool Creature::IsImmunedToSpellEffect(uint32 effect, uint32 mechanic) const
+bool Creature::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
{
- if (GetCreatureInfo()->MechanicImmuneMask & (1 << (mechanic-1)))
+ if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->EffectMechanic[index] - 1)))
return true;
- return Unit::IsImmunedToSpellEffect(effect, mechanic);
+ return Unit::IsImmunedToSpellEffect(spellInfo, index);
}
SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
diff --git a/src/game/Creature.h b/src/game/Creature.h
index 8bb1f868d..cb444205e 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -364,6 +364,10 @@ struct TrainerSpell
uint32 reqskill;
uint32 reqskillvalue;
uint32 reqlevel;
+ uint32 learned_spell;
+
+ // helpers
+ bool IsCastable() const { return learned_spell != spell; }
};
typedef std::vector TrainerSpellList;
@@ -429,7 +433,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
bool IsOutOfThreatArea(Unit* pVictim) const;
bool IsImmunedToSpell(SpellEntry const* spellInfo);
// redefine Unit::IsImmunedToSpell
- bool IsImmunedToSpellEffect(uint32 effect, uint32 mechanic) const;
+ bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
// redefine Unit::IsImmunedToSpellEffect
bool isElite() const
{
diff --git a/src/game/Formulas.h b/src/game/Formulas.h
index a00e523d1..decad556f 100644
--- a/src/game/Formulas.h
+++ b/src/game/Formulas.h
@@ -78,8 +78,17 @@ namespace MaNGOS
inline uint32 BaseGain(uint32 pl_level, uint32 mob_level, ContentLevels content)
{
- //TODO: need modifier for CONTENT_71_80 different from CONTENT_61_70?
- const uint32 nBaseExp = content == CONTENT_1_60 ? 45 : 235;
+ uint32 nBaseExp;
+ switch(content)
+ {
+ case CONTENT_1_60: nBaseExp = 45; break;
+ case CONTENT_61_70: nBaseExp = 235; break;
+ case CONTENT_71_80: nBaseExp = 580; break;
+ default:
+ sLog.outError("BaseGain: Unsupported content level %u",content);
+ nBaseExp = 45; break;
+ }
+
if( mob_level >= pl_level )
{
uint32 nLevelDiff = mob_level - pl_level;
@@ -116,66 +125,6 @@ namespace MaNGOS
return (uint32)(xp_gain*sWorld.getRate(RATE_XP_KILL));
}
- inline uint32 xp_Diff(uint32 lvl)
- {
- if( lvl < 29 )
- return 0;
- if( lvl == 29 )
- return 1;
- if( lvl == 30 )
- return 3;
- if( lvl == 31 )
- return 6;
- else
- return (5*(lvl-30));
- }
-
- inline uint32 mxp(uint32 lvl)
- {
- if (lvl < 60)
- {
- return (45 + (5*lvl));
- }
- else
- {
- return (235 + (5*lvl));
- }
- }
-
- inline uint32 xp_to_level(uint32 lvl)
- {
- uint32 xp = 0;
- if (lvl < 60)
- {
- xp = (8*lvl + xp_Diff(lvl)) * mxp(lvl);
- }
- else if (lvl == 60)
- {
- xp = (155 + mxp(lvl) * (1344 - 70 - ((69 - lvl) * (7 + (69 - lvl) * 8 - 1)/2)));
- }
- else if (lvl < 70)
- {
- xp = (155 + mxp(lvl) * (1344 - ((69-lvl) * (7 + (69 - lvl) * 8 - 1)/2)));
- }else
- {
- // level higher than 70 is not supported
- xp = (uint32)(779700 * (pow(sWorld.getRate(RATE_XP_PAST_70), (int32)lvl - 69)));
- return ((xp < 0x7fffffff) ? xp : 0x7fffffff);
- }
-
- // The XP to Level is always rounded to the nearest 100 points (50 rounded to high).
- xp = ((xp + 50) / 100) * 100; // use additional () for prevent free association operations in C++
-
- if ((lvl > 10) && (lvl < 60)) // compute discount added in 2.3.x
- {
- uint32 discount = (lvl < 28) ? (lvl - 10) : 18;
- xp = (xp * (100 - discount)) / 100; // apply discount
- xp = (xp / 100) * 100; // floor to hundreds
- }
-
- return xp;
- }
-
inline float xp_in_group_rate(uint32 count, bool isRaid)
{
if(isRaid)
diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp
index 63eeb5991..c7c770bfa 100644
--- a/src/game/GossipDef.cpp
+++ b/src/game/GossipDef.cpp
@@ -125,7 +125,7 @@ bool PlayerMenu::GossipOptionCoded( unsigned int Selection )
void PlayerMenu::SendGossipMenu( uint32 TitleTextId, uint64 npcGUID )
{
WorldPacket data( SMSG_GOSSIP_MESSAGE, (100) ); // guess size
- data << npcGUID;
+ data << uint64(npcGUID);
data << uint32(0); // new 2.4.0
data << uint32( TitleTextId );
data << uint32( mGossipMenu.MenuItemCount() ); // max count 0x0F
diff --git a/src/game/GridDefines.h b/src/game/GridDefines.h
index 03e8cc100..54cdca7b6 100644
--- a/src/game/GridDefines.h
+++ b/src/game/GridDefines.h
@@ -41,10 +41,10 @@ class Player;
#define MIN_GRID_DELAY MINUTE*1000
#define MIN_MAP_UPDATE_DELAY 50
-#define MAX_NUMBER_OF_CELLS 4
+#define MAX_NUMBER_OF_CELLS 8
#define SIZE_OF_GRID_CELL (SIZE_OF_GRIDS/MAX_NUMBER_OF_CELLS)
-#define CENTER_GRID_CELL_ID 128
+#define CENTER_GRID_CELL_ID 256
#define CENTER_GRID_CELL_OFFSET (SIZE_OF_GRID_CELL/2)
#define TOTAL_NUMBER_OF_CELLS_PER_MAP (MAX_NUMBER_OF_GRIDS*MAX_NUMBER_OF_CELLS)
diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h
index 8244f6371..590fc68c9 100644
--- a/src/game/GridNotifiersImpl.h
+++ b/src/game/GridNotifiersImpl.h
@@ -170,7 +170,7 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
SpellEntry const *spellInfo = sSpellStore.LookupEntry(i_dynobject.GetSpellId());
uint32 eff_index = i_dynobject.GetEffIndex();
// Check target immune to spell or aura
- if (target->IsImmunedToSpell(spellInfo) || target->IsImmunedToSpellEffect(spellInfo->Effect[eff_index], spellInfo->EffectMechanic[eff_index]))
+ if (target->IsImmunedToSpell(spellInfo) || target->IsImmunedToSpellEffect(spellInfo, eff_index))
return;
// Apply PersistentAreaAura on target
PersistentAreaAura* Aur = new PersistentAreaAura(spellInfo, eff_index, NULL, target, i_dynobject.GetCaster());
diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp
index 51fc8cb7c..9ec47103e 100644
--- a/src/game/GroupHandler.cpp
+++ b/src/game/GroupHandler.cpp
@@ -707,7 +707,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_AURAS)
{
- uint64 auramask = player->GetAuraUpdateMask();
+ const uint64& auramask = player->GetAuraUpdateMask();
*data << uint64(auramask);
for(uint32 i = 0; i < MAX_AURAS; ++i)
{
@@ -788,7 +788,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
{
if(pet)
{
- uint64 auramask = pet->GetAuraUpdateMask();
+ const uint64& auramask = pet->GetAuraUpdateMask();
*data << uint64(auramask);
for(uint32 i = 0; i < MAX_AURAS; ++i)
{
diff --git a/src/game/Item.h b/src/game/Item.h
index a124d318a..2bd91d55e 100644
--- a/src/game/Item.h
+++ b/src/game/Item.h
@@ -152,7 +152,7 @@ enum EnchantmentSlot
SOCK_ENCHANTMENT_SLOT_2 = 3,
SOCK_ENCHANTMENT_SLOT_3 = 4,
BONUS_ENCHANTMENT_SLOT = 5,
- WOTLK_ENCHANTMENT_SLOT = 6,
+ PRISMATIC_ENCHANTMENT_SLOT = 6, // added at apply special permanent enchantment
MAX_INSPECTED_ENCHANTMENT_SLOT = 7,
PROP_ENCHANTMENT_SLOT_0 = 7, // used with RandomSuffix
diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp
index eb4303b23..5715e319a 100644
--- a/src/game/ItemHandler.cpp
+++ b/src/game/ItemHandler.cpp
@@ -322,7 +322,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
data << pProto->ItemId;
data << pProto->Class;
data << pProto->SubClass;
- data << pProto->Unk0; // new 2.0.3, not exist in wdb cache?
+ data << int32(pProto->Unk0); // new 2.0.3, not exist in wdb cache?
data << Name;
data << uint8(0x00); //pProto->Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name...
data << uint8(0x00); //pProto->Name3; // blizz not send name there, just uint8(0x00);
@@ -418,7 +418,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
data << pProto->PageMaterial;
data << pProto->StartQuest;
data << pProto->LockID;
- data << pProto->Material;
+ data << int32(pProto->Material);
data << pProto->Sheath;
data << pProto->RandomProperty;
data << pProto->RandomSuffix;
@@ -1112,10 +1112,6 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
CHECK_PACKET_SIZE(recv_data,8*4);
uint64 guids[4];
- uint32 GemEnchants[3], OldEnchants[3];
- Item *Gems[3];
- bool SocketBonusActivated, SocketBonusToBeActivated;
-
for(int i = 0; i < 4; i++)
recv_data >> guids[i];
@@ -1133,6 +1129,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
//this slot is excepted when applying / removing meta gem bonus
uint8 slot = itemTarget->IsEquipped() ? itemTarget->GetSlot() : NULL_SLOT;
+ Item *Gems[3];
for(int i = 0; i < 3; i++)
Gems[i] = guids[i + 1] ? _player->GetItemByGuid(guids[i + 1]) : NULL;
@@ -1152,6 +1149,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
return;
}
+ uint32 GemEnchants[3], OldEnchants[3];
for(int i = 0; i < 3; ++i) //get new and old enchantments
{
GemEnchants[i] = (GemProps[i]) ? GemProps[i]->spellitemenchantement : 0;
@@ -1200,7 +1198,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
}
}
- SocketBonusActivated = itemTarget->GemsFitSockets(); //save state of socketbonus
+ bool SocketBonusActivated = itemTarget->GemsFitSockets(); //save state of socketbonus
_player->ToggleMetaGemsActive(slot, false); //turn off all metagems (except for the target item)
//if a meta gem is being equipped, all information has to be written to the item before testing if the conditions for the gem are met
@@ -1222,7 +1220,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot)
_player->ApplyEnchantment(itemTarget,EnchantmentSlot(enchant_slot),true);
- SocketBonusToBeActivated = itemTarget->GemsFitSockets();//current socketbonus state
+ bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();//current socketbonus state
if(SocketBonusActivated ^ SocketBonusToBeActivated) //if there was a change...
{
_player->ApplyEnchantment(itemTarget,BONUS_ENCHANTMENT_SLOT,false);
diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h
index a4c0bb96e..28a57ec79 100644
--- a/src/game/ItemPrototype.h
+++ b/src/game/ItemPrototype.h
@@ -74,6 +74,12 @@ enum ItemSpelltriggerType
ITEM_SPELLTRIGGER_ON_EQUIP = 1,
ITEM_SPELLTRIGGER_CHANCE_ON_HIT = 2,
ITEM_SPELLTRIGGER_SOULSTONE = 4,
+ /*
+ * ItemSpelltriggerType 5 might have changed on 2.4.3/3.0.3: Such auras
+ * will be applied on item pickup and removed on item loss - maybe on the
+ * other hand the item is destroyed if the aura is removed ("removed on
+ * death" of spell 57348 makes me think so)
+ */
ITEM_SPELLTRIGGER_ON_NO_DELAY_USE = 5, // no equip cooldown
ITEM_SPELLTRIGGER_LEARN_SPELL_ID = 6 // used in item_template.spell_2 with spell_id with SPELL_GENERIC_LEARN in spell_1
};
@@ -489,7 +495,7 @@ struct ItemPrototype
uint32 ItemId;
uint32 Class; // id from ItemClass.dbc
uint32 SubClass; // id from ItemSubClass.dbc
- uint32 Unk0;
+ int32 Unk0;
char* Name1;
uint32 DisplayInfoID; // id from ItemDisplayInfo.dbc
uint32 Quality;
@@ -535,7 +541,7 @@ struct ItemPrototype
uint32 PageMaterial;
uint32 StartQuest; // id from QuestCache.wdb
uint32 LockID;
- uint32 Material; // id from Material.dbc
+ int32 Material; // id from Material.dbc
uint32 Sheath;
uint32 RandomProperty; // id from ItemRandomProperties.dbc
uint32 RandomSuffix; // id from ItemRandomSuffix.dbc
diff --git a/src/game/Language.h b/src/game/Language.h
index 207361889..4bb924f89 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -723,7 +723,8 @@ enum MangosStrings
LANG_MUST_MALE_OR_FEMALE = 1119,
LANG_YOU_CHANGE_GENDER = 1120,
LANG_YOUR_GENDER_CHANGED = 1121,
- // Room for more level 3 1122-1199 not used
+ LANG_SKILL_VALUES = 1122,
+ // Room for more level 3 1123-1199 not used
// FREE IDS 1200-9999
diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
index 71888e8c0..04639eda8 100644
--- a/src/game/Level1.cpp
+++ b/src/game/Level1.cpp
@@ -1677,14 +1677,14 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args)
return true;
}
-//Edit Player field
+//Edit Unit field
bool ChatHandler::HandleModifyBitCommand(const char* args)
{
if( !*args )
return false;
- Player *chr = getSelectedPlayer();
- if (chr == NULL)
+ Unit *unit = getSelectedUnit();
+ if (!unit)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
@@ -1692,7 +1692,7 @@ bool ChatHandler::HandleModifyBitCommand(const char* args)
}
// check online security
- if (HasLowerSecurity(chr, 0))
+ if (unit->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player *)unit, 0))
return false;
char* pField = strtok((char*)args, " ");
@@ -1706,13 +1706,12 @@ bool ChatHandler::HandleModifyBitCommand(const char* args)
uint16 field = atoi(pField);
uint32 bit = atoi(pBit);
- if (field < 1 || field >= PLAYER_END)
+ if (field < OBJECT_END || field >= unit->GetValuesCount())
{
SendSysMessage(LANG_BAD_VALUE);
SetSentErrorMessage(true);
return false;
}
-
if (bit < 1 || bit > 32)
{
SendSysMessage(LANG_BAD_VALUE);
@@ -1720,17 +1719,16 @@ bool ChatHandler::HandleModifyBitCommand(const char* args)
return false;
}
- if ( chr->HasFlag( field, (1<<(bit-1)) ) )
+ if ( unit->HasFlag( field, (1<<(bit-1)) ) )
{
- chr->RemoveFlag( field, (1<<(bit-1)) );
+ unit->RemoveFlag( field, (1<<(bit-1)) );
PSendSysMessage(LANG_REMOVE_BIT, bit, field);
}
else
{
- chr->SetFlag( field, (1<<(bit-1)) );
+ unit->SetFlag( field, (1<<(bit-1)) );
PSendSysMessage(LANG_SET_BIT, bit, field);
}
-
return true;
}
diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
index 6ea8c6b6d..1e6172b74 100644
--- a/src/game/Level2.cpp
+++ b/src/game/Level2.cpp
@@ -854,8 +854,8 @@ bool ChatHandler::HandleNpcAddCommand(const char* args)
{
if(!*args)
return false;
- char* charID = strtok((char*)args, " ");
- if (!charID)
+ char* charID = extractKeyFromLink((char*)args,"Hcreature_entry");
+ if(!charID)
return false;
char* team = strtok(NULL, " ");
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 44f626210..cd011e16a 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -339,6 +339,15 @@ bool ChatHandler::HandleReloadLootTemplatesSkinningCommand(const char*)
return true;
}
+bool ChatHandler::HandleReloadLootTemplatesSpellCommand(const char*)
+{
+ sLog.outString( "Re-Loading Loot Tables... (`spell_loot_template`)" );
+ LoadLootTemplates_Spell();
+ LootTemplates_Spell.CheckLootRefs();
+ SendGlobalSysMessage("DB table `spell_loot_template` reloaded.");
+ return true;
+}
+
bool ChatHandler::HandleReloadMangosStringCommand(const char*)
{
sLog.outString( "Re-Loading mangos_string Table!" );
@@ -2632,15 +2641,25 @@ bool ChatHandler::HandleLookupSkillCommand(const char* args)
if(loc < MAX_LOCALE)
{
+ char valStr[50] = "";
char const* knownStr = "";
if(target && target->HasSkill(id))
+ {
knownStr = GetMangosString(LANG_KNOWN);
+ uint32 curValue = target->GetPureSkillValue(id);
+ uint32 maxValue = target->GetPureMaxSkillValue(id);
+ uint32 permValue = target->GetSkillPermBonusValue(id);
+ uint32 tempValue = target->GetSkillTempBonusValue(id);
+
+ char const* valFormat = GetMangosString(LANG_SKILL_VALUES);
+ snprintf(valStr,50,valFormat,curValue,maxValue,permValue,tempValue);
+ }
// send skill in "id - [namedlink locale]" format
if (m_session)
- PSendSysMessage(LANG_SKILL_LIST_CHAT,id,id,name.c_str(),localeNames[loc],knownStr);
+ PSendSysMessage(LANG_SKILL_LIST_CHAT,id,id,name.c_str(),localeNames[loc],knownStr,valStr);
else
- PSendSysMessage(LANG_SKILL_LIST_CONSOLE,id,name.c_str(),localeNames[loc],knownStr);
+ PSendSysMessage(LANG_SKILL_LIST_CONSOLE,id,name.c_str(),localeNames[loc],knownStr,valStr);
++counter;
}
@@ -3836,8 +3855,6 @@ bool ChatHandler::HandleShowAreaCommand(const char* args)
if (!*args)
return false;
- int area = atoi((char*)args);
-
Player *chr = getSelectedPlayer();
if (chr == NULL)
{
@@ -3846,10 +3863,11 @@ bool ChatHandler::HandleShowAreaCommand(const char* args)
return false;
}
+ int area = GetAreaFlagByAreaID(atoi((char*)args));
int offset = area / 32;
uint32 val = (uint32)(1 << (area % 32));
- if(offset >= 128)
+ if(area<0 || offset >= 128)
{
SendSysMessage(LANG_BAD_VALUE);
SetSentErrorMessage(true);
@@ -3868,8 +3886,6 @@ bool ChatHandler::HandleHideAreaCommand(const char* args)
if (!*args)
return false;
- int area = atoi((char*)args);
-
Player *chr = getSelectedPlayer();
if (chr == NULL)
{
@@ -3878,10 +3894,11 @@ bool ChatHandler::HandleHideAreaCommand(const char* args)
return false;
}
+ int area = GetAreaFlagByAreaID(atoi((char*)args));
int offset = area / 32;
uint32 val = (uint32)(1 << (area % 32));
- if(offset >= 128)
+ if(area<0 || offset >= 128)
{
SendSysMessage(LANG_BAD_VALUE);
SetSentErrorMessage(true);
@@ -4394,8 +4411,10 @@ bool ChatHandler::HandleResetLevelCommand(const char * args)
// reset level to summoned pet
Pet* pet = player->GetPet();
if(pet && pet->getPetType()==SUMMON_PET)
+ {
pet->InitStatsForLevel(1);
-
+ pet->InitTalentForLevel();
+ }
return true;
}
@@ -4507,13 +4526,6 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
else
player = getSelectedPlayer();
- if(!player && !playerGUID)
- {
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
if(player)
{
player->resetTalents(true);
@@ -4522,14 +4534,33 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
if(m_session->GetPlayer()!=player)
PSendSysMessage(LANG_RESET_TALENTS_ONLINE,player->GetName());
+ return true;
}
- else
+ else if (playerGUID)
{
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'",uint32(AT_LOGIN_RESET_TALENTS), GUID_LOPART(playerGUID) );
PSendSysMessage(LANG_RESET_TALENTS_OFFLINE,pName);
+ return true;
+ }
+ // Try reset talenents as Hunter Pet
+ Creature* creature = getSelectedCreature();
+ if (creature && creature->isPet() && ((Pet *)creature)->getPetType() == HUNTER_PET)
+ {
+ ((Pet *)creature)->resetTalents(true);
+ Unit *owner = creature->GetOwner();
+ if (owner && owner->GetTypeId() == TYPEID_PLAYER)
+ {
+ player = (Player *)owner;
+ ChatHandler(player).SendSysMessage(LANG_RESET_TALENTS);
+ if(m_session->GetPlayer()!=player)
+ PSendSysMessage(LANG_RESET_TALENTS_ONLINE,player->GetName());
+ }
+ return true;
}
- return true;
+ SendSysMessage(LANG_NO_CHAR_SELECTED);
+ SetSentErrorMessage(true);
+ return false;
}
bool ChatHandler::HandleResetAllCommand(const char * args)
diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp
index 030db9011..e5ffbbaec 100644
--- a/src/game/LootMgr.cpp
+++ b/src/game/LootMgr.cpp
@@ -23,6 +23,7 @@
#include "World.h"
#include "Util.h"
#include "SharedDefines.h"
+#include "SpellMgr.h"
static Rates const qualityToRate[MAX_ITEM_QUALITY] = {
RATE_DROP_ITEM_POOR, // ITEM_QUALITY_POOR
@@ -34,17 +35,18 @@ static Rates const qualityToRate[MAX_ITEM_QUALITY] = {
RATE_DROP_ITEM_ARTIFACT, // ITEM_QUALITY_ARTIFACT
};
-LootStore LootTemplates_Creature( "creature_loot_template", "creature entry");
-LootStore LootTemplates_Disenchant( "disenchant_loot_template", "item disenchant id");
-LootStore LootTemplates_Fishing( "fishing_loot_template", "area id");
-LootStore LootTemplates_Gameobject( "gameobject_loot_template", "gameobject entry");
-LootStore LootTemplates_Item( "item_loot_template", "item entry");
-LootStore LootTemplates_Milling( "milling_loot_template", "item entry");
-LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template","creature pickpocket lootid");
-LootStore LootTemplates_Prospecting( "prospecting_loot_template", "item entry");
-LootStore LootTemplates_QuestMail( "quest_mail_loot_template", "quest id");
-LootStore LootTemplates_Reference( "reference_loot_template", "reference id");
-LootStore LootTemplates_Skinning( "skinning_loot_template", "creature skinning id");
+LootStore LootTemplates_Creature( "creature_loot_template", "creature entry", true);
+LootStore LootTemplates_Disenchant( "disenchant_loot_template", "item disenchant id", true);
+LootStore LootTemplates_Fishing( "fishing_loot_template", "area id", true);
+LootStore LootTemplates_Gameobject( "gameobject_loot_template", "gameobject entry", true);
+LootStore LootTemplates_Item( "item_loot_template", "item entry", true);
+LootStore LootTemplates_Milling( "milling_loot_template", "item entry (herb)", true);
+LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template","creature pickpocket lootid", true);
+LootStore LootTemplates_Prospecting( "prospecting_loot_template", "item entry (ore)", true);
+LootStore LootTemplates_QuestMail( "quest_mail_loot_template", "quest id (with mail template)",false);
+LootStore LootTemplates_Reference( "reference_loot_template", "reference id", false);
+LootStore LootTemplates_Skinning( "skinning_loot_template", "creature skinning id", true);
+LootStore LootTemplates_Spell( "spell_loot_template", "spell id (explicitly discovering ability)",false);
class LootTemplate::LootGroup // A set of loot definitions for items (refs are not allowed)
{
@@ -53,7 +55,7 @@ class LootTemplate::LootGroup // A set of loot def
bool HasQuestDrop() const; // True if group includes at least 1 quest drop entry
bool HasQuestDropForPlayer(Player const * player) const;
// The same for active quests of the player
- void Process(Loot& loot) const; // Rolls an item from the group (if any) and adds the item to the loot
+ void Process(Loot& loot, bool rate) const; // Rolls an item from the group (if any) and adds the item to the loot
float RawTotalChance() const; // Overall chance for the group (without equal chanced items)
float TotalChance() const; // Overall chance for the group
@@ -64,7 +66,7 @@ class LootTemplate::LootGroup // A set of loot def
LootStoreItemList ExplicitlyChanced; // Entries with chances defined in DB
LootStoreItemList EqualChanced; // Zero chances - every entry takes the same chance
- LootStoreItem const * Roll() const; // Rolls an item from the group, returns NULL if all miss their chances
+ LootStoreItem const * Roll(bool rate) const; // Rolls an item from the group, returns NULL if all miss their chances
};
//Remove all data and free all memory
@@ -228,17 +230,17 @@ void LootStore::ReportNotExistedId(uint32 id) const
// Checks if the entry (quest, non-quest, reference) takes it's chance (at loot generation)
// RATE_DROP_ITEMS is no longer used for all types of entries
-bool LootStoreItem::Roll() const
+bool LootStoreItem::Roll(bool rate) const
{
if(chance>=100.f)
return true;
if(mincountOrRef < 0) // reference case
- return roll_chance_f(chance*sWorld.getRate(RATE_DROP_ITEM_REFERENCED));
+ return roll_chance_f(chance* (rate ? sWorld.getRate(RATE_DROP_ITEM_REFERENCED) : 1.0f));
ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid);
- float qualityModifier = pProto ? sWorld.getRate(qualityToRate[pProto->Quality]) : 1.0f;
+ float qualityModifier = pProto && rate ? sWorld.getRate(qualityToRate[pProto->Quality]) : 1.0f;
return roll_chance_f(chance*qualityModifier);
}
@@ -377,7 +379,7 @@ void Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner)
items.reserve(MAX_NR_LOOT_ITEMS);
quest_items.reserve(MAX_NR_QUEST_ITEMS);
- tab->Process(*this, store); // Processing is done there, callback via Loot::AddItem()
+ tab->Process(*this, store,store.IsRatesAllowed ()); // Processing is done there, callback via Loot::AddItem()
// Setting access rights fow group-looting case
if(!loot_owner)
@@ -763,7 +765,7 @@ void LootTemplate::LootGroup::AddEntry(LootStoreItem& item)
}
// Rolls an item from the group, returns NULL if all miss their chances
-LootStoreItem const * LootTemplate::LootGroup::Roll() const
+LootStoreItem const * LootTemplate::LootGroup::Roll(bool rate) const
{
if (!ExplicitlyChanced.empty()) // First explicitly chanced entries are checked
{
@@ -775,7 +777,7 @@ LootStoreItem const * LootTemplate::LootGroup::Roll() const
return &ExplicitlyChanced[i];
ItemPrototype const *pProto = objmgr.GetItemPrototype(ExplicitlyChanced[i].itemid);
- float qualityMultiplier = pProto ? sWorld.getRate(qualityToRate[pProto->Quality]) : 1.0f;
+ float qualityMultiplier = pProto && rate ? sWorld.getRate(qualityToRate[pProto->Quality]) : 1.0f;
Roll -= ExplicitlyChanced[i].chance * qualityMultiplier;
if (Roll < 0)
return &ExplicitlyChanced[i];
@@ -812,9 +814,9 @@ bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const * player) const
}
// Rolls an item from the group (if any takes its chance) and adds the item to the loot
-void LootTemplate::LootGroup::Process(Loot& loot) const
+void LootTemplate::LootGroup::Process(Loot& loot, bool rate) const
{
- LootStoreItem const * item = Roll();
+ LootStoreItem const * item = Roll(rate);
if (item != NULL)
loot.AddItem(*item);
}
@@ -899,21 +901,21 @@ void LootTemplate::AddEntry(LootStoreItem& item)
}
// Rolls for every item in the template and adds the rolled items the the loot
-void LootTemplate::Process(Loot& loot, LootStore const& store, uint8 groupId) const
+void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8 groupId) const
{
if (groupId) // Group reference uses own processing of the group
{
if (groupId > Groups.size())
return; // Error message already printed at loading stage
- Groups[groupId-1].Process(loot);
+ Groups[groupId-1].Process(loot,rate);
return;
}
// Rolling non-grouped items
for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end() ; ++i )
{
- if ( !i->Roll() )
+ if (!i->Roll(rate))
continue; // Bad luck for the entry
if (i->mincountOrRef < 0) // References processing
@@ -924,7 +926,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, uint8 groupId) co
continue; // Error message already printed at loading stage
for (uint32 loop=0; loop < i->maxcount; ++loop )// Ref multiplicator
- Referenced->Process(loot, store, i->group); // Ref processing
+ Referenced->Process(loot, store, rate, i->group);
}
else // Plain entries (not a reference, not grouped)
loot.AddItem(*i); // Chance is already checked, just add
@@ -932,7 +934,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, uint8 groupId) co
// Now processing groups
for (LootGroups::const_iterator i = Groups.begin( ) ; i != Groups.end( ) ; ++i )
- i->Process(loot);
+ i->Process(loot,rate);
}
// True if template includes at least 1 quest drop entry
@@ -1143,9 +1145,17 @@ void LoadLootTemplates_Milling()
// remove real entries and check existence loot
for(uint32 i = 1; i < sItemStorage.MaxEntry; ++i )
- if(ItemPrototype const* proto = sItemStorage.LookupEntry(i))
- if(ids_set.count(proto->ItemId))
- ids_set.erase(proto->ItemId);
+ {
+ ItemPrototype const* proto = sItemStorage.LookupEntry(i);
+ if(!proto)
+ continue;
+
+ if((proto->BagFamily & BAG_FAMILY_MASK_HERBS)==0)
+ continue;
+
+ if(ids_set.count(proto->ItemId))
+ ids_set.erase(proto->ItemId);
+ }
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Milling.ReportUnusedIds(ids_set);
@@ -1184,9 +1194,17 @@ void LoadLootTemplates_Prospecting()
// remove real entries and check existence loot
for(uint32 i = 1; i < sItemStorage.MaxEntry; ++i )
- if(ItemPrototype const* proto = sItemStorage.LookupEntry(i))
- if(ids_set.count(proto->ItemId))
- ids_set.erase(proto->ItemId);
+ {
+ ItemPrototype const* proto = sItemStorage.LookupEntry(i);
+ if(!proto)
+ continue;
+
+ if((proto->BagFamily & BAG_FAMILY_MASK_MINING_SUPP)==0)
+ continue;
+
+ if(ids_set.count(proto->ItemId))
+ ids_set.erase(proto->ItemId);
+ }
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Prospecting.ReportUnusedIds(ids_set);
@@ -1200,8 +1218,17 @@ void LoadLootTemplates_QuestMail()
// remove real entries and check existence loot
ObjectMgr::QuestMap const& questMap = objmgr.GetQuestTemplates();
for(ObjectMgr::QuestMap::const_iterator itr = questMap.begin(); itr != questMap.end(); ++itr )
+ {
+ if(!itr->second->GetRewMailTemplateId())
+ continue;
+
if(ids_set.count(itr->first))
ids_set.erase(itr->first);
+ /* disabled reporting: some quest mails not include items
+ else
+ LootTemplates_QuestMail.ReportNotExistedId(itr->first);
+ */
+ }
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_QuestMail.ReportUnusedIds(ids_set);
@@ -1233,6 +1260,32 @@ void LoadLootTemplates_Skinning()
LootTemplates_Skinning.ReportUnusedIds(ids_set);
}
+void LoadLootTemplates_Spell()
+{
+ LootIdSet ids_set;
+ LootTemplates_Spell.LoadAndCollectLootIds(ids_set);
+
+ // remove real entries and check existence loot
+ for(uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id)
+ {
+ SpellEntry const* spellInfo = sSpellStore.LookupEntry (spell_id);
+ if(!spellInfo)
+ continue;
+
+ // possible cases
+ if(!IsExplicitDiscoverySpell (spellInfo))
+ continue;
+
+ if(!ids_set.count(spell_id))
+ LootTemplates_Spell.ReportNotExistedId(spell_id);
+ else
+ ids_set.erase(spell_id);
+ }
+
+ // output error for any still listed (not referenced from appropriate table) ids
+ LootTemplates_QuestMail.ReportUnusedIds(ids_set);
+}
+
void LoadLootTemplates_Reference()
{
LootIdSet ids_set;
diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h
index 6f8289d31..9a7d31e09 100644
--- a/src/game/LootMgr.h
+++ b/src/game/LootMgr.h
@@ -75,7 +75,7 @@ struct LootStoreItem
group(_group), maxcount(_maxcount), conditionId(_conditionId),
needs_quest(_chanceOrQuestChance < 0) {}
- bool Roll() const; // Checks if the entry takes it's chance (at loot generation)
+ bool Roll(bool rate) const; // Checks if the entry takes it's chance (at loot generation)
bool IsValid(LootStore const& store, uint32 entry) const;
// Checks correctness of values
};
@@ -127,7 +127,8 @@ typedef std::set LootIdSet;
class LootStore
{
public:
- explicit LootStore(char const* name, char const* entryName) : m_name(name), m_entryName(entryName) {}
+ explicit LootStore(char const* name, char const* entryName, bool ratesAllowed)
+ : m_name(name), m_entryName(entryName), m_ratesAllowed(m_ratesAllowed) {}
virtual ~LootStore() { Clear(); }
void Verify() const;
@@ -145,6 +146,7 @@ class LootStore
char const* GetName() const { return m_name; }
char const* GetEntryName() const { return m_entryName; }
+ bool IsRatesAllowed() const { return m_ratesAllowed; }
protected:
void LoadLootTable();
void Clear();
@@ -152,6 +154,7 @@ class LootStore
LootTemplateMap m_LootTemplates;
char const* m_name;
char const* m_entryName;
+ bool m_ratesAllowed;
};
class LootTemplate
@@ -163,7 +166,7 @@ class LootTemplate
// Adds an entry to the group (at loading stage)
void AddEntry(LootStoreItem& item);
// Rolls for every item in the template and adds the rolled items the the loot
- void Process(Loot& loot, LootStore const& store, uint8 GroupId = 0) const;
+ void Process(Loot& loot, LootStore const& store, bool rate, uint8 GroupId = 0) const;
// True if template includes at least 1 quest drop entry
bool HasQuestDrop(LootTemplateMap const& store, uint8 GroupId = 0) const;
@@ -301,6 +304,7 @@ extern LootStore LootTemplates_Skinning;
extern LootStore LootTemplates_Disenchant;
extern LootStore LootTemplates_Prospecting;
extern LootStore LootTemplates_QuestMail;
+extern LootStore LootTemplates_Spell;
void LoadLootTemplates_Creature();
void LoadLootTemplates_Fishing();
@@ -312,6 +316,8 @@ void LoadLootTemplates_Skinning();
void LoadLootTemplates_Disenchant();
void LoadLootTemplates_Prospecting();
void LoadLootTemplates_QuestMail();
+
+void LoadLootTemplates_Spell();
void LoadLootTemplates_Reference();
inline void LoadLootTables()
@@ -326,6 +332,8 @@ inline void LoadLootTables()
LoadLootTemplates_Disenchant();
LoadLootTemplates_Prospecting();
LoadLootTemplates_QuestMail();
+ LoadLootTemplates_Spell();
+
LoadLootTemplates_Reference();
}
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index bba8e945a..2a74d5ef4 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -1448,14 +1448,6 @@ void Map::RemoveAllObjectsInRemoveList()
//sLog.outDebug("Object remover 2 check.");
}
-bool Map::CanUnload(const uint32 &diff)
-{
- if(!m_unloadTimer) return false;
- if(m_unloadTimer < diff) return true;
- m_unloadTimer -= diff;
- return false;
-}
-
uint32 Map::GetPlayersCountExceptGMs() const
{
uint32 count = 0;
diff --git a/src/game/Map.h b/src/game/Map.h
index 5b9c3781a..664dc542a 100644
--- a/src/game/Map.h
+++ b/src/game/Map.h
@@ -131,7 +131,13 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj
virtual ~Map();
// currently unused for normal maps
- virtual bool CanUnload(const uint32& diff);
+ bool CanUnload(uint32 diff)
+ {
+ if(!m_unloadTimer) return false;
+ if(m_unloadTimer <= diff) return true;
+ m_unloadTimer -= diff;
+ return false;
+ }
virtual bool Add(Player *);
virtual void Remove(Player *, bool);
@@ -150,7 +156,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj
template void Visit(const CellLock &cell, TypeContainerVisitor &visitor);
- inline bool IsRemovalGrid(float x, float y) const
+ bool IsRemovalGrid(float x, float y) const
{
GridPair p = MaNGOS::ComputeGridPair(x, y);
return( !getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_REMOVAL );
@@ -291,7 +297,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj
bool isGridObjectDataLoaded(uint32 x, uint32 y) const { return getNGrid(x,y)->isGridObjectDataLoaded(); }
void setGridObjectDataLoaded(bool pLoaded, uint32 x, uint32 y) { getNGrid(x,y)->setGridObjectDataLoaded(pLoaded); }
- inline void setNGrid(NGridType* grid, uint32 x, uint32 y);
+ void setNGrid(NGridType* grid, uint32 x, uint32 y);
protected:
typedef MaNGOS::ObjectLevelLockable