diff options
165 files changed, 3521 insertions, 2130 deletions
diff --git a/cmake/macros/FindMySQL.cmake b/cmake/macros/FindMySQL.cmake index 7650a83c571..2c393463c47 100644 --- a/cmake/macros/FindMySQL.cmake +++ b/cmake/macros/FindMySQL.cmake @@ -77,6 +77,11 @@ find_path(MYSQL_INCLUDE_DIR "C:/Program Files/MySQL/MySQL Server 5.1/include" "C:/Program Files/MySQL/MySQL Server 5.0/include" "C:/Program Files/MySQL/include" + "C:/Program Files (x86)/MySQL/MySQL Server 5.6/include" + "C:/Program Files (x86)/MySQL/MySQL Server 5.5/include" + "C:/Program Files (x86)/MySQL/MySQL Server 5.1/include" + "C:/Program Files (x86)/MySQL/MySQL Server 5.0/include" + "C:/Program Files (x86)/MySQL/include" "C:/MySQL/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.6;Location]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.5;Location]/include" @@ -116,11 +121,24 @@ if( WIN32 ) libmysql PATHS ${MYSQL_ADD_LIBRARIES_PATH} + "C:/Program Files/MySQL/MySQL Server 5.6/lib" "C:/Program Files/MySQL/MySQL Server 5.6/lib/opt" + "C:/Program Files/MySQL/MySQL Server 5.5/lib" "C:/Program Files/MySQL/MySQL Server 5.5/lib/opt" + "C:/Program Files/MySQL/MySQL Server 5.1/lib" "C:/Program Files/MySQL/MySQL Server 5.1/lib/opt" + "C:/Program Files/MySQL/MySQL Server 5.0/lib" "C:/Program Files/MySQL/MySQL Server 5.0/lib/opt" "C:/Program Files/MySQL/lib" + "C:/Program Files (x86)/MySQL/MySQL Server 5.6/lib" + "C:/Program Files (x86)/MySQL/MySQL Server 5.6/lib/opt" + "C:/Program Files (x86)/MySQL/MySQL Server 5.5/lib" + "C:/Program Files (x86)/MySQL/MySQL Server 5.5/lib/opt" + "C:/Program Files (x86)/MySQL/MySQL Server 5.1/lib" + "C:/Program Files (x86)/MySQL/MySQL Server 5.1/lib/opt" + "C:/Program Files (x86)/MySQL/MySQL Server 5.0/lib" + "C:/Program Files (x86)/MySQL/MySQL Server 5.0/lib/opt" + "C:/Program Files (x86)/MySQL/lib" "C:/MySQL/lib/debug" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.6;Location]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.6;Location]/lib/opt" diff --git a/sql/updates/world/2014_09_01_00_world_misc.sql b/sql/updates/world/2014_09_01_00_world_misc.sql new file mode 100644 index 00000000000..7a415588f0f --- /dev/null +++ b/sql/updates/world/2014_09_01_00_world_misc.sql @@ -0,0 +1,56 @@ +DELETE FROM `gossip_menu` WHERE `entry` IN(7768,7767,7766,7765,7764,7763,7762,7974,7979,7978,7977,7976); +INSERT INTO `gossip_menu` (`entry`, `text_id`) VALUES +(7768, 9507), -- 18141 +(7767, 9508), -- 18141 +(7766, 9509), -- 18141 +(7765, 9510), -- 18141 +(7764, 9511), -- 18141 +(7763, 9512), -- 18141 +(7762, 9513), -- 18141 +(7768, 9819), -- 18141 +(7974, 9821), -- 18141 +(7979, 9822), -- 18141 +(7978, 9823), -- 18141 +(7977, 9824), -- 18141 +(7976, 9825); -- 18141 + +DELETE FROM `gossip_menu_option` WHERE `menu_id` IN(7768,7767,7766,7765,7764,7763,7762,7974,7979,7978,7977,7976); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES +-- A Visit with the Greatmother +(7768, 0, 0, 'Hello, Greatmother. Garrosh told me that you wanted to speak with me.', 15770, 1, 1, 7767, 0, 0, 0, '', 0), +(7767, 0, 0, 'You raised all of the orcs here, Greatmother?', 15772, 1, 1, 7766, 0, 0, 0, '', 0), +(7766, 0, 0, 'Do you believe that?', 15774, 1, 1, 7765, 0, 0, 0, '', 0), +(7765, 0, 0, 'What can be done? I have tried many different things. I have done my best to help the people of Nagrand. Each time I have approached Garrosh, he has dismissed me.', 15776, 1, 1, 7764, 0, 0, 0, '', 0), +(7764, 0, 0, 'Left? How can you choose to leave?', 15778, 1, 1, 7763, 0, 0, 0, '', 0), +(7763, 0, 0, 'What is this duty?', 15780, 1, 1, 7762, 0, 0, 0, '', 0), +(7762, 0, 0, 'Is there anything I can do for you, Greatmother?', 15782, 1, 1, 0, 0, 0, 0, '', 0), +-- There is no hope +(7768, 1, 0, 'Garrosh is beyond redemption, Greatmother. I fear that in helping the Mag\'har, I have convinced Garrosh that he is unfit to lead.', 16845, 1, 1, 7974, 0, 0, 0, '', 0), +(7974, 0, 0, 'I have done all that I could, Greatmother. I thank you for your kind words.', 16849, 1, 1, 7979, 0, 0, 0, '', 0), +(7979, 0, 0, 'Greatmother, you are the mother of Durotan?', 16851, 1, 1, 7978, 0, 0, 0, '', 0), +(7978, 0, 0, 'Greatmother, I never had the honor. Durotan died long before my time, but his heroics are known to all on my world. The orcs of Azeroth reside in a place known as Durotar, named after your son. And... <You take a moment to breathe and think through what you are about to tell the Greatmother.>', 16853, 1, 1, 7977, 0, 0, 0, '', 0), +(7977, 0, 0, 'It is my warchief, Greatmother. The leader of my people. From my world. He... He is the son of Durotan. He is your grandchild.', 16855, 1, 1, 7976, 0, 0, 0, '', 0), +(7976, 0, 0, 'I will return to Azeroth at once, Greatmother.', 16857, 1, 1, 0, 0, 0, 0, '', 0); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN(14,15) AND `SourceGroup`=7768; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(15, 7768, 0, 0, 0, 9, 0, 10044, 0, 0, 0, 0, 0, '', 'Greatmother Geyah - Show gossip option only if player has A Visit With the Greatmother taken'), +(15, 7768, 1, 0, 0, 9, 0, 10172, 0, 0, 0, 0, 0, '', 'Greatmother Geyah - Show gossip option only if player has There is no hope taken'), +(14, 7768, 9819, 0, 0, 9, 0, 10172, 0, 0, 0, 0, 0, '', 'Greatmother Geyah - Show npc text only if player has There is no hope taken'), +(14, 7768, 9507, 0, 0, 9, 0, 10172, 0, 0, 1, 0, 0, '', 'Greatmother Geyah - Show npc text only if player does not have There is no hope taken'); + +DELETE FROM `npc_text` WHERE `ID` IN(9819,9821,9822,9823,9824,9825); +INSERT INTO `npc_text` (`ID`, `text0_0`, `text0_1`, `BroadcastTextID0`, `lang0`, `prob0`, `em0_0`, `em0_1`, `em0_2`, `em0_3`, `em0_4`, `em0_5`, `text1_0`, `text1_1`, `BroadcastTextID1`, `lang1`, `prob1`, `em1_0`, `em1_1`, `em1_2`, `em1_3`, `em1_4`, `em1_5`, `text2_0`, `text2_1`, `BroadcastTextID2`, `lang2`, `prob2`, `em2_0`, `em2_1`, `em2_2`, `em2_3`, `em2_4`, `em2_5`, `text3_0`, `text3_1`, `BroadcastTextID3`, `lang3`, `prob3`, `em3_0`, `em3_1`, `em3_2`, `em3_3`, `em3_4`, `em3_5`, `text4_0`, `text4_1`, `BroadcastTextID4`, `lang4`, `prob4`, `em4_0`, `em4_1`, `em4_2`, `em4_3`, `em4_4`, `em4_5`, `text5_0`, `text5_1`, `BroadcastTextID5`, `lang5`, `prob5`, `em5_0`, `em5_1`, `em5_2`, `em5_3`, `em5_4`, `em5_5`, `text6_0`, `text6_1`, `BroadcastTextID6`, `lang6`, `prob6`, `em6_0`, `em6_1`, `em6_2`, `em6_3`, `em6_4`, `em6_5`, `text7_0`, `text7_1`, `BroadcastTextID7`, `lang7`, `prob7`, `em7_0`, `em7_1`, `em7_2`, `em7_3`, `em7_4`, `em7_5`, `VerifiedBuild`) VALUES +(9819, '', "What did Garrosh tell you, $n?", 16844, 0, 1, 1, 1, 1, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(9821, '', "<Greatmother Geyah nods, accepting your answer.>$B$BI can no longer fight the spirits, $n. My time has long since passed. Once again, I must thank you for all that you have done. While Garrosh may be unmovable, many of my people have been lifted by your accomplishments. They are now willing to fight for our rights as a united clan.", 16848, 0, 1, 1, 1, 1, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(9822, '', "<Greatmother Geyah smiles at you.>$B$BYou remind me of my son, $n.$B$BHe was an immovable mountain: A pillar of strength and honor.$B$B<Geyah's eyes well up with tears.>$B$BHe sacrificed himself so that we could survive. So that generations of orcs after him could be born into a world without the blood curse... Without Gul'dan and his dark Horde...$B$B<Geyah stares into the distance, lost in thought.>$B$BOh Durotan, how I wish you could be here. Your people so desperately need you...", 16850, 0, 1, 1, 1, 1, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(9823, '', "<Greatmother Geyah nods.>$B$BDid you know my son?", 16852, 0, 1, 1, 1, 1, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(9824, '', "<Greatmother Geyah's violet eyes lock onto yours.>$B$BYes...", 16854, 0, 1, 1, 1, 1, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(9825, '', "<Tears stream down Greatmother Geyah's face.>$B$BI... I... Durotan survived to have a child? The child Draka told me of before they left... It was their greatest fear... To raise a child in this world. On the other side of that gate was their only hope. I dared not tell Durotan, but secretly, I begged the spirits to watch over them - to protect their child and to give them strength.$B$BI... I must see my grandchild. I must see him. Please, I am too weak. You must tell him. Before I leave this world...", 16856, 0, 1, 1, 1, 1, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + +UPDATE `creature_template` SET `AIName`= 'SmartAI',`ScriptName`= '' WHERE `entry` =18141; +DELETE FROM `smart_scripts` WHERE `entryorguid` =18141; +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 +(18141, 0, 0, 2, 62, 0, 100, 0, 7762, 0, 0, 0, 15, 10044, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Greatmother Geyah - On Gossip Option Select - Complete Quest (A Visit With the Greatmother)'), +(18141, 0, 1, 2, 62, 0, 100, 0, 7976, 0, 0, 0, 15, 10172, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Greatmother Geyah - On Gossip Option Select - Complete Quest (There is no hope)'), +(18141, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Greatmother Geyah - On Gossip Option Select - Close Gossip'); diff --git a/sql/updates/world/2014_09_02_00_world_misc_335.sql b/sql/updates/world/2014_09_02_00_world_misc_335.sql new file mode 100644 index 00000000000..0ead7e514e6 --- /dev/null +++ b/sql/updates/world/2014_09_02_00_world_misc_335.sql @@ -0,0 +1,2 @@ +-- +UPDATE `creature_template` SET `faction` = 554 WHERE `entry` = 3203; diff --git a/sql/updates/world/2014_09_03_00_world_creature_summon_groups.sql b/sql/updates/world/2014_09_03_00_world_creature_summon_groups.sql new file mode 100644 index 00000000000..aba5b88b1d4 --- /dev/null +++ b/sql/updates/world/2014_09_03_00_world_creature_summon_groups.sql @@ -0,0 +1,18 @@ +-- SWP: Move Muru summons to database
+SET @MURU := 25741;
+DELETE FROM `creature_summon_groups` WHERE `summonerId` = @MURU AND `entry` IN (25798, 25799, 25744);
+INSERT INTO `creature_summon_groups` (`summonerId`, `summonerType`, `groupId`, `entry`, `position_x`, `position_y`, `position_z`, `orientation`, `summonType`, `summonTime`) VALUES
+(@MURU, 0, 0, 25799, 1780.16, 666.83, 71.19, 5.21, 5, 0), -- Shadowsword Fury Mage
+(@MURU, 0, 0, 25799, 1847.93, 600.30, 71.30, 2.57, 5, 0),
+(@MURU, 0, 0, 25798, 1779.97, 660.64, 71.19, 5.28, 5, 0), -- Shadowsword Berserker
+(@MURU, 0, 0, 25798, 1786.20, 661.01, 71.19, 4.51, 5, 0),
+(@MURU, 0, 0, 25798, 1845.17, 602.63, 71.28, 2.43, 5, 0),
+(@MURU, 0, 0, 25798, 1842.91, 599.93, 71.23, 2.44, 5, 0),
+(@MURU, 0, 1, 25744, 1819.90, 609.80, 69.74, 1.94, 5, 0), -- Darkfiend
+(@MURU, 0, 1, 25744, 1829.39, 617.89, 69.73, 2.61, 5, 0),
+(@MURU, 0, 1, 25744, 1801.98, 633.62, 69.74, 5.71, 5, 0),
+(@MURU, 0, 1, 25744, 1830.88, 629.99, 69.73, 3.52, 5, 0),
+(@MURU, 0, 1, 25744, 1800.38, 621.41, 69.74, 0.22, 5, 0),
+(@MURU, 0, 1, 25744, 1808.30, 612.45, 69.73, 1.02, 5, 0),
+(@MURU, 0, 1, 25744, 1823.90, 639.69, 69.74, 4.12, 5, 0),
+(@MURU, 0, 1, 25744, 1811.85, 640.46, 69.73, 4.97, 5, 0);
diff --git a/sql/updates/world/2014_09_03_01_world_loot.sql b/sql/updates/world/2014_09_03_01_world_loot.sql new file mode 100644 index 00000000000..b56eba26355 --- /dev/null +++ b/sql/updates/world/2014_09_03_01_world_loot.sql @@ -0,0 +1 @@ +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=6 WHERE `entry` IN (34566, 35216, 35268, 35269, 35347, 35348, 35349, 35350, 35351, 35352, 35447, 35448, 35449, 35615, 35616) AND `item`=3;
diff --git a/sql/updates/world/2014_09_04_00_world_creature_template.sql b/sql/updates/world/2014_09_04_00_world_creature_template.sql new file mode 100644 index 00000000000..1484f317983 --- /dev/null +++ b/sql/updates/world/2014_09_04_00_world_creature_template.sql @@ -0,0 +1,2 @@ +-- Remove no longer used script
+UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` = 17662; -- Broggok Poison Cloud
diff --git a/sql/updates/world/2014_09_04_01_creature_text.sql b/sql/updates/world/2014_09_04_01_creature_text.sql new file mode 100644 index 00000000000..c2f2f6c7242 --- /dev/null +++ b/sql/updates/world/2014_09_04_01_creature_text.sql @@ -0,0 +1,4 @@ +DELETE FROM `creature_text` WHERE `entry`=30215; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextID`, `comment`) VALUES +(30215, 1, 0, 'Sons of Hodir! I humbly present to you....', 42, 0, 100, 0, 0, 0, 30906, 'Player - Read Pronouncement'), +(30215, 2, 0, 'The Helm of Hodir!', 42, 0, 100, 0, 0, 0, 30907, 'Player - Read Pronouncement'); diff --git a/sql/updates/world/2014_09_04_02_world_misc.sql b/sql/updates/world/2014_09_04_02_world_misc.sql new file mode 100644 index 00000000000..5939c74e566 --- /dev/null +++ b/sql/updates/world/2014_09_04_02_world_misc.sql @@ -0,0 +1,202 @@ +SET @CGUID := 74506; + +UPDATE `creature_template` SET `faction`=1813, `unit_flags`=32768,`flags_extra`=2 WHERE `entry` IN(21416,21709,21710,21711); +UPDATE `creature_template` SET `gossip_menu_id`=8350, `npcflag`=0, `speed_walk`=1, `speed_run`=1.142857, `BaseAttackTime`=2000, `RangeAttackTime`=2000, `unit_flags`=33280, `unit_flags2`=0, `AIName`='SmartAI' WHERE `entry`=21685; +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry`=21052; + +UPDATE `creature_template` SET `ainame`='SmartAI', `scriptname`='' WHERE `entry` IN(21703,21704,21705,21420); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(21703,21704,21705,21420) AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(-75734,-75735,-75736,-75737,-75738,-75739,-75104,-75105,-75106,-@CGUID, -@CGUID-1,-@CGUID-2) AND `source_type`=0; + +DELETE FROM `smart_scripts` WHERE `entryorguid` =2847900 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 +(-75104, 0, 0, 0, 1, 0, 100, 0, 0, 0, 15000, 15000, 11, 36817, 0, 0, 0, 0, 0, 1, 21416, 0, 0, 0, 0, 0, 0, 'Corrupt Water Totem - OOC - Cast Channel Water shield'), +(-75104, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 11, 36826, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Water Totem - On Agro - Cast Summon Corrupt Water Elemental'), +(-75105, 0, 0, 0, 1, 0, 100, 0, 0, 0, 15000, 15000, 11, 38105, 0, 0, 0, 0, 0, 1, 21416, 0, 0, 0, 0, 0, 0, 'Corrupt Water Totem - OOC - Cast Channel Water shield'), +(-75105, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 11, 36826, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Water Totem - On Agro - Cast Summon Corrupt Water Elemental'), +(-75106, 0, 0, 0, 1, 0, 100, 0, 0, 0, 15000, 15000, 11, 38106, 0, 0, 0, 0, 0, 1, 21416, 0, 0, 0, 0, 0, 0, 'Corrupt Water Totem - OOC - Cast Channel Water shield'), +(-75106, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 11, 36826, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Water Totem - On Agro - Cast Summon Corrupt Water Elemental'), +(-75734, 0, 0, 0, 1, 0, 100, 0, 0, 0, 15000, 15000, 11, 37204, 0, 0, 0, 0, 0, 1, 21709, 0, 0, 0, 0, 0, 0, 'Corrupt Earth Totem - OOC - Cast Channel Earth shield'), +(-75734, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 11, 37203, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Earth Totem - On Agro - Cast Summon Corrupt Earth Elemental'), +(-75735, 0, 0, 0, 1, 0, 100, 0, 0, 0, 15000, 15000, 11, 38101, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Earth Totem - OOC - Cast Channel Earth shield'), +(-75735, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 11, 37203, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Earth Totem - On Agro - Cast Summon Corrupt Earth Elemental'), +(-75736, 0, 0, 0, 1, 0, 100, 0, 0, 0, 15000, 15000, 11, 38102, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Earth Totem - OOC - Cast Channel Earth shield'), +(-75736, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 11, 37203, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Earth Totem - On Agro - Cast Summon Corrupt Earth Elemental'), +(-75737, 0, 0, 0, 1, 0, 100, 0, 0, 0, 15000, 15000, 11, 37205, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Air Totem - OOC - Cast Channel Air shield'), +(-75737, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 11, 37202, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Air Totem - On Agro - Cast Summon Corrupt Air Elemental'), +(-75738, 0, 0, 0, 1, 0, 100, 0, 0, 0, 15000, 15000, 11, 38099, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Air Totem - OOC - Cast Channel Air shield'), +(-75738, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 11, 37202, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Air Totem - On Agro - Cast Summon Corrupt Air Elemental'), +(-75739, 0, 0, 0, 1, 0, 100, 0, 0, 0, 15000, 15000, 11, 38100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Air Totem - OOC - Cast Channel Air shield'), +(-75739, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 11, 37202, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Air Totem - On Agro - Cast Summon Corrupt Air Elemental'), +(-@CGUID, 0, 0, 0, 1, 0, 100, 0, 0, 0, 15000, 15000, 11, 37206, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Fire Totem - OOC - Cast Channel Fire shield'), +(-@CGUID, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 11, 37201, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Fire Totem - On Agro - Cast Summon Corrupt Fire Elemental'), +(-@CGUID-1, 0, 0, 0, 1, 0, 100, 0, 0, 0, 15000, 15000, 11, 38103, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Fire Totem - OOC - Cast Channel Fire shield'), +(-@CGUID-1, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 11, 37201, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Fire Totem - On Agro - Cast Summon Corrupt Fire Elemental'), +(-@CGUID-2, 0, 0, 0, 1, 0, 100, 0, 0, 0, 15000, 15000, 11, 38104, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Fire Totem - OOC - Cast Channel Fire shield'), +(-@CGUID-2, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 11, 37201, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Corrupt Fire Totem - On Agro - Cast Summon Corrupt Fire Elemental'); + +UPDATE `creature` SET `position_x`=-3396.211, `position_y`=1568.679, `position_z`=47.82401, `orientation`=6.110603 WHERE `guid`=86485; + +DELETE FROM `creature` WHERE `id`IN(21703,21706,21707,21708,21428); +INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `MovementType`) VALUES +(@CGUID+0, 21703, 530, 1, 1, -3392.402, 1566.671, 47.97179, 0.2094395, 120, 0, 0), -- 21703 (Area: 3520) +(@CGUID+1, 21703, 530, 1, 1, -3404.077, 1566.567, 47.88474, 4.782202, 120, 0, 0), -- 21703 (Area: 3520) +(@CGUID+2, 21703, 530, 1, 1, -3397.854, 1576.284, 47.14587, 5.532694, 120, 0, 0); -- 21703 (Area: 3520) + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `ConditionTypeOrReference`=31 AND `ConditionValue1`=3 AND `ConditionValue2` IN(21416,21709,21710,21711); +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=38722; + +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 5, 36817, 0, 0, 31, 0, 3, 21416, 0, 0, 0, 0, '', ''), +(13, 5, 38105, 0, 0, 31, 0, 3, 21416, 0, 0, 0, 0, '', ''), +(13, 5, 38106, 0, 0, 31, 0, 3, 21416, 0, 0, 0, 0, '', ''), +(13, 5, 37204, 0, 0, 31, 0, 3, 21709, 0, 0, 0, 0, '', ''), +(13, 5, 38101, 0, 0, 31, 0, 3, 21709, 0, 0, 0, 0, '', ''), +(13, 5, 38102, 0, 0, 31, 0, 3, 21709, 0, 0, 0, 0, '', ''), +(13, 5, 37205, 0, 0, 31, 0, 3, 21711, 0, 0, 0, 0, '', ''), +(13, 5, 38099, 0, 0, 31, 0, 3, 21711, 0, 0, 0, 0, '', ''), +(13, 5, 38100, 0, 0, 31, 0, 3, 21711, 0, 0, 0, 0, '', ''), +(13, 5, 37206, 0, 0, 31, 0, 3, 21710, 0, 0, 0, 0, '', ''), +(13, 5, 38103, 0, 0, 31, 0, 3, 21710, 0, 0, 0, 0, '', ''), +(13, 5, 38104, 0, 0, 31, 0, 3, 21710, 0, 0, 0, 0, '', ''), +(13, 1, 38722, 0, 0, 31, 0, 3, 21506, 0, 0, 0, 0, '', ''); + +DELETE FROM `creature_template_addon` WHERE `entry`=21506; +INSERT INTO `creature_template_addon` (`entry`, `mount`, `bytes1`, `bytes2`, `auras`) VALUES +(21506, 0, 0x0, 0x1, '37833'); -- 21506 - 37833 + +UPDATE `creature_template` SET `faction`=954, `unit_flags`=2147779136 WHERE `entry`=21506; + +DELETE FROM `smart_scripts` WHERE `entryorguid`=21506 AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=21503 AND `source_type`=0 and `id`=6; + +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 +(21506, 0, 0, 1, 8, 0, 100, 0, 37834, 0, 0, 0, 33, 21892, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Azaloth - On Spellhit \'Unbanish Azaloth\' - Quest Credit \'A Necessary Distraction\''), +(21506, 0, 1, 0, 61, 0, 100, 0, 0, 0, 0, 0, 28, 37833, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Azaloth - On Spellhit \'Unbanish Azaloth\' - Remove Banish'), +(21503, 0, 6, 0, 1, 0, 100, 0, 0, 0, 15000, 15000, 11, 38722, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Sunfury Warlock - OOC - Cast Spellbind Azaloth'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry`=21503; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(22, 7, 21503, 0, 0, 29, 1, 21506, 20, 0, 0, 0, 0, '', 'Only run SAI if Azaloth within 20 yards'); + +UPDATE `creature_template` SET `ainame`='SmartAI', `scriptname`='' WHERE `entry` IN(21024,21129,21130,21131,21132); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(21024,21129,21130,21131,21132) AND `source_type`=0; + +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(2120400) 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 +(21024, 0, 0, 0, 11, 0, 100, 0, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - On Spawn - Set Phase 1'), +(21024, 0, 1, 0, 20, 1, 100, 0, 10481, 0, 0, 0, 80, 2120400, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - On Quest Reward - Enraged Spirits of Air - Run Script 1'), +(21129, 0, 0, 0, 54, 0, 100, 0, 0, 0, 0, 0, 11, 36206, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Scorned Spirit of Earth - On Just Summoned - Cast Call to the Spirits'), +(21130, 0, 0, 0, 54, 0, 100, 0, 0, 0, 0, 0, 11, 36206, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Scorned Spirit of Fire - On Just Summoned - Cast Call to the Spirits'), +(21131, 0, 0, 0, 54, 0, 100, 0, 0, 0, 0, 0, 11, 36206, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Scorned Spirit of Water - On Just Summoned - Cast Call to the Spirits'), +(21132, 0, 0, 0, 54, 0, 100, 0, 0, 0, 0, 0, 11, 36206, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Scorned Spirit of Air - On Quest Reward - On Just Summoned - Cast Call to the Spirits'), + +(2120400, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Set Phase 2'), +(2120400, 9, 1, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say Line 1'), +(2120400, 9, 2, 0, 0, 0, 100, 0, 3000, 3000, 0, 0, 107, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Summon Group'), +(2120400, 9, 3, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 66, 0, 0, 0, 0, 0, 0, 19, 21071, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Set Orientation'), +(2120400, 9, 4, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 10, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say Line 1'), +(2120400, 9, 5, 0, 0, 0, 100, 0, 2000, 2000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 19, 21129, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say'), +(2120400, 9, 6, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 19, 21130, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say'), +(2120400, 9, 7, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say Line 1'), +(2120400, 9, 8, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 19, 21131, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say'), +(2120400, 9, 9, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 19, 21132, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say'), +(2120400, 9, 10, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say Line 1'), +(2120400, 9, 11, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say Line 1'), +(2120400, 9, 12, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 19, 21129, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say'), +(2120400, 9, 13, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say Line 1'), +(2120400, 9, 14, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 19, 21130, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say'), +(2120400, 9, 15, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 5, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say Line 1'), +(2120400, 9, 16, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 19, 21131, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say'), +(2120400, 9, 17, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 6, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say Line 1'), +(2120400, 9, 18, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 19, 21132, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say'), +(2120400, 9, 19, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 2, 0, 0, 0, 0, 0, 19, 21129, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say'), +(2120400, 9, 20, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 2, 0, 0, 0, 0, 0, 19, 21130, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say'), +(2120400, 9, 21, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say Line 1'), +(2120400, 9, 22, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 3, 0, 0, 0, 0, 0, 19, 21129, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say'), +(2120400, 9, 23, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 8, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say Line 1'), +(2120400, 9, 24, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 9, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Say Line 1'), +(2120400, 9, 25, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 66, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 4.93928, 'Earthmender Torlok <The Earthen Ring> - Script - Say Line 1'), +(2120400, 9, 26, 0, 0, 0, 100, 0, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Earthmender Torlok <The Earthen Ring> - Script - Set Phase 1'); + +DELETE FROM `creature_text` WHERE `entry` IN(21024,21129,21130,21131,21132); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `BroadcastTextID`) VALUES +(21024, 0, 0, 'Stand back, $n. The spirits may lash out.', 12, 0, 100, 1, 0, 0, 'Earthmender Torlok',18749), +(21129, 0, 0, 'Why have you captured us?', 12, 0, 100, 0, 0, 0, 'Scorned Spirit of Earth',18750), +(21130, 0, 0, 'What is it that you hope to gain from this?', 12, 0, 100, 0, 0, 0, 'Scorned Spirit of Fire',18751), +(21024, 1, 0, 'We wish to help you, spirit. We seek your wisdom.', 12, 0, 100, 1, 0, 0, 'Earthmender Torlok',18753), +(21131, 0, 0, 'Wisdom? It was your people that caused the insufferable wrath of Cyrukh.', 12, 0, 100, 0, 0, 0, 'Scorned Spirit of Water',18754), +(21132, 0, 0, 'Why should we help you? The world is ruined. Destroyed.', 12, 0, 100, 0, 0, 0, 'Scorned Spirit of Air',18755), +(21024, 2, 0, 'You are right, spirit. It was my people that did this to you. Allow us to make it right.', 12, 0, 100, 1, 0, 0, 'Earthmender Torlok',18757), +(21024, 3, 0, 'Please tell us this: Who or what is Cyrukh?', 12, 0, 100, 1, 0, 0, 'Earthmender Torlok',18758), +(21129, 1, 0, 'Fool! Cyrukh the fire lord! When the tie was severed, Cyrukh awoke. It is the tears of Cyrukh that fill this land with molten rock.', 12, 0, 100, 0, 0, 0, 'Scorned Spirit of Earth',18759), +(21024, 4, 0, 'The... The fire lord? An elemental lord was unearthed? Of course... Gul''dan you were a damned fool!', 12, 0, 100, 6, 0, 0, 'Earthmender Torlok',18760), +(21130, 1, 0, 'He is insane now. Driven mad during the shattering. There is no rest for the elements.', 12, 0, 100, 0, 0, 0, 'Scorned Spirit of Fire',18761), +(21024, 5, 0, 'There must be a way.', 12, 0, 100, 0, 0, 0, 'Earthmender Torlok',18762), +(21131, 1, 0, 'Yes, a way. Destroy Cyrukh. Destroy an elemental lord.', 12, 0, 100, 0, 0, 0, 'Scorned Spirit of Water',18763), +(21024, 6, 0, 'Do not doubt my comrades and I, spirit. Tell us how to conjure the fire lord. My allies will destroy him.', 12, 0, 100, 1, 0, 0, 'Earthmender Torlok',18764), +(21132, 1, 0, 'You must utter the words...', 12, 0, 100, 0, 0, 0, 'Scorned Spirit of Air',18765), +(21129, 2, 0, 'Yes... Yes... the words. The words of damnation. The words spoken by the dark one. Your master.', 12, 0, 100, 0, 0, 0, 'Scorned Spirit of Earth',18766), +(21130, 2, 0, 'Yes... Gul''dan...', 12, 0, 100, 0, 0, 0, 'Scorned Spirit of Fire',18767), +(21024, 7, 0, 'We will find these words. We will summon your master and we will destroy him.', 12, 0, 100, 1, 0, 0, 'Earthmender Torlok',18768), +(21129, 3, 0, 'Talk. More talk... Now release us, mortal.', 12, 0, 100, 0, 0, 0, 'Scorned Spirit of Earth',18769), +(21024, 8, 0, '%s nods.', 16, 0, 100, 273, 0, 0, 'Earthmender Torlok',18756), +(21024, 9, 0, 'Now to recover the lost words!', 12, 0, 100, 5, 0, 0, 'Earthmender Torlok',18778), +(21024, 10, 0, '%s bows.', 16, 0, 100, 2, 0, 0, 'Earthmender Torlok',18752); + +DELETE FROM `creature_summon_groups` WHERE `summonerId`IN(21024); +INSERT INTO `creature_summon_groups` (`summonerId`, `summonerType`, `groupId`, `entry`, `position_x`, `position_y`, `position_z`, `orientation`, `summonType`, `summonTime`) VALUES +(21024, 0, 0, 21129, -3604.787, 1913.459, 47.80234, 4.956735, 1, 110000), +(21024, 0, 0, 21130, -3596.973, 1913.545, 47.78812, 4.572762, 1, 110000), +(21024, 0, 0, 21131, -3612.323, 1910.802, 47.62409, 5.550147, 1, 110000), +(21024, 0, 0, 21132, -3590.55, 1911.157, 47.38158, 4.049164, 1, 110000), +(21024, 0, 0, 21071, -3590.55, 1911.157, 47.38158, 4.049164, 1, 110000); + +DELETE FROM `creature_template_addon` WHERE `entry` BETWEEN 21129 AND 21132; +INSERT INTO `creature_template_addon` (`entry`, `mount`, `bytes1`, `bytes2`, `auras`) VALUES +(21129, 0, 0x0, 0x1, '36113'), -- 21129 - 36113 +(21130, 0, 0x0, 0x1, '36114'), -- 21130 - 36114 +(21131, 0, 0x0, 0x1, '35923'), -- 21131 - 35923 +(21132, 0, 0x0, 0x1, '36178'); -- 21132 - 36178 + +DELETE FROM `creature_template_addon` WHERE `entry`=21181; +INSERT INTO `creature_template_addon` (`entry`, `mount`, `bytes1`, `bytes2`, `auras`) VALUES +(21181, 0, 0x0, 0x1, '36329'); -- 21181 - 36329 + +UPDATE `creature_template` SET `gossip_menu_id`=8259, `AIName`= 'SmartAI',`ScriptName`= '' WHERE `entry`=21183; + +DELETE FROM `gossip_menu_option` WHERE `menu_id` IN(8259,8281,8280,8279,8278,8277,8276,8350); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES +(8259, 0, 1, 'What do you have for sale, Oronok?', 18834, 3, 128, 0, 0, 0, 0, '', 0), +(8259, 1, 0, 'I am ready to hear your story, Oronok.', 18935, 1, 1, 8281, 0, 0, 0, '', 0), +(8281, 0, 0, 'How do I find the cipher?', 18937, 1, 1, 8280, 0, 0, 0, '', 0), +(8280, 0, 0, 'How do you know all of this?', 18939, 1, 1, 8279, 0, 0, 0, '', 0), +(8279, 0, 0, 'Yet what? What is it, Oronok?', 18941, 1, 1, 8278, 0, 0, 0, '', 0), +(8278, 0, 0, 'Continue, please.', 18943, 1, 1, 8277, 0, 0, 0, '', 0), +(8277, 0, 0, 'So what of the cipher now? And your boys?', 18945, 1, 1, 8276, 0, 0, 0, '', 0), +(8276, 0, 0, 'I will find your boys and the cipher, Oronok.', 18947, 1, 1, 0, 0, 0, 0, '', 0), +(8350, 0, 0, 'I am ready, Oronok. Let us destroy Cyrukh and free the elements!', 19307, 1, 1, 0, 0, 0, 0, '', 0); + +DELETE FROM `gossip_menu` WHERE `entry` IN(8259,8281,8280,8279,8278,8277,8276,8350); +INSERT INTO `gossip_menu` (`entry`, `text_id`) VALUES +(8259, 10280), -- 21183 +(8259, 10312), -- 21183 +(8281, 10313), -- 21183 +(8280, 10314), -- 21183 +(8279, 10315), -- 21183 +(8278, 10316), -- 21183 +(8277, 10317), -- 21183 +(8276, 10318), -- 21183 +(8350, 10421); -- 21685 + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN(14,15) AND `SourceGroup`IN(8259,8350); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(15, 8259, 1, 0, 0, 9, 0, 10519, 0, 0, 0, 0, 0, '', 'Oronok Torn-heart <Hermit & Trader> - Show gossip option only if player has The Cipher of Damnation - Truth and History taken'), +(14, 8259, 10312, 0, 0, 9, 0, 10519, 0, 0, 0, 0, 0, '', 'Oronok Torn-heart <Hermit & Trader> - Show npc text only if player has The Cipher of Damnation - Truth and History taken'), +(14, 8259, 10280, 0, 0, 9, 0, 10519, 0, 0, 1, 0, 0, '', 'Oronok Torn-heart <Hermit & Trader> - Show npc text only if player does not have The Cipher of Damnation - Truth and History taken'), +(15, 8350, 0, 0, 0, 9, 0, 10588, 0, 0, 0, 0, 0, '', 'Oronok Torn-heart - Show gossip option only if player has The Cipher of Damnation Taken'); + +DELETE FROM `smart_scripts` WHERE `entryorguid` =21183; +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 +(21183, 0, 0, 1, 62, 0, 100, 0, 8276, 0, 0, 0, 15, 10519, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Oronok Torn-heart <Hermit & Trader> - On Gossip Option Select - Complete Quest (The Cipher of Damnation - Truth and History)'), +(21183, 0, 1, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Oronok Torn-heart <Hermit & Trader> - On Gossip Option Select - Close Gossip'); diff --git a/sql/updates/world/2014_09_05_00_world_creature.sql b/sql/updates/world/2014_09_05_00_world_creature.sql new file mode 100644 index 00000000000..ce1969a66ad --- /dev/null +++ b/sql/updates/world/2014_09_05_00_world_creature.sql @@ -0,0 +1 @@ +DELETE FROM `creature` WHERE `id`=22275; diff --git a/sql/updates/world/2014_09_05_01_world_misc.sql b/sql/updates/world/2014_09_05_01_world_misc.sql new file mode 100644 index 00000000000..e03ca9e8c40 --- /dev/null +++ b/sql/updates/world/2014_09_05_01_world_misc.sql @@ -0,0 +1,6 @@ +-- Corrects unit_flags and sets AI for Illusion of Jandice Barov (11439)
+SET @ENTRY := 11439;
+UPDATE `creature_template` SET `ScriptName` = '', `AIName` = 'SmartAI', `unit_flags` = `unit_flags` &~4194304 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, 2000, 8000, 5000, 8000, 11, 15284, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "Illusion of Jandice Barov - In Combat - Cast 'Cleave' (Normal Dungeon)");
diff --git a/sql/updates/world/2014_09_05_02_world_sai.sql b/sql/updates/world/2014_09_05_02_world_sai.sql new file mode 100644 index 00000000000..1c6b1f02213 --- /dev/null +++ b/sql/updates/world/2014_09_05_02_world_sai.sql @@ -0,0 +1,50 @@ +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry`=23282; + + +DELETE FROM `smart_scripts` WHERE `entryorguid`=185932 AND `source_type`=1; + +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 +(185932, 1, 0, 1, 62, 0, 100, 0, 8685, 0, 0, 0, 85, 41035, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Obsidia\'s Egg - On Gossip Option 0 Selected - Invoker Cast 41035 Four Dragons: Force Cast - Obsidia'), +(185932, 1, 1, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Obsidia\'s Egg - On Gossip Option 0 Selected - Close Gossip'); + +DELETE FROM `event_scripts` WHERE `id`=15005; +INSERT INTO `event_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES +(15005, 1, 10, 23364, 100000, 0, 2426.954, 7001.479, 367.3824, 0), +(15005, 0, 10, 23282, 300000, 0, 2424.975, 6933.425, 409.5501, 1.43117); + + +UPDATE `creature_template` SET `ainame`='SmartAI', `scriptname`='' WHERE `entry` =23364; +DELETE FROM `smart_scripts` WHERE `entryorguid` =23364 AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid` =23282 AND `source_type`=0 AND `id`>4; + +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 +(23364, 0, 0, 1, 11, 0, 100, 0, 0, 0, 0, 0, 11, 15750, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Black Dragon Whelpling - On Spawn - Cast Rookery Whelp Spawn-in Spell'), +(23364, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Black Dragon Whelpling - On Spawn - Say'), +(23364, 0, 2, 3, 61, 0, 100, 0, 0, 0, 0, 0, 18, 33536, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Black Dragon Whelpling - On Spawn - Set Unit Flags'), +(23364, 0, 3, 4, 61, 0, 100, 0, 0, 0, 0, 0, 70, 300, 0, 0, 0, 0, 0, 14, 27915, 185932, 0, 0, 0, 0, 0, 'Black Dragon Whelpling - On Spawn - Despawn Obsidia\'s Egg'), +(23364, 0, 4, 0, 61, 0, 100, 0, 0, 0, 0, 0, 53, 0, 23364, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Black Dragon Whelpling - On Spawn - Start WP'), +(23364, 0, 5, 6, 40, 0, 100, 0, 2, 23364, 0, 0, 45, 1, 1, 0, 0, 0, 0, 19, 23282, 0, 0, 0, 0, 0, 0, 'Black Dragon Whelpling - On Reached WP2 - Set Data on Obsidia'), +(23364, 0, 6, 0, 61, 0, 100, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Black Dragon Whelpling - Reached WP2 - Despawn'), +(23282, 0, 5, 0, 11, 0, 100, 0, 0, 0, 0, 0, 18, 768, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Obsidia - On Spawn - Set Unit Flags'), +(23282, 0, 6, 7, 38, 0, 100, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Obsidia - On Data Set - Say'), +(23282, 0, 7, 0, 61, 0, 100, 0, 0, 0, 0, 0, 53, 1, 23282, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Obsidia - On Data Set - Start WP'), +(23282, 0, 8, 9, 40, 0, 100, 0, 1, 23282, 0, 0, 94, 280, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Obsidia - On Reached WP1 - Set Dynamic Flags'), +(23282, 0, 9, 10, 61, 0, 100, 0, 0, 0, 0, 0, 19, 768, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Obsidia - On Reached WP1 - Set Unit Flags'), +(23282, 0, 10, 11, 61, 0, 100, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Obsidia - On Reached WP1 - Set Home Position'), +(23282, 0, 11, 0, 61, 0, 100, 0, 0, 0, 0, 0, 8, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Obsidia - On Reached WP1 - Set Aggresive'); + +DELETE FROM `creature_text` WHERE `entry` IN(23364,23282); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `BroadcastTextID`) VALUES +(23364, 0, 0, 'The %s screams out for its mother.', 16, 0, 100, 0, 0, 431, 'Black Dragon Whelpling',21420), +(23282, 0, 0, 'I believe that I shall feast upon both $r and ogre flesh tonight.', 14, 0, 100, 0, 0, 7274, 'Obsidia',21718); + + +DELETE FROM `waypoints` WHERE `entry` IN(23364,23282); + +INSERT INTO `waypoints` (`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `point_comment`) VALUES +(23364, 1,2425.253, 6994.862, 368.0848, 'Black Dragon Whelpling'), +(23364, 2,2424.881, 6998.754, 367.8495, 'Black Dragon Whelpling'), +(23282, 1,2428.085, 6980.77, 369.7684, 'Obsidia'); + + + diff --git a/sql/updates/world/2014_09_05_03_world_sai.sql b/sql/updates/world/2014_09_05_03_world_sai.sql new file mode 100644 index 00000000000..37deab39085 --- /dev/null +++ b/sql/updates/world/2014_09_05_03_world_sai.sql @@ -0,0 +1,17 @@ +DELETE FROM `smart_scripts` WHERE `source_type`=1 AND `entryorguid` IN (185937,185938,185936); +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 +(185937, 1, 0, 1, 62, 0, 100, 0, 8690, 0, 0, 0, 85, 41050, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Furywing\'s Egg - On Gossip Option 0 Selected - Invoker cast Four Dragons: Force Cast - Furywing'), +(185938, 1, 0, 1, 62, 0, 100, 0, 8691, 0, 0, 0, 85, 41052, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Insidion\'s Egg - On Gossip Option 0 Selected - Invoker cast Four Dragons: Force Cast - Insidion'), +(185936, 1, 0, 1, 62, 0, 100, 0, 8689, 0, 0, 0, 85, 41044, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Rivendark\'s Egg - On Gossip Option 0 Selected - Invoker cast Four Dragons: Force Cast - Rivendark'), +(185937, 1, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Furywing\'s Egg - On Gossip Option 0 Selected - Close Gossip'), +(185938, 1, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Insidion\'s Egg - On Gossip Option 0 Selected - Close Gossip'), +(185936, 1, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Rivendark\'s Egg - On Gossip Option 0 Selected - Close Gossip'), +(185937, 1, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 70, 300, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Furywing\'s Egg - On Gossip Option 0 Selected - Despawn GO'), +(185938, 1, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 70, 300, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Insidion\'s Egg - On Gossip Option 0 Selected - Despawn GO'), +(185936, 1, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 70, 300, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Rivendark\'s Egg - On Gossip Option 0 Selected - Despawn GO'); + +DELETE FROM `event_scripts` WHERE `id` IN(15004,15002); +INSERT INTO `event_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES +(15004, 0, 10, 23061, 300000, 0, 2060.6, 7418.53, 391.098, 0), +(15002, 0, 10, 23281, 300000, 0, 4176.5, 5452.21, 291.923, 0), +(15003, 0, 10, 23261, 300000, 0, 3845.31, 5220.04, 295.412, 0); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 722f86a2392..93fe943b26b 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2217,6 +2217,64 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u sGameEventMgr->StartEvent(eventId, true); break; } + case SMART_ACTION_START_CLOSEST_WAYPOINT: + { + uint32 waypoints[SMART_ACTION_PARAM_COUNT]; + waypoints[0] = e.action.closestWaypointFromList.wp1; + waypoints[1] = e.action.closestWaypointFromList.wp2; + waypoints[2] = e.action.closestWaypointFromList.wp3; + waypoints[3] = e.action.closestWaypointFromList.wp4; + waypoints[4] = e.action.closestWaypointFromList.wp5; + waypoints[5] = e.action.closestWaypointFromList.wp6; + float distanceToClosest = std::numeric_limits<float>::max(); + WayPoint* closestWp = NULL; + + ObjectList* targets = GetTargets(e, unit); + if (targets) + { + for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); ++itr) + { + if (Creature* target = (*itr)->ToCreature()) + { + if (IsSmart(target)) + { + for (uint8 i = 0; i < SMART_ACTION_PARAM_COUNT; i++) + { + if (!waypoints[i]) + continue; + + WPPath* path = sSmartWaypointMgr->GetPath(waypoints[i]); + + if (!path || path->empty()) + continue; + + WPPath::const_iterator itrWp = path->find(0); + + if (itrWp != path->end()) + { + if (WayPoint* wp = itrWp->second) + { + float distToThisPath = target->GetDistance(wp->x, wp->y, wp->z); + + if (distToThisPath < distanceToClosest) + { + distanceToClosest = distToThisPath; + closestWp = wp; + } + } + } + } + + if (closestWp) + CAST_AI(SmartAI, target->AI())->StartPath(false, closestWp->id, true); + } + } + } + + delete targets; + } + break; + } default: TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); break; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 2e8453904a1..7b7e4fce7ea 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -1008,6 +1008,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } break; } + case SMART_ACTION_START_CLOSEST_WAYPOINT: case SMART_ACTION_FOLLOW: case SMART_ACTION_SET_ORIENTATION: case SMART_ACTION_STORE_TARGET_LIST: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index c79deb5d960..296c3161845 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -529,8 +529,9 @@ enum SMART_ACTION SMART_ACTION_REMOVE_POWER = 110, // PowerType, newPower SMART_ACTION_GAME_EVENT_STOP = 111, // GameEventId SMART_ACTION_GAME_EVENT_START = 112, // GameEventId + SMART_ACTION_START_CLOSEST_WAYPOINT = 113, // wp1, wp2, wp3, wp4, wp5, wp6, wp7 - SMART_ACTION_END = 113 + SMART_ACTION_END = 114 }; struct SmartAction @@ -987,6 +988,16 @@ struct SmartAction uint32 id; } gameEventStart; + struct + { + uint32 wp1; + uint32 wp2; + uint32 wp3; + uint32 wp4; + uint32 wp5; + uint32 wp6; + } closestWaypointFromList; + //! Note for any new future actions //! All parameters must have type uint32 diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp index 20d0364ab79..6e7425a75a3 100644 --- a/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp +++ b/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp @@ -355,6 +355,7 @@ void AuctionBotBuyer::AddNewAuctionBuyerBotBid(BuyerConfiguration& config) uint32 bidPrice; uint32 bidPriceByItem; uint32 minBidPrice; + uint32 minBuyPrice; if (auction->bid >= auction->startbid) { bidPrice = auction->GetAuctionOutBid(); @@ -373,6 +374,7 @@ void AuctionBotBuyer::AddNewAuctionBuyerBotBid(BuyerConfiguration& config) inGameBuyPrice = 0; inGameBidPrice = 0; minBidPrice = 0; + minBuyPrice = 0; } else { @@ -381,6 +383,7 @@ void AuctionBotBuyer::AddNewAuctionBuyerBotBid(BuyerConfiguration& config) inGameBuyPrice = sameItemItr->second.BuyPrice / sameItemItr->second.ItemCount; inGameBidPrice = sameItemItr->second.BidPrice / sameItemItr->second.ItemCount; minBidPrice = sameItemItr->second.MinBidPrice; + minBuyPrice = sameItemItr->second.MinBuyPrice; } uint32 maxBidablePrice = maxBuyablePrice - (maxBuyablePrice / 30); // Max Bidable price defined to 70% of max buyable price @@ -389,14 +392,14 @@ void AuctionBotBuyer::AddNewAuctionBuyerBotBid(BuyerConfiguration& config) TC_LOG_DEBUG("ahbot", "AHBot: MaxPrice of Entry %u is %.1fg.", itr->second.AuctionId, double(maxBuyablePrice) / 10000.0); TC_LOG_DEBUG("ahbot", "AHBot: GamePrice buy=%.1fg, bid=%.1fg.", inGameBuyPrice / 10000, inGameBidPrice / 10000); TC_LOG_DEBUG("ahbot", "AHBot: Minimal price see in AH Buy=%ug, Bid=%ug.", - sameItemItr->second.MinBuyPrice / 10000, minBidPrice / 10000); + minBuyPrice / 10000, minBidPrice / 10000); TC_LOG_DEBUG("ahbot", "AHBot: Actual Entry price, Buy=%ug, Bid=%ug.", buyoutPrice / 10000, bidPrice / 10000); if (!auction->owner) // Original auction owner maxChance = maxChance / 5; // if Owner is AHBot this mean player placed bid on this auction. We divide by 5 chance for AhBuyer to place bid on it. (This make more challenge than ignore entry) if (auction->buyout != 0) // Is the item directly buyable? { - if (IsBuyableEntry(buyoutPrice, inGameBuyPrice, maxBuyablePrice, sameItemItr->second.MinBuyPrice, maxChance, config.FactionChance)) + if (IsBuyableEntry(buyoutPrice, inGameBuyPrice, maxBuyablePrice, minBuyPrice, maxChance, config.FactionChance)) { if (IsBidableEntry(bidPriceByItem, inGameBuyPrice, maxBidablePrice, minBidPrice, maxChance / 2, config.FactionChance)) { diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 944ad4d4a19..7ab843943f8 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -7261,13 +7261,13 @@ void ObjectMgr::LoadNPCSpellClickSpells() SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spellid); if (!spellinfo) { - TC_LOG_ERROR("sql.sql", "Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid); + TC_LOG_ERROR("sql.sql", "Table npc_spellclick_spells creature: %u references unknown spellid %u. Skipping entry.", npc_entry, spellid); continue; } uint8 userType = fields[3].GetUInt16(); if (userType >= SPELL_CLICK_USER_MAX) - TC_LOG_ERROR("sql.sql", "Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType)); + TC_LOG_ERROR("sql.sql", "Table npc_spellclick_spells creature: %u references unknown user type %u. Skipping entry.", npc_entry, uint32(userType)); uint8 castFlags = fields[2].GetUInt8(); SpellClickInfo info; @@ -7329,7 +7329,7 @@ void ObjectMgr::DeleteCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_ cell_guids.corpses.erase(player_guid); } -void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const& table, bool starter, bool go) +void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, QuestRelationsReverse* reverseMap, std::string const& table, bool starter, bool go) { uint32 oldMSTime = getMSTime(); @@ -7362,7 +7362,11 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const& } if (!poolId || !starter) + { map.insert(QuestRelations::value_type(id, quest)); + if (reverseMap) + reverseMap->insert(QuestRelationsReverse::value_type(quest, id)); + } else if (starter) poolRelationMap->insert(PooledQuestRelation::value_type(quest, id)); @@ -7374,7 +7378,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const& void ObjectMgr::LoadGameobjectQuestStarters() { - LoadQuestRelationsHelper(_goQuestRelations, "gameobject_queststarter", true, true); + LoadQuestRelationsHelper(_goQuestRelations, nullptr, "gameobject_queststarter", true, true); for (QuestRelations::iterator itr = _goQuestRelations.begin(); itr != _goQuestRelations.end(); ++itr) { @@ -7388,7 +7392,7 @@ void ObjectMgr::LoadGameobjectQuestStarters() void ObjectMgr::LoadGameobjectQuestEnders() { - LoadQuestRelationsHelper(_goQuestInvolvedRelations, "gameobject_questender", false, true); + LoadQuestRelationsHelper(_goQuestInvolvedRelations, &_goQuestInvolvedRelationsReverse, "gameobject_questender", false, true); for (QuestRelations::iterator itr = _goQuestInvolvedRelations.begin(); itr != _goQuestInvolvedRelations.end(); ++itr) { @@ -7402,7 +7406,7 @@ void ObjectMgr::LoadGameobjectQuestEnders() void ObjectMgr::LoadCreatureQuestStarters() { - LoadQuestRelationsHelper(_creatureQuestRelations, "creature_queststarter", true, false); + LoadQuestRelationsHelper(_creatureQuestRelations, nullptr, "creature_queststarter", true, false); for (QuestRelations::iterator itr = _creatureQuestRelations.begin(); itr != _creatureQuestRelations.end(); ++itr) { @@ -7416,7 +7420,7 @@ void ObjectMgr::LoadCreatureQuestStarters() void ObjectMgr::LoadCreatureQuestEnders() { - LoadQuestRelationsHelper(_creatureQuestInvolvedRelations, "creature_questender", false, false); + LoadQuestRelationsHelper(_creatureQuestInvolvedRelations, &_creatureQuestInvolvedRelationsReverse, "creature_questender", false, false); for (QuestRelations::iterator itr = _creatureQuestInvolvedRelations.begin(); itr != _creatureQuestInvolvedRelations.end(); ++itr) { diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 56ae4a4c6d1..dc9196dd0df 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -492,8 +492,10 @@ typedef std::unordered_map<int32, TrinityStringLocale> TrinityStringLocaleContai typedef std::unordered_map<uint32, GossipMenuItemsLocale> GossipMenuItemsLocaleContainer; typedef std::unordered_map<uint32, PointOfInterestLocale> PointOfInterestLocaleContainer; -typedef std::multimap<uint32, uint32> QuestRelations; +typedef std::multimap<uint32, uint32> QuestRelations; // unit/go -> quest +typedef std::multimap<uint32, uint32> QuestRelationsReverse; // quest -> unit/go typedef std::pair<QuestRelations::const_iterator, QuestRelations::const_iterator> QuestRelationBounds; +typedef std::pair<QuestRelationsReverse::const_iterator, QuestRelationsReverse::const_iterator> QuestRelationReverseBounds; struct PetLevelInfo { @@ -930,6 +932,11 @@ class ObjectMgr return _goQuestInvolvedRelations.equal_range(go_entry); } + QuestRelationReverseBounds GetGOQuestInvolvedRelationReverseBounds(uint32 questId) + { + return _goQuestInvolvedRelationsReverse.equal_range(questId); + } + QuestRelations* GetCreatureQuestRelationMap() { return &_creatureQuestRelations; @@ -945,6 +952,11 @@ class ObjectMgr return _creatureQuestInvolvedRelations.equal_range(creature_entry); } + QuestRelationReverseBounds GetCreatureQuestInvolvedRelationReverseBounds(uint32 questId) + { + return _creatureQuestInvolvedRelationsReverse.equal_range(questId); + } + void LoadEventScripts(); void LoadSpellScripts(); void LoadWaypointScripts(); @@ -1347,8 +1359,10 @@ class ObjectMgr QuestRelations _goQuestRelations; QuestRelations _goQuestInvolvedRelations; + QuestRelationsReverse _goQuestInvolvedRelationsReverse; QuestRelations _creatureQuestRelations; QuestRelations _creatureQuestInvolvedRelations; + QuestRelationsReverse _creatureQuestInvolvedRelationsReverse; //character reserved names typedef std::set<std::wstring> ReservedNamesContainer; @@ -1373,7 +1387,7 @@ class ObjectMgr private: void LoadScripts(ScriptsType type); void CheckScripts(ScriptsType type, std::set<int32>& ids); - void LoadQuestRelationsHelper(QuestRelations& map, std::string const& table, bool starter, bool go); + void LoadQuestRelationsHelper(QuestRelations& map, QuestRelationsReverse* reverseMap, std::string const& table, bool starter, bool go); void PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count); MailLevelRewardContainer _mailLevelRewardStore; diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 13f79fb88c5..9cce494a522 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -33,6 +33,7 @@ #include "GameObjectAI.h" #include "SpellAuraEffects.h" #include "Player.h" +#include "Config.h" void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets) { @@ -436,6 +437,25 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket) // maybe should only remove one buff when there are multiple? _player->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL); + + // If spell being removed is a resource tracker, see if player was tracking both (herbs / minerals) and remove the other + if (sWorld->getBoolConfig(CONFIG_ALLOW_TRACK_BOTH_RESOURCES) && spellInfo->HasAura(SPELL_AURA_TRACK_RESOURCES)) + { + Unit::AuraEffectList const& auraEffects = _player->GetAuraEffectsByType(SPELL_AURA_TRACK_RESOURCES); + if (!auraEffects.empty()) + { + // Build list of spell IDs to cancel. Trying to cancel the aura while iterating + // over AuraEffectList caused "incompatible iterator" errors on second pass + std::list<uint32> spellIDs; + + for (Unit::AuraEffectList::const_iterator auraEffect = auraEffects.begin(); auraEffect != auraEffects.end(); auraEffect++) + spellIDs.push_back((*auraEffect)->GetId()); + + // Remove all auras related to resource tracking (only Herbs and Minerals in 3.3.5a) + for (std::list<uint32>::iterator it = spellIDs.begin(); it != spellIDs.end(); it++) + _player->RemoveOwnedAura(*it, 0, 0, AURA_REMOVE_BY_CANCEL); + } + } } void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 07cfa80f297..5bc2c41b6ce 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -35,6 +35,7 @@ #include "ScriptMgr.h" #include "SpellScript.h" #include "Vehicle.h" +#include "Config.h" AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint8 effMask): _target(target), _base(aura), _removeMode(AURA_REMOVE_NONE), _slot(MAX_AURAS), @@ -1785,6 +1786,15 @@ bool Aura::CanStackWith(Aura const* existingAura) const return true; } + // Check for custom server setting to allow tracking both Herbs and Minerals + // Note: The following are client limitations and cannot be coded for: + // * The minimap tracking icon will display whichever skill is activated second + // * The minimap tracking list will only show a check mark next to the last skill activated + // Sometimes this bugs out and doesn't switch the check mark. It has no effect on the actual tracking though. + // * The minimap dots are yellow for both resources + if (m_spellInfo->HasAura(SPELL_AURA_TRACK_RESOURCES) && existingSpellInfo->HasAura(SPELL_AURA_TRACK_RESOURCES)) + return sWorld->getBoolConfig(CONFIG_ALLOW_TRACK_BOTH_RESOURCES); + // check spell specific stack rules if (m_spellInfo->IsAuraExclusiveBySpecificWith(existingSpellInfo) || (sameCaster && m_spellInfo->IsAuraExclusiveBySpecificPerCasterWith(existingSpellInfo))) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 8e0c8c8bd01..461e56b8f78 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -85,6 +85,9 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto, // Black Plague else if (spellproto->Id == 64155) return DIMINISHING_NONE; + // Screams of the Dead (King Ymiron) + else if (spellproto->Id == 51750) + return DIMINISHING_NONE; break; } // Event spells diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 79dc565487d..5c65055f3c0 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1169,6 +1169,7 @@ void World::LoadConfigSettings(bool reload) if (m_int_configs[CONFIG_PVP_TOKEN_COUNT] < 1) m_int_configs[CONFIG_PVP_TOKEN_COUNT] = 1; + m_bool_configs[CONFIG_ALLOW_TRACK_BOTH_RESOURCES] = sConfigMgr->GetBoolDefault("AllowTrackBothResources", false); m_bool_configs[CONFIG_NO_RESET_TALENT_COST] = sConfigMgr->GetBoolDefault("NoResetTalentsCost", false); m_bool_configs[CONFIG_SHOW_KICK_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowKickInWorld", false); m_bool_configs[CONFIG_SHOW_MUTE_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowMuteInWorld", false); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 8a36a0af71a..05bfcc21462 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -156,6 +156,7 @@ enum WorldBoolConfigs CONFIG_STATS_LIMITS_ENABLE, CONFIG_INSTANCES_RESET_ANNOUNCE, CONFIG_IP_BASED_ACTION_LOGGING, + CONFIG_ALLOW_TRACK_BOTH_RESOURCES, BOOL_CONFIG_VALUE_COUNT }; diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp index 477eb3649b7..470eb27bad2 100644 --- a/src/server/scripts/Commands/cs_group.cpp +++ b/src/server/scripts/Commands/cs_group.cpp @@ -245,7 +245,7 @@ public: return false; } - if (!groupSource->IsFull()) + if (groupSource->IsFull()) { handler->PSendSysMessage(LANG_GROUP_FULL); handler->SetSentErrorMessage(true); diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp index 43afea1b381..14a68d1fdae 100644 --- a/src/server/scripts/Commands/cs_server.cpp +++ b/src/server/scripts/Commands/cs_server.cpp @@ -30,8 +30,6 @@ EndScriptData */ #include "ScriptMgr.h" #include "SystemConfig.h" -#include <regex> - class server_commandscript : public CommandScript { public: @@ -296,9 +294,9 @@ public: } private: - static bool ParseExitCode(std::string const& exitCodeStr, int32& exitCode) + static bool ParseExitCode(char const* exitCodeStr, int32& exitCode) { - exitCode = atoi(exitCodeStr.c_str()); + exitCode = atoi(exitCodeStr); // Handle atoi() errors if (exitCode == 0 && (exitCodeStr[0] != '0' || exitCodeStr[1] != '\0')) @@ -319,28 +317,42 @@ private: return false; // #delay [#exit_code] [reason] - std::regex regex("([0-9]+) ([0-9]*) ?(.*)"); - std::cmatch cm; + char* delayStr = strtok((char*)args, " "); + if (!delayStr || !isNumeric(delayStr)) + return false; + + char* exitCodeStr = nullptr; - if (!std::regex_match(args, cm, regex)) + if (strlen(args) > 255) return false; - std::string delayStr = cm[1]; - std::string exitCodeStr = cm[2]; - std::string reason = cm[3]; + char reason[255] = { 0 }; + + while (char* nextToken = strtok(nullptr, " ")) + { + if (isNumeric(nextToken)) + exitCodeStr = nextToken; + else + { + strcat(reason, nextToken); + strcat(reason, " "); + strcat(reason, strtok(nullptr, "\0")); + break; + } + } - int32 delay = atoi(delayStr.c_str()); + int32 delay = atoi(delayStr); // Prevent interpret wrong arg value as 0 secs shutdown time if ((delay == 0 && (delayStr[0] != '0' || delayStr[1] != '\0')) || delay < 0) return false; int32 exitCode = defaultExitCode; - if (exitCodeStr.length() > 0) + if (exitCodeStr) if (!ParseExitCode(exitCodeStr, exitCode)) return false; - sWorld->ShutdownServ(delay, shutdownMask, static_cast<uint8>(exitCode), reason); + sWorld->ShutdownServ(delay, shutdownMask, static_cast<uint8>(exitCode), std::string(reason)); return true; } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 08e3de1941a..ee624c4f6a5 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -389,7 +389,16 @@ public: struct npc_scarlet_courierAI : public ScriptedAI { - npc_scarlet_courierAI(Creature* creature) : ScriptedAI(creature) { } + npc_scarlet_courierAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + uiStage = 1; + uiStage_timer = 3000; + } uint32 uiStage; uint32 uiStage_timer; @@ -397,8 +406,7 @@ public: void Reset() override { me->Mount(14338); // not sure about this id - uiStage = 1; - uiStage_timer = 3000; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index e202e55e675..f6757afd5bc 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -312,6 +312,8 @@ public: npc_highlord_darion_mograineAI(Creature* creature) : npc_escortAI(creature) { uiTirionGUID = 0; + uiAlexandrosGUID = 0; + uiDarionGUID = 0; uiKorfaxGUID = 0; uiMaxwellGUID = 0; uiEligorGUID = 0; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp index 43dee1338ef..8f61aadb99b 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp @@ -46,7 +46,19 @@ public: struct npc_valkyr_battle_maidenAI : public PassiveAI { - npc_valkyr_battle_maidenAI(Creature* creature) : PassiveAI(creature) { } + npc_valkyr_battle_maidenAI(Creature* creature) : PassiveAI(creature) + { + Initialize(); + } + + void Initialize() + { + FlyBackTimer = 500; + phase = 0; + x = 0.f; + y = 0.f; + z = 0.f; + } uint32 FlyBackTimer; float x, y, z; @@ -58,8 +70,6 @@ public: me->SetVisible(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetCanFly(true); - FlyBackTimer = 500; - phase = 0; me->GetPosition(x, y, z); z += 4.0f; diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index cad46b84748..307bcd5add6 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -232,7 +232,20 @@ public: struct npc_headAI : public ScriptedAI { - npc_headAI(Creature* creature) : ScriptedAI(creature) { } + npc_headAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + Phase = 0; + bodyGUID = 0; + die = false; + withbody = true; + wait = 1000; + laugh = urand(15000, 30000); + } uint64 bodyGUID; @@ -245,12 +258,7 @@ public: void Reset() override { - Phase = 0; - bodyGUID = 0; - die = false; - withbody = true; - wait = 1000; - laugh = urand(15000, 30000); + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -380,10 +388,29 @@ public: { boss_headless_horsemanAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); headGUID = 0; } + void Initialize() + { + Phase = 1; + conflagrate = 15000; + summonadds = 15000; + laugh = urand(16000, 20000); + cleave = 2000; + regen = 1000; + burn = 6000; + count = 0; + say_timer = 3000; + + withhead = true; + returned = true; + burned = false; + IsFlying = false; + } + InstanceScript* instance; uint64 headGUID; @@ -410,20 +437,7 @@ public: void Reset() override { - Phase = 1; - conflagrate = 15000; - summonadds = 15000; - laugh = urand(16000, 20000); - cleave = 2000; - regen = 1000; - burn = 6000; - count = 0; - say_timer = 3000; - - withhead = true; - returned = true; - burned = false; - IsFlying = false; + Initialize(); DoCast(me, SPELL_HEAD); if (headGUID) { diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp index a4a3660b360..78a317b216e 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp @@ -51,9 +51,21 @@ public: { boss_high_inquisitor_fairbanksAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + CurseOfBlood_Timer = 10000; + DispelMagic_Timer = 30000; + Fear_Timer = 40000; + Heal_Timer = 30000; + Sleep_Timer = 30000; + Dispel_Timer = 20000; + PowerWordShield = false; + } + uint32 CurseOfBlood_Timer; uint32 DispelMagic_Timer; uint32 Fear_Timer; @@ -65,13 +77,7 @@ public: void Reset() override { - CurseOfBlood_Timer = 10000; - DispelMagic_Timer = 30000; - Fear_Timer = 40000; - Heal_Timer = 30000; - Sleep_Timer = 30000; - Dispel_Timer = 20000; - PowerWordShield = false; + Initialize(); me->SetStandState(UNIT_STAND_STATE_DEAD); me->SetUInt32Value(UNIT_FIELD_BYTES_1, 7); instance->SetBossState(DATA_HIGH_INQUISITOR_FAIRBANKS, NOT_STARTED); diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp index a73cf946a7c..c05de1bb800 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp @@ -55,9 +55,17 @@ public: { boss_interrogator_vishasAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = me->GetInstanceScript(); } + void Initialize() + { + ShadowWordPain_Timer = 5000; + Yell60 = false; + Yell30 = false; + } + InstanceScript* instance; bool Yell30; @@ -66,9 +74,7 @@ public: void Reset() override { - ShadowWordPain_Timer = 5000; - Yell60 = false; - Yell30 = false; + Initialize(); instance->SetBossState(DATA_INTERROGATOR_VISHAS, NOT_STARTED); } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index a9988584edd..02f7c815414 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -72,9 +72,19 @@ public: { boss_scarlet_commander_mograineAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + CrusaderStrike_Timer = 10000; + HammerOfJustice_Timer = 10000; + _bHasDied = false; + _bHeal = false; + _bFakeDeath = false; + } + InstanceScript* instance; uint32 CrusaderStrike_Timer; @@ -86,8 +96,7 @@ public: void Reset() override { - CrusaderStrike_Timer = 10000; - HammerOfJustice_Timer = 10000; + Initialize(); //Incase wipe during phase that mograine fake death me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -96,10 +105,6 @@ public: if (me->IsAlive()) instance->SetBossState(DATA_MOGRAINE_AND_WHITE_EVENT, NOT_STARTED); - - _bHasDied = false; - _bHeal = false; - _bFakeDeath = false; } void JustReachedHome() override @@ -230,9 +235,21 @@ public: { boss_high_inquisitor_whitemaneAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + Wait_Timer = 7000; + Heal_Timer = 10000; + PowerWordShield_Timer = 15000; + HolySmite_Timer = 6000; + + _bCanResurrectCheck = false; + _bCanResurrect = false; + } + InstanceScript* instance; uint32 Heal_Timer; @@ -245,13 +262,7 @@ public: void Reset() override { - Wait_Timer = 7000; - Heal_Timer = 10000; - PowerWordShield_Timer = 15000; - HolySmite_Timer = 6000; - - _bCanResurrectCheck = false; - _bCanResurrect = false; + Initialize(); if (me->IsAlive()) instance->SetBossState(DATA_MOGRAINE_AND_WHITE_EVENT, NOT_STARTED); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp index 84ada04a989..4a9703b509b 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp @@ -50,7 +50,16 @@ class boss_instructor_malicia : public CreatureScript struct boss_instructormaliciaAI : public BossAI { - boss_instructormaliciaAI(Creature* creature) : BossAI(creature, DATA_INSTRUCTORMALICIA) { } + boss_instructormaliciaAI(Creature* creature) : BossAI(creature, DATA_INSTRUCTORMALICIA) + { + Initialize(); + } + + void Initialize() + { + FlashCounter = 0; + TouchCounter = 0; + } uint32 FlashCounter; uint32 TouchCounter; @@ -58,8 +67,7 @@ class boss_instructor_malicia : public CreatureScript void Reset() override { _Reset(); - FlashCounter = 0; - TouchCounter = 0; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp index 57331d84b82..44885a01270 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * 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 @@ -16,23 +15,21 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_jandicebarov -SD%Complete: 100 -SDComment: -SDCategory: Scholomance -EndScriptData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" enum Spells { - SPELL_CURSEOFBLOOD = 24673, - //SPELL_ILLUSION = 17773, + SPELL_CURSE_OF_BLOOD = 24673, + SPELL_ILLUSION = 17773, +}; - // Spells of Illusion of Jandice Barov - SPELL_CLEAVE = 15284 +enum Events +{ + EVENT_CURSE_OF_BLOOD = 1, + EVENT_ILLUSION, + EVENT_CLEAVE, + EVENT_SET_VISIBILITY }; class boss_jandice_barov : public CreatureScript @@ -40,173 +37,87 @@ class boss_jandice_barov : public CreatureScript public: boss_jandice_barov() : CreatureScript("boss_jandice_barov") { } - CreatureAI* GetAI(Creature* creature) const override - { - return new boss_jandicebarovAI(creature); - } - struct boss_jandicebarovAI : public ScriptedAI { - boss_jandicebarovAI(Creature* creature) : ScriptedAI(creature) { } - - uint32 CurseOfBlood_Timer; - uint32 Illusion_Timer; - //uint32 Illusioncounter; - uint32 Invisible_Timer; - bool Invisible; + boss_jandicebarovAI(Creature* creature) : ScriptedAI(creature), Summons(me) { } void Reset() override { - CurseOfBlood_Timer = 15000; - Illusion_Timer = 30000; - Invisible_Timer = 3000; //Too much too low? - Invisible = false; + events.Reset(); + Summons.DespawnAll(); + } + + void JustSummoned(Creature* summoned) override + { + // Illusions should attack a random target. + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + summoned->AI()->AttackStart(target); + + summoned->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); // Not sure if this is correct. + Summons.Summon(summoned); } void EnterCombat(Unit* /*who*/) override { + events.ScheduleEvent(EVENT_CURSE_OF_BLOOD, 15000); + events.ScheduleEvent(EVENT_ILLUSION, 30000); } - void SummonIllusions(Unit* victim) + void JustDied(Unit* /*killer*/) override { - if (Creature* Illusion = DoSpawnCreature(11439, float(irand(-9, 9)), float(irand(-9, 9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) - Illusion->AI()->AttackStart(victim); + Summons.DespawnAll(); } void UpdateAI(uint32 diff) override { - if (Invisible && Invisible_Timer <= diff) - { - //Become visible again - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(11073); //Jandice Model - Invisible = false; - } else if (Invisible) - { - Invisible_Timer -= diff; - //Do nothing while invisible - return; - } - - //Return since we have no target if (!UpdateVictim()) return; - //CurseOfBlood_Timer - if (CurseOfBlood_Timer <= diff) - { - //Cast - DoCastVictim(SPELL_CURSEOFBLOOD); + events.Update(diff); - //45 seconds - CurseOfBlood_Timer = 30000; - } else CurseOfBlood_Timer -= diff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - //Illusion_Timer - if (!Invisible && Illusion_Timer <= diff) + while (uint32 eventId = events.ExecuteEvent()) { - - //Interrupt any spell casting - me->InterruptNonMeleeSpells(false); - me->setFaction(35); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(11686); // Invisible Model - DoModifyThreatPercent(me->GetVictim(), -99); - - //Summon 10 Illusions attacking random gamers - Unit* target = NULL; - for (uint8 i = 0; i < 10; ++i) + switch (eventId) { - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) - SummonIllusions(target); + case EVENT_CURSE_OF_BLOOD: + DoCastVictim(SPELL_CURSE_OF_BLOOD); + events.ScheduleEvent(EVENT_CURSE_OF_BLOOD, 30000); + break; + case EVENT_ILLUSION: + DoCast(SPELL_ILLUSION); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(11686); // Invisible Model + DoModifyThreatPercent(me->GetVictim(), -99); + events.ScheduleEvent(EVENT_SET_VISIBILITY, 3000); + events.ScheduleEvent(EVENT_ILLUSION, 25000); + break; + case EVENT_SET_VISIBILITY: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(11073); //Jandice Model + break; + default: + break; } - Invisible = true; - Invisible_Timer = 3000; - - //25 seconds until we should cast this agian - Illusion_Timer = 25000; - } else Illusion_Timer -= diff; - - // //Illusion_Timer - // if (Illusion_Timer <= diff) - // { - // //Cast - // DoCastVictim(SPELL_ILLUSION); - // - // //3 Illusion will be summoned - // if (Illusioncounter < 3) - // { - // Illusion_Timer = 500; - // ++Illusioncounter; - // } - // else { - // //15 seconds until we should cast this again - // Illusion_Timer = 15000; - // Illusioncounter = 0; - // } - // - // } else Illusion_Timer -= diff; + } DoMeleeAttackIfReady(); } + + private: + EventMap events; + SummonList Summons; }; -}; - -// Illusion of Jandice Barov Script - -class npc_illusionofjandicebarov : public CreatureScript -{ -public: - npc_illusionofjandicebarov() : CreatureScript("npc_illusionofjandicebarov") { } - CreatureAI* GetAI(Creature* creature) const override { - return new npc_illusionofjandicebarovAI(creature); + return new boss_jandicebarovAI(creature); } - - struct npc_illusionofjandicebarovAI : public ScriptedAI - { - npc_illusionofjandicebarovAI(Creature* creature) : ScriptedAI(creature) { } - - uint32 Cleave_Timer; - - void Reset() override - { - Cleave_Timer = urand(2000, 8000); - me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); - } - - void EnterCombat(Unit* /*who*/) override - { - } - - void UpdateAI(uint32 diff) override - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Cleave_Timer - if (Cleave_Timer <= diff) - { - //Cast - DoCastVictim(SPELL_CLEAVE); - - //5-8 seconds - Cleave_Timer = urand(5000, 8000); - } else Cleave_Timer -= diff; - - DoMeleeAttackIfReady(); - } - }; - }; void AddSC_boss_jandicebarov() { new boss_jandice_barov(); - new npc_illusionofjandicebarov(); } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp index b88954bd1b7..3864c598459 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp @@ -44,7 +44,19 @@ public: struct boss_kormokAI : public ScriptedAI { - boss_kormokAI(Creature* creature) : ScriptedAI(creature) { } + boss_kormokAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + ShadowVolley_Timer = 10000; + BoneShield_Timer = 2000; + Minion_Timer = 15000; + Mage_Timer = 0; + Mages = false; + } uint32 ShadowVolley_Timer; uint32 BoneShield_Timer; @@ -54,11 +66,7 @@ public: void Reset() override { - ShadowVolley_Timer = 10000; - BoneShield_Timer = 2000; - Minion_Timer = 15000; - Mage_Timer = 0; - Mages = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp index 2aecc8bd491..9351224863c 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp @@ -48,7 +48,20 @@ public: struct boss_rasfrostAI : public ScriptedAI { - boss_rasfrostAI(Creature* creature) : ScriptedAI(creature) { } + boss_rasfrostAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + IceArmor_Timer = 2000; + Frostbolt_Timer = 8000; + ChillNova_Timer = 12000; + Freeze_Timer = 18000; + FrostVolley_Timer = 24000; + Fear_Timer = 45000; + } uint32 IceArmor_Timer; uint32 Frostbolt_Timer; @@ -59,12 +72,7 @@ public: void Reset() override { - IceArmor_Timer = 2000; - Frostbolt_Timer = 8000; - ChillNova_Timer = 12000; - Freeze_Timer = 18000; - FrostVolley_Timer = 24000; - Fear_Timer = 45000; + Initialize(); DoCast(me, SPELL_ICEARMOR, true); } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp index c111eb103b4..fba5f3faa14 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp @@ -51,7 +51,17 @@ public: struct boss_vectusAI : public ScriptedAI { - boss_vectusAI(Creature* creature) : ScriptedAI(creature) { } + boss_vectusAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + m_uiFireShield_Timer = 2000; + m_uiBlastWave_Timer = 14000; + m_uiFrenzy_Timer = 0; + } uint32 m_uiFireShield_Timer; uint32 m_uiBlastWave_Timer; @@ -59,9 +69,7 @@ public: void Reset() override { - m_uiFireShield_Timer = 2000; - m_uiBlastWave_Timer = 14000; - m_uiFrenzy_Timer = 0; + Initialize(); } void UpdateAI(uint32 uiDiff) override diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp index fb839650b86..a6e77a234c6 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp @@ -164,16 +164,22 @@ public: { npc_arugal_voidwalkerAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + uiDarkOffering = urand(200, 1000); + } + InstanceScript* instance; uint32 uiDarkOffering; void Reset() override { - uiDarkOffering = urand(200, 1000); + Initialize(); } void UpdateAI(uint32 uiDiff) override diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp index de54e87fc97..85f5b51b52e 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp @@ -75,9 +75,19 @@ public: { boss_baron_rivendareAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = me->GetInstanceScript(); } + void Initialize() + { + ShadowBolt_Timer = 5000; + Cleave_Timer = 8000; + MortalStrike_Timer = 12000; + // RaiseDead_Timer = 30000; + SummonSkeletons_Timer = 34000; + } + InstanceScript* instance; uint32 ShadowBolt_Timer; @@ -88,11 +98,7 @@ public: void Reset() override { - ShadowBolt_Timer = 5000; - Cleave_Timer = 8000; - MortalStrike_Timer = 12000; - // RaiseDead_Timer = 30000; - SummonSkeletons_Timer = 34000; + Initialize(); if (instance->GetData(TYPE_RAMSTEIN) == DONE) instance->SetData(TYPE_BARON, NOT_STARTED); } diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp index a3eb66ac23c..fa8f0f39563 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp @@ -49,9 +49,18 @@ public: { boss_baroness_anastariAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = me->GetInstanceScript(); } + void Initialize() + { + BansheeWail_Timer = 1000; + BansheeCurse_Timer = 11000; + Silence_Timer = 13000; + //Possess_Timer = 35000; + } + InstanceScript* instance; uint32 BansheeWail_Timer; @@ -61,10 +70,7 @@ public: void Reset() override { - BansheeWail_Timer = 1000; - BansheeCurse_Timer = 11000; - Silence_Timer = 13000; - //Possess_Timer = 35000; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp index 14d2a9a9f26..063081021fd 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp @@ -92,7 +92,18 @@ public: struct boss_cannon_master_willeyAI : public ScriptedAI { - boss_cannon_master_willeyAI(Creature* creature) : ScriptedAI(creature) { } + boss_cannon_master_willeyAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + Shoot_Timer = 1000; + Pummel_Timer = 7000; + KnockAway_Timer = 11000; + SummonRifleman_Timer = 15000; + } uint32 KnockAway_Timer; uint32 Pummel_Timer; @@ -101,10 +112,7 @@ public: void Reset() override { - Shoot_Timer = 1000; - Pummel_Timer = 7000; - KnockAway_Timer = 11000; - SummonRifleman_Timer = 15000; + Initialize(); } void JustDied(Unit* /*killer*/) override diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp index f0a8c5c418f..1c7af67190f 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp @@ -81,7 +81,23 @@ public: struct boss_dathrohan_balnazzarAI : public ScriptedAI { - boss_dathrohan_balnazzarAI(Creature* creature) : ScriptedAI(creature) { } + boss_dathrohan_balnazzarAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + m_uiCrusadersHammer_Timer = 8000; + m_uiCrusaderStrike_Timer = 12000; + m_uiMindBlast_Timer = 6000; + m_uiHolyStrike_Timer = 18000; + m_uiShadowShock_Timer = 4000; + m_uiPsychicScream_Timer = 16000; + m_uiDeepSleep_Timer = 20000; + m_uiMindControl_Timer = 10000; + m_bTransformed = false; + } uint32 m_uiCrusadersHammer_Timer; uint32 m_uiCrusaderStrike_Timer; @@ -95,15 +111,7 @@ public: void Reset() override { - m_uiCrusadersHammer_Timer = 8000; - m_uiCrusaderStrike_Timer = 12000; - m_uiMindBlast_Timer = 6000; - m_uiHolyStrike_Timer = 18000; - m_uiShadowShock_Timer = 4000; - m_uiPsychicScream_Timer = 16000; - m_uiDeepSleep_Timer = 20000; - m_uiMindControl_Timer = 10000; - m_bTransformed = false; + Initialize(); if (me->GetEntry() == NPC_BALNAZZAR) me->UpdateEntry(NPC_DATHROHAN); diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp index 8b6f2da87e4..ddd51320b1c 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp @@ -53,7 +53,19 @@ public: struct boss_magistrate_barthilasAI : public ScriptedAI { - boss_magistrate_barthilasAI(Creature* creature) : ScriptedAI(creature) { } + boss_magistrate_barthilasAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + DrainingBlow_Timer = 20000; + CrowdPummel_Timer = 15000; + MightyBlow_Timer = 10000; + FuriousAnger_Timer = 5000; + AngerCount = 0; + } uint32 DrainingBlow_Timer; uint32 CrowdPummel_Timer; @@ -63,11 +75,7 @@ public: void Reset() override { - DrainingBlow_Timer = 20000; - CrowdPummel_Timer = 15000; - MightyBlow_Timer = 10000; - FuriousAnger_Timer = 5000; - AngerCount = 0; + Initialize(); if (me->IsAlive()) me->SetDisplayId(MODEL_NORMAL); diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp index b3fae9821aa..68193ffd0c2 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp @@ -50,9 +50,17 @@ public: { boss_maleki_the_pallidAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = me->GetInstanceScript(); } + void Initialize() + { + Frostbolt_Timer = 1000; + IceTomb_Timer = 16000; + DrainLife_Timer = 31000; + } + InstanceScript* instance; uint32 Frostbolt_Timer; @@ -61,9 +69,7 @@ public: void Reset() override { - Frostbolt_Timer = 1000; - IceTomb_Timer = 16000; - DrainLife_Timer = 31000; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp index 1b5127a5e1c..1d3e28946be 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp @@ -49,9 +49,18 @@ public: { boss_nerubenkanAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = me->GetInstanceScript(); } + void Initialize() + { + CryptScarabs_Timer = 3000; + EncasingWebs_Timer = 7000; + PierceArmor_Timer = 19000; + RaiseUndeadScarab_Timer = 3000; + } + InstanceScript* instance; uint32 EncasingWebs_Timer; @@ -61,10 +70,7 @@ public: void Reset() override { - CryptScarabs_Timer = 3000; - EncasingWebs_Timer = 7000; - PierceArmor_Timer = 19000; - RaiseUndeadScarab_Timer = 3000; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp index dfc3e570e1b..0a09bc85ea3 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp @@ -65,9 +65,16 @@ public: { boss_silver_hand_bossesAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + HolyLight_Timer = 20000; + DivineShield_Timer = 20000; + } + InstanceScript* instance; uint32 HolyLight_Timer; @@ -75,8 +82,7 @@ public: void Reset() override { - HolyLight_Timer = 20000; - DivineShield_Timer = 20000; + Initialize(); switch (me->GetEntry()) { diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp index df9b6a04af4..531a4f3887a 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp @@ -52,9 +52,16 @@ public: { boss_ramstein_the_gorgerAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = me->GetInstanceScript(); } + void Initialize() + { + Trample_Timer = 3000; + Knockout_Timer = 12000; + } + InstanceScript* instance; uint32 Trample_Timer; @@ -62,8 +69,7 @@ public: void Reset() override { - Trample_Timer = 3000; - Knockout_Timer = 12000; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp index a45b3594da0..f721fca8aab 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp @@ -48,15 +48,23 @@ public: struct boss_timmy_the_cruelAI : public ScriptedAI { - boss_timmy_the_cruelAI(Creature* creature) : ScriptedAI(creature) { } + boss_timmy_the_cruelAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + RavenousClaw_Timer = 10000; + HasYelled = false; + } uint32 RavenousClaw_Timer; bool HasYelled; void Reset() override { - RavenousClaw_Timer = 10000; - HasYelled = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index 4109328afda..01ee7139ae5 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp @@ -142,7 +142,17 @@ public: struct npc_restless_soulAI : public ScriptedAI { - npc_restless_soulAI(Creature* creature) : ScriptedAI(creature) { } + npc_restless_soulAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + Tagger = 0; + Die_Timer = 5000; + Tagged = false; + } uint64 Tagger; uint32 Die_Timer; @@ -150,9 +160,7 @@ public: void Reset() override { - Tagger = 0; - Die_Timer = 5000; - Tagged = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -224,15 +232,23 @@ public: struct npc_spectral_ghostly_citizenAI : public ScriptedAI { - npc_spectral_ghostly_citizenAI(Creature* creature) : ScriptedAI(creature) { } + npc_spectral_ghostly_citizenAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + Die_Timer = 5000; + Tagged = false; + } uint32 Die_Timer; bool Tagged; void Reset() override { - Die_Timer = 5000; - Tagged = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index eb9b6c2a1df..4e401be7df3 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -70,10 +70,26 @@ public: { boss_brutallusAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); Intro = true; } + void Initialize() + { + SlashTimer = 11000; + StompTimer = 30000; + BurnTimer = 60000; + BerserkTimer = 360000; + + IntroPhase = 0; + IntroPhaseTimer = 0; + IntroFrostBoltTimer = 0; + + IsIntro = false; + Enraged = false; + } + InstanceScript* instance; uint32 SlashTimer; @@ -91,17 +107,7 @@ public: void Reset() override { - SlashTimer = 11000; - StompTimer = 30000; - BurnTimer = 60000; - BerserkTimer = 360000; - - IntroPhase = 0; - IntroPhaseTimer = 0; - IntroFrostBoltTimer = 0; - - IsIntro = false; - Enraged = false; + Initialize(); DoCast(me, SPELL_DUAL_WIELD, true); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index 3701d37ed7f..d2382cda37d 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -82,9 +82,22 @@ public: { boss_sacrolashAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + ShadowbladesTimer = 10000; + ShadownovaTimer = 30000; + ConfoundingblowTimer = 25000; + ShadowimageTimer = 20000; + ConflagrationTimer = 30000; + EnrageTimer = 360000; + SisterDeath = false; + Enraged = false; + } + InstanceScript* instance; bool SisterDeath; @@ -111,13 +124,7 @@ public: if (!me->IsInCombat()) { - ShadowbladesTimer = 10000; - ShadownovaTimer = 30000; - ConfoundingblowTimer = 25000; - ShadowimageTimer = 20000; - ConflagrationTimer = 30000; - EnrageTimer = 360000; - SisterDeath = false; + Initialize(); } instance->SetBossState(DATA_EREDAR_TWINS, NOT_STARTED); @@ -319,12 +326,27 @@ public: { boss_alythessAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); SetCombatMovement(false); instance = creature->GetInstanceScript(); IntroStepCounter = 10; } + void Initialize() + { + ConflagrationTimer = 45000; + BlazeTimer = 100; + PyrogenicsTimer = 15000; + ShadownovaTimer = 40000; + EnrageTimer = 360000; + FlamesearTimer = 15000; + IntroYellTimer = 10000; + + SisterDeath = false; + Enraged = false; + } + InstanceScript* instance; bool SisterDeath; @@ -354,15 +376,7 @@ public: if (!me->IsInCombat()) { - ConflagrationTimer = 45000; - BlazeTimer = 100; - PyrogenicsTimer = 15000; - ShadownovaTimer = 40000; - EnrageTimer = 360000; - FlamesearTimer = 15000; - IntroYellTimer = 10000; - - SisterDeath = false; + Initialize(); } instance->SetBossState(DATA_EREDAR_TWINS, NOT_STARTED); @@ -635,7 +649,17 @@ public: struct npc_shadow_imageAI : public ScriptedAI { - npc_shadow_imageAI(Creature* creature) : ScriptedAI(creature) { } + npc_shadow_imageAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + ShadowfuryTimer = 5000 + (rand32() % 15000); + DarkstrikeTimer = 3000; + KillTimer = 15000; + } uint32 ShadowfuryTimer; uint32 KillTimer; @@ -644,9 +668,7 @@ public: void Reset() override { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - ShadowfuryTimer = 5000 + (rand32() % 15000); - DarkstrikeTimer = 3000; - KillTimer = 15000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 120d3a0b231..4b17f698553 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -116,7 +116,17 @@ public: { boss_felmystAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); + uiBreathCount = 0; + breathX = 0.f; + breathY = 0.f; + } + + void Initialize() + { + phase = PHASE_NONE; + uiFlightCount = 0; } InstanceScript* instance; @@ -130,12 +140,10 @@ public: void Reset() override { - phase = PHASE_NONE; + Initialize(); events.Reset(); - uiFlightCount = 0; - me->SetDisableGravity(true); me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); me->SetFloatValue(UNIT_FIELD_COMBATREACH, 10); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index b7e03fe0459..3284febb9f3 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -107,13 +107,30 @@ public: { boss_kalecgosAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); - SathGUID = 0; - DoorGUID = 0; bJustReset = false; me->setActive(true); } + void Initialize() + { + SathGUID = 0; + ArcaneBuffetTimer = 8000; + FrostBreathTimer = 15000; + WildMagicTimer = 10000; + TailLashTimer = 25000; + SpectralBlastTimer = urand(20000, 25000); + CheckTimer = 1000; + ResetTimer = 30000; + + TalkTimer = 0; + TalkSequence = 0; + isFriendly = false; + isEnraged = false; + isBanished = false; + } + InstanceScript* instance; uint32 ArcaneBuffetTimer; @@ -132,7 +149,6 @@ public: bool bJustReset; uint64 SathGUID; - uint64 DoorGUID; void Reset() override { @@ -151,19 +167,6 @@ public: me->SetStandState(UNIT_STAND_STATE_SLEEP); } me->SetFullHealth(); //dunno why it does not resets health at evade.. - ArcaneBuffetTimer = 8000; - FrostBreathTimer = 15000; - WildMagicTimer = 10000; - TailLashTimer = 25000; - SpectralBlastTimer = urand(20000, 25000); - CheckTimer = 1000; - ResetTimer = 30000; - - TalkTimer = 0; - TalkSequence = 0; - isFriendly = false; - isEnraged = false; - isBanished = false; } void EnterEvadeMode() override @@ -459,13 +462,13 @@ public: boss_kalecAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); + SathGUID = 0; } - void Reset() override + void Initialize() { - SathGUID = instance->GetData64(DATA_SATHROVARR); - RevitalizeTimer = 5000; HeroicStrikeTimer = 3000; YellTimer = 5000; @@ -474,6 +477,13 @@ public: isEnraged = false; } + void Reset() override + { + SathGUID = instance->GetData64(DATA_SATHROVARR); + + Initialize(); + } + void DamageTaken(Unit* done_by, uint32 &damage) override { if (done_by->GetGUID() != SathGUID) @@ -581,11 +591,23 @@ public: { boss_sathrovarrAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); KalecGUID = 0; KalecgosGUID = 0; } + void Initialize() + { + ShadowBoltTimer = urand(7, 10) * 1000; + AgonyCurseTimer = 20000; + CorruptionStrikeTimer = 13000; + CheckTimer = 1000; + ResetThreat = 1000; + isEnraged = false; + isBanished = false; + } + InstanceScript* instance; uint32 CorruptionStrikeTimer; @@ -613,13 +635,7 @@ public: KalecGUID = 0; } - ShadowBoltTimer = urand(7, 10) * 1000; - AgonyCurseTimer = 20000; - CorruptionStrikeTimer = 13000; - CheckTimer = 1000; - ResetThreat = 1000; - isEnraged = false; - isBanished = false; + Initialize(); me->CastSpell(me, AURA_DEMONIC_VISUAL, true); TeleportAllPlayersBack(); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 1f66f834b28..5df2d683e21 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -243,17 +243,23 @@ public: { boss_kalecgos_kjAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + OrbsEmpowered = 0; + EmpowerCount = 0; + } + InstanceScript* instance; uint8 OrbsEmpowered; uint8 EmpowerCount; void Reset() override { - OrbsEmpowered = 0; - EmpowerCount = 0; + Initialize(); me->SetDisableGravity(true); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->setActive(true); @@ -393,11 +399,21 @@ public: { npc_kiljaeden_controllerAI(Creature* creature) : ScriptedAI(creature), summons(me) { + Initialize(); instance = creature->GetInstanceScript(); SetCombatMovement(false); } + void Initialize() + { + phase = PHASE_DECEIVERS; + deceiverDeathCount = 0; + bSummonedDeceivers = false; + bKiljaedenDeath = false; + uiRandomSayTimer = 30000; + } + InstanceScript* instance; SummonList summons; @@ -419,14 +435,10 @@ public: void Reset() override { - phase = PHASE_DECEIVERS; + Initialize(); if (Creature* pKalecKJ = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_KALECGOS_KJ))) ENSURE_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalecKJ->AI())->ResetOrbs(); - deceiverDeathCount = 0; - bSummonedDeceivers = false; - bKiljaedenDeath = false; - uiRandomSayTimer = 30000; summons.DespawnAll(); } @@ -489,11 +501,47 @@ public: { boss_kiljaedenAI(Creature* creature) : ScriptedAI(creature), summons(me) { + Initialize(); instance = creature->GetInstanceScript(); SetCombatMovement(false); } + void Initialize() + { + TimerIsDeactivated[TIMER_SPEECH] = false; + Timer[TIMER_SPEECH] = 0; + + //Phase 2 Timer + Timer[TIMER_SOUL_FLAY] = 11000; + Timer[TIMER_LEGION_LIGHTNING] = 30000; + Timer[TIMER_FIRE_BLOOM] = 20000; + Timer[TIMER_SUMMON_SHILEDORB] = 35000; + + //Phase 3 Timer + Timer[TIMER_SHADOW_SPIKE] = 4000; + Timer[TIMER_FLAME_DART] = 3000; + Timer[TIMER_DARKNESS] = 45000; + Timer[TIMER_ORBS_EMPOWER] = 35000; + + //Phase 4 Timer + Timer[TIMER_ARMAGEDDON] = 2000; + + ActiveTimers = 5; + WaitTimer = 0; + speechCount = 0; + SpeechTimer = 0; + + Phase = PHASE_NORMAL; + + IsInDarkness = false; + IsWaiting = false; + OrbActivated = false; + SpeechBegins = true; + + ChangeTimers(false, 0); + } + InstanceScript* instance; SummonList summons; @@ -520,41 +568,12 @@ public: void Reset() override { - TimerIsDeactivated[TIMER_SPEECH] = false; - Timer[TIMER_SPEECH] = 0; - - //Phase 2 Timer - Timer[TIMER_SOUL_FLAY] = 11000; - Timer[TIMER_LEGION_LIGHTNING] = 30000; - Timer[TIMER_FIRE_BLOOM] = 20000; - Timer[TIMER_SUMMON_SHILEDORB] = 35000; - - //Phase 3 Timer - Timer[TIMER_SHADOW_SPIKE] = 4000; - Timer[TIMER_FLAME_DART] = 3000; - Timer[TIMER_DARKNESS] = 45000; - Timer[TIMER_ORBS_EMPOWER] = 35000; - - //Phase 4 Timer - Timer[TIMER_ARMAGEDDON] = 2000; - - ActiveTimers = 5; - WaitTimer = 0; - speechCount = 0; - SpeechTimer = 0; - - Phase = PHASE_NORMAL; - - IsInDarkness = false; - IsWaiting = false; - OrbActivated = false; - SpeechBegins = true; + Initialize(); if (Creature* pKalec = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KALECGOS_KJ))) pKalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); me->SetFloatValue(UNIT_FIELD_COMBATREACH, 12); - ChangeTimers(false, 0); summons.DespawnAll(); } @@ -890,9 +909,17 @@ public: { npc_hand_of_the_deceiverAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + /// @todo Timers! + ShadowBoltVolleyTimer = urand(8000, 14000); // So they don't all cast it in the same moment. + FelfirePortalTimer = 20000; + } + InstanceScript* instance; uint32 ShadowBoltVolleyTimer; @@ -900,9 +927,7 @@ public: void Reset() override { - /// @todo Timers! - ShadowBoltVolleyTimer = urand(8000, 14000); // So they don't all cast it in the same moment. - FelfirePortalTimer = 20000; + Initialize(); instance->SetBossState(DATA_KILJAEDEN, NOT_STARTED); } @@ -989,14 +1014,20 @@ public: { npc_felfire_portalAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); SetCombatMovement(false); } + void Initialize() + { + uiSpawnFiendTimer = 5000; + } + uint32 uiSpawnFiendTimer; void Reset() override { - uiSpawnFiendTimer = 5000; + Initialize(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); } @@ -1034,7 +1065,16 @@ public: struct npc_volatile_felfire_fiendAI : public ScriptedAI { - npc_volatile_felfire_fiendAI(Creature* creature) : ScriptedAI(creature) { } + npc_volatile_felfire_fiendAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + uiExplodeTimer = 2000; + bLockedTarget = false; + } uint32 uiExplodeTimer; @@ -1042,8 +1082,7 @@ public: void Reset() override { - uiExplodeTimer = 2000; - bLockedTarget = false; + Initialize(); } void DamageTaken(Unit* /*done_by*/, uint32 &damage) override @@ -1093,16 +1132,22 @@ public: { npc_armageddonAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); SetCombatMovement(false); } + void Initialize() + { + spell = 0; + uiTimer = 0; + } + uint8 spell; uint32 uiTimer; void Reset() override { - spell = 0; - uiTimer = 0; + Initialize(); } void UpdateAI(uint32 diff) override @@ -1150,7 +1195,22 @@ public: { npc_shield_orbAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); + x = 0.f; + y = 0.f; + } + + void Initialize() + { + bPointReached = true; + uiTimer = urand(500, 1000); + uiCheckTimer = 1000; + r = 17; + c = 0; + mx = ShieldOrbLocations[0][0]; + my = ShieldOrbLocations[0][1]; + bClockwise = roll_chance_i(50); } InstanceScript* instance; @@ -1164,14 +1224,7 @@ public: void Reset() override { me->SetDisableGravity(true); - bPointReached = true; - uiTimer = urand(500, 1000); - uiCheckTimer = 1000; - r = 17; - c = 0; - mx = ShieldOrbLocations[0][0]; - my = ShieldOrbLocations[0][1]; - bClockwise = roll_chance_i(50); + Initialize(); } void UpdateAI(uint32 diff) override @@ -1235,12 +1288,12 @@ public: struct npc_sinster_reflectionAI : public ScriptedAI { - npc_sinster_reflectionAI(Creature* creature) : ScriptedAI(creature) { } - - uint8 victimClass; - uint32 uiTimer[3]; + npc_sinster_reflectionAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } - void Reset() override + void Initialize() { uiTimer[0] = 0; uiTimer[1] = 0; @@ -1248,6 +1301,14 @@ public: victimClass = 0; } + uint8 victimClass; + uint32 uiTimer[3]; + + void Reset() override + { + Initialize(); + } + void UpdateAI(uint32 diff) override { if (!UpdateVictim()) diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index 6ccce62cb6f..ec0bae0f27f 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -74,71 +74,51 @@ enum Spells SPELL_BLACKHOLE_GROW = 46228 }; -enum BossTimers +enum Events { - TIMER_DARKNESS = 0, - TIMER_HUMANOIDES = 1, - TIMER_PHASE = 2, - TIMER_SENTINEL = 3 + // M'uru + EVENT_DARKNESS = 1, + EVENT_SUMMON_HUMANOIDS, + EVENT_SUMMON_SENTINEL, + EVENT_PHASE_TRANSITION, // Delayed phase transition. + EVENT_ENRAGE, + + // Entropius + EVENT_SUMMON_BLACK_HOLE }; -float DarkFiends[8][4] = +enum Phases { - {1819.9f, 609.80f, 69.74f, 1.94f}, - {1829.39f, 617.89f, 69.73f, 2.61f}, - {1801.98f, 633.62f, 69.74f, 5.71f}, - {1830.88f, 629.99f, 69.73f, 3.52f}, - {1800.38f, 621.41f, 69.74f, 0.22f}, - {1808.3f, 612.45f, 69.73f, 1.02f}, - {1823.9f, 639.69f, 69.74f, 4.12f}, - {1811.85f, 640.46f, 69.73f, 4.97f} + PHASE_ONE = 1, + PHASE_TWO, }; -float Humanoides[6][5] = +enum CreatureGroups { - {NPC_FURY_MAGE, 1780.16f, 666.83f, 71.19f, 5.21f}, - {NPC_FURY_MAGE, 1847.93f, 600.30f, 71.30f, 2.57f}, - {NPC_BERSERKER, 1779.97f, 660.64f, 71.19f, 5.28f}, - {NPC_BERSERKER, 1786.2f, 661.01f, 71.19f, 4.51f}, - {NPC_BERSERKER, 1845.17f, 602.63f, 71.28f, 2.43f}, - {NPC_BERSERKER, 1842.91f, 599.93f, 71.23f, 2.44f} + CREATURE_GROUP_HUMANOIDS, + CREATURE_GROUP_DARKFIENDS }; -uint32 EnrageTimer = 600000; - class boss_entropius : public CreatureScript { public: boss_entropius() : CreatureScript("boss_entropius") { } - struct boss_entropiusAI : public ScriptedAI + struct boss_entropiusAI : public BossAI { - boss_entropiusAI(Creature* creature) : ScriptedAI(creature), Summons(me) - { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; - SummonList Summons; - - uint32 BlackHoleSummonTimer; + boss_entropiusAI(Creature* creature) : BossAI(creature, DATA_MURU) { } void Reset() override { - BlackHoleSummonTimer = 15000; - DoCastAOE(SPELL_NEGATIVE_ENERGY_E, false); - - Summons.DespawnAll(); - - instance->SetBossState(DATA_MURU, NOT_STARTED); + DoCastAOE(SPELL_NEGATIVE_ENERGY_E); } void EnterCombat(Unit* /*who*/) override { + _EnterCombat(); DoCastAOE(SPELL_NEGATIVE_ENERGY_E, true); - DoCast(me, SPELL_ENTROPIUS_SPAWN, false); - - instance->SetBossState(DATA_MURU, IN_PROGRESS); + DoCast(me, SPELL_ENTROPIUS_SPAWN); + events.ScheduleEvent(EVENT_SUMMON_BLACK_HOLE, 15000); } void JustSummoned(Creature* summoned) override @@ -146,7 +126,7 @@ public: switch (summoned->GetEntry()) { case NPC_DARK_FIENDS: - summoned->CastSpell(summoned, SPELL_DARKFIEND_VISUAL, false); + summoned->CastSpell(summoned, SPELL_DARKFIEND_VISUAL); break; case NPC_DARKNESS: summoned->AddUnitState(UNIT_STATE_STUNNED); @@ -156,42 +136,27 @@ public: break; } summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true)); - Summons.Summon(summoned); + summons.Summon(summoned); } - void JustDied(Unit* /*killer*/) override + void ExecuteEvent(uint32 eventId) override { - Summons.DespawnAll(); - instance->SetBossState(DATA_MURU, DONE); + if (eventId == EVENT_SUMMON_BLACK_HOLE) + { + if (Unit* random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(random, SPELL_DARKNESS_E); + if (Unit* random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + random->CastSpell(random, SPELL_BLACKHOLE); + events.ScheduleEvent(EVENT_SUMMON_BLACK_HOLE, 15000); + } } - void UpdateAI(uint32 diff) override + void EnterEvadeMode() override { - if (!UpdateVictim()) - return; - - if (EnrageTimer < diff && !me->HasAura(SPELL_ENRAGE, 0)) - { - DoCast(me, SPELL_ENRAGE, false); - } else EnrageTimer -= diff; - - if (BlackHoleSummonTimer <= diff) - { - Unit* random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!random) - return; - - DoCast(random, SPELL_DARKNESS_E, false); - - random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!random) - return; - - random->CastSpell(random, SPELL_BLACKHOLE, false); - BlackHoleSummonTimer = 15000; - } else BlackHoleSummonTimer -= diff; - - DoMeleeAttackIfReady(); + if (Creature* muru = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MURU))) + muru->AI()->Reset(); // Reset encounter. + me->DisappearAndDie(); + summons.DespawnAll(); } }; @@ -206,58 +171,51 @@ class boss_muru : public CreatureScript public: boss_muru() : CreatureScript("boss_muru") { } - struct boss_muruAI : public ScriptedAI + struct boss_muruAI : public BossAI { - boss_muruAI(Creature* creature) : ScriptedAI(creature), Summons(creature) + boss_muruAI(Creature* creature) : BossAI(creature, DATA_MURU) { + Initialize(); SetCombatMovement(false); - instance = creature->GetInstanceScript(); } - InstanceScript* instance; - SummonList Summons; - - uint8 Phase; - uint32 Timer[4]; - - bool DarkFiend; - - void Reset() override + void Initialize() { DarkFiend = false; - Phase = 1; - - EnrageTimer = 600000; - Timer[TIMER_DARKNESS] = 45000; - Timer[TIMER_HUMANOIDES] = 10000; - Timer[TIMER_PHASE] = 2000; - Timer[TIMER_SENTINEL] = 31500; + HasEnraged = false; + EntropiusGUID = 0; + } + void Reset() override + { + Initialize(); + _Reset(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetVisible(true); - - Summons.DespawnAll(); - instance->SetBossState(DATA_MURU, NOT_STARTED); } void EnterCombat(Unit* /*who*/) override { - DoCastAOE(SPELL_NEGATIVE_ENERGY, false); - instance->SetBossState(DATA_MURU, IN_PROGRESS); + _EnterCombat(); + events.SetPhase(PHASE_ONE); + events.ScheduleEvent(EVENT_ENRAGE, 600000); + events.ScheduleEvent(EVENT_DARKNESS, 45000, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_SUMMON_HUMANOIDS, 10000, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_SUMMON_SENTINEL, 31500, 0, PHASE_ONE); + DoCastAOE(SPELL_NEGATIVE_ENERGY); } void DamageTaken(Unit* /*done_by*/, uint32 &damage) override { - if (damage > me->GetHealth() && Phase == 1) + if (damage > me->GetHealth() && events.IsInPhase(PHASE_ONE)) { damage = 0; - Phase = 2; me->RemoveAllAuras(); - DoCast(me, SPELL_OPEN_ALL_PORTALS, false); + DoCast(me, SPELL_OPEN_ALL_PORTALS); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + events.SetPhase(PHASE_TWO); + events.ScheduleEvent(EVENT_PHASE_TRANSITION, 2000); } - if (Phase > 1 && Phase < 4) - damage = 0; } void JustSummoned(Creature* summoned) override @@ -266,96 +224,61 @@ public: { case NPC_ENTROPIUS: me->SetVisible(false); + EntropiusGUID = summoned->GetGUID(); + if (HasEnraged) // If we hit phase transition while enraged, enrage Entropius as well. + summoned->CastSpell(summoned, SPELL_ENRAGE); break; case NPC_DARK_FIENDS: - summoned->CastSpell(summoned, SPELL_DARKFIEND_VISUAL, false); + summoned->CastSpell(summoned, SPELL_DARKFIEND_VISUAL); break; } summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true)); - Summons.Summon(summoned); + summons.Summon(summoned); } - void UpdateAI(uint32 diff) override + void ExecuteEvent(uint32 eventId) override { - if (!UpdateVictim()) - return; - - if (Phase == 3) + switch (eventId) { - if (Timer[TIMER_PHASE] <= diff) - { - switch (instance->GetBossState(DATA_MURU)) + case EVENT_DARKNESS: + if (!DarkFiend) { - case NOT_STARTED: - Reset(); - break; - case DONE: - Phase = 4; - me->DisappearAndDie(); - break; - default: - break; + DarkFiend = true; + DoCastAOE(SPELL_DARKNESS); } - Timer[TIMER_PHASE] = 3000; - } else Timer[TIMER_PHASE] -= diff; - return; - } - - if (EnrageTimer < diff && !me->HasAura(SPELL_ENRAGE, 0)) - { - DoCast(me, SPELL_ENRAGE, false); - } else EnrageTimer -= diff; - - for (uint8 i = 0; i < 4; ++i) - { - if (Timer[i] <= diff) - { - switch (i) + else { - case TIMER_DARKNESS: - if (!DarkFiend) - { - DoCastAOE(SPELL_DARKNESS, false); - Timer[TIMER_DARKNESS] = 3000; - DarkFiend = true; - } - else - { - DarkFiend = false; - for (uint8 j = 0; j < 8; ++j) - me->SummonCreature(NPC_DARK_FIENDS, DarkFiends[j][0], DarkFiends[j][1], DarkFiends[j][2], DarkFiends[j][3], TEMPSUMMON_CORPSE_DESPAWN, 0); - Timer[TIMER_DARKNESS] = 42000; - } - break; - case TIMER_HUMANOIDES: - for (uint8 j = 0; j < 6; ++j) - me->SummonCreature(uint32(Humanoides[j][0]), Humanoides[j][1], Humanoides[j][2], Humanoides[j][3], Humanoides[j][4], TEMPSUMMON_CORPSE_DESPAWN, 0); - Timer[TIMER_HUMANOIDES] = 60000; - break; - case TIMER_PHASE: - me->RemoveAllAuras(); - DoCast(me, SPELL_SUMMON_ENTROPIUS, false); - Timer[TIMER_PHASE] = 3000; - Phase = 3; - return; - case TIMER_SENTINEL: - DoCastAOE(SPELL_OPEN_PORTAL_2, false); - Timer[TIMER_SENTINEL] = 30000; - break; + DarkFiend = false; + me->SummonCreatureGroup(CREATURE_GROUP_DARKFIENDS); } + events.ScheduleEvent(EVENT_DARKNESS, DarkFiend ? 3000 : 42000, 0, PHASE_ONE); + break; + case EVENT_SUMMON_HUMANOIDS: + me->SummonCreatureGroup(CREATURE_GROUP_DARKFIENDS); + events.ScheduleEvent(EVENT_SUMMON_HUMANOIDS, 60000, 0, PHASE_ONE); + break; + case EVENT_SUMMON_SENTINEL: + DoCastAOE(SPELL_OPEN_PORTAL_2); + events.ScheduleEvent(EVENT_SUMMON_SENTINEL, 30000, 0, PHASE_ONE); + break; + case EVENT_PHASE_TRANSITION: + DoCast(me, SPELL_SUMMON_ENTROPIUS); + break; + case EVENT_ENRAGE: + if (Creature* entropius = ObjectAccessor::GetCreature(*me, EntropiusGUID)) + entropius->CastSpell(entropius, SPELL_ENRAGE); + DoCast(me, SPELL_ENRAGE); + HasEnraged = true; + break; + default: break; - } - } - - // Timer - for (uint8 i = 0; i < 4; ++i) - { - if (i != TIMER_PHASE) - Timer[i] -= diff; - else if (Phase == 2) - Timer[i] -= diff; } } + + private: + bool DarkFiend; + bool HasEnraged; + uint64 EntropiusGUID; }; CreatureAI* GetAI(Creature* creature) const override @@ -405,8 +328,8 @@ public: void JustSummoned(Creature* summoned) override { - if (Player* Target = ObjectAccessor::GetPlayer(*me, instance->GetData64(DATA_PLAYER_GUID))) - summoned->AI()->AttackStart(Target); + if (Player* target = ObjectAccessor::GetPlayer(*me, instance->GetData64(DATA_PLAYER_GUID))) + summoned->AI()->AttackStart(target); Summons.Summon(summoned); } @@ -415,15 +338,15 @@ public: { float x, y, z, o; me->GetHomePosition(x, y, z, o); - DoTeleportTo(x, y, z); + me->NearTeleportTo(x, y, z, o); InAction = true; switch (Spell->Id) { case SPELL_OPEN_ALL_PORTALS: - DoCastAOE(SPELL_OPEN_PORTAL, false); + DoCastAOE(SPELL_OPEN_PORTAL); break; case SPELL_OPEN_PORTAL_2: - DoCastAOE(SPELL_OPEN_PORTAL, false); + DoCastAOE(SPELL_OPEN_PORTAL); SummonSentinel = true; break; } @@ -533,13 +456,14 @@ public: float x, y, z, o; me->GetHomePosition(x, y, z, o); - DoTeleportTo(x, y, 71); + me->NearTeleportTo(x, y, 71, o); } - void JustDied(Unit* /*killer*/) override + void JustDied(Unit* killer) override { for (uint8 i = 0; i < 8; ++i) - me->SummonCreature(NPC_VOID_SPAWN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand32() % 6), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); + if (Creature* temp = me->SummonCreature(NPC_VOID_SPAWN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand32() % 6), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000)) + temp->AI()->AttackStart(killer); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index f06dc247883..f82d71901ac 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -64,9 +64,21 @@ class boss_archaedas : public CreatureScript { boss_archaedasAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = me->GetInstanceScript(); } + void Initialize() + { + uiTremorTimer = 60000; + iAwakenTimer = 0; + uiWallMinionTimer = 10000; + + bWakingUp = false; + bGuardiansAwake = false; + bVaultWalkersAwake = false; + } + uint32 uiTremorTimer; int32 iAwakenTimer; uint32 uiWallMinionTimer; @@ -78,13 +90,7 @@ class boss_archaedas : public CreatureScript void Reset() override { - uiTremorTimer = 60000; - iAwakenTimer = 0; - uiWallMinionTimer = 10000; - - bWakingUp = false; - bGuardiansAwake = false; - bVaultWalkersAwake = false; + Initialize(); instance->SetData(0, 5); // respawn any dead minions me->setFaction(35); @@ -224,9 +230,19 @@ class npc_archaedas_minions : public CreatureScript { npc_archaedas_minionsAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = me->GetInstanceScript(); } + void Initialize() + { + uiArcing_Timer = 3000; + iAwakenTimer = 0; + + bWakingUp = false; + bAmIAwake = false; + } + uint32 uiArcing_Timer; int32 iAwakenTimer; bool bWakingUp; @@ -236,11 +252,7 @@ class npc_archaedas_minions : public CreatureScript void Reset() override { - uiArcing_Timer = 3000; - iAwakenTimer = 0; - - bWakingUp = false; - bAmIAwake = false; + Initialize(); me->setFaction(35); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp index 13a475604a7..6062f01691c 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp @@ -45,7 +45,17 @@ class boss_ironaya : public CreatureScript struct boss_ironayaAI : public ScriptedAI { - boss_ironayaAI(Creature* creature) : ScriptedAI(creature) { } + boss_ironayaAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + uiArcingTimer = 3000; + bHasCastKnockaway = false; + bHasCastWstomp = false; + } uint32 uiArcingTimer; bool bHasCastWstomp; @@ -53,9 +63,7 @@ class boss_ironaya : public CreatureScript void Reset() override { - uiArcingTimer = 3000; - bHasCastKnockaway = false; - bHasCastWstomp = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp index fdb71cbbf83..236cc55eee8 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp @@ -54,13 +54,21 @@ class npc_jadespine_basilisk : public CreatureScript struct npc_jadespine_basiliskAI : public ScriptedAI { - npc_jadespine_basiliskAI(Creature* creature) : ScriptedAI(creature) { } + npc_jadespine_basiliskAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + uiCslumberTimer = 2000; + } uint32 uiCslumberTimer; void Reset() override { - uiCslumberTimer = 2000; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index b55a9cc74d6..b15fdd85a00 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -88,19 +88,24 @@ class boss_akilzon : public CreatureScript { boss_akilzonAI(Creature* creature) : BossAI(creature, DATA_AKILZONEVENT) { - memset(BirdGUIDs, 0, sizeof(BirdGUIDs)); + Initialize(); } - void Reset() override + void Initialize() { - _Reset(); - TargetGUID = 0; CloudGUID = 0; CycloneGUID = 0; memset(BirdGUIDs, 0, sizeof(BirdGUIDs)); StormCount = 0; isRaining = false; + } + + void Reset() override + { + _Reset(); + + Initialize(); SetWeather(WEATHER_STATE_FINE, 0.0f); } @@ -380,7 +385,17 @@ class npc_akilzon_eagle : public CreatureScript struct npc_akilzon_eagleAI : public ScriptedAI { - npc_akilzon_eagleAI(Creature* creature) : ScriptedAI(creature) { } + npc_akilzon_eagleAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + EagleSwoop_Timer = urand(5000, 10000); + arrived = true; + TargetGUID = 0; + } uint32 EagleSwoop_Timer; bool arrived; @@ -388,9 +403,7 @@ class npc_akilzon_eagle : public CreatureScript void Reset() override { - EagleSwoop_Timer = urand(5000, 10000); - arrived = true; - TargetGUID = 0; + Initialize(); me->SetDisableGravity(true); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index 74ce267441f..0cf1f932f10 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -74,7 +74,21 @@ class boss_halazzi : public CreatureScript { boss_halazziAI(Creature* creature) : ScriptedAI(creature), summons(me) { + Initialize(); instance = creature->GetInstanceScript(); + Phase = PHASE_NONE; + FrenzyTimer = 0; + SaberlashTimer = 0; + ShockTimer = 0; + TotemTimer = 0; + } + + void Initialize() + { + LynxGUID = 0; + TransformCount = 0; + BerserkTimer = 600000; + CheckTimer = 1000; } InstanceScript* instance; @@ -96,10 +110,7 @@ class boss_halazzi : public CreatureScript instance->SetData(DATA_HALAZZIEVENT, NOT_STARTED); summons.DespawnAll(); - LynxGUID = 0; - TransformCount = 0; - BerserkTimer = 600000; - CheckTimer = 1000; + Initialize(); DoCast(me, SPELL_DUAL_WIELD, true); @@ -321,15 +332,23 @@ class npc_halazzi_lynx : public CreatureScript struct npc_halazzi_lynxAI : public ScriptedAI { - npc_halazzi_lynxAI(Creature* creature) : ScriptedAI(creature) { } + npc_halazzi_lynxAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + FrenzyTimer = urand(30000, 50000); //frenzy every 30-50 seconds + shredder_timer = 4000; + } uint32 FrenzyTimer; uint32 shredder_timer; void Reset() override { - FrenzyTimer = urand(30000, 50000); //frenzy every 30-50 seconds - shredder_timer = 4000; + Initialize(); } void DamageTaken(Unit* /*done_by*/, uint32 &damage) override diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index 0fee04f0d20..3c9d4397d24 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -254,10 +254,23 @@ class boss_hexlord_malacrass : public CreatureScript { boss_hex_lord_malacrassAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); SelectAddEntry(); for (uint8 i = 0; i < 4; ++i) AddGUID[i] = 0; + PlayerGUID = 0; + PlayerClass = CLASS_NONE; + } + + void Initialize() + { + SpiritBolts_Timer = 20000; + DrainPower_Timer = 60000; + SiphonSoul_Timer = 100000; + PlayerAbility_Timer = 99999; + CheckAddState_Timer = 5000; + ResetTimer = 5000; } InstanceScript* instance; @@ -280,12 +293,7 @@ class boss_hexlord_malacrass : public CreatureScript { instance->SetData(DATA_HEXLORDEVENT, NOT_STARTED); - SpiritBolts_Timer = 20000; - DrainPower_Timer = 60000; - SiphonSoul_Timer = 100000; - PlayerAbility_Timer = 99999; - CheckAddState_Timer = 5000; - ResetTimer = 5000; + Initialize(); SpawnAdds(); @@ -523,15 +531,23 @@ class boss_thurg : public CreatureScript struct boss_thurgAI : public boss_hexlord_addAI { - boss_thurgAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_thurgAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + bloodlust_timer = 15000; + cleave_timer = 10000; + } uint32 bloodlust_timer; uint32 cleave_timer; void Reset() override { - bloodlust_timer = 15000; - cleave_timer = 10000; + Initialize(); boss_hexlord_addAI::Reset(); } @@ -580,15 +596,23 @@ class boss_alyson_antille : public CreatureScript struct boss_alyson_antilleAI : public boss_hexlord_addAI { //Holy Priest - boss_alyson_antilleAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_alyson_antilleAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + flashheal_timer = 2500; + dispelmagic_timer = 10000; + } uint32 flashheal_timer; uint32 dispelmagic_timer; void Reset() override { - flashheal_timer = 2500; - dispelmagic_timer = 10000; + Initialize(); //AcquireGUID(); @@ -667,13 +691,21 @@ class boss_alyson_antille : public CreatureScript struct boss_gazakrothAI : public boss_hexlord_addAI { - boss_gazakrothAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_gazakrothAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + firebolt_timer = 2000; + } uint32 firebolt_timer; void Reset() override { - firebolt_timer = 2000; + Initialize(); boss_hexlord_addAI::Reset(); } @@ -718,15 +750,23 @@ class boss_lord_raadan : public CreatureScript struct boss_lord_raadanAI : public boss_hexlord_addAI { - boss_lord_raadanAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_lord_raadanAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + flamebreath_timer = 8000; + thunderclap_timer = 13000; + } uint32 flamebreath_timer; uint32 thunderclap_timer; void Reset() override { - flamebreath_timer = 8000; - thunderclap_timer = 13000; + Initialize(); boss_hexlord_addAI::Reset(); @@ -769,13 +809,21 @@ class boss_darkheart : public CreatureScript struct boss_darkheartAI : public boss_hexlord_addAI { - boss_darkheartAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_darkheartAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + psychicwail_timer = 8000; + } uint32 psychicwail_timer; void Reset() override { - psychicwail_timer = 8000; + Initialize(); boss_hexlord_addAI::Reset(); } void UpdateAI(uint32 diff) override @@ -811,13 +859,21 @@ class boss_slither : public CreatureScript struct boss_slitherAI : public boss_hexlord_addAI { - boss_slitherAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_slitherAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + venomspit_timer = 5000; + } uint32 venomspit_timer; void Reset() override { - venomspit_timer = 5000; + Initialize(); boss_hexlord_addAI::Reset(); } @@ -869,13 +925,21 @@ class boss_fenstalker : public CreatureScript struct boss_fenstalkerAI : public boss_hexlord_addAI { - boss_fenstalkerAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_fenstalkerAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + volatileinf_timer = 15000; + } uint32 volatileinf_timer; void Reset() override { - volatileinf_timer = 15000; + Initialize(); boss_hexlord_addAI::Reset(); } @@ -913,15 +977,23 @@ class boss_koragg : public CreatureScript struct boss_koraggAI : public boss_hexlord_addAI { - boss_koraggAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_koraggAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + coldstare_timer = 15000; + mightyblow_timer = 10000; + } uint32 coldstare_timer; uint32 mightyblow_timer; void Reset() override { - coldstare_timer = 15000; - mightyblow_timer = 10000; + Initialize(); boss_hexlord_addAI::Reset(); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index d5260c18add..2e434ed6ab5 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -121,9 +121,29 @@ class boss_janalai : public CreatureScript { boss_janalaiAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + FireBreathTimer = 8000; + BombTimer = 30000; + BombSequenceTimer = 1000; + BombCount = 0; + HatcherTimer = 10000; + EnrageTimer = MINUTE * 5 * IN_MILLISECONDS; + + noeggs = false; + isBombing = false; + enraged = false; + + isFlameBreathing = false; + + for (uint8 i = 0; i < 40; ++i) + FireBombGUIDs[i] = 0; + } + InstanceScript* instance; uint32 FireBreathTimer; @@ -145,21 +165,7 @@ class boss_janalai : public CreatureScript { instance->SetData(DATA_JANALAIEVENT, NOT_STARTED); - FireBreathTimer = 8000; - BombTimer = 30000; - BombSequenceTimer = 1000; - BombCount = 0; - HatcherTimer = 10000; - EnrageTimer = MINUTE*5*IN_MILLISECONDS; - - noeggs = false; - isBombing =false; - enraged = false; - - isFlameBreathing = false; - - for (uint8 i = 0; i < 40; ++i) - FireBombGUIDs[i] = 0; + Initialize(); HatchAllEggs(1); } @@ -493,9 +499,20 @@ class npc_janalai_hatcher : public CreatureScript { npc_janalai_hatcherAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + waypoint = 0; + isHatching = false; + hasChangedSide = false; + WaitTimer = 1; + HatchNum = 0; + side = false; + } + InstanceScript* instance; uint32 waypoint; @@ -509,12 +526,8 @@ class npc_janalai_hatcher : public CreatureScript void Reset() override { me->SetWalk(true); + Initialize(); side =(me->GetPositionY() < 1150); - waypoint = 0; - isHatching = false; - hasChangedSide = false; - WaitTimer = 1; - HatchNum = 0; } bool HatchEggs(uint32 num) @@ -626,15 +639,21 @@ class npc_janalai_hatchling : public CreatureScript { npc_janalai_hatchlingAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + BuffetTimer = 7000; + } + InstanceScript* instance; uint32 BuffetTimer; void Reset() override { - BuffetTimer = 7000; + Initialize(); if (me->GetPositionY() > 1150) me->GetMotionMaster()->MovePoint(0, hatcherway[0][3][0] + rand32() % 4 - 2, 1150.0f + rand32() % 4 - 2, hatcherway[0][3][2]); else diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index 4909074b059..c9c028021f1 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -109,11 +109,28 @@ class boss_nalorakk : public CreatureScript { boss_nalorakkAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); + inMove = false; MoveEvent = true; MovePhase = 0; + waitTimer = 0; + LaceratingSlash_Timer = 0; + RendFlesh_Timer = 0; + DeafeningRoar_Timer = 0; instance = creature->GetInstanceScript(); } + void Initialize() + { + Surge_Timer = urand(15000, 20000); + BrutalSwipe_Timer = urand(7000, 12000); + Mangle_Timer = urand(10000, 15000); + ShapeShift_Timer = urand(45000, 50000); + Berserk_Timer = 600000; + + inBearForm = false; + } + InstanceScript* instance; uint32 BrutalSwipe_Timer; @@ -150,13 +167,7 @@ class boss_nalorakk : public CreatureScript instance->SetData(DATA_NALORAKKEVENT, NOT_STARTED); - Surge_Timer = urand(15000, 20000); - BrutalSwipe_Timer = urand(7000, 12000); - Mangle_Timer = urand(10000, 15000); - ShapeShift_Timer = urand(45000, 50000); - Berserk_Timer = 600000; - - inBearForm = false; + Initialize(); // me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 5122); /// @todo find the correct equipment id } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp index 6b0fc05ba3d..5b9957cb94d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp @@ -136,8 +136,38 @@ class boss_zuljin : public CreatureScript { boss_zuljinAI(Creature* creature) : ScriptedAI(creature), Summons(me) { + Initialize(); instance = creature->GetInstanceScript(); + memset(SpiritGUID, 0, sizeof(SpiritGUID)); + health_20 = 0; } + + void Initialize() + { + Phase = 0; + + Intro_Timer = 37000; + Berserk_Timer = 600000; + + Whirlwind_Timer = 7000; + Grievous_Throw_Timer = 8000; + + Creeping_Paralysis_Timer = 7000; + Overpower_Timer = 0; + + Claw_Rage_Timer = 5000; + Lynx_Rush_Timer = 14000; + Claw_Loop_Timer = 0; + Claw_Counter = 0; + + Flame_Whirl_Timer = 5000; + Flame_Breath_Timer = 6000; + Pillar_Of_Fire_Timer = 7000; + + ClawTargetGUID = 0; + TankGUID = 0; + } + InstanceScript* instance; uint64 SpiritGUID[4]; @@ -171,30 +201,9 @@ class boss_zuljin : public CreatureScript { instance->SetData(DATA_ZULJINEVENT, NOT_STARTED); - Phase = 0; - health_20 = me->CountPctFromMaxHealth(20); - Intro_Timer = 37000; - Berserk_Timer = 600000; - - Whirlwind_Timer = 7000; - Grievous_Throw_Timer = 8000; - - Creeping_Paralysis_Timer = 7000; - Overpower_Timer = 0; - - Claw_Rage_Timer = 5000; - Lynx_Rush_Timer = 14000; - Claw_Loop_Timer = 0; - Claw_Counter = 0; - - Flame_Whirl_Timer = 5000; - Flame_Breath_Timer = 6000; - Pillar_Of_Fire_Timer = 7000; - - ClawTargetGUID = 0; - TankGUID = 0; + Initialize(); Summons.DespawnAll(); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index 5561ed3c2dd..6784ff086c7 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -131,38 +131,6 @@ class npc_zulaman_hostage : public CreatureScript public: npc_zulaman_hostage() : CreatureScript("npc_zulaman_hostage") { } - struct npc_zulaman_hostageAI : public ScriptedAI - { - npc_zulaman_hostageAI(Creature* creature) : ScriptedAI(creature) - { - IsLoot = false; - } - - bool IsLoot; - uint64 PlayerGUID; - - void Reset() override { } - - void EnterCombat(Unit* /*who*/) override { } - - void JustDied(Unit* /*killer*/) override - { - if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID)) - player->SendLoot(me->GetGUID(), LOOT_CORPSE); - } - - void UpdateAI(uint32 /*diff*/) override - { - if (IsLoot) - DoCast(me, 7, false); - } - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_zulaman_hostageAI(creature); - } - bool OnGossipHello(Player* player, Creature* creature) override { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HOSTAGE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -276,9 +244,17 @@ class npc_harrison_jones : public CreatureScript { npc_harrison_jonesAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + _gongEvent = 0; + _gongTimer = 0; + uiTargetGUID = 0; + } + InstanceScript* instance; uint8 _gongEvent; @@ -287,9 +263,7 @@ class npc_harrison_jones : public CreatureScript void Reset() override { - _gongEvent = 0; - _gongTimer = 0; - uiTargetGUID = 0; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index 4ac34615498..0d780da6560 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -92,15 +92,25 @@ class boss_arlokk : public CreatureScript struct boss_arlokkAI : public BossAI { - boss_arlokkAI(Creature* creature) : BossAI(creature, DATA_ARLOKK) { } + boss_arlokkAI(Creature* creature) : BossAI(creature, DATA_ARLOKK) + { + Initialize(); + memset(_triggersSideAGUID, 0, sizeof(_triggersSideAGUID)); + memset(_triggersSideBGUID, 0, sizeof(_triggersSideBGUID)); + } + + void Initialize() + { + _summonCountA = 0; + _summonCountB = 0; + } void Reset() override { if (events.IsInPhase(PHASE_TWO)) me->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, 35.0f, false); // hack _Reset(); - _summonCountA = 0; - _summonCountB = 0; + Initialize(); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_DAGGER)); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(WEAPON_DAGGER)); me->SetWalk(false); @@ -332,7 +342,10 @@ class npc_zulian_prowler : public CreatureScript struct npc_zulian_prowlerAI : public ScriptedAI { - npc_zulian_prowlerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { } + npc_zulian_prowlerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) + { + _sideData = 0; + } void Reset() override { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp index 7a16f670afe..f31477e8e35 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp @@ -212,13 +212,21 @@ class npc_batrider : public CreatureScript struct npc_batriderAI : public ScriptedAI { - npc_batriderAI(Creature* creature) : ScriptedAI(creature) { } + npc_batriderAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + Bomb_Timer = 2000; + } uint32 Bomb_Timer; void Reset() override { - Bomb_Timer = 2000; + Initialize(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index f766a795658..d1c9579c027 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -175,15 +175,21 @@ class npc_healing_ward : public CreatureScript { npc_healing_wardAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + Heal_Timer = 2000; + } + uint32 Heal_Timer; InstanceScript* instance; void Reset() override { - Heal_Timer = 2000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -216,13 +222,21 @@ class npc_shade_of_jindo : public CreatureScript struct npc_shade_of_jindoAI : public ScriptedAI { - npc_shade_of_jindoAI(Creature* creature) : ScriptedAI(creature) { } + npc_shade_of_jindoAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + ShadowShock_Timer = 1000; + } uint32 ShadowShock_Timer; void Reset() override { - ShadowShock_Timer = 1000; + Initialize(); DoCast(me, SPELL_INVISIBLE, true); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index 72ba9db3637..6244d2b72b1 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -112,14 +112,23 @@ class boss_mandokir : public CreatureScript struct boss_mandokirAI : public BossAI { - boss_mandokirAI(Creature* creature) : BossAI(creature, DATA_MANDOKIR) { } + boss_mandokirAI(Creature* creature) : BossAI(creature, DATA_MANDOKIR) + { + Initialize(); + memset(chainedSpirtGUIDs, 0, sizeof(chainedSpirtGUIDs)); + } + + void Initialize() + { + killCount = 0; + } void Reset() override { if (me->GetPositionZ() > 140.0f) { _Reset(); - killCount = 0; + Initialize(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); events.ScheduleEvent(EVENT_CHECK_START, 1000); if (Creature* speaker = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_VILEBRANCH_SPEAKER))) @@ -300,13 +309,21 @@ class npc_ohgan : public CreatureScript struct npc_ohganAI : public ScriptedAI { - npc_ohganAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()) { } + npc_ohganAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()) + { + Initialize(); + } - void Reset() override + void Initialize() { SunderArmor_Timer = 5000; } + void Reset() override + { + Initialize(); + } + void EnterCombat(Unit* /*who*/) override { } void JustDied(Unit* /*killer*/) override @@ -353,14 +370,22 @@ class npc_vilebranch_speaker : public CreatureScript struct npc_vilebranch_speakerAI : public ScriptedAI { - npc_vilebranch_speakerAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()) { } + npc_vilebranch_speakerAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()) + { + Initialize(); + } - void Reset() override + void Initialize() { demoralizing_Shout_Timer = urand(2000, 4000); cleave_Timer = urand(5000, 8000); } + void Reset() override + { + Initialize(); + } + void EnterCombat(Unit* /*who*/) override { } void JustDied(Unit* /*killer*/) override diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp index bbc1fb6c90e..8020bced16b 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp @@ -217,13 +217,21 @@ class npc_spawn_of_marli : public CreatureScript struct npc_spawn_of_marliAI : public ScriptedAI { - npc_spawn_of_marliAI(Creature* creature) : ScriptedAI(creature) { } + npc_spawn_of_marliAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + LevelUp_Timer = 3000; + } uint32 LevelUp_Timer; void Reset() override { - LevelUp_Timer = 3000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp index 015a2840a9c..4f907098ff4 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp @@ -45,7 +45,22 @@ class boss_renataki : public CreatureScript struct boss_renatakiAI : public BossAI { - boss_renatakiAI(Creature* creature) : BossAI(creature, DATA_EDGE_OF_MADNESS) { } + boss_renatakiAI(Creature* creature) : BossAI(creature, DATA_EDGE_OF_MADNESS) + { + Initialize(); + } + + void Initialize() + { + Invisible_Timer = urand(8000, 18000); + Ambush_Timer = 3000; + Visible_Timer = 4000; + Aggro_Timer = urand(15000, 25000); + ThousandBlades_Timer = urand(4000, 8000); + + Invisible = false; + Ambushed = false; + } uint32 Invisible_Timer; uint32 Ambush_Timer; @@ -59,14 +74,7 @@ class boss_renataki : public CreatureScript void Reset() override { _Reset(); - Invisible_Timer = urand(8000, 18000); - Ambush_Timer = 3000; - Visible_Timer = 4000; - Aggro_Timer = urand(15000, 25000); - ThousandBlades_Timer = urand(4000, 8000); - - Invisible = false; - Ambushed = false; + Initialize(); } void JustDied(Unit* /*killer*/) override diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index 997818aced2..57a286c1e58 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -83,7 +83,16 @@ class boss_thekal : public CreatureScript struct boss_thekalAI : public BossAI { - boss_thekalAI(Creature* creature) : BossAI(creature, DATA_THEKAL) { } + boss_thekalAI(Creature* creature) : BossAI(creature, DATA_THEKAL) + { + Initialize(); + } + + void Initialize() + { + Enraged = false; + WasDead = false; + } bool Enraged; bool WasDead; @@ -93,8 +102,7 @@ class boss_thekal : public CreatureScript if (events.IsInPhase(PHASE_TWO)) me->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, 35.0f, false); // hack _Reset(); - Enraged = false; - WasDead = false; + Initialize(); } void JustDied(Unit* /*killer*/) override @@ -264,9 +272,21 @@ class npc_zealot_lorkhan : public CreatureScript { npc_zealot_lorkhanAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + Shield_Timer = 1000; + BloodLust_Timer = 16000; + GreaterHeal_Timer = 32000; + Disarm_Timer = 6000; + Check_Timer = 10000; + + FakeDeath = false; + } + uint32 Shield_Timer; uint32 BloodLust_Timer; uint32 GreaterHeal_Timer; @@ -279,13 +299,7 @@ class npc_zealot_lorkhan : public CreatureScript void Reset() override { - Shield_Timer = 1000; - BloodLust_Timer = 16000; - GreaterHeal_Timer = 32000; - Disarm_Timer = 6000; - Check_Timer = 10000; - - FakeDeath = false; + Initialize(); instance->SetBossState(DATA_LORKHAN, NOT_STARTED); @@ -412,9 +426,22 @@ class npc_zealot_zath : public CreatureScript { npc_zealot_zathAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + SweepingStrikes_Timer = 13000; + SinisterStrike_Timer = 8000; + Gouge_Timer = 25000; + Kick_Timer = 18000; + Blind_Timer = 5000; + Check_Timer = 10000; + + FakeDeath = false; + } + uint32 SweepingStrikes_Timer; uint32 SinisterStrike_Timer; uint32 Gouge_Timer; @@ -428,14 +455,7 @@ class npc_zealot_zath : public CreatureScript void Reset() override { - SweepingStrikes_Timer = 13000; - SinisterStrike_Timer = 8000; - Gouge_Timer = 25000; - Kick_Timer = 18000; - Blind_Timer = 5000; - Check_Timer = 10000; - - FakeDeath = false; + Initialize(); instance->SetBossState(DATA_ZATH, NOT_STARTED); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp index 7047d22c970..c7b8a16fae1 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp @@ -90,7 +90,17 @@ class boss_venoxis : public CreatureScript struct boss_venoxisAI : public BossAI { - boss_venoxisAI(Creature* creature) : BossAI(creature, DATA_VENOXIS) { } + boss_venoxisAI(Creature* creature) : BossAI(creature, DATA_VENOXIS) + { + Initialize(); + } + + void Initialize() + { + _inMeleeRange = 0; + _transformed = false; + _frenzied = false; + } void Reset() override { @@ -99,9 +109,7 @@ class boss_venoxis : public CreatureScript me->RemoveAllAuras(); me->SetReactState(REACT_PASSIVE); // set some internally used variables to their defaults - _inMeleeRange = 0; - _transformed = false; - _frenzied = false; + Initialize(); events.SetPhase(PHASE_ONE); } diff --git a/src/server/scripts/EasternKingdoms/zone_duskwood.cpp b/src/server/scripts/EasternKingdoms/zone_duskwood.cpp index 4eaf98d0a0e..b42f09b009e 100644 --- a/src/server/scripts/EasternKingdoms/zone_duskwood.cpp +++ b/src/server/scripts/EasternKingdoms/zone_duskwood.cpp @@ -55,12 +55,20 @@ public: struct boss_twilight_corrupterAI : public ScriptedAI { - boss_twilight_corrupterAI(Creature* creature) : ScriptedAI(creature) { } + boss_twilight_corrupterAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + KillCount = 0; + } void Reset() override { _events.Reset(); - KillCount = 0; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp index 86ddf33f2fd..268a78bb491 100644 --- a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp @@ -178,16 +178,22 @@ public: { npc_rinjiAI(Creature* creature) : npc_escortAI(creature) { + Initialize(); _IsByOutrunner = false; spawnId = 0; } - void Reset() override + void Initialize() { postEventCount = 0; postEventTimer = 3000; } + void Reset() override + { + Initialize(); + } + void JustRespawned() override { _IsByOutrunner = false; diff --git a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp index fc8fdf41f51..4ce30bd5834 100644 --- a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp +++ b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp @@ -57,15 +57,23 @@ public: struct npc_converted_sentryAI : public ScriptedAI { - npc_converted_sentryAI(Creature* creature) : ScriptedAI(creature) { } + npc_converted_sentryAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + Credit = false; + Timer = 2500; + } bool Credit; uint32 Timer; void Reset() override { - Credit = false; - Timer = 2500; + Initialize(); } void MoveInLineOfSight(Unit* /*who*/) override { } diff --git a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp index 342bba3b729..5907b0b155f 100644 --- a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp +++ b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp @@ -45,14 +45,22 @@ public: struct npc_corporal_keeshanAI : public npc_escortAI { - npc_corporal_keeshanAI(Creature* creature) : npc_escortAI(creature) { } + npc_corporal_keeshanAI(Creature* creature) : npc_escortAI(creature) + { + Initialize(); + } - void Reset() override + void Initialize() { timer = 0; phase = 0; mockingBlowTimer = 5000; - shieldBashTimer = 8000; + shieldBashTimer = 8000; + } + + void Reset() override + { + Initialize(); } void sQuestAccept(Player* player, Quest const* quest) diff --git a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp index 6bdf43c3305..84f650ec9f4 100644 --- a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp +++ b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp @@ -188,7 +188,16 @@ public: { pyrewood_ambushAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - QuestInProgress = false; + Initialize(); + WaitTimer = WAIT_SECS; + QuestInProgress = false; + } + + void Initialize() + { + Phase = 0; + KillCount = 0; + PlayerGUID = 0; } uint32 Phase; @@ -205,9 +214,7 @@ public: if (!QuestInProgress) //fix reset values (see UpdateVictim) { - Phase = 0; - KillCount = 0; - PlayerGUID = 0; + Initialize(); Summons.DespawnAll(); } } diff --git a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp index 16c66c5e4e3..ee29c0a7b6e 100644 --- a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp +++ b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp @@ -233,7 +233,18 @@ public: struct npc_lord_gregor_lescovarAI : public npc_escortAI { - npc_lord_gregor_lescovarAI(Creature* creature) : npc_escortAI(creature) { } + npc_lord_gregor_lescovarAI(Creature* creature) : npc_escortAI(creature) + { + Initialize(); + } + + void Initialize() + { + uiTimer = 0; + uiPhase = 0; + + MarzonGUID = 0; + } uint32 uiTimer; uint32 uiPhase; @@ -242,10 +253,7 @@ public: void Reset() override { - uiTimer = 0; - uiPhase = 0; - - MarzonGUID = 0; + Initialize(); } void EnterEvadeMode() override @@ -486,15 +494,23 @@ public: struct npc_tyrion_spybotAI : public npc_escortAI { - npc_tyrion_spybotAI(Creature* creature) : npc_escortAI(creature) { } + npc_tyrion_spybotAI(Creature* creature) : npc_escortAI(creature) + { + Initialize(); + } + + void Initialize() + { + uiTimer = 0; + uiPhase = 0; + } uint32 uiTimer; uint32 uiPhase; void Reset() override { - uiTimer = 0; - uiPhase = 0; + Initialize(); } void WaypointReached(uint32 waypointId) override diff --git a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp index b52cb9fa1bf..d1bb7ae3c6a 100644 --- a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp +++ b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp @@ -50,15 +50,21 @@ public: { npc_yennikuAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); bReset = false; } + void Initialize() + { + Reset_Timer = 0; + } + uint32 Reset_Timer; bool bReset; void Reset() override { - Reset_Timer = 0; + Initialize(); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); } diff --git a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp index 4d19256e5a1..f953742b864 100644 --- a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp +++ b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp @@ -68,7 +68,17 @@ public: struct npc_calvin_montagueAI : public ScriptedAI { - npc_calvin_montagueAI(Creature* creature) : ScriptedAI(creature) { } + npc_calvin_montagueAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + m_uiPhase = 0; + m_uiPhaseTimer = 5000; + m_uiPlayerGUID = 0; + } uint32 m_uiPhase; uint32 m_uiPhaseTimer; @@ -76,9 +86,7 @@ public: void Reset() override { - m_uiPhase = 0; - m_uiPhaseTimer = 5000; - m_uiPlayerGUID = 0; + Initialize(); me->RestoreFaction(); diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp index 41e6bafd4a7..ea997c5563f 100644 --- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp +++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp @@ -99,7 +99,23 @@ public: struct npc_lady_sylvanas_windrunnerAI : public ScriptedAI { - npc_lady_sylvanas_windrunnerAI(Creature* creature) : ScriptedAI(creature) { } + npc_lady_sylvanas_windrunnerAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + LamentEventTimer = 5000; + LamentEvent = false; + targetGUID = 0; + + FadeTimer = 30000; + SummonSkeletonTimer = 20000; + BlackArrowTimer = 15000; + ShotTimer = 8000; + MultiShotTimer = 10000; + } uint32 LamentEventTimer; bool LamentEvent; @@ -113,15 +129,7 @@ public: void Reset() override { - LamentEventTimer = 5000; - LamentEvent = false; - targetGUID = 0; - - FadeTimer = 30000; - SummonSkeletonTimer = 20000; - BlackArrowTimer = 15000; - ShotTimer = 8000; - MultiShotTimer = 10000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -231,7 +239,18 @@ public: struct npc_highborne_lamenterAI : public ScriptedAI { - npc_highborne_lamenterAI(Creature* creature) : ScriptedAI(creature) { } + npc_highborne_lamenterAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + EventMoveTimer = 10000; + EventCastTimer = 17500; + EventMove = true; + EventCast = true; + } uint32 EventMoveTimer; uint32 EventCastTimer; @@ -240,10 +259,7 @@ public: void Reset() override { - EventMoveTimer = 10000; - EventCastTimer = 17500; - EventMove = true; - EventCast = true; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp index dbcf5998bdb..d242d17806c 100644 --- a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp @@ -319,19 +319,24 @@ public: struct npc_anchorite_truuenAI : public npc_escortAI { - npc_anchorite_truuenAI(Creature* creature) : npc_escortAI(creature) { } + npc_anchorite_truuenAI(Creature* creature) : npc_escortAI(creature) + { + Initialize(); + UghostGUID = 0; + } + + void Initialize() + { + m_uiChatTimer = 7000; + } uint32 m_uiChatTimer; uint64 UghostGUID; - uint64 TheldanisGUID; - - Creature* Ughost; - Creature* Theldanis; void Reset() override { - m_uiChatTimer = 7000; + Initialize(); } void JustSummoned(Creature* summoned) override @@ -364,26 +369,25 @@ public: Talk(SAY_WP_2); break; case 21: - Theldanis = GetClosestCreatureWithEntry(me, NPC_THEL_DANIS, 150); - if (Theldanis) + if (Creature* Theldanis = GetClosestCreatureWithEntry(me, NPC_THEL_DANIS, 150)) Theldanis->AI()->Talk(SAY_WP_3); break; case 23: - Ughost = me->SummonCreature(NPC_GHOST_UTHER, 971.86f, -1825.42f, 81.99f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - if (Ughost) + if (Creature* Ughost = me->SummonCreature(NPC_GHOST_UTHER, 971.86f, -1825.42f, 81.99f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) { + UghostGUID = Ughost->GetGUID(); Ughost->SetDisableGravity(true); Ughost->AI()->Talk(SAY_WP_4, me); } m_uiChatTimer = 4000; break; case 24: - if (Ughost) + if (Creature* Ughost = ObjectAccessor::GetCreature(*me, UghostGUID)) Ughost->AI()->Talk(SAY_WP_5, me); m_uiChatTimer = 4000; break; case 25: - if (Ughost) + if (Creature* Ughost = ObjectAccessor::GetCreature(*me, UghostGUID)) Ughost->AI()->Talk(SAY_WP_6, me); m_uiChatTimer = 4000; break; diff --git a/src/server/scripts/EasternKingdoms/zone_wetlands.cpp b/src/server/scripts/EasternKingdoms/zone_wetlands.cpp index e6c844b1b1e..94cea417b04 100644 --- a/src/server/scripts/EasternKingdoms/zone_wetlands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_wetlands.cpp @@ -59,14 +59,22 @@ public: struct npc_tapoke_slim_jahnAI : public npc_escortAI { - npc_tapoke_slim_jahnAI(Creature* creature) : npc_escortAI(creature) { } + npc_tapoke_slim_jahnAI(Creature* creature) : npc_escortAI(creature) + { + Initialize(); + } + + void Initialize() + { + IsFriendSummoned = false; + } bool IsFriendSummoned; void Reset() override { if (!HasEscortState(STATE_ESCORT_ESCORTING)) - IsFriendSummoned = false; + Initialize(); } void WaypointReached(uint32 waypointId) override diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp index 683b8d36011..6a338c2f03a 100644 --- a/src/server/scripts/Events/childrens_week.cpp +++ b/src/server/scripts/Events/childrens_week.cpp @@ -150,9 +150,12 @@ class npc_winterfin_playmate : public CreatureScript struct npc_winterfin_playmateAI : public ScriptedAI { - npc_winterfin_playmateAI(Creature* creature) : ScriptedAI(creature) { } + npc_winterfin_playmateAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } - void Reset() + void Initialize() { timer = 0; phase = 0; @@ -160,6 +163,11 @@ class npc_winterfin_playmate : public CreatureScript orphanGUID = 0; } + void Reset() + { + Initialize(); + } + void MoveInLineOfSight(Unit* who) override { @@ -249,9 +257,12 @@ class npc_snowfall_glade_playmate : public CreatureScript struct npc_snowfall_glade_playmateAI : public ScriptedAI { - npc_snowfall_glade_playmateAI(Creature* creature) : ScriptedAI(creature) { } + npc_snowfall_glade_playmateAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } - void Reset() + void Initialize() { timer = 0; phase = 0; @@ -259,6 +270,11 @@ class npc_snowfall_glade_playmate : public CreatureScript orphanGUID = 0; } + void Reset() + { + Initialize(); + } + void MoveInLineOfSight(Unit* who) override { @@ -349,10 +365,11 @@ class npc_the_biggest_tree : public CreatureScript { npc_the_biggest_treeAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); me->SetDisplayId(DISPLAY_INVISIBLE); } - void Reset() + void Initialize() { timer = 1000; phase = 0; @@ -360,8 +377,12 @@ class npc_the_biggest_tree : public CreatureScript orphanGUID = 0; } - void MoveInLineOfSight(Unit* who) override + void Reset() + { + Initialize(); + } + void MoveInLineOfSight(Unit* who) override { if (!phase && who && who->GetDistance2d(me) < 10.0f) if (Player* player = who->ToPlayer()) @@ -437,9 +458,12 @@ class npc_high_oracle_soo_roo : public CreatureScript struct npc_high_oracle_soo_rooAI : public ScriptedAI { - npc_high_oracle_soo_rooAI(Creature* creature) : ScriptedAI(creature) { } + npc_high_oracle_soo_rooAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } - void Reset() + void Initialize() { timer = 0; phase = 0; @@ -447,6 +471,11 @@ class npc_high_oracle_soo_roo : public CreatureScript orphanGUID = 0; } + void Reset() + { + Initialize(); + } + void MoveInLineOfSight(Unit* who) override { @@ -526,9 +555,12 @@ class npc_elder_kekek : public CreatureScript struct npc_elder_kekekAI : public ScriptedAI { - npc_elder_kekekAI(Creature* creature) : ScriptedAI(creature) { } + npc_elder_kekekAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } - void Reset() + void Initialize() { timer = 0; phase = 0; @@ -536,6 +568,11 @@ class npc_elder_kekek : public CreatureScript orphanGUID = 0; } + void Reset() + { + Initialize(); + } + void MoveInLineOfSight(Unit* who) override { @@ -615,9 +652,12 @@ class npc_the_etymidian : public CreatureScript struct npc_the_etymidianAI : public ScriptedAI { - npc_the_etymidianAI(Creature* creature) : ScriptedAI(creature) { } + npc_the_etymidianAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } - void Reset() + void Initialize() { timer = 0; phase = 0; @@ -625,8 +665,12 @@ class npc_the_etymidian : public CreatureScript orphanGUID = 0; } - void MoveInLineOfSight(Unit* who) override + void Reset() + { + Initialize(); + } + void MoveInLineOfSight(Unit* who) override { if (!phase && who && who->GetDistance2d(me) < 10.0f) if (Player* player = who->ToPlayer()) @@ -711,9 +755,12 @@ class npc_alexstraza_the_lifebinder : public CreatureScript struct npc_alexstraza_the_lifebinderAI : public ScriptedAI { - npc_alexstraza_the_lifebinderAI(Creature* creature) : ScriptedAI(creature) { } + npc_alexstraza_the_lifebinderAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } - void Reset() + void Initialize() { timer = 0; phase = 0; @@ -721,6 +768,11 @@ class npc_alexstraza_the_lifebinder : public CreatureScript orphanGUID = 0; } + void Reset() + { + Initialize(); + } + void SetData(uint32 type, uint32 data) override { // Existing SmartAI diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp index e7beb4cf454..f8ba2ab6646 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp @@ -80,6 +80,7 @@ public: { npc_blackfathom_deeps_eventAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); if (creature->IsSummon()) { creature->SetHomePosition(HomePosition); @@ -89,6 +90,15 @@ public: instance = creature->GetInstanceScript(); } + void Initialize() + { + Flee = false; + + ravageTimer = urand(5000, 8000); + frostNovaTimer = urand(9000, 12000); + frostBoltVolleyTimer = urand(2000, 4000); + } + InstanceScript* instance; uint32 ravageTimer; @@ -99,11 +109,7 @@ public: void Reset() override { - Flee = false; - - ravageTimer = urand(5000, 8000); - frostNovaTimer = urand(9000, 12000); - frostBoltVolleyTimer = urand(2000, 4000); + Initialize(); } void AttackPlayer() diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp index f6c34c6b555..b510a84b949 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp @@ -38,11 +38,19 @@ public: struct boss_aku_maiAI : public BossAI { - boss_aku_maiAI(Creature* creature) : BossAI(creature, TYPE_AKU_MAI) { } + boss_aku_maiAI(Creature* creature) : BossAI(creature, TYPE_AKU_MAI) + { + Initialize(); + } - void Reset() override + void Initialize() { IsEnraged = false; + } + + void Reset() override + { + Initialize(); _Reset(); } diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp index 9e25de817fa..0eba1a14fa5 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp @@ -38,16 +38,22 @@ public: { boss_gelihastAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + netTimer = urand(2000, 4000); + } + uint32 netTimer; InstanceScript* instance; void Reset() override { - netTimer = urand(2000, 4000); + Initialize(); instance->SetData(TYPE_GELIHAST, NOT_STARTED); } diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp index 37fac0fa7de..d5860e4dbf7 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp @@ -43,9 +43,16 @@ public: { boss_kelrisAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + mindBlastTimer = urand(2000, 5000); + sleepTimer = urand(9000, 12000); + } + uint32 mindBlastTimer; uint32 sleepTimer; @@ -53,8 +60,7 @@ public: void Reset() override { - mindBlastTimer = urand(2000, 5000); - sleepTimer = urand(9000, 12000); + Initialize(); instance->SetData(TYPE_KELRIS, NOT_STARTED); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp index 7aaa2239745..782632602b3 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp @@ -54,10 +54,20 @@ public: { boss_anetheronAI(Creature* creature) : hyjal_trashAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); go = false; } + void Initialize() + { + SwarmTimer = 45000; + SleepTimer = 60000; + AuraTimer = 5000; + InfernoTimer = 45000; + damageTaken = 0; + } + uint32 SwarmTimer; uint32 SleepTimer; uint32 AuraTimer; @@ -66,11 +76,7 @@ public: void Reset() override { - damageTaken = 0; - SwarmTimer = 45000; - SleepTimer = 60000; - AuraTimer = 5000; - InfernoTimer = 45000; + Initialize(); if (IsEvent) instance->SetData(DATA_ANETHERONEVENT, NOT_STARTED); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index 576b3dbdb39..2885a838cee 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -90,7 +90,13 @@ public: { npc_ancient_wispAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); + } + + void Initialize() + { + CheckTimer = 1000; ArchimondeGUID = 0; } @@ -100,7 +106,7 @@ public: void Reset() override { - CheckTimer = 1000; + Initialize(); ArchimondeGUID = instance->GetData64(DATA_ARCHIMONDE); @@ -174,15 +180,23 @@ public: struct npc_doomfire_targettingAI : public ScriptedAI { - npc_doomfire_targettingAI(Creature* creature) : ScriptedAI(creature) { } + npc_doomfire_targettingAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + TargetGUID = 0; + ChangeTargetTimer = 5000; + } uint64 TargetGUID; uint32 ChangeTargetTimer; void Reset() override { - TargetGUID = 0; - ChangeTargetTimer = 5000; + Initialize(); } void MoveInLineOfSight(Unit* who) override @@ -244,9 +258,36 @@ public: { boss_archimondeAI(Creature* creature) : hyjal_trashAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + DoomfireSpiritGUID = 0; + damageTaken = 0; + WorldTreeGUID = 0; + + DrainNordrassilTimer = 0; + FearTimer = 42000; + AirBurstTimer = 30000; + GripOfTheLegionTimer = urand(5000, 25000); + DoomfireTimer = 20000; + SoulChargeTimer = urand(2000, 30000); + SoulChargeCount = 0; + MeleeRangeCheckTimer = 15000; + HandOfDeathTimer = 2000; + WispCount = 0; // When ~30 wisps are summoned, Archimonde dies + EnrageTimer = 600000; // 10 minutes + CheckDistanceTimer = 30000; // This checks if he's too close to the World Tree (75 yards from a point on the tree), if true then he will enrage + SummonWispTimer = 0; + + Enraged = false; + BelowTenPercent = false; + HasProtected = false; + IsChanneling = false; + } + InstanceScript* instance; uint64 DoomfireSpiritGUID; @@ -275,28 +316,7 @@ public: { instance->SetData(DATA_ARCHIMONDEEVENT, NOT_STARTED); - DoomfireSpiritGUID = 0; - damageTaken = 0; - WorldTreeGUID = 0; - - DrainNordrassilTimer = 0; - FearTimer = 42000; - AirBurstTimer = 30000; - GripOfTheLegionTimer = urand(5000, 25000); - DoomfireTimer = 20000; - SoulChargeTimer = urand(2000, 30000); - SoulChargeCount = 0; - MeleeRangeCheckTimer = 15000; - HandOfDeathTimer = 2000; - WispCount = 0; // When ~30 wisps are summoned, Archimonde dies - EnrageTimer = 600000; // 10 minutes - CheckDistanceTimer = 30000; // This checks if he's too close to the World Tree (75 yards from a point on the tree), if true then he will enrage - SummonWispTimer = 0; - - Enraged = false; - BelowTenPercent = false; - HasProtected = false; - IsChanneling = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp index 38e398f3d5b..7e50fd7b775 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp @@ -55,10 +55,22 @@ public: { boss_azgalorAI(Creature* creature) : hyjal_trashAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); go = false; } + void Initialize() + { + damageTaken = 0; + RainTimer = 20000; + DoomTimer = 50000; + HowlTimer = 30000; + CleaveTimer = 10000; + EnrageTimer = 600000; + enraged = false; + } + uint32 RainTimer; uint32 DoomTimer; uint32 HowlTimer; @@ -70,13 +82,7 @@ public: void Reset() override { - damageTaken = 0; - RainTimer = 20000; - DoomTimer = 50000; - HowlTimer = 30000; - CleaveTimer = 10000; - EnrageTimer = 600000; - enraged = false; + Initialize(); if (IsEvent) instance->SetData(DATA_AZGALOREVENT, NOT_STARTED); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index c5fcb150d3f..d3c137b67e8 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -56,10 +56,20 @@ public: { boss_kazrogalAI(Creature* creature) : hyjal_trashAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); go = false; } + void Initialize() + { + damageTaken = 0; + CleaveTimer = 5000; + WarStompTimer = 15000; + MarkTimer = 45000; + MarkTimerBase = 45000; + } + uint32 CleaveTimer; uint32 WarStompTimer; uint32 MarkTimer; @@ -68,11 +78,7 @@ public: void Reset() override { - damageTaken = 0; - CleaveTimer = 5000; - WarStompTimer = 15000; - MarkTimer = 45000; - MarkTimerBase = 45000; + Initialize(); if (IsEvent) instance->SetData(DATA_KAZROGALEVENT, NOT_STARTED); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp index c37b9d910e7..5ce9b30eb58 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp @@ -51,10 +51,20 @@ public: { boss_rage_winterchillAI(Creature* creature) : hyjal_trashAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); go = false; } + void Initialize() + { + damageTaken = 0; + FrostArmorTimer = 37000; + DecayTimer = 45000; + NovaTimer = 15000; + IceboltTimer = 10000; + } + uint32 FrostArmorTimer; uint32 DecayTimer; uint32 NovaTimer; @@ -63,11 +73,7 @@ public: void Reset() override { - damageTaken = 0; - FrostArmorTimer = 37000; - DecayTimer = 45000; - NovaTimer = 15000; - IceboltTimer = 10000; + Initialize(); if (IsEvent) instance->SetData(DATA_RAGEWINTERCHILLEVENT, NOT_STARTED); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index b9c6025b91c..34b55da72de 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -317,6 +317,7 @@ float HordeFirePos[65][8]=//spawn points for the fire visuals (GO) in the horde hyjalAI::hyjalAI(Creature* creature) : npc_escortAI(creature), Summons(me) { + Initialize(); instance = creature->GetInstanceScript(); VeinsSpawned[0] = false; VeinsSpawned[1] = false; @@ -332,25 +333,14 @@ hyjalAI::hyjalAI(Creature* creature) : npc_escortAI(creature), Summons(me) InfernalPoint = 0; RespawnTimer = 10000; DoRespawn = false; - DoHide = false; MassTeleportTimer = 0; DoMassTeleport = false; } -void hyjalAI::JustSummoned(Creature* summoned) -{ - Summons.Summon(summoned); -} - -void hyjalAI::SummonedCreatureDespawn(Creature* summoned) -{ - Summons.Despawn(summoned); -} - -void hyjalAI::Reset() +void hyjalAI::Initialize() { IsDummy = false; - me->setActive(true); + // GUIDs PlayerGUID = 0; BossGUID[0] = 0; @@ -365,6 +355,39 @@ void hyjalAI::Reset() WaveCount = 0; EnemyCount = 0; + //Bools + EventBegun = false; + FirstBossDead = false; + SecondBossDead = false; + Summon = false; + bRetreat = false; + Debug = false; + + //Visibility + DoHide = true; + + //Initialize spells + memset(Spells, 0, sizeof(Spell) * HYJAL_AI_MAX_SPELLS); + + Faction = 0; +} + +void hyjalAI::JustSummoned(Creature* summoned) +{ + Summons.Summon(summoned); +} + +void hyjalAI::SummonedCreatureDespawn(Creature* summoned) +{ + Summons.Despawn(summoned); +} + +void hyjalAI::Reset() +{ + me->setActive(true); + + Initialize(); + // Set faction properly based on Creature entry switch (me->GetEntry()) { @@ -382,20 +405,9 @@ void hyjalAI::Reset() break; } - //Bools - EventBegun = false; - FirstBossDead = false; - SecondBossDead = false; - Summon = false; - bRetreat = false; - Debug = false; - //Flags me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - //Initialize spells - memset(Spells, 0, sizeof(Spell) * HYJAL_AI_MAX_SPELLS); - //Reset Instance Data for trash count if ((!instance->GetData(DATA_ALLIANCE_RETREAT) && me->GetEntry() == JAINA) || (instance->GetData(DATA_ALLIANCE_RETREAT) && me->GetEntry() == THRALL)) { @@ -405,9 +417,6 @@ void hyjalAI::Reset() instance->DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0); instance->SetData(DATA_RESET_TRASH_COUNT, 0); } - - //Visibility - DoHide = true; } void hyjalAI::EnterEvadeMode() diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h index c91414eba9d..43afc58879c 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h @@ -119,6 +119,8 @@ struct hyjalAI : public npc_escortAI { hyjalAI(Creature* creature); + void Initialize(); + void Reset(); // Generically used to reset our variables. Do *not* call in EnterEvadeMode as this may make problems if the raid is still in combat void EnterEvadeMode(); // Send creature back to spawn location and evade. diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 7537654c09c..8e1a78ea5f2 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -1135,9 +1135,15 @@ public: { npc_frost_wyrmAI(Creature* creature) : hyjal_trashAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); go = false; - Reset(); + } + + void Initialize() + { + FrostBreathTimer = 5000; + MoveTimer = 0; } bool go; @@ -1146,8 +1152,7 @@ public: void Reset() override { - FrostBreathTimer = 5000; - MoveTimer = 0; + Initialize(); me->SetDisableGravity(true); } @@ -1388,9 +1393,15 @@ public: { alliance_riflemanAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); SetCombatMovement(false); } + void Initialize() + { + ExplodeTimer = 5000 + rand32() % 5000; + } + uint32 ExplodeTimer; void JustDied(Unit* /*killer*/) override @@ -1399,7 +1410,7 @@ public: void Reset() override { - ExplodeTimer = 5000 + rand32() % 5000; + Initialize(); } void MoveInLineOfSight(Unit* who) override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp index 44e1067498d..0a666488e84 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp @@ -59,9 +59,20 @@ public: { boss_epochAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + uiStep = 1; + uiStepTimer = 26000; + uiCurseOfExertionTimer = 9300; + uiTimeWarpTimer = 25300; + uiTimeStopTimer = 21300; + uiWoundingStrikeTimer = 5300; + } + uint8 uiStep; uint32 uiStepTimer; @@ -74,12 +85,7 @@ public: void Reset() override { - uiStep = 1; - uiStepTimer = 26000; - uiCurseOfExertionTimer = 9300; - uiTimeWarpTimer = 25300; - uiTimeStopTimer = 21300; - uiWoundingStrikeTimer = 5300; + Initialize(); instance->SetData(DATA_EPOCH_EVENT, NOT_STARTED); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index 6d36a933687..d9356b724c0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -73,7 +73,21 @@ public: { boss_mal_ganisAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); + uiOutroStep = 0; + } + + void Initialize() + { + bYelled = false; + bYelled2 = false; + Phase = COMBAT; + uiCarrionSwarmTimer = 6000; + uiMindBlastTimer = 11000; + uiVampiricTouchTimer = urand(10000, 15000); + uiSleepTimer = urand(15000, 20000); + uiOutroTimer = 1000; } uint32 uiCarrionSwarmTimer; @@ -93,16 +107,9 @@ public: void Reset() override { - bYelled = false; - bYelled2 = false; - Phase = COMBAT; - uiCarrionSwarmTimer = 6000; - uiMindBlastTimer = 11000; - uiVampiricTouchTimer = urand(10000, 15000); - uiSleepTimer = urand(15000, 20000); - uiOutroTimer = 1000; - - instance->SetData(DATA_MAL_GANIS_EVENT, NOT_STARTED); + Initialize(); + + instance->SetData(DATA_MAL_GANIS_EVENT, NOT_STARTED); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp index 4c26b30947f..c961bf9b2c6 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp @@ -58,10 +58,18 @@ public: { boss_meathookAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); Talk(SAY_SPAWN); } + void Initialize() + { + uiChainTimer = urand(12000, 17000); //seen on video 13, 17, 15, 12, 16 + uiDiseaseTimer = urand(2000, 4000); //approx 3s + uiFrenzyTimer = urand(21000, 26000); //made it up + } + uint32 uiChainTimer; uint32 uiDiseaseTimer; uint32 uiFrenzyTimer; @@ -70,9 +78,7 @@ public: void Reset() override { - uiChainTimer = urand(12000, 17000); //seen on video 13, 17, 15, 12, 16 - uiDiseaseTimer = urand(2000, 4000); //approx 3s - uiFrenzyTimer = urand(21000, 26000); //made it up + Initialize(); instance->SetData(DATA_MEATHOOK_EVENT, NOT_STARTED); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp index 7c299b1feaa..1c35a38a5e3 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp @@ -63,10 +63,20 @@ public: { boss_salrammAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); Talk(SAY_SPAWN); } + void Initialize() + { + uiCurseFleshTimer = 30000; //30s DBM + uiExplodeGhoulTimer = urand(25000, 28000); //approx 6 sec after summon ghouls + uiShadowBoltTimer = urand(8000, 12000); // approx 10s + uiStealFleshTimer = 12345; + uiSummonGhoulsTimer = urand(19000, 24000); //on a video approx 24s after aggro + } + uint32 uiCurseFleshTimer; uint32 uiExplodeGhoulTimer; uint32 uiShadowBoltTimer; @@ -77,13 +87,9 @@ public: void Reset() override { - uiCurseFleshTimer = 30000; //30s DBM - uiExplodeGhoulTimer = urand(25000, 28000); //approx 6 sec after summon ghouls - uiShadowBoltTimer = urand(8000, 12000); // approx 10s - uiStealFleshTimer = 12345; - uiSummonGhoulsTimer = urand(19000, 24000); //on a video approx 24s after aggro + Initialize(); - instance->SetData(DATA_SALRAMM_EVENT, NOT_STARTED); + instance->SetData(DATA_SALRAMM_EVENT, NOT_STARTED); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index fd832051421..b8a9b295161 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -351,8 +351,37 @@ public: { npc_arthasAI(Creature* creature) : npc_escortAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); - Reset(); + bStepping = false; + step = 0; + gossipStep = 0; + bossEvent = 0; + } + + void Initialize() + { + utherGUID = 0; + jainaGUID = 0; + + for (uint8 i = 0; i < 2; ++i) + citymenGUID[i] = 0; + + for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) + waveGUID[i] = 0; + + for (uint8 i = 0; i < ENCOUNTER_DRACONIAN_NUMBER; ++i) + infiniteDraconianGUID[i] = 0; + + stalkerGUID = 0; + bossGUID = 0; + epochGUID = 0; + malganisGUID = 0; + infiniteGUID = 0; + + phaseTimer = 1000; + exorcismTimer = 7300; + wave = 0; } InstanceScript* instance; @@ -361,7 +390,6 @@ public: uint32 step; uint32 phaseTimer; uint32 gossipStep; - uint32 playerFaction; uint32 bossEvent; uint32 wave; @@ -381,23 +409,7 @@ public: void Reset() override { - utherGUID = 0; - jainaGUID = 0; - - for (uint8 i = 0; i < 2; ++i) - citymenGUID[i] = 0; - - for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) - waveGUID[i] = 0; - - for (uint8 i = 0; i < ENCOUNTER_DRACONIAN_NUMBER; ++i) - infiniteDraconianGUID[i] = 0; - - stalkerGUID = 0; - bossGUID = 0; - epochGUID = 0; - malganisGUID = 0; - infiniteGUID = 0; + Initialize(); instance->SetData(DATA_ARTHAS_EVENT, NOT_STARTED); switch (instance->GetData(DATA_ARTHAS_EVENT)) @@ -410,9 +422,6 @@ public: gossipStep = 0; break; } - phaseTimer = 1000; - exorcismTimer = 7300; - wave = 0; } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp index b63075b681a..611ef38d626 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp @@ -61,9 +61,20 @@ public: { boss_captain_skarlocAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + Holy_Light_Timer = urand(20000, 30000); + Cleanse_Timer = 10000; + HammerOfJustice_Timer = urand(20000, 35000); + HolyShield_Timer = 240000; + DevotionAura_Timer = 3000; + Consecration_Timer = 8000; + } + InstanceScript* instance; uint32 Holy_Light_Timer; @@ -75,12 +86,7 @@ public: void Reset() override { - Holy_Light_Timer = urand(20000, 30000); - Cleanse_Timer = 10000; - HammerOfJustice_Timer = urand(20000, 35000); - HolyShield_Timer = 240000; - DevotionAura_Timer = 3000; - Consecration_Timer = 8000; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp index e27dec09802..1916e184dbb 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp @@ -59,9 +59,18 @@ public: { boss_epoch_hunterAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + SandBreath_Timer = urand(8000, 16000); + ImpendingDeath_Timer = urand(25000, 30000); + WingBuffet_Timer = 35000; + Mda_Timer = 40000; + } + InstanceScript* instance; uint32 SandBreath_Timer; @@ -71,10 +80,7 @@ public: void Reset() override { - SandBreath_Timer = urand(8000, 16000); - ImpendingDeath_Timer = urand(25000, 30000); - WingBuffet_Timer = 35000; - Mda_Timer = 40000; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp index 2cf5169b530..8d23cf0a3e4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp @@ -114,7 +114,21 @@ public: struct boss_lieutenant_drakeAI : public ScriptedAI { - boss_lieutenant_drakeAI(Creature* creature) : ScriptedAI(creature) { } + boss_lieutenant_drakeAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + CanPatrol = true; + wpId = 0; + + Whirlwind_Timer = 20000; + Fear_Timer = 30000; + MortalStrike_Timer = 45000; + ExplodingShout_Timer = 25000; + } bool CanPatrol; uint32 wpId; @@ -126,13 +140,7 @@ public: void Reset() override { - CanPatrol = true; - wpId = 0; - - Whirlwind_Timer = 20000; - Fear_Timer = 30000; - MortalStrike_Timer = 45000; - ExplodingShout_Timer = 25000; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index 1dc86cd4ad4..56e95fafece 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -276,11 +276,17 @@ public: { npc_thrall_old_hillsbradAI(Creature* creature) : npc_escortAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); HadMount = false; me->setActive(true); } + void Initialize() + { + LowHp = false; + } + InstanceScript* instance; bool LowHp; @@ -451,7 +457,7 @@ public: void Reset() override { - LowHp = false; + Initialize(); if (HadMount) DoMount(); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp index a1c4f057161..1fa104ada00 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp @@ -77,9 +77,19 @@ public: { npc_medivh_bmAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + SpellCorrupt_Timer = 0; + Check_Timer = 0; + Life75 = true; + Life50 = true; + Life25 = true; + } + InstanceScript* instance; uint32 SpellCorrupt_Timer; @@ -91,11 +101,7 @@ public: void Reset() override { - SpellCorrupt_Timer = 0; - Check_Timer = 0; - Life75 = true; - Life50 = true; - Life25 = true; + Initialize(); if (instance->GetData(TYPE_MEDIVH) == IN_PROGRESS) DoCast(me, SPELL_CHANNEL, true); @@ -265,23 +271,28 @@ public: { npc_time_riftAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + TimeRiftWave_Timer = 15000; + mRiftWaveCount = 0; + mWaveId = 0; + } + InstanceScript* instance; uint32 TimeRiftWave_Timer; uint8 mRiftWaveCount; - uint8 mPortalCount; uint8 mWaveId; void Reset() override { + Initialize(); - TimeRiftWave_Timer = 15000; - mRiftWaveCount = 0; - - mPortalCount = instance->GetData(DATA_PORTAL_COUNT); + uint8 mPortalCount = instance->GetData(DATA_PORTAL_COUNT); if (mPortalCount < 6) mWaveId = 0; diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp index 15330643bd3..b8eb489461c 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp @@ -45,7 +45,17 @@ public: struct celebras_the_cursedAI : public ScriptedAI { - celebras_the_cursedAI(Creature* creature) : ScriptedAI(creature) { } + celebras_the_cursedAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + WrathTimer = 8000; + EntanglingRootsTimer = 2000; + CorruptForcesTimer = 30000; + } uint32 WrathTimer; uint32 EntanglingRootsTimer; @@ -53,9 +63,7 @@ public: void Reset() override { - WrathTimer = 8000; - EntanglingRootsTimer = 2000; - CorruptForcesTimer = 30000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp index 12016d2223a..59bcdc89171 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp @@ -45,7 +45,17 @@ public: struct boss_landslideAI : public ScriptedAI { - boss_landslideAI(Creature* creature) : ScriptedAI(creature) { } + boss_landslideAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + KnockAwayTimer = 8000; + TrampleTimer = 2000; + LandslideTimer = 0; + } uint32 KnockAwayTimer; uint32 TrampleTimer; @@ -53,9 +63,7 @@ public: void Reset() override { - KnockAwayTimer = 8000; - TrampleTimer = 2000; - LandslideTimer = 0; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp index 8c7197b2942..a7aa487db90 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp @@ -44,7 +44,19 @@ public: struct boss_noxxionAI : public ScriptedAI { - boss_noxxionAI(Creature* creature) : ScriptedAI(creature) { } + boss_noxxionAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + ToxicVolleyTimer = 7000; + UppercutTimer = 16000; + AddsTimer = 19000; + InvisibleTimer = 15000; //Too much too low? + Invisible = false; + } uint32 ToxicVolleyTimer; uint32 UppercutTimer; @@ -54,11 +66,7 @@ public: void Reset() override { - ToxicVolleyTimer = 7000; - UppercutTimer = 16000; - AddsTimer = 19000; - InvisibleTimer = 15000; //Too much too low? - Invisible = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp index 0d48d8f43c6..a36e8f09d21 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp @@ -47,7 +47,18 @@ public: struct boss_ptheradrasAI : public ScriptedAI { - boss_ptheradrasAI(Creature* creature) : ScriptedAI(creature) { } + boss_ptheradrasAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + DustfieldTimer = 8000; + BoulderTimer = 2000; + ThrashTimer = 5000; + RepulsiveGazeTimer = 23000; + } uint32 DustfieldTimer; uint32 BoulderTimer; @@ -56,10 +67,7 @@ public: void Reset() override { - DustfieldTimer = 8000; - BoulderTimer = 2000; - ThrashTimer = 5000; - RepulsiveGazeTimer = 23000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp index e0a30eba2c9..ba7934e18a3 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp @@ -50,14 +50,22 @@ public: struct boss_amnennar_the_coldbringerAI : public BossAI { - boss_amnennar_the_coldbringerAI(Creature* creature) : BossAI(creature, DATA_AMNENNAR_THE_COLD_BRINGER) { } + boss_amnennar_the_coldbringerAI(Creature* creature) : BossAI(creature, DATA_AMNENNAR_THE_COLD_BRINGER) + { + Initialize(); + } - void Reset() override + void Initialize() { - _Reset(); hp60Spectrals = false; hp30Spectrals = false; - hp50 = false; + hp50 = false; + } + + void Reset() override + { + _Reset(); + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp index 162ce9b5359..19cc5316fa4 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp @@ -80,13 +80,19 @@ class boss_ayamiss : public CreatureScript { boss_ayamissAI(Creature* creature) : BossAI(creature, DATA_AYAMISS) { + Initialize(); } - void Reset() override + void Initialize() { - _Reset(); _phase = PHASE_AIR; _enraged = false; + } + + void Reset() override + { + _Reset(); + Initialize(); SetCombatMovement(false); } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp index ac490b1440d..cf6703a01f5 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp @@ -69,6 +69,7 @@ class boss_buru : public CreatureScript { boss_buruAI(Creature* creature) : BossAI(creature, DATA_BURU) { + _phase = 0; } void EnterEvadeMode() override diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp index f0e582dee95..adb6723d2af 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp @@ -53,12 +53,18 @@ class boss_kurinnaxx : public CreatureScript { boss_kurinnaxxAI(Creature* creature) : BossAI(creature, DATA_KURINNAXX) { + Initialize(); + } + + void Initialize() + { + _enraged = false; } void Reset() override { _Reset(); - _enraged = false; + Initialize(); events.ScheduleEvent(EVENT_MORTAL_WOUND, 8000); events.ScheduleEvent(EVENT_SANDTRAP, urand(5000, 15000)); events.ScheduleEvent(EVENT_TRASH, 1000); diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp index e123a84f88e..65de64fe6c5 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp @@ -60,13 +60,19 @@ class boss_moam : public CreatureScript { boss_moamAI(Creature* creature) : BossAI(creature, DATA_MOAM) { + Initialize(); + } + + void Initialize() + { + _isStonePhase = false; } void Reset() override { _Reset(); me->SetPower(POWER_MANA, 0); - _isStonePhase = false; + Initialize(); events.ScheduleEvent(EVENT_STONE_PHASE, 90000); //events.ScheduleEvent(EVENT_WIDE_SLASH, 11000); } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp index 256f76337b4..0180bbeddac 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp @@ -88,9 +88,17 @@ class boss_ossirian : public CreatureScript { boss_ossirianAI(Creature* creature) : BossAI(creature, DATA_OSSIRIAN) { + Initialize(); SaidIntro = false; } + void Initialize() + { + CrystalIterator = 0; + TriggerGUID = 0; + CrystalGUID = 0; + } + uint64 TriggerGUID; uint64 CrystalGUID; uint8 CrystalIterator; @@ -99,9 +107,7 @@ class boss_ossirian : public CreatureScript void Reset() override { _Reset(); - CrystalIterator = 0; - TriggerGUID = 0; - CrystalGUID = 0; + Initialize(); } void SpellHit(Unit* caster, SpellInfo const* spell) override diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp index 0bb35f3842a..8369c343de4 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp @@ -65,12 +65,18 @@ class boss_rajaxx : public CreatureScript { boss_rajaxxAI(Creature* creature) : BossAI(creature, DATA_RAJAXX) { + Initialize(); + } + + void Initialize() + { + enraged = false; } void Reset() override { _Reset(); - enraged = false; + Initialize(); events.ScheduleEvent(EVENT_DISARM, 10000); events.ScheduleEvent(EVENT_THUNDERCRASH, 12000); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index 189cb7854ad..be103541989 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -55,9 +55,20 @@ public: { boss_kriAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + Cleave_Timer = urand(4000, 8000); + ToxicVolley_Timer = urand(6000, 12000); + Check_Timer = 2000; + + VemDead = false; + Death = false; + } + InstanceScript* instance; uint32 Cleave_Timer; @@ -69,12 +80,7 @@ public: void Reset() override { - Cleave_Timer = urand(4000, 8000); - ToxicVolley_Timer = urand(6000, 12000); - Check_Timer = 2000; - - VemDead = false; - Death = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override @@ -148,9 +154,19 @@ public: { boss_vemAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + Charge_Timer = urand(15000, 27000); + KnockBack_Timer = urand(8000, 20000); + Enrage_Timer = 120000; + + Enraged = false; + } + InstanceScript* instance; uint32 Charge_Timer; @@ -161,11 +177,7 @@ public: void Reset() override { - Charge_Timer = urand(15000, 27000); - KnockBack_Timer = urand(8000, 20000); - Enrage_Timer = 120000; - - Enraged = false; + Initialize(); } void JustDied(Unit* /*killer*/) override @@ -237,9 +249,19 @@ public: { boss_yaujAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + Heal_Timer = urand(25000, 40000); + Fear_Timer = urand(12000, 24000); + Check_Timer = 2000; + + VemDead = false; + } + InstanceScript* instance; uint32 Heal_Timer; @@ -250,11 +272,7 @@ public: void Reset() override { - Heal_Timer = urand(25000, 40000); - Fear_Timer = urand(12000, 24000); - Check_Timer = 2000; - - VemDead = false; + Initialize(); } void JustDied(Unit* /*killer*/) override diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 2cfd977fe99..c9795133d14 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -160,11 +160,29 @@ public: { eye_of_cthunAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); SetCombatMovement(false); } + void Initialize() + { + //Phase information + PhaseTimer = 50000; //First dark glare in 50 seconds + + //Eye beam phase 50 seconds + BeamTimer = 3000; + EyeTentacleTimer = 45000; //Always spawns 5 seconds before Dark Beam + ClawTentacleTimer = 12500; //4 per Eye beam phase (unsure if they spawn during Dark beam) + + //Dark Beam phase 35 seconds (each tick = 1 second, 35 ticks) + DarkGlareTick = 0; + DarkGlareTickTimer = 1000; + DarkGlareAngle = 0; + ClockWise = false; + } + InstanceScript* instance; //Global variables @@ -183,19 +201,7 @@ public: void Reset() override { - //Phase information - PhaseTimer = 50000; //First dark glare in 50 seconds - - //Eye beam phase 50 seconds - BeamTimer = 3000; - EyeTentacleTimer = 45000; //Always spawns 5 seconds before Dark Beam - ClawTentacleTimer = 12500; //4 per Eye beam phase (unsure if they spawn during Dark beam) - - //Dark Beam phase 35 seconds (each tick = 1 second, 35 ticks) - DarkGlareTick = 0; - DarkGlareTickTimer = 1000; - DarkGlareAngle = 0; - ClockWise = false; + Initialize(); //Reset flags me->RemoveAurasDueToSpell(SPELL_RED_COLORATION); @@ -454,11 +460,34 @@ public: { cthunAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); SetCombatMovement(false); instance = creature->GetInstanceScript(); } + void Initialize() + { + //One random wisper every 90 - 300 seconds + WisperTimer = 90000; + + //Phase information + PhaseTimer = 10000; //Emerge in 10 seconds + + //No hold player for transition + HoldPlayer = 0; + + //Body Phase + EyeTentacleTimer = 30000; + FleshTentaclesKilled = 0; + GiantClawTentacleTimer = 15000; //15 seconds into body phase (1 min repeat) + GiantEyeTentacleTimer = 45000; //15 seconds into body phase (1 min repeat) + StomachAcidTimer = 4000; //Every 4 seconds + StomachEnterTimer = 10000; //Every 10 seconds + StomachEnterVisTimer = 0; //Always 3.5 seconds after Stomach Enter Timer + StomachEnterTarget = 0; //Target to be teleported to stomach + } + InstanceScript* instance; //Out of combat whisper timer @@ -487,24 +516,7 @@ public: void Reset() override { - //One random wisper every 90 - 300 seconds - WisperTimer = 90000; - - //Phase information - PhaseTimer = 10000; //Emerge in 10 seconds - - //No hold player for transition - HoldPlayer = 0; - - //Body Phase - EyeTentacleTimer = 30000; - FleshTentaclesKilled = 0; - GiantClawTentacleTimer = 15000; //15 seconds into body phase (1 min repeat) - GiantEyeTentacleTimer = 45000; //15 seconds into body phase (1 min repeat) - StomachAcidTimer = 4000; //Every 4 seconds - StomachEnterTimer = 10000; //Every 10 seconds - StomachEnterVisTimer = 0; //Always 3.5 seconds after Stomach Enter Timer - StomachEnterTarget = 0; //Target to be teleported to stomach + Initialize(); //Clear players in stomach and outside Stomach_Map.clear(); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp index 5947c9860ec..a98f3843d97 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp @@ -53,23 +53,28 @@ public: struct boss_fankrissAI : public ScriptedAI { - boss_fankrissAI(Creature* creature) : ScriptedAI(creature) { } + boss_fankrissAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + MortalWound_Timer = urand(10000, 15000); + SpawnHatchlings_Timer = urand(6000, 12000); + SpawnSpawns_Timer = urand(15000, 45000); + } uint32 MortalWound_Timer; uint32 SpawnHatchlings_Timer; uint32 SpawnSpawns_Timer; - int Rand; - float RandX; - float RandY; Creature* Hatchling; Creature* Spawn; void Reset() override { - MortalWound_Timer = urand(10000, 15000); - SpawnHatchlings_Timer = urand(6000, 12000); - SpawnSpawns_Timer = urand(15000, 45000); + Initialize(); } void SummonSpawn(Unit* victim) @@ -77,7 +82,10 @@ public: if (!victim) return; - Rand = 10 + (rand32() % 10); + int Rand = 10 + (rand32() % 10); + float RandX = 0.f; + float RandY = 0.f; + switch (rand32() % 2) { case 0: RandX = 0.0f - Rand; break; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp index 5cc1670d8fb..b5512f29589 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp @@ -51,7 +51,23 @@ public: struct boss_huhuranAI : public ScriptedAI { - boss_huhuranAI(Creature* creature) : ScriptedAI(creature) { } + boss_huhuranAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + Frenzy_Timer = urand(25000, 35000); + Wyvern_Timer = urand(18000, 28000); + Spit_Timer = 8000; + PoisonBolt_Timer = 4000; + NoxiousPoison_Timer = urand(10000, 20000); + FrenzyBack_Timer = 15000; + + Frenzy = false; + Berserk = false; + } uint32 Frenzy_Timer; uint32 Wyvern_Timer; @@ -65,15 +81,7 @@ public: void Reset() override { - Frenzy_Timer = urand(25000, 35000); - Wyvern_Timer = urand(18000, 28000); - Spit_Timer = 8000; - PoisonBolt_Timer = 4000; - NoxiousPoison_Timer = urand(10000, 20000); - FrenzyBack_Timer = 15000; - - Frenzy = false; - Berserk = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp index 26866de9aa8..092d7ed2a3b 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp @@ -48,7 +48,23 @@ public: struct boss_ouroAI : public ScriptedAI { - boss_ouroAI(Creature* creature) : ScriptedAI(creature) { } + boss_ouroAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + Sweep_Timer = urand(5000, 10000); + SandBlast_Timer = urand(20000, 35000); + Submerge_Timer = urand(90000, 150000); + Back_Timer = urand(30000, 45000); + ChangeTarget_Timer = urand(5000, 8000); + Spawn_Timer = urand(10000, 20000); + + Enrage = false; + Submerged = false; + } uint32 Sweep_Timer; uint32 SandBlast_Timer; @@ -62,15 +78,7 @@ public: void Reset() override { - Sweep_Timer = urand(5000, 10000); - SandBlast_Timer = urand(20000, 35000); - Submerge_Timer = urand(90000, 150000); - Back_Timer = urand(30000, 45000); - ChangeTarget_Timer = urand(5000, 8000); - Spawn_Timer = urand(10000, 20000); - - Enrage = false; - Submerged = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp index e9eb9d58ca8..b73a79506a9 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp @@ -53,7 +53,25 @@ public: struct boss_sarturaAI : public ScriptedAI { - boss_sarturaAI(Creature* creature) : ScriptedAI(creature) { } + boss_sarturaAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + WhirlWind_Timer = 30000; + WhirlWindRandom_Timer = urand(3000, 7000); + WhirlWindEnd_Timer = 15000; + AggroReset_Timer = urand(45000, 55000); + AggroResetEnd_Timer = 5000; + EnrageHard_Timer = 10 * 60000; + + WhirlWind = false; + AggroReset = false; + Enraged = false; + EnragedHard = false; + } uint32 WhirlWind_Timer; uint32 WhirlWindRandom_Timer; @@ -69,18 +87,7 @@ public: void Reset() override { - WhirlWind_Timer = 30000; - WhirlWindRandom_Timer = urand(3000, 7000); - WhirlWindEnd_Timer = 15000; - AggroReset_Timer = urand(45000, 55000); - AggroResetEnd_Timer = 5000; - EnrageHard_Timer = 10*60000; - - WhirlWind = false; - AggroReset = false; - Enraged = false; - EnragedHard = false; - + Initialize(); } void EnterCombat(Unit* /*who*/) override @@ -196,7 +203,23 @@ public: struct npc_sartura_royal_guardAI : public ScriptedAI { - npc_sartura_royal_guardAI(Creature* creature) : ScriptedAI(creature) { } + npc_sartura_royal_guardAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + WhirlWind_Timer = 30000; + WhirlWindRandom_Timer = urand(3000, 7000); + WhirlWindEnd_Timer = 15000; + AggroReset_Timer = urand(45000, 55000); + AggroResetEnd_Timer = 5000; + KnockBack_Timer = 10000; + + WhirlWind = false; + AggroReset = false; + } uint32 WhirlWind_Timer; uint32 WhirlWindRandom_Timer; @@ -210,15 +233,7 @@ public: void Reset() override { - WhirlWind_Timer = 30000; - WhirlWindRandom_Timer = urand(3000, 7000); - WhirlWindEnd_Timer = 15000; - AggroReset_Timer = urand(45000, 55000); - AggroResetEnd_Timer = 5000; - KnockBack_Timer = 10000; - - WhirlWind = false; - AggroReset = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp index 51384cc117d..62de8fbd607 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp @@ -55,12 +55,20 @@ class boss_skeram : public CreatureScript struct boss_skeramAI : public BossAI { - boss_skeramAI(Creature* creature) : BossAI(creature, DATA_SKERAM) { } + boss_skeramAI(Creature* creature) : BossAI(creature, DATA_SKERAM) + { + Initialize(); + } - void Reset() override + void Initialize() { _flag = 0; _hpct = 75.0f; + } + + void Reset() override + { + Initialize(); me->SetVisible(true); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index 3e02406b93d..cd250a50fb7 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -69,9 +69,24 @@ struct boss_twinemperorsAI : public ScriptedAI { boss_twinemperorsAI(Creature* creature): ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + Heal_Timer = 0; // first heal immediately when they get close together + Teleport_Timer = TELEPORTTIME; + AfterTeleport = false; + tspellcast = false; + AfterTeleportTimer = 0; + Abuse_Bug_Timer = urand(10000, 17000); + BugsTimer = 2000; + + DontYellWhenDead = false; + EnrageTimer = 15 * 60000; + } + InstanceScript* instance; uint32 Heal_Timer; @@ -89,16 +104,8 @@ struct boss_twinemperorsAI : public ScriptedAI void TwinReset() { - Heal_Timer = 0; // first heal immediately when they get close together - Teleport_Timer = TELEPORTTIME; - AfterTeleport = false; - tspellcast = false; - AfterTeleportTimer = 0; - Abuse_Bug_Timer = urand(10000, 17000); - BugsTimer = 2000; + Initialize(); me->ClearUnitState(UNIT_STATE_STUNNED); - DontYellWhenDead = false; - EnrageTimer = 15*60000; } Creature* GetOtherBoss() @@ -394,24 +401,28 @@ public: struct boss_veknilashAI : public boss_twinemperorsAI { bool IAmVeklor() {return false;} - boss_veknilashAI(Creature* creature) : boss_twinemperorsAI(creature) { } + boss_veknilashAI(Creature* creature) : boss_twinemperorsAI(creature) + { + Initialize(); + } + + void Initialize() + { + UpperCut_Timer = urand(14000, 29000); + UnbalancingStrike_Timer = urand(8000, 18000); + Scarabs_Timer = urand(7000, 14000); + } uint32 UpperCut_Timer; uint32 UnbalancingStrike_Timer; uint32 Scarabs_Timer; - int Rand; - int RandX; - int RandY; Creature* Summoned; void Reset() override { TwinReset(); - UpperCut_Timer = urand(14000, 29000); - UnbalancingStrike_Timer = urand(8000, 18000); - Scarabs_Timer = urand(7000, 14000); - + Initialize(); //Added. Can be removed if its included in DB. me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); } @@ -480,25 +491,30 @@ public: struct boss_veklorAI : public boss_twinemperorsAI { bool IAmVeklor() {return true;} - boss_veklorAI(Creature* creature) : boss_twinemperorsAI(creature) { } + boss_veklorAI(Creature* creature) : boss_twinemperorsAI(creature) + { + Initialize(); + } + + void Initialize() + { + ShadowBolt_Timer = 0; + Blizzard_Timer = urand(15000, 20000); + ArcaneBurst_Timer = 1000; + Scorpions_Timer = urand(7000, 14000); + } uint32 ShadowBolt_Timer; uint32 Blizzard_Timer; uint32 ArcaneBurst_Timer; uint32 Scorpions_Timer; - int Rand; - int RandX; - int RandY; Creature* Summoned; void Reset() override { TwinReset(); - ShadowBolt_Timer = 0; - Blizzard_Timer = urand(15000, 20000); - ArcaneBurst_Timer = 1000; - Scorpions_Timer = urand(7000, 14000); + Initialize(); //Added. Can be removed if its included in DB. me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp index a9ec3007e5d..7f223f21269 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp @@ -91,15 +91,23 @@ class boss_viscidus : public CreatureScript struct boss_viscidusAI : public BossAI { - boss_viscidusAI(Creature* creature) : BossAI(creature, DATA_VISCIDUS) { } + boss_viscidusAI(Creature* creature) : BossAI(creature, DATA_VISCIDUS) + { + Initialize(); + } - void Reset() override + void Initialize() { - _Reset(); _hitcounter = 0; _phase = PHASE_FROST; } + void Reset() override + { + _Reset(); + Initialize(); + } + void DamageTaken(Unit* attacker, uint32& /*damage*/) override { if (_phase != PHASE_MELEE) diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp index a0d57481c75..b8f6c0ed80e 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp @@ -92,8 +92,15 @@ public: aqsentinelAI(Creature* creature) : ScriptedAI(creature) { - ClearBuddyList(); + Initialize(); abselected = 0; // just initialization of variable + ability = 0; + } + + void Initialize() + { + ClearBuddyList(); + gatherOthersWhenAggro = true; } uint64 NearbyGUID[3]; @@ -183,8 +190,8 @@ public: void GetOtherSentinels(Unit* who) { - bool *chosenAbilities = new bool[9]; - memset(chosenAbilities, 0, 9*sizeof(bool)); + bool chosenAbilities[9]; + memset(chosenAbilities, 0, sizeof(chosenAbilities)); selectAbility(pickAbilityRandom(chosenAbilities)); ClearBuddyList(); @@ -207,8 +214,6 @@ public: DoYell("I dont have enough buddies.", LANG_NEUTRAL, 0);*/ SendMyListToBuddies(); CallBuddiesToAttack(who); - - delete[] chosenAbilities; } bool gatherOthersWhenAggro; @@ -228,8 +233,7 @@ public: } } } - ClearBuddyList(); - gatherOthersWhenAggro = true; + Initialize(); } void GainSentinelAbility(uint32 id) diff --git a/src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp b/src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp index f0035cc921c..4a2425d879f 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp @@ -59,16 +59,24 @@ public: struct boss_zum_rahAI : public BossAI { - boss_zum_rahAI(Creature* creature) : BossAI(creature, DATA_ZUM_RAH) { } + boss_zum_rahAI(Creature* creature) : BossAI(creature, DATA_ZUM_RAH) + { + Initialize(); + } - void Reset() override + void Initialize() { - me->setFaction(ZUMRAH_FRIENDLY_FACTION); // areatrigger sets faction to enemy _ward80 = false; _ward40 = false; _heal30 = false; } + void Reset() override + { + me->setFaction(ZUMRAH_FRIENDLY_FACTION); // areatrigger sets faction to enemy + Initialize(); + } + void EnterCombat(Unit* /*who*/) override { Talk(SAY_SANCT_INVADE); diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp index 7c02ecdb8f2..47d269a00ff 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp @@ -104,8 +104,17 @@ public: { npc_sergeant_blyAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); postGossipStep = 0; + Text_Timer = 0; + PlayerGUID = 0; + } + + void Initialize() + { + ShieldBash_Timer = 5000; + Revenge_Timer = 8000; } InstanceScript* instance; @@ -118,8 +127,7 @@ public: void Reset() override { - ShieldBash_Timer = 5000; - Revenge_Timer = 8000; + Initialize(); me->setFaction(FACTION_FRIENDLY); } diff --git a/src/server/scripts/Kalimdor/boss_azuregos.cpp b/src/server/scripts/Kalimdor/boss_azuregos.cpp index db41213e94e..df0c9a9c16c 100644 --- a/src/server/scripts/Kalimdor/boss_azuregos.cpp +++ b/src/server/scripts/Kalimdor/boss_azuregos.cpp @@ -58,7 +58,10 @@ class boss_azuregos : public CreatureScript struct boss_azuregosAI : public WorldBossAI { - boss_azuregosAI(Creature* creature) : WorldBossAI(creature) { } + boss_azuregosAI(Creature* creature) : WorldBossAI(creature) + { + _enraged = false; + } void Reset() override { diff --git a/src/server/scripts/Kalimdor/zone_ashenvale.cpp b/src/server/scripts/Kalimdor/zone_ashenvale.cpp index 2b8dbdaab6c..500739b9404 100644 --- a/src/server/scripts/Kalimdor/zone_ashenvale.cpp +++ b/src/server/scripts/Kalimdor/zone_ashenvale.cpp @@ -61,13 +61,21 @@ public: struct npc_torekAI : public npc_escortAI { - npc_torekAI(Creature* creature) : npc_escortAI(creature) { } + npc_torekAI(Creature* creature) : npc_escortAI(creature) + { + Initialize(); + } - void Reset() override + void Initialize() { - rend_Timer = 5000; + rend_Timer = 5000; thunderclap_Timer = 8000; - _completed = false; + _completed = false; + } + + void Reset() override + { + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -298,15 +306,23 @@ public: struct npc_muglashAI : public npc_escortAI { - npc_muglashAI(Creature* creature) : npc_escortAI(creature) { } + npc_muglashAI(Creature* creature) : npc_escortAI(creature) + { + Initialize(); + } - void Reset() override + void Initialize() { eventTimer = 10000; waveId = 0; _isBrazierExtinguished = false; } + void Reset() override + { + Initialize(); + } + void EnterCombat(Unit* /*who*/) override { if (Player* player = GetPlayerForEscort()) diff --git a/src/server/scripts/Kalimdor/zone_azshara.cpp b/src/server/scripts/Kalimdor/zone_azshara.cpp index e62e17593ba..cec94617454 100644 --- a/src/server/scripts/Kalimdor/zone_azshara.cpp +++ b/src/server/scripts/Kalimdor/zone_azshara.cpp @@ -58,15 +58,23 @@ public: struct npc_spitelashesAI : public ScriptedAI { - npc_spitelashesAI(Creature* creature) : ScriptedAI(creature) { } + npc_spitelashesAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + morphtimer = 0; + spellhit = false; + } uint32 morphtimer; bool spellhit; void Reset() override { - morphtimer = 0; - spellhit = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -292,9 +300,12 @@ public: struct npc_rizzle_sprysprocketAI : public ScriptedAI { - npc_rizzle_sprysprocketAI(Creature* creature) : ScriptedAI(creature) { } + npc_rizzle_sprysprocketAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } - void Reset() override + void Initialize() { SpellEscapeTimer = 1300; TeleportTimer = 3500; @@ -311,6 +322,11 @@ public: Reached = false; } + void Reset() override + { + Initialize(); + } + void EnterCombat(Unit* /*who*/) override { } void AttackStart(Unit* who) override @@ -475,7 +491,16 @@ public: struct npc_depth_chargeAI : public ScriptedAI { - npc_depth_chargeAI(Creature* creature) : ScriptedAI(creature) { } + npc_depth_chargeAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + WeMustDie = false; + WeMustDieTimer = 1000; + } bool WeMustDie; uint32 WeMustDieTimer; @@ -485,8 +510,7 @@ public: me->SetHover(true); me->SetSwim(true); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - WeMustDie = false; - WeMustDieTimer = 1000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp index 6f02752d2fb..e6869dbf0f5 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -61,7 +61,21 @@ public: struct npc_draenei_survivorAI : public ScriptedAI { - npc_draenei_survivorAI(Creature* creature) : ScriptedAI(creature) { } + npc_draenei_survivorAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + pCaster = 0; + + SayThanksTimer = 0; + RunAwayTimer = 0; + SayHelpTimer = 10000; + + CanSayHelp = true; + } uint64 pCaster; @@ -73,13 +87,7 @@ public: void Reset() override { - pCaster = 0; - - SayThanksTimer = 0; - RunAwayTimer = 0; - SayHelpTimer = 10000; - - CanSayHelp = true; + Initialize(); DoCast(me, SPELL_IRRIDATION, true); @@ -193,22 +201,28 @@ public: { npc_engineer_spark_overgrindAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); NormFaction = creature->getFaction(); NpcFlags = creature->GetUInt32Value(UNIT_NPC_FLAGS); + } - if (creature->GetAreaId() == AREA_COVE || creature->GetAreaId() == AREA_ISLE) + void Initialize() + { + DynamiteTimer = 8000; + EmoteTimer = urand(120000, 150000); + + if (me->GetAreaId() == AREA_COVE || me->GetAreaId() == AREA_ISLE) IsTreeEvent = true; + else + IsTreeEvent = false; } void Reset() override { - DynamiteTimer = 8000; - EmoteTimer = urand(120000, 150000); + Initialize(); me->setFaction(NormFaction); me->SetUInt32Value(UNIT_NPC_FLAGS, NpcFlags); - - IsTreeEvent = false; } void EnterCombat(Unit* who) override @@ -410,7 +424,18 @@ public: struct npc_geezleAI : public ScriptedAI { - npc_geezleAI(Creature* creature) : ScriptedAI(creature) { } + npc_geezleAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + SparkGUID = 0; + Step = 0; + EventStarted = false; + SayTimer = 0; + } uint64 SparkGUID; @@ -421,8 +446,7 @@ public: void Reset() override { - SparkGUID = 0; - Step = 0; + Initialize(); StartEvent(); } @@ -582,15 +606,23 @@ public: struct npc_death_ravagerAI : public ScriptedAI { - npc_death_ravagerAI(Creature* creature) : ScriptedAI(creature){ } + npc_death_ravagerAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + RendTimer = 30000; + EnragingBiteTimer = 20000; + } uint32 RendTimer; uint32 EnragingBiteTimer; void Reset() override { - RendTimer = 30000; - EnragingBiteTimer = 20000; + Initialize(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetReactState(REACT_PASSIVE); @@ -648,7 +680,16 @@ class npc_stillpine_capitive : public CreatureScript struct npc_stillpine_capitiveAI : public ScriptedAI { - npc_stillpine_capitiveAI(Creature* creature) : ScriptedAI(creature) { } + npc_stillpine_capitiveAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + _playerGUID = 0; + _movementComplete = false; + } void Reset() override { @@ -658,8 +699,7 @@ class npc_stillpine_capitive : public CreatureScript cage->SetGoState(GO_STATE_READY); } _events.Reset(); - _player = NULL; - _movementComplete = false; + Initialize(); } void StartMoving(Player* owner) @@ -667,7 +707,7 @@ class npc_stillpine_capitive : public CreatureScript if (owner) { Talk(CAPITIVE_SAY, owner); - _player = owner; + _playerGUID = owner->GetGUID(); } Position pos = me->GetNearPosition(3.0f, 0.0f); me->GetMotionMaster()->MovePoint(POINT_INIT, pos); @@ -678,7 +718,7 @@ class npc_stillpine_capitive : public CreatureScript if (type != POINT_MOTION_TYPE || id != POINT_INIT) return; - if (_player) + if (Player* _player = ObjectAccessor::GetPlayer(*me, _playerGUID)) _player->KilledMonsterCredit(me->GetEntry(), me->GetGUID()); _movementComplete = true; @@ -697,7 +737,7 @@ class npc_stillpine_capitive : public CreatureScript } private: - Player* _player; + uint64 _playerGUID; EventMap _events; bool _movementComplete; }; diff --git a/src/server/scripts/Kalimdor/zone_darkshore.cpp b/src/server/scripts/Kalimdor/zone_darkshore.cpp index 43a533ada01..22c619f9a90 100644 --- a/src/server/scripts/Kalimdor/zone_darkshore.cpp +++ b/src/server/scripts/Kalimdor/zone_darkshore.cpp @@ -65,13 +65,21 @@ public: struct npc_kerlonianAI : public FollowerAI { - npc_kerlonianAI(Creature* creature) : FollowerAI(creature) { } + npc_kerlonianAI(Creature* creature) : FollowerAI(creature) + { + Initialize(); + } + + void Initialize() + { + FallAsleepTimer = urand(10000, 45000); + } uint32 FallAsleepTimer; void Reset() override { - FallAsleepTimer = urand(10000, 45000); + Initialize(); } void MoveInLineOfSight(Unit* who) override diff --git a/src/server/scripts/Kalimdor/zone_durotar.cpp b/src/server/scripts/Kalimdor/zone_durotar.cpp index a1df70522a8..e2f8dd0854d 100644 --- a/src/server/scripts/Kalimdor/zone_durotar.cpp +++ b/src/server/scripts/Kalimdor/zone_durotar.cpp @@ -51,7 +51,17 @@ public: struct npc_lazy_peonAI : public ScriptedAI { - npc_lazy_peonAI(Creature* creature) : ScriptedAI(creature) { } + npc_lazy_peonAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + PlayerGUID = 0; + RebuffTimer = 0; + work = false; + } uint64 PlayerGUID; @@ -60,9 +70,7 @@ public: void Reset() override { - PlayerGUID = 0; - RebuffTimer = 0; - work = false; + Initialize(); } void MovementInform(uint32 /*type*/, uint32 id) override @@ -360,6 +368,13 @@ class npc_troll_volunteer : public CreatureScript { npc_troll_volunteerAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); + _mountModel = 0; + } + + void Initialize() + { + _complete = false; } void InitializeAI() override @@ -391,7 +406,7 @@ class npc_troll_volunteer : public CreatureScript void Reset() override { - _complete = false; + Initialize(); me->AddAura(SPELL_VOLUNTEER_AURA, me); me->AddAura(SPELL_MOUNTING_CHECK, me); DoCast(me, SPELL_PETACT_AURA); diff --git a/src/server/scripts/Kalimdor/zone_moonglade.cpp b/src/server/scripts/Kalimdor/zone_moonglade.cpp index 0c07d5dc6df..268db8da779 100644 --- a/src/server/scripts/Kalimdor/zone_moonglade.cpp +++ b/src/server/scripts/Kalimdor/zone_moonglade.cpp @@ -298,9 +298,20 @@ public: public: npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature) { + Initialize(); PlayerGUID = 0; } + void Initialize() + { + Step = 0; + CurrWP = 0; + EventTimer = 0; + PlayerGUID = 0; + checkPlayerTimer = 1000; + EventOnWait = false; + } + uint8 Step; uint32 CurrWP; uint32 EventTimer; @@ -313,14 +324,7 @@ public: void Reset() override { if (!PlayerGUID) - { - Step = 0; - CurrWP = 0; - EventTimer = 0; - PlayerGUID = 0; - checkPlayerTimer = 1000; - EventOnWait = false; - } + Initialize(); } void IsSummonedBy(Unit* /*summoner*/) override diff --git a/src/server/scripts/Kalimdor/zone_mulgore.cpp b/src/server/scripts/Kalimdor/zone_mulgore.cpp index fa35371f3f2..289d7282ac6 100644 --- a/src/server/scripts/Kalimdor/zone_mulgore.cpp +++ b/src/server/scripts/Kalimdor/zone_mulgore.cpp @@ -62,7 +62,19 @@ public: struct npc_kyle_frenziedAI : public ScriptedAI { - npc_kyle_frenziedAI(Creature* creature) : ScriptedAI(creature) { } + npc_kyle_frenziedAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + EventActive = false; + IsMovingToLunch = false; + PlayerGUID = 0; + EventTimer = 5000; + EventPhase = 0; + } bool EventActive; bool IsMovingToLunch; @@ -72,11 +84,7 @@ public: void Reset() override { - EventActive = false; - IsMovingToLunch = false; - PlayerGUID = 0; - EventTimer = 5000; - EventPhase = 0; + Initialize(); if (me->GetEntry() == NPC_KYLE_FRIENDLY) me->UpdateEntry(NPC_KYLE_FRENZIED); @@ -235,7 +243,17 @@ public: struct npc_plains_visionAI : public ScriptedAI { - npc_plains_visionAI(Creature* creature) : ScriptedAI(creature) { } + npc_plains_visionAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + WayPointId = 0; + newWaypoint = true; + amountWP = 49; + } bool newWaypoint; uint8 WayPointId; @@ -243,9 +261,7 @@ public: void Reset() override { - WayPointId = 0; - newWaypoint = true; - amountWP = 49; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp index 5ae50ff7c8e..fd666b7fcd7 100644 --- a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp +++ b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp @@ -64,7 +64,19 @@ public: struct npc_shenthulAI : public ScriptedAI { - npc_shenthulAI(Creature* creature) : ScriptedAI(creature) { } + npc_shenthulAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + CanTalk = false; + CanEmote = false; + SaluteTimer = 6000; + ResetTimer = 0; + PlayerGUID = 0; + } bool CanTalk; bool CanEmote; @@ -74,11 +86,7 @@ public: void Reset() override { - CanTalk = false; - CanEmote = false; - SaluteTimer = 6000; - ResetTimer = 0; - PlayerGUID = 0; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -211,15 +219,23 @@ public: struct npc_thrall_warchiefAI : public ScriptedAI { - npc_thrall_warchiefAI(Creature* creature) : ScriptedAI(creature) { } + npc_thrall_warchiefAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + ChainLightningTimer = 2000; + ShockTimer = 8000; + } uint32 ChainLightningTimer; uint32 ShockTimer; void Reset() override { - ChainLightningTimer = 2000; - ShockTimer = 8000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index 3ddf97c164d..55f36779145 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -422,7 +422,23 @@ public: struct npc_anachronos_the_ancientAI : public ScriptedAI { - npc_anachronos_the_ancientAI(Creature* creature) : ScriptedAI(creature) { } + npc_anachronos_the_ancientAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + AnimationTimer = 1500; + AnimationCount = 0; + AnachronosQuestTriggerGUID = 0; + MerithraGUID = 0; + ArygosGUID = 0; + CaelestraszGUID = 0; + FandralGUID = 0; + PlayerGUID = 0; + eventEnd = false; + } uint32 AnimationTimer; uint8 AnimationCount; @@ -437,15 +453,7 @@ public: void Reset() override { - AnimationTimer = 1500; - AnimationCount = 0; - AnachronosQuestTriggerGUID = 0; - MerithraGUID = 0; - ArygosGUID = 0; - CaelestraszGUID = 0; - FandralGUID = 0; - PlayerGUID = 0; - eventEnd = false; + Initialize(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -750,7 +758,22 @@ public: struct npc_qiraj_war_spawnAI : public ScriptedAI { - npc_qiraj_war_spawnAI(Creature* creature) : ScriptedAI(creature) { } + npc_qiraj_war_spawnAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + SpellTimer1 = 0; + SpellTimer2 = 0; + SpellTimer3 = 0; + SpellTimer4 = 0; + } + + void Initialize() + { + MobGUID = 0; + PlayerGUID = 0; + Timers = false; + hasTarget = false; + } uint64 MobGUID; uint64 PlayerGUID; @@ -760,10 +783,7 @@ public: void Reset() override { - MobGUID = 0; - PlayerGUID = 0; - Timers = false; - hasTarget = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -863,7 +883,24 @@ public: struct npc_anachronos_quest_triggerAI : public ScriptedAI { - npc_anachronos_quest_triggerAI(Creature* creature) : ScriptedAI(creature) { } + npc_anachronos_quest_triggerAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + PlayerGUID = 0; + + WaveTimer = 2000; + AnnounceTimer = 1000; + LiveCount = 0; + WaveCount = 0; + + EventStarted = false; + Announced = false; + Failed = false; + } uint64 PlayerGUID; @@ -879,16 +916,7 @@ public: void Reset() override { - PlayerGUID = 0; - - WaveTimer = 2000; - AnnounceTimer = 1000; - LiveCount = 0; - WaveCount = 0; - - EventStarted = false; - Announced = false; - Failed = false; + Initialize(); me->SetVisible(false); } diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp index 23e8e2f26ff..fce0608faaf 100644 --- a/src/server/scripts/Kalimdor/zone_tanaris.cpp +++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp @@ -64,7 +64,21 @@ public: struct npc_aquementasAI : public ScriptedAI { - npc_aquementasAI(Creature* creature) : ScriptedAI(creature) { } + npc_aquementasAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + SendItemTimer = 0; + SwitchFactionTimer = 10000; + + isFriendly = true; + + AquaJetTimer = 5000; + FrostShockTimer = 1000; + } uint32 SendItemTimer; uint32 SwitchFactionTimer; @@ -75,13 +89,8 @@ public: void Reset() override { - SendItemTimer = 0; - SwitchFactionTimer = 10000; + Initialize(); me->setFaction(35); - isFriendly = true; - - AquaJetTimer = 5000; - FrostShockTimer = 1000; } void SendItem(Unit* receiver) @@ -526,7 +535,19 @@ public: struct npc_toogaAI : public FollowerAI { - npc_toogaAI(Creature* creature) : FollowerAI(creature) { } + npc_toogaAI(Creature* creature) : FollowerAI(creature) + { + Initialize(); + } + + void Initialize() + { + CheckSpeechTimer = 2500; + PostEventTimer = 1000; + PhasePostEvent = 0; + + TortaGUID = 0; + } uint32 CheckSpeechTimer; uint32 PostEventTimer; @@ -536,11 +557,7 @@ public: void Reset() override { - CheckSpeechTimer = 2500; - PostEventTimer = 1000; - PhasePostEvent = 0; - - TortaGUID = 0; + Initialize(); } void MoveInLineOfSight(Unit* who) override diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp index b158422054f..ced964048c2 100644 --- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp +++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp @@ -200,9 +200,17 @@ public: { npc_taskmaster_fizzuleAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); factionNorm = creature->getFaction(); } + void Initialize() + { + IsFriend = false; + ResetTimer = 120000; + FlareCount = 0; + } + uint32 factionNorm; bool IsFriend; uint32 ResetTimer; @@ -210,9 +218,7 @@ public: void Reset() override { - IsFriend = false; - ResetTimer = 120000; - FlareCount = 0; + Initialize(); me->setFaction(factionNorm); } @@ -314,20 +320,12 @@ public: struct npc_twiggy_flatheadAI : public ScriptedAI { - npc_twiggy_flatheadAI(Creature* creature) : ScriptedAI(creature) { } - - bool EventInProgress; - bool EventGrate; - bool EventBigWill; - bool ChallengerDown[6]; - uint8 Wave; - uint32 WaveTimer; - uint32 ChallengerChecker; - uint64 PlayerGUID; - uint64 AffrayChallenger[6]; - uint64 BigWill; + npc_twiggy_flatheadAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } - void Reset() override + void Initialize() { EventInProgress = false; EventGrate = false; @@ -345,6 +343,22 @@ public: BigWill = 0; } + bool EventInProgress; + bool EventGrate; + bool EventBigWill; + bool ChallengerDown[6]; + uint8 Wave; + uint32 WaveTimer; + uint32 ChallengerChecker; + uint64 PlayerGUID; + uint64 AffrayChallenger[6]; + uint64 BigWill; + + void Reset() override + { + Initialize(); + } + void MoveInLineOfSight(Unit* who) override { if (!who || !who->IsAlive() || EventInProgress) diff --git a/src/server/scripts/Kalimdor/zone_thousand_needles.cpp b/src/server/scripts/Kalimdor/zone_thousand_needles.cpp index b36037d9995..9092d4e06e5 100644 --- a/src/server/scripts/Kalimdor/zone_thousand_needles.cpp +++ b/src/server/scripts/Kalimdor/zone_thousand_needles.cpp @@ -324,14 +324,23 @@ public: struct npc_pluckyAI : public ScriptedAI { - npc_pluckyAI(Creature* creature) : ScriptedAI(creature) { NormFaction = creature->getFaction(); } + npc_pluckyAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + NormFaction = creature->getFaction(); + } + + void Initialize() + { + ResetTimer = 120000; + } uint32 NormFaction; uint32 ResetTimer; void Reset() override { - ResetTimer = 120000; + Initialize(); if (me->getFaction() != NormFaction) me->setFaction(NormFaction); diff --git a/src/server/scripts/Kalimdor/zone_thunder_bluff.cpp b/src/server/scripts/Kalimdor/zone_thunder_bluff.cpp index 3b303ffa463..40b68270c9d 100644 --- a/src/server/scripts/Kalimdor/zone_thunder_bluff.cpp +++ b/src/server/scripts/Kalimdor/zone_thunder_bluff.cpp @@ -79,7 +79,19 @@ public: struct npc_cairne_bloodhoofAI : public ScriptedAI { - npc_cairne_bloodhoofAI(Creature* creature) : ScriptedAI(creature) { } + npc_cairne_bloodhoofAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + BerserkerChargeTimer = 30000; + CleaveTimer = 5000; + MortalStrikeTimer = 10000; + ThunderclapTimer = 15000; + UppercutTimer = 10000; + } uint32 BerserkerChargeTimer; uint32 CleaveTimer; @@ -89,11 +101,7 @@ public: void Reset() override { - BerserkerChargeTimer = 30000; - CleaveTimer = 5000; - MortalStrikeTimer = 10000; - ThunderclapTimer = 15000; - UppercutTimer = 10000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp b/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp index a1e4467e9fb..ea4c743b8a5 100644 --- a/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp +++ b/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp @@ -77,7 +77,15 @@ public: struct npc_ameAI : public npc_escortAI { - npc_ameAI(Creature* creature) : npc_escortAI(creature) { } + npc_ameAI(Creature* creature) : npc_escortAI(creature) + { + Initialize(); + } + + void Initialize() + { + DemoralizingShoutTimer = 5000; + } uint32 DemoralizingShoutTimer; @@ -112,7 +120,7 @@ public: void Reset() override { - DemoralizingShoutTimer = 5000; + Initialize(); } void JustSummoned(Creature* summoned) override @@ -194,7 +202,18 @@ public: struct npc_ringoAI : public FollowerAI { - npc_ringoAI(Creature* creature) : FollowerAI(creature) { } + npc_ringoAI(Creature* creature) : FollowerAI(creature) + { + Initialize(); + } + + void Initialize() + { + FaintTimer = urand(30000, 60000); + EndEventProgress = 0; + EndEventTimer = 1000; + SpraggleGUID = 0; + } uint32 FaintTimer; uint32 EndEventProgress; @@ -204,10 +223,7 @@ public: void Reset() override { - FaintTimer = urand(30000, 60000); - EndEventProgress = 0; - EndEventTimer = 1000; - SpraggleGUID = 0; + Initialize(); } void MoveInLineOfSight(Unit* who) override diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp index 11b720ad8d5..58d9b115398 100644 --- a/src/server/scripts/Kalimdor/zone_winterspring.cpp +++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp @@ -317,7 +317,17 @@ public: npc_ranshallaAI(Creature* creature) : npc_escortAI(creature), DialogueHelper(introDialogue) { - Reset(); + Initialize(); + _firstPriestessGUID = 0; + _secondPriestessGUID = 0; + _guardEluneGUID = 0; + _voiceEluneGUID = 0; + _altarGUID = 0; + } + + void Initialize() + { + _delayTimer = 0; } uint32 _delayTimer; @@ -330,7 +340,7 @@ public: void Reset() override { - _delayTimer = 0; + Initialize(); } // Called when the player activates the torch / altar diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp index d4dc5efb6d5..79449723a16 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp @@ -61,15 +61,23 @@ class boss_elder_nadox : public CreatureScript struct boss_elder_nadoxAI : public BossAI { - boss_elder_nadoxAI(Creature* creature) : BossAI(creature, DATA_ELDER_NADOX) { } + boss_elder_nadoxAI(Creature* creature) : BossAI(creature, DATA_ELDER_NADOX) + { + Initialize(); + } - void Reset() override + void Initialize() { - _Reset(); GuardianSummoned = false; GuardianDied = false; } + void Reset() override + { + _Reset(); + Initialize(); + } + void EnterCombat(Unit* /*who*/) override { _EnterCombat(); diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp index 1c042f4d185..b200a4e9825 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp @@ -63,9 +63,19 @@ public: { boss_volazjAI(Creature* creature) : ScriptedAI(creature), Summons(me) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + uiMindFlayTimer = 8 * IN_MILLISECONDS; + uiShadowBoltVolleyTimer = 5 * IN_MILLISECONDS; + uiShiverTimer = 15 * IN_MILLISECONDS; + // Used for Insanity handling + insanityHandled = 0; + } + InstanceScript* instance; uint32 uiMindFlayTimer; @@ -145,17 +155,13 @@ public: void Reset() override { - uiMindFlayTimer = 8*IN_MILLISECONDS; - uiShadowBoltVolleyTimer = 5*IN_MILLISECONDS; - uiShiverTimer = 15*IN_MILLISECONDS; + Initialize(); instance->SetBossState(DATA_HERALD_VOLAZJ, NOT_STARTED); instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_QUICK_DEMISE_START_EVENT); // Visible for all players in insanity me->SetPhaseMask((1|16|32|64|128|256), true); - // Used for Insanity handling - insanityHandled = 0; ResetPlayersPhaseMask(); 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 905761ce359..7ae8730d57b 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp @@ -64,11 +64,27 @@ public: { boss_jedoga_shadowseekerAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); bFirstTime = true; bPreDone = false; } + void Initialize() + { + uiOpFerTimer = urand(15 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); + + uiCycloneTimer = 3 * IN_MILLISECONDS; + uiBoltTimer = 7 * IN_MILLISECONDS; + uiThunderTimer = 12 * IN_MILLISECONDS; + + bOpFerok = false; + bOpFerokFail = false; + bOnGround = false; + bCanDown = false; + volunteerWork = true; + } + InstanceScript* instance; uint32 uiOpFerTimer; @@ -86,17 +102,7 @@ public: void Reset() override { - uiOpFerTimer = urand(15*IN_MILLISECONDS, 20*IN_MILLISECONDS); - - uiCycloneTimer = 3*IN_MILLISECONDS; - uiBoltTimer = 7*IN_MILLISECONDS; - uiThunderTimer = 12*IN_MILLISECONDS; - - bOpFerok = false; - bOpFerokFail = false; - bOnGround = false; - bCanDown = false; - volunteerWork = true; + Initialize(); if (!bFirstTime) instance->SetBossState(DATA_JEDOGA_SHADOWSEEKER, FAIL); @@ -331,9 +337,16 @@ public: { npc_jedoga_initiandAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + bWalking = false; + bCheckTimer = 2 * IN_MILLISECONDS; + } + InstanceScript* instance; uint32 bCheckTimer; @@ -342,8 +355,7 @@ public: void Reset() override { - bWalking = false; - bCheckTimer = 2*IN_MILLISECONDS; + Initialize(); if (instance->GetBossState(DATA_JEDOGA_SHADOWSEEKER) != IN_PROGRESS) { diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index bf5855c3318..49d0840f08a 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -87,7 +87,29 @@ public: { boss_anub_arakAI(Creature* creature) : ScriptedAI(creature), Summons(me) { + Initialize(); instance = creature->GetInstanceScript(); + GuardianSummoned = false; + VenomancerSummoned = false; + DatterSummoned = false; + UndergroundTimer = 0; + VenomancerTimer = 0; + DatterTimer = 0; + DelayTimer = 0; + ImpaleTarget = 0; + } + + void Initialize() + { + CarrionBeetlesTimer = 8 * IN_MILLISECONDS; + LeechingSwarmTimer = 20 * IN_MILLISECONDS; + ImpaleTimer = 9 * IN_MILLISECONDS; + PoundTimer = 15 * IN_MILLISECONDS; + + Phase = PHASE_MELEE; + UndergroundPhase = 0; + Channeling = false; + ImpalePhase = IMPALE_PHASE_TARGET; } InstanceScript* instance; @@ -101,7 +123,6 @@ public: uint32 CarrionBeetlesTimer; uint32 LeechingSwarmTimer; uint32 PoundTimer; - uint32 SubmergeTimer; uint32 UndergroundTimer; uint32 VenomancerTimer; uint32 DatterTimer; @@ -115,15 +136,7 @@ public: void Reset() override { - CarrionBeetlesTimer = 8*IN_MILLISECONDS; - LeechingSwarmTimer = 20*IN_MILLISECONDS; - ImpaleTimer = 9*IN_MILLISECONDS; - PoundTimer = 15*IN_MILLISECONDS; - - Phase = PHASE_MELEE; - UndergroundPhase = 0; - Channeling = false; - ImpalePhase = IMPALE_PHASE_TARGET; + Initialize(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); me->RemoveAura(SPELL_SUBMERGE); diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp index 10d34be46b6..f8c5c63cf91 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp @@ -54,11 +54,22 @@ public: { boss_hadronoxAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); fMaxDistance = 50.0f; bFirstTime = true; } + void Initialize() + { + uiAcidTimer = urand(10 * IN_MILLISECONDS, 14 * IN_MILLISECONDS); + uiLeechTimer = urand(3 * IN_MILLISECONDS, 9 * IN_MILLISECONDS); + uiPierceTimer = urand(1 * IN_MILLISECONDS, 3 * IN_MILLISECONDS); + uiGrabTimer = urand(15 * IN_MILLISECONDS, 19 * IN_MILLISECONDS); + uiDoorsTimer = urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS); + uiCheckDistanceTimer = 2 * IN_MILLISECONDS; + } + InstanceScript* instance; uint32 uiAcidTimer; @@ -77,12 +88,7 @@ public: me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 9.0f); me->SetFloatValue(UNIT_FIELD_COMBATREACH, 9.0f); - uiAcidTimer = urand(10*IN_MILLISECONDS, 14*IN_MILLISECONDS); - uiLeechTimer = urand(3*IN_MILLISECONDS, 9*IN_MILLISECONDS); - uiPierceTimer = urand(1*IN_MILLISECONDS, 3*IN_MILLISECONDS); - uiGrabTimer = urand(15*IN_MILLISECONDS, 19*IN_MILLISECONDS); - uiDoorsTimer = urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS); - uiCheckDistanceTimer = 2*IN_MILLISECONDS; + Initialize(); if (instance->GetBossState(DATA_HADRONOX) != DONE && !bFirstTime) instance->SetBossState(DATA_HADRONOX, FAIL); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index 4c3ca322574..77ced6acef1 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -130,14 +130,22 @@ public: struct boss_sartharionAI : public BossAI { - boss_sartharionAI(Creature* creature) : BossAI(creature, DATA_SARTHARION) { } + boss_sartharionAI(Creature* creature) : BossAI(creature, DATA_SARTHARION) + { + Initialize(); + } - void Reset() override + void Initialize() { - _isBerserk = false; + _isBerserk = false; _isSoftEnraged = false; _isHardEnraged = false; - drakeCount = 0; + drakeCount = 0; + } + + void Reset() override + { + Initialize(); if (me->HasAura(SPELL_TWILIGHT_REVENGE)) me->RemoveAurasDueToSpell(SPELL_TWILIGHT_REVENGE); diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp index b74c800c01b..1b903fad188 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp @@ -25,18 +25,26 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "mana_tombs.h" -enum Pandemonius +enum Texts { SAY_AGGRO = 0, SAY_KILL = 1, SAY_DEATH = 2, - EMOTE_DARK_SHELL = 3, + EMOTE_DARK_SHELL = 3 +}; - SPELL_VOID_BLAST = 32325, - H_SPELL_VOID_BLAST = 38760, - SPELL_DARK_SHELL = 32358, - H_SPELL_DARK_SHELL = 38759 +enum Spells +{ + SPELL_VOID_BLAST = 32325, + SPELL_DARK_SHELL = 32358 +}; + +enum Events +{ + EVENT_VOID_BLAST = 1, + EVENT_DARK_SHELL }; @@ -45,26 +53,17 @@ class boss_pandemonius : public CreatureScript public: boss_pandemonius() : CreatureScript("boss_pandemonius") { } - CreatureAI* GetAI(Creature* creature) const override + struct boss_pandemoniusAI : public BossAI { - return new boss_pandemoniusAI(creature); - } - - struct boss_pandemoniusAI : public ScriptedAI - { - boss_pandemoniusAI(Creature* creature) : ScriptedAI(creature) + boss_pandemoniusAI(Creature* creature) : BossAI(creature, DATA_PANDEMONIUS) { + VoidBlastCounter = 0; } - uint32 VoidBlast_Timer; - uint32 DarkShell_Timer; - uint32 VoidBlast_Counter; - void Reset() override { - VoidBlast_Timer = 8000 + rand32() % 15000; - DarkShell_Timer = 20000; - VoidBlast_Counter = 0; + _Reset(); + VoidBlastCounter = 0; } void JustDied(Unit* /*killer*/) override @@ -79,48 +78,54 @@ public: void EnterCombat(Unit* /*who*/) override { + _EnterCombat(); Talk(SAY_AGGRO); + events.ScheduleEvent(EVENT_DARK_SHELL, 20000); + events.ScheduleEvent(EVENT_VOID_BLAST, urand(8000, 23000)); } - void UpdateAI(uint32 diff) override + void ExecuteEvent(uint32 eventId) override { - if (!UpdateVictim()) - return; - - if (VoidBlast_Timer <= diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - DoCast(target, SPELL_VOID_BLAST); - VoidBlast_Timer = 500; - ++VoidBlast_Counter; - } - - if (VoidBlast_Counter == 5) - { - VoidBlast_Timer = 15000 + rand32() % 10000; - VoidBlast_Counter = 0; - } - } else VoidBlast_Timer -= diff; - - if (!VoidBlast_Counter) + switch (eventId) { - if (DarkShell_Timer <= diff) - { + case EVENT_VOID_BLAST: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + { + DoCast(target, SPELL_VOID_BLAST); + ++VoidBlastCounter; + } + + if (VoidBlastCounter == 5) + { + VoidBlastCounter = 0; + events.ScheduleEvent(EVENT_VOID_BLAST, urand(15000, 25000)); + } + else + { + events.ScheduleEvent(EVENT_VOID_BLAST, 500); + events.DelayEvents(EVENT_DARK_SHELL, 500); + } + break; + case EVENT_DARK_SHELL: if (me->IsNonMeleeSpellCast(false)) me->InterruptNonMeleeSpells(true); - Talk(EMOTE_DARK_SHELL); - DoCast(me, SPELL_DARK_SHELL); - DarkShell_Timer = 20000; - } else DarkShell_Timer -= diff; + events.ScheduleEvent(EVENT_DARK_SHELL, 20000); + break; + default: + break; } - - DoMeleeAttackIfReady(); } + + private: + uint32 VoidBlastCounter; }; + CreatureAI* GetAI(Creature* creature) const override + { + return GetManaTombsAI<boss_pandemoniusAI>(creature); + } }; void AddSC_boss_pandemonius() diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.h b/src/server/scripts/Outland/BlackTemple/black_temple.h index 4af561480be..c03c8b97d20 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.h +++ b/src/server/scripts/Outland/BlackTemple/black_temple.h @@ -65,12 +65,15 @@ enum CreatureIds NPC_ILLIDARI_COUNCIL = 23426, NPC_BLOOD_ELF_COUNCIL_VOICE = 23499, - NPC_ILLIDAN_STORMRAGE = 22917 + NPC_ILLIDAN_STORMRAGE = 22917, + + NPC_SUPREMUS_VOLCANO = 23085 }; enum GameObjectIds { GO_NAJENTUS_GATE = 185483, + GO_NAJENTUS_SPINE = 185584, GO_SUPREMUS_GATE = 185882, GO_SHADE_OF_AKAMA_DOOR = 185478, GO_TERON_DOOR_1 = 185480, diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp index 3415451fef5..6c3e820e10f 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * 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 @@ -19,7 +18,7 @@ /* ScriptData SDName: Boss_Mother_Shahraz SD%Complete: 80 -SDComment: Saber Lash missing, Fatal Attraction slightly incorrect; need to damage only if affected players are within range of each other +SDComment: Fatal Attraction slightly incorrect; need to damage only if affected players are within range of each other SDCategory: Black Temple EndScriptData */ @@ -27,17 +26,19 @@ EndScriptData */ #include "ScriptedCreature.h" #include "black_temple.h" -enum MotherShahraz +enum Texts { //Speech'n'Sounds - SAY_TAUNT = 0, - SAY_AGGRO = 1, - SAY_SPELL = 2, - SAY_SLAY = 3, - SAY_ENRAGE = 4, - SAY_DEATH = 5, + SAY_TAUNT = 0, + SAY_AGGRO = 1, + SAY_SPELL = 2, + SAY_SLAY = 3, + SAY_ENRAGE = 4, + SAY_DEATH = 5 +}; - //Spells +enum Spells +{ SPELL_BEAM_SINISTER = 40859, SPELL_BEAM_VILE = 40860, SPELL_BEAM_WICKED = 40861, @@ -51,6 +52,26 @@ enum MotherShahraz SPELL_BERSERK = 45078 }; +enum Events +{ + EVENT_RANDOM_BEAM = 1, + EVENT_PRISMATIC_SHIELD, + EVENT_FATAL_ATTRACTION, + EVENT_FATAL_ATTRACTION_EXPLOSION, + EVENT_SABER_SLASH, + EVENT_SILENCING_SHRIEK, + EVENT_RANDOM_TAUNT, + EVENT_BERSERK +}; + +enum Beams +{ + SINISTER_BEAM, + VILE_BEAM, + WICKED_BEAM, + SINFUL_BEAM +}; + uint32 PrismaticAuras[]= { 40880, // Shadow @@ -82,62 +103,41 @@ class boss_mother_shahraz : public CreatureScript public: boss_mother_shahraz() : CreatureScript("boss_mother_shahraz") { } - CreatureAI* GetAI(Creature* creature) const override + struct boss_shahrazAI : public BossAI { - return GetInstanceAI<boss_shahrazAI>(creature); - } - - struct boss_shahrazAI : public ScriptedAI - { - boss_shahrazAI(Creature* creature) : ScriptedAI(creature) + boss_shahrazAI(Creature* creature) : BossAI(creature, DATA_MOTHER_SHAHRAZ) { - instance = creature->GetInstanceScript(); + Initialize(); } - InstanceScript* instance; - - uint64 TargetGUID[3]; - uint32 BeamTimer; - uint32 BeamCount; - uint32 CurrentBeam; - uint32 PrismaticShieldTimer; - uint32 FatalAttractionTimer; - uint32 FatalAttractionExplodeTimer; - uint32 ShriekTimer; - uint32 SaberTimer; - uint32 RandomYellTimer; - uint32 EnrageTimer; - uint32 ExplosionCount; - - bool Enraged; - - void Reset() override + void Initialize() { - instance->SetBossState(DATA_MOTHER_SHAHRAZ, NOT_STARTED); - for (uint8 i = 0; i<3; ++i) TargetGUID[i] = 0; - BeamTimer = 20000; // Timers may be incorrect BeamCount = 0; - CurrentBeam = 0; // 0 - Sinister, 1 - Vile, 2 - Wicked, 3 - Sinful - PrismaticShieldTimer = 0; - FatalAttractionTimer = 60000; - FatalAttractionExplodeTimer = 70000; - ShriekTimer = 30000; - SaberTimer = 35000; - RandomYellTimer = urand(70, 111) * 1000; - EnrageTimer = 600000; + CurrentBeam = SINISTER_BEAM; // 0 - Sinister, 1 - Vile, 2 - Wicked, 3 - Sinful ExplosionCount = 0; - Enraged = false; } - void EnterCombat(Unit* /*who*/) override + void Reset() override { - instance->SetBossState(DATA_MOTHER_SHAHRAZ, IN_PROGRESS); + Initialize(); + _Reset(); + } - DoZoneInCombat(); + void EnterCombat(Unit* /*who*/) override + { + _EnterCombat(); + events.ScheduleEvent(EVENT_RANDOM_BEAM, 20000); // Timers may be incorrect + events.ScheduleEvent(EVENT_FATAL_ATTRACTION, 60000); + events.ScheduleEvent(EVENT_FATAL_ATTRACTION_EXPLOSION, 70000); + events.ScheduleEvent(EVENT_SILENCING_SHRIEK, 30000); + events.ScheduleEvent(EVENT_SABER_SLASH, 35000); + events.ScheduleEvent(EVENT_RANDOM_TAUNT, urand(70000, 111000)); + events.ScheduleEvent(EVENT_PRISMATIC_SHIELD, 1000); + events.ScheduleEvent(EVENT_BERSERK, 600000); Talk(SAY_AGGRO); } @@ -148,152 +148,136 @@ public: void JustDied(Unit* /*killer*/) override { - instance->SetBossState(DATA_MOTHER_SHAHRAZ, DONE); - + _JustDied(); Talk(SAY_DEATH); } void TeleportPlayers() { - uint32 random = rand32() % 7; + uint32 random = urand(0, 7); float X = TeleportPoint[random].x; float Y = TeleportPoint[random].y; float Z = TeleportPoint[random].z; for (uint8 i = 0; i < 3; ++i) { - Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 1); - if (unit && unit->IsAlive() && (unit->GetTypeId() == TYPEID_PLAYER)) - { - TargetGUID[i] = unit->GetGUID(); - unit->CastSpell(unit, SPELL_TELEPORT_VISUAL, true); - DoTeleportPlayer(unit, X, Y, Z, unit->GetOrientation()); - } + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 1)) + if (unit->IsAlive() && unit->GetTypeId() == TYPEID_PLAYER) + { + TargetGUID[i] = unit->GetGUID(); + unit->CastSpell(unit, SPELL_TELEPORT_VISUAL, true); + DoTeleportPlayer(unit, X, Y, Z, unit->GetOrientation()); + } } } - void UpdateAI(uint32 diff) override + void DamageTaken(Unit* /*attacker*/, uint32 &damage) override { - if (!UpdateVictim()) - return; - - if (HealthBelowPct(10) && !Enraged) + if (!Enraged && me->HealthBelowPctDamaged(10, damage)) { Enraged = true; DoCast(me, SPELL_ENRAGE, true); Talk(SAY_ENRAGE); } + } - //Randomly cast one beam. - if (BeamTimer <= diff) - { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (!target || !target->IsAlive()) - return; - - BeamTimer = 9000; - - switch (CurrentBeam) - { - case 0: - DoCast(target, SPELL_BEAM_SINISTER); - break; - case 1: - DoCast(target, SPELL_BEAM_VILE); - break; - case 2: - DoCast(target, SPELL_BEAM_WICKED); - break; - case 3: - DoCast(target, SPELL_BEAM_SINFUL); - break; - } - ++BeamCount; - uint32 Beam = CurrentBeam; - if (BeamCount > 3) - while (CurrentBeam == Beam) - CurrentBeam = rand32() % 3; - - } else BeamTimer -= diff; - - // Random Prismatic Shield every 15 seconds. - if (PrismaticShieldTimer <= diff) - { - uint32 random = rand32() % 6; - if (PrismaticAuras[random]) - DoCast(me, PrismaticAuras[random]); - PrismaticShieldTimer = 15000; - } else PrismaticShieldTimer -= diff; - - // Select 3 random targets (can select same target more than once), teleport to a random location then make them cast explosions until they get away from each other. - if (FatalAttractionTimer <= diff) - { - ExplosionCount = 0; - - TeleportPlayers(); - - Talk(SAY_SPELL); - FatalAttractionExplodeTimer = 2000; - FatalAttractionTimer = urand(40, 71) * 1000; - } else FatalAttractionTimer -= diff; - - if (FatalAttractionExplodeTimer <= diff) + void ExecuteEvent(uint32 eventId) override + { + switch (eventId) { - // Just make them explode three times... they're supposed to keep exploding while they are in range, but it'll take too much code. I'll try to think of an efficient way for it later. - if (ExplosionCount < 3) - { - for (uint8 i = 0; i < 3; ++i) + case EVENT_RANDOM_BEAM: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { - if (TargetGUID[i]) + switch (CurrentBeam) { - if (Unit* unit = ObjectAccessor::GetUnit(*me, TargetGUID[i])) - unit->CastSpell(unit, SPELL_ATTRACTION, true); - TargetGUID[i] = 0; + case SINISTER_BEAM: + DoCast(target, SPELL_BEAM_SINISTER); + break; + case VILE_BEAM: + DoCast(target, SPELL_BEAM_VILE); + break; + case WICKED_BEAM: + DoCast(target, SPELL_BEAM_WICKED); + break; + case SINFUL_BEAM: + DoCast(target, SPELL_BEAM_SINFUL); + break; + default: + break; } + + ++BeamCount; + uint32 Beam = CurrentBeam; + if (BeamCount > 3) + while (CurrentBeam == Beam) + CurrentBeam = urand(0, 3); } - - ++ExplosionCount; - FatalAttractionExplodeTimer = 1000; - } - else - { - FatalAttractionExplodeTimer = FatalAttractionTimer + 2000; + events.ScheduleEvent(EVENT_RANDOM_BEAM, 9000); + break; + case EVENT_PRISMATIC_SHIELD: + // Random Prismatic Shield every 15 seconds. + DoCast(me, PrismaticAuras[urand(0, 6)]); + events.ScheduleEvent(EVENT_PRISMATIC_SHIELD, 15000); + break; + case EVENT_FATAL_ATTRACTION: + // Select 3 random targets (can select same target more than once), teleport to a random location then make them cast explosions until they get away from each other. ExplosionCount = 0; - } - } else FatalAttractionExplodeTimer -= diff; - - if (ShriekTimer <= diff) - { - DoCastVictim(SPELL_SILENCING_SHRIEK); - ShriekTimer = 25000 + rand32() % 10 * 1000; - } else ShriekTimer -= diff; - - if (SaberTimer <= diff) - { - DoCastVictim(SPELL_SABER_LASH); - SaberTimer = 25000 + rand32() % 10 * 1000; - } else SaberTimer -= diff; - - //Enrage - if (!me->HasAura(SPELL_BERSERK)) - { - if (EnrageTimer <= diff) - { + TeleportPlayers(); + Talk(SAY_SPELL); + events.ScheduleEvent(EVENT_FATAL_ATTRACTION_EXPLOSION, 2000); + events.ScheduleEvent(EVENT_FATAL_ATTRACTION, 40000, 71000); + break; + case EVENT_FATAL_ATTRACTION_EXPLOSION: + // Just make them explode three times... they're supposed to keep exploding while they are in range, but it'll take too much code. I'll try to think of an efficient way for it later. + if (ExplosionCount < 3) + { + for (uint8 i = 0; i < 3; ++i) + { + if (TargetGUID[i]) + { + if (Unit* unit = ObjectAccessor::GetUnit(*me, TargetGUID[i])) + unit->CastSpell(unit, SPELL_ATTRACTION, true); + TargetGUID[i] = 0; + } + } + ++ExplosionCount; + } + else + ExplosionCount = 0; + events.ScheduleEvent(EVENT_FATAL_ATTRACTION_EXPLOSION, ExplosionCount < 3 ? 1000 : events.GetTimeUntilEvent(EVENT_FATAL_ATTRACTION) + 2000); + break; + case EVENT_SILENCING_SHRIEK: + DoCastVictim(SPELL_SILENCING_SHRIEK); + events.ScheduleEvent(EVENT_SILENCING_SHRIEK, urand(25000, 35000)); + break; + case EVENT_SABER_SLASH: + DoCastVictim(SPELL_SABER_LASH); + events.ScheduleEvent(EVENT_SABER_SLASH, urand(25000, 35000)); + break; + case EVENT_RANDOM_TAUNT: + Talk(SAY_TAUNT); + events.ScheduleEvent(EVENT_RANDOM_TAUNT, urand(60000, 151000)); + break; + case EVENT_BERSERK: DoCast(me, SPELL_BERSERK); Talk(SAY_ENRAGE); - } else EnrageTimer -= diff; + break; + default: + break; } - - //Random taunts - if (RandomYellTimer <= diff) - { - Talk(SAY_TAUNT); - RandomYellTimer = urand(60, 151) * 1000; - } else RandomYellTimer -= diff; - - DoMeleeAttackIfReady(); } + + private: + uint64 TargetGUID[3]; + uint32 BeamCount; + uint32 CurrentBeam; + uint32 ExplosionCount; + bool Enraged; }; + CreatureAI* GetAI(Creature* creature) const override + { + return GetBlackTempleAI<boss_shahrazAI>(creature); + } }; void AddSC_boss_mother_shahraz() diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp index a705659337f..b9b654f8b95 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * 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 @@ -16,46 +15,47 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_Supremus -SD%Complete: 95 -SDComment: Need to implement molten punch -SDCategory: Black Temple -EndScriptData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "PassiveAI.h" #include "black_temple.h" -enum Supremus +enum Texts { - EMOTE_NEW_TARGET = 0, - EMOTE_PUNCH_GROUND = 1, - EMOTE_GROUND_CRACK = 2, - - //Spells - SPELL_MOLTEN_PUNCH = 40126, - SPELL_HATEFUL_STRIKE = 41926, - SPELL_MOLTEN_FLAME = 40980, - SPELL_VOLCANIC_ERUPTION = 40117, - SPELL_VOLCANIC_SUMMON = 40276, - SPELL_BERSERK = 45078, + EMOTE_NEW_TARGET = 0, + EMOTE_PUNCH_GROUND = 1, + EMOTE_GROUND_CRACK = 2 +}; - CREATURE_VOLCANO = 23085, - CREATURE_STALKER = 23095, +enum Spells +{ + SPELL_MOLTEN_PUNCH = 40126, + SPELL_HATEFUL_STRIKE = 41926, + SPELL_MOLTEN_FLAME = 40980, + SPELL_VOLCANIC_ERUPTION = 40117, + SPELL_VOLCANIC_SUMMON = 40276, + SPELL_BERSERK = 45078 +}; - PHASE_STRIKE = 1, - PHASE_CHASE = 2, +enum Events +{ + EVENT_BERSERK = 1, + EVENT_SWITCH_PHASE, + EVENT_FLAME, + EVENT_VOLCANO, + EVENT_SWITCH_TARGET, + EVENT_HATEFUL_STRIKE +}; - EVENT_BERSERK = 1, - EVENT_SWITCH_PHASE = 2, - EVENT_FLAME = 3, - EVENT_VOLCANO = 4, - EVENT_SWITCH_TARGET = 5, - EVENT_HATEFUL_STRIKE = 6, +enum Phases +{ + PHASE_STRIKE = 1, + PHASE_CHASE = 2 +}; - GCD_CAST = 1 +enum EventGroups +{ + GCD_CAST = 1 }; class molten_flame : public CreatureScript @@ -88,38 +88,22 @@ class boss_supremus : public CreatureScript public: boss_supremus() : CreatureScript("boss_supremus") { } - CreatureAI* GetAI(Creature* creature) const override + struct boss_supremusAI : public BossAI { - return GetInstanceAI<boss_supremusAI>(creature); - } - - struct boss_supremusAI : public ScriptedAI - { - boss_supremusAI(Creature* creature) : ScriptedAI(creature), summons(me) + boss_supremusAI(Creature* creature) : BossAI(creature, DATA_SUPREMUS) { - instance = creature->GetInstanceScript(); + phase = 0; } - InstanceScript* instance; - EventMap events; - SummonList summons; - uint32 phase; - void Reset() override { - if (me->IsAlive()) - instance->SetBossState(DATA_SUPREMUS, NOT_STARTED); - + _Reset(); phase = 0; - - events.Reset(); - summons.DespawnAll(); } void EnterCombat(Unit* /*who*/) override { - instance->SetBossState(DATA_SUPREMUS, IN_PROGRESS); - + _EnterCombat(); ChangePhase(); events.ScheduleEvent(EVENT_BERSERK, 900000, GCD_CAST); events.ScheduleEvent(EVENT_FLAME, 20000, GCD_CAST); @@ -152,23 +136,6 @@ public: events.ScheduleEvent(EVENT_SWITCH_PHASE, 60000, GCD_CAST); } - void JustDied(Unit* /*killer*/) override - { - instance->SetBossState(DATA_SUPREMUS, DONE); - - summons.DespawnAll(); - } - - void JustSummoned(Creature* summon) override - { - summons.Summon(summon); - } - - void SummonedCreatureDespawn(Creature* summon) override - { - summons.Despawn(summon); - } - Unit* CalculateHatefulStrikeTarget() { uint32 health = 0; @@ -192,63 +159,59 @@ public: return target; } - void UpdateAI(uint32 diff) override + void ExecuteEvent(uint32 eventId) override { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + switch (eventId) { - switch (eventId) - { - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK, true); - break; - case EVENT_FLAME: - DoCast(me, SPELL_MOLTEN_PUNCH); - events.DelayEvents(1500, GCD_CAST); - events.ScheduleEvent(EVENT_FLAME, 20000, GCD_CAST); - break; - case EVENT_HATEFUL_STRIKE: - if (Unit* target = CalculateHatefulStrikeTarget()) - DoCast(target, SPELL_HATEFUL_STRIKE); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(EVENT_HATEFUL_STRIKE, 5000, GCD_CAST, PHASE_STRIKE); - break; - case EVENT_SWITCH_TARGET: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) - { - DoResetThreat(); - me->AddThreat(target, 5000000.0f); - Talk(EMOTE_NEW_TARGET); - } - events.ScheduleEvent(EVENT_SWITCH_TARGET, 10000, 0, PHASE_CHASE); - break; - case EVENT_VOLCANO: + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK, true); + break; + case EVENT_FLAME: + DoCast(me, SPELL_MOLTEN_PUNCH); + events.DelayEvents(1500, GCD_CAST); + events.ScheduleEvent(EVENT_FLAME, 20000, GCD_CAST); + break; + case EVENT_HATEFUL_STRIKE: + if (Unit* target = CalculateHatefulStrikeTarget()) + DoCast(target, SPELL_HATEFUL_STRIKE); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(EVENT_HATEFUL_STRIKE, 5000, GCD_CAST, PHASE_STRIKE); + break; + case EVENT_SWITCH_TARGET: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 999, true); - if (!target) target = me->GetVictim(); - if (target) - { - //DoCast(target, SPELL_VOLCANIC_SUMMON);//movement bugged - me->SummonCreature(CREATURE_VOLCANO, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000); - Talk(EMOTE_GROUND_CRACK); - events.DelayEvents(1500, GCD_CAST); - } - events.ScheduleEvent(EVENT_VOLCANO, 10000, GCD_CAST, PHASE_CHASE); - return; + DoResetThreat(); + me->AddThreat(target, 5000000.0f); + Talk(EMOTE_NEW_TARGET); } - case EVENT_SWITCH_PHASE: - ChangePhase(); - break; - } + events.ScheduleEvent(EVENT_SWITCH_TARGET, 10000, 0, PHASE_CHASE); + break; + case EVENT_VOLCANO: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 999, true)) + { + //DoCast(target, SPELL_VOLCANIC_SUMMON);//movement bugged + me->SummonCreature(NPC_SUPREMUS_VOLCANO, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000); + Talk(EMOTE_GROUND_CRACK); + events.DelayEvents(1500, GCD_CAST); + } + events.ScheduleEvent(EVENT_VOLCANO, 10000, GCD_CAST, PHASE_CHASE); + return; + case EVENT_SWITCH_PHASE: + ChangePhase(); + break; + default: + break; } - - DoMeleeAttackIfReady(); } + + private: + uint32 phase; }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetBlackTempleAI<boss_supremusAI>(creature); + } }; class npc_volcano : public CreatureScript @@ -256,11 +219,6 @@ class npc_volcano : public CreatureScript public: npc_volcano() : CreatureScript("npc_volcano") { } - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_volcanoAI(creature); - } - struct npc_volcanoAI : public ScriptedAI { npc_volcanoAI(Creature* creature) : ScriptedAI(creature) @@ -282,7 +240,6 @@ public: void MoveInLineOfSight(Unit* /*who*/) override { } - void DoAction(int32 /*info*/) override { me->RemoveAura(SPELL_VOLCANIC_ERUPTION); @@ -298,6 +255,11 @@ public: else wait -= diff; } }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new npc_volcanoAI(creature); + } }; void AddSC_boss_supremus() diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index 64a6add9801..6425675219f 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -29,7 +29,7 @@ EndScriptData */ #include "Player.h" #include "SpellInfo.h" -enum Yells +enum Texts { SAY_AGGRO = 0, SAY_NEEDLE = 1, @@ -51,11 +51,6 @@ enum Spells }; -enum GameObjects -{ - GOBJECT_SPINE = 185584 -}; - enum Events { EVENT_BERSERK = 1, @@ -65,7 +60,7 @@ enum Events EVENT_SHIELD = 5 }; -enum Misc +enum EventGroups { GCD_CAST = 1, GCD_YELL = 2 @@ -76,30 +71,17 @@ class boss_najentus : public CreatureScript public: boss_najentus() : CreatureScript("boss_najentus") { } - CreatureAI* GetAI(Creature* creature) const override - { - return GetInstanceAI<boss_najentusAI>(creature); - } - - struct boss_najentusAI : public ScriptedAI + struct boss_najentusAI : public BossAI { - boss_najentusAI(Creature* creature) : ScriptedAI(creature) + boss_najentusAI(Creature* creature) : BossAI(creature, DATA_HIGH_WARLORD_NAJENTUS) { - instance = creature->GetInstanceScript(); + SpineTargetGUID = 0; } - InstanceScript* instance; - EventMap events; - - uint64 SpineTargetGUID; - void Reset() override { - events.Reset(); - + _Reset(); SpineTargetGUID = 0; - - instance->SetBossState(DATA_HIGH_WARLORD_NAJENTUS, NOT_STARTED); } void KilledUnit(Unit* /*victim*/) override @@ -110,8 +92,7 @@ public: void JustDied(Unit* /*killer*/) override { - instance->SetBossState(DATA_HIGH_WARLORD_NAJENTUS, DONE); - + _JustDied(); Talk(SAY_DEATH); } @@ -127,10 +108,8 @@ public: void EnterCombat(Unit* /*who*/) override { - instance->SetBossState(DATA_HIGH_WARLORD_NAJENTUS, IN_PROGRESS); - + _EnterCombat(); Talk(SAY_AGGRO); - DoZoneInCombat(); events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST); events.ScheduleEvent(EVENT_YELL, 45000 + (rand32() % 76) * 1000, GCD_YELL); ResetTimer(); @@ -155,44 +134,40 @@ public: events.RescheduleEvent(EVENT_SHIELD, 60000 + inc); } - void UpdateAI(uint32 diff) override + void ExecuteEvent(uint32 eventId) override { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + switch (eventId) { - switch (eventId) - { - case EVENT_SHIELD: - DoCast(me, SPELL_TIDAL_SHIELD, true); - ResetTimer(45000); - break; - case EVENT_BERSERK: - Talk(SAY_ENRAGE); - DoCast(me, SPELL_BERSERK, true); - events.DelayEvents(15000, GCD_YELL); - break; - case EVENT_SPINE: - { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); - if (!target) target = me->GetVictim(); - if (target) - { - DoCast(target, SPELL_IMPALING_SPINE, true); - SpineTargetGUID = target->GetGUID(); - //must let target summon, otherwise you cannot click the spine - target->SummonGameObject(GOBJECT_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30); - Talk(SAY_NEEDLE); - events.DelayEvents(1500, GCD_CAST); - events.DelayEvents(15000, GCD_YELL); - } - events.ScheduleEvent(EVENT_SPINE, 21000, GCD_CAST); - return; - } - case EVENT_NEEDLE: + case EVENT_SHIELD: + DoCast(me, SPELL_TIDAL_SHIELD, true); + ResetTimer(45000); + break; + case EVENT_BERSERK: + Talk(SAY_ENRAGE); + DoCast(me, SPELL_BERSERK, true); + events.DelayEvents(15000, GCD_YELL); + break; + case EVENT_SPINE: + {
+ Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
+
+ if (!target)
+ target = me->GetVictim();
+
+ if (target)
+ {
+ DoCast(target, SPELL_IMPALING_SPINE, true);
+ SpineTargetGUID = target->GetGUID();
+ //must let target summon, otherwise you cannot click the spine
+ target->SummonGameObject(GO_NAJENTUS_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30);
+ Talk(SAY_NEEDLE);
+ events.DelayEvents(1500, GCD_CAST);
+ events.DelayEvents(15000, GCD_YELL);
+ }
+ events.ScheduleEvent(EVENT_SPINE, 21000, GCD_CAST);
+ return;
+ } + case EVENT_NEEDLE: { //DoCast(me, SPELL_NEEDLE_SPINE, true); std::list<Unit*> targets; @@ -203,18 +178,24 @@ public: events.DelayEvents(1500, GCD_CAST); return; } - case EVENT_YELL: - Talk(SAY_SPECIAL); - events.ScheduleEvent(EVENT_YELL, urand(25000, 100000), GCD_YELL); - events.DelayEvents(15000, GCD_YELL); - break; - } + case EVENT_YELL: + Talk(SAY_SPECIAL); + events.ScheduleEvent(EVENT_YELL, urand(25000, 100000), GCD_YELL); + events.DelayEvents(15000, GCD_YELL); + break; + default: + break; } - - DoMeleeAttackIfReady(); } + + private: + uint64 SpineTargetGUID; }; + CreatureAI* GetAI(Creature* creature) const override + { + return GetBlackTempleAI<boss_najentusAI>(creature); + } }; class go_najentus_spine : public GameObjectScript diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h index b2097c34b33..51c5a5221ea 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h @@ -46,7 +46,8 @@ enum CreatureIds NPC_THE_MAKER = 17381, NPC_BROGGOK = 17380, NPC_KELIDAN_THE_BREAKER = 17377, - NPC_PRISONER = 17398 + NPC_PRISONER = 17398, + NPC_BROGGOK_POISON_CLOUD = 17662 }; enum GameObjectIds diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp index 55e9801320f..880efd0cfaf 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp @@ -43,6 +43,13 @@ enum Spells SPELL_POISON_CLOUD_PASSIVE = 30914 }; +enum Events +{ + EVENT_SLIME_SPRAY = 1, + EVENT_POISON_BOLT, + EVENT_POISON_CLOUD, +}; + class boss_broggok : public CreatureScript { public: @@ -52,17 +59,9 @@ class boss_broggok : public CreatureScript { boss_broggokAI(Creature* creature) : BossAI(creature, DATA_BROGGOK) { } - uint32 AcidSpray_Timer; - uint32 PoisonSpawn_Timer; - uint32 PoisonBolt_Timer; - bool canAttack; - void Reset() override { _Reset(); - AcidSpray_Timer = 10000; - PoisonSpawn_Timer = 5000; - PoisonBolt_Timer = 7000; DoAction(ACTION_RESET_BROGGOK); } @@ -72,44 +71,35 @@ class boss_broggok : public CreatureScript Talk(SAY_AGGRO); } - void UpdateAI(uint32 diff) override + void JustSummoned(Creature* summoned) override { - if (!UpdateVictim()) - return; - - if (!canAttack) - return; - - if (AcidSpray_Timer <= diff) - { - DoCastVictim(SPELL_SLIME_SPRAY); - AcidSpray_Timer = 4000 + rand32() % 8000; - } - else - AcidSpray_Timer -=diff; - - if (PoisonBolt_Timer <= diff) + if (summoned->GetEntry() == NPC_BROGGOK_POISON_CLOUD) { - DoCastVictim(SPELL_POISON_BOLT); - PoisonBolt_Timer = 4000 + rand32() % 8000; + summoned->SetReactState(REACT_PASSIVE); + summoned->CastSpell(summoned, SPELL_POISON_CLOUD_PASSIVE, true); + summons.Summon(summoned); } - else - PoisonBolt_Timer -=diff; - - if (PoisonSpawn_Timer <= diff) - { - DoCast(me, SPELL_POISON_CLOUD); - PoisonSpawn_Timer = 20000; - } - else - PoisonSpawn_Timer -=diff; - - DoMeleeAttackIfReady(); } - void JustDied(Unit* /*killer*/) override + void ExecuteEvent(uint32 eventId) override { - _JustDied(); + switch (eventId) + { + case EVENT_SLIME_SPRAY: + DoCastVictim(SPELL_SLIME_SPRAY); + events.ScheduleEvent(EVENT_SLIME_SPRAY, urand(4000, 12000)); + break; + case EVENT_POISON_BOLT: + DoCastVictim(SPELL_POISON_BOLT); + events.ScheduleEvent(EVENT_POISON_BOLT, urand(4000, 12000)); + break; + case EVENT_POISON_CLOUD: + DoCast(me, SPELL_POISON_CLOUD); + events.ScheduleEvent(EVENT_POISON_CLOUD, 20000); + break; + default: + break; + } } void DoAction(int32 action) override @@ -122,12 +112,13 @@ class boss_broggok : public CreatureScript case ACTION_ACTIVATE_BROGGOK: me->SetReactState(REACT_AGGRESSIVE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); - canAttack = true; + events.ScheduleEvent(EVENT_SLIME_SPRAY, 10000); + events.ScheduleEvent(EVENT_POISON_BOLT, 7000); + events.ScheduleEvent(EVENT_POISON_CLOUD, 5000); break; case ACTION_RESET_BROGGOK: me->SetReactState(REACT_PASSIVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); - canAttack = false; break; } } @@ -140,33 +131,6 @@ class boss_broggok : public CreatureScript } }; -class npc_broggok_poison_cloud : public CreatureScript -{ - public: - npc_broggok_poison_cloud() : CreatureScript("npc_broggok_poison_cloud") { } - - struct npc_broggok_poison_cloudAI : public ScriptedAI - { - npc_broggok_poison_cloudAI(Creature* creature) : ScriptedAI(creature) - { - SetCombatMovement(false); - creature->SetReactState(REACT_PASSIVE); - } - - void IsSummonedBy(Unit* /*summoner*/) override - { - DoCast(me, SPELL_POISON_CLOUD_PASSIVE, true); - } - - void UpdateAI(uint32 /*diff*/) override { } - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_broggok_poison_cloudAI(creature); - } -}; - class go_broggok_lever : public GameObjectScript { public: @@ -228,7 +192,6 @@ class spell_broggok_poison_cloud : public SpellScriptLoader void AddSC_boss_broggok() { new boss_broggok(); - new npc_broggok_poison_cloud(); new go_broggok_lever(); new spell_broggok_poison_cloud(); } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp index 53680739e55..67e09ba4ac9 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * 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 @@ -16,13 +15,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_The_Maker -SD%Complete: 80 -SDComment: Mind control no support -SDCategory: Hellfire Citadel, Blood Furnace -EndScriptData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "blood_furnace.h" @@ -42,6 +34,14 @@ enum Spells SPELL_DOMINATION = 25772 }; +enum Events +{ + EVENT_ACID_SPRAY = 1, + EVENT_EXPLODING_BREAKER, + EVENT_DOMINATION, + EVENT_KNOCKDOWN +}; + class boss_the_maker : public CreatureScript { public: @@ -51,24 +51,15 @@ class boss_the_maker : public CreatureScript { boss_the_makerAI(Creature* creature) : BossAI(creature, DATA_THE_MAKER) { } - uint32 AcidSpray_Timer; - uint32 ExplodingBreaker_Timer; - uint32 Domination_Timer; - uint32 Knockdown_Timer; - - void Reset() override - { - _Reset(); - AcidSpray_Timer = 15000; - ExplodingBreaker_Timer = 6000; - Domination_Timer = 120000; - Knockdown_Timer = 10000; - } - void EnterCombat(Unit* /*who*/) override { _EnterCombat(); Talk(SAY_AGGRO); + + events.ScheduleEvent(EVENT_ACID_SPRAY, 15000); + events.ScheduleEvent(EVENT_EXPLODING_BREAKER, 6000); + events.ScheduleEvent(EVENT_DOMINATION, 120000); + events.ScheduleEvent(EVENT_KNOCKDOWN, 10000); } void KilledUnit(Unit* who) override @@ -83,49 +74,31 @@ class boss_the_maker : public CreatureScript Talk(SAY_DIE); } - void UpdateAI(uint32 diff) override + void ExecuteEvent(uint32 eventId) override { - if (!UpdateVictim()) - return; - - if (AcidSpray_Timer <= diff) - { - DoCastVictim(SPELL_ACID_SPRAY); - AcidSpray_Timer = 15000 + rand32() % 8000; - } - else - AcidSpray_Timer -=diff; - - if (ExplodingBreaker_Timer <= diff) + switch (eventId) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_EXPLODING_BREAKER); - ExplodingBreaker_Timer = 4000 + rand32() % 8000; + case EVENT_ACID_SPRAY: + DoCastVictim(SPELL_ACID_SPRAY); + events.ScheduleEvent(EVENT_ACID_SPRAY, urand(15000, 23000)); + break; + case EVENT_EXPLODING_BREAKER: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) + DoCast(target, SPELL_EXPLODING_BREAKER); + events.ScheduleEvent(EVENT_EXPLODING_BREAKER, urand(4000, 12000)); + break; + case EVENT_DOMINATION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + DoCast(target, SPELL_DOMINATION); + events.ScheduleEvent(EVENT_DOMINATION, 120000); + break; + case EVENT_KNOCKDOWN: + DoCastVictim(SPELL_KNOCKDOWN); + events.ScheduleEvent(EVENT_KNOCKDOWN, urand(4000, 12000)); + break; + default: + break; } - else - ExplodingBreaker_Timer -=diff; - - /* // Disabled until Core Support for mind control - if (domination_timer_timer <= diff) - { - Unit* target; - target = SelectUnit(SELECT_TARGET_RANDOM, 0); - - DoCast(target, SPELL_DOMINATION); - - domination_timer = 120000; - } else domination_timer -=diff; - */ - - if (Knockdown_Timer <= diff) - { - DoCastVictim(SPELL_KNOCKDOWN); - Knockdown_Timer = 4000 + rand32() % 8000; - } - else - Knockdown_Timer -=diff; - - DoMeleeAttackIfReady(); } }; @@ -139,4 +112,3 @@ void AddSC_boss_the_maker() { new boss_the_maker(); } - diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp index f32d2516ee0..a8a99d757e7 100644 --- a/src/server/scripts/Outland/zone_nagrand.cpp +++ b/src/server/scripts/Outland/zone_nagrand.cpp @@ -19,12 +19,11 @@ /* ScriptData SDName: Nagrand SD%Complete: 90 -SDComment: Quest support: 9868, 9874, 10044, 10172, 10085. TextId's unknown for altruis_the_sufferer and greatmother_geyah (npc_text) +SDComment: Quest support: 9868, 9874, 10085. TextId's unknown for altruis_the_sufferer and greatmother_geyah (npc_text) SDCategory: Nagrand EndScriptData */ /* ContentData -npc_greatmother_geyah npc_maghar_captive npc_creditmarker_visit_with_ancestors EndContentData */ @@ -36,114 +35,6 @@ EndContentData */ #include "SpellInfo.h" /*###### -## npc_greatmother_geyah -######*/ - -#define GOSSIP_HGG1 "Hello, Greatmother. Garrosh told me that you wanted to speak with me." -#define GOSSIP_HGG2 "Garrosh is beyond redemption, Greatmother. I fear that in helping the Mag'har, I have convinced Garrosh that he is unfit to lead." - -#define GOSSIP_SGG1 "You raised all of the orcs here, Greatmother?" -#define GOSSIP_SGG2 "Do you believe that?" -#define GOSSIP_SGG3 "What can be done? I have tried many different things. I have done my best to help the people of Nagrand. Each time I have approached Garrosh, he has dismissed me." -#define GOSSIP_SGG4 "Left? How can you choose to leave?" -#define GOSSIP_SGG5 "What is this duty?" -#define GOSSIP_SGG6 "Is there anything I can do for you, Greatmother?" -#define GOSSIP_SGG7 "I have done all that I could, Greatmother. I thank you for your kind words." -#define GOSSIP_SGG8 "Greatmother, you are the mother of Durotan?" -#define GOSSIP_SGG9 "Greatmother, I never had the honor. Durotan died long before my time, but his heroics are known to all on my world. The orcs of Azeroth reside in a place known as Durotar, named after your son. And ... (You take a moment to breathe and think through what you are about to tell the Greatmother.)" -#define GOSSIP_SGG10 "It is my Warchief, Greatmother. The leader of my people. From my world. He ... He is the son of Durotan. He is your grandchild." -#define GOSSIP_SGG11 "I will return to Azeroth at once, Greatmother." - -//all the textId's for the below is unknown, but i do believe the gossip item texts are proper. -class npc_greatmother_geyah : public CreatureScript -{ -public: - npc_greatmother_geyah() : CreatureScript("npc_greatmother_geyah") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override - { - player->PlayerTalkClass->ClearMenus(); - switch (action) - { - case GOSSIP_ACTION_INFO_DEF + 1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 4: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 5: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 6: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 7: - player->AreaExploredOrEventHappens(10044); - player->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 10: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 11: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 12: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 13: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 14: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 15); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 15: - player->AreaExploredOrEventHappens(10172); - player->CLOSE_GOSSIP_MENU(); - break; - } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) override - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - if (player->GetQuestStatus(10044) == QUEST_STATUS_INCOMPLETE) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HGG1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - } - else if (player->GetQuestStatus(10172) == QUEST_STATUS_INCOMPLETE) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HGG2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - } - else - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - - return true; - } -}; - -/*##### ## npc_maghar_captive #####*/ @@ -714,7 +605,6 @@ class go_warmaul_prison : public GameObjectScript void AddSC_nagrand() { - new npc_greatmother_geyah(); new npc_maghar_captive(); new npc_creditmarker_visit_with_ancestors(); new npc_corki(); diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index b9b87fd5d6a..db34665e641 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -19,7 +19,7 @@ /* ScriptData SDName: Shadowmoon_Valley SD%Complete: 100 -SDComment: Quest support: 10519, 10583, 10601, 10804, 10854, 10458, 10481, 10480, 10781, 10451. Vendor Drake Dealer Hurlunk. +SDComment: Quest support: 10583, 10601, 10804, 10854, 10458, 10481, 10480, 10781, 10451. Vendor Drake Dealer Hurlunk. SDCategory: Shadowmoon Valley EndScriptData */ @@ -29,7 +29,6 @@ npc_enslaved_netherwing_drake npc_drake_dealer_hurlunk npcs_flanis_swiftwing_and_kagrosh npc_karynaku -npc_oronok_tornheart npc_overlord_morghor npc_earthmender_wilda npc_torloth_the_magnificent @@ -492,81 +491,6 @@ public: }; /*###### -## npc_oronok -######*/ - -#define GOSSIP_ORONOK1 "I am ready to hear your story, Oronok." -#define GOSSIP_ORONOK2 "How do I find the cipher?" -#define GOSSIP_ORONOK3 "How do you know all of this?" -#define GOSSIP_ORONOK4 "Yet what? What is it, Oronok?" -#define GOSSIP_ORONOK5 "Continue, please." -#define GOSSIP_ORONOK6 "So what of the cipher now? And your boys?" -#define GOSSIP_ORONOK7 "I will find your boys and the cipher, Oronok." - -class npc_oronok_tornheart : public CreatureScript -{ -public: - npc_oronok_tornheart() : CreatureScript("npc_oronok_tornheart") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override - { - player->PlayerTalkClass->ClearMenus(); - switch (action) - { - case GOSSIP_ACTION_TRADE: - player->GetSession()->SendListInventory(creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF: - player->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(10313, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->SEND_GOSSIP_MENU(10314, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - player->SEND_GOSSIP_MENU(10315, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - player->SEND_GOSSIP_MENU(10316, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - player->SEND_GOSSIP_MENU(10317, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - player->SEND_GOSSIP_MENU(10318, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - player->CLOSE_GOSSIP_MENU(); - player->AreaExploredOrEventHappens(10519); - break; - } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) override - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - if (creature->IsVendor()) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - - if (player->GetQuestStatus(10519) == QUEST_STATUS_INCOMPLETE) - { - player->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(10312, creature->GetGUID()); - }else - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - - return true; - } -}; - -/*#### # npc_karynaku ####*/ @@ -1909,7 +1833,6 @@ void AddSC_shadowmoon_valley() new npc_drake_dealer_hurlunk(); new npcs_flanis_swiftwing_and_kagrosh(); new npc_karynaku(); - new npc_oronok_tornheart(); new npc_overlord_morghor(); new npc_earthmender_wilda(); new npc_lord_illidan_stormrage(); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 86ef8bdc8cc..7ba663beb72 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2573,16 +2573,15 @@ class spell_gen_oracle_wolvar_reputation : public SpellScriptLoader { Player* player = GetCaster()->ToPlayer(); uint32 factionId = GetSpellInfo()->Effects[effIndex].CalcValue(); - int32 repChange = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + int32 repChange = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); - if (!factionEntry) return; // Set rep to baserep + basepoints (expecting spillover for oposite faction -> become hated) // Not when player already has equal or higher rep with this faction - if (player->GetReputationMgr().GetBaseReputation(factionEntry) < repChange) + if (player->GetReputationMgr().GetReputation(factionEntry) <= repChange) player->GetReputationMgr().SetReputation(factionEntry, repChange); // EFFECT_INDEX_2 most likely update at war state, we already handle this in SetReputation diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index f17aac51519..e135bb08e73 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -21,15 +21,16 @@ * Scriptnames of files in this file should be prefixed with "spell_q#questID_". */ +#include "CellImpl.h" +#include "CreatureTextMgr.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" #include "Player.h" #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellScript.h" #include "SpellAuraEffects.h" #include "Vehicle.h" -#include "GridNotifiers.h" -#include "GridNotifiersImpl.h" -#include "CellImpl.h" class spell_generic_quest_update_entry_SpellScript : public SpellScript { @@ -1115,12 +1116,12 @@ class spell_q9452_cast_net: public SpellScriptLoader } }; -#define SAY_1 "Sons of Hodir! I humbly present to you..." -#define SAY_2 "The Helm of Hodir!" - enum HodirsHelm { - NPC_KILLCREDIT = 30210 // Hodir's Helm KC Bunny + SAY_1 = 1, + SAY_2 = 2, + NPC_KILLCREDIT = 30210, // Hodir's Helm KC Bunny + NPC_ICE_SPIKE_BUNNY = 30215 }; class spell_q12987_read_pronouncement : public SpellScriptLoader @@ -1137,9 +1138,12 @@ public: // player must cast kill credit and do emote text, according to sniff if (Player* target = GetTarget()->ToPlayer()) { - target->MonsterWhisper(SAY_1, target, true); - target->KilledMonsterCredit(NPC_KILLCREDIT, 0); - target->MonsterWhisper(SAY_2, target, true); + if (Creature* trigger = target->FindNearestCreature(NPC_ICE_SPIKE_BUNNY, 25.0f)) + { + sCreatureTextMgr->SendChat(trigger, SAY_1, target, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, target); + target->KilledMonsterCredit(NPC_KILLCREDIT); + sCreatureTextMgr->SendChat(trigger, SAY_2, target, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, target); + } } } @@ -2096,7 +2100,7 @@ class spell_q12641_death_comes_from_on_high : public SpellScriptLoader } }; -// 52694 - Recall Eye of Acherus +// 52694 - Recall Eye of Acherus class spell_q12641_recall_eye_of_acherus : public SpellScriptLoader { public: diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 9a78d74bb45..ca53e91737b 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2432,6 +2432,20 @@ CharDelete.KeepDays = 30 ################################################################################################### # CUSTOM SERVER OPTIONS # +# AllowTrackBothResources +# Description: Allows players to track herbs and minerals at the same time (if they have the skills) +# Default: 0 (do not allow) +# 1 (allow) +# +# Note: The following are client limitations and cannot be coded for: +# * The minimap tracking icon will display whichever skill is activated second +# * The minimap tracking list will only show a check mark next to the last skill activated (sometimes this +# bugs out and doesn't switch the check mark. It has no effect on the actual tracking though). +# * The minimap dots are yellow for both resources + +AllowTrackBothResources = 0 + +# # PlayerStart.AllReputation # Description: Players will start with most of the high level reputations that are needed # for items, mounts etc. |