diff --git a/sql/mangos.sql b/sql/mangos.sql index 3c1e671eb..564a6a0d4 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_7544_01_mangos_uptime` bit(1) default NULL + `required_7568_01_mangos_spell_proc_event` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -332,6 +332,7 @@ INSERT INTO `command` VALUES ('learn all_gm',2,'Syntax: .learn all_gm\r\n\r\nLearn all default spells for Game Masters.'), ('learn all_lang',1,'Syntax: .learn all_lang\r\n\r\nLearn all languages'), ('learn all_myclass',3,'Syntax: .learn all_myclass\r\n\r\nLearn all spells and talents available for his class.'), +('learn all_mypettalents',3,'Syntax: .learn all_mypettalents\r\n\r\nLearn all talents for your pet available for his creature type (only for hunter pets).'), ('learn all_myspells',3,'Syntax: .learn all_myspells\r\n\r\nLearn all spells (except talents and spells with first rank learned as talent) available for his class.'), ('learn all_mytalents',3,'Syntax: .learn all_mytalents\r\n\r\nLearn all talents (and spells with first rank learned as talent) available for his class.'), ('learn all_recipes',2,'Syntax: .learn all_recipes [$profession]\r\rLearns all recipes of specified profession and sets skill level to max.\rExample: .learn all_recipes enchanting'), @@ -1408,6 +1409,7 @@ CREATE TABLE `gameobject_template` ( `type` tinyint(3) unsigned NOT NULL default '0', `displayId` mediumint(8) unsigned NOT NULL default '0', `name` varchar(100) NOT NULL default '', + `IconName` varchar(100) NOT NULL default '', `castBarCaption` varchar(100) NOT NULL default '', `faction` smallint(5) unsigned NOT NULL default '0', `flags` int(10) unsigned NOT NULL default '0', @@ -2890,8 +2892,11 @@ INSERT INTO `mangos_string` VALUES (1007,'Account %s NOT created (probably sql file format was updated)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1008,'Account %s NOT created (unknown error)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1009,'Player %s (Guid: %u) Account %s (Id: %u) deleted.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(1010,'| Account | Character | IP | GM | TBC |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(1011,'| | %20s | |||',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1010,'| Account | Character | IP | GM | Expansion |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1011,'| | %20s | || |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1012,'===========================================================================',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1013,'|%15s| %20s | %15s |%4d| %9d |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1014,'No online players.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1100,'Account %s (Id: %u) have up to %u expansion allowed now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1101,'Message of the day changed to:\r\n%s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1102,'Message sent to %s: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), @@ -2914,7 +2919,12 @@ INSERT INTO `mangos_string` VALUES (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), -(1122,'(%u/%u +perm %u +temp %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +(1122,'(%u/%u +perm %u +temp %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1123,'Not pet found',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1124,'Wrong pet type',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1125,'Your pet learned all talents',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1126,'Your pet talents have been reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1127,'Talents of %s\'s pet reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); /*!40000 ALTER TABLE `mangos_string` ENABLE KEYS */; UNLOCK TABLES; @@ -16784,7 +16794,7 @@ INSERT INTO `spell_proc_event` VALUES (24389, 0x00000000, 3, 0x00C00017, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (24398, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), (24658, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00014110, 0x00000000, 0.000000, 0.000000, 0), -(24905, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 15.000000, 0.000000, 0), +(24905, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 15.000000, 0.000000, 0), (24932, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 6), (25050, 0x00000004, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (25296, 0x00000000, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), @@ -17296,12 +17306,12 @@ INSERT INTO `spell_proc_event` VALUES (53551, 0x00000000, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (53552, 0x00000000, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (53553, 0x00000000, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53569, 0x00000000, 10, 0x00200000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53576, 0x00000000, 10, 0x00200000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53569, 0x00000000, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53576, 0x00000000, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53601, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), (53671, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (53673, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54149, 0x00000000, 10, 0x00200000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(54149, 0x00000000, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (54151, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (54154, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (54155, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), @@ -17318,9 +17328,11 @@ INSERT INTO `spell_proc_event` VALUES (54936, 0x00000000, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (54937, 0x00000000, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (54939, 0x00000000, 10, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(55380, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (55440, 0x00000000, 11, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (55620, 0x00000000, 15, 0x00000001, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (55623, 0x00000000, 15, 0x00000001, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(55640, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (55666, 0x00000000, 15, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (55667, 0x00000000, 15, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (55668, 0x00000000, 15, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), @@ -17329,6 +17341,8 @@ INSERT INTO `spell_proc_event` VALUES (55677, 0x00000000, 6, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (55680, 0x00000000, 6, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (55689, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(55768, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(55776, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (56218, 0x00000000, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (56333, 0x00000000, 9, 0x00000004, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (56336, 0x00000000, 9, 0x00000004, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), @@ -17336,6 +17350,7 @@ INSERT INTO `spell_proc_event` VALUES (56342, 0x00000000, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (56343, 0x00000000, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (56344, 0x00000000, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(56355, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (56364, 0x00000000, 3, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (56451, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), (56611, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), @@ -17401,6 +17416,9 @@ INSERT INTO `spell_proc_event` VALUES (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), +(61345, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(61346, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(61356, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (61846, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 0), (61847, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 0); /*!40000 ALTER TABLE `spell_proc_event` ENABLE KEYS */; diff --git a/sql/updates/7558_01_mangos_mangos_string.sql b/sql/updates/7558_01_mangos_mangos_string.sql new file mode 100644 index 000000000..c0b856a98 --- /dev/null +++ b/sql/updates/7558_01_mangos_mangos_string.sql @@ -0,0 +1,9 @@ +ALTER TABLE db_version CHANGE COLUMN required_7544_01_mangos_uptime required_7558_01_mangos_mangos_string bit; + +DELETE FROM mangos_string WHERE entry IN (1123,1124,1125,1126,1127); +INSERT INTO mangos_string VALUES +(1123,'Not pet found',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1124,'Wrong pet type',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1125,'Your pet learned all talents',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1126,'Your pet talents have been reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1127,'Talents of %s\'s pet reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/7558_02_mangos_command.sql b/sql/updates/7558_02_mangos_command.sql new file mode 100644 index 000000000..cd5b2ff89 --- /dev/null +++ b/sql/updates/7558_02_mangos_command.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_7558_01_mangos_mangos_string required_7558_02_mangos_command bit; + +DELETE FROM `command` WHERE `name` IN ('learn all_mypettalents'); + +INSERT INTO `command` VALUES +('learn all_mypettalents',3,'Syntax: .learn all_mypettalents\r\n\r\nLearn all talents for your pet available for his creature type (only for hunter pets).'); diff --git a/sql/updates/7560_01_mangos_gameobject_template.sql b/sql/updates/7560_01_mangos_gameobject_template.sql new file mode 100644 index 000000000..f980687c7 --- /dev/null +++ b/sql/updates/7560_01_mangos_gameobject_template.sql @@ -0,0 +1,4 @@ +ALTER TABLE db_version CHANGE COLUMN required_7558_02_mangos_command required_7560_01_mangos_gameobject_template bit; + +ALTER TABLE gameobject_template + ADD COLUMN IconName varchar(100) NOT NULL default '' AFTER name; diff --git a/sql/updates/7565_01_mangos_mangos_string.sql b/sql/updates/7565_01_mangos_mangos_string.sql new file mode 100644 index 000000000..4557d1966 --- /dev/null +++ b/sql/updates/7565_01_mangos_mangos_string.sql @@ -0,0 +1,9 @@ +ALTER TABLE db_version CHANGE COLUMN required_7560_01_mangos_gameobject_template required_7565_01_mangos_mangos_string bit; + +DELETE FROM mangos_string WHERE entry IN(1010,1011,1012,1013,1014); +INSERT INTO mangos_string VALUES +(1010,'| Account | Character | IP | GM | Expansion |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1011,'| | %20s | || |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1012,'===========================================================================',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1013,'|%15s| %20s | %15s |%4d| %9d |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1014,'No online players.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/7568_01_mangos_spell_proc_event.sql b/sql/updates/7568_01_mangos_spell_proc_event.sql new file mode 100644 index 000000000..327e75c1e --- /dev/null +++ b/sql/updates/7568_01_mangos_spell_proc_event.sql @@ -0,0 +1,49 @@ +ALTER TABLE db_version CHANGE COLUMN required_7565_01_mangos_mangos_string required_7568_01_mangos_spell_proc_event bit; + +-- (53569) Infusion of Light (Rank 1) +DELETE FROM `spell_proc_event` WHERE `entry` IN (53569); +INSERT INTO `spell_proc_event` VALUES (53569, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- (53576) Infusion of Light (Rank 2) +DELETE FROM `spell_proc_event` WHERE `entry` IN (53576); +INSERT INTO `spell_proc_event` VALUES (53576, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- (54149) Infusion of Light (Rank 2) +DELETE FROM `spell_proc_event` WHERE `entry` IN (54149); +INSERT INTO `spell_proc_event` VALUES (54149, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- (55776) Swordguard Embroidery () +DELETE FROM `spell_proc_event` WHERE `entry` IN (55776); +INSERT INTO `spell_proc_event` VALUES (55776, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); + +-- (55768) Darkglow Embroidery () +DELETE FROM `spell_proc_event` WHERE `entry` IN (55768); +INSERT INTO `spell_proc_event` VALUES (55768, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); + +-- (55640) Lightweave Embroidery () +DELETE FROM `spell_proc_event` WHERE `entry` IN (55640); +INSERT INTO `spell_proc_event` VALUES (55640, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); + +-- (55380) Skyflare Swiftness () +DELETE FROM `spell_proc_event` WHERE `entry` IN (55380); +INSERT INTO `spell_proc_event` VALUES (55380, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); + +-- (56355) Titanium Shield Spike () +DELETE FROM `spell_proc_event` WHERE `entry` IN (56355); +INSERT INTO `spell_proc_event` VALUES (56355, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0); + +-- (61345) Natures Grace () +DELETE FROM `spell_proc_event` WHERE `entry` IN (61345); +INSERT INTO `spell_proc_event` VALUES (61345, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- (61346) Natures Grace () +DELETE FROM `spell_proc_event` WHERE `entry` IN (61346); +INSERT INTO `spell_proc_event` VALUES (61346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- (61356) Invigorating Earthsiege Diamond Passive () +DELETE FROM `spell_proc_event` WHERE `entry` IN (61356); +INSERT INTO `spell_proc_event` VALUES (61356, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- (24905) Moonkin Form (Passive) (Passive) +DELETE FROM `spell_proc_event` WHERE `entry` IN (24905); +INSERT INTO `spell_proc_event` VALUES (24905, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 15.000000, 0.000000, 0); \ No newline at end of file diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index af1ec8f82..c42df26d2 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -206,6 +206,11 @@ pkgdata_DATA = \ 7544_02_characters_uptime.sql \ 7546_01_characters_uptime.sql \ 7546_02_realmd_uptime.sql \ + 7558_01_mangos_mangos_string.sql \ + 7558_02_mangos_command.sql \ + 7560_01_mangos_gameobject_template.sql \ + 7565_01_mangos_mangos_string.sql \ + 7568_01_mangos_spell_proc_event.sql \ README ## Additional files to include when running 'make dist' @@ -392,4 +397,9 @@ EXTRA_DIST = \ 7544_02_characters_uptime.sql \ 7546_01_characters_uptime.sql \ 7546_02_realmd_uptime.sql \ + 7558_01_mangos_mangos_string.sql \ + 7558_02_mangos_command.sql \ + 7560_01_mangos_gameobject_template.sql \ + 7565_01_mangos_mangos_string.sql \ + 7568_01_mangos_spell_proc_event.sql \ README diff --git a/src/bindings/universal/ScriptMgr.h b/src/bindings/universal/ScriptMgr.h index 37b32c79b..3b70e81ea 100644 --- a/src/bindings/universal/ScriptMgr.h +++ b/src/bindings/universal/ScriptMgr.h @@ -119,6 +119,9 @@ struct MANGOS_DLL_DECL ScriptedAI : public CreatureAI // Called when hit by a spell void SpellHit(Unit *, const SpellEntry*){} + // Called when spell hits creature's target + void SpellHitTarget(Unit*, const SpellEntry*) {} + Creature* m_creature; //= Some useful helpers ========================= diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 4efed7c97..2e708ae06 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -197,10 +197,8 @@ void AchievementMgr::SaveToDB() if(need_execute) { - CharacterDatabase.BeginTransaction (); CharacterDatabase.Execute( ssdel.str().c_str() ); CharacterDatabase.Execute( ssins.str().c_str() ); - CharacterDatabase.CommitTransaction (); } } @@ -258,12 +256,10 @@ void AchievementMgr::SaveToDB() if(need_execute_del || need_execute_ins) { - CharacterDatabase.BeginTransaction (); if(need_execute_del) CharacterDatabase.Execute( ssdel.str().c_str() ); if(need_execute_ins) CharacterDatabase.Execute( ssins.str().c_str() ); - CharacterDatabase.CommitTransaction (); } } } @@ -308,6 +304,9 @@ void AchievementMgr::LoadFromDB(QueryResult *achievementResult, QueryResult *cri void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) { + if(GetPlayer()->GetSession()->PlayerLoading()) + return; + #ifdef MANGOS_DEBUG if((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES)==0) sLog.outDebug("AchievementMgr::SendAchievementEarned(%u)", achievement->ID); @@ -515,9 +514,19 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui SetCriteriaProgress(achievementCriteria, GetPlayer()->getLevel()); break; case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL: + // update at loading or specific skill update + if(miscvalue1 && miscvalue1 != achievementCriteria->reach_skill_level.skillID) + continue; if(uint32 skillvalue = GetPlayer()->GetBaseSkillValue(achievementCriteria->reach_skill_level.skillID)) SetCriteriaProgress(achievementCriteria, skillvalue); break; + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL: + // update at loading or specific skill update + if(miscvalue1 && miscvalue1 != achievementCriteria->learn_skill_level.skillID) + continue; + if(uint32 maxSkillvalue = GetPlayer()->GetPureMaxSkillValue(achievementCriteria->learn_skill_level.skillID)) + SetCriteriaProgress(achievementCriteria, maxSkillvalue); + break; case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: if(m_completedAchievements.find(achievementCriteria->complete_achievement.linkedAchievement) != m_completedAchievements.end()) SetCriteriaProgress(achievementCriteria, 1); @@ -909,7 +918,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA: case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING: case ACHIEVEMENT_CRITERIA_TYPE_REACH_TEAM_RATING: - case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL: case ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK: case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS: @@ -999,6 +1007,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve } case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL: return progress->counter >= achievementCriteria->reach_skill_level.skillLevel; + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL: + return progress->counter >= (achievementCriteria->learn_skill_level.skillLevel * 75); case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: return progress->counter >= 1; case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT: diff --git a/src/game/BattleGroundAB.h b/src/game/BattleGroundAB.h index e9a255d10..89e262cf1 100644 --- a/src/game/BattleGroundAB.h +++ b/src/game/BattleGroundAB.h @@ -165,8 +165,8 @@ enum BG_AB_Sounds BG_AB_SOUND_NODE_CLAIMED = 8192, BG_AB_SOUND_NODE_CAPTURED_ALLIANCE = 8173, BG_AB_SOUND_NODE_CAPTURED_HORDE = 8213, - BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE = 8174, - BG_AB_SOUND_NODE_ASSAULTED_HORDE = 8212, + BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE = 8212, + BG_AB_SOUND_NODE_ASSAULTED_HORDE = 8174, BG_AB_SOUND_NEAR_VICTORY = 8456 }; diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index 46a5ca43d..9bed9d3be 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -20,6 +20,7 @@ #define __BATTLEGROUNDMGR_H #include "Common.h" +#include "Policies/Singleton.h" #include "BattleGround.h" typedef std::map BattleGroundSet; diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 0404a31c5..0d8e6c8c0 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -217,6 +217,7 @@ ChatCommand * ChatHandler::getCommandTable() { "all_default", SEC_MODERATOR, false, &ChatHandler::HandleLearnAllDefaultCommand, "", NULL }, { "all_lang", SEC_MODERATOR, false, &ChatHandler::HandleLearnAllLangCommand, "", NULL }, { "all_myclass", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMyClassCommand, "", NULL }, + { "all_mypettalents",SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMyPetTalentsCommand,"", NULL }, { "all_myspells", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMySpellsCommand, "", NULL }, { "all_mytalents", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMyTalentsCommand, "", NULL }, { "all_recipes", SEC_GAMEMASTER, false, &ChatHandler::HandleLearnAllRecipesCommand, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index 0e06b3272..656cd34c8 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -135,6 +135,7 @@ class ChatHandler bool HandleLearnAllDefaultCommand(const char* args); bool HandleLearnAllLangCommand(const char* args); bool HandleLearnAllMyClassCommand(const char* args); + bool HandleLearnAllMyPetTalentsCommand(const char* args); bool HandleLearnAllMySpellsCommand(const char* args); bool HandleLearnAllMyTalentsCommand(const char* args); @@ -391,11 +392,10 @@ class ChatHandler bool HandleResetHonorCommand(const char * args); bool HandleResetLevelCommand(const char * args); bool HandleResetSpellsCommand(const char * args); - bool HandleResetStatsCommand(const char * args); bool HandleResetTalentsCommand(const char * args); - bool HandleResetAllCommand(const char * args); + bool HandleTicketCommand(const char* args); bool HandleDelTicketCommand(const char* args); bool HandleMaxSkillCommand(const char* args); diff --git a/src/game/Corpse.h b/src/game/Corpse.h index 819382847..c044b339e 100644 --- a/src/game/Corpse.h +++ b/src/game/Corpse.h @@ -84,6 +84,7 @@ class Corpse : public WorldObject void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); } + void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } GridReference &GetGridRef() { return m_gridRef; } diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 08225da43..8cf34b10a 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1586,7 +1586,9 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); float range = GetSpellMaxRange(srange); float minrange = GetSpellMinRange(srange); - float dist = GetDistance(pVictim); + + float dist = GetCombatDistance(pVictim); + //if(!isInFront( pVictim, range ) && spellInfo->AttributesEx ) // continue; if( dist > range || dist < minrange ) @@ -1632,7 +1634,9 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); float range = GetSpellMaxRange(srange); float minrange = GetSpellMinRange(srange); - float dist = GetDistance(pVictim); + + float dist = GetCombatDistance(pVictim); + //if(!isInFront( pVictim, range ) && spellInfo->AttributesEx ) // continue; if( dist > range || dist < minrange ) diff --git a/src/game/Creature.h b/src/game/Creature.h index 90a83df10..7c986ff6f 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -528,6 +528,7 @@ class MANGOS_DLL_SPEC Creature : public Unit void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void TextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false) { MonsterTextEmote(textId,TargetGuid,IsBossEmote); } void Whisper(int32 textId, uint64 receiver, bool IsBossWhisper = false) { MonsterWhisper(textId,receiver,IsBossWhisper); } + void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } // overwrite WorldObject function for proper name localization const char* GetNameForLocaleIdx(int32 locale_idx) const; diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h index 3bc4e9b34..6d2a6a7f1 100644 --- a/src/game/CreatureAI.h +++ b/src/game/CreatureAI.h @@ -27,6 +27,7 @@ class Unit; class Creature; +class WorldObject; struct SpellEntry; #define TIME_INTERVAL_LOOK 5000 @@ -79,6 +80,9 @@ class MANGOS_DLL_SPEC CreatureAI // Called when hit by a spell virtual void SpellHit(Unit*, const SpellEntry*) {} + // Called when spell hits creature's target + virtual void SpellHitTarget(Unit*, const SpellEntry*) {} + // Called when vitim entered water and creature can not enter water virtual bool canReachByRangeAttack(Unit*) { return false; } diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 816712c5b..da1040c68 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -20,6 +20,7 @@ #include "Policies/SingletonImp.h" #include "Log.h" #include "ProgressBar.h" +#include "SharedDefines.h" #include "DBCfmt.h" @@ -126,6 +127,7 @@ static uint32 sTalentTabPages[12/*MAX_CLASSES*/][3]; DBCStorage sTaxiNodesStore(TaxiNodesEntryfmt); TaxiMask sTaxiNodesMask; +TaxiMask sOldContinentsNodesMask; // DBC used only for initialization sTaxiPathSetBySource at startup. TaxiPathSetBySource sTaxiPathSetBySource; @@ -359,9 +361,13 @@ void LoadDBCStores(const std::string& dataPath) if(!talentTabInfo) continue; + // prevent memory corruption; otherwise cls will become 12 below + if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE)==0) + continue; + // store class talent tab pages uint32 cls = 1; - for(uint32 m=1;!(m & talentTabInfo->ClassMask) && cls < 12 /*MAX_CLASSES*/;m <<=1, ++cls) {} + for(uint32 m=1;!(m & talentTabInfo->ClassMask) && cls < MAX_CLASSES;m <<=1, ++cls) {} sTalentTabPages[cls][talentTabInfo->tabpage]=talentTabId; } @@ -407,9 +413,11 @@ void LoadDBCStores(const std::string& dataPath) spellPaths.insert(sInfo->EffectMiscValue[j]); memset(sTaxiNodesMask,0,sizeof(sTaxiNodesMask)); + memset(sOldContinentsNodesMask,0,sizeof(sTaxiNodesMask)); for(uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i) { - if(!sTaxiNodesStore.LookupEntry(i)) + TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i); + if(!node) continue; TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i); @@ -430,10 +438,14 @@ void LoadDBCStores(const std::string& dataPath) continue; } - // valid taxi netowrk node + // valid taxi network node uint8 field = (uint8)((i - 1) / 32); uint32 submask = 1<<((i-1)%32); sTaxiNodesMask[field] |= submask; + + // old continent node (+ nodes virtually at old continents, check explicitly to avoid loading map files for zone info) + if (node->map_id < 2 || i == 82 || i == 83 || i == 93 || i == 94) + sOldContinentsNodesMask[field] |= submask; } } diff --git a/src/game/DBCStores.h b/src/game/DBCStores.h index 519c97733..3c9d71895 100644 --- a/src/game/DBCStores.h +++ b/src/game/DBCStores.h @@ -132,6 +132,7 @@ extern DBCStorage sTalentTabStore; extern DBCStorage sTaxiNodesStore; extern DBCStorage sTaxiPathStore; extern TaxiMask sTaxiNodesMask; +extern TaxiMask sOldContinentsNodesMask; extern TaxiPathSetBySource sTaxiPathSetBySource; extern TaxiPathNodesByPath sTaxiPathNodesByPath; extern DBCStorage sTotemCategoryStore; diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index beb0b2070..2d2e9e557 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1293,6 +1293,9 @@ struct SpellEntry //uint32 spellMissileID; // 230 m_spellMissileID not used //uint32 PowerDisplayId; // 231 PowerDisplay.dbc, new in 3.1 + // helpers + int32 CalculateSimpleValue(uint8 eff) const { return EffectBasePoints[eff]+int32(EffectBaseDice[eff]); } + private: // prevent creating custom entries (copy data from original in fact) SpellEntry(SpellEntry const&); // DON'T must have implementation diff --git a/src/game/DynamicObject.h b/src/game/DynamicObject.h index 830662f0c..ed19dc28f 100644 --- a/src/game/DynamicObject.h +++ b/src/game/DynamicObject.h @@ -52,6 +52,7 @@ class DynamicObject : public WorldObject void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); } + void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } GridReference &GetGridRef() { return m_gridRef; } diff --git a/src/game/GameEventMgr.h b/src/game/GameEventMgr.h index 2710c987c..a05f07767 100644 --- a/src/game/GameEventMgr.h +++ b/src/game/GameEventMgr.h @@ -22,6 +22,7 @@ #include "Common.h" #include "SharedDefines.h" #include "Platform/Define.h" +#include "Policies/Singleton.h" #define max_ge_check_delay 86400 // 1 day in seconds diff --git a/src/game/GameObject.h b/src/game/GameObject.h index bc19abf4c..f5f92e24e 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -39,6 +39,7 @@ struct GameObjectInfo uint32 type; uint32 displayId; char *name; + char *IconName; char *castBarCaption; uint32 faction; uint32 flags; @@ -447,6 +448,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } void Whisper(int32 textId, uint64 receiver) { MonsterWhisper(textId,receiver); } + void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } // overwrite WorldObject function for proper name localization const char* GetNameForLocaleIdx(int32 locale_idx) const; diff --git a/src/game/Language.h b/src/game/Language.h index 3d8727d14..5aa4547f4 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -729,7 +729,10 @@ enum MangosStrings LANG_CHARACTER_DELETED = 1009, LANG_ACCOUNT_LIST_HEADER = 1010, LANG_ACCOUNT_LIST_ERROR = 1011, - // Room for more level 4 1012-1099 not used + LANG_ACCOUNT_LIST_BAR = 1012, + LANG_ACCOUNT_LIST_LINE = 1013, + LANG_ACCOUNT_LIST_EMPTY = 1014, + // Room for more level 4 1015-1099 not used // Level 3 (continue) LANG_ACCOUNT_SETADDON = 1100, @@ -755,7 +758,12 @@ enum MangosStrings LANG_YOU_CHANGE_GENDER = 1120, LANG_YOUR_GENDER_CHANGED = 1121, LANG_SKILL_VALUES = 1122, - // Room for more level 3 1123-1199 not used + LANG_NO_PET_FOUND = 1123, + LANG_WRONG_PET_TYPE = 1124, + LANG_COMMAND_LEARN_PET_TALENTS = 1125, + LANG_RESET_PET_TALENTS = 1126, + LANG_RESET_PET_TALENTS_ONLINE = 1127, + // Room for more level 3 1128-1199 not used // FREE IDS 1200-9999 diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 885846048..c630dedbf 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -2432,6 +2432,11 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args) float x = (float)atof(px); float y = (float)atof(py); + + // prevent accept wrong numeric args + if (x==0.0f && *px!='0' || y==0.0f && *py!='0') + return false; + uint32 areaid = cAreaId ? (uint32)atoi(cAreaId) : _player->GetZoneId(); AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaid); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index b8395c3be..575762c86 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -758,6 +758,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) arg2 = arg1; targetAccountId = targetPlayer->GetSession()->GetAccountId(); + accmgr.GetName(targetAccountId, targetAccountName); } else { @@ -791,7 +792,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) } /// can set security level only for target with less security and to less security that we have - /// This is also reject self apply in fact + /// This will reject self apply by specify account name if(HasLowerSecurityAccount(NULL,targetAccountId,true)) return false; @@ -804,7 +805,8 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) return false; } - if(targetPlayer) + // This will prevent self apply by self target or no target + if(targetPlayer && m_session->GetPlayer()!=targetPlayer) { ChatHandler(targetPlayer).PSendSysMessage(LANG_YOURS_SECURITY_CHANGED,GetNameLink().c_str(), gm); targetPlayer->GetSession()->SetSecurity(gm); @@ -1791,6 +1793,82 @@ bool ChatHandler::HandleLearnAllMyTalentsCommand(const char* /*args*/) return true; } +bool ChatHandler::HandleLearnAllMyPetTalentsCommand(const char* /*args*/) +{ + Player* player = m_session->GetPlayer(); + + Pet* pet = player->GetPet(); + if(!pet) + { + SendSysMessage(LANG_NO_PET_FOUND); + SetSentErrorMessage(true); + return false; + } + + CreatureInfo const *ci = pet->GetCreatureInfo(); + if(!ci) + { + SendSysMessage(LANG_WRONG_PET_TYPE); + SetSentErrorMessage(true); + return false; + } + + CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family); + if(!pet_family) + { + SendSysMessage(LANG_WRONG_PET_TYPE); + SetSentErrorMessage(true); + return false; + } + + if(pet_family->petTalentType < 0) // not hunter pet + { + SendSysMessage(LANG_WRONG_PET_TYPE); + SetSentErrorMessage(true); + return false; + } + + for (uint32 i = 0; i < sTalentStore.GetNumRows(); i++) + { + TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); + if(!talentInfo) + continue; + + TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab ); + if(!talentTabInfo) + continue; + + // prevent learn talent for different family (cheating) + if(((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask)==0) + continue; + + // search highest talent rank + uint32 spellid = 0; + + for(int rank = MAX_TALENT_RANK-1; rank >= 0; --rank) + { + if(talentInfo->RankID[rank]!=0) + { + spellid = talentInfo->RankID[rank]; + break; + } + } + + if(!spellid) // ??? none spells in talent + continue; + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid); + if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false)) + continue; + + // learn highest rank of talent and learn all non-talent spell ranks (recursive by tree) + pet->learnSpellHighRank(spellid); + } + + SendSysMessage(LANG_COMMAND_LEARN_PET_TALENTS); + return true; +} + bool ChatHandler::HandleLearnAllLangCommand(const char* /*args*/) { // skipping UNIVERSAL language (0) @@ -4644,9 +4722,9 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args) if (owner && owner->GetTypeId() == TYPEID_PLAYER) { player = (Player *)owner; - ChatHandler(player).SendSysMessage(LANG_RESET_TALENTS); + ChatHandler(player).SendSysMessage(LANG_RESET_PET_TALENTS); if(m_session->GetPlayer()!=player) - PSendSysMessage(LANG_RESET_TALENTS_ONLINE,GetNameLink(player).c_str()); + PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE,GetNameLink(player).c_str()); } return true; } diff --git a/src/game/Map.cpp b/src/game/Map.cpp index b6aa9337c..8c96febbc 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1619,6 +1619,8 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps) const } } +#include "World.h" + uint16 Map::GetAreaFlag(float x, float y, float z) const { uint16 areaflag; @@ -1646,7 +1648,13 @@ uint16 Map::GetAreaFlag(float x, float y, float z) const case 1593: case 2484: case 2492: - if( (x < 6116 && x > 5568) && (y < 982 && y > 282) && z > 563.0f) areaflag = 2153; break; + if (x > 5568.0f && x < 6116.0f && y > 282.0f && y < 982.0f && z > 563.0f) areaflag = 2153; break; + // Maw of Neltharion (cave) + case 164: // Dragonblight + case 1797: // Obsidian Dragonshrine (Dragonblight) + case 1827: // Wintergrasp + case 2591: // The Cauldron of Flames (Wintergrasp) + if (x > 4364.0f && x < 4632.0f && y > 1545.0f && y < 1886.0f && z < 200.0f) areaflag = 1853; break; } return areaflag; diff --git a/src/game/Object.cpp b/src/game/Object.cpp index a42494fa0..3ce45e648 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1179,6 +1179,10 @@ float WorldObject::GetAngle( const float x, const float y ) const bool WorldObject::HasInArc(const float arcangle, const WorldObject* obj) const { + // always have self in arc + if(obj == this) + return true; + float arc = arcangle; // move arc to range 0.. 2*pi @@ -1325,6 +1329,19 @@ void WorldObject::MonsterYell(int32 textId, uint32 language, uint64 TargetGuid) cell_lock->Visit(cell_lock, message, *GetMap()); } +void WorldObject::MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid) +{ + MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, textId,language,TargetGuid); + MaNGOS::LocalizedPacketDo say_do(say_build); + + uint32 zoneid = GetZoneId(); + + Map::PlayerList const& pList = GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + if(itr->getSource()->GetZoneId()==zoneid) + say_do(itr->getSource()); +} + void WorldObject::MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote) { CellPair p = MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY()); diff --git a/src/game/Object.h b/src/game/Object.h index 218dfd7f2..c1a4382d2 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -456,6 +456,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object void MonsterYell(int32 textId, uint32 language, uint64 TargetGuid); void MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false); void MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper = false); + void MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid); void BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 TargetGuid) const; void PlayDistanceSound(uint32 sound_id, Player* target = NULL); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index d699d3c60..34426115f 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1750,3 +1750,12 @@ void Pet::CastPetAura(PetAura const* aura) else CastSpell(this, auraId, true); } + +void Pet::learnSpellHighRank(uint32 spellid) +{ + learnSpell(spellid); + + SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext(); + for(SpellChainMapNext::const_iterator itr = nextMap.lower_bound(spellid); itr != nextMap.upper_bound(spellid); ++itr) + learnSpellHighRank(itr->second); +} diff --git a/src/game/Pet.h b/src/game/Pet.h index 47e0a65bf..7f43b0691 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -190,6 +190,7 @@ class Pet : public Creature bool addSpell(uint32 spell_id,uint16 active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, PetSpellType type = PETSPELL_NORMAL); bool learnSpell(uint32 spell_id); + void learnSpellHighRank(uint32 spellid); void learnLevelupSpells(); bool unlearnSpell(uint32 spell_id); bool removeSpell(uint32 spell_id); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 3b09f1cf6..ec485481f 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -128,7 +128,18 @@ PlayerTaxi::PlayerTaxi() void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint32 level) { - // capital and taxi hub masks + // class specific initial known nodes + switch(chrClass) + { + case CLASS_DEATH_KNIGHT: + { + for(int i = 0; i < TaxiMaskSize; ++i) + m_taximask[i] |= sOldContinentsNodesMask[i]; + break; + } + } + + // race specific initial known nodes: capital and taxi hub masks switch(race) { case RACE_HUMAN: SetTaximaskNode(2); break; // Human @@ -144,12 +155,6 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint32 leve case RACE_DRAENEI: SetTaximaskNode(94); break; // Draenei } - switch(chrClass) - { - case CLASS_DEATH_KNIGHT: // TODO: figure out initial known nodes - break; - } - // new continent starting masks (It will be accessible only at new map) switch(Player::TeamForRace(race)) { @@ -4490,9 +4495,7 @@ float Player::GetTotalBaseModValue(BaseModGroup modGroup) const uint32 Player::GetShieldBlockValue() const { - BaseModGroup modGroup = SHIELD_BLOCK_VALUE; - - float value = GetTotalBaseModValue(modGroup) + GetStat(STAT_STRENGTH) * 0.5f - 10; + float value = (m_auraBaseMod[SHIELD_BLOCK_VALUE][FLAT_MOD] + GetStat(STAT_STRENGTH) * 0.5f - 10)*m_auraBaseMod[SHIELD_BLOCK_VALUE][PCT_MOD]; value = (value < 0) ? 0 : value; @@ -4819,7 +4822,7 @@ bool Player::UpdateSkill(uint32 skill_id, uint32 step) new_value = max; SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i),MAKE_SKILL_VALUE(new_value,max)); - GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL); + GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL,skill_id); return true; } @@ -4958,7 +4961,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) break; } } - GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL); + GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL,SkillId); sLog.outDebug("Player::UpdateSkillPro Chance=%3.1f%% taken", Chance/10.0); return true; } @@ -5135,7 +5138,8 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal) { SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i),MAKE_SKILL_VALUE(currVal,maxVal)); learnSkillRewardedSpells(id, currVal); - GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL); + GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL,id); + GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL,id); } else //remove { @@ -5168,7 +5172,8 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal) else SetUInt32Value(PLAYER_SKILL_INDEX(i), MAKE_PAIR32(id,0)); SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i),MAKE_SKILL_VALUE(currVal,maxVal)); - GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL); + GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL,id); + GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL,id); // apply skill bonuses SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(i),0); @@ -18597,6 +18602,31 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim) return xp || honored_kill; } +void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource) +{ + uint64 creature_guid = pRewardSource->GetTypeId()==TYPEID_UNIT ? pRewardSource->GetGUID() : uint64(0); + + // prepare data for near group iteration + if(Group *pGroup = GetGroup()) + { + for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* pGroupGuy = itr->getSource(); + if(!pGroupGuy) + continue; + + if(!pGroupGuy->IsAtGroupRewardDistance(pRewardSource)) + continue; // member (alive or dead) or his corpse at req. distance + + // quest objectives updated only for alive group member or dead but with not released body + if(pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse()) + pGroupGuy->KilledMonster(creature_id, creature_guid); + } + } + else // if (!pGroup) + KilledMonster(creature_id, creature_guid); +} + bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const { if(pRewardSource->GetDistance(this) <= sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE)) diff --git a/src/game/Player.h b/src/game/Player.h index 9d248bb04..33a54a7a9 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1673,6 +1673,7 @@ class MANGOS_DLL_SPEC Player : public Unit bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const; bool RewardPlayerAndGroupAtKill(Unit* pVictim); + void RewardPlayerAndGroupAtEvent(uint32 creature_id,WorldObject* pRewardSource); bool isHonorOrXPTarget(Unit* pVictim); ReputationMgr& GetReputationMgr() { return m_reputationMgr; } diff --git a/src/game/PoolHandler.cpp b/src/game/PoolHandler.cpp index bd47c7b6a..bb2276a6d 100644 --- a/src/game/PoolHandler.cpp +++ b/src/game/PoolHandler.cpp @@ -699,7 +699,8 @@ uint16 PoolHandler::IsPartOfAPool(uint32 guid, uint32 type) // Method that check chance integrity of the creatures and gameobjects in this pool bool PoolHandler::CheckPool(uint16 pool_id) { - return mPoolGameobjectGroups[pool_id].CheckPool() && + return pool_id <= max_pool_id && + mPoolGameobjectGroups[pool_id].CheckPool() && mPoolCreatureGroups[pool_id].CheckPool() && mPoolPoolGroups[pool_id].CheckPool(); } diff --git a/src/game/PoolHandler.h b/src/game/PoolHandler.h index 747dae62e..35e18c2d5 100644 --- a/src/game/PoolHandler.h +++ b/src/game/PoolHandler.h @@ -20,6 +20,7 @@ #define MANGOS_POOLHANDLER_H #include "Platform/Define.h" +#include "Policies/Singleton.h" #include "Creature.h" #include "GameObject.h" diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 14fb7b443..8f105010a 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -227,9 +227,11 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) { std::string Name; + std::string IconName; std::string CastBarCaption; Name = info->name; + IconName = info->IconName; CastBarCaption = info->castBarCaption; int loc_idx = GetSessionDbLocaleIndex(); @@ -251,7 +253,7 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) data << uint32(info->displayId); data << Name; data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4 - data << uint8(0); // 2.0.3, string + data << IconName; // 2.0.3, string. Icon name to use instead of default icon for go's (ex: "Attack" makes sword) data << CastBarCaption; // 2.0.3, string. Text will appear in Cast Bar when using GO (ex: "Collecting") data << uint8(0); // 2.0.3, string data.append(info->raw.data, 24); diff --git a/src/game/ReputationMgr.cpp b/src/game/ReputationMgr.cpp index 15854fef9..62b9504da 100644 --- a/src/game/ReputationMgr.cpp +++ b/src/game/ReputationMgr.cpp @@ -444,7 +444,6 @@ void ReputationMgr::LoadFromDB(QueryResult *result) void ReputationMgr::SaveToDB() { - CharacterDatabase.BeginTransaction(); for(FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr) { if (itr->second.Changed) @@ -454,7 +453,6 @@ void ReputationMgr::SaveToDB() itr->second.Changed = false; } } - CharacterDatabase.CommitTransaction(); } void ReputationMgr::UpdateRankCounters( ReputationRank old_rank, ReputationRank new_rank ) diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index d493d0d1c..919982f12 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -347,7 +347,7 @@ enum ItemQualities #define SPELL_ATTR_EX4_UNK3 0x00000008 // 3 #define SPELL_ATTR_EX4_UNK4 0x00000010 // 4 This will no longer cause guards to attack on use?? #define SPELL_ATTR_EX4_UNK5 0x00000020 // 5 -#define SPELL_ATTR_EX4_UNK6 0x00000040 // 6 +#define SPELL_ATTR_EX4_NOT_STEALABLE 0x00000040 // 6 although such auras might be dispellable, they cannot be stolen #define SPELL_ATTR_EX4_UNK7 0x00000080 // 7 #define SPELL_ATTR_EX4_UNK8 0x00000100 // 8 #define SPELL_ATTR_EX4_UNK9 0x00000200 // 9 diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 1d5648b5b..e3b0f494e 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -593,6 +593,9 @@ void Spell::FillTargetMap() case SPELL_EFFECT_REPUTATION: if(m_targets.getUnitTarget()) tmpUnitMap.push_back(m_targets.getUnitTarget()); + // Triggered spells have additional spell targets - cast them even if no explicit unit target is given (required for spell 50516 for example) + else if(m_spellInfo->Effect[i] == SPELL_EFFECT_TRIGGER_SPELL) + tmpUnitMap.push_back(m_caster); break; case SPELL_EFFECT_SUMMON_PLAYER: if(m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection()) @@ -975,7 +978,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) // Get original caster (if exist) and calculate damage/healing from him data Unit *caster = m_originalCaster ? m_originalCaster : m_caster; - // Skip if m_originalCaster not avaiable + // Skip if m_originalCaster not available if (!caster) return; @@ -1067,17 +1070,21 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) caster->ProcDamageAndSpell(unit, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo); } - // Call scripted function for AI if this spell is casted upon a creature (except pets) - if(IS_CREATURE_GUID(target->targetGUID)) + // Call scripted function for AI if this spell is casted upon a creature + if(unit->GetTypeId()==TYPEID_UNIT) { // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) - // ignore autorepeat/melee casts for speed (not exist quest for spells (hm... ) - if( m_caster->GetTypeId() == TYPEID_PLAYER && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) + // ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... ) + if( !((Creature*)unit)->isPet() && m_caster->GetTypeId() == TYPEID_PLAYER && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) ((Player*)m_caster)->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id); if(((Creature*)unit)->AI()) ((Creature*)unit)->AI()->SpellHit(m_caster ,m_spellInfo); } + + // Call scripted function for AI if this spell is casted by a creature + if(m_caster->GetTypeId()==TYPEID_UNIT && ((Creature*)m_caster)->AI()) + ((Creature*)m_caster)->AI()->SpellHitTarget(unit,m_spellInfo); } void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) @@ -4745,8 +4752,9 @@ SpellCastResult Spell::CheckRange(bool strict) if(target && target != m_caster) { - // distance from target center in checks - float dist = m_caster->GetDistance(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ()); + // distance from target in checks + float dist = m_caster->GetCombatDistance(target); + if(dist > max_range) return SPELL_FAILED_OUT_OF_RANGE; //0x5A; if(dist < min_range) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 084dd3873..dcafd1030 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1253,6 +1253,7 @@ void Aura::HandleAddModifier(bool apply, bool Real) case 34754: // Clearcasting case 34936: // Backlash case 48108: // Hot Streak + case 51124: // Killing Machine case 54741: // Firestarter case 57761: // Fireball! SetAuraCharges(1); @@ -2257,7 +2258,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) mod->value = m_modifier.m_amount; mod->type = SPELLMOD_PCT; mod->spellId = GetId(); - mod->mask = 0x0000000200000000LL; + mod->mask = 0x0000200000000000LL; mod->mask2= 0LL; m_spellmod = mod; } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 3ae815c17..0f18b3d91 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -294,7 +294,7 @@ void Spell::EffectEnvirinmentalDMG(uint32 i) // Note: this hack with damage replace required until GO casting not implemented // environment damage spells already have around enemies targeting but this not help in case not existed GO casting support // currently each enemy selected explicitly and self cast damage, we prevent apply self casted spell bonuses/etc - damage = m_spellInfo->EffectBasePoints[i]+m_spellInfo->EffectBaseDice[i]; + damage = m_spellInfo->CalculateSimpleValue(i); m_caster->CalcAbsorbResist(m_caster,GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist); @@ -1056,7 +1056,7 @@ void Spell::EffectDummy(uint32 i) return; pCreature->SetHealth(health); - ((Player*)m_caster)->KilledMonster(16992,pCreature->GetGUID()); + ((Player*)m_caster)->RewardPlayerAndGroupAtEvent(16992,pCreature); if (pCreature->AI()) pCreature->AI()->AttackStart(m_caster); @@ -1107,6 +1107,24 @@ void Spell::EffectDummy(uint32 i) m_caster->CastSpell(m_caster, 30452, true, NULL); return; } + case 52308: + { + switch(i) + { + case 0: + { + uint32 spellID = m_spellInfo->CalculateSimpleValue(0); + uint32 reqAuraID = m_spellInfo->CalculateSimpleValue(1); + + if (m_caster->HasAura(reqAuraID,0)) + m_caster->CastSpell(m_caster,spellID,true,NULL); + return; + } + case 1: + return; // additional data for dummy[0] + } + return; + } case 53341: case 53343: { @@ -1114,21 +1132,8 @@ void Spell::EffectDummy(uint32 i) return; } case 58418: // Portal to Orgrimmar - { - if(!unitTarget) - return; - - unitTarget->CastSpell(unitTarget, 58419, true); - return; - } case 58420: // Portal to Stormwind - { - if(!unitTarget) - return; - - unitTarget->CastSpell(unitTarget, 58421, true); - return; - } + return; // implemented in EffectScript[0] } //All IconID Check in there @@ -1340,31 +1345,6 @@ void Spell::EffectDummy(uint32 i) m_caster->CastSpell(unitTarget, hurt, true, 0); return; } - switch(m_spellInfo->Id ) - { - case 28598: // Touch of Weakness triggered spell - { - if(!unitTarget || !m_triggeredByAuraSpell) - return; - - uint32 spellid = 0; - switch(m_triggeredByAuraSpell->Id) - { - case 2652: spellid = 2943; break; // Rank 1 - case 19261: spellid = 19249; break; // Rank 2 - case 19262: spellid = 19251; break; // Rank 3 - case 19264: spellid = 19252; break; // Rank 4 - case 19265: spellid = 19253; break; // Rank 5 - case 19266: spellid = 19254; break; // Rank 6 - case 25461: spellid = 25460; break; // Rank 7 - default: - sLog.outError("Spell::EffectDummy: Spell 28598 triggered by unhandeled spell %u",m_triggeredByAuraSpell->Id); - return; - } - m_caster->CastSpell(unitTarget, spellid, true, NULL); - return; - } - } break; case SPELLFAMILY_DRUID: // Starfall @@ -4285,11 +4265,9 @@ void Spell::EffectWeaponDmg(uint32 i) } // some spell specific modifiers - bool customBonusDamagePercentMod = false; bool spellBonusNeedWeaponDamagePercentMod = false; // if set applied weapon damage percent mode to spell bonus - float bonusDamagePercentMod = 1.0f; // applied to fixed effect damage bonus if set customBonusDamagePercentMod - float weaponDamagePercentMod = 1.0f; // applied to weapon damage (and to fixed effect damage bonus if customBonusDamagePercentMod not set + float weaponDamagePercentMod = 1.0f; // applied to weapon damage and to fixed effect damage bonus float totalDamagePercentMod = 1.0f; // applied to final bonus+weapon damage bool normalized = false; @@ -4328,14 +4306,8 @@ void Spell::EffectWeaponDmg(uint32 i) } case SPELLFAMILY_ROGUE: { - // Ambush - if(m_spellInfo->SpellFamilyFlags & 0x00000200LL) - { - customBonusDamagePercentMod = true; - bonusDamagePercentMod = 2.5f; // 250% - } // Mutilate (for each hand) - else if(m_spellInfo->SpellFamilyFlags & 0x600000000LL) + if(m_spellInfo->SpellFamilyFlags & 0x600000000LL) { bool found = false; // fast check @@ -4408,10 +4380,7 @@ void Spell::EffectWeaponDmg(uint32 i) weaponDamagePercentMod *= float(CalculateDamage(j,unitTarget)) / 100.0f; // applied only to prev.effects fixed damage - if(customBonusDamagePercentMod) - fixed_bonus = int32(fixed_bonus*bonusDamagePercentMod); - else - fixed_bonus = int32(fixed_bonus*weaponDamagePercentMod); + fixed_bonus = int32(fixed_bonus*weaponDamagePercentMod); break; default: break; // not weapon damage effect, just skip @@ -4875,6 +4844,20 @@ void Spell::EffectScriptEffect(uint32 effIndex) unitTarget->CastSpell(unitTarget, damage, false); break; } + case 58418: // Portal to Orgrimmar + case 58420: // Portal to Stormwind + { + if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || effIndex!=0) + return; + + uint32 spellID = m_spellInfo->CalculateSimpleValue(0); + uint32 questID = m_spellInfo->CalculateSimpleValue(1); + + if( ((Player*)unitTarget)->GetQuestStatus(questID) == QUEST_STATUS_COMPLETE && !((Player*)unitTarget)->GetQuestRewardStatus (questID) ) + unitTarget->CastSpell(unitTarget, spellID, true); + + return; + } // random spell learn instead placeholder case 60893: // Northrend Alchemy Research case 61177: // Northrend Inscription Research @@ -6454,7 +6437,7 @@ void Spell::EffectStealBeneficialBuff(uint32 i) if (aur && (1<GetSpellProto()->Dispel) & dispelMask) { // Need check for passive? this - if (aur->IsPositive() && !aur->IsPassive()) + if (aur->IsPositive() && !aur->IsPassive() && !(aur->GetSpellProto()->AttributesEx4 & SPELL_ATTR_EX4_NOT_STEALABLE)) steal_list.push_back(aur); } } @@ -6512,7 +6495,7 @@ void Spell::EffectKillCredit(uint32 i) if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - ((Player*)unitTarget)->KilledMonster(m_spellInfo->EffectMiscValue[i], 0); + ((Player*)unitTarget)->RewardPlayerAndGroupAtEvent(m_spellInfo->EffectMiscValue[i], unitTarget); } void Spell::EffectQuestFail(uint32 i) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 7ef35a593..7fd3d1a8d 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -122,7 +122,8 @@ int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, ui if (spellId_1 == spellId_2) return 0; int32 diff = spellInfo_1->EffectBasePoints[effIndex_1] - spellInfo_2->EffectBasePoints[effIndex_2]; - if (spellInfo_1->EffectBasePoints[effIndex_1]+1 < 0 && spellInfo_2->EffectBasePoints[effIndex_2]+1 < 0) return -diff; + if (spellInfo_1->CalculateSimpleValue(effIndex_1) < 0 && spellInfo_2->CalculateSimpleValue(effIndex_2) < 0) + return -diff; else return diff; } @@ -339,7 +340,7 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex) case SPELL_AURA_MOD_DAMAGE_DONE: // dependent from bas point sign (negative -> negative) case SPELL_AURA_MOD_HEALING_DONE: { - if(spellproto->EffectBasePoints[effIndex]+int32(spellproto->EffectBaseDice[effIndex]) < 0) + if(spellproto->CalculateSimpleValue(effIndex) < 0) return false; break; } @@ -437,7 +438,7 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex) switch(spellproto->EffectMiscValue[effIndex]) { case SPELLMOD_COST: // dependent from bas point sign (negative -> positive) - if(spellproto->EffectBasePoints[effIndex]+int32(spellproto->EffectBaseDice[effIndex]) > 0) + if(spellproto->CalculateSimpleValue(effIndex) > 0) return false; break; default: @@ -445,11 +446,11 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex) } } break; case SPELL_AURA_MOD_HEALING_PCT: - if(spellproto->EffectBasePoints[effIndex]+int32(spellproto->EffectBaseDice[effIndex]) < 0) + if(spellproto->CalculateSimpleValue(effIndex) < 0) return false; break; case SPELL_AURA_MOD_SKILL: - if(spellproto->EffectBasePoints[effIndex]+int32(spellproto->EffectBaseDice[effIndex]) < 0) + if(spellproto->CalculateSimpleValue(effIndex) < 0) return false; break; case SPELL_AURA_FORCE_REACTION: @@ -1774,10 +1775,10 @@ void SpellMgr::LoadSpellLearnSkills() SpellLearnSkillNode dbc_node; dbc_node.skill = entry->EffectMiscValue[i]; if ( dbc_node.skill != SKILL_RIDING ) - dbc_node.value = 1; + dbc_node.value = 1; else - dbc_node.value = (entry->EffectBasePoints[i]+1)*75; - dbc_node.maxvalue = (entry->EffectBasePoints[i]+1)*75; + dbc_node.value = entry->CalculateSimpleValue(i)*75; + dbc_node.maxvalue = entry->CalculateSimpleValue(i)*75; mSpellLearnSkills[spell] = dbc_node; ++dbc_count; @@ -2095,7 +2096,7 @@ void SpellMgr::LoadSpellPetAuras() continue; } - PetAura pa(pet, aura, spellInfo->EffectImplicitTargetA[i] == TARGET_PET, spellInfo->EffectBasePoints[i] + spellInfo->EffectBaseDice[i]); + PetAura pa(pet, aura, spellInfo->EffectImplicitTargetA[i] == TARGET_PET, spellInfo->CalculateSimpleValue(i)); mSpellPetAuraMap[spell] = pa; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 8b140e4b0..46cfbfb6c 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -2275,8 +2275,8 @@ bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const *spellProto, WeaponAtt ((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK ) return false; - float blockChance = GetUnitBlockChance(); - blockChance += (GetWeaponSkillValue(attackType) - pVictim->GetMaxSkillValueForLevel() )*0.04; + float blockChance = pVictim->GetUnitBlockChance(); + blockChance += (int32(GetWeaponSkillValue(attackType)) - int32(pVictim->GetMaxSkillValueForLevel()))*0.04f; if (roll_chance_f(blockChance)) return true; } @@ -6355,7 +6355,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB } // percent stored in effect 1 (class scripts) base points int32 cost = originalSpell->manaCost + originalSpell->ManaCostPercentage * GetCreateMana() / 100; - basepoints0 = cost*(auraSpellInfo->EffectBasePoints[1]+1)/100; + basepoints0 = cost*auraSpellInfo->CalculateSimpleValue(1)/100; trigger_spell_id = 20272; target = this; } @@ -7360,6 +7360,16 @@ Unit* Unit::GetCharm() const return NULL; } +float Unit::GetCombatDistance( const Unit* target ) const +{ + float radius = target->GetFloatValue(UNIT_FIELD_COMBATREACH) + GetFloatValue(UNIT_FIELD_COMBATREACH); + float dx = GetPositionX() - target->GetPositionX(); + float dy = GetPositionY() - target->GetPositionY(); + float dz = GetPositionZ() - target->GetPositionZ(); + float dist = sqrt((dx*dx) + (dy*dy) + (dz*dz)) - radius; + return ( dist > 0 ? dist : 0); +} + void Unit::SetPet(Pet* pet) { SetUInt64Value(UNIT_FIELD_SUMMON, pet ? pet->GetGUID() : 0); @@ -7680,8 +7690,8 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 DotTicks = DotDuration / spellProto->EffectAmplitude[x]; if(DotTicks) { - DoneAdvertisedBenefit /= DotTicks*int32(stack); - TakenAdvertisedBenefit /= DotTicks*int32(stack); + DoneAdvertisedBenefit = DoneAdvertisedBenefit * int32(stack) / DotTicks; + TakenAdvertisedBenefit = TakenAdvertisedBenefit * int32(stack) / DotTicks; } } } @@ -8098,8 +8108,8 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint DotTicks = DotDuration / spellProto->EffectAmplitude[x]; if(DotTicks) { - DoneAdvertisedBenefit /= DotTicks*int32(stack); - TakenAdvertisedBenefit /= DotTicks*int32(stack); + DoneAdvertisedBenefit = DoneAdvertisedBenefit * int32(stack) / DotTicks; + TakenAdvertisedBenefit = TakenAdvertisedBenefit * int32(stack) / DotTicks; } } } diff --git a/src/game/Unit.h b/src/game/Unit.h index 0c618a4d9..19f54195c 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1113,6 +1113,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject return this; } Player* GetCharmerOrOwnerPlayerOrPlayerItself(); + float GetCombatDistance( const Unit* target ) const; void SetPet(Pet* pet); void SetCharm(Unit* pet); diff --git a/src/game/WaypointManager.h b/src/game/WaypointManager.h index 0f155ad41..54f2fec82 100644 --- a/src/game/WaypointManager.h +++ b/src/game/WaypointManager.h @@ -22,6 +22,7 @@ #include #include #include "Utilities/UnorderedMap.h" +#include "Policies/Singleton.h" #define MAX_WAYPOINT_TEXT 5 struct WaypointBehavior diff --git a/src/game/World.cpp b/src/game/World.cpp index 0adec7ac1..a64a68698 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -75,16 +75,6 @@ float World::m_MaxVisibleDistanceInFlight = DEFAULT_VISIBILITY_DISTANCE; float World::m_VisibleUnitGreyDistance = 0; float World::m_VisibleObjectGreyDistance = 0; -// ServerMessages.dbc -enum ServerMessageType -{ - SERVER_MSG_SHUTDOWN_TIME = 1, - SERVER_MSG_RESTART_TIME = 2, - SERVER_MSG_STRING = 3, - SERVER_MSG_SHUTDOWN_CANCELLED = 4, - SERVER_MSG_RESTART_CANCELLED = 5 -}; - struct ScriptAction { uint64 sourceGUID; @@ -2640,7 +2630,7 @@ void World::ShutdownMsg(bool show, Player* player) { std::string str = secsToTimeString(m_ShutdownTimer); - uint32 msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_TIME : SERVER_MSG_SHUTDOWN_TIME; + ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_TIME : SERVER_MSG_SHUTDOWN_TIME; SendServerMessage(msgid,str.c_str(),player); DEBUG_LOG("Server is %s in %s",(m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"),str.c_str()); @@ -2654,7 +2644,7 @@ void World::ShutdownCancel() if(!m_ShutdownTimer || m_stopEvent) return; - uint32 msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_CANCELLED : SERVER_MSG_SHUTDOWN_CANCELLED; + ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_CANCELLED : SERVER_MSG_SHUTDOWN_CANCELLED; m_ShutdownMask = 0; m_ShutdownTimer = 0; @@ -2665,7 +2655,7 @@ void World::ShutdownCancel() } /// Send a server message to the user(s) -void World::SendServerMessage(uint32 type, const char *text, Player* player) +void World::SendServerMessage(ServerMessageType type, const char *text, Player* player) { WorldPacket data(SMSG_SERVER_MESSAGE, 50); // guess size data << uint32(type); diff --git a/src/game/World.h b/src/game/World.h index ef2d99426..cfd99a78d 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -43,6 +43,16 @@ class SqlResultQueue; class QueryResult; class WorldSocket; +// ServerMessages.dbc +enum ServerMessageType +{ + SERVER_MSG_SHUTDOWN_TIME = 1, + SERVER_MSG_RESTART_TIME = 2, + SERVER_MSG_STRING = 3, + SERVER_MSG_SHUTDOWN_CANCELLED = 4, + SERVER_MSG_RESTART_CANCELLED = 5 +}; + enum ShutdownMask { SHUTDOWN_MASK_RESTART = 1, @@ -423,7 +433,7 @@ class World void SendGlobalMessage(WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); void SendZoneMessage(uint32 zone, WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); void SendZoneText(uint32 zone, const char *text, WorldSession *self = 0, uint32 team = 0); - void SendServerMessage(uint32 type, const char *text = "", Player* player = NULL); + void SendServerMessage(ServerMessageType type, const char *text = "", Player* player = NULL); /// Are we in the middle of a shutdown? bool IsShutdowning() const { return m_ShutdownTimer > 0; } diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp index 7575b0dad..a1d20bbdf 100644 --- a/src/mangosd/CliRunnable.cpp +++ b/src/mangosd/CliRunnable.cpp @@ -166,12 +166,15 @@ bool ChatHandler::HandleAccountOnlineListCommand(const char* args) ///- Get the list of accounts ID logged to the realm QueryResult *resultDB = CharacterDatabase.Query("SELECT name,account FROM characters WHERE online > 0"); if (!resultDB) + { + SendSysMessage(LANG_ACCOUNT_LIST_EMPTY); return true; + } ///- Display the list of account/characters online - SendSysMessage("====================================================================="); + SendSysMessage(LANG_ACCOUNT_LIST_BAR); SendSysMessage(LANG_ACCOUNT_LIST_HEADER); - SendSysMessage("====================================================================="); + SendSysMessage(LANG_ACCOUNT_LIST_BAR); ///- Circle through accounts do @@ -188,7 +191,7 @@ bool ChatHandler::HandleAccountOnlineListCommand(const char* args) if(resultLogin) { Field *fieldsLogin = resultLogin->Fetch(); - PSendSysMessage("|%15s| %20s | %15s |%4d|%5d|", + PSendSysMessage(LANG_ACCOUNT_LIST_LINE, fieldsLogin[0].GetString(),name.c_str(),fieldsLogin[1].GetString(),fieldsLogin[2].GetUInt32(),fieldsLogin[3].GetUInt32()); delete resultLogin; @@ -200,7 +203,7 @@ bool ChatHandler::HandleAccountOnlineListCommand(const char* args) delete resultDB; - SendSysMessage("====================================================================="); + SendSysMessage(LANG_ACCOUNT_LIST_BAR); return true; } diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp index 144b9dce1..ecc591a49 100644 --- a/src/shared/Database/SQLStorage.cpp +++ b/src/shared/Database/SQLStorage.cpp @@ -31,8 +31,8 @@ const char CreatureDataAddonInfofmt[]="iiiiiiis"; const char CreatureModelfmt[]="iffbi"; const char CreatureInfoAddonInfofmt[]="iiiiiiis"; const char EquipmentInfofmt[]="iiii"; -const char GameObjectInfosrcfmt[]="iiissiifiiiiiiiiiiiiiiiiiiiiiiiis"; -const char GameObjectInfodstfmt[]="iiissiifiiiiiiiiiiiiiiiiiiiiiiiii"; +const char GameObjectInfosrcfmt[]="iiisssiifiiiiiiiiiiiiiiiiiiiiiiiis"; +const char GameObjectInfodstfmt[]="iiisssiifiiiiiiiiiiiiiiiiiiiiiiiii"; const char ItemPrototypesrcfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiisiiii"; const char ItemPrototypedstfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiii"; const char PageTextfmt[]="isi"; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6b2099499..41b7460fe 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7552" + #define REVISION_NR "7590" #endif // __REVISION_NR_H__