diff --git a/sql/characters.sql b/sql/characters.sql index 0858b64cb..0876bc6ef 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_8104_01_characters` bit(1) default NULL + `required_8339_02_characters_character_battleground_data` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; -- @@ -232,13 +232,6 @@ CREATE TABLE `characters` ( `death_expire_time` bigint(20) unsigned NOT NULL default '0', `taxi_path` text, `arena_pending_points` int(10) UNSIGNED NOT NULL default '0', - `bgid` int(10) unsigned NOT NULL default '0', - `bgteam` int(10) unsigned NOT NULL default '0', - `bgmap` int(10) unsigned NOT NULL default '0', - `bgx` float NOT NULL default '0', - `bgy` float NOT NULL default '0', - `bgz` float NOT NULL default '0', - `bgo` float NOT NULL default '0', PRIMARY KEY (`guid`), KEY `idx_account` (`account`), KEY `idx_online` (`online`), @@ -346,6 +339,35 @@ LOCK TABLES `character_aura` WRITE; /*!40000 ALTER TABLE `character_aura` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `character_battleground_data` +-- + +DROP TABLE IF EXISTS `character_battleground_data`; +CREATE TABLE `character_battleground_data` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `instance_id` int(11) unsigned NOT NULL default '0', + `team` int(11) unsigned NOT NULL default '0', + `join_x` float NOT NULL default '0', + `join_y` float NOT NULL default '0', + `join_z` float NOT NULL default '0', + `join_o` float NOT NULL default '0', + `join_map` int(11) NOT NULL default '0', + `taxi_start` int(11) NOT NULL default '0', + `taxi_end` int(11) NOT NULL default '0', + `mount_spell` int(11) NOT NULL default '0', + PRIMARY KEY (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; + +-- +-- Dumping data for table `character_battleground_data` +-- + +LOCK TABLES `character_battleground_data` WRITE; +/*!40000 ALTER TABLE `character_battleground_data` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_battleground_data` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `character_declinedname` -- diff --git a/sql/mangos.sql b/sql/mangos.sql index 9f997595b..7c0a3bea7 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`; CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, - `required_8310_01_mangos_spell_proc_event` bit(1) default NULL + `required_8342_01_mangos_spell_proc_event` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -17832,6 +17832,7 @@ INSERT INTO `spell_proc_event` VALUES (53380, 0x00000000, 10, 0x00800000, 0x00020000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53381, 0x00000000, 10, 0x00800000, 0x00020000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53382, 0x00000000, 10, 0x00800000, 0x00020000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53397, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53486, 0x00000000, 10, 0x00800000, 0x00028000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53488, 0x00000000, 10, 0x00800000, 0x00028000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53501, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), diff --git a/sql/realmd.sql b/sql/realmd.sql index f534432c3..9809f7043 100644 --- a/sql/realmd.sql +++ b/sql/realmd.sql @@ -21,7 +21,7 @@ DROP TABLE IF EXISTS `realmd_db_version`; CREATE TABLE `realmd_db_version` ( - `required_7938_01_realmd_account` bit(1) default NULL + `required_8332_01_realmd_realmcharacters` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; -- @@ -133,7 +133,8 @@ CREATE TABLE `realmcharacters` ( `realmid` int(11) unsigned NOT NULL default '0', `acctid` bigint(20) unsigned NOT NULL, `numchars` tinyint(3) unsigned NOT NULL default '0', - PRIMARY KEY (`realmid`,`acctid`) + PRIMARY KEY (`realmid`,`acctid`), + KEY (acctid) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Realm Character Tracker'; -- diff --git a/sql/updates/2008_12_22_01_mangos_creature_equip_template.sql b/sql/updates/0.13/2008_12_22_01_mangos_creature_equip_template.sql similarity index 100% rename from sql/updates/2008_12_22_01_mangos_creature_equip_template.sql rename to sql/updates/0.13/2008_12_22_01_mangos_creature_equip_template.sql diff --git a/sql/updates/2008_12_22_02_characters_character_pet.sql b/sql/updates/0.13/2008_12_22_02_characters_character_pet.sql similarity index 100% rename from sql/updates/2008_12_22_02_characters_character_pet.sql rename to sql/updates/0.13/2008_12_22_02_characters_character_pet.sql diff --git a/sql/updates/2008_12_22_03_mangos_item_template.sql b/sql/updates/0.13/2008_12_22_03_mangos_item_template.sql similarity index 100% rename from sql/updates/2008_12_22_03_mangos_item_template.sql rename to sql/updates/0.13/2008_12_22_03_mangos_item_template.sql diff --git a/sql/updates/2008_12_22_04_mangos_item_template.sql b/sql/updates/0.13/2008_12_22_04_mangos_item_template.sql similarity index 100% rename from sql/updates/2008_12_22_04_mangos_item_template.sql rename to sql/updates/0.13/2008_12_22_04_mangos_item_template.sql diff --git a/sql/updates/2008_12_22_05_characters_account_data.sql b/sql/updates/0.13/2008_12_22_05_characters_account_data.sql similarity index 100% rename from sql/updates/2008_12_22_05_characters_account_data.sql rename to sql/updates/0.13/2008_12_22_05_characters_account_data.sql diff --git a/sql/updates/2008_12_22_06_characters_character_achievement.sql b/sql/updates/0.13/2008_12_22_06_characters_character_achievement.sql similarity index 100% rename from sql/updates/2008_12_22_06_characters_character_achievement.sql rename to sql/updates/0.13/2008_12_22_06_characters_character_achievement.sql diff --git a/sql/updates/2008_12_22_07_mangos_quest_template.sql b/sql/updates/0.13/2008_12_22_07_mangos_quest_template.sql similarity index 100% rename from sql/updates/2008_12_22_07_mangos_quest_template.sql rename to sql/updates/0.13/2008_12_22_07_mangos_quest_template.sql diff --git a/sql/updates/2008_12_22_08_mangos_milling_loot_template.sql b/sql/updates/0.13/2008_12_22_08_mangos_milling_loot_template.sql similarity index 100% rename from sql/updates/2008_12_22_08_mangos_milling_loot_template.sql rename to sql/updates/0.13/2008_12_22_08_mangos_milling_loot_template.sql diff --git a/sql/updates/2008_12_22_09_mangos_spell_affect.sql b/sql/updates/0.13/2008_12_22_09_mangos_spell_affect.sql similarity index 100% rename from sql/updates/2008_12_22_09_mangos_spell_affect.sql rename to sql/updates/0.13/2008_12_22_09_mangos_spell_affect.sql diff --git a/sql/updates/2008_12_22_10_mangos_string.sql b/sql/updates/0.13/2008_12_22_10_mangos_string.sql similarity index 100% rename from sql/updates/2008_12_22_10_mangos_string.sql rename to sql/updates/0.13/2008_12_22_10_mangos_string.sql diff --git a/sql/updates/2008_12_22_11_mangos_player_classlevelstats.sql b/sql/updates/0.13/2008_12_22_11_mangos_player_classlevelstats.sql similarity index 100% rename from sql/updates/2008_12_22_11_mangos_player_classlevelstats.sql rename to sql/updates/0.13/2008_12_22_11_mangos_player_classlevelstats.sql diff --git a/sql/updates/2008_12_22_12_mangos_player_levelstats.sql b/sql/updates/0.13/2008_12_22_12_mangos_player_levelstats.sql similarity index 100% rename from sql/updates/2008_12_22_12_mangos_player_levelstats.sql rename to sql/updates/0.13/2008_12_22_12_mangos_player_levelstats.sql diff --git a/sql/updates/2008_12_22_13_mangos_item_template.sql b/sql/updates/0.13/2008_12_22_13_mangos_item_template.sql similarity index 100% rename from sql/updates/2008_12_22_13_mangos_item_template.sql rename to sql/updates/0.13/2008_12_22_13_mangos_item_template.sql diff --git a/sql/updates/2008_12_22_14_mangos_playercreateinfo.sql b/sql/updates/0.13/2008_12_22_14_mangos_playercreateinfo.sql similarity index 100% rename from sql/updates/2008_12_22_14_mangos_playercreateinfo.sql rename to sql/updates/0.13/2008_12_22_14_mangos_playercreateinfo.sql diff --git a/sql/updates/2008_12_22_15_mangos_playercreateinfo_action.sql b/sql/updates/0.13/2008_12_22_15_mangos_playercreateinfo_action.sql similarity index 100% rename from sql/updates/2008_12_22_15_mangos_playercreateinfo_action.sql rename to sql/updates/0.13/2008_12_22_15_mangos_playercreateinfo_action.sql diff --git a/sql/updates/2008_12_22_16_mangos_playercreateinfo_spell.sql b/sql/updates/0.13/2008_12_22_16_mangos_playercreateinfo_spell.sql similarity index 100% rename from sql/updates/2008_12_22_16_mangos_playercreateinfo_spell.sql rename to sql/updates/0.13/2008_12_22_16_mangos_playercreateinfo_spell.sql diff --git a/sql/updates/2008_12_22_17_mangos_item_template.sql b/sql/updates/0.13/2008_12_22_17_mangos_item_template.sql similarity index 100% rename from sql/updates/2008_12_22_17_mangos_item_template.sql rename to sql/updates/0.13/2008_12_22_17_mangos_item_template.sql diff --git a/sql/updates/2008_12_22_18_characters_characters.sql b/sql/updates/0.13/2008_12_22_18_characters_characters.sql similarity index 100% rename from sql/updates/2008_12_22_18_characters_characters.sql rename to sql/updates/0.13/2008_12_22_18_characters_characters.sql diff --git a/sql/updates/2008_12_22_19_characters_item_instance.sql b/sql/updates/0.13/2008_12_22_19_characters_item_instance.sql similarity index 100% rename from sql/updates/2008_12_22_19_characters_item_instance.sql rename to sql/updates/0.13/2008_12_22_19_characters_item_instance.sql diff --git a/sql/updates/6936_01_mangos_spell_chain.sql b/sql/updates/0.13/6936_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/6936_01_mangos_spell_chain.sql rename to sql/updates/0.13/6936_01_mangos_spell_chain.sql diff --git a/sql/updates/6939_01_mangos_quest_template.sql b/sql/updates/0.13/6939_01_mangos_quest_template.sql similarity index 100% rename from sql/updates/6939_01_mangos_quest_template.sql rename to sql/updates/0.13/6939_01_mangos_quest_template.sql diff --git a/sql/updates/6940_01_mangos_spell_learn_spell.sql b/sql/updates/0.13/6940_01_mangos_spell_learn_spell.sql similarity index 100% rename from sql/updates/6940_01_mangos_spell_learn_spell.sql rename to sql/updates/0.13/6940_01_mangos_spell_learn_spell.sql diff --git a/sql/updates/6941_01_mangos_spell_learn_spell.sql b/sql/updates/0.13/6941_01_mangos_spell_learn_spell.sql similarity index 100% rename from sql/updates/6941_01_mangos_spell_learn_spell.sql rename to sql/updates/0.13/6941_01_mangos_spell_learn_spell.sql diff --git a/sql/updates/6944_01_mangos_mangos_string.sql b/sql/updates/0.13/6944_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/6944_01_mangos_mangos_string.sql rename to sql/updates/0.13/6944_01_mangos_mangos_string.sql diff --git a/sql/updates/6958_01_mangos_spell_proc_event.sql b/sql/updates/0.13/6958_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/6958_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/6958_01_mangos_spell_proc_event.sql diff --git a/sql/updates/6960_01_mangos_command.sql b/sql/updates/0.13/6960_01_mangos_command.sql similarity index 100% rename from sql/updates/6960_01_mangos_command.sql rename to sql/updates/0.13/6960_01_mangos_command.sql diff --git a/sql/updates/6960_02_mangos_string.sql b/sql/updates/0.13/6960_02_mangos_string.sql similarity index 100% rename from sql/updates/6960_02_mangos_string.sql rename to sql/updates/0.13/6960_02_mangos_string.sql diff --git a/sql/updates/6961_01_mangos_command.sql b/sql/updates/0.13/6961_01_mangos_command.sql similarity index 100% rename from sql/updates/6961_01_mangos_command.sql rename to sql/updates/0.13/6961_01_mangos_command.sql diff --git a/sql/updates/6970_01_mangos_playercreateinfo.sql b/sql/updates/0.13/6970_01_mangos_playercreateinfo.sql similarity index 100% rename from sql/updates/6970_01_mangos_playercreateinfo.sql rename to sql/updates/0.13/6970_01_mangos_playercreateinfo.sql diff --git a/sql/updates/6976_01_realmd_realmd_db_version.sql b/sql/updates/0.13/6976_01_realmd_realmd_db_version.sql similarity index 100% rename from sql/updates/6976_01_realmd_realmd_db_version.sql rename to sql/updates/0.13/6976_01_realmd_realmd_db_version.sql diff --git a/sql/updates/6976_02_characters_character_db_version.sql b/sql/updates/0.13/6976_02_characters_character_db_version.sql similarity index 100% rename from sql/updates/6976_02_characters_character_db_version.sql rename to sql/updates/0.13/6976_02_characters_character_db_version.sql diff --git a/sql/updates/7002_01_mangos_spell_chain.sql b/sql/updates/0.13/7002_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/7002_01_mangos_spell_chain.sql rename to sql/updates/0.13/7002_01_mangos_spell_chain.sql diff --git a/sql/updates/7015_01_mangos_item_template.sql b/sql/updates/0.13/7015_01_mangos_item_template.sql similarity index 100% rename from sql/updates/7015_01_mangos_item_template.sql rename to sql/updates/0.13/7015_01_mangos_item_template.sql diff --git a/sql/updates/7024_01_mangos_spell_chain.sql b/sql/updates/0.13/7024_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/7024_01_mangos_spell_chain.sql rename to sql/updates/0.13/7024_01_mangos_spell_chain.sql diff --git a/sql/updates/7026_01_mangos_battleground_template.sql b/sql/updates/0.13/7026_01_mangos_battleground_template.sql similarity index 100% rename from sql/updates/7026_01_mangos_battleground_template.sql rename to sql/updates/0.13/7026_01_mangos_battleground_template.sql diff --git a/sql/updates/7031_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7031_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7031_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7031_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7033_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7033_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7033_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7033_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7034_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7034_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7034_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7034_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7040_01_mangos_achievement_reward.sql b/sql/updates/0.13/7040_01_mangos_achievement_reward.sql similarity index 100% rename from sql/updates/7040_01_mangos_achievement_reward.sql rename to sql/updates/0.13/7040_01_mangos_achievement_reward.sql diff --git a/sql/updates/7044_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7044_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7044_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7044_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7047_01_characters_character_spell.sql b/sql/updates/0.13/7047_01_characters_character_spell.sql similarity index 100% rename from sql/updates/7047_01_characters_character_spell.sql rename to sql/updates/0.13/7047_01_characters_character_spell.sql diff --git a/sql/updates/7047_02_mangos_playercreateinfo_action.sql b/sql/updates/0.13/7047_02_mangos_playercreateinfo_action.sql similarity index 100% rename from sql/updates/7047_02_mangos_playercreateinfo_action.sql rename to sql/updates/0.13/7047_02_mangos_playercreateinfo_action.sql diff --git a/sql/updates/7047_03_mangos_playercreateinfo_spell.sql b/sql/updates/0.13/7047_03_mangos_playercreateinfo_spell.sql similarity index 100% rename from sql/updates/7047_03_mangos_playercreateinfo_spell.sql rename to sql/updates/0.13/7047_03_mangos_playercreateinfo_spell.sql diff --git a/sql/updates/7050_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7050_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7050_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7050_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7051_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7051_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7051_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7051_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7052_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7052_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7052_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7052_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7053_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7053_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7053_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7053_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7056_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7056_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7056_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7056_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7059_01_characters_character_spell.sql b/sql/updates/0.13/7059_01_characters_character_spell.sql similarity index 100% rename from sql/updates/7059_01_characters_character_spell.sql rename to sql/updates/0.13/7059_01_characters_character_spell.sql diff --git a/sql/updates/7059_02_characters_pet_spell.sql b/sql/updates/0.13/7059_02_characters_pet_spell.sql similarity index 100% rename from sql/updates/7059_02_characters_pet_spell.sql rename to sql/updates/0.13/7059_02_characters_pet_spell.sql diff --git a/sql/updates/7060_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7060_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7060_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7060_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7061_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7061_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7061_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7061_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7063_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7063_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7063_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7063_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7067_01_mangos_playercreateinfo_spell.sql b/sql/updates/0.13/7067_01_mangos_playercreateinfo_spell.sql similarity index 100% rename from sql/updates/7067_01_mangos_playercreateinfo_spell.sql rename to sql/updates/0.13/7067_01_mangos_playercreateinfo_spell.sql diff --git a/sql/updates/7067_02_mangos_spell_learn_spell.sql b/sql/updates/0.13/7067_02_mangos_spell_learn_spell.sql similarity index 100% rename from sql/updates/7067_02_mangos_spell_learn_spell.sql rename to sql/updates/0.13/7067_02_mangos_spell_learn_spell.sql diff --git a/sql/updates/7067_03_characters_character_spell.sql b/sql/updates/0.13/7067_03_characters_character_spell.sql similarity index 100% rename from sql/updates/7067_03_characters_character_spell.sql rename to sql/updates/0.13/7067_03_characters_character_spell.sql diff --git a/sql/updates/7074_01_mangos_playercreateinfo_spell.sql b/sql/updates/0.13/7074_01_mangos_playercreateinfo_spell.sql similarity index 100% rename from sql/updates/7074_01_mangos_playercreateinfo_spell.sql rename to sql/updates/0.13/7074_01_mangos_playercreateinfo_spell.sql diff --git a/sql/updates/7075_01_characters_character_spell.sql b/sql/updates/0.13/7075_01_characters_character_spell.sql similarity index 100% rename from sql/updates/7075_01_characters_character_spell.sql rename to sql/updates/0.13/7075_01_characters_character_spell.sql diff --git a/sql/updates/7075_02_mangos_spell_learn_spell.sql b/sql/updates/0.13/7075_02_mangos_spell_learn_spell.sql similarity index 100% rename from sql/updates/7075_02_mangos_spell_learn_spell.sql rename to sql/updates/0.13/7075_02_mangos_spell_learn_spell.sql diff --git a/sql/updates/7077_01_characters_character_spell.sql b/sql/updates/0.13/7077_01_characters_character_spell.sql similarity index 100% rename from sql/updates/7077_01_characters_character_spell.sql rename to sql/updates/0.13/7077_01_characters_character_spell.sql diff --git a/sql/updates/7078_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7078_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7078_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7078_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7092_01_mangos_player_xp_for_level.sql b/sql/updates/0.13/7092_01_mangos_player_xp_for_level.sql similarity index 100% rename from sql/updates/7092_01_mangos_player_xp_for_level.sql rename to sql/updates/0.13/7092_01_mangos_player_xp_for_level.sql diff --git a/sql/updates/7097_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7097_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7097_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7097_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7100_01_characters_character_spell.sql b/sql/updates/0.13/7100_01_characters_character_spell.sql similarity index 100% rename from sql/updates/7100_01_characters_character_spell.sql rename to sql/updates/0.13/7100_01_characters_character_spell.sql diff --git a/sql/updates/7107_01_mangos_string.sql b/sql/updates/0.13/7107_01_mangos_string.sql similarity index 100% rename from sql/updates/7107_01_mangos_string.sql rename to sql/updates/0.13/7107_01_mangos_string.sql diff --git a/sql/updates/7113_01_characters_character_achievement_progress.sql b/sql/updates/0.13/7113_01_characters_character_achievement_progress.sql similarity index 100% rename from sql/updates/7113_01_characters_character_achievement_progress.sql rename to sql/updates/0.13/7113_01_characters_character_achievement_progress.sql diff --git a/sql/updates/7118_01_mangos_skill_discovery_template.sql b/sql/updates/0.13/7118_01_mangos_skill_discovery_template.sql similarity index 100% rename from sql/updates/7118_01_mangos_skill_discovery_template.sql rename to sql/updates/0.13/7118_01_mangos_skill_discovery_template.sql diff --git a/sql/updates/7133_01_mangos_skill_discovery_template.sql b/sql/updates/0.13/7133_01_mangos_skill_discovery_template.sql similarity index 100% rename from sql/updates/7133_01_mangos_skill_discovery_template.sql rename to sql/updates/0.13/7133_01_mangos_skill_discovery_template.sql diff --git a/sql/updates/7133_02_mangos_spell_loot_template.sql b/sql/updates/0.13/7133_02_mangos_spell_loot_template.sql similarity index 100% rename from sql/updates/7133_02_mangos_spell_loot_template.sql rename to sql/updates/0.13/7133_02_mangos_spell_loot_template.sql diff --git a/sql/updates/7141_01_mangos_instance_template.sql b/sql/updates/0.13/7141_01_mangos_instance_template.sql similarity index 100% rename from sql/updates/7141_01_mangos_instance_template.sql rename to sql/updates/0.13/7141_01_mangos_instance_template.sql diff --git a/sql/updates/7147_01_mangos_creature_template.sql b/sql/updates/0.13/7147_01_mangos_creature_template.sql similarity index 100% rename from sql/updates/7147_01_mangos_creature_template.sql rename to sql/updates/0.13/7147_01_mangos_creature_template.sql diff --git a/sql/updates/7149_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7149_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7149_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7149_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7150_01_mangos_playercreateinfo_spell.sql b/sql/updates/0.13/7150_01_mangos_playercreateinfo_spell.sql similarity index 100% rename from sql/updates/7150_01_mangos_playercreateinfo_spell.sql rename to sql/updates/0.13/7150_01_mangos_playercreateinfo_spell.sql diff --git a/sql/updates/7156_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7156_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7156_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7156_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7168_01_mangos_command.sql b/sql/updates/0.13/7168_01_mangos_command.sql similarity index 100% rename from sql/updates/7168_01_mangos_command.sql rename to sql/updates/0.13/7168_01_mangos_command.sql diff --git a/sql/updates/7175_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7175_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7175_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7175_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7193_01_mangos_mangos_string.sql b/sql/updates/0.13/7193_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7193_01_mangos_mangos_string.sql rename to sql/updates/0.13/7193_01_mangos_mangos_string.sql diff --git a/sql/updates/7196_01_mangos_spell_chain.sql b/sql/updates/0.13/7196_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/7196_01_mangos_spell_chain.sql rename to sql/updates/0.13/7196_01_mangos_spell_chain.sql diff --git a/sql/updates/7196_02_mangos_spell_bonus_data.sql b/sql/updates/0.13/7196_02_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/7196_02_mangos_spell_bonus_data.sql rename to sql/updates/0.13/7196_02_mangos_spell_bonus_data.sql diff --git a/sql/updates/7198_01_characters_characters.sql b/sql/updates/0.13/7198_01_characters_characters.sql similarity index 100% rename from sql/updates/7198_01_characters_characters.sql rename to sql/updates/0.13/7198_01_characters_characters.sql diff --git a/sql/updates/7199_01_mangos_spell_bonus_data.sql b/sql/updates/0.13/7199_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/7199_01_mangos_spell_bonus_data.sql rename to sql/updates/0.13/7199_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/7199_02_mangos_spell_proc_event.sql b/sql/updates/0.13/7199_02_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7199_02_mangos_spell_proc_event.sql rename to sql/updates/0.13/7199_02_mangos_spell_proc_event.sql diff --git a/sql/updates/7205_01_mangos_spell_chain.sql b/sql/updates/0.13/7205_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/7205_01_mangos_spell_chain.sql rename to sql/updates/0.13/7205_01_mangos_spell_chain.sql diff --git a/sql/updates/7207_01_mangos_creature.sql b/sql/updates/0.13/7207_01_mangos_creature.sql similarity index 100% rename from sql/updates/7207_01_mangos_creature.sql rename to sql/updates/0.13/7207_01_mangos_creature.sql diff --git a/sql/updates/7207_02_mangos_gameobject.sql b/sql/updates/0.13/7207_02_mangos_gameobject.sql similarity index 100% rename from sql/updates/7207_02_mangos_gameobject.sql rename to sql/updates/0.13/7207_02_mangos_gameobject.sql diff --git a/sql/updates/7207_03_characters_corpse.sql b/sql/updates/0.13/7207_03_characters_corpse.sql similarity index 100% rename from sql/updates/7207_03_characters_corpse.sql rename to sql/updates/0.13/7207_03_characters_corpse.sql diff --git a/sql/updates/7209_01_mangos_spell_bonus_data.sql b/sql/updates/0.13/7209_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/7209_01_mangos_spell_bonus_data.sql rename to sql/updates/0.13/7209_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/7214_01_mangos_command.sql b/sql/updates/0.13/7214_01_mangos_command.sql similarity index 100% rename from sql/updates/7214_01_mangos_command.sql rename to sql/updates/0.13/7214_01_mangos_command.sql diff --git a/sql/updates/7214_02_mangos_mangos_string.sql b/sql/updates/0.13/7214_02_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7214_02_mangos_mangos_string.sql rename to sql/updates/0.13/7214_02_mangos_mangos_string.sql diff --git a/sql/updates/7230_01_mangos_spell_chain.sql b/sql/updates/0.13/7230_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/7230_01_mangos_spell_chain.sql rename to sql/updates/0.13/7230_01_mangos_spell_chain.sql diff --git a/sql/updates/7230_02_mangos_spell_bonus_data.sql b/sql/updates/0.13/7230_02_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/7230_02_mangos_spell_bonus_data.sql rename to sql/updates/0.13/7230_02_mangos_spell_bonus_data.sql diff --git a/sql/updates/7235_01_mangos_command.sql b/sql/updates/0.13/7235_01_mangos_command.sql similarity index 100% rename from sql/updates/7235_01_mangos_command.sql rename to sql/updates/0.13/7235_01_mangos_command.sql diff --git a/sql/updates/7242_01_mangos_spell_bonus_data.sql b/sql/updates/0.13/7242_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/7242_01_mangos_spell_bonus_data.sql rename to sql/updates/0.13/7242_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/7249_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7249_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7249_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7249_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7251_01_mangos_spell_chain.sql b/sql/updates/0.13/7251_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/7251_01_mangos_spell_chain.sql rename to sql/updates/0.13/7251_01_mangos_spell_chain.sql diff --git a/sql/updates/7251_02_characters_character_spell.sql b/sql/updates/0.13/7251_02_characters_character_spell.sql similarity index 100% rename from sql/updates/7251_02_characters_character_spell.sql rename to sql/updates/0.13/7251_02_characters_character_spell.sql diff --git a/sql/updates/7252_01_mangos_command.sql b/sql/updates/0.13/7252_01_mangos_command.sql similarity index 100% rename from sql/updates/7252_01_mangos_command.sql rename to sql/updates/0.13/7252_01_mangos_command.sql diff --git a/sql/updates/7252_02_mangos_mangos_string.sql b/sql/updates/0.13/7252_02_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7252_02_mangos_mangos_string.sql rename to sql/updates/0.13/7252_02_mangos_mangos_string.sql diff --git a/sql/updates/7255_01_characters_characters.sql b/sql/updates/0.13/7255_01_characters_characters.sql similarity index 100% rename from sql/updates/7255_01_characters_characters.sql rename to sql/updates/0.13/7255_01_characters_characters.sql diff --git a/sql/updates/7267_01_characters_auctionhouse.sql b/sql/updates/0.13/7267_01_characters_auctionhouse.sql similarity index 100% rename from sql/updates/7267_01_characters_auctionhouse.sql rename to sql/updates/0.13/7267_01_characters_auctionhouse.sql diff --git a/sql/updates/7290_01_mangos_command.sql b/sql/updates/0.13/7290_01_mangos_command.sql similarity index 100% rename from sql/updates/7290_01_mangos_command.sql rename to sql/updates/0.13/7290_01_mangos_command.sql diff --git a/sql/updates/7292_01_mangos_points_of_interest.sql b/sql/updates/0.13/7292_01_mangos_points_of_interest.sql similarity index 100% rename from sql/updates/7292_01_mangos_points_of_interest.sql rename to sql/updates/0.13/7292_01_mangos_points_of_interest.sql diff --git a/sql/updates/7292_02_mangos_locales_points_of_interest.sql b/sql/updates/0.13/7292_02_mangos_locales_points_of_interest.sql similarity index 100% rename from sql/updates/7292_02_mangos_locales_points_of_interest.sql rename to sql/updates/0.13/7292_02_mangos_locales_points_of_interest.sql diff --git a/sql/updates/7303_01_mangos_pools.sql b/sql/updates/0.13/7303_01_mangos_pools.sql similarity index 100% rename from sql/updates/7303_01_mangos_pools.sql rename to sql/updates/0.13/7303_01_mangos_pools.sql diff --git a/sql/updates/7307_01_characters_arena_team_member.sql b/sql/updates/0.13/7307_01_characters_arena_team_member.sql similarity index 100% rename from sql/updates/7307_01_characters_arena_team_member.sql rename to sql/updates/0.13/7307_01_characters_arena_team_member.sql diff --git a/sql/updates/7312_01_mangos_mangos_string.sql b/sql/updates/0.13/7312_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7312_01_mangos_mangos_string.sql rename to sql/updates/0.13/7312_01_mangos_mangos_string.sql diff --git a/sql/updates/7314_01_characters_guild_rank.sql b/sql/updates/0.13/7314_01_characters_guild_rank.sql similarity index 100% rename from sql/updates/7314_01_characters_guild_rank.sql rename to sql/updates/0.13/7314_01_characters_guild_rank.sql diff --git a/sql/updates/7324_01_characters_character_spell.sql b/sql/updates/0.13/7324_01_characters_character_spell.sql similarity index 100% rename from sql/updates/7324_01_characters_character_spell.sql rename to sql/updates/0.13/7324_01_characters_character_spell.sql diff --git a/sql/updates/7324_02_characters_character_aura.sql b/sql/updates/0.13/7324_02_characters_character_aura.sql similarity index 100% rename from sql/updates/7324_02_characters_character_aura.sql rename to sql/updates/0.13/7324_02_characters_character_aura.sql diff --git a/sql/updates/7331_01_mangos_command.sql b/sql/updates/0.13/7331_01_mangos_command.sql similarity index 100% rename from sql/updates/7331_01_mangos_command.sql rename to sql/updates/0.13/7331_01_mangos_command.sql diff --git a/sql/updates/7332_01_mangos_command.sql b/sql/updates/0.13/7332_01_mangos_command.sql similarity index 100% rename from sql/updates/7332_01_mangos_command.sql rename to sql/updates/0.13/7332_01_mangos_command.sql diff --git a/sql/updates/7349_01_mangos_spell_area.sql b/sql/updates/0.13/7349_01_mangos_spell_area.sql similarity index 100% rename from sql/updates/7349_01_mangos_spell_area.sql rename to sql/updates/0.13/7349_01_mangos_spell_area.sql diff --git a/sql/updates/7369_01_mangos_quest_template.sql b/sql/updates/0.13/7369_01_mangos_quest_template.sql similarity index 100% rename from sql/updates/7369_01_mangos_quest_template.sql rename to sql/updates/0.13/7369_01_mangos_quest_template.sql diff --git a/sql/updates/7376_01_mangos_spell_area.sql b/sql/updates/0.13/7376_01_mangos_spell_area.sql similarity index 100% rename from sql/updates/7376_01_mangos_spell_area.sql rename to sql/updates/0.13/7376_01_mangos_spell_area.sql diff --git a/sql/updates/7382_01_mangos_creature_template.sql b/sql/updates/0.13/7382_01_mangos_creature_template.sql similarity index 100% rename from sql/updates/7382_01_mangos_creature_template.sql rename to sql/updates/0.13/7382_01_mangos_creature_template.sql diff --git a/sql/updates/7388_01_mangos_mangos_string.sql b/sql/updates/0.13/7388_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7388_01_mangos_mangos_string.sql rename to sql/updates/0.13/7388_01_mangos_mangos_string.sql diff --git a/sql/updates/7390_01_mangos_areatrigger_teleport.sql b/sql/updates/0.13/7390_01_mangos_areatrigger_teleport.sql similarity index 100% rename from sql/updates/7390_01_mangos_areatrigger_teleport.sql rename to sql/updates/0.13/7390_01_mangos_areatrigger_teleport.sql diff --git a/sql/updates/7393_01_mangos_game_event.sql b/sql/updates/0.13/7393_01_mangos_game_event.sql similarity index 100% rename from sql/updates/7393_01_mangos_game_event.sql rename to sql/updates/0.13/7393_01_mangos_game_event.sql diff --git a/sql/updates/7399_01_mangos_mangos_string.sql b/sql/updates/0.13/7399_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7399_01_mangos_mangos_string.sql rename to sql/updates/0.13/7399_01_mangos_mangos_string.sql diff --git a/sql/updates/7422_01_mangos_mangos_string.sql b/sql/updates/0.13/7422_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7422_01_mangos_mangos_string.sql rename to sql/updates/0.13/7422_01_mangos_mangos_string.sql diff --git a/sql/updates/7439_01_mangos_mangos_string.sql b/sql/updates/0.13/7439_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7439_01_mangos_mangos_string.sql rename to sql/updates/0.13/7439_01_mangos_mangos_string.sql diff --git a/sql/updates/7472_01_mangos_mangos_string.sql b/sql/updates/0.13/7472_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7472_01_mangos_mangos_string.sql rename to sql/updates/0.13/7472_01_mangos_mangos_string.sql diff --git a/sql/updates/7493_01_mangos_command.sql b/sql/updates/0.13/7493_01_mangos_command.sql similarity index 100% rename from sql/updates/7493_01_mangos_command.sql rename to sql/updates/0.13/7493_01_mangos_command.sql diff --git a/sql/updates/7495_01_mangos_mangos_string.sql b/sql/updates/0.13/7495_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7495_01_mangos_mangos_string.sql rename to sql/updates/0.13/7495_01_mangos_mangos_string.sql diff --git a/sql/updates/7503_01_mangos_command.sql b/sql/updates/0.13/7503_01_mangos_command.sql similarity index 100% rename from sql/updates/7503_01_mangos_command.sql rename to sql/updates/0.13/7503_01_mangos_command.sql diff --git a/sql/updates/7536_01_mangos_spell_chain.sql b/sql/updates/0.13/7536_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/7536_01_mangos_spell_chain.sql rename to sql/updates/0.13/7536_01_mangos_spell_chain.sql diff --git a/sql/updates/7544_01_mangos_uptime.sql b/sql/updates/0.13/7544_01_mangos_uptime.sql similarity index 100% rename from sql/updates/7544_01_mangos_uptime.sql rename to sql/updates/0.13/7544_01_mangos_uptime.sql diff --git a/sql/updates/7544_02_characters_uptime.sql b/sql/updates/0.13/7544_02_characters_uptime.sql similarity index 100% rename from sql/updates/7544_02_characters_uptime.sql rename to sql/updates/0.13/7544_02_characters_uptime.sql diff --git a/sql/updates/7546_01_characters_uptime.sql b/sql/updates/0.13/7546_01_characters_uptime.sql similarity index 100% rename from sql/updates/7546_01_characters_uptime.sql rename to sql/updates/0.13/7546_01_characters_uptime.sql diff --git a/sql/updates/7546_02_realmd_uptime.sql b/sql/updates/0.13/7546_02_realmd_uptime.sql similarity index 100% rename from sql/updates/7546_02_realmd_uptime.sql rename to sql/updates/0.13/7546_02_realmd_uptime.sql diff --git a/sql/updates/7558_01_mangos_mangos_string.sql b/sql/updates/0.13/7558_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7558_01_mangos_mangos_string.sql rename to sql/updates/0.13/7558_01_mangos_mangos_string.sql diff --git a/sql/updates/7558_02_mangos_command.sql b/sql/updates/0.13/7558_02_mangos_command.sql similarity index 100% rename from sql/updates/7558_02_mangos_command.sql rename to sql/updates/0.13/7558_02_mangos_command.sql diff --git a/sql/updates/7560_01_mangos_gameobject_template.sql b/sql/updates/0.13/7560_01_mangos_gameobject_template.sql similarity index 100% rename from sql/updates/7560_01_mangos_gameobject_template.sql rename to sql/updates/0.13/7560_01_mangos_gameobject_template.sql diff --git a/sql/updates/7565_01_mangos_mangos_string.sql b/sql/updates/0.13/7565_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7565_01_mangos_mangos_string.sql rename to sql/updates/0.13/7565_01_mangos_mangos_string.sql diff --git a/sql/updates/7568_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7568_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7568_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7568_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7615_01_mangos_command.sql b/sql/updates/0.13/7615_01_mangos_command.sql similarity index 100% rename from sql/updates/7615_01_mangos_command.sql rename to sql/updates/0.13/7615_01_mangos_command.sql diff --git a/sql/updates/7616_01_mangos_mangos_string.sql b/sql/updates/0.13/7616_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7616_01_mangos_mangos_string.sql rename to sql/updates/0.13/7616_01_mangos_mangos_string.sql diff --git a/sql/updates/7616_02_mangos_command.sql b/sql/updates/0.13/7616_02_mangos_command.sql similarity index 100% rename from sql/updates/7616_02_mangos_command.sql rename to sql/updates/0.13/7616_02_mangos_command.sql diff --git a/sql/updates/7622_01_mangos_creature_ai_scripts.sql b/sql/updates/0.13/7622_01_mangos_creature_ai_scripts.sql similarity index 100% rename from sql/updates/7622_01_mangos_creature_ai_scripts.sql rename to sql/updates/0.13/7622_01_mangos_creature_ai_scripts.sql diff --git a/sql/updates/7622_02_mangos_creature_ai_summons.sql b/sql/updates/0.13/7622_02_mangos_creature_ai_summons.sql similarity index 100% rename from sql/updates/7622_02_mangos_creature_ai_summons.sql rename to sql/updates/0.13/7622_02_mangos_creature_ai_summons.sql diff --git a/sql/updates/7622_03_mangos_creature_ai_texts.sql b/sql/updates/0.13/7622_03_mangos_creature_ai_texts.sql similarity index 100% rename from sql/updates/7622_03_mangos_creature_ai_texts.sql rename to sql/updates/0.13/7622_03_mangos_creature_ai_texts.sql diff --git a/sql/updates/7627_01_mangos_achievement_criteria_data.sql b/sql/updates/0.13/7627_01_mangos_achievement_criteria_data.sql similarity index 100% rename from sql/updates/7627_01_mangos_achievement_criteria_data.sql rename to sql/updates/0.13/7627_01_mangos_achievement_criteria_data.sql diff --git a/sql/updates/7633_01_mangos_achievement_criteria_data.sql b/sql/updates/0.13/7633_01_mangos_achievement_criteria_data.sql similarity index 100% rename from sql/updates/7633_01_mangos_achievement_criteria_data.sql rename to sql/updates/0.13/7633_01_mangos_achievement_criteria_data.sql diff --git a/sql/updates/7643_01_mangos_db_version.sql b/sql/updates/0.13/7643_01_mangos_db_version.sql similarity index 100% rename from sql/updates/7643_01_mangos_db_version.sql rename to sql/updates/0.13/7643_01_mangos_db_version.sql diff --git a/sql/updates/7643_02_mangos_mangos_string.sql b/sql/updates/0.13/7643_02_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7643_02_mangos_mangos_string.sql rename to sql/updates/0.13/7643_02_mangos_mangos_string.sql diff --git a/sql/updates/7644_01_characters_character_pet.sql b/sql/updates/0.13/7644_01_characters_character_pet.sql similarity index 100% rename from sql/updates/7644_01_characters_character_pet.sql rename to sql/updates/0.13/7644_01_characters_character_pet.sql diff --git a/sql/updates/7662_01_mangos_spell_chain.sql b/sql/updates/0.13/7662_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/7662_01_mangos_spell_chain.sql rename to sql/updates/0.13/7662_01_mangos_spell_chain.sql diff --git a/sql/updates/7662_02_mangos_spell_bonus_data.sql b/sql/updates/0.13/7662_02_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/7662_02_mangos_spell_bonus_data.sql rename to sql/updates/0.13/7662_02_mangos_spell_bonus_data.sql diff --git a/sql/updates/7705_01_mangos_command.sql b/sql/updates/0.13/7705_01_mangos_command.sql similarity index 100% rename from sql/updates/7705_01_mangos_command.sql rename to sql/updates/0.13/7705_01_mangos_command.sql diff --git a/sql/updates/7706_01_mangos_command.sql b/sql/updates/0.13/7706_01_mangos_command.sql similarity index 100% rename from sql/updates/7706_01_mangos_command.sql rename to sql/updates/0.13/7706_01_mangos_command.sql diff --git a/sql/updates/7714_01_mangos_command.sql b/sql/updates/0.13/7714_01_mangos_command.sql similarity index 100% rename from sql/updates/7714_01_mangos_command.sql rename to sql/updates/0.13/7714_01_mangos_command.sql diff --git a/sql/updates/7720_01_mangos_mangos_string.sql b/sql/updates/0.13/7720_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7720_01_mangos_mangos_string.sql rename to sql/updates/0.13/7720_01_mangos_mangos_string.sql diff --git a/sql/updates/7776_01_mangos_npc_spellclick_spells.sql b/sql/updates/0.13/7776_01_mangos_npc_spellclick_spells.sql similarity index 100% rename from sql/updates/7776_01_mangos_npc_spellclick_spells.sql rename to sql/updates/0.13/7776_01_mangos_npc_spellclick_spells.sql diff --git a/sql/updates/7777_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7777_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7777_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7777_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7782_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7782_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7782_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7782_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7796_01_mangos_command.sql b/sql/updates/0.13/7796_01_mangos_command.sql similarity index 100% rename from sql/updates/7796_01_mangos_command.sql rename to sql/updates/0.13/7796_01_mangos_command.sql diff --git a/sql/updates/7796_02_mangos_mangos_string.sql b/sql/updates/0.13/7796_02_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7796_02_mangos_mangos_string.sql rename to sql/updates/0.13/7796_02_mangos_mangos_string.sql diff --git a/sql/updates/7802_01_characters_character_achievement.sql b/sql/updates/0.13/7802_01_characters_character_achievement.sql similarity index 100% rename from sql/updates/7802_01_characters_character_achievement.sql rename to sql/updates/0.13/7802_01_characters_character_achievement.sql diff --git a/sql/updates/7802_02_characters_character_achievement_progress.sql b/sql/updates/0.13/7802_02_characters_character_achievement_progress.sql similarity index 100% rename from sql/updates/7802_02_characters_character_achievement_progress.sql rename to sql/updates/0.13/7802_02_characters_character_achievement_progress.sql diff --git a/sql/updates/7823_01_mangos_item_template.sql b/sql/updates/0.13/7823_01_mangos_item_template.sql similarity index 100% rename from sql/updates/7823_01_mangos_item_template.sql rename to sql/updates/0.13/7823_01_mangos_item_template.sql diff --git a/sql/updates/7830_01_mangos_spell_chain.sql b/sql/updates/0.13/7830_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/7830_01_mangos_spell_chain.sql rename to sql/updates/0.13/7830_01_mangos_spell_chain.sql diff --git a/sql/updates/7839_01_mangos_mangos_string.sql b/sql/updates/0.13/7839_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/7839_01_mangos_mangos_string.sql rename to sql/updates/0.13/7839_01_mangos_mangos_string.sql diff --git a/sql/updates/7839_02_mangos_command.sql b/sql/updates/0.13/7839_02_mangos_command.sql similarity index 100% rename from sql/updates/7839_02_mangos_command.sql rename to sql/updates/0.13/7839_02_mangos_command.sql diff --git a/sql/updates/7850_01_mangos_command.sql b/sql/updates/0.13/7850_01_mangos_command.sql similarity index 100% rename from sql/updates/7850_01_mangos_command.sql rename to sql/updates/0.13/7850_01_mangos_command.sql diff --git a/sql/updates/7855_01_mangos_pools.sql b/sql/updates/0.13/7855_01_mangos_pools.sql similarity index 100% rename from sql/updates/7855_01_mangos_pools.sql rename to sql/updates/0.13/7855_01_mangos_pools.sql diff --git a/sql/updates/7867_01_realmd_account.sql b/sql/updates/0.13/7867_01_realmd_account.sql similarity index 100% rename from sql/updates/7867_01_realmd_account.sql rename to sql/updates/0.13/7867_01_realmd_account.sql diff --git a/sql/updates/7879_01_mangos_spell_proc_event.sql b/sql/updates/0.13/7879_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/7879_01_mangos_spell_proc_event.sql rename to sql/updates/0.13/7879_01_mangos_spell_proc_event.sql diff --git a/sql/updates/7884_01_mangos_playercreateinfo_spell.sql b/sql/updates/0.13/7884_01_mangos_playercreateinfo_spell.sql similarity index 100% rename from sql/updates/7884_01_mangos_playercreateinfo_spell.sql rename to sql/updates/0.13/7884_01_mangos_playercreateinfo_spell.sql diff --git a/sql/updates/7884_02_mangos_playercreateinfo_action.sql b/sql/updates/0.13/7884_02_mangos_playercreateinfo_action.sql similarity index 100% rename from sql/updates/7884_02_mangos_playercreateinfo_action.sql rename to sql/updates/0.13/7884_02_mangos_playercreateinfo_action.sql diff --git a/sql/updates/7884_03_characters_character_spell.sql b/sql/updates/0.13/7884_03_characters_character_spell.sql similarity index 100% rename from sql/updates/7884_03_characters_character_spell.sql rename to sql/updates/0.13/7884_03_characters_character_spell.sql diff --git a/sql/updates/7884_04_characters_character_aura.sql b/sql/updates/0.13/7884_04_characters_character_aura.sql similarity index 100% rename from sql/updates/7884_04_characters_character_aura.sql rename to sql/updates/0.13/7884_04_characters_character_aura.sql diff --git a/sql/updates/7884_05_characters_character_action.sql b/sql/updates/0.13/7884_05_characters_character_action.sql similarity index 100% rename from sql/updates/7884_05_characters_character_action.sql rename to sql/updates/0.13/7884_05_characters_character_action.sql diff --git a/sql/updates/7886_01_mangos_petcreateinfo_spell.sql b/sql/updates/0.13/7886_01_mangos_petcreateinfo_spell.sql similarity index 100% rename from sql/updates/7886_01_mangos_petcreateinfo_spell.sql rename to sql/updates/0.13/7886_01_mangos_petcreateinfo_spell.sql diff --git a/sql/updates/7887_01_characters_character_pet.sql b/sql/updates/0.13/7887_01_characters_character_pet.sql similarity index 100% rename from sql/updates/7887_01_characters_character_pet.sql rename to sql/updates/0.13/7887_01_characters_character_pet.sql diff --git a/sql/updates/7893_01_mangos_command.sql b/sql/updates/0.13/7893_01_mangos_command.sql similarity index 100% rename from sql/updates/7893_01_mangos_command.sql rename to sql/updates/0.13/7893_01_mangos_command.sql diff --git a/sql/updates/7896_01_mangos_creature_template.sql b/sql/updates/0.13/7896_01_mangos_creature_template.sql similarity index 100% rename from sql/updates/7896_01_mangos_creature_template.sql rename to sql/updates/0.13/7896_01_mangos_creature_template.sql diff --git a/sql/updates/7902_01_mangos_pool_creature.sql b/sql/updates/0.13/7902_01_mangos_pool_creature.sql similarity index 100% rename from sql/updates/7902_01_mangos_pool_creature.sql rename to sql/updates/0.13/7902_01_mangos_pool_creature.sql diff --git a/sql/updates/7902_02_mangos_pool_gameobject.sql b/sql/updates/0.13/7902_02_mangos_pool_gameobject.sql similarity index 100% rename from sql/updates/7902_02_mangos_pool_gameobject.sql rename to sql/updates/0.13/7902_02_mangos_pool_gameobject.sql diff --git a/sql/updates/7903_01_characters_character_pet.sql b/sql/updates/0.13/7903_01_characters_character_pet.sql similarity index 100% rename from sql/updates/7903_01_characters_character_pet.sql rename to sql/updates/0.13/7903_01_characters_character_pet.sql diff --git a/sql/updates/7904_01_mangos_creature_template.sql b/sql/updates/0.13/7904_01_mangos_creature_template.sql similarity index 100% rename from sql/updates/7904_01_mangos_creature_template.sql rename to sql/updates/0.13/7904_01_mangos_creature_template.sql diff --git a/sql/updates/7908_01_mangos_creature_template.sql b/sql/updates/0.13/7908_01_mangos_creature_template.sql similarity index 100% rename from sql/updates/7908_01_mangos_creature_template.sql rename to sql/updates/0.13/7908_01_mangos_creature_template.sql diff --git a/sql/updates/7908_02_mangos_creature_addon.sql b/sql/updates/0.13/7908_02_mangos_creature_addon.sql similarity index 100% rename from sql/updates/7908_02_mangos_creature_addon.sql rename to sql/updates/0.13/7908_02_mangos_creature_addon.sql diff --git a/sql/updates/7908_03_mangos_creature_template_addon.sql b/sql/updates/0.13/7908_03_mangos_creature_template_addon.sql similarity index 100% rename from sql/updates/7908_03_mangos_creature_template_addon.sql rename to sql/updates/0.13/7908_03_mangos_creature_template_addon.sql diff --git a/sql/updates/7932_01_characters_character_pet.sql b/sql/updates/0.13/7932_01_characters_character_pet.sql similarity index 100% rename from sql/updates/7932_01_characters_character_pet.sql rename to sql/updates/0.13/7932_01_characters_character_pet.sql diff --git a/sql/updates/7938_01_realmd_account.sql b/sql/updates/0.13/7938_01_realmd_account.sql similarity index 100% rename from sql/updates/7938_01_realmd_account.sql rename to sql/updates/0.13/7938_01_realmd_account.sql diff --git a/sql/updates/7945_01_mangos_quest_template.sql b/sql/updates/0.13/7945_01_mangos_quest_template.sql similarity index 100% rename from sql/updates/7945_01_mangos_quest_template.sql rename to sql/updates/0.13/7945_01_mangos_quest_template.sql diff --git a/sql/updates/7980_01_mangos_item_required_target.sql b/sql/updates/0.13/7980_01_mangos_item_required_target.sql similarity index 100% rename from sql/updates/7980_01_mangos_item_required_target.sql rename to sql/updates/0.13/7980_01_mangos_item_required_target.sql diff --git a/sql/updates/8332_01_realmd_realmcharacters.sql b/sql/updates/8332_01_realmd_realmcharacters.sql new file mode 100644 index 000000000..ba051f48c --- /dev/null +++ b/sql/updates/8332_01_realmd_realmcharacters.sql @@ -0,0 +1,4 @@ +ALTER TABLE realmd_db_version CHANGE COLUMN required_7938_01_realmd_account required_8332_01_realmd_realmcharacters bit; + +ALTER TABLE realmcharacters + ADD KEY (acctid); diff --git a/sql/updates/8339_01_characters_characters.sql b/sql/updates/8339_01_characters_characters.sql new file mode 100644 index 000000000..54cc217a2 --- /dev/null +++ b/sql/updates/8339_01_characters_characters.sql @@ -0,0 +1,9 @@ +ALTER TABLE character_db_version CHANGE COLUMN required_8104_01_characters required_8339_01_characters_characters bit; + +ALTER TABLE characters DROP COLUMN bgid; +ALTER TABLE characters DROP COLUMN bgteam; +ALTER TABLE characters DROP COLUMN bgmap; +ALTER TABLE characters DROP COLUMN bgx; +ALTER TABLE characters DROP COLUMN bgy; +ALTER TABLE characters DROP COLUMN bgz; +ALTER TABLE characters DROP COLUMN bgo; diff --git a/sql/updates/8339_02_characters_character_battleground_data.sql b/sql/updates/8339_02_characters_character_battleground_data.sql new file mode 100644 index 000000000..e735c391f --- /dev/null +++ b/sql/updates/8339_02_characters_character_battleground_data.sql @@ -0,0 +1,17 @@ +ALTER TABLE character_db_version CHANGE COLUMN required_8339_01_characters_characters required_8339_02_characters_character_battleground_data bit; + +DROP TABLE IF EXISTS `character_battleground_data`; +CREATE TABLE `character_battleground_data` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `instance_id` int(11) unsigned NOT NULL default '0', + `team` int(11) unsigned NOT NULL default '0', + `join_x` float NOT NULL default '0', + `join_y` float NOT NULL default '0', + `join_z` float NOT NULL default '0', + `join_o` float NOT NULL default '0', + `join_map` int(11) NOT NULL default '0', + `taxi_start` int(11) NOT NULL default '0', + `taxi_end` int(11) NOT NULL default '0', + `mount_spell` int(11) NOT NULL default '0', + PRIMARY KEY (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; diff --git a/sql/updates/8342_01_mangos_spell_proc_event.sql b/sql/updates/8342_01_mangos_spell_proc_event.sql new file mode 100644 index 000000000..097534be3 --- /dev/null +++ b/sql/updates/8342_01_mangos_spell_proc_event.sql @@ -0,0 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_8310_01_mangos_spell_proc_event required_8342_01_mangos_spell_proc_event bit; + +DELETE FROM spell_proc_event WHERE entry IN (53397); +INSERT INTO spell_proc_event VALUES +(53397, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index fbe6d7a4d..9a9a36a56 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -25,193 +25,6 @@ pkgdatadir = $(datadir)/mangos/sql/updates ## Files to be installed # Install basic SQL files to datadir pkgdata_DATA = \ - 2008_12_22_01_mangos_creature_equip_template.sql \ - 2008_12_22_02_characters_character_pet.sql \ - 2008_12_22_03_mangos_item_template.sql \ - 2008_12_22_04_mangos_item_template.sql \ - 2008_12_22_05_characters_account_data.sql \ - 2008_12_22_06_characters_character_achievement.sql \ - 2008_12_22_07_mangos_quest_template.sql \ - 2008_12_22_08_mangos_milling_loot_template.sql \ - 2008_12_22_09_mangos_spell_affect.sql \ - 2008_12_22_10_mangos_string.sql \ - 2008_12_22_11_mangos_player_classlevelstats.sql \ - 2008_12_22_12_mangos_player_levelstats.sql \ - 2008_12_22_13_mangos_item_template.sql \ - 2008_12_22_14_mangos_playercreateinfo.sql \ - 2008_12_22_15_mangos_playercreateinfo_action.sql \ - 2008_12_22_16_mangos_playercreateinfo_spell.sql \ - 2008_12_22_17_mangos_item_template.sql \ - 2008_12_22_18_characters_characters.sql \ - 2008_12_22_19_characters_item_instance.sql \ - 6936_01_mangos_spell_chain.sql \ - 6939_01_mangos_quest_template.sql \ - 6940_01_mangos_spell_learn_spell.sql \ - 6941_01_mangos_spell_learn_spell.sql \ - 6944_01_mangos_mangos_string.sql \ - 6958_01_mangos_spell_proc_event.sql \ - 6960_01_mangos_command.sql \ - 6960_02_mangos_string.sql \ - 6961_01_mangos_command.sql \ - 6970_01_mangos_playercreateinfo.sql \ - 6976_01_realmd_realmd_db_version.sql \ - 6976_02_characters_character_db_version.sql \ - 7002_01_mangos_spell_chain.sql \ - 7015_01_mangos_item_template.sql \ - 7024_01_mangos_spell_chain.sql \ - 7026_01_mangos_battleground_template.sql \ - 7031_01_mangos_spell_proc_event.sql \ - 7033_01_mangos_spell_proc_event.sql \ - 7034_01_mangos_spell_proc_event.sql \ - 7040_01_mangos_achievement_reward.sql \ - 7044_01_mangos_spell_proc_event.sql \ - 7047_01_characters_character_spell.sql \ - 7047_02_mangos_playercreateinfo_action.sql \ - 7047_03_mangos_playercreateinfo_spell.sql \ - 7050_01_mangos_spell_proc_event.sql \ - 7051_01_mangos_spell_proc_event.sql \ - 7052_01_mangos_spell_proc_event.sql \ - 7053_01_mangos_spell_proc_event.sql \ - 7056_01_mangos_spell_proc_event.sql \ - 7059_01_characters_character_spell.sql \ - 7059_02_characters_pet_spell.sql \ - 7060_01_mangos_spell_proc_event.sql \ - 7061_01_mangos_spell_proc_event.sql \ - 7063_01_mangos_spell_proc_event.sql \ - 7067_01_mangos_playercreateinfo_spell.sql \ - 7067_02_mangos_spell_learn_spell.sql \ - 7067_03_characters_character_spell.sql \ - 7074_01_mangos_playercreateinfo_spell.sql \ - 7075_01_characters_character_spell.sql \ - 7075_02_mangos_spell_learn_spell.sql \ - 7077_01_characters_character_spell.sql \ - 7078_01_mangos_spell_proc_event.sql \ - 7092_01_mangos_player_xp_for_level.sql \ - 7097_01_mangos_spell_proc_event.sql \ - 7100_01_characters_character_spell.sql \ - 7107_01_mangos_string.sql \ - 7113_01_characters_character_achievement_progress.sql \ - 7118_01_mangos_skill_discovery_template.sql \ - 7133_01_mangos_skill_discovery_template.sql \ - 7133_02_mangos_spell_loot_template.sql \ - 7141_01_mangos_instance_template.sql \ - 7147_01_mangos_creature_template.sql \ - 7149_01_mangos_spell_proc_event.sql \ - 7150_01_mangos_playercreateinfo_spell.sql \ - 7156_01_mangos_spell_proc_event.sql \ - 7168_01_mangos_command.sql \ - 7175_01_mangos_spell_proc_event.sql \ - 7193_01_mangos_mangos_string.sql \ - 7196_01_mangos_spell_chain.sql \ - 7196_02_mangos_spell_bonus_data.sql \ - 7198_01_characters_characters.sql \ - 7199_01_mangos_spell_bonus_data.sql \ - 7199_02_mangos_spell_proc_event.sql \ - 7205_01_mangos_spell_chain.sql \ - 7207_01_mangos_creature.sql \ - 7207_02_mangos_gameobject.sql \ - 7207_03_characters_corpse.sql \ - 7209_01_mangos_spell_bonus_data.sql \ - 7214_01_mangos_command.sql \ - 7214_02_mangos_mangos_string.sql \ - 7230_01_mangos_spell_chain.sql \ - 7230_02_mangos_spell_bonus_data.sql \ - 7235_01_mangos_command.sql \ - 7242_01_mangos_spell_bonus_data.sql \ - 7249_01_mangos_spell_proc_event.sql \ - 7251_01_mangos_spell_chain.sql \ - 7251_02_characters_character_spell.sql \ - 7252_01_mangos_command.sql \ - 7252_02_mangos_mangos_string.sql \ - 7255_01_characters_characters.sql \ - 7267_01_characters_auctionhouse.sql \ - 7290_01_mangos_command.sql \ - 7292_01_mangos_points_of_interest.sql \ - 7292_02_mangos_locales_points_of_interest.sql \ - 7303_01_mangos_pools.sql \ - 7307_01_characters_arena_team_member.sql \ - 7312_01_mangos_mangos_string.sql \ - 7314_01_characters_guild_rank.sql \ - 7324_01_characters_character_spell.sql \ - 7324_02_characters_character_aura.sql \ - 7331_01_mangos_command.sql \ - 7332_01_mangos_command.sql \ - 7349_01_mangos_spell_area.sql \ - 7369_01_mangos_quest_template.sql \ - 7376_01_mangos_spell_area.sql \ - 7382_01_mangos_creature_template.sql \ - 7388_01_mangos_mangos_string.sql \ - 7390_01_mangos_areatrigger_teleport.sql \ - 7393_01_mangos_game_event.sql \ - 7399_01_mangos_mangos_string.sql \ - 7422_01_mangos_mangos_string.sql \ - 7439_01_mangos_mangos_string.sql \ - 7472_01_mangos_mangos_string.sql \ - 7493_01_mangos_command.sql \ - 7495_01_mangos_mangos_string.sql \ - 7503_01_mangos_command.sql \ - 7536_01_mangos_spell_chain.sql \ - 7544_01_mangos_uptime.sql \ - 7544_02_characters_uptime.sql \ - 7546_01_characters_uptime.sql \ - 7546_02_realmd_uptime.sql \ - 7558_01_mangos_mangos_string.sql \ - 7558_02_mangos_command.sql \ - 7560_01_mangos_gameobject_template.sql \ - 7565_01_mangos_mangos_string.sql \ - 7568_01_mangos_spell_proc_event.sql \ - 7615_01_mangos_command.sql \ - 7616_01_mangos_mangos_string.sql \ - 7616_02_mangos_command.sql \ - 7622_01_mangos_creature_ai_scripts.sql \ - 7622_02_mangos_creature_ai_summons.sql \ - 7622_03_mangos_creature_ai_texts.sql \ - 7627_01_mangos_achievement_criteria_data.sql \ - 7633_01_mangos_achievement_criteria_data.sql \ - 7643_01_mangos_db_version.sql \ - 7643_02_mangos_mangos_string.sql \ - 7644_01_characters_character_pet.sql \ - 7662_01_mangos_spell_chain.sql \ - 7662_02_mangos_spell_bonus_data.sql \ - 7705_01_mangos_command.sql \ - 7706_01_mangos_command.sql \ - 7714_01_mangos_command.sql \ - 7720_01_mangos_mangos_string.sql \ - 7776_01_mangos_npc_spellclick_spells.sql \ - 7777_01_mangos_spell_proc_event.sql \ - 7782_01_mangos_spell_proc_event.sql \ - 7796_01_mangos_command.sql \ - 7796_02_mangos_mangos_string.sql \ - 7802_01_characters_character_achievement.sql \ - 7802_02_characters_character_achievement_progress.sql \ - 7823_01_mangos_item_template.sql \ - 7830_01_mangos_spell_chain.sql \ - 7839_01_mangos_mangos_string.sql \ - 7839_02_mangos_command.sql \ - 7850_01_mangos_command.sql \ - 7855_01_mangos_pools.sql \ - 7867_01_realmd_account.sql \ - 7879_01_mangos_spell_proc_event.sql \ - 7884_01_mangos_playercreateinfo_spell.sql \ - 7884_02_mangos_playercreateinfo_action.sql \ - 7884_03_characters_character_spell.sql \ - 7884_04_characters_character_aura.sql \ - 7884_05_characters_character_action.sql \ - 7886_01_mangos_petcreateinfo_spell.sql \ - 7887_01_characters_character_pet.sql \ - 7893_01_mangos_command.sql \ - 7896_01_mangos_creature_template.sql \ - 7902_01_mangos_pool_creature.sql \ - 7902_02_mangos_pool_gameobject.sql \ - 7903_01_characters_character_pet.sql \ - 7904_01_mangos_creature_template.sql \ - 7908_01_mangos_creature_template.sql \ - 7908_02_mangos_creature_addon.sql \ - 7908_03_mangos_creature_template_addon.sql \ - 7932_01_characters_character_pet.sql \ - 7938_01_realmd_account.sql \ - 7945_01_mangos_quest_template.sql \ - 7980_01_mangos_item_required_target.sql \ 7988_01_mangos_item_template.sql \ 7988_02_characters_character_equipmentsets.sql \ 7988_03_mangos_spell_chain.sql \ @@ -263,198 +76,15 @@ pkgdata_DATA = \ 8254_01_mangos_spell_proc_event.sql \ 8294_01_mangos_playercreateinfo_action.sql \ 8310_01_mangos_spell_proc_event.sql \ + 8332_01_realmd_realmcharacters.sql \ + 8339_01_characters_characters.sql \ + 8339_02_characters_character_battleground_data.sql \ + 8342_01_mangos_spell_proc_event.sql \ README ## Additional files to include when running 'make dist' # SQL update files, to upgrade database schema from older revisions EXTRA_DIST = \ - 2008_12_22_01_mangos_creature_equip_template.sql \ - 2008_12_22_02_characters_character_pet.sql \ - 2008_12_22_03_mangos_item_template.sql \ - 2008_12_22_04_mangos_item_template.sql \ - 2008_12_22_05_characters_account_data.sql \ - 2008_12_22_06_characters_character_achievement.sql \ - 2008_12_22_07_mangos_quest_template.sql \ - 2008_12_22_08_mangos_milling_loot_template.sql \ - 2008_12_22_09_mangos_spell_affect.sql \ - 2008_12_22_10_mangos_string.sql \ - 2008_12_22_11_mangos_player_classlevelstats.sql \ - 2008_12_22_12_mangos_player_levelstats.sql \ - 2008_12_22_13_mangos_item_template.sql \ - 2008_12_22_14_mangos_playercreateinfo.sql \ - 2008_12_22_15_mangos_playercreateinfo_action.sql \ - 2008_12_22_16_mangos_playercreateinfo_spell.sql \ - 2008_12_22_17_mangos_item_template.sql \ - 2008_12_22_18_characters_characters.sql \ - 2008_12_22_19_characters_item_instance.sql \ - 6936_01_mangos_spell_chain.sql \ - 6939_01_mangos_quest_template.sql \ - 6940_01_mangos_spell_learn_spell.sql \ - 6941_01_mangos_spell_learn_spell.sql \ - 6944_01_mangos_mangos_string.sql \ - 6958_01_mangos_spell_proc_event.sql \ - 6960_01_mangos_command.sql \ - 6960_02_mangos_string.sql \ - 6961_01_mangos_command.sql \ - 6970_01_mangos_playercreateinfo.sql \ - 6976_01_realmd_realmd_db_version.sql \ - 6976_02_characters_character_db_version.sql \ - 7002_01_mangos_spell_chain.sql \ - 7015_01_mangos_item_template.sql \ - 7024_01_mangos_spell_chain.sql \ - 7026_01_mangos_battleground_template.sql \ - 7031_01_mangos_spell_proc_event.sql \ - 7033_01_mangos_spell_proc_event.sql \ - 7034_01_mangos_spell_proc_event.sql \ - 7040_01_mangos_achievement_reward.sql \ - 7044_01_mangos_spell_proc_event.sql \ - 7047_01_characters_character_spell.sql \ - 7047_02_mangos_playercreateinfo_action.sql \ - 7047_03_mangos_playercreateinfo_spell.sql \ - 7050_01_mangos_spell_proc_event.sql \ - 7051_01_mangos_spell_proc_event.sql \ - 7052_01_mangos_spell_proc_event.sql \ - 7053_01_mangos_spell_proc_event.sql \ - 7056_01_mangos_spell_proc_event.sql \ - 7059_01_characters_character_spell.sql \ - 7059_02_characters_pet_spell.sql \ - 7060_01_mangos_spell_proc_event.sql \ - 7061_01_mangos_spell_proc_event.sql \ - 7063_01_mangos_spell_proc_event.sql \ - 7067_01_mangos_playercreateinfo_spell.sql \ - 7067_02_mangos_spell_learn_spell.sql \ - 7067_03_characters_character_spell.sql \ - 7074_01_mangos_playercreateinfo_spell.sql \ - 7075_01_characters_character_spell.sql \ - 7075_02_mangos_spell_learn_spell.sql \ - 7077_01_characters_character_spell.sql \ - 7078_01_mangos_spell_proc_event.sql \ - 7092_01_mangos_player_xp_for_level.sql \ - 7097_01_mangos_spell_proc_event.sql \ - 7100_01_characters_character_spell.sql \ - 7107_01_mangos_string.sql \ - 7113_01_characters_character_achievement_progress.sql \ - 7118_01_mangos_skill_discovery_template.sql \ - 7133_01_mangos_skill_discovery_template.sql \ - 7133_02_mangos_spell_loot_template.sql \ - 7141_01_mangos_instance_template.sql \ - 7147_01_mangos_creature_template.sql \ - 7149_01_mangos_spell_proc_event.sql \ - 7150_01_mangos_playercreateinfo_spell.sql \ - 7156_01_mangos_spell_proc_event.sql \ - 7168_01_mangos_command.sql \ - 7175_01_mangos_spell_proc_event.sql \ - 7193_01_mangos_mangos_string.sql \ - 7196_01_mangos_spell_chain.sql \ - 7196_02_mangos_spell_bonus_data.sql \ - 7198_01_characters_characters.sql \ - 7199_01_mangos_spell_bonus_data.sql \ - 7199_02_mangos_spell_proc_event.sql \ - 7205_01_mangos_spell_chain.sql \ - 7207_01_mangos_creature.sql \ - 7207_02_mangos_gameobject.sql \ - 7207_03_characters_corpse.sql \ - 7209_01_mangos_spell_bonus_data.sql \ - 7214_01_mangos_command.sql \ - 7214_02_mangos_mangos_string.sql \ - 7230_01_mangos_spell_chain.sql \ - 7230_02_mangos_spell_bonus_data.sql \ - 7235_01_mangos_command.sql \ - 7242_01_mangos_spell_bonus_data.sql \ - 7249_01_mangos_spell_proc_event.sql \ - 7251_01_mangos_spell_chain.sql \ - 7251_02_characters_character_spell.sql \ - 7252_01_mangos_command.sql \ - 7252_02_mangos_mangos_string.sql \ - 7255_01_characters_characters.sql \ - 7267_01_characters_auctionhouse.sql \ - 7290_01_mangos_command.sql \ - 7292_01_mangos_points_of_interest.sql \ - 7292_02_mangos_locales_points_of_interest.sql \ - 7303_01_mangos_pools.sql \ - 7307_01_characters_arena_team_member.sql \ - 7312_01_mangos_mangos_string.sql \ - 7314_01_characters_guild_rank.sql \ - 7324_01_characters_character_spell.sql \ - 7324_02_characters_character_aura.sql \ - 7331_01_mangos_command.sql \ - 7332_01_mangos_command.sql \ - 7349_01_mangos_spell_area.sql \ - 7369_01_mangos_quest_template.sql \ - 7376_01_mangos_spell_area.sql \ - 7382_01_mangos_creature_template.sql \ - 7388_01_mangos_mangos_string.sql \ - 7390_01_mangos_areatrigger_teleport.sql \ - 7393_01_mangos_game_event.sql \ - 7399_01_mangos_mangos_string.sql \ - 7422_01_mangos_mangos_string.sql \ - 7439_01_mangos_mangos_string.sql \ - 7472_01_mangos_mangos_string.sql \ - 7493_01_mangos_command.sql \ - 7495_01_mangos_mangos_string.sql \ - 7503_01_mangos_command.sql \ - 7536_01_mangos_spell_chain.sql \ - 7544_01_mangos_uptime.sql \ - 7544_02_characters_uptime.sql \ - 7546_01_characters_uptime.sql \ - 7546_02_realmd_uptime.sql \ - 7558_01_mangos_mangos_string.sql \ - 7558_02_mangos_command.sql \ - 7560_01_mangos_gameobject_template.sql \ - 7565_01_mangos_mangos_string.sql \ - 7568_01_mangos_spell_proc_event.sql \ - 7615_01_mangos_command.sql \ - 7616_01_mangos_mangos_string.sql \ - 7616_02_mangos_command.sql \ - 7622_01_mangos_creature_ai_scripts.sql \ - 7622_02_mangos_creature_ai_summons.sql \ - 7622_03_mangos_creature_ai_texts.sql \ - 7627_01_mangos_achievement_criteria_data.sql \ - 7633_01_mangos_achievement_criteria_data.sql \ - 7643_01_mangos_db_version.sql \ - 7643_02_mangos_mangos_string.sql \ - 7644_01_characters_character_pet.sql \ - 7662_01_mangos_spell_chain.sql \ - 7662_02_mangos_spell_bonus_data.sql \ - 7705_01_mangos_command.sql \ - 7706_01_mangos_command.sql \ - 7714_01_mangos_command.sql \ - 7720_01_mangos_mangos_string.sql \ - 7776_01_mangos_npc_spellclick_spells.sql \ - 7777_01_mangos_spell_proc_event.sql \ - 7782_01_mangos_spell_proc_event.sql \ - 7796_01_mangos_command.sql \ - 7796_02_mangos_mangos_string.sql \ - 7802_01_characters_character_achievement.sql \ - 7802_02_characters_character_achievement_progress.sql \ - 7823_01_mangos_item_template.sql \ - 7830_01_mangos_spell_chain.sql \ - 7839_01_mangos_mangos_string.sql \ - 7839_02_mangos_command.sql \ - 7850_01_mangos_command.sql \ - 7855_01_mangos_pools.sql \ - 7867_01_realmd_account.sql \ - 7879_01_mangos_spell_proc_event.sql \ - 7884_01_mangos_playercreateinfo_spell.sql \ - 7884_02_mangos_playercreateinfo_action.sql \ - 7884_03_characters_character_spell.sql \ - 7884_04_characters_character_aura.sql \ - 7884_05_characters_character_action.sql \ - 7886_01_mangos_petcreateinfo_spell.sql \ - 7887_01_characters_character_pet.sql \ - 7893_01_mangos_command.sql \ - 7896_01_mangos_creature_template.sql \ - 7902_01_mangos_pool_creature.sql \ - 7902_02_mangos_pool_gameobject.sql \ - 7903_01_characters_character_pet.sql \ - 7904_01_mangos_creature_template.sql \ - 7908_01_mangos_creature_template.sql \ - 7908_02_mangos_creature_addon.sql \ - 7908_03_mangos_creature_template_addon.sql \ - 7932_01_characters_character_pet.sql \ - 7938_01_realmd_account.sql \ - 7945_01_mangos_quest_template.sql \ - 7980_01_mangos_item_required_target.sql \ 7988_01_mangos_item_template.sql \ 7988_02_characters_character_equipmentsets.sql \ 7988_03_mangos_spell_chain.sql \ @@ -506,4 +136,8 @@ EXTRA_DIST = \ 8254_01_mangos_spell_proc_event.sql \ 8294_01_mangos_playercreateinfo_action.sql \ 8310_01_mangos_spell_proc_event.sql \ + 8332_01_realmd_realmcharacters.sql \ + 8339_01_characters_characters.sql \ + 8339_02_characters_character_battleground_data.sql \ + 8342_01_mangos_spell_proc_event.sql \ README diff --git a/src/game/AccountMgr.cpp b/src/game/AccountMgr.cpp index b3ed91c7e..632e31735 100644 --- a/src/game/AccountMgr.cpp +++ b/src/game/AccountMgr.cpp @@ -38,8 +38,8 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass if(utf8length(username) > MAX_ACCOUNT_STR) return AOR_NAME_TOO_LONG; // username's too long - normilizeString(username); - normilizeString(password); + normalizeString(username); + normalizeString(password); loginDatabase.escape_string(username); loginDatabase.escape_string(password); @@ -118,8 +118,8 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname, if(utf8length(new_passwd) > MAX_ACCOUNT_STR) return AOR_PASS_TOO_LONG; - normilizeString(new_uname); - normilizeString(new_passwd); + normalizeString(new_uname); + normalizeString(new_passwd); loginDatabase.escape_string(new_uname); loginDatabase.escape_string(new_passwd); @@ -139,7 +139,7 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd) if (utf8length(new_passwd) > MAX_ACCOUNT_STR) return AOR_PASS_TOO_LONG; - normilizeString(new_passwd); + normalizeString(new_passwd); loginDatabase.escape_string(new_passwd); if(!loginDatabase.PExecute("UPDATE account SET sha_pass_hash=SHA1("_CONCAT3_("username","':'","'%s'")") WHERE id='%d'", new_passwd.c_str(), accid)) @@ -190,7 +190,7 @@ bool AccountMgr::GetName(uint32 acc_id, std::string &name) bool AccountMgr::CheckPassword(uint32 accid, std::string passwd) { - normilizeString(passwd); + normalizeString(passwd); loginDatabase.escape_string(passwd); QueryResult *result = loginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d' AND sha_pass_hash=SHA1("_CONCAT3_("username","':'","'%s'")")", accid, passwd.c_str()); @@ -203,7 +203,7 @@ bool AccountMgr::CheckPassword(uint32 accid, std::string passwd) return false; } -bool AccountMgr::normilizeString(std::string& utf8str) +bool AccountMgr::normalizeString(std::string& utf8str) { wchar_t wstr_buf[MAX_ACCOUNT_STR+1]; diff --git a/src/game/AccountMgr.h b/src/game/AccountMgr.h index 86d09312c..2b3dbedcd 100644 --- a/src/game/AccountMgr.h +++ b/src/game/AccountMgr.h @@ -51,7 +51,7 @@ class AccountMgr uint32 GetSecurity(uint32 acc_id); bool GetName(uint32 acc_id, std::string &name); - static bool normilizeString(std::string& utf8str); + static bool normalizeString(std::string& utf8str); }; #define accmgr MaNGOS::Singleton::Instance() diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 9449e4f6e..446b2aac2 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -274,10 +274,12 @@ void BattleGround::Update(uint32 diff) sh = plr->GetMap()->GetCreature(itr->first); // only for visual effect if (sh) - sh->CastSpell(sh, SPELL_SPIRIT_HEAL, true); // Spirit Heal, effect 117 + // Spirit Heal, effect 117 + sh->CastSpell(sh, SPELL_SPIRIT_HEAL, true); } - plr->CastSpell(plr, SPELL_RESURRECTION_VISUAL, true); // Resurrection visual + // Resurrection visual + plr->CastSpell(plr, SPELL_RESURRECTION_VISUAL, true); m_ResurrectQueue.push_back(*itr2); } (itr->second).clear(); @@ -1041,7 +1043,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac plr->SetBGTeam(0); if (Transport) - plr->TeleportTo(plr->GetBattleGroundEntryPoint()); + plr->TeleportToBGEntryPoint(); sLog.outDetail("BATTLEGROUND: Removed player %s from BattleGround.", plr->GetName()); } @@ -1321,12 +1323,6 @@ void BattleGround::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid return; plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true); - SpellEntry const *spellInfo = sSpellStore.LookupEntry( SPELL_WAITING_FOR_RESURRECT ); - if (spellInfo) - { - Aura *Aur = CreateAura(spellInfo, 0, NULL, plr); - plr->AddAura(Aur); - } } void BattleGround::RemovePlayerFromResurrectQueue(uint64 player_guid) diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index cedf18a3c..ecbe63cd3 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -161,9 +161,6 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId); // add to queue - // store entry point coords - member->SetBattleGroundEntryPoint(member->GetMapId(),member->GetPositionX(),member->GetPositionY(),member->GetPositionZ(),member->GetOrientation()); - WorldPacket data; // send status packet (in queue) sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType); @@ -179,8 +176,6 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) { // already checked if queueSlot is valid, now just get it uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId); - // store entry point coords - _player->SetBattleGroundEntryPoint(_player->GetMapId(),_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetOrientation()); WorldPacket data; // send status packet (in queue) @@ -435,6 +430,9 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) case 1: // port to battleground if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId)) return; // cheating? + + _player->SetBattleGroundEntryPoint(); + // resurrect the player if (!_player->isAlive()) { @@ -751,9 +749,6 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId);// add to queue - // store entry point coords (same as leader entry point) - member->SetBattleGroundEntryPoint(_player->GetMapId(),_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetOrientation()); - WorldPacket data; // send status packet (in queue) sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype); @@ -771,9 +766,6 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) { uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId); - // store entry point coords - _player->SetBattleGroundEntryPoint(_player->GetMapId(),_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetOrientation()); - WorldPacket data; // send status packet (in queue) sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype); diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 8eff58586..cc9b935b5 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -59,7 +59,7 @@ bool LoginQueryHolder::Initialize() // NOTE: all fields in `characters` must be read to prevent lost character data at next save in case wrong DB structure. // !!! NOTE: including unused `zone`,`online` - res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty, arena_pending_points,bgid,bgteam,bgmap,bgx,bgy,bgz,bgo FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); + res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty, arena_pending_points FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT leaderGuid FROM group_member WHERE memberGuid ='%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid)); @@ -82,6 +82,7 @@ bool LoginQueryHolder::Initialize() res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS,"SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = '%u'", GUID_LOPART(m_guid)); 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", GUID_LOPART(m_guid)); + 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'", GUID_LOPART(m_guid)); return res; } @@ -745,54 +746,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) pCurrChar->SetMovement(MOVE_WATER_WALK); } - if(uint32 sourceNode = pCurrChar->m_taxi.GetTaxiSource()) - { - sLog.outDebug( "WORLD: Restart character %u taxi flight", pCurrChar->GetGUIDLow() ); - - uint32 mountDisplayId = objmgr.GetTaxiMountDisplayId(sourceNode, pCurrChar->GetTeam(),true); - uint32 path = pCurrChar->m_taxi.GetCurrentTaxiPath(); - - // search appropriate start path node - uint32 startNode = 0; - - TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path]; - - float distPrev = MAP_SIZE*MAP_SIZE; - float distNext = - (nodeList[0].x-pCurrChar->GetPositionX())*(nodeList[0].x-pCurrChar->GetPositionX())+ - (nodeList[0].y-pCurrChar->GetPositionY())*(nodeList[0].y-pCurrChar->GetPositionY())+ - (nodeList[0].z-pCurrChar->GetPositionZ())*(nodeList[0].z-pCurrChar->GetPositionZ()); - - for(uint32 i = 1; i < nodeList.size(); ++i) - { - TaxiPathNode const& node = nodeList[i]; - TaxiPathNode const& prevNode = nodeList[i-1]; - - // skip nodes at another map - if(node.mapid != pCurrChar->GetMapId()) - continue; - - distPrev = distNext; - - distNext = - (node.x-pCurrChar->GetPositionX())*(node.x-pCurrChar->GetPositionX())+ - (node.y-pCurrChar->GetPositionY())*(node.y-pCurrChar->GetPositionY())+ - (node.z-pCurrChar->GetPositionZ())*(node.z-pCurrChar->GetPositionZ()); - - float distNodes = - (node.x-prevNode.x)*(node.x-prevNode.x)+ - (node.y-prevNode.y)*(node.y-prevNode.y)+ - (node.z-prevNode.z)*(node.z-prevNode.z); - - if(distNext + distPrev < distNodes) - { - startNode = i; - break; - } - } - - SendDoFlight( mountDisplayId, path, startNode ); - } + pCurrChar->ContinueTaxiFlight(); // reset for all pets before pet loading if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS)) diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 7bc7c8682..7bba3e979 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -393,7 +393,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args) // when porting out from the bg, it will be reset to 0 target->SetBattleGroundId(m_session->GetPlayer()->GetBattleGroundId(), m_session->GetPlayer()->GetBattleGroundTypeId()); // remember current position as entry point for return at bg end teleportation - target->SetBattleGroundEntryPoint(target->GetMapId(),target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),target->GetOrientation()); + target->SetBattleGroundEntryPoint(); } else if (pMap->IsDungeon()) { @@ -507,7 +507,7 @@ bool ChatHandler::HandleGonameCommand(const char* args) // when porting out from the bg, it will be reset to 0 _player->SetBattleGroundId(target->GetBattleGroundId(), target->GetBattleGroundTypeId()); // remember current position as entry point for return at bg end teleportation - _player->SetBattleGroundEntryPoint(_player->GetMapId(),_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetOrientation()); + _player->SetBattleGroundEntryPoint(); } else if(cMap->IsDungeon()) { diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index a22640341..a69e94bdc 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -4043,7 +4043,7 @@ bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args) char* limit_str = strtok (NULL, " "); int32 limit = limit_str ? atoi (limit_str) : -1; - if (!AccountMgr::normilizeString (account)) + if (!AccountMgr::normalizeString (account)) return false; loginDatabase.escape_string (account); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index cd78de075..cdcf023fd 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -853,7 +853,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) return false; targetAccountName = arg1; - if(!AccountMgr::normilizeString(targetAccountName)) + if (!AccountMgr::normalizeString(targetAccountName)) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,targetAccountName.c_str()); SetSentErrorMessage(true); @@ -919,7 +919,7 @@ bool ChatHandler::HandleAccountSetPasswordCommand(const char* args) return false; std::string account_name = szAccount; - if(!AccountMgr::normilizeString(account_name)) + if (!AccountMgr::normalizeString(account_name)) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); SetSentErrorMessage(true); @@ -4906,7 +4906,7 @@ bool ChatHandler::HandleBanHelper(BanMode mode, const char* args) switch(mode) { case BAN_ACCOUNT: - if(!AccountMgr::normilizeString(nameOrIP)) + if (!AccountMgr::normalizeString(nameOrIP)) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,nameOrIP.c_str()); SetSentErrorMessage(true); @@ -4986,7 +4986,7 @@ bool ChatHandler::HandleUnBanHelper(BanMode mode, const char* args) switch(mode) { case BAN_ACCOUNT: - if(!AccountMgr::normilizeString(nameOrIP)) + if (!AccountMgr::normalizeString(nameOrIP)) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,nameOrIP.c_str()); SetSentErrorMessage(true); @@ -5021,11 +5021,11 @@ bool ChatHandler::HandleBanInfoAccountCommand(const char* args) return false; char* cname = strtok((char*)args, ""); - if(!cname) + if (!cname) return false; std::string account_name = cname; - if(!AccountMgr::normilizeString(account_name)) + if (!AccountMgr::normalizeString(account_name)) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); SetSentErrorMessage(true); @@ -5033,7 +5033,7 @@ bool ChatHandler::HandleBanInfoAccountCommand(const char* args) } uint32 accountid = accmgr.GetId(account_name); - if(!accountid) + if (!accountid) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); return true; @@ -5046,13 +5046,13 @@ bool ChatHandler::HandleBanInfoCharacterCommand(const char* args) { Player* target; uint64 target_guid; - if(!extractPlayerTarget((char*)args,&target,&target_guid)) + if (!extractPlayerTarget((char*)args,&target,&target_guid)) return false; uint32 accountid = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid); std::string accountname; - if(!accmgr.GetName(accountid,accountname)) + if (!accmgr.GetName(accountid,accountname)) { PSendSysMessage(LANG_BANINFO_NOCHARACTER); return true; @@ -5390,15 +5390,15 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args) return false; char * file = strtok((char*)args, " "); - if(!file) + if (!file) return false; char * account = strtok(NULL, " "); - if(!account) + if (!account) return false; std::string account_name = account; - if(!AccountMgr::normilizeString(account_name)) + if (!AccountMgr::normalizeString(account_name)) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); SetSentErrorMessage(true); @@ -5406,10 +5406,10 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args) } uint32 account_id = accmgr.GetId(account_name); - if(!account_id) + if (!account_id) { account_id = atoi(account); // use original string - if(!account_id) + if (!account_id) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); SetSentErrorMessage(true); @@ -5417,7 +5417,7 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args) } } - if(!accmgr.GetName(account_id,account_name)) + if (!accmgr.GetName(account_id,account_name)) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); SetSentErrorMessage(true); @@ -6074,10 +6074,10 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char* args) std::string account_name; uint32 account_id; - if(!szExp) + if (!szExp) { Player* player = getSelectedPlayer(); - if(!player) + if (!player) return false; account_id = player->GetSession()->GetAccountId(); @@ -6088,7 +6088,7 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char* args) { ///- Convert Account name to Upper Format account_name = szAcc; - if(!AccountMgr::normilizeString(account_name)) + if (!AccountMgr::normalizeString(account_name)) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); SetSentErrorMessage(true); @@ -6096,7 +6096,7 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char* args) } account_id = accmgr.GetId(account_name); - if(!account_id) + if (!account_id) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); SetSentErrorMessage(true); diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index f3ce42151..ef80d78c8 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -692,7 +692,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) realCount += 1; } - data.put(0, realCount); // this will display warning about undelivered mail to player if realCount > mails_count + data.put(0, realCount); // this will display warning about undelivered mail to player if realCount > mailsCount data.put(4, mailsCount); // set real send mails to client SendPacket(&data); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 904a1a0cd..404be4dd5 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -370,14 +370,11 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa m_DetectInvTimer = 1*IN_MILISECONDS; - m_bgBattleGroundID = 0; - m_bgTypeID = BATTLEGROUND_TYPE_NONE; for (int j=0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; ++j) { m_bgBattleGroundQueueID[j].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE; m_bgBattleGroundQueueID[j].invitedToInstance = 0; } - m_bgTeam = 0; m_logintime = time(NULL); m_Last_tick = m_logintime; @@ -458,7 +455,6 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa m_mover = this; m_miniPet = 0; - m_bgAfkReportedTimer = 0; m_contestedPvPTimer = 0; m_declinedname = NULL; @@ -1776,6 +1772,13 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return true; } +bool Player::TeleportToBGEntryPoint() +{ + ScheduleDelayedOperation(DELAYED_BG_MOUNT_RESTORE); + ScheduleDelayedOperation(DELAYED_BG_TAXI_RESTORE); + return TeleportTo(m_bgData.joinPos); +} + void Player::ProcessDelayedOperations() { if(m_DelayedOperations == 0) @@ -1811,18 +1814,31 @@ void Player::ProcessDelayedOperations() CastSpell(this, 26013, true); // Deserter } + if (m_DelayedOperations & DELAYED_BG_MOUNT_RESTORE) + { + if (m_bgData.mountSpell) + { + CastSpell(this, m_bgData.mountSpell, true); + m_bgData.mountSpell = 0; + } + } + + if (m_DelayedOperations & DELAYED_BG_TAXI_RESTORE) + { + if (m_bgData.HasTaxiPath()) + { + m_taxi.AddTaxiDestination(m_bgData.taxiPath[0]); + m_taxi.AddTaxiDestination(m_bgData.taxiPath[1]); + m_bgData.ClearTaxiPath(); + + ContinueTaxiFlight(); + } + } + //we have executed ALL delayed ops, so clear the flag m_DelayedOperations = 0; } -void Player::ScheduleDelayedOperation(uint32 operation) -{ - if(operation >= DELAYED_END) - return; - - m_DelayedOperations |= operation; -} - void Player::AddToWorld() { ///- Do not add/remove the player from the object storage @@ -13938,6 +13954,28 @@ void Player::_LoadEquipmentSets(QueryResult *result) delete result; } +void Player::_LoadBGData(QueryResult* result) +{ + if (!result) + return; + + // Expecting only one row + Field *fields = result->Fetch(); + /* bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */ + m_bgData.bgInstanceID = fields[0].GetUInt32(); + m_bgData.bgTeam = fields[1].GetUInt32(); + m_bgData.joinPos = WorldLocation(fields[6].GetUInt32(), // Map + fields[2].GetFloat(), // X + fields[3].GetFloat(), // Y + fields[4].GetFloat(), // Z + fields[5].GetFloat()); // Orientation + m_bgData.taxiPath[0] = fields[7].GetUInt32(); + m_bgData.taxiPath[1] = fields[8].GetUInt32(); + m_bgData.mountSpell = fields[9].GetUInt32(); + + delete result; +} + bool Player::LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float& o, bool& in_flight, uint64 guid) { QueryResult *result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,taxi_path FROM characters WHERE guid = '%u'",GUID_LOPART(guid)); @@ -14009,8 +14047,8 @@ float Player::GetFloatValueFromDB(uint16 index, uint64 guid) bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) { - //// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 - //QueryResult *result = CharacterDatabase.PQuery("SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty, arena_pending_points,bgid,bgteam,bgmap,bgx,bgy,bgz,bgo FROM characters WHERE guid = '%u'", guid); + //// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 + //QueryResult *result = CharacterDatabase.PQuery("SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty, arena_pending_points FROM characters WHERE guid = '%u'", guid); QueryResult *result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM); if(!result) @@ -14153,31 +14191,22 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) m_movementInfo.t_o = 0.0f; } - uint32 bgid = fields[41].GetUInt32(); - uint32 bgteam = fields[42].GetUInt32(); + _LoadBGData(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBGDATA)); - if(bgid) //saved in BattleGround + if(m_bgData.bgInstanceID) //saved in BattleGround { - SetBattleGroundEntryPoint(fields[43].GetUInt32(),fields[44].GetFloat(),fields[45].GetFloat(),fields[46].GetFloat(),fields[47].GetFloat()); - - // check entry point and fix to homebind if need - MapEntry const* mapEntry = sMapStore.LookupEntry(m_bgEntryPoint.mapid); - if(!mapEntry || mapEntry->Instanceable() || !MapManager::IsValidMapCoord(m_bgEntryPoint)) - SetBattleGroundEntryPoint(m_homebindMapId,m_homebindX,m_homebindY,m_homebindZ,0.0f); - - BattleGround *currentBg = sBattleGroundMgr.GetBattleGround(bgid, BATTLEGROUND_TYPE_NONE); + BattleGround *currentBg = sBattleGroundMgr.GetBattleGround(m_bgData.bgInstanceID, BATTLEGROUND_TYPE_NONE); if(currentBg && currentBg->IsPlayerInBattleGround(GetGUID())) { BattleGroundQueueTypeId bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType()); AddBattleGroundQueueId(bgQueueTypeId); - SetBattleGroundId(currentBg->GetInstanceID(), currentBg->GetTypeID()); - SetBGTeam(bgteam); + m_bgData.bgTypeID = currentBg->GetTypeID(); //join player to battleground group currentBg->EventPlayerLoggedIn(this, GetGUID()); - currentBg->AddOrSetPlayerToCorrectBgGroup(this, GetGUID(), bgteam); + currentBg->AddOrSetPlayerToCorrectBgGroup(this, GetGUID(), m_bgData.bgTeam); SetInviteForBattleGroundQueueType(bgQueueTypeId,currentBg->GetInstanceID()); } @@ -14186,7 +14215,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) const WorldLocation& _loc = GetBattleGroundEntryPoint(); SetLocationMapId(_loc.mapid); Relocate(_loc.coord_x, _loc.coord_y, _loc.coord_z, _loc.orientation); - //RemoveArenaAuras(true); } } else @@ -14196,14 +14224,9 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // player can have current coordinates in to BG/Arean map, fix this if(!mapEntry || mapEntry->IsBattleGroundOrArena()) { - // return to BG master - SetLocationMapId(fields[43].GetUInt32()); - Relocate(fields[44].GetFloat(),fields[45].GetFloat(),fields[46].GetFloat(),fields[47].GetFloat()); - - // check entry point and fix to homebind if need - mapEntry = sMapStore.LookupEntry(GetMapId()); - if(!mapEntry || mapEntry->IsBattleGroundOrArena() || !IsPositionValid()) - RelocateToHomebind(); + const WorldLocation& _loc = GetBattleGroundEntryPoint(); + SetLocationMapId(_loc.mapid); + Relocate(_loc.coord_x, _loc.coord_y, _loc.coord_z, _loc.orientation); } } @@ -14451,7 +14474,13 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) } // Not finish taxi flight path - if(!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes,GetTeam())) + if(m_bgData.HasTaxiPath()) + { + m_taxi.ClearTaxiDestinations(); + for (int i = 0; i < 2; ++i) + m_taxi.AddTaxiDestination(m_bgData.taxiPath[i]); + } + else if(!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes,GetTeam())) { // problems with taxi path loading TaxiNodesEntry const* nodeEntry = NULL; @@ -14477,7 +14506,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) m_taxi.ClearTaxiDestinations(); } - else if(uint32 node_id = m_taxi.GetTaxiSource()) + + if(uint32 node_id = m_taxi.GetTaxiSource()) { // save source node as recall coord to prevent recall and fall from sky TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(node_id); @@ -15525,7 +15555,7 @@ void Player::SaveToDB() "taximask, online, cinematic, " "totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, " "trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, " - "death_expire_time, taxi_path, arena_pending_points, bgid, bgteam, bgmap, bgx, bgy, bgz, bgo) VALUES (" + "death_expire_time, taxi_path, arena_pending_points) VALUES (" << GetGUIDLow() << ", " << GetSession()->GetAccountId() << ", '" << sql_name << "', " @@ -15604,14 +15634,7 @@ void Player::SaveToDB() ss << (uint64)m_deathExpireTime << ", '"; ss << m_taxi.SaveTaxiDestinationsToString() << "', "; - ss << "'0', "; // arena_pending_points - ss << GetBattleGroundId() << ", "; - ss << GetBGTeam() << ", "; - ss << m_bgEntryPoint.mapid << ", " - << finiteAlways(m_bgEntryPoint.coord_x) << ", " - << finiteAlways(m_bgEntryPoint.coord_y) << ", " - << finiteAlways(m_bgEntryPoint.coord_z) << ", " - << finiteAlways(m_bgEntryPoint.orientation); + ss << "'0' "; // arena_pending_points ss << ")"; CharacterDatabase.Execute( ss.str().c_str() ); @@ -15619,6 +15642,7 @@ void Player::SaveToDB() if(m_mailsUpdated) //save mails only when needed _SaveMail(); + _SaveBGData(); _SaveInventory(); _SaveQuestStatus(); _SaveDailyQuestStatus(); @@ -16208,10 +16232,10 @@ void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId) ///checks the 15 afk reports per 5 minutes limit void Player::UpdateAfkReport(time_t currTime) { - if(m_bgAfkReportedTimer <= currTime) + if(m_bgData.bgAfkReportedTimer <= currTime) { - m_bgAfkReportedCount = 0; - m_bgAfkReportedTimer = currTime+5*MINUTE; + m_bgData.bgAfkReportedCount = 0; + m_bgData.bgAfkReportedTimer = currTime+5*MINUTE; } } @@ -17033,6 +17057,59 @@ bool Player::ActivateTaxiPathTo( uint32 taxi_path_id, uint32 spellid /*= 0*/ ) return ActivateTaxiPathTo(nodes,NULL,spellid); } +void Player::ContinueTaxiFlight() +{ + uint32 sourceNode = m_taxi.GetTaxiSource(); + if (!sourceNode) + return; + + sLog.outDebug( "WORLD: Restart character %u taxi flight", GetGUIDLow() ); + + uint32 mountDisplayId = objmgr.GetTaxiMountDisplayId(sourceNode, GetTeam(),true); + uint32 path = m_taxi.GetCurrentTaxiPath(); + + // search appropriate start path node + uint32 startNode = 0; + + TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path]; + + float distPrev = MAP_SIZE*MAP_SIZE; + float distNext = + (nodeList[0].x-GetPositionX())*(nodeList[0].x-GetPositionX())+ + (nodeList[0].y-GetPositionY())*(nodeList[0].y-GetPositionY())+ + (nodeList[0].z-GetPositionZ())*(nodeList[0].z-GetPositionZ()); + + for(uint32 i = 1; i < nodeList.size(); ++i) + { + TaxiPathNode const& node = nodeList[i]; + TaxiPathNode const& prevNode = nodeList[i-1]; + + // skip nodes at another map + if(node.mapid != GetMapId()) + continue; + + distPrev = distNext; + + distNext = + (node.x-GetPositionX())*(node.x-GetPositionX())+ + (node.y-GetPositionY())*(node.y-GetPositionY())+ + (node.z-GetPositionZ())*(node.z-GetPositionZ()); + + float distNodes = + (node.x-prevNode.x)*(node.x-prevNode.x)+ + (node.y-prevNode.y)*(node.y-prevNode.y)+ + (node.z-prevNode.z)*(node.z-prevNode.z); + + if(distNext + distPrev < distNodes) + { + startNode = i; + break; + } + } + + GetSession()->SendDoFlight(mountDisplayId, path, startNode); +} + void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs ) { // last check 2.0.10 @@ -17714,6 +17791,56 @@ void Player::ToggleMetaGemsActive(uint8 exceptslot, bool apply) } } +void Player::SetBattleGroundEntryPoint() +{ + // Taxi path store + if (!m_taxi.empty()) + { + m_bgData.mountSpell = 0; + m_bgData.taxiPath[0] = m_taxi.GetTaxiSource(); + m_bgData.taxiPath[1] = m_taxi.GetTaxiDestination(); + + // On taxi we don't need check for dungeon + m_bgData.joinPos = WorldLocation(GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + return; + } + else + { + m_bgData.ClearTaxiPath(); + + // Mount spell id storing + if (IsMounted()) + { + AuraList const& auras = GetAurasByType(SPELL_AURA_MOUNTED); + if (!auras.empty()) + m_bgData.mountSpell = (*auras.begin())->GetId(); + } + else + m_bgData.mountSpell = 0; + + // If map is dungeon find linked graveyard + if(GetMap()->IsDungeon()) + { + if (const WorldSafeLocsEntry* entry = objmgr.GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam())) + { + m_bgData.joinPos = WorldLocation(entry->map_id, entry->x, entry->y, entry->z, 0.0f); + return; + } + else + sLog.outError("SetBattleGroundEntryPoint: Dungeon map %u has no linked graveyard, setting home location as entry point.", GetMapId()); + } + // If new entry point is not BG or arena set it + else if (!GetMap()->IsBattleGroundOrArena()) + { + m_bgData.joinPos = WorldLocation(GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + return; + } + } + + // In error cases use homebind position + m_bgData.joinPos = WorldLocation(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, 0.0f); +} + void Player::LeaveBattleground(bool teleportToEntryPoint) { if(BattleGround *bg = GetBattleGround()) @@ -17750,9 +17877,9 @@ bool Player::CanJoinToBattleground() const bool Player::CanReportAfkDueToLimit() { // a player can complain about 15 people per 5 minutes - if(m_bgAfkReportedCount >= 15) + if(m_bgData.bgAfkReportedCount++ >= 15) return false; - ++m_bgAfkReportedCount; + return true; } @@ -17764,15 +17891,15 @@ void Player::ReportedAfkBy(Player* reporter) return; // check if player has 'Idle' or 'Inactive' debuff - if(m_bgAfkReporter.find(reporter->GetGUIDLow()) == m_bgAfkReporter.end() && !HasAura(43680,0) && !HasAura(43681,0) && reporter->CanReportAfkDueToLimit()) + if(m_bgData.bgAfkReporter.find(reporter->GetGUIDLow()) == m_bgData.bgAfkReporter.end() && !HasAura(43680, 0) && !HasAura(43681, 0) && reporter->CanReportAfkDueToLimit()) { - m_bgAfkReporter.insert(reporter->GetGUIDLow()); + m_bgData.bgAfkReporter.insert(reporter->GetGUIDLow()); // 3 players have to complain to apply debuff - if(m_bgAfkReporter.size() >= 3) + if(m_bgData.bgAfkReporter.size() >= 3) { // cast 'Idle' spell CastSpell(this, 43680, true); - m_bgAfkReporter.clear(); + m_bgData.bgAfkReporter.clear(); } } } @@ -18401,7 +18528,7 @@ BattleGround* Player::GetBattleGround() const if(GetBattleGroundId()==0) return NULL; - return sBattleGroundMgr.GetBattleGround(GetBattleGroundId(), m_bgTypeID); + return sBattleGroundMgr.GetBattleGround(GetBattleGroundId(), m_bgData.bgTypeID); } bool Player::InArena() const @@ -20387,6 +20514,18 @@ void Player::_SaveEquipmentSets() } } +void Player::_SaveBGData() +{ + CharacterDatabase.PExecute("DELETE FROM character_battleground_data WHERE guid='%u'", GetGUIDLow()); + if (m_bgData.bgInstanceID) + { + /* guid, bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */ + CharacterDatabase.PExecute("INSERT INTO character_battleground_data VALUES ('%u', '%u', '%u', '%f', '%f', '%f', '%f', '%u', '%u', '%u', '%u')", + GetGUIDLow(), m_bgData.bgInstanceID, m_bgData.bgTeam, m_bgData.joinPos.coord_x, m_bgData.joinPos.coord_y, m_bgData.joinPos.coord_z, + m_bgData.joinPos.orientation, m_bgData.joinPos.mapid, m_bgData.taxiPath[0], m_bgData.taxiPath[1], m_bgData.mountSpell); + } +} + void Player::DeleteEquipmentSet(uint64 setGuid) { for(EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr) diff --git a/src/game/Player.h b/src/game/Player.h index 1ac5ea4c3..39ba05e34 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -882,14 +882,17 @@ enum PlayerLoginQueryIndex PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS = 18, PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS = 19, PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS = 20, - MAX_PLAYER_LOGIN_QUERY = 21 + PLAYER_LOGIN_QUERY_LOADBGDATA = 21, + MAX_PLAYER_LOGIN_QUERY = 22 }; enum PlayerDelayedOperations { - DELAYED_SAVE_PLAYER = 1, - DELAYED_RESURRECT_PLAYER = 2, - DELAYED_SPELL_CAST_DESERTER = 4, + DELAYED_SAVE_PLAYER = 0x01, + DELAYED_RESURRECT_PLAYER = 0x02, + DELAYED_SPELL_CAST_DESERTER = 0x04, + DELAYED_BG_MOUNT_RESTORE = 0x08, ///< Flag to restore mount state after teleport from BG + DELAYED_BG_TAXI_RESTORE = 0x10, ///< Flag to restore taxi state after teleport from BG DELAYED_END }; @@ -960,6 +963,35 @@ class MANGOS_DLL_SPEC PlayerTaxi std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi); +class Player; + +/// Holder for BattleGround data +struct BGData +{ + BGData() : bgInstanceID(0), bgTypeID(BATTLEGROUND_TYPE_NONE), bgAfkReportedCount(0), bgAfkReportedTimer(0), + bgTeam(0), mountSpell(0) { ClearTaxiPath(); } + + + uint32 bgInstanceID; ///< This variable is set to bg->m_InstanceID, + /// when player is teleported to BG - (it is battleground's GUID) + BattleGroundTypeId bgTypeID; + + std::set bgAfkReporter; + uint8 bgAfkReportedCount; + time_t bgAfkReportedTimer; + + uint32 bgTeam; ///< What side the player will be added to + + + uint32 mountSpell; + uint32 taxiPath[2]; + + WorldLocation joinPos; ///< From where player entered BG + + void ClearTaxiPath() { taxiPath[0] = taxiPath[1] = 0; } + bool HasTaxiPath() const { return taxiPath[0] && taxiPath[1]; } +}; + class MANGOS_DLL_SPEC Player : public Unit { friend class WorldSession; @@ -984,6 +1016,8 @@ class MANGOS_DLL_SPEC Player : public Unit return TeleportTo(loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation, options); } + bool TeleportToBGEntryPoint(); + void SetSummonPoint(uint32 mapid, float x, float y, float z) { m_summon_expire = time(NULL) + MAX_PLAYER_SUMMON_DELAY; @@ -1031,6 +1065,7 @@ class MANGOS_DLL_SPEC Player : public Unit bool ActivateTaxiPathTo(std::vector const& nodes, Creature* npc = NULL, uint32 spellid = 0); bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 0); // mount_id can be used in scripting calls + void ContinueTaxiFlight(); bool isAcceptTickets() const { return GetSession()->GetSecurity() >= SEC_GAMEMASTER && (m_ExtraFlags & PLAYER_EXTRA_GM_ACCEPT_TICKETS); } void SetAcceptTicket(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_GM_ACCEPT_TICKETS; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_ACCEPT_TICKETS; } bool isAcceptWhispers() const { return m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS; } @@ -1913,10 +1948,10 @@ class MANGOS_DLL_SPEC Player : public Unit /*** BATTLEGROUND SYSTEM ***/ /*********************************************************/ - bool InBattleGround() const { return m_bgBattleGroundID != 0; } + bool InBattleGround() const { return m_bgData.bgInstanceID != 0; } bool InArena() const; - uint32 GetBattleGroundId() const { return m_bgBattleGroundID; } - BattleGroundTypeId GetBattleGroundTypeId() const { return m_bgTypeID; } + uint32 GetBattleGroundId() const { return m_bgData.bgInstanceID; } + BattleGroundTypeId GetBattleGroundTypeId() const { return m_bgData.bgTypeID; } BattleGround* GetBattleGround() const; @@ -1952,8 +1987,8 @@ class MANGOS_DLL_SPEC Player : public Unit void SetBattleGroundId(uint32 val, BattleGroundTypeId bgTypeId) { - m_bgBattleGroundID = val; - m_bgTypeID = bgTypeId; + m_bgData.bgInstanceID = val; + m_bgData.bgTypeID = bgTypeId; } uint32 AddBattleGroundQueueId(BattleGroundQueueTypeId val) { @@ -2000,20 +2035,17 @@ class MANGOS_DLL_SPEC Player : public Unit return true; return false; } - WorldLocation const& GetBattleGroundEntryPoint() const { return m_bgEntryPoint; } - void SetBattleGroundEntryPoint(uint32 Map, float PosX, float PosY, float PosZ, float PosO ) - { - m_bgEntryPoint = WorldLocation(Map,PosX,PosY,PosZ,PosO); - } + WorldLocation const& GetBattleGroundEntryPoint() const { return m_bgData.joinPos; } + void SetBattleGroundEntryPoint(); - void SetBGTeam(uint32 team) { m_bgTeam = team; } - uint32 GetBGTeam() const { return m_bgTeam ? m_bgTeam : GetTeam(); } + void SetBGTeam(uint32 team) { m_bgData.bgTeam = team; } + uint32 GetBGTeam() const { return m_bgData.bgTeam ? m_bgData.bgTeam : GetTeam(); } void LeaveBattleground(bool teleportToEntryPoint = true); bool CanJoinToBattleground() const; bool CanReportAfkDueToLimit(); void ReportedAfkBy(Player* reporter); - void ClearAfkReports() { m_bgAfkReporter.clear(); } + void ClearAfkReports() { m_bgData.bgAfkReporter.clear(); } bool GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const; bool CanUseBattleGroundObject(); @@ -2213,13 +2245,12 @@ class MANGOS_DLL_SPEC Player : public Unit bool canSeeSpellClickOn(Creature const* creature) const; protected: + uint32 m_contestedPvPTimer; + /*********************************************************/ /*** BATTLEGROUND SYSTEM ***/ /*********************************************************/ - /* this variable is set to bg->m_InstanceID, when player is teleported to BG - (it is battleground's GUID)*/ - uint32 m_bgBattleGroundID; - BattleGroundTypeId m_bgTypeID; /* this is an array of BG queues (BgTypeIDs) in which is player */ @@ -2228,15 +2259,9 @@ class MANGOS_DLL_SPEC Player : public Unit BattleGroundQueueTypeId bgQueueTypeId; uint32 invitedToInstance; }; + BgBattleGroundQueueID_Rec m_bgBattleGroundQueueID[PLAYER_MAX_BATTLEGROUND_QUEUES]; - WorldLocation m_bgEntryPoint; - - std::set m_bgAfkReporter; - uint8 m_bgAfkReportedCount; - time_t m_bgAfkReportedTimer; - uint32 m_contestedPvPTimer; - - uint32 m_bgTeam; // what side the player will be added to + BGData m_bgData; /*********************************************************/ /*** QUEST SYSTEM ***/ @@ -2269,6 +2294,7 @@ class MANGOS_DLL_SPEC Player : public Unit void _LoadDeclinedNames(QueryResult *result); void _LoadArenaTeamInfo(QueryResult *result); void _LoadEquipmentSets(QueryResult *result); + void _LoadBGData(QueryResult* result); /*********************************************************/ /*** SAVE SYSTEM ***/ @@ -2282,6 +2308,7 @@ class MANGOS_DLL_SPEC Player : public Unit void _SaveDailyQuestStatus(); void _SaveSpells(); void _SaveEquipmentSets(); + void _SaveBGData(); void _SetCreateBits(UpdateMask *updateMask, Player *target) const; void _SetUpdateBits(UpdateMask *updateMask, Player *target) const; @@ -2451,7 +2478,11 @@ class MANGOS_DLL_SPEC Player : public Unit bool IsHasDelayedTeleport() const { return m_bHasDelayedTeleport; } void SetDelayedTeleportFlag(bool setting) { m_bHasDelayedTeleport = setting; } - void ScheduleDelayedOperation(uint32 operation); + void ScheduleDelayedOperation(uint32 operation) + { + if(operation < DELAYED_END) + m_DelayedOperations |= operation; + } GridReference m_gridRef; MapReference m_mapRef; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index dbeb81a22..1fb84ca44 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -366,7 +366,7 @@ m_spellmod(NULL), m_caster_guid(0), m_target(target), m_castItemGuid(castItem?ca m_timeCla(1000), m_periodicTimer(0), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE), m_effIndex(eff), m_auraSlot(MAX_AURAS), m_auraFlags(AFLAG_NONE), m_auraLevel(1), m_procCharges(0), m_stackAmount(1), m_positive(false), m_permanent(false), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false), -m_isRemovedOnShapeLost(true), m_updated(false), m_in_use(false) +m_isRemovedOnShapeLost(true), m_in_use(0), m_deleted(false) { assert(target); @@ -801,12 +801,8 @@ void AreaAura::Update(uint32 diff) } else // aura at non-caster { - Unit * tmp_target = m_target; Unit* caster = GetCaster(); - uint32 tmp_spellId = GetId(), tmp_effIndex = m_effIndex; - // WARNING: the aura may get deleted during the update - // DO NOT access its members after update! Aura::Update(diff); // remove aura if out-of-range from caster (after teleport for example) @@ -814,53 +810,53 @@ void AreaAura::Update(uint32 diff) // or caster is (no longer) friendly bool needFriendly = (m_areaAuraType == AREA_AURA_ENEMY ? false : true); if( !caster || caster->hasUnitState(UNIT_STAT_ISOLATED) || - !caster->IsWithinDistInMap(tmp_target, m_radius) || - !caster->HasAura(tmp_spellId, tmp_effIndex) || - caster->IsFriendlyTo(tmp_target) != needFriendly + !caster->IsWithinDistInMap(m_target, m_radius) || + !caster->HasAura(GetId(), GetEffIndex()) || + caster->IsFriendlyTo(m_target) != needFriendly ) { - tmp_target->RemoveAura(tmp_spellId, tmp_effIndex); + m_target->RemoveAura(GetId(), GetEffIndex()); } else if( m_areaAuraType == AREA_AURA_PARTY) // check if in same sub group { // not check group if target == owner or target == pet - if (caster->GetCharmerOrOwnerGUID() != tmp_target->GetGUID() && caster->GetGUID() != tmp_target->GetCharmerOrOwnerGUID()) + if (caster->GetCharmerOrOwnerGUID() != m_target->GetGUID() && caster->GetGUID() != m_target->GetCharmerOrOwnerGUID()) { Player* check = caster->GetCharmerOrOwnerPlayerOrPlayerItself(); Group *pGroup = check ? check->GetGroup() : NULL; if( pGroup ) { - Player* checkTarget = tmp_target->GetCharmerOrOwnerPlayerOrPlayerItself(); + Player* checkTarget = m_target->GetCharmerOrOwnerPlayerOrPlayerItself(); if(!checkTarget || !pGroup->SameSubGroup(check, checkTarget)) - tmp_target->RemoveAura(tmp_spellId, tmp_effIndex); + m_target->RemoveAura(GetId(), GetEffIndex()); } else - tmp_target->RemoveAura(tmp_spellId, tmp_effIndex); + m_target->RemoveAura(GetId(), GetEffIndex()); } } else if( m_areaAuraType == AREA_AURA_RAID) // TODO: fix me! { // not check group if target == owner or target == pet - if (caster->GetCharmerOrOwnerGUID() != tmp_target->GetGUID() && caster->GetGUID() != tmp_target->GetCharmerOrOwnerGUID()) + if (caster->GetCharmerOrOwnerGUID() != m_target->GetGUID() && caster->GetGUID() != m_target->GetCharmerOrOwnerGUID()) { Player* check = caster->GetCharmerOrOwnerPlayerOrPlayerItself(); Group *pGroup = check ? check->GetGroup() : NULL; if( pGroup ) { - Player* checkTarget = tmp_target->GetCharmerOrOwnerPlayerOrPlayerItself(); + Player* checkTarget = m_target->GetCharmerOrOwnerPlayerOrPlayerItself(); if(!checkTarget) - tmp_target->RemoveAura(tmp_spellId, tmp_effIndex); + m_target->RemoveAura(GetId(), GetEffIndex()); } else - tmp_target->RemoveAura(tmp_spellId, tmp_effIndex); + m_target->RemoveAura(GetId(), GetEffIndex()); } } else if( m_areaAuraType == AREA_AURA_PET || m_areaAuraType == AREA_AURA_OWNER ) { - if( tmp_target->GetGUID() != caster->GetCharmerOrOwnerGUID() ) - tmp_target->RemoveAura(tmp_spellId, tmp_effIndex); + if( m_target->GetGUID() != caster->GetCharmerOrOwnerGUID() ) + m_target->RemoveAura(GetId(), GetEffIndex()); } } } @@ -871,8 +867,7 @@ void PersistentAreaAura::Update(uint32 diff) // remove the aura if its caster or the dynamic object causing it was removed // or if the target moves too far from the dynamic object - Unit *caster = GetCaster(); - if (caster) + if(Unit *caster = GetCaster()) { DynamicObject *dynObj = caster->GetDynObject(GetId(), GetEffIndex()); if (dynObj) @@ -886,25 +881,20 @@ void PersistentAreaAura::Update(uint32 diff) else remove = true; - Unit *tmp_target = m_target; - uint32 tmp_id = GetId(), tmp_index = GetEffIndex(); - - // WARNING: the aura may get deleted during the update - // DO NOT access its members after update! Aura::Update(diff); if(remove) - tmp_target->RemoveAura(tmp_id, tmp_index); + m_target->RemoveAura(GetId(), GetEffIndex()); } void Aura::ApplyModifier(bool apply, bool Real) { AuraType aura = m_modifier.m_auraname; - m_in_use = true; + SetInUse(true); if(aura < TOTAL_AURAS) (*this.*AuraHandler [aura])(apply, Real); - m_in_use = false; + SetInUse(false); } void Aura::_AddAura() @@ -3609,47 +3599,44 @@ void Aura::HandleAuraModStun(bool apply, bool Real) void Aura::HandleModStealth(bool apply, bool Real) { - Unit* pTarget = m_target; - SpellEntry const* pSpellInfo = GetSpellProto(); - if (apply) { // drop flag at stealth in bg - pTarget->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); + m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); // only at real aura add if (Real) { - pTarget->SetStandFlags(UNIT_STAND_FLAGS_CREEP); + m_target->SetStandFlags(UNIT_STAND_FLAGS_CREEP); - if (pTarget->GetTypeId()==TYPEID_PLAYER) - pTarget->SetFlag(PLAYER_FIELD_BYTES2, 0x2000); + if (m_target->GetTypeId()==TYPEID_PLAYER) + m_target->SetFlag(PLAYER_FIELD_BYTES2, 0x2000); // apply only if not in GM invisibility (and overwrite invisibility state) - if (pTarget->GetVisibility()!=VISIBILITY_OFF) + if (m_target->GetVisibility()!=VISIBILITY_OFF) { - pTarget->SetVisibility(VISIBILITY_GROUP_NO_DETECT); - pTarget->SetVisibility(VISIBILITY_GROUP_STEALTH); + m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); + m_target->SetVisibility(VISIBILITY_GROUP_STEALTH); } // apply full stealth period bonuses only at first stealth aura in stack - if(pTarget->GetAurasByType(SPELL_AURA_MOD_STEALTH).size()<=1) + if(m_target->GetAurasByType(SPELL_AURA_MOD_STEALTH).size()<=1) { - Unit::AuraList const& mDummyAuras = pTarget->GetAurasByType(SPELL_AURA_DUMMY); + Unit::AuraList const& mDummyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i) { // Master of Subtlety if ((*i)->GetSpellProto()->SpellIconID == 2114) { - pTarget->RemoveAurasDueToSpell(31666); + m_target->RemoveAurasDueToSpell(31666); int32 bp = (*i)->GetModifier()->m_amount; - pTarget->CastCustomSpell(pTarget,31665,&bp,NULL,NULL,true); + m_target->CastCustomSpell(m_target,31665,&bp,NULL,NULL,true); } // Overkill - else if ((*i)->GetId() == 58426 && pSpellInfo->SpellFamilyFlags & UI64LIT(0x0000000000400000)) + else if ((*i)->GetId() == 58426 && GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000400000)) { - pTarget->RemoveAurasDueToSpell(58428); - pTarget->CastSpell(pTarget, 58427, true); + m_target->RemoveAurasDueToSpell(58428); + m_target->CastSpell(m_target, 58427, true); } } } @@ -3658,36 +3645,36 @@ void Aura::HandleModStealth(bool apply, bool Real) else { // only at real aura remove of _last_ SPELL_AURA_MOD_STEALTH - if (Real && !pTarget->HasAuraType(SPELL_AURA_MOD_STEALTH)) + if (Real && !m_target->HasAuraType(SPELL_AURA_MOD_STEALTH)) { // if no GM invisibility - if(pTarget->GetVisibility()!=VISIBILITY_OFF) + if (m_target->GetVisibility()!=VISIBILITY_OFF) { - pTarget->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP); + m_target->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP); - if (pTarget->GetTypeId()==TYPEID_PLAYER) - pTarget->RemoveFlag(PLAYER_FIELD_BYTES2, 0x2000); + if (m_target->GetTypeId()==TYPEID_PLAYER) + m_target->RemoveFlag(PLAYER_FIELD_BYTES2, 0x2000); // restore invisibility if any - if (pTarget->HasAuraType(SPELL_AURA_MOD_INVISIBILITY)) + if (m_target->HasAuraType(SPELL_AURA_MOD_INVISIBILITY)) { - pTarget->SetVisibility(VISIBILITY_GROUP_NO_DETECT); - pTarget->SetVisibility(VISIBILITY_GROUP_INVISIBILITY); + m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); + m_target->SetVisibility(VISIBILITY_GROUP_INVISIBILITY); } else - pTarget->SetVisibility(VISIBILITY_ON); + m_target->SetVisibility(VISIBILITY_ON); } // apply delayed talent bonus remover at last stealth aura remove - Unit::AuraList const& mDummyAuras = pTarget->GetAurasByType(SPELL_AURA_DUMMY); + Unit::AuraList const& mDummyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i) { // Master of Subtlety if ((*i)->GetSpellProto()->SpellIconID == 2114) - pTarget->CastSpell(pTarget, 31666, true); + m_target->CastSpell(m_target, 31666, true); // Overkill - else if ((*i)->GetId() == 58426 && pSpellInfo->SpellFamilyFlags & UI64LIT(0x0000000000400000)) - pTarget->CastSpell(pTarget, 58428, true); + else if ((*i)->GetId() == 58426 && GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000400000)) + m_target->CastSpell(m_target, 58428, true); } } } @@ -4048,38 +4035,34 @@ void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real) void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/) { - // cache values in local vars for prevent access to possible deleted aura data - SpellEntry const* spellInfo = GetSpellProto(); uint32 misc = m_modifier.m_miscvalue; - Unit* target = m_target; - // Forbearance // in DBC wrong mechanic immune since 3.0.x if (GetId() == 25771) misc = MECHANIC_IMMUNE_SHIELD; - if(apply && spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) + if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) { - uint32 mechanic = 1 << m_modifier.m_miscvalue; + uint32 mechanic = 1 << misc; //immune movement impairment and loss of control if(GetId()==42292 || GetId()==59752) mechanic=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; - Unit::AuraMap& Auras = target->GetAuras(); + Unit::AuraMap& Auras = m_target->GetAuras(); for(Unit::AuraMap::iterator iter = Auras.begin(), next; iter != Auras.end(); iter = next) { next = iter; ++next; SpellEntry const *spell = iter->second->GetSpellProto(); if (!( spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) && // spells unaffected by invulnerability - spell->Id != spellInfo->Id) + spell->Id != GetId()) { //check for mechanic mask if(GetSpellMechanicMask(spell, iter->second->GetEffIndex()) & mechanic) { - target->RemoveAurasDueToSpell(spell->Id); + m_target->RemoveAurasDueToSpell(spell->Id); if(Auras.empty()) break; else @@ -4089,13 +4072,13 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/) } } - target->ApplySpellImmune(spellInfo->Id,IMMUNITY_MECHANIC,misc,apply); + m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,misc,apply); // Bestial Wrath - if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->SpellIconID == 1680) + if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_HUNTER && GetSpellProto()->SpellIconID == 1680) { // The Beast Within cast on owner if talent present - if (Unit* owner = target->GetOwner()) + if (Unit* owner = m_target->GetOwner()) { // Search talent Unit::AuraList const& dummyAuras = owner->GetAurasByType(SPELL_AURA_DUMMY); @@ -4112,25 +4095,6 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/) } } } - - // The Beast Within and Bestial Wrath - immunity - if (spellInfo->Id == 19574 || spellInfo->Id == 34471) - { - if (apply) - { - target->CastSpell(target, 24395, true); - target->CastSpell(target, 24396, true); - target->CastSpell(target, 24397, true); - target->CastSpell(target, 26592, true); - } - else - { - target->RemoveAurasDueToSpell(24395); - target->RemoveAurasDueToSpell(24396); - target->RemoveAurasDueToSpell(24397); - target->RemoveAurasDueToSpell(26592); - } - } } //this method is called whenever we add / remove aura which gives m_target some imunity to some spell effect @@ -5565,6 +5529,7 @@ void Aura::HandleSpellSpecificBoosts(bool apply) uint32 spellId1 = 0; uint32 spellId2 = 0; uint32 spellId3 = 0; + uint32 spellId4 = 0; switch(GetSpellProto()->SpellFamilyName) { @@ -5591,15 +5556,19 @@ void Aura::HandleSpellSpecificBoosts(bool apply) } case SPELLFAMILY_HUNTER: { - if(GetSpellSpecific(m_spellProto->Id) != SPELL_ASPECT) - return; - + // The Beast Within and Bestial Wrath - immunity + if (GetId() == 19574 || GetId() == 34471) + { + spellId1 = 24395; + spellId2 = 24396; + spellId3 = 24397; + spellId4 = 26592; + } // Aspect of the Dragonhawk dodge - if (GetSpellProto()->SpellFamilyFlags2 & 0x00001000) + else if(GetSpellProto()->SpellFamilyFlags2 & 0x00001000) spellId1 = 61848; else return; - break; } case SPELLFAMILY_PALADIN: @@ -5649,6 +5618,8 @@ void Aura::HandleSpellSpecificBoosts(bool apply) m_target->CastSpell(m_target, spellId2, true, NULL, this); if (spellId3) m_target->CastSpell(m_target, spellId3, true, NULL, this); + if (spellId4) + m_target->CastSpell(m_target, spellId4, true, NULL, this); } else { @@ -5658,6 +5629,8 @@ void Aura::HandleSpellSpecificBoosts(bool apply) m_target->RemoveAurasByCasterSpell(spellId2, GetCasterGUID()); if (spellId3) m_target->RemoveAurasByCasterSpell(spellId3, GetCasterGUID()); + if (spellId4) + m_target->RemoveAurasByCasterSpell(spellId4, GetCasterGUID()); } } @@ -5892,32 +5865,26 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) switch(m_spellProto->SpellFamilyName) { case SPELLFAMILY_PRIEST: - if(m_spellProto->SpellFamilyFlags == 0x1) //PW:S - { - //+30% from +healing bonus - DoneActualBenefit = caster->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellProto)) * 0.3f; - break; - } + // Power Word: Shield + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001)) + //+80.68% from +spell bonus + DoneActualBenefit = caster->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellProto)) * 0.8068f; break; case SPELLFAMILY_MAGE: - if (m_spellProto->SpellFamilyFlags == UI64LIT(0x80100) || - m_spellProto->SpellFamilyFlags == UI64LIT(0x8) || - m_spellProto->SpellFamilyFlags == UI64LIT(0x100000000)) - { - //frost ward, fire ward, ice barrier - //+10% from +spd bonus + // Frost Ward, Fire Ward + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000108)) + //+10% from +spell bonus DoneActualBenefit = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.1f; - break; - } + // Ice Barrier + else if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000100000000)) + //+80.67% from +spell bonus + DoneActualBenefit = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.8067f; break; case SPELLFAMILY_WARLOCK: - if(m_spellProto->SpellFamilyFlags == 0x00) - { - //shadow ward - //+10% from +spd bonus - DoneActualBenefit = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.1f; - break; - } + // Shadow Ward + if (m_spellProto->SpellFamilyFlags2 & 0x00000040) + //+30% from +spell bonus + DoneActualBenefit = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.30f; break; default: break; @@ -6121,18 +6088,15 @@ void Aura::PeriodicTick() SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, absorb, resist, 0.0f, isCrit); m_target->SendPeriodicAuraLog(&pInfo); - Unit* target = m_target; // aura can be deleted in DealDamage - SpellEntry const* spellProto = GetSpellProto(); - // Set trigger flag uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC; // | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT; uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;// | PROC_FLAG_TAKEN_HARMFUL_SPELL_HIT; pdamage = (pdamage <= absorb + resist) ? 0 : (pdamage - absorb - resist); if (pdamage) procVictim|=PROC_FLAG_TAKEN_ANY_DAMAGE; - pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto); + pCaster->ProcDamageAndSpell(m_target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, GetSpellProto()); - pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(spellProto), spellProto, true); + pCaster->DealDamage(m_target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true); break; } case SPELL_AURA_PERIODIC_LEECH: @@ -6184,10 +6148,7 @@ void Aura::PeriodicTick() pCaster->SendSpellNonMeleeDamageLog(m_target, GetId(), pdamage, GetSpellSchoolMask(GetSpellProto()), absorb, resist, false, 0); - Unit* target = m_target; // aura can be deleted in DealDamage - SpellEntry const* spellProto = GetSpellProto(); - float multiplier = spellProto->EffectMultipleValue[GetEffIndex()] > 0 ? spellProto->EffectMultipleValue[GetEffIndex()] : 1; - int32 stackAmount = GetStackAmount(); + float multiplier = GetSpellProto()->EffectMultipleValue[GetEffIndex()] > 0 ? GetSpellProto()->EffectMultipleValue[GetEffIndex()] : 1; // Set trigger flag uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC; // | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT; @@ -6195,26 +6156,26 @@ void Aura::PeriodicTick() pdamage = (pdamage <= absorb + resist) ? 0 : (pdamage-absorb-resist); if (pdamage) procVictim|=PROC_FLAG_TAKEN_ANY_DAMAGE; - pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto); - int32 new_damage = pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(spellProto), spellProto, false); + pCaster->ProcDamageAndSpell(m_target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, GetSpellProto()); + int32 new_damage = pCaster->DealDamage(m_target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), false); - if (!target->isAlive() && pCaster->IsNonMeleeSpellCasted(false)) + if (!m_target->isAlive() && pCaster->IsNonMeleeSpellCasted(false)) { for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) { - if (pCaster->m_currentSpells[i] && pCaster->m_currentSpells[i]->m_spellInfo->Id == spellProto->Id) + if (pCaster->m_currentSpells[i] && pCaster->m_currentSpells[i]->m_spellInfo->Id == GetId()) pCaster->m_currentSpells[i]->cancel(); } } if(Player *modOwner = pCaster->GetSpellModOwner()) - modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_MULTIPLE_VALUE, multiplier); + modOwner->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE, multiplier); - uint32 heal = pCaster->SpellHealingBonus(pCaster, spellProto, uint32(new_damage * multiplier), DOT, stackAmount); + uint32 heal = pCaster->SpellHealingBonus(pCaster, GetSpellProto(), uint32(new_damage * multiplier), DOT, GetStackAmount()); - int32 gain = pCaster->DealHeal(pCaster, heal, spellProto); - pCaster->getHostilRefManager().threatAssist(pCaster, gain * 0.5f, spellProto); + int32 gain = pCaster->DealHeal(pCaster, heal, GetSpellProto()); + pCaster->getHostilRefManager().threatAssist(pCaster, gain * 0.5f, GetSpellProto()); break; } case SPELL_AURA_PERIODIC_HEAL: diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 6fc9d83a9..c84415440 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -292,16 +292,24 @@ class MANGOS_DLL_SPEC Aura bool IsDeathPersistent() const { return m_isDeathPersist; } bool IsRemovedOnShapeLost() const { return m_isRemovedOnShapeLost; } bool IsInUse() const { return m_in_use;} + bool IsDeleted() const { return m_deleted;} - virtual void Update(uint32 diff); + void SetInUse(bool state) + { + if(state) + ++m_in_use; + else + { + if(m_in_use) + --m_in_use; + } + } void ApplyModifier(bool apply, bool Real = false); + void UpdateAura(uint32 diff) { SetInUse(true); Update(diff); SetInUse(false); } void _AddAura(); bool _RemoveAura(); - bool IsUpdated() { return m_updated; } - void SetUpdated(bool val) { m_updated = val; } - bool IsSingleTarget() {return m_isSingleTargetAura;} void SetIsSingleTarget(bool val) { m_isSingleTargetAura = val;} @@ -319,14 +327,19 @@ class MANGOS_DLL_SPEC Aura void TriggerSpell(); void TriggerSpellWithValue(); - void PeriodicTick(); - void PeriodicDummyTick(); uint32 const *getAuraSpellClassMask() const { return m_spellProto->EffectSpellClassMaskA + m_effIndex * 3; } bool isAffectedOnSpell(SpellEntry const *spell) const; protected: Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL); + // must be called only from Aura::UpdateAura + virtual void Update(uint32 diff); + + // must be called only from Aura*::Update + void PeriodicTick(); + void PeriodicDummyTick(); + bool IsCritFromAbilityAura(Unit* caster, uint32& damage); Modifier m_modifier; @@ -362,10 +375,10 @@ class MANGOS_DLL_SPEC Aura bool m_isPersistent:1; bool m_isDeathPersist:1; bool m_isRemovedOnShapeLost:1; - bool m_updated:1; // Prevent remove aura by stack if set - bool m_in_use:1; // true while in Aura::ApplyModifier call + bool m_deleted:1; // true if RemoveAura(iterator) called while in Aura::ApplyModifier call (added to Unit::m_deletedAuras) bool m_isSingleTargetAura:1; // true if it's a single target spell and registered at caster - can change at spell steal for example + uint32 m_in_use; // > 0 while in Aura::ApplyModifier call/Aura::Update/etc private: void CleanupTriggeredSpells(); }; @@ -375,6 +388,7 @@ class MANGOS_DLL_SPEC AreaAura : public Aura public: AreaAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL); ~AreaAura(); + protected: void Update(uint32 diff); private: float m_radius; @@ -386,6 +400,7 @@ class MANGOS_DLL_SPEC PersistentAreaAura : public Aura public: PersistentAreaAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL); ~PersistentAreaAura(); + protected: void Update(uint32 diff); }; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 1d7aa31a2..39fb1558e 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2409,11 +2409,6 @@ void Spell::EffectApplyAura(uint32 i) if (!added) return; - // found crash at character loading, broken pointer to Aur... - // Aur was deleted in AddAura()... - if(!Aur) - return; - // Prayer of Mending (jump animation), we need formal caster instead original for correct animation if( m_spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000002000000000))) m_caster->CastSpell(unitTarget, 41637, true, NULL, Aur, m_originalCasterGUID); @@ -5266,6 +5261,26 @@ void Spell::EffectScriptEffect(uint32 effIndex) m_caster->CastCustomSpell(target, spellId, &basePoint, 0, 0, false); return; } + case 53412: // Invigoration (pet triggered script, master targeted) + { + if (!unitTarget) + return; + + Unit::AuraList const& auras = unitTarget->GetAurasByType(SPELL_AURA_DUMMY); + for(Unit::AuraList::const_iterator i = auras.begin();i != auras.end(); ++i) + { + // Invigoration (master talent) + if ((*i)->GetModifier()->m_miscvalue == 8 && (*i)->GetSpellProto()->SpellIconID == 3487) + { + if (roll_chance_i((*i)->GetModifier()->m_amount)) + { + unitTarget->CastSpell(unitTarget, 53398, true, NULL, (*i), m_caster->GetGUID()); + break; + } + } + } + return; + } default: break; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 885de4c0a..49c3b1a69 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -102,7 +102,7 @@ Unit::Unit() //m_Aura = NULL; //m_AurasCheck = 2000; //m_removeAuraTimer = 4; - //tmpAura = NULL; + m_AurasUpdateIterator = m_Auras.end(); m_Visibility = VISIBILITY_ON; @@ -148,7 +148,6 @@ Unit::Unit() for (int i = 0; i < MAX_MOVE_TYPE; ++i) m_speed_rate[i] = 1.0f; - m_removedAuras = 0; m_charmInfo = NULL; // remove aurastates allowing special moves @@ -192,6 +191,11 @@ void Unit::Update( uint32 p_time ) m_Events.Update( p_time ); _UpdateSpells( p_time ); + // really delete auras "deleted" while processing its ApplyModify code + for(AuraList::const_iterator itr = m_deletedAuras.begin(); itr != m_deletedAuras.begin(); ++itr) + delete *itr; + m_deletedAuras.clear(); + // update combat timer only for players and pets if (isInCombat() && (GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->isPet() || ((Creature*)this)->isCharmed())) { @@ -1509,18 +1513,14 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) // victim's damage shield std::set alreadyDone; - uint32 removedAuras = pVictim->m_removedAuras; AuraList const& vDamageShields = pVictim->GetAurasByType(SPELL_AURA_DAMAGE_SHIELD); - for(AuraList::const_iterator i = vDamageShields.begin(), next = vDamageShields.begin(); i != vDamageShields.end(); i = next) + for(AuraList::const_iterator i = vDamageShields.begin(); i != vDamageShields.end();) { - next++; if (alreadyDone.find(*i) == alreadyDone.end()) { alreadyDone.insert(*i); uint32 damage=(*i)->GetModifier()->m_amount; - SpellEntry const *spellProto = sSpellStore.LookupEntry((*i)->GetId()); - if(!spellProto) - continue; + SpellEntry const *i_spellProto = (*i)->GetSpellProto(); //Calculate absorb resist ??? no data in opcode for this possibly unable to absorb or resist? //uint32 absorb; //uint32 resist; @@ -1532,20 +1532,18 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) WorldPacket data(SMSG_SPELLDAMAGESHIELD,(8+8+4+4+4+4)); data << uint64(pVictim->GetGUID()); data << uint64(GetGUID()); - data << uint32(spellProto->Id); + data << uint32(i_spellProto->Id); data << uint32(damage); // Damage data << uint32(0); // Overkill - data << uint32(spellProto->SchoolMask); + data << uint32(i_spellProto->SchoolMask); pVictim->SendMessageToSet(&data, true ); - pVictim->DealDamage(this, damage, 0, SPELL_DIRECT_DAMAGE, GetSpellSchoolMask(spellProto), spellProto, true); + pVictim->DealDamage(this, damage, 0, SPELL_DIRECT_DAMAGE, GetSpellSchoolMask(i_spellProto), i_spellProto, true); - if (pVictim->m_removedAuras > removedAuras) - { - removedAuras = pVictim->m_removedAuras; - next = vDamageShields.begin(); - } + i = vDamageShields.begin(); } + else + ++i; } } } @@ -2962,50 +2960,27 @@ void Unit::_UpdateSpells( uint32 time ) } } - // TODO: Find a better way to prevent crash when multiple auras are removed. - m_removedAuras = 0; - for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i) - if ((*i).second) - (*i).second->SetUpdated(false); - - for (AuraMap::iterator i = m_Auras.begin(), next; i != m_Auras.end(); i = next) + // update auras + // m_AurasUpdateIterator can be updated in inderect called code at aura remove to skip next planned to update but removed auras + for (m_AurasUpdateIterator = m_Auras.begin(); m_AurasUpdateIterator != m_Auras.end();) { - next = i; - ++next; - if ((*i).second) - { - // prevent double update - if ((*i).second->IsUpdated()) - continue; - (*i).second->SetUpdated(true); - (*i).second->Update( time ); - // several auras can be deleted due to update - if (m_removedAuras) - { - if (m_Auras.empty()) break; - next = m_Auras.begin(); - m_removedAuras = 0; - } - } + Aura* i_aura = m_AurasUpdateIterator->second; + ++m_AurasUpdateIterator; // need shift to next for allow update if need into aura update + i_aura->UpdateAura(time); } + // remove expired auras for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end();) { if ((*i).second) { if ( !(*i).second->GetAuraDuration() && !((*i).second->IsPermanent() || ((*i).second->IsPassive())) ) - { RemoveAura(i); - } else - { ++i; - } } else - { ++i; - } } if(!m_gameObj.empty()) @@ -3538,6 +3513,11 @@ bool Unit::AddAura(Aura *Aur) Aur->ApplyModifier(true,true); sLog.outDebug("Aura %u now is in use", aurName); + // if aura deleted before boosts apply ignore + // this can be possible it it removed indirectly by triggered spell effect at ApplyModifier + if (Aur->IsDeleted()) + return false; + if(IsSpellLastAuraEffect(aurSpellInfo,Aur->GetEffIndex())) Aur->HandleSpellSpecificBoosts(true); @@ -3955,10 +3935,16 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) // Set remove mode Aur->SetRemoveMode(mode); + + // if unit currently update aura list then make safe update iterator shift to next + if (m_AurasUpdateIterator == i) + ++m_AurasUpdateIterator; + // some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura // remove aura from list before to prevent deleting it before m_Auras.erase(i); - ++m_removedAuras; // internal count used by unit update + + // now aura removed from from list and can't be deleted by indirect call but can be referenced from callers // Statue unsummoned at aura remove Totem* statue = NULL; @@ -3986,7 +3972,12 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) Aur->HandleSpellSpecificBoosts(false); } - delete Aur; + // If aura in use (removed from code that plan access to it data after return) + // store it in aura list with delayed deletion + if (Aur->IsInUse()) + m_deletedAuras.push_back(Aur); + else + delete Aur; if(caster_channeled) RemoveAurasAtChanneledTarget (AurSpellInfo); @@ -4735,32 +4726,11 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu break; } /* - // TODO: need find item for aura and triggered spells // Sunwell Exalted Caster Neck (??? neck) // cast ??? Light's Wrath if Exalted by Aldor // cast ??? Arcane Bolt if Exalted by Scryers*/ case 46569: - return false; // disable for while - /* - { - if(GetTypeId() != TYPEID_PLAYER) - return false; - - // Get Aldor reputation rank - if (((Player *)this)->GetReputationRank(932) == REP_EXALTED) - { - target = this; - triggered_spell_id = ??? - break; - } - // Get Scryers reputation rank - if (((Player *)this)->GetReputationRank(934) == REP_EXALTED) - { - triggered_spell_id = ??? - break; - } - return false; - }*/ + return false; // old unused version // Sunwell Exalted Caster Neck (Shattered Sun Pendant of Acumen neck) // cast 45479 Light's Wrath if Exalted by Aldor // cast 45429 Arcane Bolt if Exalted by Scryers @@ -4779,6 +4749,21 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Get Scryers reputation rank if (((Player *)this)->GetReputationRank(934) == REP_EXALTED) { + // triggered at positive/self casts also, current attack target used then + if(IsFriendlyTo(target)) + { + target = getVictim(); + if(!target) + { + uint64 selected_guid = ((Player *)this)->GetSelection(); + target = ObjectAccessor::GetUnit(*this,selected_guid); + if(!target) + return false; + } + if(IsFriendlyTo(target)) + return false; + } + triggered_spell_id = 45429; break; } @@ -7996,13 +7981,38 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } // Custom scripted damage - // Ice Lance - if (spellProto->SpellFamilyName == SPELLFAMILY_MAGE && spellProto->SpellIconID == 186) + switch(spellProto->SpellFamilyName) { - if (pVictim->isFrozen()) - DoneTotalMod *= 3.0f; + case SPELLFAMILY_MAGE: + { + // Ice Lance + if (spellProto->SpellIconID == 186) + { + if (pVictim->isFrozen()) + DoneTotalMod *= 3.0f; + } + // Torment the weak affected (Arcane Barrage, Arcane Blast, Frostfire Bolt, Arcane Missiles, Fireball) + if ((spellProto->SpellFamilyFlags & UI64LIT(0x0000900020200021)) && + (pVictim->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || pVictim->HasAuraType(SPELL_AURA_MELEE_SLOW))) + { + //Search for Torment the weak dummy aura + Unit::AuraList const& ttw = GetAurasByType(SPELL_AURA_DUMMY); + for(Unit::AuraList::const_iterator i = ttw.begin(); i != ttw.end(); ++i) + { + if ((*i)->GetSpellProto()->SpellIconID == 3263) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f) / 100.0f; + break; + } + } + } + break; + } + default: + break; } + // ..taken AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i) @@ -10555,7 +10565,7 @@ CharmInfo* Unit::InitCharmInfo(Unit *charm) CharmInfo::CharmInfo(Unit* unit) : m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0) { - for(int i =0; i<4; ++i) + for(int i = 0; i < CREATURE_MAX_SPELLS; ++i) m_charmspells[i].SetActionAndType(0,ACT_DISABLED); } @@ -10940,6 +10950,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag if(!IsTriggeredAtSpellProcEvent(pTarget, itr->second, procSpell, procFlag, procExtra, attType, isVictim, (damage > 0), spellProcEvent)) continue; + itr->second->SetInUse(true); // prevent aura deletion procTriggered.push_back( ProcTriggeredData(spellProcEvent, itr->second) ); } @@ -10951,33 +10962,11 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag for(ProcTriggeredList::const_iterator i = procTriggered.begin(); i != procTriggered.end(); ++i) { // Some auras can be deleted in function called in this loop (except first, ofc) - // Until storing auars in std::multimap to hard check deleting by another way - if(i != procTriggered.begin()) - { - bool found = false; - AuraMap::const_iterator lower = GetAuras().lower_bound(i->triggeredByAura_SpellPair); - AuraMap::const_iterator upper = GetAuras().upper_bound(i->triggeredByAura_SpellPair); - for(AuraMap::const_iterator itr = lower; itr!= upper; ++itr) - { - if(itr->second==i->triggeredByAura) - { - found = true; - break; - } - } - if(!found) - { -// sLog.outDebug("Spell aura %u (id:%u effect:%u) has been deleted before call spell proc event handler", i->triggeredByAura->GetModifier()->m_auraname, i->triggeredByAura_SpellPair.first, i->triggeredByAura_SpellPair.second); -// sLog.outDebug("It can be deleted one from early proccesed auras:"); -// for(ProcTriggeredList::const_iterator i2 = procTriggered.begin(); i != i2; ++i2) -// sLog.outDebug(" Spell aura %u (id:%u effect:%u)", i->triggeredByAura->GetModifier()->m_auraname,i2->triggeredByAura_SpellPair.first,i2->triggeredByAura_SpellPair.second); -// sLog.outDebug(" "); - continue; - } - } + Aura *triggeredByAura = i->triggeredByAura; + if(triggeredByAura->IsDeleted()) + continue; SpellProcEventEntry const *spellProcEvent = i->spellProcEvent; - Aura *triggeredByAura = i->triggeredByAura; Modifier *auraModifier = triggeredByAura->GetModifier(); SpellEntry const *spellInfo = triggeredByAura->GetSpellProto(); bool useCharges = triggeredByAura->GetAuraCharges() > 0; @@ -10993,7 +10982,10 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag sLog.outDebug("ProcDamageAndSpell: casting spell %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); // Don`t drop charge or add cooldown for not started trigger if (!HandleProcTriggerSpell(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) + { + triggeredByAura->SetInUse(false); continue; + } break; } case SPELL_AURA_PROC_TRIGGER_DAMAGE: @@ -11013,21 +11005,30 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag { sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s dummy aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); if (!HandleDummyAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) + { + triggeredByAura->SetInUse(false); continue; + } break; } case SPELL_AURA_MOD_HASTE: { sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s haste aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); if (!HandleHasteAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) + { + triggeredByAura->SetInUse(false); continue; + } break; } case SPELL_AURA_OVERRIDE_CLASS_SCRIPTS: { sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); if (!HandleOverrideClassScriptAuraProc(pTarget, damage, triggeredByAura, procSpell, cooldown)) + { + triggeredByAura->SetInUse(false); continue; + } break; } case SPELL_AURA_PRAYER_OF_MENDING: @@ -11043,18 +11044,27 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag sLog.outDebug("ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); if (!HandleProcTriggerSpell(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) + { + triggeredByAura->SetInUse(false); continue; + } break; } case SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK: // Skip melee hits or instant cast spells if (procSpell == NULL || GetSpellCastTime(procSpell) == 0) + { + triggeredByAura->SetInUse(false); continue; + } break; case SPELL_AURA_REFLECT_SPELLS_SCHOOL: // Skip Melee hits and spells ws wrong school if (procSpell == NULL || (auraModifier->m_miscvalue & procSpell->SchoolMask) == 0) + { + triggeredByAura->SetInUse(false); continue; + } break; case SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT: case SPELL_AURA_MOD_POWER_COST_SCHOOL: @@ -11062,47 +11072,56 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag if (procSpell == NULL || (procSpell->manaCost == 0 && procSpell->ManaCostPercentage == 0) || // Cost check (auraModifier->m_miscvalue & procSpell->SchoolMask) == 0) // School check + { + triggeredByAura->SetInUse(false); continue; + } break; case SPELL_AURA_MECHANIC_IMMUNITY: // Compare mechanic if (procSpell==NULL || procSpell->Mechanic != auraModifier->m_miscvalue) + { + triggeredByAura->SetInUse(false); continue; + } break; case SPELL_AURA_MOD_MECHANIC_RESISTANCE: // Compare mechanic if (procSpell==NULL || procSpell->Mechanic != auraModifier->m_miscvalue) + { + triggeredByAura->SetInUse(false); continue; + } break; case SPELL_AURA_MOD_DAMAGE_FROM_CASTER: // Compare casters if (triggeredByAura->GetCasterGUID() != pTarget->GetGUID()) + { + triggeredByAura->SetInUse(false); continue; + } break; case SPELL_AURA_MOD_SPELL_CRIT_CHANCE: if (!procSpell) + { + triggeredByAura->SetInUse(false); continue; + } break; default: // nothing do, just charges counter break; } + // Remove charge (aura can be removed by triggers) - if(useCharges) + if(useCharges && !triggeredByAura->IsDeleted()) { - // need found aura on drop (can be dropped by triggers) - AuraMap::const_iterator lower = GetAuras().lower_bound(i->triggeredByAura_SpellPair); - AuraMap::const_iterator upper = GetAuras().upper_bound(i->triggeredByAura_SpellPair); - for(AuraMap::const_iterator itr = lower; itr!= upper; ++itr) - { - // If last charge dropped add spell to remove list - if(itr->second == i->triggeredByAura && triggeredByAura->DropAuraCharge()) - { - removedSpells.push_back(triggeredByAura->GetId()); - break; - } - } + // If last charge dropped add spell to remove list + if(triggeredByAura->DropAuraCharge()) + removedSpells.push_back(triggeredByAura->GetId()); } + + triggeredByAura->SetInUse(false); } if (!removedSpells.empty()) { diff --git a/src/game/Unit.h b/src/game/Unit.h index 89fdf816e..608d60cf9 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -829,7 +829,7 @@ struct CharmInfo Unit* m_unit; UnitActionBarEntry PetActionBar[MAX_UNIT_ACTION_BAR_INDEX]; - CharmSpellEntry m_charmspells[4]; + CharmSpellEntry m_charmspells[CREATURE_MAX_SPELLS]; CommandStates m_CommandState; ReactStates m_reactState; uint32 m_petnumber; @@ -1514,8 +1514,10 @@ class MANGOS_DLL_SPEC Unit : public WorldObject DeathState m_deathState; AuraMap m_Auras; + AuraMap::iterator m_AurasUpdateIterator; // != end() in Unit::m_Auras update and point to next element + AuraList m_deletedAuras; // auras removed while in ApplyModifier and waiting deleted - std::list m_scAuras; // casted singlecast auras + AuraList m_scAuras; // casted by unit single per-caster auras typedef std::list DynObjectGUIDs; DynObjectGUIDs m_dynObjGUIDs; @@ -1524,7 +1526,6 @@ class MANGOS_DLL_SPEC Unit : public WorldObject GameObjectList m_gameObj; bool m_isSorted; uint32 m_transform; - uint32 m_removedAuras; AuraList m_modAuras[TOTAL_AURAS]; float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END]; diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp index 5e7c05dbc..cd730e39a 100644 --- a/src/mangosd/CliRunnable.cpp +++ b/src/mangosd/CliRunnable.cpp @@ -55,7 +55,7 @@ void utf8print(const char* str) /// \todo This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm, delete account chars in realm then delete account bool ChatHandler::HandleAccountDeleteCommand(const char* args) { - if(!*args) + if (!*args) return false; ///- Get the account name from the command line @@ -64,7 +64,7 @@ bool ChatHandler::HandleAccountDeleteCommand(const char* args) return false; std::string account_name = account_name_str; - if(!AccountMgr::normilizeString(account_name)) + if (!AccountMgr::normalizeString(account_name)) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); SetSentErrorMessage(true); @@ -72,7 +72,7 @@ bool ChatHandler::HandleAccountDeleteCommand(const char* args) } uint32 account_id = accmgr.GetId(account_name); - if(!account_id) + if (!account_id) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); SetSentErrorMessage(true); @@ -219,7 +219,7 @@ bool ChatHandler::HandleAccountCreateCommand(const char* args) if(!szAcc || !szPassword) return false; - // normilized in accmgr.CreateAccount + // normalized in accmgr.CreateAccount std::string account_name = szAcc; std::string password = szPassword; diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp index 676b4297e..996cade19 100644 --- a/src/mangosd/Master.cpp +++ b/src/mangosd/Master.cpp @@ -223,8 +223,8 @@ int Master::Run() _HookSignals(); ///- Launch WorldRunnable thread - ACE_Based::Thread t(new WorldRunnable); - t.setPriority(ACE_Based::Highest); + ACE_Based::Thread world_thread(new WorldRunnable); + world_thread.setPriority(ACE_Based::Highest); // set server online loginDatabase.PExecute("UPDATE realmlist SET color = 0, population = 0 WHERE id = '%d'",realmID); @@ -241,7 +241,7 @@ int Master::Run() cliThread = new ACE_Based::Thread(new CliRunnable); } - ACE_Based::Thread td2(new RARunnable); + ACE_Based::Thread rar_thread(new RARunnable); ///- Handle affinity for multiple processors and process priority on Windows #ifdef WIN32 @@ -297,13 +297,12 @@ int Master::Run() uint32 loopCounter = 0; ///- Start up freeze catcher thread - uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0); - if(freeze_delay) + if(uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0)) { FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable(); fdr->SetDelayTime(freeze_delay*1000); - ACE_Based::Thread t(fdr); - t.setPriority(ACE_Based::Highest); + ACE_Based::Thread freeze_thread(fdr); + freeze_thread.setPriority(ACE_Based::Highest); } ///- Launch the world listener socket @@ -327,8 +326,8 @@ int Master::Run() // when the main thread closes the singletons get unloaded // since worldrunnable uses them, it will crash if unloaded after master - t.wait(); - td2.wait (); + world_thread.wait(); + rar_thread.wait (); ///- Clean database before leaving clearOnlineAccounts(); @@ -340,7 +339,7 @@ int Master::Run() sLog.outString( "Halting process..." ); - if(cliThread) + if (cliThread) { #ifdef WIN32 @@ -477,7 +476,7 @@ void Master::clearOnlineAccounts() CharacterDatabase.Execute("UPDATE characters SET online = 0 WHERE online<>0"); // Battleground instance ids reset at server restart - CharacterDatabase.Execute("UPDATE characters SET bgid = 0 WHERE bgid<>0"); + CharacterDatabase.Execute("UPDATE character_battleground_data SET instance_id = 0"); } /// Handle termination signals diff --git a/src/mangosd/RASocket.cpp b/src/mangosd/RASocket.cpp index dca788232..565226947 100644 --- a/src/mangosd/RASocket.cpp +++ b/src/mangosd/RASocket.cpp @@ -147,7 +147,7 @@ void RASocket::OnRead() std::string login = szLogin; ///- Convert Account name to Upper Format - AccountMgr::normilizeString(login); + AccountMgr::normalizeString(login); ///- Escape the Login to allow quotes in names loginDatabase.escape_string(login); @@ -189,8 +189,8 @@ void RASocket::OnRead() std::string login = szLogin; std::string pw = &buff[5]; - AccountMgr::normilizeString(login); - AccountMgr::normilizeString(pw); + AccountMgr::normalizeString(login); + AccountMgr::normalizeString(pw); loginDatabase.escape_string(login); loginDatabase.escape_string(pw); diff --git a/src/realmd/AuthSocket.h b/src/realmd/AuthSocket.h index 87cde8117..cf82f34f7 100644 --- a/src/realmd/AuthSocket.h +++ b/src/realmd/AuthSocket.h @@ -58,7 +58,7 @@ class AuthSocket: public TcpSocket void _SetVSFields(const std::string& rI); FILE *pPatch; - ACE_Thread_Mutex patcherLock; + ACE_Thread_Mutex patcherLock; bool IsLag(); private: diff --git a/src/shared/Threading.cpp b/src/shared/Threading.cpp index 25bd3120c..652f46877 100644 --- a/src/shared/Threading.cpp +++ b/src/shared/Threading.cpp @@ -103,6 +103,10 @@ Thread::Thread() : m_task(0), m_iThreadId(0), m_hThreadHandle(0) Thread::Thread(Runnable* instance) : m_task(instance), m_iThreadId(0), m_hThreadHandle(0) { + // register reference to m_task to prevent it deeltion until destructor + if (m_task) + m_task->incReference(); + bool _start = start(); ASSERT (_start); } @@ -111,8 +115,9 @@ Thread::~Thread() { //Wait(); - // deleted runnable object (owned by Thread) - delete m_task; + // deleted runnable object (if no other references) + if (m_task) + m_task->decReference(); } //initialize Thread's class static member @@ -121,15 +126,20 @@ ThreadPriority Thread::m_TpEnum; bool Thread::start() { - if(m_task == 0 || m_iThreadId != 0) + if (m_task == 0 || m_iThreadId != 0) return false; - return (ACE_Thread::spawn(&Thread::ThreadTask, (void*)m_task, THREADFLAG, &m_iThreadId, &m_hThreadHandle) == 0); + bool res = (ACE_Thread::spawn(&Thread::ThreadTask, (void*)m_task, THREADFLAG, &m_iThreadId, &m_hThreadHandle) == 0); + + if (res) + m_task->incReference(); + + return res; } bool Thread::wait() { - if(!m_hThreadHandle || !m_task) + if (!m_hThreadHandle || !m_task) return false; ACE_THR_FUNC_RETURN _value = ACE_THR_FUNC_RETURN(-1); @@ -143,7 +153,17 @@ bool Thread::wait() void Thread::destroy() { - ACE_Thread::kill(m_iThreadId, -1); + if (!m_iThreadId || !m_task) + return; + + if (ACE_Thread::kill(m_iThreadId, -1) != 0) + return; + + m_iThreadId = 0; + m_hThreadHandle = 0; + + // reference set at ACE_Thread::spawn + m_task->decReference(); } void Thread::suspend() @@ -161,6 +181,9 @@ ACE_THR_FUNC_RETURN Thread::ThreadTask(void * param) Runnable * _task = (Runnable*)param; _task->run(); + // task execution complete, free referecne added at + _task->decReference(); + return (ACE_THR_FUNC_RETURN)0; } diff --git a/src/shared/Threading.h b/src/shared/Threading.h index ab423696c..6c3f3724b 100644 --- a/src/shared/Threading.h +++ b/src/shared/Threading.h @@ -21,6 +21,7 @@ #include #include +#include "ace/Atomic_Op.h" #include #include "Errors.h" @@ -32,6 +33,15 @@ namespace ACE_Based public: virtual ~Runnable() {} virtual void run() = 0; + + void incReference() { ++m_refs; } + void decReference() + { + if(!--m_refs) + delete this; + } + private: + ACE_Atomic_Op m_refs; }; enum Priority diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index cde51ab1f..03bda0f9b 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 "8326" + #define REVISION_NR "8342" #endif // __REVISION_NR_H__