diff --git a/.github/actions/linux-build/action.yml b/.github/actions/linux-build/action.yml index d06f88551..739be2342 100644 --- a/.github/actions/linux-build/action.yml +++ b/.github/actions/linux-build/action.yml @@ -130,6 +130,7 @@ runs: AC_CHARACTER_DATABASE_INFO=localhost;3306;root;root;acore_characters AC_WORLD_DATABASE_INFO=localhost;3306;root;root;acore_world AC_DATA_DIR=env/dist/data + AC_LOGS_DIR=env/dist/logs EOF - name: get dbc files @@ -156,7 +157,7 @@ runs: - name: Check startup errors shell: bash run: | - error_log="./env/dist/bin/Errors.log" + error_log="$AC_LOGS_DIR/Errors.log" # -s checks if the file's size is greater than 0 bytes # ! -s checks if the file's size is less than/equal to 0 bytes # if the error log is empty, exit without error diff --git a/data/sql/updates/db_world/2024_06_24_03.sql b/data/sql/updates/db_world/2024_06_24_03.sql new file mode 100644 index 000000000..c996dd865 --- /dev/null +++ b/data/sql/updates/db_world/2024_06_24_03.sql @@ -0,0 +1,2 @@ +-- DB update 2024_06_24_02 -> 2024_06_24_03 +UPDATE `creature_template` SET `flags_extra` = `flags_extra` | 0x00000008 WHERE `entry` IN (19514, 22947, 23576); diff --git a/data/sql/updates/db_world/2024_06_25_00.sql b/data/sql/updates/db_world/2024_06_25_00.sql new file mode 100644 index 000000000..d4347c837 --- /dev/null +++ b/data/sql/updates/db_world/2024_06_25_00.sql @@ -0,0 +1,2 @@ +-- DB update 2024_06_24_03 -> 2024_06_25_00 +UPDATE `creature_template` SET `minlevel` = 80, `maxlevel` = 80 WHERE `entry` = 26339; diff --git a/data/sql/updates/db_world/2024_06_25_01.sql b/data/sql/updates/db_world/2024_06_25_01.sql new file mode 100644 index 000000000..4af7f528e --- /dev/null +++ b/data/sql/updates/db_world/2024_06_25_01.sql @@ -0,0 +1,6 @@ +-- DB update 2024_06_25_00 -> 2024_06_25_01 +-- +UPDATE `spell_script_names` SET `ScriptName`='spell_q10923_evil_draws_near_periodic_aura' WHERE `spell_id`=39259; +UPDATE `spell_script_names` SET `ScriptName`='spell_mark_of_kazzak_aura' WHERE `spell_id`=32960; +UPDATE `spell_script_names` SET `ScriptName`='spell_npc22275_crystal_prison_aura' WHERE `spell_id`=40846; +UPDATE `spell_script_names` SET `ScriptName`='spell_q10563_q10596_to_legion_hold_aura' WHERE `spell_id`=37097; diff --git a/data/sql/updates/db_world/2024_06_25_02.sql b/data/sql/updates/db_world/2024_06_25_02.sql new file mode 100644 index 000000000..5c6e84c1a --- /dev/null +++ b/data/sql/updates/db_world/2024_06_25_02.sql @@ -0,0 +1,3 @@ +-- DB update 2024_06_25_01 -> 2024_06_25_02 +-- Zaxxis Insignia +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 1) AND (`SourceEntry` = 29209) AND (`ConditionTypeOrReference` = 8) AND (`ConditionValue1` = 10265); diff --git a/data/sql/updates/db_world/2024_06_25_03.sql b/data/sql/updates/db_world/2024_06_25_03.sql new file mode 100644 index 000000000..fb3d40612 --- /dev/null +++ b/data/sql/updates/db_world/2024_06_25_03.sql @@ -0,0 +1,14 @@ +-- DB update 2024_06_25_02 -> 2024_06_25_03 +-- adjust chances in tbc reference +UPDATE `reference_loot_template` SET `Chance` = 2 WHERE `Reference` = 11114 AND `Item` = 34834; -- lager +UPDATE `reference_loot_template` SET `Chance` = 2 WHERE `Reference` = 11114 AND `Item` = 34836; -- line +-- create tbc template entries +DELETE FROM `item_loot_template` WHERE `Item` = 34834 AND `Entry` IN (33844, 33857); +INSERT INTO `item_loot_template` (`Entry`, `Item`, `Reference`, `Chance`, `QuestRequired`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`, `Comment`) VALUES +(33844, 34834, 0, 0.15, 0, 1, 3, 1, 1, 'Barrel of Fish - Recipe: Captain Rumsey''s Lager'), +(33857, 34834, 0, 0.1, 0, 1, 2, 1, 1, 'Crate of Meat - Recipe: Captain Rumsey''s Lager'); +-- adjust tbc template chances +UPDATE `item_loot_template` SET `Chance` = 100 WHERE `Reference` = 11114 AND `Entry` IN (34863, 35348); +-- adjust wotlk template chances +UPDATE `item_loot_template` SET `Chance` = 0.6 WHERE `Entry` = 46007 AND `Item` = 34834; +UPDATE `item_loot_template` SET `Chance` = 0.8 WHERE `Entry` = 44113 AND `Item` = 34834; diff --git a/data/sql/updates/db_world/2024_06_25_04.sql b/data/sql/updates/db_world/2024_06_25_04.sql new file mode 100644 index 000000000..262735887 --- /dev/null +++ b/data/sql/updates/db_world/2024_06_25_04.sql @@ -0,0 +1,18 @@ +-- DB update 2024_06_25_03 -> 2024_06_25_04 +-- loot cleanup +DELETE FROM `creature_loot_template` WHERE `Entry` = 20784 AND `Item` = 31943; -- Armbreaker Huffaz +DELETE FROM `creature_loot_template` WHERE `Entry` = 20785 AND `Item` = 31573; -- Fel Tinkerer Zortan +DELETE FROM `creature_loot_template` WHERE `Entry` = 20786 AND `Item` IN (31929, 31937, 31939, 31940); -- Gul'bor +DELETE FROM `creature_loot_template` WHERE `Entry` = 20788 AND `Item` = 31565; -- Forgosh +DELETE FROM `creature_loot_template` WHERE `Entry` = 20789 AND `Item` = 32520; -- Wrathbringer Laz-tarash +DELETE FROM `creature_loot_template` WHERE `Entry` = 20790 AND `Item` = 31581; -- Malevus the Mad + +-- reference time baby +INSERT INTO `creature_loot_template` (`Entry`, `Item`, `Reference`, `Chance`, `QuestRequired`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`, `Comment`) VALUES +(20783, 14501, 14501, 100, 0, 1, 0, 1, 1, 'Porfus the Gem Gorger - (ReferenceTable)'), +(20784, 14501, 14501, 100, 0, 1, 0, 1, 1, 'Armbreaker Huffaz - (ReferenceTable)'), +(20785, 14501, 14501, 100, 0, 1, 0, 1, 1, 'Fel Tinkerer Zortan - (ReferenceTable)'), +(20786, 14501, 14501, 100, 0, 1, 0, 1, 1, 'Gul''bor - (ReferenceTable)'), +(20788, 14501, 14501, 100, 0, 1, 0, 1, 1, 'Forgosh - (ReferenceTable)'), +(20789, 14501, 14501, 100, 0, 1, 0, 1, 1, 'Wrathbringer Laz-tarash - (ReferenceTable)'), +(20790, 14501, 14501, 100, 0, 1, 0, 1, 1, 'Malevus the Mad - (ReferenceTable)'); diff --git a/data/sql/updates/db_world/2024_06_25_05.sql b/data/sql/updates/db_world/2024_06_25_05.sql new file mode 100644 index 000000000..c385f6820 --- /dev/null +++ b/data/sql/updates/db_world/2024_06_25_05.sql @@ -0,0 +1,14 @@ +-- DB update 2024_06_25_04 -> 2024_06_25_05 +-- Lashh'an Kalir & Lashh'an Talonite +DELETE FROM `creature` WHERE (`id1` = 20109); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` IN (19943,20109)); +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`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19943, 0, 0, 0, 0, 0, 100, 0, 2600, 4000, 5000, 8000, 0, 0, 11, 37685, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Talonite - In Combat - Cast \'Backstab\''), +(19943, 0, 1, 0, 25, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 34854, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Talonite - On Reset - Cast \'Lashh`an Kaliri\''), +(19943, 0, 2, 0, 6, 0, 100, 0, 0, 0, 0, 0, 0, 0, 75, 8602, 0, 0, 0, 0, 0, 204, 20109, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Talonite - On Just Died - Add Aura \'Vengeance\' to Lashh`an Kaliri'), +(20109, 0, 0, 0, 23, 0, 50, 1, 8602, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Kaliri - On Aura \'Vengeance\' - Say Line 0 (No Repeat)'); + +DELETE FROM `creature_text` WHERE (`CreatureID` = 20109); +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES +(20109, 0, 0, '%s goes into a rage after seeing its master fall in battle!', 16, 0, 100, 0, 0, 0, 19437, 0, 'Lashh\'an Kalir - Enrage'); diff --git a/data/sql/updates/db_world/2024_06_25_06.sql b/data/sql/updates/db_world/2024_06_25_06.sql new file mode 100644 index 000000000..43564418f --- /dev/null +++ b/data/sql/updates/db_world/2024_06_25_06.sql @@ -0,0 +1,25 @@ +-- DB update 2024_06_25_05 -> 2024_06_25_06 +-- Durnholde Lodges (First one was already linked) +-- "Additional NPCs" 83958 & 83934 +UPDATE `creature_formations` SET `groupAI` = 3 WHERE `leaderGUID` = 83929; + +DELETE FROM `creature_formations` WHERE `leaderGUID` IN (83927,83922,83948,77820); +INSERT INTO `creature_formations` (`leaderGUID`, `memberGUID`, `dist`, `angle`, `groupAI`, `point_1`, `point_2`) VALUES +(83927, 83927, 0, 0, 3, 0, 0), +(83927, 83926, 0, 0, 3, 0, 0), +(83927, 83987, 0, 0, 3, 0, 0), +(83927, 77817, 0, 0, 3, 0, 0), +(83927, 83934, 0, 0, 3, 0, 0), +(83922, 83922, 0, 0, 3, 0, 0), +(83922, 83923, 0, 0, 3, 0, 0), +(83922, 77818, 0, 0, 3, 0, 0), +(83922, 83924, 0, 0, 3, 0, 0), +(83948, 83948, 0, 0, 3, 0, 0), +(83948, 83949, 0, 0, 3, 0, 0), +(83948, 77819, 0, 0, 3, 0, 0), +(83948, 83959, 0, 0, 3, 0, 0), +(77820, 77820, 0, 0, 3, 0, 0), +(77820, 77854, 0, 0, 3, 0, 0), +(77820, 83955, 0, 0, 3, 0, 0), +(77820, 83956, 0, 0, 3, 0, 0), +(77820, 83958, 0, 0, 3, 0, 0); diff --git a/data/sql/updates/db_world/2024_06_25_07.sql b/data/sql/updates/db_world/2024_06_25_07.sql new file mode 100644 index 000000000..54ce6cefb --- /dev/null +++ b/data/sql/updates/db_world/2024_06_25_07.sql @@ -0,0 +1,8 @@ +-- DB update 2024_06_25_06 -> 2024_06_25_07 +-- Kirin'Var Apprentice +UPDATE `creature_template_addon` SET `auras` = '33900' WHERE (`entry` = 20409); +UPDATE `creature_addon` SET `auras` = '33900' WHERE `guid` IN (72371, 72374, 72375, 72377, 72378, 72379); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 20409); +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`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(20409, 0, 0, 0, 9, 0, 100, 0, 0, 0, 0, 0, 10, 35, 11, 36099, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Kirin\'Var Apprentice - Within 10-35 Range - Cast \'Throw Hammer\''); diff --git a/data/sql/updates/db_world/2024_06_25_08.sql b/data/sql/updates/db_world/2024_06_25_08.sql new file mode 100644 index 000000000..db001251e --- /dev/null +++ b/data/sql/updates/db_world/2024_06_25_08.sql @@ -0,0 +1,6 @@ +-- DB update 2024_06_25_07 -> 2024_06_25_08 +-- Drunken Haze, Drunken Skull Crack +DELETE FROM `spell_script_names` WHERE `spell_id` IN (37591,29690); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(37591, 'spell_gen_sober_up'), +(29690, 'spell_gen_sober_up'); diff --git a/data/sql/updates/db_world/2024_06_25_09.sql b/data/sql/updates/db_world/2024_06_25_09.sql new file mode 100644 index 000000000..1eebfa68d --- /dev/null +++ b/data/sql/updates/db_world/2024_06_25_09.sql @@ -0,0 +1,25 @@ +-- DB update 2024_06_25_08 -> 2024_06_25_09 +-- Soulbind +DELETE FROM `spell_scripts` WHERE `id`=36153; +INSERT INTO `spell_scripts` (`id`, `effIndex`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES +(36153, 0, 0, 15, 36141, 3, 0, 0, 0, 0, 0); + +-- Transformed from Tormented Soul & Tormented Citizen +DELETE FROM `creature` WHERE `id1`=20480; + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` IN (20480,20512)); +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`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(20512, 0, 0, 0, 4, 0, 100, 0, 0, 0, 0, 0, 0, 0, 80, 2051200, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tormented Soul - On Aggro - Run Script'), +(20512, 0, 1, 0, 0, 0, 100, 0, 7000, 12000, 0, 0, 0, 0, 11, 36153, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Tormented Soul - In Combat - Cast \'Soulbind\''), +(20512, 0, 2, 3, 25, 0, 100, 0, 0, 0, 0, 0, 0, 0, 36, 20512, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tormented Soul - On Reset - Update Template To \'Tormented Soul\''), +(20512, 0, 3, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 8, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tormented Soul - On Reset - Set Reactstate Aggressive'); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 9 AND `entryorguid` = 2051200); +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`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(2051200, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tormented Soul - Actionlist - Set Reactstate Passive'), +(2051200, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 224, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tormented Soul - Actionlist - Stop Attack'), +(2051200, 9, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tormented Soul - Actionlist - Set Rooted On'), +(2051200, 9, 3, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 5, 15, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tormented Soul - Actionlist - Play Emote 15'), +(2051200, 9, 4, 0, 0, 0, 100, 0, 1500, 1500, 0, 0, 0, 0, 36, 20480, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tormented Soul - Actionlist - Update Template To \'Kirin\'Var Ghost\''), +(2051200, 9, 5, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 8, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tormented Soul - Actionlist - Set Reactstate Aggressive'), +(2051200, 9, 6, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tormented Soul - Actionlist - Set Rooted Off'); diff --git a/data/sql/updates/db_world/2024_06_26_00.sql b/data/sql/updates/db_world/2024_06_26_00.sql new file mode 100644 index 000000000..4c5896baa --- /dev/null +++ b/data/sql/updates/db_world/2024_06_26_00.sql @@ -0,0 +1,2 @@ +-- DB update 2024_06_25_09 -> 2024_06_26_00 +UPDATE `creature_template_addon` SET `auras` = 75498 WHERE `entry` = 25985; diff --git a/data/sql/updates/db_world/2024_06_26_01.sql b/data/sql/updates/db_world/2024_06_26_01.sql new file mode 100644 index 000000000..7823f803a --- /dev/null +++ b/data/sql/updates/db_world/2024_06_26_01.sql @@ -0,0 +1,4 @@ +-- DB update 2024_06_26_00 -> 2024_06_26_01 +-- +UPDATE `spell_script_names` SET `ScriptName`='spell_mount_check_aura' WHERE `spell_id`=75420; +UPDATE `spell_script_names` SET `ScriptName`='spell_boss_salramm_steal_flesh_aura' WHERE `spell_id`=52708; diff --git a/data/sql/updates/db_world/2024_06_26_02.sql b/data/sql/updates/db_world/2024_06_26_02.sql new file mode 100644 index 000000000..a070ba85b --- /dev/null +++ b/data/sql/updates/db_world/2024_06_26_02.sql @@ -0,0 +1,4 @@ +-- DB update 2024_06_26_01 -> 2024_06_26_02 +-- +UPDATE `spell_script_names` SET `ScriptName`='spell_karazhan_brittle_bones_aura' WHERE `spell_id`=32441; +UPDATE `spell_script_names` SET `ScriptName`='spell_karazhan_overload_aura' WHERE `spell_id`=29768; diff --git a/data/sql/updates/db_world/2024_06_26_03.sql b/data/sql/updates/db_world/2024_06_26_03.sql new file mode 100644 index 000000000..3f77ad4a9 --- /dev/null +++ b/data/sql/updates/db_world/2024_06_26_03.sql @@ -0,0 +1,19 @@ +-- DB update 2024_06_26_02 -> 2024_06_26_03 +-- Update gameobject 'Transpolyporter' with sniffed values +-- updated spawns +DELETE FROM `gameobject` WHERE (`id` IN (143230, 142175)) +AND (`guid` IN (11010, 32372)); +INSERT INTO `gameobject` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `ScriptName`, `VerifiedBuild`, `Comment`) VALUES +(11010, 143230, 0, 0, 0, 1, 1, -14468.337890625, 457.59954833984375, 15.16606616973876953, 0.139624491333961486, 0, 0, 0.06975555419921875, 0.997564136981964111, 120, 255, 1, "", 45572, NULL), +(32372, 142175, 0, 0, 0, 1, 1, -5096.5966796875, 750.10186767578125, 260.55023193359375, 2.687806606292724609, 0, 0, 0.974370002746582031, 0.224951311945915222, 120, 255, 1, "", 46779, NULL); + +-- new spawns +DELETE FROM `gameobject` WHERE (`id` IN (142172)) +AND (`guid` IN (28)); +INSERT INTO `gameobject` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `ScriptName`, `VerifiedBuild`, `Comment`) VALUES +(28, 142172, 0, 0, 0, 1, 1, -14468.0830078125, 457.62255859375, 15.16595935821533203, 2.146752834320068359, 0, 0, 0.878816604614257812, 0.477159708738327026, 120, 255, 1, "", 45572, NULL); + +-- add missing condition +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 17) AND (`SourceGroup` = 0) AND (`SourceEntry` = 11409) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 2) AND (`ConditionTarget` = 1) AND (`ConditionValue1` = 9173) AND (`ConditionValue2` = 1) AND (`ConditionValue3` = 0); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(17, 0, 11409, 0, 0, 2, 1, 9173, 1, 0, 0, 0, 0, '', 'Requires Target to have item'); diff --git a/data/sql/updates/db_world/2024_06_26_04.sql b/data/sql/updates/db_world/2024_06_26_04.sql new file mode 100644 index 000000000..3571ef2c2 --- /dev/null +++ b/data/sql/updates/db_world/2024_06_26_04.sql @@ -0,0 +1,14 @@ +-- DB update 2024_06_26_03 -> 2024_06_26_04 +-- +DELETE FROM `creature_formations` WHERE `leaderGUID` IN (135858,135854,135856,135853,135860); +INSERT INTO `creature_formations` (`leaderGUID`, `memberGUID`, `dist`, `angle`, `groupAI`, `point_1`, `point_2`) VALUES +(135858, 135858, 0, 0, 3, 0, 0), +(135858, 135859, 0, 0, 3, 0, 0), +(135854, 135854, 0, 0, 3, 0, 0), +(135854, 135855, 0, 0, 3, 0, 0), +(135856, 135856, 0, 0, 3, 0, 0), +(135856, 135857, 0, 0, 3, 0, 0), +(135853, 135853, 0, 0, 3, 0, 0), +(135853, 135852, 0, 0, 3, 0, 0), +(135860, 135860, 0, 0, 3, 0, 0), +(135860, 135861, 0, 0, 3, 0, 0); diff --git a/data/sql/updates/db_world/2024_06_26_05.sql b/data/sql/updates/db_world/2024_06_26_05.sql new file mode 100644 index 000000000..9f1c081e0 --- /dev/null +++ b/data/sql/updates/db_world/2024_06_26_05.sql @@ -0,0 +1,5 @@ +-- DB update 2024_06_26_04 -> 2024_06_26_05 +-- Raise Dead +DELETE FROM `spell_cooldown_overrides` WHERE `Id`=34019; +INSERT INTO `spell_cooldown_overrides` (`Id`, `RecoveryTime`, `CategoryRecoveryTime`, `StartRecoveryTime`, `StartRecoveryCategory`, `Comment`) VALUES +(34019, 60000, 60000, 0, 0, 'Bleeding Hollow Necrolyte - Raise Dead'); diff --git a/data/sql/updates/db_world/2024_06_27_00.sql b/data/sql/updates/db_world/2024_06_27_00.sql new file mode 100644 index 000000000..15c829245 --- /dev/null +++ b/data/sql/updates/db_world/2024_06_27_00.sql @@ -0,0 +1,16 @@ +-- DB update 2024_06_26_05 -> 2024_06_27_00 +-- Treebole +UPDATE `creature_template_addon` SET `path_id` = 222150 WHERE (`entry` = 22215); + +DELETE FROM `waypoint_data` WHERE `id` = 222150; +INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`, `action`, `action_chance`, `wpguid`) VALUES +(222150, 1, 3609.03, 6829.57, 136.69, 5.2105, 300000, 0, 0, 100, 0), +(222150, 2, 3598.63, 6845.62, 140.703, 2.54014, 0, 0, 0, 100, 0), +(222150, 3, 3587.26, 6853.75, 141.589, 2.52051, 0, 0, 0, 100, 0), +(222150, 4, 3568.35, 6864.28, 140.533, 4.41331, 300000, 0, 0, 100, 0), +(222150, 5, 3587.72, 6853.33, 141.546, 5.70922, 0, 0, 0, 100, 0), +(222150, 6, 3599.61, 6845.15, 140.649, 5.70922, 0, 0, 0, 100, 0); + +DELETE FROM `creature` WHERE (`id1` = 22215 AND `guid` = 77879); +INSERT INTO `creature` (`guid`, `id1`, `id2`, `id3`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `ScriptName`, `VerifiedBuild`, `CreateObject`, `Comment`) VALUES +(77879, 22215, 0, 0, 530, 0, 0, 1, 1, 0, 3609.03, 6829.56, 136.69, 5.2105, 300, 0, 0, 6986, 0, 2, 0, 0, 0, '', 0, 0, NULL); diff --git a/data/sql/updates/db_world/2024_06_27_01.sql b/data/sql/updates/db_world/2024_06_27_01.sql new file mode 100644 index 000000000..9f3dabf0d --- /dev/null +++ b/data/sql/updates/db_world/2024_06_27_01.sql @@ -0,0 +1,30 @@ +-- DB update 2024_06_27_00 -> 2024_06_27_01 +-- +-- FORCE_GOSSIP +UPDATE `creature_template` SET `detection_range` = 40, `type_flags` = `type_flags` | 134217728, `movementId` = 1988 WHERE `entry` = 17225; + +-- Intro +DELETE FROM `waypoint_data` WHERE `id` = 172250; +INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`, `action`, `action_chance`, `wpguid`) VALUES +(172250, 1, -11105.76, -1875.8998, 158.97804, NULL, 0, 2, 0, 100, 0), +(172250, 2, -11175.097, -1857.2238, 101.00588, NULL, 0, 2, 0, 100, 0), +(172250, 3, -11296.927, -1764.5311, 101.00588, NULL, 0, 2, 0, 100, 0), +(172250, 4, -11258.901, -1722.3717, 101.00588, NULL, 0, 2, 0, 100, 0), +(172250, 5, -11176.764, -1809.5985, 101.00588, NULL, 0, 2, 0, 100, 0), +(172250, 6, -11191.107, -1889.3965, 107.89479, NULL, 0, 2, 0, 100, 0), +(172250, 7, -11152.18, -1863.318, 101.00588, NULL, 0, 2, 0, 100, 0), +(172250, 8, -11130.677, -1891.4235, 107.89634, NULL, 0, 2, 0, 100, 0), +(172250, 9, -11110.674, -1878.7712, 107.89686, NULL, 0, 2, 0, 100, 0); + +-- Landing +DELETE FROM `waypoint_data` WHERE `id` = 172251; +INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`, `action`, `action_chance`, `wpguid`) VALUES +(172251, 1, -11117.731, -1941.2609, 127.17197, NUll, 0, 2, 0, 100, 0), +(172251, 2, -11123.777, -1968.243, 125.92196, NUll, 0, 2, 0, 100, 0), +(172251, 3, -11148.344, -1972.9801, 116.69972, NUll, 0, 2, 0, 100, 0), +(172251, 4, -11161.62, -1945.7255, 103.08859, NUll, 0, 2, 0, 100, 0), +(172251, 5, -11168.009, -1922.9045, 97.39415, NUll, 0, 2, 0, 100, 0), +(172251, 6, -11162.231, -1900.3287, 94.72747, NUll, 0, 2, 0, 100, 0); + +-- Nightbane helper target +UPDATE `creature_template` SET `type_flags` = `type_flags` | 134217728, `movementId` = 1693, `ScriptName` = 'npc_nightbane_helper_target' WHERE `entry` = 17260; diff --git a/data/sql/updates/db_world/2024_06_27_02.sql b/data/sql/updates/db_world/2024_06_27_02.sql new file mode 100644 index 000000000..8bad9f56e --- /dev/null +++ b/data/sql/updates/db_world/2024_06_27_02.sql @@ -0,0 +1,7 @@ +-- DB update 2024_06_27_01 -> 2024_06_27_02 +-- +UPDATE `spell_script_names` SET `ScriptName`='spell_garr_separation_anxiety_aura' WHERE `spell_id`=23487; +UPDATE `spell_script_names` SET `ScriptName`='spell_mc_play_dead_aura' WHERE `spell_id`=19822; +UPDATE `spell_script_names` SET `ScriptName`='spell_majordomo_separation_anxiety_aura' WHERE `spell_id`=21094; +UPDATE `spell_script_names` SET `ScriptName`='spell_geddon_inferno_aura' WHERE `spell_id`=19695; +UPDATE `spell_script_names` SET `ScriptName`='spell_geddon_armageddon_aura' WHERE `spell_id`=20478; diff --git a/data/sql/updates/db_world/2024_06_27_03.sql b/data/sql/updates/db_world/2024_06_27_03.sql new file mode 100644 index 000000000..877e5269a --- /dev/null +++ b/data/sql/updates/db_world/2024_06_27_03.sql @@ -0,0 +1,3 @@ +-- DB update 2024_06_27_02 -> 2024_06_27_03 +-- +UPDATE `smart_scripts` SET `target_type` = 8 WHERE `entryorguid` = 2875000 AND `source_type` = 9 AND `id` = 3; diff --git a/data/sql/updates/db_world/2024_06_28_00.sql b/data/sql/updates/db_world/2024_06_28_00.sql new file mode 100644 index 000000000..c8b1e527d --- /dev/null +++ b/data/sql/updates/db_world/2024_06_28_00.sql @@ -0,0 +1,14 @@ +-- DB update 2024_06_27_03 -> 2024_06_28_00 +-- +DELETE FROM `spell_custom_attr` WHERE `spell_id` IN (33802,38609,31943,62821,62807,51103,69146,70823,70824,70825); +INSERT INTO `spell_custom_attr` (`spell_id`, `attributes`) VALUES +(33802, 536870912), +(38609, 536870912), +(31943, 536870912), +(62821, 536870912), +(62807, 536870912), +(51103, 536870912), +(69146, 536870912), +(70823, 536870912), +(70824, 536870912), +(70825, 536870912); diff --git a/data/sql/updates/db_world/2024_06_28_01.sql b/data/sql/updates/db_world/2024_06_28_01.sql new file mode 100644 index 000000000..115d4c77f --- /dev/null +++ b/data/sql/updates/db_world/2024_06_28_01.sql @@ -0,0 +1,36 @@ +-- DB update 2024_06_28_00 -> 2024_06_28_01 +-- Lashh'an Wing Guard +DELETE FROM `creature_text` WHERE `CreatureID` = 19944; +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES +(19944, 0, 0, '%s makes a break for the nearest rune circle.', 16, 0, 100, 0, 0, 0, 19473, 0, 'Lashh\'an Wing Guard - Run to circle'); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` IN (21470,19944)); +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`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19944, 0, 0, 0, 0, 0, 100, 0, 3500, 4000, 10500, 14500, 0, 0, 11, 37577, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Wing Guard - In Combat - Cast \'Debilitating Strike\''), +(19944, 0, 1, 0, 2, 0, 100, 0, 0, 20, 0, 0, 0, 0, 80, 1994400, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Wing Guard - Between 0-20% Health - Run Script'), +(19944, 0, 2, 0, 34, 0, 100, 0, 8, 0, 0, 0, 0, 0, 80, 1994401, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Wing Guard - On Reached Point 0 - Run Script'), +(19944, 0, 3, 0, 17, 0, 100, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Wing Guard - On Summoned Unit - Start Attacking'), +(19944, 0, 4, 0, 25, 0, 100, 0, 0, 0, 0, 0, 0, 0, 8, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Wing Guard - On Reset - Set Reactstate Aggressive'); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 9 AND `entryorguid` IN (1994400,1994401)); +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`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(1994400, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Wing Guard - Actionlist - Say Line 0'), +(1994400, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 20, 184826, 100, 0, 0, 0, 0, 0, 0, 'Lashh\'an Wing Guard - Actionlist - Move To Closest Object \'Lashh\'an Circle Spell Focus\''), +(1994400, 9, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Wing Guard - Actionlist - Set Reactstate Passive'), +(1994400, 9, 3, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 224, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Wing Guard - Actionlist - Stop Attack'), +(1994401, 9, 0, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 0, 0, 12, 21470, 2, 60000, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Wing Guard - Actionlist - Summon Creature \'Angered Arakkoa Protector\''), +(1994401, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 8, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Wing Guard - Actionlist - Set Reactstate Aggressive'), +(1994401, 9, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Lashh\'an Wing Guard - Actionlist - Start Attacking'); + +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 22) AND (`SourceGroup` = 2) AND (`SourceEntry` = 19944); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(22, 2, 19944, 0, 0, 30, 1, 184826, 100, 0, 0, 0, 0, '', 'Only execute SAI if Object Lashh\'an Circle Spell Focus is within 100y'); + +-- Angered Arakkoa Protector +DELETE FROM `creature` WHERE (`id1` = 21470); +UPDATE `creature_template` SET `AIName` = '' WHERE `entry` = 21470; + +-- Lashh'an Circle Spell Focus +DELETE FROM `gameobject` WHERE `guid` = 99988 AND `id` = 184826; +INSERT INTO `gameobject` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `ScriptName`, `VerifiedBuild`, `Comment`) VALUES +(99988, 184826, 530, 0, 0, 1, 1, 1637.02, 6998.45, 158.32, 1.3090, 0, 0, 0, 0, 180, 0, 1, '', 0, NULL); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 9dbd754ff..cab036c52 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -653,7 +653,7 @@ void BossAI::_JustEngagedWith() void BossAI::_EnterEvadeMode(EvadeReason why) { CreatureAI::EnterEvadeMode(why); - if (instance) + if (instance && instance->GetBossState(_bossId) != DONE) { instance->SetBossState(_bossId, NOT_STARTED); instance->SaveToDB(); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index ea2332b58..162833c16 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -800,7 +800,7 @@ void ObjectMgr::LoadCreatureTemplateModels() CreatureModelInfo const* modelInfo = GetCreatureModelInfo(creatureDisplayId); if (!modelInfo) - LOG_ERROR("sql.sql", "No model data exist for `CreatureDisplayID` = {} listed by creature (Entry: {%u}}).", creatureDisplayId, creatureId); + LOG_ERROR("sql.sql", "No model data exist for `CreatureDisplayID` = {} listed by creature (Entry: {}).", creatureDisplayId, creatureId); if (displayScale <= 0.0f) displayScale = 1.0f; diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index cbb948950..449dafaf0 100644 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -61,6 +61,10 @@ void WaypointMovementGenerator::DoFinalize(Creature* creature) void WaypointMovementGenerator::DoReset(Creature* creature) { + if (stalled) + { + return; + } creature->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); StartMoveNow(creature); } @@ -209,6 +213,11 @@ bool WaypointMovementGenerator::DoUpdate(Creature* creature, uint32 di { // Waypoint movement can be switched on/off // This is quite handy for escort quests and other stuff + if (stalled) + { + Stop(1000); + return true; + } if (creature->HasUnitState(UNIT_STATE_NOT_MOVE) || creature->IsMovementPreventedByCasting()) { creature->StopMoving(); @@ -278,6 +287,17 @@ void WaypointMovementGenerator::MovementInform(Creature* creature) } } +void WaypointMovementGenerator::Pause(uint32 /*timer*/) +{ + stalled = true; + i_nextMoveTime.Reset(1); +} + +void WaypointMovementGenerator::Resume(uint32 /*overrideTimer/*/) +{ + stalled = false; +} + //----------------------------------------------------// uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h index 1699a71a6..84d1279c2 100644 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h @@ -54,13 +54,15 @@ class WaypointMovementGenerator : public MovementGeneratorMedium< Crea public PathMovementBase { public: - WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true) - : PathMovementBase((WaypointPath const*)nullptr), i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating) {} + WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true, bool _stalled = false) + : PathMovementBase((WaypointPath const*)nullptr), i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating), stalled(_stalled) {} ~WaypointMovementGenerator() { i_path = nullptr; } void DoInitialize(Creature*); void DoFinalize(Creature*); void DoReset(Creature*); bool DoUpdate(Creature*, uint32 diff); + void Pause(uint32 timer/* = 0*/); + void Resume(uint32 overrideTimer/* = 0*/); void MovementInform(Creature*); @@ -93,6 +95,7 @@ private: bool m_isArrivalDone; uint32 path_id; bool repeating; + bool stalled; }; /** FlightPathMovementGenerator generates movement of the player for the paths diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 5a533f307..4fa18baed 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -4106,12 +4106,6 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 // Patch 3.0.3 Bladestorm now breaks all snares and roots on the warrior when activated. if (GetId() == 46924) { - if (apply) - { - target->resetAttackTimer(); - target->resetAttackTimer(OFF_ATTACK); - } - // Knockback and hex target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, apply); } diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 5e4e67f51..cbaa8b1ec 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -658,9 +658,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) if ((itr->second & (1 << effIndex)) && itr->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex)) itr->second &= ~(1 << effIndex); } - if (!itr->second - || itr->first->IsImmunedToSpell(GetSpellInfo()) - || !CanBeAppliedOn(itr->first)) + if (!itr->second || itr->first->IsImmunedToSpell(GetSpellInfo()) || !CanBeAppliedOn(itr->first)) addUnit = false; if (addUnit) @@ -671,21 +669,9 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) if (itr->first->IsInFlight()) addUnit = false; - switch( GetId() ) - { - case 62821: // Ulduar, Hodir, Toasty Fire - case 62807: // Ulduar, Hodir, Starlight - case 51103: // Oculus, Mage-Lord Urom, Frostbomb - case 69146: - case 70823: - case 70824: - case 70825: // Icecrown Citadel, Lord Marrowgar, Coldflame - { - if( itr->first->HasAura(GetId()) ) - addUnit = false; - } - break; - } + // Allow only 1 persistent area aura to affect our targets if a custom flag is set. + if (itr->first->HasAura(GetId()) && GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_ONLY_ONE_AREA_AURA)) + addUnit = false; } // unit auras can not stack with each other else // (GetType() == UNIT_AURA_TYPE) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 5a1a1fa8f..fdbc50c71 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5645,7 +5645,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() == TYPEID_PLAYER) { //can cast triggered (by aura only?) spells while have this flag - if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_CASTER_AURASTATE) && m_caster->ToPlayer()->HasPlayerFlag(PLAYER_ALLOW_ONLY_ABILITY)) + if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_CASTER_AURASTATE) && m_caster->ToPlayer()->HasPlayerFlag(PLAYER_ALLOW_ONLY_ABILITY) && !IsNextMeleeSwingSpell()) return SPELL_FAILED_SPELL_IN_PROGRESS; if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) && m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id)) diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 238274fab..3d6493029 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -195,7 +195,7 @@ enum SpellCustomAttributes SPELL_ATTR0_CU_NEEDS_AMMO_DATA = 0x00080000, SPELL_ATTR0_CU_BINARY_SPELL = 0x00100000, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS = 0x00200000, - SPELL_ATTR0_CU_SINGLE_AURA_STACK = 0x00400000, // pussywizard + SPELL_ATTR0_CU_SINGLE_AURA_STACK = 0x00400000, SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC = 0x00800000, SPELL_ATTR0_CU_AURA_CANNOT_BE_SAVED = 0x01000000, SPELL_ATTR0_CU_POSITIVE_EFF0 = 0x02000000, @@ -203,7 +203,8 @@ enum SpellCustomAttributes SPELL_ATTR0_CU_POSITIVE_EFF2 = 0x08000000, SPELL_ATTR0_CU_FORCE_SEND_CATEGORY_COOLDOWNS = 0x10000000, SPELL_ATTR0_CU_FORCE_AURA_SAVING = 0x20000800, - SPELL_ATTR0_CU_ENCOUNTER_REWARD = 0x40000000, // pussywizard + SPELL_ATTR0_CU_ONLY_ONE_AREA_AURA = 0x20000000, + SPELL_ATTR0_CU_ENCOUNTER_REWARD = 0x40000000, SPELL_ATTR0_CU_BYPASS_MECHANIC_IMMUNITY = 0x80000000, SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2, diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp index 98f656c3c..d7ab25b08 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp @@ -303,43 +303,32 @@ public: } }; -class spell_egg_event : public SpellScriptLoader +class spell_egg_event : public SpellScript { -public: - spell_egg_event() : SpellScriptLoader("spell_egg_event") { } + PrepareSpellScript(spell_egg_event); - class spell_egg_eventSpellScript : public SpellScript + void HandleOnHit() { - PrepareSpellScript(spell_egg_eventSpellScript); - - void HandleOnHit() + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) { - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - { - instance->SetData(DATA_EGG_EVENT, SPECIAL); - } - - if (Creature* razorgore = GetCaster()->ToCreature()) - { - if (GameObject* egg = GetHitGObj()) - { - razorgore->AI()->DoAction(TALK_EGG_BROKEN_RAND); - egg->SetLootState(GO_READY); - egg->UseDoorOrButton(10000); - egg->SetRespawnTime(WEEK); - } - } + instance->SetData(DATA_EGG_EVENT, SPECIAL); } - void Register() override + if (Creature* razorgore = GetCaster()->ToCreature()) { - OnHit += SpellHitFn(spell_egg_eventSpellScript::HandleOnHit); + if (GameObject* egg = GetHitGObj()) + { + razorgore->AI()->DoAction(TALK_EGG_BROKEN_RAND); + egg->SetLootState(GO_READY); + egg->UseDoorOrButton(10000); + egg->SetRespawnTime(WEEK); + } } - }; + } - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_egg_eventSpellScript(); + OnHit += SpellHitFn(spell_egg_event::HandleOnHit); } }; @@ -347,6 +336,6 @@ void AddSC_boss_razorgore() { new boss_razorgore(); new go_orb_of_domination(); - new spell_egg_event(); + RegisterSpellScript(spell_egg_event); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp index d87ddbc5c..5a24defea 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp @@ -478,37 +478,26 @@ enum ShadowFlame }; // 22539 - Shadowflame (used in Blackwing Lair) -class spell_bwl_shadowflame : public SpellScriptLoader +class spell_bwl_shadowflame : public SpellScript { -public: - spell_bwl_shadowflame() : SpellScriptLoader("spell_bwl_shadowflame") { } + PrepareSpellScript(spell_bwl_shadowflame); - class spell_bwl_shadowflame_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_bwl_shadowflame_SpellScript); + return ValidateSpellInfo({ SPELL_ONYXIA_SCALE_CLOAK, SPELL_SHADOW_FLAME_DOT }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_ONYXIA_SCALE_CLOAK, SPELL_SHADOW_FLAME_DOT }); - } - - void HandleEffectScriptEffect(SpellEffIndex /*effIndex*/) - { - // If the victim of the spell does not have "Onyxia Scale Cloak" - add the Shadow Flame DoT (22682) - if (Unit* victim = GetHitUnit()) - if (!victim->HasAura(SPELL_ONYXIA_SCALE_CLOAK)) - victim->AddAura(SPELL_SHADOW_FLAME_DOT, victim); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_bwl_shadowflame_SpellScript::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); - } - }; - - SpellScript* GetSpellScript() const override + void HandleEffectScriptEffect(SpellEffIndex /*effIndex*/) { - return new spell_bwl_shadowflame_SpellScript; + // If the victim of the spell does not have "Onyxia Scale Cloak" - add the Shadow Flame DoT (22682) + if (Unit* victim = GetHitUnit()) + if (!victim->HasAura(SPELL_ONYXIA_SCALE_CLOAK)) + victim->AddAura(SPELL_SHADOW_FLAME_DOT, victim); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_bwl_shadowflame::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); } }; @@ -539,7 +528,7 @@ public: void AddSC_instance_blackwing_lair() { new instance_blackwing_lair(); - new spell_bwl_shadowflame(); + RegisterSpellScript(spell_bwl_shadowflame); new at_orb_of_command(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp index 363c8151c..a1aaddce1 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp @@ -128,118 +128,96 @@ public: }; // 19695 Inferno -class spell_geddon_inferno : public SpellScriptLoader +class spell_geddon_inferno_aura : public AuraScript { -public: - spell_geddon_inferno() : SpellScriptLoader("spell_geddon_inferno") { } + PrepareAuraScript(spell_geddon_inferno_aura); - class spell_geddon_inferno_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spell*/) override { - PrepareAuraScript(spell_geddon_inferno_AuraScript); + return ValidateSpellInfo({ SPELL_INFERNO_DUMMY_EFFECT }); + } - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_INFERNO_DUMMY_EFFECT }); - } - - void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Creature* pCreatureTarget = GetTarget()->ToCreature()) - { - pCreatureTarget->SetReactState(REACT_PASSIVE); - pCreatureTarget->AttackStop(); - } - } - - void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Creature* pCreatureTarget = GetTarget()->ToCreature()) - { - pCreatureTarget->SetReactState(REACT_AGGRESSIVE); - } - } - - void PeriodicTick(AuraEffect const* aurEff) - { - PreventDefaultAction(); - - if (Unit* caster = GetUnitOwner()) - { - //The pulses come about 1 second apart and last for 10 seconds. Damage starts at 500 damage per pulse and increases by 500 every other pulse (500, 500, 1000, 1000, 1500, etc.). (Source: Wowwiki) - int32 multiplier = 1; - switch (aurEff->GetTickNumber()) - { - case 3: - case 4: - multiplier = 2; - break; - case 5: - case 6: - multiplier = 4; - break; - case 7: - multiplier = 6; - break; - case 8: - multiplier = 10; - break; - } - - caster->CastCustomSpell(SPELL_INFERNO_DUMMY_EFFECT, SPELLVALUE_BASE_POINT0, 500 * multiplier, (Unit*)nullptr, TRIGGERED_NONE, nullptr, aurEff); - } - } - - void Register() override - { - AfterEffectApply += AuraEffectApplyFn(spell_geddon_inferno_AuraScript::HandleAfterApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_inferno_AuraScript::HandleAfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_geddon_inferno_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const override + void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - return new spell_geddon_inferno_AuraScript(); + if (Creature* pCreatureTarget = GetTarget()->ToCreature()) + { + pCreatureTarget->SetReactState(REACT_PASSIVE); + pCreatureTarget->AttackStop(); + } + } + + void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Creature* pCreatureTarget = GetTarget()->ToCreature()) + { + pCreatureTarget->SetReactState(REACT_AGGRESSIVE); + } + } + + void PeriodicTick(AuraEffect const* aurEff) + { + PreventDefaultAction(); + + if (Unit* caster = GetUnitOwner()) + { + //The pulses come about 1 second apart and last for 10 seconds. Damage starts at 500 damage per pulse and increases by 500 every other pulse (500, 500, 1000, 1000, 1500, etc.). (Source: Wowwiki) + int32 multiplier = 1; + switch (aurEff->GetTickNumber()) + { + case 3: + case 4: + multiplier = 2; + break; + case 5: + case 6: + multiplier = 4; + break; + case 7: + multiplier = 6; + break; + case 8: + multiplier = 10; + break; + } + + caster->CastCustomSpell(SPELL_INFERNO_DUMMY_EFFECT, SPELLVALUE_BASE_POINT0, 500 * multiplier, (Unit*)nullptr, TRIGGERED_NONE, nullptr, aurEff); + } + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_geddon_inferno_aura::HandleAfterApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_inferno_aura::HandleAfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_geddon_inferno_aura::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; // 20478 Armageddon -class spell_geddon_armageddon : public SpellScriptLoader +class spell_geddon_armageddon_aura : public AuraScript { -public: - spell_geddon_armageddon() : SpellScriptLoader("spell_geddon_armageddon") { } + PrepareAuraScript(spell_geddon_armageddon_aura); - class spell_geddon_armageddon_AuraScript : public AuraScript + void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - PrepareAuraScript(spell_geddon_armageddon_AuraScript); - - void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + if (Creature* pCreatureTarget = GetTarget()->ToCreature()) { - if (Creature* pCreatureTarget = GetTarget()->ToCreature()) - { - pCreatureTarget->SetReactState(REACT_PASSIVE); - pCreatureTarget->AttackStop(); - } + pCreatureTarget->SetReactState(REACT_PASSIVE); + pCreatureTarget->AttackStop(); } + } - void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Creature* pCreatureTarget = GetTarget()->ToCreature()) - { - pCreatureTarget->SetReactState(REACT_AGGRESSIVE); - } - } - - void Register() override - { - AfterEffectApply += AuraEffectApplyFn(spell_geddon_armageddon_AuraScript::HandleAfterApply, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_armageddon_AuraScript::HandleAfterRemove, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL); - } - }; - - AuraScript* GetAuraScript() const override + void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - return new spell_geddon_armageddon_AuraScript(); + if (Creature* pCreatureTarget = GetTarget()->ToCreature()) + { + pCreatureTarget->SetReactState(REACT_AGGRESSIVE); + } + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_geddon_armageddon_aura::HandleAfterApply, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_armageddon_aura::HandleAfterRemove, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL); } }; @@ -248,7 +226,7 @@ void AddSC_boss_baron_geddon() new boss_baron_geddon(); // Spells - new spell_geddon_inferno(); - new spell_geddon_armageddon(); + RegisterSpellScript(spell_geddon_inferno_aura); + RegisterSpellScript(spell_geddon_armageddon_aura); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp index 60afcf517..6514408f0 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp @@ -172,75 +172,52 @@ public: }; // 23487 Separation Anxiety (server side) -class spell_garr_separation_nexiety : public SpellScriptLoader +class spell_garr_separation_anxiety_aura : public AuraScript { -public: - spell_garr_separation_nexiety() : SpellScriptLoader("spell_garr_separation_nexiety") {} + PrepareAuraScript(spell_garr_separation_anxiety_aura); - class spell_garr_separation_nexiety_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spell*/) override { - PrepareAuraScript(spell_garr_separation_nexiety_AuraScript); + return ValidateSpellInfo({ SPELL_SEPARATION_ANXIETY_MINION }); + } - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_SEPARATION_ANXIETY_MINION }); - } - - void HandlePeriodic(AuraEffect const* aurEff) - { - Unit const* caster = GetCaster(); - Unit* target = GetTarget(); - if (caster && target && target->GetDistance(caster) > 40.0f && !target->HasAura(SPELL_SEPARATION_ANXIETY_MINION)) - { - target->CastSpell(target, SPELL_SEPARATION_ANXIETY_MINION, true, nullptr, aurEff); - } - } - - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_garr_separation_nexiety_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; - - // Should return a fully valid AuraScript pointer. - AuraScript* GetAuraScript() const override + void HandlePeriodic(AuraEffect const* aurEff) { - return new spell_garr_separation_nexiety_AuraScript(); + Unit const* caster = GetCaster(); + Unit* target = GetTarget(); + if (caster && target && target->GetDistance(caster) > 40.0f && !target->HasAura(SPELL_SEPARATION_ANXIETY_MINION)) + { + target->CastSpell(target, SPELL_SEPARATION_ANXIETY_MINION, true, nullptr, aurEff); + } + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_garr_separation_anxiety_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } }; //19515 Frenzy (SERVERSIDE) -class spell_garr_frenzy : public SpellScriptLoader +class spell_garr_frenzy : public SpellScript { -public: - spell_garr_frenzy() : SpellScriptLoader("spell_garr_frenzy") {} + PrepareSpellScript(spell_garr_frenzy); - class spell_garr_frenzy_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spell*/) override { - PrepareSpellScript(spell_garr_frenzy_SpellScript); + return ValidateSpellInfo({ SPELL_FRENZY }); + } - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_FRENZY }); - } - - void HandleHit(SpellEffIndex /*effIndex*/) - { - if (Unit* target = GetHitUnit()) - { - target->CastSpell(target, SPELL_FRENZY); - } - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_garr_frenzy_SpellScript::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override + void HandleHit(SpellEffIndex /*effIndex*/) { - return new spell_garr_frenzy_SpellScript(); + if (Unit* target = GetHitUnit()) + { + target->CastSpell(target, SPELL_FRENZY); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_garr_frenzy::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -250,7 +227,7 @@ void AddSC_boss_garr() new npc_garr_firesworn(); // Spells - new spell_garr_separation_nexiety(); - new spell_garr_frenzy(); + RegisterSpellScript(spell_garr_separation_anxiety_aura); + RegisterSpellScript(spell_garr_frenzy); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp index 12aca38e7..6efca09c4 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp @@ -119,55 +119,44 @@ public: // 19411 Lava Bomb // 20474 Lava Bomb -class spell_magmadar_lava_bomb : public SpellScriptLoader +class spell_magmadar_lava_bomb : public SpellScript { -public: - spell_magmadar_lava_bomb() : SpellScriptLoader("spell_magmadar_lava_bomb") {} + PrepareSpellScript(spell_magmadar_lava_bomb); - class spell_magmadar_lava_bomb_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_magmadar_lava_bomb_SpellScript); + return ValidateSpellInfo({ SPELL_LAVA_BOMB_EFFECT, SPELL_LAVA_BOMB_RANGED_EFFECT }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) { - return ValidateSpellInfo({ SPELL_LAVA_BOMB_EFFECT, SPELL_LAVA_BOMB_RANGED_EFFECT }); - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Unit* target = GetHitUnit()) + uint32 spellId = 0; + switch (m_scriptSpellId) { - uint32 spellId = 0; - switch (m_scriptSpellId) + case SPELL_LAVA_BOMB: { - case SPELL_LAVA_BOMB: - { - spellId = SPELL_LAVA_BOMB_EFFECT; - break; - } - case SPELL_LAVA_BOMB_RANGED: - { - spellId = SPELL_LAVA_BOMB_RANGED_EFFECT; - break; - } - default: - { - return; - } + spellId = SPELL_LAVA_BOMB_EFFECT; + break; + } + case SPELL_LAVA_BOMB_RANGED: + { + spellId = SPELL_LAVA_BOMB_RANGED_EFFECT; + break; + } + default: + { + return; } - target->CastSpell(target, spellId, true, nullptr, nullptr, GetCaster()->GetGUID()); } + target->CastSpell(target, spellId, true, nullptr, nullptr, GetCaster()->GetGUID()); } + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_magmadar_lava_bomb_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_magmadar_lava_bomb_SpellScript(); + OnEffectHitTarget += SpellEffectFn(spell_magmadar_lava_bomb::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -176,6 +165,6 @@ void AddSC_boss_magmadar() new boss_magmadar(); // Spells - new spell_magmadar_lava_bomb(); + RegisterSpellScript(spell_magmadar_lava_bomb); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp index 3c12600f3..f79b43552 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp @@ -581,108 +581,74 @@ public: }; // 20538 Hate to Zero (SERVERSIDE) -class spell_hate_to_zero : public SpellScriptLoader +class spell_hate_to_zero : public SpellScript { -public: - spell_hate_to_zero() : SpellScriptLoader("spell_hate_to_zero") {} + PrepareSpellScript(spell_hate_to_zero); - class spell_hate_to_zero_SpellScript : public SpellScript + bool Load() override { - PrepareSpellScript(spell_hate_to_zero_SpellScript); + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } - bool Load() override + void HandleHit(SpellEffIndex /*effIndex*/) + { + if (Unit* caster = GetCaster()) { - return GetCaster()->GetTypeId() == TYPEID_UNIT; - } - - void HandleHit(SpellEffIndex /*effIndex*/) - { - if (Unit* caster = GetCaster()) + if (Creature* creatureCaster = caster->ToCreature()) { - if (Creature* creatureCaster = caster->ToCreature()) - { - creatureCaster->GetThreatMgr().ResetAllThreat(); - } + creatureCaster->GetThreatMgr().ResetAllThreat(); } } + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_hate_to_zero_SpellScript::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_hate_to_zero_SpellScript(); + OnEffectHitTarget += SpellEffectFn(spell_hate_to_zero::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY); } }; // 21094 Separation Anxiety (server side) -class spell_majordomo_separation_nexiety : public SpellScriptLoader +class spell_majordomo_separation_anxiety_aura : public AuraScript { -public: - spell_majordomo_separation_nexiety() : SpellScriptLoader("spell_majordomo_separation_nexiety") {} + PrepareAuraScript(spell_majordomo_separation_anxiety_aura); - class spell_majordomo_separation_nexiety_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spell*/) override { - PrepareAuraScript(spell_majordomo_separation_nexiety_AuraScript); + return ValidateSpellInfo({ SPELL_SEPARATION_ANXIETY_MINION }); + } - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_SEPARATION_ANXIETY_MINION }); - } - - void HandlePeriodic(AuraEffect const* aurEff) - { - Unit const* caster = GetCaster(); - Unit* target = GetTarget(); - if (caster && target && target->GetDistance(caster) > 40.0f && !target->HasAura(SPELL_SEPARATION_ANXIETY_MINION)) - { - target->CastSpell(target, SPELL_SEPARATION_ANXIETY_MINION, true, nullptr, aurEff); - } - } - - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_majordomo_separation_nexiety_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; - - // Should return a fully valid AuraScript pointer. - AuraScript* GetAuraScript() const override + void HandlePeriodic(AuraEffect const* aurEff) { - return new spell_majordomo_separation_nexiety_AuraScript(); + Unit const* caster = GetCaster(); + Unit* target = GetTarget(); + if (caster && target && target->GetDistance(caster) > 40.0f && !target->HasAura(SPELL_SEPARATION_ANXIETY_MINION)) + { + target->CastSpell(target, SPELL_SEPARATION_ANXIETY_MINION, true, nullptr, aurEff); + } + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_majordomo_separation_anxiety_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } }; // 19774 Summon Ragnaros -class spell_summon_ragnaros : public SpellScriptLoader +class spell_summon_ragnaros : public SpellScript { -public: - spell_summon_ragnaros() : SpellScriptLoader("spell_summon_ragnaros") {} + PrepareSpellScript(spell_summon_ragnaros); - class spell_summon_ragnaros_SpellScript : public SpellScript + void HandleHit() { - PrepareSpellScript(spell_summon_ragnaros_SpellScript); - - void HandleHit() + if (Unit* caster = GetCaster()) { - if (Unit* caster = GetCaster()) - { - caster->SummonCreature(NPC_RAGNAROS, RagnarosSummonPos, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 2 * HOUR * IN_MILLISECONDS); - } + caster->SummonCreature(NPC_RAGNAROS, RagnarosSummonPos, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 2 * HOUR * IN_MILLISECONDS); } + } - void Register() override - { - AfterCast += SpellCastFn(spell_summon_ragnaros_SpellScript::HandleHit); - } - }; - - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_summon_ragnaros_SpellScript(); + AfterCast += SpellCastFn(spell_summon_ragnaros::HandleHit); } }; @@ -691,8 +657,8 @@ void AddSC_boss_majordomo() new boss_majordomo(); // Spells - new spell_hate_to_zero(); - new spell_majordomo_separation_nexiety(); - new spell_summon_ragnaros(); + RegisterSpellScript(spell_hate_to_zero); + RegisterSpellScript(spell_majordomo_separation_anxiety_aura); + RegisterSpellScript(spell_summon_ragnaros); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp index 6ef919b52..4f37b434c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp @@ -109,85 +109,74 @@ public: }; // 23138 - Gate of Shazzrah -class spell_shazzrah_gate_dummy : public SpellScriptLoader +class spell_shazzrah_gate_dummy : public SpellScript { -public: - spell_shazzrah_gate_dummy() : SpellScriptLoader("spell_shazzrah_gate_dummy") {} + PrepareSpellScript(spell_shazzrah_gate_dummy); - class spell_shazzrah_gate_dummy_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_shazzrah_gate_dummy_SpellScript); + return ValidateSpellInfo({ SPELL_SHAZZRAH_GATE }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override + void FilterTargets(std::list& targets) + { + Unit* caster = GetCaster(); + if (!targets.empty()) { - return ValidateSpellInfo({ SPELL_SHAZZRAH_GATE }); - } - - void FilterTargets(std::list& targets) - { - Unit* caster = GetCaster(); - if (!targets.empty()) + targets.remove_if([caster](WorldObject const* target) -> bool { - targets.remove_if([caster](WorldObject const* target) -> bool + Player const* plrTarget = target->ToPlayer(); + // Should not target non player targets + if (!plrTarget) { - Player const* plrTarget = target->ToPlayer(); - // Should not target non player targets - if (!plrTarget) - { - return true; - } - - // Should skip current victim - if (caster->GetVictim() == plrTarget) - { - return true; - } - - // Should not target enemies within melee range - if (plrTarget->IsWithinMeleeRange(caster)) - { - return true; - } - - return false; - }); - } - - if (!targets.empty()) - { - Acore::Containers::RandomResize(targets, 1); - } - } - - void HandleScript(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - Unit* target = GetHitUnit(); - - if (caster && target) - { - target->CastSpell(caster, SPELL_SHAZZRAH_GATE, true); - caster->CastSpell(nullptr, SPELL_ARCANE_EXPLOSION); - - if (Creature* creatureCaster = caster->ToCreature()) - { - creatureCaster->GetThreatMgr().ResetAllThreat(); - creatureCaster->GetThreatMgr().AddThreat(target, 1); - creatureCaster->AI()->AttackStart(target); // Attack the target which caster will teleport to. + return true; } + + // Should skip current victim + if (caster->GetVictim() == plrTarget) + { + return true; + } + + // Should not target enemies within melee range + if (plrTarget->IsWithinMeleeRange(caster)) + { + return true; + } + + return false; + }); + } + + if (!targets.empty()) + { + Acore::Containers::RandomResize(targets, 1); + } + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + Unit* target = GetHitUnit(); + + if (caster && target) + { + target->CastSpell(caster, SPELL_SHAZZRAH_GATE, true); + caster->CastSpell(nullptr, SPELL_ARCANE_EXPLOSION); + + if (Creature* creatureCaster = caster->ToCreature()) + { + creatureCaster->GetThreatMgr().ResetAllThreat(); + creatureCaster->GetThreatMgr().AddThreat(target, 1); + creatureCaster->AI()->AttackStart(target); // Attack the target which caster will teleport to. } } + } - void Register() override - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_shazzrah_gate_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnEffectHitTarget += SpellEffectFn(spell_shazzrah_gate_dummy_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_shazzrah_gate_dummy_SpellScript(); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_shazzrah_gate_dummy::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_shazzrah_gate_dummy::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -196,6 +185,6 @@ void AddSC_boss_shazzrah() new boss_shazzrah(); // Spells - new spell_shazzrah_gate_dummy(); + RegisterSpellScript(spell_shazzrah_gate_dummy); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/molten_core.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/molten_core.cpp index f25149e66..8f94b53ad 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/molten_core.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/molten_core.cpp @@ -118,101 +118,95 @@ public: }; // 19822 Play Dead -class spell_mc_play_dead : public SpellScriptLoader +class spell_mc_play_dead_aura : public AuraScript { -public: - spell_mc_play_dead() : SpellScriptLoader("spell_mc_play_dead") { } + PrepareAuraScript(spell_mc_play_dead_aura); - class spell_mc_play_dead_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_mc_play_dead_AuraScript); + return ValidateSpellInfo({ SPELL_PLAY_DEAD_PACIFY, SPELL_PLAY_DEAD }); + } - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_UNIT; - } - - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Creature* creatureTarget = GetTarget()->ToCreature(); - if (!creatureTarget) - { - return; - } - - creatureTarget->CastSpell(creatureTarget, SPELL_PLAY_DEAD_PACIFY, true); - creatureTarget->SetDynamicFlag(UNIT_DYNFLAG_DEAD); - creatureTarget->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); - //creatureTarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - creatureTarget->SetReactState(REACT_PASSIVE); - creatureTarget->SetControlled(true, UNIT_STATE_ROOT); - - creatureTarget->AttackStop(); - } - - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Creature* creatureTarget = GetTarget()->ToCreature(); - if (!creatureTarget) - { - return; - } - - creatureTarget->RemoveAurasDueToSpell(SPELL_PLAY_DEAD_PACIFY); - creatureTarget->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD); - creatureTarget->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); - //creatureTarget->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - creatureTarget->SetControlled(false, UNIT_STATE_ROOT); - creatureTarget->SetReactState(REACT_AGGRESSIVE); - - if (!creatureTarget->IsInCombat()) - { - return; - } - - bool shouldDie = true; - std::list hounds; - creatureTarget->GetCreaturesWithEntryInRange(hounds, 80.0f, NPC_CORE_HOUND); - - // Perform lambda based check to find if there is any nearby - if (!hounds.empty()) - { - // Alive hound been found within 80 yards -> cancel suicide - if (std::find_if(hounds.begin(), hounds.end(), [creatureTarget](Creature const* hound) - { - return creatureTarget != hound && creatureTarget->IsWithinLOSInMap(hound) && hound->IsAlive() && hound->IsInCombat() && !hound->HasAura(SPELL_PLAY_DEAD); - }) != hounds.end()) - { - shouldDie = false; - } - } - - if (!shouldDie) - { - if (CreatureAI* targetAI = creatureTarget->AI()) - { - targetAI->DoCastSelf(SPELL_FIRE_NOVA_VISUAL, true); - targetAI->DoCastSelf(SPELL_FULL_HEALTH, true); - targetAI->Talk(EMOTE_IGNITE); - } - } - else - { - Unit::Kill(creatureTarget, creatureTarget); - creatureTarget->DespawnOrUnsummon(14000); - } - } - - void Register() override - { - AfterEffectApply += AuraEffectApplyFn(spell_mc_play_dead_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_FEIGN_DEATH, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectApplyFn(spell_mc_play_dead_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_FEIGN_DEATH, AURA_EFFECT_HANDLE_REAL); - } - }; - - AuraScript* GetAuraScript() const override + bool Load() override { - return new spell_mc_play_dead_AuraScript(); + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } + + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Creature* creatureTarget = GetTarget()->ToCreature(); + if (!creatureTarget) + { + return; + } + + creatureTarget->CastSpell(creatureTarget, SPELL_PLAY_DEAD_PACIFY, true); + creatureTarget->SetDynamicFlag(UNIT_DYNFLAG_DEAD); + creatureTarget->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); + //creatureTarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + creatureTarget->SetReactState(REACT_PASSIVE); + creatureTarget->SetControlled(true, UNIT_STATE_ROOT); + + creatureTarget->AttackStop(); + } + + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Creature* creatureTarget = GetTarget()->ToCreature(); + if (!creatureTarget) + { + return; + } + + creatureTarget->RemoveAurasDueToSpell(SPELL_PLAY_DEAD_PACIFY); + creatureTarget->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD); + creatureTarget->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); + //creatureTarget->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + creatureTarget->SetControlled(false, UNIT_STATE_ROOT); + creatureTarget->SetReactState(REACT_AGGRESSIVE); + + if (!creatureTarget->IsInCombat()) + { + return; + } + + bool shouldDie = true; + std::list hounds; + creatureTarget->GetCreaturesWithEntryInRange(hounds, 80.0f, NPC_CORE_HOUND); + + // Perform lambda based check to find if there is any nearby + if (!hounds.empty()) + { + // Alive hound been found within 80 yards -> cancel suicide + if (std::find_if(hounds.begin(), hounds.end(), [creatureTarget](Creature const* hound) + { + return creatureTarget != hound && creatureTarget->IsWithinLOSInMap(hound) && hound->IsAlive() && hound->IsInCombat() && !hound->HasAura(SPELL_PLAY_DEAD); + }) != hounds.end()) + { + shouldDie = false; + } + } + + if (!shouldDie) + { + if (CreatureAI* targetAI = creatureTarget->AI()) + { + targetAI->DoCastSelf(SPELL_FIRE_NOVA_VISUAL, true); + targetAI->DoCastSelf(SPELL_FULL_HEALTH, true); + targetAI->Talk(EMOTE_IGNITE); + } + } + else + { + Unit::Kill(creatureTarget, creatureTarget); + creatureTarget->DespawnOrUnsummon(14000); + } + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_mc_play_dead_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_FEIGN_DEATH, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectApplyFn(spell_mc_play_dead_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_FEIGN_DEATH, AURA_EFFECT_HANDLE_REAL); } }; @@ -272,6 +266,6 @@ void AddSC_molten_core() RegisterCreatureAI(npc_lava_spawn); // Spells - new spell_mc_play_dead(); + RegisterSpellScript(spell_mc_play_dead_aura); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index 77c0f379b..6289d41fc 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -144,8 +144,6 @@ struct boss_netherspite : public BossAI if (p && p->IsAlive() // alive && (!target || target->GetDistance2d(portal) > p->GetDistance2d(portal)) // closer than current best && !p->HasAura(PlayerDebuff[j]) // not exhausted - && !p->HasAura(PlayerBuff[(j + 1) % 3]) // not on another beam - && !p->HasAura(PlayerBuff[(j + 2) % 3]) && IsBetween(me, p, portal)) // on the beam target = p; } @@ -296,6 +294,7 @@ struct boss_netherspite : public BossAI { BossAI::JustDied(killer); HandleDoors(true); + DestroyPortals(); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index ec7bd7bfe..c0dbd8fdc 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -20,22 +20,23 @@ #include "Player.h" #include "ScriptedCreature.h" #include "TaskScheduler.h" +#include "PassiveAI.h" #include "karazhan.h" enum Spells { - // phase 1 + // Ground Phase + SPELL_RAIN_OF_BONES = 37098, + SPELL_SMOKING_BLAST = 37057, + SPELL_FIREBALL_BARRAGE = 30282, + SPELL_SEARING_CINDERS = 30127, + // Air Phase SPELL_BELLOWING_ROAR = 39427, SPELL_CLEAVE = 30131, SPELL_CHARRED_EARTH = 30129, SPELL_DISTRACTING_ASH = 30130, SPELL_SMOLDERING_BREATH = 30210, SPELL_TAIL_SWEEP = 25653, - // phase 2 - SPELL_RAIN_OF_BONES = 37098, - SPELL_SMOKING_BLAST = 37057, - SPELL_FIREBALL_BARRAGE = 30282, - SPELL_SEARING_CINDERS = 30127, SPELL_SUMMON_SKELETON = 30170 }; @@ -43,20 +44,45 @@ enum Says { EMOTE_SUMMON = 0, YELL_AGGRO = 1, - YELL_FLY_PHASE = 2, + YELL_AIR_PHASE = 2, YELL_LAND_PHASE = 3, EMOTE_BREATH = 4 }; -enum Groups +enum Actions +{ + ACTION_START_INTRO = 0 +}; + +enum Phases +{ + PHASE_INTRO = 0, + PHASE_GROUND = 1, + PHASE_FLY = 2, + PHASE_TRANSITION = 3, +}; + + enum Groups { GROUP_GROUND = 0, - GROUP_FLYING = 1 -}; + GROUP_AIR = 1, + GROUP_LAND = 2 + }; enum Points { - POINT_DESPAWN = 10 // Other points used dynamically throughout the script + POINT_INTRO_TAKE_OFF = 11, + POINT_INTRO_PRE_LAND = 8, + POINT_INTRO_LAND = 12, + POINT_PRE_FLY_EAST = 21, + POINT_PRE_FLY_SOUTH = 22, + POINT_PRE_FLY_WEST = 23, + POINT_PRE_FLY = 24, + POINT_FLY = 31, + POINT_LANDING_PRE = 41, + POINT_LANDING_WEST = 42, + POINT_PRE_LAND = 5, + POINT_LAND = 51, }; float IntroWay[8][3] = @@ -71,13 +97,20 @@ float IntroWay[8][3] = {-11163.00f, -1903.00f, 91.473f} }; //TODO: move to table +Position const homePos = {-11003.7f, -1760.19f, 140.253f}; +Position const introLandPos = {-11142.712f, -1891.193f, 92.25038f}; +Position const preFlySouthPos = {-11193.77f, -1921.983f, 107.9845f}; +Position const preFlyEastPos = {-11167.065f, -1976.3473f, 109.91183f}; +Position const preFlyWestPos = {-11095.48f, -1866.5396f, 107.868996}; +Position const preFlyPos = {-11154.900391f, -1850.670044f, 103.264999f}; +Position const flyPos = {-11160.125f, -1870.683f, 97.73876f}; +Position const landPos = {-11162.231f, -1900.3287f, 91.47627f}; + struct boss_nightbane : public BossAI { boss_nightbane(Creature* creature) : BossAI(creature, DATA_NIGHTBANE) { - _intro = true; _skeletonCount = 5; - _movePhase = 0; } void Reset() override @@ -85,33 +118,37 @@ struct boss_nightbane : public BossAI BossAI::Reset(); _skeletonscheduler.CancelAll(); - me->SetSpeed(MOVE_RUN, 2.0f); - me->SetDisableGravity(_intro); - me->SetWalk(false); - me->setActive(true); + _triggerCountTakeOffWhileFlying = 0; + _airPhasesCompleted = 0; - _flying = false; - _movement = false; - _intro = true; - Phase = 1; - _movePhase = 0; + me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run); + me->SetCanFly(true); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); ScheduleHealthCheckEvent({ 75, 50, 25 }, [&]{ - TakeOff(); + TriggerHealthTakeOff(); }); } + void JustReachedHome() override + { + BossAI::JustReachedHome(); + me->DespawnOnEvade(); + } + void EnterEvadeMode(EvadeReason why) override { - BossAI::EnterEvadeMode(why); + me->SetHomePosition(homePos); + me->SetCanFly(true); me->SetDisableGravity(true); me->SendMovementFlagUpdate(); - me->GetMotionMaster()->MoveTakeoff(POINT_DESPAWN, -11013.246f, -1770.5212f, 166.50139f); + BossAI::EnterEvadeMode(why); } void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType damageEffectType, SpellSchoolMask spellSchoolMask) override { - if (_flying || Phase == 2) + if (_airPhasesCompleted < 3) { if (damage >= me->GetHealth()) { @@ -124,12 +161,31 @@ struct boss_nightbane : public BossAI void JustEngagedWith(Unit* who) override { BossAI::JustEngagedWith(who); - _intro = false; - Talk(YELL_AGGRO); ScheduleGround(); } + void DoAction(int32 action) override + { + if (action == ACTION_START_INTRO) + { + me->GetMap()->LoadGrid(-11260.0f, -1771.0f); // load grid at far end of intro path + me->GetMap()->SetVisibilityRange(DEFAULT_VISIBILITY_INSTANCE + 100.0f); // see nightbane + me->AddUnitState(UNIT_STATE_IGNORE_PATHFINDING); + _phase = PHASE_INTRO; + Talk(EMOTE_SUMMON); + scheduler.Schedule(2s, [this](TaskContext /*context*/) + { + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetDisableGravity(true); + me->GetMotionMaster()->MoveTakeoff(POINT_INTRO_TAKE_OFF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 10.0f, 13.99879f); + }).Schedule(4s, [this](TaskContext /*context*/) + { + me->GetMotionMaster()->MovePath(me->GetEntry()*10, false); + }); + } + } + void ScheduleGround() { scheduler.Schedule(30s, GROUP_GROUND, [this](TaskContext context) @@ -169,12 +225,13 @@ struct boss_nightbane : public BossAI { _skeletonSpawnCounter = 0; - scheduler.Schedule(2s, GROUP_FLYING, [this](TaskContext) + scheduler.Schedule(2s, GROUP_AIR, [this](TaskContext) { DoResetThreatList(); if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f)) { _skeletonSpawnPos = target->GetPosition(); + me->SetFacingTo(_skeletonSpawnPos.GetOrientation()); me->CastSpell(_skeletonSpawnPos.GetPositionX(), _skeletonSpawnPos.GetPositionY(), _skeletonSpawnPos.GetPositionZ(), SPELL_RAIN_OF_BONES, true); _skeletonscheduler.Schedule(50ms, [this](TaskContext context) { @@ -187,18 +244,23 @@ struct boss_nightbane : public BossAI } }); } - }).Schedule(20s, GROUP_FLYING, [this](TaskContext context) + }).Schedule(20s, GROUP_AIR, [this](TaskContext context) { - DoCastRandomTarget(SPELL_DISTRACTING_ASH); + if (Unit* target = SelectTarget(SelectTargetMethod::Random)) + { + me->SetFacingToObject(target); + DoCast(target, SPELL_DISTRACTING_ASH); + } context.Repeat(2s); //timer wrong? - }).Schedule(25s, GROUP_FLYING, [this](TaskContext context) + }).Schedule(25s, GROUP_AIR, [this](TaskContext context) { //5 seconds added due to double trigger? //trigger for timer in original + in rain of bones //timers need some investigation + me->SetFacingToObject(me->GetVictim()); DoCastVictim(SPELL_SMOKING_BLAST); context.Repeat(1500ms); //timer wrong? - }).Schedule(13s, GROUP_FLYING, [this](TaskContext context) + }).Schedule(13s, GROUP_AIR, [this](TaskContext context) { DoCastOnFarAwayPlayers(SPELL_FIREBALL_BARRAGE, false, 80.0f); context.Repeat(20s); @@ -207,58 +269,135 @@ struct boss_nightbane : public BossAI void AttackStart(Unit* who) override { - if (!_intro && !_flying) + if (_phase == PHASE_GROUND) ScriptedAI::AttackStart(who); } void MoveInLineOfSight(Unit* who) override { - if (!_intro && !_flying) + if (_phase == PHASE_GROUND) ScriptedAI::MoveInLineOfSight(who); } + void PathEndReached(uint32 pathId) override + { + BossAI::PathEndReached(pathId); + if (pathId == me->GetEntry()*10) // intro + { + me->GetMap()->SetVisibilityRange(DEFAULT_VISIBILITY_INSTANCE); // restore visibility + scheduler.Schedule(0s, [this](TaskContext /*context*/) + { + me->ClearUnitState(UNIT_STATE_IGNORE_PATHFINDING); + me->GetMotionMaster()->MovePoint(POINT_INTRO_LAND, introLandPos); + me->SetSpeed(MOVE_RUN, 2.0f); + }).Schedule(3s, [this](TaskContext /*context*/) + { + me->SetDisableGravity(false); + me->SetCanFly(false); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + _phase = PHASE_GROUND; + me->SetReactState(REACT_AGGRESSIVE); + me->SetInCombatWithZone(); + }).Schedule(8s, [this](TaskContext /*context*/) + { + if (!SelectTargetFromPlayerList(45.0f)) + { + EnterEvadeMode(EVADE_REASON_NO_HOSTILES); + } + }); + } + else if (pathId == me->GetEntry()*10+1) // landing + { + _airPhasesCompleted++; + if (_triggerCountTakeOffWhileFlying > 0) + { + _triggerCountTakeOffWhileFlying--; + scheduler.Schedule(0s, [this](TaskContext /*context*/) + { + me->GetMotionMaster()->MovePoint(POINT_PRE_FLY_SOUTH, preFlySouthPos); + }); + } + else + { + scheduler.Schedule(0s, [this](TaskContext /*context*/) + { + DoResetThreatList(); + me->GetMotionMaster()->MovePoint(POINT_LAND, landPos); + me->SetDisableGravity(false); + me->SetCanFly(false); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + _phase = PHASE_GROUND; + ScheduleGround(); + }); + } + } + } + void MovementInform(uint32 type, uint32 id) override { if (type != POINT_MOTION_TYPE) return; - if (id == POINT_DESPAWN) + switch (id) { - me->DespawnOnEvade(); - } - - if (_intro) - { - if (id >= 8) - { - me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); - me->SetInCombatWithZone(); - return; - } - - _movePhase = id + 1; - return; - } - - if (_flying) - { - if (id == 0) - { + case POINT_INTRO_TAKE_OFF: + break; + case POINT_INTRO_LAND: + DoStartMovement(me->GetVictim()); + break; + case POINT_PRE_FLY_EAST: + scheduler.Schedule(0s, [this](TaskContext /*context*/) + { + me->GetMotionMaster()->MovePoint(POINT_PRE_FLY_SOUTH, preFlySouthPos); + }); + break; + case POINT_PRE_FLY_SOUTH: + case POINT_PRE_FLY_WEST: + scheduler.Schedule(0s, [this](TaskContext /*context*/) + { + me->GetMotionMaster()->MovePoint(POINT_PRE_FLY, preFlyPos); + }); + break; + case POINT_PRE_FLY: + scheduler.Schedule(0s, [this](TaskContext /*context*/) + { + me->GetMotionMaster()->MovePoint(POINT_FLY, flyPos); + }); + break; + case POINT_FLY: + _phase = PHASE_FLY; Talk(EMOTE_BREATH); - _flying = false; - Phase = 2; - return; - } - - if (id < 8) - _movePhase = id + 1; - else - { - Phase = 1; - _flying = false; - _movement = true; - return; - } + ScheduleFly(); + ScheduleLand(); + break; + case POINT_LANDING_PRE: + scheduler.Schedule(0s, [this](TaskContext /*context*/) + { + me->GetMotionMaster()->MovePoint(POINT_LANDING_WEST, preFlyWestPos); + }); + break; + case POINT_LANDING_WEST: + if (_triggerCountTakeOffWhileFlying > 0) + { + _airPhasesCompleted++; + _triggerCountTakeOffWhileFlying--; + scheduler.Schedule(0s, [this](TaskContext /*context*/) + { + me->GetMotionMaster()->MovePoint(POINT_PRE_FLY, preFlyPos); + }); + } + else + { + scheduler.Schedule(0s, [this](TaskContext /*context*/) + { + me->GetMotionMaster()->MovePath(me->GetEntry()*10+1, false); + }); + } + break; + case POINT_LAND: + DoStartMovement(me->GetVictim()); + break; } } @@ -284,107 +423,79 @@ struct boss_nightbane : public BossAI } } - void TakeOff() + void TriggerHealthTakeOff() { - Talk(YELL_FLY_PHASE); + if (_phase != PHASE_GROUND) + { + _triggerCountTakeOffWhileFlying++; + return; + } + _phase = PHASE_TRANSITION; + Talk(YELL_AIR_PHASE); scheduler.CancelGroup(GROUP_GROUND); - me->InterruptSpell(CURRENT_GENERIC_SPELL); me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); me->SetDisableGravity(true); + me->SetCanFly(true); + me->SendMovementFlagUpdate(); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + FlyToClosestPreFlyWayPoint(); + } + + void FlyToClosestPreFlyWayPoint() + { + Position closestWP = preFlyPos; + if (me->GetDistance(preFlyEastPos) < me->GetDistance(closestWP)) + closestWP = preFlyEastPos; + if (me->GetDistance(preFlySouthPos) < me->GetDistance(closestWP)) + closestWP = preFlySouthPos; + if (me->GetDistance(preFlyWestPos) < me->GetDistance(closestWP)) + closestWP = preFlyWestPos; + me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MovePoint(0, IntroWay[2][0], IntroWay[2][1], IntroWay[2][2]); + if (closestWP == preFlyPos) + me->GetMotionMaster()->MovePoint(POINT_PRE_FLY, closestWP); + else if (closestWP == preFlyEastPos) + me->GetMotionMaster()->MovePoint(POINT_PRE_FLY_EAST, closestWP); + else if (closestWP == preFlySouthPos) + me->GetMotionMaster()->MovePoint(POINT_PRE_FLY_SOUTH, closestWP); + else if (closestWP == preFlyWestPos) + me->GetMotionMaster()->MovePoint(POINT_PRE_FLY_WEST, closestWP); + } - _flying = true; - - ScheduleFly(); - - //handle landing again - scheduler.Schedule(45s, 60s, [this](TaskContext) + void ScheduleLand() + { + scheduler.Schedule(30s, GROUP_LAND, [this](TaskContext) /*context*/ { Talk(YELL_LAND_PHASE); + scheduler.CancelGroup(GROUP_AIR); + _phase = PHASE_TRANSITION; me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MovePoint(3, IntroWay[3][0], IntroWay[3][1], IntroWay[3][2]); - - _flying = true; - scheduler.CancelGroup(GROUP_FLYING); - scheduler.Schedule(2s, [this](TaskContext) - { - ScheduleGround(); - }); + me->GetMotionMaster()->MovePoint(POINT_LANDING_PRE, preFlyPos); }); } void UpdateAI(uint32 diff) override { - if (_intro) - { - if (_movePhase) - { - if (_movePhase >= 7) - { - me->SetDisableGravity(false); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]); - } - else - { - me->GetMotionMaster()->MovePoint(_movePhase, IntroWay[_movePhase][0], IntroWay[_movePhase][1], IntroWay[_movePhase][2]); - } - _movePhase = 0; - } - return; - } - - if (_flying && _movePhase) - { - if (_movePhase >= 7) - { - me->SetDisableGravity(false); - DoResetThreatList(); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); - me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]); - } - else - me->GetMotionMaster()->MovePoint(_movePhase, IntroWay[_movePhase][0], IntroWay[_movePhase][1], IntroWay[_movePhase][2]); - - _movePhase = 0; - } + scheduler.Update(diff); + _skeletonscheduler.Update(diff); if (!UpdateVictim()) return; - if (_flying) - return; - - scheduler.Update(diff); - _skeletonscheduler.Update(diff); - - // Phase 1 "GROUND FIGHT" - if (Phase == 1) + if (_phase == PHASE_GROUND) { - if (_movement) - { - DoStartMovement(me->GetVictim()); - _movement = false; - } - DoMeleeAttackIfReady(); } } private: - uint32 Phase; + uint8 _phase; + uint8 _airPhasesCompleted; + uint8 _triggerCountTakeOffWhileFlying; TaskScheduler _skeletonscheduler; - - bool _intro; - bool _flying; - bool _movement; - - uint32 _movePhase; uint8 _skeletonCount; uint8 _skeletonSpawnCounter; Position _skeletonSpawnPos; @@ -399,22 +510,31 @@ public: { if (InstanceScript* instance = go->GetInstanceScript()) { - if (instance->GetData(DATA_NIGHTBANE) != DONE && !go->FindNearestCreature(NPC_NIGHTBANE, 40.0f)) + // if (instance->GetBossState(DATA_NIGHTBANE) == NOT_STARTED || instance->GetBossState(DATA_NIGHTBANE) == FAIL) + if (instance->GetBossState(DATA_NIGHTBANE) == NOT_STARTED) { if (Creature* nightbane = instance->GetCreature(DATA_NIGHTBANE)) { - nightbane->GetMotionMaster()->MovePoint(0, IntroWay[0][0], IntroWay[0][1], IntroWay[0][2]); - nightbane->AI()->Talk(EMOTE_SUMMON); + if (nightbane->IsAlive()) + { + nightbane->AI()->DoAction(ACTION_START_INTRO); + return true; + } } } } - return false; } }; +struct npc_nightbane_helper_target : public NullCreatureAI +{ + npc_nightbane_helper_target(Creature* creature) : NullCreatureAI(creature) { me->SetDisableGravity(true); } +}; + void AddSC_boss_nightbane() { RegisterKarazhanCreatureAI(boss_nightbane); new go_blackened_urn(); + RegisterKarazhanCreatureAI(npc_nightbane_helper_target); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index 447c6a375..114d0201b 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -528,103 +528,85 @@ public: }; }; -class spell_karazhan_brittle_bones : public SpellScriptLoader +class spell_karazhan_brittle_bones_aura : public AuraScript { -public: - spell_karazhan_brittle_bones() : SpellScriptLoader("spell_karazhan_brittle_bones") { } + PrepareAuraScript(spell_karazhan_brittle_bones_aura); - class spell_karazhan_brittle_bones_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_karazhan_brittle_bones_AuraScript); + return ValidateSpellInfo({ SPELL_RATTLED }); + } - void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) - { - isPeriodic = true; - amplitude = 5000; - } - - void Update(AuraEffect const* /*effect*/) - { - PreventDefaultAction(); - if (roll_chance_i(35)) - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_RATTLED, true); - } - - void Register() override - { - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_karazhan_brittle_bones_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_karazhan_brittle_bones_AuraScript::Update, EFFECT_0, SPELL_AURA_DUMMY); - } - }; - - AuraScript* GetAuraScript() const override + void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) { - return new spell_karazhan_brittle_bones_AuraScript(); + isPeriodic = true; + amplitude = 5000; + } + + void Update(AuraEffect const* /*effect*/) + { + PreventDefaultAction(); + if (roll_chance_i(35)) + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_RATTLED, true); + } + + void Register() override + { + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_karazhan_brittle_bones_aura::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_karazhan_brittle_bones_aura::Update, EFFECT_0, SPELL_AURA_DUMMY); } }; -class spell_karazhan_overload : public SpellScriptLoader +class spell_karazhan_overload_aura : public AuraScript { -public: - spell_karazhan_overload() : SpellScriptLoader("spell_karazhan_overload") { } + PrepareAuraScript(spell_karazhan_overload_aura); - class spell_karazhan_overload_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_karazhan_overload_AuraScript); + return ValidateSpellInfo({ SPELL_OVERLOAD }); + } - void PeriodicTick(AuraEffect const* auraEffect) - { - PreventDefaultAction(); - //Should stop at 3200 damage, maybe check needed(?) - GetUnitOwner()->CastCustomSpell(SPELL_OVERLOAD, SPELLVALUE_BASE_POINT0, int32(auraEffect->GetAmount() * pow(2.0, auraEffect->GetTickNumber())), GetUnitOwner(), true); - } - - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_karazhan_overload_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const override + void PeriodicTick(AuraEffect const* auraEffect) { - return new spell_karazhan_overload_AuraScript(); + PreventDefaultAction(); + //Should stop at 3200 damage, maybe check needed(?) + GetUnitOwner()->CastCustomSpell(SPELL_OVERLOAD, SPELLVALUE_BASE_POINT0, int32(auraEffect->GetAmount() * pow(2.0, auraEffect->GetTickNumber())), GetUnitOwner(), true); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_karazhan_overload_aura::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; -class spell_karazhan_blink : public SpellScriptLoader +class spell_karazhan_blink : public SpellScript { -public: - spell_karazhan_blink() : SpellScriptLoader("spell_karazhan_blink") { } + PrepareSpellScript(spell_karazhan_blink); - class spell_karazhan_blink_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_karazhan_blink_SpellScript); + return ValidateSpellInfo({ SPELL_BLINK }); + } - void HandleDummy(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - GetCaster()->GetThreatMgr().ResetAllThreat(); - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, SPELL_BLINK, true); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_karazhan_blink_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex effIndex) { - return new spell_karazhan_blink_SpellScript(); + PreventHitDefaultEffect(effIndex); + GetCaster()->GetThreatMgr().ResetAllThreat(); + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, SPELL_BLINK, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_karazhan_blink::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; void AddSC_instance_karazhan() { new instance_karazhan(); - new spell_karazhan_brittle_bones(); - new spell_karazhan_overload(); - new spell_karazhan_blink(); + RegisterSpellScript(spell_karazhan_brittle_bones_aura); + RegisterSpellScript(spell_karazhan_overload_aura); + RegisterSpellScript(spell_karazhan_blink); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp index 6ae04d96a..3919e5119 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp @@ -161,41 +161,35 @@ public: }; }; -class spell_boss_salramm_steal_flesh : public SpellScriptLoader +class spell_boss_salramm_steal_flesh_aura : public AuraScript { -public: - spell_boss_salramm_steal_flesh() : SpellScriptLoader("spell_boss_salramm_steal_flesh") { } + PrepareAuraScript(spell_boss_salramm_steal_flesh_aura); - class spell_boss_salramm_steal_flesh_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_boss_salramm_steal_flesh_AuraScript); + return ValidateSpellInfo({ SPELL_STEAL_FLESH_CASTER, SPELL_STEAL_FLESH_TARGET }); + } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* caster = GetCaster(); - Unit* target = GetUnitOwner(); - if (caster) - { - caster->CastSpell(caster, SPELL_STEAL_FLESH_CASTER, true); - caster->CastSpell(target, SPELL_STEAL_FLESH_TARGET, true); - } - } - - void Register() override - { - AfterEffectRemove += AuraEffectRemoveFn(spell_boss_salramm_steal_flesh_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; - - AuraScript* GetAuraScript() const override + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - return new spell_boss_salramm_steal_flesh_AuraScript(); + Unit* caster = GetCaster(); + Unit* target = GetUnitOwner(); + if (caster) + { + caster->CastSpell(caster, SPELL_STEAL_FLESH_CASTER, true); + caster->CastSpell(target, SPELL_STEAL_FLESH_TARGET, true); + } + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_boss_salramm_steal_flesh_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; void AddSC_boss_salramm() { new boss_salramm(); - new spell_boss_salramm_steal_flesh(); + RegisterSpellScript(spell_boss_salramm_steal_flesh_aura); } diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index 371c233bc..f2de81202 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -457,86 +457,64 @@ public: }; // 10247 - Summon Zul'Farrak Zombies -class spell_zulfarrak_summon_zulfarrak_zombies : public SpellScriptLoader +class spell_zulfarrak_summon_zulfarrak_zombies : public SpellScript { -public: - spell_zulfarrak_summon_zulfarrak_zombies() : SpellScriptLoader("spell_zulfarrak_summon_zulfarrak_zombies") { } + PrepareSpellScript(spell_zulfarrak_summon_zulfarrak_zombies); - class spell_zulfarrak_summon_zulfarrak_zombies_SpellScript : public SpellScript + void HandleSummon(SpellEffIndex effIndex) { - PrepareSpellScript(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript); - - void HandleSummon(SpellEffIndex effIndex) + if (effIndex == EFFECT_0) { - if (effIndex == EFFECT_0) - { - if (roll_chance_i(30)) - { - PreventHitDefaultEffect(effIndex); - return; - } - } - else if (roll_chance_i(40)) + if (roll_chance_i(30)) { PreventHitDefaultEffect(effIndex); return; } } - - void Register() override + else if (roll_chance_i(40)) { - OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON); - OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript::HandleSummon, EFFECT_1, SPELL_EFFECT_SUMMON); + PreventHitDefaultEffect(effIndex); + return; } - }; + } - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_zulfarrak_summon_zulfarrak_zombies_SpellScript; + OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON); + OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies::HandleSummon, EFFECT_1, SPELL_EFFECT_SUMMON); } }; // 10738 - Unlocking -class spell_zulfarrak_unlocking : public SpellScriptLoader +class spell_zulfarrak_unlocking : public SpellScript { -public: - spell_zulfarrak_unlocking() : SpellScriptLoader("spell_zulfarrak_unlocking") { } + PrepareSpellScript(spell_zulfarrak_unlocking); - class spell_zulfarrak_unlocking_SpellScript : public SpellScript + void HandleOpenLock(SpellEffIndex /*effIndex*/) { - PrepareSpellScript(spell_zulfarrak_unlocking_SpellScript); - - void HandleOpenLock(SpellEffIndex /*effIndex*/) + GameObject* cage = GetHitGObj(); + std::list cagesList; + Acore::AllWorldObjectsInRange objects(GetCaster(), 15.0f); + Acore::WorldObjectListSearcher searcher(GetCaster(), cagesList, objects); + Cell::VisitAllObjects(GetCaster(), searcher, 15.0f); + for (std::list::const_iterator itr = cagesList.begin(); itr != cagesList.end(); ++itr) { - GameObject* cage = GetHitGObj(); - std::list cagesList; - Acore::AllWorldObjectsInRange objects(GetCaster(), 15.0f); - Acore::WorldObjectListSearcher searcher(GetCaster(), cagesList, objects); - Cell::VisitAllObjects(GetCaster(), searcher, 15.0f); - for (std::list::const_iterator itr = cagesList.begin(); itr != cagesList.end(); ++itr) - { - if (GameObject* go = (*itr)->ToGameObject()) - if (go->GetDisplayId() == cage->GetDisplayId()) - go->UseDoorOrButton(0, false, GetCaster()); - } + if (GameObject* go = (*itr)->ToGameObject()) + if (go->GetDisplayId() == cage->GetDisplayId()) + go->UseDoorOrButton(0, false, GetCaster()); } + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_zulfarrak_unlocking_SpellScript::HandleOpenLock, EFFECT_0, SPELL_EFFECT_OPEN_LOCK); - } - }; - - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_zulfarrak_unlocking_SpellScript(); + OnEffectHitTarget += SpellEffectFn(spell_zulfarrak_unlocking::HandleOpenLock, EFFECT_0, SPELL_EFFECT_OPEN_LOCK); } }; void AddSC_instance_zulfarrak() { new instance_zulfarrak(); - new spell_zulfarrak_summon_zulfarrak_zombies(); - new spell_zulfarrak_unlocking(); + RegisterSpellScript(spell_zulfarrak_summon_zulfarrak_zombies); + RegisterSpellScript(spell_zulfarrak_unlocking); } diff --git a/src/server/scripts/Kalimdor/zone_durotar.cpp b/src/server/scripts/Kalimdor/zone_durotar.cpp index 2747801a9..bd243b54c 100644 --- a/src/server/scripts/Kalimdor/zone_durotar.cpp +++ b/src/server/scripts/Kalimdor/zone_durotar.cpp @@ -361,90 +361,68 @@ public: typedef npc_troll_volunteer::npc_troll_volunteerAI VolunteerAI; -class spell_mount_check : public SpellScriptLoader +class spell_mount_check_aura : public AuraScript { -public: - spell_mount_check() : SpellScriptLoader("spell_mount_check") { } + PrepareAuraScript(spell_mount_check_aura); - class spell_mount_check_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_mount_check_AuraScript) + return ValidateSpellInfo({ SPELL_MOUNTING_CHECK }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_MOUNTING_CHECK }); - } - - void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) - { - Unit* target = GetTarget(); - Unit* owner = target->GetOwner(); - - if (!owner) - return; - - if (owner->IsMounted() && !target->IsMounted()) - { - if (VolunteerAI* volunteerAI = CAST_AI(VolunteerAI, target->GetAI())) - target->Mount(volunteerAI->GetMountId()); - } - else if (!owner->IsMounted() && target->IsMounted()) - target->Dismount(); - - target->SetSpeed(MOVE_RUN, owner->GetSpeedRate(MOVE_RUN)); - target->SetSpeed(MOVE_WALK, owner->GetSpeedRate(MOVE_WALK)); - } - - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_mount_check_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; - - AuraScript* GetAuraScript() const override + void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) { - return new spell_mount_check_AuraScript(); + Unit* target = GetTarget(); + Unit* owner = target->GetOwner(); + + if (!owner) + return; + + if (owner->IsMounted() && !target->IsMounted()) + { + if (VolunteerAI* volunteerAI = CAST_AI(VolunteerAI, target->GetAI())) + target->Mount(volunteerAI->GetMountId()); + } + else if (!owner->IsMounted() && target->IsMounted()) + target->Dismount(); + + target->SetSpeed(MOVE_RUN, owner->GetSpeedRate(MOVE_RUN)); + target->SetSpeed(MOVE_WALK, owner->GetSpeedRate(MOVE_WALK)); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mount_check_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } }; -class spell_voljin_war_drums : public SpellScriptLoader +class spell_voljin_war_drums : public SpellScript { -public: - spell_voljin_war_drums() : SpellScriptLoader("spell_voljin_war_drums") { } + PrepareSpellScript(spell_voljin_war_drums); - class spell_voljin_war_drums_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_voljin_war_drums_SpellScript) + return ValidateSpellInfo({ SPELL_MOTIVATE_1, SPELL_MOTIVATE_2 }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_MOTIVATE_1, SPELL_MOTIVATE_2 }); - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - if (Unit* target = GetHitUnit()) - { - uint32 motivate = 0; - if (target->GetEntry() == NPC_CITIZEN_1) - motivate = SPELL_MOTIVATE_1; - else if (target->GetEntry() == NPC_CITIZEN_2) - motivate = SPELL_MOTIVATE_2; - if (motivate) - caster->CastSpell(target, motivate, false); - } - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_voljin_war_drums_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex /*effIndex*/) { - return new spell_voljin_war_drums_SpellScript(); + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) + { + uint32 motivate = 0; + if (target->GetEntry() == NPC_CITIZEN_1) + motivate = SPELL_MOTIVATE_1; + else if (target->GetEntry() == NPC_CITIZEN_2) + motivate = SPELL_MOTIVATE_2; + if (motivate) + caster->CastSpell(target, motivate, false); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_voljin_war_drums::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -460,45 +438,34 @@ enum VoodooSpells }; // 17009 -class spell_voodoo : public SpellScriptLoader +class spell_voodoo : public SpellScript { -public: - spell_voodoo() : SpellScriptLoader("spell_voodoo") { } + PrepareSpellScript(spell_voodoo); - class spell_voodoo_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_voodoo_SpellScript) + return ValidateSpellInfo( + { + SPELL_BREW, + SPELL_GHOSTLY, + SPELL_HEX1, + SPELL_HEX2, + SPELL_HEX3, + SPELL_GROW, + SPELL_LAUNCH + }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_BREW, - SPELL_GHOSTLY, - SPELL_HEX1, - SPELL_HEX2, - SPELL_HEX3, - SPELL_GROW, - SPELL_LAUNCH - }); - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - uint32 spellid = RAND(SPELL_BREW, SPELL_GHOSTLY, RAND(SPELL_HEX1, SPELL_HEX2, SPELL_HEX3), SPELL_GROW, SPELL_LAUNCH); - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, spellid, false); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_voodoo_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex /*effIndex*/) { - return new spell_voodoo_SpellScript(); + uint32 spellid = RAND(SPELL_BREW, SPELL_GHOSTLY, RAND(SPELL_HEX1, SPELL_HEX2, SPELL_HEX3), SPELL_GROW, SPELL_LAUNCH); + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, spellid, false); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_voodoo::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -507,8 +474,8 @@ void AddSC_durotar() new npc_tiger_matriarch_credit(); new npc_tiger_matriarch(); new npc_troll_volunteer(); - new spell_mount_check(); - new spell_voljin_war_drums(); - new spell_voodoo(); + RegisterSpellScript(spell_mount_check_aura); + RegisterSpellScript(spell_voljin_war_drums); + RegisterSpellScript(spell_voodoo); } diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp index 4f3934f2b..5439edc99 100644 --- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp @@ -30,135 +30,102 @@ enum SpellScripts SPELL_ENERGIZED = 42492, }; -class spell_ooze_zap : public SpellScriptLoader +class spell_ooze_zap : public SpellScript { -public: - spell_ooze_zap() : SpellScriptLoader("spell_ooze_zap") { } + PrepareSpellScript(spell_ooze_zap); - class spell_ooze_zap_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_ooze_zap_SpellScript); + return ValidateSpellInfo({ SPELL_OOZE_ZAP }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_OOZE_ZAP }); - } - - SpellCastResult CheckRequirement() - { - if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue())) - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct - - if (!GetExplTargetUnit()) - return SPELL_FAILED_BAD_TARGETS; - - return SPELL_CAST_OK; - } - - void HandleDummy(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (GetHitUnit()) - GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - OnCheckCast += SpellCheckCastFn(spell_ooze_zap_SpellScript::CheckRequirement); - } - }; - - SpellScript* GetSpellScript() const override + SpellCastResult CheckRequirement() { - return new spell_ooze_zap_SpellScript(); + if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue())) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct + + if (!GetExplTargetUnit()) + return SPELL_FAILED_BAD_TARGETS; + + return SPELL_CAST_OK; + } + + void HandleDummy(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (GetHitUnit()) + GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_ooze_zap::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnCheckCast += SpellCheckCastFn(spell_ooze_zap::CheckRequirement); } }; -class spell_ooze_zap_channel_end : public SpellScriptLoader +class spell_ooze_zap_channel_end : public SpellScript { -public: - spell_ooze_zap_channel_end() : SpellScriptLoader("spell_ooze_zap_channel_end") { } + PrepareSpellScript(spell_ooze_zap_channel_end); - class spell_ooze_zap_channel_end_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_ooze_zap_channel_end_SpellScript); + return ValidateSpellInfo({ SPELL_OOZE_ZAP_CHANNEL_END }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_OOZE_ZAP_CHANNEL_END }); - } - - void HandleDummy(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Player* player = GetCaster()->ToPlayer()) - player->CastSpell(player, SPELL_OOZE_CHANNEL_CREDIT, true); - Unit::Kill(GetHitUnit(), GetHitUnit()); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_channel_end_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex effIndex) { - return new spell_ooze_zap_channel_end_SpellScript(); + PreventHitDefaultEffect(effIndex); + if (Player* player = GetCaster()->ToPlayer()) + player->CastSpell(player, SPELL_OOZE_CHANNEL_CREDIT, true); + Unit::Kill(GetHitUnit(), GetHitUnit()); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_channel_end::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; -class spell_energize_aoe : public SpellScriptLoader +class spell_energize_aoe : public SpellScript { -public: - spell_energize_aoe() : SpellScriptLoader("spell_energize_aoe") { } + PrepareSpellScript(spell_energize_aoe); - class spell_energize_aoe_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_energize_aoe_SpellScript); + return ValidateSpellInfo({ SPELL_ENERGIZED }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_ENERGIZED }); - } - - void FilterTargets(std::list& targets) - { - for (std::list::iterator itr = targets.begin(); itr != targets.end();) - { - if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE) - ++itr; - else - targets.erase(itr++); - } - targets.push_back(GetCaster()); - } - - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_energize_aoe_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY); - } - }; - - SpellScript* GetSpellScript() const override + void FilterTargets(std::list& targets) { - return new spell_energize_aoe_SpellScript(); + for (std::list::iterator itr = targets.begin(); itr != targets.end();) + { + if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE) + ++itr; + else + targets.erase(itr++); + } + targets.push_back(GetCaster()); + } + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_energize_aoe::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY); } }; void AddSC_dustwallow_marsh() { - new spell_ooze_zap(); - new spell_ooze_zap_channel_end(); - new spell_energize_aoe(); + RegisterSpellScript(spell_ooze_zap); + RegisterSpellScript(spell_ooze_zap_channel_end); + RegisterSpellScript(spell_energize_aoe); } diff --git a/src/server/scripts/Kalimdor/zone_feralas.cpp b/src/server/scripts/Kalimdor/zone_feralas.cpp index 854b85c69..7352427a5 100644 --- a/src/server/scripts/Kalimdor/zone_feralas.cpp +++ b/src/server/scripts/Kalimdor/zone_feralas.cpp @@ -33,39 +33,28 @@ enum GordunniTrap GO_GORDUNNI_DIRT_MOUND = 144064, }; -class spell_gordunni_trap : public SpellScriptLoader +class spell_gordunni_trap : public SpellScript { -public: - spell_gordunni_trap() : SpellScriptLoader("spell_gordunni_trap") { } + PrepareSpellScript(spell_gordunni_trap); - class spell_gordunni_trap_SpellScript : public SpellScript + void HandleDummy() { - PrepareSpellScript(spell_gordunni_trap_SpellScript); + if (Unit* caster = GetCaster()) + if (GameObject* chest = caster->SummonGameObject(GO_GORDUNNI_DIRT_MOUND, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0)) + { + chest->SetSpellId(GetSpellInfo()->Id); + caster->RemoveGameObject(chest, false); + } + } - void HandleDummy() - { - if (Unit* caster = GetCaster()) - if (GameObject* chest = caster->SummonGameObject(GO_GORDUNNI_DIRT_MOUND, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0)) - { - chest->SetSpellId(GetSpellInfo()->Id); - caster->RemoveGameObject(chest, false); - } - } - - void Register() override - { - OnCast += SpellCastFn(spell_gordunni_trap_SpellScript::HandleDummy); - } - }; - - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_gordunni_trap_SpellScript(); + OnCast += SpellCastFn(spell_gordunni_trap::HandleDummy); } }; void AddSC_feralas() { - new spell_gordunni_trap(); + RegisterSpellScript(spell_gordunni_trap); } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index 34da57c69..1e69836ac 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -31,6 +31,7 @@ enum Spells SPELL_EMERGE = 53500, SPELL_SUBMERGE = 53421, SPELL_SELF_ROOT = 42716, + SPELL_CLEAR_ALL_DEBUFFS = 34098, SPELL_SUMMON_DARTER = 53599, SPELL_SUMMON_ASSASSIN = 53610, @@ -193,6 +194,7 @@ class boss_anub_arak : public CreatureScript if (me->HealthBelowPct(eventId*25)) { Talk(SAY_SUBMERGE); + DoCastSelf(SPELL_CLEAR_ALL_DEBUFFS, true); me->CastSpell(me, SPELL_IMPALE_PERIODIC, true); me->CastSpell(me, SPELL_SUBMERGE, false); me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 45a189ad9..ecb1ac0b1 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -88,6 +88,7 @@ enum AnubSpells SPELL_SUBMERGE = 65981, SPELL_EMERGE = 65982, SPELL_BERSERK = 26662, + SPELL_CLEAR_ALL_DEBUFFS = 34098, SPELL_FREEZING_SLASH = 66012, SPELL_PENETRATING_COLD = 66013, @@ -313,7 +314,7 @@ public: { me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); bool berserk = me->HasAura(SPELL_BERSERK); - me->RemoveAllAuras(); + DoCastSelf(SPELL_CLEAR_ALL_DEBUFFS, true); if (berserk) me->CastSpell(me, SPELL_BERSERK, true); Talk(EMOTE_SUBMERGE); @@ -681,7 +682,7 @@ public: { me->GetMotionMaster()->MoveIdle(); me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); - me->RemoveAllAuras(); + DoCastSelf(SPELL_CLEAR_ALL_DEBUFFS, true); me->CastSpell(me, SPELL_EXPOSE_WEAKNESS, true); me->CastSpell(me, SPELL_SPIDER_FRENZY, true); me->CastSpell(me, SPELL_SUBMERGE, false); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_ahune.cpp b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_ahune.cpp index caa25161c..ab80dc84f 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_ahune.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_ahune.cpp @@ -235,10 +235,10 @@ struct boss_ahune : public BossAI switch (eventId) { case EVENT_INITIAL_EMERGE: - DoCastSelf(SPELL_BIRTH); - DoCastSelf(SPELL_STAND); - DoCastSelf(SPELL_AHUNE_SPANKY_HANDS); - DoCastSelf(SPELL_AHUNES_SHIELD); + DoCastSelf(SPELL_BIRTH, true); + DoCastSelf(SPELL_STAND, true); + DoCastSelf(SPELL_AHUNE_SPANKY_HANDS, true); + DoCastSelf(SPELL_AHUNES_SHIELD, true); me->SetStandState(UNIT_STAND_STATE_STAND); // Likely needs to be moved to SPELL_STAND script, forced temporarily break; case EVENT_EMERGE: @@ -248,7 +248,7 @@ struct boss_ahune : public BossAI if (Creature* frozenCore = instance->GetCreature(DATA_FROZEN_CORE)) DoCast(frozenCore, SPELL_SYNCH_HEALTH, true); else - DoCastSelf(SPELL_SUICIDE); + DoCastSelf(SPELL_SUICIDE, true); events.Repeat(3s); break; default: @@ -261,11 +261,11 @@ struct boss_ahune : public BossAI if (Creature* frozenCore = instance->GetCreature(DATA_FROZEN_CORE)) frozenCore->AI()->DoAction(ACTION_AHUNE_RESURFACE); - DoCastSelf(SPELL_AHUNES_SHIELD); + DoCastSelf(SPELL_AHUNES_SHIELD, true); me->RemoveAurasDueToSpell(SPELL_AHUNE_SELF_STUN); me->RemoveAurasDueToSpell(SPELL_STAY_SUBMERGED); - DoCastSelf(SPELL_BIRTH); - DoCastSelf(SPELL_STAND); + DoCastSelf(SPELL_BIRTH, true); + DoCastSelf(SPELL_STAND, true); DoCastSelf(SPELL_RESURFACE, true); me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->SetStandState(UNIT_STAND_STATE_STAND); diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index be738c9a1..b7715016a 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -150,54 +150,43 @@ public: } }; -class spell_mark_of_kazzak : public SpellScriptLoader +class spell_mark_of_kazzak_aura : public AuraScript { -public: - spell_mark_of_kazzak() : SpellScriptLoader("spell_mark_of_kazzak") { } + PrepareAuraScript(spell_mark_of_kazzak_aura); - class spell_mark_of_kazzak_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spell*/) override { - PrepareAuraScript(spell_mark_of_kazzak_AuraScript); + return ValidateSpellInfo({ SPELL_MARK_OF_KAZZAK_DAMAGE }); + } - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_MARK_OF_KAZZAK_DAMAGE }); - } - - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) - { - if (Unit* owner = GetUnitOwner()) - { - amount = CalculatePct(owner->GetPower(POWER_MANA), 5); - } - } - - void OnPeriodic(AuraEffect const* aurEff) - { - Unit* target = GetTarget(); - if (target->GetPower(POWER_MANA) == 0) - { - target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, nullptr, aurEff); - SetDuration(0); // Remove aura - } - } - - void Register() override - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mark_of_kazzak_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_kazzak_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH); - } - }; - - AuraScript* GetAuraScript() const override + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { - return new spell_mark_of_kazzak_AuraScript(); + if (Unit* owner = GetUnitOwner()) + { + amount = CalculatePct(owner->GetPower(POWER_MANA), 5); + } + } + + void OnPeriodic(AuraEffect const* aurEff) + { + Unit* target = GetTarget(); + if (target->GetPower(POWER_MANA) == 0) + { + target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, nullptr, aurEff); + SetDuration(0); // Remove aura + } + } + + void Register() override + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mark_of_kazzak_aura::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_kazzak_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH); } }; void AddSC_boss_doomlordkazzak() { new boss_doomlord_kazzak(); - new spell_mark_of_kazzak(); + RegisterSpellScript(spell_mark_of_kazzak_aura); } diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp index d470ffdf8..e3fa09e7e 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -223,31 +223,30 @@ public: } }; -class spell_npc22275_crystal_prison : public SpellScriptLoader +enum CrystalPrison { -public: - spell_npc22275_crystal_prison() : SpellScriptLoader("spell_npc22275_crystal_prison") { } + SPELL_CRYSTAL_SHATTER = 40898 +}; - class spell_npc22275_crystal_prison_AuraScript : public AuraScript +class spell_npc22275_crystal_prison_aura : public AuraScript +{ + PrepareAuraScript(spell_npc22275_crystal_prison_aura); + + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_npc22275_crystal_prison_AuraScript); + return ValidateSpellInfo({ SPELL_CRYSTAL_SHATTER }); + } - void OnPeriodic(AuraEffect const* /*aurEff*/) - { - PreventDefaultAction(); - SetDuration(0); - GetTarget()->CastSpell(GetTarget(), 40898, true); - } - - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_npc22275_crystal_prison_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; - - AuraScript* GetAuraScript() const override + void OnPeriodic(AuraEffect const* /*aurEff*/) { - return new spell_npc22275_crystal_prison_AuraScript(); + PreventDefaultAction(); + SetDuration(0); + GetTarget()->CastSpell(GetTarget(), SPELL_CRYSTAL_SHATTER, true); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_npc22275_crystal_prison_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } }; @@ -1139,31 +1138,25 @@ public: } }; -class spell_oscillating_field : public SpellScriptLoader +class spell_oscillating_field : public SpellScript { -public: - spell_oscillating_field() : SpellScriptLoader("spell_oscillating_field") { } + PrepareSpellScript(spell_oscillating_field); - class spell_oscillating_field_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_oscillating_field_SpellScript); + return ValidateSpellInfo({ SPELL_OSCILLATION_FIELD }); + } - void HandleEffect(SpellEffIndex /*effIndex*/) - { - if (Player* player = GetHitPlayer()) - if (player->GetAuraCount(SPELL_OSCILLATION_FIELD) == 5 && player->GetQuestStatus(QUEST_GAUGING_THE_RESONANT_FREQUENCY) == QUEST_STATUS_INCOMPLETE) - player->CompleteQuest(QUEST_GAUGING_THE_RESONANT_FREQUENCY); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_oscillating_field_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA); - } - }; - - SpellScript* GetSpellScript() const override + void HandleEffect(SpellEffIndex /*effIndex*/) { - return new spell_oscillating_field_SpellScript(); + if (Player* player = GetHitPlayer()) + if (player->GetAuraCount(SPELL_OSCILLATION_FIELD) == 5 && player->GetQuestStatus(QUEST_GAUGING_THE_RESONANT_FREQUENCY) == QUEST_STATUS_INCOMPLETE) + player->CompleteQuest(QUEST_GAUGING_THE_RESONANT_FREQUENCY); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_oscillating_field::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA); } }; @@ -1172,7 +1165,7 @@ void AddSC_blades_edge_mountains() // Ours new npc_deaths_door_fell_cannon_target_bunny(); new npc_deaths_fel_cannon(); - new spell_npc22275_crystal_prison(); + RegisterSpellScript(spell_npc22275_crystal_prison_aura); // Theirs new npc_nether_drake(); new npc_daranelle(); @@ -1180,5 +1173,5 @@ void AddSC_blades_edge_mountains() new go_simon_cluster(); new go_apexis_relic(); new npc_oscillating_frequency_scanner_master_bunny(); - new spell_oscillating_field(); + RegisterSpellScript(spell_oscillating_field); } diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp index 66bff74f3..a52f2089d 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp @@ -25,39 +25,37 @@ #include "SpellScript.h" #include "SpellScriptLoader.h" -// Ours - -class spell_q10935_the_exorcism_of_colonel_jules : public SpellScriptLoader +enum q10935Exorcism { -public: - spell_q10935_the_exorcism_of_colonel_jules() : SpellScriptLoader("spell_q10935_the_exorcism_of_colonel_jules") { } + SPELL_HOLY_FIRE = 39323, + SPELL_HEAL_BARADA = 39322 +}; - class spell_q10935_the_exorcism_of_colonel_jules_SpellScript : public SpellScript +class spell_q10935_the_exorcism_of_colonel_jules : public SpellScript +{ + PrepareSpellScript(spell_q10935_the_exorcism_of_colonel_jules); + + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_q10935_the_exorcism_of_colonel_jules_SpellScript); + return ValidateSpellInfo({ SPELL_HOLY_FIRE, SPELL_HEAL_BARADA }); + } - void HandleDummy(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - Creature* target = GetHitCreature(); - if (!target) - return; - - if (GetCaster()->IsHostileTo(target)) - GetCaster()->CastSpell(target, 39323 /*SPELL_HOLY_FIRE*/, true); - else - GetCaster()->CastSpell(target, 39322 /*SPELL_HEAL_BARADA*/, true); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_q10935_the_exorcism_of_colonel_jules_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex effIndex) { - return new spell_q10935_the_exorcism_of_colonel_jules_SpellScript(); + PreventHitDefaultEffect(effIndex); + Creature* target = GetHitCreature(); + if (!target) + return; + + if (GetCaster()->IsHostileTo(target)) + GetCaster()->CastSpell(target, SPELL_HOLY_FIRE, true); + else + GetCaster()->CastSpell(target, SPELL_HEAL_BARADA, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_q10935_the_exorcism_of_colonel_jules::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -607,7 +605,7 @@ public: void AddSC_hellfire_peninsula() { // Ours - new spell_q10935_the_exorcism_of_colonel_jules(); + RegisterSpellScript(spell_q10935_the_exorcism_of_colonel_jules); // Theirs new npc_aeranas(); diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index 8314d7586..0243fbf51 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -45,93 +45,81 @@ npc_enraged_spirit EndContentData */ // Ours -class spell_q10612_10613_the_fel_and_the_furious : public SpellScriptLoader +enum TheFelAndTheFurious { -public: - spell_q10612_10613_the_fel_and_the_furious() : SpellScriptLoader("spell_q10612_10613_the_fel_and_the_furious") { } + SPELL_ROCKET_LAUNCHER = 38083 +}; - class spell_q10612_10613_the_fel_and_the_furious_SpellScript : public SpellScript +class spell_q10612_10613_the_fel_and_the_furious : public SpellScript +{ + PrepareSpellScript(spell_q10612_10613_the_fel_and_the_furious); + + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_q10612_10613_the_fel_and_the_furious_SpellScript); + return ValidateSpellInfo({ SPELL_ROCKET_LAUNCHER }); + } - void HandleScriptEffect(SpellEffIndex /*effIndex*/) + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Player* charmer = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself(); + if (!charmer) + return; + + std::list gList; + GetCaster()->GetGameObjectListWithEntryInGrid(gList, 184979, 30.0f); + uint8 counter = 0; + for (std::list::const_iterator itr = gList.begin(); itr != gList.end(); ++itr, ++counter) { - Player* charmer = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself(); - if (!charmer) - return; - - std::list gList; - GetCaster()->GetGameObjectListWithEntryInGrid(gList, 184979, 30.0f); - uint8 counter = 0; - for (std::list::const_iterator itr = gList.begin(); itr != gList.end(); ++itr, ++counter) + if (counter >= 10) + break; + GameObject* go = *itr; + if (!go->isSpawned()) + continue; + Creature* cr2 = go->SummonTrigger(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ() + 2.0f, 0.0f, 100); + if (cr2) { - if (counter >= 10) - break; - GameObject* go = *itr; - if (!go->isSpawned()) - continue; - Creature* cr2 = go->SummonTrigger(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ() + 2.0f, 0.0f, 100); - if (cr2) - { - cr2->SetFaction(FACTION_MONSTER); - cr2->ReplaceAllUnitFlags(UNIT_FLAG_NONE); - GetCaster()->CastSpell(cr2, 38083, true); - } - - go->SetLootState(GO_JUST_DEACTIVATED); - charmer->KilledMonsterCredit(21959); + cr2->SetFaction(FACTION_MONSTER); + cr2->ReplaceAllUnitFlags(UNIT_FLAG_NONE); + GetCaster()->CastSpell(cr2, SPELL_ROCKET_LAUNCHER, true); } - } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_q10612_10613_the_fel_and_the_furious_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + go->SetLootState(GO_JUST_DEACTIVATED); + charmer->KilledMonsterCredit(21959); } - }; + } - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_q10612_10613_the_fel_and_the_furious_SpellScript(); + OnEffectHitTarget += SpellEffectFn(spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; -class spell_q10563_q10596_to_legion_hold : public SpellScriptLoader +class spell_q10563_q10596_to_legion_hold_aura : public AuraScript { -public: - spell_q10563_q10596_to_legion_hold() : SpellScriptLoader("spell_q10563_q10596_to_legion_hold") { } + PrepareAuraScript(spell_q10563_q10596_to_legion_hold_aura); - class spell_q10563_q10596_to_legion_hold_AuraScript : public AuraScript + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - PrepareAuraScript(spell_q10563_q10596_to_legion_hold_AuraScript) - - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + if (Player* player = GetTarget()->ToPlayer()) { - if (Player* player = GetTarget()->ToPlayer()) - { - player->KilledMonsterCredit(21502); - player->SetControlled(false, UNIT_STATE_STUNNED); - } + player->KilledMonsterCredit(21502); + player->SetControlled(false, UNIT_STATE_STUNNED); } + } - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Player* player = GetTarget()->ToPlayer()) - { - player->SetControlled(true, UNIT_STATE_STUNNED); - player->SummonCreature(21633, -3311.13f, 2946.15f, 171.1f, 4.86f, TEMPSUMMON_TIMED_DESPAWN, 64000); - } - } - - void Register() override - { - OnEffectApply += AuraEffectApplyFn(spell_q10563_q10596_to_legion_hold_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_q10563_q10596_to_legion_hold_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); - } - }; - - AuraScript* GetAuraScript() const override + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - return new spell_q10563_q10596_to_legion_hold_AuraScript(); + if (Player* player = GetTarget()->ToPlayer()) + { + player->SetControlled(true, UNIT_STATE_STUNNED); + player->SummonCreature(21633, -3311.13f, 2946.15f, 171.1f, 4.86f, TEMPSUMMON_TIMED_DESPAWN, 64000); + } + } + + void Register() override + { + OnEffectApply += AuraEffectApplyFn(spell_q10563_q10596_to_legion_hold_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_q10563_q10596_to_legion_hold_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); } }; @@ -1833,8 +1821,8 @@ public: void AddSC_shadowmoon_valley() { // Ours - new spell_q10612_10613_the_fel_and_the_furious(); - new spell_q10563_q10596_to_legion_hold(); + RegisterSpellScript(spell_q10612_10613_the_fel_and_the_furious); + RegisterSpellScript(spell_q10563_q10596_to_legion_hold_aura); // Theirs new npc_invis_infernal_caster(); diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp index b24b227e8..86dc4cd35 100644 --- a/src/server/scripts/Outland/zone_terokkar_forest.cpp +++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp @@ -36,103 +36,81 @@ enum fumping SPELL_SUMMON_HAISHULUD = 39248, }; -class spell_q10930_big_bone_worm : public SpellScriptLoader +class spell_q10930_big_bone_worm : public SpellScript { -public: - spell_q10930_big_bone_worm() : SpellScriptLoader("spell_q10930_big_bone_worm") { } + PrepareSpellScript(spell_q10930_big_bone_worm); - class spell_q10930_big_bone_worm_SpellScript : public SpellScript + void SetDest(SpellDestination& dest) { - PrepareSpellScript(spell_q10930_big_bone_worm_SpellScript); - - void SetDest(SpellDestination& dest) - { - Position const offset = { 0.5f, 0.5f, 5.0f, 0.0f }; - dest.RelocateOffset(offset); - } - - void Register() override - { - OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10930_big_bone_worm_SpellScript::SetDest, EFFECT_1, TARGET_DEST_CASTER); - } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_q10930_big_bone_worm_SpellScript(); + Position const offset = { 0.5f, 0.5f, 5.0f, 0.0f }; + dest.RelocateOffset(offset); } - class spell_q10930_big_bone_worm_AuraScript : public AuraScript + void Register() override { - PrepareAuraScript(spell_q10930_big_bone_worm_AuraScript); - - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) - return; - - GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_HAISHULUD, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true); - } - - void Register() override - { - OnEffectRemove += AuraEffectRemoveFn(spell_q10930_big_bone_worm_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_q10930_big_bone_worm_AuraScript(); + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10930_big_bone_worm::SetDest, EFFECT_1, TARGET_DEST_CASTER); } }; -class spell_q10929_fumping : SpellScriptLoader +class spell_q10930_big_bone_worm_aura : public AuraScript { -public: - spell_q10929_fumping() : SpellScriptLoader("spell_q10929_fumping") { } + PrepareAuraScript(spell_q10930_big_bone_worm_aura); - class spell_q10929_fumping_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_q10929_fumping_SpellScript); - - void SetDest(SpellDestination& dest) - { - Position const offset = { 0.5f, 0.5f, 5.0f, 0.0f }; - dest.RelocateOffset(offset); - } - - void Register() override - { - OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10929_fumping_SpellScript::SetDest, EFFECT_1, TARGET_DEST_CASTER); - } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_q10929_fumping_SpellScript(); + return ValidateSpellInfo({ SPELL_SUMMON_HAISHULUD, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3 }); } - class spell_q10929_fumping_AuraScript : public AuraScript + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - PrepareAuraScript(spell_q10929_fumping_AuraScript); + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + return; - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) - return; + GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_HAISHULUD, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true); + } - GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_SAND_GNOME1, SPELL_SUMMON_SAND_GNOME3, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true); - } - - void Register() override - { - OnEffectRemove += AuraEffectRemoveFn(spell_q10929_fumping_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; - - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_q10929_fumping_AuraScript(); + OnEffectRemove += AuraEffectRemoveFn(spell_q10930_big_bone_worm_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + +class spell_q10929_fumping : public SpellScript +{ + PrepareSpellScript(spell_q10929_fumping); + + void SetDest(SpellDestination& dest) + { + Position const offset = { 0.5f, 0.5f, 5.0f, 0.0f }; + dest.RelocateOffset(offset); + } + + void Register() override + { + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10929_fumping::SetDest, EFFECT_1, TARGET_DEST_CASTER); + } +}; + +class spell_q10929_fumping_aura : public AuraScript +{ + PrepareAuraScript(spell_q10929_fumping_aura); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SUMMON_SAND_GNOME1, SPELL_SUMMON_SAND_GNOME3, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3 }); + } + + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + return; + + GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_SAND_GNOME1, SPELL_SUMMON_SAND_GNOME3, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true); + } + + void Register() override + { + OnEffectRemove += AuraEffectRemoveFn(spell_q10929_fumping_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -162,30 +140,19 @@ enum q10036Torgos NPC_TORGOS = 18707 }; -class spell_q10036_torgos : public SpellScriptLoader +class spell_q10036_torgos : public SpellScript { -public: - spell_q10036_torgos() : SpellScriptLoader("spell_q10036_torgos") { } + PrepareSpellScript(spell_q10036_torgos); - class spell_q10036_torgos_SpellScript : public SpellScript + void HandleSendEvent(SpellEffIndex /*effIndex*/) { - PrepareSpellScript(spell_q10036_torgos_SpellScript); + if (Creature* torgos = GetCaster()->FindNearestCreature(NPC_TORGOS, 100.0f, true)) + torgos->GetAI()->AttackStart(GetCaster()); + } - void HandleSendEvent(SpellEffIndex /*effIndex*/) - { - if (Creature* torgos = GetCaster()->FindNearestCreature(NPC_TORGOS, 100.0f, true)) - torgos->GetAI()->AttackStart(GetCaster()); - } - - void Register() override - { - OnEffectLaunch += SpellEffectFn(spell_q10036_torgos_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); - } - }; - - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_q10036_torgos_SpellScript(); + OnEffectLaunch += SpellEffectFn(spell_q10036_torgos::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); } }; @@ -198,114 +165,80 @@ enum eQ10923EvilDrawsNear NPC_AUCHENAI_DEATH_SPIRIT = 21967 }; -class spell_q10923_evil_draws_near_summon : public SpellScriptLoader +class spell_q10923_evil_draws_near_summon : public SpellScript { -public: - spell_q10923_evil_draws_near_summon() : SpellScriptLoader("spell_q10923_evil_draws_near_summon") { } + PrepareSpellScript(spell_q10923_evil_draws_near_summon); - class spell_q10923_evil_draws_near_summon_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_q10923_evil_draws_near_summon_SpellScript); + return ValidateSpellInfo({ SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL_AURA }); + } - void HandleSendEvent(SpellEffIndex /*effIndex*/) - { - if (Creature* auchenai = GetCaster()->FindNearestCreature(NPC_AUCHENAI_DEATH_SPIRIT, 10.0f, true)) - auchenai->CastSpell(auchenai, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL_AURA, true); - } - - void Register() override - { - OnEffectLaunch += SpellEffectFn(spell_q10923_evil_draws_near_summon_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); - } - }; - - SpellScript* GetSpellScript() const override + void HandleSendEvent(SpellEffIndex /*effIndex*/) { - return new spell_q10923_evil_draws_near_summon_SpellScript(); + if (Creature* auchenai = GetCaster()->FindNearestCreature(NPC_AUCHENAI_DEATH_SPIRIT, 10.0f, true)) + auchenai->CastSpell(auchenai, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL_AURA, true); + } + + void Register() override + { + OnEffectLaunch += SpellEffectFn(spell_q10923_evil_draws_near_summon::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); } }; -class spell_q10923_evil_draws_near_periodic : public SpellScriptLoader +class spell_q10923_evil_draws_near_periodic_aura : public AuraScript { -public: - spell_q10923_evil_draws_near_periodic() : SpellScriptLoader("spell_q10923_evil_draws_near_periodic") { } + PrepareAuraScript(spell_q10923_evil_draws_near_periodic_aura); - class spell_q10923_evil_draws_near_periodic_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_q10923_evil_draws_near_periodic_AuraScript); + return ValidateSpellInfo({ SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2 }); + } - void HandlePeriodic(AuraEffect const* /*aurEff*/) - { - PreventDefaultAction(); - GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2), true); - } - - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_q10923_evil_draws_near_periodic_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const override + void HandlePeriodic(AuraEffect const* /*aurEff*/) { - return new spell_q10923_evil_draws_near_periodic_AuraScript(); + PreventDefaultAction(); + GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2), true); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_q10923_evil_draws_near_periodic_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; -class spell_q10923_evil_draws_near_visual : public SpellScriptLoader +class spell_q10923_evil_draws_near_visual : public SpellScript { -public: - spell_q10923_evil_draws_near_visual() : SpellScriptLoader("spell_q10923_evil_draws_near_visual") { } + PrepareSpellScript(spell_q10923_evil_draws_near_visual); - class spell_q10923_evil_draws_near_visual_SpellScript : public SpellScript + void SetDest(SpellDestination& dest) { - PrepareSpellScript(spell_q10923_evil_draws_near_visual_SpellScript); + // Adjust effect summon position + Position const offset = { 0.0f, 0.0f, 20.0f, 0.0f }; + dest.RelocateOffset(offset); + } - void SetDest(SpellDestination& dest) - { - // Adjust effect summon position - Position const offset = { 0.0f, 0.0f, 20.0f, 0.0f }; - dest.RelocateOffset(offset); - } - - void Register() override - { - OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10923_evil_draws_near_visual_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER_RADIUS); - } - }; - - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_q10923_evil_draws_near_visual_SpellScript(); + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10923_evil_draws_near_visual::SetDest, EFFECT_0, TARGET_DEST_CASTER_RADIUS); } }; -class spell_q10898_skywing : public SpellScriptLoader +class spell_q10898_skywing : public SpellScript { -public: - spell_q10898_skywing() : SpellScriptLoader("spell_q10898_skywing") { } + PrepareSpellScript(spell_q10898_skywing); - class spell_q10898_skywing_SpellScript : public SpellScript + void SetDest(SpellDestination& dest) { - PrepareSpellScript(spell_q10898_skywing_SpellScript); + // Adjust effect summon position + Position const offset = { frand(-7.0f, 7.0f), frand(-7.0f, 7.0f), 11.0f, 0.0f }; + dest.Relocate(*GetCaster()); + dest.RelocateOffset(offset); + } - void SetDest(SpellDestination& dest) - { - // Adjust effect summon position - Position const offset = { frand(-7.0f, 7.0f), frand(-7.0f, 7.0f), 11.0f, 0.0f }; - dest.Relocate(*GetCaster()); - dest.RelocateOffset(offset); - } - - void Register() override - { - OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10898_skywing_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER_RANDOM); - } - }; - - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_q10898_skywing_SpellScript(); + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10898_skywing::SetDest, EFFECT_0, TARGET_DEST_CASTER_RANDOM); } }; @@ -701,14 +634,14 @@ public: void AddSC_terokkar_forest() { // Ours - new spell_q10930_big_bone_worm(); - new spell_q10929_fumping(); + RegisterSpellAndAuraScriptPair(spell_q10930_big_bone_worm, spell_q10930_big_bone_worm_aura); + RegisterSpellAndAuraScriptPair(spell_q10929_fumping, spell_q10929_fumping_aura); new npc_greatfather_aldrimus(); - new spell_q10036_torgos(); - new spell_q10923_evil_draws_near_summon(); - new spell_q10923_evil_draws_near_periodic(); - new spell_q10923_evil_draws_near_visual(); - new spell_q10898_skywing(); + RegisterSpellScript(spell_q10036_torgos); + RegisterSpellScript(spell_q10923_evil_draws_near_summon); + RegisterSpellScript(spell_q10923_evil_draws_near_periodic_aura); + RegisterSpellScript(spell_q10923_evil_draws_near_visual); + RegisterSpellScript(spell_q10898_skywing); // Theirs new npc_unkor_the_ruthless(); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index fc2ad1645..47f95c91a 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -5199,6 +5199,59 @@ class spell_gen_consumption : public SpellScript } }; +// 37591 - Drunken Haze | 29690 - Drunken Skull Crack +enum DrunkenHaze +{ + SPELL_DRUNKEN_HAZE = 37591, + SPELL_DRUNKEN_SKULL_CRACK = 29690 +}; + +class spell_gen_sober_up : public AuraScript +{ + PrepareAuraScript(spell_gen_sober_up); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_DRUNKEN_HAZE, SPELL_DRUNKEN_SKULL_CRACK }); + } + + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + if (!target && !target->ToPlayer()) + return; + + SpellEffIndex InebriateEffIndex; + if (Player* player = target->ToPlayer()) + { + switch (GetSpellInfo()->Id) + { + case SPELL_DRUNKEN_HAZE: + InebriateEffIndex = EFFECT_1; + break; + case SPELL_DRUNKEN_SKULL_CRACK: + InebriateEffIndex = EFFECT_2; + break; + } + + uint16 level = aurEff->GetSpellInfo()->Effects[InebriateEffIndex].CalcValue(); + player->SetDrunkValue(player->GetDrunkValue() - (level > 100 ? 100 : level)); // Some (maybe it's only 29690) spells can have over 100 inebriate points + } + } + + void Register() override + { + if (m_scriptSpellId == SPELL_DRUNKEN_HAZE) + { + AfterEffectRemove += AuraEffectRemoveFn(spell_gen_sober_up::OnRemove, EFFECT_0, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + } + else + { + AfterEffectRemove += AuraEffectRemoveFn(spell_gen_sober_up::OnRemove, EFFECT_1, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + } + } +}; + void AddSC_generic_spell_scripts() { RegisterSpellScript(spell_silithyst); @@ -5354,5 +5407,6 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_yehkinya_bramble); RegisterSpellScript(spell_gen_choking_vines); RegisterSpellScript(spell_gen_consumption); + RegisterSpellScript(spell_gen_sober_up); }