diff options
65 files changed, 1976 insertions, 1439 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_08_31_00_world_game_tele.sql b/sql/updates/world/2014_08_31_00_world_game_tele.sql new file mode 100644 index 00000000000..dd6d790fb2f --- /dev/null +++ b/sql/updates/world/2014_08_31_00_world_game_tele.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `game_tele` WHERE `id`=1424; +INSERT INTO `game_tele` (`id`, `position_x`, `position_y`, `position_z`, `orientation`, `map`, `name`) VALUES +(1424, 16218.7, 16403.6, -64.3789, 3.12191, 1, 'Jail'); diff --git a/sql/updates/world/2014_08_31_01_world_misc.sql b/sql/updates/world/2014_08_31_01_world_misc.sql new file mode 100644 index 00000000000..cf2645d772b --- /dev/null +++ b/sql/updates/world/2014_08_31_01_world_misc.sql @@ -0,0 +1,14 @@ +UPDATE `smart_scripts` SET `id`=15 WHERE `entryorguid`=20417 AND `source_type`=0 AND `id`=13 AND `link`=0; +UPDATE `smart_scripts` SET `event_param1`=9, `event_param2`=9 WHERE `entryorguid`=20417 AND `source_type`=0 AND `id`=4 AND `link`=5; +UPDATE `smart_scripts` SET `action_param1`=9, `action_param2`=9 WHERE `entryorguid`=18395600 AND `source_type`=9 AND `id`=10 AND `link`=0; +UPDATE `creature_summon_groups` SET `summonTime`=900000 WHERE `summonerId`=35501; + +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN(30209,30211,30212); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(30209,30211,30212) 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 +(30209, 0, 0, 0, 8, 0, 100, 0, 56275, 0, 0, 0, 33, 30209, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'North Lightning Forge - On Spellhit "Bouldercrags Bomb" - Give Kill Credit'), +(30211, 0, 0, 0, 8, 0, 100, 0, 56275, 0, 0, 0, 33, 30211, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Central Lightning Forge - On Spellhit "Bouldercrags Bomb" - Give Kill Credit'), +(30212, 0, 0, 0, 8, 0, 100, 0, 56275, 0, 0, 0, 33, 30212, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'South Lightning Forge - On Spellhit "Bouldercrags Bomb" - Give Kill Credit'); + +UPDATE `creature` SET `spawndist`=0, `MovementType`=0 WHERE `guid` IN(95645,96491,96864); diff --git a/sql/updates/world/2014_08_31_02_world_spell_script_names.sql b/sql/updates/world/2014_08_31_02_world_spell_script_names.sql new file mode 100644 index 00000000000..128364bf4e7 --- /dev/null +++ b/sql/updates/world/2014_08_31_02_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` = 38194;
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(38194, 'spell_talon_king_ikiss_blink');
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/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/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 77f318066a2..45450a0c129 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -74,6 +74,7 @@ Object::Object() : m_PackGUID(sizeof(uint64)+1) { m_objectTypeId = TYPEID_OBJECT; m_objectType = TYPEMASK_OBJECT; + m_updateFlag = UPDATEFLAG_NONE; m_uint32Values = NULL; m_valuesCount = 0; 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/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 99c3d234ef8..5ef6acbcce1 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -853,6 +853,7 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry) Effects[i] = SpellEffectInfo(spellEntry, this, i); ChainEntry = NULL; + ExplicitTargetMask = 0; } SpellInfo::~SpellInfo() 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/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/AlteracValley/alterac_valley.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp index 6f8b93bbdba..a9fc95fdb14 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp @@ -84,10 +84,20 @@ class npc_av_marshal_or_warmaster : public CreatureScript struct npc_av_marshal_or_warmasterAI : public ScriptedAI { - npc_av_marshal_or_warmasterAI(Creature* creature) : ScriptedAI(creature) { } + npc_av_marshal_or_warmasterAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + _hasAura = false; + } void Reset() override { + Initialize(); + events.Reset(); events.ScheduleEvent(EVENT_CHARGE_TARGET, urand(2 * IN_MILLISECONDS, 12 * IN_MILLISECONDS)); events.ScheduleEvent(EVENT_CLEAVE, urand(1 * IN_MILLISECONDS, 11 * IN_MILLISECONDS)); @@ -95,8 +105,6 @@ class npc_av_marshal_or_warmaster : public CreatureScript events.ScheduleEvent(EVENT_WHIRLWIND, urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS)); events.ScheduleEvent(EVENT_ENRAGE, urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS)); events.ScheduleEvent(EVENT_CHECK_RESET, 5000); - - _hasAura = false; } void JustRespawned() override diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp index 52a05f6c0a3..8bc969e9020 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp @@ -110,7 +110,20 @@ public: struct boss_balindaAI : public ScriptedAI { - boss_balindaAI(Creature* creature) : ScriptedAI(creature), summons(me) { } + boss_balindaAI(Creature* creature) : ScriptedAI(creature), summons(me) + { + Initialize(); + } + + void Initialize() + { + arcaneExplosionTimer = urand(5 * IN_MILLISECONDS, 15 * IN_MILLISECONDS); + coneOfColdTimer = 8 * IN_MILLISECONDS; + fireBoltTimer = 1 * IN_MILLISECONDS; + frostboltTimer = 4 * IN_MILLISECONDS; + resetTimer = 5 * IN_MILLISECONDS; + waterElementalTimer = 0; + } uint32 arcaneExplosionTimer; uint32 coneOfColdTimer; @@ -123,12 +136,7 @@ public: void Reset() override { - arcaneExplosionTimer = urand(5 * IN_MILLISECONDS, 15 * IN_MILLISECONDS); - coneOfColdTimer = 8 * IN_MILLISECONDS; - fireBoltTimer = 1 * IN_MILLISECONDS; - frostboltTimer = 4 * IN_MILLISECONDS; - resetTimer = 5 * IN_MILLISECONDS; - waterElementalTimer = 0; + Initialize(); summons.DespawnAll(); } diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp index 4ecb57177a6..49c5a61b7d0 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp @@ -45,7 +45,20 @@ public: struct boss_drektharAI : public ScriptedAI { - boss_drektharAI(Creature* creature) : ScriptedAI(creature) { } + boss_drektharAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + WhirlwindTimer = urand(1 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); + Whirlwind2Timer = urand(1 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); + KnockdownTimer = 12 * IN_MILLISECONDS; + FrenzyTimer = 6 * IN_MILLISECONDS; + ResetTimer = 5 * IN_MILLISECONDS; + YellTimer = urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS); //20 to 30 seconds + } uint32 WhirlwindTimer; uint32 Whirlwind2Timer; @@ -56,12 +69,7 @@ public: void Reset() override { - WhirlwindTimer = urand(1 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); - Whirlwind2Timer = urand(1 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); - KnockdownTimer = 12 * IN_MILLISECONDS; - FrenzyTimer = 6 * IN_MILLISECONDS; - ResetTimer = 5 * IN_MILLISECONDS; - YellTimer = urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS); //20 to 30 seconds + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp index 9e4fc5838ad..e422975bd1a 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp @@ -46,7 +46,20 @@ public: struct boss_galvangarAI : public ScriptedAI { - boss_galvangarAI(Creature* creature) : ScriptedAI(creature) { } + boss_galvangarAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + CleaveTimer = urand(1 * IN_MILLISECONDS, 9 * IN_MILLISECONDS); + FrighteningShoutTimer = urand(2 * IN_MILLISECONDS, 19 * IN_MILLISECONDS); + Whirlwind1Timer = urand(1 * IN_MILLISECONDS, 13 * IN_MILLISECONDS); + Whirlwind2Timer = urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); + MortalStrikeTimer = urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); + ResetTimer = 5 * IN_MILLISECONDS; + } uint32 CleaveTimer; uint32 FrighteningShoutTimer; @@ -57,12 +70,7 @@ public: void Reset() override { - CleaveTimer = urand(1 * IN_MILLISECONDS, 9 * IN_MILLISECONDS); - FrighteningShoutTimer = urand(2 * IN_MILLISECONDS, 19 * IN_MILLISECONDS); - Whirlwind1Timer = urand(1 * IN_MILLISECONDS, 13 * IN_MILLISECONDS); - Whirlwind2Timer = urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); - MortalStrikeTimer = urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); - ResetTimer = 5 * IN_MILLISECONDS; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp index 076607a5672..1eabfb67f57 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp @@ -42,7 +42,19 @@ public: struct boss_vanndarAI : public ScriptedAI { - boss_vanndarAI(Creature* creature) : ScriptedAI(creature) { } + boss_vanndarAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + AvatarTimer = 3 * IN_MILLISECONDS; + ThunderclapTimer = 4 * IN_MILLISECONDS; + StormboltTimer = 6 * IN_MILLISECONDS; + ResetTimer = 5 * IN_MILLISECONDS; + YellTimer = urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS); + } uint32 AvatarTimer; uint32 ThunderclapTimer; @@ -52,11 +64,7 @@ public: void Reset() override { - AvatarTimer = 3 * IN_MILLISECONDS; - ThunderclapTimer = 4 * IN_MILLISECONDS; - StormboltTimer = 6 * IN_MILLISECONDS; - ResetTimer = 5 * IN_MILLISECONDS; - YellTimer = urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS); + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp index 907aaed3a0d..51ca327738b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp @@ -124,10 +124,27 @@ public: { npc_grimstoneAI(Creature* creature) : npc_escortAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); MobSpawnId = rand32() % 6; } + void Initialize() + { + EventPhase = 0; + Event_Timer = 1000; + + MobCount = 0; + MobDeath_Timer = 0; + + for (uint8 i = 0; i < MAX_NPC_AMOUNT; ++i) + RingMobGUID[i] = 0; + + RingBossGUID = 0; + + CanWalk = false; + } + InstanceScript* instance; uint8 EventPhase; @@ -144,20 +161,9 @@ public: void Reset() override { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - EventPhase = 0; - Event_Timer = 1000; - - MobCount = 0; - MobDeath_Timer = 0; + Initialize(); - for (uint8 i = 0; i < MAX_NPC_AMOUNT; ++i) - RingMobGUID[i] = 0; - - RingBossGUID = 0; - - CanWalk = false; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } /// @todo move them to center @@ -353,7 +359,17 @@ public: struct npc_phalanxAI : public ScriptedAI { - npc_phalanxAI(Creature* creature) : ScriptedAI(creature) { } + npc_phalanxAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + ThunderClap_Timer = 12000; + FireballVolley_Timer = 0; + MightyBlow_Timer = 15000; + } uint32 ThunderClap_Timer; uint32 FireballVolley_Timer; @@ -361,9 +377,7 @@ public: void Reset() override { - ThunderClap_Timer = 12000; - FireballVolley_Timer = 0; - MightyBlow_Timer = 15000; + Initialize(); } void UpdateAI(uint32 diff) override @@ -1238,9 +1252,16 @@ public: { npc_rocknotAI(Creature* creature) : npc_escortAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + BreakKeg_Timer = 0; + BreakDoor_Timer = 0; + } + InstanceScript* instance; uint32 BreakKeg_Timer; @@ -1251,8 +1272,7 @@ public: if (HasEscortState(STATE_ESCORT_ESCORTING)) return; - BreakKeg_Timer = 0; - BreakDoor_Timer = 0; + Initialize(); } void DoGo(uint32 id, uint32 state) diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp index 83464c12230..77a8c68d28e 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp @@ -157,12 +157,18 @@ class boss_doomrel : public CreatureScript { boss_doomrelAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); _instance = creature->GetInstanceScript(); } - void Reset() override + void Initialize() { _voidwalkers = false; + } + + void Reset() override + { + Initialize(); me->setFaction(FACTION_FRIEND); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp index ed62e26075c..ea92aa91b69 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp @@ -53,13 +53,21 @@ public: struct boss_gythAI : public BossAI { - boss_gythAI(Creature* creature) : BossAI(creature, DATA_GYTH) { } + boss_gythAI(Creature* creature) : BossAI(creature, DATA_GYTH) + { + Initialize(); + } + + void Initialize() + { + SummonedRend = false; + } bool SummonedRend; void Reset() override { - SummonedRend = false; + Initialize(); if (instance->GetBossState(DATA_GYTH) == IN_PROGRESS) { instance->SetBossState(DATA_GYTH, DONE); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_halycon.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_halycon.cpp index d5f7a4ce34b..b85cf4611ac 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_halycon.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_halycon.cpp @@ -45,12 +45,20 @@ public: struct boss_halyconAI : public BossAI { - boss_halyconAI(Creature* creature) : BossAI(creature, DATA_HALYCON) { } + boss_halyconAI(Creature* creature) : BossAI(creature, DATA_HALYCON) + { + Initialize(); + } + + void Initialize() + { + Summoned = false; + } void Reset() override { _Reset(); - Summoned = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_lord_valthalak.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_lord_valthalak.cpp index 23593442e86..bc1bdca1f61 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_lord_valthalak.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_lord_valthalak.cpp @@ -46,15 +46,23 @@ public: struct boss_lord_valthalakAI : public BossAI { - boss_lord_valthalakAI(Creature* creature) : BossAI(creature, DATA_LORD_VALTHALAK) { } + boss_lord_valthalakAI(Creature* creature) : BossAI(creature, DATA_LORD_VALTHALAK) + { + Initialize(); + } - void Reset() override + void Initialize() { - _Reset(); frenzy40 = false; frenzy15 = false; } + void Reset() override + { + _Reset(); + Initialize(); + } + void EnterCombat(Unit* /*who*/) override { _EnterCombat(); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_overlord_wyrmthalak.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_overlord_wyrmthalak.cpp index cc6911b5da7..4b4633d54ca 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_overlord_wyrmthalak.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_overlord_wyrmthalak.cpp @@ -57,14 +57,22 @@ public: struct boss_overlordwyrmthalakAI : public BossAI { - boss_overlordwyrmthalakAI(Creature* creature) : BossAI(creature, DATA_OVERLORD_WYRMTHALAK) { } + boss_overlordwyrmthalakAI(Creature* creature) : BossAI(creature, DATA_OVERLORD_WYRMTHALAK) + { + Initialize(); + } + + void Initialize() + { + Summoned = false; + } bool Summoned; void Reset() override { _Reset(); - Summoned = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp index efe0a0e2a78..1a97f668558 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp @@ -73,6 +73,8 @@ public: { boss_chromaggusAI(Creature* creature) : BossAI(creature, BOSS_CHROMAGGUS) { + Initialize(); + // Select the 2 breaths that we are going to use until despawned // 5 possiblities for the first breath, 4 for the second, 20 total possiblites // This way we don't end up casting 2 of the same breath @@ -173,12 +175,17 @@ public: EnterEvadeMode(); } + void Initialize() + { + CurrentVurln_Spell = 0; // We use this to store our last vulnerabilty spell so we can remove it later + Enraged = false; + } + void Reset() override { _Reset(); - CurrentVurln_Spell = 0; // We use this to store our last vulnerabilty spell so we can remove it later - Enraged = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp index 262befdd3ec..d5a08d157d0 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp @@ -166,11 +166,19 @@ public: struct boss_victor_nefariusAI : public BossAI { - boss_victor_nefariusAI(Creature* creature) : BossAI(creature, BOSS_NEFARIAN) { } + boss_victor_nefariusAI(Creature* creature) : BossAI(creature, BOSS_NEFARIAN) + { + Initialize(); + } - void Reset() override + void Initialize() { SpawnedAdds = 0; + } + + void Reset() override + { + Initialize(); if (me->GetMapId() == 469) { @@ -386,15 +394,23 @@ public: struct boss_nefarianAI : public BossAI { - boss_nefarianAI(Creature* creature) : BossAI(creature, BOSS_NEFARIAN) { } + boss_nefarianAI(Creature* creature) : BossAI(creature, BOSS_NEFARIAN) + { + Initialize(); + } - void Reset() override + void Initialize() { Phase3 = false; canDespawn = false; DespawnTimer = 30000; } + void Reset() override + { + Initialize(); + } + void JustReachedHome() override { canDespawn = true; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp index 8d4a84197b1..b83cc4694ab 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp @@ -68,13 +68,21 @@ public: struct boss_razorgoreAI : public BossAI { - boss_razorgoreAI(Creature* creature) : BossAI(creature, BOSS_RAZORGORE) { } + boss_razorgoreAI(Creature* creature) : BossAI(creature, BOSS_RAZORGORE) + { + Initialize(); + } + + void Initialize() + { + secondPhase = false; + } void Reset() override { _Reset(); - secondPhase = false; + Initialize(); instance->SetData(DATA_EGG_EVENT, NOT_STARTED); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp index e3085854f4a..1282cdcd313 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp @@ -70,19 +70,24 @@ public: { boss_vaelAI(Creature* creature) : BossAI(creature, BOSS_VAELASTRAZ) { + Initialize(); creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); creature->setFaction(35); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } + void Initialize() + { + PlayerGUID = 0; + HasYelled = false; + } + void Reset() override { _Reset(); me->SetStandState(UNIT_STAND_STATE_DEAD); - PlayerGUID = 0; - - HasYelled = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp index 2a1309dc097..a268890c25d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp @@ -108,13 +108,21 @@ class npc_firesworn : public CreatureScript struct npc_fireswornAI : public ScriptedAI { - npc_fireswornAI(Creature* creature) : ScriptedAI(creature) { } + npc_fireswornAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + immolateTimer = 4000; //These times are probably wrong + } uint32 immolateTimer; void Reset() override { - immolateTimer = 4000; //These times are probably wrong + Initialize(); } void DamageTaken(Unit* /*attacker*/, uint32& damage) override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp index f9757997731..c8b33e48852 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp @@ -131,12 +131,18 @@ class npc_core_rager : public CreatureScript { npc_core_ragerAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + mangleTimer = 7 * IN_MILLISECONDS; // These times are probably wrong + } + void Reset() override { - mangleTimer = 7*IN_MILLISECONDS; // These times are probably wrong + Initialize(); } void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp index 6eafb41a8fa..4a0e22b1ba8 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp @@ -82,18 +82,24 @@ class boss_ragnaros : public CreatureScript { boss_ragnarosAI(Creature* creature) : BossAI(creature, BOSS_RAGNAROS) { + Initialize(); _introState = 0; me->SetReactState(REACT_PASSIVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - void Reset() override + void Initialize() { - BossAI::Reset(); _emergeTimer = 90000; _hasYelledMagmaBurst = false; _hasSubmergedOnce = false; _isBanished = false; + } + + void Reset() override + { + BossAI::Reset(); + Initialize(); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); } diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp index ffb3c02d101..b0222413513 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp @@ -52,9 +52,22 @@ public: { boss_mr_smiteAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + uiTrashTimer = urand(5000, 9000); + uiSlamTimer = 9000; + uiNimbleReflexesTimer = urand(15500, 31600); + + uiHealth = 0; + + uiPhase = 0; + uiTimer = 0; + } + InstanceScript* instance; uint32 uiTrashTimer; @@ -68,14 +81,7 @@ public: void Reset() override { - uiTrashTimer = urand(5000, 9000); - uiSlamTimer = 9000; - uiNimbleReflexesTimer = urand(15500, 31600); - - uiHealth = 0; - - uiPhase = 0; - uiTimer = 0; + Initialize(); SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index 9fe21313f71..f469bf6deb1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -60,7 +60,19 @@ public: struct boss_curatorAI : public ScriptedAI { - boss_curatorAI(Creature* creature) : ScriptedAI(creature) { } + boss_curatorAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + AddTimer = 10000; + HatefulBoltTimer = 15000; //This time may be wrong + BerserkTimer = 720000; //12 minutes + Enraged = false; + Evocating = false; + } uint32 AddTimer; uint32 HatefulBoltTimer; @@ -71,11 +83,7 @@ public: void Reset() override { - AddTimer = 10000; - HatefulBoltTimer = 15000; //This time may be wrong - BerserkTimer = 720000; //12 minutes - Enraged = false; - Evocating = false; + Initialize(); me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, true); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 5d1e5451ab1..bbddf0aa5f5 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -62,13 +62,20 @@ public: { boss_attumenAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); + Phase = 1; CleaveTimer = urand(10000, 15000); CurseTimer = 30000; RandomYellTimer = urand(30000, 60000); //Occasionally yell ChargeTimer = 20000; + } + + void Initialize() + { ResetTimer = 0; + Midnight = 0; } uint64 Midnight; @@ -81,8 +88,7 @@ public: void Reset() override { - ResetTimer = 0; - Midnight = 0; + Initialize(); } void EnterEvadeMode() override @@ -127,7 +133,17 @@ public: struct boss_midnightAI : public ScriptedAI { - boss_midnightAI(Creature* creature) : ScriptedAI(creature) { } + boss_midnightAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + Phase = 1; + Attumen = 0; + Mount_Timer = 0; + } uint64 Attumen; uint8 Phase; @@ -135,9 +151,7 @@ public: void Reset() override { - Phase = 1; - Attumen = 0; - Mount_Timer = 0; + Initialize(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetVisible(true); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 6ff1faf35b6..5b4f25aea44 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -105,12 +105,25 @@ public: { boss_moroesAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); memset(AddId, 0, sizeof(AddId)); memset(AddGUID, 0, sizeof(AddGUID)); instance = creature->GetInstanceScript(); } + void Initialize() + { + Vanish_Timer = 30000; + Blind_Timer = 35000; + Gouge_Timer = 23000; + Wait_Timer = 0; + CheckAdds_Timer = 5000; + + Enrage = false; + InVanish = false; + } + InstanceScript* instance; uint64 AddGUID[4]; @@ -127,14 +140,7 @@ public: void Reset() override { - Vanish_Timer = 30000; - Blind_Timer = 35000; - Gouge_Timer = 23000; - Wait_Timer = 0; - CheckAdds_Timer = 5000; - - Enrage = false; - InVanish = false; + Initialize(); if (me->IsAlive()) SpawnAdds(); @@ -391,7 +397,17 @@ public: struct boss_baroness_dorothea_millstipeAI : public boss_moroes_guestAI { //Shadow Priest - boss_baroness_dorothea_millstipeAI(Creature* creature) : boss_moroes_guestAI(creature) { } + boss_baroness_dorothea_millstipeAI(Creature* creature) : boss_moroes_guestAI(creature) + { + Initialize(); + } + + void Initialize() + { + ManaBurn_Timer = 7000; + MindFlay_Timer = 1000; + ShadowWordPain_Timer = 6000; + } uint32 ManaBurn_Timer; uint32 MindFlay_Timer; @@ -399,9 +415,7 @@ public: void Reset() override { - ManaBurn_Timer = 7000; - MindFlay_Timer = 1000; - ShadowWordPain_Timer = 6000; + Initialize(); DoCast(me, SPELL_SHADOWFORM, true); @@ -454,7 +468,17 @@ public: struct boss_baron_rafe_dreugerAI : public boss_moroes_guestAI { //Retr Pally - boss_baron_rafe_dreugerAI(Creature* creature) : boss_moroes_guestAI(creature){ } + boss_baron_rafe_dreugerAI(Creature* creature) : boss_moroes_guestAI(creature) + { + Initialize(); + } + + void Initialize() + { + HammerOfJustice_Timer = 1000; + SealOfCommand_Timer = 7000; + JudgementOfCommand_Timer = SealOfCommand_Timer + 29000; + } uint32 HammerOfJustice_Timer; uint32 SealOfCommand_Timer; @@ -462,9 +486,7 @@ public: void Reset() override { - HammerOfJustice_Timer = 1000; - SealOfCommand_Timer = 7000; - JudgementOfCommand_Timer = SealOfCommand_Timer + 29000; + Initialize(); boss_moroes_guestAI::Reset(); } @@ -511,7 +533,18 @@ public: struct boss_lady_catriona_von_indiAI : public boss_moroes_guestAI { //Holy Priest - boss_lady_catriona_von_indiAI(Creature* creature) : boss_moroes_guestAI(creature) { } + boss_lady_catriona_von_indiAI(Creature* creature) : boss_moroes_guestAI(creature) + { + Initialize(); + } + + void Initialize() + { + DispelMagic_Timer = 11000; + GreaterHeal_Timer = 1500; + HolyFire_Timer = 5000; + PowerWordShield_Timer = 1000; + } uint32 DispelMagic_Timer; uint32 GreaterHeal_Timer; @@ -520,10 +553,7 @@ public: void Reset() override { - DispelMagic_Timer = 11000; - GreaterHeal_Timer = 1500; - HolyFire_Timer = 5000; - PowerWordShield_Timer = 1000; + Initialize(); AcquireGUID(); @@ -581,7 +611,18 @@ public: struct boss_lady_keira_berrybuckAI : public boss_moroes_guestAI { //Holy Pally - boss_lady_keira_berrybuckAI(Creature* creature) : boss_moroes_guestAI(creature) { } + boss_lady_keira_berrybuckAI(Creature* creature) : boss_moroes_guestAI(creature) + { + Initialize(); + } + + void Initialize() + { + Cleanse_Timer = 13000; + GreaterBless_Timer = 1000; + HolyLight_Timer = 7000; + DivineShield_Timer = 31000; + } uint32 Cleanse_Timer; uint32 GreaterBless_Timer; @@ -590,10 +631,7 @@ public: void Reset() override { - Cleanse_Timer = 13000; - GreaterBless_Timer = 1000; - HolyLight_Timer = 7000; - DivineShield_Timer = 31000; + Initialize(); AcquireGUID(); @@ -655,7 +693,17 @@ public: struct boss_lord_robin_darisAI : public boss_moroes_guestAI { //Arms Warr - boss_lord_robin_darisAI(Creature* creature) : boss_moroes_guestAI(creature) { } + boss_lord_robin_darisAI(Creature* creature) : boss_moroes_guestAI(creature) + { + Initialize(); + } + + void Initialize() + { + Hamstring_Timer = 7000; + MortalStrike_Timer = 10000; + WhirlWind_Timer = 21000; + } uint32 Hamstring_Timer; uint32 MortalStrike_Timer; @@ -663,9 +711,7 @@ public: void Reset() override { - Hamstring_Timer = 7000; - MortalStrike_Timer = 10000; - WhirlWind_Timer = 21000; + Initialize(); boss_moroes_guestAI::Reset(); } @@ -711,7 +757,18 @@ public: struct boss_lord_crispin_ferenceAI : public boss_moroes_guestAI { //Arms Warr - boss_lord_crispin_ferenceAI(Creature* creature) : boss_moroes_guestAI(creature) { } + boss_lord_crispin_ferenceAI(Creature* creature) : boss_moroes_guestAI(creature) + { + Initialize(); + } + + void Initialize() + { + Disarm_Timer = 6000; + HeroicStrike_Timer = 10000; + ShieldBash_Timer = 8000; + ShieldWall_Timer = 4000; + } uint32 Disarm_Timer; uint32 HeroicStrike_Timer; @@ -720,10 +777,7 @@ public: void Reset() override { - Disarm_Timer = 6000; - HeroicStrike_Timer = 10000; - ShieldBash_Timer = 8000; - ShieldWall_Timer = 4000; + Initialize(); boss_moroes_guestAI::Reset(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index ac24f868670..a928413fea0 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -78,6 +78,7 @@ public: { boss_netherspiteAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); for (int i=0; i<3; ++i) @@ -86,6 +87,19 @@ public: BeamTarget[i] = 0; BeamerGUID[i] = 0; } + + PortalPhase = false; + PhaseTimer = 0; + EmpowermentTimer = 0; + PortalTimer = 0; + } + + void Initialize() + { + Berserk = false; + NetherInfusionTimer = 540000; + VoidZoneTimer = 15000; + NetherbreathTimer = 3000; } InstanceScript* instance; @@ -129,10 +143,7 @@ public: void Reset() override { - Berserk = false; - NetherInfusionTimer = 540000; - VoidZoneTimer = 15000; - NetherbreathTimer = 3000; + Initialize(); HandleDoors(true); DestroyPortals(); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index af9f8b72abf..9084a6b0371 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -78,10 +78,32 @@ public: { boss_nightbaneAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); Intro = true; } + void Initialize() + { + BellowingRoarTimer = 30000; + CharredEarthTimer = 15000; + DistractingAshTimer = 20000; + SmolderingBreathTimer = 10000; + TailSweepTimer = 12000; + RainofBonesTimer = 10000; + SmokingBlastTimer = 20000; + FireballBarrageTimer = 13000; + SearingCindersTimer = 14000; + WaitTimer = 1000; + + Phase = 1; + FlyCount = 0; + MovePhase = 0; + + Flying = false; + Movement = false; + } + InstanceScript* instance; uint32 Phase; @@ -111,20 +133,7 @@ public: void Reset() override { - BellowingRoarTimer = 30000; - CharredEarthTimer = 15000; - DistractingAshTimer = 20000; - SmolderingBreathTimer = 10000; - TailSweepTimer = 12000; - RainofBonesTimer = 10000; - SmokingBlastTimer = 20000; - FireballBarrageTimer = 13000; - SearingCindersTimer = 14000; - WaitTimer = 1000; - - Phase =1; - FlyCount = 0; - MovePhase = 0; + Initialize(); me->SetSpeed(MOVE_RUN, 2.0f); me->SetDisableGravity(true); @@ -138,9 +147,6 @@ public: HandleTerraceDoors(true); - Flying = false; - Movement = false; - if (!Intro) { me->SetHomePosition(IntroWay[7][0], IntroWay[7][1], IntroWay[7][2], 0); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index 518c4eacbd9..c09b349f143 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -186,10 +186,33 @@ public: { boss_malchezaarAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); + instance = creature->GetInstanceScript(); memset(axes, 0, sizeof(axes)); } + void Initialize() + { + EnfeebleTimer = 30000; + EnfeebleResetTimer = 38000; + ShadowNovaTimer = 35500; + SWPainTimer = 20000; + AmplifyDamageTimer = 5000; + Cleave_Timer = 8000; + InfernalTimer = 40000; + InfernalCleanupTimer = 47000; + AxesTargetSwitchTimer = urand(7500, 20000); + SunderArmorTimer = urand(5000, 10000); + phase = 1; + + for (uint8 i = 0; i < 5; ++i) + { + enfeeble_targets[i] = 0; + enfeeble_health[i] = 0; + } + } + InstanceScript* instance; uint32 EnfeebleTimer; uint32 EnfeebleResetTimer; @@ -218,27 +241,11 @@ public: InfernalCleanup(); positions.clear(); - for (uint8 i = 0; i < 5; ++i) - { - enfeeble_targets[i] = 0; - enfeeble_health[i] = 0; - } + Initialize(); for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) positions.push_back(&InfernalPoints[i]); - EnfeebleTimer = 30000; - EnfeebleResetTimer = 38000; - ShadowNovaTimer = 35500; - SWPainTimer = 20000; - AmplifyDamageTimer = 5000; - Cleave_Timer = 8000; - InfernalTimer = 40000; - InfernalCleanupTimer = 47000; - AxesTargetSwitchTimer = urand(7500, 20000); - SunderArmorTimer = urand(5000, 10000); - phase = 1; - instance->HandleGameObject(instance->GetData64(DATA_GO_NETHER_DOOR), true); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 6a89adca967..c66f2b335c4 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -93,9 +93,35 @@ public: { boss_aranAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + SecondarySpellTimer = 5000; + NormalCastTimer = 0; + SuperCastTimer = 35000; + BerserkTimer = 720000; + CloseDoorTimer = 15000; + + LastSuperSpell = rand32() % 3; + + FlameWreathTimer = 0; + FlameWreathCheckTime = 0; + + CurrentNormalSpell = 0; + ArcaneCooldown = 0; + FireCooldown = 0; + FrostCooldown = 0; + + DrinkInterruptTimer = 10000; + + ElementalsSpawned = false; + Drinking = false; + DrinkInturrupted = false; + } + InstanceScript* instance; uint32 SecondarySpellTimer; @@ -125,27 +151,7 @@ public: void Reset() override { - SecondarySpellTimer = 5000; - NormalCastTimer = 0; - SuperCastTimer = 35000; - BerserkTimer = 720000; - CloseDoorTimer = 15000; - - LastSuperSpell = rand32() % 3; - - FlameWreathTimer = 0; - FlameWreathCheckTime = 0; - - CurrentNormalSpell = 0; - ArcaneCooldown = 0; - FireCooldown = 0; - FrostCooldown = 0; - - DrinkInterruptTimer = 10000; - - ElementalsSpawned = false; - Drinking = false; - DrinkInturrupted = false; + Initialize(); // Not in progress instance->SetData(TYPE_ARAN, NOT_STARTED); @@ -362,6 +368,10 @@ public: Available[0] = SUPER_FLAME; Available[1] = SUPER_AE; break; + default: + Available[0] = 0; + Available[1] = 0; + break; } LastSuperSpell = Available[urand(0, 1)]; @@ -508,13 +518,21 @@ public: struct water_elementalAI : public ScriptedAI { - water_elementalAI(Creature* creature) : ScriptedAI(creature) { } + water_elementalAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + CastTimer = 2000 + (rand32() % 3000); + } uint32 CastTimer; void Reset() override { - CastTimer = 2000 + (rand32() % 3000); + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index 9b66beb5986..ed40c18f70e 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -79,16 +79,22 @@ public: { npc_kilrekAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + AmplifyTimer = 2000; + } + InstanceScript* instance; uint32 AmplifyTimer; void Reset() override { - AmplifyTimer = 2000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -131,13 +137,21 @@ public: struct npc_demon_chainAI : public ScriptedAI { - npc_demon_chainAI(Creature* creature) : ScriptedAI(creature) { } + npc_demon_chainAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + SacrificeGUID = 0; + } uint64 SacrificeGUID; void Reset() override { - SacrificeGUID = 0; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -203,13 +217,21 @@ public: struct npc_fiendish_impAI : public ScriptedAI { - npc_fiendish_impAI(Creature* creature) : ScriptedAI(creature) { } + npc_fiendish_impAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + FireboltTimer = 2000; + } uint32 FireboltTimer; void Reset() override { - FireboltTimer = 2000; + Initialize(); me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); } @@ -247,11 +269,24 @@ public: { boss_terestianAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); for (uint8 i = 0; i < 2; ++i) PortalGUID[i] = 0; instance = creature->GetInstanceScript(); } + void Initialize() + { + PortalsCount = 0; + SacrificeTimer = 30000; + ShadowboltTimer = 5000; + SummonTimer = 10000; + BerserkTimer = 600000; + + SummonedPortals = false; + Berserk = false; + } + InstanceScript* instance; uint64 PortalGUID[2]; @@ -281,14 +316,7 @@ public: } } - PortalsCount = 0; - SacrificeTimer = 30000; - ShadowboltTimer = 5000; - SummonTimer = 10000; - BerserkTimer = 600000; - - SummonedPortals = false; - Berserk = false; + Initialize(); instance->SetData(TYPE_TERESTIAN, NOT_STARTED); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 19ec8da7fc9..ce8223c90cf 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -125,9 +125,22 @@ public: { boss_dorotheeAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + AggroTimer = 500; + + WaterBoltTimer = 5000; + FearTimer = 15000; + SummonTitoTimer = 47500; + + SummonedTito = false; + TitoDied = false; + } + InstanceScript* instance; uint32 AggroTimer; @@ -141,14 +154,7 @@ public: void Reset() override { - AggroTimer = 500; - - WaterBoltTimer = 5000; - FearTimer = 15000; - SummonTitoTimer = 47500; - - SummonedTito = false; - TitoDied = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override @@ -237,15 +243,23 @@ public: struct npc_titoAI : public ScriptedAI { - npc_titoAI(Creature* creature) : ScriptedAI(creature) { } + npc_titoAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + DorotheeGUID = 0; + YipTimer = 10000; + } uint64 DorotheeGUID; uint32 YipTimer; void Reset() override { - DorotheeGUID = 0; - YipTimer = 10000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -305,9 +319,17 @@ public: { boss_strawmanAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + AggroTimer = 13000; + BrainBashTimer = 5000; + BrainWipeTimer = 7000; + } + InstanceScript* instance; uint32 AggroTimer; @@ -316,9 +338,7 @@ public: void Reset() override { - AggroTimer = 13000; - BrainBashTimer = 5000; - BrainWipeTimer = 7000; + Initialize(); } void AttackStart(Unit* who) override @@ -419,9 +439,19 @@ public: { boss_tinheadAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + AggroTimer = 15000; + CleaveTimer = 5000; + RustTimer = 30000; + + RustCount = 0; + } + InstanceScript* instance; uint32 AggroTimer; @@ -432,11 +462,7 @@ public: void Reset() override { - AggroTimer = 15000; - CleaveTimer = 5000; - RustTimer = 30000; - - RustCount = 0; + Initialize(); } void EnterCombat(Unit* /*who*/) override @@ -528,9 +554,18 @@ public: { boss_roarAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + AggroTimer = 20000; + MangleTimer = 5000; + ShredTimer = 10000; + ScreamTimer = 15000; + } + InstanceScript* instance; uint32 AggroTimer; @@ -540,10 +575,7 @@ public: void Reset() override { - AggroTimer = 20000; - MangleTimer = 5000; - ShredTimer = 10000; - ScreamTimer = 15000; + Initialize(); } void MoveInLineOfSight(Unit* who) override @@ -636,9 +668,16 @@ public: { boss_croneAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + CycloneTimer = 30000; + ChainLightningTimer = 10000; + } + InstanceScript* instance; uint32 CycloneTimer; @@ -646,8 +685,7 @@ public: void Reset() override { - CycloneTimer = 30000; - ChainLightningTimer = 10000; + Initialize(); } void JustReachedHome() override @@ -717,13 +755,21 @@ public: struct npc_cycloneAI : public ScriptedAI { - npc_cycloneAI(Creature* creature) : ScriptedAI(creature) { } + npc_cycloneAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + MoveTimer = 1000; + } uint32 MoveTimer; void Reset() override { - MoveTimer = 1000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -812,9 +858,22 @@ public: { boss_bigbadwolfAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + ChaseTimer = 30000; + FearTimer = urand(25000, 35000); + SwipeTimer = 5000; + + HoodGUID = 0; + TempThreat = 0; + + IsChasing = false; + } + InstanceScript* instance; uint32 ChaseTimer; @@ -828,14 +887,7 @@ public: void Reset() override { - ChaseTimer = 30000; - FearTimer = urand(25000, 35000); - SwipeTimer = 5000; - - HoodGUID = 0; - TempThreat = 0; - - IsChasing = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override @@ -1011,12 +1063,30 @@ public: { boss_julianneAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); EntryYellTimer = 1000; AggroYellTimer = 10000; IsFakingDeath = false; } + void Initialize() + { + RomuloGUID = 0; + Phase = PHASE_JULIANNE; + + BlindingPassionTimer = 30000; + DevotionTimer = 15000; + EternalAffectionTimer = 25000; + PowerfulAttractionTimer = 5000; + SummonRomuloTimer = 10000; + DrinkPoisonTimer = 0; + ResurrectSelfTimer = 0; + + SummonedRomulo = false; + RomuloDead = false; + } + InstanceScript* instance; uint32 EntryYellTimer; @@ -1041,25 +1111,12 @@ public: void Reset() override { - RomuloGUID = 0; - Phase = PHASE_JULIANNE; - - BlindingPassionTimer = 30000; - DevotionTimer = 15000; - EternalAffectionTimer = 25000; - PowerfulAttractionTimer = 5000; - SummonRomuloTimer = 10000; - DrinkPoisonTimer = 0; - ResurrectSelfTimer = 0; - + Initialize(); if (IsFakingDeath) { Resurrect(me); IsFakingDeath = false; } - - SummonedRomulo = false; - RomuloDead = false; } void EnterCombat(Unit* /*who*/) override { } @@ -1131,11 +1188,27 @@ public: { boss_romuloAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); EntryYellTimer = 8000; AggroYellTimer = 15000; } + void Initialize() + { + JulianneGUID = 0; + Phase = PHASE_ROMULO; + + BackwardLungeTimer = 15000; + DaringTimer = 20000; + DeadlySwatheTimer = 25000; + PoisonThrustTimer = 10000; + ResurrectTimer = 10000; + + IsFakingDeath = false; + JulianneDead = false; + } + InstanceScript* instance; uint64 JulianneGUID; @@ -1154,17 +1227,7 @@ public: void Reset() override { - JulianneGUID = 0; - Phase = PHASE_ROMULO; - - BackwardLungeTimer = 15000; - DaringTimer = 20000; - DeadlySwatheTimer = 25000; - PoisonThrustTimer = 10000; - ResurrectTimer = 10000; - - IsFakingDeath = false; - JulianneDead = false; + Initialize(); } void JustReachedHome() override diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index c89950b7de3..c37829e26d5 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -131,11 +131,23 @@ public: { npc_barnesAI(Creature* creature) : npc_escortAI(creature) { + Initialize(); RaidWiped = false; m_uiEventId = 0; instance = creature->GetInstanceScript(); } + void Initialize() + { + m_uiSpotlightGUID = 0; + + TalkCount = 0; + TalkTimer = 2000; + WipeTimer = 5000; + + PerformanceReady = false; + } + InstanceScript* instance; uint64 m_uiSpotlightGUID; @@ -150,13 +162,7 @@ public: void Reset() override { - m_uiSpotlightGUID = 0; - - TalkCount = 0; - TalkTimer = 2000; - WipeTimer = 5000; - - PerformanceReady = false; + Initialize(); m_uiEventId = instance->GetData(DATA_OPERA_PERFORMANCE); } @@ -476,9 +482,20 @@ public: { npc_image_of_medivhAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); + Step = 0; + FireArcanagosTimer = 0; + FireMedivhTimer = 0; instance = creature->GetInstanceScript(); } + void Initialize() + { + ArcanagosGUID = 0; + EventStarted = false; + YellTimer = 0; + } + InstanceScript* instance; uint64 ArcanagosGUID; @@ -492,9 +509,7 @@ public: void Reset() override { - ArcanagosGUID = 0; - EventStarted = false; - YellTimer = 0; + Initialize(); if (instance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0) { diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 7944011c7a0..1aafb32cef9 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -103,9 +103,29 @@ public: { boss_felblood_kaelthasAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + /// @todo Timers + FireballTimer = 0; + PhoenixTimer = 10000; + FlameStrikeTimer = 25000; + CombatPulseTimer = 0; + + PyroblastTimer = 60000; + + GravityLapseTimer = 0; + GravityLapsePhase = 0; + + FirstGravityLapse = true; + HasTaunted = false; + + Phase = 0; + } + InstanceScript* instance; uint32 FireballTimer; @@ -134,21 +154,7 @@ public: void Reset() override { - /// @todo Timers - FireballTimer = 0; - PhoenixTimer = 10000; - FlameStrikeTimer = 25000; - CombatPulseTimer = 0; - - PyroblastTimer = 60000; - - GravityLapseTimer = 0; - GravityLapsePhase = 0; - - FirstGravityLapse = true; - HasTaunted = false; - - Phase = 0; + Initialize(); instance->SetBossState(DATA_KAELTHAS, NOT_STARTED); } @@ -439,13 +445,19 @@ public: { npc_felkael_flamestrikeAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); + } + + void Initialize() + { + FlameStrikeTimer = 5000; } uint32 FlameStrikeTimer; void Reset() override { - FlameStrikeTimer = 5000; + Initialize(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->setFaction(14); @@ -481,9 +493,18 @@ public: { npc_felkael_phoenixAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + BurnTimer = 2000; + Death_Timer = 3000; + Rebirth = false; + FakeDeath = false; + } + InstanceScript* instance; uint32 BurnTimer; uint32 Death_Timer; @@ -495,10 +516,7 @@ public: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); me->SetDisableGravity(true); DoCast(me, SPELL_PHOENIX_BURN, true); - BurnTimer = 2000; - Death_Timer = 3000; - Rebirth = false; - FakeDeath = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -592,13 +610,21 @@ public: struct npc_felkael_phoenix_eggAI : public ScriptedAI { - npc_felkael_phoenix_eggAI(Creature* creature) : ScriptedAI(creature) { } + npc_felkael_phoenix_eggAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + HatchTimer = 10000; + } uint32 HatchTimer; void Reset() override { - HatchTimer = 10000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index 40dedcf6d93..cc2af3dcea5 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -117,11 +117,24 @@ public: { boss_priestess_delrissaAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); memset(&m_auiLackeyGUID, 0, sizeof(m_auiLackeyGUID)); LackeyEntryList.clear(); } + void Initialize() + { + PlayersKilled = 0; + + HealTimer = 15000; + RenewTimer = 10000; + ShieldTimer = 2000; + SWPainTimer = 5000; + DispelTimer = 7500; + ResetTimer = 5000; + } + InstanceScript* instance; std::vector<uint32> LackeyEntryList; @@ -138,14 +151,7 @@ public: void Reset() override { - PlayersKilled = 0; - - HealTimer = 15000; - RenewTimer = 10000; - ShieldTimer = 2000; - SWPainTimer = 5000; - DispelTimer = 7500; - ResetTimer = 5000; + Initialize(); InitializeLackeys(); } @@ -353,11 +359,23 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI { boss_priestess_lackey_commonAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); memset(&m_auiLackeyGUIDs, 0, sizeof(m_auiLackeyGUIDs)); AcquireGUIDs(); } + void Initialize() + { + UsedPotion = false; + + // These guys does not follow normal threat system rules + // For later development, some alternative threat system should be made + // We do not know what this system is based upon, but one theory is class (healers=high threat, dps=medium, etc) + // We reset their threat frequently as an alternative until such a system exist + ResetThreatTimer = urand(5000, 20000); + } + InstanceScript* instance; uint64 m_auiLackeyGUIDs[MAX_ACTIVE_LACKEY]; @@ -367,13 +385,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI void Reset() override { - UsedPotion = false; - - // These guys does not follow normal threat system rules - // For later development, some alternative threat system should be made - // We do not know what this system is based upon, but one theory is class (healers=high threat, dps=medium, etc) - // We reset their threat frequently as an alternative until such a system exist - ResetThreatTimer = urand(5000, 20000); + Initialize(); // in case she is not alive and Reset was for some reason called, respawn her (most likely party wipe after killing her) if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA))) @@ -493,7 +505,20 @@ public: struct boss_kagani_nightstrikeAI : public boss_priestess_lackey_commonAI { //Rogue - boss_kagani_nightstrikeAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_kagani_nightstrikeAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + Gouge_Timer = 5500; + Kick_Timer = 7000; + Vanish_Timer = 2000; + Eviscerate_Timer = 6000; + Wait_Timer = 5000; + InVanish = false; + } uint32 Gouge_Timer; uint32 Kick_Timer; @@ -504,12 +529,7 @@ public: void Reset() override { - Gouge_Timer = 5500; - Kick_Timer = 7000; - Vanish_Timer = 2000; - Eviscerate_Timer = 6000; - Wait_Timer = 5000; - InVanish = false; + Initialize(); me->SetVisible(true); boss_priestess_lackey_commonAI::Reset(); @@ -597,7 +617,19 @@ public: struct boss_ellris_duskhallowAI : public boss_priestess_lackey_commonAI { //Warlock - boss_ellris_duskhallowAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_ellris_duskhallowAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + Immolate_Timer = 6000; + Shadow_Bolt_Timer = 3000; + Seed_of_Corruption_Timer = 2000; + Curse_of_Agony_Timer = 1000; + Fear_Timer = 10000; + } uint32 Immolate_Timer; uint32 Shadow_Bolt_Timer; @@ -607,11 +639,7 @@ public: void Reset() override { - Immolate_Timer = 6000; - Shadow_Bolt_Timer = 3000; - Seed_of_Corruption_Timer = 2000; - Curse_of_Agony_Timer = 1000; - Fear_Timer = 10000; + Initialize(); boss_priestess_lackey_commonAI::Reset(); } @@ -688,15 +716,23 @@ public: struct boss_eramas_brightblazeAI : public boss_priestess_lackey_commonAI { //Monk - boss_eramas_brightblazeAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_eramas_brightblazeAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + Knockdown_Timer = 6000; + Snap_Kick_Timer = 4500; + } uint32 Knockdown_Timer; uint32 Snap_Kick_Timer; void Reset() override { - Knockdown_Timer = 6000; - Snap_Kick_Timer = 4500; + Initialize(); boss_priestess_lackey_commonAI::Reset(); } @@ -749,7 +785,24 @@ public: struct boss_yazzaiAI : public boss_priestess_lackey_commonAI { //Mage - boss_yazzaiAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_yazzaiAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + HasIceBlocked = false; + + Polymorph_Timer = 1000; + Ice_Block_Timer = 20000; + Wait_Timer = 10000; + Blizzard_Timer = 8000; + Ice_Lance_Timer = 12000; + Cone_of_Cold_Timer = 10000; + Frostbolt_Timer = 3000; + Blink_Timer = 8000; + } bool HasIceBlocked; @@ -764,16 +817,7 @@ public: void Reset() override { - HasIceBlocked = false; - - Polymorph_Timer = 1000; - Ice_Block_Timer = 20000; - Wait_Timer = 10000; - Blizzard_Timer = 8000; - Ice_Lance_Timer = 12000; - Cone_of_Cold_Timer = 10000; - Frostbolt_Timer = 3000; - Blink_Timer = 8000; + Initialize(); boss_priestess_lackey_commonAI::Reset(); } @@ -879,7 +923,20 @@ public: struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI { //Warrior - boss_warlord_salarisAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_warlord_salarisAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + Intercept_Stun_Timer = 500; + Disarm_Timer = 6000; + Piercing_Howl_Timer = 10000; + Frightening_Shout_Timer = 18000; + Hamstring_Timer = 4500; + Mortal_Strike_Timer = 8000; + } uint32 Intercept_Stun_Timer; uint32 Disarm_Timer; @@ -890,12 +947,7 @@ public: void Reset() override { - Intercept_Stun_Timer = 500; - Disarm_Timer = 6000; - Piercing_Howl_Timer = 10000; - Frightening_Shout_Timer = 18000; - Hamstring_Timer = 4500; - Mortal_Strike_Timer = 8000; + Initialize(); boss_priestess_lackey_commonAI::Reset(); } @@ -1001,9 +1053,20 @@ public: //Hunter boss_garaxxasAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { + Initialize(); m_uiPetGUID = 0; } + void Initialize() + { + Aimed_Shot_Timer = 6000; + Shoot_Timer = 2500; + Concussive_Shot_Timer = 8000; + Multi_Shot_Timer = 10000; + Wing_Clip_Timer = 4000; + Freezing_Trap_Timer = 15000; + } + uint64 m_uiPetGUID; uint32 Aimed_Shot_Timer; @@ -1015,12 +1078,7 @@ public: void Reset() override { - Aimed_Shot_Timer = 6000; - Shoot_Timer = 2500; - Concussive_Shot_Timer = 8000; - Multi_Shot_Timer = 10000; - Wing_Clip_Timer = 4000; - Freezing_Trap_Timer = 15000; + Initialize(); Unit* pPet = ObjectAccessor::GetUnit(*me, m_uiPetGUID); if (!pPet) @@ -1110,7 +1168,20 @@ public: struct boss_apokoAI : public boss_priestess_lackey_commonAI { //Shaman - boss_apokoAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_apokoAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + Totem_Timer = 2000; + Totem_Amount = 1; + War_Stomp_Timer = 10000; + Purge_Timer = 8000; + Healing_Wave_Timer = 5000; + Frost_Shock_Timer = 7000; + } uint32 Totem_Timer; uint8 Totem_Amount; @@ -1121,12 +1192,7 @@ public: void Reset() override { - Totem_Timer = 2000; - Totem_Amount = 1; - War_Stomp_Timer = 10000; - Purge_Timer = 8000; - Healing_Wave_Timer = 5000; - Frost_Shock_Timer = 7000; + Initialize(); boss_priestess_lackey_commonAI::Reset(); } @@ -1199,7 +1265,19 @@ public: struct boss_zelfanAI : public boss_priestess_lackey_commonAI { //Engineer - boss_zelfanAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_zelfanAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + Goblin_Dragon_Gun_Timer = 20000; + Rocket_Launch_Timer = 7000; + Recombobulate_Timer = 4000; + High_Explosive_Sheep_Timer = 10000; + Fel_Iron_Bomb_Timer = 15000; + } uint32 Goblin_Dragon_Gun_Timer; uint32 Rocket_Launch_Timer; @@ -1209,11 +1287,7 @@ public: void Reset() override { - Goblin_Dragon_Gun_Timer = 20000; - Rocket_Launch_Timer = 7000; - Recombobulate_Timer = 4000; - High_Explosive_Sheep_Timer = 10000; - Fel_Iron_Bomb_Timer = 15000; + Initialize(); boss_priestess_lackey_commonAI::Reset(); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp index 28f4800b6cf..a20f595183f 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp @@ -115,13 +115,21 @@ public: struct npc_kalecgosAI : public ScriptedAI { - npc_kalecgosAI(Creature* creature) : ScriptedAI(creature) { } + npc_kalecgosAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + m_uiTransformTimer = 0; + } uint32 m_uiTransformTimer; void Reset() override { - m_uiTransformTimer = 0; + Initialize(); // we must assume he appear as dragon somewhere outside the platform of orb, and then move directly to here if (me->GetEntry() != NPC_KAEL) diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 95990f18829..7355674963a 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -102,9 +102,21 @@ public: { npc_unworthy_initiateAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); me->SetReactState(REACT_PASSIVE); if (!me->GetCurrentEquipmentId()) me->SetCurrentEquipmentId(me->GetOriginalEquipmentId()); + + playerGUID = 0; + wait_timer = 0; + anchorX = 0.f; + anchorY = 0.f; + } + + void Initialize() + { + anchorGUID = 0; + phase = PHASE_CHAINED; } uint64 playerGUID; @@ -117,8 +129,7 @@ public: void Reset() override { - anchorGUID = 0; - phase = PHASE_CHAINED; + Initialize(); events.Reset(); me->setFaction(7); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); @@ -516,7 +527,15 @@ public: { npc_death_knight_initiateAI(Creature* creature) : CombatAI(creature) { + Initialize(); + } + + void Initialize() + { + m_uiDuelerGUID = 0; + m_uiDuelTimer = 5000; m_bIsDuelInProgress = false; + lose = false; } bool lose; @@ -526,15 +545,11 @@ public: void Reset() override { - lose = false; + Initialize(); + me->RestoreFaction(); CombatAI::Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); - - m_uiDuelerGUID = 0; - m_uiDuelTimer = 5000; - m_bIsDuelInProgress = false; } void SpellHit(Unit* pCaster, const SpellInfo* pSpell) override @@ -630,9 +645,12 @@ class npc_dark_rider_of_acherus : public CreatureScript struct npc_dark_rider_of_acherusAI : public ScriptedAI { - npc_dark_rider_of_acherusAI(Creature* creature) : ScriptedAI(creature) { } + npc_dark_rider_of_acherusAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } - void Reset() override + void Initialize() { PhaseTimer = 4000; Phase = 0; @@ -640,6 +658,11 @@ class npc_dark_rider_of_acherus : public CreatureScript TargetGUID = 0; } + void Reset() override + { + Initialize(); + } + void UpdateAI(uint32 diff) override { if (!Intro || !TargetGUID) @@ -1067,18 +1090,24 @@ class npc_scarlet_miner : public CreatureScript { npc_scarlet_minerAI(Creature* creature) : npc_escortAI(creature) { + Initialize(); me->SetReactState(REACT_PASSIVE); } + void Initialize() + { + carGUID = 0; + IntroTimer = 0; + IntroPhase = 0; + } + uint32 IntroTimer; uint32 IntroPhase; uint64 carGUID; void Reset() override { - carGUID = 0; - IntroTimer = 0; - IntroPhase = 0; + Initialize(); } void IsSummonedBy(Unit* summoner) override diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 8e3743ad5e2..08e3de1941a 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -51,7 +51,17 @@ public: struct npc_crusade_persuadedAI : public ScriptedAI { - npc_crusade_persuadedAI(Creature* creature) : ScriptedAI(creature) { } + npc_crusade_persuadedAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + speechTimer = 0; + speechCounter = 0; + playerGUID = 0; + } uint32 speechTimer; uint32 speechCounter; @@ -59,9 +69,7 @@ public: void Reset() override { - speechTimer = 0; - speechCounter = 0; - playerGUID = 0; + Initialize(); me->SetReactState(REACT_AGGRESSIVE); me->RestoreFaction(); } @@ -207,16 +215,22 @@ public: { npc_koltira_deathweaverAI(Creature* creature) : npc_escortAI(creature) { + Initialize(); me->SetReactState(REACT_DEFENSIVE); } + void Initialize() + { + wave = 0; + waveTimer = 3000; + valrothGUID = 0; + } + void Reset() override { if (!HasEscortState(STATE_ESCORT_ESCORTING)) { - wave = 0; - waveTimer = 3000; - valrothGUID = 0; + Initialize(); me->LoadEquipment(0, true); me->RemoveAurasDueToSpell(SPELL_ANTI_MAGIC_ZONE); me->RemoveAurasDueToSpell(SPELL_KOLTIRA_TRANSFORM); @@ -467,7 +481,17 @@ public: struct npc_high_inquisitor_valrothAI : public ScriptedAI { - npc_high_inquisitor_valrothAI(Creature* creature) : ScriptedAI(creature) { } + npc_high_inquisitor_valrothAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + uiRenew_timer = 1000; + uiInquisitor_Penance_timer = 2000; + uiValroth_Smite_timer = 1000; + } uint32 uiRenew_timer; uint32 uiInquisitor_Penance_timer; @@ -475,9 +499,7 @@ public: void Reset() override { - uiRenew_timer = 1000; - uiInquisitor_Penance_timer = 2000; - uiValroth_Smite_timer = 1000; + Initialize(); } void EnterCombat(Unit* who) override @@ -603,7 +625,17 @@ public: struct npc_a_special_surpriseAI : public ScriptedAI { - npc_a_special_surpriseAI(Creature* creature) : ScriptedAI(creature) { } + npc_a_special_surpriseAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + ExecuteSpeech_Timer = 0; + ExecuteSpeech_Counter = 0; + PlayerGUID = 0; + } uint32 ExecuteSpeech_Timer; uint32 ExecuteSpeech_Counter; @@ -611,9 +643,7 @@ public: void Reset() override { - ExecuteSpeech_Timer = 0; - ExecuteSpeech_Counter = 0; - PlayerGUID = 0; + Initialize(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } 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/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp index 8e619864201..c6a91e3ff33 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp @@ -18,7 +18,7 @@ /* ScriptData SDName: Boss_Skarvald_Dalronn SD%Complete: 95 -SDComment: Needs adjustments to blizzlike timers, Yell Text + Sound to DB +SDComment: Needs adjustments to blizzlike timers SDCategory: Utgarde Keep EndScriptData */ @@ -26,21 +26,15 @@ EndScriptData */ #include "ScriptedCreature.h" #include "utgarde_keep.h" -enum Yells +enum Texts { - // signed for 24200, but used by 24200, 27390 - YELL_SKARVALD_AGGRO = 0, - YELL_SKARVALD_DAL_DIED = 1, - YELL_SKARVALD_SKA_DIEDFIRST = 2, - YELL_SKARVALD_KILL = 3, - YELL_SKARVALD_DAL_DIEDFIRST = 4, - - // signed for 24201, but used by 24201, 27389 - YELL_DALRONN_AGGRO = 0, - YELL_DALRONN_SKA_DIED = 1, - YELL_DALRONN_DAL_DIEDFIRST = 2, - YELL_DALRONN_KILL = 3, - YELL_DALRONN_SKA_DIEDFIRST = 4 + // Texts are common for both bosses and their ghosts. + SAY_AGGRO = 0, + SAY_DEATH = 1, // Said once both bosses are dead. + SAY_DIED_FIRST = 2, // Said by the first boss that dies. + SAY_KILL = 3, + SAY_DEATH_RESPONSE = 4 // Said by the boss alive after the first one dies. + }; enum Spells @@ -48,175 +42,189 @@ enum Spells // Spells of Skarvald and his Ghost SPELL_CHARGE = 43651, SPELL_STONE_STRIKE = 48583, - SPELL_SUMMON_SKARVALD_GHOST = 48613, SPELL_ENRAGE = 48193, + SPELL_SUMMON_SKARVALD_GHOST = 48613, + // Spells of Dalronn and his Ghost SPELL_SHADOW_BOLT = 43649, - H_SPELL_SHADOW_BOLT = 59575, - H_SPELL_SUMMON_SKELETONS = 52611, + SPELL_SUMMON_SKELETONS = 52611, SPELL_DEBILITATE = 43650, SPELL_SUMMON_DALRONN_GHOST = 48612, }; -class SkarvaldChargePredicate +enum Events { - public: - SkarvaldChargePredicate(Unit* unit) : me(unit) { } - - bool operator() (WorldObject* object) const - { - return object->GetDistance2d(me) >= 5.0f && object->GetDistance2d(me) <= 30.0f; - } + // Skarvald the Constructor + EVENT_SKARVALD_CHARGE = 1, + EVENT_STONE_STRIKE, + + // Dalronn the Controller + EVENT_SHADOW_BOLT, + EVENT_DEBILITATE, + EVENT_SUMMON_SKELETONS, + EVENT_DELAYED_AGGRO_SAY, // Dalronn's SAY_AGGRO is delayed so it doesn't overlap Skarvald's one. + + // Common event to both bosses. + // Delays SAY_DEATH_RESPONSE so it doesn't overlap with the SAY_DIED_FIRST from the boss that has just died. + EVENT_DEATH_RESPONSE +}; - private: - Unit* me; +enum Actions +{ + ACTION_OTHER_JUST_DIED = 1, + ACTION_DESPAWN_SUMMONS = 2 // Only needed to clear off the ghosts when the second boss dies. }; -class boss_skarvald_the_constructor : public CreatureScript +class SkarvaldChargePredicate { public: - boss_skarvald_the_constructor() : CreatureScript("boss_skarvald_the_constructor") { } + SkarvaldChargePredicate(Unit* unit) : _me(unit) { } - struct boss_skarvald_the_constructorAI : public BossAI + bool operator() (WorldObject* target) const { - boss_skarvald_the_constructorAI(Creature* creature) : BossAI(creature, DATA_SKARVALD_DALRONN) { } + return target->GetDistance2d(_me) >= 5.0f && target->GetDistance2d(_me) <= 30.0f; + } - bool ghost; - uint32 Charge_Timer; - uint32 StoneStrike_Timer; - uint32 Response_Timer; - uint32 Check_Timer; - bool Dalronn_isDead; - bool Enraged; + private: + Unit* _me; +}; - void Reset() override - { - Charge_Timer = 5000; - StoneStrike_Timer = 10000; - Dalronn_isDead = false; - Response_Timer = 0; - Check_Timer = 5000; - Enraged = false; +struct generic_boss_controllerAI : public BossAI +{ + generic_boss_controllerAI(Creature* creature) : BossAI(creature, DATA_SKARVALD_DALRONN) + { + OtherBossData = 0; + IsInGhostForm = me->GetEntry() == NPC_SKARVALD_GHOST || me->GetEntry() == NPC_DALRONN_GHOST; + } - ghost = me->GetEntry() == NPC_SKARVALD_GHOST; - if (!ghost) - _Reset(); - } + void Reset() override + { + if (IsInGhostForm) + { + // Call this here since ghosts aren't set in combat as they spawn. + DoZoneInCombat(me, 50.0f); + } + else + _Reset(); + } - void EnterCombat(Unit* /*who*/) override + void EnterCombat(Unit* /*who*/) override + { + if (!IsInGhostForm) + _EnterCombat(); + } + + void JustDied(Unit* /*killer*/) override + { + if (Creature* otherBoss = ObjectAccessor::GetCreature(*me, instance->GetData64(OtherBossData))) + { + if (otherBoss->IsAlive()) { - if (!ghost) - { - _EnterCombat(); - Talk(YELL_SKARVALD_AGGRO); - } + Talk(SAY_DIED_FIRST); + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + otherBoss->AI()->DoAction(ACTION_OTHER_JUST_DIED); + DoCast(me, OtherBossData == DATA_DALRONN ? SPELL_SUMMON_SKARVALD_GHOST : SPELL_SUMMON_DALRONN_GHOST, true); } - - void DamageTaken(Unit* /*attacker*/, uint32& damage) override + else { - if (!Enraged && !ghost && me->HealthBelowPctDamaged(15, damage)) - { - Enraged = true; - DoCast(me, SPELL_ENRAGE); - } + Talk(SAY_DEATH); + otherBoss->AI()->DoAction(ACTION_DESPAWN_SUMMONS); + _JustDied(); } + } + } - void DoAction(int32 /*actionId*/) - { + void DoAction(int32 actionId) override + { + switch (actionId) + { + case ACTION_OTHER_JUST_DIED: + events.ScheduleEvent(EVENT_DEATH_RESPONSE, 2000); + break; + case ACTION_DESPAWN_SUMMONS: summons.DespawnAll(); - } + break; + default: + break; + } + } + + void ExecuteEvent(uint32 eventId) override + { + if (eventId == EVENT_DEATH_RESPONSE) + Talk(SAY_DEATH_RESPONSE); + } + + void KilledUnit(Unit* who) override + { + if (!IsInGhostForm && who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); + } - void JustDied(Unit* killer) override + protected: + uint32 OtherBossData; + bool IsInGhostForm; +}; + +class boss_skarvald_the_constructor : public CreatureScript +{ + public: + boss_skarvald_the_constructor() : CreatureScript("boss_skarvald_the_constructor") { } + + struct boss_skarvald_the_constructorAI : public generic_boss_controllerAI + { + boss_skarvald_the_constructorAI(Creature* creature) : generic_boss_controllerAI(creature) { - if (!ghost) - { - if (Creature* dalronn = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALRONN))) - { - if (dalronn->IsAlive()) - { - Talk(YELL_SKARVALD_SKA_DIEDFIRST); - - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - - //DoCast(me, SPELL_SUMMON_SKARVALD_GHOST, true); - if (Creature* temp = me->SummonCreature(NPC_SKARVALD_GHOST, *me, TEMPSUMMON_CORPSE_DESPAWN, 5000)) - { - temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - temp->AI()->AttackStart(killer); - } - } - else - { - dalronn->AI()->DoAction(0); - _JustDied(); - Talk(YELL_SKARVALD_DAL_DIED); - } - } - } + OtherBossData = DATA_DALRONN; + Enraged = false; } - void KilledUnit(Unit* who) override + void Reset() override { - if (!ghost && who->GetTypeId() == TYPEID_PLAYER) - Talk(YELL_SKARVALD_KILL); + Enraged = false; + generic_boss_controllerAI::Reset(); } - void UpdateAI(uint32 diff) override + void EnterCombat(Unit* who) override { - if (!UpdateVictim()) - return; + generic_boss_controllerAI::EnterCombat(who); - if (!ghost) - { - if (Check_Timer) - { - if (Check_Timer <= diff) - { - Check_Timer = 5000; - Creature* dalronn = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALRONN)); - if (dalronn && dalronn->isDead()) - { - Dalronn_isDead = true; - Response_Timer = 2000; - Check_Timer = 0; - } - } - else - Check_Timer -= diff; - } - if (Response_Timer && Dalronn_isDead) - { - if (Response_Timer <= diff) - { - Talk(YELL_SKARVALD_DAL_DIEDFIRST); - - Response_Timer = 0; - } - else - Response_Timer -= diff; - } - } + if (!IsInGhostForm) + Talk(SAY_AGGRO); + + events.ScheduleEvent(EVENT_SKARVALD_CHARGE, 5000); + events.ScheduleEvent(EVENT_STONE_STRIKE, 10000); + } - if (Charge_Timer <= diff) + void ExecuteEvent(uint32 eventId) override + { + switch (eventId) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, SkarvaldChargePredicate(me))) - DoCast(target, SPELL_CHARGE); - Charge_Timer = 5000 + rand32() % 5000; + case EVENT_SKARVALD_CHARGE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, SkarvaldChargePredicate(me))) + DoCast(target, SPELL_CHARGE); + events.ScheduleEvent(EVENT_CHARGE, urand(5000, 10000)); + break; + case EVENT_STONE_STRIKE: + DoCastVictim(SPELL_STONE_STRIKE); + events.ScheduleEvent(EVENT_STONE_STRIKE, urand(5000, 10000)); + break; + default: + generic_boss_controllerAI::ExecuteEvent(eventId); + break; } - else - Charge_Timer -= diff; + } - if (StoneStrike_Timer <= diff) + void DamageTaken(Unit* /*attacker*/, uint32& damage) override + { + if (!Enraged && !IsInGhostForm && me->HealthBelowPctDamaged(15, damage)) { - DoCastVictim(SPELL_STONE_STRIKE); - StoneStrike_Timer = 5000 + rand32() % 5000; + Enraged = true; + DoCast(me, SPELL_ENRAGE); } - else - StoneStrike_Timer -= diff; - - if (!me->HasUnitState(UNIT_STATE_CASTING)) - DoMeleeAttackIfReady(); } + private: + bool Enraged; }; CreatureAI* GetAI(Creature* creature) const override @@ -230,171 +238,52 @@ class boss_dalronn_the_controller : public CreatureScript public: boss_dalronn_the_controller() : CreatureScript("boss_dalronn_the_controller") { } - struct boss_dalronn_the_controllerAI : public BossAI + struct boss_dalronn_the_controllerAI : public generic_boss_controllerAI { - boss_dalronn_the_controllerAI(Creature* creature) : BossAI(creature, DATA_SKARVALD_DALRONN) { } - - bool ghost; - uint32 ShadowBolt_Timer; - uint32 Debilitate_Timer; - uint32 Summon_Timer; - - uint32 Response_Timer; - uint32 Check_Timer; - uint32 AggroYell_Timer; - bool Skarvald_isDead; - - void Reset() override + boss_dalronn_the_controllerAI(Creature* creature) : generic_boss_controllerAI(creature) { - ShadowBolt_Timer = 1000; - Debilitate_Timer = 5000; - Summon_Timer = 10000; - Check_Timer = 5000; - Skarvald_isDead = false; - Response_Timer = 0; - AggroYell_Timer = 0; - - ghost = me->GetEntry() == NPC_DALRONN_GHOST; - if (!ghost) - _Reset(); + OtherBossData = DATA_SKARVALD; } - void EnterCombat(Unit* /*who*/) override + void EnterCombat(Unit* who) override { - if (!ghost) - { - _EnterCombat(); - AggroYell_Timer = 5000; - } - } + generic_boss_controllerAI::EnterCombat(who); - void DoAction(int32 /*actionId*/) - { - summons.DespawnAll(); - } + events.ScheduleEvent(EVENT_SHADOW_BOLT, 1000); + events.ScheduleEvent(EVENT_DEBILITATE, 5000); - void JustDied(Unit* killer) override - { - if (!ghost) - { - if (Creature* skarvald = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SKARVALD))) - { - if (skarvald->IsAlive()) - { - Talk(YELL_DALRONN_DAL_DIEDFIRST); - - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - - //DoCast(me, SPELL_SUMMON_DALRONN_GHOST, true); - if (Creature* temp = me->SummonCreature(NPC_DALRONN_GHOST, *me, TEMPSUMMON_CORPSE_DESPAWN, 5000)) - { - temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - temp->AI()->AttackStart(killer); - } - } - else - { - skarvald->AI()->DoAction(0); - _JustDied(); - Talk(YELL_DALRONN_SKA_DIED); - } - } - } - } + if (!IsInGhostForm) + events.ScheduleEvent(EVENT_DELAYED_AGGRO_SAY, 5000); - void KilledUnit(Unit* who) override - { - if (!ghost && who->GetTypeId() == TYPEID_PLAYER) - Talk(YELL_DALRONN_KILL); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SUMMON_SKELETONS, 10000); } - void UpdateAI(uint32 diff) override + void ExecuteEvent(uint32 eventId) override { - if (!UpdateVictim()) - return; - - if (AggroYell_Timer) + switch (eventId) { - if (AggroYell_Timer <= diff) - { - Talk(YELL_DALRONN_AGGRO); - - AggroYell_Timer = 0; - } - else - AggroYell_Timer -= diff; - } - - if (!ghost) - { - if (Check_Timer) - { - if (Check_Timer <= diff) - { - Check_Timer = 5000; - Creature* skarvald = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SKARVALD)); - if (skarvald && skarvald->isDead()) - { - Skarvald_isDead = true; - Response_Timer = 2000; - Check_Timer = 0; - } - } - else - Check_Timer -= diff; - } - - if (Response_Timer && Skarvald_isDead) - { - if (Response_Timer <= diff) - { - Talk(YELL_DALRONN_SKA_DIEDFIRST); - Response_Timer = 0; - } - else - Response_Timer -= diff; - } - } - - if (ShadowBolt_Timer <= diff) - { - if (!me->IsNonMeleeSpellCast(false)) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + case EVENT_SHADOW_BOLT: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true)) DoCast(target, SPELL_SHADOW_BOLT); - ShadowBolt_Timer = 2100;//give a 100ms pause to try cast other spells - } - } - else - ShadowBolt_Timer -= diff; - - if (Debilitate_Timer <= diff) - { - if (!me->IsNonMeleeSpellCast(false)) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + events.ScheduleEvent(EVENT_SHADOW_BOLT, 2100); //give a 100ms pause to try cast other spells + break; + case EVENT_DEBILITATE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) DoCast(target, SPELL_DEBILITATE); - Debilitate_Timer = 5000 + rand32() % 5000; - } - } - else - Debilitate_Timer -= diff; - - if (IsHeroic()) - { - if (Summon_Timer <= diff) - { - if (!me->IsNonMeleeSpellCast(false)) - { - DoCast(me, H_SPELL_SUMMON_SKELETONS); - Summon_Timer = (rand32() % 10000) + 20000; - } - } - else - Summon_Timer -= diff; + events.ScheduleEvent(EVENT_DEBILITATE, urand(5000, 10000)); + break; + case EVENT_SUMMON_SKELETONS: + DoCast(me, SPELL_SUMMON_SKELETONS); + events.ScheduleEvent(EVENT_SUMMON_SKELETONS, urand(10000, 30000)); + break; + case EVENT_DELAYED_AGGRO_SAY: + Talk(SAY_AGGRO); + break; + default: + generic_boss_controllerAI::ExecuteEvent(eventId); + break; } - - DoMeleeAttackIfReady(); } }; diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp deleted file mode 100644 index 9cb7505c015..00000000000 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - * 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 - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* ScriptData -SDName: Boss_Talon_King_Ikiss -SD%Complete: 80 -SDComment: Heroic supported. Some details missing, but most are spell related. -SDCategory: Auchindoun, Sethekk Halls -EndScriptData */ - -#include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "sethekk_halls.h" - -enum Says -{ - SAY_INTRO = 0, - SAY_AGGRO = 1, - SAY_SLAY = 2, - SAY_DEATH = 3, - EMOTE_ARCANE_EXP = 4 -}; - -enum Spells -{ - SPELL_BLINK = 38194, - SPELL_BLINK_TELEPORT = 38203, - SPELL_MANA_SHIELD = 38151, - SPELL_ARCANE_BUBBLE = 9438, - H_SPELL_SLOW = 35032, - SPELL_POLYMORPH = 38245, - H_SPELL_POLYMORPH = 43309, - SPELL_ARCANE_VOLLEY = 35059, - H_SPELL_ARCANE_VOLLEY = 40424, - SPELL_ARCANE_EXPLOSION = 38197, - H_SPELL_ARCANE_EXPLOSION = 40425 -}; - -class boss_talon_king_ikiss : public CreatureScript -{ -public: - boss_talon_king_ikiss() : CreatureScript("boss_talon_king_ikiss") { } - - struct boss_talon_king_ikissAI : public BossAI - { - boss_talon_king_ikissAI(Creature* creature) : BossAI(creature, DATA_TALON_KING_IKISS) { } - - void Reset() override - { - _Reset(); - ArcaneVolley_Timer = 5000; - Sheep_Timer = 8000; - Blink_Timer = 35000; - Slow_Timer = 15000 + rand32() % 15000; - Blink = false; - Intro = false; - ManaShield = false; - } - - void MoveInLineOfSight(Unit* who) override - { - if (!me->GetVictim() && me->CanCreatureAttack(who)) - { - if (!Intro && me->IsWithinDistInMap(who, 100)) - { - Intro = true; - Talk(SAY_INTRO); - } - - if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) - return; - - float attackRadius = me->GetAttackDistance(who); - if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who)) - { - //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); - AttackStart(who); - } - } - } - - void EnterCombat(Unit* /*who*/) override - { - _EnterCombat(); - Talk(SAY_AGGRO); - } - - void JustDied(Unit* /*killer*/) override - { - _JustDied(); - Talk(SAY_DEATH); - } - - void KilledUnit(Unit* who) override - { - if (who->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); - } - - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; - - if (Blink) - { - DoCast(me, SPELL_ARCANE_EXPLOSION); - DoCast(me, SPELL_ARCANE_BUBBLE, true); - Blink = false; - } - - if (ArcaneVolley_Timer <= diff) - { - DoCast(me, SPELL_ARCANE_VOLLEY); - ArcaneVolley_Timer = 7000 + rand32() % 5000; - } else ArcaneVolley_Timer -= diff; - - if (Sheep_Timer <= diff) - { - Unit* target; - - //second top aggro target in normal, random target in heroic correct? - if (IsHeroic()) - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - else - target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1); - - if (target) - DoCast(target, SPELL_POLYMORPH); - Sheep_Timer = 15000 + rand32() % 2500; - } else Sheep_Timer -= diff; - - //may not be correct time to cast - if (!ManaShield && HealthBelowPct(20)) - { - DoCast(me, SPELL_MANA_SHIELD); - ManaShield = true; - } - - if (IsHeroic()) - { - if (Slow_Timer <= diff) - { - DoCast(me, H_SPELL_SLOW); - Slow_Timer = 15000 + rand32() % 25000; - } else Slow_Timer -= diff; - } - - if (Blink_Timer <= diff) - { - Talk(EMOTE_ARCANE_EXP); - - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - if (me->IsNonMeleeSpellCast(false)) - me->InterruptNonMeleeSpells(false); - - //Spell doesn't work, but we use for visual effect at least - DoCast(target, SPELL_BLINK); - - float X = target->GetPositionX(); - float Y = target->GetPositionY(); - float Z = target->GetPositionZ(); - - DoTeleportTo(X, Y, Z); - - DoCast(target, SPELL_BLINK_TELEPORT); - Blink = true; - } - Blink_Timer = 35000 + rand32() % 5000; - } else Blink_Timer -= diff; - - if (!Blink) - DoMeleeAttackIfReady(); - } - - private: - uint32 ArcaneVolley_Timer; - uint32 Sheep_Timer; - uint32 Blink_Timer; - uint32 Slow_Timer; - - bool ManaShield; - bool Blink; - bool Intro; - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return GetSethekkHallsAI<boss_talon_king_ikissAI>(creature); - } -}; - -void AddSC_boss_talon_king_ikiss() -{ - new boss_talon_king_ikiss(); -} diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp new file mode 100644 index 00000000000..22914ca9094 --- /dev/null +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp @@ -0,0 +1,211 @@ +/* + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "sethekk_halls.h" + +enum Says +{ + SAY_INTRO = 0, + SAY_AGGRO = 1, + SAY_SLAY = 2, + SAY_DEATH = 3, + EMOTE_ARCANE_EXPLOSION = 4 +}; + +enum Spells +{ + SPELL_BLINK = 38194, + SPELL_BLINK_TELEPORT = 38203, + SPELL_MANA_SHIELD = 38151, + SPELL_ARCANE_BUBBLE = 9438, + SPELL_SLOW = 35032, + SPELL_POLYMORPH = 38245, + SPELL_ARCANE_VOLLEY = 35059, + SPELL_ARCANE_EXPLOSION = 38197, +}; + +enum Events +{ + EVENT_POLYMORPH = 1, + EVENT_BLINK, + EVENT_SLOW, + EVENT_ARCANE_VOLLEY, + EVENT_ARCANE_EXPLOSION +}; + +class boss_talon_king_ikiss : public CreatureScript +{ +public: + boss_talon_king_ikiss() : CreatureScript("boss_talon_king_ikiss") { } + + struct boss_talon_king_ikissAI : public BossAI + { + boss_talon_king_ikissAI(Creature* creature) : BossAI(creature, DATA_TALON_KING_IKISS) + { + Intro = false; + ManaShield = false; + } + + void Reset() override + { + _Reset(); + Intro = false; + ManaShield = false; + } + + void MoveInLineOfSight(Unit* who) override + { + if (!Intro && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 100.0f)) + { + Intro = true; + Talk(SAY_INTRO); + } + + BossAI::MoveInLineOfSight(who); + } + + void EnterCombat(Unit* /*who*/) override + { + _EnterCombat(); + Talk(SAY_AGGRO); + events.ScheduleEvent(EVENT_ARCANE_VOLLEY, 5000); + events.ScheduleEvent(EVENT_POLYMORPH, 8000); + events.ScheduleEvent(EVENT_BLINK, 35000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SLOW, urand(15000, 30000)); + } + + void ExecuteEvent(uint32 eventId) override + { + switch (eventId) + { + case EVENT_POLYMORPH: + // Second top aggro in normal, random target in heroic. + if (IsHeroic()) + DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_POLYMORPH); + else + DoCast(SelectTarget(SELECT_TARGET_TOPAGGRO, 1), SPELL_POLYMORPH); + events.ScheduleEvent(EVENT_POLYMORPH, urand(15000, 17500)); + break; + case EVENT_ARCANE_VOLLEY: + DoCast(me, SPELL_ARCANE_VOLLEY); + events.ScheduleEvent(EVENT_ARCANE_VOLLEY, urand(7000, 12000)); + break; + case EVENT_SLOW: + DoCast(me, SPELL_SLOW); + events.ScheduleEvent(EVENT_SLOW, urand(15000, 40000)); + break; + case EVENT_BLINK: + if (me->IsNonMeleeSpellCast(false)) + me->InterruptNonMeleeSpells(false); + Talk(EMOTE_ARCANE_EXPLOSION); + DoCastAOE(SPELL_BLINK); + events.ScheduleEvent(EVENT_BLINK, urand(35000, 40000)); + events.ScheduleEvent(EVENT_ARCANE_EXPLOSION, 1000); + break; + case EVENT_ARCANE_EXPLOSION: + DoCast(me, SPELL_ARCANE_EXPLOSION); + DoCast(me, SPELL_ARCANE_BUBBLE, true); + break; + default: + break; + } + } + + void DamageTaken(Unit* /*who*/, uint32& damage) override + { + if (!ManaShield && me->HealthBelowPctDamaged(20, damage)) + { + DoCast(me, SPELL_MANA_SHIELD); + ManaShield = true; + } + } + + void JustDied(Unit* /*killer*/) override + { + _JustDied(); + Talk(SAY_DEATH); + } + + void KilledUnit(Unit* who) override + { + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); + } + + private: + bool ManaShield; + bool Intro; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetSethekkHallsAI<boss_talon_king_ikissAI>(creature); + } +}; + +// 38194 - Blink +class spell_talon_king_ikiss_blink : public SpellScriptLoader +{ + public: + spell_talon_king_ikiss_blink() : SpellScriptLoader("spell_talon_king_ikiss_blink") { } + + class spell_talon_king_ikiss_blink_SpellScript : public SpellScript + { + PrepareSpellScript(spell_talon_king_ikiss_blink_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_BLINK_TELEPORT)) + return false; + return true; + } + + void FilterTargets(std::list<WorldObject*>& targets) + { + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(target); + } + + void HandleDummyHitTarget(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetHitUnit()->CastSpell(GetCaster(), SPELL_BLINK_TELEPORT, true); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_talon_king_ikiss_blink_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_talon_king_ikiss_blink_SpellScript::HandleDummyHitTarget, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_talon_king_ikiss_blink_SpellScript(); + } +}; + +void AddSC_boss_talon_king_ikiss() +{ + new boss_talon_king_ikiss(); + new spell_talon_king_ikiss_blink(); +} 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/CMakeLists.txt b/src/server/scripts/Outland/CMakeLists.txt index 0c69a236ef8..ffc9b514abf 100644 --- a/src/server/scripts/Outland/CMakeLists.txt +++ b/src/server/scripts/Outland/CMakeLists.txt @@ -88,7 +88,7 @@ set(scripts_STAT_SRCS Outland/Auchindoun/ManaTombs/instance_mana_tombs.cpp Outland/Auchindoun/ManaTombs/mana_tombs.h Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp - Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp + Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp Outland/Auchindoun/SethekkHalls/boss_anzu.cpp Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp Outland/Auchindoun/SethekkHalls/sethekk_halls.h 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_zangarmarsh.cpp b/src/server/scripts/Outland/zone_zangarmarsh.cpp index b9736c523c3..c7627d1aa04 100644 --- a/src/server/scripts/Outland/zone_zangarmarsh.cpp +++ b/src/server/scripts/Outland/zone_zangarmarsh.cpp @@ -178,6 +178,12 @@ public: npc_cooshcooshAI(Creature* creature) : ScriptedAI(creature) { m_uiNormFaction = creature->getFaction(); + Initialize(); + } + + void Initialize() + { + LightningBolt_Timer = 2000; } uint32 m_uiNormFaction; @@ -185,7 +191,7 @@ public: void Reset() override { - LightningBolt_Timer = 2000; + Initialize(); if (me->getFaction() != m_uiNormFaction) me->setFaction(m_uiNormFaction); } diff --git a/src/server/scripts/Pet/pet_dk.cpp b/src/server/scripts/Pet/pet_dk.cpp index 34da2a242f4..b24336cb33c 100644 --- a/src/server/scripts/Pet/pet_dk.cpp +++ b/src/server/scripts/Pet/pet_dk.cpp @@ -43,12 +43,20 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript struct npc_pet_dk_ebon_gargoyleAI : CasterAI { - npc_pet_dk_ebon_gargoyleAI(Creature* creature) : CasterAI(creature) { } + npc_pet_dk_ebon_gargoyleAI(Creature* creature) : CasterAI(creature) + { + Initialize(); + } - void InitializeAI() override + void Initialize() { // Not needed to be despawned now _despawnTimer = 0; + } + + void InitializeAI() override + { + Initialize(); CasterAI::InitializeAI(); uint64 ownerGuid = me->GetOwnerGUID(); diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp index cfb4820c040..d0e950dec32 100644 --- a/src/server/scripts/Pet/pet_generic.cpp +++ b/src/server/scripts/Pet/pet_generic.cpp @@ -39,11 +39,19 @@ class npc_pet_gen_mojo : public CreatureScript struct npc_pet_gen_mojoAI : public ScriptedAI { - npc_pet_gen_mojoAI(Creature* creature) : ScriptedAI(creature) { } + npc_pet_gen_mojoAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } - void Reset() override + void Initialize() { _victimGUID = 0; + } + + void Reset() override + { + Initialize(); if (Unit* owner = me->GetOwner()) me->GetMotionMaster()->MoveFollow(owner, 0.0f, 0.0f); diff --git a/src/server/scripts/Pet/pet_hunter.cpp b/src/server/scripts/Pet/pet_hunter.cpp index 8fd6cb54b0e..20412415fbe 100644 --- a/src/server/scripts/Pet/pet_hunter.cpp +++ b/src/server/scripts/Pet/pet_hunter.cpp @@ -42,13 +42,22 @@ class npc_pet_hunter_snake_trap : public CreatureScript struct npc_pet_hunter_snake_trapAI : public ScriptedAI { - npc_pet_hunter_snake_trapAI(Creature* creature) : ScriptedAI(creature) { } + npc_pet_hunter_snake_trapAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + _spellTimer = 0; + _isViper = false; + } void EnterCombat(Unit* /*who*/) override { } void Reset() override { - _spellTimer = 0; + Initialize(); CreatureTemplate const* Info = me->GetCreatureTemplate(); diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp index 950b4cd10e9..23e373312cb 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -170,13 +170,19 @@ class npc_dream_fog : public CreatureScript { npc_dream_fogAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); } - void Reset() override + void Initialize() { _roamTimer = 0; } + void Reset() override + { + Initialize(); + } + void UpdateAI(uint32 diff) override { if (!UpdateVictim()) @@ -247,11 +253,17 @@ class boss_ysondre : public CreatureScript { boss_ysondreAI(Creature* creature) : emerald_dragonAI(creature) { + Initialize(); } - void Reset() override + void Initialize() { _stage = 1; + } + + void Reset() override + { + Initialize(); emerald_dragonAI::Reset(); events.ScheduleEvent(EVENT_LIGHTNING_WAVE, 12000); } @@ -335,11 +347,17 @@ class boss_lethon : public CreatureScript { boss_lethonAI(Creature* creature) : emerald_dragonAI(creature) { + Initialize(); } - void Reset() override + void Initialize() { _stage = 1; + } + + void Reset() override + { + Initialize(); emerald_dragonAI::Reset(); events.ScheduleEvent(EVENT_SHADOW_BOLT_WHIRL, 10000); } @@ -457,11 +475,17 @@ class boss_emeriss : public CreatureScript { boss_emerissAI(Creature* creature) : emerald_dragonAI(creature) { + Initialize(); } - void Reset() override + void Initialize() { _stage = 1; + } + + void Reset() override + { + Initialize(); emerald_dragonAI::Reset(); events.ScheduleEvent(EVENT_VOLATILE_INFECTION, 12000); } @@ -549,16 +573,22 @@ class boss_taerar : public CreatureScript { boss_taerarAI(Creature* creature) : emerald_dragonAI(creature) { + Initialize(); } - void Reset() override + void Initialize() { - me->RemoveAurasDueToSpell(SPELL_SHADE); _stage = 1; - _shades = 0; _banished = false; _banishedTimer = 0; + } + + void Reset() override + { + me->RemoveAurasDueToSpell(SPELL_SHADE); + + Initialize(); emerald_dragonAI::Reset(); events.ScheduleEvent(EVENT_ARCANE_BLAST, 12000); diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp index a156a41fcef..bd953a285ab 100644 --- a/src/server/scripts/World/guards.cpp +++ b/src/server/scripts/World/guards.cpp @@ -54,14 +54,22 @@ public: struct guard_genericAI : public GuardAI { - guard_genericAI(Creature* creature) : GuardAI(creature) { } + guard_genericAI(Creature* creature) : GuardAI(creature) + { + Initialize(); + } - void Reset() override + void Initialize() { globalCooldown = 0; buffTimer = 0; } + void Reset() override + { + Initialize(); + } + void EnterCombat(Unit* who) override { if (me->GetEntry() == NPC_CENARION_HOLD_INFANTRY) @@ -263,9 +271,12 @@ public: struct guard_shattrath_scryerAI : public GuardAI { - guard_shattrath_scryerAI(Creature* creature) : GuardAI(creature) { } + guard_shattrath_scryerAI(Creature* creature) : GuardAI(creature) + { + Initialize(); + } - void Reset() override + void Initialize() { banishTimer = 5000; exileTimer = 8500; @@ -273,6 +284,11 @@ public: canTeleport = false; } + void Reset() override + { + Initialize(); + } + void UpdateAI(uint32 diff) override { if (!UpdateVictim()) @@ -328,9 +344,12 @@ public: struct guard_shattrath_aldorAI : public GuardAI { - guard_shattrath_aldorAI(Creature* creature) : GuardAI(creature) { } + guard_shattrath_aldorAI(Creature* creature) : GuardAI(creature) + { + Initialize(); + } - void Reset() override + void Initialize() { banishTimer = 5000; exileTimer = 8500; @@ -338,6 +357,11 @@ public: canTeleport = false; } + void Reset() override + { + Initialize(); + } + void UpdateAI(uint32 diff) override { if (!UpdateVictim()) diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp index a27a78a5338..eb6fbea170e 100644 --- a/src/server/scripts/World/mob_generic_creature.cpp +++ b/src/server/scripts/World/mob_generic_creature.cpp @@ -36,7 +36,17 @@ public: struct generic_creatureAI : public ScriptedAI { - generic_creatureAI(Creature* creature) : ScriptedAI(creature) { } + generic_creatureAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + GlobalCooldown = 0; + BuffTimer = 0; //Rebuff as soon as we can + IsSelfRooted = false; + } uint32 GlobalCooldown; //This variable acts like the global cooldown that players have (1.5 seconds) uint32 BuffTimer; //This variable keeps track of buffs @@ -44,9 +54,7 @@ public: void Reset() override { - GlobalCooldown = 0; - BuffTimer = 0; //Rebuff as soon as we can - IsSelfRooted = false; + Initialize(); } void EnterCombat(Unit* who) override diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index e8a4a78e1bb..944ebe27b7b 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -329,13 +329,21 @@ public: struct npc_chicken_cluckAI : public ScriptedAI { - npc_chicken_cluckAI(Creature* creature) : ScriptedAI(creature) { } + npc_chicken_cluckAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + ResetFlagTimer = 120000; + } uint32 ResetFlagTimer; void Reset() override { - ResetFlagTimer = 120000; + Initialize(); me->setFaction(FACTION_CHICKEN); me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); } @@ -424,15 +432,23 @@ public: struct npc_dancing_flamesAI : public ScriptedAI { - npc_dancing_flamesAI(Creature* creature) : ScriptedAI(creature) { } + npc_dancing_flamesAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + Active = true; + CanIteract = 3500; + } bool Active; uint32 CanIteract; void Reset() override { - Active = true; - CanIteract = 3500; + Initialize(); DoCast(me, SPELL_BRAZIER, true); DoCast(me, SPELL_FIERY_AURA, false); float x, y, z; @@ -575,7 +591,25 @@ public: struct npc_doctorAI : public ScriptedAI { - npc_doctorAI(Creature* creature) : ScriptedAI(creature) { } + npc_doctorAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + PlayerGUID = 0; + + SummonPatientTimer = 10000; + SummonPatientCount = 0; + PatientDiedCount = 0; + PatientSavedCount = 0; + + Patients.clear(); + Coordinates.clear(); + + Event = false; + } uint64 PlayerGUID; @@ -591,18 +625,7 @@ public: void Reset() override { - PlayerGUID = 0; - - SummonPatientTimer = 10000; - SummonPatientCount = 0; - PatientDiedCount = 0; - PatientSavedCount = 0; - - Patients.clear(); - Coordinates.clear(); - - Event = false; - + Initialize(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } @@ -720,15 +743,23 @@ public: struct npc_injured_patientAI : public ScriptedAI { - npc_injured_patientAI(Creature* creature) : ScriptedAI(creature) { } + npc_injured_patientAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + DoctorGUID = 0; + Coord = NULL; + } uint64 DoctorGUID; Location* Coord; void Reset() override { - DoctorGUID = 0; - Coord = NULL; + Initialize(); //no select me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -1449,14 +1480,20 @@ public: { npc_tonk_mineAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); me->SetReactState(REACT_PASSIVE); } + void Initialize() + { + ExplosionTimer = 3000; + } + uint32 ExplosionTimer; void Reset() override { - ExplosionTimer = 3000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -1651,13 +1688,21 @@ class npc_wormhole : public CreatureScript struct npc_wormholeAI : public PassiveAI { - npc_wormholeAI(Creature* creature) : PassiveAI(creature) { } + npc_wormholeAI(Creature* creature) : PassiveAI(creature) + { + Initialize(); + } - void InitializeAI() override + void Initialize() { _showUnderground = urand(0, 100) == 0; // Guessed value, it is really rare though } + void InitializeAI() override + { + Initialize(); + } + uint32 GetData(uint32 type) const override { return (type == DATA_SHOW_UNDERGROUND && _showUnderground) ? 1 : 0; @@ -2305,7 +2350,19 @@ public: struct npc_spring_rabbitAI : public ScriptedAI { - npc_spring_rabbitAI(Creature* creature) : ScriptedAI(creature) { } + npc_spring_rabbitAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + inLove = false; + rabbitGUID = 0; + jumpTimer = urand(5000, 10000); + bunnyTimer = urand(10000, 20000); + searchTimer = urand(5000, 10000); + } bool inLove; uint32 jumpTimer; @@ -2315,11 +2372,7 @@ public: void Reset() override { - inLove = false; - rabbitGUID = 0; - jumpTimer = urand(5000, 10000); - bunnyTimer = urand(10000, 20000); - searchTimer = urand(5000, 10000); + Initialize(); if (Unit* owner = me->GetOwner()) me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); } diff --git a/src/tools/vmap4_extractor/model.cpp b/src/tools/vmap4_extractor/model.cpp index c527ec32ddb..519f59cb086 100644 --- a/src/tools/vmap4_extractor/model.cpp +++ b/src/tools/vmap4_extractor/model.cpp @@ -143,6 +143,7 @@ Vec3D fixCoordSystem2(Vec3D v) } ModelInstance::ModelInstance(MPQFile& f, char const* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile) + : scale(0), flags(0) { float ff[3]; f.read(&id, 4); |