diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 0630f734b77..b8f6e9acef4 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -219,8 +219,14 @@ spell_scripts * data_flags = flag_original_source_as_target = 0x02 flag_buddy_as_target = 0x04 (When this flag is not set, buddy will be the attacker when buddy is defined) - - - - - +27 SCRIPT_COMMAND_GO_LOCK_STATE source or target must be WorldObject + * datalong = flag_go_lock = 0x01, flag_go_unlock = 0x02, + flag_go_nonInteract = 0x04, flag_go_interact = 0x08 + * datalong2 = go entry (searching closest to source (if worldobject) or target + * datalong3 = go search radius + +28 SCRIPT_COMMAND_STAND_STATE source = Unit (or WorldObject when creature entry defined), target = Unit (or none) + * datalong = stand state (enum UnitStandStateType) + * datalong2 = creature entry (searching for a buddy, closest to source) + * datalong3 = creature search radius + * data_flags = flag_target_as_source = 0x01 diff --git a/sql/characters.sql b/sql/characters.sql index 8f216a70126..8db2366c989 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_11436_01_characters_character_queststatus` bit(1) default NULL + `required_11620_01_characters_character_equipmentsets` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; -- @@ -462,25 +462,26 @@ CREATE TABLE `character_equipmentsets` ( `setindex` tinyint(4) NOT NULL default '0', `name` varchar(100) NOT NULL, `iconname` varchar(100) NOT NULL, - `item0` int(11) NOT NULL default '0', - `item1` int(11) NOT NULL default '0', - `item2` int(11) NOT NULL default '0', - `item3` int(11) NOT NULL default '0', - `item4` int(11) NOT NULL default '0', - `item5` int(11) NOT NULL default '0', - `item6` int(11) NOT NULL default '0', - `item7` int(11) NOT NULL default '0', - `item8` int(11) NOT NULL default '0', - `item9` int(11) NOT NULL default '0', - `item10` int(11) NOT NULL default '0', - `item11` int(11) NOT NULL default '0', - `item12` int(11) NOT NULL default '0', - `item13` int(11) NOT NULL default '0', - `item14` int(11) NOT NULL default '0', - `item15` int(11) NOT NULL default '0', - `item16` int(11) NOT NULL default '0', - `item17` int(11) NOT NULL default '0', - `item18` int(11) NOT NULL default '0', + `ignore_mask` int(11) unsigned NOT NULL default '0', + `item0` int(11) unsigned NOT NULL default '0', + `item1` int(11) unsigned NOT NULL default '0', + `item2` int(11) unsigned NOT NULL default '0', + `item3` int(11) unsigned NOT NULL default '0', + `item4` int(11) unsigned NOT NULL default '0', + `item5` int(11) unsigned NOT NULL default '0', + `item6` int(11) unsigned NOT NULL default '0', + `item7` int(11) unsigned NOT NULL default '0', + `item8` int(11) unsigned NOT NULL default '0', + `item9` int(11) unsigned NOT NULL default '0', + `item10` int(11) unsigned NOT NULL default '0', + `item11` int(11) unsigned NOT NULL default '0', + `item12` int(11) unsigned NOT NULL default '0', + `item13` int(11) unsigned NOT NULL default '0', + `item14` int(11) unsigned NOT NULL default '0', + `item15` int(11) unsigned NOT NULL default '0', + `item16` int(11) unsigned NOT NULL default '0', + `item17` int(11) unsigned NOT NULL default '0', + `item18` int(11) unsigned NOT NULL default '0', PRIMARY KEY (`setguid`), UNIQUE KEY `idx_set` (`guid`,`setguid`,`setindex`), INDEX `Idx_setindex` (`setindex`) diff --git a/sql/mangos.sql b/sql/mangos.sql index aee7b60fdff..8d7c432d613 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_11530_01_mangos_spell_proc_event` bit(1) default NULL + `required_11613_01_mangos_spell_bonus_data` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -649,6 +649,7 @@ INSERT INTO `command` VALUES ('lookup taxinode',3,'Syntax: .lookup taxinode $substring\r\n\r\nSearch and output all taxinodes with provide $substring in name.'), ('lookup tele',1,'Syntax: .lookup tele $substring\r\n\r\nSearch and output all .tele command locations with provide $substring in name.'), ('lookup title',2,'Syntax: .lookup title $$namepart\r\n\r\nLooks up a title by $namepart, and returns all matches with their title ID\'s and index\'s.'), +('mailbox',3,'Syntax: .mailbox\r\n\r\nShow your mailbox content.'), ('maxskill',3,'Syntax: .maxskill\r\nSets all skills of the targeted player to their maximum VALUESfor its current level.'), ('modify arena',1,'Syntax: .modify arena #value\r\nAdd $amount arena points to the selected player.'), ('modify aspeed',1,'Syntax: .modify aspeed #rate\r\n\r\nModify all speeds -run,swim,run back,swim back- of the selected player to \"normalbase speed for this move type\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 10.'), @@ -3553,7 +3554,7 @@ INSERT INTO `mangos_string` VALUES (536,' Home movement used for player?!?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (537,' Taxi flight',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (538,' Unknown movement generator (%u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(539,'Player selected NPC\nGUID: %u.\nFaction: %u.\nnpcFlags: %u.\nEntry: %u.\nDisplayID: %u (Native: %u).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(539,'Player selected: %s.\nFaction: %u.\nnpcFlags: %u.\nEntry: %u.\nDisplayID: %u (Native: %u).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (540,'Level: %u.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (541,'Health (base): %u. (max): %u. (current): %u.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (542,'Unit Flags: %u.\nDynamic Flags: %u.\nFaction Template: %u.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), @@ -3860,7 +3861,7 @@ INSERT INTO `mangos_string` VALUES (1167,'Scripting library has wrong list functions (outdated?).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1168,'Scripting library reloaded.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1169,'Scripting library build for different mangosd revision.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(1170,'Player selected NPC\nGUID: %u.\nFaction: %u.\nnpcFlags: %u.\nBase Entry: %u, Spawned Entry %u (Difficulty %u).\nDisplayID: %u (Native: %u).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1170,'Player selected: %s.\nFaction: %u.\nnpcFlags: %u.\nBase Entry: %u, Spawned Entry %u (Difficulty %u).\nDisplayID: %u (Native: %u).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1200,'You try to view cinemitic %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1201,'You try to view movie %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1202,'Spell %u %s = %f (*1.88 = %f) DB = %f AP = %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), @@ -14550,8 +14551,8 @@ INSERT INTO `spell_bonus_data` VALUES (9007, 0, 0, 0, 0.03, 'Druid - Pounce Bleed'), (1822, 0, 0, 0, 0.06, 'Druid - Rake'), (8936, 0.539, 0.188, 0, 0, 'Druid - Regrowth'), -(50288, 0.05, 0, 0, 0, 'Druid - Starfall'), -(50294, 0.012, 0, 0, 0, 'Druid - Starfall AOE'), +(50288, 0.3, 0, 0, 0, 'Druid - Starfall'), +(50294, 0.13, 0, 0, 0, 'Druid - Starfall AOE'), (18562, 0, 0, 0, 0, 'Druid - Swiftmend'), (44203, 0.538, 0, 0, 0, 'Druid - Tranquility Triggered'), (48438, 0, 0.11505, 0, 0, 'Druid - Wild Growth'), @@ -16829,6 +16830,7 @@ INSERT INTO `spell_elixir` VALUES (60346,0x1), (60347,0x2), (62380,0x3), +(63729,0x1), (67016,0x3), (67017,0x3), (67018,0x3), @@ -17068,6 +17070,7 @@ INSERT INTO `spell_proc_event` VALUES (17106, 0x00, 7, 0x00080000, 0x00080000, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (17364, 0x08, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (17495, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(17767, 0x00, 5, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00080000, 0x00040000, 0.000000, 0.000000, 0), (17793, 0x00, 5, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (18094, 0x00, 5, 0x0000000A, 0x0000000A, 0x0000000A, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (18096, 0x00, 5, 0x00000100, 0x00000100, 0x00000100, 0x00800000, 0x00800000, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), @@ -17136,6 +17139,7 @@ INSERT INTO `spell_proc_event` VALUES (28719, 0x00, 7, 0x00000020, 0x00000020, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (28744, 0x00, 7, 0x00000040, 0x00000040, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00044000, 0x00000000, 0.000000, 0.000000, 0), (28752, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(28761, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (28789, 0x00, 10, 0xC0000000, 0xC0000000, 0xC0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (28802, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (28809, 0x00, 6, 0x00001000, 0x00001000, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), @@ -17449,6 +17453,7 @@ INSERT INTO `spell_proc_event` VALUES (54821, 0x00, 7, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0.000000, 0.000000, 0), (54838, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (54841, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 3), +(54925, 0x00, 10, 0x00000000, 0x00000000, 0x00000000, 0x00000200, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (54937, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (54939, 0x00, 10, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (55166, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), @@ -17493,7 +17498,7 @@ INSERT INTO `spell_proc_event` VALUES (58644, 0x00, 15, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (58647, 0x00, 15, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (58677, 0x00, 15, 0x00002000, 0x00002000, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(58872, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(58872, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000043, 0.000000, 0.000000, 0), (58901, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), (59176, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (59327, 0x00, 15, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), @@ -17567,6 +17572,9 @@ INSERT INTO `spell_proc_event` VALUES (64976, 0x00, 4, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), (65661, 0x00, 15, 0x00400011 ,0x00400011, 0x00400011, 0x20020004, 0x20020004, 0x20020004, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0.000000, 100.000000,0), (64127, 0x00, 6, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(64914, 0x00, 8, 0x00000000, 0x00000000, 0x00000000, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(66808, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0.000000, 0.000000, 0), +(67151, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (67228, 0x04, 11, 0x00000000, 0x00000000, 0x00000000, 0x00001000, 0x00001000, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (67353, 0x00, 7, 0x00008000, 0x00008000, 0x00008000, 0x00100500, 0x00100500, 0x00100500, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (67356, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0.000000, 0.000000, 5), @@ -17583,6 +17591,7 @@ INSERT INTO `spell_proc_event` VALUES (67672, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 50), (67702, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (67771, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(68160, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0.000000, 0.000000, 0), (69739, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (69755, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (70652, 0x00, 15, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), diff --git a/sql/updates/11549_01_mangos_spell_proc_event.sql b/sql/updates/11549_01_mangos_spell_proc_event.sql new file mode 100644 index 00000000000..201171d1a3f --- /dev/null +++ b/sql/updates/11549_01_mangos_spell_proc_event.sql @@ -0,0 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_11530_01_mangos_spell_proc_event required_11549_01_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE entry = 58872; +INSERT INTO `spell_proc_event` VALUE +(58872, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000043, 0.000000, 0.000000, 0); diff --git a/sql/updates/11560_01_mangos_command.sql b/sql/updates/11560_01_mangos_command.sql new file mode 100644 index 00000000000..0659af83c2d --- /dev/null +++ b/sql/updates/11560_01_mangos_command.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_11549_01_mangos_spell_proc_event required_11560_01_mangos_command bit; + +DELETE FROM command WHERE name = 'mailbox'; + +INSERT INTO command (name, security, help) VALUES +('mailbox',3,'Syntax: .mailbox\r\n\r\nShow your mailbox content.'); diff --git a/sql/updates/11565_01_mangos_mangos_string.sql b/sql/updates/11565_01_mangos_mangos_string.sql new file mode 100644 index 00000000000..f597da7c655 --- /dev/null +++ b/sql/updates/11565_01_mangos_mangos_string.sql @@ -0,0 +1,7 @@ +ALTER TABLE db_version CHANGE COLUMN required_11560_01_mangos_command required_11565_01_mangos_mangos_string bit; + +DELETE FROM mangos_string WHERE entry IN (1170,539); + +INSERT INTO mangos_string VALUES +(539,'Player selected: %s.\nFaction: %u.\nnpcFlags: %u.\nEntry: %u.\nDisplayID: %u (Native: %u).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1170,'Player selected: %s.\nFaction: %u.\nnpcFlags: %u.\nBase Entry: %u, Spawned Entry %u (Difficulty %u).\nDisplayID: %u (Native: %u).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/11567_01_mangos_spell_proc_event.sql b/sql/updates/11567_01_mangos_spell_proc_event.sql new file mode 100644 index 00000000000..9f1f2a3d0f3 --- /dev/null +++ b/sql/updates/11567_01_mangos_spell_proc_event.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_11565_01_mangos_mangos_string required_11567_01_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE entry IN (66808, 68160); +INSERT INTO `spell_proc_event` VALUE +(66808, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0.000000, 0.000000, 0), +(68160, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/11595_09_mangos_spell_elixir.sql b/sql/updates/11595_09_mangos_spell_elixir.sql new file mode 100644 index 00000000000..548c5f3b668 --- /dev/null +++ b/sql/updates/11595_09_mangos_spell_elixir.sql @@ -0,0 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_11567_01_mangos_spell_proc_event required_11595_09_mangos_spell_elixir bit; + +DELETE FROM spell_elixir WHERE entry='63729'; +INSERT INTO spell_elixir VALUES +(63729,0x1); diff --git a/sql/updates/11597_01_mangos_spell_proc_event.sql b/sql/updates/11597_01_mangos_spell_proc_event.sql new file mode 100644 index 00000000000..f4b69229130 --- /dev/null +++ b/sql/updates/11597_01_mangos_spell_proc_event.sql @@ -0,0 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_11595_09_mangos_spell_elixir required_11597_01_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE entry IN (17767); +INSERT INTO `spell_proc_event` VALUE +(17767, 0x00, 5, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00080000, 0x00040000, 0.000000, 0.000000, 0); diff --git a/sql/updates/11598_01_mangos_spell_proc_event.sql b/sql/updates/11598_01_mangos_spell_proc_event.sql new file mode 100644 index 00000000000..81f0b979330 --- /dev/null +++ b/sql/updates/11598_01_mangos_spell_proc_event.sql @@ -0,0 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_11597_01_mangos_spell_proc_event required_11598_01_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE entry IN (64914); +INSERT INTO `spell_proc_event` VALUE +(64914, 0x00, 8, 0x00000000, 0x00000000, 0x00000000, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/11599_01_mangos_spell_proc_event.sql b/sql/updates/11599_01_mangos_spell_proc_event.sql new file mode 100644 index 00000000000..c8249351104 --- /dev/null +++ b/sql/updates/11599_01_mangos_spell_proc_event.sql @@ -0,0 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_11598_01_mangos_spell_proc_event required_11599_01_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE `entry` IN (67151); +INSERT INTO `spell_proc_event` VALUES +(67151, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/11602_01_mangos_spell_proc_event.sql b/sql/updates/11602_01_mangos_spell_proc_event.sql new file mode 100644 index 00000000000..29af28722ba --- /dev/null +++ b/sql/updates/11602_01_mangos_spell_proc_event.sql @@ -0,0 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_11599_01_mangos_spell_proc_event required_11602_01_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE `entry` IN (54925); +INSERT INTO `spell_proc_event` VALUES +(54925, 0x00, 10, 0x00000000, 0x00000000, 0x00000000, 0x00000200, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/11606_01_mangos_spell_proc_event.sql b/sql/updates/11606_01_mangos_spell_proc_event.sql new file mode 100644 index 00000000000..d56fecbc216 --- /dev/null +++ b/sql/updates/11606_01_mangos_spell_proc_event.sql @@ -0,0 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_11602_01_mangos_spell_proc_event required_11606_01_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE `entry` IN (28761); +INSERT INTO `spell_proc_event` VALUES +(28761, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/11613_01_mangos_spell_bonus_data.sql b/sql/updates/11613_01_mangos_spell_bonus_data.sql new file mode 100644 index 00000000000..36622969b94 --- /dev/null +++ b/sql/updates/11613_01_mangos_spell_bonus_data.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_11606_01_mangos_spell_proc_event required_11613_01_mangos_spell_bonus_data bit; + +DELETE FROM spell_bonus_data WHERE entry IN (50288,50294); +INSERT INTO spell_bonus_data VALUES +(50288, 0.3, 0, 0, 0, 'Druid - Starfall'), +(50294, 0.13, 0, 0, 0, 'Druid - Starfall AOE'); diff --git a/sql/updates/11620_01_characters_character_equipmentsets.sql b/sql/updates/11620_01_characters_character_equipmentsets.sql new file mode 100644 index 00000000000..5739e964f55 --- /dev/null +++ b/sql/updates/11620_01_characters_character_equipmentsets.sql @@ -0,0 +1,24 @@ +ALTER TABLE character_db_version CHANGE COLUMN required_11436_01_characters_character_queststatus required_11620_01_characters_character_equipmentsets bit; + +ALTER TABLE character_equipmentsets + MODIFY COLUMN item0 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item1 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item2 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item3 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item4 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item5 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item6 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item7 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item8 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item9 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item10 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item11 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item12 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item13 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item14 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item15 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item16 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item17 int(11) unsigned NOT NULL DEFAULT 0, + MODIFY COLUMN item18 int(11) unsigned NOT NULL DEFAULT 0; + +ALTER TABLE character_equipmentsets ADD COLUMN ignore_mask int(11) unsigned NOT NULL DEFAULT 0 AFTER iconname; diff --git a/src/framework/Dynamic/ObjectRegistry.h b/src/framework/Dynamic/ObjectRegistry.h index 25c4721c86a..156a4837437 100644 --- a/src/framework/Dynamic/ObjectRegistry.h +++ b/src/framework/Dynamic/ObjectRegistry.h @@ -43,12 +43,12 @@ class MANGOS_DLL_DECL ObjectRegistry } /// Inserts a registry item - bool InsertItem(T *obj, Key key, bool override = false) + bool InsertItem(T *obj, Key key, bool replace = false) { typename RegistryMapType::iterator iter = i_registeredObjects.find(key); if( iter != i_registeredObjects.end() ) { - if( !override ) + if( !replace ) return false; delete iter->second; i_registeredObjects.erase(iter); diff --git a/src/framework/Platform/Define.h b/src/framework/Platform/Define.h index 3110a34e70b..d3f85c691b3 100644 --- a/src/framework/Platform/Define.h +++ b/src/framework/Platform/Define.h @@ -119,6 +119,12 @@ typedef uint16 WORD; typedef uint32 DWORD; #endif //COMPILER +#if COMPILER == COMPILER_GNU +# if !defined(__GXX_EXPERIMENTAL_CXX0X__) || (__GNUC__ < 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ < 7) +# define override +# endif +#endif + typedef uint64 OBJECT_HANDLE; #endif //MANGOS_DEFINE_H diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 73a0068d727..2b9b9b5a540 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -2216,9 +2216,9 @@ AchievementCriteriaEntryList const& AchievementGlobalMgr::GetAchievementCriteria void AchievementGlobalMgr::LoadAchievementCriteriaList() { - if(sAchievementCriteriaStore.GetNumRows()==0) + if (sAchievementCriteriaStore.GetNumRows()==0) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -2226,7 +2226,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() return; } - barGoLink bar( sAchievementCriteriaStore.GetNumRows() ); + BarGoLink bar(sAchievementCriteriaStore.GetNumRows()); for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId) { bar.step(); @@ -2249,7 +2249,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() { if(sAchievementStore.GetNumRows()==0) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -2258,13 +2258,13 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() } uint32 count = 0; - barGoLink bar( sAchievementStore.GetNumRows() ); + BarGoLink bar(sAchievementStore.GetNumRows()); for (uint32 entryId = 0; entryId < sAchievementStore.GetNumRows(); ++entryId) { bar.step(); AchievementEntry const* achievement = sAchievementStore.LookupEntry(entryId); - if(!achievement || !achievement->refAchievement) + if (!achievement || !achievement->refAchievement) continue; m_AchievementListByReferencedId[achievement->refAchievement].push_back(achievement); @@ -2272,7 +2272,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() } sLog.outString(); - sLog.outString(">> Loaded %u achievement references.",count); + sLog.outString(">> Loaded %u achievement references.", count); } void AchievementGlobalMgr::LoadAchievementCriteriaRequirements() @@ -2281,9 +2281,9 @@ void AchievementGlobalMgr::LoadAchievementCriteriaRequirements() QueryResult *result = WorldDatabase.Query("SELECT criteria_id, type, value1, value2 FROM achievement_criteria_requirement"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -2293,7 +2293,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaRequirements() uint32 count = 0; uint32 disabled_count = 0; - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { bar.step(); @@ -2410,9 +2410,9 @@ void AchievementGlobalMgr::LoadCompletedAchievements() { QueryResult *result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -2420,14 +2420,14 @@ void AchievementGlobalMgr::LoadCompletedAchievements() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { bar.step(); Field *fields = result->Fetch(); uint32 achievement_id = fields[0].GetUInt32(); - if(!sAchievementStore.LookupEntry(achievement_id)) + if (!sAchievementStore.LookupEntry(achievement_id)) { // we will remove nonexistent achievement for all characters sLog.outError("Nonexistent achievement %u data removed from table `character_achievement`.",achievement_id); @@ -2451,9 +2451,9 @@ void AchievementGlobalMgr::LoadRewards() // 0 1 2 3 4 5 6 7 QueryResult *result = WorldDatabase.Query("SELECT entry, gender, title_A, title_H, item, sender, subject, text FROM achievement_reward"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -2463,7 +2463,7 @@ void AchievementGlobalMgr::LoadRewards() } uint32 count = 0; - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -2582,9 +2582,9 @@ void AchievementGlobalMgr::LoadRewardLocales() QueryResult *result = WorldDatabase.Query("SELECT entry,gender,subject_loc1,text_loc1,subject_loc2,text_loc2,subject_loc3,text_loc3,subject_loc4,text_loc4,subject_loc5,text_loc5,subject_loc6,text_loc6,subject_loc7,text_loc7,subject_loc8,text_loc8 FROM locales_achievement_reward"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -2593,7 +2593,7 @@ void AchievementGlobalMgr::LoadRewardLocales() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -2602,7 +2602,7 @@ void AchievementGlobalMgr::LoadRewardLocales() uint32 entry = fields[0].GetUInt32(); - if(m_achievementRewards.find(entry)==m_achievementRewards.end()) + if (m_achievementRewards.find(entry)==m_achievementRewards.end()) { sLog.outErrorDb( "Table `locales_achievement_reward` (Entry: %u) has locale strings for nonexistent achievement reward .", entry); continue; diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index d671bf37286..7013e89f7e1 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -291,14 +291,14 @@ void AuctionHouseMgr::LoadAuctionItems() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); sLog.outString(">> Loaded 0 auction items"); return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); uint32 count = 0; @@ -342,7 +342,7 @@ void AuctionHouseMgr::LoadAuctions() QueryResult *result = CharacterDatabase.Query("SELECT COUNT(*) FROM auction"); if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); sLog.outString(">> Loaded 0 auctions. DB table `auction` is empty."); @@ -355,7 +355,7 @@ void AuctionHouseMgr::LoadAuctions() if (!AuctionCount) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); sLog.outString(">> Loaded 0 auctions. DB table `auction` is empty."); @@ -365,14 +365,14 @@ void AuctionHouseMgr::LoadAuctions() result = CharacterDatabase.Query("SELECT id,houseid,itemguid,item_template,itemowner,buyoutprice,time,moneyTime,buyguid,lastbid,startbid,deposit FROM auction"); if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); sLog.outString(">> Loaded 0 auctions. DB table `auction` is empty."); return; } - barGoLink bar(AuctionCount); + BarGoLink bar(AuctionCount); typedef std::map PlayerNames; PlayerNames playerNames; // caching for load time diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index e8cdc90a192..f036f8b00f9 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1484,9 +1484,8 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI //for arenas there is random map used if (bg_template->isArena()) { - BattleGroundTypeId arenas[] = {BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL}; - uint32 arena_num = urand(0,2); - bgTypeId = arenas[arena_num]; + BattleGroundTypeId arenas[] = { BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL/*, BATTLEGROUND_DS, BATTLEGROUND_RV*/ }; + bgTypeId = arenas[urand(0, countof(arenas)-1)]; bg_template = GetBattleGroundTemplate(bgTypeId); if (!bg_template) { @@ -1613,7 +1612,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -1622,7 +1621,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -1867,10 +1866,18 @@ void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId, BattleGr bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId) { - return ( bgTypeId == BATTLEGROUND_AA || - bgTypeId == BATTLEGROUND_BE || - bgTypeId == BATTLEGROUND_NA || - bgTypeId == BATTLEGROUND_RL ); + switch(bgTypeId) + { + case BATTLEGROUND_NA: + case BATTLEGROUND_BE: + case BATTLEGROUND_RL: + case BATTLEGROUND_DS: + case BATTLEGROUND_RV: + case BATTLEGROUND_AA: + return true; + default: + return false; + }; } BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, ArenaType arenaType) @@ -2018,15 +2025,15 @@ void BattleGroundMgr::LoadBattleMastersEntry() if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded 0 battlemaster entries - table is empty!" ); + sLog.outString(">> Loaded 0 battlemaster entries - table is empty!"); return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -2039,13 +2046,13 @@ void BattleGroundMgr::LoadBattleMastersEntry() uint32 bgTypeId = fields[1].GetUInt32(); if (!sBattlemasterListStore.LookupEntry(bgTypeId)) { - sLog.outErrorDb("Table `battlemaster_entry` contain entry %u for nonexistent battleground type %u, ignored.",entry,bgTypeId); + sLog.outErrorDb("Table `battlemaster_entry` contain entry %u for nonexistent battleground type %u, ignored.", entry, bgTypeId); continue; } mBattleMastersMap[entry] = BattleGroundTypeId(bgTypeId); - } while( result->NextRow() ); + } while(result->NextRow()); delete result; @@ -2128,9 +2135,9 @@ void BattleGroundMgr::LoadBattleEventIndexes() "LEFT OUTER JOIN battleground_events AS description ON data.map = description.map " "AND data.ev1 = description.event1 AND data.ev2 = description.event2 " "ORDER BY m, ev1, ev2" ); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -2138,7 +2145,7 @@ void BattleGroundMgr::LoadBattleEventIndexes() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { diff --git a/src/game/CharacterDatabaseCleaner.cpp b/src/game/CharacterDatabaseCleaner.cpp index 0c703108b46..59b8fa21f5d 100644 --- a/src/game/CharacterDatabaseCleaner.cpp +++ b/src/game/CharacterDatabaseCleaner.cpp @@ -61,7 +61,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table bool found = false; std::ostringstream ss; - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { bar.step(); @@ -70,9 +70,9 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table uint32 id = fields[0].GetUInt32(); - if(!check(id)) + if (!check(id)) { - if(!found) + if (!found) { ss << "DELETE FROM " << table << " WHERE " << column << " IN ("; found = true; @@ -82,7 +82,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table ss << id; } } - while( result->NextRow() ); + while (result->NextRow()); delete result; if (found) diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index d9a6a42ead4..3c2b176afd5 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -95,7 +95,7 @@ bool LoginQueryHolder::Initialize() res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, "SELECT arenateamid, played_week, played_season, wons_season, personal_rating FROM arena_team_member WHERE guid='%u'", m_guid.GetCounter()); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = '%u'", m_guid.GetCounter()); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS,"SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = '%u'", m_guid.GetCounter()); - res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", m_guid.GetCounter()); + res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, ignore_mask, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", m_guid.GetCounter()); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBGDATA, "SELECT instance_id, team, join_x, join_y, join_z, join_o, join_map, taxi_start, taxi_end, mount_spell FROM character_battleground_data WHERE guid = '%u'", m_guid.GetCounter()); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA, "SELECT type, time, data FROM character_account_data WHERE guid='%u'", m_guid.GetCounter()); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADTALENTS, "SELECT talent_id, current_rank, spec FROM character_talent WHERE guid = '%u'", m_guid.GetCounter()); @@ -1242,6 +1242,14 @@ void WorldSession::HandleEquipmentSetSaveOpcode(WorldPacket &recv_data) recv_data >> itemGuid.ReadAsPacked(); + // equipment manager sends "1" (as raw GUID) for slots set to "ignore" (not touch slot at equip set) + if (itemGuid.GetRawValue() == 1) + { + // ignored slots saved as bit mask because we have no free special values for Items[i] + eqSet.IgnoreMask |= 1 << i; + continue; + } + Item *item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); if(!item && itemGuid) // cheating check 1 @@ -1282,6 +1290,10 @@ void WorldSession::HandleEquipmentSetUseOpcode(WorldPacket &recv_data) DEBUG_LOG("Item (%s): srcbag %u, srcslot %u", itemGuid.GetString().c_str(), srcbag, srcslot); + // check if item slot is set to "ignored" (raw value == 1), must not be unequipped then + if (itemGuid.GetRawValue() == 1) + continue; + Item *item = _player->GetItemByGuid(itemGuid); uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8); diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 7b28c73c95a..fe8d78922b6 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -749,6 +749,7 @@ ChatCommand * ChatHandler::getCommandTable() { "additem", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAddItemCommand, "", NULL }, { "additemset", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAddItemSetCommand, "", NULL }, { "bank", SEC_ADMINISTRATOR, false, &ChatHandler::HandleBankCommand, "", NULL }, + { "mailbox", SEC_ADMINISTRATOR, false, &ChatHandler::HandleMailBoxCommand, "", NULL }, { "wchange", SEC_ADMINISTRATOR, false, &ChatHandler::HandleChangeWeatherCommand, "", NULL }, { "ticket", SEC_GAMEMASTER, true, &ChatHandler::HandleTicketCommand, "", NULL }, { "delticket", SEC_GAMEMASTER, true, &ChatHandler::HandleDelTicketCommand, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index 9a8a36d7f9a..afd27368c80 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -570,6 +570,7 @@ class MANGOS_DLL_SPEC ChatHandler bool HandleBankCommand(char* args); bool HandleChangeWeatherCommand(char* args); bool HandleKickPlayerCommand(char* args); + bool HandleMailBoxCommand(char* args); bool HandleTicketCommand(char* args); bool HandleDelTicketCommand(char* args); diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 8e381f139a9..15e7850996e 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -50,10 +50,10 @@ #include "Policies/SingletonImp.h" -HighGuid CreatureData::GetHighGuid() const +ObjectGuid CreatureData::GetObjectGuid(uint32 lowguid) const { // info existence checked at loading - return ObjectMgr::GetCreatureTemplate(id)->GetHighGuid(); + return ObjectMgr::GetCreatureTemplate(id)->GetObjectGuid(lowguid); } TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const @@ -248,13 +248,8 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=NULL*/, GameE return false; } - // difficulties for dungeons/battleground ordered in normal way - // and if more high version not exist must be used lesser version - // for raid order different: - // 10 man normal version must be used instead nonexistent 10 man heroic version - // 25 man normal version must be used instead nonexistent 25 man heroic version CreatureInfo const *cinfo = normalInfo; - for (uint8 diff = uint8(GetMap()->GetDifficulty()); diff > 0;) + for (Difficulty diff = GetMap()->GetDifficulty(); diff > REGULAR_DIFFICULTY; diff = GetPrevDifficulty(diff, GetMap()->IsRaid())) { // we already have valid Map pointer for current creature! if (normalInfo->DifficultyEntry[diff - 1]) @@ -266,13 +261,6 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=NULL*/, GameE // check and reported at startup, so just ignore (restore normalInfo) cinfo = normalInfo; } - - // for raid heroic to normal, for other to prev in normal order - if ((diff == int(RAID_DIFFICULTY_10MAN_HEROIC) || diff == int(RAID_DIFFICULTY_25MAN_HEROIC)) && - GetMap()->IsRaid()) - diff -= 2; // to normal raid difficulty cases - else - --diff; } SetEntry(Entry); // normal entry always @@ -1280,7 +1268,7 @@ bool Creature::LoadFromDB(uint32 guidlow, Map *map) GameEventCreatureData const* eventData = sGameEventMgr.GetCreatureUpdateDataForActiveEvent(guidlow); // Creature can be loaded already in map if grid has been unloaded while creature walk to another grid - if (map->GetCreature(data->GetObjectGuid(guidlow))) + if (map->GetCreature(cinfo->GetObjectGuid(guidlow))) return false; CreatureCreatePos pos(map, data->posX, data->posY, data->posZ, data->orientation, data->phaseMask); diff --git a/src/game/Creature.h b/src/game/Creature.h index 5341b9d54af..21ff8f4374c 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -147,6 +147,8 @@ struct CreatureInfo return vehicleId ? HIGHGUID_VEHICLE : HIGHGUID_UNIT; } + ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(GetHighGuid(), Entry, lowguid); } + SkillType GetRequiredLootSkill() const { if(type_flags & CREATURE_TYPEFLAGS_HERBLOOT) @@ -202,8 +204,7 @@ struct CreatureData uint8 spawnMask; // helper function - HighGuid GetHighGuid() const; - ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(GetHighGuid(), id, lowguid); } + ObjectGuid GetObjectGuid(uint32 lowguid) const; }; // from `creature_addon` and `creature_template_addon`tables @@ -457,7 +458,7 @@ class MANGOS_DLL_SPEC Creature : public Unit char const* GetSubName() const { return GetCreatureInfo()->SubName; } - void Update(uint32 update_diff, uint32 time); // overwrite Unit::Update + void Update(uint32 update_diff, uint32 time) override; // overwrite Unit::Update virtual void RegenerateAll(uint32 update_diff); void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const; diff --git a/src/game/CreatureEventAIMgr.cpp b/src/game/CreatureEventAIMgr.cpp index d9e3e5f1dee..852824a5464 100644 --- a/src/game/CreatureEventAIMgr.cpp +++ b/src/game/CreatureEventAIMgr.cpp @@ -44,7 +44,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts(bool check_entry_use) sLog.outString("Loading EventAI Texts additional data..."); if (result) { - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); uint32 count = 0; do @@ -105,7 +105,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts(bool check_entry_use) } else { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); sLog.outString(">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty."); @@ -159,7 +159,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons(bool check_entry_use) QueryResult *result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_ai_summons"); if (result) { - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); uint32 Count = 0; do @@ -176,7 +176,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons(bool check_entry_use) temp.orientation = fields[4].GetFloat(); temp.SpawnTimeSecs = fields[5].GetUInt32(); - if(!MaNGOS::IsValidMapCoord(temp.position_x,temp.position_y,temp.position_z,temp.orientation)) + if (!MaNGOS::IsValidMapCoord(temp.position_x,temp.position_y,temp.position_z,temp.orientation)) { sLog.outErrorDb("CreatureEventAI: Summon id %u have wrong coordinates (%f,%f,%f,%f), skipping.", i,temp.position_x,temp.position_y,temp.position_z,temp.orientation); continue; @@ -196,7 +196,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons(bool check_entry_use) sLog.outString(">> Loaded %u CreatureEventAI summon definitions", Count); }else { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); sLog.outString(">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty."); @@ -253,7 +253,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() "FROM creature_ai_scripts"); if (result) { - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); uint32 Count = 0; do @@ -822,7 +822,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outString(">> Loaded %u CreatureEventAI scripts", Count); }else { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); sLog.outString(">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty."); diff --git a/src/game/DBCEnums.h b/src/game/DBCEnums.h index 229e8e003c5..44c97e83734 100644 --- a/src/game/DBCEnums.h +++ b/src/game/DBCEnums.h @@ -264,7 +264,7 @@ enum AreaFlags AREA_FLAG_SLAVE_CAPITAL = 0x00000008, // city and city subsones AREA_FLAG_UNK3 = 0x00000010, // can't find common meaning AREA_FLAG_SLAVE_CAPITAL2 = 0x00000020, // slave capital city flag? - AREA_FLAG_UNK4 = 0x00000040, // many zones have this flag + AREA_FLAG_DUEL = 0x00000040, // zones where duels allowed AREA_FLAG_ARENA = 0x00000080, // arena, both instanced and world arenas AREA_FLAG_CAPITAL = 0x00000100, // main capital city flag AREA_FLAG_CITY = 0x00000200, // only for one zone named "City" (where it located?) @@ -309,7 +309,7 @@ enum Difficulty enum SpawnMask { - SPAWNMASK_REGULAR = (1 << REGULAR_DIFFICULTY),// any any maps without spawn modes (continents/subway) or in minimal spawnmode + SPAWNMASK_REGULAR = (1 << REGULAR_DIFFICULTY),// any maps without spawn modes (continents/subway) or in minimal spawnmode SPAWNMASK_DUNGEON_NORMAL = (1 << DUNGEON_DIFFICULTY_NORMAL), SPAWNMASK_DUNGEON_HEROIC = (1 << DUNGEON_DIFFICULTY_HEROIC), @@ -356,6 +356,11 @@ enum AbilytyLearnType ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL = 2 }; +enum AbilitySkillFlags +{ + ABILITY_SKILL_NONTRAINABLE = 0x100 +}; + enum ItemEnchantmentType { ITEM_ENCHANTMENT_TYPE_NONE = 0, diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 05fd521d8ba..69bafa29749 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -152,6 +152,7 @@ DBCStorage sScalingStatValuesStore(ScalingStatValuesfmt DBCStorage sSkillLineStore(SkillLinefmt); DBCStorage sSkillLineAbilityStore(SkillLineAbilityfmt); +DBCStorage sSkillRaceClassInfoStore(SkillRaceClassInfofmt); DBCStorage sSoundEntriesStore(SoundEntriesfmt); @@ -313,7 +314,7 @@ struct LocalData }; template -inline void LoadDBC(LocalData& localeData,barGoLink& bar, StoreProblemList& errlist, DBCStorage& storage, const std::string& dbc_path, const std::string& filename) +inline void LoadDBC(LocalData& localeData, BarGoLink& bar, StoreProblemList& errlist, DBCStorage& storage, const std::string& dbc_path, const std::string& filename) { // compatibility format and C++ structure sizes MANGOS_ASSERT(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename)); @@ -393,9 +394,9 @@ void LoadDBCStores(const std::string& dataPath) exit(1); } - const uint32 DBCFilesCount = 101; + const uint32 DBCFilesCount = 102; - barGoLink bar( (int)DBCFilesCount ); + BarGoLink bar(DBCFilesCount); StoreProblemList bad_dbc_files; @@ -404,9 +405,9 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAreaStore, dbcPath,"AreaTable.dbc"); // must be after sAreaStore loading - for(uint32 i = 0; i < sAreaStore.GetNumRows(); ++i) // areaflag numbered from 0 + for (uint32 i = 0; i < sAreaStore.GetNumRows(); ++i) // areaflag numbered from 0 { - if(AreaTableEntry const* area = sAreaStore.LookupEntry(i)) + if (AreaTableEntry const* area = sAreaStore.LookupEntry(i)) { // fill AreaId->DBC records sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID),area->exploreFlag)); @@ -509,6 +510,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sScalingStatValuesStore, dbcPath,"ScalingStatValues.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSkillLineStore, dbcPath,"SkillLine.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSkillLineAbilityStore, dbcPath,"SkillLineAbility.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSkillRaceClassInfoStore, dbcPath,"SkillRaceClassInfo.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSoundEntriesStore, dbcPath,"SoundEntries.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellStore, dbcPath,"Spell.dbc"); for(uint32 i = 1; i < sSpellStore.GetNumRows(); ++i) diff --git a/src/game/DBCStores.h b/src/game/DBCStores.h index 6288fa9ab16..2baa3ac3b4a 100644 --- a/src/game/DBCStores.h +++ b/src/game/DBCStores.h @@ -65,6 +65,28 @@ bool Map2ZoneCoordinates(float& x,float& y,uint32 zone); typedef std::map MapDifficultyMap; MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty); +// natural order for difficulties up-down iteration +// difficulties for dungeons/battleground ordered in normal way +// and if more high version not exist must be used lesser version +// for raid order different: +// 10 man normal version must be used instead nonexistent 10 man heroic version +// 25 man normal version must be used instead nonexistent 25 man heroic version +inline Difficulty GetPrevDifficulty(Difficulty diff, bool isRaid) +{ + switch (diff) + { + default: + case RAID_DIFFICULTY_10MAN_NORMAL: // == DUNGEON_DIFFICULTY_NORMAL == REGULAR_DIFFICULTY + return REGULAR_DIFFICULTY; // return itself, caller code must properly check and not call for this case + case RAID_DIFFICULTY_25MAN_NORMAL: // == DUNGEON_DIFFICULTY_HEROIC + return RAID_DIFFICULTY_10MAN_NORMAL; + case RAID_DIFFICULTY_10MAN_HEROIC: + return isRaid ? RAID_DIFFICULTY_10MAN_NORMAL : DUNGEON_DIFFICULTY_HEROIC; + case RAID_DIFFICULTY_25MAN_HEROIC: + return isRaid ? RAID_DIFFICULTY_25MAN_NORMAL : RAID_DIFFICULTY_10MAN_HEROIC; + } +} + uint32 const* /*[3]*/ GetTalentTabPages(uint32 cls); bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, float x, float y, float z, float delta = 0.0f); @@ -154,6 +176,7 @@ extern DBCStorage sScalingStatDistributionStore; extern DBCStorage sScalingStatValuesStore; extern DBCStorage sSkillLineStore; extern DBCStorage sSkillLineAbilityStore; +extern DBCStorage sSkillRaceClassInfoStore; extern DBCStorage sSoundEntriesStore; extern DBCStorage sSpellCastTimesStore; extern DBCStorage sSpellDifficultyStore; diff --git a/src/game/DBCStructure.cpp b/src/game/DBCStructure.cpp index 8abb518b97d..2fd52135aa4 100644 --- a/src/game/DBCStructure.cpp +++ b/src/game/DBCStructure.cpp @@ -27,11 +27,14 @@ int32 SpellEntry::CalculateSimpleValue(SpellEffectIndex eff) const return 0; } -uint32 const* SpellEntry::GetEffectSpellClassMask(SpellEffectIndex eff) const +ClassFamilyMask const& SpellEntry::GetEffectSpellClassMask(SpellEffectIndex eff) const { - if(SpellEffectEntry const* effectEntry = GetSpellEffectEntry(Id, eff)) - return &effectEntry->EffectSpellClassMaskA[0]; - return NULL; + if (SpellEffectEntry const* effectEntry = GetSpellEffectEntry(Id, eff)) + return effectEntry->EffectSpellClassMask; + + static ClassFamilyMask const emptyCFM; + + return emptyCFM; } SpellAuraOptionsEntry const* SpellEntry::GetSpellAuraOptions() const diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 68c0caee49f..4b45d82d166 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1486,17 +1486,17 @@ struct ScalingStatValuesEntry uint32 displayOrder; // 2 m_sortIndex };*/ -/*struct SkillRaceClassInfoEntry +struct SkillRaceClassInfoEntry { - uint32 id; // 0 m_ID + //uint32 id; // 0 m_ID uint32 skillId; // 1 m_skillID uint32 raceMask; // 2 m_raceMask uint32 classMask; // 3 m_classMask uint32 flags; // 4 m_flags uint32 reqLevel; // 5 m_minLevel - uint32 skillTierId; // 6 m_skillTierID - uint32 skillCostID; // 7 m_skillCostIndex -};*/ + //uint32 skillTierId; // 6 m_skillTierID + //uint32 skillCostID; // 7 m_skillCostIndex +}; /*struct SkillTiersEntry{ uint32 id; // 0 m_ID @@ -1554,6 +1554,41 @@ struct SoundEntriesEntry //unk // 33 4.0.0 }; +struct ClassFamilyMask +{ + uint64 Flags; + uint32 Flags2; + + ClassFamilyMask() : Flags(0), Flags2(0) {} + explicit ClassFamilyMask(uint64 familyFlags, uint32 familyFlags2 = 0) : Flags(familyFlags), Flags2(familyFlags2) {} + + bool Empty() const { return Flags == 0 && Flags2 == 0; } + bool operator! () const { return Empty(); } + operator void const* () const { return Empty() ? NULL : this; }// for allow normal use in if(mask) + + bool IsFitToFamilyMask(uint64 familyFlags, uint32 familyFlags2 = 0) const + { + return (Flags & familyFlags) || (Flags2 & familyFlags2); + } + + bool IsFitToFamilyMask(ClassFamilyMask const& mask) const + { + return (Flags & mask.Flags) || (Flags2 & mask.Flags2); + } + + uint64 operator& (uint64 mask) const // possible will removed at finish convertion code use IsFitToFamilyMask + { + return Flags & mask; + } + + ClassFamilyMask& operator|= (ClassFamilyMask const& mask) + { + Flags |= mask.Flags; + Flags2 |= mask.Flags2; + return *this; + } +}; + #define MAX_SPELL_REAGENTS 8 #define MAX_SPELL_TOTEMS 2 #define MAX_SPELL_TOTEM_CATEGORIES 2 @@ -1611,8 +1646,7 @@ struct SpellClassOptionsEntry { //uint32 Id; // 0 m_ID //uint32 modalNextSpell; // 50 m_modalNextSpell not used - uint64 SpellFamilyFlags; // 149-150 m_spellClassMask NOTE: size is 12 bytes!!! - uint32 SpellFamilyFlags2; // 151 addition to m_spellClassMask + ClassFamilyMask SpellFamilyFlags; // 149-151 m_spellClassMask NOTE: size is 12 bytes!!! uint32 SpellFamilyName; // 148 m_spellClassSet //char* Description; // 6 4.0.0 @@ -1620,13 +1654,22 @@ struct SpellClassOptionsEntry bool IsFitToFamilyMask(uint64 familyFlags, uint32 familyFlags2 = 0) const { - return (SpellFamilyFlags & familyFlags) || (SpellFamilyFlags2 & familyFlags2); + return SpellFamilyFlags.IsFitToFamilyMask(familyFlags, familyFlags2); } bool IsFitToFamily(SpellFamily family, uint64 familyFlags, uint32 familyFlags2 = 0) const { - return SpellFamily(SpellFamilyName) == family && - ((SpellFamilyFlags & familyFlags) || (SpellFamilyFlags2 & familyFlags2)); + return SpellFamily(SpellFamilyName) == family && IsFitToFamilyMask(familyFlags, familyFlags2); + } + + bool IsFitToFamilyMask(ClassFamilyMask const& mask) const + { + return SpellFamilyFlags.IsFitToFamilyMask(mask); + } + + bool IsFitToFamily(SpellFamily family, ClassFamilyMask const& mask) const + { + return SpellFamily(SpellFamilyName) == family && IsFitToFamilyMask(mask); } private: @@ -1665,7 +1708,7 @@ struct SpellEffectEntry uint32 EffectRadiusIndex; // 94-96 m_effectRadiusIndex - spellradius.dbc //uint32 EffectRadiusMaxIndex; // 97-99 4.0.0 float EffectRealPointsPerLevel; // 79-81 m_effectRealPointsPerLevel - uint32 EffectSpellClassMaskA[3]; // 127-129 m_effectSpellClassMaskA, effect 0 + ClassFamilyMask EffectSpellClassMask; // 127-129 m_effectSpellClassMask uint32 EffectTriggerSpell; // 121-123 m_effectTriggerSpell uint32 EffectImplicitTargetA; // 88-90 m_implicitTargetA uint32 EffectImplicitTargetB; // 91-93 m_implicitTargetB @@ -1822,7 +1865,7 @@ struct MANGOS_DLL_SPEC SpellEntry // helpers int32 CalculateSimpleValue(SpellEffectIndex eff) const; - uint32 const* GetEffectSpellClassMask(SpellEffectIndex eff) const; + ClassFamilyMask const& GetEffectSpellClassMask(SpellEffectIndex eff) const; // struct access functions SpellAuraOptionsEntry const* GetSpellAuraOptions() const; @@ -1895,6 +1938,18 @@ struct MANGOS_DLL_SPEC SpellEntry return classOpt && classOpt->IsFitToFamily(family, familyFlags, familyFlags2); } + bool IsFitToFamilyMask(ClassFamilyMask const& mask) const + { + SpellClassOptionsEntry const* classOpt = GetSpellClassOptions(); + return classOpt && classOpt->IsFitToFamilyMask(mask); + } + + bool IsFitToFamily(SpellFamily family, ClassFamilyMask const& mask) const + { + SpellClassOptionsEntry const* classOpt = GetSpellClassOptions(); + return classOpt && classOpt->IsFitToFamily(family, mask); + } + private: // prevent creating custom entries (copy data from original in fact) SpellEntry(SpellEntry const&); // DON'T must have implementation diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 615c0e8d3c3..60b1537b572 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -92,6 +92,7 @@ const char ScalingStatDistributionfmt[]="niiiiiiiiiiiiiiiiiiiixi"; const char ScalingStatValuesfmt[]="iniiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxx"; const char SkillLinefmt[]="nixsxixi"; const char SkillLineAbilityfmt[]="niiiixxiiiiixx"; +const char SkillRaceClassInfofmt[]="diiiiixx"; const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char SpellCastTimefmt[]="nixx"; const char SpellDurationfmt[]="niii"; diff --git a/src/game/DynamicObject.h b/src/game/DynamicObject.h index 58f509eb361..da3b98a248d 100644 --- a/src/game/DynamicObject.h +++ b/src/game/DynamicObject.h @@ -43,7 +43,7 @@ class DynamicObject : public WorldObject void RemoveFromWorld(); bool Create(uint32 guidlow, Unit *caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type); - void Update(uint32 update_diff, uint32 p_time); + void Update(uint32 update_diff, uint32 p_time) override; void Delete(); uint32 GetSpellId() const { return m_spellId; } SpellEffectIndex GetEffIndex() const { return m_effIndex; } diff --git a/src/game/GMTicketMgr.cpp b/src/game/GMTicketMgr.cpp index 1b28c5226a7..4d72878cb43 100644 --- a/src/game/GMTicketMgr.cpp +++ b/src/game/GMTicketMgr.cpp @@ -38,7 +38,7 @@ void GMTicketMgr::LoadGMTickets() if( !result ) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); @@ -47,7 +47,7 @@ void GMTicketMgr::LoadGMTickets() return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index c5875cc54c9..a6b92568e40 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -110,7 +110,7 @@ void GameEventMgr::LoadFromDB() } QueryResult *result = WorldDatabase.Query("SELECT entry,UNIX_TIMESTAMP(start_time),UNIX_TIMESTAMP(end_time),occurence,length,holiday,description FROM game_event"); - if( !result ) + if (!result) { mGameEvent.clear(); sLog.outString(">> Table game_event is empty!"); @@ -121,7 +121,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; { - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { ++count; @@ -183,9 +183,9 @@ void GameEventMgr::LoadFromDB() "FROM creature JOIN game_event_creature ON creature.guid = game_event_creature.guid"); count = 0; - if( !result ) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -194,7 +194,7 @@ void GameEventMgr::LoadFromDB() else { - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -261,9 +261,9 @@ void GameEventMgr::LoadFromDB() "FROM gameobject JOIN game_event_gameobject ON gameobject.guid=game_event_gameobject.guid"); count = 0; - if( !result ) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -272,7 +272,7 @@ void GameEventMgr::LoadFromDB() else { - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -352,9 +352,9 @@ void GameEventMgr::LoadFromDB() "FROM creature JOIN game_event_creature_data ON creature.guid=game_event_creature_data.guid"); count = 0; - if( !result ) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -363,7 +363,7 @@ void GameEventMgr::LoadFromDB() else { - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -432,9 +432,9 @@ void GameEventMgr::LoadFromDB() result = WorldDatabase.Query("SELECT quest, event FROM game_event_quest"); count = 0; - if( !result ) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -443,7 +443,7 @@ void GameEventMgr::LoadFromDB() else { - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -494,7 +494,7 @@ void GameEventMgr::LoadFromDB() count = 0; if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -503,7 +503,7 @@ void GameEventMgr::LoadFromDB() else { - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { Field *fields = result->Fetch(); diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index f31a3b0c4cb..f3bde11d63c 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -190,11 +190,7 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/) SetGoState(GO_STATE_ACTIVE); // SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN); - UpdateData udata; - WorldPacket packet; - BuildValuesUpdateBlockForPlayer(&udata,((Player*)caster)); - udata.BuildPacket(&packet); - ((Player*)caster)->GetSession()->SendPacket(&packet); + SendForcedObjectUpdate(); SendGameObjectCustomAnim(GetObjectGuid()); } @@ -402,8 +398,15 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/) if (GetGOInfo()->IsDespawnAtAction() || GetGoAnimProgress() > 0) { SendObjectDeSpawnAnim(GetObjectGuid()); - //reset flags - SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); + // reset flags + if (GetMap()->Instanceable()) + { + // In Instances GO_FLAG_LOCKED or GO_FLAG_NO_INTERACT are not changed + uint32 currentLockOrInteractFlags = GetUInt32Value(GAMEOBJECT_FLAGS) & (GO_FLAG_LOCKED | GO_FLAG_NO_INTERACT); + SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags & ~(GO_FLAG_LOCKED | GO_FLAG_NO_INTERACT) | currentLockOrInteractFlags); + } + else + SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); } loot.clear(); @@ -474,9 +477,9 @@ void GameObject::getFishLoot(Loot *fishloot, Player* loot_owner) GetZoneAndAreaId(zone,subzone); // if subzone loot exist use it - if (!fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true)) - // else use zone loot (must exist in like case) - fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner,true); + if (!fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, (subzone != zone)) && subzone != zone) + // else use zone loot (if zone diff. from subzone, must exist in like case) + fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true); } void GameObject::SaveToDB() diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 9551d89dd24..1b59595e1e0 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -599,7 +599,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject void RemoveFromWorld(); bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint8 animprogress, GOState go_state); - void Update(uint32 update_diff, uint32 p_time); + void Update(uint32 update_diff, uint32 p_time) override; GameObjectInfo const* GetGOInfo() const; bool IsTransport() const; diff --git a/src/game/Group.cpp b/src/game/Group.cpp index afa71eab798..80510b10e29 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -131,7 +131,7 @@ bool Group::Create(ObjectGuid guid, const char * name) m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; if (!isBGGroup()) { - m_Id = sObjectMgr.GenerateGroupId(); + m_Id = sObjectMgr.GenerateGroupLowGuid(); Player *leader = sObjectMgr.GetPlayer(guid); if(leader) @@ -1021,11 +1021,9 @@ void Group::SendTargetIconList(WorldSession *session) void Group::SendUpdate() { - Player *player; - for(member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { - player = sObjectMgr.GetPlayer(citr->guid); + Player* player = sObjectMgr.GetPlayer(citr->guid); if(!player || !player->GetSession() || player->GetGroup() != this ) continue; // guess size @@ -1039,7 +1037,7 @@ void Group::SendUpdate() data << uint8(0); data << uint32(0); } - data << uint64(0x50000000FFFFFFFELL); // related to voice chat? + data << GetObjectGuid(); // group guid data << uint32(0); // 3.3, this value increments every time SMSG_GROUP_LIST is sent data << uint32(GetMembersCount()-1); for(member_citerator citr2 = m_memberSlots.begin(); citr2 != m_memberSlots.end(); ++citr2) diff --git a/src/game/Group.h b/src/game/Group.h index 653afed3a10..a32648d858c 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -229,6 +229,7 @@ class MANGOS_DLL_SPEC Group // properties accessories uint32 GetId() const { return m_Id; } + ObjectGuid GetObjectGuid() const { return ObjectGuid(HIGHGUID_GROUP, GetId()); } bool IsFull() const { return (m_groupType == GROUPTYPE_NORMAL) ? (m_memberSlots.size() >= MAX_GROUP_SIZE) : (m_memberSlots.size() >= MAX_RAID_SIZE); } bool isRaidGroup() const { return m_groupType & GROUPTYPE_RAID; } bool isBGGroup() const { return m_bgGroup != NULL; } diff --git a/src/game/GuildMgr.cpp b/src/game/GuildMgr.cpp index ae586312a6d..5f1314b9d3a 100644 --- a/src/game/GuildMgr.cpp +++ b/src/game/GuildMgr.cpp @@ -95,7 +95,7 @@ void GuildMgr::LoadGuilds() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -123,7 +123,7 @@ void GuildMgr::LoadGuilds() // 0 1 2 3 4 QueryResult* guildBankTabRightsResult = CharacterDatabase.Query("SELECT guildid,TabId,rid,gbright,SlotPerDay FROM guild_bank_right ORDER BY guildid ASC, TabId ASC"); - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { diff --git a/src/game/Item.cpp b/src/game/Item.cpp index af399363c4f..9d18595c74a 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -23,45 +23,45 @@ #include "Database/DatabaseEnv.h" #include "ItemEnchantmentMgr.h" -void AddItemsSetItem(Player*player,Item *item) +void AddItemsSetItem(Player* player, Item* item) { - ItemPrototype const *proto = item->GetProto(); + ItemPrototype const* proto = item->GetProto(); uint32 setid = proto->ItemSet; - ItemSetEntry const *set = sItemSetStore.LookupEntry(setid); + ItemSetEntry const* set = sItemSetStore.LookupEntry(setid); - if(!set) + if (!set) { - sLog.outErrorDb("Item set %u for item (id %u) not found, mods not applied.",setid,proto->ItemId); + sLog.outErrorDb("Item set %u for item (id %u) not found, mods not applied.", setid,proto->ItemId); return; } - if( set->required_skill_id && player->GetSkillValue(set->required_skill_id) < set->required_skill_value ) + if (set->required_skill_id && player->GetSkillValue(set->required_skill_id) < set->required_skill_value) return; - ItemSetEffect *eff = NULL; + ItemSetEffect* eff = NULL; - for(size_t x = 0; x < player->ItemSetEff.size(); ++x) + for (size_t x = 0; x < player->ItemSetEff.size(); ++x) { - if(player->ItemSetEff[x] && player->ItemSetEff[x]->setid == setid) + if (player->ItemSetEff[x] && player->ItemSetEff[x]->setid == setid) { eff = player->ItemSetEff[x]; break; } } - if(!eff) + if (!eff) { eff = new ItemSetEffect; - memset(eff,0,sizeof(ItemSetEffect)); + memset(eff, 0, sizeof(ItemSetEffect)); eff->setid = setid; size_t x = 0; - for(; x < player->ItemSetEff.size(); x++) - if(!player->ItemSetEff[x]) + for (; x < player->ItemSetEff.size(); x++) + if (!player->ItemSetEff[x]) break; - if(x < player->ItemSetEff.size()) + if (x < player->ItemSetEff.size()) player->ItemSetEff[x]=eff; else player->ItemSetEff.push_back(eff); @@ -69,36 +69,36 @@ void AddItemsSetItem(Player*player,Item *item) ++eff->item_count; - for(uint32 x=0;x<8;x++) + for (uint32 x = 0; x < 8; x++) { - if(!set->spells [x]) + if (!set->spells[x]) continue; - //not enough for spell - if(set->items_to_triggerspell[x] > eff->item_count) + // not enough for spell + if (set->items_to_triggerspell[x] > eff->item_count) continue; - uint32 z=0; - for(;z<8;z++) - if(eff->spells[z] && eff->spells[z]->Id==set->spells[x]) + uint32 z = 0; + for (; z < 8; z++) + if (eff->spells[z] && eff->spells[z]->Id == set->spells[x]) break; - if(z < 8) + if (z < 8) continue; - //new spell - for(uint32 y=0;y<8;y++) + // new spell + for (uint32 y = 0; y < 8; y++) { - if(!eff->spells[y]) // free slot + if (!eff->spells[y]) // free slot { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(set->spells[x]); - if(!spellInfo) + SpellEntry const* spellInfo = sSpellStore.LookupEntry(set->spells[x]); + if (!spellInfo) { sLog.outError("WORLD: unknown spell id %u in items set %u effects", set->spells[x],setid); break; } // spell casted only if fit form requirement, in other case will casted at form change - player->ApplyEquipSpell(spellInfo,NULL,true); + player->ApplyEquipSpell(spellInfo, NULL, true); eff->spells[y] = spellInfo; break; } @@ -106,23 +106,23 @@ void AddItemsSetItem(Player*player,Item *item) } } -void RemoveItemsSetItem(Player*player,ItemPrototype const *proto) +void RemoveItemsSetItem(Player* player, ItemPrototype const* proto) { uint32 setid = proto->ItemSet; - ItemSetEntry const *set = sItemSetStore.LookupEntry(setid); + ItemSetEntry const* set = sItemSetStore.LookupEntry(setid); - if(!set) + if (!set) { - sLog.outErrorDb("Item set #%u for item #%u not found, mods not removed.",setid,proto->ItemId); + sLog.outErrorDb("Item set #%u for item #%u not found, mods not removed.", setid,proto->ItemId); return; } - ItemSetEffect *eff = NULL; + ItemSetEffect* eff = NULL; size_t setindex = 0; - for(;setindex < player->ItemSetEff.size(); setindex++) + for (; setindex < player->ItemSetEff.size(); setindex++) { - if(player->ItemSetEff[setindex] && player->ItemSetEff[setindex]->setid == setid) + if (player->ItemSetEff[setindex] && player->ItemSetEff[setindex]->setid == setid) { eff = player->ItemSetEff[setindex]; break; @@ -130,33 +130,33 @@ void RemoveItemsSetItem(Player*player,ItemPrototype const *proto) } // can be in case now enough skill requirement for set appling but set has been appliend when skill requirement not enough - if(!eff) + if (!eff) return; --eff->item_count; - for(uint32 x=0;x<8;x++) + for (uint32 x = 0; x < 8; x++) { - if(!set->spells[x]) + if (!set->spells[x]) continue; // enough for spell - if(set->items_to_triggerspell[x] <= eff->item_count) + if (set->items_to_triggerspell[x] <= eff->item_count) continue; - for(uint32 z=0;z<8;z++) + for (uint32 z = 0; z < 8; z++) { - if(eff->spells[z] && eff->spells[z]->Id==set->spells[x]) + if (eff->spells[z] && eff->spells[z]->Id == set->spells[x]) { // spell can be not active if not fit form requirement - player->ApplyEquipSpell(eff->spells[z],NULL,false); - eff->spells[z]=NULL; + player->ApplyEquipSpell(eff->spells[z], NULL, false); + eff->spells[z] = NULL; break; } } } - if(!eff->item_count) //all items of a set were removed + if (!eff->item_count) // all items of a set were removed { MANGOS_ASSERT(eff == player->ItemSetEff[setindex]); delete eff; @@ -164,62 +164,62 @@ void RemoveItemsSetItem(Player*player,ItemPrototype const *proto) } } -bool ItemCanGoIntoBag(ItemPrototype const *pProto, ItemPrototype const *pBagProto) +bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProto) { - if(!pProto || !pBagProto) + if (!pProto || !pBagProto) return false; - switch(pBagProto->Class) + switch (pBagProto->Class) { case ITEM_CLASS_CONTAINER: - switch(pBagProto->SubClass) + switch (pBagProto->SubClass) { case ITEM_SUBCLASS_CONTAINER: return true; case ITEM_SUBCLASS_SOUL_CONTAINER: - if(!(pProto->BagFamily & BAG_FAMILY_MASK_SOUL_SHARDS)) + if (!(pProto->BagFamily & BAG_FAMILY_MASK_SOUL_SHARDS)) return false; return true; case ITEM_SUBCLASS_HERB_CONTAINER: - if(!(pProto->BagFamily & BAG_FAMILY_MASK_HERBS)) + if (!(pProto->BagFamily & BAG_FAMILY_MASK_HERBS)) return false; return true; case ITEM_SUBCLASS_ENCHANTING_CONTAINER: - if(!(pProto->BagFamily & BAG_FAMILY_MASK_ENCHANTING_SUPP)) + if (!(pProto->BagFamily & BAG_FAMILY_MASK_ENCHANTING_SUPP)) return false; return true; case ITEM_SUBCLASS_MINING_CONTAINER: - if(!(pProto->BagFamily & BAG_FAMILY_MASK_MINING_SUPP)) + if (!(pProto->BagFamily & BAG_FAMILY_MASK_MINING_SUPP)) return false; return true; case ITEM_SUBCLASS_ENGINEERING_CONTAINER: - if(!(pProto->BagFamily & BAG_FAMILY_MASK_ENGINEERING_SUPP)) + if (!(pProto->BagFamily & BAG_FAMILY_MASK_ENGINEERING_SUPP)) return false; return true; case ITEM_SUBCLASS_GEM_CONTAINER: - if(!(pProto->BagFamily & BAG_FAMILY_MASK_GEMS)) + if (!(pProto->BagFamily & BAG_FAMILY_MASK_GEMS)) return false; return true; case ITEM_SUBCLASS_LEATHERWORKING_CONTAINER: - if(!(pProto->BagFamily & BAG_FAMILY_MASK_LEATHERWORKING_SUPP)) + if (!(pProto->BagFamily & BAG_FAMILY_MASK_LEATHERWORKING_SUPP)) return false; return true; case ITEM_SUBCLASS_INSCRIPTION_CONTAINER: - if(!(pProto->BagFamily & BAG_FAMILY_MASK_INSCRIPTION_SUPP)) + if (!(pProto->BagFamily & BAG_FAMILY_MASK_INSCRIPTION_SUPP)) return false; return true; default: return false; } case ITEM_CLASS_QUIVER: - switch(pBagProto->SubClass) + switch (pBagProto->SubClass) { case ITEM_SUBCLASS_QUIVER: - if(!(pProto->BagFamily & BAG_FAMILY_MASK_ARROWS)) + if (!(pProto->BagFamily & BAG_FAMILY_MASK_ARROWS)) return false; return true; case ITEM_SUBCLASS_AMMO_POUCH: - if(!(pProto->BagFamily & BAG_FAMILY_MASK_BULLETS)) + if (!(pProto->BagFamily & BAG_FAMILY_MASK_BULLETS)) return false; return true; default: @@ -231,12 +231,12 @@ bool ItemCanGoIntoBag(ItemPrototype const *pProto, ItemPrototype const *pBagProt uint32 ItemPrototype::GetArmor() const { - if(Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc... + if (Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc... return 0; - if(Class == ITEM_CLASS_ARMOR && SubClass == ITEM_SUBCLASS_ARMOR_SHIELD) + if (Class == ITEM_CLASS_ARMOR && SubClass == ITEM_SUBCLASS_ARMOR_SHIELD) { - if(ItemArmorShieldEntry const* ias = sItemArmorShieldStore.LookupEntry(ItemLevel)) + if (ItemArmorShieldEntry const* ias = sItemArmorShieldStore.LookupEntry(ItemLevel)) { return uint32(floor(ias->Value[Quality] + 0.5f)); } @@ -246,28 +246,28 @@ uint32 ItemPrototype::GetArmor() const ItemArmorQualityEntry const* iaq = sItemArmorQualityStore.LookupEntry(ItemLevel); ItemArmorTotalEntry const* iat = sItemArmorTotalStore.LookupEntry(ItemLevel); - if(!iaq || !iat) + if (!iaq || !iat) return 0; - if(InventoryType != INVTYPE_HEAD && InventoryType != INVTYPE_CHEST && InventoryType != INVTYPE_SHOULDERS - && InventoryType != INVTYPE_LEGS && InventoryType != INVTYPE_FEET && InventoryType != INVTYPE_WRISTS - && InventoryType != INVTYPE_HANDS && InventoryType != INVTYPE_WAIST && InventoryType != INVTYPE_CLOAK - && InventoryType != INVTYPE_ROBE) + if (InventoryType != INVTYPE_HEAD && InventoryType != INVTYPE_CHEST && InventoryType != INVTYPE_SHOULDERS && + InventoryType != INVTYPE_LEGS && InventoryType != INVTYPE_FEET && InventoryType != INVTYPE_WRISTS && + InventoryType != INVTYPE_HANDS && InventoryType != INVTYPE_WAIST && InventoryType != INVTYPE_CLOAK && + InventoryType != INVTYPE_ROBE) return 0; ArmorLocationEntry const* al = NULL; - if(InventoryType == INVTYPE_ROBE) + if (InventoryType == INVTYPE_ROBE) al = sArmorLocationStore.LookupEntry(INVTYPE_CHEST); else al = sArmorLocationStore.LookupEntry(InventoryType); - if(!al) + if (!al) return 0; float iatMult, alMult; - switch(SubClass) + switch (SubClass) { case ITEM_SUBCLASS_ARMOR_CLOTH: iatMult = iat->Value[0]; @@ -296,25 +296,25 @@ float ItemPrototype::getDPS() const { float damage = 0.0f; - if(Class == ITEM_CLASS_WEAPON) + if (Class == ITEM_CLASS_WEAPON) { - if(Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc... + if (Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc... return damage; ItemDamageEntry const* id = NULL; - switch(InventoryType) + switch (InventoryType) { case INVTYPE_WEAPON: case INVTYPE_WEAPONMAINHAND: case INVTYPE_WEAPONOFFHAND: - if(Flags2 & ITEM_FLAG2_CASTER_WEAPON) // caster weapon flag + if (Flags2 & ITEM_FLAG2_CASTER_WEAPON) // caster weapon flag id = sItemDamageOneHandCasterStore.LookupEntry(ItemLevel); else id = sItemDamageOneHandStore.LookupEntry(ItemLevel); break; case INVTYPE_2HWEAPON: - if(Flags2 & ITEM_FLAG2_CASTER_WEAPON) // caster weapon flag + if (Flags2 & ITEM_FLAG2_CASTER_WEAPON) // caster weapon flag id = sItemDamageTwoHandCasterStore.LookupEntry(ItemLevel); else id = sItemDamageTwoHandStore.LookupEntry(ItemLevel); @@ -325,7 +325,7 @@ float ItemPrototype::getDPS() const case INVTYPE_RANGED: case INVTYPE_THROWN: case INVTYPE_RANGEDRIGHT: - switch(SubClass) + switch (SubClass) { case ITEM_SUBCLASS_WEAPON_BOW: case ITEM_SUBCLASS_WEAPON_GUN: @@ -346,7 +346,7 @@ float ItemPrototype::getDPS() const break; } - if(!id) + if (!id) return damage; return id->Value[Quality]; @@ -355,7 +355,7 @@ float ItemPrototype::getDPS() const return damage; } -Item::Item( ) +Item::Item() { m_objectType |= TYPEMASK_ITEM; m_objectTypeId = TYPEID_ITEM; @@ -371,7 +371,7 @@ Item::Item( ) m_lootState = ITEM_LOOT_NONE; } -bool Item::Create( uint32 guidlow, uint32 itemid, Player const* owner) +bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner) { Object::_Create(guidlow, 0, HIGHGUID_ITEM); @@ -381,15 +381,15 @@ bool Item::Create( uint32 guidlow, uint32 itemid, Player const* owner) SetGuidValue(ITEM_FIELD_OWNER, owner ? owner->GetObjectGuid() : ObjectGuid()); SetGuidValue(ITEM_FIELD_CONTAINED, ObjectGuid()); - ItemPrototype const *itemProto = ObjectMgr::GetItemPrototype(itemid); - if(!itemProto) + ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(itemid); + if (!itemProto) return false; SetUInt32Value(ITEM_FIELD_STACK_COUNT, 1); SetUInt32Value(ITEM_FIELD_MAXDURABILITY, itemProto->MaxDurability); SetUInt32Value(ITEM_FIELD_DURABILITY, itemProto->MaxDurability); - for(int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) SetSpellCharges(i,itemProto->Spells[i].SpellCharges); SetUInt32Value(ITEM_FIELD_DURATION, itemProto->Duration); @@ -402,9 +402,9 @@ void Item::UpdateDuration(Player* owner, uint32 diff) if (!GetUInt32Value(ITEM_FIELD_DURATION)) return; - //DEBUG_LOG("Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)",GetEntry(),GetUInt32Value(ITEM_FIELD_DURATION),diff); + //DEBUG_LOG("Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)", GetEntry(), GetUInt32Value(ITEM_FIELD_DURATION), diff); - if (GetUInt32Value(ITEM_FIELD_DURATION)<=diff) + if (GetUInt32Value(ITEM_FIELD_DURATION) <= diff) { owner->DestroyItem(GetBagSlot(), GetSlot(), true); return; @@ -428,7 +428,7 @@ void Item::SaveToDB() stmt.PExecute(guid); std::ostringstream ss; - for(uint16 i = 0; i < m_valuesCount; ++i ) + for (uint16 i = 0; i < m_valuesCount; ++i) ss << GetUInt32Value(i) << " "; stmt = CharacterDatabase.CreateStatement(insItem, "INSERT INTO item_instance (guid,owner_guid,data,text) VALUES (?, ?, ?, ?)"); @@ -442,7 +442,7 @@ void Item::SaveToDB() SqlStatement stmt = CharacterDatabase.CreateStatement(updInstance, "UPDATE item_instance SET data = ?, owner_guid = ?, text = ? WHERE guid = ?"); std::ostringstream ss; - for(uint16 i = 0; i < m_valuesCount; ++i ) + for (uint16 i = 0; i < m_valuesCount; ++i) ss << GetUInt32Value(i) << " "; stmt.PExecute(ss.str().c_str(), GetOwnerGuid().GetCounter(), m_text.c_str(), guid); @@ -491,7 +491,7 @@ void Item::SaveToDB() if (m_lootState == ITEM_LOOT_NEW || m_lootState == ITEM_LOOT_CHANGED) { - if(Player* owner = GetOwner()) + if (Player* owner = GetOwner()) { static SqlStatementID saveGold ; static SqlStatementID saveLoot ; @@ -508,10 +508,10 @@ void Item::SaveToDB() // save items and quest items (at load its all will added as normal, but this not important for item loot case) for (size_t i = 0; i < loot.GetMaxSlotInLootFor(owner); ++i) { - QuestItem *qitem = NULL; + QuestItem* qitem = NULL; - LootItem *item = loot.LootItemInSlot(i,owner,&qitem); - if(!item) + LootItem* item = loot.LootItemInSlot(i, owner, &qitem); + if (!item) continue; // questitems use the blocked field for other purposes @@ -537,7 +537,7 @@ void Item::SaveToDB() SetState(ITEM_UNCHANGED); } -bool Item::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid) +bool Item::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid) { // create item before any checks for store correct guid // and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB @@ -562,23 +562,23 @@ bool Item::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid) } ItemPrototype const* proto = GetProto(); - if(!proto) + if (!proto) return false; // update max durability (and durability) if need - if(proto->MaxDurability!= GetUInt32Value(ITEM_FIELD_MAXDURABILITY)) + if (proto->MaxDurability!= GetUInt32Value(ITEM_FIELD_MAXDURABILITY)) { - SetUInt32Value(ITEM_FIELD_MAXDURABILITY,proto->MaxDurability); - if(GetUInt32Value(ITEM_FIELD_DURABILITY) > proto->MaxDurability) - SetUInt32Value(ITEM_FIELD_DURABILITY,proto->MaxDurability); + SetUInt32Value(ITEM_FIELD_MAXDURABILITY, proto->MaxDurability); + if (GetUInt32Value(ITEM_FIELD_DURABILITY) > proto->MaxDurability) + SetUInt32Value(ITEM_FIELD_DURABILITY, proto->MaxDurability); need_save = true; } // recalculate suffix factor - if(GetItemRandomPropertyId() < 0) + if (GetItemRandomPropertyId() < 0) { - if(UpdateItemSuffixFactor()) + if (UpdateItemSuffixFactor()) need_save = true; } @@ -627,7 +627,7 @@ bool Item::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid) SqlStatement stmt = CharacterDatabase.CreateStatement(updItem, "UPDATE item_instance SET data = ?, owner_guid = ? WHERE guid = ?"); std::ostringstream ss; - for(uint16 i = 0; i < m_valuesCount; ++i ) + for (uint16 i = 0; i < m_valuesCount; ++i) ss << GetUInt32Value(i) << " "; stmt.addString(ss); @@ -639,7 +639,7 @@ bool Item::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid) return true; } -void Item::LoadLootFromDB(Field *fields) +void Item::LoadLootFromDB(Field* fields) { uint32 item_id = fields[1].GetUInt32(); uint32 item_amount = fields[2].GetUInt32(); @@ -657,7 +657,7 @@ void Item::LoadLootFromDB(Field *fields) // normal item case ItemPrototype const* proto = ObjectMgr::GetItemPrototype(item_id); - if(!proto) + if (!proto) { CharacterDatabase.PExecute("DELETE FROM item_loot WHERE guid = '%u' AND itemid = '%u'", GetGUIDLow(), item_id); sLog.outError("Item::LoadLootFromDB: %s has an unknown item (id: #%u) in item_loot, deleted.", GetOwnerGuid().GetString().c_str(), item_id); @@ -686,7 +686,7 @@ void Item::DeleteFromInventoryDB() stmt.PExecute(GetGUIDLow()); } -ItemPrototype const *Item::GetProto() const +ItemPrototype const* Item::GetProto() const { return ObjectMgr::GetItemPrototype(GetEntry()); } @@ -709,7 +709,7 @@ uint32 Item::GetSkill() const static uint32 item_armor_skills[MAX_ITEM_SUBCLASS_ARMOR] = { - 0,SKILL_CLOTH,SKILL_LEATHER,SKILL_MAIL,SKILL_PLATE_MAIL,0,SKILL_SHIELD,0,0,0,0 + 0, SKILL_CLOTH, SKILL_LEATHER, SKILL_MAIL, SKILL_PLATE_MAIL, 0, SKILL_SHIELD, 0, 0, 0, 0 }; ItemPrototype const* proto = GetProto(); @@ -717,13 +717,13 @@ uint32 Item::GetSkill() switch (proto->Class) { case ITEM_CLASS_WEAPON: - if( proto->SubClass >= MAX_ITEM_SUBCLASS_WEAPON ) + if (proto->SubClass >= MAX_ITEM_SUBCLASS_WEAPON) return 0; else return item_weapon_skills[proto->SubClass]; case ITEM_CLASS_ARMOR: - if( proto->SubClass >= MAX_ITEM_SUBCLASS_ARMOR ) + if (proto->SubClass >= MAX_ITEM_SUBCLASS_ARMOR) return 0; else return item_armor_skills[proto->SubClass]; @@ -760,7 +760,7 @@ uint32 Item::GetSpell() default: return 0; } case ITEM_CLASS_ARMOR: - switch(proto->SubClass) + switch (proto->SubClass) { case ITEM_SUBCLASS_ARMOR_CLOTH: return 9078; case ITEM_SUBCLASS_ARMOR_LEATHER: return 9077; @@ -775,43 +775,43 @@ uint32 Item::GetSpell() int32 Item::GenerateItemRandomPropertyId(uint32 item_id) { - ItemPrototype const *itemProto = sItemStorage.LookupEntry(item_id); + ItemPrototype const* itemProto = sItemStorage.LookupEntry(item_id); - if(!itemProto) + if (!itemProto) return 0; // item must have one from this field values not null if it can have random enchantments - if((!itemProto->RandomProperty) && (!itemProto->RandomSuffix)) + if ((!itemProto->RandomProperty) && (!itemProto->RandomSuffix)) return 0; // item can have not null only one from field values - if((itemProto->RandomProperty) && (itemProto->RandomSuffix)) + if ((itemProto->RandomProperty) && (itemProto->RandomSuffix)) { - sLog.outErrorDb("Item template %u have RandomProperty==%u and RandomSuffix==%u, but must have one from field =0",itemProto->ItemId,itemProto->RandomProperty,itemProto->RandomSuffix); + sLog.outErrorDb("Item template %u have RandomProperty==%u and RandomSuffix==%u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix); return 0; } - // RandomProperty case - if(itemProto->RandomProperty) + // Random Property case + if (itemProto->RandomProperty) { uint32 randomPropId = GetItemEnchantMod(itemProto->RandomProperty); - ItemRandomPropertiesEntry const *random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId); - if(!random_id) + ItemRandomPropertiesEntry const* random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId); + if (!random_id) { - sLog.outErrorDb("Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'",randomPropId); + sLog.outErrorDb("Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId); return 0; } return random_id->ID; } - // RandomSuffix case + // Random Suffix case else { uint32 randomPropId = GetItemEnchantMod(itemProto->RandomSuffix); - ItemRandomSuffixEntry const *random_id = sItemRandomSuffixStore.LookupEntry(randomPropId); - if(!random_id) + ItemRandomSuffixEntry const* random_id = sItemRandomSuffixStore.LookupEntry(randomPropId); + if (!random_id) { - sLog.outErrorDb("Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.",randomPropId); + sLog.outErrorDb("Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId); return 0; } @@ -821,38 +821,38 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) void Item::SetItemRandomProperties(int32 randomPropId) { - if(!randomPropId) + if (!randomPropId) return; - if(randomPropId > 0) + if (randomPropId > 0) { - ItemRandomPropertiesEntry const *item_rand = sItemRandomPropertiesStore.LookupEntry(randomPropId); - if(item_rand) + ItemRandomPropertiesEntry const* item_rand = sItemRandomPropertiesStore.LookupEntry(randomPropId); + if (item_rand) { - if(GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != int32(item_rand->ID)) + if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != int32(item_rand->ID)) { SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID,item_rand->ID); SetState(ITEM_CHANGED); } - for(uint32 i = PROP_ENCHANTMENT_SLOT_2; i < PROP_ENCHANTMENT_SLOT_2 + 3; ++i) - SetEnchantment(EnchantmentSlot(i),item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_2],0,0); + for (uint32 i = PROP_ENCHANTMENT_SLOT_2; i < PROP_ENCHANTMENT_SLOT_2 + 3; ++i) + SetEnchantment(EnchantmentSlot(i), item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_2], 0, 0); } } else { - ItemRandomSuffixEntry const *item_rand = sItemRandomSuffixStore.LookupEntry(-randomPropId); - if(item_rand) + ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(-randomPropId); + if (item_rand) { - if( GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != -int32(item_rand->ID) || + if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != -int32(item_rand->ID) || !GetItemSuffixFactor()) { - SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID,-int32(item_rand->ID)); + SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, -int32(item_rand->ID)); UpdateItemSuffixFactor(); SetState(ITEM_CHANGED); } - for(uint32 i = PROP_ENCHANTMENT_SLOT_0; i < PROP_ENCHANTMENT_SLOT_0 + 3; ++i) - SetEnchantment(EnchantmentSlot(i),item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_0],0,0); + for (uint32 i = PROP_ENCHANTMENT_SLOT_0; i < PROP_ENCHANTMENT_SLOT_0 + 3; ++i) + SetEnchantment(EnchantmentSlot(i), item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_0], 0, 0); } } } @@ -860,13 +860,13 @@ void Item::SetItemRandomProperties(int32 randomPropId) bool Item::UpdateItemSuffixFactor() { uint32 suffixFactor = GenerateEnchSuffixFactor(GetEntry()); - if(GetItemSuffixFactor()==suffixFactor) + if (GetItemSuffixFactor() == suffixFactor) return false; SetUInt32Value(ITEM_FIELD_PROPERTY_SEED,suffixFactor); return true; } -void Item::SetState(ItemUpdateState state, Player *forplayer) +void Item::SetState(ItemUpdateState state, Player* forplayer) { if (uState == ITEM_NEW && state == ITEM_REMOVED) { @@ -891,7 +891,7 @@ void Item::SetState(ItemUpdateState state, Player *forplayer) } } -void Item::AddToUpdateQueueOf(Player *player) +void Item::AddToUpdateQueueOf(Player* player) { if (IsInUpdateQueue()) return; @@ -918,10 +918,10 @@ void Item::AddToUpdateQueueOf(Player *player) return; player->m_itemUpdateQueue.push_back(this); - uQueuePos = player->m_itemUpdateQueue.size()-1; + uQueuePos = player->m_itemUpdateQueue.size() -1; } -void Item::RemoveFromUpdateQueueOf(Player *player) +void Item::RemoveFromUpdateQueueOf(Player* player) { if (!IsInUpdateQueue()) return; @@ -971,7 +971,7 @@ bool Item::CanBeTraded(bool mail) const if (Player* owner = GetOwner()) { - if (owner->CanUnequipItem(GetPos(),false) != EQUIP_ERR_OK ) + if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK ) return false; if (owner->GetLootGuid() == GetObjectGuid()) return false; @@ -989,17 +989,17 @@ bool Item::CanBeTraded(bool mail) const bool Item::IsBoundByEnchant() const { // Check all enchants for soulbound - for(uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot) + for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot) { uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)); - if(!enchant_id) + if (!enchant_id) continue; SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if(!enchantEntry) + if (!enchantEntry) continue; - if(enchantEntry->slot & ENCHANTMENT_CAN_SOULBOUND) + if (enchantEntry->slot & ENCHANTMENT_CAN_SOULBOUND) return true; } return false; @@ -1032,12 +1032,12 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const if (equippedItems->EquippedItemClass != -1) // -1 == any item class { - if(equippedItems->EquippedItemClass != int32(proto->Class)) + if (equippedItems->EquippedItemClass != int32(proto->Class)) return false; // wrong item class - if(equippedItems->EquippedItemSubClassMask != 0) // 0 == any subclass + if (equippedItems->EquippedItemSubClassMask != 0) // 0 == any subclass { - if((equippedItems->EquippedItemSubClassMask & (1 << proto->SubClass)) == 0) + if ((equippedItems->EquippedItemSubClassMask & (1 << proto->SubClass)) == 0) return false; // subclass not present in mask } } @@ -1045,9 +1045,9 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const // Only check for item enchantments (TARGET_FLAG_ITEM), all other spells are either NPC spells // or spells where slot requirements are already handled with AttributesEx3 fields // and special code (Titan's Grip, Windfury Attack). Check clearly not applicable for Lava Lash. - if(equippedItems->EquippedItemInventoryTypeMask != 0 && (spellInfo->GetTargets() & TARGET_FLAG_ITEM)) // 0 == any inventory type + if (equippedItems->EquippedItemInventoryTypeMask != 0 && (spellInfo->GetTargets() & TARGET_FLAG_ITEM)) // 0 == any inventory type { - if((equippedItems->EquippedItemInventoryTypeMask & (1 << proto->InventoryType)) == 0) + if ((equippedItems->EquippedItemInventoryTypeMask & (1 << proto->InventoryType)) == 0) return false; // inventory type not present in mask } @@ -1064,8 +1064,8 @@ bool Item::IsTargetValidForItemUse(Unit* pUnitTarget) if (!pUnitTarget) return false; - for(ItemRequiredTargetMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) - if(itr->second.IsFitToRequirements(pUnitTarget)) + for (ItemRequiredTargetMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) + if (itr->second.IsFitToRequirements(pUnitTarget)) return true; return false; @@ -1074,74 +1074,74 @@ bool Item::IsTargetValidForItemUse(Unit* pUnitTarget) void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges) { // Better lost small time at check in comparison lost time at item save to DB. - if((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges)) + if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges)) return; - SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET,id); - SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET,duration); - SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET,charges); + SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET, id); + SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET, duration); + SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET, charges); SetState(ITEM_CHANGED); } void Item::SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration) { - if(GetEnchantmentDuration(slot) == duration) + if (GetEnchantmentDuration(slot) == duration) return; - SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET,duration); + SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET, duration); SetState(ITEM_CHANGED); } void Item::SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges) { - if(GetEnchantmentCharges(slot) == charges) + if (GetEnchantmentCharges(slot) == charges) return; - SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET,charges); + SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET, charges); SetState(ITEM_CHANGED); } void Item::ClearEnchantment(EnchantmentSlot slot) { - if(!GetEnchantmentId(slot)) + if (!GetEnchantmentId(slot)) return; - for(uint8 x = 0; x < 3; ++x) - SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + x, 0); + for (uint8 x = 0; x < 3; ++x) + SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + x, 0); SetState(ITEM_CHANGED); } bool Item::GemsFitSockets() const { bool fits = true; - for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot) + for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot) { uint8 SocketColor = GetProto()->Socket[enchant_slot-SOCK_ENCHANTMENT_SLOT].Color; uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)); - if(!enchant_id) + if (!enchant_id) { - if(SocketColor) fits &= false; + if (SocketColor) fits &= false; continue; } SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if(!enchantEntry) + if (!enchantEntry) { - if(SocketColor) fits &= false; + if (SocketColor) fits &= false; continue; } uint8 GemColor = 0; uint32 gemid = enchantEntry->GemID; - if(gemid) + if (gemid) { ItemPrototype const* gemProto = sItemStorage.LookupEntry(gemid); - if(gemProto) + if (gemProto) { GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties); - if(gemProperty) + if (gemProperty) GemColor = gemProperty->color; } } @@ -1154,17 +1154,17 @@ bool Item::GemsFitSockets() const uint8 Item::GetGemCountWithID(uint32 GemID) const { uint8 count = 0; - for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot) + for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot) { uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)); - if(!enchant_id) + if (!enchant_id) continue; SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if(!enchantEntry) + if (!enchantEntry) continue; - if(GemID == enchantEntry->GemID) + if (GemID == enchantEntry->GemID) ++count; } return count; @@ -1173,27 +1173,27 @@ uint8 Item::GetGemCountWithID(uint32 GemID) const uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const { uint8 count = 0; - for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot) + for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot) { uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)); - if(!enchant_id) + if (!enchant_id) continue; SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if(!enchantEntry) + if (!enchantEntry) continue; ItemPrototype const* gemProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID); - if(!gemProto) + if (!gemProto) continue; - if(gemProto->ItemLimitCategory==limitCategory) + if (gemProto->ItemLimitCategory == limitCategory) ++count; } return count; } -bool Item::IsLimitedToAnotherMapOrZone( uint32 cur_mapId, uint32 cur_zoneId) const +bool Item::IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const { ItemPrototype const* proto = GetProto(); return proto && ((proto->Map && proto->Map != cur_mapId) || (proto->Area && proto->Area != cur_zoneId)); @@ -1208,7 +1208,7 @@ void Item::SendTimeUpdate(Player* owner) if (!duration) return; - WorldPacket data(SMSG_ITEM_TIME_UPDATE, (8+4)); + WorldPacket data(SMSG_ITEM_TIME_UPDATE, (8 + 4)); data << ObjectGuid(GetObjectGuid()); data << uint32(duration); owner->GetSession()->SendPacket(&data); @@ -1219,17 +1219,17 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player ) if (count < 1) return NULL; //don't create item at zero count - if (ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(item)) + if (ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(item)) { if (count > pProto->GetMaxStackSize()) count = pProto->GetMaxStackSize(); - MANGOS_ASSERT(count !=0 && "pProto->Stackable==0 but checked at loading already"); + MANGOS_ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already"); - Item *pItem = NewItemOrBag( pProto ); - if (pItem->Create(sObjectMgr.GenerateItemLowGuid(), item, player) ) + Item* pItem = NewItemOrBag(pProto); + if (pItem->Create(sObjectMgr.GenerateItemLowGuid(), item, player)) { - pItem->SetCount( count ); + pItem->SetCount(count); return pItem; } else @@ -1238,10 +1238,10 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player ) return NULL; } -Item* Item::CloneItem( uint32 count, Player const* player ) const +Item* Item::CloneItem(uint32 count, Player const* player) const { - Item* newItem = CreateItem( GetEntry(), count, player ); - if(!newItem) + Item* newItem = CreateItem(GetEntry(), count, player); + if (!newItem) return NULL; newItem->SetGuidValue(ITEM_FIELD_CREATOR, GetGuidValue(ITEM_FIELD_CREATOR)); @@ -1252,7 +1252,7 @@ Item* Item::CloneItem( uint32 count, Player const* player ) const return newItem; } -bool Item::IsBindedNotWith( Player const* player ) const +bool Item::IsBindedNotWith(Player const* player) const { // own item if (GetOwnerGuid() == player->GetObjectGuid()) @@ -1302,7 +1302,7 @@ void Item::BuildUpdateData(UpdateDataMapType& update_players) ClearUpdateMask(false); } -InventoryResult Item::CanBeMergedPartlyWith( ItemPrototype const* proto ) const +InventoryResult Item::CanBeMergedPartlyWith(ItemPrototype const* proto) const { // check item type if (GetEntry() != proto->ItemId) @@ -1319,15 +1319,15 @@ InventoryResult Item::CanBeMergedPartlyWith( ItemPrototype const* proto ) const return EQUIP_ERR_OK; } -bool ItemRequiredTarget::IsFitToRequirements( Unit* pUnitTarget ) const +bool ItemRequiredTarget::IsFitToRequirements(Unit* pUnitTarget) const { - if(pUnitTarget->GetTypeId() != TYPEID_UNIT) + if (pUnitTarget->GetTypeId() != TYPEID_UNIT) return false; - if(pUnitTarget->GetEntry() != m_uiTargetEntry) + if (pUnitTarget->GetEntry() != m_uiTargetEntry) return false; - switch(m_uiType) + switch (m_uiType) { case ITEM_TARGET_TYPE_CREATURE: return pUnitTarget->isAlive(); @@ -1342,7 +1342,7 @@ bool Item::HasMaxCharges() const { ItemPrototype const* itemProto = GetProto(); - for(int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) if (GetSpellCharges(i) != itemProto->Spells[i].SpellCharges) return false; @@ -1353,7 +1353,7 @@ void Item::RestoreCharges() { ItemPrototype const* itemProto = GetProto(); - for(int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) { if (GetSpellCharges(i) != itemProto->Spells[i].SpellCharges) { @@ -1363,12 +1363,12 @@ void Item::RestoreCharges() } } -void Item::SetLootState( ItemLootUpdateState state ) +void Item::SetLootState(ItemLootUpdateState state) { // ITEM_LOOT_NONE -> ITEM_LOOT_TEMPORARY -> ITEM_LOOT_NONE // ITEM_LOOT_NONE -> ITEM_LOOT_NEW -> ITEM_LOOT_NONE // ITEM_LOOT_NONE -> ITEM_LOOT_NEW -> ITEM_LOOT_UNCHANGED [<-> ITEM_LOOT_CHANGED] -> ITEM_LOOT_REMOVED -> ITEM_LOOT_NONE - switch(state) + switch (state) { case ITEM_LOOT_NONE: case ITEM_LOOT_NEW: diff --git a/src/game/Item.h b/src/game/Item.h index e9e62f4b58e..9c877cdf3e5 100644 --- a/src/game/Item.h +++ b/src/game/Item.h @@ -34,7 +34,7 @@ struct ItemSetEffect { uint32 setid; uint32 item_count; - SpellEntry const *spells[8]; + SpellEntry const* spells[8]; }; enum InventoryResult @@ -273,16 +273,16 @@ bool ItemCanGoIntoBag(ItemPrototype const *proto, ItemPrototype const *pBagProto class MANGOS_DLL_SPEC Item : public Object { public: - static Item* CreateItem( uint32 item, uint32 count, Player const* player = NULL ); + static Item* CreateItem(uint32 item, uint32 count, Player const* player = NULL); Item* CloneItem( uint32 count, Player const* player = NULL ) const; - Item ( ); + Item(); virtual bool Create( uint32 guidlow, uint32 itemid, Player const* owner); ItemPrototype const* GetProto() const; - ObjectGuid const& GetOwnerGuid() const { return GetGuidValue(ITEM_FIELD_OWNER); } + ObjectGuid const& GetOwnerGuid() const { return GetGuidValue(ITEM_FIELD_OWNER); } void SetOwnerGuid(ObjectGuid guid) { SetGuidValue(ITEM_FIELD_OWNER, guid); } Player* GetOwner()const; @@ -292,10 +292,10 @@ class MANGOS_DLL_SPEC Item : public Object bool IsBindedNotWith(Player const* player) const; bool IsBoundByEnchant() const; virtual void SaveToDB(); - virtual bool LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid = ObjectGuid()); + virtual bool LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid = ObjectGuid()); virtual void DeleteFromDB(); void DeleteFromInventoryDB(); - void LoadLootFromDB(Field *fields); + void LoadLootFromDB(Field* fields); bool IsBag() const { return GetProto()->InventoryType == INVTYPE_BAG; } bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; } @@ -305,7 +305,7 @@ class MANGOS_DLL_SPEC Item : public Object bool IsFitToSpellRequirements(SpellEntry const* spellInfo) const; bool IsTargetValidForItemUse(Unit* pUnitTarget); - bool IsLimitedToAnotherMapOrZone( uint32 cur_mapId, uint32 cur_zoneId) const; + bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const; bool GemsFitSockets() const; uint32 GetCount() const { return GetUInt32Value (ITEM_FIELD_STACK_COUNT); } @@ -316,7 +316,7 @@ class MANGOS_DLL_SPEC Item : public Object InventoryResult CanBeMergedPartlyWith(ItemPrototype const* proto) const; uint8 GetSlot() const {return m_slot;} - Bag *GetContainer() { return m_container; } + Bag* GetContainer() { return m_container; } uint8 GetBagSlot() const; void SetSlot(uint8 slot) {m_slot = slot;} uint16 GetPos() const { return uint16(GetBagSlot()) << 8 | GetSlot(); } @@ -338,9 +338,9 @@ class MANGOS_DLL_SPEC Item : public Object void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration); void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges); void ClearEnchantment(EnchantmentSlot slot); - uint32 GetEnchantmentId(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET);} - uint32 GetEnchantmentDuration(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET);} - uint32 GetEnchantmentCharges(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET);} + uint32 GetEnchantmentId(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET);} + uint32 GetEnchantmentDuration(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET);} + uint32 GetEnchantmentCharges(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET);} std::string const& GetText() const { return m_text; } void SetText(std::string const& text) { m_text = text; } @@ -350,7 +350,7 @@ class MANGOS_DLL_SPEC Item : public Object // spell charges (signed but stored as unsigned) int32 GetSpellCharges(uint8 index/*0..5*/ = 0) const { return GetInt32Value(ITEM_FIELD_SPELL_CHARGES + index); } - void SetSpellCharges(uint8 index/*0..5*/, int32 value) { SetInt32Value(ITEM_FIELD_SPELL_CHARGES + index,value); } + void SetSpellCharges(uint8 index/*0..5*/, int32 value) { SetInt32Value(ITEM_FIELD_SPELL_CHARGES + index,value); } bool HasMaxCharges() const; void RestoreCharges(); @@ -364,9 +364,9 @@ class MANGOS_DLL_SPEC Item : public Object // Update States ItemUpdateState GetState() const { return uState; } - void SetState(ItemUpdateState state, Player *forplayer = NULL); - void AddToUpdateQueueOf(Player *player); - void RemoveFromUpdateQueueOf(Player *player); + void SetState(ItemUpdateState state, Player* forplayer = NULL); + void AddToUpdateQueueOf(Player* player); + void RemoveFromUpdateQueueOf(Player* player); bool IsInUpdateQueue() const { return uQueuePos != -1; } uint16 GetQueuePos() const { return uQueuePos; } void FSetState(ItemUpdateState state) // forced @@ -385,7 +385,7 @@ class MANGOS_DLL_SPEC Item : public Object private: std::string m_text; uint8 m_slot; - Bag *m_container; + Bag* m_container; ItemUpdateState uState; int16 uQueuePos; bool mb_in_trade; // true if item is currently in trade-window diff --git a/src/game/ItemEnchantmentMgr.cpp b/src/game/ItemEnchantmentMgr.cpp index dd61ea689cf..80e64df6492 100644 --- a/src/game/ItemEnchantmentMgr.cpp +++ b/src/game/ItemEnchantmentMgr.cpp @@ -57,7 +57,7 @@ void LoadRandomEnchantmentsTable() if (result) { - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 5b7a925f6f5..461f85a3138 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -4115,11 +4115,11 @@ bool ChatHandler::HandleNpcInfoCommand(char* /*args*/) break; if (diff < MAX_DIFFICULTY) - PSendSysMessage(LANG_NPCINFO_CHAR_DIFFICULTY, target->GetGUIDLow(), faction, npcflags, + PSendSysMessage(LANG_NPCINFO_CHAR_DIFFICULTY, target->GetGuidStr().c_str(), faction, npcflags, Entry, target->GetCreatureInfo()->Entry, diff, displayid, nativeid); else - PSendSysMessage(LANG_NPCINFO_CHAR, target->GetGUIDLow(), faction, npcflags, Entry, displayid, nativeid); + PSendSysMessage(LANG_NPCINFO_CHAR, target->GetGuidStr().c_str(), faction, npcflags, Entry, displayid, nativeid); PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel()); PSendSysMessage(LANG_NPCINFO_HEALTH,target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth()); @@ -4506,6 +4506,12 @@ bool ChatHandler::HandleBankCommand(char* /*args*/) return true; } +bool ChatHandler::HandleMailBoxCommand(char* /*args*/) +{ + m_session->SendShowMailBox(m_session->GetPlayer()->GetObjectGuid()); + return true; +} + bool ChatHandler::HandleStableCommand(char* /*args*/) { m_session->SendStablePet(m_session->GetPlayer()->GetObjectGuid()); diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index fd702952b11..c4765291825 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -234,6 +234,8 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ ) if (pLoot) { + pLoot->NotifyMoneyRemoved(); + if (!guid.IsItem() && player->GetGroup()) //item can be looted only single player { Group *group = player->GetGroup(); @@ -254,24 +256,29 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ ) { (*i)->ModifyMoney( money_per_player ); (*i)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, money_per_player); - //Offset surely incorrect, but works - WorldPacket data( SMSG_LOOT_MONEY_NOTIFY, 4 ); + + WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4+1); data << uint32(money_per_player); - (*i)->GetSession()->SendPacket( &data ); + data << uint8(playersNear.size() > 1 ? 0 : 1);// 0 is "you share of loot..." + + (*i)->GetSession()->SendPacket(&data); } } else { player->ModifyMoney( pLoot->gold ); player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, pLoot->gold); + + WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4+1); + data << uint32(pLoot->gold); + data << uint8(1); // 1 is "you loot..." + player->GetSession()->SendPacket(&data); } pLoot->gold = 0; if (pItem) pItem->SetLootState(ITEM_LOOT_CHANGED); - - pLoot->NotifyMoneyRemoved(); } } diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index 1340a7e5ac7..c17b816d25b 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -102,7 +102,7 @@ void LootStore::LoadLootTable() if (result) { - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { diff --git a/src/game/MailHandler.cpp b/src/game/MailHandler.cpp index e2817d6ef00..c7c8db657e6 100644 --- a/src/game/MailHandler.cpp +++ b/src/game/MailHandler.cpp @@ -36,6 +36,56 @@ #include "WorldPacket.h" #include "WorldSession.h" #include "Opcodes.h" +#include "Chat.h" + +bool WorldSession::CheckMailBox(ObjectGuid guid) +{ + // GM case + if (guid == GetPlayer()->GetObjectGuid()) + { + // command case will return only if player have real access to command + if (!ChatHandler(GetPlayer()).FindCommand("mailbox")) + { + DEBUG_LOG("%s attempt open mailbox in cheating way.", guid.GetString().c_str()); + return false; + } + } + // mailbox case + else if (guid.IsGameObject()) + { + if (!GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_MAILBOX)) + { + DEBUG_LOG("Mailbox %s not found or %s can't interact with him.", guid.GetString().c_str(), GetPlayer()->GetGuidStr().c_str()); + return false; + } + } + // squire case + else if (guid.IsAnyTypeCreature()) + { + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); + if (!creature) + { + DEBUG_LOG("%s not found or %s can't interact with him.", creature->GetGuidStr().c_str(), GetPlayer()->GetGuidStr().c_str()); + return false; + } + + if (!(creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_SQUIRE)) + { + DEBUG_LOG("%s not have access to mailbox.", creature->GetGuidStr().c_str()); + return false; + } + + if (creature->GetOwnerGuid() != GetPlayer()->GetObjectGuid()) + { + DEBUG_LOG("%s not owned by %s for access to mailbox.", creature->GetGuidStr().c_str(), GetPlayer()->GetGuidStr().c_str()); + return false; + } + } + else + return false; + + return true; +} /** * Handles the Packet sent by the client when sending a mail. @@ -95,7 +145,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) // packet read complete, now do check - if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX)) + if (!CheckMailBox(mailboxGuid)) return; if (receiver.empty()) @@ -295,7 +345,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data ) recv_data >> mailboxGuid; recv_data >> mailId; - if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX)) + if (!CheckMailBox(mailboxGuid)) return; Player *pl = _player; @@ -326,7 +376,7 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data ) recv_data >> mailId; recv_data.read_skip(); // mailTemplateId - if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX)) + if (!CheckMailBox(mailboxGuid)) return; Player* pl = _player; @@ -362,7 +412,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data ) recv_data >> mailId; recv_data.read_skip(); // original sender GUID for return to, not used - if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX)) + if (!CheckMailBox(mailboxGuid)) return; Player *pl = _player; @@ -421,7 +471,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) recv_data >> mailId; recv_data >> itemId; // item guid low - if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX)) + if (!CheckMailBox(mailboxGuid)) return; Player* pl = _player; @@ -516,7 +566,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data ) recv_data >> mailboxGuid; recv_data >> mailId; - if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX)) + if (!CheckMailBox(mailboxGuid)) return; Player *pl = _player; @@ -551,7 +601,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) ObjectGuid mailboxGuid; recv_data >> mailboxGuid; - if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX)) + if (!CheckMailBox(mailboxGuid)) return; // client can't work with packets > max int16 value @@ -680,7 +730,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data ) recv_data >> mailboxGuid; recv_data >> mailId; - if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX)) + if (!CheckMailBox(mailboxGuid)) return; Player *pl = _player; diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 55b15d14bde..a695af41263 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2869,6 +2869,93 @@ void Map::ScriptsProcess() sLog.outError("SCRIPT_COMMAND_ATTACK_START (script id %u) unexpected error, attacker or victim could not be found, no action.", step.script->id); break; } + case SCRIPT_COMMAND_GO_LOCK_STATE: + { + if ((!source || !source->isType(TYPEMASK_WORLDOBJECT)) && (!target || !target->isType(TYPEMASK_WORLDOBJECT))) + { + sLog.outError("SCRIPT_COMMAND_GO_LOCK_STATE (script id %u) call for non-worldobject (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", step.script->id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + break; + } + + WorldObject* pSearcher = source && source->isType(TYPEMASK_WORLDOBJECT) ? (WorldObject*)source : (WorldObject*)target; + GameObject* pGo = NULL; + + MaNGOS::NearestGameObjectEntryInObjectRangeCheck u_check(*pSearcher, step.script->goLockState.goEntry, step.script->goLockState.searchRadius); + MaNGOS::GameObjectLastSearcher searcher(pGo, u_check); + + Cell::VisitGridObjects(pSearcher, searcher, step.script->goLockState.searchRadius); + + /* flag lockState + * go_lock 0x01 + * go_unlock 0x02 + * go_nonInteract 0x04 + * go_Interact 0x08 + */ + if (pGo) + { + // Lock or Unlock + if (step.script->goLockState.lockState & 0x01) + pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + else if (step.script->goLockState.lockState & 0x02) + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + // Set Non Interactable or Set Interactable + if (step.script->goLockState.lockState & 0x04) + pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NO_INTERACT); + else if (step.script->goLockState.lockState & 0x08) + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NO_INTERACT); + } + } + case SCRIPT_COMMAND_STAND_STATE: + { + if (!source) + { + sLog.outError("SCRIPT_COMMAND_STAND_STATE (script id %u) call for NULL source.", step.script->id); + break; + } + + if (!source->isType(TYPEMASK_WORLDOBJECT)) + { + sLog.outError("SCRIPT_COMMAND_STAND_STATE (script id %u) call for non-worldobject (TypeId: %u), skipping.", step.script->id, source->GetTypeId()); + break; + } + // When creatureEntry is not defined, GameObject can not be source + else if (!step.script->standState.creatureEntry) + { + if (!source->isType(TYPEMASK_UNIT)) + { + sLog.outError("SCRIPT_COMMAND_STAND_STATE (script id %u) are missing datalong2 (creature entry). Unsupported call for non-unit (TypeId: %u), skipping.", step.script->id, source->GetTypeId()); + break; + } + } + + WorldObject* pSource = (WorldObject*)source; + Creature* pBuddy = NULL; + + // flag_target_as_source 0x01 + + // If target is Unit* and should change it's stand state (or should be source of searcher below) + if (target && target->isType(TYPEMASK_UNIT) && step.script->standState.flags & 0x01) + pSource = (WorldObject*)target; + + // If step has a buddy entry defined, search for it. + if (step.script->standState.creatureEntry) + { + MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSource, step.script->standState.creatureEntry, true, step.script->standState.searchRadius); + MaNGOS::CreatureLastSearcher searcher(pBuddy, u_check); + + Cell::VisitGridObjects(pSource, searcher, step.script->standState.searchRadius); + + // If buddy found, then use it or break (break since we must assume pBuddy was defined for a reason) + if (pBuddy) + pSource = (WorldObject*)pBuddy; + else + break; + } + + // Must be safe cast to Unit* here + ((Unit*)pSource)->SetStandState(step.script->standState.stand_state); + break; + } default: sLog.outError("Unknown SCRIPT_COMMAND_ %u called for script id %u.",step.script->command, step.script->id); break; @@ -3051,3 +3138,111 @@ uint32 Map::GenerateLocalLowGuid(HighGuid guidhigh) MANGOS_ASSERT(0); return 0; } + +/** + * Helper structure for building static chat information + * + */ +class StaticMonsterChatBuilder +{ + public: + StaticMonsterChatBuilder(CreatureInfo const* cInfo, ChatMsg msgtype, int32 textId, uint32 language, Unit* target, uint32 senderLowGuid = 0) + : i_cInfo(cInfo), i_msgtype(msgtype), i_textId(textId), i_language(language), i_target(target) + { + // 0 lowguid not used in core, but accepted fine in this case by client + i_senderGuid = i_cInfo->GetObjectGuid(senderLowGuid); + } + void operator()(WorldPacket& data, int32 loc_idx) + { + char const* text = sObjectMgr.GetMangosString(i_textId,loc_idx); + + std::string nameForLocale = ""; + if (loc_idx >= 0) + { + CreatureLocale const *cl = sObjectMgr.GetCreatureLocale(i_cInfo->Entry); + if (cl) + { + if (cl->Name.size() > (size_t)loc_idx && !cl->Name[loc_idx].empty()) + nameForLocale = cl->Name[loc_idx]; + } + } + + if (nameForLocale.empty()) + nameForLocale = i_cInfo->Name; + + WorldObject::BuildMonsterChat(&data, i_senderGuid, i_msgtype, text, i_language, nameForLocale.c_str(), i_target ? i_target->GetObjectGuid() : ObjectGuid(), i_target ? i_target->GetNameForLocaleIdx(loc_idx) : ""); + } + + private: + ObjectGuid i_senderGuid; + CreatureInfo const* i_cInfo; + ChatMsg i_msgtype; + int32 i_textId; + uint32 i_language; + Unit* i_target; +}; + + +/** + * Function simulates yell of creature + * + * @param guid must be creature guid of whom to Simulate the yell, non-creature guids not supported at this moment + * @param textId Id of the simulated text + * @param language language of the text + * @param target, can be NULL + */ +void Map::MonsterYellToMap(ObjectGuid guid, int32 textId, uint32 language, Unit* target) +{ + if (guid.IsAnyTypeCreature()) + { + CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(guid.GetEntry()); + if (!cInfo) + { + sLog.outError("Map::MonsterYellToMap: Called for nonexistent creature entry in guid: %s", guid.GetString().c_str()); + return; + } + + MonsterYellToMap(cInfo, textId, language, target, guid.GetCounter()); + } + else + { + sLog.outError("Map::MonsterYellToMap: Called for non creature guid: %s", guid.GetString().c_str()); + return; + } +} + + +/** + * Function simulates yell of creature + * + * @param cinfo must be entry of Creature of whom to Simulate the yell + * @param textId Id of the simulated text + * @param language language of the text + * @param target, can be NULL + * @param senderLowGuid provide way proper show yell for near spawned creature with known lowguid, + * 0 accepted by client else if this not important + */ +void Map::MonsterYellToMap(CreatureInfo const* cinfo, int32 textId, uint32 language, Unit* target, uint32 senderLowGuid /*= 0*/) +{ + StaticMonsterChatBuilder say_build(cinfo, CHAT_MSG_MONSTER_YELL, textId, language, target, senderLowGuid); + MaNGOS::LocalizedPacketDo say_do(say_build); + + Map::PlayerList const& pList = GetPlayers(); + for (PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + say_do(itr->getSource()); +} + +/** + * Function to play sound to all players in map + * + * @param soundId Played Sound + */ +void Map::PlayDirectSoundToMap(uint32 soundId) +{ + WorldPacket data(SMSG_PLAY_SOUND, 4); + data << uint32(soundId); + + Map::PlayerList const& pList = GetPlayers(); + for (PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + itr->getSource()->SendDirectMessage(&data); +} diff --git a/src/game/Map.h b/src/game/Map.h index 3dde4d9a946..31e8731cb6a 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -40,6 +40,7 @@ #include #include +struct CreatureInfo; class Creature; class Unit; class WorldPacket; @@ -94,6 +95,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager friend class MapReference; friend class ObjectGridLoader; friend class ObjectWorldLoader; + protected: Map(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode); @@ -252,6 +254,11 @@ class MANGOS_DLL_SPEC Map : public GridRefManager void CreateInstanceData(bool load); InstanceData* GetInstanceData() { return i_data; } uint32 GetScriptId() const { return i_script_id; } + + void MonsterYellToMap(ObjectGuid guid, int32 textId, uint32 language, Unit* target); + void MonsterYellToMap(CreatureInfo const* cinfo, int32 textId, uint32 language, Unit* target, uint32 senderLowGuid = 0); + void PlayDirectSoundToMap(uint32 soundId); + private: void LoadMapAndVMap(int gx, int gy); @@ -289,8 +296,8 @@ class MANGOS_DLL_SPEC Map : public GridRefManager void SendObjectUpdates(); std::set i_objectsToClientUpdate; - protected: + protected: MapEntry const* i_mapEntry; uint8 i_spawnMode; uint32 i_id; @@ -306,6 +313,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager ActiveNonPlayers m_activeNonPlayers; ActiveNonPlayers::iterator m_activeNonPlayersIter; MapStoredObjectTypesContainer m_objectsStore; + private: time_t i_gridExpiry; diff --git a/src/game/MapPersistentStateMgr.cpp b/src/game/MapPersistentStateMgr.cpp index 0b1020a20b7..76690896ab4 100644 --- a/src/game/MapPersistentStateMgr.cpp +++ b/src/game/MapPersistentStateMgr.cpp @@ -702,7 +702,7 @@ void MapPersistentStateManager::_DelHelper(DatabaseType &db, const char *fields, void MapPersistentStateManager::CleanupInstances() { - barGoLink bar(2); + BarGoLink bar(2); bar.step(); // load reset times and clean expired instances @@ -754,7 +754,7 @@ void MapPersistentStateManager::PackInstances() delete result; } - barGoLink bar( InstanceSet.size() + 1); + BarGoLink bar(InstanceSet.size() + 1); bar.step(); uint32 InstanceNumber = 1; @@ -917,9 +917,9 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes() uint32 count = 0; QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime FROM creature_respawn LEFT JOIN instance ON instance = id"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -928,7 +928,7 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -982,9 +982,9 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes() QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime FROM gameobject_respawn LEFT JOIN instance ON instance = id"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -993,7 +993,7 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 2da44c56b7a..d9cff01a3c7 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -292,7 +292,9 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ ) // not set flags if player can't free move to prevent lost state at logout cancel if(GetPlayer()->CanFreeMove()) { - GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT); + float height = GetPlayer()->GetTerrain()->GetHeight(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY(), GetPlayer()->GetPositionZ()); + if ((GetPlayer()->GetPositionZ() < height + 0.1f) && !(GetPlayer()->IsInWater())) + GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT); WorldPacket data( SMSG_FORCE_MOVE_ROOT, (8+4) ); // guess size data << GetPlayer()->GetPackGUID(); diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 53a6616e70f..90252a2110c 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -96,6 +96,13 @@ void WorldSession::SendShowBank(ObjectGuid guid) SendPacket(&data); } +void WorldSession::SendShowMailBox(ObjectGuid guid) +{ + WorldPacket data(SMSG_SHOW_MAILBOX, 8); + data << ObjectGuid(guid); + SendPacket(&data); +} + void WorldSession::HandleTrainerListOpcode( WorldPacket & recv_data ) { ObjectGuid guid; @@ -112,7 +119,7 @@ void WorldSession::SendTrainerList(ObjectGuid guid) } -static void SendTrainerSpellHelper(WorldPacket& data, TrainerSpell const* tSpell, TrainerSpellState state, float fDiscountMod, bool can_learn_primary_prof) +static void SendTrainerSpellHelper(WorldPacket& data, TrainerSpell const* tSpell, TrainerSpellState state, float fDiscountMod, bool can_learn_primary_prof, uint32 skillReqLevel) { bool primary_prof_first_rank = sSpellMgr.IsPrimaryProfessionFirstRankSpell(tSpell->learnedSpell); SpellChainNode const* chain_node = sSpellMgr.GetSpellChainNode(tSpell->learnedSpell); @@ -124,7 +131,7 @@ static void SendTrainerSpellHelper(WorldPacket& data, TrainerSpell const* tSpell data << uint32(primary_prof_first_rank && can_learn_primary_prof ? 1 : 0); // primary prof. learn confirmation dialog data << uint32(primary_prof_first_rank ? 1 : 0); // must be equal prev. field to have learn button in enabled state - data << uint8(tSpell->reqLevel); + data << uint8(skillReqLevel ? skillReqLevel : tSpell->reqLevel); data << uint32(tSpell->reqSkill); data << uint32(tSpell->reqSkillValue); data << uint32(!tSpell->IsCastable() && chain_node ? (chain_node->prev ? chain_node->prev : chain_node->req) : 0); @@ -186,12 +193,13 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle) { TrainerSpell const* tSpell = &itr->second; - if(!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell)) + uint32 skillReqLevel = 0; + if(!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell, &skillReqLevel)) continue; TrainerSpellState state = _player->GetTrainerSpellState(tSpell); - SendTrainerSpellHelper(data, tSpell, state, fDiscountMod, can_learn_primary_prof); + SendTrainerSpellHelper(data, tSpell, state, fDiscountMod, can_learn_primary_prof, skillReqLevel); ++count; } @@ -203,12 +211,13 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle) { TrainerSpell const* tSpell = &itr->second; - if(!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell)) + uint32 skillReqLevel = 0; + if(!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell, &skillReqLevel)) continue; TrainerSpellState state = _player->GetTrainerSpellState(tSpell); - SendTrainerSpellHelper(data, tSpell, state, fDiscountMod, can_learn_primary_prof); + SendTrainerSpellHelper(data, tSpell, state, fDiscountMod, can_learn_primary_prof, skillReqLevel); ++count; } diff --git a/src/game/Object.cpp b/src/game/Object.cpp index ad079730824..318cd373f72 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -108,6 +108,25 @@ void Object::SetObjectScale(float newScale) SetFloatValue(OBJECT_FIELD_SCALE_X, newScale); } +void Object::SendForcedObjectUpdate() +{ + if (!m_inWorld || !m_objectUpdated) + return; + + UpdateDataMapType update_players; + + BuildUpdateData(update_players); + RemoveFromClientUpdateList(); + + WorldPacket packet; // here we allocate a std::vector with a size of 0x10000 + for(UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter) + { + iter->second.BuildPacket(&packet); + iter->first->GetSession()->SendPacket(&packet); + packet.clear(); // clean the string + } +} + void Object::BuildMovementUpdateBlock(UpdateData * data, uint16 flags ) const { ByteBuffer buf(500); @@ -1452,21 +1471,21 @@ bool WorldObject::IsPositionValid() const void WorldObject::MonsterSay(const char* text, uint32 language, Unit* target) { WorldPacket data(SMSG_MESSAGECHAT, 200); - BuildMonsterChat(&data, CHAT_MSG_MONSTER_SAY, text, language, GetName(), target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : ""); + BuildMonsterChat(&data, GetObjectGuid(), CHAT_MSG_MONSTER_SAY, text, language, GetName(), target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : ""); SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY),true); } void WorldObject::MonsterYell(const char* text, uint32 language, Unit* target) { WorldPacket data(SMSG_MESSAGECHAT, 200); - BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, text, language, GetName(), target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : ""); + BuildMonsterChat(&data, GetObjectGuid(), CHAT_MSG_MONSTER_YELL, text, language, GetName(), target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : ""); SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_YELL),true); } void WorldObject::MonsterTextEmote(const char* text, Unit* target, bool IsBossEmote) { WorldPacket data(SMSG_MESSAGECHAT, 200); - BuildMonsterChat(&data, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, text, LANG_UNIVERSAL, + BuildMonsterChat(&data, GetObjectGuid(), IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, text, LANG_UNIVERSAL, GetName(), target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : ""); SendMessageToSetInRange(&data, sWorld.getConfig(IsBossEmote ? CONFIG_FLOAT_LISTEN_RANGE_YELL : CONFIG_FLOAT_LISTEN_RANGE_TEXTEMOTE), true); } @@ -1477,7 +1496,7 @@ void WorldObject::MonsterWhisper(const char* text, Unit* target, bool IsBossWhis return; WorldPacket data(SMSG_MESSAGECHAT, 200); - BuildMonsterChat(&data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, text, LANG_UNIVERSAL, + BuildMonsterChat(&data, GetObjectGuid(), IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, text, LANG_UNIVERSAL, GetName(), target->GetObjectGuid(), target->GetName()); ((Player*)target)->GetSession()->SendPacket(&data); } @@ -1493,7 +1512,7 @@ namespace MaNGOS { char const* text = sObjectMgr.GetMangosString(i_textId,loc_idx); - i_object.BuildMonsterChat(&data, i_msgtype, text, i_language, i_object.GetNameForLocaleIdx(loc_idx), i_target ? i_target->GetObjectGuid() : ObjectGuid(), i_target ? i_target->GetNameForLocaleIdx(loc_idx) : ""); + WorldObject::BuildMonsterChat(&data, i_object.GetObjectGuid(), i_msgtype, text, i_language, i_object.GetNameForLocaleIdx(loc_idx), i_target ? i_target->GetObjectGuid() : ObjectGuid(), i_target ? i_target->GetNameForLocaleIdx(loc_idx) : ""); } private: @@ -1555,17 +1574,17 @@ void WorldObject::MonsterWhisper(int32 textId, Unit* target, bool IsBossWhisper) char const* text = sObjectMgr.GetMangosString(textId, loc_idx); WorldPacket data(SMSG_MESSAGECHAT, 200); - BuildMonsterChat(&data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, text, LANG_UNIVERSAL, + BuildMonsterChat(&data, GetObjectGuid(), IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, text, LANG_UNIVERSAL, GetNameForLocaleIdx(loc_idx), target->GetObjectGuid(), ""); ((Player*)target)->GetSession()->SendPacket(&data); } -void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid, char const* targetName) const +void WorldObject::BuildMonsterChat(WorldPacket *data, ObjectGuid senderGuid, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid, char const* targetName) { *data << uint8(msgtype); *data << uint32(language); - *data << ObjectGuid(GetObjectGuid()); + *data << ObjectGuid(senderGuid); *data << uint32(0); // 2.1.0 *data << uint32(strlen(name)+1); *data << name; diff --git a/src/game/Object.h b/src/game/Object.h index ab96b09f10a..000ebf8a91b 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -128,7 +128,7 @@ class MANGOS_DLL_SPEC Object m_inWorld = true; // synchronize values mirror with values array (changes will send in updatecreate opcode any way - ClearUpdateMask(false); // false - we can't have update dat in update queue before adding to world + ClearUpdateMask(false); // false - we can't have update data in update queue before adding to world } virtual void RemoveFromWorld() { @@ -138,7 +138,6 @@ class MANGOS_DLL_SPEC Object } ObjectGuid const& GetObjectGuid() const { return GetGuidValue(OBJECT_FIELD_GUID); } - const uint64& GetGUID() const { return GetUInt64Value(OBJECT_FIELD_GUID); } // DEPRECATED, not use, will removed soon uint32 GetGUIDLow() const { return GetObjectGuid().GetCounter(); } PackedGuid const& GetPackGUID() const { return m_PackGUID; } std::string GetGuidStr() const { return GetObjectGuid().GetString(); } @@ -164,6 +163,7 @@ class MANGOS_DLL_SPEC Object virtual void RemoveFromClientUpdateList(); virtual void BuildUpdateData(UpdateDataMapType& update_players); void MarkForClientUpdate(); + void SendForcedObjectUpdate(); void BuildValuesUpdateBlockForPlayer( UpdateData *data, Player *target ) const; void BuildOutOfRangeUpdateBlock( UpdateData *data ) const; @@ -431,7 +431,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object virtual ~WorldObject ( ) {} - virtual void Update ( uint32 /*update_diff*/, uint32 /*time_diff*/ ) {} + virtual void Update(uint32 /*update_diff*/, uint32 /*time_diff*/) {} void _Create( uint32 guidlow, HighGuid guidhigh, uint32 phaseMask); @@ -541,7 +541,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object void MonsterTextEmote(int32 textId, Unit* target, bool IsBossEmote = false); void MonsterWhisper(int32 textId, Unit* receiver, bool IsBossWhisper = false); void MonsterYellToZone(int32 textId, uint32 language, Unit* target); - void BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid, char const* targetName) const; + static void BuildMonsterChat(WorldPacket *data, ObjectGuid senderGuid, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid, char const* targetName); void PlayDistanceSound(uint32 sound_id, Player* target = NULL); void PlayDirectSound(uint32 sound_id, Player* target = NULL); diff --git a/src/game/ObjectGuid.cpp b/src/game/ObjectGuid.cpp index a206abb35d9..8688013f91d 100644 --- a/src/game/ObjectGuid.cpp +++ b/src/game/ObjectGuid.cpp @@ -38,6 +38,7 @@ char const* ObjectGuid::GetTypeName(HighGuid high) case HIGHGUID_CORPSE: return "Corpse"; case HIGHGUID_MO_TRANSPORT: return "MoTransport"; case HIGHGUID_INSTANCE: return "InstanceID"; + case HIGHGUID_GROUP: return "Group"; default: return ""; } @@ -107,3 +108,4 @@ template uint32 ObjectGuidGenerator::Generate(); template uint32 ObjectGuidGenerator::Generate(); template uint32 ObjectGuidGenerator::Generate(); template uint32 ObjectGuidGenerator::Generate(); +template uint32 ObjectGuidGenerator::Generate(); diff --git a/src/game/ObjectGuid.h b/src/game/ObjectGuid.h index 1cfb61fe3ca..9022d850285 100644 --- a/src/game/ObjectGuid.h +++ b/src/game/ObjectGuid.h @@ -59,20 +59,21 @@ enum TypeMask enum HighGuid { - HIGHGUID_ITEM = 0x4700, // blizz 4700 - HIGHGUID_CONTAINER = 0x4700, // blizz 4700 - HIGHGUID_PLAYER = 0x0000, // blizz 0700 (temporary reverted back to 0 high guid + HIGHGUID_ITEM = 0x470, // blizz 470 + HIGHGUID_CONTAINER = 0x470, // blizz 470 + HIGHGUID_PLAYER = 0x000, // blizz 070 (temporary reverted back to 0 high guid // in result unknown source visibility player with // player problems. please reapply only after its resolve) - HIGHGUID_GAMEOBJECT = 0xF110, // blizz F110/F510 - HIGHGUID_TRANSPORT = 0xF120, // blizz F120/F520 (for GAMEOBJECT_TYPE_TRANSPORT) - HIGHGUID_UNIT = 0xF130, // blizz F130/F530 - HIGHGUID_PET = 0xF140, // blizz F140/F540 - HIGHGUID_VEHICLE = 0xF150, // blizz F150/F550 - HIGHGUID_DYNAMICOBJECT = 0xF100, // blizz F100/F500 - HIGHGUID_CORPSE = 0xF500, // blizz F100/F500 used second variant to resolve conflict with HIGHGUID_DYNAMICOBJECT - HIGHGUID_MO_TRANSPORT = 0x1FC0, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT) - HIGHGUID_INSTANCE = 0x1F42, // blizz 1F42/1F44/1F44/1F47 + HIGHGUID_GAMEOBJECT = 0xF11, // blizz F11/F51 + HIGHGUID_TRANSPORT = 0xF12, // blizz F12/F52 (for GAMEOBJECT_TYPE_TRANSPORT) + HIGHGUID_UNIT = 0xF13, // blizz F13/F53 + HIGHGUID_PET = 0xF14, // blizz F14/F54 + HIGHGUID_VEHICLE = 0xF15, // blizz F15/F55 + HIGHGUID_DYNAMICOBJECT = 0xF10, // blizz F10/F50 + HIGHGUID_CORPSE = 0xF50, // blizz F10/F50 used second variant to resolve conflict with HIGHGUID_DYNAMICOBJECT + HIGHGUID_MO_TRANSPORT = 0x1FC, // blizz 1FC (for GAMEOBJECT_TYPE_MO_TRANSPORT) + HIGHGUID_INSTANCE = 0x1F4, // blizz 1F4 + HIGHGUID_GROUP = 0x1F5, // blizz 1F5 }; class ObjectGuid; @@ -88,26 +89,26 @@ class MANGOS_DLL_SPEC ObjectGuid { public: // constructors ObjectGuid() : m_guid(0) {} - ObjectGuid(uint64 const& guid) : m_guid(guid) {} // temporary allowed implicit cast, really bad in connection with operator uint64() - ObjectGuid(HighGuid hi, uint32 entry, uint32 counter) : m_guid(counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(hi) << 48) : 0) {} - ObjectGuid(HighGuid hi, uint32 counter) : m_guid(counter ? uint64(counter) | (uint64(hi) << 48) : 0) {} + explicit ObjectGuid(uint64 guid) : m_guid(guid) {} + ObjectGuid(HighGuid hi, uint32 entry, uint32 counter) : m_guid(counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(hi) << 52) : 0) {} + ObjectGuid(HighGuid hi, uint32 counter) : m_guid(counter ? uint64(counter) | (uint64(hi) << 52) : 0) {} operator uint64() const { return m_guid; } private: - ObjectGuid(uint32 const&); // no implementation, used for catch wrong type assign + explicit ObjectGuid(uint32 const&); // no implementation, used for catch wrong type assign ObjectGuid(HighGuid, uint32, uint64 counter); // no implementation, used for catch wrong type assign ObjectGuid(HighGuid, uint64 counter); // no implementation, used for catch wrong type assign public: // modifiers PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); } - void Set(uint64 const& guid) { m_guid = guid; } + void Set(uint64 guid) { m_guid = guid; } void Clear() { m_guid = 0; } PackedGuid WriteAsPacked() const; public: // accessors - uint64 const& GetRawValue() const { return m_guid; } - HighGuid GetHigh() const { return HighGuid((m_guid >> 48) & 0x0000FFFF); } + uint64 GetRawValue() const { return m_guid; } + HighGuid GetHigh() const { return HighGuid((m_guid >> 52) & 0x00000FFF); } uint32 GetEntry() const { return HasEntry() ? uint32((m_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; } uint32 GetCounter() const { @@ -125,22 +126,23 @@ class MANGOS_DLL_SPEC ObjectGuid uint32 GetMaxCounter() const { return GetMaxCounter(GetHigh()); } - bool IsEmpty() const { return m_guid == 0; } - bool IsCreature() const { return GetHigh() == HIGHGUID_UNIT; } - bool IsPet() const { return GetHigh() == HIGHGUID_PET; } - bool IsVehicle() const { return GetHigh() == HIGHGUID_VEHICLE; } - bool IsCreatureOrPet() const { return IsCreature() || IsPet(); } - bool IsCreatureOrVehicle() const { return IsCreature() || IsVehicle(); } - bool IsAnyTypeCreature() const { return IsCreature() || IsPet() || IsVehicle(); } - bool IsPlayer() const { return !IsEmpty() && GetHigh() == HIGHGUID_PLAYER; } - bool IsUnit() const { return IsAnyTypeCreature() || IsPlayer(); } - bool IsItem() const { return GetHigh() == HIGHGUID_ITEM; } - bool IsGameObject() const { return GetHigh() == HIGHGUID_GAMEOBJECT; } - bool IsDynamicObject() const { return GetHigh() == HIGHGUID_DYNAMICOBJECT; } - bool IsCorpse() const { return GetHigh() == HIGHGUID_CORPSE; } - bool IsTransport() const { return GetHigh() == HIGHGUID_TRANSPORT; } - bool IsMOTransport() const { return GetHigh() == HIGHGUID_MO_TRANSPORT; } - bool IsInstance() const { return GetHigh() == HIGHGUID_INSTANCE; } + bool IsEmpty() const { return m_guid == 0; } + bool IsCreature() const { return GetHigh() == HIGHGUID_UNIT; } + bool IsPet() const { return GetHigh() == HIGHGUID_PET; } + bool IsVehicle() const { return GetHigh() == HIGHGUID_VEHICLE; } + bool IsCreatureOrPet() const { return IsCreature() || IsPet(); } + bool IsCreatureOrVehicle() const { return IsCreature() || IsVehicle(); } + bool IsAnyTypeCreature() const { return IsCreature() || IsPet() || IsVehicle(); } + bool IsPlayer() const { return !IsEmpty() && GetHigh() == HIGHGUID_PLAYER; } + bool IsUnit() const { return IsAnyTypeCreature() || IsPlayer(); } + bool IsItem() const { return GetHigh() == HIGHGUID_ITEM; } + bool IsGameObject() const { return GetHigh() == HIGHGUID_GAMEOBJECT; } + bool IsDynamicObject() const { return GetHigh() == HIGHGUID_DYNAMICOBJECT; } + bool IsCorpse() const { return GetHigh() == HIGHGUID_CORPSE; } + bool IsTransport() const { return GetHigh() == HIGHGUID_TRANSPORT; } + bool IsMOTransport() const { return GetHigh() == HIGHGUID_MO_TRANSPORT; } + bool IsInstance() const { return GetHigh() == HIGHGUID_INSTANCE; } + bool IsGroup() const { return GetHigh() == HIGHGUID_GROUP; } static TypeID GetTypeId(HighGuid high) { @@ -158,6 +160,7 @@ class MANGOS_DLL_SPEC ObjectGuid case HIGHGUID_VEHICLE: return TYPEID_UNIT; // unknown case HIGHGUID_INSTANCE: + case HIGHGUID_GROUP: default: return TYPEID_OBJECT; } } @@ -185,6 +188,7 @@ class MANGOS_DLL_SPEC ObjectGuid case HIGHGUID_CORPSE: case HIGHGUID_MO_TRANSPORT: case HIGHGUID_INSTANCE: + case HIGHGUID_GROUP: return false; case HIGHGUID_GAMEOBJECT: case HIGHGUID_TRANSPORT: diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 831aeadf0e1..57471de34ed 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -150,8 +150,7 @@ ObjectMgr::ObjectMgr() : m_EquipmentSetIds("Equipment set ids"), m_GuildIds("Guild ids"), m_MailIds("Mail ids"), - m_PetNumbers("Pet numbers"), - m_GroupIds("Group ids") + m_PetNumbers("Pet numbers") { // Only zero condition left, others will be added while loading DB tables mConditions.resize(1); @@ -237,9 +236,9 @@ void ObjectMgr::LoadCreatureLocales() QueryResult *result = WorldDatabase.Query("SELECT entry,name_loc1,subname_loc1,name_loc2,subname_loc2,name_loc3,subname_loc3,name_loc4,subname_loc4,name_loc5,subname_loc5,name_loc6,subname_loc6,name_loc7,subname_loc7,name_loc8,subname_loc8 FROM locales_creature"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -248,7 +247,7 @@ void ObjectMgr::LoadCreatureLocales() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -311,9 +310,9 @@ void ObjectMgr::LoadGossipMenuItemsLocales() "option_text_loc7,box_text_loc7,option_text_loc8,box_text_loc8 " "FROM locales_gossip_menu_option"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -322,7 +321,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -396,9 +395,9 @@ void ObjectMgr::LoadPointOfInterestLocales() QueryResult *result = WorldDatabase.Query("SELECT entry,icon_name_loc1,icon_name_loc2,icon_name_loc3,icon_name_loc4,icon_name_loc5,icon_name_loc6,icon_name_loc7,icon_name_loc8 FROM locales_points_of_interest"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -407,7 +406,7 @@ void ObjectMgr::LoadPointOfInterestLocales() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -1070,7 +1069,7 @@ void ObjectMgr::LoadCreatureModelRace() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -1079,7 +1078,7 @@ void ObjectMgr::LoadCreatureModelRace() return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); uint32 count = 0; @@ -1197,9 +1196,9 @@ void ObjectMgr::LoadCreatures() "LEFT OUTER JOIN pool_creature ON creature.guid = pool_creature.guid " "LEFT OUTER JOIN pool_creature_template ON creature.id = pool_creature_template.id"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -1224,7 +1223,7 @@ void ObjectMgr::LoadCreatures() if (GetMapDifficultyData(i,Difficulty(k))) spawnMasks[i] |= (1 << k); - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -1235,7 +1234,7 @@ void ObjectMgr::LoadCreatures() uint32 entry = fields[ 1].GetUInt32(); CreatureInfo const* cInfo = GetCreatureTemplate(entry); - if(!cInfo) + if (!cInfo) { sLog.outErrorDb("Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry); continue; @@ -1416,9 +1415,9 @@ void ObjectMgr::LoadGameobjects() "LEFT OUTER JOIN pool_gameobject ON gameobject.guid = pool_gameobject.guid " "LEFT OUTER JOIN pool_gameobject_template ON gameobject.id = pool_gameobject_template.id"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -1435,7 +1434,7 @@ void ObjectMgr::LoadGameobjects() if (GetMapDifficultyData(i,Difficulty(k))) spawnMasks[i] |= (1 << k); - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -1696,9 +1695,9 @@ void ObjectMgr::LoadItemLocales() QueryResult *result = WorldDatabase.Query("SELECT entry,name_loc1,description_loc1,name_loc2,description_loc2,name_loc3,description_loc3,name_loc4,description_loc4,name_loc5,description_loc5,name_loc6,description_loc6,name_loc7,description_loc7,name_loc8,description_loc8 FROM locales_item"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -1707,7 +1706,7 @@ void ObjectMgr::LoadItemLocales() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -2357,7 +2356,7 @@ void ObjectMgr::LoadItemConverts() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -2366,7 +2365,7 @@ void ObjectMgr::LoadItemConverts() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -2422,7 +2421,7 @@ void ObjectMgr::LoadItemRequiredTarget() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -2431,7 +2430,7 @@ void ObjectMgr::LoadItemRequiredTarget() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -2529,7 +2528,7 @@ void ObjectMgr::LoadPetLevelInfo() if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -2538,14 +2537,14 @@ void ObjectMgr::LoadPetLevelInfo() return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { Field* fields = result->Fetch(); uint32 creature_id = fields[0].GetUInt32(); - if(!sCreatureStorage.LookupEntry(creature_id)) + if (!sCreatureStorage.LookupEntry(creature_id)) { sLog.outErrorDb("Wrong creature id %u in `pet_levelstats` table, ignoring.",creature_id); continue; @@ -2645,7 +2644,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); sLog.outString(); sLog.outString( ">> Loaded %u player create definitions", count ); @@ -2654,7 +2653,7 @@ void ObjectMgr::LoadPlayerInfo() exit(1); } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -2728,7 +2727,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); @@ -2737,7 +2736,7 @@ void ObjectMgr::LoadPlayerInfo() } else { - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -2747,14 +2746,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_class = fields[1].GetUInt32(); ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); - if(!rEntry || !((1 << (current_race-1)) & RACEMASK_ALL_PLAYABLE)) + if (!rEntry || !((1 << (current_race-1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `playercreateinfo_item` table, ignoring.",current_race); continue; } ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class); - if(!cEntry || !((1 << (current_class-1)) & CLASSMASK_ALL_PLAYABLE)) + if (!cEntry || !((1 << (current_class-1)) & CLASSMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong class %u in `playercreateinfo_item` table, ignoring.",current_class); continue; @@ -2764,7 +2763,7 @@ void ObjectMgr::LoadPlayerInfo() uint32 item_id = fields[2].GetUInt32(); - if(!GetItemPrototype(item_id)) + if (!GetItemPrototype(item_id)) { sLog.outErrorDb("Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.",item_id,current_race,current_class); continue; @@ -2772,7 +2771,7 @@ void ObjectMgr::LoadPlayerInfo() uint32 amount = fields[3].GetUInt32(); - if(!amount) + if (!amount) { sLog.outErrorDb("Item id %u (class %u race %u) have amount==0 in `playercreateinfo_item` table, ignoring.",item_id,current_race,current_class); continue; @@ -2801,7 +2800,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); sLog.outString(); sLog.outString( ">> Loaded %u player create spells", count ); @@ -2809,7 +2808,7 @@ void ObjectMgr::LoadPlayerInfo() } else { - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -2819,7 +2818,7 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_class = fields[1].GetUInt32(); ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); - if(!rEntry || !((1 << (current_race-1)) & RACEMASK_ALL_PLAYABLE)) + if (!rEntry || !((1 << (current_race-1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `playercreateinfo_spell` table, ignoring.",current_race); continue; @@ -2863,15 +2862,15 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); sLog.outString(); - sLog.outString( ">> Loaded %u player create actions", count ); - sLog.outErrorDb( "Error loading `playercreateinfo_action` table or empty table."); + sLog.outString(">> Loaded %u player create actions", count); + sLog.outErrorDb("Error loading `playercreateinfo_action` table or empty table."); } else { - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -2881,14 +2880,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_class = fields[1].GetUInt32(); ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); - if(!rEntry || !((1 << (current_race-1)) & RACEMASK_ALL_PLAYABLE)) + if (!rEntry || !((1 << (current_race-1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `playercreateinfo_action` table, ignoring.",current_race); continue; } ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class); - if(!cEntry || !((1 << (current_class-1)) & CLASSMASK_ALL_PLAYABLE)) + if (!cEntry || !((1 << (current_class-1)) & CLASSMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong class %u in `playercreateinfo_action` table, ignoring.",current_class); continue; @@ -2925,7 +2924,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); sLog.outString(); sLog.outString( ">> Loaded %u level health/mana definitions", count ); @@ -2934,28 +2933,28 @@ void ObjectMgr::LoadPlayerInfo() exit(1); } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { Field* fields = result->Fetch(); uint32 current_class = fields[0].GetUInt32(); - if(current_class >= MAX_CLASSES) + if (current_class >= MAX_CLASSES) { sLog.outErrorDb("Wrong class %u in `player_classlevelstats` table, ignoring.",current_class); continue; } uint32 current_level = fields[1].GetUInt32(); - if(current_level == 0) + if (current_level == 0) { sLog.outErrorDb("Wrong level %u in `player_classlevelstats` table, ignoring.",current_level); continue; } - else if(current_level > sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) + else if (current_level > sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) { - if(current_level > STRONG_MAX_LEVEL) // hardcoded level maximum + if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum sLog.outErrorDb("Wrong (> %u) level %u in `player_classlevelstats` table, ignoring.",STRONG_MAX_LEVEL,current_level); else { @@ -2967,7 +2966,7 @@ void ObjectMgr::LoadPlayerInfo() PlayerClassInfo* pClassInfo = &playerClassInfo[current_class]; - if(!pClassInfo->levelInfo) + if (!pClassInfo->levelInfo) pClassInfo->levelInfo = new PlayerClassLevelInfo[sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)]; PlayerClassLevelInfo* pClassLevelInfo = &pClassInfo->levelInfo[current_level-1]; @@ -3023,16 +3022,16 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); sLog.outString(); - sLog.outString( ">> Loaded %u level stats definitions", count ); - sLog.outErrorDb( "Error loading `player_levelstats` table or empty table."); + sLog.outString(">> Loaded %u level stats definitions", count); + sLog.outErrorDb("Error loading `player_levelstats` table or empty table."); Log::WaitBeforeContinueIfNeed(); exit(1); } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -3042,23 +3041,23 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_class = fields[1].GetUInt32(); ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); - if(!rEntry || !((1 << (current_race-1)) & RACEMASK_ALL_PLAYABLE)) + if (!rEntry || !((1 << (current_race-1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `player_levelstats` table, ignoring.",current_race); continue; } ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class); - if(!cEntry || !((1 << (current_class-1)) & CLASSMASK_ALL_PLAYABLE)) + if (!cEntry || !((1 << (current_class-1)) & CLASSMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong class %u in `player_levelstats` table, ignoring.",current_class); continue; } uint32 current_level = fields[2].GetUInt32(); - if(current_level > sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) + if (current_level > sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) { - if(current_level > STRONG_MAX_LEVEL) // hardcoded level maximum + if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum sLog.outErrorDb("Wrong (> %u) level %u in `player_levelstats` table, ignoring.",STRONG_MAX_LEVEL,current_level); else { @@ -3070,15 +3069,13 @@ void ObjectMgr::LoadPlayerInfo() PlayerInfo* pInfo = &playerInfo[current_race][current_class]; - if(!pInfo->levelInfo) + if (!pInfo->levelInfo) pInfo->levelInfo = new PlayerLevelInfo[sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)]; PlayerLevelInfo* pLevelInfo = &pInfo->levelInfo[current_level-1]; - for (int i = 0; i < MAX_STATS; i++) - { + for (int i = 0; i < MAX_STATS; ++i) pLevelInfo->stats[i] = fields[i+3].GetUInt8(); - } bar.step(); ++count; @@ -3151,16 +3148,16 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); sLog.outString(); - sLog.outString( ">> Loaded %u xp for level definitions", count ); - sLog.outErrorDb( "Error loading `player_xp_for_level` table or empty table."); + sLog.outString(">> Loaded %u xp for level definitions", count); + sLog.outErrorDb("Error loading `player_xp_for_level` table or empty table."); Log::WaitBeforeContinueIfNeed(); exit(1); } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -3169,9 +3166,9 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_level = fields[0].GetUInt32(); uint32 current_xp = fields[1].GetUInt32(); - if(current_level >= sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) + if (current_level >= sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) { - if(current_level > STRONG_MAX_LEVEL) // hardcoded level maximum + if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum sLog.outErrorDb("Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL,current_level); else { @@ -3190,7 +3187,7 @@ void ObjectMgr::LoadPlayerInfo() delete result; sLog.outString(); - sLog.outString( ">> Loaded %u xp for level definitions", count ); + sLog.outString(">> Loaded %u xp for level definitions", count); } // fill level gaps @@ -3317,15 +3314,15 @@ void ObjectMgr::LoadArenaTeams() "EmblemColor,BorderStyle,BorderColor, rating,games_week,wins_week,games_season,wins_season,rank " "FROM arena_team LEFT JOIN arena_team_stats ON arena_team.arenateamid = arena_team_stats.arenateamid ORDER BY arena_team.arenateamid ASC" ); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u arenateam definitions", count ); + sLog.outString(">> Loaded %u arenateam definitions", count); return; } @@ -3335,7 +3332,7 @@ void ObjectMgr::LoadArenaTeams() "SELECT arenateamid,member.guid,played_week,wons_week,played_season,wons_season,personal_rating,name,class " "FROM arena_team_member member LEFT JOIN characters chars on member.guid = chars.guid ORDER BY member.arenateamid ASC"); - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -3352,13 +3349,13 @@ void ObjectMgr::LoadArenaTeams() continue; } AddArenaTeam(newArenaTeam); - }while( result->NextRow() ); + } while (result->NextRow()); delete result; delete arenaTeamMembersResult; sLog.outString(); - sLog.outString( ">> Loaded %u arenateam definitions", count ); + sLog.outString(">> Loaded %u arenateam definitions", count); } void ObjectMgr::LoadGroups() @@ -3370,16 +3367,16 @@ void ObjectMgr::LoadGroups() if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u group definitions", count ); + sLog.outString(">> Loaded %u group definitions", count); return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -3407,14 +3404,14 @@ void ObjectMgr::LoadGroups() result = CharacterDatabase.Query("SELECT memberGuid, assistant, subgroup, groupId FROM group_member ORDER BY groupId"); if (!result) { - barGoLink bar2( 1 ); + BarGoLink bar2(1); bar2.step(); } else { Group* group = NULL; // used as cached pointer for avoid relookup group for each member - barGoLink bar2( (int)result->GetRowCount() ); + BarGoLink bar2(result->GetRowCount()); do { bar2.step(); @@ -3476,14 +3473,14 @@ void ObjectMgr::LoadGroups() if (!result) { - barGoLink bar2( 1 ); + BarGoLink bar2(1); bar2.step(); } else { Group* group = NULL; // used as cached pointer for avoid relookup group for each member - barGoLink bar2( (int)result->GetRowCount() ); + BarGoLink bar2(result->GetRowCount()); do { bar2.step(); @@ -3585,13 +3582,13 @@ void ObjectMgr::LoadQuests() // 139 140 "StartScript, CompleteScript" " FROM quest_template"); - if (result == NULL) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded 0 quests definitions" ); + sLog.outString(">> Loaded 0 quests definitions"); sLog.outErrorDb("`quest_template` table is empty!"); return; } @@ -3599,7 +3596,7 @@ void ObjectMgr::LoadQuests() // create multimap previous quest for each existing quest // some quests can have many previous maps set by NextQuestId in previous quest // for example set of race quests can lead to single not race specific quest - barGoLink bar((int) result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { bar.step(); @@ -4248,9 +4245,9 @@ void ObjectMgr::LoadQuestLocales() " FROM locales_quest" ); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -4259,7 +4256,7 @@ void ObjectMgr::LoadQuestLocales() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -4436,9 +4433,9 @@ void ObjectMgr::LoadPageTextLocales() QueryResult *result = WorldDatabase.Query("SELECT entry,text_loc1,text_loc2,text_loc3,text_loc4,text_loc5,text_loc6,text_loc7,text_loc8 FROM locales_page_text"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -4447,7 +4444,7 @@ void ObjectMgr::LoadPageTextLocales() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -4604,17 +4601,17 @@ void ObjectMgr::LoadGossipText() int count = 0; if( !result ) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u npc texts", count ); + sLog.outString(">> Loaded %u npc texts", count); return; } int cic; - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -4626,7 +4623,7 @@ void ObjectMgr::LoadGossipText() bar.step(); uint32 Text_ID = fields[cic++].GetUInt32(); - if(!Text_ID) + if (!Text_ID) { sLog.outErrorDb("Table `npc_text` has record wit reserved id 0, ignore."); continue; @@ -4634,7 +4631,7 @@ void ObjectMgr::LoadGossipText() GossipText& gText = mGossipText[Text_ID]; - for (int i=0; i< 8; i++) + for (int i = 0; i < 8; ++i) { gText.Options[i].Text_0 = fields[cic++].GetCppString(); gText.Options[i].Text_1 = fields[cic++].GetCppString(); @@ -4642,16 +4639,16 @@ void ObjectMgr::LoadGossipText() gText.Options[i].Language = fields[cic++].GetUInt32(); gText.Options[i].Probability = fields[cic++].GetFloat(); - for(int j=0; j < 3; ++j) + for (int j = 0; j < 3; ++j) { gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt32(); gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt32(); } } - } while( result->NextRow() ); + } while(result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u npc texts", count ); + sLog.outString(">> Loaded %u npc texts", count); delete result; } @@ -4672,7 +4669,7 @@ void ObjectMgr::LoadGossipTextLocales() if(!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -4681,7 +4678,7 @@ void ObjectMgr::LoadGossipTextLocales() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -4746,9 +4743,9 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) CharacterDatabase.PExecute("DELETE FROM mail WHERE expire_time < '" UI64FMTD "' AND has_items = '0' AND body = ''", (uint64)basetime); // 0 1 2 3 4 5 6 7 8 QueryResult* result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,has_items,expire_time,cod,checked,mailTemplateId FROM mail WHERE expire_time < '" UI64FMTD "'", (uint64)basetime); - if ( !result ) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); sLog.outString(">> Only expired mails (need to be return or delete) or DB table `mail` is empty."); @@ -4760,7 +4757,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) //delitems << "DELETE FROM item_instance WHERE guid IN ( "; //delmails << "DELETE FROM mail WHERE id IN ( " - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); uint32 count = 0; Field *fields; @@ -4854,15 +4851,15 @@ void ObjectMgr::LoadQuestAreaTriggers() if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u quest trigger points", count ); + sLog.outString(">> Loaded %u quest trigger points", count); return; } - barGoLink bar((int) result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -4918,15 +4915,15 @@ void ObjectMgr::LoadTavernAreaTriggers() if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u tavern triggers", count ); + sLog.outString(">> Loaded %u tavern triggers", count); return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -5062,17 +5059,17 @@ void ObjectMgr::LoadGraveyardZones() uint32 count = 0; - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u graveyard-zone links", count ); + sLog.outString(">> Loaded %u graveyard-zone links", count); return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -5280,16 +5277,16 @@ void ObjectMgr::LoadAreaTriggerTeleports() if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u area trigger teleport definitions", count ); + sLog.outString(">> Loaded %u area trigger teleport definitions", count); return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -5479,7 +5476,7 @@ void ObjectMgr::PackGroupIds() delete result; } - barGoLink bar( groupIds.size() + 1); + BarGoLink bar(groupIds.size() + 1); bar.step(); uint32 groupId = 1; @@ -5499,8 +5496,6 @@ void ObjectMgr::PackGroupIds() bar.step(); } - m_GroupIds.Set(groupId); - sLog.outString( ">> Group Ids remapped, next group id is %u", groupId ); sLog.outString(); } @@ -5595,7 +5590,7 @@ void ObjectMgr::SetHighestGuids() result = CharacterDatabase.Query( "SELECT MAX(groupId) FROM groups" ); if (result) { - m_GroupIds.Set((*result)[0].GetUInt32()+1); + m_GroupGuids.Set((*result)[0].GetUInt32()+1); delete result; } @@ -5618,7 +5613,7 @@ void ObjectMgr::LoadGameObjectLocales() if(!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -5627,7 +5622,7 @@ void ObjectMgr::LoadGameObjectLocales() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -5934,18 +5929,18 @@ void ObjectMgr::LoadExplorationBaseXP() uint32 count = 0; QueryResult *result = WorldDatabase.Query("SELECT level,basexp FROM exploration_basexp"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u BaseXP definitions", count ); + sLog.outString(">> Loaded %u BaseXP definitions", count); return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -5983,18 +5978,18 @@ void ObjectMgr::LoadPetNames() uint32 count = 0; QueryResult *result = WorldDatabase.Query("SELECT word,entry,half FROM pet_name_generation"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u pet name parts", count ); + sLog.outString(">> Loaded %u pet name parts", count); return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -6004,7 +5999,7 @@ void ObjectMgr::LoadPetNames() std::string word = fields[0].GetString(); uint32 entry = fields[1].GetUInt32(); bool half = fields[2].GetBool(); - if(half) + if (half) PetHalfName1[entry].push_back(word); else PetHalfName0[entry].push_back(word); @@ -6027,11 +6022,11 @@ void ObjectMgr::LoadPetNumber() delete result; } - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded the max pet number: %d", m_PetNumbers.GetNextAfterMaxUsed()-1); + sLog.outString(">> Loaded the max pet number: %d", m_PetNumbers.GetNextAfterMaxUsed() - 1); } std::string ObjectMgr::GeneratePetName(uint32 entry) @@ -6039,11 +6034,11 @@ std::string ObjectMgr::GeneratePetName(uint32 entry) std::vector & list0 = PetHalfName0[entry]; std::vector & list1 = PetHalfName1[entry]; - if(list0.empty() || list1.empty()) + if (list0.empty() || list1.empty()) { CreatureInfo const *cinfo = GetCreatureTemplate(entry); char const* petname = GetPetName(cinfo->family, sWorld.GetDefaultDbcLocale()); - if(!petname) + if (!petname) petname = cinfo->Name; return std::string(petname); } @@ -6061,18 +6056,18 @@ void ObjectMgr::LoadCorpses() "JOIN characters ON player = characters.guid " "LEFT JOIN guild_member ON player=guild_member.guid WHERE corpse_type <> 0"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u corpses", count ); + sLog.outString(">> Loaded %u corpses", count); return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -6083,7 +6078,7 @@ void ObjectMgr::LoadCorpses() uint32 guid = fields[0].GetUInt32(); Corpse *corpse = new Corpse; - if(!corpse->LoadFromDB(guid,fields)) + if (!corpse->LoadFromDB(guid,fields)) { delete corpse; continue; @@ -6109,7 +6104,7 @@ void ObjectMgr::LoadReputationRewardRate() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -6118,7 +6113,7 @@ void ObjectMgr::LoadReputationRewardRate() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -6181,9 +6176,9 @@ void ObjectMgr::LoadReputationOnKill() "IsTeamAward1, MaxStanding1, RewOnKillRepValue1, IsTeamAward2, MaxStanding2, RewOnKillRepValue2, TeamDependent " "FROM creature_onkill_reputation"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -6192,7 +6187,7 @@ void ObjectMgr::LoadReputationOnKill() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -6258,7 +6253,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -6267,7 +6262,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -6378,9 +6373,9 @@ void ObjectMgr::LoadPointsOfInterest() // 0 1 2 3 4 5 QueryResult *result = WorldDatabase.Query("SELECT entry, x, y, icon, flags, data, icon_name FROM points_of_interest"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -6389,7 +6384,7 @@ void ObjectMgr::LoadPointsOfInterest() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -6432,9 +6427,9 @@ void ObjectMgr::LoadQuestPOI() // 0 1 2 3 4 5 6 7 QueryResult *result = WorldDatabase.Query("SELECT questId, poiId, objIndex, mapId, mapAreaId, floorId, unk3, unk4 FROM quest_poi"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -6443,7 +6438,7 @@ void ObjectMgr::LoadQuestPOI() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -6509,9 +6504,9 @@ void ObjectMgr::LoadNPCSpellClickSpells() // 0 1 2 3 4 5 QueryResult *result = WorldDatabase.Query("SELECT npc_entry, spell_id, quest_start, quest_start_active, quest_end, cast_flags FROM npc_spellclick_spells"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -6520,7 +6515,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -6598,9 +6593,9 @@ void ObjectMgr::LoadWeatherZoneChances() // 0 1 2 3 4 5 6 7 8 9 10 11 12 QueryResult *result = WorldDatabase.Query("SELECT zone, spring_rain_chance, spring_snow_chance, spring_storm_chance, summer_rain_chance, summer_snow_chance, summer_storm_chance, fall_rain_chance, fall_snow_chance, fall_storm_chance, winter_rain_chance, winter_snow_chance, winter_storm_chance FROM game_weather"); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -6609,7 +6604,7 @@ void ObjectMgr::LoadWeatherZoneChances() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -6696,9 +6691,9 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelationsMap& map, char const* tab QueryResult *result = WorldDatabase.PQuery("SELECT id,quest FROM %s",table); - if(!result) + if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -6707,7 +6702,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelationsMap& map, char const* tab return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -6717,7 +6712,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelationsMap& map, char const* tab uint32 id = fields[0].GetUInt32(); uint32 quest = fields[1].GetUInt32(); - if(mQuestTemplates.find(quest) == mQuestTemplates.end()) + if (mQuestTemplates.find(quest) == mQuestTemplates.end()) { sLog.outErrorDb("Table `%s: Quest %u listed for entry %u does not exist.",table,quest,id); continue; @@ -6798,17 +6793,17 @@ void ObjectMgr::LoadReservedPlayersNames() uint32 count = 0; - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u reserved player names", count ); + sLog.outString(">> Loaded %u reserved player names", count); return; } - barGoLink bar((int) result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); Field* fields; do @@ -6818,7 +6813,7 @@ void ObjectMgr::LoadReservedPlayersNames() std::string name= fields[0].GetCppString(); std::wstring wstr; - if(!Utf8toWStr (name,wstr)) + if (!Utf8toWStr (name,wstr)) { sLog.outError("Table `reserved_name` have invalid name: %s", name.c_str() ); continue; @@ -7017,18 +7012,18 @@ void ObjectMgr::LoadGameObjectForQuests() if (!sGOStorage.MaxEntry) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded 0 GameObjects for quests" ); + sLog.outString(">> Loaded 0 GameObjects for quests"); return; } - barGoLink bar(sGOStorage.MaxEntry - 1); + BarGoLink bar(sGOStorage.MaxEntry - 1); uint32 count = 0; // collect GO entries for GO that must activated - for(uint32 go_entry = 1; go_entry < sGOStorage.MaxEntry; ++go_entry) + for (uint32 go_entry = 1; go_entry < sGOStorage.MaxEntry; ++go_entry) { bar.step(); GameObjectInfo const* goInfo = GetGameObjectInfo(go_entry); @@ -7137,7 +7132,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -7151,7 +7146,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min uint32 count = 0; - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -7244,9 +7239,9 @@ void ObjectMgr::LoadFishingBaseSkillLevel() uint32 count = 0; QueryResult *result = WorldDatabase.Query("SELECT entry,skill FROM skill_fishing_base_level"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); @@ -7255,7 +7250,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() return; } - barGoLink bar((int) result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -7266,7 +7261,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() int32 skill = fields[1].GetInt32(); AreaTableEntry const* fArea = GetAreaEntryByAreaID(entry); - if(!fArea) + if (!fArea) { sLog.outErrorDb("AreaId %u defined in `skill_fishing_base_level` does not exist",entry); continue; @@ -7280,7 +7275,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() delete result; sLog.outString(); - sLog.outString( ">> Loaded %u areas for fishing base skill level", count ); + sLog.outString(">> Loaded %u areas for fishing base skill level", count); } // Searches for the same condition already in Conditions store @@ -7827,9 +7822,9 @@ void ObjectMgr::LoadGameTele() uint32 count = 0; QueryResult *result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, map, name FROM game_tele"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); @@ -7838,7 +7833,7 @@ void ObjectMgr::LoadGameTele() return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -7857,13 +7852,13 @@ void ObjectMgr::LoadGameTele() gt.mapId = fields[5].GetUInt32(); gt.name = fields[6].GetCppString(); - if(!MapManager::IsValidMapCoord(gt.mapId,gt.position_x,gt.position_y,gt.position_z,gt.orientation)) + if (!MapManager::IsValidMapCoord(gt.mapId,gt.position_x,gt.position_y,gt.position_z,gt.orientation)) { sLog.outErrorDb("Wrong position for id %u (name: %s) in `game_tele` table, ignoring.",id,gt.name.c_str()); continue; } - if(!Utf8toWStr(gt.name,gt.wnameLow)) + if (!Utf8toWStr(gt.name,gt.wnameLow)) { sLog.outErrorDb("Wrong UTF8 name for id %u in `game_tele` table, ignoring.",id); continue; @@ -7879,7 +7874,7 @@ void ObjectMgr::LoadGameTele() delete result; sLog.outString(); - sLog.outString( ">> Loaded %u GameTeleports", count ); + sLog.outString(">> Loaded %u GameTeleports", count); } GameTele const* ObjectMgr::GetGameTele(const std::string& name) const @@ -7955,9 +7950,9 @@ void ObjectMgr::LoadMailLevelRewards() uint32 count = 0; QueryResult *result = WorldDatabase.Query("SELECT level, raceMask, mailTemplateId, senderEntry FROM mail_level_reward"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); @@ -7966,7 +7961,7 @@ void ObjectMgr::LoadMailLevelRewards() return; } - barGoLink bar((int) result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -8029,7 +8024,7 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates) if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -8038,7 +8033,7 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates) return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); std::set talentIds; @@ -8055,13 +8050,13 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates) SpellEntry const *spellinfo = sSpellStore.LookupEntry(spell); if (!spellinfo) { - sLog.outErrorDb("Table `%s` for trainer (Entry: %u ) has non existing spell %u, ignore", tableName, entry, spell); + sLog.outErrorDb("Table `%s` (Entry: %u ) has non existing spell %u, ignore", tableName, entry, spell); continue; } if (!SpellMgr::IsSpellValid(spellinfo)) { - sLog.outErrorDb("Table `%s` for trainer (Entry: %u) has broken learning spell %u, ignore", tableName, entry, spell); + sLog.outErrorDb("Table `%s` (Entry: %u) has broken learning spell %u, ignore", tableName, entry, spell); continue; } @@ -8099,7 +8094,7 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates) { if (tSpells->spellList.find(spell) != tSpells->spellList.end()) { - sLog.outErrorDb("Table `%s` for trainer (Entry: %u) has spell %u listed in trainer template %u, ignore", tableName, entry, spell, cInfo->trainerId); + sLog.outErrorDb("Table `%s` (Entry: %u) has spell %u listed in trainer template %u, ignore", tableName, entry, spell, cInfo->trainerId); continue; } } @@ -8114,28 +8109,63 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates) trainerSpell.reqSkillValue = fields[4].GetUInt32(); trainerSpell.reqLevel = fields[5].GetUInt32(); - if(!trainerSpell.reqLevel) - trainerSpell.reqLevel = spellinfo->GetSpellLevel(); - // calculate learned spell for profession case when stored cast-spell trainerSpell.learnedSpell = spell; for(int i = 0; i < MAX_EFFECT_INDEX; ++i) { - if(SpellEffectEntry const* spellEffect = spellinfo->GetSpellEffect(SpellEffectIndex(i))) + SpellEffectEntry const* spellEffect = spellinfo->GetSpellEffect(SpellEffectIndex(i)); + if (!spellEffect) + continue; + + if (spellEffect->Effect == SPELL_EFFECT_LEARN_SPELL && + SpellMgr::IsProfessionOrRidingSpell(spellEffect->EffectTriggerSpell)) { - if (spellEffect->Effect != SPELL_EFFECT_LEARN_SPELL) - continue; - if (SpellMgr::IsProfessionOrRidingSpell(spellEffect->EffectTriggerSpell)) + // prof spells sometime only additions to main spell learn that have level data + for(int j = 0; j < MAX_EFFECT_INDEX; ++j) { - trainerSpell.learnedSpell = spellEffect->EffectTriggerSpell; - break; + SpellEffectEntry const* spellEff = spellinfo->GetSpellEffect(SpellEffectIndex(j)); + if (!spellEff) + continue; + + if (spellEff->Effect == SPELL_EFFECT_LEARN_SPELL) + { + trainerSpell.learnedSpell = spellEff->EffectTriggerSpell; + break; + } } + break; } } + // already checked as valid spell so exist. + SpellEntry const *learnSpellinfo = sSpellStore.LookupEntry(trainerSpell.learnedSpell); if (SpellMgr::IsProfessionSpell(trainerSpell.learnedSpell)) + { data.trainerType = 2; + uint32 minLevel = sSpellMgr.GetProfessionSpellMinLevel(trainerSpell.learnedSpell); + if (trainerSpell.reqLevel) + { + if (minLevel == trainerSpell.reqLevel) + ERROR_DB_STRICT_LOG("Table `%s` (Entry: %u) has redundant reqlevel %u (=prof reqlevel) for spell %u", tableName, entry, trainerSpell.reqLevel, spell); + else + sLog.outErrorDb("Table `%s` (Entry: %u) has wrong redundant reqlevel %u (<>prof reqlevel %u) for spell %u", tableName, entry, trainerSpell.reqLevel, minLevel, spell); + } + else + trainerSpell.reqLevel = minLevel; + } + // for non-prof. spell use spellLevel if not provided any + else + { + if (trainerSpell.reqLevel) + { + if (trainerSpell.reqLevel == learnSpellinfo->GetSpellLevel()) + ERROR_DB_STRICT_LOG("Table `%s` (Entry: %u) has redundant reqlevel %u (=spell level) for spell %u", tableName, entry, trainerSpell.reqLevel, spell); + } + else + trainerSpell.reqLevel = learnSpellinfo->GetSpellLevel(); + } + ++count; } while (result->NextRow()); @@ -8187,7 +8217,7 @@ void ObjectMgr::LoadVendors(char const* tableName, bool isTemplates) QueryResult *result = WorldDatabase.PQuery("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM %s", tableName); if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); @@ -8196,7 +8226,7 @@ void ObjectMgr::LoadVendors(char const* tableName, bool isTemplates) return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); uint32 count = 0; do @@ -8262,7 +8292,7 @@ void ObjectMgr::LoadNpcGossips() QueryResult* result = WorldDatabase.Query("SELECT npc_guid, textid FROM npc_gossip"); if( !result ) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); @@ -8271,7 +8301,7 @@ void ObjectMgr::LoadNpcGossips() return; } - barGoLink bar((int) result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); uint32 count = 0; uint32 guid,textid; @@ -8314,7 +8344,7 @@ void ObjectMgr::LoadGossipMenu() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -8323,7 +8353,7 @@ void ObjectMgr::LoadGossipMenu() return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); uint32 count = 0; @@ -8405,7 +8435,7 @@ void ObjectMgr::LoadGossipMenuItems() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -8429,7 +8459,7 @@ void ObjectMgr::LoadGossipMenuItems() } // loading - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); uint32 count = 0; diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index da595bc9e32..2233a049931 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -717,16 +717,16 @@ class ObjectMgr uint32 GenerateStaticCreatureLowGuid() { if (m_StaticCreatureGuids.GetNextAfterMaxUsed() >= m_FirstTemporaryCreatureGuid) return 0; return m_StaticCreatureGuids.Generate(); } uint32 GenerateStaticGameObjectLowGuid() { if (m_StaticGameObjectGuids.GetNextAfterMaxUsed() >= m_FirstTemporaryGameObjectGuid) return 0; return m_StaticGameObjectGuids.Generate(); } - uint32 GeneratePlayerLowGuid() { return m_CharGuids.Generate(); } - uint32 GenerateItemLowGuid() { return m_ItemGuids.Generate(); } - uint32 GenerateCorpseLowGuid() { return m_CorpseGuids.Generate(); } + uint32 GeneratePlayerLowGuid() { return m_CharGuids.Generate(); } + uint32 GenerateItemLowGuid() { return m_ItemGuids.Generate(); } + uint32 GenerateCorpseLowGuid() { return m_CorpseGuids.Generate(); } uint32 GenerateInstanceLowGuid() { return m_InstanceGuids.Generate(); } + uint32 GenerateGroupLowGuid() { return m_GroupGuids.Generate(); } uint32 GenerateArenaTeamId() { return m_ArenaTeamIds.Generate(); } uint32 GenerateAuctionID() { return m_AuctionIds.Generate(); } uint64 GenerateEquipmentSetGuid() { return m_EquipmentSetIds.Generate(); } uint32 GenerateGuildId() { return m_GuildIds.Generate(); } - uint32 GenerateGroupId() { return m_GroupIds.Generate(); } //uint32 GenerateItemTextID() { return m_ItemGuids.Generate(); } uint32 GenerateMailID() { return m_MailIds.Generate(); } uint32 GeneratePetNumber() { return m_PetNumbers.Generate(); } @@ -1037,7 +1037,6 @@ class ObjectMgr IdGenerator m_GuildIds; IdGenerator m_MailIds; IdGenerator m_PetNumbers; - IdGenerator m_GroupIds; // initial free low guid for selected guid type for map local guids uint32 m_FirstTemporaryCreatureGuid; @@ -1052,6 +1051,7 @@ class ObjectMgr ObjectGuidGenerator m_ItemGuids; ObjectGuidGenerator m_CorpseGuids; ObjectGuidGenerator m_InstanceGuids; + ObjectGuidGenerator m_GroupGuids; QuestMap mQuestTemplates; diff --git a/src/game/Pet.h b/src/game/Pet.h index 3177013dcff..2759e52f1d2 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -133,7 +133,7 @@ typedef std::vector AutoSpellList; class Player; -class Pet : public Creature +class MANGOS_DLL_SPEC Pet : public Creature { public: explicit Pet(PetType type = MAX_PET_TYPE); @@ -157,7 +157,7 @@ class Pet : public Creature static void DeleteFromDB(uint32 guidlow, bool separate_transaction = true); void SetDeathState(DeathState s); // overwrite virtual Creature::SetDeathState and Unit::SetDeathState - void Update(uint32 update_diff, uint32 diff); // overwrite virtual Creature::Update and Unit::Update + void Update(uint32 update_diff, uint32 diff) override; // overwrite virtual Creature::Update and Unit::Update uint8 GetPetAutoSpellSize() const { return m_autospells.size(); } uint32 GetPetAutoSpellOnPos(uint8 pos) const diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a9b2b6c7b22..03e9c83a23d 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -274,32 +274,21 @@ std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi) SpellModifier::SpellModifier( SpellModOp _op, SpellModType _type, int32 _value, SpellEntry const* spellEntry, SpellEffectIndex eff, int16 _charges /*= 0*/ ) : op(_op), type(_type), charges(_charges), value(_value), spellId(spellEntry->Id), lastAffected(NULL) { - uint32 const* ptr = spellEntry->GetEffectSpellClassMask(eff); - MANGOS_ASSERT(ptr); - mask = uint64(ptr[0]) | (uint64(ptr[1]) << 32); - mask2= ptr[2]; + mask = spellEntry->GetEffectSpellClassMask(eff); } SpellModifier::SpellModifier( SpellModOp _op, SpellModType _type, int32 _value, Aura const* aura, int16 _charges /*= 0*/ ) : op(_op), type(_type), charges(_charges), value(_value), spellId(aura->GetId()), lastAffected(NULL) { - uint32 const* ptr = aura->getAuraSpellClassMask(); - MANGOS_ASSERT(ptr); - mask = uint64(ptr[0]) | (uint64(ptr[1]) << 32); - mask2= ptr[2]; + mask = aura->GetAuraSpellClassMask(); } bool SpellModifier::isAffectedOnSpell( SpellEntry const *spell ) const { SpellEntry const *affect_spell = sSpellStore.LookupEntry(spellId); - SpellClassOptionsEntry const* classOpt = spell->GetSpellClassOptions(); // False if affect_spell == NULL or spellFamily not equal - if (!affect_spell || (classOpt && affect_spell->GetSpellFamilyName() != SpellFamily(classOpt->SpellFamilyName))) + if (!affect_spell || affect_spell->GetSpellFamilyName() != spell->GetSpellFamilyName()) return false; - if (classOpt && (mask & classOpt->SpellFamilyFlags)) - return true; - if (classOpt && (mask2 & classOpt->SpellFamilyFlags2)) - return true; - return false; + return spell->IsFitToFamilyMask(mask); } //== TradeData ================================================= @@ -1330,9 +1319,8 @@ void Player::Update( uint32 update_diff, uint32 p_time ) } } - Unit *owner = pVictim->GetOwner(); - Unit *u = owner ? owner : pVictim; - if (u->IsPvP() && (!duel || duel->opponent != u)) + Player *vOwner = pVictim->GetCharmerOrOwnerPlayerOrPlayerItself(); + if (vOwner && vOwner->IsPvP() && !IsInDuelWith(vOwner)) { UpdatePvP(true); RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); @@ -1405,7 +1393,7 @@ void Player::Update( uint32 update_diff, uint32 p_time ) if (isAlive()) { // if no longer casting, set regen power as soon as it is up. - if (!IsUnderLastManaUseEffect()) + if (!IsUnderLastManaUseEffect() && !HasAuraType(SPELL_AURA_STOP_NATURAL_MANA_REGEN)) SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER); if (!m_regenTimer) @@ -1829,7 +1817,8 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // If the map is not created, assume it is possible to enter it. // It will be created in the WorldPortAck. - Map *map = sMapMgr.FindMap(mapid); + DungeonPersistentState* state = GetBoundInstanceSaveForSelfOrGroup(mapid); + Map *map = sMapMgr.FindMap(mapid, state ? state->GetInstanceId() : 0); if (!map || map->CanEnter(this)) { //lets reset near teleport flag if it wasn't reset during chained teleports @@ -2113,6 +2102,8 @@ void Player::Regenerate(Powers power, uint32 diff) { case POWER_MANA: { + if (HasAuraType(SPELL_AURA_STOP_NATURAL_MANA_REGEN)) + break; bool recentCast = IsUnderLastManaUseEffect(); float ManaIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_MANA); if (recentCast) @@ -5636,8 +5627,11 @@ void Player::UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, bool de if(lvldif < 3) lvldif = 3; - uint32 skilldif = 5 * plevel - (defence ? GetBaseDefenseSkillValue() : GetBaseWeaponSkillValue(attType)); - if(skilldif <= 0) + int32 skilldif = 5 * plevel - (defence ? GetBaseDefenseSkillValue() : GetBaseWeaponSkillValue(attType)); + + // Max skill reached for level. + // Can in some cases be less than 0: having max skill and then .level -1 as example. + if (skilldif <= 0) return; float chance = float(3 * lvldif * skilldif) / plevel; @@ -6926,8 +6920,12 @@ void Player::CheckDuelDistance(time_t currTime) return; GameObject* obj = GetMap()->GetGameObject(GetGuidValue(PLAYER_DUEL_ARBITER)); - if(!obj) + if (!obj) + { + // player not at duel start map + DuelComplete(DUEL_FLED); return; + } if (duel->outOfBound == 0) { @@ -6958,7 +6956,7 @@ void Player::CheckDuelDistance(time_t currTime) void Player::DuelComplete(DuelCompleteType type) { // duel not requested - if(!duel) + if (!duel) return; WorldPacket data(SMSG_DUEL_COMPLETE, (1)); @@ -6966,7 +6964,7 @@ void Player::DuelComplete(DuelCompleteType type) GetSession()->SendPacket(&data); duel->opponent->GetSession()->SendPacket(&data); - if(type != DUEL_INTERUPTED) + if (type != DUEL_INTERUPTED) { data.Initialize(SMSG_DUEL_WINNER, (1+20)); // we guess size data << (uint8)((type==DUEL_WON) ? 0 : 1); // 0 = just won; 1 = fled @@ -7457,9 +7455,20 @@ void Player::ApplyItemEquipSpell(Item *item, bool apply, bool form_change) if(!spellData.SpellId ) continue; - // wrong triggering type - if(apply && spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_EQUIP) - continue; + if (apply) + { + // apply only at-equip spells + if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_EQUIP) + continue; + } + else + { + // at un-apply remove all spells (not only at-apply, so any at-use active affects from item and etc) + // except with at-use with negative charges, so allow consuming item spells (including with extra flag that prevent consume really) + // applied to player after item remove from equip slot + if (spellData.SpellTrigger == ITEM_SPELLTRIGGER_ON_USE && spellData.SpellCharges < 0) + continue; + } // check if it is valid spell SpellEntry const* spellproto = sSpellStore.LookupEntry(spellData.SpellId); @@ -11223,7 +11232,8 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) _ApplyItemMods(pItem, slot, true); - if(pProto && isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer == 0) + // Weapons and also Totem/Relic/Sigil/etc + if (pProto && isInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer == 0) { uint32 cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s; @@ -15238,7 +15248,7 @@ void Player::_LoadArenaTeamInfo(QueryResult *result) void Player::_LoadEquipmentSets(QueryResult *result) { - // SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", GUID_LOPART(m_guid)); + // SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, ignore_mask, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", GUID_LOPART(m_guid)); if (!result) return; @@ -15249,14 +15259,15 @@ void Player::_LoadEquipmentSets(QueryResult *result) EquipmentSet eqSet; - eqSet.Guid = fields[0].GetUInt64(); - uint32 index = fields[1].GetUInt32(); - eqSet.Name = fields[2].GetCppString(); - eqSet.IconName = fields[3].GetCppString(); - eqSet.state = EQUIPMENT_SET_UNCHANGED; + eqSet.Guid = fields[0].GetUInt64(); + uint32 index = fields[1].GetUInt32(); + eqSet.Name = fields[2].GetCppString(); + eqSet.IconName = fields[3].GetCppString(); + eqSet.IgnoreMask = fields[4].GetUInt32(); + eqSet.state = EQUIPMENT_SET_UNCHANGED; for(uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) - eqSet.Items[i] = fields[4+i].GetUInt32(); + eqSet.Items[i] = fields[5+i].GetUInt32(); m_EquipmentSets[index] = eqSet; @@ -15491,7 +15502,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder ) _LoadBoundInstances(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES)); - if(!IsPositionValid()) + if (!IsPositionValid()) { sLog.outError("%s have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid.GetString().c_str(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); @@ -15504,13 +15515,13 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder ) _LoadBGData(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBGDATA)); - if(m_bgData.bgInstanceID) //saved in BattleGround + if (m_bgData.bgInstanceID) //saved in BattleGround { BattleGround *currentBg = sBattleGroundMgr.GetBattleGround(m_bgData.bgInstanceID, BATTLEGROUND_TYPE_NONE); bool player_at_bg = currentBg && currentBg->IsPlayerInBattleGround(GetObjectGuid()); - if(player_at_bg && currentBg->GetStatus() != STATUS_WAIT_LEAVE) + if (player_at_bg && currentBg->GetStatus() != STATUS_WAIT_LEAVE) { BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType()); AddBattleGroundQueueId(bgQueueTypeId); @@ -15536,6 +15547,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder ) // We are not in BG anymore SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); + // remove outdated DB data in DB + _SaveBGData(); } } else @@ -15548,6 +15561,11 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder ) const WorldLocation& _loc = GetBattleGroundEntryPoint(); SetLocationMapId(_loc.mapid); Relocate(_loc.coord_x, _loc.coord_y, _loc.coord_z, _loc.orientation); + + // We are not in BG anymore + SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); + // remove outdated DB data in DB + _SaveBGData(); } } @@ -18117,7 +18135,7 @@ void Player::SendAttackSwingBadFacingAttack() void Player::SendAutoRepeatCancel(Unit *target) { WorldPacket data(SMSG_CANCEL_AUTO_REPEAT, target->GetPackGUID().size()); - data << target->GetPackGUID(); // may be it's target guid + data << target->GetPackGUID(); GetSession()->SendPacket( &data ); } @@ -18559,12 +18577,12 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply) else _mask2= uint32(1) << (eff - 64); - if ( mod->mask & _mask || mod->mask2 & _mask2) + if (mod->mask.IsFitToFamilyMask(_mask, _mask2)) { int32 val = 0; for (SpellModList::const_iterator itr = m_spellMods[mod->op].begin(); itr != m_spellMods[mod->op].end(); ++itr) { - if ((*itr)->type == mod->type && ((*itr)->mask & _mask || (*itr)->mask2 & _mask2)) + if ((*itr)->type == mod->type && ((*itr)->mask.IsFitToFamilyMask(_mask, _mask2))) val += (*itr)->value; } val += apply ? mod->value : -(mod->value); @@ -20004,6 +20022,20 @@ template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Corpse* template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, GameObject* target, UpdateData& data, std::set& visibleNow); template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, DynamicObject* target, UpdateData& data, std::set& visibleNow); +void Player::SetPhaseMask(uint32 newPhaseMask, bool update) +{ + // GM-mode have mask PHASEMASK_ANYWHERE always + if (isGameMaster()) + newPhaseMask = PHASEMASK_ANYWHERE; + + // phase auras normally not expected at BG but anyway better check + if (BattleGround *bg = GetBattleGround()) + bg->EventPlayerDroppedFlag(this); + + Unit::SetPhaseMask(newPhaseMask, update); + GetSession()->SendSetPhaseShift(GetPhaseMask()); +} + void Player::InitPrimaryProfessions() { SetFreePrimaryProfessions(sWorld.getConfig(CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL)); @@ -20019,6 +20051,13 @@ void Player::SendComboPoints() data << uint8(m_comboPoints); GetSession()->SendPacket(&data); } + /*else + { + // can be NULL, and then points=0. Use unknown; to reset points of some sort? + data << PackedGuid(); + data << uint8(0); + GetSession()->SendPacket(&data); + }*/ } void Player::AddComboPoints(Unit* target, int8 count) @@ -20541,7 +20580,16 @@ float Player::GetReputationPriceDiscount( Creature const* pCreature ) const return 1.0f - 0.05f* (rank - REP_NEUTRAL); } -bool Player::IsSpellFitByClassAndRace( uint32 spell_id ) const +/** + * Check spell availability for training base at SkillLineAbility/SkillRaceClassInfo data. + * Checked allowed race/class and dependent from race/class allowed min level + * + * @param spell_id checked spell id + * @param pReqlevel if arg provided then function work in view mode (level check not applied but detected minlevel returned to var by arg pointer. + if arg not provided then considered train action mode and level checked + * @return true if spell available for show in trainer list (with skip level check) or training. + */ +bool Player::IsSpellFitByClassAndRace(uint32 spell_id, uint32* pReqlevel /*= NULL*/) const { uint32 racemask = getRaceMask(); uint32 classmask = getClassMask(); @@ -20550,16 +20598,42 @@ bool Player::IsSpellFitByClassAndRace( uint32 spell_id ) const if (bounds.first==bounds.second) return true; - for(SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) + for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) { + SkillLineAbilityEntry const* abilityEntry = _spell_idx->second; // skip wrong race skills - if (_spell_idx->second->racemask && (_spell_idx->second->racemask & racemask) == 0) + if (abilityEntry->racemask && (abilityEntry->racemask & racemask) == 0) continue; // skip wrong class skills - if (_spell_idx->second->classmask && (_spell_idx->second->classmask & classmask) == 0) + if (abilityEntry->classmask && (abilityEntry->classmask & classmask) == 0) continue; + SkillRaceClassInfoMapBounds bounds = sSpellMgr.GetSkillRaceClassInfoMapBounds(abilityEntry->skillId); + for (SkillRaceClassInfoMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) + { + SkillRaceClassInfoEntry const* skillRCEntry = itr->second; + if ((skillRCEntry->raceMask & racemask) && (skillRCEntry->classMask & classmask)) + { + if (skillRCEntry->flags & ABILITY_SKILL_NONTRAINABLE) + return false; + + if (pReqlevel) // show trainers list case + { + if (skillRCEntry->reqLevel) + { + *pReqlevel = skillRCEntry->reqLevel; + return true; + } + } + else // check availble case at train + { + if (skillRCEntry->reqLevel && getLevel() < skillRCEntry->reqLevel) + return false; + } + } + } + return true; } @@ -20780,11 +20854,7 @@ bool Player::CanNoReagentCast(SpellEntry const* spellInfo) const // Check no reagent use mask uint64 noReagentMask_0_1 = GetUInt64Value(PLAYER_NO_REAGENT_COST_1); uint32 noReagentMask_2 = GetUInt32Value(PLAYER_NO_REAGENT_COST_1+2); - SpellClassOptionsEntry const* classOptions = spellInfo->GetSpellClassOptions(); - if(!classOptions) - return false; - if (classOptions->SpellFamilyFlags & noReagentMask_0_1 || - classOptions->SpellFamilyFlags2 & noReagentMask_2) + if (spellInfo->IsFitToFamilyMask(noReagentMask_0_1, noReagentMask_2)) return true; return false; @@ -22357,7 +22427,13 @@ void Player::SendEquipmentSetList() data << itr->second.Name; data << itr->second.IconName; for(uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) - data << ObjectGuid(HIGHGUID_ITEM, itr->second.Items[i]).WriteAsPacked(); + { + // ignored slots stored in IgnoreMask, client wants "1" as raw GUID, so no HIGHGUID_ITEM + if (itr->second.IgnoreMask & (1 << i)) + data << ObjectGuid(uint64(1)).WriteAsPacked(); + else + data << ObjectGuid(HIGHGUID_ITEM, itr->second.Items[i]).WriteAsPacked(); + } ++count; // client have limit but it checked at loading and set } @@ -22423,12 +22499,13 @@ void Player::_SaveEquipmentSets() break; // nothing do case EQUIPMENT_SET_CHANGED: { - SqlStatement stmt = CharacterDatabase.CreateStatement(updSets, "UPDATE character_equipmentsets SET name=?, iconname=?, item0=?, item1=?, item2=?, item3=?, item4=?, " + SqlStatement stmt = CharacterDatabase.CreateStatement(updSets, "UPDATE character_equipmentsets SET name=?, iconname=?, ignore_mask=?, item0=?, item1=?, item2=?, item3=?, item4=?, " "item5=?, item6=?, item7=?, item8=?, item9=?, item10=?, item11=?, item12=?, item13=?, item14=?, " "item15=?, item16=?, item17=?, item18=? WHERE guid=? AND setguid=? AND setindex=?"); stmt.addString(eqset.Name); stmt.addString(eqset.IconName); + stmt.addUInt32(eqset.IgnoreMask); for (int i = 0; i < EQUIPMENT_SLOT_END; ++i) stmt.addUInt32(eqset.Items[i]); @@ -22445,12 +22522,13 @@ void Player::_SaveEquipmentSets() } case EQUIPMENT_SET_NEW: { - SqlStatement stmt = CharacterDatabase.CreateStatement(insSets, "INSERT INTO character_equipmentsets VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + SqlStatement stmt = CharacterDatabase.CreateStatement(insSets, "INSERT INTO character_equipmentsets VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); stmt.addUInt32(GetGUIDLow()); stmt.addUInt64(eqset.Guid); stmt.addUInt32(index); stmt.addString(eqset.Name); stmt.addString(eqset.IconName); + stmt.addUInt32(eqset.IgnoreMask); for (int i = 0; i < EQUIPMENT_SLOT_END; ++i) stmt.addUInt32(eqset.Items[i]); @@ -22819,6 +22897,8 @@ Object* Player::GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask) case HIGHGUID_CORPSE: case HIGHGUID_MO_TRANSPORT: case HIGHGUID_INSTANCE: + case HIGHGUID_GROUP: + default: break; } diff --git a/src/game/Player.h b/src/game/Player.h index c403a271310..362b1cd721c 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -120,7 +120,11 @@ struct SpellModifier SpellModifier() : charges(0), lastAffected(NULL) {} SpellModifier(SpellModOp _op, SpellModType _type, int32 _value, uint32 _spellId, uint64 _mask, uint32 _mask2 = 0, int16 _charges = 0) - : op(_op), type(_type), charges(_charges), value(_value), mask(_mask), mask2(_mask2), spellId(_spellId), lastAffected(NULL) + : op(_op), type(_type), charges(_charges), value(_value), mask(_mask, _mask2), spellId(_spellId), lastAffected(NULL) + {} + + SpellModifier(SpellModOp _op, SpellModType _type, int32 _value, uint32 _spellId, ClassFamilyMask _mask, int16 _charges = 0) + : op(_op), type(_type), charges(_charges), value(_value), mask(_mask), spellId(_spellId), lastAffected(NULL) {} SpellModifier(SpellModOp _op, SpellModType _type, int32 _value, SpellEntry const* spellEntry, SpellEffectIndex eff, int16 _charges = 0); @@ -133,8 +137,7 @@ struct SpellModifier SpellModType type : 8; int16 charges : 16; int32 value; - uint64 mask; - uint32 mask2; + ClassFamilyMask mask; uint32 spellId; Spell const* lastAffected; }; @@ -707,7 +710,7 @@ enum EquipmentSetUpdateState struct EquipmentSet { - EquipmentSet() : Guid(0), state(EQUIPMENT_SET_NEW) + EquipmentSet() : Guid(0), IgnoreMask(0), state(EQUIPMENT_SET_NEW) { for(int i = 0; i < EQUIPMENT_SLOT_END; ++i) Items[i] = 0; @@ -716,6 +719,7 @@ struct EquipmentSet uint64 Guid; std::string Name; std::string IconName; + uint32 IgnoreMask; uint32 Items[EQUIPMENT_SLOT_END]; EquipmentSetUpdateState state; }; @@ -1068,7 +1072,7 @@ class MANGOS_DLL_SPEC Player : public Unit bool Create( uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId ); - void Update( uint32 update_diff, uint32 time ); + void Update(uint32 update_diff, uint32 time) override; static bool BuildEnumData( QueryResult * result, WorldPacket * p_data ); @@ -1579,7 +1583,7 @@ class MANGOS_DLL_SPEC Player : public Unit bool HasSpell(uint32 spell) const; bool HasActiveSpell(uint32 spell) const; // show in spellbook TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const; - bool IsSpellFitByClassAndRace( uint32 spell_id ) const; + bool IsSpellFitByClassAndRace(uint32 spell_id, uint32* pReqlevel = NULL) const; bool IsNeedCastPassiveLikeSpellAtLearn(SpellEntry const* spellInfo) const; bool IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const; @@ -1720,6 +1724,7 @@ class MANGOS_DLL_SPEC Player : public Unit /** todo: -maybe move UpdateDuelFlag+DuelComplete to independent DuelHandler.. **/ DuelInfo *duel; + bool IsInDuelWith(Player const* player) const { return duel && duel->opponent == player && duel->startTime != 0; } void UpdateDuelFlag(time_t currTime); void CheckDuelDistance(time_t currTime); void DuelComplete(DuelCompleteType type); @@ -2238,6 +2243,8 @@ class MANGOS_DLL_SPEC Player : public Unit Camera& GetCamera() { return m_camera; } + virtual void SetPhaseMask(uint32 newPhaseMask, bool update);// overwrite Unit::SetPhaseMask + uint8 m_forced_speed_changes[MAX_MOVE_TYPE]; bool HasAtLoginFlag(AtLoginFlags f) const { return m_atLoginFlags & f; } diff --git a/src/game/PoolManager.cpp b/src/game/PoolManager.cpp index b527dc747d0..071db0ed7af 100644 --- a/src/game/PoolManager.cpp +++ b/src/game/PoolManager.cpp @@ -595,7 +595,7 @@ void PoolManager::LoadFromDB() uint32 count = 0; - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { ++count; @@ -628,7 +628,7 @@ void PoolManager::LoadFromDB() count = 0; if (!result) { - barGoLink bar2(1); + BarGoLink bar2(1); bar2.step(); sLog.outString(); @@ -637,7 +637,7 @@ void PoolManager::LoadFromDB() else { - barGoLink bar2((int)result->GetRowCount()); + BarGoLink bar2(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -690,7 +690,7 @@ void PoolManager::LoadFromDB() count = 0; if (!result) { - barGoLink bar2(1); + BarGoLink bar2(1); bar2.step(); sLog.outString(); @@ -698,7 +698,7 @@ void PoolManager::LoadFromDB() } else { - barGoLink bar2((int)result->GetRowCount()); + BarGoLink bar2(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -767,7 +767,7 @@ void PoolManager::LoadFromDB() count = 0; if (!result) { - barGoLink bar2(1); + BarGoLink bar2(1); bar2.step(); sLog.outString(); @@ -776,7 +776,7 @@ void PoolManager::LoadFromDB() else { - barGoLink bar2((int)result->GetRowCount()); + BarGoLink bar2(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -838,7 +838,7 @@ void PoolManager::LoadFromDB() count = 0; if (!result) { - barGoLink bar2(1); + BarGoLink bar2(1); bar2.step(); sLog.outString(); @@ -847,7 +847,7 @@ void PoolManager::LoadFromDB() else { - barGoLink bar2((int)result->GetRowCount()); + BarGoLink bar2(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -922,7 +922,7 @@ void PoolManager::LoadFromDB() count = 0; if( !result ) { - barGoLink bar2(1); + BarGoLink bar2(1); bar2.step(); sLog.outString(); @@ -931,7 +931,7 @@ void PoolManager::LoadFromDB() else { - barGoLink bar2( (int)result->GetRowCount() ); + BarGoLink bar2(result->GetRowCount()); do { Field *fields = result->Fetch(); diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp index 010dde30379..55d977840d7 100644 --- a/src/game/ScriptMgr.cpp +++ b/src/game/ScriptMgr.cpp @@ -92,7 +92,7 @@ void ScriptMgr::LoadScripts(ScriptMapMap& scripts, const char* tablename) if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -100,7 +100,7 @@ void ScriptMgr::LoadScripts(ScriptMapMap& scripts, const char* tablename) return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -533,6 +533,51 @@ void ScriptMgr::LoadScripts(ScriptMapMap& scripts, const char* tablename) } break; } + case SCRIPT_COMMAND_GO_LOCK_STATE: + { + if (!ObjectMgr::GetGameObjectInfo(tmp.goLockState.goEntry)) + { + sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_GO_LOCK_STATE for script id %u, but this gameobject_template does not exist.", tablename, tmp.goLockState.goEntry, tmp.id); + continue; + } + if (!tmp.goLockState.searchRadius) + { + sLog.outErrorDb("Table `%s` has invalid search radius (datalong3 = %u) in SCRIPT_COMMAND_GO_LOCK_STATE for script id %u.", tablename, tmp.goLockState.searchRadius, tmp.id); + continue; + } + if (// lock(0x01) and unlock(0x02) together + ((tmp.goLockState.lockState & 0x01) && (tmp.goLockState.lockState & 0x02)) || + // non-interact (0x4) and interact (0x08) together + ((tmp.goLockState.lockState & 0x04) && (tmp.goLockState.lockState & 0x08)) || + // no setting + !tmp.goLockState.lockState || + // invalid number + tmp.goLockState.lockState >= 0x10) + { + sLog.outErrorDb("Table `%s` has invalid lock state (datalong = %u) in SCRIPT_COMMAND_GO_LOCK_STATE for script id %u.", tablename, tmp.goLockState.lockState, tmp.id); + continue; + } + break; + } + case SCRIPT_COMMAND_STAND_STATE: + { + if (tmp.standState.stand_state >= MAX_UNIT_STAND_STATE) + { + sLog.outErrorDb("Table `%s` has invalid stand state (datalong = %u) in SCRIPT_COMMAND_STAND_STATE for script id %u", tablename, tmp.standState.stand_state, tmp.id); + continue; + } + if (tmp.standState.creatureEntry && !ObjectMgr::GetCreatureTemplate(tmp.standState.creatureEntry)) + { + sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_STAND_STATE for script id %u, but this creature_template does not exist.", tablename, tmp.standState.creatureEntry, tmp.id); + continue; + } + if (tmp.standState.creatureEntry && !tmp.standState.searchRadius) + { + sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_STAND_STATE for script id %u, but search radius is too small (datalong3 = %u).", tablename, tmp.standState.creatureEntry, tmp.id, tmp.standState.searchRadius); + continue; + } + break; + } } if (scripts.find(tmp.id) == scripts.end()) @@ -764,7 +809,7 @@ void ScriptMgr::LoadAreaTriggerScripts() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -772,7 +817,7 @@ void ScriptMgr::LoadAreaTriggerScripts() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -808,7 +853,7 @@ void ScriptMgr::LoadEventIdScripts() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -816,13 +861,13 @@ void ScriptMgr::LoadEventIdScripts() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); // TODO: remove duplicate code below, same way to collect event id's used in LoadEventScripts() std::set evt_scripts; // Load all possible event entries from gameobjects - for(uint32 i = 1; i < sGOStorage.MaxEntry; ++i) + for (uint32 i = 1; i < sGOStorage.MaxEntry; ++i) { if (GameObjectInfo const* goInfo = sGOStorage.LookupEntry(i)) { @@ -923,14 +968,14 @@ void ScriptMgr::LoadScriptNames() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); sLog.outErrorDb(">> Loaded empty set of Script Names!"); return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); uint32 count = 0; do @@ -943,7 +988,7 @@ void ScriptMgr::LoadScriptNames() std::sort(m_scriptNames.begin(), m_scriptNames.end()); sLog.outString(); - sLog.outString( ">> Loaded %d Script Names", count ); + sLog.outString(">> Loaded %d Script Names", count); } uint32 ScriptMgr::GetScriptId(const char *name) const diff --git a/src/game/ScriptMgr.h b/src/game/ScriptMgr.h index 419413e3a2c..ee950d5cf35 100644 --- a/src/game/ScriptMgr.h +++ b/src/game/ScriptMgr.h @@ -92,6 +92,13 @@ enum eScriptCommand // datalong2=creature entry, datalong3=search radius SCRIPT_COMMAND_ATTACK_START = 26, // source = Creature (or WorldObject when creature entry are defined), target = Player // datalong2 = creature entry (searching for a buddy, closest to source), datalong3 = creature search radius + SCRIPT_COMMAND_GO_LOCK_STATE = 27, // source or target must be WorldObject + // datalong= 1=lock, 2=unlock, 4=set not-interactable, 8=set interactable + // datalong2= go entry, datalong3= go search radius + SCRIPT_COMMAND_STAND_STATE = 28, // source = Unit (or WorldObject when creature entry defined), target = Unit (or none) + // datalong = stand state (enum UnitStandStateType) + // datalong2 = creature entry (searching for a buddy, closest to source), datalong3 = creature search radius + // data_flags = flag_target_as_source = 0x01 }; #define MAX_TEXT_ID 4 // used for SCRIPT_COMMAND_TALK @@ -284,6 +291,22 @@ struct ScriptInfo uint32 flags; // data_flags } attack; + struct // SCRIPT_COMMAND_GO_LOCK_STATE (27) + { + uint32 lockState; // datalong + uint32 goEntry; // datalong2 + uint32 searchRadius; // datalong3 + } goLockState; + + struct // SCRIPT_COMMAND_STAND_STATE (28) + { + uint32 stand_state; // datalong + uint32 creatureEntry; // datalong2 + uint32 searchRadius; // datalong3 + uint32 unused1; // datalong4 + uint32 flags; // data_flags + } standState; + struct { uint32 data[9]; diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 061dcf74b71..c3ed82b5a01 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -951,6 +951,111 @@ enum SpellCastResult SPELL_CAST_OK = 255 // custom value, don't must be send to client }; +// Used in addition to SPELL_FAILED_CUSTOM_ERROR +enum SpellCastResultCustom +{ + // Postfix _NONE will not display the text in client + SPELL_FAILED_CUSTOM_ERROR_1 = 1, // "Something bad happened, and we want to display a custom message!" + SPELL_FAILED_CUSTOM_ERROR_2 = 2, // "Alex broke your quest! Thank him later!" + SPELL_FAILED_CUSTOM_ERROR_3 = 3, // "This spell may only be used on Helpless Wintergarde Villagers that have not been rescued." + SPELL_FAILED_CUSTOM_ERROR_4 = 4, // "Requires that you be wearing the Warsong Disguise." + SPELL_FAILED_CUSTOM_ERROR_5 = 5, // "You must be closer to a plague wagon in order to drop off yor 7th Legion Siege Engineer." + SPELL_FAILED_CUSTOM_ERROR_6 = 6, // "You cannot target friendly targets outside your party." + SPELL_FAILED_CUSTOM_ERROR_7 = 7, // "You must target a weakened chill nymph." + SPELL_FAILED_CUSTOM_ERROR_8 = 8, // "The Imbued Scourge Shroud will only work when equipped in the Temple City of En'Kilah" + SPELL_FAILED_CUSTOM_ERROR_9 = 9, // "Requires Corpse Dust" + SPELL_FAILED_CUSTOM_ERROR_10 = 10, // "You cannot summon another gargoyle yet." + SPELL_FAILED_CUSTOM_ERROR_11 = 11, // "Requires Corpse Dust if the target is not dead and humanoid." + SPELL_FAILED_CUSTOM_ERROR_12 = 12, // "Can only be placed near Shatterhorn." + SPELL_FAILED_CUSTOM_ERROR_13 = 13, // "You must first select a Proto-Drake Egg" + SPELL_FAILED_CUSTOM_ERROR_14_NONE = 14, // "You must be close to a marked tree." + SPELL_FAILED_CUSTOM_ERROR_15 = 15, // "You must target a Fjord Turkey." + SPELL_FAILED_CUSTOM_ERROR_16 = 16, // "You must target a Fjord Hawk." + SPELL_FAILED_CUSTOM_ERROR_17 = 17, // "You are too far away from the bouy." + SPELL_FAILED_CUSTOM_ERROR_18 = 18, // "Must be used near an oil slick." + SPELL_FAILED_CUSTOM_ERROR_19 = 19, // "You must be closer to the bouy!" + SPELL_FAILED_CUSTOM_ERROR_20 = 20, // "You may only call for the aid of a Wyrmrest Vanquisher in Wyrmrest Temple, The Dragon Wastes, Galakrond's Rest or The Wicked Coil." + SPELL_FAILED_CUSTOM_ERROR_21 = 21, // "Can only be used on a Ice Heart Jormungar Spawn." + SPELL_FAILED_CUSTOM_ERROR_22 = 22, // "You must be closer to a sinkhole to use your map." + SPELL_FAILED_CUSTOM_ERROR_23 = 23, // "You may only call down a stampede on Harold Lane." + SPELL_FAILED_CUSTOM_ERROR_24 = 24, // "You may only use the Pouch of Crushed Bloodspore on Gammothra or other magnataur in the Bloodspore Plains and Gammoth." + SPELL_FAILED_CUSTOM_ERROR_25 = 25, // "Requires the magmawyrm ressurection chamber in the back of the Maw of Neltharion." + SPELL_FAILED_CUSTOM_ERROR_26 = 26, // "You may only call down a Wintergarde Gryphon in Wintergarde Keep or the Carrion Fields." + SPELL_FAILED_CUSTOM_ERROR_27 = 27, // "What are you doing? Only aim that thing at Wilhelm!" + SPELL_FAILED_CUSTOM_ERROR_28 = 28, // "Not enough health!" + SPELL_FAILED_CUSTOM_ERROR_29 = 29, // "There are no nearby corpses to use" + SPELL_FAILED_CUSTOM_ERROR_30 = 30, // "You've created enough ghouls. Return to Gothik the Harvester at Death's Breach." + SPELL_FAILED_CUSTOM_ERROR_31 = 31, // "Your companion does not want to come here. Go further from the Sundered Shard." + SPELL_FAILED_CUSTOM_ERROR_32 = 32, // "Must be in Cat Form" + SPELL_FAILED_CUSTOM_ERROR_33 = 33, // "Only Death Knights may enter Ebon Hold." + SPELL_FAILED_CUSTOM_ERROR_34 = 34, // "Must be in Cat Form, Bear Form, or Dire Bear Form." + SPELL_FAILED_CUSTOM_ERROR_35 = 35, // "You must be within range of a Helpless Wintergarde Villager" + SPELL_FAILED_CUSTOM_ERROR_36 = 36, // "You cannot target an elemental or mechanical corpse." + SPELL_FAILED_CUSTOM_ERROR_37 = 37, // "This teleport crystal cannot be used until the teleport crystal in Dalaran has been used at least once." + SPELL_FAILED_CUSTOM_ERROR_38 = 38, // "You are already holding something in your hand. You must throw the creature in your hand before picking up another." + SPELL_FAILED_CUSTOM_ERROR_39 = 39, // "You don't have anything to throw! Find a Vargul and use Gymer Grab to pick one up!" + SPELL_FAILED_CUSTOM_ERROR_40 = 40, // "Bouldercrag's War Horn can only be used within 10 yards of Valduran the Stormborn." + SPELL_FAILED_CUSTOM_ERROR_41 = 41, // "You are not carrying a passenger. There is nobody to drop off." + SPELL_FAILED_CUSTOM_ERROR_42 = 42, // "You cannot build any more siege vehicles." + SPELL_FAILED_CUSTOM_ERROR_43 = 43, // "You are already carrying a captured Argent Crusader. You must return to the Argen Vanguard Infirmary and drop off your passenger before you may pick up another." + SPELL_FAILED_CUSTOM_ERROR_44 = 44, // "You can't do that while rooted." + SPELL_FAILED_CUSTOM_ERROR_45 = 45, // "Requires a nearby target." + SPELL_FAILED_CUSTOM_ERROR_46 = 46, // "Nothing left to discover." + SPELL_FAILED_CUSTOM_ERROR_47 = 47, // "No targets close enough to bluff." + SPELL_FAILED_CUSTOM_ERROR_48 = 48, // "Your Iron Rune Construct is out of range." + SPELL_FAILED_CUSTOM_ERROR_49 = 49, // "Requires Grand Master Engineer." + SPELL_FAILED_CUSTOM_ERROR_50 = 50, // "You can't use that mount." + SPELL_FAILED_CUSTOM_ERROR_51 = 51, // "There is nobody to eject!" + SPELL_FAILED_CUSTOM_ERROR_52 = 52, // "The target must be bound to you." + SPELL_FAILED_CUSTOM_ERROR_53 = 53, // "Target must be undead." + SPELL_FAILED_CUSTOM_ERROR_54 = 54, // "You have no target or your target is too far away." + SPELL_FAILED_CUSTOM_ERROR_55 = 55, // "Missing Reagents: Dark Matter" + SPELL_FAILED_CUSTOM_ERROR_56 = 56, // "You can't use that item." + SPELL_FAILED_CUSTOM_ERROR_57 = 57, // "You can't do that when Cycloned." + SPELL_FAILED_CUSTOM_ERROR_58 = 58, // "Target is already affected by a scroll." + SPELL_FAILED_CUSTOM_ERROR_59 = 59, // "That anti-venom is not strong enough to dispel that poison." + SPELL_FAILED_CUSTOM_ERROR_60 = 60, // "You must have a lance equipped." + SPELL_FAILED_CUSTOM_ERROR_61 = 61, // "You must be near the Maiden of Winter's Breath Lake" + SPELL_FAILED_CUSTOM_ERROR_62 = 62, // "You have learned everything from that book." + SPELL_FAILED_CUSTOM_ERROR_63_NONE = 63, // "Your pet is dead" + SPELL_FAILED_CUSTOM_ERROR_64_NONE = 64, // "There are no valid targets within range." + SPELL_FAILED_CUSTOM_ERROR_65 = 65, // "Only GMs may use that. Your account has been reported for investigation." + SPELL_FAILED_CUSTOM_ERROR_66 = 66, // "You must reach level 58 to use this portal." + SPELL_FAILED_CUSTOM_ERROR_67 = 67, // "You already have the maximum amount of honor." + SPELL_FAILED_CUSTOM_ERROR_68 = 68, // "" + SPELL_FAILED_CUSTOM_ERROR_69 = 69, // "" + SPELL_FAILED_CUSTOM_ERROR_70 = 70, // "" + SPELL_FAILED_CUSTOM_ERROR_71 = 71, // "" + SPELL_FAILED_CUSTOM_ERROR_72 = 72, // "" + SPELL_FAILED_CUSTOM_ERROR_73 = 73, // "" + SPELL_FAILED_CUSTOM_ERROR_74 = 74, // "" + SPELL_FAILED_CUSTOM_ERROR_75 = 75, // "You must have a demonic circle active." + SPELL_FAILED_CUSTOM_ERROR_76 = 76, // "You already have maximum rage" + SPELL_FAILED_CUSTOM_ERROR_77 = 77, // "Requires Engineering (350)" + SPELL_FAILED_CUSTOM_ERROR_78 = 78, // "Your soul belongs to the Lich King" + SPELL_FAILED_CUSTOM_ERROR_79 = 79, // "Your attendant already has an Argent Pony" + SPELL_FAILED_CUSTOM_ERROR_80 = 80, // "" + SPELL_FAILED_CUSTOM_ERROR_81 = 81, // "" + SPELL_FAILED_CUSTOM_ERROR_82 = 82, // "" + SPELL_FAILED_CUSTOM_ERROR_83 = 83, // "You must have a Fire Totem active." + SPELL_FAILED_CUSTOM_ERROR_84 = 84, // "You may not bite other vampires." + SPELL_FAILED_CUSTOM_ERROR_85 = 85, // "Your pet is already at your level." + SPELL_FAILED_CUSTOM_ERROR_86 = 86, // "You do not meet the level requirements for this item." + SPELL_FAILED_CUSTOM_ERROR_87 = 87, // "There are too many Mutated Abominations." + SPELL_FAILED_CUSTOM_ERROR_88 = 88, // "The potions have all been depleted by Professor Putricide." + SPELL_FAILED_CUSTOM_ERROR_89 = 89, // "" + SPELL_FAILED_CUSTOM_ERROR_90 = 90, // "Requires level 65" + SPELL_FAILED_CUSTOM_ERROR_91 = 91, // "" + SPELL_FAILED_CUSTOM_ERROR_92 = 92, // "" + SPELL_FAILED_CUSTOM_ERROR_93 = 93, // "" + SPELL_FAILED_CUSTOM_ERROR_94 = 94, // "" + SPELL_FAILED_CUSTOM_ERROR_95 = 95, // "" + SPELL_FAILED_CUSTOM_ERROR_96 = 96, // "You already have the max number of recruits." + SPELL_FAILED_CUSTOM_ERROR_97 = 97, // "You already have the max number of volunteers." + SPELL_FAILED_CUSTOM_ERROR_98 = 98, // "Frostmourne has rendered you unable to ressurect." + SPELL_FAILED_CUSTOM_ERROR_99 = 99, // "You can't mount while affected by that shapeshift." +}; + // Spell aura states enum AuraState { // (C) used in caster aura state (T) used in target aura state @@ -1276,7 +1381,7 @@ enum GameObjectFlags GO_FLAG_LOCKED = 0x00000002, //require key, spell, event, etc to be opened. Makes "Locked" appear in tooltip GO_FLAG_INTERACT_COND = 0x00000004, //cannot interact (condition to interact) GO_FLAG_TRANSPORT = 0x00000008, //any kind of transport? Object can transport (elevator, boat, car) - GO_FLAG_UNK1 = 0x00000010, // + GO_FLAG_NO_INTERACT = 0x00000010, //players cannot interact with this go (often need to remove flag in event) GO_FLAG_NODESPAWN = 0x00000020, //never despawn, typically for doors, they just change state GO_FLAG_TRIGGERED = 0x00000040, //typically, summoned objects. Triggered by spell or other events GO_FLAG_UNK_8 = 0x00000080, @@ -2012,7 +2117,7 @@ enum CreatureTypeFlags CREATURE_TYPEFLAGS_UNK21 = 0x00100000, // no idea, but it used by client, may be related to rendering CREATURE_TYPEFLAGS_UNK22 = 0x00200000, // may be has something to do with animation (disable animation?) CREATURE_TYPEFLAGS_UNK23 = 0x00400000, // this one probably controls some creature visual - CREATURE_TYPEFLAGS_UNK24 = 0x00800000, // ? First seen in 3.2.2. Related to banner/backpack of creature/companion, used in CanInteract function by client + CREATURE_TYPEFLAGS_SQUIRE = 0x00800000, // First seen in 3.2.2. Related to banner/backpack of creature/companion, used in CanInteract function by client CREATURE_TYPEFLAGS_UNK25 = 0x01000000, // pet sounds related? CREATURE_TYPEFLAGS_UNK26 = 0x02000000, // this one probably controls some creature visual CREATURE_TYPEFLAGS_UNK27 = 0x04000000, // creature has no type, or forces creature to be considered as in party, may be related to creature assistance diff --git a/src/game/SkillDiscovery.cpp b/src/game/SkillDiscovery.cpp index 0f5febd49a6..225090f7ae9 100644 --- a/src/game/SkillDiscovery.cpp +++ b/src/game/SkillDiscovery.cpp @@ -62,7 +62,7 @@ void LoadSkillDiscoveryTable() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); std::ostringstream ssNonDiscoverableEntries; std::set reportedReqSpells; diff --git a/src/game/SkillExtraItems.cpp b/src/game/SkillExtraItems.cpp index dabecfad988..349b3c5acc6 100644 --- a/src/game/SkillExtraItems.cpp +++ b/src/game/SkillExtraItems.cpp @@ -61,7 +61,7 @@ void LoadSkillExtraItemTable() if (result) { - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -70,28 +70,28 @@ void LoadSkillExtraItemTable() uint32 spellId = fields[0].GetUInt32(); - if(!sSpellStore.LookupEntry(spellId)) + if (!sSpellStore.LookupEntry(spellId)) { sLog.outError("Skill specialization %u has nonexistent spell id in `skill_extra_item_template`!", spellId); continue; } uint32 requiredSpecialization = fields[1].GetUInt32(); - if(!sSpellStore.LookupEntry(requiredSpecialization)) + if (!sSpellStore.LookupEntry(requiredSpecialization)) { sLog.outError("Skill specialization %u have nonexistent required specialization spell id %u in `skill_extra_item_template`!", spellId,requiredSpecialization); continue; } float additionalCreateChance = fields[2].GetFloat(); - if(additionalCreateChance <= 0.0f) + if (additionalCreateChance <= 0.0f) { sLog.outError("Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId); continue; } uint8 additionalMaxNum = fields[3].GetUInt8(); - if(!additionalMaxNum) + if (!additionalMaxNum) { sLog.outError("Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId); continue; @@ -109,7 +109,7 @@ void LoadSkillExtraItemTable() delete result; sLog.outString(); - sLog.outString( ">> Loaded %u spell specialization definitions", count ); + sLog.outString(">> Loaded %u spell specialization definitions", count); } else { diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index d81fac91fd5..c25ca47f22b 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -321,7 +321,7 @@ Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid o if (info->SpellDifficultyId && caster->GetTypeId() != TYPEID_PLAYER && caster->IsInWorld() && caster->GetMap()->IsDungeon()) { - if (SpellEntry const* spellEntry = GetSpellEntryByDifficulty(info->SpellDifficultyId, caster->GetMap()->GetDifficulty())) + if (SpellEntry const* spellEntry = GetSpellEntryByDifficulty(info->SpellDifficultyId, caster->GetMap()->GetDifficulty(), caster->GetMap()->IsRaid())) m_spellInfo = spellEntry; else m_spellInfo = info; @@ -652,14 +652,13 @@ void Spell::FillTargetMap() break; } - if(m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->GetTypeId() == TYPEID_PLAYER) { Player *me = (Player*)m_caster; for (UnitList::const_iterator itr = tmpUnitMap.begin(); itr != tmpUnitMap.end(); ++itr) { - Unit *owner = (*itr)->GetOwner(); - Unit *u = owner ? owner : (*itr); - if(u!=m_caster && u->IsPvP() && (!me->duel || me->duel->opponent != u)) + Player *targetOwner = (*itr)->GetCharmerOrOwnerPlayerOrPlayerItself(); + if (targetOwner && targetOwner != me && targetOwner->IsPvP() && !me->IsInDuelWith(targetOwner)) { me->UpdatePvP(true); me->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); @@ -1521,10 +1520,10 @@ class ChainHealingFullHealth: std::unary_function // Helper for targets nearest to the spell target // The spell target is always first unless there is a target at _completely_ the same position (unbelievable case) -struct TargetDistanceOrder : public std::binary_function +struct TargetDistanceOrderNear : public std::binary_function { const Unit* MainTarget; - TargetDistanceOrder(const Unit* Target) : MainTarget(Target) {}; + TargetDistanceOrderNear(const Unit* Target) : MainTarget(Target) {}; // functor for operator ">" bool operator()(const Unit* _Left, const Unit* _Right) const { @@ -1532,6 +1531,19 @@ struct TargetDistanceOrder : public std::binary_function +{ + const Unit* MainTarget; + TargetDistanceOrderFarAway(const Unit* Target) : MainTarget(Target) {}; + // functor for operator "<" + bool operator()(const Unit* _Left, const Unit* _Right) const + { + return !MainTarget->GetDistanceOrder(_Left, _Right); + } +}; + void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& targetUnitMap) { SpellEffectEntry const* spellEffect = m_spellInfo->GetSpellEffect(effIndex); @@ -1572,6 +1584,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& case 38794: // Murmur's Touch (h) case 50988: // Glare of the Tribunal (Halls of Stone) case 59870: // Glare of the Tribunal (h) (Halls of Stone) + case 64218: // Overcharge case 68950: // Fear unMaxTargets = 1; break; @@ -1702,7 +1715,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& if(tempTargetUnitMap.empty()) break; - tempTargetUnitMap.sort(TargetDistanceOrder(m_caster)); + tempTargetUnitMap.sort(TargetDistanceOrderNear(m_caster)); //Now to get us a random target that's in the initial range of the spell uint32 t = 0; @@ -1720,7 +1733,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& tempTargetUnitMap.erase(itr); - tempTargetUnitMap.sort(TargetDistanceOrder(pUnitTarget)); + tempTargetUnitMap.sort(TargetDistanceOrderNear(pUnitTarget)); t = unMaxTargets - 1; Unit *prev = pUnitTarget; @@ -1740,7 +1753,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& prev = *next; targetUnitMap.push_back(prev); tempTargetUnitMap.erase(next); - tempTargetUnitMap.sort(TargetDistanceOrder(prev)); + tempTargetUnitMap.sort(TargetDistanceOrderNear(prev)); next = tempTargetUnitMap.begin(); --t; @@ -1762,7 +1775,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& if(tempTargetUnitMap.empty()) break; - tempTargetUnitMap.sort(TargetDistanceOrder(m_caster)); + tempTargetUnitMap.sort(TargetDistanceOrderNear(m_caster)); //Now to get us a random target that's in the initial range of the spell uint32 t = 0; @@ -1780,7 +1793,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& tempTargetUnitMap.erase(itr); - tempTargetUnitMap.sort(TargetDistanceOrder(pUnitTarget)); + tempTargetUnitMap.sort(TargetDistanceOrderNear(pUnitTarget)); t = unMaxTargets - 1; Unit *prev = pUnitTarget; @@ -1799,7 +1812,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& prev = *next; targetUnitMap.push_back(prev); tempTargetUnitMap.erase(next); - tempTargetUnitMap.sort(TargetDistanceOrder(prev)); + tempTargetUnitMap.sort(TargetDistanceOrderNear(prev)); next = tempTargetUnitMap.begin(); --t; } @@ -1847,7 +1860,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& if (tempTargetUnitMap.empty()) break; - tempTargetUnitMap.sort(TargetDistanceOrder(pUnitTarget)); + tempTargetUnitMap.sort(TargetDistanceOrderNear(pUnitTarget)); if (*tempTargetUnitMap.begin() == pUnitTarget) tempTargetUnitMap.erase(tempTargetUnitMap.begin()); @@ -1869,7 +1882,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& prev = *next; targetUnitMap.push_back(prev); tempTargetUnitMap.erase(next); - tempTargetUnitMap.sort(TargetDistanceOrder(prev)); + tempTargetUnitMap.sort(TargetDistanceOrderNear(prev)); next = tempTargetUnitMap.begin(); --t; } @@ -1878,6 +1891,16 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& } case TARGET_ALL_ENEMY_IN_AREA: FillAreaTargets(targetUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE); + + if (m_spellInfo->Id == 42005) // Bloodboil + { + // manually cuting, because the spell hits only the 5 furthest away targets + if (targetUnitMap.size() > unMaxTargets) + { + targetUnitMap.sort(TargetDistanceOrderFarAway(m_caster)); + targetUnitMap.resize(unMaxTargets); + } + } break; case TARGET_AREAEFFECT_INSTANT: { @@ -2030,6 +2053,12 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& break; default: FillAreaTargets(targetUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE); + + // Mind Sear, triggered + if (m_spellInfo->IsFitToFamily(SPELLFAMILY_PRIEST, UI64LIT(0x0008000000000000))) + if (Unit* unitTarget = m_targets.getUnitTarget()) + targetUnitMap.remove(unitTarget); + break; } break; @@ -2041,24 +2070,24 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& break; } case TARGET_ALL_PARTY_AROUND_CASTER: - case TARGET_ALL_PARTY_AROUND_CASTER_2: - case TARGET_ALL_PARTY: { - switch(m_spellInfo->Id) + if (m_caster->GetObjectGuid().IsPet()) { - case 70893: // Culling the Herd - case 53434: // Call of the Wild - { - if (Unit *owner = m_caster->GetOwner()) - targetUnitMap.push_back(owner); - break; - } - default: - { - FillRaidOrPartyTargets(targetUnitMap, m_caster, m_caster, radius, false, true, true); - break; - } + // only affect pet and owner + targetUnitMap.push_back(m_caster); + if (Unit* owner = m_caster->GetOwner()) + targetUnitMap.push_back(owner); } + else + { + FillRaidOrPartyTargets(targetUnitMap, m_caster, m_caster, radius, false, true, true); + } + break; + } + case TARGET_ALL_PARTY_AROUND_CASTER_2: + case TARGET_ALL_PARTY: + { + FillRaidOrPartyTargets(targetUnitMap, m_caster, m_caster, radius, false, true, true); break; } case TARGET_ALL_RAID_AROUND_CASTER: @@ -2374,7 +2403,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& if (m_caster != pUnitTarget && std::find(tempTargetUnitMap.begin(), tempTargetUnitMap.end(), m_caster) == tempTargetUnitMap.end()) tempTargetUnitMap.push_front(m_caster); - tempTargetUnitMap.sort(TargetDistanceOrder(pUnitTarget)); + tempTargetUnitMap.sort(TargetDistanceOrderNear(pUnitTarget)); if (tempTargetUnitMap.empty()) break; @@ -2407,7 +2436,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& prev = *next; targetUnitMap.push_back(prev); tempTargetUnitMap.erase(next); - tempTargetUnitMap.sort(TargetDistanceOrder(prev)); + tempTargetUnitMap.sort(TargetDistanceOrderNear(prev)); next = tempTargetUnitMap.begin(); --t; @@ -2422,8 +2451,6 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& { targetUnitMap.push_back(currentTarget); m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ()); - if(spellEffect && spellEffect->EffectImplicitTargetB == TARGET_ALL_ENEMY_IN_AREA_INSTANT) - FillAreaTargets(targetUnitMap, radius, PUSH_TARGET_CENTER, SPELL_TARGETS_AOE_DAMAGE); } break; } @@ -3593,6 +3620,9 @@ void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 ca data << uint8(result); // problem switch (result) { + case SPELL_FAILED_NOT_READY: + data << uint32(0); // unknown, value 1 seen for 14177 + break; case SPELL_FAILED_REQUIRES_SPELL_FOCUS: data << uint32(spellInfo->GetRequiresSpellFocus()); break; @@ -3640,6 +3670,15 @@ void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 ca //data << uint32(eqItems ? eqItems->EquippedItemInventoryTypeMask : 0); } break; + case SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND: + case SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND: + // same data as SPELL_FAILED_EQUIPPED_ITEM_CLASS ? + data << uint32(0); + data << uint32(0); + break; + case SPELL_FAILED_PREVENTED_BY_MECHANIC: + data << uint32(0); // unknown, mechanic mask? + break; default: break; } @@ -4827,8 +4866,8 @@ SpellCastResult Spell::CheckCast(bool strict) // Exclusion for Pounce: Facing Limitation was removed in 2.0.1, but it still uses the same, old Ex-Flags // Exclusion for Mutilate:Facing Limitation was removed in 2.0.1 and 3.0.3, but they still use the same, old Ex-Flags // Exclusion for Throw: Facing limitation was added in 3.2.x, but that shouldn't be - if (classOptions && (classOptions->SpellFamilyName != SPELLFAMILY_DRUID || (classOptions->SpellFamilyFlags != UI64LIT(0x0000000000020000))) && - (classOptions->SpellFamilyName != SPELLFAMILY_ROGUE || (classOptions->SpellFamilyFlags != UI64LIT(0x0020000000000000))) && + if (!m_spellInfo->IsFitToFamily(SPELLFAMILY_DRUID, UI64LIT(0x0000000000020000)) && + !m_spellInfo->IsFitToFamily(SPELLFAMILY_ROGUE, UI64LIT(0x0020000000000000)) && m_spellInfo->Id != 2764) { SendInterrupted(2); @@ -5803,19 +5842,29 @@ SpellCastResult Spell::CheckCasterAuras() const else if (spellEffect->EffectApplyAuraName == SPELL_AURA_DISPEL_IMMUNITY) dispel_immune |= GetDispellMask(DispelType(spellEffect->EffectMiscValue)); } - // immune movement impairment and loss of control - if (m_spellInfo->Id == 42292) // PvP Trinket + + // immune movement impairment and loss of control (spell data have special structure for mark this case) + if (IsSpellRemoveAllMovementAndControlLossEffects(m_spellInfo)) mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; } // Check whether the cast should be prevented by any state you might have. SpellCastResult prevented_reason = SPELL_CAST_OK; + bool spellUsableWhileStunned = m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED; + // Have to check if there is a stun aura. Otherwise will have problems with ghost aura apply while logging out uint32 unitflag = m_caster->GetUInt32Value(UNIT_FIELD_FLAGS); // Get unit state if (unitflag & UNIT_FLAG_STUNNED) { + // Pain Suppression (have SPELL_ATTR_EX5_USABLE_WHILE_STUNNED that must be used only with glyph) + if (m_spellInfo->GetSpellFamilyName() == SPELLFAMILY_PRIEST && m_spellInfo->SpellIconID == 2178) + { + if (!m_caster->HasAura(63248)) // Glyph of Pain Suppression + spellUsableWhileStunned = false; + } + // spell is usable while stunned, check if caster has only mechanic stun auras, another stun types must prevent cast spell - if (m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED) + if (spellUsableWhileStunned) { bool is_stun_mechanic = true; Unit::AuraList const& stunAuras = m_caster->GetAurasByType(SPELL_AURA_MOD_STUN); @@ -5882,7 +5931,7 @@ SpellCastResult Spell::CheckCasterAuras() const switch(aura->GetModifier()->m_auraname) { case SPELL_AURA_MOD_STUN: - if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED) || !aura->HasMechanic(MECHANIC_STUN)) + if (!spellUsableWhileStunned || !aura->HasMechanic(MECHANIC_STUN)) return SPELL_FAILED_STUNNED; break; case SPELL_AURA_MOD_CONFUSE: diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index a975f050b3d..6f88c7d8bb4 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -329,7 +329,7 @@ enum AuraType SPELL_AURA_MOD_QUEST_XP_PCT = 291, SPELL_AURA_OPEN_STABLE = 292, SPELL_AURA_ADD_MECHANIC_ABILITIES = 293, - SPELL_AURA_294 = 294, + SPELL_AURA_STOP_NATURAL_MANA_REGEN = 294, SPELL_AURA_295 = 295, SPELL_AURA_296 = 296, SPELL_AURA_297 = 297, diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index ef2e2258b0d..e64fc1f8f07 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -137,7 +137,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleModRegen, // 84 SPELL_AURA_MOD_REGEN &Aura::HandleModPowerRegen, // 85 SPELL_AURA_MOD_POWER_REGEN &Aura::HandleChannelDeathItem, // 86 SPELL_AURA_CHANNEL_DEATH_ITEM - &Aura::HandleNoImmediateEffect, // 87 SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN implemented in Unit::MeleeDamageBonusTaken and Unit::SpellDamageBonusTaken + &Aura::HandleDamagePercentTaken, // 87 SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN implemented in Unit::MeleeDamageBonusTaken and Unit::SpellDamageBonusTaken &Aura::HandleNoImmediateEffect, // 88 SPELL_AURA_MOD_HEALTH_REGEN_PERCENT implemented in Player::RegenerateHealth &Aura::HandlePeriodicDamagePCT, // 89 SPELL_AURA_PERIODIC_DAMAGE_PERCENT &Aura::HandleUnused, // 90 unused (3.0.8a-3.2.2a) old SPELL_AURA_MOD_RESIST_CHANCE @@ -319,7 +319,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleUnused, //266 unused (3.0.8a-3.2.2a) &Aura::HandleNoImmediateEffect, //267 SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL implemented in Unit::IsImmuneToSpellEffect &Aura::HandleAuraModAttackPowerOfStatPercent, //268 SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT - &Aura::HandleNoImmediateEffect, //269 SPELL_AURA_MOD_IGNORE_DAMAGE_REDUCTION_SCHOOL implemented in Unit::CalcNotIgnoreDamageRedunction + &Aura::HandleNoImmediateEffect, //269 SPELL_AURA_MOD_IGNORE_DAMAGE_REDUCTION_SCHOOL implemented in Unit::CalcNotIgnoreDamageReduction &Aura::HandleUnused, //270 SPELL_AURA_MOD_IGNORE_TARGET_RESIST (unused in 3.2.2a) &Aura::HandleNoImmediateEffect, //271 SPELL_AURA_MOD_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonusTaken &Aura::HandleNoImmediateEffect, //272 SPELL_AURA_MAELSTROM_WEAPON (unclear use for aura, it used in (3.2.2a...3.3.0) in single spell 53817 that spellmode stacked and charged spell expected to be drop as stack @@ -344,7 +344,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNoImmediateEffect, //291 SPELL_AURA_MOD_QUEST_XP_PCT implemented in Player::GiveXP &Aura::HandleAuraOpenStable, //292 call stabled pet &Aura::HandleAuraAddMechanicAbilities, //293 SPELL_AURA_ADD_MECHANIC_ABILITIES replaces target's action bars with a predefined spellset - &Aura::HandleNULL, //294 2 spells, possible prevent mana regen + &Aura::HandleAuraStopNaturalManaRegen, //294 SPELL_AURA_STOP_NATURAL_MANA_REGEN implemented in Player:Regenerate &Aura::HandleUnused, //295 unused (3.2.2a) &Aura::HandleNULL, //296 2 spells &Aura::HandleNULL, //297 1 spell (counter spell school?) @@ -862,32 +862,16 @@ void Aura::ApplyModifier(bool apply, bool Real) bool Aura::isAffectedOnSpell(SpellEntry const *spell) const { - SpellClassOptionsEntry const* classOpt = spell->GetSpellClassOptions(); - if(!classOpt) - return false; - // Check family name - if (SpellFamily(classOpt->SpellFamilyName) != GetHolder()->GetSpellProto()->GetSpellFamilyName()) - return false; - // Check EffectClassMask - uint32 const *ptr = getAuraSpellClassMask(); - if(!ptr) - return false; - if (((uint64*)ptr)[0] & classOpt->SpellFamilyFlags) - return true; - if (ptr[2] & classOpt->SpellFamilyFlags2) - return true; - return false; + return spell->IsFitToFamily(GetSpellProto()->GetSpellFamilyName(), GetAuraSpellClassMask()); } bool Aura::CanProcFrom(SpellEntry const *spell, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const { // Check EffectClassMask - uint32 const *ptr = getAuraSpellClassMask(); - if(!ptr) - return true; + ClassFamilyMask const& mask = GetAuraSpellClassMask(); // if no class mask defined, or spell_proc_event has SpellFamilyName=0 - allow proc - if (!useClassMask || (!((uint64*)ptr)[0] && !ptr[2])) + if (!useClassMask || !mask) { if (!(EventProcEx & PROC_EX_EX_TRIGGER_ALWAYS)) { @@ -917,13 +901,8 @@ bool Aura::CanProcFrom(SpellEntry const *spell, uint32 EventProcEx, uint32 procE if(!classOpt) return true; - if (((uint64*)ptr)[0] & classOpt->SpellFamilyFlags) - return true; - - if (ptr[2] & classOpt->SpellFamilyFlags2) - return true; + return mask.IsFitToFamilyMask(classOpt->SpellFamilyFlags); } - return false; } void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode ) @@ -1058,6 +1037,19 @@ void Aura::HandleAddModifier(bool apply, bool Real) // prevent expire spell mods with (charges > 0 && m_stackAmount > 1) // all this spell expected expire not at use but at spell proc event check GetSpellProto()->GetStackAmount() > 1 ? 0 : GetHolder()->GetAuraCharges()); + + // Everlasting Affliction, overwrite wrong data, if will need more better restore support of spell_affect table + if (spellProto->GetSpellFamilyName() == SPELLFAMILY_WARLOCK && spellProto->SpellIconID == 3169) + { + // Corruption and Unstable Affliction + m_spellmod->mask = ClassFamilyMask(UI64LIT(0x0000010000000002)); + } + // Improved Flametongue Weapon, overwrite wrong data, maybe time re-add table + else if (spellProto->Id == 37212) + { + // Flametongue Weapon (Passive) + m_spellmod->mask = ClassFamilyMask(UI64LIT(0x0000000000200000)); + } } ((Player*)GetTarget())->AddSpellMod(m_spellmod, apply); @@ -3217,25 +3209,8 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) } } - // now only powertype must be set - switch(form) - { - case FORM_CAT: - PowerType = POWER_ENERGY; - break; - case FORM_BEAR: - case FORM_DIREBEAR: - case FORM_BATTLESTANCE: - case FORM_BERSERKERSTANCE: - case FORM_DEFENSIVESTANCE: - PowerType = POWER_RAGE; - break; - default: - break; - } - // remove polymorph before changing display id to keep new display id - switch ( form ) + switch (form) { case FORM_CAT: case FORM_TREE: @@ -3272,7 +3247,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) } // and polymorphic affects - if(target->IsPolymorphed()) + if (target->IsPolymorphed()) target->RemoveAurasDueToSpell(target->getTransForm()); break; @@ -3281,21 +3256,41 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) break; } - if(apply) + if (apply) { // remove other shapeshift before applying a new one target->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT, GetHolder()); - if(modelid > 0) + // need send to client not form active state, or at re-apply form client go crazy + target->SendForcedObjectUpdate(); + + if (modelid > 0) target->SetDisplayId(modelid); - if(PowerType != POWER_MANA) + // now only powertype must be set + switch (form) + { + case FORM_CAT: + PowerType = POWER_ENERGY; + break; + case FORM_BEAR: + case FORM_DIREBEAR: + case FORM_BATTLESTANCE: + case FORM_BERSERKERSTANCE: + case FORM_DEFENSIVESTANCE: + PowerType = POWER_RAGE; + break; + default: + break; + } + + if (PowerType != POWER_MANA) { // reset power to default values only at power change - if(target->getPowerType() != PowerType) + if (target->getPowerType() != PowerType) target->setPowerType(PowerType); - switch(form) + switch (form) { case FORM_CAT: case FORM_BEAR: @@ -3304,7 +3299,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) // get furor proc chance int32 furorChance = 0; Unit::AuraList const& mDummy = target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator i = mDummy.begin(); i != mDummy.end(); ++i) + for (Unit::AuraList::const_iterator i = mDummy.begin(); i != mDummy.end(); ++i) { if ((*i)->GetSpellProto()->SpellIconID == 238) { @@ -4444,8 +4439,23 @@ void Aura::HandleModStealth(bool apply, bool Real) } else { + if (!Real) + return; + + // Vanish (triggered, normal stealth need apply before remove advanced stealth) + if (target->GetTypeId() == TYPEID_PLAYER && m_removeMode == AURA_REMOVE_BY_EXPIRE && + GetSpellProto()->IsFitToFamily(SPELLFAMILY_ROGUE, UI64LIT(0x000000000800))) + { + uint32 spellId = 1784; // Stealth + // reset cooldown on it if needed + if (((Player*)target)->HasSpellCooldown(spellId)) + ((Player*)target)->RemoveSpellCooldown(spellId); + + target->CastSpell(target, spellId, true); + } + // only at real aura remove of _last_ SPELL_AURA_MOD_STEALTH - if (Real && !target->HasAuraType(SPELL_AURA_MOD_STEALTH)) + if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) { // if no GM invisibility if (target->GetVisibility()!=VISIBILITY_OFF) @@ -4904,15 +4914,15 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/) Unit *target = GetTarget(); - if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) + if (apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) { uint32 mechanic = 1 << (misc-1); - //immune movement impairment and loss of control - if(GetId()==42292 || GetId()==59752 || GetId()==65547) + // immune movement impairment and loss of control (spell data have special structure for mark this case) + if (IsSpellRemoveAllMovementAndControlLossEffects(GetSpellProto())) mechanic=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; - target->RemoveAurasAtMechanicImmunity(mechanic,GetId()); + target->RemoveAurasAtMechanicImmunity(mechanic, GetId()); } target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,misc,apply); @@ -5268,6 +5278,34 @@ void Aura::HandlePeriodicHeal(bool apply, bool /*Real*/) } } +void Aura::HandleDamagePercentTaken(bool apply, bool Real) +{ + m_isPeriodic = apply; + + Unit* target = GetTarget(); + + if (!Real) + return; + + // For prevent double apply bonuses + bool loading = (target->GetTypeId() == TYPEID_PLAYER && ((Player*)target)->GetSession()->PlayerLoading()); + + if (apply) + { + if (loading) + return; + + // Hand of Salvation (only it have this aura and mask) + if (GetSpellProto()->IsFitToFamily(SPELLFAMILY_PALADIN, UI64LIT(0x0000000000000100))) + { + // Glyph of Salvation + if (target->GetObjectGuid() == GetCasterGuid()) + if (Aura* aur = target->GetAura(63225, EFFECT_INDEX_0)) + m_modifier.m_amount -= aur->GetModifier()->m_amount; + } + } +} + void Aura::HandlePeriodicDamage(bool apply, bool Real) { // spells required only Real aura add/remove @@ -6331,21 +6369,13 @@ void Aura::HandleNoReagentUseAura(bool /*Apply*/, bool Real) if(target->GetTypeId() != TYPEID_PLAYER) return; - uint32 mask[3] = {0, 0, 0}; + ClassFamilyMask mask; Unit::AuraList const& noReagent = target->GetAurasByType(SPELL_AURA_NO_REAGENT_USE); - for(Unit::AuraList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i) - { - uint32 const *ptr = (*i)->getAuraSpellClassMask(); - if(!ptr) - continue; - mask[0] |= ptr[0]; - mask[1] |= ptr[1]; - mask[2] |= ptr[2]; - } + for(Unit::AuraList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i) + mask |= (*i)->GetAuraSpellClassMask(); - target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+0, mask[0]); - target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+1, mask[1]); - target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+2, mask[2]); + target->SetUInt64Value(PLAYER_NO_REAGENT_COST_1+0, mask.Flags); + target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+2, mask.Flags2); } /*********************************************************/ @@ -8249,49 +8279,30 @@ void Aura::HandlePhase(bool apply, bool Real) target->RemoveAurasDueToSpell(phases.front()->GetId(), GetHolder()); } + target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL, true); // no-phase is also phase state so same code for apply and remove - - // phase auras normally not expected at BG but anyway better check - if(target->GetTypeId() == TYPEID_PLAYER) + if (GetEffIndex() == EFFECT_INDEX_0 && target->GetTypeId() == TYPEID_PLAYER) { - // drop flag at invisible in bg - if(((Player*)target)->InBattleGround()) - if(BattleGround *bg = ((Player*)target)->GetBattleGround()) - bg->EventPlayerDroppedFlag((Player*)target); - - // GM-mode have mask 0xFFFFFFFF - if(!((Player*)target)->isGameMaster()) - target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL, false); - - ((Player*)target)->GetSession()->SendSetPhaseShift(apply ? GetMiscValue() : PHASEMASK_NORMAL); - - if (GetEffIndex() == EFFECT_INDEX_0) + SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAuraMapBounds(GetId()); + if(saBounds.first != saBounds.second) { - SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAuraMapBounds(GetId()); - if(saBounds.first != saBounds.second) - { - uint32 zone, area; - target->GetZoneAndAreaId(zone, area); + uint32 zone, area; + target->GetZoneAndAreaId(zone, area); - for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) + for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) + { + // some auras remove at aura remove + if(!itr->second->IsFitToRequirements((Player*)target, zone, area)) + target->RemoveAurasDueToSpell(itr->second->spellId); + // some auras applied at aura apply + else if(itr->second->autocast) { - // some auras remove at aura remove - if(!itr->second->IsFitToRequirements((Player*)target, zone, area)) - target->RemoveAurasDueToSpell(itr->second->spellId); - // some auras applied at aura apply - else if(itr->second->autocast) - { - if (!target->HasAura(itr->second->spellId, EFFECT_INDEX_0)) - target->CastSpell(target, itr->second->spellId, true); - } + if (!target->HasAura(itr->second->spellId, EFFECT_INDEX_0)) + target->CastSpell(target, itr->second->spellId, true); } } } } - else - target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL, false); - - target->UpdateVisibilityAndView(); } void Aura::HandleAuraSafeFall( bool Apply, bool Real ) @@ -8346,6 +8357,14 @@ void Aura::HandleAuraModAllCritChance(bool apply, bool Real) ((Player*)target)->UpdateAllSpellCritChances(); } +void Aura::HandleAuraStopNaturalManaRegen(bool apply, bool real) +{ + if (!real) + return; + + GetTarget()->ApplyModFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER, !apply && !GetTarget()->IsUnderLastManaUseEffect()); +} + bool Aura::IsLastAuraOnHolder() { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) @@ -8415,6 +8434,7 @@ m_permanent(false), m_isRemovedOnShapeLost(true), m_deleted(false), m_in_use(0) case 34027: // Kill Command case 55166: // Tidal Force case 58914: // Kill Command (pet part) + case 64455: // Feral Essence case 71564: // Deadly Precision case 74396: // Fingers of Frost m_stackAmount = m_spellProto->GetStackAmount(); @@ -8622,8 +8642,7 @@ void SpellAuraHolder::_RemoveSpellAuraHolder() uint32 removeState = 0; SpellClassOptionsEntry const* classOptions = m_spellProto->GetSpellClassOptions(); - uint64 removeFamilyFlag = classOptions ? classOptions->SpellFamilyFlags : 0; - uint32 removeFamilyFlag2 = classOptions ? classOptions->SpellFamilyFlags2 : 0; + ClassFamilyMask removeFamilyFlag = classOptions ? classOptions->SpellFamilyFlags : ClassFamilyMask(); switch(m_spellProto->GetSpellFamilyName()) { case SPELLFAMILY_PALADIN: @@ -8634,8 +8653,7 @@ void SpellAuraHolder::_RemoveSpellAuraHolder() // Conflagrate aura state on Immolate and Shadowflame, if (m_spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000004), 0x00000002)) { - removeFamilyFlag = UI64LIT(0x0000000000000004); - removeFamilyFlag2 = 0x00000002; + removeFamilyFlag = ClassFamilyMask(UI64LIT(0x0000000000000004), 0x00000002); removeState = AURA_STATE_CONFLAGRATE; } break; @@ -8644,7 +8662,7 @@ void SpellAuraHolder::_RemoveSpellAuraHolder() removeState = AURA_STATE_FAERIE_FIRE; // Faerie Fire (druid versions) else if (m_spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000050))) { - removeFamilyFlag = 0x50; + removeFamilyFlag = ClassFamilyMask(UI64LIT(0x00000000000050)); removeState = AURA_STATE_SWIFTMEND; // Swiftmend aura state } break; @@ -8669,7 +8687,7 @@ void SpellAuraHolder::_RemoveSpellAuraHolder() for (Unit::SpellAuraHolderMap::const_iterator i = holders.begin(); i != holders.end(); ++i) { SpellEntry const *auraSpellInfo = (*i).second->GetSpellProto(); - if (auraSpellInfo->IsFitToFamily(SpellFamily(m_spellProto->GetSpellFamilyName()), removeFamilyFlag, removeFamilyFlag2)) + if (auraSpellInfo->IsFitToFamily(SpellFamily(m_spellProto->GetSpellFamilyName()), removeFamilyFlag)) { found = true; break; @@ -8922,6 +8940,11 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) caster->RemoveAurasDueToSpell(34027); return; } + case 62692: // Aura of Despair + { + spellId1 = 64848; + break; + } case 71905: // Soul Fragment { if (!apply) diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 8e722beb4df..533bd81d5a8 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -302,6 +302,7 @@ class MANGOS_DLL_SPEC Aura void HandleModPowerRegen(bool Apply, bool Real); void HandleModPowerRegenPCT(bool Apply, bool Real); void HandleChannelDeathItem(bool Apply, bool Real); + void HandleDamagePercentTaken(bool Apply, bool Real); void HandlePeriodicDamagePCT(bool Apply, bool Real); void HandleAuraModAttackPower(bool Apply, bool Real); void HandleAuraTransform(bool Apply, bool Real); @@ -370,6 +371,7 @@ class MANGOS_DLL_SPEC Aura void HandleAuraModAllCritChance(bool Apply, bool Real); void HandleAuraOpenStable(bool apply, bool Real); void HandleAuraAddMechanicAbilities(bool apply, bool Real); + void HandleAuraStopNaturalManaRegen(bool apply, bool real); virtual ~Aura(); @@ -440,7 +442,7 @@ class MANGOS_DLL_SPEC Aura void TriggerSpell(); void TriggerSpellWithValue(); - uint32 const *getAuraSpellClassMask() const { return m_spellAuraHolder->GetSpellProto()->GetEffectSpellClassMask(m_effIndex); } + ClassFamilyMask const& GetAuraSpellClassMask() const { return m_spellAuraHolder->GetSpellProto()->GetEffectSpellClassMask(m_effIndex); } bool isAffectedOnSpell(SpellEntry const *spell) const; bool CanProcFrom(SpellEntry const *spell, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 3a09aafe645..5258c3031a4 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -984,6 +984,11 @@ void Spell::EffectDummy(SpellEffectEntry const* effect) m_caster->CastSpell(m_caster, spell_id, true, NULL); return; } + case 17770: // Wolfshead Helm Energy + { + m_caster->CastSpell(m_caster, 29940, true, NULL); + return; + } case 17950: // Shadow Portal { if (!unitTarget) @@ -3347,17 +3352,6 @@ void Spell::EffectTriggerSpell(SpellEffectEntry const* effect) unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT); unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOD_DECREASE_SPEED); unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOD_STALKED); - - // if this spell is given to NPC it must handle rest by it's own AI - if (unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - uint32 spellId = 1784; - // reset cooldown on it if needed - if (((Player*)unitTarget)->HasSpellCooldown(spellId)) - ((Player*)unitTarget)->RemoveSpellCooldown(spellId); - - m_caster->CastSpell(unitTarget, spellId, true); return; } // just skip @@ -5580,7 +5574,6 @@ void Spell::EffectTameCreature(SpellEffectEntry const* /*effect*/) pet->SetCreatorGuid(plr->GetObjectGuid()); pet->setFaction(plr->getFaction()); pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); - pet->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); if (plr->IsPvP()) pet->SetPvP(true); @@ -5721,10 +5714,6 @@ void Spell::EffectSummonPet(SpellEffectEntry const* effect) NewSummon->GetCharmInfo()->SetPetNumber(pet_number, true); // this enables pet details window (Shift+P) - // this enables popup window (pet dismiss, cancel), hunter pet additional flags set later - if(m_caster->GetTypeId() == TYPEID_PLAYER) - NewSummon->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - if(m_caster->IsPvP()) NewSummon->SetPvP(true); @@ -6100,13 +6089,13 @@ void Spell::EffectWeaponDmg(SpellEffectEntry const* effect) m_damage+= uint32(bonus > 0 ? bonus : 0); // Hemorrhage - if (classOptions && classOptions->SpellFamilyName==SPELLFAMILY_ROGUE && (classOptions->SpellFamilyFlags & UI64LIT(0x2000000))) + if (m_spellInfo->IsFitToFamily(SPELLFAMILY_ROGUE, UI64LIT(0x0000000002000000))) { if(m_caster->GetTypeId()==TYPEID_PLAYER) ((Player*)m_caster)->AddComboPoints(unitTarget, 1); } // Mangle (Cat): CP - else if (classOptions && classOptions->SpellFamilyName==SPELLFAMILY_DRUID && (classOptions->SpellFamilyFlags==UI64LIT(0x0000040000000000))) + else if (m_spellInfo->IsFitToFamily(SPELLFAMILY_DRUID, UI64LIT(0x0000040000000000))) { if(m_caster->GetTypeId()==TYPEID_PLAYER) ((Player*)m_caster)->AddComboPoints(unitTarget, 1); @@ -6363,6 +6352,11 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect) return; } + case 24320: // Poisonous Blood + { + unitTarget->CastSpell(unitTarget, 24321, true, NULL, NULL, m_caster->GetObjectGuid()); + return; + } case 24590: // Brittle Armor - need remove one 24575 Brittle Armor aura unitTarget->RemoveAuraHolderFromStack(24575); return; @@ -6914,7 +6908,18 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect) // Torture the Torturer: High Executor's Branding Iron Impact unitTarget->CastSpell(unitTarget, 48614, true); return; + case 48724: // The Denouncement: Commander Jordan On Death + case 48726: // The Denouncement: Lead Cannoneer Zierhut On Death + case 48728: // The Denouncement: Blacksmith Goodman On Death + case 48730: // The Denouncement: Stable Master Mercer On Death + { + // Compelled + if (!unitTarget || !m_caster->HasAura(48714)) + return; + unitTarget->CastSpell(unitTarget, effect->CalculateSimpleValue(), true); + return; + } // Gender spells case 48762: // A Fall from Grace: Scarlet Raven Priest Image - Master case 45759: // Warsong Orc Disguise @@ -7322,6 +7327,10 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect) unitTarget->CastSpell(unitTarget, 66747, true); return; } + case 68861: // Consume Soul (ICC FoS: Bronjahm) + if (unitTarget) + unitTarget->CastSpell(unitTarget, effect->CalculateSimpleValue(), true); + return; case 69377: // Fortitude { if (!unitTarget) @@ -7346,6 +7355,13 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect) m_caster->CastSpell(unitTarget, 72588, true); return; } + case 72034: // Whiteout + case 72096: // Whiteout (heroic) + { + // cast Whiteout visual + m_caster->CastSpell(unitTarget, 72036, true); + return; + } } break; } @@ -7515,8 +7531,7 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect) // Search only Serpent Sting, Viper Sting, Scorpid Sting auras SpellClassOptionsEntry const* stingClassOptions = holder->GetSpellProto()->GetSpellClassOptions(); - uint64 familyFlag = stingClassOptions ? stingClassOptions->SpellFamilyFlags : 0; - if (!(familyFlag & UI64LIT(0x000000800000C000))) + if (!stingClassOptions || !stingClassOptions->SpellFamilyFlags.IsFitToFamilyMask(UI64LIT(0x000000800000C000))) continue; // Refresh aura duration @@ -7528,7 +7543,7 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect) continue; // Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting. - if ((familyFlag & UI64LIT(0x0000000000004000))) + if (stingClassOptions->IsFitToFamilyMask(UI64LIT(0x0000000000004000))) { // m_amount already include RAP bonus basePoint = aura->GetModifier()->m_amount * aura->GetAuraMaxTicks() * 40 / 100; @@ -7536,7 +7551,7 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect) } // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting. - if ((familyFlag & UI64LIT(0x0000008000000000))) + if (stingClassOptions->IsFitToFamilyMask(UI64LIT(0x0000008000000000))) { uint32 target_max_mana = unitTarget->GetMaxPower(POWER_MANA); if (!target_max_mana) @@ -7559,7 +7574,7 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect) } // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute. - if (familyFlag & UI64LIT(0x0000000000008000)) + if (stingClassOptions->IsFitToFamilyMask(UI64LIT(0x0000000000008000))) spellId = 53359; // Chimera Shot - Scorpid // ?? nothing say in spell desc (possibly need addition check) //if ((familyFlag & UI64LIT(0x0000010000000000)) || // dot @@ -7764,12 +7779,10 @@ void Spell::EffectSanctuary(SpellEffectEntry const* /*effect*/) unitTarget->CombatStop(); unitTarget->getHostileRefManager().deleteReferences(); // stop all fighting + // Vanish allows to remove all threat and cast regular stealth so other spells can be used - SpellClassOptionsEntry const* vClassOptions = m_spellInfo->GetSpellClassOptions(); - if(vClassOptions && vClassOptions->SpellFamilyName == SPELLFAMILY_ROGUE && (vClassOptions->SpellFamilyFlags & SPELLFAMILYFLAG_ROGUE_VANISH)) - { + if (m_spellInfo->IsFitToFamily(SPELLFAMILY_ROGUE, UI64LIT(0x0000000000000800))) ((Player *)m_caster)->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT); - } } void Spell::EffectAddComboPoints(SpellEffectEntry const* effect /*effect*/) @@ -7795,27 +7808,19 @@ void Spell::EffectDuel(SpellEffectEntry const* effect) Player *target = (Player*)unitTarget; // caster or target already have requested duel - if( caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetObjectGuid()) ) + if (caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetObjectGuid())) return; // Players can only fight a duel with each other outside (=not inside dungeons and not in capital cities) - // Don't have to check the target's map since you cannot challenge someone across maps - uint32 mapid = caster->GetMapId(); - if( mapid != 0 && mapid != 1 && mapid != 530 && mapid != 571 && mapid != 609) - { - SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here - return; - } - - AreaTableEntry const* casterAreaEntry = GetAreaEntryByAreaID(caster->GetZoneId()); - if(casterAreaEntry && (casterAreaEntry->flags & AREA_FLAG_CAPITAL) ) + AreaTableEntry const* casterAreaEntry = GetAreaEntryByAreaID(caster->GetAreaId()); + if (casterAreaEntry && !(casterAreaEntry->flags & AREA_FLAG_DUEL)) { SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here return; } - AreaTableEntry const* targetAreaEntry = GetAreaEntryByAreaID(target->GetZoneId()); - if(targetAreaEntry && (targetAreaEntry->flags & AREA_FLAG_CAPITAL) ) + AreaTableEntry const* targetAreaEntry = GetAreaEntryByAreaID(target->GetAreaId()); + if (targetAreaEntry && !(targetAreaEntry->flags & AREA_FLAG_DUEL)) { SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here return; diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 5b6a5b15ea6..f3446fa3d0d 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -290,6 +290,13 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data ) if(!obj) return; + // Additional check preventing exploits (ie loot despawned chests) + if (!obj->isSpawned()) + { + sLog.outError("HandleGameObjectUseOpcode: CMSG_GAMEOBJ_USE for despawned GameObject (Entry %u), didn't expect this to happen.", obj->GetEntry()); + return; + } + // Never expect this opcode for some type GO's if (obj->GetGoType() == GAMEOBJECT_TYPE_GENERIC) { @@ -297,6 +304,13 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data ) return; } + // Never expect this opcode for non intractable GO's + if (obj->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_NO_INTERACT)) + { + sLog.outError("HandleGameObjectUseOpcode: CMSG_GAMEOBJ_USE for GameObject (Entry %u) with non intractable flag (Flags %u), didn't expect this to happen.", obj->GetEntry(), obj->GetUInt32Value(GAMEOBJECT_FLAGS)); + return; + } + obj->Use(_player); } diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 2c834ab6e0e..43e4b7410b6 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -752,8 +752,9 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) return false; break; case SPELL_AURA_MOD_DAMAGE_TAKEN: // dependent from bas point sign (positive -> negative) - if (spellEffect->CalculateSimpleValue() > 0) - return false; + if (spellEffect->CalculateSimpleValue() < 0) + return true; + // let check by target modes (for Amplify Magic cases/etc) break; case SPELL_AURA_MOD_SPELL_CRIT_CHANCE: case SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT: @@ -779,7 +780,8 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) continue; // if non-positive trigger cast targeted to positive target this main cast is non-positive // this will place this spell auras as debuffs - if (IsPositiveTarget(triggerSpellEffect->EffectImplicitTargetA,triggerSpellEffect->EffectImplicitTargetB) && + if (triggerSpellEffect->Effect && + IsPositiveTarget(triggerSpellEffect->EffectImplicitTargetA,triggerSpellEffect->EffectImplicitTargetB) && !IsPositiveEffect(spellTriggeredProto, SpellEffectIndex(i))) return false; } @@ -880,9 +882,17 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) } } break; case SPELL_AURA_FORCE_REACTION: - if(spellproto->Id==42792) // Recently Dropped Flag (prevent cancel) - return false; + { + switch (spellproto->Id) + { + case 42792: // Recently Dropped Flag (prevent cancel) + case 46221: // Animal Blood + return false; + default: + break; + } break; + } default: break; } @@ -1029,7 +1039,7 @@ void SpellMgr::LoadSpellTargetPositions() QueryResult *result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); @@ -1038,7 +1048,7 @@ void SpellMgr::LoadSpellTargetPositions() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -1197,13 +1207,7 @@ struct DoSpellProcEvent { if (spe.spellFamilyMask[i] != r_spe.spellFamilyMask[i]) { - sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different spellFamilyMask from first rank in chain", spell_id); - break; - } - - if (spe.spellFamilyMask2[i] != r_spe.spellFamilyMask2[i]) - { - sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different spellFamilyMask2 from first rank in chain", spell_id); + sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different spellFamilyMask/spellFamilyMask2 from first rank in chain", spell_id); break; } } @@ -1277,13 +1281,11 @@ struct DoSpellProcEvent bool empty = !spe.spellFamilyName ? true : false; for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) { - if (spe.spellFamilyMask[i] || spe.spellFamilyMask2[i]) + if (spe.spellFamilyMask[i]) { empty = false; - uint32 const* ptr = spell->GetEffectSpellClassMask(SpellEffectIndex(i)); - if(!ptr) - continue; - if ((((uint64*)ptr)[0] != 0 && spe.spellFamilyMask[i] == ((uint64*)ptr)[0]) && (ptr[2] == 0 || spe.spellFamilyMask2[i] == ptr[2])) + ClassFamilyMask const& mask = spell->GetEffectSpellClassMask(SpellEffectIndex(i)); + if (mask == spe.spellFamilyMask[i]) sLog.outErrorDb("Spell %u listed in `spell_proc_event` has same class mask as in Spell.dbc (EffectIndex %u) and doesn't have any other data", spell->Id, i); } } @@ -1312,18 +1314,18 @@ void SpellMgr::LoadSpellProcEvents() // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 QueryResult *result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMaskA0, SpellFamilyMaskA1, SpellFamilyMaskA2, SpellFamilyMaskB0, SpellFamilyMaskB1, SpellFamilyMaskB2, SpellFamilyMaskC0, SpellFamilyMaskC1, SpellFamilyMaskC2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> No spell proc event conditions loaded"); + sLog.outString(">> No spell proc event conditions loaded"); return; } SpellRankHelper rankHelper(*this, mSpellProcEventMap); - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -1339,8 +1341,9 @@ void SpellMgr::LoadSpellProcEvents() for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) { - spe.spellFamilyMask[i] = (uint64)fields[i+3].GetUInt32()|((uint64)fields[i+6].GetUInt32()<<32); - spe.spellFamilyMask2[i] = fields[i+9].GetUInt32(); + spe.spellFamilyMask[i] = ClassFamilyMask( + (uint64)fields[i+3].GetUInt32() | ((uint64)fields[i+6].GetUInt32()<<32), + fields[i+9].GetUInt32()); } spe.procFlags = fields[12].GetUInt32(); spe.procEx = fields[13].GetUInt32(); @@ -1377,19 +1380,19 @@ void SpellMgr::LoadSpellProcItemEnchant() // 0 1 QueryResult *result = WorldDatabase.Query("SELECT entry, ppmRate FROM spell_proc_item_enchant"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u proc item enchant definitions", count ); + sLog.outString(">> Loaded %u proc item enchant definitions", count); return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -1447,16 +1450,16 @@ void SpellMgr::LoadSpellBonuses() uint32 count = 0; // 0 1 2 3 QueryResult *result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u spell bonus data", count); + sLog.outString(">> Loaded %u spell bonus data", count); return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -1677,19 +1680,19 @@ void SpellMgr::LoadSpellElixirs() // 0 1 QueryResult *result = WorldDatabase.Query("SELECT entry, mask FROM spell_elixir"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u spell elixir definitions", count ); + sLog.outString(">> Loaded %u spell elixir definitions", count); return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -1780,18 +1783,18 @@ void SpellMgr::LoadSpellThreats() // 0 1 2 3 QueryResult *result = WorldDatabase.Query("SELECT entry, Threat, multiplier, ap_bonus FROM spell_threat"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> No spell threat entries loaded."); + sLog.outString(">> No spell threat entries loaded."); return; } SpellRankHelper rankHelper(*this, mSpellThreatMap); - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -1880,22 +1883,14 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1); SpellEntry const *spellInfo_2 = sSpellStore.LookupEntry(spellId_2); - if(!spellInfo_1 || !spellInfo_2) - return false; - - if(spellId_1 == spellId_2) + if (!spellInfo_1 || !spellInfo_2) return false; SpellClassOptionsEntry const* classOptions1 = spellInfo_1->GetSpellClassOptions(); SpellClassOptionsEntry const* classOptions2 = spellInfo_2->GetSpellClassOptions(); - //I think we don't check this correctly because i need a exception for spell: - //72,11327,18461...(called from 1856,1857...) Call Aura 16,31, after trigger another spell who call aura 77 and 77 remove 16 and 31, this should not happen. - if(classOptions2 && classOptions2->SpellFamilyFlags == 2048) - return false; - // Resurrection sickness - if((spellInfo_1->Id == SPELL_ID_PASSIVE_RESURRECTION_SICKNESS) != (spellInfo_2->Id==SPELL_ID_PASSIVE_RESURRECTION_SICKNESS)) + if ((spellInfo_1->Id == SPELL_ID_PASSIVE_RESURRECTION_SICKNESS) != (spellInfo_2->Id==SPELL_ID_PASSIVE_RESURRECTION_SICKNESS)) return false; // Allow stack passive and not passive spells @@ -1964,6 +1959,11 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons (spellInfo_2->Id == 8326 && spellInfo_1->Id == 20584)) return false; + // Aura of Despair auras + if ((spellInfo_1->Id == 64848 && spellInfo_2->Id == 62692) || + (spellInfo_2->Id == 64848 && spellInfo_1->Id == 62692)) + return false; + // Blood Fury and Rage of the Unraveller if (spellInfo_1->SpellIconID == 1662 && spellInfo_2->SpellIconID == 1662) return false; @@ -2306,8 +2306,8 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return true; // Swift Retribution / Improved Devotion Aura (talents) and Paladin Auras - if (classOptions1 && (classOptions1->SpellFamilyFlags2 & 0x00000020) && (spellInfo_2->SpellIconID == 291 || spellInfo_2->SpellIconID == 3028) || - (classOptions2->SpellFamilyFlags2 & 0x00000020) && (spellInfo_1->SpellIconID == 291 || spellInfo_1->SpellIconID == 3028)) + if ((spellInfo_1->IsFitToFamilyMask(UI64LIT(0x0), 0x00000020) && (spellInfo_2->SpellIconID == 291 || spellInfo_2->SpellIconID == 3028)) || + (spellInfo_2->IsFitToFamilyMask(UI64LIT(0x0), 0x00000020) && (spellInfo_1->SpellIconID == 291 || spellInfo_1->SpellIconID == 3028))) return false; // Beacon of Light and Light's Beacon @@ -2353,7 +2353,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons { // Windfury weapon if (spellInfo_1->SpellIconID==220 && spellInfo_2->SpellIconID==220 && - classOptions1 && classOptions1->SpellFamilyFlags != classOptions2->SpellFamilyFlags ) + !classOptions1->IsFitToFamilyMask(classOptions2->SpellFamilyFlags)) return false; // Ghost Wolf @@ -2488,6 +2488,42 @@ bool SpellMgr::IsPrimaryProfessionSpell(uint32 spellId) return IsPrimaryProfessionSkill(skill); } +uint32 SpellMgr::GetProfessionSpellMinLevel(uint32 spellId) +{ + uint32 s2l[8][3] = + { // 0 - gather 1 - non-gather 2 - fish + /*0*/ { 0, 5, 5 }, + /*1*/ { 0, 5, 5 }, + /*2*/ { 0, 10, 10 }, + /*3*/ { 10, 20, 10 }, + /*4*/ { 25, 35, 10 }, + /*5*/ { 40, 50, 10 }, + /*6*/ { 55, 65, 10 }, + /*7*/ { 75, 75, 10 }, + }; + + uint32 rank = GetSpellRank(spellId); + if (rank >= 8) + return 0; + + SkillLineAbilityMapBounds bounds = GetSkillLineAbilityMapBounds(spellId); + if (bounds.first == bounds.second) + return 0; + + switch (bounds.first->second->skillId) + { + case SKILL_FISHING: + return s2l[rank][2]; + case SKILL_HERBALISM: + case SKILL_MINING: + case SKILL_SKINNING: + return s2l[rank][0]; + default: + return s2l[rank][1]; + } +} + + bool SpellMgr::IsPrimaryProfessionFirstRankSpell(uint32 spellId) const { return IsPrimaryProfessionSpell(spellId) && GetSpellRank(spellId)==1; @@ -2745,11 +2781,11 @@ void SpellMgr::LoadSpellChains() QueryResult *result = WorldDatabase.Query("SELECT spell_id, prev_spell, first_spell, rank, req_spell FROM spell_chain"); if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded 0 spell chain records" ); + sLog.outString(">> Loaded 0 spell chain records"); sLog.outErrorDb("`spell_chains` table is empty!"); return; } @@ -2758,7 +2794,7 @@ void SpellMgr::LoadSpellChains() uint32 new_count = 0; uint32 req_count = 0; - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { bar.step(); @@ -3002,26 +3038,26 @@ void SpellMgr::LoadSpellLearnSkills() // search auto-learned skills and add its to map also for use in unlearn spells/talents uint32 dbc_count = 0; - barGoLink bar( sSpellStore.GetNumRows() ); - for(uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell) + BarGoLink bar(sSpellStore.GetNumRows()); + for (uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell) { bar.step(); SpellEntry const* entry = sSpellStore.LookupEntry(spell); - if(!entry) + if (!entry) continue; - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { SpellEffectEntry const* spellEffect = entry->GetSpellEffect(SpellEffectIndex(i)); - if(!spellEffect) + if (!spellEffect) continue; - if(spellEffect->Effect == SPELL_EFFECT_SKILL) + if (spellEffect->Effect == SPELL_EFFECT_SKILL) { SpellLearnSkillNode dbc_node; dbc_node.skill = spellEffect->EffectMiscValue; dbc_node.step = entry->CalculateSimpleValue(SpellEffectIndex(i)); - if ( dbc_node.skill != SKILL_RIDING ) + if (dbc_node.skill != SKILL_RIDING) dbc_node.value = 1; else dbc_node.value = dbc_node.step * 75; @@ -3035,7 +3071,7 @@ void SpellMgr::LoadSpellLearnSkills() } sLog.outString(); - sLog.outString( ">> Loaded %u Spell Learn Skills from DBC", dbc_count ); + sLog.outString(">> Loaded %u Spell Learn Skills from DBC", dbc_count); } void SpellMgr::LoadSpellLearnSpells() @@ -3046,18 +3082,18 @@ void SpellMgr::LoadSpellLearnSpells() QueryResult *result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell"); if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded 0 spell learn spells" ); + sLog.outString(">> Loaded 0 spell learn spells"); sLog.outErrorDb("`spell_learn_spell` table is empty!"); return; } uint32 count = 0; - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { bar.step(); @@ -3091,7 +3127,7 @@ void SpellMgr::LoadSpellLearnSpells() mSpellLearnSpells.insert(SpellLearnSpellMap::value_type(spell_id,node)); ++count; - } while( result->NextRow() ); + } while (result->NextRow()); delete result; @@ -3161,7 +3197,7 @@ void SpellMgr::LoadSpellScriptTarget() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); @@ -3170,7 +3206,7 @@ void SpellMgr::LoadSpellScriptTarget() return; } - barGoLink bar((int)result->GetRowCount()); + BarGoLink bar(result->GetRowCount()); do { @@ -3305,19 +3341,19 @@ void SpellMgr::LoadSpellPetAuras() // 0 1 2 3 QueryResult *result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u spell pet auras", count ); + sLog.outString(">> Loaded %u spell pet auras", count); return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -3661,18 +3697,18 @@ void SpellMgr::LoadSpellAreas() // 0 1 2 3 4 5 6 7 8 QueryResult *result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_active, quest_end, aura_spell, racemask, gender, autocast FROM spell_area"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u spell area requirements", count ); + sLog.outString(">> Loaded %u spell area requirements", count); return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -3692,7 +3728,7 @@ void SpellMgr::LoadSpellAreas() spellArea.gender = Gender(fields[7].GetUInt8()); spellArea.autocast = fields[8].GetBool(); - if(!sSpellStore.LookupEntry(spell)) + if (!sSpellStore.LookupEntry(spell)) { sLog.outErrorDb("Spell %u listed in `spell_area` does not exist", spell); continue; @@ -3701,7 +3737,7 @@ void SpellMgr::LoadSpellAreas() { bool ok = true; SpellAreaMapBounds sa_bounds = GetSpellAreaMapBounds(spellArea.spellId); - for(SpellAreaMap::const_iterator itr = sa_bounds.first; itr != sa_bounds.second; ++itr) + for (SpellAreaMap::const_iterator itr = sa_bounds.first; itr != sa_bounds.second; ++itr) { if (spellArea.spellId != itr->second.spellId) continue; @@ -3721,7 +3757,7 @@ void SpellMgr::LoadSpellAreas() break; } - if(!ok) + if (!ok) { sLog.outErrorDb("Spell %u listed in `spell_area` already listed with similar requirements.", spell); continue; @@ -3729,47 +3765,47 @@ void SpellMgr::LoadSpellAreas() } - if(spellArea.areaId && !GetAreaEntryByAreaID(spellArea.areaId)) + if (spellArea.areaId && !GetAreaEntryByAreaID(spellArea.areaId)) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong area (%u) requirement", spell,spellArea.areaId); continue; } - if(spellArea.questStart && !sObjectMgr.GetQuestTemplate(spellArea.questStart)) + if (spellArea.questStart && !sObjectMgr.GetQuestTemplate(spellArea.questStart)) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell,spellArea.questStart); continue; } - if(spellArea.questEnd) + if (spellArea.questEnd) { - if(!sObjectMgr.GetQuestTemplate(spellArea.questEnd)) + if (!sObjectMgr.GetQuestTemplate(spellArea.questEnd)) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell,spellArea.questEnd); continue; } - if(spellArea.questEnd==spellArea.questStart && !spellArea.questStartCanActive) + if (spellArea.questEnd==spellArea.questStart && !spellArea.questStartCanActive) { sLog.outErrorDb("Spell %u listed in `spell_area` have quest (%u) requirement for start and end in same time", spell,spellArea.questEnd); continue; } } - if(spellArea.auraSpell) + if (spellArea.auraSpell) { SpellEntry const* spellInfo = sSpellStore.LookupEntry(abs(spellArea.auraSpell)); - if(!spellInfo) + if (!spellInfo) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell,abs(spellArea.auraSpell)); continue; } SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(EFFECT_INDEX_0); - if(!spellEffect) + if (!spellEffect) continue; - switch(spellEffect->EffectApplyAuraName) + switch (spellEffect->EffectApplyAuraName) { case SPELL_AURA_DUMMY: case SPELL_AURA_PHASE: @@ -3780,7 +3816,7 @@ void SpellMgr::LoadSpellAreas() continue; } - if(uint32(abs(spellArea.auraSpell))==spellArea.spellId) + if (uint32(abs(spellArea.auraSpell))==spellArea.spellId) { sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell)); continue; @@ -3791,7 +3827,7 @@ void SpellMgr::LoadSpellAreas() { bool chain = false; SpellAreaForAuraMapBounds saBound = GetSpellAreaForAuraMapBounds(spellArea.spellId); - for(SpellAreaForAuraMap::const_iterator itr = saBound.first; itr != saBound.second; ++itr) + for (SpellAreaForAuraMap::const_iterator itr = saBound.first; itr != saBound.second; ++itr) { if (itr->second->autocast && itr->second->auraSpell > 0) { @@ -3807,7 +3843,7 @@ void SpellMgr::LoadSpellAreas() } SpellAreaMapBounds saBound2 = GetSpellAreaMapBounds(spellArea.auraSpell); - for(SpellAreaMap::const_iterator itr2 = saBound2.first; itr2 != saBound2.second; ++itr2) + for (SpellAreaMap::const_iterator itr2 = saBound2.first; itr2 != saBound2.second; ++itr2) { if (itr2->second.autocast && itr2->second.auraSpell > 0) { @@ -3816,7 +3852,7 @@ void SpellMgr::LoadSpellAreas() } } - if(chain) + if (chain) { sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell,spellArea.auraSpell); continue; @@ -3824,13 +3860,13 @@ void SpellMgr::LoadSpellAreas() } } - if(spellArea.raceMask && (spellArea.raceMask & RACEMASK_ALL_PLAYABLE)==0) + if (spellArea.raceMask && (spellArea.raceMask & RACEMASK_ALL_PLAYABLE)==0) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell,spellArea.raceMask); continue; } - if(spellArea.gender!=GENDER_NONE && spellArea.gender!=GENDER_FEMALE && spellArea.gender!=GENDER_MALE) + if (spellArea.gender!=GENDER_NONE && spellArea.gender!=GENDER_FEMALE && spellArea.gender!=GENDER_MALE) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell,spellArea.gender); continue; @@ -3839,33 +3875,33 @@ void SpellMgr::LoadSpellAreas() SpellArea const* sa = &mSpellAreaMap.insert(SpellAreaMap::value_type(spell,spellArea))->second; // for search by current zone/subzone at zone/subzone change - if(spellArea.areaId) + if (spellArea.areaId) mSpellAreaForAreaMap.insert(SpellAreaForAreaMap::value_type(spellArea.areaId,sa)); // for search at quest start/reward - if(spellArea.questStart) + if (spellArea.questStart) { - if(spellArea.questStartCanActive) + if (spellArea.questStartCanActive) mSpellAreaForActiveQuestMap.insert(SpellAreaForQuestMap::value_type(spellArea.questStart,sa)); else mSpellAreaForQuestMap.insert(SpellAreaForQuestMap::value_type(spellArea.questStart,sa)); } // for search at quest start/reward - if(spellArea.questEnd) + if (spellArea.questEnd) mSpellAreaForQuestEndMap.insert(SpellAreaForQuestMap::value_type(spellArea.questEnd,sa)); // for search at aura apply - if(spellArea.auraSpell) + if (spellArea.auraSpell) mSpellAreaForAuraMap.insert(SpellAreaForAuraMap::value_type(abs(spellArea.auraSpell),sa)); ++count; - } while( result->NextRow() ); + } while (result->NextRow()); delete result; sLog.outString(); - sLog.outString( ">> Loaded %u spell area requirements", count ); + sLog.outString(">> Loaded %u spell area requirements", count); } SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player) @@ -4002,7 +4038,7 @@ void SpellMgr::LoadSkillLineAbilityMap() { mSkillLineAbilityMap.clear(); - barGoLink bar( (int)sSkillLineAbilityStore.GetNumRows() ); + BarGoLink bar(sSkillLineAbilityStore.GetNumRows()); uint32 count = 0; for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i) @@ -4020,6 +4056,33 @@ void SpellMgr::LoadSkillLineAbilityMap() sLog.outString(">> Loaded %u SkillLineAbility MultiMap Data", count); } +void SpellMgr::LoadSkillRaceClassInfoMap() +{ + mSkillRaceClassInfoMap.clear(); + + BarGoLink bar(sSkillRaceClassInfoStore.GetNumRows()); + uint32 count = 0; + + for (uint32 i = 0; i < sSkillRaceClassInfoStore.GetNumRows(); ++i) + { + bar.step(); + SkillRaceClassInfoEntry const *skillRCInfo = sSkillRaceClassInfoStore.LookupEntry(i); + if (!skillRCInfo) + continue; + + // not all skills really listed in ability skills list + if (!sSkillLineStore.LookupEntry(skillRCInfo->skillId)) + continue; + + mSkillRaceClassInfoMap.insert(SkillRaceClassInfoMap::value_type(skillRCInfo->skillId,skillRCInfo)); + + ++count; + } + + sLog.outString(); + sLog.outString(">> Loaded %u SkillRaceClassInfo MultiMap Data", count); +} + void SpellMgr::CheckUsedSpells(char const* table) { uint32 countSpells = 0; @@ -4028,9 +4091,9 @@ void SpellMgr::CheckUsedSpells(char const* table) // 0 1 2 3 4 5 6 7 8 9 10 11 QueryResult *result = WorldDatabase.PQuery("SELECT spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMaskB,SpellIcon,SpellVisual,SpellCategory,EffectType,EffectAura,EffectIdx,Name,Code FROM %s",table); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); @@ -4039,7 +4102,7 @@ void SpellMgr::CheckUsedSpells(char const* table) return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { @@ -4132,7 +4195,7 @@ void SpellMgr::CheckUsedSpells(char const* table) { if(familyMaskA == UI64LIT(0x0000000000000000) && familyMaskB == 0x00000000) { - if(classOptions && (classOptions->SpellFamilyFlags != 0 || classOptions->SpellFamilyFlags2 != 0)) + if (classOptions && classOptions->SpellFamilyFlags) { sLog.outError("Spell %u '%s' not fit to (" I64FMT "," I32FMT ") but used in %s.", spell, name.c_str(), familyMaskA, familyMaskB, code.c_str()); @@ -4141,7 +4204,7 @@ void SpellMgr::CheckUsedSpells(char const* table) } else { - if(classOptions && (classOptions->SpellFamilyFlags & familyMaskA)==0 && (classOptions->SpellFamilyFlags2 & familyMaskB)==0) + if (!spellEntry->IsFitToFamilyMask(familyMaskA, familyMaskB)) { sLog.outError("Spell %u '%s' not fit to (" I64FMT "," I32FMT ") but used in %s.",spell,name.c_str(),familyMaskA,familyMaskB,code.c_str()); continue; @@ -4218,12 +4281,12 @@ void SpellMgr::CheckUsedSpells(char const* table) { if(familyMaskA == UI64LIT(0x0000000000000000) && familyMaskB == 0x00000000) { - if(classOptions && (classOptions->SpellFamilyFlags != 0 || classOptions->SpellFamilyFlags2 != 0)) + if (classOptions && classOptions->SpellFamilyFlags) continue; } else { - if(classOptions && (classOptions->SpellFamilyFlags & familyMaskA)==0 && (classOptions->SpellFamilyFlags2 & familyMaskB)==0) + if (!spellEntry->IsFitToFamilyMask(familyMaskA, familyMaskB)) continue; } } @@ -4528,16 +4591,18 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 return true; } -SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty) +SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty, bool isRaid) { SpellDifficultyEntry const* spellDiff = sSpellDifficultyStore.LookupEntry(id); if (!spellDiff) return NULL; - if (!spellDiff->spellId[difficulty]) - return NULL; + for (Difficulty diff = difficulty; diff >= REGULAR_DIFFICULTY; diff = GetPrevDifficulty(diff, isRaid)) + { + if (spellDiff->spellId[diff]) + return sSpellStore.LookupEntry(spellDiff->spellId[difficulty]); + } - SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellDiff->spellId[difficulty]); - return spellEntry; + return NULL; } diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index c6eb083f144..e5ca0b2ba62 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -47,17 +47,6 @@ enum SpellCategories SPELLCATEGORY_JUDGEMENT = 1210, // Judgement (seal trigger) }; -//Some SpellFamilyFlags -#define SPELLFAMILYFLAG_ROGUE_VANISH UI64LIT(0x0000000000000800) -#define SPELLFAMILYFLAG_ROGUE_STEALTH UI64LIT(0x0000000000400000) -#define SPELLFAMILYFLAG_ROGUE_BACKSTAB UI64LIT(0x0000000000800004) -#define SPELLFAMILYFLAG_ROGUE_SAP UI64LIT(0x0000000000000080) -#define SPELLFAMILYFLAG_ROGUE_FEINT UI64LIT(0x0000000008000000) -#define SPELLFAMILYFLAG_ROGUE_KIDNEYSHOT UI64LIT(0x0000000000200000) -#define SPELLFAMILYFLAG_ROGUE__FINISHING_MOVE UI64LIT(0x00000009003E0000) - -#define SPELLFAMILYFLAG_PALADIN_SEALS UI64LIT(0x26000C000A000000) - // Spell clasification enum SpellSpecific { @@ -199,11 +188,9 @@ bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 spellId_2); inline bool IsSealSpell(SpellEntry const *spellInfo) { - SpellClassOptionsEntry const* classOptions = spellInfo->GetSpellClassOptions(); SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(EFFECT_INDEX_0); //Collection of all the seal family flags. No other paladin spell has any of those. - return classOptions && classOptions->SpellFamilyName == SPELLFAMILY_PALADIN && - ( classOptions->SpellFamilyFlags & SPELLFAMILYFLAG_PALADIN_SEALS ) && + return spellInfo->IsFitToFamily(SPELLFAMILY_PALADIN, UI64LIT(0x26000C000A000000)) && // avoid counting target triggered effect as seal for avoid remove it or seal by it. spellEffect && spellEffect->EffectImplicitTargetA == TARGET_SELF; } @@ -253,6 +240,20 @@ inline bool IsPassiveSpellStackableWithRanks(SpellEntry const* spellProto) return !IsSpellHaveEffect(spellProto,SPELL_EFFECT_APPLY_AURA); } +inline bool IsSpellRemoveAllMovementAndControlLossEffects(SpellEntry const* spellProto) +{ + SpellEffectEntry const* spellEffect0 = spellProto->GetSpellEffect(EFFECT_INDEX_0); + + return spellEffect0 && spellEffect0->EffectApplyAuraName == SPELL_AURA_MECHANIC_IMMUNITY && + spellEffect0->EffectMiscValue == 1 && + spellEffect0->EffectApplyAuraName == 0 && + spellEffect0->EffectApplyAuraName == 0 && + (spellProto->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)/* && -- all above selected spells have SPELL_ATTR_EX5_* mask + ((spellProto->AttributesEx5 & + (SPELL_ATTR_EX5_USABLE_WHILE_CONFUSED|SPELL_ATTR_EX5_USABLE_WHILE_FEARED|SPELL_ATTR_EX5_USABLE_WHILE_STUNNED)) == + (SPELL_ATTR_EX5_USABLE_WHILE_CONFUSED|SPELL_ATTR_EX5_USABLE_WHILE_FEARED|SPELL_ATTR_EX5_USABLE_WHILE_STUNNED))*/; +} + inline bool IsDeathOnlySpell(SpellEntry const *spellInfo) { return spellInfo->AttributesEx3 & SPELL_ATTR_EX3_CAST_ON_DEAD @@ -578,7 +579,7 @@ bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group); DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group); int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry const* spellproto); -SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty); +SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty, bool isRaid); // Spell proc event related declarations (accessed using SpellMgr functions) enum ProcFlags @@ -665,8 +666,7 @@ struct SpellProcEventEntry { uint32 schoolMask; // if nonzero - bit mask for matching proc condition based on spell candidate's school: Fire=2, Mask=1<<(2-1)=2 uint32 spellFamilyName; // if nonzero - for matching proc condition based on candidate spell's SpellFamilyNamer value - uint64 spellFamilyMask[MAX_EFFECT_INDEX]; // if nonzero - for matching proc condition based on candidate spell's SpellFamilyFlags (like auras 107 and 108 do) - uint32 spellFamilyMask2[MAX_EFFECT_INDEX]; // if nonzero - for matching proc condition based on candidate spell's SpellFamilyFlags2 (like auras 107 and 108 do) + ClassFamilyMask spellFamilyMask[MAX_EFFECT_INDEX]; // if nonzero - for matching proc condition based on candidate spell's SpellFamilyFlags (like auras 107 and 108 do) uint32 procFlags; // bitmask for matching proc event uint32 procEx; // proc Extend info (see ProcFlagsEx) float ppmRate; // for melee (ranged?) damage spells - proc rate per minute. if zero, falls back to flat chance from Spell.dbc @@ -849,6 +849,9 @@ typedef std::pair SkillLineAbilityMap; typedef std::pair SkillLineAbilityMapBounds; +typedef std::multimap SkillRaceClassInfoMap; +typedef std::pair SkillRaceClassInfoMapBounds; + typedef std::multimap PetLevelupSpellSet; typedef std::map PetLevelupSpellMap; @@ -1094,6 +1097,7 @@ class SpellMgr static bool IsProfessionSpell(uint32 spellId); static bool IsPrimaryProfessionSpell(uint32 spellId); bool IsPrimaryProfessionFirstRankSpell(uint32 spellId) const; + uint32 GetProfessionSpellMinLevel(uint32 spellId); bool IsSkillBonusSpell(uint32 spellId) const; @@ -1112,6 +1116,11 @@ class SpellMgr return mSkillLineAbilityMap.equal_range(spell_id); } + SkillRaceClassInfoMapBounds GetSkillRaceClassInfoMapBounds(uint32 skill_id) const + { + return mSkillRaceClassInfoMap.equal_range(skill_id); + } + PetAura const* GetPetAura(uint32 spell_id, SpellEffectIndex eff) { SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find((spell_id<<8) + eff); @@ -1187,6 +1196,7 @@ class SpellMgr void LoadSpellTargetPositions(); void LoadSpellThreats(); void LoadSkillLineAbilityMap(); + void LoadSkillRaceClassInfoMap(); void LoadSpellPetAuras(); void LoadPetLevelupSpellMap(); void LoadPetDefaultSpells(); @@ -1207,6 +1217,7 @@ class SpellMgr SpellProcItemEnchantMap mSpellProcItemEnchantMap; SpellBonusMap mSpellBonusMap; SkillLineAbilityMap mSkillLineAbilityMap; + SkillRaceClassInfoMap mSkillRaceClassInfoMap; SpellPetAuraMap mSpellPetAuraMap; PetLevelupSpellMap mPetLevelupSpellMap; PetDefaultSpellsMap mPetDefaultSpellsMap; // only spells not listed in related mPetLevelupSpellMap entry diff --git a/src/game/TemporarySummon.h b/src/game/TemporarySummon.h index 0dd0a56b495..da6a95266f5 100644 --- a/src/game/TemporarySummon.h +++ b/src/game/TemporarySummon.h @@ -27,7 +27,8 @@ class TemporarySummon : public Creature public: explicit TemporarySummon(ObjectGuid summoner = ObjectGuid()); virtual ~TemporarySummon(){}; - void Update(uint32 update_diff, uint32 time); + + void Update(uint32 update_diff, uint32 time) override; void Summon(TempSummonType type, uint32 lifetime); void MANGOS_DLL_SPEC UnSummon(); void SaveToDB(); diff --git a/src/game/Totem.h b/src/game/Totem.h index 34f067491ce..7b7e2a3556b 100644 --- a/src/game/Totem.h +++ b/src/game/Totem.h @@ -34,7 +34,7 @@ class Totem : public Creature explicit Totem(); virtual ~Totem(){}; bool Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* cinfo, Unit* owner); - void Update(uint32 update_diff, uint32 time ); + void Update(uint32 update_diff, uint32 time) override; void Summon(Unit* owner); void UnSummon(); uint32 GetSpell() const { return m_spells[0]; } diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index 9e3b7e40bff..3a65c3c145c 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -37,7 +37,7 @@ void MapManager::LoadTransports() if( !result ) { - barGoLink bar( 1 ); + BarGoLink bar(1); bar.step(); sLog.outString(); @@ -45,7 +45,7 @@ void MapManager::LoadTransports() return; } - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { diff --git a/src/game/Transports.h b/src/game/Transports.h index 929b8e46b1f..c3f440e681d 100644 --- a/src/game/Transports.h +++ b/src/game/Transports.h @@ -32,7 +32,7 @@ class Transport : public GameObject bool Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint8 animprogress, uint16 dynamicHighValue); bool GenerateWaypoints(uint32 pathid, std::set &mapids); - void Update(uint32 update_diff, uint32 p_time); + void Update(uint32 update_diff, uint32 p_time) override; bool AddPassenger(Player* passenger); bool RemovePassenger(Player* passenger); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 37965524d76..c154adbedfd 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -595,6 +595,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa ((Player*)this)->KilledMonster(normalInfo, pVictim->GetObjectGuid()); } + if (InstanceData* mapInstance = pVictim->GetInstanceData()) + mapInstance->OnCreatureDeath(((Creature*)pVictim)); + DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE, "DealDamage critter, critter dies"); return damage; @@ -607,7 +610,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // duel ends when player has 1 or less hp bool duel_hasEnded = false; - if(pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->duel && damage >= (health-1)) + if (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->duel && damage >= (health-1)) { // prevent kill only if killed in duel and killed by opponent or opponent controlled creature if(((Player*)pVictim)->duel->opponent==this || ((Player*)pVictim)->duel->opponent->GetObjectGuid() == GetOwnerGuid()) @@ -1309,11 +1312,11 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 damage, S damageInfo->HitInfo|= SPELL_HIT_TYPE_CRIT; damage = SpellCriticalDamageBonus(spellInfo, damage, pVictim); // Resilience - reduce crit damage - uint32 redunction_affected_damage = CalcNotIgnoreDamageRedunction(damage,damageSchoolMask); + uint32 reduction_affected_damage = CalcNotIgnoreDamageReduction(damage, damageSchoolMask); if (attackType != RANGED_ATTACK) - damage -= pVictim->GetMeleeCritDamageReduction(redunction_affected_damage); + damage -= pVictim->GetMeleeCritDamageReduction(reduction_affected_damage); else - damage -= pVictim->GetRangedCritDamageReduction(redunction_affected_damage); + damage -= pVictim->GetRangedCritDamageReduction(reduction_affected_damage); } } break; @@ -1331,8 +1334,8 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 damage, S damageInfo->HitInfo|= SPELL_HIT_TYPE_CRIT; damage = SpellCriticalDamageBonus(spellInfo, damage, pVictim); // Resilience - reduce crit damage - uint32 redunction_affected_damage = CalcNotIgnoreDamageRedunction(damage,damageSchoolMask); - damage -= pVictim->GetSpellCritDamageReduction(redunction_affected_damage); + uint32 reduction_affected_damage = CalcNotIgnoreDamageReduction(damage, damageSchoolMask); + damage -= pVictim->GetSpellCritDamageReduction(reduction_affected_damage); } } break; @@ -1341,8 +1344,8 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 damage, S // only from players if (GetTypeId() == TYPEID_PLAYER) { - uint32 redunction_affected_damage = CalcNotIgnoreDamageRedunction(damage,damageSchoolMask); - damage -= pVictim->GetSpellDamageReduction(redunction_affected_damage); + uint32 reduction_affected_damage = CalcNotIgnoreDamageReduction(damage, damageSchoolMask); + damage -= pVictim->GetSpellDamageReduction(reduction_affected_damage); } // damage mitigation @@ -1351,7 +1354,7 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 damage, S // physical damage => armor if (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL) { - uint32 armor_affected_damage = CalcNotIgnoreDamageRedunction(damage,damageSchoolMask); + uint32 armor_affected_damage = CalcNotIgnoreDamageReduction(damage, damageSchoolMask); damage = damage - armor_affected_damage + CalcArmorReducedDamage(pVictim, armor_affected_damage); } } @@ -1403,8 +1406,8 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da damageInfo->resist = 0; damageInfo->blocked_amount = 0; - damageInfo->TargetState = 0; - damageInfo->HitInfo = 0; + damageInfo->TargetState = VICTIMSTATE_UNAFFECTED; + damageInfo->HitInfo = HITINFO_NORMALSWING; damageInfo->procAttacker = PROC_FLAG_NONE; damageInfo->procVictim = PROC_FLAG_NONE; damageInfo->procEx = PROC_EX_NONE; @@ -1431,7 +1434,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da case RANGED_ATTACK: damageInfo->procAttacker = PROC_FLAG_SUCCESSFUL_RANGED_HIT; damageInfo->procVictim = PROC_FLAG_TAKEN_RANGED_HIT; - damageInfo->HitInfo = 0x08;// test + damageInfo->HitInfo = HITINFO_UNK3; // test (dev note: test what? HitInfo flag possibly not confirmed.) break; default: break; @@ -1454,7 +1457,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType); // Calculate armor reduction - uint32 armor_affected_damage = CalcNotIgnoreDamageRedunction(damage,damageInfo->damageSchoolMask); + uint32 armor_affected_damage = CalcNotIgnoreDamageReduction(damage, damageInfo->damageSchoolMask); damageInfo->damage = damage - armor_affected_damage + CalcArmorReducedDamage(damageInfo->target, armor_affected_damage); damageInfo->cleanDamage += damage - damageInfo->damage; @@ -1482,7 +1485,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da case MELEE_HIT_MISS: { damageInfo->HitInfo |= HITINFO_MISS; - damageInfo->TargetState = VICTIMSTATE_NORMAL; + damageInfo->TargetState = VICTIMSTATE_UNAFFECTED; damageInfo->procEx|=PROC_EX_MISS; damageInfo->damage = 0; @@ -1518,12 +1521,12 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da damageInfo->damage = int32((damageInfo->damage) * float((100.0f + mod)/100.0f)); // Resilience - reduce crit damage - uint32 redunction_affected_damage = CalcNotIgnoreDamageRedunction(damageInfo->damage,damageInfo->damageSchoolMask); + uint32 reduction_affected_damage = CalcNotIgnoreDamageReduction(damageInfo->damage, damageInfo->damageSchoolMask); uint32 resilienceReduction; if (attackType != RANGED_ATTACK) - resilienceReduction = pVictim->GetMeleeCritDamageReduction(redunction_affected_damage); + resilienceReduction = pVictim->GetMeleeCritDamageReduction(reduction_affected_damage); else - resilienceReduction = pVictim->GetRangedCritDamageReduction(redunction_affected_damage); + resilienceReduction = pVictim->GetRangedCritDamageReduction(reduction_affected_damage); damageInfo->damage -= resilienceReduction; damageInfo->cleanDamage += resilienceReduction; @@ -1531,22 +1534,22 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da } case MELEE_HIT_PARRY: damageInfo->TargetState = VICTIMSTATE_PARRY; - damageInfo->procEx |= PROC_EX_PARRY; + damageInfo->procEx |= PROC_EX_PARRY; damageInfo->cleanDamage += damageInfo->damage; damageInfo->damage = 0; break; case MELEE_HIT_DODGE: damageInfo->TargetState = VICTIMSTATE_DODGE; - damageInfo->procEx|=PROC_EX_DODGE; + damageInfo->procEx |= PROC_EX_DODGE; damageInfo->cleanDamage += damageInfo->damage; damageInfo->damage = 0; break; case MELEE_HIT_BLOCK: { damageInfo->TargetState = VICTIMSTATE_NORMAL; - damageInfo->HitInfo |= HITINFO_BLOCK; - damageInfo->procEx |= PROC_EX_BLOCK; + damageInfo->HitInfo |= HITINFO_BLOCK; + damageInfo->procEx |= PROC_EX_BLOCK; damageInfo->blocked_amount = damageInfo->target->GetShieldBlockValue(); // Target has a chance to double the blocked amount if it has SPELL_AURA_MOD_BLOCK_CRIT_CHANCE @@ -1637,12 +1640,12 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da // only from players if (GetTypeId() == TYPEID_PLAYER) { - uint32 redunction_affected_damage = CalcNotIgnoreDamageRedunction(damageInfo->damage,damageInfo->damageSchoolMask); + uint32 reduction_affected_damage = CalcNotIgnoreDamageReduction(damageInfo->damage, damageInfo->damageSchoolMask); uint32 resilienceReduction; if (attackType != RANGED_ATTACK) - resilienceReduction = pVictim->GetMeleeDamageReduction(redunction_affected_damage); + resilienceReduction = pVictim->GetMeleeDamageReduction(reduction_affected_damage); else - resilienceReduction = pVictim->GetRangedDamageReduction(redunction_affected_damage); + resilienceReduction = pVictim->GetRangedDamageReduction(reduction_affected_damage); damageInfo->damage -= resilienceReduction; damageInfo->cleanDamage += resilienceReduction; } @@ -1848,7 +1851,7 @@ uint32 Unit::CalcNotIgnoreAbsorbDamage( uint32 damage, SpellSchoolMask damageSch return absorb_affected_rate <= 0.0f ? 0 : (absorb_affected_rate < 1.0f ? uint32(damage * absorb_affected_rate) : damage); } -uint32 Unit::CalcNotIgnoreDamageRedunction( uint32 damage, SpellSchoolMask damageSchoolMask) +uint32 Unit::CalcNotIgnoreDamageReduction(uint32 damage, SpellSchoolMask damageSchoolMask) { float absorb_affected_rate = 1.0f; Unit::AuraList const& ignoreAbsorb = GetAurasByType(SPELL_AURA_MOD_IGNORE_DAMAGE_REDUCTION_SCHOOL); @@ -2126,7 +2129,7 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM continue; } // Reflective Shield - if (classOptions && classOptions->SpellFamilyFlags == 0x1 && canReflect) + if (spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000001)) && canReflect) { if (pCaster == this) break; @@ -5269,16 +5272,17 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) } data << uint8(damageInfo->TargetState); - data << uint32(0); - data << uint32(0); + data << uint32(0); // unknown, usually seen with -1, 0 and 1000 + data << uint32(0); // spell id, seen with heroic strike and disarm as examples. + // HITINFO_NOACTION normally set if spell if(damageInfo->HitInfo & HITINFO_BLOCK) data << uint32(damageInfo->blocked_amount); - if(damageInfo->HitInfo & HITINFO_UNK3) - data << uint32(0); + if(damageInfo->HitInfo & HITINFO_UNK22) + data << uint32(0); // count of some sort? - if(damageInfo->HitInfo & HITINFO_UNK1) + if(damageInfo->HitInfo & HITINFO_UNK0) { data << uint32(0); data << float(0); @@ -5377,15 +5381,15 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const bool Unit::IsHostileTo(Unit const* unit) const { // always non-hostile to self - if(unit==this) + if (unit == this) return false; // always non-hostile to GM in GM mode - if(unit->GetTypeId()==TYPEID_PLAYER && ((Player const*)unit)->isGameMaster()) + if (unit->GetTypeId() == TYPEID_PLAYER && ((Player const*)unit)->isGameMaster()) return false; // always hostile to enemy - if(getVictim()==unit || unit->getVictim()==this) + if (getVictim() == unit || unit->getVictim() == this) return true; // test pet/charm masters instead pers/charmeds @@ -5393,49 +5397,49 @@ bool Unit::IsHostileTo(Unit const* unit) const Unit const* targetOwner = unit->GetCharmerOrOwner(); // always hostile to owner's enemy - if(testerOwner && (testerOwner->getVictim()==unit || unit->getVictim()==testerOwner)) + if (testerOwner && (testerOwner->getVictim() == unit || unit->getVictim() == testerOwner)) return true; // always hostile to enemy owner - if(targetOwner && (getVictim()==targetOwner || targetOwner->getVictim()==this)) + if (targetOwner && (getVictim() == targetOwner || targetOwner->getVictim() == this)) return true; // always hostile to owner of owner's enemy - if(testerOwner && targetOwner && (testerOwner->getVictim()==targetOwner || targetOwner->getVictim()==testerOwner)) + if (testerOwner && targetOwner && (testerOwner->getVictim() == targetOwner || targetOwner->getVictim() == testerOwner)) return true; Unit const* tester = testerOwner ? testerOwner : this; Unit const* target = targetOwner ? targetOwner : unit; // always non-hostile to target with common owner, or to owner/pet - if(tester==target) + if (tester == target) return false; // special cases (Duel, etc) - if(tester->GetTypeId()==TYPEID_PLAYER && target->GetTypeId()==TYPEID_PLAYER) + if (tester->GetTypeId() == TYPEID_PLAYER && target->GetTypeId() == TYPEID_PLAYER) { Player const* pTester = (Player const*)tester; Player const* pTarget = (Player const*)target; // Duel - if(pTester->duel && pTester->duel->opponent == pTarget && pTester->duel->startTime != 0) + if (pTester->IsInDuelWith(pTarget)) return true; // Group - if(pTester->GetGroup() && pTester->GetGroup()==pTarget->GetGroup()) + if (pTester->GetGroup() && pTester->GetGroup() == pTarget->GetGroup()) return false; // Sanctuary - if(pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY) && pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY)) + if (pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY) && pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY)) return false; // PvP FFA state - if(pTester->IsFFAPvP() && pTarget->IsFFAPvP()) + if (pTester->IsFFAPvP() && pTarget->IsFFAPvP()) return true; //= PvP states // Green/Blue (can't attack) - if(pTester->GetTeam()==pTarget->GetTeam()) + if (pTester->GetTeam() == pTarget->GetTeam()) return false; // Red (can attack) if true, Blue/Yellow (can't attack) in another case @@ -5489,15 +5493,15 @@ bool Unit::IsHostileTo(Unit const* unit) const bool Unit::IsFriendlyTo(Unit const* unit) const { // always friendly to self - if(unit==this) + if (unit == this) return true; // always friendly to GM in GM mode - if(unit->GetTypeId()==TYPEID_PLAYER && ((Player const*)unit)->isGameMaster()) + if (unit->GetTypeId() == TYPEID_PLAYER && ((Player const*)unit)->isGameMaster()) return true; // always non-friendly to enemy - if(getVictim()==unit || unit->getVictim()==this) + if (getVictim() == unit || unit->getVictim() == this) return false; // test pet/charm masters instead pers/charmeds @@ -5505,49 +5509,49 @@ bool Unit::IsFriendlyTo(Unit const* unit) const Unit const* targetOwner = unit->GetCharmerOrOwner(); // always non-friendly to owner's enemy - if(testerOwner && (testerOwner->getVictim()==unit || unit->getVictim()==testerOwner)) + if (testerOwner && (testerOwner->getVictim() == unit || unit->getVictim() == testerOwner)) return false; // always non-friendly to enemy owner - if(targetOwner && (getVictim()==targetOwner || targetOwner->getVictim()==this)) + if (targetOwner && (getVictim() == targetOwner || targetOwner->getVictim() == this)) return false; // always non-friendly to owner of owner's enemy - if(testerOwner && targetOwner && (testerOwner->getVictim()==targetOwner || targetOwner->getVictim()==testerOwner)) + if (testerOwner && targetOwner && (testerOwner->getVictim() == targetOwner || targetOwner->getVictim() == testerOwner)) return false; Unit const* tester = testerOwner ? testerOwner : this; Unit const* target = targetOwner ? targetOwner : unit; // always friendly to target with common owner, or to owner/pet - if(tester==target) + if (tester == target) return true; // special cases (Duel) - if(tester->GetTypeId()==TYPEID_PLAYER && target->GetTypeId()==TYPEID_PLAYER) + if (tester->GetTypeId() == TYPEID_PLAYER && target->GetTypeId() == TYPEID_PLAYER) { Player const* pTester = (Player const*)tester; Player const* pTarget = (Player const*)target; // Duel - if(pTester->duel && pTester->duel->opponent == target && pTester->duel->startTime != 0) + if (pTester->IsInDuelWith(pTarget)) return false; // Group - if(pTester->GetGroup() && pTester->GetGroup()==pTarget->GetGroup()) + if (pTester->GetGroup() && pTester->GetGroup() == pTarget->GetGroup()) return true; // Sanctuary - if(pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY) && pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY)) + if (pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY) && pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY)) return true; // PvP FFA state - if(pTester->IsFFAPvP() && pTarget->IsFFAPvP()) + if (pTester->IsFFAPvP() && pTarget->IsFFAPvP()) return false; //= PvP states // Green/Blue (non-attackable) - if(pTester->GetTeam()==pTarget->GetTeam()) + if (pTester->GetTeam() == pTarget->GetTeam()) return true; // Blue (friendly/non-attackable) if not PVP, or Yellow/Red in another case (attackable) @@ -5899,6 +5903,15 @@ Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() return GetTypeId()==TYPEID_PLAYER ? (Player*)this : NULL; } +Player const* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() const +{ + ObjectGuid guid = GetCharmerOrOwnerGuid(); + if (guid.IsPlayer()) + return ObjectAccessor::FindPlayer(guid); + + return GetTypeId() == TYPEID_PLAYER ? (Player const*)this : NULL; +} + Pet* Unit::GetPet() const { if (ObjectGuid pet_guid = GetPetGuid()) @@ -6754,9 +6767,21 @@ bool Unit::IsSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM // Custom crit by class switch(spellProto->GetSpellFamilyName()) { + case SPELLFAMILY_MAGE: + { + // Fire Blast + if (spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000002)) && spellProto->SpellIconID == 12) + { + // Glyph of Fire Blast + if (pVictim->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) || pVictim->isInRoots()) + if (Aura* aura = GetAura(56369, EFFECT_INDEX_0)) + crit_chance += aura->GetModifier()->m_amount; + } + break; + } case SPELLFAMILY_PRIEST: // Flash Heal - if (classOptions && classOptions->SpellFamilyFlags & UI64LIT(0x0000000000000800)) + if (spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000800))) { if (pVictim->GetHealth() > pVictim->GetMaxHealth()/2) break; @@ -6775,7 +6800,7 @@ bool Unit::IsSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM break; case SPELLFAMILY_DRUID: // Improved Insect Swarm (Starfire part) - if (classOptions && classOptions->SpellFamilyFlags & UI64LIT(0x0000000000000004)) + if (spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000004))) { // search for Moonfire on target if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, UI64LIT(0x000000000000002), 0, GetObjectGuid())) @@ -6809,7 +6834,7 @@ bool Unit::IsSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM break; case SPELLFAMILY_SHAMAN: // Lava Burst - if (classOptions && classOptions->SpellFamilyFlags & UI64LIT(0x0000100000000000)) + if (spellProto->IsFitToFamilyMask(UI64LIT(0x0000100000000000))) { // Flame Shock if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, UI64LIT(0x0000000010000000), 0, GetObjectGuid())) @@ -7730,18 +7755,20 @@ void Unit::SetInCombatWith(Unit* enemy) Unit* eOwner = enemy->GetCharmerOrOwnerOrSelf(); if (eOwner->IsPvP()) { - SetInCombatState(true,enemy); + SetInCombatState(true, enemy); return; } //check for duel if (eOwner->GetTypeId() == TYPEID_PLAYER && ((Player*)eOwner)->duel) { - Unit const* myOwner = GetCharmerOrOwnerOrSelf(); - if(((Player const*)eOwner)->duel->opponent == myOwner) + if (Player const* myOwner = GetCharmerOrOwnerPlayerOrPlayerItself()) { - SetInCombatState(true,enemy); - return; + if (myOwner->IsInDuelWith((Player const*)eOwner)) + { + SetInCombatState(true,enemy); + return; + } } } @@ -8236,7 +8263,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio) switch(mtype) { case MOVE_WALK: - return; + break; case MOVE_RUN: { if (IsMounted()) // Use on mount auras @@ -9834,9 +9861,9 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag { if (spellProcEvent) { - if (spellProcEvent->spellFamilyMask[i] || spellProcEvent->spellFamilyMask2[i]) + if (spellProcEvent->spellFamilyMask[i]) { - if (!procSpell->IsFitToFamilyMask(spellProcEvent->spellFamilyMask[i], spellProcEvent->spellFamilyMask2[i])) + if (!procSpell->IsFitToFamilyMask(spellProcEvent->spellFamilyMask[i])) continue; } // don't check dbc FamilyFlags if schoolMask exists @@ -9916,8 +9943,17 @@ void Unit::SendPetCastFail(uint32 spellid, SpellCastResult msg) data << uint8(0); // cast count? data << uint32(spellid); data << uint8(msg); - // uint32 for some reason - // uint32 for some reason + + // More cases exist, see Spell::SendCastResult (can possibly be unified) + switch(msg) + { + case SPELL_FAILED_NOT_READY: + data << uint32(0); // unknown + break; + default: + break; + } + ((Player*)owner)->GetSession()->SendPacket(&data); } @@ -10413,7 +10449,7 @@ void Unit::SetContestedPvP(Player *attackedPlayer) { Player* player = GetCharmerOrOwnerPlayerOrPlayerItself(); - if (!player || (attackedPlayer && (attackedPlayer == player || (player->duel && player->duel->opponent == attackedPlayer)))) + if (!player || (attackedPlayer && (attackedPlayer == player || player->IsInDuelWith(attackedPlayer)))) return; player->SetContestedPvPTimer(30000); @@ -10829,16 +10865,22 @@ bool Unit::IsAllowedDamageInArea(Unit* pVictim) const if (pVictim == this) return true; - // non player controlled unit can damage anywhere - if (!IsCharmerOrOwnerPlayerOrPlayerItself()) - return true; - // can damage own pet anywhere if (pVictim->GetOwnerGuid() == GetObjectGuid()) return true; + // non player controlled unit can damage anywhere + Player const* pOwner = GetCharmerOrOwnerPlayerOrPlayerItself(); + if (!pOwner) + return true; + // can damage non player controlled victim anywhere - if (!pVictim->IsCharmerOrOwnerPlayerOrPlayerItself()) + Player const* vOwner = pVictim->GetCharmerOrOwnerPlayerOrPlayerItself(); + if (!vOwner) + return true; + + // can damage opponent in duel + if (pOwner->IsInDuelWith(vOwner)) return true; // can't damage player controlled unit by player controlled unit in sanctuary diff --git a/src/game/Unit.h b/src/game/Unit.h index bca0192ac21..2245e9c7b39 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -145,6 +145,8 @@ enum UnitStandStateType UNIT_STAND_STATE_CUSTOM = 9 // Depends on model animation. Submerge, freeze, hide, hibernate, rest }; +#define MAX_UNIT_STAND_STATE 10 + // byte flags value (UNIT_FIELD_BYTES_1,2) enum UnitStandFlags { @@ -206,7 +208,7 @@ enum Swing enum VictimState { - VICTIMSTATE_UNKNOWN1 = 0, + VICTIMSTATE_UNAFFECTED = 0, // seen in relation with HITINFO_MISS VICTIMSTATE_NORMAL = 1, VICTIMSTATE_DODGE = 2, VICTIMSTATE_PARRY = 3, @@ -220,10 +222,10 @@ enum VictimState enum HitInfo { HITINFO_NORMALSWING = 0x00000000, - HITINFO_UNK1 = 0x00000001, // req correct packet structure + HITINFO_UNK0 = 0x00000001, // req correct packet structure HITINFO_NORMALSWING2 = 0x00000002, HITINFO_LEFTSWING = 0x00000004, - HITINFO_UNK2 = 0x00000008, + HITINFO_UNK3 = 0x00000008, HITINFO_MISS = 0x00000010, HITINFO_ABSORB = 0x00000020, // absorbed damage HITINFO_ABSORB2 = 0x00000040, // absorbed damage @@ -243,7 +245,7 @@ enum HitInfo // 0x00100000 HITINFO_SWINGNOHITSOUND = 0x00200000, // guessed // 0x00400000 - HITINFO_UNK3 = 0x00800000 + HITINFO_UNK22 = 0x00800000 }; //i would like to remove this: (it is defined in item.h @@ -1155,7 +1157,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void ApplyDiminishingAura(DiminishingGroup group, bool apply); void ClearDiminishings() { m_Diminishing.clear(); } - virtual void Update( uint32 update_diff, uint32 time ); + void Update(uint32 update_diff, uint32 time) override; void setAttackTimer(WeaponAttackType type, uint32 time) { m_attackTimer[type] = time; } void resetAttackTimer(WeaponAttackType type = BASE_ATTACK); @@ -1534,6 +1536,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject } bool IsCharmerOrOwnerPlayerOrPlayerItself() const; Player* GetCharmerOrOwnerPlayerOrPlayerItself(); + Player const* GetCharmerOrOwnerPlayerOrPlayerItself() const; float GetCombatDistance( const Unit* target ) const; void SetPet(Pet* pet); @@ -1908,7 +1911,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject int32 CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, SpellEffectIndex effect_index, int32 const* basePoints = NULL); uint32 CalcNotIgnoreAbsorbDamage( uint32 damage, SpellSchoolMask damageSchoolMask, SpellEntry const* spellInfo = NULL); - uint32 CalcNotIgnoreDamageRedunction( uint32 damage, SpellSchoolMask damageSchoolMask); + uint32 CalcNotIgnoreDamageReduction(uint32 damage, SpellSchoolMask damageSchoolMask); int32 CalculateAuraDuration(SpellEntry const* spellProto, uint32 effectMask, int32 duration, Unit const* caster); float CalculateLevelPenalty(SpellEntry const* spellProto) const; diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index 88f6a0a1314..8114db15038 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -384,7 +384,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, SpellAuraHolder* holder, S } // Aura added by spell can`t trigger from self (prevent drop charges/do triggers) // But except periodic triggers (can triggered from self) - if(procSpell && procSpell->Id == spellProto->Id && !(spellProto->GetProcFlags() & PROC_FLAG_ON_TAKE_PERIODIC)) + if(procSpell && procSpell->Id == spellProto->Id && !(EventProcFlag & PROC_FLAG_ON_TAKE_PERIODIC)) return false; // Check if current equipment allows aura to proc @@ -719,12 +719,9 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura SpellAuraHolderMap& Auras = pVictim->GetSpellAuraHolderMap(); for(SpellAuraHolderMap::const_iterator iter = Auras.begin(); iter != Auras.end();) { - SpellEntry const *spell = iter->second->GetSpellProto(); - - if( spell->GetMechanic() == MECHANIC_STUN || - iter->second->HasMechanic(MECHANIC_STUN)) + if (iter->second->HasMechanic(MECHANIC_STUN)) { - pVictim->RemoveAurasDueToSpell(spell->Id); + pVictim->RemoveAurasDueToSpell(iter->second->GetId()); iter = Auras.begin(); } else @@ -778,14 +775,14 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura case CLASS_DRUID: // 39511,40997,40998,40999,41002,41005,41009,41011,41409 { uint32 RandomSpell[]={39511,40997,40998,40999,41002,41005,41009,41011,41409}; - triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ]; + triggered_spell_id = RandomSpell[urand(0, countof(RandomSpell)-1)]; break; } case CLASS_ROGUE: // 39511,40997,40998,41002,41005,41011 case CLASS_WARRIOR: // 39511,40997,40998,41002,41005,41011 { uint32 RandomSpell[]={39511,40997,40998,41002,41005,41011}; - triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ]; + triggered_spell_id = RandomSpell[urand(0, countof(RandomSpell)-1)]; break; } case CLASS_PRIEST: // 40999,41002,41005,41009,41011,41406,41409 @@ -794,13 +791,13 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura case CLASS_WARLOCK: // 40999,41002,41005,41009,41011,41406,41409 { uint32 RandomSpell[]={40999,41002,41005,41009,41011,41406,41409}; - triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ]; + triggered_spell_id = RandomSpell[urand(0, countof(RandomSpell)-1)]; break; } case CLASS_HUNTER: // 40997,40999,41002,41005,41009,41011,41406,41409 { uint32 RandomSpell[]={40997,40999,41002,41005,41009,41011,41406,41409}; - triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ]; + triggered_spell_id = RandomSpell[urand(0, countof(RandomSpell)-1)]; break; } default: @@ -968,6 +965,16 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura case 63320: triggered_spell_id = 63321; break; + // Meteor Fists + case 66725: + case 68161: + triggered_spell_id = 66765; + break; + // Meteor Fists + case 66808: + case 68160: + triggered_spell_id = 66809; + break; // Shiny Shard of the Scale - Equip Effect case 69739: // Cauterizing Heal or Searing Flame @@ -1153,7 +1160,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura case SPELLFAMILY_WARRIOR: { // Retaliation - if (dummyClassOptions && dummyClassOptions->SpellFamilyFlags == UI64LIT(0x0000000800000000)) + if (dummySpell->IsFitToFamilyMask(UI64LIT(0x0000000800000000))) { // check attack comes not from behind if (!HasInArc(M_PI_F, pVictim)) @@ -3049,7 +3056,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d case SPELLFAMILY_WARLOCK: { // Drain Soul - if (auraClassOptions && auraClassOptions->SpellFamilyFlags & UI64LIT(0x0000000000004000)) + if (auraSpellInfo->IsFitToFamilyMask(UI64LIT(0x0000000000004000))) { // search for "Improved Drain Soul" dummy aura Unit::AuraList const& mDummyAura = GetAurasByType(SPELL_AURA_DUMMY); @@ -3067,6 +3074,13 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d // Need for correct work Drain Soul SPELL_AURA_CHANNEL_DEATH_ITEM aura return SPELL_AURA_PROC_FAILED; } + // Consume Shadows + else if (auraSpellInfo->IsFitToFamilyMask(UI64LIT(0x0000000002000000))) + { + Aura* heal = triggeredByAura->GetHolder()->GetAuraByEffectIndex(EFFECT_INDEX_0); + if (!heal || heal->GetAuraTicks() > 1) + return SPELL_AURA_PROC_FAILED; + } // Nether Protection else if (auraSpellInfo->SpellIconID == 1985) { @@ -3205,6 +3219,12 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d if (HasAura(67544)) return SPELL_AURA_PROC_FAILED; } + // Item - Hunter T9 4P Bonus + else if (auraSpellInfo->Id == 67151) + { + trigger_spell_id = 68130; + break; + } break; } case SPELLFAMILY_PALADIN: @@ -3797,7 +3817,7 @@ SpellAuraProcResult Unit::HandleMendingAuraProc( Unit* /*pVictim*/, uint32 /*dam { SpellClassOptionsEntry const* classOptions = spellProto->GetSpellClassOptions(); // aura will applied from caster, but spell casted from current aura holder - SpellModifier *mod = new SpellModifier(SPELLMOD_CHARGES,SPELLMOD_FLAT,jumps-5,spellProto->Id,classOptions ? classOptions->SpellFamilyFlags : 0,classOptions ? classOptions->SpellFamilyFlags2 : 0); + SpellModifier *mod = new SpellModifier(SPELLMOD_CHARGES,SPELLMOD_FLAT,jumps-5,spellProto->Id,classOptions ? classOptions->SpellFamilyFlags : ClassFamilyMask()); // remove before apply next (locked against deleted) triggeredByAura->SetInUse(true); diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp index a3caf34e585..bfdacc86dbc 100644 --- a/src/game/WaypointManager.cpp +++ b/src/game/WaypointManager.cpp @@ -67,7 +67,7 @@ void WaypointManager::Load() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); sLog.outString( ">> Loaded 0 paths. DB table `creature_movement` is empty." ); @@ -75,7 +75,7 @@ void WaypointManager::Load() else { total_paths = (uint32)result->GetRowCount(); - barGoLink bar( total_paths ); + BarGoLink bar(total_paths); do { @@ -100,7 +100,7 @@ void WaypointManager::Load() // 7 8 9 10 11 12 13 14 15 16 "textid1, textid2, textid3, textid4, textid5, emote, spell, orientation, model1, model2 FROM creature_movement"); - barGoLink barRow((int)result->GetRowCount()); + BarGoLink barRow((int)result->GetRowCount()); // error after load, we check if creature guid corresponding to the path id has proper MovementType std::set creatureNoMoveType; @@ -243,7 +243,7 @@ void WaypointManager::Load() if (!result) { - barGoLink bar(1); + BarGoLink bar(1); bar.step(); sLog.outString(); sLog.outString( ">> Loaded 0 path templates. DB table `creature_movement_template` is empty." ); @@ -253,7 +253,7 @@ void WaypointManager::Load() total_nodes = 0; total_behaviors = 0; total_paths = (uint32)result->GetRowCount(); - barGoLink barRow(total_paths); + BarGoLink barRow(total_paths); do { @@ -278,7 +278,7 @@ void WaypointManager::Load() // 7 8 9 10 11 12 13 14 15 16 "textid1, textid2, textid3, textid4, textid5, emote, spell, orientation, model1, model2 FROM creature_movement_template"); - barGoLink bar( (int)result->GetRowCount() ); + BarGoLink bar(result->GetRowCount()); do { diff --git a/src/game/World.cpp b/src/game/World.cpp index baf7e0bdc1f..a6bb1e2009a 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -243,12 +243,12 @@ World::AddSession_ (WorldSession* s) } WorldPacket packet(SMSG_AUTH_RESPONSE, 1 + 4 + 1 + 4 + 1); - packet << uint8 (AUTH_OK); - packet << uint32 (0); // BillingTimeRemaining - packet << uint8 (0); // BillingPlanFlags - packet << uint32 (0); // BillingTimeRested - packet << uint8 (s->Expansion()); // 0 - normal, 1 - TBC, must be set in database manually for each account - s->SendPacket (&packet); + packet << uint8(AUTH_OK); + packet << uint32(0); // BillingTimeRemaining + packet << uint8(0); // BillingPlanFlags + packet << uint32(0); // BillingTimeRested + packet << uint8(s->Expansion()); // 0 - normal, 1 - TBC, 2 - WotLK. Must be set in database manually for each account. + s->SendPacket(&packet); s->SendAddonsInfo(); @@ -949,9 +949,12 @@ void World::SetInitialWorldSettings() sLog.outString( "Loading InstanceTemplate..." ); sObjectMgr.LoadInstanceTemplate(); - sLog.outString( "Loading SkillLineAbilityMultiMap Data..." ); + sLog.outString("Loading SkillLineAbilityMultiMap Data..."); sSpellMgr.LoadSkillLineAbilityMap(); + sLog.outString("Loading SkillRaceClassInfoMultiMap Data..."); + sSpellMgr.LoadSkillRaceClassInfoMap(); + ///- Clean up and pack instances sLog.outString( "Cleaning up instances..." ); sMapPersistentStateMgr.CleanupInstances(); // must be called before `creature_respawn`/`gameobject_respawn` tables @@ -963,7 +966,7 @@ void World::SetInitialWorldSettings() sObjectMgr.PackGroupIds(); // must be after CleanupInstances ///- Init highest guids before any guid using table loading to prevent using not initialized guids in some code. - sObjectMgr.SetHighestGuids(); // must be after packing instances + sObjectMgr.SetHighestGuids(); // must be after PackInstances() and PackGroupIds() sLog.outString(); sLog.outString( "Loading Page Texts..." ); diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 4a3b1b7952a..f54113e9399 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -300,6 +300,8 @@ class MANGOS_DLL_SPEC WorldSession void SendListInventory(ObjectGuid guid); bool CheckBanker(ObjectGuid guid); void SendShowBank(ObjectGuid guid); + bool CheckMailBox(ObjectGuid guid); + void SendShowMailBox(ObjectGuid guid); void SendTabardVendorActivate(ObjectGuid guid); void SendSpiritResurrect(); void SendBindPoint(Creature* npc); diff --git a/src/mangosd/Main.cpp b/src/mangosd/Main.cpp index fee8ac557bf..62f7166ca05 100644 --- a/src/mangosd/Main.cpp +++ b/src/mangosd/Main.cpp @@ -174,20 +174,19 @@ extern int main(int argc, char **argv) #endif sLog.outString( "%s [world-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID) ); - sLog.outString( " to stop.\n\n" ); - - sLog.outTitle( "MM MM MM MM MMMMM MMMM MMMMM"); - sLog.outTitle( "MM MM MM MM MMM MMM MM MM MMM MMM"); - sLog.outTitle( "MMM MMM MMM MM MMM MMM MM MM MMM"); - sLog.outTitle( "MM M MM MMMM MM MMM MM MM MMM"); - sLog.outTitle( "MM M MM MMMMM MM MMMM MMM MM MM MMM"); - sLog.outTitle( "MM M MM M MMM MM MMM MMMMMMM MM MM MMM"); - sLog.outTitle( "MM MM MMM MM MM MM MMM MM MM MMM"); - sLog.outTitle( "MM MM MMMMMMM MM MM MMM MMM MM MM MMM MMM"); - sLog.outTitle( "MM MM MM MMM MM MM MMMMMM MMMM MMMMM"); - sLog.outTitle( " MM MMM http://getmangos.com"); - sLog.outTitle( " MMMMMM\n\n"); - + sLog.outString( " to stop." ); + sLog.outString("\n\n" + "MM MM MM MM MMMMM MMMM MMMMM\n" + "MM MM MM MM MMM MMM MM MM MMM MMM\n" + "MMM MMM MMM MM MMM MMM MM MM MMM\n" + "MM M MM MMMM MM MMM MM MM MMM\n" + "MM M MM MMMMM MM MMMM MMM MM MM MMM\n" + "MM M MM M MMM MM MMM MMMMMMM MM MM MMM\n" + "MM MM MMM MM MM MM MMM MM MM MMM\n" + "MM MM MMMMMMM MM MM MMM MMM MM MM MMM MMM\n" + "MM MM MM MMM MM MM MMMMMM MMMM MMMMM\n" + " MM MMM http://getmangos.com\n" + " MMMMMM\n\n"); sLog.outString("Using configuration file %s.", cfg_file); DETAIL_LOG("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); @@ -200,7 +199,7 @@ extern int main(int argc, char **argv) DETAIL_LOG("Using ACE: %s", ACE_VERSION); ///- Set progress bars show mode - barGoLink::SetOutputState(sConfig.GetBoolDefault("ShowProgressBars", true)); + BarGoLink::SetOutputState(sConfig.GetBoolDefault("ShowProgressBars", true)); ///- and run the 'Master' /// \todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd? diff --git a/src/realmd/AuthSocket.cpp b/src/realmd/AuthSocket.cpp index 97b3d910b24..8932a07ca03 100644 --- a/src/realmd/AuthSocket.cpp +++ b/src/realmd/AuthSocket.cpp @@ -44,6 +44,13 @@ enum eStatus STATUS_AUTHED }; +enum AccountFlags +{ + ACCOUNT_FLAG_GM = 0x00000001, + ACCOUNT_FLAG_TRIAL = 0x00000008, + ACCOUNT_FLAG_PROPASS = 0x00800000, +}; + // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some paltform #if defined( __GNUC__ ) #pragma pack(1) @@ -110,9 +117,9 @@ typedef struct AUTH_LOGON_PROOF_S uint8 cmd; uint8 error; uint8 M2[20]; - uint32 unk1; // AccountFlags (trial 0x08, ProPass 0x800000, gm 0x01) - uint32 unk2; // SurveyId - uint16 unk3; // some flags (AccountMsgAvailable = 0x01) + uint32 accountFlags; // see enum AccountFlags + uint32 surveyId; // SurveyId + uint16 unkFlags; // some flags (AccountMsgAvailable = 0x01) } sAuthLogonProof_S; typedef struct AUTH_LOGON_PROOF_S_BUILD_6005 @@ -298,9 +305,9 @@ void AuthSocket::SendProof(Sha1Hash sha) memcpy(proof.M2, sha.GetDigest(), 20); proof.cmd = CMD_AUTH_LOGON_PROOF; proof.error = 0; - proof.unk1 = 0x00800000; - proof.unk2 = 0x00; - proof.unk3 = 0x00; + proof.accountFlags = ACCOUNT_FLAG_PROPASS; + proof.surveyId = 0x00000000; + proof.unkFlags = 0x0000; send((char *)&proof, sizeof(proof)); break; diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h index 9fb1baed9f3..2c5864c6420 100644 --- a/src/shared/ByteBuffer.h +++ b/src/shared/ByteBuffer.h @@ -414,10 +414,16 @@ class ByteBuffer if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output return; - sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); - for(uint32 i = 0; i < size(); ++i) - sLog.outDebugInLine("%u - ", read(i) ); - sLog.outDebug(" "); + std::ostringstream ss; + ss << "STORAGE_SIZE: " << size() << "\n"; + + if (sLog.IsIncludeTime()) + ss << " "; + + for (size_t i = 0; i < size(); ++i) + ss << uint32(read(i)) << " - "; + + sLog.outDebug(ss.str().c_str()); } void textlike() const @@ -425,10 +431,16 @@ class ByteBuffer if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output return; - sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); - for(uint32 i = 0; i < size(); ++i) - sLog.outDebugInLine("%c", read(i) ); - sLog.outDebug(" "); + std::ostringstream ss; + ss << "STORAGE_SIZE: " << size() << "\n"; + + if (sLog.IsIncludeTime()) + ss << " "; + + for (size_t i = 0; i < size(); ++i) + ss << read(i); + + sLog.outDebug(ss.str().c_str()); } void hexlike() const @@ -436,37 +448,40 @@ class ByteBuffer if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output return; - uint32 j = 1, k = 1; - sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); + std::ostringstream ss; + ss << "STORAGE_SIZE: " << size() << "\n"; if (sLog.IsIncludeTime()) - sLog.outDebugInLine(" "); + ss << " "; + + size_t j = 1, k = 1; - for(uint32 i = 0; i < size(); ++i) + for (size_t i = 0; i < size(); ++i) { if ((i == (j * 8)) && ((i != (k * 16)))) { - sLog.outDebugInLine("| %02X ", read(i)); + ss << "| "; ++j; } else if (i == (k * 16)) { - sLog.outDebugInLine("\n"); - if(sLog.IsIncludeTime()) - sLog.outDebugInLine(" "); + ss << "\n"; - sLog.outDebugInLine("%02X ", read(i)); + if (sLog.IsIncludeTime()) + ss << " "; ++k; ++j; } - else - { - sLog.outDebugInLine("%02X ", read(i)); - } + + char buf[4]; + snprintf(buf, 4, "%02X", read(i)); + ss << buf << " "; + } - sLog.outDebugInLine("\n"); + sLog.outDebug(ss.str().c_str()); } + private: // limited for internal use because can "append" any unexpected type (like pointer and etc) with hard detection problem template void append(T value) diff --git a/src/shared/Common.h b/src/shared/Common.h index cd61d2d8d48..36a57298e07 100644 --- a/src/shared/Common.h +++ b/src/shared/Common.h @@ -250,4 +250,8 @@ inline char * mangos_strdup(const char * source) # define M_PI_F float(M_PI) #endif +#ifndef countof +#define countof(array) (sizeof(array) / sizeof((array)[0])) +#endif + #endif diff --git a/src/shared/Database/SQLStorageImpl.h b/src/shared/Database/SQLStorageImpl.h index 62625c58357..fa02eda7db2 100644 --- a/src/shared/Database/SQLStorageImpl.h +++ b/src/shared/Database/SQLStorageImpl.h @@ -223,8 +223,8 @@ void SQLStorageLoaderBase::Load(SQLStorage &store, bool error_at_empty /*= tr memset(newIndex,0,maxi*sizeof(char*)); char * _data= new char[store.RecordCount *recordsize]; - uint32 count=0; - barGoLink bar( store.RecordCount ); + uint32 count = 0; + BarGoLink bar(store.RecordCount); do { fields = result->Fetch(); diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index 724d093f7b4..075a9ef4c12 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -346,31 +346,6 @@ std::string Log::GetTimestampStr() return std::string(buf); } -void Log::outTitle( const char * str) -{ - if (!str) - return; - - if (m_colored) - SetColor(true,WHITE); - - // not expected utf8 and then send as-is - printf("%s", str); - - if (m_colored) - ResetColor(true); - - printf("\n"); - if (logfile) - { - fprintf(logfile, "%s", str); - fprintf(logfile, "\n" ); - fflush(logfile); - } - - fflush(stdout); -} - void Log::outString() { if (m_includeTime) @@ -614,34 +589,6 @@ void Log::outDetail( const char * str, ... ) fflush(stdout); } -void Log::outDebugInLine( const char * str, ... ) -{ - if (!str) - return; - - if (m_logLevel >= LOG_LVL_DEBUG) - { - if (m_colored) - SetColor(true,m_colors[LogDebug]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); - } - - if (logfile && m_logFileLevel >= LOG_LVL_DEBUG) - { - va_list ap; - va_start(ap, str); - vfprintf(logfile, str, ap); - va_end(ap); - } -} - void Log::outDebug( const char * str, ... ) { if (!str) @@ -795,38 +742,6 @@ void Log::outCharDump( const char * str, uint32 account_id, uint32 guid, const c } } -void Log::outMenu( const char * str, ... ) -{ - if (!str) - return; - - SetColor(true,m_colors[LogNormal]); - - if (m_includeTime) - outTime(); - - va_list ap; - - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - ResetColor(true); - - if (logfile) - { - outTimestamp(logfile); - - va_start(ap, str); - vfprintf(logfile, str, ap); - va_end(ap); - - fprintf(logfile, "\n" ); - fflush(logfile); - } - fflush(stdout); -} - void Log::outRALog( const char * str, ... ) { if (!str) @@ -860,7 +775,7 @@ void Log::WaitBeforeContinueIfNeed() else if (mode > 0) { printf("\nWait %u secs for continue.\n",mode); - barGoLink bar(mode); + BarGoLink bar(mode); for(int i = 0; i < mode; ++i) { bar.step(); diff --git a/src/shared/Log.h b/src/shared/Log.h index ad003a66d93..8502d4421d5 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -118,7 +118,7 @@ class Log : public MaNGOS::Singleton= 2 void outDetail( const char * str, ... ) ATTR_PRINTF(2,3); // log level >= 3 - void outDebugInLine( const char * str, ... ) ATTR_PRINTF(2,3); - // log level >= 3 void outDebug( const char * str, ... ) ATTR_PRINTF(2,3); - // any log level - void outMenu( const char * str, ... ) ATTR_PRINTF(2,3); + void outErrorDb(); // any log level // any log level void outErrorDb( const char * str, ... ) ATTR_PRINTF(2,3); diff --git a/src/shared/ProgressBar.cpp b/src/shared/ProgressBar.cpp index cd28c3dfd2e..b97e141b7f0 100644 --- a/src/shared/ProgressBar.cpp +++ b/src/shared/ProgressBar.cpp @@ -19,17 +19,35 @@ #include #include "ProgressBar.h" +#include "Errors.h" -bool barGoLink::m_showOutput = true; +bool BarGoLink::m_showOutput = true; -char const* const barGoLink::empty = " "; +char const* const BarGoLink::empty = " "; #ifdef _WIN32 -char const* const barGoLink::full = "\x3D"; +char const* const BarGoLink::full = "\x3D"; #else -char const* const barGoLink::full = "*"; +char const* const BarGoLink::full = "*"; #endif -barGoLink::~barGoLink() +BarGoLink::BarGoLink(int row_count) +{ + init(row_count); +} + +BarGoLink::BarGoLink(uint32 row_count) +{ + MANGOS_ASSERT(row_count < (uint32)ACE_INT32_MAX); + init((int)row_count); +} + +BarGoLink::BarGoLink(uint64 row_count) +{ + MANGOS_ASSERT(row_count < (uint64)ACE_INT32_MAX); + init((int)row_count); +} + +BarGoLink::~BarGoLink() { if (!m_showOutput) return; @@ -38,7 +56,7 @@ barGoLink::~barGoLink() fflush(stdout); } -barGoLink::barGoLink(int row_count) +void BarGoLink::init(int row_count) { rec_no = 0; rec_pos = 0; @@ -62,7 +80,7 @@ barGoLink::barGoLink(int row_count) fflush(stdout); } -void barGoLink::step() +void BarGoLink::step() { if (!m_showOutput) return; @@ -94,7 +112,7 @@ void barGoLink::step() } // avoid use inline version because linking problems with private static field -void barGoLink::SetOutputState(bool on) +void BarGoLink::SetOutputState(bool on) { m_showOutput = on; -} \ No newline at end of file +} diff --git a/src/shared/ProgressBar.h b/src/shared/ProgressBar.h index 195b0b0ba52..c2f142fa4a7 100644 --- a/src/shared/ProgressBar.h +++ b/src/shared/ProgressBar.h @@ -20,17 +20,21 @@ #include "Platform/Define.h" -class MANGOS_DLL_SPEC barGoLink +class MANGOS_DLL_SPEC BarGoLink { public: // constructors - barGoLink(int row_count); - ~barGoLink(); + explicit BarGoLink(int row_count); + explicit BarGoLink(uint32 row_count); // row_count < ACE_INT32_MAX + explicit BarGoLink(uint64 row_count); // row_count < ACE_INT32_MAX + ~BarGoLink(); public: // modifiers - void step( void ); + void step(); static void SetOutputState(bool on); private: + void init(int row_count); + static bool m_showOutput; // not recommended change with existed active bar static char const * const empty; static char const * const full; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index eb88628c944..0449c3e5dfd 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 "11535" + #define REVISION_NR "11629" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 12e301d1823..eb5085920aa 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ - #define REVISION_DB_CHARACTERS "required_11436_01_characters_character_queststatus" - #define REVISION_DB_MANGOS "required_11530_01_mangos_spell_proc_event" + #define REVISION_DB_CHARACTERS "required_11620_01_characters_character_equipmentsets" + #define REVISION_DB_MANGOS "required_11613_01_mangos_spell_bonus_data" #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" #endif // __REVISION_SQL_H__ diff --git a/win/VC100/g3dlite.vcxproj.filters b/win/VC100/g3dlite.vcxproj.filters index 4728c6004e2..a7836a99f68 100644 --- a/win/VC100/g3dlite.vcxproj.filters +++ b/win/VC100/g3dlite.vcxproj.filters @@ -3,9 +3,11 @@ {1fd8ff6c-4f21-4985-be06-a9082b53b059} + h;hpp;hxx;hm;inl;inc;xsd {46c5f23b-da25-4b0d-8e5e-c787c3462b5c} + cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx @@ -91,48 +93,118 @@ Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + Source Files + + Source Files + + + Source Files + + + Source Files + Source Files + + Source Files + + + Source Files + + + Source Files + Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + Source Files + + Source Files + + + Source Files + Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + Source Files + + Source Files + + + Source Files + Source Files + + Source Files + + + Source Files + Source Files diff --git a/win/VC100/mangosd.vcxproj b/win/VC100/mangosd.vcxproj index 55ae5eed78f..9e57bc989ad 100644 --- a/win/VC100/mangosd.vcxproj +++ b/win/VC100/mangosd.vcxproj @@ -179,7 +179,6 @@ ..\..\dep\lib\$(Platform)_$(Configuration);.\framework__$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) true $(TargetDir)$(TargetName).pdb - true $(TargetDir)$(TargetName).map Console true @@ -229,7 +228,6 @@ ..\..\dep\lib\$(Platform)_$(Configuration);.\framework__$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) true $(TargetDir)$(TargetName).pdb - true $(TargetDir)$(TargetName).map Console @@ -281,7 +279,6 @@ ..\..\dep\lib\$(Platform)_$(Configuration);.\framework__$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) true $(TargetDir)$(TargetName).pdb - true $(TargetDir)$(TargetName).map Console true @@ -332,7 +329,6 @@ ..\..\dep\lib\$(Platform)_$(Configuration);.\framework__$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) true $(TargetDir)$(TargetName).pdb - true $(TargetDir)$(TargetName).map Console false @@ -383,7 +379,6 @@ ..\..\dep\lib\$(Platform)_debug;.\framework__$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) true $(TargetDir)$(TargetName).pdb - true $(TargetDir)$(TargetName).map Console true @@ -434,7 +429,6 @@ ..\..\dep\lib\$(Platform)_debug;.\framework__$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) true $(TargetDir)$(TargetName).pdb - true $(TargetDir)$(TargetName).map Console false diff --git a/win/VC100/realmd.vcxproj b/win/VC100/realmd.vcxproj index b382ff7edee..06403e50c23 100644 --- a/win/VC100/realmd.vcxproj +++ b/win/VC100/realmd.vcxproj @@ -179,7 +179,6 @@ ..\..\dep\lib\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) true $(TargetDir)$(TargetName).pdb - true $(TargetDir)$(TargetName).map Console true @@ -223,7 +222,6 @@ ..\..\dep\lib\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) true $(TargetDir)$(TargetName).pdb - true $(TargetDir)$(TargetName).map Console false @@ -267,7 +265,6 @@ ..\..\dep\lib\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) true $(TargetDir)$(TargetName).pdb - true $(TargetDir)$(TargetName).map Console true @@ -312,7 +309,6 @@ ..\..\dep\lib\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) true $(TargetDir)$(TargetName).pdb - true $(TargetDir)$(TargetName).map Console false @@ -357,7 +353,6 @@ ..\..\dep\lib\$(Platform)_debug;%(AdditionalLibraryDirectories) true $(TargetDir)$(TargetName).pdb - true $(TargetDir)$(TargetName).map Console true @@ -402,7 +397,6 @@ ..\..\dep\lib\$(Platform)_debug;%(AdditionalLibraryDirectories) true $(TargetDir)$(TargetName).pdb - true $(TargetDir)$(TargetName).map Console false diff --git a/win/VC80/mangosd.vcproj b/win/VC80/mangosd.vcproj index 8eaa70cd96d..b62be796a65 100644 --- a/win/VC80/mangosd.vcproj +++ b/win/VC80/mangosd.vcproj @@ -85,7 +85,6 @@ AdditionalLibraryDirectories=""..\..\dep\lib\$(PlatformName)_$(ConfigurationName)";".\framework__$(PlatformName)_$(ConfigurationName)"" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.map" SubSystem="1" StackReserveSize="4194304" @@ -187,7 +186,6 @@ AdditionalLibraryDirectories=""..\..\dep\lib\$(PlatformName)_$(ConfigurationName)";".\framework__$(PlatformName)_$(ConfigurationName)"" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.map" SubSystem="1" StackReserveSize="4194304" @@ -289,7 +287,6 @@ AdditionalLibraryDirectories=""..\..\dep\lib\$(PlatformName)_$(ConfigurationName)";".\framework__$(PlatformName)_$(ConfigurationName)"" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.map" SubSystem="1" StackReserveSize="4194304" @@ -391,7 +388,6 @@ AdditionalLibraryDirectories=""..\..\dep\lib\$(PlatformName)_$(ConfigurationName)";".\framework__$(PlatformName)_$(ConfigurationName)"" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.map" SubSystem="1" StackReserveSize="4194304" @@ -493,7 +489,6 @@ AdditionalLibraryDirectories=""..\..\dep\lib\$(PlatformName)_debug";".\framework__$(PlatformName)_$(ConfigurationName)"" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.map" SubSystem="1" StackReserveSize="4194304" @@ -595,7 +590,6 @@ AdditionalLibraryDirectories=""..\..\dep\lib\$(PlatformName)_debug";".\framework__$(PlatformName)_$(ConfigurationName)"" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.map" SubSystem="1" StackReserveSize="4194304" diff --git a/win/VC80/realmd.vcproj b/win/VC80/realmd.vcproj index d85f3620957..37aea83e721 100644 --- a/win/VC80/realmd.vcproj +++ b/win/VC80/realmd.vcproj @@ -85,7 +85,6 @@ AdditionalLibraryDirectories="..\..\dep\lib\$(PlatformName)_$(ConfigurationName)" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.map" SubSystem="1" LargeAddressAware="2" @@ -183,7 +182,6 @@ AdditionalLibraryDirectories="..\..\dep\lib\$(PlatformName)_$(ConfigurationName)" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.map" SubSystem="1" TargetMachine="17" @@ -280,7 +278,6 @@ AdditionalLibraryDirectories="..\..\dep\lib\$(PlatformName)_$(ConfigurationName)" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.map" SubSystem="1" LargeAddressAware="2" @@ -378,7 +375,6 @@ AdditionalLibraryDirectories="..\..\dep\lib\$(PlatformName)_$(ConfigurationName)" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.map" SubSystem="1" TargetMachine="17" @@ -476,7 +472,6 @@ AdditionalLibraryDirectories="..\..\dep\lib\$(PlatformName)_debug" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.map" SubSystem="1" LargeAddressAware="2" @@ -574,7 +569,6 @@ AdditionalLibraryDirectories="..\..\dep\lib\$(PlatformName)_debug" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.map" SubSystem="1" TargetMachine="17" diff --git a/win/VC90/mangosd.vcproj b/win/VC90/mangosd.vcproj index 7fe60dfd81f..3b4900263dd 100644 --- a/win/VC90/mangosd.vcproj +++ b/win/VC90/mangosd.vcproj @@ -87,7 +87,6 @@ AdditionalLibraryDirectories=""..\..\dep\lib\$(PlatformName)_$(ConfigurationName)";".\framework__$(PlatformName)_$(ConfigurationName)"" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.map" SubSystem="1" StackReserveSize="4194304" @@ -188,7 +187,6 @@ AdditionalLibraryDirectories=""..\..\dep\lib\$(PlatformName)_$(ConfigurationName)";".\framework__$(PlatformName)_$(ConfigurationName)"" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.map" SubSystem="1" StackReserveSize="4194304" @@ -290,7 +288,6 @@ AdditionalLibraryDirectories=""..\..\dep\lib\$(PlatformName)_$(ConfigurationName)";".\framework__$(PlatformName)_$(ConfigurationName)"" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.map" SubSystem="1" StackReserveSize="4194304" @@ -392,7 +389,6 @@ AdditionalLibraryDirectories=""..\..\dep\lib\$(PlatformName)_$(ConfigurationName)";".\framework__$(PlatformName)_$(ConfigurationName)"" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.map" SubSystem="1" StackReserveSize="4194304" @@ -494,7 +490,6 @@ AdditionalLibraryDirectories=""..\..\dep\lib\$(PlatformName)_debug";".\framework__$(PlatformName)_$(ConfigurationName)"" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.map" SubSystem="1" StackReserveSize="4194304" @@ -596,7 +591,6 @@ AdditionalLibraryDirectories=""..\..\dep\lib\$(PlatformName)_debug";".\framework__$(PlatformName)_$(ConfigurationName)"" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.map" SubSystem="1" StackReserveSize="4194304" diff --git a/win/VC90/realmd.vcproj b/win/VC90/realmd.vcproj index d37e6892cad..b456967b173 100644 --- a/win/VC90/realmd.vcproj +++ b/win/VC90/realmd.vcproj @@ -87,7 +87,6 @@ AdditionalLibraryDirectories="..\..\dep\lib\$(PlatformName)_$(ConfigurationName)" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.map" SubSystem="1" LargeAddressAware="2" @@ -184,7 +183,6 @@ AdditionalLibraryDirectories="..\..\dep\lib\$(PlatformName)_$(ConfigurationName)" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.map" SubSystem="1" RandomizedBaseAddress="1" @@ -281,7 +279,6 @@ AdditionalLibraryDirectories="..\..\dep\lib\$(PlatformName)_$(ConfigurationName)" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.map" SubSystem="1" LargeAddressAware="2" @@ -379,7 +376,6 @@ AdditionalLibraryDirectories="..\..\dep\lib\$(PlatformName)_$(ConfigurationName)" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.map" SubSystem="1" RandomizedBaseAddress="1" @@ -477,7 +473,6 @@ AdditionalLibraryDirectories="..\..\dep\lib\$(PlatformName)_debug" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.map" SubSystem="1" LargeAddressAware="2" @@ -575,7 +570,6 @@ AdditionalLibraryDirectories="..\..\dep\lib\$(PlatformName)_debug" GenerateDebugInformation="true" ProgramDatabaseFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.pdb" - GenerateMapFile="true" MapFileName="..\..\bin\$(PlatformName)_$(ConfigurationName)\realmd.map" SubSystem="1" RandomizedBaseAddress="1"