diff options
234 files changed, 2857 insertions, 1621 deletions
diff --git a/.travis.yml b/.travis.yml index 756cacfebab..4f4c6870ec7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,14 +18,14 @@ install: - mysql -uroot -e 'create database test_mysql;' - mkdir bin - cd bin - - cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=1 -DUSE_COREPCH=0 -DUSE_SCRIPTPCH=0 -DTOOLS=1 -DSCRIPTS=1 -DSERVERS=1 -DCMAKE_BUILD_TYPE=Release + - cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=1 -DUSE_COREPCH=0 -DUSE_SCRIPTPCH=0 -DTOOLS=1 -DSCRIPTS=1 -DSERVERS=1 -DNOJEM=1 -DCMAKE_BUILD_TYPE=Release script: - cd .. - mysql -uroot < sql/create/create_mysql.sql - mysql -uroot auth < sql/base/auth_database.sql - mysql -uroot characters < sql/base/characters_database.sql - - mysql -uroot world < sql/base/world_database.sql + - mysql -uroot world < sql/base/dev/world_database.sql - for file in sql/updates/world/*.sql; do mysql -uroot world < $file; done - mysql -uroot < sql/create/drop_mysql.sql - cd bin diff --git a/dep/CMakeLists.txt b/dep/CMakeLists.txt index 40ec9f931f5..5a32cb2c810 100644 --- a/dep/CMakeLists.txt +++ b/dep/CMakeLists.txt @@ -21,17 +21,21 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux") endif() if(CMAKE_SYSTEM_NAME MATCHES "Windows") - if(USE_MYSQL_SOURCES) + if(USE_MYSQL_SOURCES AND SERVERS) add_subdirectory(mysqllite) endif() if(TOOLS) add_subdirectory(bzip2) endif() - add_subdirectory(zlib) + if(SERVERS OR TOOLS) + add_subdirectory(zlib) + endif() endif() -add_subdirectory(g3dlite) -add_subdirectory(recastnavigation) +if(SERVERS OR TOOLS) + add_subdirectory(g3dlite) + add_subdirectory(recastnavigation) +endif() if(SERVERS) add_subdirectory(gsoap) diff --git a/sql/base/world_database.sql b/sql/base/dev/world_database.sql index 633b59e0556..633b59e0556 100644 --- a/sql/base/world_database.sql +++ b/sql/base/dev/world_database.sql diff --git a/sql/updates/world/2014_07_31_05_335_world_sai.sql b/sql/updates/world/2014_07_31_05_335_world_sai.sql new file mode 100644 index 00000000000..88c5c78d916 --- /dev/null +++ b/sql/updates/world/2014_07_31_05_335_world_sai.sql @@ -0,0 +1,73 @@ +UPDATE `creature_text` SET `type`=14 WHERE `entry`=8391 AND `groupid`=1 AND `id`=0; + +DELETE FROM `creature_text` WHERE `entry`IN(8421, 8391); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `BroadcastTextID`) VALUES +(8421, 0, 0, 'Fools. I knew that if I played upon my brother''s feeble emotions, he would send ''rescuers.''', 12, 0, 100, 0, 0, 0, 'Dorius', 4394), +(8421, 1, 0, 'How easy it was to manipulate you into recovering the last Suntara stone from those imbeciles of the Twilight\'s Hammer.', 12, 0, 100, 0, 0, 0, 'Dorius', 4395), +(8421, 2, 0, 'When I stumbled upon the Suntara stones at the Grimesilt Digsite, the power of Ragnaros surged through my being. It was Ragnaros that gave me a purpose.', 12, 0, 100, 0, 0, 0, 'Dorius', 4396), +(8421, 3, 0, 'It was the will of Ragnaros that Obsidion be built. Obsidion will destroy the Blackrock orcs of Blackrock Spire, uniting us with our bretheren in the fiery depths.', 12, 0, 100, 0, 0, 0, 'Dorius', 4397), +(8421, 4, 0, 'And ultimately, it was Ragnaros that named me when I was reborn as an acolyte of fire: Lathoric... Lathoric the Black.', 12, 0, 100, 0, 0, 0, 'Dorius', 4398), +(8421, 5, 0, '%s''s laughter trails off...', 16, 0, 100, 0, 0, 0, 'Dorius', 4399), +(8421, 6, 0, 'Bravo! Bravo! Good show. What? You thought I was dead?', 12, 0, 100, 0, 0, 0, 'Dorius', 4393), +(8391, 0, 0, 'Your task is complete. Prepare to meet your doom.', 12, 0, 100, 0, 0, 0, 'Lathoric the Black', 4391), +(8391, 1, 0, 'Obsidion, Rise and Serve your Master!', 14, 0, 100, 0, 0, 0, 'Lathoric the Black', 4392); + +UPDATE `gameobject_template` SET `AIName`= 'SmartGameObjectAI' WHERE `entry`=148498; + +DELETE FROM `smart_scripts` WHERE `entryorguid` =148498; + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(148498,1,0,1,62,0,100,0,1282,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Altar of Suntara - On Gossip Select - Close gossip'), +(148498,1,1,0,61,0,100,0,0,0,0,0,45,2,2,0,0,0,0,19,8400,0,0,0,0,0,0,'Altar of Suntara - Linked with previous event - Set Data 3 3 on Obsidion'); + +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=8391; + +DELETE FROM `smart_scripts` WHERE `entryorguid` =8391; + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(8391, 0,0,0,11,0,100,0,0,0,0,0,69,0,0,0,0,0,0,19,8400,0,0,0,0,0,0,'Lathoric the Black - On Spawn - Move to Altar of Suntara'), +(8391, 0,1,2,1,0,100,1,8000,8000,0,0,101,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Lathoric the Black - OOC (No Repeat) - Set Home Position'), +(8391, 0,2,0,61,0,100,1,0,0,0,0,49,0,0,0,0,0,0,21,100,0,0,0,0,0,0,'Lathoric the Black - Linked with Previous Event - Attack'), +(8391, 0,3,0,7,0,100,1,0,0,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Lathoric the Black - On Evade - Despawn'), +(8391, 0,4,0,11,0,100,1,0,0,0,0,8,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Lathoric the Black - On Spawn - Set React State Defensive'); + +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=8400; + +DELETE FROM `smart_scripts` WHERE `entryorguid` =8400; + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(8400, 0,0,1,38,0,100,0,1,1,0,0,19,256,0,0,0,0,0,8,0,0,0,0,0,0,0,'Obsidion - On Data Set - Remove Unattackable Flags'), +(8400, 0,1,2,61,0,100,0,0,0,0,0,91,7,0,0,0,0,0,1,0,0,0,0,0,0,0,'Obsidion - Linked with Previous Event - Set Bytes_1'), +(8400, 0,2,0,61,0,100,0,0,0,0,0,49,0,0,0,0,0,0,21,100,0,0,0,0,0,0,'Obsidion - Linked with Previous Event - Attack'), +(8400, 0,3,4,7,0,100,0,0,0,0,0,90,7,0,0,0,0,0,1,0,0,0,0,0,0,0,'Obsidion - On Evade - Set Bytes_1'), +(8400, 0,4,0,61,0,100,0,0,0,0,0,18,256,0,0,0,0,0,1,0,0,0,0,0,0,0,'Obsidion - On Evade - Set Unit Flags'), +(8400, 0,5,0,9,0,100,0,0,10,20000,30000,11,12734,2,0,0,0,0,1,0,0,0,0,0,0,0,'Obsidion - On Range - Cast Floor Smash'), +(8400, 0,6,0,9,0,100,0,0,5,15000,30000,11,10101,2,0,0,0,0,7,0,0,0,0,0,0,0,'Obsidion - On Range - Cast Knock Away'), +(8400, 0,7,8,38,0,100,0,2,2,60000,60000,12,8421,3,31000,0,0,0,8,0,0,0,-6481.127441,-1237.451538,180.067535,5.104429,'Obsidion - On Data Set 2 2 - Spawn Dorius'), +(8400, 0,8,0,61 ,0,100,1,8000,8000,0,0,1,6,5000,0,0,0,0,9,8421,0,100,0,0,0,0,'Obsidion - OOC - Say (Dorius)'), +(8400, 0,9,0,52,0,100,0,0,8421,0,0,1,1,5000,0,0,0,0,9,8421,0,100,0,0,0,0,'Obsidion - On Text Over - Say (Dorius)'), +(8400, 0,10,0,52,0,100,0,1,8421,0,0,1,2,5000,0,0,0,0,9,8421,0,100,0,0,0,0,'Obsidion - On Text Over - Say (Dorius)'), +(8400, 0,11,0,52,0,100,0,2,8421,0,0,1,3,5000,0,0,0,0,9,8421,0,100,0,0,0,0,'Obsidion - On Text Over - Say (Dorius)'), +(8400, 0,12,0,52,0,100,0,3,8421,0,0,1,4,3000,0,0,0,0,9,8421,0,100,0,0,0,0,'Obsidion - On Text Over - Say (Dorius)'), +(8400, 0,13,14,52,0,100,0,4,8421,0,0,1,5,3000,0,0,0,0,9,8421,0,100,0,0,0,0,'Obsidion - On Text Over - Say (Dorius)'), +(8400, 0,14,0,61,0,100,0,0,0,0,0,12,8391,3,300000,0,0,0,8,0,0,0,-6528.036621, -1233.628296, 182.052963, 5.990324,'Obsidion - On Text Over - Spawn Lathoric The Black'), +(8400, 0,16,0,52,0,100,0,5,8421,0,0,1,0,5000,0,0,0,0,19,8391,0,0,0,0,0,0,'Obsidion - On Text Over - Say (Lathoric the Black)'), +(8400, 0,17,0,52,0,100,0,6,8421,0,0,1,0,5000,0,0,0,0,9,8421,0,100,0,0,0,0,'Obsidion - On Text Over - Say (Dorius)'), +(8400, 0,18,0,52,0,100,0,0,8391,0,0,1,1,2000,0,0,0,0,19,8391,0,0,0,0,0,0,'Obsidion - On Text Over - Say (Lathoric the Black)'), +(8400, 0,19,20,52,0,100,0,1,8391,0,0,45,2,2,0,0,0,0,19,8391,0,0,0,0,0,0,'Obsidion - On Text Over- Send Data to Lathoric the Black'), +(8400, 0,20,0,61,0,100,0,1,0,0,0,45,1,1,0,0,0,0,1,0,0,0,0,0,0,0,'Lathoric the Black - OOC - Send Data to Obsidion'); + +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=8417; + +DELETE FROM `smart_scripts` WHERE `entryorguid` =8417; + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(8417,0,0,0,19,0,100,0,3566,0,0,0,45,2,2,0,0,0,0,19,8400,0,0,0,0,0,0,' Dying Archaeologist - On Quest Accept - Set Data 2 2 on Obsidion'); + +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=8421; + +DELETE FROM `smart_scripts` WHERE `entryorguid` =8421; + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(8421, 0,0,1,11,0,100,1,0,0,0,0,8,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Dorius - On Spawn - Set React State Defensive'), +(8421, 0,1,0,61,0,100,1,0,0,0,0,2,120,0,0,0,0,0,1,0,0,0,0,0,0,0,'Dorius - On Spawn - Set Faction'); diff --git a/sql/updates/world/2014_08_01_00_world_creature_template.sql b/sql/updates/world/2014_08_01_00_world_creature_template.sql new file mode 100644 index 00000000000..93d8dbd7399 --- /dev/null +++ b/sql/updates/world/2014_08_01_00_world_creature_template.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `faction`=14 WHERE `entry`=16118; -- Kormok diff --git a/sql/updates/world/2014_08_01_01_world_sai.sql b/sql/updates/world/2014_08_01_01_world_sai.sql new file mode 100644 index 00000000000..92ce9db75b0 --- /dev/null +++ b/sql/updates/world/2014_08_01_01_world_sai.sql @@ -0,0 +1,244 @@ +-- Hate'rel SAI +SET @ENTRY := 9034; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,3400,4800,11,15232,64,0,0,0,0,2,0,0,0,0,0,0,0,"Hate'rel - In Combat CMC - Cast 'Shadow Bolt'(Normal Dungeon)"), +(@ENTRY,0,1,0,9,0,100,2,0,5,5000,7000,11,15580,0,0,0,0,0,2,0,0,0,0,0,0,0,"Hate'rel - Within 0-5 Range - Cast 'Strike' (Normal Dungeon)"), +(@ENTRY,0,2,0,0,0,100,2,9000,14000,40000,48000,11,15232,1,0,0,0,0,1,0,0,0,0,0,0,0,"Hate'rel - In Combat - Cast 'Shadow Bolt' (Normal Dungeon)"), +(@ENTRY,0,3,0,0,0,100,2,14000,17000,15000,20000,11,15232,1,0,0,0,0,5,0,0,0,0,0,0,0,"Hate'rel - In Combat - Cast 'Shadow Bolt' (Normal Dungeon)"), +(@ENTRY,0,4,0,21,0,100,3,0,0,0,0,34,4,2,0,0,0,0,1,0,0,0,0,0,0,0,"Hate'rel - On Reached Home - Set Instance Data 4 to 2 (Phase 1) (No Repeat) (Normal Dungeon)"); + +-- Vile'rel SAI +SET @ENTRY := 9036; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,3400,4800,11,15587,64,0,0,0,0,2,0,0,0,0,0,0,0,"Vile'rel - In Combat CMC - Cast 'Mind Blast' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,100,2,20000,30000,60000,120000,11,11974,1,0,0,0,0,1,0,0,0,0,0,0,0,"Vile'rel - In Combat - Cast 'Power Word: Shield' (Normal Dungeon)"), +(@ENTRY,0,2,0,0,0,100,2,15000,20000,15000,20000,11,15585,1,0,0,0,0,1,0,0,0,0,0,0,0,"Vile'rel - In Combat - Cast 'Prayer of Healing' (Normal Dungeon)"), +(@ENTRY,0,3,0,2,0,100,2,0,50,16000,20000,11,15586,1,0,0,0,0,1,0,0,0,0,0,0,0,"Vile'rel - Between 0-50% Health - Cast 'Heal' (Normal Dungeon)"), +(@ENTRY,0,4,0,21,0,100,3,0,0,0,0,34,4,2,0,0,0,0,1,0,0,0,0,0,0,0,"Vile'rel - On Reached Home - Set Instance Data 4 to 2 (No Repeat) (Normal Dungeon)"); + +-- Seeth'rel SAI +SET @ENTRY := 9038; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,1,0,100,2,1000,1000,1800000,1800000,11,12544,33,0,0,0,0,1,0,0,0,0,0,0,0,"Seeth'rel - Out of Combat - Cast 'Frost Armor' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,100,2,0,0,3400,4800,11,12675,64,0,0,0,0,2,0,0,0,0,0,0,0,"Seeth'rel - In Combat CMC - Cast 'Frostbolt' (Normal Dungeon)"), +(@ENTRY,0,2,0,0,0,100,2,9000,14000,19000,24000,11,15244,1,0,0,0,0,1,0,0,0,0,0,0,0,"Seeth'rel - In Combat - Cast 'Cone of Cold' (Normal Dungeon)"), +(@ENTRY,0,3,0,0,0,100,2,12000,16000,20000,23000,11,12674,1,0,0,0,0,1,0,0,0,0,0,0,0,"Seeth'rel - In Combat - Cast 'Frost Nova' (Normal Dungeon)"), +(@ENTRY,0,4,0,0,0,100,2,3000,5000,64000,75000,11,15044,1,0,0,0,0,1,0,0,0,0,0,0,0,"Seeth'rel - In Combat - Cast 'Frost Ward' (Normal Dungeon)"), +(@ENTRY,0,5,0,21,0,100,3,0,0,0,0,34,4,2,0,0,0,0,1,0,0,0,0,0,0,0,"Seeth'rel - On Reached Home - Set Instance Data 4 to 2 (No Repeat) (Normal Dungeon)"); + +-- Warder Stilgiss SAI +SET @ENTRY := 9041; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,1,0,100,2,1000,1000,1800000,1800000,11,12544,33,0,0,0,0,1,0,0,0,0,0,0,0,"Warder Stilgiss - Out of Combat - Cast 'Frost Armor' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,100,2,0,0,2400,3800,11,12675,64,0,0,0,0,2,0,0,0,0,0,0,0,"Warder Stilgiss - In Combat CMC - Cast 'Frostbolt' (Normal Dungeon)"), +(@ENTRY,0,2,0,0,0,100,2,7000,9000,14000,18000,11,12674,1,0,0,0,0,1,0,0,0,0,0,0,0,"Warder Stilgiss - In Combat - Cast 'Frost Nova' (Normal Dungeon)"), +(@ENTRY,0,3,0,0,0,100,2,3000,4000,65000,70000,11,15044,1,0,0,0,0,1,0,0,0,0,0,0,0,"Warder Stilgiss - In Combat - Cast 'Frost Ward' (Normal Dungeon)"), +(@ENTRY,0,4,0,2,0,100,3,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Warder Stilgiss - Between 0-15% Health - Flee For Assist (No Repeat) (Normal Dungeon)"); + +-- Spirestone Ogre Magus SAI +SET @ENTRY := 9201; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,2400,3800,11,15979,64,0,0,0,0,2,0,0,0,0,0,0,0,"Spirestone Ogre Magus - In Combat CMC - Cast 'Arcane Bolt' (Normal Dungeon)"), +(@ENTRY,0,1,0,2,0,100,2,0,40,30000,35000,11,6742,1,0,0,0,0,1,0,0,0,0,0,0,0,"Spirestone Ogre Magus - Between 0-40% Health - Cast 'Bloodlust'= (Normal Dungeon)"), +(@ENTRY,0,2,0,0,0,100,2,6000,9000,20000,30000,11,13747,1,0,0,0,0,2,0,0,0,0,0,0,0,"Spirestone Ogre Magus - In Combat - Cast 'Slow'= (Normal Dungeon)"); + +-- Spirestone Lord Magus SAI +SET @ENTRY := 9217; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,2400,3800,11,15230,64,0,0,0,0,2,0,0,0,0,0,0,0,"Spirestone Lord Magus - In Combat CMC - Cast 'Arcane Bolt' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,100,2,7000,12000,14000,19000,11,13323,1,0,0,0,0,6,0,0,0,0,0,0,0,"Spirestone Lord Magus - In Combat - Cast 'Polymorph' (Normal Dungeon)"), +(@ENTRY,0,2,0,2,0,100,2,0,50,25000,30000,11,8365,1,0,0,0,0,1,0,0,0,0,0,0,0,"Spirestone Lord Magus - Between 0-50% Health - Cast 'Enlarge' (Normal Dungeon)"), +(@ENTRY,0,3,0,2,0,100,2,0,30,30000,35000,11,6742,1,0,0,0,0,1,0,0,0,0,0,0,0,"Spirestone Lord Magus - Between 0-30% Health - Cast 'Bloodlust' (Normal Dungeon)"); + +-- Smolderthorn Headhunter SAI +SET @ENTRY := 9241; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,2300,3900,11,15795,64,0,0,0,0,2,0,0,0,0,0,0,0,"Smolderthorn Headhunter - In Combat CMC - Cast 'Throw' (Phase 1) (Normal Dungeon)"), +(@ENTRY,0,1,0,9,0,100,2,5,30,9000,13000,11,16001,1,0,0,0,0,2,0,0,0,0,0,0,0,"Smolderthorn Headhunter - Within 5-30 Range - Cast 'Impale' (Normal Dungeon)"), +(@ENTRY,0,2,0,0,0,100,2,5000,10000,22000,26000,11,6016,0,0,0,0,0,2,0,0,0,0,0,0,0,"Smolderthorn Headhunter - In Combat - Cast 'Pierce Armor' (Normal Dungeon)"), +(@ENTRY,0,3,0,2,0,100,3,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Smolderthorn Headhunter - Between 0-15% Health - Flee For Assist (No Repeat) (Normal Dungeon)"); + +-- Scarshield Warlock SAI +SET @ENTRY := 9257; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,2400,3800,11,12471,64,0,0,0,0,2,0,0,0,0,0,0,0,"Scarshield Warlock - In Combat CMC - Cast 'Shadow Bolt' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,100,2,10000,20000,60000,75000,11,15125,1,0,0,0,0,1,0,0,0,0,0,0,0,"Scarshield Warlock - In Combat - Cast 'Scarshield Portal' (Normal Dungeon)"), +(@ENTRY,0,2,0,2,0,100,3,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Scarshield Warlock - Between 0-15% Health - Flee For Assist (Normal Dungeon)"); + +-- Firebrand Darkweaver SAI +SET @ENTRY := 9261; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,2400,3800,11,12471,64,0,0,0,0,2,0,0,0,0,0,0,0,"Firebrand Darkweaver - In Combat CMC - Cast 'Shadow Bolt' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,50,2,4000,6000,30000,45000,11,15128,32,0,0,0,0,5,0,0,0,0,0,0,0,"Firebrand Darkweaver - In Combat - Cast 'Mark of Flames' (Normal Dungeon)"), +(@ENTRY,0,2,0,0,0,100,2,9000,14000,9000,14000,11,15090,1,0,0,0,0,5,0,0,0,0,0,0,0,"Firebrand Darkweaver - In Combat - Cast 'Dispel Magic' (Normal Dungeon)"), +(@ENTRY,0,3,0,0,0,100,2,1000,4000,12000,15000,11,16071,32,0,0,0,0,5,0,0,0,0,0,0,0,"Firebrand Darkweaver - In Combat - Cast 'Curse of the Firebrand' (Normal Dungeon)"), +(@ENTRY,0,4,0,0,0,100,2,12000,15000,12000,15000,11,14887,1,0,0,0,0,2,0,0,0,0,0,0,0,"Firebrand Darkweaver - In Combat - Cast 'Shadow Bolt Volley' (Normal Dungeon)"), +(@ENTRY,0,5,0,2,0,100,3,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Firebrand Darkweaver - Between 0-15% Health - Flee For Assist (Normal Dungeon)"); + +-- Firebrand Invoker SAI +SET @ENTRY := 9262; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,2400,3800,11,15242,64,0,0,0,0,2,0,0,0,0,0,0,0,"Firebrand Invoker - In Combat CMC - Cast 'Fireball' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,50,2,4000,6000,30000,45000,11,15128,32,0,0,0,0,5,0,0,0,0,0,0,0,"Firebrand Invoker - In Combat - Cast 'Mark of Flames' (Normal Dungeon)"), +(@ENTRY,0,2,0,0,0,100,2,8000,10000,11000,14000,11,12470,1,0,0,0,0,1,0,0,0,0,0,0,0,"Firebrand Invoker - In Combat - Cast 'Fire Nova' (Normal Dungeon)"), +(@ENTRY,0,3,0,0,0,100,2,12000,16000,14000,18000,11,12468,0,0,0,0,0,5,0,0,0,0,0,0,0,"Firebrand Invoker - In Combat - Cast 'Flamestrike' (Normal Dungeon)"), +(@ENTRY,0,4,0,2,0,100,3,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Firebrand Invoker - Between 0-15% Health - Flee For Assist (No Repeat) (Normal Dungeon)"); + +-- Smolderthorn Axe Thrower SAI +SET @ENTRY := 9267; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,2300,3900,11,15795,64,0,0,0,0,2,0,0,0,0,0,0,0,"Smolderthorn Axe Thrower - In Combat CMC - Cast 'Throw' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,100,2,6000,9000,9000,12000,11,3391,1,0,0,0,0,1,0,0,0,0,0,0,0,"Smolderthorn Axe Thrower - In Combat - Cast 'Thrash' (Normal Dungeon)"), +(@ENTRY,0,2,0,0,0,100,2,9000,14000,11000,15000,11,11428,1,0,0,0,0,2,0,0,0,0,0,0,0,"Smolderthorn Axe Thrower - In Combat - Cast 'Knockdown' (Normal Dungeon)"), +(@ENTRY,0,3,0,2,0,100,3,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Smolderthorn Axe Thrower - Between 0-15% Health - Flee For Assist (No Repeat) (Normal Dungeon)"); + +-- Smolderthorn Seer SAI +SET @ENTRY := 9269; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,1,0,100,2,1000,1000,600000,600000,11,13585,33,0,0,0,0,1,0,0,0,0,0,0,0,"Smolderthorn Seer - Out of Combat - Cast 'Lightning Shield' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,100,2,0,0,2400,3800,11,15801,64,0,0,0,0,2,0,0,0,0,0,0,0,"Smolderthorn Seer - In Combat CMC - Cast 'Lightning Bolt' (Normal Dungeon)"), +(@ENTRY,0,2,0,14,0,100,2,3000,40,15000,25000,11,12492,1,0,0,0,0,7,0,0,0,0,0,0,0,"Smolderthorn Seer - Friendly At 3000 Health - Cast 'Healing Wave' (Normal Dungeon)"), +(@ENTRY,0,3,0,0,0,100,2,3000,6000,12000,15000,11,15802,32,0,0,0,0,5,0,0,0,0,0,0,0,"Smolderthorn Seer - In Combat - Cast 'Shrink' (Normal Dungeon)"), +(@ENTRY,0,4,0,2,0,100,3,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Smolderthorn Seer - Between 0-15% Health - Flee For Assist (No Repeat) (Normal Dungeon)"); + +-- Dark Keeper Vorfalk SAI +SET @ENTRY := 9437; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,2400,3800,11,15234,64,0,0,0,0,2,0,0,0,0,0,0,0,"Dark Keeper Vorfalk - In Combat CMC - Cast 'Lightning Bolt' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,100,2,6000,9000,7000,10000,11,15306,1,0,0,0,0,2,0,0,0,0,0,0,0,"Dark Keeper Vorfalk - In Combat - Cast 'Shock' (Normal Dungeon)"); + +-- Dark Keeper Bethek SAI +SET @ENTRY := 9438; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,2400,3800,11,15228,64,0,0,0,0,2,0,0,0,0,0,0,0,"Dark Keeper Bethek - In Combat CMC - Cast 'Fireball' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,100,2,3000,5000,15000,20000,11,12738,1,0,0,0,0,2,0,0,0,0,0,0,0,"Dark Keeper Bethek - In Combat - Cast 'Amplify Damage' (Normal Dungeon)"); + +-- Dark Keeper Uggel SAI +SET @ENTRY := 9439; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,2400,3800,11,15232,64,0,0,0,0,2,0,0,0,0,0,0,0,"Dark Keeper Uggel - In Combat CMC - Cast 'Shadow Bolt' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,100,2,5000,7000,12000,18000,11,14875,33,0,0,0,0,5,0,0,0,0,0,0,0,"Dark Keeper Uggel - In Combat - Cast 'Curse of Agony' (Normal Dungeon)"); + +-- Dark Keeper Ofgut SAI +SET @ENTRY := 9442; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,2400,3800,11,15230,64,0,0,0,0,2,0,0,0,0,0,0,0,"Dark Keeper Ofgut - In Combat CMC - Cast 'Arcane Bolt' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,100,2,7000,12000,18000,24000,11,7121,1,0,0,0,0,1,0,0,0,0,0,0,0,"Dark Keeper Ofgut - In Combat - Cast 'Anti-Magic Shield' (Normal Dungeon)"); + +-- Dark Keeper Pelver SAI +SET @ENTRY := 9443; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,1,0,100,2,1000,1000,1800000,1800000,11,12544,33,0,0,0,0,1,0,0,0,0,0,0,0,"Dark Keeper Pelver - Out of Combat - Cast 'Frost Armor' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,100,2,0,0,2400,3800,11,12675,64,0,0,0,0,2,0,0,0,0,0,0,0,"Dark Keeper Pelver - In Combat CMC - Cast 'Frostbolt' (Normal Dungeon)"); + +-- Scarlet Cleric SAI +SET @ENTRY := 9449; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,0,0,0,3400,4800,11,15587,64,0,0,0,0,2,0,0,0,0,0,0,0,"Scarlet Cleric - In Combat CMC - Cast 'Mind Blast'"), +(@ENTRY,0,1,0,74,0,100,0,0,40,25000,35000,11,15587,1,0,0,0,0,9,0,0,0,0,0,0,0,"Scarlet Cleric - On Friendly Between 0-40% Health - Cast 'Mind Blast'"), +(@ENTRY,0,2,0,2,0,100,1,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Scarlet Cleric - Between 0-15% Health - Flee For Assist (No Repeat)"); + +-- Scarlet Curate SAI +SET @ENTRY := 9450; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,9,0,100,0,0,40,3400,4800,11,25054,64,0,0,0,0,2,0,0,0,0,0,0,0,"Scarlet Curate - In Combat CMC - Cast 'Holy Smite'"), +(@ENTRY,0,1,0,15,0,100,1,0,0,30,0,11,17201,1,0,0,0,0,7,0,0,0,0,0,0,0,"Scarlet Curate - Friendly Crowd Controlled - Cast 'Dispel Magic'"), +(@ENTRY,0,2,0,74,0,100,0,0,40,25000,35000,11,17201,1,0,0,0,0,9,0,0,0,0,0,0,0,"Scarlet Curate - On Friendly Between 0-40% Health - Cast 'Dispel Magic'"), +(@ENTRY,0,3,0,61,0,100,1,0,0,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Scarlet Curate - Between 0-15% Health - Flee For Assist (No Repeat)"); + +-- Scarlet Archmage SAI +SET @ENTRY := 9451; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,1,0,100,0,1000,1000,1800000,1800000,11,18100,1,0,0,0,0,1,0,0,0,0,0,0,0,"Scarlet Archmage - Out of Combat - Cast 'Frost Armor'"), +(@ENTRY,0,1,0,9,0,100,0,0,40,3400,4800,11,15242,64,0,0,0,0,2,0,0,0,0,0,0,0,"Scarlet Archmage - In Combat CMC - Cast 'Fireball'"), +(@ENTRY,0,2,0,0,0,100,0,8000,11000,16000,21000,11,15244,1,0,0,0,0,1,0,0,0,0,0,0,0,"Scarlet Archmage - In Combat - Cast 'Cone of Cold'"), +(@ENTRY,0,3,0,13,0,100,1,0,0,0,0,11,15122,1,0,0,0,0,7,0,0,0,0,0,0,0,"Scarlet Archmage - Target Casting - Cast 'Counterspell'"), +(@ENTRY,0,4,0,2,0,100,1,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Scarlet Archmage - Between 0-15% Health - Flee For Assist (No Repeat)"); + +-- Scarlet Enchanter SAI +SET @ENTRY := 9452; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,0,0,0,3400,4800,11,25055,64,0,0,0,0,2,0,0,0,0,0,0,0,"Scarlet Enchanter - In Combat CMC - Cast 'Arcane Bolt'"), +(@ENTRY,0,1,0,0,0,100,0,7000,10000,18000,22000,11,15970,1,0,0,0,0,6,0,0,0,0,0,0,0,"Scarlet Enchanter - In Combat - Cast 'Sleep'"); + +-- Bloodaxe Evoker SAI +SET @ENTRY := 9693; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,2400,3800,11,13748,64,0,0,0,0,2,0,0,0,0,0,0,0,"Bloodaxe Evoker - In Combat CMC - Cast 'Arcane Bolt'"), +(@ENTRY,0,1,0,0,0,75,2,12000,14000,25000,30000,11,15743,1,0,0,0,0,1,0,0,0,0,0,0,0,"Bloodaxe Evoker - In Combat - Cast 'Flamecrack' (Normal Dungeon)"), +(@ENTRY,0,2,0,0,0,80,2,7000,9000,15000,20000,11,15744,1,0,0,0,0,1,0,0,0,0,0,0,0,"Bloodaxe Evoker - In Combat - Cast 'Blast Wave' (Normal Dungeon)"), +(@ENTRY,0,3,0,2,0,100,3,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Bloodaxe Evoker - Between 0-15% Health - Flee For Assist (No Repeat) (Normal Dungeon)"); + +-- Bloodaxe Summoner SAI +SET @ENTRY := 9717; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,3400,5800,11,15791,64,0,0,0,0,2,0,0,0,0,0,0,0,"Bloodaxe Summoner - In Combat CMC - Cast 'Arcane Missiles' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,90,2,6000,9000,13000,18000,11,15532,1,0,0,0,0,1,0,0,0,0,0,0,0,"Bloodaxe Summoner - In Combat - Cast 'Frost Nova' (Normal Dungeon)"), +(@ENTRY,0,2,0,0,0,75,2,8000,12000,25000,30000,11,15734,1,0,0,0,0,6,0,0,0,0,0,0,0,"Bloodaxe Summoner - In Combat - Cast 'Summon' (Normal Dungeon)"); + +-- Flamekin Spitter SAI +SET @ENTRY := 9776; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,0,0,0,2600,5100,11,15664,64,0,0,0,0,2,0,0,0,0,0,0,0,"Flamekin Spitter - In Combat CMC - Cast 'Venom Spit'"); + +-- Flamekin Torcher SAI +SET @ENTRY := 9778; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,0,0,0,3500,4700,11,15665,64,0,0,0,0,2,0,0,0,0,0,0,0,"Flamekin Torcher - In Combat CMC - Cast 'Fireball'"); + +-- Wesley SAI +SET @ENTRY := 9978; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,2,0,100,1,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Wesley - Between 0-15% Health - Flee For Assist"); diff --git a/sql/updates/world/2014_08_02_00_world_spell_script_names.sql b/sql/updates/world/2014_08_02_00_world_spell_script_names.sql new file mode 100644 index 00000000000..23ed6eabf4d --- /dev/null +++ b/sql/updates/world/2014_08_02_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM spell_script_names WHERE spell_id=-49027; +INSERT INTO spell_script_names VALUES +(-49027, 'spell_dk_bloodworms'); diff --git a/sql/updates/world/2014_08_02_01_world_sai.sql b/sql/updates/world/2014_08_02_01_world_sai.sql new file mode 100644 index 00000000000..7756c136e62 --- /dev/null +++ b/sql/updates/world/2014_08_02_01_world_sai.sql @@ -0,0 +1,42 @@ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`IN(49191,49554); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 49191, 0, 0, 31, 0, 3, 27712, 0, 0, 0, 0, '', '7th Legion Chain Gun hits Mindless Ghoul'), +(13, 1, 49554, 0, 0, 31, 0, 3, 27795, 0, 0, 0, 0, '', 'Summon injured soldier hits Injured Soldier Summon Point'); + +UPDATE `creature` SET `spawntimesecs`=120 WHERE `id`=27712; + +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN(27712,27795,27788); + +DELETE FROM `smart_scripts` WHERE `entryorguid`IN(27712,27788) AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=2778800 AND `source_type`=9; + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(27712, 0, 0, 0, 9, 0, 100, 0, 0, 5, 10000, 15000, 11, 50196, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Mindless Ghoul - IC - Cast Rotting Touch'), +(27788, 0, 0, 1, 54, 0, 100, 0, 0, 0, 0, 0, 64, 1, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - On Just Summoned - Store Targetlist'), +(27788, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 11, 49774, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - On Just Summoned - Cast cast Cower + Fear Visual'), +(27788, 0, 2, 12, 61, 0, 100, 0, 0, 0, 0, 0, 80, 2778800, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - Run Script'), +(27788, 0, 3, 5, 7, 0, 100, 0, 0, 0, 0, 0, 11, 49774, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - On Evade - cast Cower + Fear Visual'), +(27788, 0, 4, 0, 61, 0, 100, 0, 0, 0, 0, 0, 64, 2, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - On 7th Legion cannon within 3 yards - Disable Combat movement'), +(27788, 0, 5, 0, 6, 0, 100, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - On Death - Reset all scripts'), +(27788, 0, 6, 4, 75, 0, 100, 1, 0, 27714, 10, 0, 59, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - On 7th Legion Cannon within 15 yards - Remove aura Cower + Fear Visual'), +(27788, 0, 7, 8, 75, 0, 100, 1, 0, 27714, 3, 0, 1, 0, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - On 7th Legion Cannon within 5 yards - Say'), +(27788, 0, 8, 9, 61, 0, 100, 0, 0, 0, 0, 0, 33, 27788, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - On 7th Legion Cannon within 5 yards - Give kill credit to stored target'), +(27788, 0, 9, 13, 61, 0, 100, 0, 0, 0, 0, 0, 28, 49774, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - On 7th Legion Cannon within 5 yards - Remove aura Cower + Fear Visual'), +(27788, 0, 10, 0, 1, 0, 100, 0, 500, 500, 7500, 7500, 29, 0, 0, 0, 0, 0, 0, 12, 2, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - OOC - Follow stored target 2'), +(27788, 0, 11, 12, 61, 0, 100, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - Just Summoned - Disable melee combat'), +(27788, 0, 12, 0, 61, 0, 100, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - Just Summoned - Disable Combat movement'), +(27788, 0, 13, 14, 61, 0, 100, 0, 0, 0, 0, 0, 28, 49775, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - On 7th Legion Cannon within 15 yards - Remove aura Cower + Fear Visual'), +(27788, 0, 14, 15, 61, 0, 100, 0, 0, 0, 0, 0, 18, 768, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - On 7th Legion Cannon within 15 yards - Set Unit Flags'), +(27788, 0, 15, 0, 61, 0, 100, 0, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - On 7th Legion Cannon within 15 yards - Set Run'), +(27788, 0, 16, 0, 7, 0, 100, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 12, 2, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - On Evade Follow stored targetlist 2'), +(2778800, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 64, 2, 0, 0, 0, 0, 0, 19, 27792, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - Script - Store Targetlist 2 closest Injured Soldier Waypoint 01 '), +(2778800, 9, 1, 0, 0, 0, 100, 0, 15000, 15000, 0, 0, 64, 2, 0, 0, 0, 0, 0, 19, 27793, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - Script - Store Targetlist 2 closest Injured Soldier Waypoint 02'), +(2778800, 9, 2, 0, 0, 0, 100, 0, 15000, 15000, 0, 0, 64, 2, 0, 0, 0, 0, 0, 19, 27794, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - Script - Store Targetlist 2 closest Injured Soldier Waypoint 03'), +(2778800, 9, 3, 0, 0, 0, 100, 0, 15000, 15000, 0, 0, 64, 2, 0, 27714, 0, 0, 0, 19, 27714, 0, 0, 0, 0, 0, 0, 'Injured 7th Legion Soldier - Script - Store Targetlist 2 7th legion chain gun'); + +DELETE FROM `creature_text` WHERE `entry`=27788; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `BroadcastTextID`) VALUES +(27788, 0, 0, 'I was almost ghoul bait! Thanks for the rescue!', 12, 0, 100, 0, 0, 0, 'Injured 7th Legion Soldier', 27097), +(27788, 0, 1, 'It''s a good thing you came along, ally! We were done for!', 12, 0, 100, 0, 0, 0, 'Injured 7th Legion Soldier', 27098), +(27788, 0, 2, 'Thanks for the cover fire! It''s a MADHOUSE down there!', 12, 0, 100, 0, 0, 0, 'Injured 7th Legion Soldier', 27095), +(27788, 0, 3, 'Wow, I thought I was a goner! Thanks, friend!', 12, 0, 100, 0, 0, 0, 'Injured 7th Legion Soldier', 27096); diff --git a/sql/updates/world/2014_08_03_00_world_sai.sql b/sql/updates/world/2014_08_03_00_world_sai.sql new file mode 100644 index 00000000000..2462b8bf1bf --- /dev/null +++ b/sql/updates/world/2014_08_03_00_world_sai.sql @@ -0,0 +1,26 @@ + UPDATE `creature_template` SET `AIName`='SmartAI',`npcflag`=16777216 WHERE `entry`=28161; + + DELETE FROM `smart_scripts` WHERE `entryorguid`=28161 and `source_type`=0; + DELETE FROM `smart_scripts` WHERE `entryorguid`=2816100 and `source_type`=9; + + INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES + (28161, 0, 0, 4, 8, 0, 100, 0, 51959, 0, 11000, 11000, 28, 51846, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Chicken Escapee - On Spellhit (Chicken Net) - Remove Aura Scared Chicken'), + (28161, 0, 1, 2, 73, 0, 100, 0, 0, 0, 0, 0, 85, 51037, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Chicken Escapee - On Spellclick - Invoker Cast Capture Chicken Escapee '), + (28161, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Chicken Escapee - On Spellclick - Despawn'), + (28161, 0, 2, 3, 11, 0, 100, 0, 0, 0, 0, 0, 11, 50734, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Chicken Escapee - On Reset - Cast Frenzyheart Chicken: Invisibility'), + (28161, 0, 3, 0, 61, 0, 100, 0, 0, 0, 0, 0, 11, 51846, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Chicken Escapee - On Reset - Cast Scared Chicken'), + (28161, 0, 4, 0, 61, 0, 100, 0, 0, 0, 0, 0, 80, 2816100, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Chicken Escapee - Link - Run Script'), + (2816100, 9, 0, 0, 0, 0, 100, 0, 10, 10, 0, 0, 11, 51959, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Chicken Escapee - Script - Cast Chicken Net'); + + DELETE FROM `npc_spellclick_spells` WHERE `npc_entry`=28161; + INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `cast_flags`, `user_type`) VALUES + (28161, 51037, 0, 0); + + DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=18 AND `SourceGroup`=28161; + INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES + (18, 28161, 51037, 0, 0, 9, 0, 12702, 0, 0, 0, 0, 0, '', 'Required quest active for spellclick'), + (18, 28161, 51037, 0, 1, 9, 0, 12532, 0, 0, 0, 0, 0, '', 'Required quest active for spellclick'); + + DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=51959; + INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES + (13, 1, 51959, 0, 0, 31, 0, 3, 28161, 0, 0, 0, 0, '', 'Chicken Net targets chicken escapee'); diff --git a/sql/updates/world/2014_08_03_01_world_immunities.sql b/sql/updates/world/2014_08_03_01_world_immunities.sql new file mode 100644 index 00000000000..2468c67dcae --- /dev/null +++ b/sql/updates/world/2014_08_03_01_world_immunities.sql @@ -0,0 +1,14 @@ +SET @MECHANIC_CHARM = 1; +SET @MECHANIC_FEAR = 16; +SET @MECHANIC_ROOT = 64; +SET @MECHANIC_SLEEP = 512; +SET @MECHANIC_FREEZE = 4096; +SET @MECHANIC_POLYMORPH = 65536; +SET @MECHANIC_SAPPED = 536870912; + +UPDATE `creature_template` + SET `mechanic_immune_mask`= `mechanic_immune_mask`|@MECHANIC_CHARM|@MECHANIC_FEAR|@MECHANIC_ROOT|@MECHANIC_SLEEP|@MECHANIC_FREEZE|@MECHANIC_POLYMORPH|@MECHANIC_SAPPED + WHERE `ScriptName` LIKE 'boss_%' OR + `entry` IN (SELECT `difficulty_entry_1` FROM (SELECT `difficulty_entry_1` FROM `creature_template` WHERE `ScriptName` LIKE 'boss_%') AS diff1) OR + `entry` IN (SELECT `difficulty_entry_2` FROM (SELECT `difficulty_entry_2` FROM `creature_template` WHERE `ScriptName` LIKE 'boss_%') AS diff2) OR + `entry` IN (SELECT `difficulty_entry_3` FROM (SELECT `difficulty_entry_3` FROM `creature_template` WHERE `ScriptName` LIKE 'boss_%') AS diff3); diff --git a/sql/updates/world/2014_08_03_02_world_sai.sql b/sql/updates/world/2014_08_03_02_world_sai.sql new file mode 100644 index 00000000000..c6331ebe375 --- /dev/null +++ b/sql/updates/world/2014_08_03_02_world_sai.sql @@ -0,0 +1,19 @@ +-- Defias Watchman SAI +SET @ENTRY := 1725; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,0,0,100,2,0,0,2200,3800,11,6660,64,0,0,0,0,2,0,0,0,0,0,0,0,"Defias Watchman - In Combat CMC - Cast 'Shoot' (Normal Dungeon)"), +(@ENTRY,0,1,0,2,0,100,3,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Defias Watchman - Between 0-15% Health - Flee For Assist (Normal Dungeon) (No Repeat)"), +(@ENTRY,0,2,0,0,0,100,0,0,0,2200,3800,11,6660,64,0,0,0,0,2,0,0,0,0,0,0,0,"Defias Watchman - In Combat CMC - Cast 'Shoot'"), +(@ENTRY,0,3,0,2,0,100,1,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Defias Watchman - Between 0-15% Health - Flee For Assist (No Repeat)"); + +-- Defias Magician SAI +SET @ENTRY := 1726; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,1,0,100,0,1000,1000,1800000,1800000,11,12544,1,0,0,0,0,1,0,0,0,0,0,0,0,"Defias Magician - Out of Combat - Cast 'Frost Armor' (Normal Dungeon)"), +(@ENTRY,0,1,0,0,0,100,0,0,0,4000,6600,11,9053,64,0,0,0,0,2,0,0,0,0,0,0,0,"Defias Magician - In Combat CMC - Cast 'Fireball' (Normal Dungeon)"), +(@ENTRY,0,2,0,0,0,100,0,0,0,23200,38500,11,5110,1,0,0,0,0,1,0,0,0,0,0,0,0,"Defias Magician - In Combat - Cast 'Summon Living Flame' (Normal Dungeon)"), +(@ENTRY,0,3,0,2,0,100,1,0,15,0,0,25,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Defias Watchman - Between 0-15% Health - Flee For Assist (Normal Dungeon) (No Repeat)"); diff --git a/sql/updates/world/2014_08_05_00_world_quest_template.sql b/sql/updates/world/2014_08_05_00_world_quest_template.sql new file mode 100644 index 00000000000..272a490bf81 --- /dev/null +++ b/sql/updates/world/2014_08_05_00_world_quest_template.sql @@ -0,0 +1,2 @@ +-- +UPDATE `quest_template` SET `RequestItemsText` = '<Nipsy puts his index finger through one of the air holes in the carton.>$b$bAlive and kicking... and just in time!' WHERE `id` = 6662; diff --git a/sql/updates/world/2014_08_05_01_world_misc.sql b/sql/updates/world/2014_08_05_01_world_misc.sql new file mode 100644 index 00000000000..e913685da69 --- /dev/null +++ b/sql/updates/world/2014_08_05_01_world_misc.sql @@ -0,0 +1,5 @@ +-- Gramma Stonefield's Note page 2 +UPDATE `page_text` SET `text` = 'I fear the war between the Stonefields and the Maclures will kill Tommy Joe and Maybell''s blossoming romance, and in times like these - where dark news and rumors of war loom over us - youth and love must be nurtured.$b$bSo, the favor: I ask that you use your skills and concoct a potion or elixir to aid these young lovers in their quest for each other.$b$bThank you, William. And please, when you have some time away from work, come visit. We''ll have a few chuckles over the past.$b$b-Mildred' WHERE `entry` = 218; + +-- Additional fix for "Meeting the Warchief" which was done, however with 2 additional whitespaces +UPDATE `quest_template` SET `OfferRewardText` = '<Thrall begins to read the letter.>$b$bSo the blood elves finally took care of their little problem. It is no surprise that it took your help as well as that of an entire Forsaken regiment to get the job done.$b$b<The Warchief breaks into laughter.>$b$bI suppose there''s no stopping this. In the end we need them just as much as they need us.' WHERE `id` = 9813; diff --git a/sql/updates/world/2014_08_05_02_world_page_text.sql b/sql/updates/world/2014_08_05_02_world_page_text.sql new file mode 100644 index 00000000000..45d48ecc879 --- /dev/null +++ b/sql/updates/world/2014_08_05_02_world_page_text.sql @@ -0,0 +1,2 @@ +-- A Bloodstained Journal Page +UPDATE `page_text` SET `text` = '. . .downward spiral of despair. First she mocks me and now she is engaged. The ungracious charlatan was pretending to love when truly she desired to hurt me all along. A black void lurks with in me now and it grows with each waking moment. The blood I shall spill pales in comparison to the tears I have shed. . .' WHERE `entry` = 24; diff --git a/sql/updates/world/2014_08_05_03_world_page_text.sql b/sql/updates/world/2014_08_05_03_world_page_text.sql new file mode 100644 index 00000000000..2cacb1d2ad2 --- /dev/null +++ b/sql/updates/world/2014_08_05_03_world_page_text.sql @@ -0,0 +1,2 @@ +-- Brock's List +UPDATE `page_text` SET `text` = 'Below is the list of students who obtained a Platinum Star grade at Brock''s School of Mining and Surveying, earning them an Honorary Miner''s Pick:$b$bMelia Stoneshaker$bBardin Ironband$bUmi Togglevolt$bRumi Togglevolt$bVorel Steelspire' WHERE `entry` = 2514; diff --git a/sql/updates/world/2014_08_05_04_world_creature_template.sql b/sql/updates/world/2014_08_05_04_world_creature_template.sql new file mode 100644 index 00000000000..2895fb06b9a --- /dev/null +++ b/sql/updates/world/2014_08_05_04_world_creature_template.sql @@ -0,0 +1,2 @@ +-- +UPDATE `creature_template` SET `faction`=59 WHERE `entry`=1118; diff --git a/sql/updates/world/2014_08_05_05_world_page_text.sql b/sql/updates/world/2014_08_05_05_world_page_text.sql new file mode 100644 index 00000000000..4901f4d108c --- /dev/null +++ b/sql/updates/world/2014_08_05_05_world_page_text.sql @@ -0,0 +1,11 @@ +-- Senir's Report page 1 +UPDATE `page_text` SET `text` = 'A Report on the State of the Frostmane Trolls in the General Area of Coldridge Valley$b$bThe trolls situated in Dun Morogh are largely centralized in Frostmane Hold, a mountain cave on the western border. They have sufficient numbers to cause some concern, however, they seem more than content to stay in their cave. This is, no doubt, because they do not wish to incur the wrath of the dwarves again, and risk total extermination. Their actions can be considered territorial, if anything, and it is' WHERE `entry` = 88; + +-- Senir's Report page 2 +UPDATE `page_text` SET `text` = 'my belief that they pose no real threat to us, so long as we do not encroach upon their territory. This may be a situation unappealing to the dwarven populace, but given the dispersal of military resources, it may be prudent to relegate the extermination of the trolls to a lower level of importance, and continue to focus on the threat posed by the troggs and the Dark Irons.$b$bEnclosed, you will also find a copy of my brother Grelin''s report on Anvilmar.$b$bSigned,$bSenir Whitebeard' WHERE `entry` = 89; + +-- Senir's Report page 3 +UPDATE `page_text` SET `text` = 'A Report on the State of the Frostmane Trolls in the General Area of Coldridge Valley$b$bPrepared by Grelin Whitebeard, Senate Special Envoy$b$bFrom the time that I have spent observing the movement of the Frostmane trolls in the Coldridge Valley area, I have determined that they pose no large threat to dwarven settlements in the area. Moreover, they are a threat that can be eliminated with little additional support from the army. Through the assistance of Mountaineers already stationed in' WHERE `entry` = 90; + +-- Senir's Report page 4 +UPDATE `page_text` SET `text` = 'Coldridge Valley and mercenaries (paid with funds set aside by the Senate prior to my dispatchment), I am confident that the problem will be solved in short order.$b$bThis action has been authorized with the sanction given to me by King Bronzebeard.' WHERE `entry` = 91; diff --git a/sql/updates/world/2014_08_05_06_world_quest_template.sql b/sql/updates/world/2014_08_05_06_world_quest_template.sql new file mode 100644 index 00000000000..0eb91f13842 --- /dev/null +++ b/sql/updates/world/2014_08_05_06_world_quest_template.sql @@ -0,0 +1,2 @@ +-- +UPDATE `quest_template` SET `PrevQuestId` = 0 WHERE `Id`= 315; diff --git a/sql/updates/world/2014_08_06_00_world_gameobject.sql b/sql/updates/world/2014_08_06_00_world_gameobject.sql new file mode 100644 index 00000000000..0128071ae65 --- /dev/null +++ b/sql/updates/world/2014_08_06_00_world_gameobject.sql @@ -0,0 +1,2 @@ +UPDATE `gameobject` SET `spawntimesecs`=-60 WHERE `guid`=46424; +UPDATE `event_scripts` SET `datalong2`=60 WHERE `id`=466; diff --git a/sql/updates/world/2014_08_10_00_world_quest_template.sql b/sql/updates/world/2014_08_10_00_world_quest_template.sql new file mode 100644 index 00000000000..f77c3927499 --- /dev/null +++ b/sql/updates/world/2014_08_10_00_world_quest_template.sql @@ -0,0 +1,2 @@ +-- Fix Hunter Trainers offering Hunter quest to Rogues +UPDATE `quest_template` SET `RequiredClasses`=4 WHERE `id` IN (6721,6722); diff --git a/sql/updates/world/2014_08_10_01_world_misc.sql b/sql/updates/world/2014_08_10_01_world_misc.sql new file mode 100644 index 00000000000..c6bd7857d3f --- /dev/null +++ b/sql/updates/world/2014_08_10_01_world_misc.sql @@ -0,0 +1,90 @@ +DELETE FROM `creature_text` WHERE `entry` IN(17058,16794,16938,21257,21279,16795,19354,20680,19191,19273,19255,20677,20678,20679); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `BroadcastTextID`) VALUES +(17058, 0, 0, 'Do not stop! I promise you a thousand deaths if you even think about putting down that pick!', 12, 0, 100, 0, 0, 0, 'Illidari Taskmaster',16425), +(17058, 0, 1, 'Dig faster, wretch! Do not force me to show you the true meaning of pain!', 12, 0, 100, 0, 0, 0, 'Illidari Taskmaster',16424), +(17058, 0, 2, 'Faster, scum! The Master won''t be pleased if we don''t find the Ata''mal crystal he''s after.', 12, 0, 100, 0, 0, 0, 'Illidari Taskmaster',16421), +(17058, 1, 0, 'You dare interfere with the Master''s endeavors? You will pay, foolish mortal!', 12, 0, 100, 0, 0, 0, 'Illidari Taskmaster',16438), +(17058, 1, 1, 'Slay these intruders, filthy Dreghood! I promise you neverending pain if you disobey me!', 12, 0, 100, 0, 0, 0, 'Illidari Taskmaster',16439), +(17058, 1, 2, 'Go, you little wretches! Show these fools that our Master is not to be trifled with!', 12, 0, 100, 0, 0, 0, 'Illidari Taskmaster',16440), +(17058, 1, 3, 'Do not even think of fleeing, Broken wretches! I promise you a fate worse than death if you don''t slay these intruders!', 12, 0, 100, 0, 0, 0, 'Illidari Taskmaster',16441), +(16794, 0, 0, '...a potent concoction!', 12, 0, 100, 0, 0, 0, 'Apothecary Azethen',13678), +(16794, 1, 0, 'But where could I ever find a suitable test subject?', 12, 0, 100, 6, 0, 0, 'Apothecary Azethen',13682), +(16794, 2, 0, 'Drink this, you blue brute! Disobey me and I promise you a slow, painful death!', 12, 0, 100, 25, 0, 0, 'Apothecary Azethen',13683), +(16794, 3, 0, 'Hmmm... looks like I''m going to need a new test subject.', 12, 0, 100, 274, 0, 0, 'Apothecary Azethen',13684), +(16938, 0, 0, 'Put me out of this misery!', 12, 0, 100, 0, 0, 0, 'Dreghood Brute',16471), +(16938, 0, 1, 'Forgive me... I have no choice.', 12, 0, 100, 0, 0, 0, 'Dreghood Brute',16469), +(21257, 0, 0, 'Thank you, $n. Now, to perform the test...', 12, 0, 100, 1, 0, 0, 'Apothecary Zelana',19022), +(21257, 1, 0, 'Ah, I see...', 12, 0, 100, 0, 0, 0, 'Apothecary Zelana',19023), +(21257, 2, 0, 'Yes, this is unfortunate.', 12, 0, 100, 0, 0, 0, 'Apothecary Zelana',19024), +(21257, 3, 0, '$n, I have confirmed that this blood is from the Bonechewer clan of orcs, tainted with demonic power. I''m afraid, however, that my current equipment can delve no deeper into this mystery...', 12, 0, 100, 1, 0, 0, 'Apothecary Zelana',19025), +(21279, 0, 0, 'Please excuse me while I begin my tests...', 12, 0, 100, 1, 0, 0, 'Apothecary Albreck',19065), +(21279, 1, 0, 'Interesting...', 12, 0, 100, 0, 0, 0, 'Apothecary Albreck',19066), +(21279, 2, 0, 'But what is this?', 12, 0, 100, 0, 0, 0, 'Apothecary Albreck',19067), +(21279, 3, 0, 'Oh, my!', 12, 0, 100, 0, 0, 0, 'Apothecary Albreck',19068), +(21279, 4, 0, 'If my blood hadn''t clotted long ago, it would be boiling with rage right now...', 12, 0, 100, 1, 0, 0, 'Apothecary Albreck',19069), +(16795, 0, 0, 'I pity you, Forsaken. Your soul is devoid of light.', 12, 35, 100, 0, 0, 0, 'Draenei Prisoner',13685), +(19354, 0, 0, 'Work these Broken wretches to the bones, Illidari! If there''s anything of value in this forsaken place we shall find it!', 14, 0, 100, 0, 0, 0, 'Arzeth the Merciless',16472), +(19354, 0, 1, 'Do not allow these wretches a moment of rest! If there''s an Ata''mal crystal here then we shall find it!', 14, 0, 100, 0, 0, 0, 'Arzeth the Merciless',16476), +(19354, 0, 2, 'Keep a close eye on this Broken scum! Far too many have escaped from us!', 14, 0, 100, 0, 0, 0, 'Arzeth the Merciless',16474), +(19354, 0, 3, 'We will find what the Master is looking for! Failure is not an option!', 14, 0, 100, 0, 0, 0, 'Arzeth the Merciless',16475), +(20680, 1, 0, 'That Broken worm gave you that staff, didn''t he? Did he also tell you he''s the one that sold out his tribe? No matter, you will both pay for this!', 14, 0, 100, 0, 0, 0, 'Arzeth the Powerless',18349), +(19191, 0, 0, 'What insolence! What arrogance! To believe you could defeat me on my own doorstep!', 14, 0, 100, 0, 0, 0, 'Arazzius the Cruel',17653), +(19191, 1, 0, 'Master, I have failed...', 14, 0, 100, 0, 0, 0, 'Arazzius the Cruel',16429), +(19273, 0, 0, 'Speak with Wing Commander Brack, $n. He''ll outfit you with one of our armored wyvern destroyers. And, good luck!', 12, 0, 100, 25, 0, 0, 'Forward Commander To''arch',17964), +(19255, 0, 0, 'Yea, we got problems. I think that''s crystal clear. The question is, what are we gonna do about it?', 12, 1, 100, 1, 0, 0, 'General Krakork',16392), +(19255, 0, 1, 'Get used to it, girls. We''re out here for the rest of our miserable lives as far as I''m concerned. Welcome to Hellfire Peninsula, your new home.', 12, 1, 100, 1, 0, 0, 'General Krakork',16394), +(19255, 0, 2, 'How many more of you grunts do I need to send back to mommy and daddy in a body bag before you grow a brain and realize that runnin'' head first into a Legion kill squad is suicide? And don''t nod your thick skulls at me as if you know what I''m talkin'' about!', 12, 1, 100, 1, 0, 0, 'General Krakork',16393), +(19255, 0, 3, 'I''m not gonna lie to you, soldiers. We''re getting our butts kicked out there! Now which one of you is orc enough to do something about it?', 12, 1, 100, 1, 0, 0, 'General Krakork',16390), +(20677, 0, 0, 'You''ve freed me! The winds speak to my people once again and grant us their strength. I thank you, stranger.', 12, 0, 100, 1, 0, 0, 'Morod the Windstirrer',18358), +(20678, 0, 0, 'I am free! I will ask the spirit of fire to return to us so that my people may have the courage to fight their masters! I thank you, $r.', 12, 0, 100, 15, 0, 0, 'Akoru the Firecaller',18356), +(20679, 0, 0, 'I''m free! The spirit of water returns to my people. It will bring us the wisdom we need to survive in this harsh land. I am in your debt, $n.', 12, 0, 100, 1, 0, 0, 'Aylaan the Waterwaker',18357); + +UPDATE `creature_template` SET `AIName`= 'SmartAI',`ScriptName`='' WHERE `entry` IN(16794,16795,21257,21279,16764,19273); + +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(16794,16795,21257,21279,19255) and `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(1679400,1679500,2125700,2127900) and `source_type`=9; + +DELETE FROM `smart_scripts` WHERE `entryorguid`=17058 AND `source_type`=0 AND `id` IN(2,3); +DELETE FROM `smart_scripts` WHERE `entryorguid`=16938 AND `source_type`=0 AND `id` IN(1); +DELETE FROM `smart_scripts` WHERE `entryorguid`=19354 AND `source_type`=0 AND `id` IN(3,4); +DELETE FROM `smart_scripts` WHERE `entryorguid`=19191 AND `source_type`=0 AND `id` IN(4,5); +DELETE FROM `smart_scripts` WHERE `entryorguid`=19273 AND `source_type`=0 AND `id` IN(1); +DELETE FROM `smart_scripts` WHERE `entryorguid`IN(20677,20678,20679) AND `source_type`=0 AND `id` IN(2); + +UPDATE `smart_scripts` SET `link`=2 WHERE `entryorguid` IN(20677,20678,20679) AND `source_type`=0 AND `id`=1; +UPDATE `smart_scripts` SET `link`=4 WHERE `entryorguid`=19354 AND `source_type`=0 AND `id`=2; + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(17058, 0, 2, 0, 4, 0, 100, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Illidari Taskmaster - On Agro - Say'), +(17058, 0, 3, 0, 1, 0, 100, 0, 15000, 60000, 45000, 90000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Illidari Taskmaster - OOC - Say'), +(16794, 0, 0, 0, 20, 0, 100, 0, 9387, 0, 0, 0, 80, 1679400, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Azethen - On Quest Reward (Source of the Corruption) - Run Script'), +(16795, 0, 0, 0, 38, 0, 100, 0, 1, 1, 0, 0, 80, 1679500, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Draenei Prisoner - On Data Set 1 1 - Run Script'), +(16938, 0, 1, 0, 4, 0, 35, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Dreghood Brute - On Agro - Say'), +(21257, 0, 0, 0, 20, 0, 100, 0, 10449, 0, 0, 0, 80, 2125700, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Zelana - On Quest Reward (Apothecary Zelana) - Run Script'), +(21279, 0, 0, 0, 20, 0, 100, 0, 10538, 0, 0, 0, 80, 2127900, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Albreck - On Quest Reward (Boiling Blood) - Run Script'), +(19354, 0, 3, 0, 1, 0, 100, 0, 35000, 45000, 40000, 90000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Arzeth the Merciless - OOC - Say'), +(19354, 0, 4, 0, 61, 0, 100, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Arzeth the Merciless - Link - Say'), +(19191, 0, 4, 0, 4, 0, 100, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Arazzius the Cruel - On Agro - Say'), +(19191, 0, 5, 0, 6, 0, 100, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Arazzius the Cruel - On Death - Say'), +(19273, 0, 1, 0, 19, 0, 100, 0, 10129, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Forward Commander To''arch - On Quest Accepted (Mission: The Abyssal Shelf) - Say'), +(19255, 0, 0, 0, 1, 0, 100, 0, 30000, 60000, 30000, 90000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'General Krakork - OOC - Say'), +(20677, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Morod the Windstirrer - Link - Say'), +(20678, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Akoru the Firecaller - Link - Say'), +(20679, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Aylaan the Waterwaker - Link - Say'), +(1679400, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Azethen - Script - Say'), +(1679400, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Azethen - Script - Say'), +(1679400, 9, 2, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 2, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Azethen - Script - Say'), +(1679400, 9, 3, 0, 0, 0, 100, 0, 0, 0, 0, 0, 45, 1, 1, 0, 0, 0, 0, 19, 16795, 0, 0, 0, 0, 0, 0, 'Apothecary Azethen - Script - Set Data 1 1 on Draenei Prisoner'), +(1679400, 9, 4, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 3, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Azethen - Script - Say'), +(1679500, 9, 0, 0, 0, 0, 100, 0, 2000, 2000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Draenei Prisoner - Script - Say'), +(1679500, 9, 1, 0, 0, 0, 100, 0, 2000, 2000, 0, 0, 5, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Draenei Prisoner - Script - Play Emote OneShotEat'), +(1679500, 9, 2, 0, 0, 0, 100, 0, 2000, 2000, 0, 0, 37, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Draenei Prisoner - Script - Die'), +(2125700, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Zelana - Script - Say'), +(2125700, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Zelana - Script - Say'), +(2125700, 9, 2, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 2, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Zelana - Script - Say'), +(2125700, 9, 3, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 3, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Zelana - Script - Say'), +(2127900, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Albreck - Script - Say'), +(2127900, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Albreck - Script - Say'), +(2127900, 9, 2, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 2, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Albreck - Script - Say'), +(2127900, 9, 3, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 3, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Albreck - Script - Say'), +(2127900, 9, 4, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 4, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Apothecary Albreck - Script - Say'); diff --git a/sql/updates/world/2014_08_10_02_world_misc.sql b/sql/updates/world/2014_08_10_02_world_misc.sql new file mode 100644 index 00000000000..b07b6a3632d --- /dev/null +++ b/sql/updates/world/2014_08_10_02_world_misc.sql @@ -0,0 +1,238 @@ +DELETE FROM `creature_text` WHERE `entry` IN(19270,19228,18756,19271); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `BroadcastTextID`) VALUES +(19270, 0, 0, 'If you are ready to laugh, head over to the World''s End Tavern!', 14, 0, 100, 0, 0, 0, 'Shattrath Saul',16380), +(18756, 0, 0, 'I, like, so don''t get it...', 12, 0, 100, 1, 0, 0, 'Haris Pilton',16888), +(18756, 0, 1, 'Psshh... whatever.', 12, 0, 100, 1, 0, 0, 'Haris Pilton',16882), +(18756, 0, 2, 'That''s hot.', 12, 0, 100, 1, 0, 0, 'Haris Pilton',16881), +(18756, 0, 3, 'That joke''s hot.', 12, 0, 100, 1, 0, 0, 'Haris Pilton',16887), +(19228, 0, 0, 'Hey all! So how long until the jokes spawn?', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16382), +(19228, 0, 1, 'I just flew in from Ironforge and, Boy!, are my mount''s wings tired!', 12, 0, 100, 1, 0, 0, 'Perry Gatner',16649), +(19228, 0, 2, 'Hey folks, go easy on me... it''s my first time.', 12, 0, 100, 24, 0, 0, 'Perry Gatner',16328), +(19228, 0, 3, 'Thanks for coming out to see me! I hope you are ready for a good time, because I am.', 12, 0, 100, 21, 0, 0, 'Perry Gatner',16327), + + + +(19228, 1, 0, 'I never met a tauren I didn''t like...', 12, 0, 100, 1, 0, 0, 'Perry Gatner',16378), +(19228, 2, 0, 'To eat!!', 12, 0, 100, 5, 0, 0, 'Perry Gatner',16379), +(19228, 3, 0, 'Last week I was in Goldshire. Have you been there?', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16651), +(19228, 4, 0, 'That town''s so small, I asked a kid to draw me a map. He drew it on the back of a Defias wanted poster...', 12, 0, 100, 1, 0, 0, 'Perry Gatner',16652), +(19228, 5, 0, 'to scale!!', 12, 0, 100, 5, 0, 0, 'Perry Gatner',16653), +(19228, 6, 0, 'Impersonation time!! I call this, "The Silly Tauren."', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16337), +(19228, 7, 0, 'The comedian clears his throat.', 16, 0, 100, 0, 0, 0, 'Perry Gatner',16338), +(19228, 8, 0, 'The comedian impersonates a tauren.', 16, 0, 100, 5, 0, 6386, 'Perry Gatner',16580), +(19228, 9, 0, 'Here''s a good one, why do watermelons have water in them? ', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16333), +(19228, 10, 0, 'Because they are planted in the spring!', 12, 0, 100, 5, 0, 0, 'Perry Gatner',16336), +(19228, 11, 0, 'What''s the deal with women? I mean they are always like...', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16339), +(19228, 12, 0, 'The comedian impersonates a human female.', 16, 0, 100, 5, 0, 6143, 'Perry Gatner',16583), +(19228, 13, 0, 'And then gnomes are even worse! They are always saying stuff like...', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16340), +(19228, 14, 0, 'The comedian impersonates a gnome.', 16, 0, 100, 5, 0, 6133, 'Perry Gatner',16581), +(19228, 15, 0, 'What time is it when an elekk sits on your fence?', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16368), +(19228, 16, 0, 'Time to get a new fence!!', 12, 0, 100, 5, 0, 0, 'Perry Gatner',16369), +(19228, 17, 0, 'If I knew it was going to be like this, I''d have worn my Greater Boots of Laughter.', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16388), +(19228, 17, 1, 'Apparently my reputation with you people is hostile.', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16385), +(19228, 17, 2, 'Wow! The laughs don''t drop very often here, do they?', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16389), +(19228, 18, 0, 'Hey! Hey! Hey! It''s Raliq the drunk... His momma''s so fat she didn''t just make the front cover of Ogre Today...', 12, 0, 100, 25, 0, 0, 'Perry Gatner',16667), +(19228, 19, 0, 'She made the back cover too!', 12, 0, 100, 5, 0, 0, 'Perry Gatner',16668), +(19228, 20, 0, 'The gnomes used to be a nice respectful people...', 12, 0, 100, 1, 0, 0, 'Perry Gatner',16669), +(19228, 21, 0, 'The other day I saw one walking down the street shouting, "Once you go gnome, you never go home!"', 12, 0, 100, 1, 0, 4415, 'Perry Gatner',16670), +(19228, 22, 0, 'I love blood elf women. Especially when they say stuff like this...', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16374), +(19228, 23, 0, 'The comedian impersonates a blood elf.', 16, 0, 100, 5, 0, 9643, 'Perry Gatner',16582), +(19228, 24, 0, 'So the blood elves think they''re just one step away from ruling the world...', 12, 0, 100, 1, 0, 0, 'Perry Gatner',16682), +(19228, 25, 0, 'Twelve steps is more like it!', 12, 0, 100, 5, 0, 0, 'Perry Gatner',16683), +(19228, 26, 0, 'One last impersonation. It''s tough, but let''s see if you can guess who it is...', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16351), +(19228, 27, 0, 'The comedian impersonates an orc.', 16, 0, 100, 5, 0, 7195, 'Perry Gatner',16584), +(19228, 28, 0, 'Now that the show''s done, can someone run me through Scarlet Monestary?', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16381), +(19228, 28, 1, 'Thank you! Don''t forget to tip your waiters! Good night folks.', 12, 0, 100, 0, 0, 0, 'Perry Gatner',16341), +(19228, 28, 2, 'Well, it''s time to take these comedic muscles elsewhere. Have a good night all!', 12, 0, 100, 23, 0, 0, 'Perry Gatner',16348), +(19228, 28, 3, 'Is it over already? You''ve been great folks. Walk safely and have a good night.', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16343), +(19228, 29, 0, 'How many kobolds does it take to change a lantern wick?', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16657), +(19228, 30, 0, 'You no take candle!', 12, 0, 100, 5, 0, 0, 'Perry Gatner',16658), +(19228, 31, 0, 'Goldshire''s inn advertises a lakeside view...', 12, 0, 100, 1, 0, 0, 'Perry Gatner',16655), +(19228, 32, 0, 'I saw a murloc swim by my window.', 12, 0, 100, 1, 0, 0, 'Perry Gatner',16656), +(19228, 33, 0, 'Have you ever noticed that all those cute, orc kids look the same?', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16331), +(19228, 34, 0, 'It''s too bad they don''t stay cute. There must be some rite of passage in the Barrens called, "Climb ugly tree and fall out."', 12, 0, 100, 0, 0, 0, 'Perry Gatner',16334), +(19228, 35, 0, 'I''ve heard that gnomes can grant wishes...', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16375), +(19228, 36, 0, 'Well I wish they''d go away!', 12, 0, 100, 5, 0, 0, 'Perry Gatner',16376), +(19228, 37, 0, 'Look who''s here, it''s Raliq the drunk... His momma''s so fat dragons won''t eat her...', 12, 0, 100, 25, 0, 0, 'Perry Gatner',16665), +(19228, 38, 0, 'They don''t know where to store the leftovers!', 12, 0, 100, 5, 0, 0, 'Perry Gatner',16666), +(19228, 39, 0, 'My wife and I were happy for 23 years...', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16370), +(19228, 40, 0, 'And then we met!', 12, 0, 100, 5, 0, 0, 'Perry Gatner',16371), +(19228, 41, 0, 'What do you call a broken boomerang?', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16372), +(19228, 42, 0, 'A stick!', 12, 0, 100, 5, 0, 0, 'Perry Gatner',16373), +(19228, 43, 0, 'So this gnome tells a tauren that he''s been to Molten Core.', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16332), +(19228, 44, 0, 'The tauren says, "That''s a load of bull."', 12, 0, 100, 5, 0, 0, 'Perry Gatner',16335), +(19228, 45, 0, 'How desperate do you have to be for allies that you recruit your livestock?', 12, 0, 100, 6, 0, 0, 'Perry Gatner',16680), +(19228, 46, 0, 'I own a dog, but I''m not giving him a sword.', 12, 0, 100, 1, 0, 0, 'Perry Gatner',16681), +(19271, 0, 0, 'Thank you all for coming tonight. Now put your hands together to welcome Shattrath''s best, Perry Gatner!', 12, 0, 100, 21, 0, 0, 'Albert Quarksprocket',16383), +(19271, 1, 0, 'Perry Gatner! What an act! The cantina is open all night long, so please, stay and enjoy yourselves!', 12, 0, 100, 21, 0, 0, 'Albert Quarksprocket',16384); +-- Delete the permament spawn of Perry Gatner +DELETE FROM `creature` WHERE `guid`=6747; + +DELETE FROM `waypoints` WHERE `entry` IN(19228,19271,1927100); +INSERT INTO `waypoints` (`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `point_comment`) VALUES +(19228,1,-1748.807, 5131.199, -35.77385,'Perry Gatner WP1'), +(19228,2,-1749.057, 5132.199, -36.02385,'Perry Gatner WP2'), +(19228,3,-1750.557, 5137.449, -36.02385,'Perry Gatner WP3'), -- Stage +(19228,4,-1748.807, 5131.199, -35.77385,'Perry Gatner WP4'), +(19228,5,-1749.029, 5132.317, -36.02094,'Perry Gatner WP5'), +(19228,6,-1748.779, 5131.067, -36.02094,'Perry Gatner WP6'), -- back + + +(19271,1,-1740.421, 5139.315, -37.04716,'Albert Quarksprocket WP1'), +(19271,2,-1741.421, 5139.315, -36.54716,'Albert Quarksprocket WP2'), +(19271,3,-1745.072, 5139.196, -36.11526,'Albert Quarksprocket WP3'), +(19271,4,-1749.072, 5140.196, -36.11526,'Albert Quarksprocket WP4'), +(19271,5,-1750.931, 5143.452, -35.98227,'Albert Quarksprocket WP5'), -- Intro +(19271,6,-1749.931, 5144.202, -36.48227,'Albert Quarksprocket WP6'), +(19271,7,-1749.181, 5144.952, -36.73227,'Albert Quarksprocket WP7'), +(19271,8,-1748.681, 5145.452, -36.73227,'Albert Quarksprocket WP8'), +(19271,9,-1747.681, 5144.952, -36.73227,'Albert Quarksprocket WP9'), +(19271,10,-1740.931, 5142.721, -37.01586,'Albert Quarksprocket WP10'), -- end +(19271,11,-1739.931, 5141.971, -37.01586,'Albert Quarksprocket WP11'), +(19271,12,-1740.726, 5142.045, -37.01049,'Albert Quarksprocket WP12'), +(19271,13,-1741.726, 5142.545, -37.01049,'Albert Quarksprocket WP13'), +(19271,14,-1747.726, 5145.545, -37.01049,'Albert Quarksprocket WP14'), +(19271,15,-1748.1, 5145.452, -36.73235,'Albert Quarksprocket WP15'), +(19271,16,-1748.6, 5145.952, -36.73235,'Albert Quarksprocket WP16'), +(19271,17,-1749.35, 5144.952, -36.73235,'Albert Quarksprocket WP17'), +(19271,18,-1749.85, 5143.702, -36.23235,'Albert Quarksprocket WP18'), -- Outro +(19271,19,-1749.56, 5143.69, -35.98226,'Albert Quarksprocket WP19'), +(19271,20,-1748.56, 5143.94, -36.48226,'Albert Quarksprocket WP20'), +(19271,21,-1747.31, 5144.44, -36.73226,'Albert Quarksprocket WP21'), +(19271,22,-1748.287, 5144.005, -36.37066,'Albert Quarksprocket WP22'), +(19271,23,-1747.037, 5144.505, -36.87066,'Albert Quarksprocket WP23'), +(19271,24,-1745.287, 5145.255, -36.87066,'Albert Quarksprocket WP24'), +(19271,25,-1741.787, 5142.005, -36.87066,'Albert Quarksprocket WP25'), +(19271,26,-1737.287, 5138.584, -37.30579,'Albert Quarksprocket WP26');-- end + +DELETE FROM `game_event` WHERE `eventEntry` IN(65,66); +INSERT INTO `game_event` (`eventEntry`, `start_time`, `end_time`, `occurence`, `length`, `holiday`, `description`, `world_event`, `announce`) VALUES +(65, '2008-01-02 15:55:00', '2020-12-31 06:00:00', 1440, 15, 0, 'Perry Gatner 4pm', 0, 2), +(66, '2008-01-02 19:55:00', '2020-12-31 06:00:00', 1440, 15, 0, 'Perry Gatner 8pm', 0, 2); + +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN(19270,19228,19271,15106,14990,22015,30567,15105,34949); + +DELETE FROM `smart_scripts` WHERE `entryorguid`IN(19270,19228,19271,15106,14990,22015,30567,15105,34949) AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(1922800,1922801,1922802,1927000,1927100,1927101,1927102,1927103,1927104,1927105,1927106,1927107,1927108,1927109,1927110,1927111,1927112,1927113,1927114) AND `source_type`=9; + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19270, 0, 0, 0, 68, 0, 100, 0, 65, 0, 0, 0, 80, 1927000, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shattrath Saul - On Event Start Run Timed action list'), +(19270, 0, 1, 0, 68, 0, 100, 0, 66, 0, 0, 0, 80, 1927000, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shattrath Saul - On Event Start Run Timed action list'), +(1927000, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shattrath Saul - Script - Say'), +(1927000, 9, 1, 0, 0, 0, 100, 0, 120000, 120000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shattrath Saul - Script - Say'), +(1927000, 9, 2, 0, 0, 0, 100, 0, 120000, 120000, 0, 0, 12, 19228, 1, 900000, 0, 0, 0, 8, 0, 0, 0, -1747.617, 5126.938, -35.78802, 1.867502, 'Shattrath Saul - Script - Spawn Perry Gatner'), +(1927000, 9, 3, 0, 0, 0, 100, 0, 60000, 60000, 0, 0, 45, 1, 1, 0, 0, 0, 0, 19, 19271, 0, 0, 0, 0, 0, 0, 'Shattrath Saul - Script - Set Data 1 1 on Albert Quarksprocket'), +(19271, 0, 0, 0, 38, 0, 100, 0, 1, 1, 0, 0, 53, 0, 19271, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - On Data 11 - Start WP'), +(19271, 0, 1, 2, 40, 0, 100, 0, 5, 19271, 0, 0, 54, 13000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - On Reached WP5 - Pause WP'), +(19271, 0, 2, 3, 61, 0, 100, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1.867502, 'Albert Quarksprocket - On Reached WP5 - Set Orientation'), +(19271, 0, 3, 0, 61, 0, 100, 0, 0, 0, 0, 0, 1, 0, 5000, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - On Reached WP5 - Say line 1'), +(19271, 0, 4, 0, 52, 0, 100, 0, 0, 19271, 0, 0, 80, 1927104, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - On Text over line 1 - Run Script '), +(19271, 0, 5, 6, 40, 0, 100, 0, 10, 19271, 0, 0, 54, 229000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - On Reached WP10 - Stop WP'), +(19271, 0, 6, 0, 61, 0, 100, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - On Reached WP10 - Set Orientation'), +(19271, 0, 7, 0, 38, 0, 100, 0, 2, 2, 0, 0, 87, 1927102, 1927103, 1927113, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2.03774, 'Albert Quarksprocket - On Reached WP26 - Set Orientation'), +(19271, 0, 8, 9, 40, 0, 100, 0, 18, 19271, 0, 0, 54, 15000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - On Reached WP18 - Pause WP'), +(19271, 0, 9, 10, 61, 0, 100, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1.867502, 'Albert Quarksprocket - On Reached WP18 - Set Orientation'), +(19271, 0, 10, 0, 61, 0, 100, 0, 0, 0, 0, 0, 1, 1, 14000, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - On Reached WP18 - Say line 2'), +(19271, 0, 11, 0, 40, 0, 100, 0, 26, 19271, 0, 0, 66, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 2.03774, 'Albert Quarksprocket - On Reached WP26 - Set Orientation'), +(19271, 0, 12, 0, 38, 0, 100, 0, 3, 3, 0, 0, 87, 1927100, 1927101, 1927111, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - On Data set 3 3 - Run Random script'), +(19271, 0, 13, 0, 38, 0, 100, 0, 4, 4, 0, 0, 87, 1927105, 1927106, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - On Data set 4 4 - Run Random script'), +(19271, 0, 14, 0, 38, 0, 100, 0, 5, 5, 0, 0, 87, 1927107, 1927108, 1927114, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - On Data set 5 5 - Run Random script'), +(19271, 0, 15, 0, 38, 0, 100, 0, 6, 6, 0, 0, 87, 1927109, 1927110, 1927112, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - On Data set 5 5 - Run Random script'), +(1927100, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 15, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 1 - Say Line 15 (Perry Gatner'), +(1927100, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 16, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 1 - Say Line 16 (Perry Gatner'), +(1927101, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 29, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 2 - Say Line 29 (Perry Gatner'), +(1927101, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 30, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 2 - Say Line 30 (Perry Gatner'), +(1927102, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 9, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 3 - Say Line 15 (Perry Gatner'), +(1927102, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 10, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 3 - Say Line 16 (Perry Gatner'), +(1927103, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 31, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 3 - Say Line 31 (Perry Gatner'), +(1927103, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 32, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 3 - Say Line 32 (Perry Gatner'), +(1927104, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 4 - Set Orientation'), +(1927104, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 5, 21, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 4 - Play emote Oneshot_applause'), +(1927104, 9, 2, 0, 0, 0, 100, 0, 2000, 2000, 0, 0, 5, 25, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 4 - Play emote Oneshot_point'), +(1927104, 9, 3, 0, 0, 0, 100, 0, 2000, 2000, 0, 0, 5, 21, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 4 - Play emote Oneshot_applause'), +(1927104, 9, 4, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 45, 1, 1, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 4 - Set Data 1 1 on Perry Gatner'), +(1927105, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 5 - Say Line 1 (Perry Gatner'), +(1927105, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 2, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 5 - Say Line 2 (Perry Gatner'), +(1927106, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 33, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 6 - Say Line 33 (Perry Gatner'), +(1927106, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 34, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 6 - Say Line 34 (Perry Gatner'), +(1927107, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 24, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 7 - Say Line 24 (Perry Gatner'), +(1927107, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 25, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 7 - Say Line 25 (Perry Gatner'), +(1927108, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 35, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 8 - Say Line 35 (Perry Gatner'), +(1927108, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 36, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 8 - Say Line 36 (Perry Gatner'), +(1927109, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 18, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 9 - Say Line 24 (Perry Gatner'), +(1927109, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 19, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 9 - Say Line 25 (Perry Gatner'), +(1927110, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 37, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 10 - Say Line 35 (Perry Gatner'), +(1927110, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 38, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 10 - Say Line 36 (Perry Gatner'), +(1927111, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 39, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 11 - Say Line 39 (Perry Gatner'), +(1927111, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 40, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 11 - Say Line 40 (Perry Gatner'), +(1927112, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 41, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 12 - Say Line 41 (Perry Gatner'), +(1927112, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 42, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 12 - Say Line 42 (Perry Gatner'), +(1927113, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 43, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 13 - Say Line 42 (Perry Gatner'), +(1927113, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 44, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 13 - Say Line 43 (Perry Gatner'), +(1927114, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 45, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 14 - Say Line 44 (Perry Gatner'), +(1927114, 9, 1, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 46, 0, 0, 0, 0, 0, 19, 19228, 0, 0, 0, 0, 0, 0, 'Albert Quarksprocket - - Script 14 - Say Line 45 (Perry Gatner'), +(19228, 0, 0, 0, 38, 0, 100, 0, 1, 1, 0, 0, 53, 0, 19228, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - On Data Set 1 1 - Start WP'), +(19228, 0, 1, 2, 40, 0, 100, 0, 3, 19228, 0, 0, 54, 220000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - On Reached WP3 - Pause WP'), +(19228, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 80, 1922800, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - On Reached WP3 - Run Script 1'), +(19228, 0, 3, 0, 40, 0, 100, 0, 6, 19228, 0, 0, 41, 5000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - On Reached WP6 - Despawn'), +(19228, 0, 4, 0, 40, 0, 100, 0, 2, 19228, 0, 0, 80, 1922801, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - On Reached WP2 - Run Script 2'), +(19228, 0, 5, 0, 40, 0, 100, 0, 4, 19228, 0, 0, 80, 1922802, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - On Reached WP6 - Run Script 3'), +(1922800, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 1, 0, 0, 0, 100, 0, 3000, 3000, 0, 0, 45, 4, 4, 0, 0, 0, 0, 19, 19271, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Set Data 4 4 on Albert Quarksprocket'), +(1922800, 9, 2, 0, 0, 0, 100, 0, 14000, 14000, 0, 0, 1, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 3, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 4, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 5, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 5, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 6, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 6, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 7, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 8, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 8, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 45, 2, 2, 0, 0, 0, 0, 19, 19271, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Set Data 2 2 on Albert Quarksprocket'), +(1922800, 9, 9, 0, 0, 0, 100, 0, 14000, 14000, 0, 0, 1, 11, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 10, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 11, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 12, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 12, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 13, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 13, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 14, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 14, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 15, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 45, 3, 3, 0, 0, 0, 0, 19, 19271, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Set Data 3 3 on Albert Quarksprocket'), +(1922800, 9, 16, 0, 0, 0, 100, 0, 12000, 12000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 19, 18756, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line 1 on Hilton Paris'), +(1922800, 9, 17, 0, 0, 0, 100, 0, 2000, 2000, 0, 0, 1, 17, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 18, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 45, 6, 6, 0, 0, 0, 0, 19, 19271, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Set Data 6 6 on Albert Quarksprocket'), +(1922800, 9, 19, 0, 0, 0, 100, 0, 14000, 14000, 0, 0, 1, 20, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 20, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 21, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 21, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 22, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 22, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 23, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 23, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 24, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 45, 5, 5, 0, 0, 0, 0, 19, 19271, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Set Data 5 5 on Albert Quarksprocket'), +(1922800, 9, 25, 0, 0, 0, 100, 0, 14000, 14000, 0, 0, 1, 26, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 26, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 27, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 27, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922800, 9, 38, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 28, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script - Say Line'), +(1922801, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 45, 1, 1, 0, 0, 0, 0, 19, 15106, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script 2 - Set Data 1 1 on Frostwolf Emissary'), +(1922801, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 45, 1, 1, 0, 0, 0, 0, 19, 14990, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script 2 - Set Data 1 1 on Defilers Emissary'), +(1922801, 9, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 45, 1, 1, 0, 0, 0, 0, 19, 22015, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script 2 - Set Data 1 1 on Eye of the Storm Envoy'), +(1922801, 9, 3, 0, 0, 0, 100, 0, 0, 0, 0, 0, 45, 1, 1, 0, 0, 0, 0, 19, 30567, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script 2 - Set Data 1 1 on Strand of the Ancients Envoy'), +(1922801, 9, 4, 0, 0, 0, 100, 0, 0, 0, 0, 0, 45, 1, 1, 0, 0, 0, 0, 19, 15105, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script 2 - Set Data 1 1 on Warsong Emissary'), +(1922801, 9, 5, 0, 0, 0, 100, 0, 0, 0, 0, 0, 45, 1, 1, 0, 0, 0, 0, 19, 34949, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script 2 - Set Data 1 1 on Isle of Conquest Envoy'), +(1922802, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 45, 2, 2, 0, 0, 0, 0, 19, 15106, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script 3 - Set Data 2 2 on Frostwolf Emissary'), +(1922802, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 45, 2, 2, 0, 0, 0, 0, 19, 14990, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script 3 - Set Data 2 2 on Defilers Emissary'), +(1922802, 9, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 45, 2, 2, 0, 0, 0, 0, 19, 22015, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script 3 - Set Data 2 2 on Eye of the Storm Envoy'), +(1922802, 9, 3, 0, 0, 0, 100, 0, 0, 0, 0, 0, 45, 2, 2, 0, 0, 0, 0, 19, 30567, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script 3 - Set Data 2 2 on Strand of the Ancients Envoy'), +(1922802, 9, 4, 0, 0, 0, 100, 0, 0, 0, 0, 0, 45, 2, 2, 0, 0, 0, 0, 19, 15105, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script 3 - Set Data 2 2 on Warsong Emissary'), +(1922802, 9, 5, 0, 0, 0, 100, 0, 0, 0, 0, 0, 45, 2, 2, 0, 0, 0, 0, 19, 34949, 0, 0, 0, 0, 0, 0, 'Perry Gatner - Script 3 - Set Data 2 2 on Isle of Conquest Envoy'), +(15106, 0, 0, 0, 38, 0, 100, 0, 1, 1, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Frostwolf Emissary - On Data Set 1 1 - Set Phase 2'), +(15106, 0, 1, 0, 38, 0, 100, 0, 2, 2, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Frostwolf Emissary - On Data Set 2 2 - Set Phase 1'), +(15106, 0, 2, 0, 1, 2, 100, 0, 14000, 21000, 7000, 21000, 5, 11, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Frostwolf Emissary - OOC (Phase 2) - Play emote oneshot laugh'), +(14990, 0, 0, 0, 38, 0, 100, 0, 1, 1, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Defilers Emissary - On Data Set 1 1 - Set Phase 2'), +(14990, 0, 1, 0, 38, 0, 100, 0, 2, 2, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Defilers Emissary - On Data Set 2 2 - Set Phase 1'), +(14990, 0, 2, 0, 1, 2, 100, 0, 14000, 21000, 7000, 21000, 5, 11, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Defilers Emissary - OOC (Phase 2) - Play emote oneshot laugh'), +(22015, 0, 0, 0, 38, 0, 100, 0, 1, 1, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Eye of the Storm Envoy - On Data Set 1 1 - Set Phase 2'), +(22015, 0, 1, 0, 38, 0, 100, 0, 2, 2, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Eye of the Storm Envoy - On Data Set 2 2 - Set Phase 1'), +(22015, 0, 2, 0, 1, 2, 100, 0, 14000, 21000, 7000, 21000, 5, 11, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Eye of the Storm Envoy - OOC (Phase 2) - Play emote oneshot laugh'), +(30567, 0, 0, 0, 38, 0, 100, 0, 1, 1, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Strand of the Ancients Envoy - On Data Set 1 1 - Set Phase 2'), +(30567, 0, 1, 0, 38, 0, 100, 0, 2, 2, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Strand of the Ancients Envoy - On Data Set 2 2 - Set Phase 1'), +(30567, 0, 2, 0, 1, 2, 100, 0, 14000, 21000, 7000, 21000, 5, 11, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Strand of the Ancients Envoy - OOC (Phase 2) - Play emote oneshot laugh'), +(15105, 0, 0, 0, 38, 0, 100, 0, 1, 1, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Warsong Emissary - On Data Set 1 1 - Set Phase 2'), +(15105, 0, 1, 0, 38, 0, 100, 0, 2, 2, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Warsong Emissary - On Data Set 2 2 - Set Phase 1'), +(15105, 0, 2, 0, 1, 2, 100, 0, 14000, 21000, 7000, 21000, 5, 11, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Warsong Emissary - OOC (Phase 2) - Play emote oneshot laugh'), +(34949, 0, 0, 0, 38, 0, 100, 0, 1, 1, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Isle of Conquest Envoy - On Data Set 1 1 - Set Phase 2'), +(34949, 0, 1, 0, 38, 0, 100, 0, 2, 2, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Isle of Conquest Envoy - On Data Set 2 2 - Set Phase 1'), +(34949, 0, 2, 0, 1, 2, 100, 0, 14000, 21000, 7000, 21000, 5, 11, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Isle of Conquest Envoy - OOC (Phase 2) - Play emote oneshot laugh'); diff --git a/sql/updates/world/2014_08_11_00_world_misc.sql b/sql/updates/world/2014_08_11_00_world_misc.sql new file mode 100644 index 00000000000..06f80db7758 --- /dev/null +++ b/sql/updates/world/2014_08_11_00_world_misc.sql @@ -0,0 +1,102 @@ +DELETE FROM `creature_text` WHERE `entry` IN(17831,17955); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `BroadcastTextID`) VALUES +(17831, 0, 0, '$n, let''s go see if this plan will work. Come along, Buddy!', 12, 0, 100, 0, 0, 0, 'Watcher Leesa''oh',14608), +(17831, 1, 0, 'Ok, let''s see about using those mushrooms you brought back to grow the bog lords a new food supply.', 12, 0, 100, 0, 0, 0, 'Watcher Leesa''oh',14609), +(17831, 2, 0, 'Wait and see what happens!', 12, 0, 100, 0, 0, 0, 'Watcher Leesa''oh',14615), +(17831, 3, 0, 'Oh Buddy, you big baby! Look, it''s working. It''s really working!! Now all I need to do is grow more of these mushrooms here and the bog lords will likely leave the sporelings alone!', 12, 0, 100, 0, 0, 0, 'Watcher Leesa''oh',14610), +(17831, 4, 0, 'Oh, thank you, $n! You''ve made it possible to save both the sporelings from the bog lords, and the bog lords from our wrath.', 12, 0, 100, 0, 0, 0, 'Watcher Leesa''oh',14611), +(17955, 0, 0, 'The %s takes a piece of the mushroom tree and holds it to its ''nose''. Seemingly satisfied, it eats it!', 16, 0, 100, 36, 0, 0, 'Hungry Bog Lord',14612), +(17955, 1, 0, 'The %s uproots the rest of the mushroom tree and makes off with it.', 16, 0, 100, 36, 0, 0, 'Hungry Bog Lord',14613); + +DELETE FROM `waypoints` WHERE `entry` IN(17831,17955,17953); +INSERT INTO `waypoints` (`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `point_comment`) VALUES +(17831,1, -280.0389, 8304.785, 20.12167,'Watcher Leesa''oh '), +(17831,2, -276.2272, 8298.744, 20.00148,'Watcher Leesa''oh '), +(17831,3, -278.8585, 8289.577, 19.76397,'Watcher Leesa''oh '), +(17831,4, -280.1085, 8285.827, 19.01397,'Watcher Leesa''oh '), +(17831,5, -280.6085, 8283.827, 18.51397,'Watcher Leesa''oh '), +(17831,6, -281.8585, 8280.077, 18.01397,'Watcher Leesa''oh '), +(17831,7, -288.8013, 8259.563, 17.99014,'Watcher Leesa''oh '), +(17831,8, -292.6434, 8246.023, 18.64896,'Watcher Leesa''oh '), +(17831,9, -293.1434, 8240.273, 18.89896,'Watcher Leesa''oh '), +(17831,10, -293.4886, 8239.822, 19.07904,'Watcher Leesa''oh '), +(17831,11, -293.4886, 8238.322, 19.57904,'Watcher Leesa''oh '), +(17831,12, -293.7386, 8235.572, 20.32904,'Watcher Leesa''oh '), +(17831,13, -293.7386, 8233.572, 20.82904,'Watcher Leesa''oh '), -- event +(17831,14, -293.5977, 8234.545, 20.6902,'Watcher Leesa''oh '), +(17831,15, -293.5977, 8236.545, 19.9402,'Watcher Leesa''oh '), +(17831,16, -293.3477, 8238.295, 19.4402,'Watcher Leesa''oh '), +(17831,17, -293.0977, 8241.295, 18.9402,'Watcher Leesa''oh '), +(17831,18, -292.3477, 8250.045, 18.1902,'Watcher Leesa''oh '), +(17831,19, -291.7706, 8253.604, 18.16209,'Watcher Leesa''oh '), +(17831,20, -288.8718, 8267.246, 17.94799,'Watcher Leesa''oh '), +(17831,21, -283.1218, 8282.746, 18.44799,'Watcher Leesa''oh '), +(17831,22, -282.3718, 8284.746, 18.94799,'Watcher Leesa''oh '), +(17831,23, -281.6218, 8286.496, 19.44799,'Watcher Leesa''oh '), +(17831,24, -282.2319, 8284.964, 19.17534,'Watcher Leesa''oh '), +(17831,25, -281.4819, 8286.714, 19.42534,'Watcher Leesa''oh '), +(17831,26, -281.4819, 8287.214, 19.67534,'Watcher Leesa''oh '), +(17831,27, -277.4792, 8293.729, 20.06543,'Watcher Leesa''oh '), +(17831,28, -276.6099, 8299.607, 20.13173,'Watcher Leesa''oh '), +(17831,29, -280.3798, 8302.444, 20.07166,'Watcher Leesa''oh '), +(17831,30,-283.8611, 8302.739, 19.72713,'Watcher Leesa''oh '), +(17955,1, -350.6533, 8217.619, 23.96465,'Hungry Boglord'), +(17955,2, -343.4033, 8219.119, 23.71465,'Hungry Boglord'), +(17955,3, -332.9033, 8217.119, 23.46465,'Hungry Boglord'), +(17955,4, -330.9033, 8216.619, 22.96465,'Hungry Boglord'), +(17955,5, -330.5525, 8216.891, 22.75951,'Hungry Boglord'), +(17955,6, -323.0525, 8215.641, 23.00951,'Hungry Boglord'), +(17955,7, -315.3025, 8216.391, 23.50951,'Hungry Boglord'), +(17955,8, -306.3025, 8217.141, 22.75951,'Hungry Boglord'), +(17955,9, -303.5525, 8217.391, 22.25951,'Hungry Boglord'), -- eat +(17955,10, -270.5456, 8223.803, 21.73361,'Hungry Boglord'), +(17955,11, -270.1879, 8223.752, 21.80058,'Hungry Boglord'), +(17955,12, -269.6879, 8224.002, 21.55058,'Hungry Boglord'), +(17955,13, -267.1879, 8222.752, 21.05058,'Hungry Boglord'), +(17955,14, -264.1879, 8221.752, 20.55058,'Hungry Boglord'), +(17955,15, -251.7115, 8216.566, 20.36899,'Hungry Boglord'), +(17955,16, -245.7115, 8208.816, 21.11899,'Hungry Boglord'), +(17955,17, -241.9615, 8204.316, 21.61899,'Hungry Boglord'), +(17955,18, -235.9615, 8196.316, 21.11899,'Hungry Boglord'), +(17955,19, -235.5499, 8195.942, 21.19431,'Hungry Boglord'), +(17955,20, -232.5499, 8192.192, 20.94431,'Hungry Boglord'), +(17955,21, -226.0499, 8159.192, 21.19431,'Hungry Boglord'), +(17955,22, -226.1419, 8158.809, 21.23708,'Hungry Boglord'), +(17955,23, -223.8919, 8147.559, 20.73708,'Hungry Boglord'), +(17953,1, -223.8919, 8147.559, 20.73708,'Buddy'); + + +UPDATE `creature_template` SET `ainame`='SmartAI', `scriptname`='' WHERE `entry` IN(17831,17953,17955); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(17831,17953,17955) AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(1783100,1783101) AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(17831, 0, 0, 1, 20, 0, 100, 0, 9709, 0, 0, 0, 64, 1, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - On Quest Reward - Store Target List'), +(17831, 0, 1, 0, 61, 0, 100, 0, 0, 0, 0, 0, 80, 1783101, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - On Quest Reward - Run Script'), +(17831, 0, 2, 3, 40, 0, 100, 0, 13, 17831, 0, 0, 54, 50000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - On Reached WP21 - Pause WP'), +(17831, 0, 3, 0, 61, 0, 100, 0, 0, 0, 0, 0, 80, 1783100, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - On Reached WP13 - Run Script'), +(17831, 0, 4, 5, 40, 0, 100, 0, 31, 17831, 0, 0, 66, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0.9250245, 'Watcher Leesa''oh - On Reached WP41 - Set Orientation'), +(17831, 0, 5, 0, 61, 0, 100, 0, 0, 0, 0, 0, 81, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - On Reached WP31 - Set NPC Flags'), +(17953, 0, 0, 0, 38, 0, 100, 0, 1, 1, 0, 0, 29, 0, 0, 0, 0, 0, 0, 19, 17831, 0, 0, 0, 0, 0, 0, 'Buddy - On Data Set - Follow Watcher Leesa''oh '), +(17953, 0, 1, 2, 1, 0, 100, 0, 0, 30000, 60000, 0, 5, 36, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Buddy - OOC - Play emote OneShotAttack1H'), +(17953, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 4, 643, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Buddy - OOC - Play Sound ID 643'), +(17953, 0, 3, 0, 25, 0, 100, 0, 0, 0, 0, 0, 89, 6, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Buddy - On Reset Set Random Movement'), +(17953, 0, 4, 5, 38, 0, 100, 0, 2, 2, 0, 0, 29, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Buddy - On Data Set - Follow Watcher Leesa''oh '), +(17953, 0, 5, 0, 61, 0, 100, 0, 0, 0, 0, 0, 53, 0, 17953, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Buddy - OOC - Play Sound ID 643'), +(17953, 0, 6, 0, 40, 0, 100, 0, 1, 17953, 0, 0, 89, 6, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Buddy - On Reached WP1 - Set Random Movement'), +(17955, 0, 0, 0, 54, 0, 100, 0, 0, 0, 0, 0, 53, 1, 17955, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Hungry Boglord - On Just Summoned Start WP'), +(17955, 0, 1, 0, 40, 0, 100, 0, 9, 17955, 0, 0, 54, 11500, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Hungry Boglord - On Reached WP10 Pause WP'), +(17955, 0, 2, 0, 40, 0, 100, 0, 23, 17955, 0, 0, 41, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Hungry Boglord - On Reached WP24 - Despawn'), +(1783100, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - Script - Say Line 2'), +(1783100, 9, 1, 0, 0, 0, 100, 0, 2000, 2000, 0, 0, 11, 32618, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - Script - Cast'), +(1783100, 9, 2, 0, 0, 0, 100, 0, 8000, 8000, 0, 0, 1, 2, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - Script - Say Line 3'), +(1783100, 9, 3, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 50, 182073, 21, 0, 0, 0, 0, 8, 0, 0, 0, -293.1354, 8218.522, 22.26159, 2.757613, 'Watcher Leesa''oh - Script - Spawn Grown Mushroom'), +(1783100, 9, 4, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 12, 17955, 1, 30000, 0, 0, 0, 8, 0, 0, 0, -362.3764, 8215.58, 25.25911, 0.3794507, 'Watcher Leesa''oh - Script - Spawn Hungry Boglord'), +(1783100, 9, 5, 0, 0, 0, 100, 0, 8000, 8000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 19, 17955, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - Script - Say Line 1 on Hungry Boglord'), +(1783100, 9, 6, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 45, 2, 2, 0, 0, 0, 0, 19, 17953, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - Script - Set Data 2 2 on Buddy'), +(1783100, 9, 7, 0, 0, 0, 100, 0, 4000, 4000, 0, 0, 1, 3, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - Script - Say Line 4'), +(1783100, 9, 8, 0, 0, 0, 100, 0, 9000, 9000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 19, 17955, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - Script - Say Line 2 on Hungry Boglord'), +(1783100, 9, 9, 0, 0, 0, 100, 0, 10000, 10000, 0, 0, 1, 4, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - Script - Say Line 4'), +(1783101, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - Script 2 - Set Npc Flags'), +(1783101, 9, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 0, 7000, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - Script 2 - Say Line 1'), +(1783101, 9, 3, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 45, 1, 1, 0, 0, 0, 0, 19, 17953, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - Script 2 - Set Data 1 1 on Buddy'), +(1783101, 9, 4, 0, 0, 0, 100, 0, 0, 0, 0, 0, 53, 0, 17831, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Watcher Leesa''oh - Script 2 - Start WP'); diff --git a/sql/updates/world/2014_08_11_01_world_misc.sql b/sql/updates/world/2014_08_11_01_world_misc.sql new file mode 100644 index 00000000000..8b0a17b016f --- /dev/null +++ b/sql/updates/world/2014_08_11_01_world_misc.sql @@ -0,0 +1,70 @@ +UPDATE `creature_text` SET `emote`=5 WHERE `entry`=19831 AND `groupid`=4 AND `id`=0; +UPDATE `creature_text` SET `emote`=1 WHERE `entry`=19831 AND `groupid`=0 AND `id`=0; +UPDATE `creature_text` SET `emote`=6 WHERE `entry`=19830 AND `groupid`=0 AND `id`=0; +UPDATE `creature_text` SET `emote`=1 WHERE `entry`=21504 AND `groupid`=0 AND `id`=0; +UPDATE `creature_text` SET `emote`=5 WHERE `entry`=21504 AND `groupid`=1 AND `id`=0; +UPDATE `creature_text` SET `emote`=1 WHERE `entry`=21504 AND `groupid`=2 AND `id`=0; +UPDATE `creature_text` SET `emote`=1 WHERE `entry`=21504 AND `groupid`=3 AND `id`=0; +UPDATE `creature_text` SET `emote`=2 WHERE `entry`=18554 AND `groupid`=3 AND `id`=0; +UPDATE `creature_text` SET `emote`=1 WHERE `entry`=21504 AND `groupid`=4 AND `id`=0; +UPDATE `creature_text` SET `emote`=1 WHERE `entry`=21504 AND `groupid`=5 AND `id`=0; +UPDATE `creature_text` SET `emote`=5, `sound`=7274 WHERE `entry`=21504 AND `groupid`=6 AND `id`=0; +UPDATE `creature_text` SET `emote`=25 WHERE `entry`=21504 AND `groupid`=7 AND `id`=0; +UPDATE `creature_text` SET `emote`=25 WHERE `entry`=18385 AND `groupid`=1 AND `id`=0; + +UPDATE `creature_template` SET `ainame`='SmartAI', `scriptname`='' WHERE `entry` IN(19466); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(19466) AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(1946600) AND `source_type`=9; +DELETE FROM `smart_scripts` WHERE `entryorguid`=1410 AND `source_type`=0 AND `id`=3; +DELETE FROM `smart_scripts` WHERE `entryorguid`=5355 AND `source_type`=0 AND `id`=3; +DELETE FROM `smart_scripts` WHERE `entryorguid`=16769 AND `source_type`=0 AND `id`=17; +DELETE FROM `smart_scripts` WHERE `entryorguid`=21611 AND `source_type`=0 AND `id`=3; + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19466, 0, 0, 0, 1, 0, 100, 0, 0, 30000, 180000, 240000, 80, 1946600, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Exarch Orelis - OOC - Run Script'), +(1410, 0, 3, 0, 4, 0, 30, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Firewing Bloodwarder - On Agro - Say'), +(5355, 0, 3, 0, 4, 0, 30, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Firewing Defender - On Agro - Say'), +(16769, 0, 17, 0, 4, 0, 30, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Firewing Warlock - On Agro - Say'), +(21611, 0, 3, 0, 4, 0, 30, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Cabal SkirmisheR - On Agro - Say'), +(1946600, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 19, 19467, 0, 0, 0, 0, 0, 0, 'Exarch Orelis - Script - Say Line 1 (Anchorite Karja)'), +(1946600, 9, 1, 0, 0, 0, 100, 0, 8000, 8000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 19, 19468, 0, 0, 0, 0, 0, 0, 'Exarch Orelis - Script - Say Line 1 (Spymaster Thalodien)'), +(1946600, 9, 2, 0, 0, 0, 100, 0, 8000, 8000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Exarch Orelis - Script - Say Line 1'), +(1946600, 9, 3, 0, 0, 0, 100, 0, 8000, 8000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 19, 19469, 0, 0, 0, 0, 0, 0, 'Exarch Orelis - Script - Say Line 1 (Magistrix Larynna)'), +(1946600, 9, 4, 0, 0, 0, 100, 0, 8000, 8000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 19, 19467, 0, 0, 0, 0, 0, 0, 'Exarch Orelis - Script - Say Line 2 (Anchorite Karja)'), +(1946600, 9, 5, 0, 0, 0, 100, 0, 8000, 8000, 0, 0, 1, 2, 0, 0, 0, 0, 0, 19, 19467, 0, 0, 0, 0, 0, 0, 'Exarch Orelis - Script - Say Line 3 (Anchorite Karja)'), +(1946600, 9, 6, 0, 0, 0, 100, 0, 8000, 8000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 19, 19469, 0, 0, 0, 0, 0, 0, 'Exarch Orelis - Script - Say Line 2 (Magistrix Larynna)'), +(1946600, 9, 7, 0, 0, 0, 100, 0, 8000, 8000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 19, 19468, 0, 0, 0, 0, 0, 0, 'Exarch Orelis - Script - Say Line 2 (Spymaster Thalodien)'), +(1946600, 9, 8, 0, 0, 0, 100, 0, 8000, 8000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Exarch Orelis - Script - Say Line 2'), +(1946600, 9, 9, 0, 0, 0, 100, 0, 8000, 8000, 0, 0, 1, 2, 0, 0, 0, 0, 0, 19, 19468, 0, 0, 0, 0, 0, 0, 'Exarch Orelis - Script - Say Line 3 (Spymaster Thalodien)'); + +DELETE FROM `creature_text` WHERE `entry` IN(19466,19468,19541,19467,19469,1410,5355,21661); +DELETE FROM `creature_text` WHERE `entry` =16769 AND `groupid`=1; + +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `BroadcastTextID`) VALUES +(19466, 0, 0, 'Hold your tongue, knave! Do not dare use that tone with a priestess of the Light!', 12, 0, 100, 25, 0, 0, 'Exarch Orelis',16873), +(19466, 1, 0, 'Even you must admit that your information from defectors is outdated and unreliable. Let us make calculated attacks on these manaforges and gather what information we can.', 12, 0, 100, 5, 0, 0, 'Exarch Orelis',16890), +(19468, 0, 0, 'Look, sweetheart. No one''s talking about storming Tempest Keep ourselves, but when we see a target of opportunity we have to take it.', 12, 0, 100, 0, 0, 0, 'Spymaster Thalodien',16872), +(19468, 1, 0, '...and just look at where that got us!', 12, 0, 100, 0, 0, 0, 'Spymaster Thalodien',16889), +(19468, 2, 0, 'Finally some talk of action from the big guy!', 12, 0, 100, 1, 0, 0, 'Spymaster Thalodien',16891), +(19541, 0, 0, 'Good thing that we''re surrounded by neighbors with excess machine parts.', 12, 0, 100, 1, 0, 0, 'Netherstorm Agent',17119), +(19541, 0, 1, 'Maybe I should gather up some other agents and head out there after this shift?', 12, 0, 100, 1, 0, 0, 'Netherstorm Agent',17115), +(19541, 0, 2, 'Hmm, arcane annihilators are pretty tough. I wonder if Papa Wheeler knows what he''s asking for?', 12, 0, 100, 1, 0, 0, 'Netherstorm Agent',17116), +(19541, 0, 3, 'Last time someone went out to try to collect the bounty on Netherock, all we got back was a compressed layer of foolhardy adventurer!', 12, 0, 100, 1, 0, 0, 'Netherstorm Agent',19660), +(19541, 0, 4, 'Netherock?! That thing''ll squish you flat with one step of its massive foot! No thanks!', 12, 0, 100, 1, 0, 0, 'Netherstorm Agent',19659), +(19467, 0, 0, 'With all due respect, A''dal sent us here to investigate Kael''s activities, not mount a full-scaled attack.', 12, 0, 100, 0, 0, 0, 'Anchorite Karja',16870), +(19467, 1, 0, 'The magistrix will be happy to know I''m fluent in Thalassian. Your courtesy is not lost on me.', 12, 0, 100, 0, 0, 0, 'Anchorite Karja',16875), +(19467, 2, 0, 'Back to the topic... we should focus our attention on these manaforges. We need to learn what the enemy is doing with them and why.', 12, 0, 100, 0, 0, 0, 'Anchorite Karja',16876), +(19469, 0, 0, 'I''m surrounded by idiots!', 12, 10, 100, 5, 0, 0, 'Magistrix Larynna',16874), +(19469, 1, 0, 'We''ve told you all there is to know! Do you forget that many of us used to be trusted followers of Kael''thas?', 12, 0, 100, 22, 0, 0, 'Magistrix Larynna',16883), +(1410, 0, 0, 'You won''t escape alive!', 12, 0, 100, 0, 0, 0, 'Firewing Bloodwarder',16249), +(1410, 0, 1, 'I will have your energy and then your life!', 12, 0, 100, 0, 0, 0, 'Firewing Bloodwarder',16254), +(5355, 0, 2, 'You won''t escape alive!', 12, 0, 100, 0, 0, 0, 'Firewing Defender',16249), +(5355, 0, 3, 'You know too much!', 12, 0, 100, 0, 0, 0, 'Firewing Defender',16251), +(16769, 1, 0, 'For Kael''thas!', 12, 0, 100, 0, 0, 0, 'Firewing Warlock',16252), +(16769, 1, 1, 'You won''t escape alive!', 12, 0, 100, 0, 0, 0, 'Firewing Warlock',16249), +(16769, 1, 2, 'Kill them before they get away!', 12, 0, 100, 0, 0, 0, 'Firewing Warlock',16250), +(16769, 1, 3, 'I will have your energy and then your life!', 12, 0, 100, 0, 0, 0, 'Firewing Warlock',16254), +(21661, 0, 0, '%s becomes enraged!', 16, 0, 100, 0, 0, 0, 'Cabal Skirmisher',10677), +(21661, 1, 0, 'The end comes for you!', 12, 0, 100, 0, 0, 0, 'Cabal Skirmisher',16800), +(21661, 1, 1, 'You will not escape us so easily!', 12, 0, 100, 0, 0, 0, 'Cabal Skirmisher',20165), +(21661, 1, 2, 'I shall be rewarded!', 12, 0, 100, 0, 0, 0, 'Cabal Skirmisher',16803); diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 0b1a93b3d2a..5b7ad73a0d0 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -106,6 +106,7 @@ int main(int argc, char** argv) if (sRealmList->size() == 0) { TC_LOG_ERROR("server.authserver", "No valid realms specified."); + StopDB(); return 1; } @@ -114,6 +115,7 @@ int main(int argc, char** argv) if (port < 0 || port > 0xFFFF) { TC_LOG_ERROR("server.authserver", "Specified port out of allowed range (1-65535)"); + StopDB(); return 1; } diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp index 5a03109f717..2110dc1fecc 100644 --- a/src/server/authserver/Realms/RealmList.cpp +++ b/src/server/authserver/Realms/RealmList.cpp @@ -137,8 +137,10 @@ void RealmList::UpdateRealms(bool init) uint32 realmId = fields[0].GetUInt32(); std::string name = fields[1].GetString(); boost::asio::ip::tcp::resolver::query externalAddressQuery(ip::tcp::v4(), fields[2].GetString(), ""); - boost::asio::ip::tcp::resolver::iterator endPoint = _resolver->resolve(externalAddressQuery); - if (endPoint == end) + + boost::system::error_code ec; + boost::asio::ip::tcp::resolver::iterator endPoint = _resolver->resolve(externalAddressQuery, ec); + if (endPoint == end || ec) { TC_LOG_ERROR("server.authserver", "Could not resolve address %s", fields[2].GetString().c_str()); return; @@ -147,8 +149,8 @@ void RealmList::UpdateRealms(bool init) ip::address externalAddress = (*endPoint).endpoint().address(); boost::asio::ip::tcp::resolver::query localAddressQuery(ip::tcp::v4(), fields[3].GetString(), ""); - endPoint = _resolver->resolve(localAddressQuery); - if (endPoint == end) + endPoint = _resolver->resolve(localAddressQuery, ec); + if (endPoint == end || ec) { TC_LOG_ERROR("server.authserver", "Could not resolve address %s", fields[3].GetString().c_str()); return; @@ -157,8 +159,8 @@ void RealmList::UpdateRealms(bool init) ip::address localAddress = (*endPoint).endpoint().address(); boost::asio::ip::tcp::resolver::query localSubmaskQuery(ip::tcp::v4(), fields[4].GetString(), ""); - endPoint = _resolver->resolve(localSubmaskQuery); - if (endPoint == end) + endPoint = _resolver->resolve(localSubmaskQuery, ec); + if (endPoint == end || ec) { TC_LOG_ERROR("server.authserver", "Could not resolve address %s", fields[4].GetString().c_str()); return; diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp index ac7c1cfaee5..4112f991dc6 100644 --- a/src/server/authserver/Server/AuthSession.cpp +++ b/src/server/authserver/Server/AuthSession.cpp @@ -21,6 +21,7 @@ #include "AuthCodes.h" #include "Database/DatabaseEnv.h" #include "SHA1.h" +#include "TOTP.h" #include "openssl/crypto.h" #include "Configuration/Config.h" #include "RealmList.h" @@ -52,7 +53,6 @@ enum eStatus typedef struct AUTH_LOGON_CHALLENGE_C { - uint8 cmd; uint8 error; uint16 size; uint8 gamename[4]; @@ -71,7 +71,6 @@ typedef struct AUTH_LOGON_CHALLENGE_C typedef struct AUTH_LOGON_PROOF_C { - uint8 cmd; uint8 A[32]; uint8 M1[20]; uint8 crc_hash[20]; @@ -99,7 +98,6 @@ typedef struct AUTH_LOGON_PROOF_S_OLD typedef struct AUTH_RECONNECT_PROOF_C { - uint8 cmd; uint8 R1[16]; uint8 R2[20]; uint8 R3[20]; @@ -114,10 +112,10 @@ enum class BufferSizes : uint32 SRP_6_S = 0x20, }; -#define REALM_LIST_PACKET_SIZE 5 -#define XFER_ACCEPT_SIZE 1 -#define XFER_RESUME_SIZE 9 -#define XFER_CANCEL_SIZE 1 +#define REALM_LIST_PACKET_SIZE 4 +#define XFER_ACCEPT_SIZE 0 +#define XFER_RESUME_SIZE 8 +#define XFER_CANCEL_SIZE 0 std::unordered_map<uint8, AuthHandler> AuthSession::InitHandlers() { @@ -137,48 +135,43 @@ std::unordered_map<uint8, AuthHandler> AuthSession::InitHandlers() std::unordered_map<uint8, AuthHandler> const Handlers = AuthSession::InitHandlers(); -void AuthSession::ReadHeaderHandler(boost::system::error_code error, size_t transferedBytes) +void AuthSession::ReadHeaderHandler() { - if (!error && transferedBytes == 1) + uint8 cmd = GetHeaderBuffer()[0]; + auto itr = Handlers.find(cmd); + if (itr != Handlers.end()) { - uint8 cmd = GetReadBuffer()[0]; - auto itr = Handlers.find(cmd); - if (itr != Handlers.end()) + // Handle dynamic size packet + if (cmd == AUTH_LOGON_CHALLENGE || cmd == AUTH_RECONNECT_CHALLENGE) { - // Handle dynamic size packet - if (cmd == AUTH_LOGON_CHALLENGE || cmd == AUTH_RECONNECT_CHALLENGE) - { - ReadData(sizeof(uint8) + sizeof(uint16), sizeof(cmd)); //error + size - sAuthLogonChallenge_C* challenge = reinterpret_cast<sAuthLogonChallenge_C*>(GetReadBuffer()); + ReadData(sizeof(uint8) + sizeof(uint16)); //error + size + sAuthLogonChallenge_C* challenge = reinterpret_cast<sAuthLogonChallenge_C*>(GetDataBuffer()); - AsyncReadData(challenge->size, sizeof(uint8) + sizeof(uint8) + sizeof(uint16)); // cmd + error + size - } - else - AsyncReadData(itr->second.packetSize, sizeof(uint8)); + AsyncReadData(challenge->size); } + else + AsyncReadData(itr->second.packetSize); } else CloseSocket(); } -void AuthSession::ReadDataHandler(boost::system::error_code error, size_t transferedBytes) +void AuthSession::ReadDataHandler() { - if (!error && transferedBytes > 0) + if (!(*this.*Handlers.at(GetHeaderBuffer()[0]).handler)()) { - if (!(*this.*Handlers.at(GetReadBuffer()[0]).handler)()) - { - CloseSocket(); - return; - } - - AsyncReadHeader(); - } - else CloseSocket(); + return; + } + + AsyncReadHeader(); } void AuthSession::AsyncWrite(ByteBuffer& packet) { + if (!IsOpen()) + return; + std::lock_guard<std::mutex> guard(_writeLock); bool needsWriteStart = _writeQueue.empty(); @@ -191,7 +184,7 @@ void AuthSession::AsyncWrite(ByteBuffer& packet) bool AuthSession::HandleLogonChallenge() { - sAuthLogonChallenge_C* challenge = reinterpret_cast<sAuthLogonChallenge_C*>(GetReadBuffer()); + sAuthLogonChallenge_C* challenge = reinterpret_cast<sAuthLogonChallenge_C*>(GetDataBuffer()); //TC_LOG_DEBUG("server.authserver", "[AuthChallenge] got full packet, %#04x bytes", challenge->size); TC_LOG_DEBUG("server.authserver", "[AuthChallenge] name(%d): '%s'", challenge->I_len, challenge->I); @@ -412,7 +405,7 @@ bool AuthSession::HandleLogonProof() TC_LOG_DEBUG("server.authserver", "Entering _HandleLogonProof"); // Read the packet - sAuthLogonProof_C *logonProof = reinterpret_cast<sAuthLogonProof_C*>(GetReadBuffer()); + sAuthLogonProof_C *logonProof = reinterpret_cast<sAuthLogonProof_C*>(GetDataBuffer()); // If the client has no valid version if (_expversion == NO_VALID_EXP_FLAG) @@ -519,17 +512,12 @@ bool AuthSession::HandleLogonProof() // Check auth token if ((logonProof->securityFlags & 0x04) || !_tokenKey.empty()) { - // TODO To be fixed - - /* - uint8 size; - socket().recv((char*)&size, 1); - char* token = new char[size + 1]; - token[size] = '\0'; - socket().recv(token, size); - unsigned int validToken = TOTP::GenerateToken(_tokenKey.c_str()); - unsigned int incomingToken = atoi(token); - delete[] token; + ReadData(1); + uint8 size = *(GetDataBuffer() + sizeof(sAuthLogonProof_C)); + ReadData(size); + std::string token(reinterpret_cast<char*>(GetDataBuffer() + sizeof(sAuthLogonProof_C) + sizeof(size)), size); + uint32 validToken = TOTP::GenerateToken(_tokenKey.c_str()); + uint32 incomingToken = atoi(token.c_str()); if (validToken != incomingToken) { ByteBuffer packet; @@ -539,7 +527,7 @@ bool AuthSession::HandleLogonProof() packet << uint8(0); AsyncWrite(packet); return false; - }*/ + } } ByteBuffer packet; @@ -647,7 +635,7 @@ bool AuthSession::HandleLogonProof() bool AuthSession::HandleReconnectChallenge() { TC_LOG_DEBUG("server.authserver", "Entering _HandleReconnectChallenge"); - sAuthLogonChallenge_C* challenge = reinterpret_cast<sAuthLogonChallenge_C*>(GetReadBuffer()); + sAuthLogonChallenge_C* challenge = reinterpret_cast<sAuthLogonChallenge_C*>(GetDataBuffer()); //TC_LOG_DEBUG("server.authserver", "[AuthChallenge] got full packet, %#04x bytes", challenge->size); TC_LOG_DEBUG("server.authserver", "[AuthChallenge] name(%d): '%s'", challenge->I_len, challenge->I); @@ -698,7 +686,7 @@ bool AuthSession::HandleReconnectChallenge() bool AuthSession::HandleReconnectProof() { TC_LOG_DEBUG("server.authserver", "Entering _HandleReconnectProof"); - sAuthReconnectProof_C *reconnectProof = reinterpret_cast<sAuthReconnectProof_C*>(GetReadBuffer()); + sAuthReconnectProof_C *reconnectProof = reinterpret_cast<sAuthReconnectProof_C*>(GetDataBuffer()); if (_login.empty() || !_reconnectProof.GetNumBytes() || !K.GetNumBytes()) return false; diff --git a/src/server/authserver/Server/AuthSession.h b/src/server/authserver/Server/AuthSession.h index 2ba6b3efdd4..04ee339df8e 100644 --- a/src/server/authserver/Server/AuthSession.h +++ b/src/server/authserver/Server/AuthSession.h @@ -37,7 +37,8 @@ class AuthSession : public Socket<AuthSession, ByteBuffer> public: static std::unordered_map<uint8, AuthHandler> InitHandlers(); - AuthSession(tcp::socket&& socket) : Socket(std::move(socket), 1) + AuthSession(tcp::socket&& socket) : Socket(std::move(socket), 1), + _isAuthenticated(false), _build(0), _expversion(0), _accountSecurityLevel(SEC_PLAYER) { N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"); g.SetDword(7); @@ -51,8 +52,8 @@ public: void AsyncWrite(ByteBuffer& packet); protected: - void ReadHeaderHandler(boost::system::error_code error, size_t transferedBytes) override; - void ReadDataHandler(boost::system::error_code error, size_t transferedBytes) override; + void ReadHeaderHandler() override; + void ReadDataHandler() override; private: bool HandleLogonChallenge(); diff --git a/src/server/authserver/Server/BattlenetBitStream.h b/src/server/authserver/Server/BattlenetBitStream.h index 8f369f1d3ce..c1c95236360 100644 --- a/src/server/authserver/Server/BattlenetBitStream.h +++ b/src/server/authserver/Server/BattlenetBitStream.h @@ -18,8 +18,9 @@ #ifndef __BATTLENETBITSTREAM_H__ #define __BATTLENETBITSTREAM_H__ -#include "ByteConverter.h" #include "Common.h" +#include "ByteConverter.h" +#include "MessageBuffer.h" #include <exception> #include <vector> #include <type_traits> @@ -63,6 +64,10 @@ namespace Battlenet _buffer.resize(length, 0); } + BitStream(MessageBuffer&& buffer) : _buffer(buffer.Move()), _numBits(_buffer.size() * 8), _readPos(0), _writePos(0) + { + } + BitStream() : _numBits(0), _readPos(0), _writePos(0) { _buffer.reserve(0x1000); diff --git a/src/server/authserver/Server/BattlenetSession.cpp b/src/server/authserver/Server/BattlenetSession.cpp index 0fd08c267f1..e345cd35200 100644 --- a/src/server/authserver/Server/BattlenetSession.cpp +++ b/src/server/authserver/Server/BattlenetSession.cpp @@ -538,17 +538,10 @@ bool Battlenet::Session::HandleRealmJoinRequest(PacketHeader& header, BitStream& return true; } -void Battlenet::Session::ReadHeaderHandler(boost::system::error_code error, size_t transferedBytes) +void Battlenet::Session::ReadDataHandler() { - if (error) - { - CloseSocket(); - return; - } - - BitStream packet(transferedBytes); - std::memcpy(packet.GetBuffer(), GetReadBuffer(), transferedBytes); - _crypt.DecryptRecv(packet.GetBuffer(), transferedBytes); + BitStream packet(MoveData()); + _crypt.DecryptRecv(packet.GetBuffer(), packet.GetSize()); while (!packet.IsRead()) { @@ -589,17 +582,23 @@ void Battlenet::Session::ReadHeaderHandler(boost::system::error_code error, size } } - AsyncReadHeader(); + AsyncReadData(size_t(BufferSizes::Read)); } void Battlenet::Session::Start() { TC_LOG_TRACE("server.battlenet", "Battlenet::Session::Start"); - AsyncReadHeader(); + AsyncReadData(size_t(BufferSizes::Read)); } void Battlenet::Session::AsyncWrite(ServerPacket* packet) { + if (!IsOpen()) + { + delete packet; + return; + } + TC_LOG_TRACE("server.battlenet", "Battlenet::Session::AsyncWrite %s", packet->ToString().c_str()); packet->Write(); diff --git a/src/server/authserver/Server/BattlenetSession.h b/src/server/authserver/Server/BattlenetSession.h index 78ae00b4e3e..0ffa253e371 100644 --- a/src/server/authserver/Server/BattlenetSession.h +++ b/src/server/authserver/Server/BattlenetSession.h @@ -79,9 +79,11 @@ namespace Battlenet void AsyncWrite(ServerPacket* packet); + bool IsDataReady() const override { return GetDataSize() > 0; } + protected: - void ReadHeaderHandler(boost::system::error_code error, size_t transferedBytes) override; - void ReadDataHandler(boost::system::error_code /*error*/, size_t /*transferedBytes*/) override { } + void ReadHeaderHandler() override { } + void ReadDataHandler() override; private: void _SetVSFields(std::string const& rI); diff --git a/src/server/collision/Management/VMapManager2.h b/src/server/collision/Management/VMapManager2.h index 03de6951d5d..04292e7d8e4 100644 --- a/src/server/collision/Management/VMapManager2.h +++ b/src/server/collision/Management/VMapManager2.h @@ -53,7 +53,7 @@ namespace VMAP class ManagedModel { public: - ManagedModel() : iModel(0), iRefCount(0) { } + ManagedModel() : iModel(nullptr), iRefCount(0) { } void setModel(WorldModel* model) { iModel = model; } WorldModel* getModel() { return iModel; } void incRefCount() { ++iRefCount; } @@ -86,32 +86,32 @@ namespace VMAP VMapManager2(); ~VMapManager2(void); - int loadMap(const char* pBasePath, unsigned int mapId, int x, int y); + int loadMap(const char* pBasePath, unsigned int mapId, int x, int y) override; - void unloadMap(unsigned int mapId, int x, int y); - void unloadMap(unsigned int mapId); + void unloadMap(unsigned int mapId, int x, int y) override; + void unloadMap(unsigned int mapId) override; - bool isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2) ; + bool isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2) override ; /** fill the hit pos and return true, if an object was hit */ - bool getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist); - float getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist); + bool getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist) override; + float getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist) override; - bool processCommand(char* /*command*/) { return false; } // for debug and extensions + bool processCommand(char* /*command*/) override { return false; } // for debug and extensions - bool getAreaInfo(unsigned int pMapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const; - bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const; + bool getAreaInfo(unsigned int pMapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const override; + bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const override; WorldModel* acquireModelInstance(const std::string& basepath, const std::string& filename); void releaseModelInstance(const std::string& filename); // what's the use of this? o.O - virtual std::string getDirFileName(unsigned int mapId, int /*x*/, int /*y*/) const + virtual std::string getDirFileName(unsigned int mapId, int /*x*/, int /*y*/) const override { return getMapFileName(mapId); } - virtual bool existsMap(const char* basePath, unsigned int mapId, int x, int y); + virtual bool existsMap(const char* basePath, unsigned int mapId, int x, int y) override; public: void getInstanceMapTree(InstanceTreeMap &instanceMapTree); }; diff --git a/src/server/collision/Maps/MapTree.h b/src/server/collision/Maps/MapTree.h index 05351b74019..e16f5701de1 100644 --- a/src/server/collision/Maps/MapTree.h +++ b/src/server/collision/Maps/MapTree.h @@ -31,7 +31,7 @@ namespace VMAP struct LocationInfo { - LocationInfo(): hitInstance(0), hitModel(0), ground_Z(-G3D::inf()) { } + LocationInfo(): hitInstance(nullptr), hitModel(nullptr), ground_Z(-G3D::inf()) { } const ModelInstance* hitInstance; const GroupModel* hitModel; float ground_Z; diff --git a/src/server/collision/Models/ModelInstance.h b/src/server/collision/Models/ModelInstance.h index 3ea68f57ba4..1cb8fdde942 100644 --- a/src/server/collision/Models/ModelInstance.h +++ b/src/server/collision/Models/ModelInstance.h @@ -63,9 +63,9 @@ namespace VMAP class ModelInstance: public ModelSpawn { public: - ModelInstance(): iInvScale(0.0f), iModel(0) { } + ModelInstance(): iInvScale(0.0f), iModel(nullptr) { } ModelInstance(const ModelSpawn &spawn, WorldModel* model); - void setUnloaded() { iModel = 0; } + void setUnloaded() { iModel = nullptr; } bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit) const; void intersectPoint(const G3D::Vector3& p, AreaInfo &info) const; bool GetLocationInfo(const G3D::Vector3& p, LocationInfo &info) const; diff --git a/src/server/collision/Models/WorldModel.cpp b/src/server/collision/Models/WorldModel.cpp index 99f3782215d..d6b0a76f23b 100644 --- a/src/server/collision/Models/WorldModel.cpp +++ b/src/server/collision/Models/WorldModel.cpp @@ -108,7 +108,7 @@ namespace VMAP iFlags = new uint8[width*height]; } - WmoLiquid::WmoLiquid(const WmoLiquid &other): iHeight(0), iFlags(0) + WmoLiquid::WmoLiquid(const WmoLiquid &other): iHeight(nullptr), iFlags(nullptr) { *this = other; // use assignment operator... } @@ -135,14 +135,14 @@ namespace VMAP memcpy(iHeight, other.iHeight, (iTilesX+1)*(iTilesY+1)*sizeof(float)); } else - iHeight = 0; + iHeight = nullptr; if (other.iFlags) { iFlags = new uint8[iTilesX * iTilesY]; memcpy(iFlags, other.iFlags, iTilesX * iTilesY); } else - iFlags = 0; + iFlags = nullptr; return *this; } @@ -254,7 +254,7 @@ namespace VMAP GroupModel::GroupModel(const GroupModel &other): iBound(other.iBound), iMogpFlags(other.iMogpFlags), iGroupWMOID(other.iGroupWMOID), - vertices(other.vertices), triangles(other.triangles), meshTree(other.meshTree), iLiquid(0) + vertices(other.vertices), triangles(other.triangles), meshTree(other.meshTree), iLiquid(nullptr) { if (other.iLiquid) iLiquid = new WmoLiquid(*other.iLiquid); diff --git a/src/server/game/AI/CoreAI/CombatAI.h b/src/server/game/AI/CoreAI/CombatAI.h index f73daa2d720..4b6af3cbdda 100644 --- a/src/server/game/AI/CoreAI/CombatAI.h +++ b/src/server/game/AI/CoreAI/CombatAI.h @@ -30,7 +30,7 @@ class AggressorAI : public CreatureAI public: explicit AggressorAI(Creature* c) : CreatureAI(c) { } - void UpdateAI(uint32); + void UpdateAI(uint32) override; static int Permissible(const Creature*); }; @@ -41,12 +41,12 @@ class CombatAI : public CreatureAI public: explicit CombatAI(Creature* c) : CreatureAI(c) { } - void InitializeAI(); - void Reset(); - void EnterCombat(Unit* who); - void JustDied(Unit* killer); - void UpdateAI(uint32 diff); - void SpellInterrupted(uint32 spellId, uint32 unTimeMs); + void InitializeAI() override; + void Reset() override; + void EnterCombat(Unit* who) override; + void JustDied(Unit* killer) override; + void UpdateAI(uint32 diff) override; + void SpellInterrupted(uint32 spellId, uint32 unTimeMs) override; static int Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; } @@ -59,10 +59,10 @@ class CasterAI : public CombatAI { public: explicit CasterAI(Creature* c) : CombatAI(c) { m_attackDist = MELEE_RANGE; } - void InitializeAI(); - void AttackStart(Unit* victim) { AttackStartCaster(victim, m_attackDist); } - void UpdateAI(uint32 diff); - void EnterCombat(Unit* /*who*/); + void InitializeAI() override; + void AttackStart(Unit* victim) override { AttackStartCaster(victim, m_attackDist); } + void UpdateAI(uint32 diff) override; + void EnterCombat(Unit* /*who*/) override; private: float m_attackDist; }; @@ -71,8 +71,8 @@ struct ArcherAI : public CreatureAI { public: explicit ArcherAI(Creature* c); - void AttackStart(Unit* who); - void UpdateAI(uint32 diff); + void AttackStart(Unit* who) override; + void UpdateAI(uint32 diff) override; static int Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; } @@ -84,9 +84,9 @@ struct TurretAI : public CreatureAI { public: explicit TurretAI(Creature* c); - bool CanAIAttack(Unit const* who) const; - void AttackStart(Unit* who); - void UpdateAI(uint32 diff); + bool CanAIAttack(Unit const* who) const override; + void AttackStart(Unit* who) override; + void UpdateAI(uint32 diff) override; static int Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; } @@ -102,10 +102,10 @@ struct VehicleAI : public CreatureAI public: explicit VehicleAI(Creature* creature); - void UpdateAI(uint32 diff); - void MoveInLineOfSight(Unit*) { } - void AttackStart(Unit*) { } - void OnCharmed(bool apply); + void UpdateAI(uint32 diff) override; + void MoveInLineOfSight(Unit*) override { } + void AttackStart(Unit*) override { } + void OnCharmed(bool apply) override; static int Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; } diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h index 36ca2c3253f..6e03103e269 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.h +++ b/src/server/game/AI/CoreAI/GameObjectAI.h @@ -68,7 +68,7 @@ class NullGameObjectAI : public GameObjectAI public: explicit NullGameObjectAI(GameObject* g); - void UpdateAI(uint32 /*diff*/) { } + void UpdateAI(uint32 /*diff*/) override { } static int Permissible(GameObject const* /*go*/) { return PERMIT_BASE_IDLE; } }; diff --git a/src/server/game/AI/CoreAI/GuardAI.h b/src/server/game/AI/CoreAI/GuardAI.h index 9af047e8906..c2b05d71e03 100644 --- a/src/server/game/AI/CoreAI/GuardAI.h +++ b/src/server/game/AI/CoreAI/GuardAI.h @@ -29,10 +29,10 @@ class GuardAI : public ScriptedAI explicit GuardAI(Creature* creature); static int Permissible(Creature const* creature); - bool CanSeeAlways(WorldObject const* obj); + bool CanSeeAlways(WorldObject const* obj) override; - void EnterEvadeMode(); - void JustDied(Unit* killer); + void EnterEvadeMode() override; + void JustDied(Unit* killer) override; }; #endif diff --git a/src/server/game/AI/CoreAI/PassiveAI.cpp b/src/server/game/AI/CoreAI/PassiveAI.cpp index 07987cf8cec..3ae73636619 100644 --- a/src/server/game/AI/CoreAI/PassiveAI.cpp +++ b/src/server/game/AI/CoreAI/PassiveAI.cpp @@ -75,5 +75,5 @@ void CritterAI::EnterEvadeMode() void TriggerAI::IsSummonedBy(Unit* summoner) { if (me->m_spells[0]) - me->CastSpell(me, me->m_spells[0], false, 0, 0, summoner->GetGUID()); + me->CastSpell(me, me->m_spells[0], false, nullptr, nullptr, summoner->GetGUID()); } diff --git a/src/server/game/AI/CoreAI/PassiveAI.h b/src/server/game/AI/CoreAI/PassiveAI.h index 33bfde4f9f2..7f5ab5f29a2 100644 --- a/src/server/game/AI/CoreAI/PassiveAI.h +++ b/src/server/game/AI/CoreAI/PassiveAI.h @@ -26,9 +26,9 @@ class PassiveAI : public CreatureAI public: explicit PassiveAI(Creature* c); - void MoveInLineOfSight(Unit*) { } - void AttackStart(Unit*) { } - void UpdateAI(uint32); + void MoveInLineOfSight(Unit*) override { } + void AttackStart(Unit*) override { } + void UpdateAI(uint32) override; static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; } }; @@ -38,13 +38,13 @@ class PossessedAI : public CreatureAI public: explicit PossessedAI(Creature* c); - void MoveInLineOfSight(Unit*) { } - void AttackStart(Unit* target); - void UpdateAI(uint32); - void EnterEvadeMode() { } + void MoveInLineOfSight(Unit*) override { } + void AttackStart(Unit* target) override; + void UpdateAI(uint32) override; + void EnterEvadeMode() override { } - void JustDied(Unit*); - void KilledUnit(Unit* victim); + void JustDied(Unit*) override; + void KilledUnit(Unit* victim) override; static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; } }; @@ -54,11 +54,11 @@ class NullCreatureAI : public CreatureAI public: explicit NullCreatureAI(Creature* c); - void MoveInLineOfSight(Unit*) { } - void AttackStart(Unit*) { } - void UpdateAI(uint32) { } - void EnterEvadeMode() { } - void OnCharmed(bool /*apply*/) { } + void MoveInLineOfSight(Unit*) override { } + void AttackStart(Unit*) override { } + void UpdateAI(uint32) override { } + void EnterEvadeMode() override { } + void OnCharmed(bool /*apply*/) override { } static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; } }; @@ -68,15 +68,15 @@ class CritterAI : public PassiveAI public: explicit CritterAI(Creature* c) : PassiveAI(c) { } - void DamageTaken(Unit* done_by, uint32& /*damage*/); - void EnterEvadeMode(); + void DamageTaken(Unit* done_by, uint32& /*damage*/) override; + void EnterEvadeMode() override; }; class TriggerAI : public NullCreatureAI { public: explicit TriggerAI(Creature* c) : NullCreatureAI(c) { } - void IsSummonedBy(Unit* summoner); + void IsSummonedBy(Unit* summoner) override; }; #endif diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 8032568434f..4bce9113082 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -246,8 +246,6 @@ void PetAI::UpdateAI(uint32 diff) me->SendUpdateToPlayer(owner->ToPlayer()); } - me->AddCreatureSpellCooldown(spell->m_spellInfo->Id); - spell->prepare(&targets); } diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h index 450f68443f0..c24bf3a0c1b 100644 --- a/src/server/game/AI/CoreAI/PetAI.h +++ b/src/server/game/AI/CoreAI/PetAI.h @@ -31,23 +31,23 @@ class PetAI : public CreatureAI explicit PetAI(Creature* c); - void UpdateAI(uint32); + void UpdateAI(uint32) override; static int Permissible(const Creature*); - void KilledUnit(Unit* /*victim*/); - void AttackStart(Unit* target); - void MovementInform(uint32 moveType, uint32 data); - void OwnerAttackedBy(Unit* attacker); - void OwnerAttacked(Unit* target); - void AttackedBy(Unit* attacker); - void ReceiveEmote(Player* player, uint32 textEmote); + void KilledUnit(Unit* /*victim*/) override; + void AttackStart(Unit* target) override; + void MovementInform(uint32 moveType, uint32 data) override; + void OwnerAttackedBy(Unit* attacker) override; + void OwnerAttacked(Unit* target) override; + void AttackedBy(Unit* attacker) override; + void ReceiveEmote(Player* player, uint32 textEmote) override; // The following aren't used by the PetAI but need to be defined to override // default CreatureAI functions which interfere with the PetAI // - void MoveInLineOfSight(Unit* /*who*/) { } // CreatureAI interferes with returning pets + void MoveInLineOfSight(Unit* /*who*/) override { } // CreatureAI interferes with returning pets void MoveInLineOfSight_Safe(Unit* /*who*/) { } // CreatureAI interferes with returning pets - void EnterEvadeMode() { } // For fleeing, pets don't use this type of Evade mechanic + void EnterEvadeMode() override { } // For fleeing, pets don't use this type of Evade mechanic private: bool _isVisible(Unit*) const; diff --git a/src/server/game/AI/CoreAI/ReactorAI.h b/src/server/game/AI/CoreAI/ReactorAI.h index 417944f9ba2..2fdccac802d 100644 --- a/src/server/game/AI/CoreAI/ReactorAI.h +++ b/src/server/game/AI/CoreAI/ReactorAI.h @@ -29,8 +29,8 @@ class ReactorAI : public CreatureAI explicit ReactorAI(Creature* c) : CreatureAI(c) { } - void MoveInLineOfSight(Unit*) { } - void UpdateAI(uint32 diff); + void MoveInLineOfSight(Unit*) override { } + void UpdateAI(uint32 diff) override; static int Permissible(const Creature*); }; diff --git a/src/server/game/AI/CoreAI/TotemAI.h b/src/server/game/AI/CoreAI/TotemAI.h index 4d5f03566ba..93106b91492 100644 --- a/src/server/game/AI/CoreAI/TotemAI.h +++ b/src/server/game/AI/CoreAI/TotemAI.h @@ -31,11 +31,11 @@ class TotemAI : public CreatureAI explicit TotemAI(Creature* c); - void MoveInLineOfSight(Unit* who); - void AttackStart(Unit* victim); - void EnterEvadeMode(); + void MoveInLineOfSight(Unit* who) override; + void AttackStart(Unit* victim) override; + void EnterEvadeMode() override; - void UpdateAI(uint32 diff); + void UpdateAI(uint32 diff) override; static int Permissible(Creature const* creature); private: diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 6ca79dc0a49..b6743b572cb 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -275,13 +275,13 @@ class PlayerAI : public UnitAI public: explicit PlayerAI(Player* player) : UnitAI((Unit*)player), me(player) { } - void OnCharmed(bool apply); + void OnCharmed(bool apply) override; }; class SimpleCharmedAI : public PlayerAI { public: - void UpdateAI(uint32 diff); + void UpdateAI(uint32 diff) override; SimpleCharmedAI(Player* player): PlayerAI(player) { } }; diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index 209995d359d..b79dd6abbc8 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -127,7 +127,7 @@ class CreatureAI : public UnitAI // Called at waypoint reached or point movement finished virtual void MovementInform(uint32 /*type*/, uint32 /*id*/) { } - void OnCharmed(bool apply); + void OnCharmed(bool apply) override; // Called at reaching home after evade virtual void JustReachedHome() { } diff --git a/src/server/game/AI/CreatureAIFactory.h b/src/server/game/AI/CreatureAIFactory.h index f2854f1a9ce..61e3cd2b240 100644 --- a/src/server/game/AI/CreatureAIFactory.h +++ b/src/server/game/AI/CreatureAIFactory.h @@ -34,9 +34,9 @@ struct CreatureAIFactory : public SelectableAI { CreatureAIFactory(const char* name) : SelectableAI(name) { } - CreatureAI* Create(void*) const; + CreatureAI* Create(void*) const override; - int Permit(const Creature* c) const { return REAL_AI::Permissible(c); } + int Permit(const Creature* c) const override { return REAL_AI::Permissible(c); } }; template<class REAL_AI> @@ -61,9 +61,9 @@ struct GameObjectAIFactory : public SelectableGameObjectAI { GameObjectAIFactory(const char* name) : SelectableGameObjectAI(name) { } - GameObjectAI* Create(void*) const; + GameObjectAI* Create(void*) const override; - int Permit(const GameObject* g) const { return REAL_GO_AI::Permissible(g); } + int Permit(const GameObject* g) const override { return REAL_GO_AI::Permissible(g); } }; template<class REAL_GO_AI> diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index e03bbd8c6a2..6213f559319 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -25,6 +25,15 @@ #include "InstanceScript.h" #define CAST_AI(a, b) (dynamic_cast<a*>(b)) +#define ENSURE_AI(a,b) (EnsureAI<a>(b)) + +template<class T, class U> +T* EnsureAI(U* ai) +{ + T* cast_ai = dynamic_cast<T*>(ai); + ASSERT(cast_ai); + return cast_ai; +}; class InstanceScript; @@ -141,31 +150,31 @@ struct ScriptedAI : public CreatureAI void AttackStartNoMove(Unit* target); // Called at any Damage from any attacker (before damage apply) - void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) { } + void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) override { } //Called at World update tick - virtual void UpdateAI(uint32 diff); + virtual void UpdateAI(uint32 diff) override; //Called at creature death - void JustDied(Unit* /*killer*/) { } + void JustDied(Unit* /*killer*/) override { } //Called at creature killing another unit - void KilledUnit(Unit* /*victim*/) { } + void KilledUnit(Unit* /*victim*/) override { } // Called when the creature summon successfully other creature - void JustSummoned(Creature* /*summon*/) { } + void JustSummoned(Creature* /*summon*/) override { } // Called when a summoned creature is despawned - void SummonedCreatureDespawn(Creature* /*summon*/) { } + void SummonedCreatureDespawn(Creature* /*summon*/) override { } // Called when hit by a spell - void SpellHit(Unit* /*caster*/, SpellInfo const* /*spell*/) { } + void SpellHit(Unit* /*caster*/, SpellInfo const* /*spell*/) override { } // Called when spell hits a target - void SpellHitTarget(Unit* /*target*/, SpellInfo const* /*spell*/) { } + void SpellHitTarget(Unit* /*target*/, SpellInfo const* /*spell*/) override { } //Called at waypoint reached or PointMovement end - void MovementInform(uint32 /*type*/, uint32 /*id*/) { } + void MovementInform(uint32 /*type*/, uint32 /*id*/) override { } // Called when AI is temporarily replaced or put back when possess is applied or removed void OnPossess(bool /*apply*/) { } @@ -185,13 +194,13 @@ struct ScriptedAI : public CreatureAI // ************* //Called at creature reset either by death or evade - void Reset() { } + void Reset() override { } //Called at creature aggro either by MoveInLOS or Attack Start - void EnterCombat(Unit* /*victim*/) { } + void EnterCombat(Unit* /*victim*/) override { } // Called before EnterCombat even before the creature is in combat. - void AttackStart(Unit* /*target*/); + void AttackStart(Unit* /*target*/) override; // ************* //AI Helper Functions @@ -339,10 +348,10 @@ class BossAI : public ScriptedAI InstanceScript* const instance; BossBoundaryMap const* GetBoundary() const { return _boundary; } - void JustSummoned(Creature* summon); - void SummonedCreatureDespawn(Creature* summon); + void JustSummoned(Creature* summon) override; + void SummonedCreatureDespawn(Creature* summon) override; - virtual void UpdateAI(uint32 diff); + virtual void UpdateAI(uint32 diff) override; // Hook used to execute events scheduled into EventMap without the need // to override UpdateAI @@ -350,10 +359,10 @@ class BossAI : public ScriptedAI // is supposed to run more than once virtual void ExecuteEvent(uint32 /*eventId*/) { } - void Reset() { _Reset(); } - void EnterCombat(Unit* /*who*/) { _EnterCombat(); } - void JustDied(Unit* /*killer*/) { _JustDied(); } - void JustReachedHome() { _JustReachedHome(); } + void Reset() override { _Reset(); } + void EnterCombat(Unit* /*who*/) override { _EnterCombat(); } + void JustDied(Unit* /*killer*/) override { _JustDied(); } + void JustReachedHome() override { _JustReachedHome(); } protected: void _Reset(); @@ -388,10 +397,10 @@ class WorldBossAI : public ScriptedAI WorldBossAI(Creature* creature); virtual ~WorldBossAI() { } - void JustSummoned(Creature* summon); - void SummonedCreatureDespawn(Creature* summon); + void JustSummoned(Creature* summon) override; + void SummonedCreatureDespawn(Creature* summon) override; - virtual void UpdateAI(uint32 diff); + virtual void UpdateAI(uint32 diff) override; // Hook used to execute events scheduled into EventMap without the need // to override UpdateAI @@ -399,9 +408,9 @@ class WorldBossAI : public ScriptedAI // is supposed to run more than once virtual void ExecuteEvent(uint32 /*eventId*/) { } - void Reset() { _Reset(); } - void EnterCombat(Unit* /*who*/) { _EnterCombat(); } - void JustDied(Unit* /*killer*/) { _JustDied(); } + void Reset() override { _Reset(); } + void EnterCombat(Unit* /*who*/) override { _EnterCombat(); } + void JustDied(Unit* /*killer*/) override { _JustDied(); } protected: void _Reset(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h index 177810bbbfd..b8c9ee57aeb 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h @@ -56,22 +56,22 @@ struct npc_escortAI : public ScriptedAI ~npc_escortAI() { } // CreatureAI functions - void AttackStart(Unit* who); + void AttackStart(Unit* who) override; - void MoveInLineOfSight(Unit* who); + void MoveInLineOfSight(Unit* who) override; - void JustDied(Unit*); + void JustDied(Unit*) override; - void JustRespawned(); + void JustRespawned() override; void ReturnToLastPoint(); - void EnterEvadeMode(); + void EnterEvadeMode() override; - void UpdateAI(uint32 diff); //the "internal" update, calls UpdateEscortAI() + void UpdateAI(uint32 diff) override; //the "internal" update, calls UpdateEscortAI() virtual void UpdateEscortAI(uint32 const diff); //used when it's needed to add code in update (abilities, scripted events, etc) - void MovementInform(uint32, uint32); + void MovementInform(uint32, uint32) override; // EscortAI functions void AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime = 0); // waitTime is in ms @@ -94,7 +94,7 @@ struct npc_escortAI : public ScriptedAI void SetEscortPaused(bool on); bool HasEscortState(uint32 escortState) { return (m_uiEscortState & escortState) != 0; } - virtual bool IsEscorted() { return (m_uiEscortState & STATE_ESCORT_ESCORTING); } + virtual bool IsEscorted() override { return (m_uiEscortState & STATE_ESCORT_ESCORTING); } void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; } float GetMaxPlayerDistance() { return MaxPlayerDistance; } diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h index af7508441b9..adb17ef76b1 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h @@ -40,19 +40,19 @@ class FollowerAI : public ScriptedAI //virtual void WaypointReached(uint32 uiPointId) = 0; - void MovementInform(uint32 motionType, uint32 pointId); + void MovementInform(uint32 motionType, uint32 pointId) override; - void AttackStart(Unit*); + void AttackStart(Unit*) override; - void MoveInLineOfSight(Unit*); + void MoveInLineOfSight(Unit*) override; - void EnterEvadeMode(); + void EnterEvadeMode() override; - void JustDied(Unit*); + void JustDied(Unit*) override; - void JustRespawned(); + void JustRespawned() override; - void UpdateAI(uint32); //the "internal" update, calls UpdateFollowerAI() + void UpdateAI(uint32) override; //the "internal" update, calls UpdateFollowerAI() virtual void UpdateFollowerAI(uint32); //used when it's needed to add code in update (abilities, scripted events, etc) void StartFollow(Player* player, uint32 factionForFollower = 0, const Quest* quest = NULL); diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index af47b52f500..41f783f4289 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -931,7 +931,7 @@ class SmartTrigger : public AreaTriggerScript SmartTrigger() : AreaTriggerScript("SmartTrigger") { } - bool OnTrigger(Player* player, AreaTriggerEntry const* trigger) + bool OnTrigger(Player* player, AreaTriggerEntry const* trigger) override { if (!player->IsAlive()) return false; diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 4d66b976746..e674bbfdaac 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -70,94 +70,94 @@ class SmartAI : public CreatureAI bool IsEscortInvokerInRange(); // Called when creature is spawned or respawned - void JustRespawned(); + void JustRespawned() override; // Called at reaching home after evade, InitializeAI(), EnterEvadeMode() for resetting variables - void JustReachedHome(); + void JustReachedHome() override; // Called for reaction at enter to combat if not in combat yet (enemy can be NULL) - void EnterCombat(Unit* enemy); + void EnterCombat(Unit* enemy) override; // Called for reaction at stopping attack at no attackers or targets - void EnterEvadeMode(); + void EnterEvadeMode() override; // Called when the creature is killed - void JustDied(Unit* killer); + void JustDied(Unit* killer) override; // Called when the creature kills a unit - void KilledUnit(Unit* victim); + void KilledUnit(Unit* victim) override; // Called when the creature summon successfully other creature - void JustSummoned(Creature* creature); + void JustSummoned(Creature* creature) override; // Tell creature to attack and follow the victim - void AttackStart(Unit* who); + void AttackStart(Unit* who) override; // Called if IsVisible(Unit* who) is true at each *who move, reaction at visibility zone enter - void MoveInLineOfSight(Unit* who); + void MoveInLineOfSight(Unit* who) override; // Called when hit by a spell - void SpellHit(Unit* unit, const SpellInfo* spellInfo); + void SpellHit(Unit* unit, const SpellInfo* spellInfo) override; // Called when spell hits a target - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo); + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) override; // Called at any Damage from any attacker (before damage apply) - void DamageTaken(Unit* doneBy, uint32& damage); + void DamageTaken(Unit* doneBy, uint32& damage) override; // Called when the creature receives heal - void HealReceived(Unit* doneBy, uint32& addhealth); + void HealReceived(Unit* doneBy, uint32& addhealth) override; // Called at World update tick - void UpdateAI(uint32 diff); + void UpdateAI(uint32 diff) override; // Called at text emote receive from player - void ReceiveEmote(Player* player, uint32 textEmote); + void ReceiveEmote(Player* player, uint32 textEmote) override; // Called at waypoint reached or point movement finished - void MovementInform(uint32 MovementType, uint32 Data); + void MovementInform(uint32 MovementType, uint32 Data) override; // Called when creature is summoned by another unit - void IsSummonedBy(Unit* summoner); + void IsSummonedBy(Unit* summoner) override; // Called at any Damage to any victim (before damage apply) - void DamageDealt(Unit* doneTo, uint32& damage, DamageEffectType /*damagetype*/); + void DamageDealt(Unit* doneTo, uint32& damage, DamageEffectType /*damagetype*/) override; // Called when a summoned creature dissapears (UnSommoned) - void SummonedCreatureDespawn(Creature* unit); + void SummonedCreatureDespawn(Creature* unit) override; // called when the corpse of this creature gets removed - void CorpseRemoved(uint32& respawnDelay); + void CorpseRemoved(uint32& respawnDelay) override; // Called at World update tick if creature is charmed void UpdateAIWhileCharmed(const uint32 diff); // Called when a Player/Creature enters the creature (vehicle) - void PassengerBoarded(Unit* who, int8 seatId, bool apply); + void PassengerBoarded(Unit* who, int8 seatId, bool apply) override; // Called when gets initialized, when creature is added to world - void InitializeAI(); + void InitializeAI() override; // Called when creature gets charmed by another unit - void OnCharmed(bool apply); + void OnCharmed(bool apply) override; // Called when victim is in line of sight - bool CanAIAttack(const Unit* who) const; + bool CanAIAttack(const Unit* who) const override; // Used in scripts to share variables - void DoAction(int32 param = 0); + void DoAction(int32 param = 0) override; // Used in scripts to share variables - uint32 GetData(uint32 id = 0) const; + uint32 GetData(uint32 id = 0) const override; // Used in scripts to share variables - void SetData(uint32 id, uint32 value); + void SetData(uint32 id, uint32 value) override; // Used in scripts to share variables - void SetGUID(uint64 guid, int32 id = 0); + void SetGUID(uint64 guid, int32 id = 0) override; // Used in scripts to share variables - uint64 GetGUID(int32 id = 0) const; + uint64 GetGUID(int32 id = 0) const override; //core related static int Permissible(const Creature*); @@ -174,15 +174,15 @@ class SmartAI : public CreatureAI void SetInvincibilityHpLevel(uint32 level) { mInvincibilityHpLevel = level; } - void sGossipHello(Player* player); - void sGossipSelect(Player* player, uint32 sender, uint32 action); - void sGossipSelectCode(Player* player, uint32 sender, uint32 action, const char* code); - void sQuestAccept(Player* player, Quest const* quest); + void sGossipHello(Player* player) override; + void sGossipSelect(Player* player, uint32 sender, uint32 action) override; + void sGossipSelectCode(Player* player, uint32 sender, uint32 action, const char* code) override; + void sQuestAccept(Player* player, Quest const* quest) override; //void sQuestSelect(Player* player, Quest const* quest); //void sQuestComplete(Player* player, Quest const* quest); - void sQuestReward(Player* player, Quest const* quest, uint32 opt); - bool sOnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effIndex); - void sOnGameEvent(bool start, uint16 eventId); + void sQuestReward(Player* player, Quest const* quest, uint32 opt) override; + bool sOnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effIndex) override; + void sOnGameEvent(bool start, uint16 eventId) override; uint32 mEscortQuestID; @@ -193,7 +193,7 @@ class SmartAI : public CreatureAI } void StartDespawn() { mDespawnState = 2; } - void OnSpellClick(Unit* clicker, bool& result); + void OnSpellClick(Unit* clicker, bool& result) override; private: uint32 mFollowCreditType; @@ -237,23 +237,23 @@ class SmartGameObjectAI : public GameObjectAI SmartGameObjectAI(GameObject* g) : GameObjectAI(g) { } ~SmartGameObjectAI() { } - void UpdateAI(uint32 diff); - void InitializeAI(); - void Reset(); + void UpdateAI(uint32 diff) override; + void InitializeAI() override; + void Reset() override; SmartScript* GetScript() { return &mScript; } static int Permissible(const GameObject* g); - bool GossipHello(Player* player); - bool GossipSelect(Player* player, uint32 sender, uint32 action); - bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/); - bool QuestAccept(Player* player, Quest const* quest); - bool QuestReward(Player* player, Quest const* quest, uint32 opt); - void Destroyed(Player* player, uint32 eventId); - void SetData(uint32 id, uint32 value); + bool GossipHello(Player* player) override; + bool GossipSelect(Player* player, uint32 sender, uint32 action) override; + bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) override; + bool QuestAccept(Player* player, Quest const* quest) override; + bool QuestReward(Player* player, Quest const* quest, uint32 opt) override; + void Destroyed(Player* player, uint32 eventId) override; + void SetData(uint32 id, uint32 value) override; void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker); - void OnGameEvent(bool start, uint16 eventId); - void OnStateChanged(uint32 state, Unit* unit); - void EventInform(uint32 eventId); + void OnGameEvent(bool start, uint16 eventId) override; + void OnStateChanged(uint32 state, Unit* unit) override; + void EventInform(uint32 eventId) override; private: SmartScript mScript; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index d4b41f529a9..8b83cae3d99 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -519,7 +519,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u mana < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask())) _allowMove = true; - CAST_AI(SmartAI, me->AI())->SetCombatMove(_allowMove); + ENSURE_AI(SmartAI, me->AI())->SetCombatMove(_allowMove); } me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0); @@ -707,7 +707,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - CAST_AI(SmartAI, me->AI())->SetAutoAttack(e.action.autoAttack.attack != 0); + ENSURE_AI(SmartAI, me->AI())->SetAutoAttack(e.action.autoAttack.attack != 0); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_AUTO_ATTACK: Creature: %u bool on = %u", me->GetGUIDLow(), e.action.autoAttack.attack); break; @@ -718,7 +718,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; bool move = e.action.combatMove.move != 0; - CAST_AI(SmartAI, me->AI())->SetCombatMove(move); + ENSURE_AI(SmartAI, me->AI())->SetCombatMove(move); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_ALLOW_COMBAT_MOVEMENT: Creature %u bool on = %u", me->GetGUIDLow(), e.action.combatMove.move); break; @@ -817,7 +817,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u ObjectList* targets = GetTargets(e, unit); if (!targets) { - CAST_AI(SmartAI, me->AI())->StopFollow(); + ENSURE_AI(SmartAI, me->AI())->StopFollow(); break; } @@ -825,7 +825,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (IsUnit(*itr)) { - CAST_AI(SmartAI, me->AI())->SetFollow((*itr)->ToUnit(), (float)e.action.follow.dist, (float)e.action.follow.angle, e.action.follow.credit, e.action.follow.entry, e.action.follow.creditType); + ENSURE_AI(SmartAI, me->AI())->SetFollow((*itr)->ToUnit(), (float)e.action.follow.dist, (float)e.action.follow.angle, e.action.follow.credit, e.action.follow.entry, e.action.follow.creditType); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_FOLLOW: Creature %u following target %u", me->GetGUIDLow(), (*itr)->GetGUIDLow()); break; @@ -1035,8 +1035,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if ((*itr)->ToUnit()->IsAlive() && IsSmart((*itr)->ToCreature())) { - CAST_AI(SmartAI, (*itr)->ToCreature()->AI())->SetDespawnTime(e.action.forceDespawn.delay + 1); // Next tick - CAST_AI(SmartAI, (*itr)->ToCreature()->AI())->StartDespawn(); + ENSURE_AI(SmartAI, (*itr)->ToCreature()->AI())->SetDespawnTime(e.action.forceDespawn.delay + 1); // Next tick + ENSURE_AI(SmartAI, (*itr)->ToCreature()->AI())->StartDespawn(); } else (*itr)->ToCreature()->DespawnOrUnsummon(e.action.forceDespawn.delay); @@ -1331,7 +1331,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - CAST_AI(SmartAI, me->AI())->SetFly(e.action.setFly.fly != 0); + ENSURE_AI(SmartAI, me->AI())->SetFly(e.action.setFly.fly != 0); break; } case SMART_ACTION_SET_RUN: @@ -1339,7 +1339,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - CAST_AI(SmartAI, me->AI())->SetRun(e.action.setRun.run != 0); + ENSURE_AI(SmartAI, me->AI())->SetRun(e.action.setRun.run != 0); break; } case SMART_ACTION_SET_SWIM: @@ -1347,7 +1347,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - CAST_AI(SmartAI, me->AI())->SetSwim(e.action.setSwim.swim != 0); + ENSURE_AI(SmartAI, me->AI())->SetSwim(e.action.setSwim.swim != 0); break; } case SMART_ACTION_WP_START: @@ -1361,12 +1361,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u ObjectList* targets = GetTargets(e, unit); StoreTargetList(targets, SMART_ESCORT_TARGETS); me->SetReactState((ReactStates)e.action.wpStart.reactState); - CAST_AI(SmartAI, me->AI())->StartPath(run, entry, repeat, unit); + ENSURE_AI(SmartAI, me->AI())->StartPath(run, entry, repeat, unit); uint32 quest = e.action.wpStart.quest; uint32 DespawnTime = e.action.wpStart.despawnTime; - CAST_AI(SmartAI, me->AI())->mEscortQuestID = quest; - CAST_AI(SmartAI, me->AI())->SetDespawnTime(DespawnTime); + ENSURE_AI(SmartAI, me->AI())->mEscortQuestID = quest; + ENSURE_AI(SmartAI, me->AI())->SetDespawnTime(DespawnTime); break; } case SMART_ACTION_WP_PAUSE: @@ -1375,7 +1375,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; uint32 delay = e.action.wpPause.delay; - CAST_AI(SmartAI, me->AI())->PausePath(delay, e.GetEventType() == SMART_EVENT_WAYPOINT_REACHED ? false : true); + ENSURE_AI(SmartAI, me->AI())->PausePath(delay, e.GetEventType() == SMART_EVENT_WAYPOINT_REACHED ? false : true); break; } case SMART_ACTION_WP_STOP: @@ -1386,7 +1386,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u uint32 DespawnTime = e.action.wpStop.despawnTime; uint32 quest = e.action.wpStop.quest; bool fail = e.action.wpStop.fail != 0; - CAST_AI(SmartAI, me->AI())->StopPath(DespawnTime, quest, fail); + ENSURE_AI(SmartAI, me->AI())->StopPath(DespawnTime, quest, fail); break; } case SMART_ACTION_WP_RESUME: @@ -1394,7 +1394,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - CAST_AI(SmartAI, me->AI())->ResumePath(); + ENSURE_AI(SmartAI, me->AI())->ResumePath(); break; } case SMART_ACTION_SET_ORIENTATION: @@ -1630,7 +1630,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); ++itr) if (Creature* target = (*itr)->ToCreature()) if (IsSmart(target) && target->GetVictim()) - if (CAST_AI(SmartAI, target->AI())->CanCombatMove()) + if (ENSURE_AI(SmartAI, target->AI())->CanCombatMove()) target->GetMotionMaster()->MoveChase(target->GetVictim(), attackDistance, attackAngle); delete targets; @@ -1652,12 +1652,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (Creature* target = (*itr)->ToCreature()) { if (IsSmart(target)) - CAST_AI(SmartAI, target->AI())->SetScript9(e, e.action.timedActionList.id, GetLastInvoker()); + ENSURE_AI(SmartAI, target->AI())->SetScript9(e, e.action.timedActionList.id, GetLastInvoker()); } else if (GameObject* goTarget = (*itr)->ToGameObject()) { if (IsSmartGO(goTarget)) - CAST_AI(SmartGameObjectAI, goTarget->AI())->SetScript9(e, e.action.timedActionList.id, GetLastInvoker()); + ENSURE_AI(SmartGameObjectAI, goTarget->AI())->SetScript9(e, e.action.timedActionList.id, GetLastInvoker()); } } @@ -1788,12 +1788,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (Creature* target = (*itr)->ToCreature()) { if (IsSmart(target)) - CAST_AI(SmartAI, target->AI())->SetScript9(e, id, GetLastInvoker()); + ENSURE_AI(SmartAI, target->AI())->SetScript9(e, id, GetLastInvoker()); } else if (GameObject* goTarget = (*itr)->ToGameObject()) { if (IsSmartGO(goTarget)) - CAST_AI(SmartGameObjectAI, goTarget->AI())->SetScript9(e, id, GetLastInvoker()); + ENSURE_AI(SmartGameObjectAI, goTarget->AI())->SetScript9(e, id, GetLastInvoker()); } } @@ -1818,12 +1818,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (Creature* target = (*itr)->ToCreature()) { if (IsSmart(target)) - CAST_AI(SmartAI, target->AI())->SetScript9(e, id, GetLastInvoker()); + ENSURE_AI(SmartAI, target->AI())->SetScript9(e, id, GetLastInvoker()); } else if (GameObject* goTarget = (*itr)->ToGameObject()) { if (IsSmartGO(goTarget)) - CAST_AI(SmartGameObjectAI, goTarget->AI())->SetScript9(e, id, GetLastInvoker()); + ENSURE_AI(SmartGameObjectAI, goTarget->AI())->SetScript9(e, id, GetLastInvoker()); } } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index f09e16268c1..e5abc876648 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1421,7 +1421,7 @@ class SmartWaypointMgr { if (waypoint_map.find(id) != waypoint_map.end()) return waypoint_map[id]; - else return 0; + else return nullptr; } private: diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 0aa6a51d6bf..e4fe45d45d5 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -247,12 +247,12 @@ class Battlefield : public ZoneScript void HandlePlayerLeaveZone(Player* player, uint32 zone); // All-purpose data storage 64 bit - virtual uint64 GetData64(uint32 dataId) const { return m_Data64[dataId]; } - virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; } + virtual uint64 GetData64(uint32 dataId) const override { return m_Data64[dataId]; } + virtual void SetData64(uint32 dataId, uint64 value) override { m_Data64[dataId] = value; } // All-purpose data storage 32 bit - virtual uint32 GetData(uint32 dataId) const { return m_Data32[dataId]; } - virtual void SetData(uint32 dataId, uint32 value) { m_Data32[dataId] = value; } + virtual uint32 GetData(uint32 dataId) const override { return m_Data32[dataId]; } + virtual void SetData(uint32 dataId, uint32 value) override { m_Data32[dataId] = value; } virtual void UpdateData(uint32 index, int32 pad) { m_Data32[index] += pad; } // Battlefield - generic methods diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 03c2992e812..622236b4162 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -255,7 +255,7 @@ class WintergraspCapturePoint : public BfCapturePoint void LinkToWorkshop(WGWorkshop* workshop) { m_Workshop = workshop; } - void ChangeTeam(TeamId oldteam); + void ChangeTeam(TeamId oldteam) override; TeamId GetTeam() const { return m_team; } protected: @@ -276,7 +276,7 @@ class BattlefieldWG : public Battlefield * - Rebuild tower and wall * - Invite player to war */ - void OnBattleStart(); + void OnBattleStart() override; /** * \brief Called when battle end @@ -287,13 +287,13 @@ class BattlefieldWG : public Battlefield * - Remove vehicle * \param endByTimer : true if battle ended when timer is at 00:00, false if battle ended by clicking on relic */ - void OnBattleEnd(bool endByTimer); + void OnBattleEnd(bool endByTimer) override; /** * \brief Called when grouping starts (15 minutes before battlestart) * - Invite all player in zone to join queue */ - void OnStartGrouping(); + void OnStartGrouping() override; /** * \brief Called when player accept invite to join battle @@ -303,20 +303,20 @@ class BattlefieldWG : public Battlefield * - Update tenacity * \param player: Player who accepted invite */ - void OnPlayerJoinWar(Player* player); + void OnPlayerJoinWar(Player* player) override; /** * \brief Called when player left the battle * - Update player aura * \param player : Player who left the battle */ - void OnPlayerLeaveWar(Player* player); + void OnPlayerLeaveWar(Player* player) override; /** * \brief Called when player left the WG zone * \param player : Player who left the zone */ - void OnPlayerLeaveZone(Player* player); + void OnPlayerLeaveZone(Player* player) override; /** * \brief Called when player enters in WG zone @@ -324,7 +324,7 @@ class BattlefieldWG : public Battlefield * - Update worldstate * \param player : Player who enters the zone */ - void OnPlayerEnterZone(Player* player); + void OnPlayerEnterZone(Player* player) override; /** * \brief Called for update battlefield data @@ -332,24 +332,24 @@ class BattlefieldWG : public Battlefield * - Update imunity aura from graveyard * \param diff : time elapsed since the last call (in ms) */ - bool Update(uint32 diff); + bool Update(uint32 diff) override; /** * \brief Called when a creature is created * - Update vehicle count */ - void OnCreatureCreate(Creature* creature); + void OnCreatureCreate(Creature* creature) override; /** * \brief Called when a creature is removed * - Update vehicle count */ - void OnCreatureRemove(Creature* creature); + void OnCreatureRemove(Creature* creature) override; /** * \brief Called when a gameobject is created */ - void OnGameObjectCreate(GameObject* go); + void OnGameObjectCreate(GameObject* go) override; /** * \brief Called when a wall/tower is broken @@ -370,14 +370,14 @@ class BattlefieldWG : public Battlefield */ void UpdatedDestroyedTowerCount(TeamId team); - void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1); + void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1) override; void RemoveAurasFromPlayer(Player* player); /** * \brief Called when battlefield is setup, at server start */ - bool SetupBattlefield(); + bool SetupBattlefield() override; /// Return pointer to relic object GameObject* GetRelic() { return GetGameObject(m_titansRelicGUID); } @@ -395,22 +395,22 @@ class BattlefieldWG : public Battlefield void UpdateCounterVehicle(bool init); void SendInitWorldStatesTo(Player* player); - void SendInitWorldStatesToAll(); - void FillInitialWorldStates(WorldPacket& data); + void SendInitWorldStatesToAll() override; + void FillInitialWorldStates(WorldPacket& data) override; - void HandleKill(Player* killer, Unit* victim); - void OnUnitDeath(Unit* unit); + void HandleKill(Player* killer, Unit* victim) override; + void OnUnitDeath(Unit* unit) override; void PromotePlayer(Player* killer); void UpdateTenacity(); - void ProcessEvent(WorldObject* obj, uint32 eventId); + void ProcessEvent(WorldObject* obj, uint32 eventId) override; bool FindAndRemoveVehicleFromList(Unit* vehicle); // returns the graveyardId in the specified area. uint8 GetSpiritGraveyardId(uint32 areaId) const; - uint32 GetData(uint32 data) const; + uint32 GetData(uint32 data) const override; protected: bool m_isRelicInteractible; diff --git a/src/server/game/Battlegrounds/ArenaScore.h b/src/server/game/Battlegrounds/ArenaScore.h index 162cf729181..6de7fae8d05 100644 --- a/src/server/game/Battlegrounds/ArenaScore.h +++ b/src/server/game/Battlegrounds/ArenaScore.h @@ -30,7 +30,7 @@ struct ArenaScore : public BattlegroundScore protected: ArenaScore(uint64 playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), TeamId(team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE) { } - void AppendToPacket(WorldPacket& data, ByteBuffer& content) final + void AppendToPacket(WorldPacket& data, ByteBuffer& content) final override { uint32 primaryTree = 0; if (Player* player = ObjectAccessor::FindPlayer(PlayerGuid)) @@ -87,7 +87,7 @@ struct ArenaScore : public BattlegroundScore content.WriteByteSeq(PlayerGuid[2]); } - void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& /*content*/) final + void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& /*content*/) final override { data.WriteBits(0, 24); // Objectives Count } diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.h b/src/server/game/Battlegrounds/BattlegroundQueue.h index af283cb825f..f95e8bafd06 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.h +++ b/src/server/game/Battlegrounds/BattlegroundQueue.h @@ -143,8 +143,8 @@ class BGQueueInviteEvent : public BasicEvent { } virtual ~BGQueueInviteEvent() { } - virtual bool Execute(uint64 e_time, uint32 p_time); - virtual void Abort(uint64 e_time); + virtual bool Execute(uint64 e_time, uint32 p_time) override; + virtual void Abort(uint64 e_time) override; private: uint64 m_PlayerGuid; uint32 m_BgInstanceGUID; @@ -167,8 +167,8 @@ class BGQueueRemoveEvent : public BasicEvent virtual ~BGQueueRemoveEvent() { } - virtual bool Execute(uint64 e_time, uint32 p_time); - virtual void Abort(uint64 e_time); + virtual bool Execute(uint64 e_time, uint32 p_time) override; + virtual void Abort(uint64 e_time) override; private: uint64 m_PlayerGuid; uint32 m_BgInstanceGUID; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index 74efe421d35..91bb7104d66 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -260,7 +260,7 @@ struct BattlegroundABScore final : public BattlegroundScore } } - void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) final + void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) final override { data.WriteBits(2, 24); // Objectives Count content << uint32(BasesAssaulted); @@ -277,31 +277,31 @@ class BattlegroundAB : public Battleground BattlegroundAB(); ~BattlegroundAB(); - void AddPlayer(Player* player); - void StartingEventCloseDoors(); - void StartingEventOpenDoors(); - void RemovePlayer(Player* player, uint64 guid, uint32 team); - void HandleAreaTrigger(Player* Source, uint32 Trigger); - bool SetupBattleground(); - void Reset(); - void EndBattleground(uint32 winner); - WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + void AddPlayer(Player* player) override; + void StartingEventCloseDoors() override; + void StartingEventOpenDoors() override; + void RemovePlayer(Player* player, uint64 guid, uint32 team) override; + void HandleAreaTrigger(Player* Source, uint32 Trigger) override; + bool SetupBattleground() override; + void Reset() override; + void EndBattleground(uint32 winner) override; + WorldSafeLocsEntry const* GetClosestGraveYard(Player* player) override; /* Scorekeeping */ bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override; - void FillInitialWorldStates(WorldPacket& data); + void FillInitialWorldStates(WorldPacket& data) override; /* Nodes occupying */ - void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj); + void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override; /* achievement req. */ - bool IsAllNodesControlledByTeam(uint32 team) const; - bool CheckAchievementCriteriaMeet(uint32 /*criteriaId*/, Player const* /*player*/, Unit const* /*target*/ = NULL, uint32 /*miscvalue1*/ = 0); + bool IsAllNodesControlledByTeam(uint32 team) const override; + bool CheckAchievementCriteriaMeet(uint32 /*criteriaId*/, Player const* /*player*/, Unit const* /*target*/ = nullptr, uint32 /*miscvalue1*/ = 0) override; - uint32 GetPrematureWinner(); + uint32 GetPrematureWinner() override; private: - void PostUpdateImpl(uint32 diff); + void PostUpdateImpl(uint32 diff) override; /* Gameobject spawning/despawning */ void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay); void _DelBanner(uint8 node, uint8 type, uint8 teamIndex); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 5255caeda18..a93929672c7 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -1558,7 +1558,7 @@ struct BattlegroundAVScore final : public BattlegroundScore } } - void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) final + void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) final override { data.WriteBits(5, 24); // Objectives Count content << uint32(GraveyardsAssaulted); @@ -1582,37 +1582,37 @@ class BattlegroundAV : public Battleground ~BattlegroundAV(); /* inherited from BattlegroundClass */ - void AddPlayer(Player* player); - void StartingEventCloseDoors(); - void StartingEventOpenDoors(); + void AddPlayer(Player* player) override; + void StartingEventCloseDoors() override; + void StartingEventOpenDoors() override; - void RemovePlayer(Player* player, uint64 guid, uint32 team); - void HandleAreaTrigger(Player* player, uint32 trigger); - bool SetupBattleground(); - void ResetBGSubclass(); + void RemovePlayer(Player* player, uint64 guid, uint32 team) override; + void HandleAreaTrigger(Player* player, uint32 trigger) override; + bool SetupBattleground() override; + void ResetBGSubclass() override; /*general stuff*/ void UpdateScore(uint16 team, int16 points); bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override; /*handlestuff*/ //these are functions which get called from extern - void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj); - void HandleKillPlayer(Player* player, Player* killer); - void HandleKillUnit(Creature* unit, Player* killer); - void HandleQuestComplete(uint32 questid, Player* player); - bool CanActivateGO(int32 GOId, uint32 team) const; + void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override; + void HandleKillPlayer(Player* player, Player* killer) override; + void HandleKillUnit(Creature* unit, Player* killer) override; + void HandleQuestComplete(uint32 questid, Player* player) override; + bool CanActivateGO(int32 GOId, uint32 team) const override; - void EndBattleground(uint32 winner); + void EndBattleground(uint32 winner) override; - WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + WorldSafeLocsEntry const* GetClosestGraveYard(Player* player) override; // Achievement: Av perfection and Everything counts - bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0); + bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = nullptr, uint32 miscvalue1 = 0) override; - uint32 GetPrematureWinner(); + uint32 GetPrematureWinner() override; private: - void PostUpdateImpl(uint32 diff); + void PostUpdateImpl(uint32 diff) override; /* Nodes occupying */ void EventPlayerAssaultsPoint(Player* player, uint32 object); @@ -1636,7 +1636,7 @@ class BattlegroundAV : public Battleground void ChangeMineOwner(uint8 mine, uint32 team, bool initial=false); /*worldstates*/ - void FillInitialWorldStates(WorldPacket& data); + void FillInitialWorldStates(WorldPacket& data) override; uint8 GetWorldStateType(uint8 state, uint16 team); void SendMineWorldStates(uint32 mine); void UpdateNodeWorldState(BG_AV_Nodes node); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h index f391edbf747..6aa3e56ca13 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h @@ -48,11 +48,11 @@ class BattlegroundBE : public Arena BattlegroundBE(); /* inherited from BattlegroundClass */ - void StartingEventCloseDoors(); - void StartingEventOpenDoors(); + void StartingEventCloseDoors() override; + void StartingEventOpenDoors() override; - void HandleAreaTrigger(Player* Source, uint32 Trigger); - bool SetupBattleground(); - void FillInitialWorldStates(WorldPacket &d); + void HandleAreaTrigger(Player* Source, uint32 Trigger) override; + bool SetupBattleground() override; + void FillInitialWorldStates(WorldPacket &d) override; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index 4c763316d83..7b91996ed0e 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -94,15 +94,15 @@ class BattlegroundDS : public Arena BattlegroundDS(); /* inherited from BattlegroundClass */ - void StartingEventCloseDoors(); - void StartingEventOpenDoors(); + void StartingEventCloseDoors() override; + void StartingEventOpenDoors() override; - void HandleAreaTrigger(Player* Source, uint32 Trigger); - bool SetupBattleground(); - void FillInitialWorldStates(WorldPacket &d); + void HandleAreaTrigger(Player* Source, uint32 Trigger) override; + bool SetupBattleground() override; + void FillInitialWorldStates(WorldPacket &d) override; private: - void PostUpdateImpl(uint32 diff); + void PostUpdateImpl(uint32 diff) override; EventMap _events; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index 9ea6d30fe51..9867d878b41 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -343,7 +343,7 @@ struct BattlegroundEYScore final : public BattlegroundScore } } - void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) final + void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) final override { data.WriteBits(1, 24); // Objectives Count content << uint32(FlagCaptures); @@ -359,42 +359,42 @@ class BattlegroundEY : public Battleground ~BattlegroundEY(); /* inherited from BattlegroundClass */ - void AddPlayer(Player* player); - void StartingEventCloseDoors(); - void StartingEventOpenDoors(); + void AddPlayer(Player* player) override; + void StartingEventCloseDoors() override; + void StartingEventOpenDoors() override; /* BG Flags */ - uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return m_FlagKeeper; } + uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const override { return m_FlagKeeper; } void SetFlagPicker(uint64 guid) { m_FlagKeeper = guid; } bool IsFlagPickedup() const { return m_FlagKeeper != 0; } uint8 GetFlagState() const { return m_FlagState; } void RespawnFlag(bool send_message); void RespawnFlagAfterDrop(); - void RemovePlayer(Player* player, uint64 guid, uint32 team); + void RemovePlayer(Player* player, uint64 guid, uint32 team) override; void HandleBuffUse(uint64 buff_guid); - void HandleAreaTrigger(Player* Source, uint32 Trigger); - void HandleKillPlayer(Player* player, Player* killer); - WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); - bool SetupBattleground(); - void Reset(); + void HandleAreaTrigger(Player* Source, uint32 Trigger) override; + void HandleKillPlayer(Player* player, Player* killer) override; + WorldSafeLocsEntry const* GetClosestGraveYard(Player* player) override; + bool SetupBattleground() override; + void Reset() override; void UpdateTeamScore(uint32 Team); - void EndBattleground(uint32 winner); + void EndBattleground(uint32 winner) override; bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override; - void FillInitialWorldStates(WorldPacket& data); - void SetDroppedFlagGUID(uint64 guid, int32 /*TeamID*/ = -1) { m_DroppedFlagGUID = guid;} + void FillInitialWorldStates(WorldPacket& data) override; + void SetDroppedFlagGUID(uint64 guid, int32 /*TeamID*/ = -1) override { m_DroppedFlagGUID = guid;} uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;} /* Battleground Events */ - void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj); - void EventPlayerDroppedFlag(Player* Source); + void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj) override; + void EventPlayerDroppedFlag(Player* Source) override; /* achievement req. */ - bool IsAllNodesControlledByTeam(uint32 team) const; + bool IsAllNodesControlledByTeam(uint32 team) const override; - uint32 GetPrematureWinner(); + uint32 GetPrematureWinner() override; private: - void PostUpdateImpl(uint32 diff); + void PostUpdateImpl(uint32 diff) override; void EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType); void EventTeamCapturedPoint(Player* Source, uint32 Point); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index 5153a6fb9cf..a0f03f5727d 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -871,7 +871,7 @@ struct BattlegroundICScore final : public BattlegroundScore } } - void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) final + void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) final override { data.WriteBits(2, 24); // Objectives Count content << uint32(BasesAssaulted); @@ -889,36 +889,36 @@ class BattlegroundIC : public Battleground ~BattlegroundIC(); /* inherited from BattlegroundClass */ - void AddPlayer(Player* player); - void StartingEventCloseDoors(); - void StartingEventOpenDoors(); - void PostUpdateImpl(uint32 diff); - - void RemovePlayer(Player* player, uint64 guid, uint32 team); - void HandleAreaTrigger(Player* player, uint32 trigger); - bool SetupBattleground(); + void AddPlayer(Player* player) override; + void StartingEventCloseDoors() override; + void StartingEventOpenDoors() override; + void PostUpdateImpl(uint32 diff) override; + + void RemovePlayer(Player* player, uint64 guid, uint32 team) override; + void HandleAreaTrigger(Player* player, uint32 trigger) override; + bool SetupBattleground() override; void SpawnLeader(uint32 teamid); - void HandleKillUnit(Creature* unit, Player* killer); - void HandleKillPlayer(Player* player, Player* killer); - void EndBattleground(uint32 winner); - void EventPlayerClickedOnFlag(Player* source, GameObject* /*target_obj*/); + void HandleKillUnit(Creature* unit, Player* killer) override; + void HandleKillPlayer(Player* player, Player* killer) override; + void EndBattleground(uint32 winner) override; + void EventPlayerClickedOnFlag(Player* source, GameObject* /*target_obj*/) override; - void DestroyGate(Player* player, GameObject* go); + void DestroyGate(Player* player, GameObject* go) override; - WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + WorldSafeLocsEntry const* GetClosestGraveYard(Player* player) override; /* Scorekeeping */ - void FillInitialWorldStates(WorldPacket& data); + void FillInitialWorldStates(WorldPacket& data) override; - void DoAction(uint32 action, uint64 var); + void DoAction(uint32 action, uint64 var) override; - void HandlePlayerResurrect(Player* player); + void HandlePlayerResurrect(Player* player) override; uint32 GetNodeState(uint8 nodeType) const { return (uint8)nodePoint[nodeType].nodeState; } - bool IsAllNodesControlledByTeam(uint32 team) const; + bool IsAllNodesControlledByTeam(uint32 team) const override; - bool IsSpellAllowed(uint32 spellId, Player const* player) const; + bool IsSpellAllowed(uint32 spellId, Player const* player) const override; private: uint32 closeFortressDoorsTimer; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h index 2fa93a07651..17df258a0b8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h @@ -47,11 +47,11 @@ class BattlegroundNA : public Arena BattlegroundNA(); /* inherited from BattlegroundClass */ - void StartingEventCloseDoors(); - void StartingEventOpenDoors(); + void StartingEventCloseDoors() override; + void StartingEventOpenDoors() override; - void HandleAreaTrigger(Player* Source, uint32 Trigger); - bool SetupBattleground(); - void FillInitialWorldStates(WorldPacket &d); + void HandleAreaTrigger(Player* Source, uint32 Trigger) override; + bool SetupBattleground() override; + void FillInitialWorldStates(WorldPacket &d) override; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h index ad4fe18a3c7..e96129b05f0 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h @@ -43,11 +43,11 @@ class BattlegroundRL : public Arena BattlegroundRL(); /* inherited from BattlegroundClass */ - void FillInitialWorldStates(WorldPacket &d); - void StartingEventCloseDoors(); - void StartingEventOpenDoors(); + void FillInitialWorldStates(WorldPacket &d) override; + void StartingEventCloseDoors() override; + void StartingEventOpenDoors() override; - void HandleAreaTrigger(Player* Source, uint32 Trigger); - bool SetupBattleground(); + void HandleAreaTrigger(Player* Source, uint32 Trigger) override; + bool SetupBattleground() override; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h index d23f6757b83..eda4bf7fa00 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h @@ -96,14 +96,14 @@ class BattlegroundRV : public Arena BattlegroundRV(); /* inherited from BattlegroundClass */ - void StartingEventOpenDoors(); - void FillInitialWorldStates(WorldPacket &d); + void StartingEventOpenDoors() override; + void FillInitialWorldStates(WorldPacket &d) override; - void HandleAreaTrigger(Player* Source, uint32 Trigger); - bool SetupBattleground(); + void HandleAreaTrigger(Player* Source, uint32 Trigger) override; + bool SetupBattleground() override; private: - void PostUpdateImpl(uint32 diff); + void PostUpdateImpl(uint32 diff) override; void TogglePillarCollision(); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 474a2ff8dc3..7019d785503 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -531,7 +531,7 @@ struct BattlegroundSAScore final : public BattlegroundScore } } - void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) final + void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) final override { data.WriteBits(2, 24); // Objectives Count content << uint32(DemolishersDestroyed); @@ -554,27 +554,27 @@ class BattlegroundSA : public Battleground * -Update timer * -Round switch */ - void PostUpdateImpl(uint32 diff); + void PostUpdateImpl(uint32 diff) override; /* inherited from BattlegroundClass */ /// Called when a player join battle - void AddPlayer(Player* player); + void AddPlayer(Player* player) override; /// Called when battle start - void StartingEventCloseDoors(); - void StartingEventOpenDoors(); + void StartingEventCloseDoors() override; + void StartingEventOpenDoors() override; /// Called for ini battleground, after that the first player be entered - bool SetupBattleground(); - void Reset(); + bool SetupBattleground() override; + void Reset() override; /// Called for generate packet contain worldstate data - void FillInitialWorldStates(WorldPacket& data); + void FillInitialWorldStates(WorldPacket& data) override; /// Called when a player kill a unit in bg - void HandleKillUnit(Creature* creature, Player* killer); + void HandleKillUnit(Creature* creature, Player* killer) override; /// Return the nearest graveyard where player can respawn - WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + WorldSafeLocsEntry const* GetClosestGraveYard(Player* player) override; /// Called when someone activates an event void ProcessEvent(WorldObject* /*obj*/, uint32 /*eventId*/, WorldObject* /*invoker*/ = NULL) override; /// Called when a player click on flag (graveyard flag) - void EventPlayerClickedOnFlag(Player* source, GameObject* go); + void EventPlayerClickedOnFlag(Player* source, GameObject* go) override; /// Called when a player clicked on relic void TitanRelicActivated(Player* clicker); @@ -588,11 +588,11 @@ class BattlegroundSA : public Battleground } /// Called on battleground ending - void EndBattleground(uint32 winner); + void EndBattleground(uint32 winner) override; /// Called when a player leave battleground - void RemovePlayer(Player* player, uint64 guid, uint32 team); - void HandleAreaTrigger(Player* Source, uint32 Trigger); + void RemovePlayer(Player* player, uint64 guid, uint32 team) override; + void HandleAreaTrigger(Player* Source, uint32 Trigger) override; /* Scorekeeping */ @@ -630,7 +630,7 @@ class BattlegroundSA : public Battleground * -Update worldstate * -Delete gameobject in front of door (lighting object, with different colours for each door) */ - void DestroyGate(Player* player, GameObject* go); + void DestroyGate(Player* player, GameObject* go) override; /// Update timer worldstate void SendTime(); /** diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 1c3ee932b76..2fdb6dd120e 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -170,7 +170,7 @@ struct BattlegroundWGScore final : public BattlegroundScore } } - void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) final + void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& content) final override { data.WriteBits(2, 24); // Objectives Count content << uint32(FlagCaptures); @@ -189,12 +189,12 @@ class BattlegroundWS : public Battleground ~BattlegroundWS(); /* inherited from BattlegroundClass */ - void AddPlayer(Player* player); - void StartingEventCloseDoors(); - void StartingEventOpenDoors(); + void AddPlayer(Player* player) override; + void StartingEventCloseDoors() override; + void StartingEventOpenDoors() override; /* BG Flags */ - uint64 GetFlagPickerGUID(int32 team) const + uint64 GetFlagPickerGUID(int32 team) const override { if (team == TEAM_ALLIANCE || team == TEAM_HORDE) return m_FlagKeepers[team]; @@ -209,40 +209,40 @@ class BattlegroundWS : public Battleground uint8 GetFlagState(uint32 team) { return _flagState[GetTeamIndexByTeamId(team)]; } /* Battleground Events */ - void EventPlayerDroppedFlag(Player* player); - void EventPlayerClickedOnFlag(Player* player, GameObject* target_obj); + void EventPlayerDroppedFlag(Player* player) override; + void EventPlayerClickedOnFlag(Player* player, GameObject* target_obj) override; void EventPlayerCapturedFlag(Player* player); - void RemovePlayer(Player* player, uint64 guid, uint32 team); - void HandleAreaTrigger(Player* player, uint32 trigger); - void HandleKillPlayer(Player* player, Player* killer); - bool SetupBattleground(); - void Reset(); - void EndBattleground(uint32 winner); - WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + void RemovePlayer(Player* player, uint64 guid, uint32 team) override; + void HandleAreaTrigger(Player* player, uint32 trigger) override; + void HandleKillPlayer(Player* player, Player* killer) override; + bool SetupBattleground() override; + void Reset() override; + void EndBattleground(uint32 winner) override; + WorldSafeLocsEntry const* GetClosestGraveYard(Player* player) override; void UpdateFlagState(uint32 team, uint32 value); void SetLastFlagCapture(uint32 team) { _lastFlagCaptureTeam = team; } void UpdateTeamScore(uint32 team); bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override; - void SetDroppedFlagGUID(uint64 guid, int32 team = -1) + void SetDroppedFlagGUID(uint64 guid, int32 team = -1) override { if (team == TEAM_ALLIANCE || team == TEAM_HORDE) m_DroppedFlagGUID[team] = guid; } uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];} - void FillInitialWorldStates(WorldPacket& data); + void FillInitialWorldStates(WorldPacket& data) override; /* Scorekeeping */ void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; } void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; } void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; } - uint32 GetPrematureWinner(); + uint32 GetPrematureWinner() override; /* Achievements*/ - bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0); + bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = nullptr, uint32 miscvalue1 = 0) override; private: uint64 m_FlagKeepers[2]; // 0 - alliance, 1 - horde @@ -260,6 +260,6 @@ class BattlegroundWS : public Battleground uint8 _flagDebuffState; // 0 - no debuffs, 1 - focused assault, 2 - brutal assault uint8 _minutesElapsed; - void PostUpdateImpl(uint32 diff); + void PostUpdateImpl(uint32 diff) override; }; #endif diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 0686272f191..961824b1d86 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -984,7 +984,7 @@ static char const* const spellKeys[] = "Henchant", // enchanting recipe spell "Htrade", // profession/skill spell "Hglyph", // glyph - 0 + nullptr }; uint32 ChatHandler::extractSpellIdFromLink(char* text) @@ -1068,7 +1068,7 @@ static char const* const guidKeys[] = "Hplayer", "Hcreature", "Hgameobject", - 0 + nullptr }; uint64 ChatHandler::extractGuidFromLink(char* text) diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index 5c541d07b5a..7c9ad68a7f3 100644 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -148,14 +148,14 @@ class CliHandler : public ChatHandler explicit CliHandler(void* callbackArg, Print* zprint) : m_callbackArg(callbackArg), m_print(zprint) { } // overwrite functions - const char *GetTrinityString(int32 entry) const; - bool isAvailable(ChatCommand const& cmd) const; - bool HasPermission(uint32 /*permission*/) const { return true; } - void SendSysMessage(const char *str); - std::string GetNameLink() const; - bool needReportToTarget(Player* chr) const; - LocaleConstant GetSessionDbcLocale() const; - int GetSessionDbLocaleIndex() const; + const char *GetTrinityString(int32 entry) const override; + bool isAvailable(ChatCommand const& cmd) const override; + bool HasPermission(uint32 /*permission*/) const override { return true; } + void SendSysMessage(const char *str) override; + std::string GetNameLink() const override; + bool needReportToTarget(Player* chr) const override; + LocaleConstant GetSessionDbcLocale() const override; + int GetSessionDbLocaleIndex() const override; private: void* m_callbackArg; diff --git a/src/server/game/Chat/ChatLink.h b/src/server/game/Chat/ChatLink.h index ebe2583dc1c..a13cd2a0964 100644 --- a/src/server/game/Chat/ChatLink.h +++ b/src/server/game/Chat/ChatLink.h @@ -61,8 +61,8 @@ public: { memset(_data, 0, sizeof(_data)); } - virtual bool Initialize(std::istringstream& iss); - virtual bool ValidateName(char* buffer, const char* context); + virtual bool Initialize(std::istringstream& iss) override; + virtual bool ValidateName(char* buffer, const char* context) override; protected: std::string FormatName(uint8 index, ItemLocale const* locale, char* suffixStrings) const; @@ -77,9 +77,9 @@ protected: class QuestChatLink : public ChatLink { public: - QuestChatLink() : ChatLink(), _quest(NULL), _questLevel(0) { } - virtual bool Initialize(std::istringstream& iss); - virtual bool ValidateName(char* buffer, const char* context); + QuestChatLink() : ChatLink(), _quest(nullptr), _questLevel(0) { } + virtual bool Initialize(std::istringstream& iss) override; + virtual bool ValidateName(char* buffer, const char* context) override; protected: Quest const* _quest; @@ -90,9 +90,9 @@ protected: class SpellChatLink : public ChatLink { public: - SpellChatLink() : ChatLink(), _spell(NULL) { } - virtual bool Initialize(std::istringstream& iss); - virtual bool ValidateName(char* buffer, const char* context); + SpellChatLink() : ChatLink(), _spell(nullptr) { } + virtual bool Initialize(std::istringstream& iss) override; + virtual bool ValidateName(char* buffer, const char* context) override; protected: SpellInfo const* _spell; @@ -106,8 +106,8 @@ public: { memset(_data, 0, sizeof(_data)); } - virtual bool Initialize(std::istringstream& iss); - virtual bool ValidateName(char* buffer, const char* context); + virtual bool Initialize(std::istringstream& iss) override; + virtual bool ValidateName(char* buffer, const char* context) override; protected: uint32 _guid; @@ -120,7 +120,7 @@ class TradeChatLink : public SpellChatLink { public: TradeChatLink() : SpellChatLink(), _minSkillLevel(0), _maxSkillLevel(0), _guid(0) { } - virtual bool Initialize(std::istringstream& iss); + virtual bool Initialize(std::istringstream& iss) override; private: int32 _minSkillLevel; int32 _maxSkillLevel; @@ -133,7 +133,7 @@ class TalentChatLink : public SpellChatLink { public: TalentChatLink() : SpellChatLink(), _talentId(0), _rankId(0) { } - virtual bool Initialize(std::istringstream& iss); + virtual bool Initialize(std::istringstream& iss) override; private: uint32 _talentId; @@ -145,7 +145,7 @@ class EnchantmentChatLink : public SpellChatLink { public: EnchantmentChatLink() : SpellChatLink() { } - virtual bool Initialize(std::istringstream& iss); + virtual bool Initialize(std::istringstream& iss) override; }; // GlyphChatLink - link to glyph @@ -153,7 +153,7 @@ class GlyphChatLink : public SpellChatLink { public: GlyphChatLink() : SpellChatLink(), _slotId(0), _glyph(NULL) { } - virtual bool Initialize(std::istringstream& iss); + virtual bool Initialize(std::istringstream& iss) override; private: uint32 _slotId; GlyphPropertiesEntry const* _glyph; diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h index dd5904ae2ec..f0741f81067 100644 --- a/src/server/game/Combat/ThreatManager.h +++ b/src/server/game/Combat/ThreatManager.h @@ -117,13 +117,13 @@ class HostileReference : public Reference<Unit, ThreatManager> //================================================= // Tell our refTo (target) object that we have a link - void targetObjectBuildLink(); + void targetObjectBuildLink() override; // Tell our refTo (taget) object, that the link is cut - void targetObjectDestroyLink(); + void targetObjectDestroyLink() override; // Tell our refFrom (source) object, that the link is cut (Target destroyed) - void sourceObjectDestroyLink(); + void sourceObjectDestroyLink() override; private: // Inform the source, that the status of that reference was changed void fireStatusChanged(ThreatRefStatusChangeEvent& threatRefStatusChangeEvent); diff --git a/src/server/game/DungeonFinding/LFGScripts.h b/src/server/game/DungeonFinding/LFGScripts.h index 1ed37bd9d05..3f1dcbb218b 100644 --- a/src/server/game/DungeonFinding/LFGScripts.h +++ b/src/server/game/DungeonFinding/LFGScripts.h @@ -35,9 +35,9 @@ class LFGPlayerScript : public PlayerScript LFGPlayerScript(); // Player Hooks - void OnLogout(Player* player); - void OnLogin(Player* player, bool loginFirst); - void OnMapChanged(Player* player); + void OnLogout(Player* player) override; + void OnLogin(Player* player, bool loginFirst) override; + void OnMapChanged(Player* player) override; }; class LFGGroupScript : public GroupScript @@ -46,11 +46,11 @@ class LFGGroupScript : public GroupScript LFGGroupScript(); // Group Hooks - void OnAddMember(Group* group, uint64 guid); - void OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason); - void OnDisband(Group* group); - void OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid); - void OnInviteMember(Group* group, uint64 guid); + void OnAddMember(Group* group, uint64 guid) override; + void OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason) override; + void OnDisband(Group* group) override; + void OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid) override; + void OnInviteMember(Group* group, uint64 guid) override; }; } // namespace lfg diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h index def84dd93a9..5039c85bcb9 100644 --- a/src/server/game/Entities/Corpse/Corpse.h +++ b/src/server/game/Entities/Corpse/Corpse.h @@ -52,8 +52,8 @@ class Corpse : public WorldObject, public GridObject<Corpse> explicit Corpse(CorpseType type = CORPSE_BONES); ~Corpse(); - void AddToWorld(); - void RemoveFromWorld(); + void AddToWorld() override; + void RemoveFromWorld() override; bool Create(uint32 guidlow, Map* map); bool Create(uint32 guidlow, Player* owner); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 992894a1a3c..4a515d311d3 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -548,15 +548,6 @@ void Creature::Update(uint32 diff) if (!IsAlive()) break; - time_t now = time(NULL); - - // Check if we should refill the pickpocketing loot - if (loot.loot_type == LOOT_PICKPOCKETING && _pickpocketLootRestore && _pickpocketLootRestore <= now) - { - loot.clear(); - _pickpocketLootRestore = 0; - } - if (m_regenTimer > 0) { if (diff >= m_regenTimer) @@ -1542,7 +1533,7 @@ void Creature::Respawn(bool force) TC_LOG_DEBUG("entities.unit", "Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", GetName().c_str(), GetGUIDLow(), GetGUID(), GetEntry()); m_respawnTime = 0; - _pickpocketLootRestore = 0; + ResetPickPocketRefillTimer(); loot.clear(); if (m_originalEntry != GetEntry()) UpdateEntry(m_originalEntry); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index f5a0abfc469..64f7fca8ffa 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -436,11 +436,11 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject explicit Creature(bool isWorldObject = false); virtual ~Creature(); - void AddToWorld(); - void RemoveFromWorld(); + void AddToWorld() override; + void RemoveFromWorld() override; - void SetObjectScale(float scale); - void SetDisplayId(uint32 modelId); + void SetObjectScale(float scale) override; + void SetDisplayId(uint32 modelId) override; void DisappearAndDie(); @@ -451,8 +451,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } - void Update(uint32 time); // overwrited Unit::Update - void GetRespawnPosition(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const; + void Update(uint32 time) override; // overwrited Unit::Update + void GetRespawnPosition(float &x, float &y, float &z, float* ori = nullptr, float* dist =nullptr) const; void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; } uint32 GetCorpseDelay() const { return m_corpseDelay; } @@ -462,7 +462,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject bool IsGuard() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GUARD) != 0; } bool CanWalk() const { return (GetCreatureTemplate()->InhabitType & INHABIT_GROUND) != 0; } bool CanSwim() const { return (GetCreatureTemplate()->InhabitType & INHABIT_WATER) != 0 || IsPet(); } - bool CanFly() const { return (GetCreatureTemplate()->InhabitType & INHABIT_AIR) != 0; } + bool CanFly() const override { return (GetCreatureTemplate()->InhabitType & INHABIT_AIR) != 0; } void SetReactState(ReactStates st) { m_reactState = st; } ReactStates GetReactState() { return m_reactState; } @@ -473,14 +473,14 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject bool isCanInteractWithBattleMaster(Player* player, bool msg) const; bool isCanTrainingAndResetTalentsOf(Player* player) const; bool CanCreatureAttack(Unit const* victim, bool force = true) const; - bool IsImmunedToSpell(SpellInfo const* spellInfo) const; // override Unit::IsImmunedToSpell - bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; // override Unit::IsImmunedToSpellEffect + bool IsImmunedToSpell(SpellInfo const* spellInfo) const override; // override Unit::IsImmunedToSpell + bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const override; // override Unit::IsImmunedToSpellEffect bool isElite() const; bool isWorldBoss() const; bool IsDungeonBoss() const; - uint8 getLevelForTarget(WorldObject const* target) const; // overwrite Unit::getLevelForTarget for boss level support + uint8 getLevelForTarget(WorldObject const* target) const override; // overwrite Unit::getLevelForTarget for boss level support bool IsInEvadeMode() const { return HasUnitState(UNIT_STATE_EVADE); } @@ -489,7 +489,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject CreatureAI* AI() const { return (CreatureAI*)i_AI; } - SpellSchoolMask GetMeleeDamageSchoolMask() const { return m_meleeDamageSchoolMask; } + SpellSchoolMask GetMeleeDamageSchoolMask() const override { return m_meleeDamageSchoolMask; } void SetMeleeDamageSchool(SpellSchools school) { m_meleeDamageSchoolMask = SpellSchoolMask(1 << school); } void _AddCreatureSpellCooldown(uint32 spell_id, time_t end_time); @@ -498,21 +498,21 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject bool HasSpellCooldown(uint32 spell_id) const; bool HasCategoryCooldown(uint32 spell_id) const; uint32 GetCreatureSpellCooldownDelay(uint32 spellId) const; - virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs); + virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) override; - bool HasSpell(uint32 spellID) const; + bool HasSpell(uint32 spellID) const override; bool UpdateEntry(uint32 entry, CreatureData const* data = nullptr); void UpdateMovementFlags(); - bool UpdateStats(Stats stat); - bool UpdateAllStats(); - void UpdateResistances(uint32 school); - void UpdateArmor(); - void UpdateMaxHealth(); - void UpdateMaxPower(Powers power); - void UpdateAttackPowerAndDamage(bool ranged = false); + bool UpdateStats(Stats stat) override; + bool UpdateAllStats() override; + void UpdateResistances(uint32 school) override; + void UpdateArmor() override; + void UpdateMaxHealth() override; + void UpdateMaxPower(Powers power) override; + void UpdateAttackPowerAndDamage(bool ranged = false) override; void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage) override; void SetCanDualWield(bool value) override; @@ -537,9 +537,9 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject uint32 GetScriptId() const; // override WorldObject function for proper name localization - std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const; + std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override; - void setDeathState(DeathState s); // override virtual Unit::setDeathState + void setDeathState(DeathState s) override; // override virtual Unit::setDeathState bool LoadFromDB(uint32 guid, Map* map) { return LoadCreatureFromDB(guid, map, false); } bool LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap = true); @@ -551,6 +551,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject Loot loot; void StartPickPocketRefillTimer(); void ResetPickPocketRefillTimer() { _pickpocketLootRestore = 0; } + bool CanGeneratePickPocketLoot() const { return _pickpocketLootRestore <= time(NULL); } void SetSkinner(uint64 guid) { _skinner = guid; } uint64 GetSkinner() const { return _skinner; } // Returns the player who skinned this creature Player* GetLootRecipient() const; @@ -606,7 +607,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject time_t GetRespawnTimeEx() const; void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(NULL) + respawn : 0; } void Respawn(bool force = false); - void SaveRespawnTime(); + void SaveRespawnTime() override; uint32 GetRespawnDelay() const { return m_respawnDelay; } void SetRespawnDelay(uint32 delay) { m_respawnDelay = delay; } @@ -621,8 +622,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject void SetInCombatWithZone(); - bool hasQuest(uint32 quest_id) const; - bool hasInvolvedQuest(uint32 quest_id) const; + bool hasQuest(uint32 quest_id) const override; + bool hasInvolvedQuest(uint32 quest_id) const override; bool isRegeneratingHealth() { return m_regenHealth; } void setRegeneratingHealth(bool regenHealth) { m_regenHealth = regenHealth; } @@ -673,7 +674,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject bool m_isTempWorldObject; //true when possessed // Handling caster facing during spellcast - void SetTarget(uint64 guid); + void SetTarget(uint64 guid) override; void FocusTarget(Spell const* focusSpell, WorldObject const* target); void ReleaseFocus(Spell const* focusSpell); @@ -725,8 +726,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject uint16 m_LootMode; // Bitmask (default: LOOT_MODE_DEFAULT) that determines what loot will be lootable - bool IsInvisibleDueToDespawn() const; - bool CanAlwaysSee(WorldObject const* obj) const; + bool IsInvisibleDueToDespawn() const override; + bool CanAlwaysSee(WorldObject const* obj) const override; private: void ForcedDespawn(uint32 timeMSToDespawn = 0); @@ -747,7 +748,7 @@ class AssistDelayEvent : public BasicEvent public: AssistDelayEvent(uint64 victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { } - bool Execute(uint64 e_time, uint32 p_time); + bool Execute(uint64 e_time, uint32 p_time) override; void AddAssistant(uint64 guid) { m_assistants.push_back(guid); } private: AssistDelayEvent(); @@ -761,7 +762,7 @@ class ForcedDespawnDelayEvent : public BasicEvent { public: ForcedDespawnDelayEvent(Creature& owner) : BasicEvent(), m_owner(owner) { } - bool Execute(uint64 e_time, uint32 p_time); + bool Execute(uint64 e_time, uint32 p_time) override; private: Creature& m_owner; diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h index 1cee6361172..58cc6eb7d0b 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.h +++ b/src/server/game/Entities/Creature/TemporarySummon.h @@ -42,13 +42,13 @@ class TempSummon : public Creature public: explicit TempSummon(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject); virtual ~TempSummon() { } - void Update(uint32 time); + void Update(uint32 time) override; virtual void InitStats(uint32 lifetime); virtual void InitSummon(); virtual void UnSummon(uint32 msTime = 0); - void RemoveFromWorld(); + void RemoveFromWorld() override; void SetTempSummonType(TempSummonType type); - void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) { } + void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) override { } Unit* GetSummoner() const; Creature* GetSummonerCreatureBase() const; uint64 GetSummonerGUID() const { return m_summonerGUID; } @@ -67,10 +67,10 @@ class Minion : public TempSummon { public: Minion(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject); - void InitStats(uint32 duration); - void RemoveFromWorld(); + void InitStats(uint32 duration) override; + void RemoveFromWorld() override; Unit* GetOwner() const { return m_owner; } - float GetFollowAngle() const { return m_followAngle; } + float GetFollowAngle() const override { return m_followAngle; } void SetFollowAngle(float angle) { m_followAngle = angle; } bool IsPetGhoul() const {return GetEntry() == 26125;} // Ghoul may be guardian or pet bool IsSpiritWolf() const {return GetEntry() == 29264;} // Spirit wolf from feral spirits @@ -84,17 +84,17 @@ class Guardian : public Minion { public: Guardian(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject); - void InitStats(uint32 duration); + void InitStats(uint32 duration) override; bool InitStatsForLevel(uint8 level); - void InitSummon(); + void InitSummon() override; - bool UpdateStats(Stats stat); - bool UpdateAllStats(); - void UpdateResistances(uint32 school); - void UpdateArmor(); - void UpdateMaxHealth(); - void UpdateMaxPower(Powers power); - void UpdateAttackPowerAndDamage(bool ranged = false); + bool UpdateStats(Stats stat) override; + bool UpdateAllStats() override; + void UpdateResistances(uint32 school) override; + void UpdateArmor() override; + void UpdateMaxHealth() override; + void UpdateMaxPower(Powers power) override; + void UpdateAttackPowerAndDamage(bool ranged = false) override; void UpdateDamagePhysical(WeaponAttackType attType) override; int32 GetBonusDamage() const { return m_bonusSpellDamage; } @@ -108,17 +108,17 @@ class Puppet : public Minion { public: Puppet(SummonPropertiesEntry const* properties, Unit* owner); - void InitStats(uint32 duration); - void InitSummon(); - void Update(uint32 time); - void RemoveFromWorld(); + void InitStats(uint32 duration) override; + void InitSummon() override; + void Update(uint32 time) override; + void RemoveFromWorld() override; }; class ForcedUnsummonDelayEvent : public BasicEvent { public: ForcedUnsummonDelayEvent(TempSummon& owner) : BasicEvent(), m_owner(owner) { } - bool Execute(uint64 e_time, uint32 p_time); + bool Execute(uint64 e_time, uint32 p_time) override; private: TempSummon& m_owner; diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h index ed9b5a3af68..c185c669e7b 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.h +++ b/src/server/game/Entities/DynamicObject/DynamicObject.h @@ -38,11 +38,11 @@ class DynamicObject : public WorldObject, public GridObject<DynamicObject>, publ DynamicObject(bool isWorldObject); ~DynamicObject(); - void AddToWorld(); - void RemoveFromWorld(); + void AddToWorld() override; + void RemoveFromWorld() override; bool CreateDynamicObject(uint32 guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type); - void Update(uint32 p_time); + void Update(uint32 p_time) override; void Remove(); void SetDuration(int32 newDuration); int32 GetDuration() const; diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 90f46c4ad86..e5cbf2f3ac9 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1800,14 +1800,14 @@ void GameObject::CastSpell(Unit* target, uint32 spellId, bool triggered /*= true trigger->setFaction(owner->getFaction()); // needed for GO casts for proper target validation checks trigger->SetOwnerGUID(owner->GetGUID()); - trigger->CastSpell(target ? target : trigger, spellInfo, triggered, 0, 0, owner->GetGUID()); + trigger->CastSpell(target ? target : trigger, spellInfo, triggered, nullptr, nullptr, owner->GetGUID()); } else { trigger->setFaction(14); // Set owner guid for target if no owner available - needed by trigger auras // - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell()) - trigger->CastSpell(target ? target : trigger, spellInfo, triggered, 0, 0, target ? target->GetGUID() : 0); + trigger->CastSpell(target ? target : trigger, spellInfo, triggered, nullptr, nullptr, target ? target->GetGUID() : 0); } } diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 09c84c71244..c372f05a3ee 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -638,14 +638,14 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map explicit GameObject(); ~GameObject(); - void BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, Player* target) const; + void BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, Player* target) const override; - void AddToWorld(); - void RemoveFromWorld(); - void CleanupsBeforeDelete(bool finalCleanup = true); + void AddToWorld() override; + void RemoveFromWorld() override; + void CleanupsBeforeDelete(bool finalCleanup = true) override; bool Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit = 0); - void Update(uint32 p_time); + void Update(uint32 p_time) override; static GameObject* GetGameObject(WorldObject& object, uint64 guid); GameObjectTemplate const* GetGOInfo() const { return m_goInfo; } GameObjectData const* GetGOData() const { return m_goData; } @@ -660,7 +660,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map void UpdateRotationFields(float rotation2 = 0.0f, float rotation3 = 0.0f); // overwrite WorldObject function for proper name localization - std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const; + std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override; void SaveToDB(); void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask); @@ -760,7 +760,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map uint32 GetUseCount() const { return m_usetimes; } uint32 GetUniqueUseCount() const { return m_unique_users.size(); } - void SaveRespawnTime(); + void SaveRespawnTime() override; Loot loot; @@ -772,8 +772,8 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map uint32 m_groupLootTimer; // (msecs)timer used for group loot uint32 lootingGroupLowGUID; // used to find group which is looting - bool hasQuest(uint32 quest_id) const; - bool hasInvolvedQuest(uint32 quest_id) const; + bool hasQuest(uint32 quest_id) const override; + bool hasInvolvedQuest(uint32 quest_id) const override; bool ActivateToQuest(Player* target) const; void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false, Unit* user = NULL); // 0 = use `gameobject`.`spawntimesecs` @@ -783,10 +783,10 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map bool IsNeverVisible() const override; - bool IsAlwaysVisibleFor(WorldObject const* seer) const; - bool IsInvisibleDueToDespawn() const; + bool IsAlwaysVisibleFor(WorldObject const* seer) const override; + bool IsInvisibleDueToDespawn() const override; - uint8 getLevelForTarget(WorldObject const* target) const + uint8 getLevelForTarget(WorldObject const* target) const override { if (Unit* owner = GetOwner()) return owner->getLevelForTarget(target); @@ -831,10 +831,10 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map Transport* ToTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<Transport*>(this); else return NULL; } Transport const* ToTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<Transport const*>(this); else return NULL; } - float GetStationaryX() const { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionX(); return GetPositionX(); } - float GetStationaryY() const { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionY(); return GetPositionY(); } - float GetStationaryZ() const { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionZ(); return GetPositionZ(); } - float GetStationaryO() const { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetOrientation(); return GetOrientation(); } + float GetStationaryX() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionX(); return GetPositionX(); } + float GetStationaryY() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionY(); return GetPositionY(); } + float GetStationaryZ() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionZ(); return GetPositionZ(); } + float GetStationaryO() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetOrientation(); return GetOrientation(); } float GetInteractionDistance() const; @@ -876,7 +876,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map void SwitchDoorOrButton(bool activate, bool alternative = false); //! Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size. - bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool /*is3D*/) const + bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool /*is3D*/) const override { //! Following check does check 3d distance return IsInRange(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare); diff --git a/src/server/game/Entities/Item/Container/Bag.h b/src/server/game/Entities/Item/Container/Bag.h index 1e39e5a41ad..db0c8edf556 100644 --- a/src/server/game/Entities/Item/Container/Bag.h +++ b/src/server/game/Entities/Item/Container/Bag.h @@ -32,10 +32,10 @@ class Bag : public Item Bag(); ~Bag(); - void AddToWorld(); - void RemoveFromWorld(); + void AddToWorld() override; + void RemoveFromWorld() override; - bool Create(uint32 guidlow, uint32 itemid, Player const* owner); + bool Create(uint32 guidlow, uint32 itemid, Player const* owner) override; void Clear(); void StoreItem(uint8 slot, Item* pItem, bool update); @@ -52,13 +52,13 @@ class Bag : public Item // DB operations // overwrite virtual Item::SaveToDB - void SaveToDB(SQLTransaction& trans); + void SaveToDB(SQLTransaction& trans) override; // overwrite virtual Item::LoadFromDB - bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry); + bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry) override; // overwrite virtual Item::DeleteFromDB - void DeleteFromDB(SQLTransaction& trans); + void DeleteFromDB(SQLTransaction& trans) override; - void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const; + void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const override; protected: diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index ebd66a64838..25472ff83ee 100644 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -331,8 +331,8 @@ class Item : public Object uState = state; } - bool hasQuest(uint32 quest_id) const { return GetTemplate()->StartQuest == quest_id; } - bool hasInvolvedQuest(uint32 /*quest_id*/) const { return false; } + bool hasQuest(uint32 quest_id) const override { return GetTemplate()->StartQuest == quest_id; } + bool hasInvolvedQuest(uint32 /*quest_id*/) const override { return false; } bool HasStats() const; bool IsPotion() const { return GetTemplate()->IsPotion(); } bool IsVellum() const { return GetTemplate()->IsVellum(); } @@ -358,7 +358,7 @@ class Item : public Object void ClearSoulboundTradeable(Player* currentOwner); bool CheckSoulboundTradeExpire(); - void BuildUpdate(UpdateDataMapType&); + void BuildUpdate(UpdateDataMapType&) override; uint32 GetScriptId() const { return GetTemplate()->ScriptId; } diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 51087e0f966..623680dad7e 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -121,7 +121,7 @@ Object::~Object() } delete [] m_uint32Values; - m_uint32Values = 0; + m_uint32Values = nullptr; } void Object::_InitValues() diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 87f94008455..6c6d8c75f7d 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -655,7 +655,7 @@ class WorldObject : public Object, public WorldLocation virtual void Update (uint32 /*time_diff*/) { } void _Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask); - virtual void RemoveFromWorld(); + virtual void RemoveFromWorld() override; void GetNearPoint2D(float &x, float &y, float distance, float absAngle) const; void GetNearPoint(WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle) const; @@ -792,7 +792,7 @@ class WorldObject : public Object, public WorldLocation void DestroyForNearbyPlayers(); virtual void UpdateObjectVisibility(bool forced = true); - void BuildUpdate(UpdateDataMapType&); + void BuildUpdate(UpdateDataMapType&) override; //relocation and visibility system functions void AddToNotify(uint16 f) { m_notifyflags |= f;} diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h index 97323f3f9ab..15383d90bf3 100644 --- a/src/server/game/Entities/Pet/Pet.h +++ b/src/server/game/Entities/Pet/Pet.h @@ -43,10 +43,10 @@ class Pet : public Guardian explicit Pet(Player* owner, PetType type = MAX_PET_TYPE); virtual ~Pet(); - void AddToWorld(); - void RemoveFromWorld(); + void AddToWorld() override; + void RemoveFromWorld() override; - void SetDisplayId(uint32 modelId); + void SetDisplayId(uint32 modelId) override; PetType getPetType() const { return m_petType; } void setPetType(PetType type) { m_petType = type; } @@ -60,16 +60,16 @@ class Pet : public Guardian bool CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner); bool CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask); bool LoadPetFromDB(Player* owner, uint32 petentry = 0, uint32 petnumber = 0, bool current = false); - bool isBeingLoaded() const { return m_loading;} + bool isBeingLoaded() const override { return m_loading;} void SavePetToDB(PetSaveMode mode); void Remove(PetSaveMode mode, bool returnreagent = false); static void DeleteFromDB(uint32 guidlow); - void setDeathState(DeathState s); // overwrite virtual Creature::setDeathState and Unit::setDeathState - void Update(uint32 diff); // overwrite virtual Creature::Update and Unit::Update + void setDeathState(DeathState s) override; // overwrite virtual Creature::setDeathState and Unit::setDeathState + void Update(uint32 diff) override; // overwrite virtual Creature::Update and Unit::Update - uint8 GetPetAutoSpellSize() const { return m_autospells.size(); } - uint32 GetPetAutoSpellOnPos(uint8 pos) const + uint8 GetPetAutoSpellSize() const override { return m_autospells.size(); } + uint32 GetPetAutoSpellOnPos(uint8 pos) const override { if (pos >= m_autospells.size()) return 0; @@ -98,7 +98,7 @@ class Pet : public Guardian void ToggleAutocast(SpellInfo const* spellInfo, bool apply); - bool HasSpell(uint32 spell) const; + bool HasSpell(uint32 spell) const override; void LearnPetPassives(); void CastPetAuras(bool current); @@ -119,7 +119,7 @@ class Pet : public Guardian bool unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab = true); bool removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab = true); void CleanupActionBar(); - virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs); + virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) override; PetSpellMap m_spells; AutoSpellList m_autospells; @@ -127,7 +127,7 @@ class Pet : public Guardian void InitPetCreateSpells(); bool resetTalents(); - static void resetTalentsForAllPetsOf(Player* owner, Pet* online_pet = NULL); + static void resetTalentsForAllPetsOf(Player* owner, Pet* online_pet = nullptr); void InitTalentForLevel(); uint8 GetMaxTalentPointsForLevel(uint8 level); @@ -156,11 +156,11 @@ class Pet : public Guardian DeclinedName *m_declinedname; private: - void SaveToDB(uint32, uint8, uint32) // override of Creature::SaveToDB - must not be called + void SaveToDB(uint32, uint8, uint32) override // override of Creature::SaveToDB - must not be called { ASSERT(false); } - void DeleteFromDB() // override of Creature::DeleteFromDB - must not be called + void DeleteFromDB() override // override of Creature::DeleteFromDB - must not be called { ASSERT(false); } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 21cb96ac048..b6f62a3ddf3 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -376,7 +376,10 @@ void TradeData::SetMoney(uint64 money) if (!m_player->HasEnoughMoney(money)) { - m_player->GetSession()->SendTradeStatus(TRADE_STATUS_BUSY); + TradeStatusInfo info; + info.Status = TRADE_STATUS_CLOSE_WINDOW; + info.Result = EQUIP_ERR_NOT_ENOUGH_MONEY; + m_player->GetSession()->SendTradeStatus(info); return; } @@ -402,10 +405,12 @@ void TradeData::SetAccepted(bool state, bool crosssend /*= false*/) if (!state) { + TradeStatusInfo info; + info.Status = TRADE_STATUS_BACK_TO_TRADE; if (crosssend) - m_trader->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); + m_trader->GetSession()->SendTradeStatus(info); else - m_player->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); + m_player->GetSession()->SendTradeStatus(info); } } @@ -1636,7 +1641,7 @@ void Player::Update(uint32 p_time) else { q_status.Timer -= p_time; - m_QuestStatusSave[*iter] = true; + m_QuestStatusSave[*iter] = QUEST_DEFAULT_SAVE_TYPE; ++iter; } } @@ -9113,18 +9118,27 @@ void Player::SendLoot(uint64 guid, LootType loot_type) { if (loot->loot_type != LOOT_PICKPOCKETING) { - creature->StartPickPocketRefillTimer(); - loot->clear(); + if (creature->CanGeneratePickPocketLoot()) + { + creature->StartPickPocketRefillTimer(); + loot->clear(); - if (uint32 lootid = creature->GetCreatureTemplate()->pickpocketLootId) - loot->FillLoot(lootid, LootTemplates_Pickpocketing, this, true); + if (uint32 lootid = creature->GetCreatureTemplate()->pickpocketLootId) + loot->FillLoot(lootid, LootTemplates_Pickpocketing, this, true); - // Generate extra money for pick pocket loot - const uint32 a = urand(0, creature->getLevel()/2); - const uint32 b = urand(0, getLevel()/2); - loot->gold = uint32(10 * (a + b) * sWorld->getRate(RATE_DROP_MONEY)); - permission = OWNER_PERMISSION; - } + // Generate extra money for pick pocket loot + const uint32 a = urand(0, creature->getLevel() / 2); + const uint32 b = urand(0, getLevel() / 2); + loot->gold = uint32(10 * (a + b) * sWorld->getRate(RATE_DROP_MONEY)); + permission = OWNER_PERMISSION; + } + else + { + permission = NONE_PERMISSION; + SendLootError(guid, LOOT_ERROR_ALREADY_PICKPOCKETED); + return; + } + } // else - still has pickpocket loot generated & not fully taken } else { @@ -9203,8 +9217,6 @@ void Player::SendLoot(uint64 guid, LootType loot_type) } } - SetLootGUID(guid); - // LOOT_INSIGNIA and LOOT_FISHINGHOLE unsupported by client switch (loot_type) { @@ -9217,21 +9229,35 @@ void Player::SendLoot(uint64 guid, LootType loot_type) // need know merged fishing/corpse loot type for achievements loot->loot_type = loot_type; - WorldPacket data(SMSG_LOOT_RESPONSE, 8 + 1 + 50 + 1 + 1); // we guess size - data << uint64(guid); - data << uint8(loot_type); - data << LootView(*loot, this, permission); + if (permission != NONE_PERMISSION) + { + SetLootGUID(guid); - SendDirectMessage(&data); + WorldPacket data(SMSG_LOOT_RESPONSE, (9 + 50)); // we guess size + data << uint64(guid); + data << uint8(loot_type); + data << LootView(*loot, this, permission); + SendDirectMessage(&data); - // add 'this' player as one of the players that are looting 'loot' - if (permission != NONE_PERMISSION) + // add 'this' player as one of the players that are looting 'loot' loot->AddLooter(GetGUID()); + } + else + SendLootError(GetLootGUID(), LOOT_ERROR_DIDNT_KILL); if (loot_type == LOOT_CORPSE && !IS_ITEM_GUID(guid)) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING); } +void Player::SendLootError(uint64 guid, LootError error) +{ + WorldPacket data(SMSG_LOOT_RESPONSE, 10); + data << uint64(guid); + data << uint8(LOOT_NONE); + data << uint8(error); + SendDirectMessage(&data); +} + void Player::SendNotifyLootMoneyRemoved() { WorldPacket data(SMSG_LOOT_CLEAR_MONEY, 0); @@ -10613,7 +10639,7 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 return false; } -InventoryResult Player::CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count) const +InventoryResult Player::CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count /*= NULL*/, uint32* itemLimitCategory /*= NULL*/) const { ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(entry); if (!pProto) @@ -10659,6 +10685,8 @@ InventoryResult Player::CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item { if (no_space_count) *no_space_count = count + curcount - limitEntry->maxCount; + if (itemLimitCategory) + *itemLimitCategory = pProto->ItemLimitCategory; return EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED_IS; } } @@ -11161,61 +11189,61 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des } ////////////////////////////////////////////////////////////////////////// -InventoryResult Player::CanStoreItems(Item** pItems, int count) const +InventoryResult Player::CanStoreItems(Item** items, int count, uint32* itemLimitCategory) const { - Item* pItem2; + Item* item2; // fill space table - int inv_slot_items[INVENTORY_SLOT_ITEM_END - INVENTORY_SLOT_ITEM_START]; - int inv_bags[INVENTORY_SLOT_BAG_END - INVENTORY_SLOT_BAG_START][MAX_BAG_SIZE]; + uint32 inventoryCounts[INVENTORY_SLOT_ITEM_END - INVENTORY_SLOT_ITEM_START]; + uint32 bagCounts[INVENTORY_SLOT_BAG_END - INVENTORY_SLOT_BAG_START][MAX_BAG_SIZE]; - memset(inv_slot_items, 0, sizeof(int) * (INVENTORY_SLOT_ITEM_END - INVENTORY_SLOT_ITEM_START)); - memset(inv_bags, 0, sizeof(int) * (INVENTORY_SLOT_BAG_END - INVENTORY_SLOT_BAG_START) * MAX_BAG_SIZE); + memset(inventoryCounts, 0, sizeof(uint32) * (INVENTORY_SLOT_ITEM_END - INVENTORY_SLOT_ITEM_START)); + memset(bagCounts, 0, sizeof(uint32) * (INVENTORY_SLOT_BAG_END - INVENTORY_SLOT_BAG_START) * MAX_BAG_SIZE); for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) { - pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i); - if (pItem2 && !pItem2->IsInTrade()) - inv_slot_items[i - INVENTORY_SLOT_ITEM_START] = pItem2->GetCount(); + item2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (item2 && !item2->IsInTrade()) + inventoryCounts[i - INVENTORY_SLOT_ITEM_START] = item2->GetCount(); } for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) if (Bag* pBag = GetBagByPos(i)) for (uint32 j = 0; j < pBag->GetBagSize(); j++) { - pItem2 = GetItemByPos(i, j); - if (pItem2 && !pItem2->IsInTrade()) - inv_bags[i - INVENTORY_SLOT_BAG_START][j] = pItem2->GetCount(); + item2 = GetItemByPos(i, j); + if (item2 && !item2->IsInTrade()) + bagCounts[i - INVENTORY_SLOT_BAG_START][j] = item2->GetCount(); } // check free space for all items for (int k = 0; k < count; ++k) { - Item* pItem = pItems[k]; + Item* item = items[k]; // no item - if (!pItem) + if (!item) continue; - TC_LOG_DEBUG("entities.player.items", "STORAGE: CanStoreItems %i. item = %u, count = %u", k + 1, pItem->GetEntry(), pItem->GetCount()); - ItemTemplate const* pProto = pItem->GetTemplate(); + TC_LOG_DEBUG("entities.player.items", "STORAGE: CanStoreItems %i. item = %u, count = %u", k + 1, item->GetEntry(), item->GetCount()); + ItemTemplate const* pProto = item->GetTemplate(); // strange item if (!pProto) return EQUIP_ERR_ITEM_NOT_FOUND; // item used - if (pItem->m_lootGenerated) + if (item->m_lootGenerated) return EQUIP_ERR_LOOT_GONE; // item it 'bind' - if (pItem->IsBindedNotWith(this)) + if (item->IsBindedNotWith(this)) return EQUIP_ERR_NOT_OWNER; ItemTemplate const* pBagProto; // item is 'one item only' - InventoryResult res = CanTakeMoreSimilarItems(pItem); + InventoryResult res = CanTakeMoreSimilarItems(item, itemLimitCategory); if (res != EQUIP_ERR_OK) return res; @@ -11226,10 +11254,10 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const for (int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t) { - pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, t); - if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_slot_items[t-INVENTORY_SLOT_ITEM_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) + item2 = GetItemByPos(INVENTORY_SLOT_BAG_0, t); + if (item2 && item2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inventoryCounts[t-INVENTORY_SLOT_ITEM_START] + item->GetCount() <= pProto->GetMaxStackSize()) { - inv_slot_items[t-INVENTORY_SLOT_ITEM_START] += pItem->GetCount(); + inventoryCounts[t-INVENTORY_SLOT_ITEM_START] += item->GetCount(); b_found = true; break; } @@ -11241,14 +11269,14 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const { if (Bag* bag = GetBagByPos(t)) { - if (ItemCanGoIntoBag(pItem->GetTemplate(), bag->GetTemplate())) + if (ItemCanGoIntoBag(item->GetTemplate(), bag->GetTemplate())) { for (uint32 j = 0; j < bag->GetBagSize(); j++) { - pItem2 = GetItemByPos(t, j); - if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_bags[t-INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->GetMaxStackSize()) + item2 = GetItemByPos(t, j); + if (item2 && item2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && bagCounts[t-INVENTORY_SLOT_BAG_START][j] + item->GetCount() <= pProto->GetMaxStackSize()) { - inv_bags[t-INVENTORY_SLOT_BAG_START][j] += pItem->GetCount(); + bagCounts[t-INVENTORY_SLOT_BAG_START][j] += item->GetCount(); b_found = true; break; } @@ -11277,9 +11305,9 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const { for (uint32 j = 0; j < bag->GetBagSize(); j++) { - if (inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0) + if (bagCounts[t-INVENTORY_SLOT_BAG_START][j] == 0) { - inv_bags[t-INVENTORY_SLOT_BAG_START][j] = 1; + bagCounts[t-INVENTORY_SLOT_BAG_START][j] = 1; b_found = true; break; } @@ -11295,9 +11323,9 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const bool b_found = false; for (int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t) { - if (inv_slot_items[t-INVENTORY_SLOT_ITEM_START] == 0) + if (inventoryCounts[t-INVENTORY_SLOT_ITEM_START] == 0) { - inv_slot_items[t-INVENTORY_SLOT_ITEM_START] = 1; + inventoryCounts[t-INVENTORY_SLOT_ITEM_START] = 1; b_found = true; break; } @@ -11318,9 +11346,9 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const for (uint32 j = 0; j < bag->GetBagSize(); j++) { - if (inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0) + if (bagCounts[t-INVENTORY_SLOT_BAG_START][j] == 0) { - inv_bags[t-INVENTORY_SLOT_BAG_START][j] = 1; + bagCounts[t-INVENTORY_SLOT_BAG_START][j] = 1; b_found = true; break; } @@ -11330,7 +11358,7 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const // no free slot found? if (!b_found) - return EQUIP_ERR_INV_FULL; + return EQUIP_ERR_BAG_FULL; } return EQUIP_ERR_OK; @@ -13243,7 +13271,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem) // found empty if (!m_items[i]) { - slot = i; + oldest_slot = i; break; } @@ -15213,7 +15241,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver) SetQuestSlot(log_slot, quest_id, qtime); - m_QuestStatusSave[quest_id] = true; + m_QuestStatusSave[quest_id] = QUEST_DEFAULT_SAVE_TYPE; StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, quest_id); @@ -15396,7 +15424,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, RemoveActiveQuest(quest_id, false); m_RewardedQuests.insert(quest_id); - m_RewardedQuestsSave[quest_id] = true; + m_RewardedQuestsSave[quest_id] = QUEST_DEFAULT_SAVE_TYPE; // StoreNewItem, mail reward, etc. save data directly to the database // to prevent exploitable data desynchronisation we save the quest status to the database too @@ -16044,7 +16072,7 @@ void Player::SetQuestStatus(uint32 questId, QuestStatus status, bool update /*= if (sObjectMgr->GetQuestTemplate(questId)) { m_QuestStatus[questId].Status = status; - m_QuestStatusSave[questId] = true; + m_QuestStatusSave[questId] = QUEST_DEFAULT_SAVE_TYPE; } if (update) @@ -16057,7 +16085,7 @@ void Player::RemoveActiveQuest(uint32 questId, bool update /*= true*/) if (itr != m_QuestStatus.end()) { m_QuestStatus.erase(itr); - m_QuestStatusSave[questId] = false; + m_QuestStatusSave[questId] = QUEST_DELETE_SAVE_TYPE; } if (update) @@ -16070,7 +16098,7 @@ void Player::RemoveRewardedQuest(uint32 questId, bool update /*= true*/) if (rewItr != m_RewardedQuests.end()) { m_RewardedQuests.erase(rewItr); - m_RewardedQuestsSave[questId] = false; + m_RewardedQuestsSave[questId] = QUEST_FORCE_DELETE_SAVE_TYPE; } if (update) @@ -16236,7 +16264,7 @@ void Player::AdjustQuestReqItemCount(Quest const* quest, QuestStatusData& questS uint32 curitemcount = GetItemCount(quest->RequiredItemId[i], true); questStatusData.ItemCount[i] = std::min(curitemcount, reqitemcount); - m_QuestStatusSave[quest->GetQuestId()] = true; + m_QuestStatusSave[quest->GetQuestId()] = QUEST_DEFAULT_SAVE_TYPE; } } } @@ -16327,7 +16355,7 @@ void Player::AreaExploredOrEventHappens(uint32 questId) if (!q_status.Explored) { q_status.Explored = true; - m_QuestStatusSave[questId] = true; + m_QuestStatusSave[questId] = QUEST_DEFAULT_SAVE_TYPE; } } if (CanCompleteQuest(questId)) @@ -16380,7 +16408,7 @@ void Player::ItemAddedQuestCheck(uint32 entry, uint32 count) if (curitemcount < reqitemcount) { q_status.ItemCount[j] = std::min<uint16>(q_status.ItemCount[j] + count, reqitemcount); - m_QuestStatusSave[questid] = true; + m_QuestStatusSave[questid] = QUEST_DEFAULT_SAVE_TYPE; //SendQuestUpdateAddItem(qInfo, j, additemcount); // FIXME: verify if there's any packet sent updating item @@ -16427,7 +16455,7 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count) if (newItemCount != q_status.ItemCount[j]) { q_status.ItemCount[j] = newItemCount; - m_QuestStatusSave[questid] = true; + m_QuestStatusSave[questid] = QUEST_DEFAULT_SAVE_TYPE; IncompleteQuest(questid); } return; @@ -16495,7 +16523,7 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid /*= 0*/) { q_status.CreatureOrGOCount[j] = curkillcount + addkillcount; - m_QuestStatusSave[questid] = true; + m_QuestStatusSave[questid] = QUEST_DEFAULT_SAVE_TYPE; SendQuestUpdateAddCreatureOrGo(qInfo, guid, j, curkillcount, addkillcount); } @@ -16537,7 +16565,7 @@ void Player::KilledPlayerCredit() { q_status.PlayerCount = curkill + addkillcount; - m_QuestStatusSave[questid] = true; + m_QuestStatusSave[questid] = QUEST_DEFAULT_SAVE_TYPE; SendQuestUpdateAddPlayer(qInfo, curkill, addkillcount); } @@ -16589,7 +16617,7 @@ void Player::KillCreditGO(uint32 entry, uint64 guid) { q_status.CreatureOrGOCount[j] = curCastCount + addCastCount; - m_QuestStatusSave[questid] = true; + m_QuestStatusSave[questid] = QUEST_DEFAULT_SAVE_TYPE; SendQuestUpdateAddCreatureOrGo(qInfo, guid, j, curCastCount, addCastCount); } @@ -16646,7 +16674,7 @@ void Player::TalkedToCreature(uint32 entry, uint64 guid) { q_status.CreatureOrGOCount[j] = curTalkCount + addTalkCount; - m_QuestStatusSave[questid] = true; + m_QuestStatusSave[questid] = QUEST_DEFAULT_SAVE_TYPE; SendQuestUpdateAddCreatureOrGo(qInfo, guid, j, curTalkCount, addTalkCount); } @@ -20008,7 +20036,7 @@ void Player::_SaveQuestStatus(SQLTransaction& trans) for (saveItr = m_QuestStatusSave.begin(); saveItr != m_QuestStatusSave.end(); ++saveItr) { - if (saveItr->second) + if (saveItr->second == QUEST_DEFAULT_SAVE_TYPE) { statusItr = m_QuestStatus.find(saveItr->first); if (statusItr != m_QuestStatus.end() && (keepAbandoned || statusItr->second.Status != QUEST_STATUS_NONE)) @@ -20045,7 +20073,7 @@ void Player::_SaveQuestStatus(SQLTransaction& trans) for (saveItr = m_RewardedQuestsSave.begin(); saveItr != m_RewardedQuestsSave.end(); ++saveItr) { - if (saveItr->second) + if (saveItr->second == QUEST_DEFAULT_SAVE_TYPE) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_QUESTSTATUS_REWARDED); stmt->setUInt32(0, GetGUIDLow()); @@ -20053,7 +20081,7 @@ void Player::_SaveQuestStatus(SQLTransaction& trans) trans->Append(stmt); } - else if (!keepAbandoned) + else if (saveItr->second == QUEST_FORCE_DELETE_SAVE_TYPE || !keepAbandoned) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST); stmt->setUInt32(0, GetGUIDLow()); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index ef65558e13c..80128fcc075 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -606,8 +606,16 @@ enum AtLoginFlags typedef std::map<uint32, QuestStatusData> QuestStatusMap; typedef std::set<uint32> RewardedQuestSet; -// quest, keep -typedef std::map<uint32, bool> QuestStatusSaveMap; +enum QuestSaveType +{ + QUEST_DEFAULT_SAVE_TYPE = 0, + QUEST_DELETE_SAVE_TYPE, + QUEST_FORCE_DELETE_SAVE_TYPE +}; + +// quest +typedef std::map<uint32, QuestSaveType> QuestStatusSaveMap; + enum QuestSlotOffsets { @@ -1061,6 +1069,19 @@ struct BGData bool HasTaxiPath() const { return taxiPath[0] && taxiPath[1]; } }; +struct TradeStatusInfo +{ + TradeStatusInfo() : Status(TRADE_STATUS_BUSY), TraderGuid(0), Result(EQUIP_ERR_OK), + IsTargetResult(false), ItemLimitCategoryId(0), Slot(0) { } + + TradeStatus Status; + ObjectGuid TraderGuid; + InventoryResult Result; + bool IsTargetResult; + uint32 ItemLimitCategoryId; + uint8 Slot; +}; + struct VoidStorageItem { VoidStorageItem() @@ -1232,12 +1253,12 @@ class Player : public Unit, public GridObject<Player> explicit Player(WorldSession* session); ~Player(); - void CleanupsBeforeDelete(bool finalCleanup = true); + void CleanupsBeforeDelete(bool finalCleanup = true) override; - void AddToWorld(); - void RemoveFromWorld(); + void AddToWorld() override; + void RemoveFromWorld() override; - void SetObjectScale(float scale) + void SetObjectScale(float scale) override { Unit::SetObjectScale(scale); SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, scale * DEFAULT_WORLD_OBJECT_SIZE); @@ -1253,14 +1274,14 @@ class Player : public Unit, public GridObject<Player> bool Create(uint32 guidlow, CharacterCreateInfo* createInfo); - void Update(uint32 time); + void Update(uint32 time) override; static bool BuildEnumData(PreparedQueryResult result, ByteBuffer* dataBuffer, ByteBuffer* bitBuffer); void SetInWater(bool apply); - bool IsInWater() const { return m_isInWater; } - bool IsUnderWater() const; + bool IsInWater() const override { return m_isInWater; } + bool IsUnderWater() const override; void SendInitialPacketsBeforeAddToMap(); void SendInitialPacketsAfterAddToMap(); @@ -1319,7 +1340,7 @@ class Player : public Unit, public GridObject<Player> uint32 GetTotalPlayedTime() { return m_Played_time[PLAYED_TIME_TOTAL]; } uint32 GetLevelPlayedTime() { return m_Played_time[PLAYED_TIME_LEVEL]; } - void setDeathState(DeathState s); // overwrite Unit::setDeathState + void setDeathState(DeathState s) override; // overwrite Unit::setDeathState void InnEnter(time_t time, uint32 mapid, float x, float y, float z); @@ -1356,7 +1377,7 @@ class Player : public Unit, public GridObject<Player> /*********************************************************/ void SetVirtualItemSlot(uint8 i, Item* item); - void SetSheath(SheathState sheathed); // overwrite Unit version + void SetSheath(SheathState sheathed) override; // overwrite Unit version uint8 FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const; uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = NULL) const; uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = NULL) const; @@ -1386,11 +1407,11 @@ class Player : public Unit, public GridObject<Player> bool CanNoReagentCast(SpellInfo const* spellInfo) const; bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const; bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const; - InventoryResult CanTakeMoreSimilarItems(Item* pItem) const { return CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem); } - InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return CanTakeMoreSimilarItems(entry, count, NULL); } + InventoryResult CanTakeMoreSimilarItems(Item* pItem, uint32* itemLimitCategory = NULL) const { return CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem, NULL, itemLimitCategory); } + InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, uint32* itemLimitCategory = NULL) const { return CanTakeMoreSimilarItems(entry, count, NULL, NULL, itemLimitCategory); } InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = NULL) const; InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap = false) const; - InventoryResult CanStoreItems(Item** pItem, int count) const; + InventoryResult CanStoreItems(Item** items, int count, uint32* itemLimitCategory) const; InventoryResult CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const; InventoryResult CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool swap, bool not_loading = true) const; @@ -1414,7 +1435,7 @@ class Player : public Unit, public GridObject<Player> void AutoStoreLoot(uint32 loot_id, LootStore const& store, bool broadcast = false) { AutoStoreLoot(NULL_BAG, NULL_SLOT, loot_id, store, broadcast); } void StoreLootItem(uint8 lootSlot, Loot* loot); - InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const; + InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL, uint32* itemLimitCategory = NULL) const; InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const; void AddRefundReference(uint32 it); @@ -1653,7 +1674,7 @@ class Player : public Unit, public GridObject<Player> /*********************************************************/ bool LoadFromDB(uint32 guid, SQLQueryHolder *holder); - bool isBeingLoaded() const; + bool isBeingLoaded() const override; void Initialize(uint32 guid); static uint32 GetUInt32ValueFromArray(Tokenizer const& data, uint16 index); @@ -1758,7 +1779,7 @@ class Player : public Unit, public GridObject<Player> void PossessSpellInitialize(); void VehicleSpellInitialize(); void SendRemoveControlBar(); - bool HasSpell(uint32 spell) const; + bool HasSpell(uint32 spell) const override; bool HasActiveSpell(uint32 spell) const; // show in spellbook TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const; bool IsSpellFitByClassAndRace(uint32 spell_id) const; @@ -1854,7 +1875,7 @@ class Player : public Unit, public GridObject<Player> void AddSpellCooldown(uint32 spell_id, uint32 itemid, time_t end_time); void ModifySpellCooldown(uint32 spellId, int32 cooldown); void SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId = 0, Spell* spell = NULL, bool setCooldown = true); - void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs); + void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) override; void RemoveSpellCooldown(uint32 spell_id, bool update = false); void RemoveSpellCategoryCooldown(uint32 cat, bool update = false); void SendClearCooldown(uint32 spell_id, Unit* target); @@ -1975,14 +1996,14 @@ class Player : public Unit, public GridObject<Player> float GetHealthBonusFromStamina(); float GetManaBonusFromIntellect(); - bool UpdateStats(Stats stat); - bool UpdateAllStats(); + bool UpdateStats(Stats stat) override; + bool UpdateAllStats() override; void ApplySpellPenetrationBonus(int32 amount, bool apply); - void UpdateResistances(uint32 school); - void UpdateArmor(); - void UpdateMaxHealth(); - void UpdateMaxPower(Powers power); - void UpdateAttackPowerAndDamage(bool ranged = false); + void UpdateResistances(uint32 school) override; + void UpdateArmor() override; + void UpdateMaxHealth() override; + void UpdateMaxPower(Powers power) override; + void UpdateAttackPowerAndDamage(bool ranged = false) override; void ApplySpellPowerBonus(int32 amount, bool apply); void UpdateSpellDamageAndHealingBonus(); void ApplyRatingMod(CombatRating cr, int32 value, bool apply); @@ -2032,8 +2053,8 @@ class Player : public Unit, public GridObject<Player> WorldSession* GetSession() const { return m_session; } - void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const; - void DestroyForPlayer(Player* target, bool onDeath = false) const; + void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const override; + void DestroyForPlayer(Player* target, bool onDeath = false) const override; void SendLogXPGain(uint32 GivenXP, Unit* victim, uint32 BonusXP, bool recruitAFriend = false, float group_rate=1.0f); // notifiers @@ -2052,14 +2073,14 @@ class Player : public Unit, public GridObject<Player> void SendResetInstanceFailed(uint32 reason, uint32 MapId); void SendResetFailedNotify(uint32 mapid); - virtual bool UpdatePosition(float x, float y, float z, float orientation, bool teleport = false); + virtual bool UpdatePosition(float x, float y, float z, float orientation, bool teleport = false) override; bool UpdatePosition(const Position &pos, bool teleport = false) { return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); } - void UpdateUnderwaterState(Map* m, float x, float y, float z); + void UpdateUnderwaterState(Map* m, float x, float y, float z) override; - void SendMessageToSet(WorldPacket* data, bool self) {SendMessageToSetInRange(data, GetVisibilityRange(), self); };// overwrite Object::SendMessageToSet - void SendMessageToSetInRange(WorldPacket* data, float fist, bool self);// overwrite Object::SendMessageToSetInRange + void SendMessageToSet(WorldPacket* data, bool self) override {SendMessageToSetInRange(data, GetVisibilityRange(), self); };// overwrite Object::SendMessageToSet + void SendMessageToSetInRange(WorldPacket* data, float fist, bool self) override;// overwrite Object::SendMessageToSetInRange void SendMessageToSetInRange(WorldPacket* data, float dist, bool self, bool own_team_only); - void SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr); + void SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr) override; Corpse* GetCorpse() const; void SpawnCorpseBones(); @@ -2221,6 +2242,7 @@ class Player : public Unit, public GridObject<Player> std::vector<ItemSetEffect*> ItemSetEff; void SendLoot(uint64 guid, LootType loot_type); + void SendLootError(uint64 guid, LootError error); void SendLootRelease(uint64 guid); void SendNotifyLootItemRemoved(uint8 lootSlot); void SendNotifyLootMoneyRemoved(); @@ -2360,12 +2382,12 @@ class Player : public Unit, public GridObject<Player> bool HaveAtClient(WorldObject const* u) const; - bool IsNeverVisible() const; + bool IsNeverVisible() const override; bool IsVisibleGloballyFor(Player const* player) const; void SendInitialVisiblePackets(Unit* target); - void UpdateObjectVisibility(bool forced = true); + void UpdateObjectVisibility(bool forced = true) override; void UpdateVisibilityForPlayer(); void UpdateVisibilityOf(WorldObject* target); void UpdateTriggerVisibility(); @@ -2462,8 +2484,8 @@ class Player : public Unit, public GridObject<Player> MapReference &GetMapRef() { return m_mapRef; } // Set map to player and add reference - void SetMap(Map* map); - void ResetMap(); + void SetMap(Map* map) override; + void ResetMap() override; bool isAllowedToLoot(const Creature* creature); @@ -2822,9 +2844,9 @@ class Player : public Unit, public GridObject<Player> Runes *m_runes; EquipmentSets m_EquipmentSets; - bool CanAlwaysSee(WorldObject const* obj) const; + bool CanAlwaysSee(WorldObject const* obj) const override; - bool IsAlwaysDetectableFor(WorldObject const* seer) const; + bool IsAlwaysDetectableFor(WorldObject const* seer) const override; uint8 m_grantableLevels; diff --git a/src/server/game/Entities/Totem/Totem.h b/src/server/game/Entities/Totem/Totem.h index 5a2f3f5773a..1d79eb3a3df 100644 --- a/src/server/game/Entities/Totem/Totem.h +++ b/src/server/game/Entities/Totem/Totem.h @@ -40,25 +40,25 @@ class Totem : public Minion public: Totem(SummonPropertiesEntry const* properties, Unit* owner); virtual ~Totem() { } - void Update(uint32 time); - void InitStats(uint32 duration); - void InitSummon(); - void UnSummon(uint32 msTime = 0); + void Update(uint32 time) override; + void InitStats(uint32 duration) override; + void InitSummon() override; + void UnSummon(uint32 msTime = 0) override; uint32 GetSpell(uint8 slot = 0) const { return m_spells[slot]; } uint32 GetTotemDuration() const { return m_duration; } void SetTotemDuration(uint32 duration) { m_duration = duration; } TotemType GetTotemType() const { return m_type; } - bool UpdateStats(Stats /*stat*/) { return true; } - bool UpdateAllStats() { return true; } - void UpdateResistances(uint32 /*school*/) { } - void UpdateArmor() { } - void UpdateMaxHealth() { } - void UpdateMaxPower(Powers /*power*/) { } - void UpdateAttackPowerAndDamage(bool /*ranged*/) { } + bool UpdateStats(Stats /*stat*/) override { return true; } + bool UpdateAllStats() override { return true; } + void UpdateResistances(uint32 /*school*/) override { } + void UpdateArmor() override { } + void UpdateMaxHealth() override { } + void UpdateMaxPower(Powers /*power*/) override { } + void UpdateAttackPowerAndDamage(bool /*ranged*/) override { } void UpdateDamagePhysical(WeaponAttackType /*attType*/) override { } - bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; + bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const override; protected: TotemType m_type; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f096170c46d..843cc937baa 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11983,7 +11983,7 @@ void Unit::DeleteCharmInfo() } CharmInfo::CharmInfo(Unit* unit) -: _unit(unit), _CommandState(COMMAND_FOLLOW), _petnumber(0), _barInit(false), _oldReactState(REACT_PASSIVE), +: _unit(unit), _CommandState(COMMAND_FOLLOW), _petnumber(0), _oldReactState(REACT_PASSIVE), _isCommandAttack(false), _isCommandFollow(false), _isAtStay(false), _isFollowing(false), _isReturning(false), _stayX(0.0f), _stayY(0.0f), _stayZ(0.0f) { @@ -13651,8 +13651,6 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) if (creature) { Loot* loot = &creature->loot; - if (creature->loot.loot_type == LOOT_PICKPOCKETING) - creature->ResetPickPocketRefillTimer(); loot->clear(); if (uint32 lootid = creature->GetCreatureTemplate()->lootid) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 035c3a6aa0e..d5e732989e0 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1211,7 +1211,6 @@ struct CharmInfo CharmSpellInfo _charmspells[4]; CommandStates _CommandState; uint32 _petnumber; - bool _barInit; //for restoration after charmed ReactStates _oldReactState; @@ -1302,8 +1301,8 @@ class Unit : public WorldObject UnitAI* GetAI() { return i_AI; } void SetAI(UnitAI* newAI) { i_AI = newAI; } - void AddToWorld(); - void RemoveFromWorld(); + void AddToWorld() override; + void RemoveFromWorld() override; void CleanupBeforeRemoveFromMap(bool finalCleanup); void CleanupsBeforeDelete(bool finalCleanup = true) override; // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units) @@ -1318,7 +1317,7 @@ class Unit : public WorldObject float GetSpellMaxRangeForTarget(Unit const* target, SpellInfo const* spellInfo) const; float GetSpellMinRangeForTarget(Unit const* target, SpellInfo const* spellInfo) const; - virtual void Update(uint32 time); + virtual void Update(uint32 time) override; void setAttackTimer(WeaponAttackType type, uint32 time) { m_attackTimer[type] = time; } void resetAttackTimer(WeaponAttackType type = BASE_ATTACK); @@ -1374,7 +1373,7 @@ class Unit : public WorldObject bool IsVehicle() const { return (m_unitTypeMask & UNIT_MASK_VEHICLE) != 0; } uint8 getLevel() const { return uint8(GetUInt32Value(UNIT_FIELD_LEVEL)); } - uint8 getLevelForTarget(WorldObject const* /*target*/) const { return getLevel(); } + uint8 getLevelForTarget(WorldObject const* /*target*/) const override { return getLevel(); } void SetLevel(uint8 lvl); uint8 getRace() const { return GetByteValue(UNIT_FIELD_BYTES_0, 0); } uint32 getRaceMask() const { return 1 << (getRace()-1); } @@ -1929,7 +1928,7 @@ class Unit : public WorldObject // common function for visibility checks for player/creatures with detection code void SetInPhase(uint32 id, bool update, bool apply); - void UpdateObjectVisibility(bool forced = true); + void UpdateObjectVisibility(bool forced = true) override; SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY]; uint32 m_lastSanctuaryTime; @@ -2114,7 +2113,7 @@ class Unit : public WorldObject bool IsOnVehicle(const Unit* vehicle) const; Unit* GetVehicleBase() const; Creature* GetVehicleCreatureBase() const; - uint64 GetTransGUID() const; + uint64 GetTransGUID() const override; /// Returns the transport this unit is on directly (if on vehicle and transport, return vehicle) TransportBase* GetDirectTransport() const; @@ -2170,7 +2169,7 @@ class Unit : public WorldObject protected: explicit Unit (bool isWorldObject); - void BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, Player* target) const; + void BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, Player* target) const override; UnitAI* i_AI, *i_disabledAI; @@ -2239,8 +2238,8 @@ class Unit : public WorldObject uint32 m_unitTypeMask; LiquidTypeEntry const* _lastLiquid; - bool IsAlwaysVisibleFor(WorldObject const* seer) const; - bool IsAlwaysDetectableFor(WorldObject const* seer) const; + bool IsAlwaysVisibleFor(WorldObject const* seer) const override; + bool IsAlwaysDetectableFor(WorldObject const* seer) const override; void DisableSpline(); private: diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h index 36119fa0027..be008330f0c 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.h +++ b/src/server/game/Entities/Vehicle/Vehicle.h @@ -89,7 +89,7 @@ class Vehicle : public TransportBase void InitMovementInfoForBase(); /// This method transforms supplied transport offsets into global coordinates - void CalculatePassengerPosition(float& x, float& y, float& z, float* o /*= NULL*/) const + void CalculatePassengerPosition(float& x, float& y, float& z, float* o /*= NULL*/) const override { TransportBase::CalculatePassengerPosition(x, y, z, o, GetBase()->GetPositionX(), GetBase()->GetPositionY(), @@ -97,7 +97,7 @@ class Vehicle : public TransportBase } /// This method transforms supplied global coordinates into local offsets - void CalculatePassengerOffset(float& x, float& y, float& z, float* o /*= NULL*/) const + void CalculatePassengerOffset(float& x, float& y, float& z, float* o /*= NULL*/) const override { TransportBase::CalculatePassengerOffset(x, y, z, o, GetBase()->GetPositionX(), GetBase()->GetPositionY(), @@ -126,8 +126,8 @@ class VehicleJoinEvent : public BasicEvent protected: VehicleJoinEvent(Vehicle* v, Unit* u) : Target(v), Passenger(u), Seat(Target->Seats.end()) { } ~VehicleJoinEvent(); - bool Execute(uint64, uint32); - void Abort(uint64); + bool Execute(uint64, uint32) override; + void Abort(uint64) override; Vehicle* Target; Unit* Passenger; diff --git a/src/server/game/Grids/GridStates.h b/src/server/game/Grids/GridStates.h index af11ab08d5e..330b74ec65e 100644 --- a/src/server/game/Grids/GridStates.h +++ b/src/server/game/Grids/GridStates.h @@ -34,24 +34,24 @@ class GridState class InvalidState : public GridState { public: - void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const; + void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const override; }; class ActiveState : public GridState { public: - void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const; + void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const override; }; class IdleState : public GridState { public: - void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const; + void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const override; }; class RemovalState : public GridState { public: - void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const; + void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const override; }; #endif diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index 2929c05cace..2a7295b641e 100644 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -133,7 +133,7 @@ class Roll : public LootValidatorRef ~Roll(); void setLoot(Loot* pLoot); Loot* getLoot(); - void targetObjectBuildLink(); + void targetObjectBuildLink() override; uint64 itemGUID; uint32 itemid; diff --git a/src/server/game/Groups/GroupReference.h b/src/server/game/Groups/GroupReference.h index df5683b3edf..dc8480e9463 100644 --- a/src/server/game/Groups/GroupReference.h +++ b/src/server/game/Groups/GroupReference.h @@ -28,9 +28,9 @@ class GroupReference : public Reference<Group, Player> { protected: uint8 iSubGroup; - void targetObjectBuildLink(); - void targetObjectDestroyLink(); - void sourceObjectDestroyLink(); + void targetObjectBuildLink() override; + void targetObjectDestroyLink() override; + void sourceObjectDestroyLink() override; public: GroupReference() : Reference<Group, Player>(), iSubGroup(0) { } ~GroupReference() { unlink(); } diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index d62907ddde5..da5f16d38c5 100644 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -458,8 +458,8 @@ private: ~EventLogEntry() { } - void SaveToDB(SQLTransaction& trans) const; - void WritePacket(WorldPacket& data, ByteBuffer& content) const; + void SaveToDB(SQLTransaction& trans) const override; + void WritePacket(WorldPacket& data, ByteBuffer& content) const override; private: GuildEventLogTypes m_eventType; @@ -496,8 +496,8 @@ private: ~BankEventLogEntry() { } - void SaveToDB(SQLTransaction& trans) const; - void WritePacket(WorldPacket& data, ByteBuffer& content) const; + void SaveToDB(SQLTransaction& trans) const override; + void WritePacket(WorldPacket& data, ByteBuffer& content) const override; private: GuildBankEventLogTypes m_eventType; @@ -711,13 +711,13 @@ private: PlayerMoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) : MoveItemData(guild, player, container, slotId) { } - bool IsBank() const { return false; } - bool InitItem(); - void RemoveItem(SQLTransaction& trans, MoveItemData* pOther, uint32 splitedAmount = 0); - Item* StoreItem(SQLTransaction& trans, Item* pItem); - void LogBankEvent(SQLTransaction& trans, MoveItemData* pFrom, uint32 count) const; + bool IsBank() const override { return false; } + bool InitItem() override; + void RemoveItem(SQLTransaction& trans, MoveItemData* pOther, uint32 splitedAmount = 0) override; + Item* StoreItem(SQLTransaction& trans, Item* pItem) override; + void LogBankEvent(SQLTransaction& trans, MoveItemData* pFrom, uint32 count) const override; protected: - InventoryResult CanStore(Item* pItem, bool swap); + InventoryResult CanStore(Item* pItem, bool swap) override; }; class BankMoveItemData : public MoveItemData @@ -726,17 +726,17 @@ private: BankMoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) : MoveItemData(guild, player, container, slotId) { } - bool IsBank() const { return true; } - bool InitItem(); - bool HasStoreRights(MoveItemData* pOther) const; - bool HasWithdrawRights(MoveItemData* pOther) const; - void RemoveItem(SQLTransaction& trans, MoveItemData* pOther, uint32 splitedAmount); - Item* StoreItem(SQLTransaction& trans, Item* pItem); - void LogBankEvent(SQLTransaction& trans, MoveItemData* pFrom, uint32 count) const; - void LogAction(MoveItemData* pFrom) const; + bool IsBank() const override { return true; } + bool InitItem() override; + bool HasStoreRights(MoveItemData* pOther) const override; + bool HasWithdrawRights(MoveItemData* pOther) const override; + void RemoveItem(SQLTransaction& trans, MoveItemData* pOther, uint32 splitedAmount) override; + Item* StoreItem(SQLTransaction& trans, Item* pItem) override; + void LogBankEvent(SQLTransaction& trans, MoveItemData* pFrom, uint32 count) const override; + void LogAction(MoveItemData* pFrom) const override; protected: - InventoryResult CanStore(Item* pItem, bool swap); + InventoryResult CanStore(Item* pItem, bool swap) override; private: Item* _StoreItem(SQLTransaction& trans, BankTab* pTab, Item* pItem, ItemPosCount& pos, bool clone) const; diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index 7c3d9e99eee..692f5b80953 100644 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -83,10 +83,9 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData) Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid); bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->loot.loot_type == LOOT_PICKPOCKETING); - if (!lootAllowed || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) { - player->SendLootRelease(lguid); + player->SendLootError(lguid, lootAllowed ? LOOT_ERROR_TOO_FAR : LOOT_ERROR_DIDNT_KILL); return; } @@ -156,6 +155,8 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/) if (creature->IsAlive()) shareMoney = false; } + else + player->SendLootError(guid, lootAllowed ? LOOT_ERROR_TOO_FAR : LOOT_ERROR_DIDNT_KILL); break; } default: @@ -403,21 +404,28 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) if (!_player->GetGroup() || _player->GetGroup()->GetMasterLooterGuid() != _player->GetGUID() || _player->GetGroup()->GetLootMethod() != MASTER_LOOT) { - _player->SendLootRelease(GetPlayer()->GetLootGUID()); + _player->SendLootError(lootguid, LOOT_ERROR_DIDNT_KILL); return; } Player* target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(target_playerguid, 0, HIGHGUID_PLAYER)); if (!target) + { + _player->SendLootError(lootguid, LOOT_ERROR_PLAYER_NOT_FOUND); return; + } TC_LOG_DEBUG("network", "WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName().c_str()); if (_player->GetLootGUID() != lootguid) + { + _player->SendLootError(lootguid, LOOT_ERROR_DIDNT_KILL); return; + } if (!_player->IsInRaidWith(target) || !_player->IsInMap(target)) { + _player->SendLootError(lootguid, LOOT_ERROR_MASTER_OTHER); TC_LOG_INFO("loot", "MasterLootItem: Player %s tried to give an item to ineligible player %s !", GetPlayer()->GetName().c_str(), target->GetName().c_str()); return; } @@ -459,16 +467,21 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) msg = EQUIP_ERR_CANT_EQUIP_EVER; if (msg != EQUIP_ERR_OK) { + if (msg == EQUIP_ERR_ITEM_MAX_COUNT) + _player->SendLootError(lootguid, LOOT_ERROR_MASTER_UNIQUE_ITEM); + else if (msg == EQUIP_ERR_INV_FULL) + _player->SendLootError(lootguid, LOOT_ERROR_MASTER_INV_FULL); + else + _player->SendLootError(lootguid, LOOT_ERROR_MASTER_OTHER); + target->SendEquipError(msg, NULL, NULL, item.itemid); - // send duplicate of error massage to master looter - _player->SendEquipError(msg, NULL, NULL, item.itemid); return; } // list of players allowed to receive this item in trade AllowedLooterSet looters = item.GetAllowedLooters(); - // not move item from loot to target inventory + // now move item from loot to target inventory Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomPropertyId, looters); target->SendNewItem(newitem, uint32(item.count), false, false, true); target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count); @@ -476,8 +489,8 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item.itemid, item.count); // mark as looted - item.count=0; - item.is_looted=true; + item.count = 0; + item.is_looted = true; loot->NotifyItemRemoved(slotid); --loot->unlootedCount; diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 04e64634d88..b0e0d60803b 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -578,7 +578,7 @@ void WorldSession::HandleSelfResOpcode(WorldPacket& /*recvData*/) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)); if (spellInfo) - _player->CastSpell(_player, spellInfo, false, 0); + _player->CastSpell(_player, spellInfo, false, nullptr); _player->SetUInt32Value(PLAYER_SELF_RES_SPELL, 0); } diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index f6c403acb66..f4aca0528a0 100644 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -30,43 +30,50 @@ #include "Language.h" #include "AccountMgr.h" -void WorldSession::SendTradeStatus(TradeStatus status, int8 clearSlot) +void WorldSession::SendTradeStatus(TradeStatusInfo const& info) { - WorldPacket data; - Player* trader = GetPlayer()->GetTrader(); - data.Initialize(SMSG_TRADE_STATUS, 1+4+4); + WorldPacket data(SMSG_TRADE_STATUS, 13); data.WriteBit(trader ? (trader->GetSession()->GetBattlenetAccountId() == GetBattlenetAccountId()) : 0); // IsSameBnetAccount, used for trading heirlooms and other battle.net bound items with your other accounts - data.WriteBits(status, 5); + data.WriteBits(info.Status, 5); - switch (status) + switch (info.Status) { case TRADE_STATUS_BEGIN_TRADE: - data.WriteBits(0, 8); // Trader Guid - data.FlushBits(); + data.WriteBit(info.TraderGuid[2]); + data.WriteBit(info.TraderGuid[4]); + data.WriteBit(info.TraderGuid[6]); + data.WriteBit(info.TraderGuid[0]); + data.WriteBit(info.TraderGuid[1]); + data.WriteBit(info.TraderGuid[3]); + data.WriteBit(info.TraderGuid[7]); + data.WriteBit(info.TraderGuid[5]); + + data.WriteByteSeq(info.TraderGuid[4]); + data.WriteByteSeq(info.TraderGuid[1]); + data.WriteByteSeq(info.TraderGuid[2]); + data.WriteByteSeq(info.TraderGuid[3]); + data.WriteByteSeq(info.TraderGuid[0]); + data.WriteByteSeq(info.TraderGuid[7]); + data.WriteByteSeq(info.TraderGuid[6]); + data.WriteByteSeq(info.TraderGuid[5]); break; case TRADE_STATUS_OPEN_WINDOW: - data.FlushBits(); - data << uint32(0); // Trade Id + data << uint32(0); // CGTradeInfo::m_tradeID break; case TRADE_STATUS_CLOSE_WINDOW: - data.WriteBit(0); // Error bool (0 = Target, 1 = Self) - data.FlushBits(); - data << uint32(0); // Error Item (Relevant item to the error) - data << uint32(0); // InventoryResult + data.WriteBit(info.IsTargetResult); // bool isTargetError; used for: EQUIP_ERR_BAG_FULL, EQUIP_ERR_CANT_CARRY_MORE_OF_THIS, EQUIP_ERR_MISSING_REAGENT, EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED + data << uint32(info.Result); // InventoryResult + data << uint32(info.ItemLimitCategoryId); // ItemLimitCategory.dbc entry break; - case TRADE_STATUS_ONLY_CONJURED: // Not Implemented - case TRADE_STATUS_NOT_ELIGIBLE: - // Used when trading loot soulbound items with people that are not eligible (TRADE_STATUS_NOT_ELIGIBLE), - // and when trying to trade items with players in other realms when in a cross realm BG, you can only trade conjured goods with them (TRADE_STATUS_ONLY_CONJURED) - data.FlushBits(); - data << int8(clearSlot); // Trade slot to clear, -1 = Clear the money amount + case TRADE_STATUS_WRONG_REALM: + case TRADE_STATUS_NOT_ON_TAPLIST: + data << uint8(info.Slot); // Trade slot; -1 here clears CGTradeInfo::m_tradeMoney break; case TRADE_STATUS_CURRENCY: // Not implemented case TRADE_STATUS_CURRENCY_NOT_TRADABLE: // Not implemented // Blizzard never implemented these, you can only trade currency with the field9 & 1 in CurrencyTypes.DBC, and only two test currencies have that flag - data.FlushBits(); data << uint32(0); // Trading Currency Id data << uint32(0); // Trading Currency Amount default: @@ -99,7 +106,7 @@ void WorldSession::SendUpdateTrade(bool trader_data /*= true*/) ++count; WorldPacket data(SMSG_TRADE_STATUS_EXTENDED, 4*6 + 8 + 1 + 3 + count * 70); - data << uint32(0); // this value must be equal to value from TRADE_STATUS_OPEN_WINDOW status packet (different value for different players to block multiple trades?) + data << uint32(0); // CGTradeInfo::m_tradeID data << uint32(0); // unk 2 data << uint64(view_trade->GetMoney()); // trader gold data << uint32(view_trade->GetSpell()); // spell casted on lowest slot item @@ -337,14 +344,15 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) Item* myItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL }; Item* hisItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL }; - bool myCanCompleteTrade = true, hisCanCompleteTrade = true; // set before checks for propertly undo at problems (it already set in to client) my_trade->SetAccepted(true); + TradeStatusInfo info; if (!_player->IsWithinDistInMap(trader, TRADE_DISTANCE, false)) { - SendTradeStatus(TRADE_STATUS_TARGET_TO_FAR); + info.Status = TRADE_STATUS_TARGET_TO_FAR; + SendTradeStatus(info); my_trade->SetAccepted(false); return; } @@ -352,7 +360,9 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) // not accept case incorrect money amount if (!_player->HasEnoughMoney(my_trade->GetMoney())) { - SendNotification(LANG_NOT_ENOUGH_GOLD); + info.Status = TRADE_STATUS_CLOSE_WINDOW; + info.Result = EQUIP_ERR_NOT_ENOUGH_MONEY; + SendTradeStatus(info); my_trade->SetAccepted(false, true); return; } @@ -360,21 +370,27 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) // not accept case incorrect money amount if (!trader->HasEnoughMoney(his_trade->GetMoney())) { - trader->GetSession()->SendNotification(LANG_NOT_ENOUGH_GOLD); + info.Status = TRADE_STATUS_CLOSE_WINDOW; + info.Result = EQUIP_ERR_NOT_ENOUGH_MONEY; + trader->GetSession()->SendTradeStatus(info); his_trade->SetAccepted(false, true); return; } if (_player->GetMoney() >= uint64(MAX_MONEY_AMOUNT) - his_trade->GetMoney()) { - _player->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL); + info.Status = TRADE_STATUS_CLOSE_WINDOW; + info.Result = EQUIP_ERR_TOO_MUCH_GOLD; + SendTradeStatus(info); my_trade->SetAccepted(false, true); return; } if (trader->GetMoney() >= uint64(MAX_MONEY_AMOUNT) - my_trade->GetMoney()) { - trader->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL); + info.Status = TRADE_STATUS_CLOSE_WINDOW; + info.Result = EQUIP_ERR_TOO_MUCH_GOLD; + trader->GetSession()->SendTradeStatus(info); his_trade->SetAccepted(false, true); return; } @@ -386,14 +402,16 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) { if (!item->CanBeTraded(false, true)) { - SendTradeStatus(TRADE_STATUS_TRADE_CANCELED); + info.Status = TRADE_STATUS_TRADE_CANCELED; + SendTradeStatus(info); return; } if (item->IsBindedNotWith(trader)) { - SendTradeStatus(TRADE_STATUS_NOT_ELIGIBLE); - SendTradeStatus(TRADE_STATUS_CLOSE_WINDOW/*TRADE_STATUS_TRADE_CANCELED*/); + info.Status = TRADE_STATUS_CLOSE_WINDOW; + info.Result = EQUIP_ERR_TRADE_BOUND_ITEM; + SendTradeStatus(info); return; } } @@ -402,7 +420,8 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) { if (!item->CanBeTraded(false, true)) { - SendTradeStatus(TRADE_STATUS_TRADE_CANCELED); + info.Status = TRADE_STATUS_TRADE_CANCELED; + SendTradeStatus(info); return; } //if (item->IsBindedNotWith(_player)) // dont mark as invalid when his item isnt good (not exploitable because if item is invalid trade will fail anyway later on the same check) @@ -497,31 +516,37 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) } // inform partner client - trader->GetSession()->SendTradeStatus(TRADE_STATUS_TRADE_ACCEPT); + info.Status = TRADE_STATUS_TRADE_ACCEPT; + trader->GetSession()->SendTradeStatus(info); // test if item will fit in each inventory - hisCanCompleteTrade = (trader->CanStoreItems(myItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK); - myCanCompleteTrade = (_player->CanStoreItems(hisItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK); + TradeStatusInfo myCanCompleteInfo, hisCanCompleteInfo; + hisCanCompleteInfo.Result = trader->CanStoreItems(myItems, TRADE_SLOT_TRADED_COUNT, &hisCanCompleteInfo.ItemLimitCategoryId); + myCanCompleteInfo.Result = _player->CanStoreItems(hisItems, TRADE_SLOT_TRADED_COUNT, &myCanCompleteInfo.ItemLimitCategoryId); clearAcceptTradeMode(myItems, hisItems); // in case of missing space report error - if (!myCanCompleteTrade) + if (myCanCompleteInfo.Result != EQUIP_ERR_OK) { clearAcceptTradeMode(my_trade, his_trade); - SendNotification(LANG_NOT_FREE_TRADE_SLOTS); - trader->GetSession()->SendNotification(LANG_NOT_PARTNER_FREE_TRADE_SLOTS); + myCanCompleteInfo.Status = TRADE_STATUS_CLOSE_WINDOW; + trader->GetSession()->SendTradeStatus(myCanCompleteInfo); + myCanCompleteInfo.IsTargetResult = true; + SendTradeStatus(myCanCompleteInfo); my_trade->SetAccepted(false); his_trade->SetAccepted(false); return; } - else if (!hisCanCompleteTrade) + else if (hisCanCompleteInfo.Result != EQUIP_ERR_OK) { clearAcceptTradeMode(my_trade, his_trade); - SendNotification(LANG_NOT_PARTNER_FREE_TRADE_SLOTS); - trader->GetSession()->SendNotification(LANG_NOT_FREE_TRADE_SLOTS); + hisCanCompleteInfo.Status = TRADE_STATUS_CLOSE_WINDOW; + SendTradeStatus(hisCanCompleteInfo); + hisCanCompleteInfo.IsTargetResult = true; + trader->GetSession()->SendTradeStatus(hisCanCompleteInfo); my_trade->SetAccepted(false); his_trade->SetAccepted(false); return; @@ -590,12 +615,14 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) trader->SaveInventoryAndGoldToDB(trans); CharacterDatabase.CommitTransaction(trans); - trader->GetSession()->SendTradeStatus(TRADE_STATUS_TRADE_COMPLETE); - SendTradeStatus(TRADE_STATUS_TRADE_COMPLETE); + info.Status = TRADE_STATUS_TRADE_COMPLETE; + trader->GetSession()->SendTradeStatus(info); + SendTradeStatus(info); } else { - trader->GetSession()->SendTradeStatus(TRADE_STATUS_TRADE_ACCEPT); + info.Status = TRADE_STATUS_TRADE_ACCEPT; + trader->GetSession()->SendTradeStatus(info); } } @@ -614,8 +641,10 @@ void WorldSession::HandleBeginTradeOpcode(WorldPacket& /*recvPacket*/) if (!my_trade) return; - my_trade->GetTrader()->GetSession()->SendTradeStatus(TRADE_STATUS_OPEN_WINDOW); - SendTradeStatus(TRADE_STATUS_OPEN_WINDOW); + TradeStatusInfo info; + info.Status = TRADE_STATUS_OPEN_WINDOW; + my_trade->GetTrader()->GetSession()->SendTradeStatus(info); + SendTradeStatus(info); } void WorldSession::SendCancelTrade() @@ -623,7 +652,9 @@ void WorldSession::SendCancelTrade() if (PlayerRecentlyLoggedOut() || PlayerLogout()) return; - SendTradeStatus(TRADE_STATUS_TRADE_CANCELED); + TradeStatusInfo info; + info.Status = TRADE_STATUS_TRADE_CANCELED; + SendTradeStatus(info); } void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/) @@ -658,27 +689,32 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) if (GetPlayer()->m_trade) return; + TradeStatusInfo info; if (!GetPlayer()->IsAlive()) { - SendTradeStatus(TRADE_STATUS_YOU_DEAD); + info.Status = TRADE_STATUS_YOU_DEAD; + SendTradeStatus(info); return; } if (GetPlayer()->HasUnitState(UNIT_STATE_STUNNED)) { - SendTradeStatus(TRADE_STATUS_YOU_STUNNED); + info.Status = TRADE_STATUS_YOU_STUNNED; + SendTradeStatus(info); return; } if (isLogingOut()) { - SendTradeStatus(TRADE_STATUS_YOU_LOGOUT); + info.Status = TRADE_STATUS_YOU_LOGOUT; + SendTradeStatus(info); return; } if (GetPlayer()->IsInFlight()) { - SendTradeStatus(TRADE_STATUS_TARGET_TO_FAR); + info.Status = TRADE_STATUS_TARGET_TO_FAR; + SendTradeStatus(info); return; } @@ -692,55 +728,64 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) if (!pOther) { - SendTradeStatus(TRADE_STATUS_NO_TARGET); + info.Status = TRADE_STATUS_NO_TARGET; + SendTradeStatus(info); return; } if (pOther == GetPlayer() || pOther->m_trade) { - SendTradeStatus(TRADE_STATUS_BUSY); + info.Status = TRADE_STATUS_BUSY; + SendTradeStatus(info); return; } if (!pOther->IsAlive()) { - SendTradeStatus(TRADE_STATUS_TARGET_DEAD); + info.Status = TRADE_STATUS_TARGET_DEAD; + SendTradeStatus(info); return; } if (pOther->IsInFlight()) { - SendTradeStatus(TRADE_STATUS_TARGET_TO_FAR); + info.Status = TRADE_STATUS_TARGET_TO_FAR; + SendTradeStatus(info); return; } if (pOther->HasUnitState(UNIT_STATE_STUNNED)) { - SendTradeStatus(TRADE_STATUS_TARGET_STUNNED); + info.Status = TRADE_STATUS_TARGET_STUNNED; + SendTradeStatus(info); return; } if (pOther->GetSession()->isLogingOut()) { - SendTradeStatus(TRADE_STATUS_TARGET_LOGOUT); + info.Status = TRADE_STATUS_TARGET_LOGOUT; + SendTradeStatus(info); return; } if (pOther->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow())) { - SendTradeStatus(TRADE_STATUS_IGNORE_YOU); + info.Status = TRADE_STATUS_IGNORE_YOU; + SendTradeStatus(info); return; } if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeam() !=_player->GetTeam()) { - SendTradeStatus(TRADE_STATUS_WRONG_FACTION); + info.Status = TRADE_STATUS_WRONG_FACTION; + SendTradeStatus(info); return; } if (!pOther->IsWithinDistInMap(_player, TRADE_DISTANCE, false)) { - SendTradeStatus(TRADE_STATUS_TARGET_TO_FAR); + info.Status = TRADE_STATUS_TARGET_TO_FAR; + SendTradeStatus(info); return; } @@ -754,31 +799,9 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) _player->m_trade = new TradeData(_player, pOther); pOther->m_trade = new TradeData(pOther, _player); - WorldPacket data(SMSG_TRADE_STATUS, 2+7); - data.WriteBit(0); // unk bit, usually 0 - data.WriteBits(TRADE_STATUS_BEGIN_TRADE, 5); - - ObjectGuid playerGuid = _player->GetGUID(); - // WTB StartBitStream... - data.WriteBit(playerGuid[2]); - data.WriteBit(playerGuid[4]); - data.WriteBit(playerGuid[6]); - data.WriteBit(playerGuid[0]); - data.WriteBit(playerGuid[1]); - data.WriteBit(playerGuid[3]); - data.WriteBit(playerGuid[7]); - data.WriteBit(playerGuid[5]); - - data.WriteByteSeq(playerGuid[4]); - data.WriteByteSeq(playerGuid[1]); - data.WriteByteSeq(playerGuid[2]); - data.WriteByteSeq(playerGuid[3]); - data.WriteByteSeq(playerGuid[0]); - data.WriteByteSeq(playerGuid[7]); - data.WriteByteSeq(playerGuid[6]); - data.WriteByteSeq(playerGuid[5]); - - pOther->GetSession()->SendPacket(&data); + info.Status = TRADE_STATUS_BEGIN_TRADE; + info.TraderGuid = _player->GetGUID(); + pOther->GetSession()->SendTradeStatus(info); } void WorldSession::HandleSetTradeGoldOpcode(WorldPacket& recvPacket) @@ -808,10 +831,12 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket) if (!my_trade) return; + TradeStatusInfo info; // invalid slot number if (tradeSlot >= TRADE_SLOT_COUNT) { - SendTradeStatus(TRADE_STATUS_TRADE_CANCELED); + info.Status = TRADE_STATUS_TRADE_CANCELED; + SendTradeStatus(info); return; } @@ -819,7 +844,8 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket) Item* item = _player->GetItemByPos(bag, slot); if (!item || (tradeSlot != TRADE_SLOT_NONTRADED && !item->CanBeTraded(false, true))) { - SendTradeStatus(TRADE_STATUS_TRADE_CANCELED); + info.Status = TRADE_STATUS_TRADE_CANCELED; + SendTradeStatus(info); return; } @@ -829,14 +855,16 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket) if (my_trade->HasItem(iGUID)) { // cheating attempt - SendTradeStatus(TRADE_STATUS_TRADE_CANCELED); + info.Status = TRADE_STATUS_TRADE_CANCELED; + SendTradeStatus(info); return; } - if (item->IsBindedNotWith(GetPlayer()->GetTrader())) + if (slot != TRADE_SLOT_NONTRADED && item->IsBindedNotWith(my_trade->GetTrader())) { - // The item is BOP tradeable but the trader wasn't eligible to get it. - SendTradeStatus(TRADE_STATUS_NOT_ELIGIBLE, tradeSlot); + info.Status = TRADE_STATUS_NOT_ON_TAPLIST; + info.Slot = tradeSlot; + SendTradeStatus(info); return; } diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index cb3b9082c20..09809d50b10 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -92,6 +92,23 @@ enum LootType LOOT_FISHING_JUNK = 22 // unsupported by client, sending LOOT_FISHING instead }; +enum LootError +{ + LOOT_ERROR_DIDNT_KILL = 0, // You don't have permission to loot that corpse. + LOOT_ERROR_TOO_FAR = 4, // You are too far away to loot that corpse. + LOOT_ERROR_BAD_FACING = 5, // You must be facing the corpse to loot it. + LOOT_ERROR_LOCKED = 6, // Someone is already looting that corpse. + LOOT_ERROR_NOTSTANDING = 8, // You need to be standing up to loot something! + LOOT_ERROR_STUNNED = 9, // You can't loot anything while stunned! + LOOT_ERROR_PLAYER_NOT_FOUND = 10, // Player not found + LOOT_ERROR_PLAY_TIME_EXCEEDED = 11, // Maximum play time exceeded + LOOT_ERROR_MASTER_INV_FULL = 12, // That player's inventory is full + LOOT_ERROR_MASTER_UNIQUE_ITEM = 13, // Player has too many of that item already + LOOT_ERROR_MASTER_OTHER = 14, // Can't assign item to that player + LOOT_ERROR_ALREADY_PICKPOCKETED = 15, // Your target has already had its pockets picked + LOOT_ERROR_NOT_WHILE_SHAPESHIFTED = 16 // You can't do that while shapeshifted. +}; + // type of Loot Item in Loot View enum LootSlotType { @@ -263,8 +280,8 @@ class LootValidatorRef : public Reference<Loot, LootValidatorRef> { public: LootValidatorRef() { } - void targetObjectDestroyLink() { } - void sourceObjectDestroyLink() { } + void targetObjectDestroyLink() override { } + void sourceObjectDestroyLink() override { } }; //===================================================== diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 75301da32ed..61773656642 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2216,7 +2216,7 @@ bool Map::IsOutdoors(float x, float y, float z) const if (!GetAreaInfo(x, y, z, mogpFlags, adtId, rootId, groupId)) return true; - AreaTableEntry const* atEntry = 0; + AreaTableEntry const* atEntry = nullptr; WMOAreaTableEntry const* wmoEntry= GetWMOAreaTableEntryByTripple(rootId, adtId, groupId); if (wmoEntry) { @@ -2249,8 +2249,8 @@ uint16 Map::GetAreaFlag(float x, float y, float z, bool *isOutdoors) const { uint32 mogpFlags; int32 adtId, rootId, groupId; - WMOAreaTableEntry const* wmoEntry = 0; - AreaTableEntry const* atEntry = 0; + WMOAreaTableEntry const* wmoEntry = nullptr; + AreaTableEntry const* atEntry = nullptr; bool haveAreaInfo = false; if (GetAreaInfo(x, y, z, mogpFlags, adtId, rootId, groupId)) diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index c194f4dccd7..a92c78ae951 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -334,16 +334,16 @@ class Map : public GridRefManager<NGridType> // can return INVALID_HEIGHT if under z+2 z coord not found height float GetHeight(float x, float y, float z, bool checkVMap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const; - ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0) const; + ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = nullptr) const; - uint16 GetAreaFlag(float x, float y, float z, bool *isOutdoors=0) const; + uint16 GetAreaFlag(float x, float y, float z, bool *isOutdoors=nullptr) const; bool GetAreaInfo(float x, float y, float z, uint32 &mogpflags, int32 &adtId, int32 &rootId, int32 &groupId) const; bool IsOutdoors(float x, float y, float z) const; uint8 GetTerrainType(float x, float y) const; float GetWaterLevel(float x, float y) const; - bool IsInWater(float x, float y, float z, LiquidData* data = 0) const; + bool IsInWater(float x, float y, float z, LiquidData* data = nullptr) const; bool IsUnderWater(float x, float y, float z) const; static uint32 GetAreaIdByAreaFlag(uint16 areaflag, uint32 map_id); @@ -680,23 +680,23 @@ class InstanceMap : public Map public: InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map* _parent); ~InstanceMap(); - bool AddPlayerToMap(Player*); - void RemovePlayerFromMap(Player*, bool); - void Update(const uint32); + bool AddPlayerToMap(Player*) override; + void RemovePlayerFromMap(Player*, bool) override; + void Update(const uint32) override; void CreateInstanceData(bool load); bool Reset(uint8 method); uint32 GetScriptId() { return i_script_id; } InstanceScript* GetInstanceScript() { return i_data; } void PermBindAllPlayers(Player* source); - void UnloadAll(); - bool CanEnter(Player* player); + void UnloadAll() override; + bool CanEnter(Player* player) override; void SendResetWarnings(uint32 timeLeft) const; void SetResetSchedule(bool on); uint32 GetMaxPlayers() const; uint32 GetMaxResetDelay() const; - virtual void InitVisibilityDistance(); + virtual void InitVisibilityDistance() override; private: bool m_resetAfterUnload; bool m_unloadWhenEmpty; @@ -710,14 +710,14 @@ class BattlegroundMap : public Map BattlegroundMap(uint32 id, time_t, uint32 InstanceId, Map* _parent, uint8 spawnMode); ~BattlegroundMap(); - bool AddPlayerToMap(Player*); - void RemovePlayerFromMap(Player*, bool); - bool CanEnter(Player* player); + bool AddPlayerToMap(Player*) override; + void RemovePlayerFromMap(Player*, bool) override; + bool CanEnter(Player* player) override; void SetUnload(); //void UnloadAll(bool pForce); - void RemoveAllPlayers(); + void RemoveAllPlayers() override; - virtual void InitVisibilityDistance(); + virtual void InitVisibilityDistance() override; Battleground* GetBG() { return m_bg; } void SetBG(Battleground* bg) { m_bg = bg; } private: diff --git a/src/server/game/Maps/MapInstanced.h b/src/server/game/Maps/MapInstanced.h index 30aec43cc21..614764dbba3 100644 --- a/src/server/game/Maps/MapInstanced.h +++ b/src/server/game/Maps/MapInstanced.h @@ -33,11 +33,11 @@ class MapInstanced : public Map ~MapInstanced() { } // functions overwrite Map versions - void Update(const uint32); - void DelayedUpdate(const uint32 diff); + void Update(const uint32) override; + void DelayedUpdate(const uint32 diff) override; //void RelocationNotify(); - void UnloadAll(); - bool CanEnter(Player* player); + void UnloadAll() override; + bool CanEnter(Player* player) override; Map* CreateInstanceForPlayer(const uint32 mapId, Player* player); Map* FindInstanceMap(uint32 instanceId) const @@ -61,7 +61,7 @@ class MapInstanced : public Map } InstancedMaps &GetInstancedMaps() { return m_InstancedMaps; } - virtual void InitVisibilityDistance(); + virtual void InitVisibilityDistance() override; private: InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty); diff --git a/src/server/game/Maps/MapReference.h b/src/server/game/Maps/MapReference.h index fe5ceb714c5..2742902d558 100644 --- a/src/server/game/Maps/MapReference.h +++ b/src/server/game/Maps/MapReference.h @@ -25,18 +25,18 @@ class MapReference : public Reference<Map, Player> { protected: - void targetObjectBuildLink() + void targetObjectBuildLink() override { // called from link() getTarget()->m_mapRefManager.insertFirst(this); getTarget()->m_mapRefManager.incSize(); } - void targetObjectDestroyLink() + void targetObjectDestroyLink() override { // called from unlink() if (isValid()) getTarget()->m_mapRefManager.decSize(); } - void sourceObjectDestroyLink() + void sourceObjectDestroyLink() override { // called from invalidate() getTarget()->m_mapRefManager.decSize(); diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 833e4f7c7bc..da48d749cab 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -3889,7 +3889,7 @@ enum TradeStatus { TRADE_STATUS_OPEN_WINDOW = 0, // 1 - Related to EVENT_PLAYER_MONEY - TRADE_STATUS_NOT_ELIGIBLE = 2, // Related to trading soulbound loot items + TRADE_STATUS_NOT_ON_TAPLIST = 2, // Related to trading soulbound loot items TRADE_STATUS_YOU_LOGOUT = 3, TRADE_STATUS_IGNORE_YOU = 4, TRADE_STATUS_TARGET_DEAD = 5, @@ -3913,7 +3913,7 @@ enum TradeStatus TRADE_STATUS_TRADE_CANCELED = 23, TRADE_STATUS_CURRENCY = 24, // new 4.x TRADE_STATUS_BACK_TO_TRADE = 25, - TRADE_STATUS_ONLY_CONJURED = 26, // You can only trade conjured items... (cross realm BG related). + TRADE_STATUS_WRONG_REALM = 26, // You can only trade conjured items... (cross realm BG related). TRADE_STATUS_YOU_STUNNED = 27, // 28 - nonexistent TRADE_STATUS_TARGET_STUNNED = 29, diff --git a/src/server/game/Movement/FollowerReference.h b/src/server/game/Movement/FollowerReference.h index a97104ce72c..ee6901dc2d7 100644 --- a/src/server/game/Movement/FollowerReference.h +++ b/src/server/game/Movement/FollowerReference.h @@ -27,8 +27,8 @@ class Unit; class FollowerReference : public Reference<Unit, TargetedMovementGeneratorBase> { protected: - void targetObjectBuildLink(); - void targetObjectDestroyLink(); - void sourceObjectDestroyLink(); + void targetObjectBuildLink() override; + void targetObjectDestroyLink() override; + void sourceObjectDestroyLink() override; }; #endif diff --git a/src/server/game/Movement/MovementGenerator.h b/src/server/game/Movement/MovementGenerator.h index 12116b5505d..d87344ba089 100755 --- a/src/server/game/Movement/MovementGenerator.h +++ b/src/server/game/Movement/MovementGenerator.h @@ -51,25 +51,25 @@ template<class T, class D> class MovementGeneratorMedium : public MovementGenerator { public: - void Initialize(Unit* u) + void Initialize(Unit* u) override { //u->AssertIsType<T>(); (static_cast<D*>(this))->DoInitialize(static_cast<T*>(u)); } - void Finalize(Unit* u) + void Finalize(Unit* u) override { //u->AssertIsType<T>(); (static_cast<D*>(this))->DoFinalize(static_cast<T*>(u)); } - void Reset(Unit* u) + void Reset(Unit* u) override { //u->AssertIsType<T>(); (static_cast<D*>(this))->DoReset(static_cast<T*>(u)); } - bool Update(Unit* u, uint32 time_diff) + bool Update(Unit* u, uint32 time_diff) override { //u->AssertIsType<T>(); return (static_cast<D*>(this))->DoUpdate(static_cast<T*>(u), time_diff); @@ -86,7 +86,7 @@ struct MovementGeneratorFactory : public SelectableMovement { MovementGeneratorFactory(MovementGeneratorType mgt) : SelectableMovement(mgt) { } - MovementGenerator* Create(void *) const; + MovementGenerator* Create(void *) const override; }; typedef FactoryHolder<MovementGenerator, MovementGeneratorType> MovementGeneratorCreator; diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h index ba8e228873f..c3bcfffb2a7 100755 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h @@ -49,9 +49,9 @@ class TimedFleeingMovementGenerator : public FleeingMovementGenerator<Creature> FleeingMovementGenerator<Creature>(fright), i_totalFleeTime(time) { } - MovementGeneratorType GetMovementGeneratorType() { return TIMED_FLEEING_MOTION_TYPE; } - bool Update(Unit*, uint32); - void Finalize(Unit*); + MovementGeneratorType GetMovementGeneratorType() override { return TIMED_FLEEING_MOTION_TYPE; } + bool Update(Unit*, uint32) override; + void Finalize(Unit*) override; private: TimeTracker i_totalFleeTime; diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h index abe97e21536..8e0b0e335c4 100644 --- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h @@ -38,7 +38,7 @@ class HomeMovementGenerator<Creature> : public MovementGeneratorMedium< Creature void DoFinalize(Creature*); void DoReset(Creature*); bool DoUpdate(Creature*, const uint32); - MovementGeneratorType GetMovementGeneratorType() { return HOME_MOTION_TYPE; } + MovementGeneratorType GetMovementGeneratorType() override { return HOME_MOTION_TYPE; } private: void _setTargetLocation(Creature*); diff --git a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h index bdf9d52b93a..0cd9b2777b4 100755 --- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h @@ -25,11 +25,11 @@ class IdleMovementGenerator : public MovementGenerator { public: - void Initialize(Unit*); - void Finalize(Unit*) { } - void Reset(Unit*); - bool Update(Unit*, uint32) { return true; } - MovementGeneratorType GetMovementGeneratorType() { return IDLE_MOTION_TYPE; } + void Initialize(Unit*) override; + void Finalize(Unit*) override { } + void Reset(Unit*) override; + bool Update(Unit*, uint32) override { return true; } + MovementGeneratorType GetMovementGeneratorType() override { return IDLE_MOTION_TYPE; } }; extern IdleMovementGenerator si_idleMovement; @@ -39,11 +39,11 @@ class RotateMovementGenerator : public MovementGenerator public: explicit RotateMovementGenerator(uint32 time, RotateDirection direction) : m_duration(time), m_maxDuration(time), m_direction(direction) { } - void Initialize(Unit*); - void Finalize(Unit*); - void Reset(Unit* owner) { Initialize(owner); } - bool Update(Unit*, uint32); - MovementGeneratorType GetMovementGeneratorType() { return ROTATE_MOTION_TYPE; } + void Initialize(Unit*) override; + void Finalize(Unit*) override; + void Reset(Unit* owner) override { Initialize(owner); } + bool Update(Unit*, uint32) override; + MovementGeneratorType GetMovementGeneratorType() override { return ROTATE_MOTION_TYPE; } private: uint32 m_duration, m_maxDuration; @@ -55,11 +55,11 @@ class DistractMovementGenerator : public MovementGenerator public: explicit DistractMovementGenerator(uint32 timer) : m_timer(timer) { } - void Initialize(Unit*); - void Finalize(Unit*); - void Reset(Unit* owner) { Initialize(owner); } - bool Update(Unit*, uint32); - MovementGeneratorType GetMovementGeneratorType() { return DISTRACT_MOTION_TYPE; } + void Initialize(Unit*) override; + void Finalize(Unit*) override; + void Reset(Unit* owner) override { Initialize(owner); } + bool Update(Unit*, uint32) override; + MovementGeneratorType GetMovementGeneratorType() override { return DISTRACT_MOTION_TYPE; } private: uint32 m_timer; @@ -71,8 +71,8 @@ class AssistanceDistractMovementGenerator : public DistractMovementGenerator AssistanceDistractMovementGenerator(uint32 timer) : DistractMovementGenerator(timer) { } - MovementGeneratorType GetMovementGeneratorType() { return ASSISTANCE_DISTRACT_MOTION_TYPE; } - void Finalize(Unit*); + MovementGeneratorType GetMovementGeneratorType() override { return ASSISTANCE_DISTRACT_MOTION_TYPE; } + void Finalize(Unit*) override; }; #endif diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h index c596b406cf3..3c5b33f3736 100644 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h @@ -55,8 +55,8 @@ class AssistanceMovementGenerator : public PointMovementGenerator<Creature> AssistanceMovementGenerator(float _x, float _y, float _z) : PointMovementGenerator<Creature>(0, _x, _y, _z, true) { } - MovementGeneratorType GetMovementGeneratorType() { return ASSISTANCE_MOTION_TYPE; } - void Finalize(Unit*); + MovementGeneratorType GetMovementGeneratorType() override { return ASSISTANCE_MOTION_TYPE; } + void Finalize(Unit*) override; }; // Does almost nothing - just doesn't allows previous movegen interrupt current effect. @@ -64,11 +64,11 @@ class EffectMovementGenerator : public MovementGenerator { public: explicit EffectMovementGenerator(uint32 Id) : m_Id(Id) { } - void Initialize(Unit*) { } - void Finalize(Unit*); - void Reset(Unit*) { } - bool Update(Unit*, uint32); - MovementGeneratorType GetMovementGeneratorType() { return EFFECT_MOTION_TYPE; } + void Initialize(Unit*) override { } + void Finalize(Unit*) override; + void Reset(Unit*) override { } + bool Update(Unit*, uint32) override; + MovementGeneratorType GetMovementGeneratorType() override { return EFFECT_MOTION_TYPE; } private: uint32 m_Id; }; diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h index 9b5fe14b9d6..85c39fe0830 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h @@ -72,7 +72,7 @@ class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Crea void MovementInform(Creature*); - MovementGeneratorType GetMovementGeneratorType() { return WAYPOINT_MOTION_TYPE; } + MovementGeneratorType GetMovementGeneratorType() override { return WAYPOINT_MOTION_TYPE; } // now path movement implmementation void LoadPath(Creature*); @@ -126,7 +126,7 @@ class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, Flig void DoReset(Player*); void DoFinalize(Player*); bool DoUpdate(Player*, uint32); - MovementGeneratorType GetMovementGeneratorType() { return FLIGHT_MOTION_TYPE; } + MovementGeneratorType GetMovementGeneratorType() override { return FLIGHT_MOTION_TYPE; } TaxiPathNodeList const& GetPath() { return *i_path; } uint32 GetPathAtMapEnd() const; diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index 2820c5dee17..21af63868db 100644 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -78,6 +78,7 @@ void WaypointMgr::Load() if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX) { TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", wp->id); + delete wp; continue; } @@ -134,13 +135,14 @@ void WaypointMgr::ReloadPath(uint32 id) wp->z = z; wp->orientation = o; wp->move_type = fields[5].GetUInt32(); - + if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX) { TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", wp->id); + delete wp; continue; } - + wp->delay = fields[6].GetUInt32(); wp->event_id = fields[7].GetUInt32(); wp->event_chance = fields[8].GetUInt8(); diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h index b7c08d51bda..b4e546164d0 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.h +++ b/src/server/game/OutdoorPvP/OutdoorPvP.h @@ -217,9 +217,9 @@ class OutdoorPvP : public ZoneScript // setup stuff virtual bool SetupOutdoorPvP() {return true;} - void OnGameObjectCreate(GameObject* go); - void OnGameObjectRemove(GameObject* go); - void OnCreatureCreate(Creature*) { } + void OnGameObjectCreate(GameObject* go) override; + void OnGameObjectRemove(GameObject* go) override; + void OnCreatureCreate(Creature*) override { } // send world state update to all players present void SendUpdateWorldState(uint32 field, uint32 value); diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 7c82b806cf8..3ccc876e1a2 100644 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -824,10 +824,9 @@ void Map::ScriptsProcess() } Creature* cTarget = NULL; - if (source) //using grid searcher + WorldObject* wSource = dynamic_cast <WorldObject*> (source); + if (wSource) //using grid searcher { - WorldObject* wSource = dynamic_cast <WorldObject*> (source); - CellCoord p(Trinity::ComputeCellCoord(wSource->GetPositionX(), wSource->GetPositionY())); Cell cell(p); diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 6d0be13c35e..a6201bb7d51 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -32,6 +32,7 @@ #include "CreatureAIImpl.h" #include "Player.h" #include "WorldPacket.h" +#include "WorldSession.h" namespace { @@ -407,44 +408,42 @@ void ScriptMgr::OnSocketOpen(std::shared_ptr<WorldSocket> socket) FOREACH_SCRIPT(ServerScript)->OnSocketOpen(socket); } -void ScriptMgr::OnSocketClose(std::shared_ptr<WorldSocket> socket, bool wasNew) +void ScriptMgr::OnSocketClose(std::shared_ptr<WorldSocket> socket) { ASSERT(socket); - FOREACH_SCRIPT(ServerScript)->OnSocketClose(socket, wasNew); + FOREACH_SCRIPT(ServerScript)->OnSocketClose(socket); } -void ScriptMgr::OnPacketReceive(std::shared_ptr<WorldSocket> socket, WorldPacket const& packet) +void ScriptMgr::OnPacketReceive(WorldSession* session, WorldPacket const& packet) { - ASSERT(socket); - if (SCR_REG_LST(ServerScript).empty()) return; WorldPacket copy(packet); - FOREACH_SCRIPT(ServerScript)->OnPacketReceive(socket, copy); + FOREACH_SCRIPT(ServerScript)->OnPacketReceive(session, copy); } -void ScriptMgr::OnPacketSend(std::shared_ptr<WorldSocket> socket, WorldPacket const& packet) +void ScriptMgr::OnPacketSend(WorldSession* session, WorldPacket const& packet) { - ASSERT(socket); + ASSERT(session); if (SCR_REG_LST(ServerScript).empty()) return; WorldPacket copy(packet); - FOREACH_SCRIPT(ServerScript)->OnPacketSend(socket, copy); + FOREACH_SCRIPT(ServerScript)->OnPacketSend(session, copy); } -void ScriptMgr::OnUnknownPacketReceive(std::shared_ptr<WorldSocket> socket, WorldPacket const& packet) +void ScriptMgr::OnUnknownPacketReceive(WorldSession* session, WorldPacket const& packet) { - ASSERT(socket); + ASSERT(session); if (SCR_REG_LST(ServerScript).empty()) return; WorldPacket copy(packet); - FOREACH_SCRIPT(ServerScript)->OnUnknownPacketReceive(socket, copy); + FOREACH_SCRIPT(ServerScript)->OnUnknownPacketReceive(session, copy); } void ScriptMgr::OnOpenStateChange(bool open) diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 104410a1345..9f52aec848f 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -59,6 +59,7 @@ class Vehicle; class WorldPacket; class WorldSocket; class WorldObject; +class WorldSession; struct AuctionEntry; struct ConditionSourceInfo; @@ -196,7 +197,7 @@ class SpellScriptLoader : public ScriptObject public: - bool IsDatabaseBound() const final { return true; } + bool IsDatabaseBound() const final override { return true; } // Should return a fully valid SpellScript pointer. virtual SpellScript* GetSpellScript() const { return NULL; } @@ -224,19 +225,19 @@ class ServerScript : public ScriptObject // Called when a socket is closed. Do not store the socket object, and do not rely on the connection // being open; it is not. - virtual void OnSocketClose(std::shared_ptr<WorldSocket> /*socket*/, bool /*wasNew*/) { } + virtual void OnSocketClose(std::shared_ptr<WorldSocket> /*socket*/) { } // Called when a packet is sent to a client. The packet object is a copy of the original packet, so reading // and modifying it is safe. - virtual void OnPacketSend(std::shared_ptr<WorldSocket> /*socket*/, WorldPacket& /*packet*/) { } + virtual void OnPacketSend(WorldSession* /*session*/, WorldPacket& /*packet*/) { } // Called when a (valid) packet is received by a client. The packet object is a copy of the original packet, so - // reading and modifying it is safe. - virtual void OnPacketReceive(std::shared_ptr<WorldSocket> /*socket*/, WorldPacket& /*packet*/) { } + // reading and modifying it is safe. Make sure to check WorldSession pointer before usage, it might be null in case of auth packets + virtual void OnPacketReceive(WorldSession* /*session*/, WorldPacket& /*packet*/) { } // Called when an invalid (unknown opcode) packet is received by a client. The packet is a reference to the orignal // packet; not a copy. This allows you to actually handle unknown packets (for whatever purpose). - virtual void OnUnknownPacketReceive(std::shared_ptr<WorldSocket> /*socket*/, WorldPacket& /*packet*/) { } + virtual void OnUnknownPacketReceive(WorldSession* /*session*/, WorldPacket& /*packet*/) { } }; class WorldScript : public ScriptObject @@ -354,7 +355,7 @@ class InstanceMapScript : public ScriptObject, public MapScript<InstanceMap> public: - bool IsDatabaseBound() const final { return true; } + bool IsDatabaseBound() const final override { return true; } // Gets an InstanceScript object for this instance. virtual InstanceScript* GetInstanceScript(InstanceMap* /*map*/) const { return NULL; } @@ -375,7 +376,7 @@ class ItemScript : public ScriptObject public: - bool IsDatabaseBound() const final { return true; } + bool IsDatabaseBound() const final override { return true; } // Called when a dummy spell effect is triggered on the item. virtual bool OnDummyEffect(Unit* /*caster*/, uint32 /*spellId*/, SpellEffIndex /*effIndex*/, Item* /*target*/) { return false; } @@ -424,7 +425,7 @@ class CreatureScript : public UnitScript, public UpdatableScript<Creature> public: - bool IsDatabaseBound() const final { return true; } + bool IsDatabaseBound() const final override { return true; } // Called when a dummy spell effect is triggered on the creature. virtual bool OnDummyEffect(Unit* /*caster*/, uint32 /*spellId*/, SpellEffIndex /*effIndex*/, Creature* /*target*/) { return false; } @@ -465,7 +466,7 @@ class GameObjectScript : public ScriptObject, public UpdatableScript<GameObject> public: - bool IsDatabaseBound() const final { return true; } + bool IsDatabaseBound() const final override { return true; } // Called when a dummy spell effect is triggered on the gameobject. virtual bool OnDummyEffect(Unit* /*caster*/, uint32 /*spellId*/, SpellEffIndex /*effIndex*/, GameObject* /*target*/) { return false; } @@ -512,7 +513,7 @@ class AreaTriggerScript : public ScriptObject public: - bool IsDatabaseBound() const final { return true; } + bool IsDatabaseBound() const final override { return true; } // Called when the area trigger is activated by a player. virtual bool OnTrigger(Player* /*player*/, AreaTriggerEntry const* /*trigger*/) { return false; } @@ -526,7 +527,7 @@ class BattlegroundScript : public ScriptObject public: - bool IsDatabaseBound() const final { return true; } + bool IsDatabaseBound() const final override { return true; } // Should return a fully valid Battleground object for the type ID. virtual Battleground* GetBattleground() const = 0; @@ -540,7 +541,7 @@ class OutdoorPvPScript : public ScriptObject public: - bool IsDatabaseBound() const final { return true; } + bool IsDatabaseBound() const final override { return true; } // Should return a fully valid OutdoorPvP object for the type ID. virtual OutdoorPvP* GetOutdoorPvP() const = 0; @@ -566,7 +567,7 @@ class WeatherScript : public ScriptObject, public UpdatableScript<Weather> public: - bool IsDatabaseBound() const final { return true; } + bool IsDatabaseBound() const final override { return true; } // Called when the weather changes in the zone this script is associated with. virtual void OnChange(Weather* /*weather*/, WeatherState /*state*/, float /*grade*/) { } @@ -601,7 +602,7 @@ class ConditionScript : public ScriptObject public: - bool IsDatabaseBound() const final { return true; } + bool IsDatabaseBound() const final override { return true; } // Called when a single condition is checked for a player. virtual bool OnConditionCheck(Condition* /*condition*/, ConditionSourceInfo& /*sourceInfo*/) { return true; } @@ -649,7 +650,7 @@ class TransportScript : public ScriptObject, public UpdatableScript<Transport> public: - bool IsDatabaseBound() const final { return true; } + bool IsDatabaseBound() const final override { return true; } // Called when a player boards the transport. virtual void OnAddPassenger(Transport* /*transport*/, Player* /*player*/) { } @@ -672,7 +673,7 @@ class AchievementCriteriaScript : public ScriptObject public: - bool IsDatabaseBound() const final { return true; } + bool IsDatabaseBound() const final override { return true; } // Called when an additional criteria is checked. virtual bool OnCheck(Player* source, Unit* target) = 0; @@ -804,7 +805,7 @@ class GuildScript : public ScriptObject public: - bool IsDatabaseBound() const final { return false; } + bool IsDatabaseBound() const final override { return false; } // Called when a member is added to the guild. virtual void OnAddMember(Guild* /*guild*/, Player* /*player*/, uint8& /*plRank*/) { } @@ -847,7 +848,7 @@ class GroupScript : public ScriptObject public: - bool IsDatabaseBound() const final { return false; } + bool IsDatabaseBound() const final override { return false; } // Called when a member is added to a group. virtual void OnAddMember(Group* /*group*/, uint64 /*guid*/) { } @@ -908,10 +909,10 @@ class ScriptMgr void OnNetworkStart(); void OnNetworkStop(); void OnSocketOpen(std::shared_ptr<WorldSocket> socket); - void OnSocketClose(std::shared_ptr<WorldSocket> socket, bool wasNew); - void OnPacketReceive(std::shared_ptr<WorldSocket> socket, WorldPacket const& packet); - void OnPacketSend(std::shared_ptr<WorldSocket> socket, WorldPacket const& packet); - void OnUnknownPacketReceive(std::shared_ptr<WorldSocket> socket, WorldPacket const& packet); + void OnSocketClose(std::shared_ptr<WorldSocket> socket); + void OnPacketReceive(WorldSession* session, WorldPacket const& packet); + void OnPacketSend(WorldSession* session, WorldPacket const& packet); + void OnUnknownPacketReceive(WorldSession* session, WorldPacket const& packet); public: /* WorldScript */ diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp index 0d0dd07edf9..9c0bdd5d558 100644 --- a/src/server/game/Server/Protocol/PacketLog.cpp +++ b/src/server/game/Server/Protocol/PacketLog.cpp @@ -58,7 +58,7 @@ struct PacketHeader PacketLog::PacketLog() : _file(NULL) { - Initialize(); + std::call_once(_initializeFlag, &PacketLog::Initialize, this); } PacketLog::~PacketLog() @@ -99,6 +99,8 @@ void PacketLog::Initialize() void PacketLog::LogPacket(WorldPacket const& packet, Direction direction, boost::asio::ip::address addr, uint16 port) { + std::lock_guard<std::mutex> lock(_logPacketLock); + PacketHeader header; *reinterpret_cast<uint32*>(header.Direction) = direction == CLIENT_TO_SERVER ? 0x47534d43 : 0x47534d53; header.ConnectionId = 0; diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h index b09e853236a..36e8c675f63 100644 --- a/src/server/game/Server/Protocol/PacketLog.h +++ b/src/server/game/Server/Protocol/PacketLog.h @@ -19,7 +19,9 @@ #define TRINITY_PACKETLOG_H #include "Common.h" + #include <boost/asio/ip/address.hpp> +#include <mutex> enum Direction { @@ -34,6 +36,8 @@ class PacketLog private: PacketLog(); ~PacketLog(); + std::mutex _logPacketLock; + std::once_flag _initializeFlag; public: static PacketLog* instance() diff --git a/src/server/game/Server/WorldPacket.h b/src/server/game/Server/WorldPacket.h index 3e812621b48..bdacefabbeb 100644 --- a/src/server/game/Server/WorldPacket.h +++ b/src/server/game/Server/WorldPacket.h @@ -54,6 +54,8 @@ class WorldPacket : public ByteBuffer return *this; } + WorldPacket(Opcodes opcode, MessageBuffer&& buffer) : ByteBuffer(std::move(buffer)), m_opcode(opcode) { } + void Initialize(Opcodes opcode, size_t newres=200) { clear(); @@ -63,6 +65,7 @@ class WorldPacket : public ByteBuffer Opcodes GetOpcode() const { return m_opcode; } void SetOpcode(Opcodes opcode) { m_opcode = opcode; } + bool IsCompressed() const { return m_opcode & COMPRESSED_OPCODE_MASK; } void Compress(z_stream_s* compressionStream); void Compress(z_stream_s* compressionStream, WorldPacket const* source); diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 227555c1dfa..feef22c8a21 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -266,6 +266,8 @@ void WorldSession::SendPacket(WorldPacket* packet, bool forced /*= false*/) } #endif // !TRINITY_DEBUG + sScriptMgr->OnPacketSend(this, *packet); + m_Socket->AsyncWrite(*packet); } @@ -350,7 +352,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) } else if (_player->IsInWorld()) { - sScriptMgr->OnPacketReceive(m_Socket, *packet); + sScriptMgr->OnPacketReceive(this, *packet); (this->*opHandle->Handler)(*packet); LogUnprocessedTail(packet); } @@ -363,7 +365,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) else { // not expected _player or must checked in packet hanlder - sScriptMgr->OnPacketReceive(m_Socket, *packet); + sScriptMgr->OnPacketReceive(this, *packet); (this->*opHandle->Handler)(*packet); LogUnprocessedTail(packet); } @@ -375,7 +377,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) LogUnexpectedOpcode(packet, "STATUS_TRANSFER", "the player is still in world"); else { - sScriptMgr->OnPacketReceive(m_Socket, *packet); + sScriptMgr->OnPacketReceive(this, *packet); (this->*opHandle->Handler)(*packet); LogUnprocessedTail(packet); } @@ -393,7 +395,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) if (packet->GetOpcode() == CMSG_CHAR_ENUM) m_playerRecentlyLogout = false; - sScriptMgr->OnPacketReceive(m_Socket, *packet); + sScriptMgr->OnPacketReceive(this, *packet); (this->*opHandle->Handler)(*packet); LogUnprocessedTail(packet); break; @@ -449,7 +451,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) if (m_Socket && !m_Socket->IsOpen()) { expireTime -= expireTime > diff ? diff : expireTime; - if (expireTime < diff || forceExit) + if (expireTime < diff || forceExit || !GetPlayer()) { m_Socket = nullptr; } @@ -1320,6 +1322,10 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_MESSAGECHAT_YELL: // 0 3.5 case CMSG_INSPECT: // 0 3.5 case CMSG_AREA_SPIRIT_HEALER_QUERY: // not profiled + case CMSG_STANDSTATECHANGE: // not profiled + case MSG_RANDOM_ROLL: // not profiled + case CMSG_TIME_SYNC_RESP: // not profiled + case CMSG_TRAINER_BUY_SPELL: // not profiled { // "0" is a magic number meaning there's no limit for the opcode. // All the opcodes above must cause little CPU usage and no sync/async database queries at all @@ -1348,6 +1354,9 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_CALENDAR_GET_CALENDAR: // 0 1.5 medium upload bandwidth usage case CMSG_GUILD_BANK_QUERY_TAB: // 0 3.5 medium upload bandwidth usage case CMSG_QUERY_INSPECT_ACHIEVEMENTS: // 0 13 high upload bandwidth usage + case CMSG_GAMEOBJ_REPORT_USE: // not profiled + case CMSG_GAMEOBJ_USE: // not profiled + case MSG_PETITION_DECLINE: // not profiled { maxPacketCounterAllowed = 50; break; @@ -1361,8 +1370,7 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_GM_REPORT_LAG: // 1 3 1 async db query case CMSG_SPELLCLICK: // not profiled - case CMSG_GAMEOBJ_USE: // not profiled - case CMSG_GAMEOBJ_REPORT_USE: // not profiled + case CMSG_DISMISS_CONTROLLED_VEHICLE: // not profiled { maxPacketCounterAllowed = 20; break; @@ -1390,7 +1398,6 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_REQUEST_VEHICLE_PREV_SEAT: // not profiled case CMSG_REQUEST_VEHICLE_NEXT_SEAT: // not profiled case CMSG_REQUEST_VEHICLE_SWITCH_SEAT: // not profiled - case CMSG_DISMISS_CONTROLLED_VEHICLE: // not profiled case CMSG_REQUEST_VEHICLE_EXIT: // not profiled case CMSG_EJECT_PASSENGER: // not profiled case CMSG_ITEM_REFUND: // not profiled @@ -1442,11 +1449,9 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_SET_GUILD_BANK_TEXT: // not profiled case MSG_SAVE_GUILD_EMBLEM: // not profiled case MSG_PETITION_RENAME: // not profiled - case MSG_PETITION_DECLINE: // not profiled case MSG_TALENT_WIPE_CONFIRM: // not profiled case MSG_SET_DUNGEON_DIFFICULTY: // not profiled case MSG_SET_RAID_DIFFICULTY: // not profiled - case MSG_RANDOM_ROLL: // not profiled case MSG_PARTY_ASSIGNMENT: // not profiled case MSG_RAID_READY_CHECK: // not profiled { diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index bd159475c37..227be6ec45b 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -53,6 +53,7 @@ struct AuctionEntry; struct DeclinedName; struct ItemTemplate; struct MovementInfo; +struct TradeStatusInfo; namespace lfg { @@ -159,9 +160,9 @@ public: explicit MapSessionFilter(WorldSession* pSession) : PacketFilter(pSession) { } ~MapSessionFilter() { } - virtual bool Process(WorldPacket* packet); + virtual bool Process(WorldPacket* packet) override; //in Map::Update() we do not process player logout! - virtual bool ProcessLogout() const { return false; } + virtual bool ProcessLogout() const override { return false; } }; //class used to filer only thread-unsafe packets from queue @@ -172,7 +173,7 @@ public: explicit WorldSessionFilter(WorldSession* pSession) : PacketFilter(pSession) { } ~WorldSessionFilter() { } - virtual bool Process(WorldPacket* packet); + virtual bool Process(WorldPacket* packet) override; }; // Proxy structure to contain data passed to callback function, @@ -303,7 +304,7 @@ class WorldSession void SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId = BATTLEGROUND_RB); - void SendTradeStatus(TradeStatus status, int8 clearSlot = 0); + void SendTradeStatus(TradeStatusInfo const& status); void SendUpdateTrade(bool trader_data = true); void SendCancelTrade(); diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index e74e7806288..f290a6a8b84 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -34,6 +34,7 @@ WorldSocket::WorldSocket(tcp::socket&& socket) void WorldSocket::Start() { + sScriptMgr->OnSocketOpen(shared_from_this()); AsyncReadHeader(); // not an opcode. this packet sends raw string WORLD OF WARCRAFT CONNECTION - SERVER TO CLIENT" @@ -59,127 +60,108 @@ void WorldSocket::HandleSendAuthSession() AsyncWrite(packet); } -void WorldSocket::ReadHeaderHandler(boost::system::error_code error, size_t transferedBytes) +void WorldSocket::ReadHeaderHandler() { - if (!error && transferedBytes == sizeof(ClientPktHeader)) - { - _authCrypt.DecryptRecv(GetReadBuffer(), sizeof(ClientPktHeader)); + _authCrypt.DecryptRecv(GetHeaderBuffer(), sizeof(ClientPktHeader)); - ClientPktHeader* header = reinterpret_cast<ClientPktHeader*>(GetReadBuffer()); - EndianConvertReverse(header->size); - EndianConvert(header->cmd); + ClientPktHeader* header = reinterpret_cast<ClientPktHeader*>(GetHeaderBuffer()); + EndianConvertReverse(header->size); + EndianConvert(header->cmd); - AsyncReadData(header->size - sizeof(header->cmd), sizeof(ClientPktHeader)); - } - else - CloseSocket(); + AsyncReadData(header->size - sizeof(header->cmd)); } -void WorldSocket::ReadDataHandler(boost::system::error_code error, size_t transferedBytes) +void WorldSocket::ReadDataHandler() { - ClientPktHeader* header = reinterpret_cast<ClientPktHeader*>(GetReadBuffer()); + ClientPktHeader* header = reinterpret_cast<ClientPktHeader*>(GetHeaderBuffer()); - if (!error && transferedBytes == (header->size - sizeof(header->cmd))) - { - header->size -= sizeof(header->cmd); + header->size -= sizeof(header->cmd); Opcodes opcode = PacketFilter::DropHighBytes(Opcodes(header->cmd)); - std::string opcodeName = GetOpcodeNameForLogging(opcode); - - WorldPacket packet(opcode, header->size); + std::string opcodeName = GetOpcodeNameForLogging(opcode); - if (header->size > 0) - { - packet.resize(header->size); - - std::memcpy(packet.contents(), &(GetReadBuffer()[sizeof(ClientPktHeader)]), header->size); - } + WorldPacket packet(opcode, MoveData()); - if (sPacketLog->CanLogPacket()) - sPacketLog->LogPacket(packet, CLIENT_TO_SERVER, GetRemoteIpAddress(), GetRemotePort()); + if (sPacketLog->CanLogPacket()) + sPacketLog->LogPacket(packet, CLIENT_TO_SERVER, GetRemoteIpAddress(), GetRemotePort()); - TC_LOG_TRACE("network.opcode", "C->S: %s %s", (_worldSession ? _worldSession->GetPlayerInfo() : GetRemoteIpAddress().to_string()).c_str(), GetOpcodeNameForLogging(opcode).c_str()); + TC_LOG_TRACE("network.opcode", "C->S: %s %s", (_worldSession ? _worldSession->GetPlayerInfo() : GetRemoteIpAddress().to_string()).c_str(), opcodeName.c_str()); - switch (opcode) - { - case CMSG_PING: - HandlePing(packet); - break; - case CMSG_AUTH_SESSION: - if (_worldSession) - { - TC_LOG_ERROR("network", "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", _worldSession->GetPlayerInfo().c_str()); - break; - } - - sScriptMgr->OnPacketReceive(shared_from_this(), packet); - HandleAuthSession(packet); - break; - case CMSG_KEEP_ALIVE: - TC_LOG_DEBUG("network", "%s", opcodeName.c_str()); - sScriptMgr->OnPacketReceive(shared_from_this(), packet); - break; - case CMSG_LOG_DISCONNECT: - packet.rfinish(); // contains uint32 disconnectReason; - TC_LOG_DEBUG("network", "%s", opcodeName.c_str()); - sScriptMgr->OnPacketReceive(shared_from_this(), packet); - return; - // not an opcode, client sends string "WORLD OF WARCRAFT CONNECTION - CLIENT TO SERVER" without opcode - // first 4 bytes become the opcode (2 dropped) - case MSG_VERIFY_CONNECTIVITY: + switch (opcode) + { + case CMSG_PING: + HandlePing(packet); + break; + case CMSG_AUTH_SESSION: + if (_worldSession) { - TC_LOG_DEBUG("network", "%s", opcodeName.c_str()); - sScriptMgr->OnPacketReceive(shared_from_this(), packet); - std::string str; - packet >> str; - if (str != "D OF WARCRAFT CONNECTION - CLIENT TO SERVER") - { - CloseSocket(); - break; - } - - HandleSendAuthSession(); + TC_LOG_ERROR("network", "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", _worldSession->GetPlayerInfo().c_str()); break; } - case CMSG_ENABLE_NAGLE: + + HandleAuthSession(packet); + break; + case CMSG_KEEP_ALIVE: + TC_LOG_DEBUG("network", "%s", opcodeName.c_str()); + sScriptMgr->OnPacketReceive(_worldSession, packet); + break; + case CMSG_LOG_DISCONNECT: + packet.rfinish(); // contains uint32 disconnectReason; + TC_LOG_DEBUG("network", "%s", opcodeName.c_str()); + sScriptMgr->OnPacketReceive(_worldSession, packet); + return; + // not an opcode, client sends string "WORLD OF WARCRAFT CONNECTION - CLIENT TO SERVER" without opcode + // first 4 bytes become the opcode (2 dropped) + case MSG_VERIFY_CONNECTIVITY: + { + TC_LOG_DEBUG("network", "%s", opcodeName.c_str()); + sScriptMgr->OnPacketReceive(_worldSession, packet); + std::string str; + packet >> str; + if (str != "D OF WARCRAFT CONNECTION - CLIENT TO SERVER") { - TC_LOG_DEBUG("network", "%s", opcodeName.c_str()); - sScriptMgr->OnPacketReceive(shared_from_this(), packet); - if (_worldSession) - _worldSession->HandleEnableNagleAlgorithm(); + CloseSocket(); break; } - default: - { - if (!_worldSession) - { - TC_LOG_ERROR("network.opcode", "ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); - break; - } - - // Our Idle timer will reset on any non PING opcodes. - // Catches people idling on the login screen and any lingering ingame connections. - _worldSession->ResetTimeOutTime(); - // Copy the packet to the heap before enqueuing - _worldSession->QueuePacket(new WorldPacket(packet)); + HandleSendAuthSession(); + break; + } + case CMSG_ENABLE_NAGLE: + { + TC_LOG_DEBUG("network", "%s", opcodeName.c_str()); + sScriptMgr->OnPacketReceive(_worldSession, packet); + if (_worldSession) + _worldSession->HandleEnableNagleAlgorithm(); + break; + } + default: + { + if (!_worldSession) + { + TC_LOG_ERROR("network.opcode", "ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); break; } - } - AsyncReadHeader(); + // Copy the packet to the heap before enqueuing + _worldSession->QueuePacket(new WorldPacket(std::move(packet))); + break; + } } - else - CloseSocket(); + + AsyncReadHeader(); } void WorldSocket::AsyncWrite(WorldPacket& packet) { + if (!IsOpen()) + return; + if (sPacketLog->CanLogPacket()) sPacketLog->LogPacket(packet, SERVER_TO_CLIENT, GetRemoteIpAddress(), GetRemotePort()); - if (_worldSession && packet.size() > 0x400) + if (_worldSession && packet.size() > 0x400 && !packet.IsCompressed()) packet.Compress(_worldSession->GetCompressionStream()); TC_LOG_TRACE("network.opcode", "S->C: %s %s", (_worldSession ? _worldSession->GetPlayerInfo() : GetRemoteIpAddress().to_string()).c_str(), GetOpcodeNameForLogging(packet.GetOpcode()).c_str()); @@ -528,3 +510,10 @@ void WorldSocket::HandlePing(WorldPacket& recvPacket) packet << ping; return AsyncWrite(packet); } + +void WorldSocket::CloseSocket() +{ + sScriptMgr->OnSocketClose(shared_from_this()); + + Socket::CloseSocket(); +} diff --git a/src/server/game/Server/WorldSocket.h b/src/server/game/Server/WorldSocket.h index 2cf6159cb38..404999499ef 100644 --- a/src/server/game/Server/WorldSocket.h +++ b/src/server/game/Server/WorldSocket.h @@ -104,12 +104,14 @@ public: void Start() override; + void CloseSocket() override; + using Base::AsyncWrite; void AsyncWrite(WorldPacket& packet); protected: - void ReadHeaderHandler(boost::system::error_code error, size_t transferedBytes) override; - void ReadDataHandler(boost::system::error_code error, size_t transferedBytes) override; + void ReadHeaderHandler() override; + void ReadDataHandler() override; private: void HandleSendAuthSession(); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index da12ed3da77..e43363e9cf6 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5415,7 +5415,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const int32 mod = (rage < 100) ? rage : 100; int32 points = target->CalculateSpellDamage(target, GetSpellInfo(), 1); int32 regen = target->GetMaxHealth() * (mod * points / 10) / 1000; - target->CastCustomSpell(target, 22845, ®en, 0, 0, true, 0, this); + target->CastCustomSpell(target, 22845, ®en, nullptr, nullptr, true, nullptr, this); target->SetPower(POWER_RAGE, rage-mod); break; } @@ -5436,12 +5436,12 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const // Feeding Frenzy Rank 1 case 53511: if (target->GetVictim() && target->EnsureVictim()->HealthBelowPct(35)) - target->CastSpell(target, 60096, true, 0, this); + target->CastSpell(target, 60096, true, nullptr, this); return; // Feeding Frenzy Rank 2 case 53512: if (target->GetVictim() && target->EnsureVictim()->HealthBelowPct(35)) - target->CastSpell(target, 60097, true, 0, this); + target->CastSpell(target, 60097, true, nullptr, this); return; default: break; @@ -5774,7 +5774,7 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target) { int32 basepoints = GetAmount(); - triggerCaster->CastCustomSpell(target, triggerSpellId, &basepoints, &basepoints, &basepoints, true, 0, this); + triggerCaster->CastCustomSpell(target, triggerSpellId, &basepoints, &basepoints, &basepoints, true, nullptr, this); TC_LOG_DEBUG("spells", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); } } diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index e38dc8fdf4a..4d8c1e033ed 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1300,7 +1300,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b { // instantly heal m_amount% of the absorb-value int32 heal = glyph->GetAmount() * GetEffect(0)->GetAmount()/100; - caster->CastCustomSpell(GetUnitOwner(), 56160, &heal, NULL, NULL, true, 0, GetEffect(0)); + caster->CastCustomSpell(GetUnitOwner(), 56160, &heal, nullptr, nullptr, true, nullptr, GetEffect(0)); } } break; diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 19c77c2ac7e..e578c0ffc3a 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -274,12 +274,12 @@ class UnitAura : public Aura protected: explicit UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); public: - void _ApplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp); - void _UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp); + void _ApplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp) override; + void _UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp) override; - void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); + void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) override; - void FillTargetMap(std::map<Unit*, uint8> & targets, Unit* caster); + void FillTargetMap(std::map<Unit*, uint8> & targets, Unit* caster) override; // Allow Apply Aura Handler to modify and access m_AuraDRGroup void SetDiminishGroup(DiminishingGroup group) { m_AuraDRGroup = group; } @@ -295,8 +295,8 @@ class DynObjAura : public Aura protected: explicit DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); public: - void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); + void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) override; - void FillTargetMap(std::map<Unit*, uint8> & targets, Unit* caster); + void FillTargetMap(std::map<Unit*, uint8> & targets, Unit* caster) override; }; #endif diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index bf518859b49..df754440c40 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1200,7 +1200,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr) { if (Unit* unitTarget = (*itr)->ToUnit()) - AddUnitTarget(unitTarget, effMask, false); + AddUnitTarget(unitTarget, effMask, false, true, center); else if (GameObject* gObjTarget = (*itr)->ToGameObject()) AddGOTarget(gObjTarget, effMask); } @@ -1997,10 +1997,10 @@ void Spell::CleanupTargetList() m_delayMoment = 0; } -void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= true*/, bool implicit /*= true*/) +void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= true*/, bool implicit /*= true*/, Position const* losPosition /*= nullptr*/) { for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) - if (!m_spellInfo->Effects[effIndex].IsEffect() || !CheckEffectTarget(target, effIndex)) + if (!m_spellInfo->Effects[effIndex].IsEffect() || !CheckEffectTarget(target, effIndex, losPosition)) effectMask &= ~(1 << effIndex); // no effects left @@ -2707,7 +2707,7 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask) if (*i < 0) unit->RemoveAurasDueToSpell(-(*i)); else - unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID()); + unit->CastSpell(unit, *i, true, nullptr, nullptr, m_caster->GetGUID()); } } } @@ -3432,7 +3432,14 @@ void Spell::SendSpellCooldown() { Player* _player = m_caster->ToPlayer(); if (!_player) + { + // Handle pet cooldowns here if needed instead of in PetAI to avoid hidden cooldown restarts + Creature* _creature = m_caster->ToCreature(); + if (_creature && _creature->IsPet()) + _creature->AddCreatureSpellCooldown(m_spellInfo->Id); + return; + } // mana/health/etc potions, disabled by client (until combat out as declarate) if (m_CastItem && (m_CastItem->IsPotion() || m_spellInfo->IsCooldownStartedOnEvent())) @@ -3979,7 +3986,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data) uint32 hit = 0; size_t hitPos = data->wpos(); *data << (uint8)0; // placeholder - for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && hit <= 255; ++ihit) + for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && hit < 255; ++ihit) { if ((*ihit).missCondition == SPELL_MISS_NONE) // Add only hits { @@ -3989,7 +3996,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data) } } - for (std::list<GOTargetInfo>::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end() && hit <= 255; ++ighit) + for (std::list<GOTargetInfo>::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end() && hit < 255; ++ighit) { *data << uint64(ighit->targetGUID); // Always hits ++hit; @@ -3998,7 +4005,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data) uint32 miss = 0; size_t missPos = data->wpos(); *data << (uint8)0; // placeholder - for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && miss <= 255; ++ihit) + for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && miss < 255; ++ihit) { if (ihit->missCondition != SPELL_MISS_NONE) // Add only miss { @@ -4863,7 +4870,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (IsTriggered() && m_triggeredByAuraSpell) if (DynamicObject* dynObj = m_caster->GetDynObject(m_triggeredByAuraSpell->Id)) losTarget = dynObj; - + if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, NULL, SPELL_DISABLE_LOS) && !target->IsWithinLOSInMap(losTarget)) return SPELL_FAILED_LINE_OF_SIGHT; } @@ -6449,7 +6456,7 @@ CurrentSpellTypes Spell::GetCurrentContainer() const return(CURRENT_GENERIC_SPELL); } -bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const +bool Spell::CheckEffectTarget(Unit const* target, uint32 eff, Position const* losPosition) const { switch (m_spellInfo->Effects[eff].ApplyAuraName) { @@ -6499,15 +6506,22 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const // all ok by some way or another, skip normal check break; default: // normal case - // Get GO cast coordinates if original caster -> GO - WorldObject* caster = NULL; - if (IS_GAMEOBJECT_GUID(m_originalCasterGUID)) - caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID); - if (!caster) - caster = m_caster; - if (target != m_caster && !target->IsWithinLOSInMap(caster)) - return false; + { + if (losPosition) + return target->IsWithinLOS(losPosition->GetPositionX(), losPosition->GetPositionY(), losPosition->GetPositionZ()); + else + { + // Get GO cast coordinates if original caster -> GO + WorldObject* caster = NULL; + if (IS_GAMEOBJECT_GUID(m_originalCasterGUID)) + caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID); + if (!caster) + caster = m_caster; + if (target != m_caster && !target->IsWithinLOSInMap(caster)) + return false; + } break; + } } return true; diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 5b976ced426..fa5d051635b 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -422,7 +422,7 @@ class Spell void DoCreateItem(uint32 i, uint32 itemtype); void WriteSpellGoTargets(WorldPacket* data); - bool CheckEffectTarget(Unit const* target, uint32 eff) const; + bool CheckEffectTarget(Unit const* target, uint32 eff, Position const* losPosition) const; bool CanAutoCast(Unit* target); void CheckSrc() { if (!m_targets.HasSrc()) m_targets.SetSrc(*m_caster); } void CheckDst() { if (!m_targets.HasDst()) m_targets.SetDst(*m_caster); } @@ -612,7 +612,7 @@ class Spell SpellDestination m_destTargets[MAX_SPELL_EFFECTS]; - void AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid = true, bool implicit = true); + void AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid = true, bool implicit = true, Position const* losPosition = nullptr); void AddGOTarget(GameObject* target, uint32 effectMask); void AddItemTarget(Item* item, uint32 effectMask); void AddDestTarget(SpellDestination const& dest, uint32 effIndex); @@ -757,9 +757,9 @@ class SpellEvent : public BasicEvent SpellEvent(Spell* spell); virtual ~SpellEvent(); - virtual bool Execute(uint64 e_time, uint32 p_time); - virtual void Abort(uint64 e_time); - virtual bool IsDeletable() const; + virtual bool Execute(uint64 e_time, uint32 p_time) override; + virtual void Abort(uint64 e_time) override; + virtual bool IsDeletable() const override; protected: Spell* m_Spell; }; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 7623550d736..e0055cca1f1 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -431,7 +431,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) int chance = (*i)->GetSpellInfo()->Effects[EFFECT_1].CalcValue(m_caster); if (roll_chance_i(chance)) // Mind Trauma - m_caster->CastSpell(unitTarget, 48301, true, 0); + m_caster->CastSpell(unitTarget, 48301, true, nullptr); break; } } @@ -2065,6 +2065,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) case 1562: case 833: case 1161: + case 713: numSummons = (damage > 0) ? damage : 1; break; default: diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 43d8a577fa3..756644dbd1b 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -187,7 +187,7 @@ class SpellScript : public _SpellScript public: EffectHandler(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName); std::string ToString(); - bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex); + bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex) override; void Call(SpellScript* spellScript, SpellEffIndex effIndex); private: SpellEffectFnType pEffectHandlerScript; @@ -206,7 +206,7 @@ class SpellScript : public _SpellScript { public: TargetHook(uint8 _effectIndex, uint16 _targetType, bool _area, bool _dest); - bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex); + bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex) override; std::string ToString(); uint16 GetTarget() const { return targetType; } protected: @@ -253,7 +253,7 @@ class SpellScript : public _SpellScript #define PrepareSpellScript(CLASSNAME) SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) public: - bool _Validate(SpellInfo const* entry); + bool _Validate(SpellInfo const* entry) override; bool _Load(Spell* spell); void _InitHit(); bool _IsEffectPrevented(SpellEffIndex effIndex) { return (m_hitPreventEffectMask & (1 << effIndex)) != 0; } @@ -509,7 +509,7 @@ class AuraScript : public _SpellScript public: EffectBase(uint8 _effIndex, uint16 _effName); std::string ToString(); - bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex); + bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex) override; }; class EffectPeriodicHandler : public EffectBase { @@ -630,7 +630,7 @@ class AuraScript : public _SpellScript public: AuraScript() : _SpellScript(), m_aura(NULL), m_auraApplication(NULL), m_defaultActionPrevented(false) { } - bool _Validate(SpellInfo const* entry); + bool _Validate(SpellInfo const* entry) override; bool _Load(Aura* aura); void _PrepareScriptCall(AuraScriptHookType hookType, AuraApplication const* aurApp = NULL); void _FinishScriptCall(); diff --git a/src/server/game/Warden/WardenMac.h b/src/server/game/Warden/WardenMac.h index 3ea509c75ef..e9ccfe55438 100644 --- a/src/server/game/Warden/WardenMac.h +++ b/src/server/game/Warden/WardenMac.h @@ -34,13 +34,13 @@ class WardenMac : public Warden WardenMac(); ~WardenMac(); - void Init(WorldSession* session, BigNumber* k); - ClientWardenModule* GetModuleForClient(); - void InitializeModule(); - void RequestHash(); - void HandleHashResult(ByteBuffer& buff); - void RequestData(); - void HandleData(ByteBuffer& buff); + void Init(WorldSession* session, BigNumber* k) override; + ClientWardenModule* GetModuleForClient() override; + void InitializeModule() override; + void RequestHash() override; + void HandleHashResult(ByteBuffer& buff) override; + void RequestData() override; + void HandleData(ByteBuffer& buff) override; }; #endif diff --git a/src/server/game/Warden/WardenWin.h b/src/server/game/Warden/WardenWin.h index 47487ba65a2..d760d9ee981 100644 --- a/src/server/game/Warden/WardenWin.h +++ b/src/server/game/Warden/WardenWin.h @@ -76,13 +76,13 @@ class WardenWin : public Warden WardenWin(); ~WardenWin(); - void Init(WorldSession* session, BigNumber* K); - ClientWardenModule* GetModuleForClient(); - void InitializeModule(); - void RequestHash(); - void HandleHashResult(ByteBuffer &buff); - void RequestData(); - void HandleData(ByteBuffer &buff); + void Init(WorldSession* session, BigNumber* K) override; + ClientWardenModule* GetModuleForClient() override; + void InitializeModule() override; + void RequestHash() override; + void HandleHashResult(ByteBuffer &buff) override; + void RequestData() override; + void HandleData(ByteBuffer &buff) override; private: uint32 _serverTicks; diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index f18809b107a..8bf045c5adc 100644 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -51,7 +51,7 @@ namespace Weather* FindWeather(uint32 id) { WeatherMap::const_iterator itr = m_weathers.find(id); - return (itr != m_weathers.end()) ? itr->second.get() : 0; + return (itr != m_weathers.end()) ? itr->second.get() : nullptr; } /// Remove a Weather object for the given zoneid diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 3af21032cd5..edf67a9563e 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -20,69 +20,49 @@ \ingroup world */ -#include <atomic> -#include "Common.h" -#include "Memory.h" -#include "DatabaseEnv.h" -#include "Config.h" -#include "SystemConfig.h" -#include "Log.h" -#include "Opcodes.h" -#include "WorldSession.h" -#include "WorldPacket.h" -#include "Player.h" -#include "Vehicle.h" -#include "SkillExtraItems.h" -#include "SkillDiscovery.h" #include "World.h" -#include "AccountMgr.h" #include "AchievementMgr.h" -#include "AuctionHouseMgr.h" -#include "ObjectMgr.h" #include "ArenaTeamMgr.h" -#include "GuildMgr.h" -#include "GuildFinderMgr.h" -#include "TicketMgr.h" -#include "SpellMgr.h" -#include "GroupMgr.h" +#include "AuctionHouseMgr.h" +#include "BattlefieldMgr.h" +#include "BattlegroundMgr.h" +#include "CalendarMgr.h" +#include "Channel.h" +#include "CharacterDatabaseCleaner.h" #include "Chat.h" -#include "DBCStores.h" -#include "DB2Stores.h" -#include "LootMgr.h" -#include "ItemEnchantmentMgr.h" -#include "MapManager.h" +#include "Config.h" #include "CreatureAIRegistry.h" -#include "BattlegroundMgr.h" -#include "OutdoorPvPMgr.h" -#include "TemporarySummon.h" -#include "WaypointMovementGenerator.h" -#include "VMapFactory.h" -#include "MMapFactory.h" +#include "CreatureGroups.h" +#include "CreatureTextMgr.h" +#include "DatabaseEnv.h" +#include "DisableMgr.h" #include "GameEventMgr.h" -#include "PoolMgr.h" #include "GridNotifiersImpl.h" -#include "CellImpl.h" +#include "GroupMgr.h" +#include "GuildFinderMgr.h" #include "InstanceSaveMgr.h" -#include "Util.h" #include "Language.h" -#include "CreatureGroups.h" -#include "Transport.h" -#include "ScriptMgr.h" -#include "AddonMgr.h" #include "LFGMgr.h" -#include "ConditionMgr.h" -#include "DisableMgr.h" -#include "CharacterDatabaseCleaner.h" +#include "MapManager.h" +#include "Memory.h" +#include "MMapFactory.h" +#include "ObjectMgr.h" +#include "OutdoorPvPMgr.h" +#include "Player.h" +#include "PoolMgr.h" #include "ScriptMgr.h" -#include "WeatherMgr.h" -#include "CreatureTextMgr.h" +#include "SkillDiscovery.h" +#include "SkillExtraItems.h" #include "SmartAI.h" -#include "Channel.h" -#include "WardenCheckMgr.h" -#include "Warden.h" -#include "CalendarMgr.h" -#include "BattlefieldMgr.h" +#include "SystemConfig.h" +#include "TicketMgr.h" #include "TransportMgr.h" +#include "Unit.h" +#include "VMapFactory.h" +#include "WardenCheckMgr.h" +#include "WaypointMovementGenerator.h" +#include "WeatherMgr.h" +#include "WorldSession.h" std::atomic<bool> World::m_stopEvent(false); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 00c897a6f00..bf488c7edf0 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -642,11 +642,11 @@ class World void SendWorldText(int32 string_id, ...); void SendGlobalText(const char* text, WorldSession* self); void SendGMText(int32 string_id, ...); - void SendGlobalMessage(WorldPacket* packet, WorldSession* self = 0, uint32 team = 0); - void SendGlobalGMMessage(WorldPacket* packet, WorldSession* self = 0, uint32 team = 0); - bool SendZoneMessage(uint32 zone, WorldPacket* packet, WorldSession* self = 0, uint32 team = 0); - void SendZoneText(uint32 zone, const char *text, WorldSession* self = 0, uint32 team = 0); void SendServerMessage(ServerMessageType type, const char *text = "", Player* player = NULL); + void SendGlobalMessage(WorldPacket* packet, WorldSession* self = nullptr, uint32 team = 0); + void SendGlobalGMMessage(WorldPacket* packet, WorldSession* self = nullptr, uint32 team = 0); + bool SendZoneMessage(uint32 zone, WorldPacket* packet, WorldSession* self = nullptr, uint32 team = 0); + void SendZoneText(uint32 zone, const char *text, WorldSession* self = nullptr, uint32 team = 0); /// Are we in the middle of a shutdown? bool IsShuttingDown() const { return m_ShutdownTimer > 0; } diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 352142baea4..d7b7adc05ba 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -37,7 +37,7 @@ class gobject_commandscript : public CommandScript public: gobject_commandscript() : CommandScript("gobject_commandscript") { } - ChatCommand* GetCommands() const + ChatCommand* GetCommands() const override { static ChatCommand gobjectAddCommandTable[] = { diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp index 928e110e9a1..dfc681a1d87 100644 --- a/src/server/scripts/Commands/cs_guild.cpp +++ b/src/server/scripts/Commands/cs_guild.cpp @@ -35,7 +35,7 @@ class guild_commandscript : public CommandScript public: guild_commandscript() : CommandScript("guild_commandscript") { } - ChatCommand* GetCommands() const + ChatCommand* GetCommands() const override { static ChatCommand guildCommandTable[] = { diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp index dd1366ac09c..f2067e6c70b 100644 --- a/src/server/scripts/Commands/cs_message.cpp +++ b/src/server/scripts/Commands/cs_message.cpp @@ -34,7 +34,7 @@ class message_commandscript : public CommandScript public: message_commandscript() : CommandScript("message_commandscript") { } - ChatCommand* GetCommands() const + ChatCommand* GetCommands() const override { static ChatCommand channelSetCommandTable[] = { diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index b476a2e0a13..9d763cb8d71 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1460,7 +1460,6 @@ public: std::string raceStr, classStr = "None"; uint8 gender = 0; int8 locale = handler->GetSessionDbcLocale(); - std::string genderStr = handler->GetTrinityString(LANG_ERROR); uint32 totalPlayerTime = 0; uint8 level = 0; std::string alive = handler->GetTrinityString(LANG_ERROR); diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index b9bf0f7d9f6..2988c2c50c9 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -47,7 +47,7 @@ class reload_commandscript : public CommandScript public: reload_commandscript() : CommandScript("reload_commandscript") { } - ChatCommand* GetCommands() const + ChatCommand* GetCommands() const override { static ChatCommand reloadAllCommandTable[] = { diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp index 2f0b53bff68..a2f1c75106b 100644 --- a/src/server/scripts/Commands/cs_ticket.cpp +++ b/src/server/scripts/Commands/cs_ticket.cpp @@ -36,7 +36,7 @@ class ticket_commandscript : public CommandScript public: ticket_commandscript() : CommandScript("ticket_commandscript") { } - ChatCommand* GetCommands() const + ChatCommand* GetCommands() const override { static ChatCommand ticketResponseCommandTable[] = { diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp index 47e91cac63d..60a8e943bc7 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp @@ -140,7 +140,7 @@ public: void JustSummoned(Creature* summoned) override { - CAST_AI(npc_water_elemental::npc_water_elementalAI, summoned->AI())->balindaGUID = me->GetGUID(); + ENSURE_AI(npc_water_elemental::npc_water_elementalAI, summoned->AI())->balindaGUID = me->GetGUID(); summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true)); summoned->setFaction(me->getFaction()); summons.Summon(summoned); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp index 90306913534..0f4840c0d1f 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp @@ -19,7 +19,7 @@ #include "ScriptedCreature.h" #include "karazhan.h" -enum Spells +enum Spells { SPELL_REPENTANCE = 29511, SPELL_HOLYFIRE = 29522, diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index d812a8e3001..5d1e5451ab1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -230,7 +230,7 @@ public: void SetMidnight(Creature* pAttumen, uint64 value) { - CAST_AI(boss_attumen::boss_attumenAI, pAttumen->AI())->Midnight = value; + ENSURE_AI(boss_attumen::boss_attumenAI, pAttumen->AI())->Midnight = value; } }; }; @@ -307,7 +307,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(uint32 diff) Creature* pMidnight = ObjectAccessor::GetCreature(*me, Midnight); if (pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT) { - CAST_AI(boss_midnight::boss_midnightAI, (pMidnight->AI()))->Mount(me); + ENSURE_AI(boss_midnight::boss_midnightAI, (pMidnight->AI()))->Mount(me); me->SetHealth(pMidnight->GetHealth()); DoResetThreat(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 411ebed869d..6ff1faf35b6 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -352,7 +352,7 @@ struct boss_moroes_guestAI : public ScriptedAI { if (Creature* Moroes = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOROES))) for (uint8 i = 0; i < 4; ++i) - if (uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i]) + if (uint64 GUID = ENSURE_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i]) GuestGUID[i] = GUID; } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index e6c544aa0a0..518c4eacbd9 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -367,8 +367,8 @@ public: infernal->SetDisplayId(INFERNAL_MODEL_INVISIBLE); infernal->setFaction(me->getFaction()); if (point) - CAST_AI(netherspite_infernal::netherspite_infernalAI, infernal->AI())->point=point; - CAST_AI(netherspite_infernal::netherspite_infernalAI, infernal->AI())->malchezaar=me->GetGUID(); + ENSURE_AI(netherspite_infernal::netherspite_infernalAI, infernal->AI())->point = point; + ENSURE_AI(netherspite_infernal::netherspite_infernalAI, infernal->AI())->malchezaar = me->GetGUID(); infernals.push_back(infernal->GetGUID()); DoCast(infernal, SPELL_INFERNAL_RELAY); @@ -586,7 +586,7 @@ void netherspite_infernal::netherspite_infernalAI::Cleanup() Creature* pMalchezaar = ObjectAccessor::GetCreature(*me, malchezaar); if (pMalchezaar && pMalchezaar->IsAlive()) - CAST_AI(boss_malchezaar::boss_malchezaarAI, pMalchezaar->AI())->Cleanup(me, point); + ENSURE_AI(boss_malchezaar::boss_malchezaarAI, pMalchezaar->AI())->Cleanup(me, point); } void AddSC_boss_malchezaar() diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index 787e468c3c1..911d4e35797 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -272,7 +272,7 @@ public: { if (Creature* pPortal = ObjectAccessor::GetCreature(*me, PortalGUID[i])) { - CAST_AI(npc_fiendish_portal::npc_fiendish_portalAI, pPortal->AI())->DespawnAllImp(); + ENSURE_AI(npc_fiendish_portal::npc_fiendish_portalAI, pPortal->AI())->DespawnAllImp(); pPortal->DespawnOrUnsummon(); } @@ -362,7 +362,7 @@ public: if (Creature* Chains = me->FindNearestCreature(NPC_DEMONCHAINS, 5000)) { - CAST_AI(npc_demon_chain::npc_demon_chainAI, Chains->AI())->SacrificeGUID = target->GetGUID(); + ENSURE_AI(npc_demon_chain::npc_demon_chainAI, Chains->AI())->SacrificeGUID = target->GetGUID(); Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true); Talk(SAY_SACRIFICE); SacrificeTimer = 30000; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index dd5ad8ee7ae..f86f267b6b9 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -257,7 +257,7 @@ public: Creature* Dorothee = (ObjectAccessor::GetCreature((*me), DorotheeGUID)); if (Dorothee && Dorothee->IsAlive()) { - CAST_AI(boss_dorothee::boss_dorotheeAI, Dorothee->AI())->TitoDied = true; + ENSURE_AI(boss_dorothee::boss_dorotheeAI, Dorothee->AI())->TitoDied = true; Talk(SAY_DOROTHEE_TITO_DEATH, Dorothee); } } @@ -284,7 +284,7 @@ void boss_dorothee::boss_dorotheeAI::SummonTito() if (Creature* pTito = me->SummonCreature(CREATURE_TITO, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) { Talk(SAY_DOROTHEE_SUMMON); - CAST_AI(npc_tito::npc_titoAI, pTito->AI())->DorotheeGUID = me->GetGUID(); + ENSURE_AI(npc_tito::npc_titoAI, pTito->AI())->DorotheeGUID = me->GetGUID(); pTito->AI()->AttackStart(me->GetVictim()); SummonedTito = true; TitoDied = false; @@ -1188,8 +1188,8 @@ public: if (Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID))) { - CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->RomuloDead = true; - CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->ResurrectSelfTimer = 10000; + ENSURE_AI(boss_julianne::boss_julianneAI, Julianne->AI())->RomuloDead = true; + ENSURE_AI(boss_julianne::boss_julianneAI, Julianne->AI())->ResurrectSelfTimer = 10000; } damage = 0; @@ -1216,8 +1216,8 @@ public: { PretendToDie(me); IsFakingDeath = true; - CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->ResurrectTimer = 10000; - CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->RomuloDead = true; + ENSURE_AI(boss_julianne::boss_julianneAI, Julianne->AI())->ResurrectTimer = 10000; + ENSURE_AI(boss_julianne::boss_julianneAI, Julianne->AI())->RomuloDead = true; damage = 0; return; } @@ -1276,11 +1276,11 @@ public: if (ResurrectTimer <= diff) { Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID)); - if (Julianne && CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath) + if (Julianne && ENSURE_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath) { Talk(SAY_ROMULO_RESURRECT); Resurrect(Julianne); - CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath = false; + ENSURE_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath = false; JulianneDead = false; ResurrectTimer = 10000; } @@ -1362,8 +1362,8 @@ void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff) if (Creature* pRomulo = me->SummonCreature(CREATURE_ROMULO, ROMULO_X, ROMULO_Y, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS)) { RomuloGUID = pRomulo->GetGUID(); - CAST_AI(boss_romulo::boss_romuloAI, pRomulo->AI())->JulianneGUID = me->GetGUID(); - CAST_AI(boss_romulo::boss_romuloAI, pRomulo->AI())->Phase = PHASE_ROMULO; + ENSURE_AI(boss_romulo::boss_romuloAI, pRomulo->AI())->JulianneGUID = me->GetGUID(); + ENSURE_AI(boss_romulo::boss_romuloAI, pRomulo->AI())->Phase = PHASE_ROMULO; DoZoneInCombat(pRomulo); pRomulo->setFaction(16); @@ -1396,11 +1396,11 @@ void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff) if (ResurrectTimer <= diff) { Creature* Romulo = (ObjectAccessor::GetCreature((*me), RomuloGUID)); - if (Romulo && CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath) + if (Romulo && ENSURE_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath) { Talk(SAY_JULIANNE_RESURRECT); Resurrect(Romulo); - CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath = false; + ENSURE_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath = false; RomuloDead = false; ResurrectTimer = 10000; } @@ -1494,8 +1494,8 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama { PretendToDie(me); IsFakingDeath = true; - CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->ResurrectTimer = 10000; - CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->JulianneDead = true; + ENSURE_AI(boss_romulo::boss_romuloAI, Romulo->AI())->ResurrectTimer = 10000; + ENSURE_AI(boss_romulo::boss_romuloAI, Romulo->AI())->JulianneDead = true; damage = 0; return; } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index 976a83a98c2..c89950b7de3 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -339,7 +339,7 @@ public: bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override { player->PlayerTalkClass->ClearMenus(); - npc_barnesAI* pBarnesAI = CAST_AI(npc_barnes::npc_barnesAI, creature->AI()); + npc_barnesAI* pBarnesAI = ENSURE_AI(npc_barnes::npc_barnesAI, creature->AI()); switch (action) { diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index 45fd9fed60a..40dedcf6d93 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -450,7 +450,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI if (Creature* Delrissa = (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA)))) { for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) - m_auiLackeyGUIDs[i] = CAST_AI(boss_priestess_delrissa::boss_priestess_delrissaAI, Delrissa->AI())->m_auiLackeyGUID[i]; + m_auiLackeyGUIDs[i] = ENSURE_AI(boss_priestess_delrissa::boss_priestess_delrissaAI, Delrissa->AI())->m_auiLackeyGUID[i]; } } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index fff8a92dfcd..0189b6040f7 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -315,7 +315,7 @@ public: if (Creature* anchor = go->FindNearestCreature(29521, 15)) if (uint64 prisonerGUID = anchor->AI()->GetGUID()) if (Creature* prisoner = ObjectAccessor::GetCreature(*player, prisonerGUID)) - CAST_AI(npc_unworthy_initiate::npc_unworthy_initiateAI, prisoner->AI())->EventStart(anchor, player); + ENSURE_AI(npc_unworthy_initiate::npc_unworthy_initiateAI, prisoner->AI())->EventStart(anchor, player); return false; } @@ -632,7 +632,7 @@ public: caster->setFaction(35); DoCast(caster, SPELL_CALL_DARK_RIDER, true); if (Creature* Dark_Rider = me->FindNearestCreature(28654, 15)) - CAST_AI(npc_dark_rider_of_acherus::npc_dark_rider_of_acherusAI, Dark_Rider->AI())->InitDespawnHorse(caster); + ENSURE_AI(npc_dark_rider_of_acherus::npc_dark_rider_of_acherusAI, Dark_Rider->AI())->InitDespawnHorse(caster); } } } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 2800e9473b7..72757387b1c 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -282,8 +282,8 @@ public: { case GOSSIP_ACTION_INFO_DEF+1: player->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_highlord_darion_mograine::npc_highlord_darion_mograineAI, creature->AI())->uiStep = 1; - CAST_AI(npc_highlord_darion_mograine::npc_highlord_darion_mograineAI, creature->AI())->Start(true, false, player->GetGUID()); + ENSURE_AI(npc_highlord_darion_mograine::npc_highlord_darion_mograineAI, creature->AI())->uiStep = 1; + ENSURE_AI(npc_highlord_darion_mograine::npc_highlord_darion_mograineAI, creature->AI())->Start(true, false, player->GetGUID()); break; } return true; diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index e169e521d0b..5939d4a41db 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -466,7 +466,7 @@ public: case 1: { if (Creature* smoke = me->SummonCreature(HELPER, Spawn[1].x, Spawn[1].y, Spawn[1].z, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) - CAST_AI(npc_wisp_invis::npc_wisp_invisAI, smoke->AI())->SetType(3); + ENSURE_AI(npc_wisp_invis::npc_wisp_invisAI, smoke->AI())->SetType(3); DoCast(me, SPELL_RHYME_BIG); break; } @@ -517,7 +517,7 @@ public: SaySound(SAY_PLAYER_DEATH); //maybe possible when player dies from conflagration else if (Creature* Head = ObjectAccessor::GetCreature((*me), headGUID)) - CAST_AI(npc_head::npc_headAI, Head->AI())->SaySound(SAY_PLAYER_DEATH); + ENSURE_AI(npc_head::npc_headAI, Head->AI())->SaySound(SAY_PLAYER_DEATH); } } @@ -566,7 +566,7 @@ public: if (Creature* flame = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 60000)) flame->CastSpell(flame, SPELL_BODY_FLAME, false); if (Creature* wisp = DoSpawnCreature(WISP_INVIS, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 60000)) - CAST_AI(npc_wisp_invis::npc_wisp_invisAI, wisp->AI())->SetType(4); + ENSURE_AI(npc_wisp_invis::npc_wisp_invisAI, wisp->AI())->SetType(4); instance->SetData(DATA_HORSEMAN_EVENT, DONE); Map::PlayerList const& players = me->GetMap()->GetPlayers(); @@ -690,7 +690,7 @@ public: if (burn <= diff) { if (Creature* flame = me->SummonCreature(HELPER, Spawn[0].x, Spawn[0].y, Spawn[0].z, 0, TEMPSUMMON_TIMED_DESPAWN, 17000)) - CAST_AI(npc_wisp_invis::npc_wisp_invisAI, flame->AI())->SetType(2); + ENSURE_AI(npc_wisp_invis::npc_wisp_invisAI, flame->AI())->SetType(2); burned = true; } else burn -= diff; @@ -749,8 +749,8 @@ public: Creature* Head = ObjectAccessor::GetCreature((*me), headGUID); if (Head && Head->IsAlive()) { - CAST_AI(npc_head::npc_headAI, Head->AI())->Phase = Phase; - CAST_AI(npc_head::npc_headAI, Head->AI())->Disappear(); + ENSURE_AI(npc_head::npc_headAI, Head->AI())->Phase = Phase; + ENSURE_AI(npc_head::npc_headAI, Head->AI())->Disappear(); } return; } @@ -808,7 +808,7 @@ public: { debuff->SetDisplayId(me->GetDisplayId()); debuff->CastSpell(debuff, SPELL_PUMPKIN_AURA_GREEN, false); - CAST_AI(npc_wisp_invis::npc_wisp_invisAI, debuff->AI())->SetType(1); + ENSURE_AI(npc_wisp_invis::npc_wisp_invisAI, debuff->AI())->SetType(1); debuffGUID = debuff->GetGUID(); } sprouted = false; @@ -894,8 +894,8 @@ public: player->AreaExploredOrEventHappens(11405); if (Creature* horseman = soil->SummonCreature(HH_MOUNTED, FlightPoint[20].x, FlightPoint[20].y, FlightPoint[20].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 0)) { - CAST_AI(boss_headless_horseman::boss_headless_horsemanAI, horseman->AI())->PlayerGUID = player->GetGUID(); - CAST_AI(boss_headless_horseman::boss_headless_horsemanAI, horseman->AI())->FlyMode(); + ENSURE_AI(boss_headless_horseman::boss_headless_horsemanAI, horseman->AI())->PlayerGUID = player->GetGUID(); + ENSURE_AI(boss_headless_horseman::boss_headless_horsemanAI, horseman->AI())->FlyMode(); } //} return true; @@ -920,7 +920,7 @@ void npc_head::npc_headAI::Disappear() me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->GetMotionMaster()->MoveIdle(); - CAST_AI(boss_headless_horseman::boss_headless_horsemanAI, body->AI())->returned = true; + ENSURE_AI(boss_headless_horseman::boss_headless_horsemanAI, body->AI())->returned = true; } } } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 9c83b038545..b7e03fe0459 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -650,8 +650,8 @@ public: TeleportAllPlayersBack(); if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) { - CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; - CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = false; + ENSURE_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; + ENSURE_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = false; } EnterEvadeMode(); return; @@ -666,8 +666,8 @@ public: TeleportAllPlayersBack(); if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) { - CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; - CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = true; + ENSURE_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; + ENSURE_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = true; } instance->SetBossState(DATA_KALECGOS, DONE); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 849b7014d3a..e6029acc61f 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -370,7 +370,7 @@ public: go->SetUInt32Value(GAMEOBJECT_FACTION, 0); if (Creature* pKalec = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_KALECGOS_KJ))) - CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->SetRingOfBlueFlames(); + ENSURE_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->SetRingOfBlueFlames(); go->Refresh(); } @@ -422,7 +422,7 @@ public: phase = PHASE_DECEIVERS; if (Creature* pKalecKJ = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_KALECGOS_KJ))) - CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalecKJ->AI())->ResetOrbs(); + ENSURE_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalecKJ->AI())->ResetOrbs(); deceiverDeathCount = 0; bSummonedDeceivers = false; bKiljaedenDeath = false; @@ -612,7 +612,7 @@ public: // Reset the controller if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) - CAST_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->Reset(); + ENSURE_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->Reset(); } void EnterCombat(Unit* /*who*/) override @@ -800,10 +800,10 @@ public: switch (Phase) { case PHASE_SACRIFICE: - CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(true); + ENSURE_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(true); break; default: - CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(false); + ENSURE_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(false); break; } } @@ -924,7 +924,7 @@ public: void JustDied(Unit* /*killer*/) override { if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) - ++(CAST_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->deceiverDeathCount); + ++(ENSURE_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->deceiverDeathCount); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp index 8baeaec96ff..41e6bafd4a7 100644 --- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp +++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp @@ -81,8 +81,8 @@ public: { if (_Quest->GetQuestId() == QUEST_JOURNEY_TO_UNDERCITY) { - CAST_AI(npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI, creature->AI())->LamentEvent = true; - CAST_AI(npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI, creature->AI())->DoPlaySoundToSet(creature, SOUND_CREDIT); + ENSURE_AI(npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI, creature->AI())->LamentEvent = true; + ENSURE_AI(npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI, creature->AI())->DoPlaySoundToSet(creature, SOUND_CREDIT); creature->CastSpell(creature, SPELL_SYLVANAS_CAST, false); for (uint8 i = 0; i < 4; ++i) diff --git a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp index 0839a476941..dbcf5998bdb 100644 --- a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp @@ -304,10 +304,11 @@ public: bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override { - npc_escortAI* pEscortAI = CAST_AI(npc_anchorite_truuen::npc_anchorite_truuenAI, creature->AI()); - if (quest->GetQuestId() == QUEST_TOMB_LIGHTBRINGER) + { + npc_escortAI* pEscortAI = ENSURE_AI(npc_anchorite_truuen::npc_anchorite_truuenAI, creature->AI()); pEscortAI->Start(true, true, player->GetGUID()); + } return false; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp index ede038863fc..4a92041f921 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -56,7 +56,7 @@ public: bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override { player->PlayerTalkClass->ClearMenus(); - hyjalAI* ai = CAST_AI(hyjalAI, creature->AI()); + hyjalAI* ai = ENSURE_AI(hyjalAI, creature->AI()); switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: @@ -80,7 +80,7 @@ public: bool OnGossipHello(Player* player, Creature* creature) override { - hyjalAI* ai = CAST_AI(hyjalAI, creature->AI()); + hyjalAI* ai = ENSURE_AI(hyjalAI, creature->AI()); if (ai->EventBegun) return false; @@ -135,7 +135,7 @@ public: bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override { player->PlayerTalkClass->ClearMenus(); - hyjalAI* ai = CAST_AI(hyjalAI, creature->AI()); + hyjalAI* ai = ENSURE_AI(hyjalAI, creature->AI()); ai->DeSpawnVeins();//despawn the alliance veins switch (action) { @@ -160,7 +160,7 @@ public: bool OnGossipHello(Player* player, Creature* creature) override { - hyjalAI* ai = CAST_AI(hyjalAI, creature->AI()); + hyjalAI* ai = ENSURE_AI(hyjalAI, creature->AI()); if (ai->EventBegun) return false; @@ -242,7 +242,7 @@ public: bool OnGossipHello(Player* player, Creature* creature) override { - hyjalAI* ai = CAST_AI(hyjalAI, creature->AI()); + hyjalAI* ai = ENSURE_AI(hyjalAI, creature->AI()); uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); // Only let them get item if Azgalor is dead. diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index 316834c422a..b9c6025b91c 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -460,7 +460,7 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) {//summon at tower creature = me->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0]+irand(-20, 20), SpawnPointSpecial[SPAWN_NEAR_TOWER][1]+irand(-20, 20), SpawnPointSpecial[SPAWN_NEAR_TOWER][2]+irand(-10, 10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); if (creature) - CAST_AI(hyjal_trashAI, creature->AI())->useFlyPath = true; + ENSURE_AI(hyjal_trashAI, creature->AI())->useFlyPath = true; } else {//summon at gate @@ -474,7 +474,7 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) { creature = me->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0], SpawnPointSpecial[SPAWN_NEAR_TOWER][1], SpawnPointSpecial[SPAWN_NEAR_TOWER][2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); if (creature) - CAST_AI(hyjal_trashAI, creature->AI())->useFlyPath = true; + ENSURE_AI(hyjal_trashAI, creature->AI())->useFlyPath = true; } break; case 17908: //GIANT_INFERNAL @@ -511,7 +511,7 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) case ANETHERON: case KAZROGAL: case AZGALOR: - CAST_AI(hyjal_trashAI, creature->AI())->IsEvent = true; + ENSURE_AI(hyjal_trashAI, creature->AI())->IsEvent = true; break; } if (instance->GetData(DATA_RAIDDAMAGE) < MINRAIDDAMAGE) @@ -623,7 +623,7 @@ void hyjalAI::Retreat() if (JainaDummy) { JainaDummy->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - CAST_AI(hyjalAI, JainaDummy->AI())->IsDummy = true; + ENSURE_AI(hyjalAI, JainaDummy->AI())->IsDummy = true; DummyGuid = JainaDummy->GetGUID(); } AddWaypoint(0, JainaDummySpawn[1][0], JainaDummySpawn[1][1], JainaDummySpawn[1][2]); @@ -939,7 +939,7 @@ void hyjalAI::WaypointReached(uint32 waypointId) { if (Creature* creature = ObjectAccessor::GetCreature(*me, DummyGuid)) { - hyjalAI* ai = CAST_AI(hyjalAI, creature->AI()); + hyjalAI* ai = ENSURE_AI(hyjalAI, creature->AI()); ai->DoMassTeleport = true; ai->MassTeleportTimer = 20000; creature->CastSpell(me, SPELL_MASS_TELEPORT, false); @@ -1036,9 +1036,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) Creature* unit = me->SummonCreature(GHOUL, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); if (unit) { - CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction; - CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; - CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i; + ENSURE_AI(hyjal_trashAI, unit->AI())->faction = Faction; + ENSURE_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; + ENSURE_AI(hyjal_trashAI, unit->AI())->OverrunType = i; unit->setActive(true); } } @@ -1048,9 +1048,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) Creature* unit = me->SummonCreature(ABOMINATION, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); if (unit) { - CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction; - CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; - CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i; + ENSURE_AI(hyjal_trashAI, unit->AI())->faction = Faction; + ENSURE_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; + ENSURE_AI(hyjal_trashAI, unit->AI())->OverrunType = i; unit->setActive(true); } } @@ -1060,9 +1060,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) if (unit) { unit->SetHomePosition(AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3]); - CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction; - CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; - CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i; + ENSURE_AI(hyjal_trashAI, unit->AI())->faction = Faction; + ENSURE_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; + ENSURE_AI(hyjal_trashAI, unit->AI())->OverrunType = i; unit->setActive(true); } } @@ -1077,9 +1077,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) if (unit) { unit->SetHomePosition(InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3]); - CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction; - CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; - CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i; + ENSURE_AI(hyjal_trashAI, unit->AI())->faction = Faction; + ENSURE_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; + ENSURE_AI(hyjal_trashAI, unit->AI())->OverrunType = i; unit->setActive(true); } } @@ -1089,9 +1089,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) Creature* unit = me->SummonCreature(GHOUL, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); if (unit) { - CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction; - CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; - CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i; + ENSURE_AI(hyjal_trashAI, unit->AI())->faction = Faction; + ENSURE_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; + ENSURE_AI(hyjal_trashAI, unit->AI())->OverrunType = i; unit->setActive(true); } } @@ -1101,9 +1101,9 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) Creature* unit = me->SummonCreature(ABOMINATION, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); if (unit) { - CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction; - CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; - CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i; + ENSURE_AI(hyjal_trashAI, unit->AI())->faction = Faction; + ENSURE_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; + ENSURE_AI(hyjal_trashAI, unit->AI())->OverrunType = i; unit->setActive(true); } } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 3a5025695f8..7537654c09c 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -1184,7 +1184,7 @@ public: if (IsEvent || IsOverrun) { - CAST_AI(hyjal_trashAI, me->AI())->SetCanAttack(false); + ENSURE_AI(hyjal_trashAI, me->AI())->SetCanAttack(false); npc_escortAI::UpdateAI(diff); } @@ -1301,7 +1301,7 @@ public: if (IsEvent || IsOverrun) { - CAST_AI(hyjal_trashAI, me->AI())->SetCanAttack(false); + ENSURE_AI(hyjal_trashAI, me->AI())->SetCanAttack(false); npc_escortAI::UpdateAI(diff); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index da40ec333a6..1dc86cd4ad4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -209,9 +209,9 @@ public: if (npc_escortAI* pEscortAI = CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, creature->AI())) pEscortAI->Start(true, true, player->GetGUID()); - CAST_AI(npc_escortAI, (creature->AI()))->SetMaxPlayerDistance(100.0f);//not really needed, because it will not despawn if player is too far - CAST_AI(npc_escortAI, (creature->AI()))->SetDespawnAtEnd(false); - CAST_AI(npc_escortAI, (creature->AI()))->SetDespawnAtFar(false); + ENSURE_AI(npc_escortAI, (creature->AI()))->SetMaxPlayerDistance(100.0f);//not really needed, because it will not despawn if player is too far + ENSURE_AI(npc_escortAI, (creature->AI()))->SetDespawnAtEnd(false); + ENSURE_AI(npc_escortAI, (creature->AI()))->SetDespawnAtFar(false); break; case GOSSIP_ACTION_INFO_DEF+2: @@ -227,14 +227,14 @@ public: creature->AI()->Talk(SAY_TH_START_EVENT_PART2); - CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, creature->AI())->StartWP(); + ENSURE_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, creature->AI())->StartWP(); break; case GOSSIP_ACTION_INFO_DEF+3: player->CLOSE_GOSSIP_MENU(); if (instance) instance->SetData(TYPE_THRALL_PART3, IN_PROGRESS); - CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, creature->AI())->StartWP(); + ENSURE_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, creature->AI())->StartWP(); break; } return true; @@ -423,7 +423,7 @@ public: if (Creature* Taretha = instance->instance->GetCreature(instance->GetData64(DATA_TARETHA))) { if (Player* player = GetPlayerForEscort()) - CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, player->GetGUID()); + ENSURE_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, player->GetGUID()); } //kill credit Creature for quest @@ -586,7 +586,7 @@ public: creature->SummonCreature(ENTRY_EPOCH, 2639.13f, 698.55f, 65.43f, 4.59f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); if (Creature* thrall = (ObjectAccessor::GetCreature(*creature, instance->GetData64(DATA_THRALL)))) - CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, thrall->AI())->StartWP(); + ENSURE_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, thrall->AI())->StartWP(); } } return true; diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp index 835fd6228e1..f996bcc6f70 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp @@ -51,7 +51,7 @@ public: { if (quest->GetQuestId() == QUEST_WILLIX_THE_IMPORTER) { - CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); + ENSURE_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); creature->AI()->Talk(SAY_READY, player); creature->setFaction(113); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index c5011eba2f8..3e02406b93d 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -131,7 +131,7 @@ struct boss_twinemperorsAI : public ScriptedAI pOtherBoss->SetHealth(0); pOtherBoss->setDeathState(JUST_DIED); pOtherBoss->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - CAST_AI(boss_twinemperorsAI, pOtherBoss->AI())->DontYellWhenDead = true; + ENSURE_AI(boss_twinemperorsAI, pOtherBoss->AI())->DontYellWhenDead = true; } if (!DontYellWhenDead) // I hope AI is not threaded DoPlaySoundToSet(me, IAmVeklor() ? SOUND_VL_DEATH : SOUND_VN_DEATH); @@ -150,9 +150,9 @@ struct boss_twinemperorsAI : public ScriptedAI { /// @todo we should activate the other boss location so he can start attackning even if nobody // is near I dont know how to do that - ScriptedAI* otherAI = CAST_AI(ScriptedAI, pOtherBoss->AI()); if (!pOtherBoss->IsInCombat()) { + ScriptedAI* otherAI = ENSURE_AI(ScriptedAI, pOtherBoss->AI()); DoPlaySoundToSet(me, IAmVeklor() ? SOUND_VL_AGGRO : SOUND_VN_AGGRO); otherAI->AttackStart(who); otherAI->DoZoneInCombat(); @@ -224,7 +224,7 @@ struct boss_twinemperorsAI : public ScriptedAI me->SetPosition(otherPos); SetAfterTeleport(); - CAST_AI(boss_twinemperorsAI, pOtherBoss->AI())->SetAfterTeleport(); + ENSURE_AI(boss_twinemperorsAI, pOtherBoss->AI())->SetAfterTeleport(); } } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp index e41fbb7d90d..a0d57481c75 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp @@ -122,7 +122,7 @@ public: void GiveBuddyMyList(Creature* c) { - aqsentinelAI* cai = CAST_AI(aqsentinelAI, (c)->AI()); + aqsentinelAI* cai = ENSURE_AI(aqsentinelAI, (c)->AI()); for (int i=0; i<3; ++i) if (NearbyGUID[i] && NearbyGUID[i] != c->GetGUID()) cai->AddBuddyToList(NearbyGUID[i]); @@ -200,8 +200,8 @@ public: break; AddSentinelsNear(pNearby); - CAST_AI(aqsentinelAI, pNearby->AI())->gatherOthersWhenAggro = false; - CAST_AI(aqsentinelAI, pNearby->AI())->selectAbility(pickAbilityRandom(chosenAbilities)); + ENSURE_AI(aqsentinelAI, pNearby->AI())->gatherOthersWhenAggro = false; + ENSURE_AI(aqsentinelAI, pNearby->AI())->selectAbility(pickAbilityRandom(chosenAbilities)); } /*if (bli < 3) DoYell("I dont have enough buddies.", LANG_NEUTRAL, 0);*/ @@ -256,7 +256,7 @@ public: if (sent->isDead()) continue; sent->ModifyHealth(int32(sent->CountPctFromMaxHealth(50))); - CAST_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability); + ENSURE_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability); } } }; diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp index 516da307bfd..bb872421197 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp @@ -99,9 +99,9 @@ public: creature->setFaction(250); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - CAST_AI(npc_escortAI, (creature->AI()))->Start(false, false, player->GetGUID()); - CAST_AI(npc_escortAI, (creature->AI()))->SetDespawnAtFar(false); - CAST_AI(npc_escortAI, (creature->AI()))->SetDespawnAtEnd(false); + ENSURE_AI(npc_escortAI, (creature->AI()))->Start(false, false, player->GetGUID()); + ENSURE_AI(npc_escortAI, (creature->AI()))->SetDespawnAtFar(false); + ENSURE_AI(npc_escortAI, (creature->AI()))->SetDespawnAtEnd(false); } return true; } diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp index 04be688d8aa..7c02ecdb8f2 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp @@ -70,7 +70,7 @@ public: if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_sergeant_bly::npc_sergeant_blyAI, creature->AI())->PlayerGUID = player->GetGUID(); + ENSURE_AI(npc_sergeant_bly::npc_sergeant_blyAI, creature->AI())->PlayerGUID = player->GetGUID(); creature->AI()->DoAction(0); } return true; diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp index c3c1d7c146b..9d906acb312 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -720,7 +720,7 @@ class go_bristlelimb_cage : public GameObjectScript if (Creature* capitive = go->FindNearestCreature(NPC_STILLPINE_CAPITIVE, 5.0f, true)) { go->ResetDoorOrButton(); - CAST_AI(npc_stillpine_capitive::npc_stillpine_capitiveAI, capitive->AI())->StartMoving(player); + ENSURE_AI(npc_stillpine_capitive::npc_stillpine_capitiveAI, capitive->AI())->StartMoving(player); return false; } } diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp index b78bdae5c87..bc6807c54d9 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp @@ -373,8 +373,8 @@ public: { if (Creature* boss = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_JEDOGA_SHADOWSEEKER))) { - if (!CAST_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok) - CAST_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerokFail = true; + if (!ENSURE_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok) + ENSURE_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerokFail = true; if (killer->GetTypeId() == TYPEID_PLAYER) boss->AI()->DoAction(ACTION_INITIAND_KILLED); @@ -421,8 +421,8 @@ public: Creature* boss = me->GetMap()->GetCreature(instance->GetData64(DATA_JEDOGA_SHADOWSEEKER)); if (boss) { - CAST_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok = true; - CAST_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerokFail = false; + ENSURE_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok = true; + ENSURE_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerokFail = false; me->Kill(me); } } diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index e3156e21371..c5b87eb48e8 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -403,7 +403,7 @@ class go_prince_taldaram_sphere : public GameObjectScript break; } - CAST_AI(boss_prince_taldaram::boss_prince_taldaramAI, PrinceTaldaram->AI())->CheckSpheres(); + ENSURE_AI(boss_prince_taldaram::boss_prince_taldaramAI, PrinceTaldaram->AI())->CheckSpheres(); } return true; } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index e22ee040599..4015467501e 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -494,7 +494,7 @@ public: if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_announcer_toc5::npc_announcer_toc5AI, creature->AI())->StartEncounter(); + ENSURE_AI(npc_announcer_toc5::npc_announcer_toc5AI, creature->AI())->StartEncounter(); } return true; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index e40cd9d5f41..a0c42492a1b 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -837,7 +837,7 @@ class spell_power_of_the_twins : public SpellScriptLoader if (InstanceScript* instance = GetCaster()->GetInstanceScript()) { if (Creature* Valk = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(GetCaster()->GetEntry()))) - CAST_AI(boss_twin_baseAI, Valk->AI())->EnableDualWield(true); + ENSURE_AI(boss_twin_baseAI, Valk->AI())->EnableDualWield(true); } } @@ -846,7 +846,7 @@ class spell_power_of_the_twins : public SpellScriptLoader if (InstanceScript* instance = GetCaster()->GetInstanceScript()) { if (Creature* Valk = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(GetCaster()->GetEntry()))) - CAST_AI(boss_twin_baseAI, Valk->AI())->EnableDualWield(false); + ENSURE_AI(boss_twin_baseAI, Valk->AI())->EnableDualWield(false); } } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index 1c126bc54fd..3f8e1cc6ee0 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -624,7 +624,7 @@ class spell_krick_pursuit : public SpellScriptLoader { ick->AI()->Talk(SAY_ICK_CHASE_1, target); ick->AddAura(GetSpellInfo()->Id, target); - CAST_AI(boss_ick::boss_ickAI, ick->AI())->SetTempThreat(ick->getThreatManager().getThreat(target)); + ENSURE_AI(boss_ick::boss_ickAI, ick->AI())->SetTempThreat(ick->getThreatManager().getThreat(target)); ick->AddThreat(target, float(GetEffectValue())); target->AddThreat(ick, float(GetEffectValue())); } @@ -645,7 +645,7 @@ class spell_krick_pursuit : public SpellScriptLoader { if (Unit* caster = GetCaster()) if (Creature* creCaster = caster->ToCreature()) - CAST_AI(boss_ick::boss_ickAI, creCaster->AI())->_ResetThreat(GetTarget()); + ENSURE_AI(boss_ick::boss_ickAI, creCaster->AI())->_ResetThreat(GetTarget()); } void Register() override diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index 9a9e7aa6849..e2ff68ab851 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -147,15 +147,15 @@ public: { if (attack && who) { - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->encounterActionAttack = true; - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->encounterActionAttack = true; - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->encounterActionAttack = true; - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->encounterActionAttack = true; - - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->AttackStart(who); - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->AttackStart(who); - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->AttackStart(who); - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->AttackStart(who); + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->encounterActionAttack = true; + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->encounterActionAttack = true; + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->encounterActionAttack = true; + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->encounterActionAttack = true; + + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->AttackStart(who); + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->AttackStart(who); + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->AttackStart(who); + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->AttackStart(who); } if (reset) @@ -174,15 +174,15 @@ public: if (!Sir->IsAlive()) Sir->Respawn(); - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->encounterActionReset = true; - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->encounterActionReset = true; - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->encounterActionReset = true; - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->encounterActionReset = true; + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->encounterActionReset = true; + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->encounterActionReset = true; + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->encounterActionReset = true; + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->encounterActionReset = true; - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->EnterEvadeMode(); - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->EnterEvadeMode(); - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->EnterEvadeMode(); - CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->EnterEvadeMode(); + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->EnterEvadeMode(); + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->EnterEvadeMode(); + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->EnterEvadeMode(); + ENSURE_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->EnterEvadeMode(); } } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp index 946b60d4e27..5702987cc5a 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp @@ -177,13 +177,13 @@ class spell_loatheb_necrotic_aura_warning : public SpellScriptLoader void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (GetTarget()->IsAIEnabled) - CAST_AI(LoathebAI, GetTarget()->GetAI())->Talk(SAY_NECROTIC_AURA_APPLIED); + ENSURE_AI(LoathebAI, GetTarget()->GetAI())->Talk(SAY_NECROTIC_AURA_APPLIED); } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (GetTarget()->IsAIEnabled) - CAST_AI(LoathebAI, GetTarget()->GetAI())->Talk(SAY_NECROTIC_AURA_REMOVED); + ENSURE_AI(LoathebAI, GetTarget()->GetAI())->Talk(SAY_NECROTIC_AURA_REMOVED); } void Register() override diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp index 38e6a3fc816..bfe34ece6cf 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp @@ -220,7 +220,7 @@ public: go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); go->SetGoState(GO_STATE_ACTIVE); - CAST_AI(boss_keristrasza::boss_keristraszaAI, pKeristrasza->AI())->CheckContainmentSpheres(true); + ENSURE_AI(boss_keristrasza::boss_keristraszaAI, pKeristrasza->AI())->CheckContainmentSpheres(true); } return true; } @@ -271,7 +271,7 @@ class achievement_intense_cold : public AchievementCriteriaScript if (!target) return false; - std::list<uint64> intenseColdList = CAST_AI(boss_keristrasza::boss_keristraszaAI, target->ToCreature()->AI())->intenseColdList; + std::list<uint64> intenseColdList = ENSURE_AI(boss_keristrasza::boss_keristraszaAI, target->ToCreature()->AI())->intenseColdList; if (!intenseColdList.empty()) for (std::list<uint64>::iterator itr = intenseColdList.begin(); itr != intenseColdList.end(); ++itr) if (player->GetGUID() == *itr) diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index 585da8e28d3..f398dd99b5c 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -310,7 +310,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader if (varos->GetEntry() != NPC_VAROS) return; - float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation(); + float orientation = ENSURE_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation(); for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();) { @@ -354,7 +354,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader if (varos->GetEntry() != NPC_VAROS) return; - float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation(); + float orientation = ENSURE_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation(); for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();) { diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp index cedf06a3154..683eb97a4f7 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp @@ -272,7 +272,7 @@ public: if (action == GOSSIP_ACTION_INFO_DEF+1 || action == GOSSIP_ACTION_INFO_DEF+2) { player->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_brann_hos::npc_brann_hosAI, creature->AI())->StartWP(); + ENSURE_AI(npc_brann_hos::npc_brann_hosAI, creature->AI())->StartWP(); } return true; @@ -347,7 +347,7 @@ public: { if (!creature->IsAlive()) creature->Respawn(); - CAST_AI(npc_tribuna_controller::npc_tribuna_controllerAI, creature->AI())->UpdateFacesList(); + ENSURE_AI(npc_tribuna_controller::npc_tribuna_controllerAI, creature->AI())->UpdateFacesList(); uiControllerGUID = creature->GetGUID(); } break; @@ -463,7 +463,7 @@ public: Talk(SAY_EVENT_A_3); instance->HandleGameObject(instance->GetData64(DATA_GO_KADDRAK), true); if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID)) - CAST_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bKaddrakActivated = true; + ENSURE_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bKaddrakActivated = true; JumpToNextStep(5000); break; case 9: @@ -485,7 +485,7 @@ public: Talk(SAY_EVENT_B_3); instance->HandleGameObject(instance->GetData64(DATA_GO_MARNAK), true); if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID)) - CAST_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bMarnakActivated = true; + ENSURE_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bMarnakActivated = true; JumpToNextStep(10000); break; case 13: @@ -515,7 +515,7 @@ public: Talk(SAY_EVENT_C_3); instance->HandleGameObject(instance->GetData64(DATA_GO_ABEDNEUM), true); if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID)) - CAST_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bAbedneumActivated = true; + ENSURE_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bAbedneumActivated = true; JumpToNextStep(5000); break; case 19: diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 57df8c76a56..68bdbe0fdf3 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -1101,7 +1101,7 @@ class npc_ancient_water_spirit : public CreatureScript { instance = me->GetInstanceScript(); if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) - waveCount = CAST_AI(boss_freya::boss_freyaAI, Freya->AI())->trioWaveCount; + waveCount = ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->trioWaveCount; } void Reset() override @@ -1133,8 +1133,8 @@ class npc_ancient_water_spirit : public CreatureScript { if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) { - CAST_AI(boss_freya::boss_freyaAI, Freya->AI())->checkElementalAlive[waveCount] = false; - CAST_AI(boss_freya::boss_freyaAI, Freya->AI())->LasherDead(1); + ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->checkElementalAlive[waveCount] = false; + ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->LasherDead(1); } } @@ -1161,7 +1161,7 @@ class npc_storm_lasher : public CreatureScript { instance = me->GetInstanceScript(); if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) - waveCount = CAST_AI(boss_freya::boss_freyaAI, Freya->AI())->trioWaveCount; + waveCount = ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->trioWaveCount; } void Reset() override @@ -1199,8 +1199,8 @@ class npc_storm_lasher : public CreatureScript { if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) { - CAST_AI(boss_freya::boss_freyaAI, Freya->AI())->checkElementalAlive[waveCount] = false; - CAST_AI(boss_freya::boss_freyaAI, Freya->AI())->LasherDead(2); + ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->checkElementalAlive[waveCount] = false; + ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->LasherDead(2); } } @@ -1228,7 +1228,7 @@ class npc_snaplasher : public CreatureScript { instance = me->GetInstanceScript(); if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) - waveCount = CAST_AI(boss_freya::boss_freyaAI, Freya->AI())->trioWaveCount; + waveCount = ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->trioWaveCount; } void UpdateAI(uint32 /*diff*/) override @@ -1246,8 +1246,8 @@ class npc_snaplasher : public CreatureScript { if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) { - CAST_AI(boss_freya::boss_freyaAI, Freya->AI())->checkElementalAlive[waveCount] = false; - CAST_AI(boss_freya::boss_freyaAI, Freya->AI())->LasherDead(4); + ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->checkElementalAlive[waveCount] = false; + ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->LasherDead(4); } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index ed909d459ca..399113e18c8 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -711,7 +711,7 @@ class npc_expedition_commander : public CreatureScript { case GOSSIP_ACTION_INFO_DEF: player->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_expedition_commanderAI, creature->AI())->Phase = 1; + ENSURE_AI(npc_expedition_commanderAI, creature->AI())->Phase = 1; break; } return true; diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index b623d5e6ddc..9e2bb85e27a 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -267,7 +267,7 @@ public: { case GOSSIP_ACTION_INFO_DEF+1: player->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_sinclari_vh::npc_sinclariAI, (creature->AI()))->uiPhase = 1; + ENSURE_AI(npc_sinclari_vh::npc_sinclariAI, (creature->AI()))->uiPhase = 1; if (InstanceScript* instance = creature->GetInstanceScript()) instance->SetData(DATA_MAIN_EVENT_PHASE, SPECIAL); break; diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index 08936df4589..7f34e470c7e 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -1263,8 +1263,8 @@ public: switch (action) { case GOSSIP_ACTION_INFO_DEF+1: - CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); - CAST_AI(npc_escortAI, (creature->AI()))->SetMaxPlayerDistance(200.0f); + ENSURE_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); + ENSURE_AI(npc_escortAI, (creature->AI()))->SetMaxPlayerDistance(200.0f); break; } return true; @@ -1301,7 +1301,7 @@ public: if (me->IsSummon()) if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - CAST_AI(npc_thassarian::npc_thassarianAI, summoner->ToCreature()->AI())->arthasInPosition = true; + ENSURE_AI(npc_thassarian::npc_thassarianAI, summoner->ToCreature()->AI())->arthasInPosition = true; } }; @@ -1333,7 +1333,7 @@ public: me->CastSpell(me, SPELL_STUN, true); if (me->IsSummon()) if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - CAST_AI(npc_thassarian::npc_thassarianAI, summoner->ToCreature()->AI())->arlosInPosition = true; + ENSURE_AI(npc_thassarian::npc_thassarianAI, summoner->ToCreature()->AI())->arlosInPosition = true; } }; @@ -1387,7 +1387,7 @@ public: if (me->IsSummon()) if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - CAST_AI(npc_thassarian::npc_thassarianAI, summoner->ToCreature()->AI())->talbotInPosition = true; + ENSURE_AI(npc_thassarian::npc_thassarianAI, summoner->ToCreature()->AI())->talbotInPosition = true; } void UpdateAI(uint32 diff) override @@ -1491,14 +1491,14 @@ public: if (!bDone) { if (Creature* talbot = me->FindNearestCreature(NPC_PRINCE_VALANAR, 50.0f, true)) - CAST_AI(npc_counselor_talbot::npc_counselor_talbotAI, talbot->GetAI())->bCheck = true; + ENSURE_AI(npc_counselor_talbot::npc_counselor_talbotAI, talbot->GetAI())->bCheck = true; me->AddUnitState(UNIT_STATE_STUNNED); me->CastSpell(me, SPELL_STUN, true); if (me->IsSummon()) if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - CAST_AI(npc_thassarian::npc_thassarianAI, summoner->GetAI())->leryssaInPosition = true; + ENSURE_AI(npc_thassarian::npc_thassarianAI, summoner->GetAI())->leryssaInPosition = true; bDone = true; } else @@ -1566,7 +1566,7 @@ public: if (Creature* thassarian = summoner->ToCreature()) { thassarian->AI()->Talk(SAY_THASSARIAN_7); - CAST_AI(npc_thassarian::npc_thassarianAI, thassarian->GetAI())->phase = 16; + ENSURE_AI(npc_thassarian::npc_thassarianAI, thassarian->GetAI())->phase = 16; } phaseTimer = 5000; phase = 0; @@ -1812,7 +1812,7 @@ public: } creature->SetStandState(UNIT_STAND_STATE_STAND); creature->AI()->Talk(SAY_1); - CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); + ENSURE_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); } return true; } @@ -1893,7 +1893,7 @@ public: { creature->SetStandState(UNIT_STAND_STATE_STAND); creature->AI()->Talk(SAY_BONKER_2, player); - CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, player->GetGUID()); + ENSURE_AI(npc_escortAI, (creature->AI()))->Start(true, true, player->GetGUID()); } return true; } diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp index c577fb2864f..96fdcbfe990 100644 --- a/src/server/scripts/Northrend/zone_howling_fjord.cpp +++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp @@ -67,7 +67,7 @@ public: creature->setFaction(FACTION_ESCORTEE_H); break; } - CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); + ENSURE_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); } return true; } diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp index 3ec138dcfaa..f9fb3801955 100644 --- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp +++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp @@ -146,8 +146,8 @@ public: player->PlayerTalkClass->ClearMenus(); if (action == GOSSIP_ACTION_INFO_DEF+1) { - CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); - CAST_AI(npc_escortAI, (creature->AI()))->SetMaxPlayerDistance(35.0f); + ENSURE_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); + ENSURE_AI(npc_escortAI, (creature->AI()))->SetMaxPlayerDistance(35.0f); creature->AI()->Talk(SAY_START_IRO); switch (player->GetTeam()){ diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp index 2b3928f322a..7ba0a452941 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp @@ -225,9 +225,8 @@ public: if (Unit* target = ObjectAccessor::GetUnit(*me, soulholder)) { - - CAST_AI(npc_stolen_soul::npc_stolen_soulAI, summoned->AI())->SetMyClass(soulclass); - summoned->AI()->AttackStart(target); + ENSURE_AI(npc_stolen_soul::npc_stolen_soulAI, summoned->AI())->SetMyClass(soulclass); + summoned->AI()->AttackStart(target); } } } diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index ec89acfb7b6..08fc588e923 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -747,7 +747,7 @@ public: flame->setFaction(me->getFaction()); // Just in case the database has it as a different faction flame->SetMeleeDamageSchool(SPELL_SCHOOL_FIRE); FlameGUID[i] = flame->GetGUID(); // Record GUID in order to check if they're dead later on to move to the next phase - CAST_AI(npc_flame_of_azzinoth::flame_of_azzinothAI, flame->AI())->SetGlaiveGUID(GlaiveGUID[i]); + ENSURE_AI(npc_flame_of_azzinoth::flame_of_azzinothAI, flame->AI())->SetGlaiveGUID(GlaiveGUID[i]); glaive->CastSpell(flame, SPELL_AZZINOTH_CHANNEL, false); // Glaives do some random Beam type channel on it. } } @@ -1325,7 +1325,7 @@ public: me->SetVisible(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID)) - CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->DeleteFromThreatList(me->GetGUID()); + ENSURE_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->DeleteFromThreatList(me->GetGUID()); me->AttackStop(); Timer[EVENT_MAIEV_STEALTH] = 60000; // reappear after 1 minute MaxTimer = 1; @@ -1458,8 +1458,8 @@ public: illidan->SetInFront(me); me->GetMotionMaster()->MoveIdle(); illidan->GetMotionMaster()->MoveIdle(); - CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->AkamaGUID = me->GetGUID(); - CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->EnterPhase(PHASE_TALK_SEQUENCE); + ENSURE_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->AkamaGUID = me->GetGUID(); + ENSURE_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->EnterPhase(PHASE_TALK_SEQUENCE); } } @@ -1512,7 +1512,7 @@ public: else if (Phase == PHASE_TALK) { if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID)) - CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->DeleteFromThreatList(me->GetGUID()); + ENSURE_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->DeleteFromThreatList(me->GetGUID()); EnterEvadeMode(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); ++WalkCount; @@ -1566,7 +1566,7 @@ public: case 0: if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID)) { - CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->Timer[EVENT_TAUNT] += 30000; + ENSURE_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->Timer[EVENT_TAUNT] += 30000; illidan->AI()->Talk(SAY_ILLIDAN_MINION); } Timer = 8000; @@ -1849,7 +1849,7 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::JustSummoned(Creature* su summon->SetVisible(false); // Leave her invisible until she has to talk summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); MaievGUID = summon->GetGUID(); - CAST_AI(boss_maiev_shadowsong::boss_maievAI, summon->AI())->GetIllidanGUID(me->GetGUID()); + ENSURE_AI(boss_maiev_shadowsong::boss_maievAI, summon->AI())->GetIllidanGUID(me->GetGUID()); summon->AI()->DoAction(PHASE_TALK_SEQUENCE); } break; @@ -1881,7 +1881,7 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::HandleTalkSequence() { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); me->AddThreat(akama, 100.0f); - CAST_AI(npc_akama_illidan::npc_akama_illidanAI, akama->AI())->EnterPhase(PHASE_FIGHT_ILLIDAN); + ENSURE_AI(npc_akama_illidan::npc_akama_illidanAI, akama->AI())->EnterPhase(PHASE_FIGHT_ILLIDAN); EnterPhase(PHASE_NORMAL); } break; @@ -2040,7 +2040,7 @@ public: // Grid search for nearest live Creature of entry 23304 within 10 yards if (Creature* pTrigger = go->FindNearestCreature(23304, 10.0f)) - CAST_AI(npc_cage_trap_trigger::cage_trap_triggerAI, pTrigger->AI())->Active = true; + ENSURE_AI(npc_cage_trap_trigger::cage_trap_triggerAI, pTrigger->AI())->Active = true; go->SetGoState(GO_STATE_ACTIVE); return true; } @@ -2158,7 +2158,7 @@ public: && !me->EnsureVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND2)) { if (Creature* illidan = ObjectAccessor::GetCreature((*me), IllidanGUID))// summon only in 1. phase - if (CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->Phase == PHASE_NORMAL) + if (ENSURE_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->Phase == PHASE_NORMAL) me->CastSpell(me->GetVictim(), SPELL_PARASITIC_SHADOWFIEND2, true, 0, 0, IllidanGUID); // do not stack } me->AttackerStateUpdate(me->GetVictim()); diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp index 67d456286d5..f3c8af50328 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -215,7 +215,7 @@ public: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { - CAST_AI(npc_enslaved_soul::npc_enslaved_soulAI, Soul->AI())->ReliquaryGUID = me->GetGUID(); + ENSURE_AI(npc_enslaved_soul::npc_enslaved_soulAI, Soul->AI())->ReliquaryGUID = me->GetGUID(); Soul->AI()->AttackStart(target); } else EnterEvadeMode(); return true; @@ -379,7 +379,7 @@ void npc_enslaved_soul::npc_enslaved_soulAI::JustDied(Unit* /*killer*/) { if (ReliquaryGUID) if (Creature* Reliquary = (ObjectAccessor::GetCreature((*me), ReliquaryGUID))) - ++(CAST_AI(boss_reliquary_of_souls::boss_reliquary_of_soulsAI, Reliquary->AI())->SoulDeathCount); + ++(ENSURE_AI(boss_reliquary_of_souls::boss_reliquary_of_soulsAI, Reliquary->AI())->SoulDeathCount); DoCast(me, SPELL_SOUL_RELEASE, true); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index b59d073c17d..6b478bc9dfc 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -439,7 +439,7 @@ public: { if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA))) if (Shade->IsAlive()) - CAST_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->HasKilledAkama = true; + ENSURE_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->HasKilledAkama = true; me->GetMotionMaster()->Clear(true); me->GetMotionMaster()->MoveIdle(); } @@ -778,7 +778,7 @@ public: void IsSummonedBy(Unit* /*summoner*/) override { if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid))) - CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); + ENSURE_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); } void EnterCombat(Unit* /*who*/) override { } @@ -884,7 +884,7 @@ public: void IsSummonedBy(Unit* /*summoner*/) override { if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid))) - CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); + ENSURE_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); } void EnterCombat(Unit* /*who*/) override @@ -974,7 +974,7 @@ public: void IsSummonedBy(Unit* /*summoner*/) override { if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid))) - CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); + ENSURE_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); } void EnterCombat(Unit* /*who*/) override @@ -1054,7 +1054,7 @@ public: void IsSummonedBy(Unit* /*summoner*/) override { if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid))) - CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); + ENSURE_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); } void EnterCombat(Unit* /*who*/) override @@ -1136,7 +1136,7 @@ public: void IsSummonedBy(Unit* /*summoner*/) override { if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid))) - CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); + ENSURE_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index c2bf5966a5c..0bbf2cb2a96 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -366,7 +366,7 @@ public: { Construct->CastSpell(Construct, SPELL_PASSIVE_SHADOWFORM, true); SetThreatList(Construct); // Use same function as Doom Blossom to set Threat List. - CAST_AI(npc_shadowy_construct::npc_shadowy_constructAI, Construct->AI())->GhostGUID = GhostGUID; + ENSURE_AI(npc_shadowy_construct::npc_shadowy_constructAI, Construct->AI())->GhostGUID = GhostGUID; Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!target) // someone's trying to solo. target = me->GetVictim(); @@ -444,7 +444,7 @@ public: DoomBlossom->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoomBlossom->setFaction(me->getFaction()); DoomBlossom->AddThreat(target, 1.0f); - CAST_AI(npc_doom_blossom::npc_doom_blossomAI, DoomBlossom->AI())->SetTeronGUID(me->GetGUID()); + ENSURE_AI(npc_doom_blossom::npc_doom_blossomAI, DoomBlossom->AI())->SetTeronGUID(me->GetGUID()); target->CombatStart(DoomBlossom); SetThreatList(DoomBlossom); SummonDoomBlossomTimer = 35000; diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index b9a9f41ca09..64a6add9801 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -226,7 +226,7 @@ public: { if (InstanceScript* instance = go->GetInstanceScript()) if (Creature* Najentus = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_HIGH_WARLORD_NAJENTUS))) - if (CAST_AI(boss_najentus::boss_najentusAI, Najentus->AI())->RemoveImpalingSpine()) + if (ENSURE_AI(boss_najentus::boss_najentusAI, Najentus->AI())->RemoveImpalingSpine()) { player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true); go->Delete(); diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index ba7730ba566..2c6bac4c9d9 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -291,8 +291,8 @@ public: // Start the event for the Voice Trigger if (Creature* VoiceTrigger = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))) { - CAST_AI(npc_blood_elf_council_voice_trigger::npc_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->LoadCouncilGUIDs(); - CAST_AI(npc_blood_elf_council_voice_trigger::npc_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->EventStarted = true; + ENSURE_AI(npc_blood_elf_council_voice_trigger::npc_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->LoadCouncilGUIDs(); + ENSURE_AI(npc_blood_elf_council_voice_trigger::npc_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->EventStarted = true; } for (uint8 i = 0; i < 4; ++i) @@ -393,7 +393,7 @@ struct boss_illidari_councilAI : public ScriptedAI void EnterCombat(Unit* who) override { if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ILLIDARI_COUNCIL))) - CAST_AI(npc_illidari_council::npc_illidari_councilAI, controller->AI())->StartEvent(who); + ENSURE_AI(npc_illidari_council::npc_illidari_councilAI, controller->AI())->StartEvent(who); DoZoneInCombat(); // Load GUIDs on first aggro because the Creature guids are only set as the creatures are created in world- // this means that for each creature, it will attempt to LoadGUIDs even though some of the other creatures are diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index 0f9a10e5c4f..7e24f4b54b2 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp @@ -343,7 +343,7 @@ public: void JustDied(Unit* /*killer*/) override { if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KARATHRESS))) - CAST_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventSharkkisDeath(); + ENSURE_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventSharkkisDeath(); } void EnterCombat(Unit* who) override @@ -469,7 +469,7 @@ public: void JustDied(Unit* /*killer*/) override { if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KARATHRESS))) - CAST_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventTidalvessDeath(); + ENSURE_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventTidalvessDeath(); } void EnterCombat(Unit* who) override @@ -585,7 +585,7 @@ public: void JustDied(Unit* /*killer*/) override { if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KARATHRESS))) - CAST_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventCaribdisDeath(); + ENSURE_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventCaribdisDeath(); } void EnterCombat(Unit* who) override diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index f877ce83b37..a241f2bea37 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -621,7 +621,7 @@ public: DoCast(me, SPELL_SURGE); } if (Creature* vashj = ObjectAccessor::GetCreature(*me, VashjGUID)) - if (!vashj->IsInCombat() || CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase != 2 || vashj->isDead()) + if (!vashj->IsInCombat() || ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase != 2 || vashj->isDead()) me->Kill(me); Move = 1000; } else Move -= diff; @@ -663,7 +663,7 @@ public: void JustDied(Unit* /*killer*/) override { if (Creature* vashj = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_LADYVASHJ))) - CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->EventTaintedElementalDeath(); + ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->EventTaintedElementalDeath(); } void EnterCombat(Unit* who) override @@ -779,7 +779,7 @@ public: { // check if vashj is death Unit* Vashj = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ)); - if (!Vashj || !Vashj->IsAlive() || CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->ToCreature()->AI())->Phase != 3) + if (!Vashj || !Vashj->IsAlive() || ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->ToCreature()->AI())->Phase != 3) { // remove me->setDeathState(DEAD); @@ -866,7 +866,7 @@ public: } Creature* vashj = ObjectAccessor::GetCreature((*player), instance->GetData64(DATA_LADYVASHJ)); - if (vashj && (CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase == 2)) + if (vashj && (ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase == 2)) { if (GameObject* gObj = targets.GetGOTarget()) { @@ -901,7 +901,7 @@ public: } // get and remove channel - if (Unit* channel = ObjectAccessor::GetCreature(*vashj, CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->ShieldGeneratorChannel[channelIdentifier])) + if (Unit* channel = ObjectAccessor::GetCreature(*vashj, ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->ShieldGeneratorChannel[channelIdentifier])) channel->setDeathState(JUST_DIED); // call Unsummon() instance->SetData(identifier, 1); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index cc09952d336..8e478aadeca 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -703,7 +703,7 @@ public: instance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, 0); Creature* leotheras = ObjectAccessor::GetCreature(*me, leotherasGUID); if (leotheras && leotheras->IsAlive()) - CAST_AI(boss_leotheras_the_blind::boss_leotheras_the_blindAI, leotheras->AI())->CheckChannelers(/*false*/); + ENSURE_AI(boss_leotheras_the_blind::boss_leotheras_the_blindAI, leotheras->AI())->CheckChannelers(/*false*/); } void EnterCombat(Unit* who) override diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp index ab6e0afaab4..8024d5138eb 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp @@ -168,7 +168,7 @@ public: { Talk(SAY_REGEN); DoCast(me, SPELL_WARLORDS_RAGE); - CAST_AI(npc_naga_distiller::npc_naga_distillerAI, distiller->AI())->StartRageGen(me); + ENSURE_AI(npc_naga_distiller::npc_naga_distillerAI, distiller->AI())->StartRageGen(me); } Rage_Timer = 3000 + rand32() % 15000; } else Rage_Timer -= diff; diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp index e56b82d4507..b2f199008d0 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp @@ -291,7 +291,7 @@ class npc_shadowmoon_channeler : public CreatureScript void EnterCombat(Unit* who) override { if (Creature* Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100)) - CAST_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->ChannelerEngaged(who); + ENSURE_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->ChannelerEngaged(who); if (me->IsNonMeleeSpellCast(false)) me->InterruptNonMeleeSpells(true); DoStartMovement(who); @@ -300,7 +300,7 @@ class npc_shadowmoon_channeler : public CreatureScript void JustDied(Unit* killer) override { if (Creature* Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100)) - CAST_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->ChannelerDied(killer); + ENSURE_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->ChannelerDied(killer); } void UpdateAI(uint32 diff) override @@ -312,7 +312,7 @@ class npc_shadowmoon_channeler : public CreatureScript if (!me->IsNonMeleeSpellCast(false)) if (Creature* Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100)) { - uint64 channeler = CAST_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->GetChanneled(me); + uint64 channeler = ENSURE_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->GetChanneled(me); if (Unit* channeled = ObjectAccessor::GetUnit(*me, channeler)) DoCast(channeled, SPELL_CHANNELING); } diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index b15bd18c97c..839dd800721 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -468,7 +468,7 @@ class npc_hellfire_sentry : public CreatureScript void JustDied(Unit* killer) override { if (Creature* herald = me->FindNearestCreature(NPC_VAZRUDEN_HERALD, 150)) - CAST_AI(boss_vazruden_the_herald::boss_vazruden_the_heraldAI, herald->AI())->SentryDownBy(killer); + ENSURE_AI(boss_vazruden_the_herald::boss_vazruden_the_heraldAI, herald->AI())->SentryDownBy(killer); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index c6756feb0ce..8a5d6e41780 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -405,7 +405,7 @@ class boss_magtheridon : public CreatureScript Creature* summon = me->SummonCreature(NPC_ABYSSAL, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (summon) { - CAST_AI(npc_abyssal::npc_abyssalAI, summon->AI())->SetTrigger(2); + ENSURE_AI(npc_abyssal::npc_abyssalAI, summon->AI())->SetTrigger(2); DoCast(summon, SPELL_BLAZE_TARGET, true); summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } @@ -437,7 +437,7 @@ class boss_magtheridon : public CreatureScript target->GetPosition(x, y, z); Creature* summon = me->SummonCreature(NPC_ABYSSAL, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (summon) - CAST_AI(npc_abyssal::npc_abyssalAI, summon->AI())->SetTrigger(1); + ENSURE_AI(npc_abyssal::npc_abyssalAI, summon->AI())->SetTrigger(1); } Debris_Timer = 10000; } @@ -599,7 +599,7 @@ public: player->InterruptNonMeleeSpells(false); player->CastSpell(player, SPELL_SHADOW_GRASP, true); player->CastSpell(player, SPELL_SHADOW_GRASP_VISUAL, false); - CAST_AI(boss_magtheridon::boss_magtheridonAI, Magtheridon->AI())->SetClicker(go->GetGUID(), player->GetGUID()); + ENSURE_AI(boss_magtheridon::boss_magtheridonAI, Magtheridon->AI())->SetClicker(go->GetGUID(), player->GetGUID()); return true; } }; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index 29f240773e5..64deebce8b8 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -697,7 +697,7 @@ class boss_kaelthas : public CreatureScript if (!Advisor) TC_LOG_ERROR("scripts", "SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i); else - CAST_AI(advisorbase_ai, Advisor->AI())->Revive(target); + ENSURE_AI(advisorbase_ai, Advisor->AI())->Revive(target); } PhaseSubphase = 1; diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp index a1335290d5a..0981fc527f3 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp @@ -186,7 +186,7 @@ class boss_warp_splinter : public CreatureScript float O = - me->GetAngle(X, Y); if (Creature* pTreant = me->SummonCreature(CREATURE_TREANT, treant_pos[i][0], treant_pos[i][1], treant_pos[i][2], O, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000)) - CAST_AI(npc_warp_splinter_treant::npc_warp_splinter_treantAI, pTreant->AI())->WarpGuid = me->GetGUID(); + ENSURE_AI(npc_warp_splinter_treant::npc_warp_splinter_treantAI, pTreant->AI())->WarpGuid = me->GetGUID(); } Talk(SAY_SUMMON); } diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index 6f331425be0..42be5ba8c90 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -347,8 +347,8 @@ public: if (manaforge) { - CAST_AI(npc_manaforge_control_console::npc_manaforge_control_consoleAI, manaforge->AI())->someplayer = player->GetGUID(); - CAST_AI(npc_manaforge_control_console::npc_manaforge_control_consoleAI, manaforge->AI())->goConsole = go->GetGUID(); + ENSURE_AI(npc_manaforge_control_console::npc_manaforge_control_consoleAI, manaforge->AI())->someplayer = player->GetGUID(); + ENSURE_AI(npc_manaforge_control_console::npc_manaforge_control_consoleAI, manaforge->AI())->goConsole = go->GetGUID(); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); } return true; @@ -638,7 +638,7 @@ public: if (!Dawnforge) return false; - if (CAST_AI(npc_commander_dawnforge::npc_commander_dawnforgeAI, Dawnforge->AI())->CanStartEvent(player)) + if (ENSURE_AI(npc_commander_dawnforge::npc_commander_dawnforgeAI, Dawnforge->AI())->CanStartEvent(player)) return true; } return false; @@ -860,7 +860,7 @@ public: { creature->setFaction(113); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); + ENSURE_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); } return true; } diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index e1590873455..b9b87fd5d6a 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -643,8 +643,8 @@ public: { if (_Quest->GetQuestId() == QUEST_LORD_ILLIDAN_STORMRAGE) { - CAST_AI(npc_overlord_morghor::npc_overlord_morghorAI, creature->AI())->PlayerGUID = player->GetGUID(); - CAST_AI(npc_overlord_morghor::npc_overlord_morghorAI, creature->AI())->StartEvent(); + ENSURE_AI(npc_overlord_morghor::npc_overlord_morghorAI, creature->AI())->PlayerGUID = player->GetGUID(); + ENSURE_AI(npc_overlord_morghor::npc_overlord_morghorAI, creature->AI())->StartEvent(); return true; } return false; @@ -1509,7 +1509,7 @@ public: me->RemoveCorpse(); if (Creature* LordIllidan = (ObjectAccessor::GetCreature(*me, LordIllidanGUID))) if (LordIllidan) - CAST_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, LordIllidan->AI())->LiveCounter(); + ENSURE_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, LordIllidan->AI())->LiveCounter(); } void UpdateAI(uint32 diff) override @@ -1644,14 +1644,14 @@ void npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave() Spawn->GetMotionMaster()->MovePoint(0, x, y, z); } } - CAST_AI(npc_illidari_spawn::npc_illidari_spawnAI, Spawn->AI())->LordIllidanGUID = me->GetGUID(); + ENSURE_AI(npc_illidari_spawn::npc_illidari_spawnAI, Spawn->AI())->LordIllidanGUID = me->GetGUID(); } if (WavesInfo[WaveCount].CreatureId == 22076) // Torloth { - CAST_AI(npc_torloth_the_magnificent::npc_torloth_the_magnificentAI, Spawn->AI())->LordIllidanGUID = me->GetGUID(); + ENSURE_AI(npc_torloth_the_magnificent::npc_torloth_the_magnificentAI, Spawn->AI())->LordIllidanGUID = me->GetGUID(); if (PlayerGUID) - CAST_AI(npc_torloth_the_magnificent::npc_torloth_the_magnificentAI, Spawn->AI())->AggroTargetGUID = PlayerGUID; + ENSURE_AI(npc_torloth_the_magnificent::npc_torloth_the_magnificentAI, Spawn->AI())->AggroTargetGUID = PlayerGUID; } } } @@ -1675,11 +1675,11 @@ public: { Creature* Illidan = player->FindNearestCreature(22083, 50); - if (Illidan && !CAST_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->EventStarted) + if (Illidan && !ENSURE_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->EventStarted) { - CAST_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->PlayerGUID = player->GetGUID(); - CAST_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->LiveCount = 0; - CAST_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->EventStarted=true; + ENSURE_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->PlayerGUID = player->GetGUID(); + ENSURE_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->LiveCount = 0; + ENSURE_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->EventStarted = true; } } return true; diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp index c0755b6b06b..da7ae03a8ee 100644 --- a/src/server/scripts/Outland/zone_terokkar_forest.cpp +++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp @@ -529,7 +529,7 @@ public: { if (quest->GetQuestId() == QUEST_EFTW_H || quest->GetQuestId() == QUEST_EFTW_A) { - CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); + ENSURE_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); creature->setFaction(113); } return true; diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 9b9b774fdcc..3bd61ddf465 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -1046,7 +1046,7 @@ class spell_pri_shadow_word_death : public SpellScriptLoader if (AuraEffect* aurEff = GetCaster()->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_PAIN_AND_SUFFERING, EFFECT_1)) AddPct(damage, aurEff->GetAmount()); - GetCaster()->CastCustomSpell(GetCaster(), SPELL_PRIEST_SHADOW_WORD_DEATH, &damage, 0, 0, true); + GetCaster()->CastCustomSpell(GetCaster(), SPELL_PRIEST_SHADOW_WORD_DEATH, &damage, nullptr, nullptr, true); } void Register() override diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 854bc77671b..87661710f53 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1773,7 +1773,7 @@ class spell_q12847_summon_soul_moveto_bunny : public SpellScriptLoader } }; - SpellScript *GetSpellScript() const + SpellScript *GetSpellScript() const override { return new spell_q12847_summon_soul_moveto_bunny_SpellScript(); } diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index d0c2e18c353..1ae01daa5f5 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -645,7 +645,7 @@ class spell_rog_prey_on_the_weak : public SpellScriptLoader if (!target->HasAura(SPELL_ROGUE_PREY_ON_THE_WEAK)) { int32 bp = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); - target->CastCustomSpell(target, SPELL_ROGUE_PREY_ON_THE_WEAK, &bp, 0, 0, true); + target->CastCustomSpell(target, SPELL_ROGUE_PREY_ON_THE_WEAK, &bp, nullptr, nullptr, true); } } else diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 969bfa57d58..e39cf9096f4 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -392,7 +392,7 @@ public: bool OnQuestAccept(Player* /*player*/, Creature* creature, Quest const* quest) override { if (quest->GetQuestId() == QUEST_CLUCK) - CAST_AI(npc_chicken_cluck::npc_chicken_cluckAI, creature->AI())->Reset(); + ENSURE_AI(npc_chicken_cluck::npc_chicken_cluckAI, creature->AI())->Reset(); return true; } @@ -400,7 +400,7 @@ public: bool OnQuestComplete(Player* /*player*/, Creature* creature, Quest const* quest) override { if (quest->GetQuestId() == QUEST_CLUCK) - CAST_AI(npc_chicken_cluck::npc_chicken_cluckAI, creature->AI())->Reset(); + ENSURE_AI(npc_chicken_cluck::npc_chicken_cluckAI, creature->AI())->Reset(); return true; } @@ -692,7 +692,7 @@ public: bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override { if ((quest->GetQuestId() == 6624) || (quest->GetQuestId() == 6622)) - CAST_AI(npc_doctor::npc_doctorAI, creature->AI())->BeginEvent(player); + ENSURE_AI(npc_doctor::npc_doctorAI, creature->AI())->BeginEvent(player); return true; } @@ -763,7 +763,7 @@ public: if (player->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE) if (DoctorGUID) if (Creature* doctor = ObjectAccessor::GetCreature(*me, DoctorGUID)) - CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientSaved(me, player, Coord); + ENSURE_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientSaved(me, player, Coord); //make not selectable me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -809,7 +809,7 @@ public: if (DoctorGUID) if (Creature* doctor = ObjectAccessor::GetCreature((*me), DoctorGUID)) - CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientDied(Coord); + ENSURE_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientDied(Coord); } } }; @@ -859,8 +859,8 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 diff) Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); Patients.push_back(Patient->GetGUID()); - CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->DoctorGUID = me->GetGUID(); - CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = point; + ENSURE_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->DoctorGUID = me->GetGUID(); + ENSURE_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = point; Coordinates.erase(itr); } diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h index e74e707a942..e9e9d4d58c0 100644 --- a/src/server/shared/Common.h +++ b/src/server/shared/Common.h @@ -19,46 +19,6 @@ #ifndef TRINITYCORE_COMMON_H #define TRINITYCORE_COMMON_H -// config.h needs to be included 1st -/// @todo this thingy looks like hack, but its not, need to -// make separate header however, because It makes mess here. -#ifdef HAVE_CONFIG_H -// Remove Some things that we will define -// This is in case including another config.h -// before trinity config.h -#ifdef PACKAGE -#undef PACKAGE -#endif //PACKAGE -#ifdef PACKAGE_BUGREPORT -#undef PACKAGE_BUGREPORT -#endif //PACKAGE_BUGREPORT -#ifdef PACKAGE_NAME -#undef PACKAGE_NAME -#endif //PACKAGE_NAME -#ifdef PACKAGE_STRING -#undef PACKAGE_STRING -#endif //PACKAGE_STRING -#ifdef PACKAGE_TARNAME -#undef PACKAGE_TARNAME -#endif //PACKAGE_TARNAME -#ifdef PACKAGE_VERSION -#undef PACKAGE_VERSION -#endif //PACKAGE_VERSION -#ifdef VERSION -#undef VERSION -#endif //VERSION - -# include "Config.h" - -#undef PACKAGE -#undef PACKAGE_BUGREPORT -#undef PACKAGE_NAME -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -#undef PACKAGE_VERSION -#undef VERSION -#endif //HAVE_CONFIG_H - #include "Define.h" #include <unordered_map> @@ -85,6 +45,13 @@ #if PLATFORM == PLATFORM_WINDOWS # include <ws2tcpip.h> + +# if defined(__INTEL_COMPILER) +# if !defined(BOOST_ASIO_HAS_MOVE) +# define BOOST_ASIO_HAS_MOVE +# endif // !defined(BOOST_ASIO_HAS_MOVE) +# endif // if defined(__INTEL_COMPILER) + #else # include <sys/types.h> # include <sys/ioctl.h> diff --git a/src/server/shared/Database/DatabaseWorker.cpp b/src/server/shared/Database/DatabaseWorker.cpp index ca48ebdd811..e130429c8d0 100644 --- a/src/server/shared/Database/DatabaseWorker.cpp +++ b/src/server/shared/Database/DatabaseWorker.cpp @@ -50,7 +50,7 @@ void DatabaseWorker::WorkerThread() _queue->WaitAndPop(operation); - if (_cancelationToken) + if (_cancelationToken || !operation) return; operation->SetConnection(_connection); diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index 18797b6b12a..5548e44c925 100644 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -35,7 +35,7 @@ class PingOperation : public SQLOperation { //! Operation for idle delaythreads - bool Execute() + bool Execute() override { m_conn->Ping(); return true; @@ -45,6 +45,14 @@ class PingOperation : public SQLOperation template <class T> class DatabaseWorkerPool { + private: + enum InternalIndex + { + IDX_ASYNC, + IDX_SYNCH, + IDX_SIZE + }; + public: /* Activity state */ DatabaseWorkerPool() : _connectionInfo(NULL) @@ -74,34 +82,17 @@ class DatabaseWorkerPool TC_LOG_INFO("sql.driver", "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.", GetDatabaseName(), async_threads, synch_threads); - //! Open asynchronous connections (delayed operations) - _connections[IDX_ASYNC].resize(async_threads); - for (uint8 i = 0; i < async_threads; ++i) - { - T* t = new T(_queue, *_connectionInfo); - res &= t->Open(); - if (res) // only check mysql version if connection is valid - WPFatal(mysql_get_server_version(t->GetHandle()) >= MIN_MYSQL_SERVER_VERSION, "TrinityCore does not support MySQL versions below 5.1"); - _connections[IDX_ASYNC][i] = t; - ++_connectionCount[IDX_ASYNC]; - } + res = OpenConnections(IDX_ASYNC, async_threads); - //! Open synchronous connections (direct, blocking operations) - _connections[IDX_SYNCH].resize(synch_threads); - for (uint8 i = 0; i < synch_threads; ++i) - { - T* t = new T(*_connectionInfo); - res &= t->Open(); - _connections[IDX_SYNCH][i] = t; - ++_connectionCount[IDX_SYNCH]; - } + if (!res) + return res; + + res = OpenConnections(IDX_SYNCH, synch_threads); if (res) TC_LOG_INFO("sql.driver", "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(), (_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC])); - else - TC_LOG_ERROR("sql.driver", "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " - "for specific errors. Read wiki at http://collab.kpsn.org/display/tc/TrinityCore+Home", GetDatabaseName()); + return res; } @@ -112,8 +103,6 @@ class DatabaseWorkerPool for (uint8 i = 0; i < _connectionCount[IDX_ASYNC]; ++i) { T* t = _connections[IDX_ASYNC][i]; - DatabaseWorker* worker = t->m_worker; - delete worker; t->Close(); //! Closes the actualy MySQL connection. } @@ -442,7 +431,7 @@ class DatabaseWorkerPool if (str.empty()) return; - char* buf = new char[str.size()*2+1]; + char* buf = new char[str.size() * 2 + 1]; EscapeString(buf, str.c_str(), str.size()); str = buf; delete[] buf; @@ -470,6 +459,54 @@ class DatabaseWorkerPool } private: + bool OpenConnections(InternalIndex type, uint8 numConnections) + { + _connections[type].resize(numConnections); + for (uint8 i = 0; i < numConnections; ++i) + { + T* t; + + if (type == IDX_ASYNC) + t = new T(_queue, *_connectionInfo); + else if (type == IDX_SYNCH) + t = new T(*_connectionInfo); + else + ASSERT(false); + + _connections[type][i] = t; + ++_connectionCount[type]; + + bool res = t->Open(); + + if (res) + { + if (mysql_get_server_version(t->GetHandle()) < MIN_MYSQL_SERVER_VERSION) + { + TC_LOG_ERROR("sql.driver", "TrinityCore does not support MySQL versions below 5.1"); + res = false; + } + } + + // Failed to open a connection or invalid version, abort and cleanup + if (!res) + { + TC_LOG_ERROR("sql.driver", "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " + "for specific errors. Read wiki at http://collab.kpsn.org/display/tc/TrinityCore+Home", GetDatabaseName()); + + while (_connectionCount[type] != 0) + { + T* t = _connections[type][i--]; + delete t; + --_connectionCount[type]; + } + + return false; + } + } + + return true; + } + unsigned long EscapeString(char *to, const char *from, unsigned long length) { if (!to || !from || !length) @@ -507,14 +544,6 @@ class DatabaseWorkerPool return _connectionInfo->database.c_str(); } - private: - enum _internalIndex - { - IDX_ASYNC, - IDX_SYNCH, - IDX_SIZE - }; - ProducerConsumerQueue<SQLOperation*>* _queue; //! Queue shared by async worker threads. std::vector< std::vector<T*> > _connections; uint32 _connectionCount[2]; //! Counter of MySQL connections; diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 73eac6e30d6..5accf57f132 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -29,7 +29,7 @@ class CharacterDatabaseConnection : public MySQLConnection CharacterDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } //- Loads database type specific prepared statements - void DoPrepareStatements(); + void DoPrepareStatements() override; }; typedef DatabaseWorkerPool<CharacterDatabaseConnection> CharacterDatabaseWorkerPool; diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h index 830fd625931..6fc452808de 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.h +++ b/src/server/shared/Database/Implementation/LoginDatabase.h @@ -29,7 +29,7 @@ class LoginDatabaseConnection : public MySQLConnection LoginDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } //- Loads database type specific prepared statements - void DoPrepareStatements(); + void DoPrepareStatements() override; }; typedef DatabaseWorkerPool<LoginDatabaseConnection> LoginDatabaseWorkerPool; diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h index c8c38d8a629..625dfc68ce6 100644 --- a/src/server/shared/Database/Implementation/WorldDatabase.h +++ b/src/server/shared/Database/Implementation/WorldDatabase.h @@ -29,7 +29,7 @@ class WorldDatabaseConnection : public MySQLConnection WorldDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } //- Loads database type specific prepared statements - void DoPrepareStatements(); + void DoPrepareStatements() override; }; typedef DatabaseWorkerPool<WorldDatabaseConnection> WorldDatabaseWorkerPool; diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index 8b24f508331..4e46ff0e3a1 100644 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -57,12 +57,14 @@ m_connectionFlags(CONNECTION_ASYNC) MySQLConnection::~MySQLConnection() { - ASSERT (m_Mysql); /// MySQL context must be present at this point - for (size_t i = 0; i < m_stmts.size(); ++i) delete m_stmts[i]; - mysql_close(m_Mysql); + if (m_Mysql) + mysql_close(m_Mysql); + + if (m_worker) + delete m_worker; } void MySQLConnection::Close() @@ -112,7 +114,7 @@ bool MySQLConnection::Open() else // generic case { port = atoi(m_connectionInfo.port_or_socket.c_str()); - unix_socket = 0; + unix_socket = nullptr; } #endif diff --git a/src/server/shared/Database/PreparedStatement.h b/src/server/shared/Database/PreparedStatement.h index 16f7a9141d3..5af52cde016 100644 --- a/src/server/shared/Database/PreparedStatement.h +++ b/src/server/shared/Database/PreparedStatement.h @@ -163,7 +163,7 @@ class PreparedStatementTask : public SQLOperation PreparedStatementTask(PreparedStatement* stmt, bool async = false); ~PreparedStatementTask(); - bool Execute(); + bool Execute() override; PreparedQueryResultFuture GetFuture() { return m_result->get_future(); } protected: diff --git a/src/server/shared/Database/QueryHolder.h b/src/server/shared/Database/QueryHolder.h index 37e23ecd653..273980c3ac5 100644 --- a/src/server/shared/Database/QueryHolder.h +++ b/src/server/shared/Database/QueryHolder.h @@ -52,7 +52,7 @@ class SQLQueryHolderTask : public SQLOperation SQLQueryHolderTask(SQLQueryHolder* holder) : m_holder(holder) { }; - bool Execute(); + bool Execute() override; QueryResultHolderFuture GetFuture() { return m_result.get_future(); } }; diff --git a/src/server/shared/Database/QueryResult.cpp b/src/server/shared/Database/QueryResult.cpp index 06b09d43168..a7b8ec2b107 100644 --- a/src/server/shared/Database/QueryResult.cpp +++ b/src/server/shared/Database/QueryResult.cpp @@ -124,7 +124,7 @@ m_length(NULL) *m_rBind[fIndex].length); break; default: - m_rows[uint32(m_rowPosition)][fIndex].SetByteValue(0, + m_rows[uint32(m_rowPosition)][fIndex].SetByteValue(nullptr, m_rBind[fIndex].buffer_length, m_rBind[fIndex].buffer_type, *m_rBind[fIndex].length); diff --git a/src/server/shared/Database/Transaction.h b/src/server/shared/Database/Transaction.h index c7cbbbbe712..3822c2c82c1 100644 --- a/src/server/shared/Database/Transaction.h +++ b/src/server/shared/Database/Transaction.h @@ -63,7 +63,7 @@ class TransactionTask : public SQLOperation ~TransactionTask(){ }; protected: - bool Execute(); + bool Execute() override; SQLTransaction m_trans; }; diff --git a/src/server/shared/Define.h b/src/server/shared/Define.h index 2a04b8cdfad..8350815243c 100644 --- a/src/server/shared/Define.h +++ b/src/server/shared/Define.h @@ -28,6 +28,9 @@ # if !defined(__STDC_CONSTANT_MACROS) # define __STDC_CONSTANT_MACROS # endif +# if !defined(_GLIBCXX_USE_NANOSLEEP) +# define _GLIBCXX_USE_NANOSLEEP +# endif #endif #include <cstddef> diff --git a/src/server/shared/Dynamic/LinkedList.h b/src/server/shared/Dynamic/LinkedList.h index 402aaf3d40c..87bbeaac380 100644 --- a/src/server/shared/Dynamic/LinkedList.h +++ b/src/server/shared/Dynamic/LinkedList.h @@ -150,7 +150,7 @@ class LinkedListHead typedef _Ty& reference; typedef _Ty const & const_reference; - Iterator() : _Ptr(0) + Iterator() : _Ptr(nullptr) { // construct with null node pointer } diff --git a/src/server/shared/Logging/AppenderConsole.h b/src/server/shared/Logging/AppenderConsole.h index b8f15b4fa0f..5b66f86650d 100644 --- a/src/server/shared/Logging/AppenderConsole.h +++ b/src/server/shared/Logging/AppenderConsole.h @@ -51,7 +51,7 @@ class AppenderConsole: public Appender private: void SetColor(bool stdout_stream, ColorTypes color); void ResetColor(bool stdout_stream); - void _write(LogMessage const& message); + void _write(LogMessage const& message) override; bool _colored; ColorTypes _colors[MaxLogLevels]; }; diff --git a/src/server/shared/Logging/AppenderDB.h b/src/server/shared/Logging/AppenderDB.h index 660992261fd..b86252d0d67 100644 --- a/src/server/shared/Logging/AppenderDB.h +++ b/src/server/shared/Logging/AppenderDB.h @@ -31,7 +31,7 @@ class AppenderDB: public Appender private: uint32 realmId; bool enabled; - void _write(LogMessage const& message); + void _write(LogMessage const& message) override; }; #endif diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h index a600c92d152..37ba2769e19 100644 --- a/src/server/shared/Logging/AppenderFile.h +++ b/src/server/shared/Logging/AppenderFile.h @@ -30,7 +30,7 @@ class AppenderFile: public Appender private: void CloseFile(); - void _write(LogMessage const& message); + void _write(LogMessage const& message) override; FILE* logfile; std::string filename; std::string logDir; diff --git a/src/server/shared/Networking/AsyncAcceptor.h b/src/server/shared/Networking/AsyncAcceptor.h index d056731bb79..64665c2b198 100644 --- a/src/server/shared/Networking/AsyncAcceptor.h +++ b/src/server/shared/Networking/AsyncAcceptor.h @@ -18,6 +18,7 @@ #ifndef __ASYNCACCEPT_H_ #define __ASYNCACCEPT_H_ +#include "Log.h" #include <boost/asio.hpp> using boost::asio::ip::tcp; @@ -49,8 +50,15 @@ private: { if (!error) { - // this-> is required here to fix an segmentation fault in gcc 4.7.2 - reason is lambdas in a templated class - std::make_shared<T>(std::move(this->_socket))->Start(); + try + { + // this-> is required here to fix an segmentation fault in gcc 4.7.2 - reason is lambdas in a templated class + std::make_shared<T>(std::move(this->_socket))->Start(); + } + catch (boost::system::system_error const& err) + { + TC_LOG_INFO("network", "Failed to retrieve client's remote address %s", err.what()); + } } // lets slap some more this-> on this so we can fix this bug with gcc 4.7.2 throwing internals in yo face diff --git a/src/server/shared/Networking/MessageBuffer.h b/src/server/shared/Networking/MessageBuffer.h new file mode 100644 index 00000000000..547b39130a4 --- /dev/null +++ b/src/server/shared/Networking/MessageBuffer.h @@ -0,0 +1,93 @@ +/* +* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __MESSAGEBUFFER_H_ +#define __MESSAGEBUFFER_H_ + +#include "Define.h" +#include <vector> + +class MessageBuffer +{ + typedef std::vector<uint8>::size_type size_type; + +public: + MessageBuffer() : _wpos(0), _storage() { } + + MessageBuffer(MessageBuffer const& right) : _wpos(right._wpos), _storage(right._storage) { } + + MessageBuffer(MessageBuffer&& right) : _wpos(right._wpos), _storage(right.Move()) { } + + void Reset() + { + _storage.clear(); + _wpos = 0; + } + + bool IsMessageReady() const { return _wpos == _storage.size(); } + + size_type GetMissingSize() const { return _storage.size() - _wpos; } + + uint8* Data() { return _storage.data(); } + + void Grow(size_type bytes) + { + _storage.resize(_storage.size() + bytes); + } + + uint8* GetWritePointer() { return &_storage[_wpos]; } + + void WriteCompleted(size_type bytes) { _wpos += bytes; } + + void ResetWritePointer() { _wpos = 0; } + + size_type GetSize() const { return _storage.size(); } + + std::vector<uint8>&& Move() + { + _wpos = 0; + return std::move(_storage); + } + + MessageBuffer& operator=(MessageBuffer& right) + { + if (this != &right) + { + _wpos = right._wpos; + _storage = right._storage; + } + + return *this; + } + + MessageBuffer& operator=(MessageBuffer&& right) + { + if (this != &right) + { + _wpos = right._wpos; + _storage = right.Move(); + } + + return *this; + } + +private: + size_type _wpos; + std::vector<uint8> _storage; +}; + +#endif /* __MESSAGEBUFFER_H_ */ diff --git a/src/server/shared/Networking/Socket.h b/src/server/shared/Networking/Socket.h index 38d88e3592c..dd638c059a5 100644 --- a/src/server/shared/Networking/Socket.h +++ b/src/server/shared/Networking/Socket.h @@ -18,8 +18,9 @@ #ifndef __SOCKET_H__ #define __SOCKET_H__ -#include "Define.h" +#include "MessageBuffer.h" #include "Log.h" +#include <atomic> #include <vector> #include <mutex> #include <queue> @@ -28,68 +29,92 @@ #include <type_traits> #include <boost/asio/ip/tcp.hpp> #include <boost/asio/write.hpp> +#include <boost/asio/read.hpp> using boost::asio::ip::tcp; +#define READ_BLOCK_SIZE 4096 + template<class T, class PacketType> class Socket : public std::enable_shared_from_this<T> { typedef typename std::conditional<std::is_pointer<PacketType>::value, PacketType, PacketType const&>::type WritePacketType; public: - Socket(tcp::socket&& socket, std::size_t headerSize) : _socket(std::move(socket)), _headerSize(headerSize) { } - - virtual void Start() = 0; + Socket(tcp::socket&& socket, std::size_t headerSize) : _socket(std::move(socket)), _remoteAddress(_socket.remote_endpoint().address()), + _remotePort(_socket.remote_endpoint().port()), _readHeaderBuffer(), _readDataBuffer(), _closed(false) + { + _readHeaderBuffer.Grow(headerSize); + } - boost::asio::ip::address GetRemoteIpAddress() const + virtual ~Socket() { boost::system::error_code error; - auto ep = _socket.remote_endpoint(error); + _socket.close(error); - if (error) + while (!_writeQueue.empty()) { - TC_LOG_DEBUG("network", "Socket::GetRemoteIpAddress: errored with: %i (%s)", error.value(), error.message().c_str()); - return boost::asio::ip::address(); + DeletePacket(_writeQueue.front()); + _writeQueue.pop(); } - else - return ep.address(); } - uint16 GetRemotePort() const + virtual void Start() = 0; + + boost::asio::ip::address GetRemoteIpAddress() const { - boost::system::error_code error; - auto ep = _socket.remote_endpoint(error); + return _remoteAddress; + } - if (error) - { - TC_LOG_DEBUG("network", "Socket::GetRemotePort: errored with: %i (%s)", error.value(), error.message().c_str()); - return 0; - } - else - return ep.port(); + uint16 GetRemotePort() const + { + return _remotePort; } void AsyncReadHeader() { - _socket.async_read_some(boost::asio::buffer(_readBuffer, _headerSize), std::bind(&Socket<T, PacketType>::ReadHeaderHandlerInternal, this->shared_from_this(), - std::placeholders::_1, std::placeholders::_2)); + if (!IsOpen()) + return; + + _readHeaderBuffer.ResetWritePointer(); + _readDataBuffer.Reset(); + + AsyncReadMissingHeaderData(); } - void AsyncReadData(std::size_t size, std::size_t bufferOffset) + void AsyncReadData(std::size_t size) { - _socket.async_read_some(boost::asio::buffer(&_readBuffer[bufferOffset], size), std::bind(&Socket<T, PacketType>::ReadDataHandlerInternal, this->shared_from_this(), - std::placeholders::_1, std::placeholders::_2)); + if (!IsOpen()) + return; + + if (!size) + { + // if this is a packet with 0 length body just invoke handler directly + ReadDataHandler(); + return; + } + + _readDataBuffer.Grow(size); + AsyncReadMissingData(); } - void ReadData(std::size_t size, std::size_t bufferOffset) + void ReadData(std::size_t size) { + if (!IsOpen()) + return; + boost::system::error_code error; - _socket.read_some(boost::asio::buffer(&_readBuffer[bufferOffset], size), error); + _readDataBuffer.Grow(size); - if (error) + std::size_t bytesRead = boost::asio::read(_socket, boost::asio::buffer(_readDataBuffer.GetWritePointer(), size), error); + + _readDataBuffer.WriteCompleted(bytesRead); + + if (error || !_readDataBuffer.IsMessageReady()) { - TC_LOG_DEBUG("network", "Socket::ReadData: %s errored with: %i (%s)", GetRemoteIpAddress().to_string().c_str(), error.value(), error.message().c_str()); + TC_LOG_DEBUG("network", "Socket::ReadData: %s errored with: %i (%s)", GetRemoteIpAddress().to_string().c_str(), error.value(), + error.message().c_str()); CloseSocket(); } @@ -97,32 +122,93 @@ public: void AsyncWrite(WritePacketType data) { - boost::asio::async_write(_socket, boost::asio::buffer(data), std::bind(&Socket<T, PacketType>::WriteHandler, this->shared_from_this(), std::placeholders::_1, - std::placeholders::_2)); + boost::asio::async_write(_socket, boost::asio::buffer(data), std::bind(&Socket<T, PacketType>::WriteHandler, this->shared_from_this(), + std::placeholders::_1, std::placeholders::_2)); } - bool IsOpen() const { return _socket.is_open(); } - void CloseSocket() + bool IsOpen() const { return !_closed; } + + virtual void CloseSocket() { - boost::system::error_code error; - _socket.close(error); - if (error) - TC_LOG_DEBUG("network", "Socket::CloseSocket: %s errored when closing socket: %i (%s)", GetRemoteIpAddress().to_string().c_str(), - error.value(), error.message().c_str()); + if (_closed.exchange(true)) + return; + + boost::system::error_code shutdownError; + _socket.shutdown(boost::asio::socket_base::shutdown_send, shutdownError); + if (shutdownError) + TC_LOG_DEBUG("network", "Socket::CloseSocket: %s errored when shutting down socket: %i (%s)", GetRemoteIpAddress().to_string().c_str(), + shutdownError.value(), shutdownError.message().c_str()); } - uint8* GetReadBuffer() { return _readBuffer; } + virtual bool IsHeaderReady() const { return _readHeaderBuffer.IsMessageReady(); } + virtual bool IsDataReady() const { return _readDataBuffer.IsMessageReady(); } + + uint8* GetHeaderBuffer() { return _readHeaderBuffer.Data(); } + uint8* GetDataBuffer() { return _readDataBuffer.Data(); } + + size_t GetHeaderSize() const { return _readHeaderBuffer.GetSize(); } + size_t GetDataSize() const { return _readDataBuffer.GetSize(); } + + MessageBuffer&& MoveHeader() { return std::move(_readHeaderBuffer); } + MessageBuffer&& MoveData() { return std::move(_readDataBuffer); } protected: - virtual void ReadHeaderHandler(boost::system::error_code error, size_t transferedBytes) = 0; - virtual void ReadDataHandler(boost::system::error_code error, size_t transferedBytes) = 0; + virtual void ReadHeaderHandler() = 0; + virtual void ReadDataHandler() = 0; std::mutex _writeLock; std::queue<PacketType> _writeQueue; private: - void ReadHeaderHandlerInternal(boost::system::error_code error, size_t transferedBytes) { ReadHeaderHandler(error, transferedBytes); } - void ReadDataHandlerInternal(boost::system::error_code error, size_t transferedBytes) { ReadDataHandler(error, transferedBytes); } + void AsyncReadMissingHeaderData() + { + _socket.async_read_some(boost::asio::buffer(_readHeaderBuffer.GetWritePointer(), std::min<std::size_t>(READ_BLOCK_SIZE, _readHeaderBuffer.GetMissingSize())), + std::bind(&Socket<T, PacketType>::ReadHeaderHandlerInternal, this->shared_from_this(), std::placeholders::_1, std::placeholders::_2)); + } + + void AsyncReadMissingData() + { + _socket.async_read_some(boost::asio::buffer(_readDataBuffer.GetWritePointer(), std::min<std::size_t>(READ_BLOCK_SIZE, _readDataBuffer.GetMissingSize())), + std::bind(&Socket<T, PacketType>::ReadDataHandlerInternal, this->shared_from_this(), std::placeholders::_1, std::placeholders::_2)); + } + + void ReadHeaderHandlerInternal(boost::system::error_code error, size_t transferredBytes) + { + if (error) + { + CloseSocket(); + return; + } + + _readHeaderBuffer.WriteCompleted(transferredBytes); + if (!IsHeaderReady()) + { + // incomplete, read more + AsyncReadMissingHeaderData(); + return; + } + + ReadHeaderHandler(); + } + + void ReadDataHandlerInternal(boost::system::error_code error, size_t transferredBytes) + { + if (error) + { + CloseSocket(); + return; + } + + _readDataBuffer.WriteCompleted(transferredBytes); + if (!IsDataReady()) + { + // incomplete, read more + AsyncReadMissingData(); + return; + } + + ReadDataHandler(); + } void WriteHandler(boost::system::error_code error, size_t /*transferedBytes*/) { @@ -148,9 +234,13 @@ private: tcp::socket _socket; - uint8 _readBuffer[4096]; + boost::asio::ip::address _remoteAddress; + uint16 _remotePort; + + MessageBuffer _readHeaderBuffer; + MessageBuffer _readDataBuffer; - std::size_t _headerSize; + std::atomic<bool> _closed; }; #endif // __SOCKET_H__ diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp index 0a911492f85..3785d1c29fa 100644 --- a/src/server/shared/Packets/ByteBuffer.cpp +++ b/src/server/shared/Packets/ByteBuffer.cpp @@ -17,11 +17,16 @@ */ #include "ByteBuffer.h" +#include "MessageBuffer.h" #include "Common.h" #include "Log.h" #include <sstream> +ByteBuffer::ByteBuffer(MessageBuffer&& buffer) : _rpos(0), _wpos(0), _storage(buffer.Move()) +{ +} + ByteBufferPositionException::ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize) { @@ -69,8 +74,8 @@ void ByteBuffer::textlike() const o << "STORAGE_SIZE: " << size(); for (uint32 i = 0; i < size(); ++i) { - char buf[1]; - snprintf(buf, 1, "%c", read<uint8>(i)); + char buf[2]; + snprintf(buf, 2, "%c", read<uint8>(i)); o << buf; } o << " "; @@ -90,7 +95,7 @@ void ByteBuffer::hexlike() const for (uint32 i = 0; i < size(); ++i) { char buf[3]; - snprintf(buf, 1, "%2X ", read<uint8>(i)); + snprintf(buf, 3, "%2X ", read<uint8>(i)); if ((i == (j * 8)) && ((i != (k * 16)))) { o << "| "; diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 520c1a85fc2..35b23610143 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -34,13 +34,15 @@ #include <math.h> #include <boost/asio/buffer.hpp> +class MessageBuffer; + // Root of ByteBuffer exception hierarchy class ByteBufferException : public std::exception { public: ~ByteBufferException() throw() { } - char const* what() const throw() { return msg_.c_str(); } + char const* what() const throw() override { return msg_.c_str(); } protected: std::string & message() throw() { return msg_; } @@ -82,14 +84,12 @@ class ByteBuffer } ByteBuffer(ByteBuffer&& buf) : _rpos(buf._rpos), _wpos(buf._wpos), - _bitpos(buf._bitpos), _curbitval(buf._curbitval), _storage(std::move(buf._storage)) - { - } + _bitpos(buf._bitpos), _curbitval(buf._curbitval), _storage(std::move(buf._storage)) { } ByteBuffer(ByteBuffer const& right) : _rpos(right._rpos), _wpos(right._wpos), - _bitpos(right._bitpos), _curbitval(right._curbitval), _storage(right._storage) - { - } + _bitpos(right._bitpos), _curbitval(right._curbitval), _storage(right._storage) { } + + ByteBuffer(MessageBuffer&& buffer); ByteBuffer& operator=(ByteBuffer const& right) { diff --git a/src/server/shared/Threading/ProcessPriority.h b/src/server/shared/Threading/ProcessPriority.h index 06a5622fb9d..23238c94ace 100644 --- a/src/server/shared/Threading/ProcessPriority.h +++ b/src/server/shared/Threading/ProcessPriority.h @@ -32,7 +32,7 @@ void SetProcessPriority(const std::string logChannel) #if PLATFORM_APPLE (void)logChannel; #endif - + #if defined(_WIN32) || defined(__linux__) ///- Handle affinity for multiple processors and process priority diff --git a/src/server/shared/Threading/ProducerConsumerQueue.h b/src/server/shared/Threading/ProducerConsumerQueue.h index 1fee1d0685f..accb0aebb11 100644 --- a/src/server/shared/Threading/ProducerConsumerQueue.h +++ b/src/server/shared/Threading/ProducerConsumerQueue.h @@ -58,7 +58,7 @@ public: { std::lock_guard<std::mutex> lock(_queueLock); - if (_queue.empty()) + if (_queue.empty() || _shutdown) return false; value = _queue.front(); @@ -77,7 +77,7 @@ public: _condition.wait(lock); } - if (_queue.empty()) + if (_queue.empty() || _shutdown) return; value = _queue.front(); diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index a5279eae03f..0bdc1fb714c 100644 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -18,13 +18,14 @@ #include "Util.h" #include "Common.h" +#include "CompilerDefs.h" #include "utf8.h" #include "SFMT.h" #include "Errors.h" // for ASSERT #include <stdarg.h> #include <boost/thread/tss.hpp> -#if PLATFORM == PLATFORM_UNIX +#if COMPILER == COMPILER_GNU #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 3afa9e84e8b..e149902af02 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -87,6 +87,7 @@ bool StartDB(); void StopDB(); void WorldUpdateLoop(); void ClearOnlineAccounts(); +void ShutdownThreadPool(std::vector<std::thread>& threadPool); variables_map GetConsoleArguments(int argc, char** argv, std::string& cfg_file, std::string& cfg_service); /// Launch the Trinity server @@ -179,7 +180,10 @@ extern int main(int argc, char** argv) // Start the databases if (!StartDB()) + { + ShutdownThreadPool(threadPool); return 1; + } // Set server offline (not connectable) LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = (flag & ~%u) | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, REALM_FLAG_INVALID, realmID); @@ -217,7 +221,7 @@ extern int main(int argc, char** argv) AsyncAcceptor<WorldSocket> worldAcceptor(_ioService, worldListener, worldPort, tcpNoDelay); - sScriptMgr->OnStartup(); + sScriptMgr->OnNetworkStart(); // Set server online (allow connecting now) LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID); @@ -233,16 +237,12 @@ extern int main(int argc, char** argv) TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon) ready...", _FULLVERSION); + sScriptMgr->OnStartup(); + WorldUpdateLoop(); // Shutdown starts here - - _ioService.stop(); - - for (auto& thread : threadPool) - { - thread.join(); - } + ShutdownThreadPool(threadPool); sScriptMgr->OnShutdown(); @@ -281,41 +281,7 @@ extern int main(int argc, char** argv) if (cliThread != nullptr) { #ifdef _WIN32 - - // this only way to terminate CLI thread exist at Win32 (alt. way exist only in Windows Vista API) - //_exit(1); - // send keyboard input to safely unblock the CLI thread - INPUT_RECORD b[4]; - HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE); - b[0].EventType = KEY_EVENT; - b[0].Event.KeyEvent.bKeyDown = TRUE; - b[0].Event.KeyEvent.uChar.AsciiChar = 'X'; - b[0].Event.KeyEvent.wVirtualKeyCode = 'X'; - b[0].Event.KeyEvent.wRepeatCount = 1; - - b[1].EventType = KEY_EVENT; - b[1].Event.KeyEvent.bKeyDown = FALSE; - b[1].Event.KeyEvent.uChar.AsciiChar = 'X'; - b[1].Event.KeyEvent.wVirtualKeyCode = 'X'; - b[1].Event.KeyEvent.wRepeatCount = 1; - - b[2].EventType = KEY_EVENT; - b[2].Event.KeyEvent.bKeyDown = TRUE; - b[2].Event.KeyEvent.dwControlKeyState = 0; - b[2].Event.KeyEvent.uChar.AsciiChar = '\r'; - b[2].Event.KeyEvent.wVirtualKeyCode = VK_RETURN; - b[2].Event.KeyEvent.wRepeatCount = 1; - b[2].Event.KeyEvent.wVirtualScanCode = 0x1c; - - b[3].EventType = KEY_EVENT; - b[3].Event.KeyEvent.bKeyDown = FALSE; - b[3].Event.KeyEvent.dwControlKeyState = 0; - b[3].Event.KeyEvent.uChar.AsciiChar = '\r'; - b[3].Event.KeyEvent.wVirtualKeyCode = VK_RETURN; - b[3].Event.KeyEvent.wVirtualScanCode = 0x1c; - b[3].Event.KeyEvent.wRepeatCount = 1; - DWORD numb; - WriteConsoleInput(hStdIn, b, 4, &numb); + CancelSynchronousIo(cliThread->native_handle()); #endif cliThread->join(); delete cliThread; @@ -330,6 +296,17 @@ extern int main(int argc, char** argv) return World::GetExitCode(); } +void ShutdownThreadPool(std::vector<std::thread>& threadPool) +{ + sScriptMgr->OnNetworkStop(); + + _ioService.stop(); + + for (auto& thread : threadPool) + { + thread.join(); + } +} void WorldUpdateLoop() { diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp index b119b6cdbde..885dd24d760 100644 --- a/src/tools/mmaps_generator/MapBuilder.cpp +++ b/src/tools/mmaps_generator/MapBuilder.cpp @@ -63,7 +63,8 @@ namespace MMAP m_skipBattlegrounds (skipBattlegrounds), m_maxWalkableAngle (maxWalkableAngle), m_bigBaseUnit (bigBaseUnit), - m_rcContext (NULL) + m_rcContext (NULL), + _cancelationToken (false) { m_terrainBuilder = new TerrainBuilder(skipLiquid); diff --git a/src/tools/mmaps_generator/PathGenerator.cpp b/src/tools/mmaps_generator/PathGenerator.cpp index 3e2025dace8..c2ca184905e 100644 --- a/src/tools/mmaps_generator/PathGenerator.cpp +++ b/src/tools/mmaps_generator/PathGenerator.cpp @@ -276,7 +276,7 @@ int main(int argc, char** argv) } if (!checkDirectories(debugOutput)) - return silent ? -3 : finish("Press any key to close...", -3); + return silent ? -3 : finish("Press ENTER to close...", -3); MapBuilder builder(maxAngle, skipLiquid, skipContinents, skipJunkMaps, skipBattlegrounds, debugOutput, bigBaseUnit, offMeshInputPath); |