diff --git a/sql/migrations/20221127232342_world.sql b/sql/migrations/20221127232342_world.sql new file mode 100644 index 000000000..f1574f386 --- /dev/null +++ b/sql/migrations/20221127232342_world.sql @@ -0,0 +1,400 @@ +DROP PROCEDURE IF EXISTS add_migration; +delimiter ?? +CREATE PROCEDURE `add_migration`() +BEGIN +DECLARE v INT DEFAULT 1; +SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20221127232342'); +IF v=0 THEN +INSERT INTO `migrations` VALUES ('20221127232342'); +-- Add your query below. + + +-- Make Rajaxx active object so he attacks even if players are not in visibility range. +UPDATE `creature` SET `spawn_flags`=1 WHERE `guid`=90871; + +-- Make whole Rajaxx wave group respawn when any evades. +UPDATE `creature_groups` SET `flags`=46 WHERE `leader_guid` IN (301057, 301058, 301168, 301169, 301170, 301171, 301172); + +-- Delete custom duplicate of Andorov. +DELETE FROM `creature_template` WHERE `entry`=987001; + +-- Update Lieutenant General Andorov's group. +UPDATE `creature_groups` SET `flags`=11 WHERE `leader_guid`=301311; +UPDATE `creature_groups` SET `dist`=4.929, `angle`=2.1 WHERE `member_guid`=301315; +UPDATE `creature_groups` SET `dist`=4.813, `angle`=2.6 WHERE `member_guid`=301314; +UPDATE `creature_groups` SET `dist`=4.743, `angle`=3.2 WHERE `member_guid`=301313; +UPDATE `creature_groups` SET `dist`=4.856, `angle`=3.7 WHERE `member_guid`=301312; +UPDATE `creature` SET `spawn_flags`=2, `position_x`=-8638.66, `position_y`=1486.67, `position_z`=32.8086, `orientation`=2.33201 WHERE `guid`=301311; +UPDATE `creature` SET `spawn_flags`=2, `position_x`=-8642.17, `position_y`=1483.27, `position_z`=32.1492, `orientation`=2.34367 WHERE `guid`=301315; +UPDATE `creature` SET `spawn_flags`=2, `position_x`=-8638.79, `position_y`=1481.88, `position_z`=32.3678, `orientation`=2.34722 WHERE `guid`=301314; +UPDATE `creature` SET `spawn_flags`=2, `position_x`=-8635.29, `position_y`=1483.34, `position_z`=32.6653, `orientation`=2.3467 WHERE `guid`=301313; +UPDATE `creature` SET `spawn_flags`=2, `position_x`=-8633.81, `position_y`=1486.9, `position_z`=32.8304, `orientation`=2.34515 WHERE `guid`=301312; + +-- Correct faction and flags of Lieutenant General Andorov and Kaldorei Elite. +UPDATE `creature_template` SET `regeneration`=0, `faction`=1608, `unit_flags`=512, `ai_name`='EventAI', `script_name`='', `flags_extra` = (`flags_extra` | 33554432) WHERE `entry` IN (15471, 15473); + +-- 1112: Instance Data TYPE_GENERAL_ANDOROV is FAIL +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (1112, 34, 1, 2, 0, 0, 0); + +-- Events list for Lieutenant General Andorov +DELETE FROM `creature_ai_events` WHERE `creature_id`=15471; +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1547101, 15471, 0, 11, 0, 100, 1, 0, 0, 0, 0, 1547101, 0, 0, 'Lieutenant General Andorov - Set Data and Phase on Spawn'); +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1547102, 15471, 0, 1, 1, 100, 0, 1000, 1000, 0, 0, 1547102, 0, 0, 'Lieutenant General Andorov - Set Emote State OOC (Phase 1)'); +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1547103, 15471, 0, 6, 0, 100, 0, 0, 0, 0, 0, 1547103, 0, 0, 'Lieutenant General Andorov - Set Home Position on Death'); +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1547104, 15471, 3704, 1, 3, 100, 0, 5000, 5000, 0, 0, 1547104, 0, 0, 'Lieutenant General Andorov - Set Immune to NPC Flag 5 seconds after Rajaxx is Dead'); +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1547105, 15471, 3704, 1, 3, 100, 0, 130000, 130000, 0, 0, 1547105, 0, 0, 'Lieutenant General Andorov - Despawn 130 seconds after Rajaxx is Dead'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1547101; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1547101, 0, 0, 37, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1112, 'Lieutenant General Andorov - Set Data TYPE_GENERAL_ANDOROV to NOT_STARTED'), +(1547101, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Set Phase to 0'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1547102; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1547102, 0, 0, 1, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Set Emote State to Ready 1H'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1547103; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1547103, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -8870.721, 1648.401, 21.51133, 5.637414, 0, 'Lieutenant General Andorov - Set Home Position'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1547104; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1547104, 0, 0, 4, 46, 512, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Set Immune to NPC Flag'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1547105; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1547105, 0, 0, 39, 1547105, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Start Script to Despawn'); +REPLACE INTO `creature_spells` (`entry`, `name`, `spellId_1`, `probability_1`, `castTarget_1`, `targetParam1_1`, `targetParam2_1`, `castFlags_1`, `delayInitialMin_1`, `delayInitialMax_1`, `delayRepeatMin_1`, `delayRepeatMax_1`, `scriptId_1`, `spellId_2`, `probability_2`, `castTarget_2`, `targetParam1_2`, `targetParam2_2`, `castFlags_2`, `delayInitialMin_2`, `delayInitialMax_2`, `delayRepeatMin_2`, `delayRepeatMax_2`, `scriptId_2`, `spellId_3`, `probability_3`, `castTarget_3`, `targetParam1_3`, `targetParam2_3`, `castFlags_3`, `delayInitialMin_3`, `delayInitialMax_3`, `delayRepeatMin_3`, `delayRepeatMax_3`, `scriptId_3`, `spellId_4`, `probability_4`, `castTarget_4`, `targetParam1_4`, `targetParam2_4`, `castFlags_4`, `delayInitialMin_4`, `delayInitialMax_4`, `delayRepeatMin_4`, `delayRepeatMax_4`, `scriptId_4`, `spellId_5`, `probability_5`, `castTarget_5`, `targetParam1_5`, `targetParam2_5`, `castFlags_5`, `delayInitialMin_5`, `delayInitialMax_5`, `delayRepeatMin_5`, `delayRepeatMax_5`, `scriptId_5`, `spellId_6`, `probability_6`, `castTarget_6`, `targetParam1_6`, `targetParam2_6`, `castFlags_6`, `delayInitialMin_6`, `delayInitialMax_6`, `delayRepeatMin_6`, `delayRepeatMax_6`, `scriptId_6`, `spellId_7`, `probability_7`, `castTarget_7`, `targetParam1_7`, `targetParam2_7`, `castFlags_7`, `delayInitialMin_7`, `delayInitialMax_7`, `delayRepeatMin_7`, `delayRepeatMax_7`, `scriptId_7`, `spellId_8`, `probability_8`, `castTarget_8`, `targetParam1_8`, `targetParam2_8`, `castFlags_8`, `delayInitialMin_8`, `delayInitialMax_8`, `delayRepeatMin_8`, `delayRepeatMax_8`, `scriptId_8`) VALUES (154710, 'Ruins of Ahn\'Qiraj - Lieutenant General Andorov', 22591, 100, 1, 0, 0, 0, 9, 13, 10, 14, 0, 25515, 100, 1, 0, 0, 0, 25, 29, 25, 45, 0, 25516, 100, 0, 0, 0, 0, 9, 13, 30, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +UPDATE `creature_template` SET `npc_flags`=1, `spell_list_id`=154710 WHERE `entry`=15471; + +-- 301315: Source's Guid Is 301315 +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (301315, 52, 301315, 0, 0, 0, 0); +-- 301314: Source's Guid Is 301314 +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (301314, 52, 301314, 0, 0, 0, 0); +-- 301313: Source's Guid Is 301313 +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (301313, 52, 301313, 0, 0, 0, 0); +-- 301312: Source's Guid Is 301312 +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (301312, 52, 301312, 0, 0, 0, 0); + +-- Events list for Kaldorei Elite +DELETE FROM `creature_ai_events` WHERE `creature_id`=15473; +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES +(1547301, 15473, 0, 6, 0, 100, 0, 0, 0, 0, 0, 1547301, 0, 0, 'Kaldorei Elite - Set Home Position on Death'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1547301; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1547301, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -8873.13, 1645.21, 21.5113, 5.44, 301315, 'Kaldorei Elite - Set Home Position'), +(1547301, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -8871.92, 1646.8, 21.5113, 5.78, 301314, 'Kaldorei Elite - Set Home Position'), +(1547301, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -8869.52, 1650, 21.5113, 5.48, 301313, 'Kaldorei Elite - Set Home Position'), +(1547301, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -8868.31, 1651.6, 21.5113, 5.45, 301312, 'Kaldorei Elite - Set Home Position'); +REPLACE INTO `creature_spells` (`entry`, `name`, `spellId_1`, `probability_1`, `castTarget_1`, `targetParam1_1`, `targetParam2_1`, `castFlags_1`, `delayInitialMin_1`, `delayInitialMax_1`, `delayRepeatMin_1`, `delayRepeatMax_1`, `scriptId_1`, `spellId_2`, `probability_2`, `castTarget_2`, `targetParam1_2`, `targetParam2_2`, `castFlags_2`, `delayInitialMin_2`, `delayInitialMax_2`, `delayRepeatMin_2`, `delayRepeatMax_2`, `scriptId_2`, `spellId_3`, `probability_3`, `castTarget_3`, `targetParam1_3`, `targetParam2_3`, `castFlags_3`, `delayInitialMin_3`, `delayInitialMax_3`, `delayRepeatMin_3`, `delayRepeatMax_3`, `scriptId_3`, `spellId_4`, `probability_4`, `castTarget_4`, `targetParam1_4`, `targetParam2_4`, `castFlags_4`, `delayInitialMin_4`, `delayInitialMax_4`, `delayRepeatMin_4`, `delayRepeatMax_4`, `scriptId_4`, `spellId_5`, `probability_5`, `castTarget_5`, `targetParam1_5`, `targetParam2_5`, `castFlags_5`, `delayInitialMin_5`, `delayInitialMax_5`, `delayRepeatMin_5`, `delayRepeatMax_5`, `scriptId_5`, `spellId_6`, `probability_6`, `castTarget_6`, `targetParam1_6`, `targetParam2_6`, `castFlags_6`, `delayInitialMin_6`, `delayInitialMax_6`, `delayRepeatMin_6`, `delayRepeatMax_6`, `scriptId_6`, `spellId_7`, `probability_7`, `castTarget_7`, `targetParam1_7`, `targetParam2_7`, `castFlags_7`, `delayInitialMin_7`, `delayInitialMax_7`, `delayRepeatMin_7`, `delayRepeatMax_7`, `scriptId_7`, `spellId_8`, `probability_8`, `castTarget_8`, `targetParam1_8`, `targetParam2_8`, `castFlags_8`, `delayInitialMin_8`, `delayInitialMax_8`, `delayRepeatMin_8`, `delayRepeatMax_8`, `scriptId_8`) VALUES (154730, 'Ruins of Ahn\'Qiraj - Kaldorei Elite', 16856, 100, 1, 0, 0, 0, 5, 15, 5, 15, 0, 26350, 100, 1, 0, 0, 0, 10, 30, 10, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +UPDATE `creature_template` SET `spell_list_id`=154730 WHERE `entry`=15473; + +-- These texts should be yelled. +UPDATE `broadcast_text` SET `chat_type`=6 WHERE `entry` IN (11028, 11477, 11012, 11032, 11560); +UPDATE `broadcast_text` SET `emote_id1`=5 WHERE `entry`=11560; + +-- Spawn waypoints for Lieutenant General Andorov. +DELETE FROM `creature_movement_template` WHERE `entry`=15471; +INSERT INTO `creature_movement_template` (`entry`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `waittime`, `wander_distance`, `script_id`) VALUES +(15471, 1, -8638.661133, 1486.667725, 32.808559, 100.000000, 0, 0.000000, 0), +(15471, 2, -8652.152344, 1500.827148, 32.665638, 100.000000, 0, 0.000000, 0), +(15471, 3, -8668.321289, 1520.756958, 32.007122, 100.000000, 0, 0.000000, 0), +(15471, 4, -8694.014648, 1552.808838, 32.086586, 100.000000, 0, 0.000000, 0), +(15471, 5, -8710.787109, 1571.019775, 26.510817, 100.000000, 0, 0.000000, 0), +(15471, 6, -8737.693359, 1596.180664, 21.580246, 100.000000, 0, 0.000000, 0), +(15471, 7, -8771.529297, 1614.135498, 21.579346, 100.000000, 0, 0.000000, 0), +(15471, 8, -8809.159180, 1622.420776, 20.155216, 100.000000, 0, 0.000000, 0), +(15471, 9, -8845.422852, 1633.813477, 19.799856, 100.000000, 1000, 0.000000, 0), +(15471, 10, -8870.720703, 1648.400879, 21.511328, 5.637414, 1000, 0.000000, 1547101), +(15471, 11, -8870.720703, 1648.400879, 21.511328, 5.637414, 0, 0.000000, 0); +DELETE FROM `creature_movement_scripts` WHERE `id`=1547101; +INSERT INTO `creature_movement_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1547101, 0, 0, 20, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Move Idle'), +(1547101, 0, 0, 34, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Set Home Position'), +(1547101, 0, 0, 84, 6629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Set Gossip Menu'), +(1547101, 0, 1, 3, 0, 0, 2, 0, 301315, 0, 9, 2, 0, 0, 0, 0, -8873.13, 1645.21, 21.5113, 5.44, 0, 'Kaldorei Elite - Move to Furthest Right Position'), +(1547101, 0, 1, 34, 0, 0, 0, 0, 301315, 0, 9, 2, 0, 0, 0, 0, -8873.13, 1645.21, 21.5113, 5.44, 0, 'Kaldorei Elite - Set Home Position to Furthest Right'), +(1547101, 0, 2, 3, 0, 0, 2, 0, 301314, 0, 9, 2, 0, 0, 0, 0, -8871.92, 1646.8, 21.5113, 5.78, 0, 'Kaldorei Elite - Move to Nearest Right Position'), +(1547101, 0, 2, 34, 0, 0, 0, 0, 301314, 0, 9, 2, 0, 0, 0, 0, -8871.92, 1646.8, 21.5113, 5.78, 0, 'Kaldorei Elite - Set Home Position to Nearest Right'), +(1547101, 0, 3, 3, 0, 0, 2, 0, 301313, 0, 9, 2, 0, 0, 0, 0, -8869.52, 1650, 21.5113, 5.48, 0, 'Kaldorei Elite - Move to Nearest Left Position'), +(1547101, 0, 3, 34, 0, 0, 0, 0, 301313, 0, 9, 2, 0, 0, 0, 0, -8869.52, 1650, 21.5113, 5.48, 0, 'Kaldorei Elite - Set Home Position to Nearest Left'), +(1547101, 0, 4, 3, 0, 0, 2, 0, 301312, 0, 9, 2, 0, 0, 0, 0, -8868.31, 1651.6, 21.5113, 5.45, 0, 'Kaldorei Elite - Move to Furthest Left Position'), +(1547101, 0, 4, 34, 0, 0, 0, 0, 301312, 0, 9, 2, 0, 0, 0, 0, -8868.31, 1651.6, 21.5113, 5.45, 0, 'Kaldorei Elite - Set Home Position to Furthest Left'); + +-- Script upon talking to Lieutenant General Andorov. +DELETE FROM `gossip_scripts` WHERE `id`=6629; +INSERT INTO `gossip_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(6629, 0, 0, 39, 154710, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Start Script to Start Andorov Event'); +DELETE FROM `generic_scripts` WHERE `id`=154710; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(154710, 0, 0, 37, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Set Data TYPE_GENERAL_ANDOROV to IN_PROGRESS'), +(154710, 0, 2, 1, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Emote Shout'), +(154710, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11028, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Say Text'), +(154710, 2, 0, 60, 3, 0, 0, 0, 0, 0, 0, 0, 0, 15471, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Move Waypoint'), +(154710, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11477, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Say Text'); + +-- Event waypoints for Lieutenant General Andorov. +INSERT INTO `creature_movement_special` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `waittime`, `wander_distance`, `script_id`) VALUES +(15471, 1, -8881.382813, 1611.213135, 21.441124, 100.000000, 0, 0.000000, 0), +(15471, 2, -8894.543945, 1589.428223, 21.454288, 100.000000, 0, 0.000000, 0), +(15471, 3, -8916.958008, 1557.906372, 21.431034, 100.000000, 0, 0.000000, 0), +(15471, 4, -8939.951172, 1551.126953, 21.566868, 100.000000, 5000, 0.000000, 1547102), +(15471, 5, -8939.951172, 1551.126953, 21.566868, 2.877214, 10000, 0.000000, 1547103), +(15471, 6, -8939.951172, 1551.126953, 21.566868, 2.877214, 0, 0.000000, 0); +DELETE FROM `creature_movement_scripts` WHERE `id`=1547102; +INSERT INTO `creature_movement_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1547102, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11012, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Say Text'), +(1547102, 2, 0, 1, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Emote Shout'); +DELETE FROM `creature_movement_scripts` WHERE `id`=1547103; +INSERT INTO `creature_movement_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1547103, 0, 0, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Emote Point'), +(1547103, 0, 1, 34, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Set Home Position'), +(1547103, 0, 2, 20, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Move Idle'), +(1547103, 0, 3, 3, 0, 0, 0, 0, 301312, 0, 9, 2, 0, 0, 0, 0, -8937.8, 1556.23, 21.4079, 2.97824, 0, 'Kaldorei Elite - Move to Furthest Right Position'), +(1547103, 0, 4, 34, 0, 0, 0, 0, 301312, 0, 9, 2, 0, 0, 0, 0, -8937.8, 1556.23, 21.4079, 2.97824, 0, 'Kaldorei Elite - Set Home Position to Furthest Right'), +(1547103, 0, 5, 3, 0, 0, 0, 0, 301313, 0, 9, 2, 0, 0, 0, 0, -8939.17, 1554.02, 21.5905, 2.89695, 0, 'Kaldorei Elite - Move to Nearest Right Position'), +(1547103, 0, 6, 34, 0, 0, 0, 0, 301313, 0, 9, 2, 0, 0, 0, 0, -8939.17, 1554.02, 21.5905, 2.89695, 0, 'Kaldorei Elite - Set Home Position to Nearest Right'), +(1547103, 0, 7, 3, 0, 0, 0, 0, 301314, 0, 9, 2, 0, 0, 0, 0, -8940.74, 1548.23, 21.6848, 2.6754, 0, 'Kaldorei Elite - Move to Nearest Left Position'), +(1547103, 0, 8, 34, 0, 0, 0, 0, 301314, 0, 9, 2, 0, 0, 0, 0, -8940.74, 1548.23, 21.6848, 2.6754, 0, 'Kaldorei Elite - Set Home Position to Nearest Left'), +(1547103, 0, 9, 3, 0, 0, 0, 0, 301315, 0, 9, 2, 0, 0, 0, 0, -8941.52, 1545.34, 21.8723, 2.96206, 0, 'Kaldorei Elite - Move to Furthest Left Position'), +(1547103, 0, 10, 34, 0, 0, 0, 0, 301315, 0, 9, 2, 0, 0, 0, 0, -8941.52, 1545.34, 21.8723, 2.96206, 0, 'Kaldorei Elite - Set Home Position to Furthest Left'), +(1547103, 6, 0, 1, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Emote Ready 1H'), +(1547103, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11032, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Say Text'), +(1547103, 8, 0, 1, 333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Emote State Ready 1H'), +(1547103, 8, 0, 44, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Set Phase to 1'), +(1547103, 12, 0, 39, 153911, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Start Script to Start Wave 1'); + +-- Failure conditions for Andorov Event targets. +-- 1100: (116: Target Is Alive) And (117: Not (Target Is In Combat)) +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (1100, -1, 116, 117, 0, 0, 0); + +-- Andorov Event Failed Script +DELETE FROM `generic_scripts` WHERE `id`=153912; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153912, 0, 0, 37, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Event Failed: Set Data TYPE_GENERAL_ANDOROV to FAIL'), +(153912, 0, 0, 71, 0, 0, 0, 0, 301057, 0, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Event Failed: Respawn Captain Qeez'), +(153912, 0, 0, 71, 0, 0, 0, 0, 301058, 0, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Event Failed: Respawn Captain Tuubid'), +(153912, 0, 0, 71, 0, 0, 0, 0, 301168, 0, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Event Failed: Respawn Captain Drenn'), +(153912, 0, 0, 71, 0, 0, 0, 0, 301172, 0, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Event Failed: Respawn Captain Xurrem'), +(153912, 0, 0, 71, 0, 0, 0, 0, 301169, 0, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Event Failed: Respawn Major Yeggeth'), +(153912, 0, 0, 71, 0, 0, 0, 0, 301171, 0, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Event Failed: Respawn Major Pakkon'), +(153912, 0, 0, 71, 0, 0, 0, 0, 301170, 0, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Event Failed: Respawn Colonel Zerran'), +(153912, 0, 0, 34, 0, 0, 0, 0, 301311, 0, 9, 2, 0, 0, 0, 0, -8870.721, 1648.401, 21.51133, 5.637414, 0, 'Lieutenant General Andorov - Set Home Position'), +(153912, 0, 0, 34, 0, 0, 0, 0, 301312, 0, 9, 2, 0, 0, 0, 0, -8868.31, 1651.6, 21.5113, 5.45, 0, 'Kaldorei Elite - Set Home Position'), +(153912, 0, 0, 34, 0, 0, 0, 0, 301313, 0, 9, 2, 0, 0, 0, 0, -8869.52, 1650, 21.5113, 5.48, 0, 'Kaldorei Elite - Set Home Position'), +(153912, 0, 0, 34, 0, 0, 0, 0, 301314, 0, 9, 2, 0, 0, 0, 0, -8871.92, 1646.8, 21.5113, 5.78, 0, 'Kaldorei Elite - Set Home Position'), +(153912, 0, 0, 34, 0, 0, 0, 0, 301315, 0, 9, 2, 0, 0, 0, 0, -8873.13, 1645.21, 21.5113, 5.44, 0, 'Kaldorei Elite - Set Home Position'), +(153912, 1, 0, 90, 154711, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Event Failed: Lieutenant General Andorov - Despawn'); +DELETE FROM `generic_scripts` WHERE `id`=154711; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(154711, 0, 0, 18, 0, 900, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov and Kaldorei Elite - Despawn with 15 min respawn time'); + +-- Wave 1 Scripts (Captain Qeez) + +-- Success condition. +-- 15391: Extra Targets Of Scripted Map Event 15391 Satisfy Condition (121: Not (Target Is Alive)) +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (15391, 47, 15391, 121, 0, 0, 0); + +DELETE FROM `generic_scripts` WHERE `id`=153910; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153910, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Captain Qeez Group - Enter Combat with Zone'), +(153910, 0, 1, 63, 15391, 0, 0, 0, 0, 0, 0, 0, 1100, 0, 0, 0, 0, 0, 0, 0, 0, 'Captain Qeez Group - Add To Scripted Map Event'); +DELETE FROM `generic_scripts` WHERE `id`=153911; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153911, 0, 0, 61, 15391, 180, 0, 0, 0, 0, 0, 0, 0, 153912, 0, 153921, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Start Scripted Map Event'), +(153911, 0, 1, 90, 153910, 0, 0, 0, 301057, 0, 9, 2, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Captain Qeez - Start Script on Group'), +(153911, 1, 0, 69, 15391, 0, 0, 0, 0, 0, 0, 0, 0, 153912, 15391, 153921, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Edit Scripted Map Event'); + +-- Wave 2 Scripts (Captain Tuubid) + +-- 15392: Extra Targets Of Scripted Map Event 15392 Satisfy Condition (121: Not (Target Is Alive)) +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (15392, 47, 15392, 121, 0, 0, 0); + +DELETE FROM `generic_scripts` WHERE `id`=153920; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153920, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Captain Tuubid Group - Enter Combat with Zone'), +(153920, 0, 1, 63, 15392, 0, 0, 0, 0, 0, 0, 0, 1100, 0, 0, 0, 0, 0, 0, 0, 0, 'Captain Tuubid Group - Add To Scripted Map Event'); +DELETE FROM `generic_scripts` WHERE `id`=153921; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153921, 0, 0, 16, 8637, 4, 0, 0, 90871, 0, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 1 Success: General Rajaxx - Play Sound'), +(153921, 0, 0, 61, 15392, 180, 0, 0, 0, 0, 0, 0, 0, 153912, 0, 153891, 0, 0, 0, 0, 0, 'Andorov Wave 1 Success: Start Scripted Map Event'), +(153921, 0, 1, 90, 153920, 0, 0, 0, 301058, 0, 9, 2, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 1 Success: Captain Tuubid - Start Script on Group'), +(153921, 1, 0, 69, 15392, 0, 0, 0, 0, 0, 0, 0, 0, 153912, 15392, 153891, 0, 0, 0, 0, 0, 'Andorov Wave 1 Success: Edit Scripted Map Event'); + +-- Wave 3 Scripts (Captain Drenn) + +-- 15389: Extra Targets Of Scripted Map Event 15389 Satisfy Condition (121: Not (Target Is Alive)) +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (15389, 47, 15389, 121, 0, 0, 0); + +-- The time of our retribution is at hand! Let darkness reign in the hearts of our enemies! +UPDATE `broadcast_text` SET `chat_type`=6, `sound_id`=8645 WHERE `entry`=11440; + +DELETE FROM `generic_scripts` WHERE `id`=153890; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153890, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Captain Drenn Group - Enter Combat with Zone'), +(153890, 0, 1, 63, 15389, 0, 0, 0, 0, 0, 0, 0, 1100, 0, 0, 0, 0, 0, 0, 0, 0, 'Captain Drenn Group - Add To Scripted Map Event'); +DELETE FROM `generic_scripts` WHERE `id`=153891; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153891, 0, 0, 0, 0, 0, 0, 0, 90871, 0, 9, 2, 11440, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 2 Success: General Rajaxx - Say Text'), +(153891, 0, 0, 61, 15389, 180, 0, 0, 0, 0, 0, 0, 0, 153912, 0, 153901, 0, 0, 0, 0, 0, 'Andorov Wave 2 Success: Start Scripted Map Event'), +(153891, 0, 1, 90, 153890, 0, 0, 0, 301168, 0, 9, 2, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 2 Success: Captain Drenn - Start Script on Group'), +(153891, 1, 0, 69, 15389, 0, 0, 0, 0, 0, 0, 0, 0, 153912, 15389, 153901, 0, 0, 0, 0, 0, 'Andorov Wave 2 Success: Edit Scripted Map Event'); + +-- Wave 4 Scripts (Captain Xurrem) + +-- 15390: Extra Targets Of Scripted Map Event 15390 Satisfy Condition (121: Not (Target Is Alive)) +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (15390, 47, 15390, 121, 0, 0, 0); + +-- No longer will we wait behind barred doors and walls of stone! No longer will our vengeance be denied! The dragons themselves will tremble before our wrath! +UPDATE `broadcast_text` SET `chat_type`=6, `sound_id`=8644 WHERE `entry`=11439; + +DELETE FROM `generic_scripts` WHERE `id`=153900; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153900, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Captain Xurrem Group - Enter Combat with Zone'), +(153900, 0, 1, 63, 15390, 0, 0, 0, 0, 0, 0, 0, 1100, 0, 0, 0, 0, 0, 0, 0, 0, 'Captain Xurrem Group - Add To Scripted Map Event'); +DELETE FROM `generic_scripts` WHERE `id`=153901; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153901, 0, 0, 0, 0, 0, 0, 0, 90871, 0, 9, 2, 11439, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 3 Success: General Rajaxx - Say Text'), +(153901, 0, 0, 61, 15390, 180, 0, 0, 0, 0, 0, 0, 0, 153912, 0, 153861, 0, 0, 0, 0, 0, 'Andorov Wave 3 Success: Start Scripted Map Event'), +(153901, 0, 1, 90, 153900, 0, 0, 0, 301172, 0, 9, 2, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 3 Success: Captain Xurrem - Start Script on Group'), +(153901, 1, 0, 69, 15390, 0, 0, 0, 0, 0, 0, 0, 0, 153912, 15390, 153861, 0, 0, 0, 0, 0, 'Andorov Wave 3 Success: Edit Scripted Map Event'); + +-- Wave 5 Scripts (Major Yeggeth) + +-- 15386: Extra Targets Of Scripted Map Event 15386 Satisfy Condition (121: Not (Target Is Alive)) +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (15386, 47, 15386, 121, 0, 0, 0); + +-- Fear is for the enemy! Fear and death! +UPDATE `broadcast_text` SET `chat_type`=6, `sound_id`=8643 WHERE `entry`=11438; + +DELETE FROM `generic_scripts` WHERE `id`=153860; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153860, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Major Yeggeth Group - Enter Combat with Zone'), +(153860, 0, 1, 63, 15386, 0, 0, 0, 0, 0, 0, 0, 1100, 0, 0, 0, 0, 0, 0, 0, 0, 'Major Yeggeth Group - Add To Scripted Map Event'); +DELETE FROM `generic_scripts` WHERE `id`=153861; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153861, 0, 0, 0, 0, 0, 0, 0, 90871, 0, 9, 2, 11438, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 4 Success: General Rajaxx - Say Text'), +(153861, 0, 0, 61, 15386, 180, 0, 0, 0, 0, 0, 0, 0, 153912, 0, 153881, 0, 0, 0, 0, 0, 'Andorov Wave 4 Success: Start Scripted Map Event'), +(153861, 0, 1, 90, 153860, 0, 0, 0, 301169, 0, 9, 2, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 4 Success: Major Yeggeth - Start Script on Group'), +(153861, 1, 0, 69, 15386, 0, 0, 0, 0, 0, 0, 0, 0, 153912, 15386, 153881, 0, 0, 0, 0, 0, 'Andorov Wave 4 Success: Edit Scripted Map Event'); + +-- Wave 6 Scripts (Major Pakkon) + +-- 15388: Extra Targets Of Scripted Map Event 15388 Satisfy Condition (121: Not (Target Is Alive)) +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (15388, 47, 15388, 121, 0, 0, 0); + +-- Staghelm will whimper and beg for his life, just as his whelp of a son did! One thousand years of injustice will end this day! +UPDATE `broadcast_text` SET `chat_type`=6, `sound_id`=8642 WHERE `entry`=11437; + +DELETE FROM `generic_scripts` WHERE `id`=153880; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153880, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Major Pakkon Group - Enter Combat with Zone'), +(153880, 0, 1, 63, 15388, 0, 0, 0, 0, 0, 0, 0, 1100, 0, 0, 0, 0, 0, 0, 0, 0, 'Major Pakkon Group - Add To Scripted Map Event'); +DELETE FROM `generic_scripts` WHERE `id`=153881; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153881, 0, 0, 0, 0, 0, 0, 0, 90871, 0, 9, 2, 11437, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 5 Success: General Rajaxx - Say Text'), +(153881, 0, 0, 61, 15388, 180, 0, 0, 0, 0, 0, 0, 0, 153912, 0, 153851, 0, 0, 0, 0, 0, 'Andorov Wave 5 Success: Start Scripted Map Event'), +(153881, 0, 1, 90, 153880, 0, 0, 0, 301171, 0, 9, 2, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 5 Success: Major Pakkon - Start Script on Group'), +(153881, 1, 0, 69, 15388, 0, 0, 0, 0, 0, 0, 0, 0, 153912, 15388, 153851, 0, 0, 0, 0, 0, 'Andorov Wave 5 Success: Edit Scripted Map Event'); + +-- Wave 7 Scripts (Colonel Zerran) + +-- 15385: Extra Targets Of Scripted Map Event 15385 Satisfy Condition (121: Not (Target Is Alive)) +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (15385, 47, 15385, 121, 0, 0, 0); + +-- Fandral! Your time has come! Go and hide in the Emerald Dream and pray we never find you! +UPDATE `broadcast_text` SET `chat_type`=6, `sound_id`=8641 WHERE `entry`=11436; + +DELETE FROM `generic_scripts` WHERE `id`=153850; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153850, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Colonel Zerran Group - Enter Combat with Zone'), +(153850, 0, 1, 63, 15385, 0, 0, 0, 0, 0, 0, 0, 1100, 0, 0, 0, 0, 0, 0, 0, 0, 'Colonel Zerran Group - Add To Scripted Map Event'); +DELETE FROM `generic_scripts` WHERE `id`=153851; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153851, 0, 0, 0, 0, 0, 0, 0, 90871, 0, 9, 2, 11436, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 6 Success: General Rajaxx - Say Text'), +(153851, 0, 0, 61, 15385, 180, 0, 0, 0, 0, 0, 0, 0, 153912, 0, 153411, 0, 0, 0, 0, 0, 'Andorov Wave 6 Success: Start Scripted Map Event'), +(153851, 0, 1, 90, 153850, 0, 0, 0, 301170, 0, 9, 2, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 6 Success: Colonel Zerran - Start Script on Group'), +(153851, 1, 0, 69, 15385, 0, 0, 0, 0, 0, 0, 0, 0, 153912, 15385, 153411, 0, 0, 0, 0, 0, 'Andorov Wave 6 Success: Edit Scripted Map Event'); + +-- Wave 8 Scripts (General Rajaxx) + +-- Impudent fool! I will kill you myself! +UPDATE `broadcast_text` SET `chat_type`=6, `sound_id`=8638 WHERE `entry`=11435; + +DELETE FROM `generic_scripts` WHERE `id`=153410; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153410, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11435, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Say Text'), +(153410, 1, 0, 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Enter Combat with Zone'); +DELETE FROM `generic_scripts` WHERE `id`=153411; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(153411, 0, 0, 39, 153410, 0, 0, 0, 90871, 0, 9, 2, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 7 Success: General Rajaxx - Start Script'), +(153411, 0, 0, 37, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 7 Success: Set Data TYPE_GENERAL_ANDOROV to DONE'), +(153411, 0, 0, 44, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Andorov Wave 7 Success: Lieutenant General Andorov - Set Phase to 2'); + +-- Despawn script for Lieutenant General Andorov. +DELETE FROM `generic_scripts` WHERE `id`=1547105; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1547105, 0, 0, 4, 147, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Remove Gossip Flag'), +(1547105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11560, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Say Text'), +(1547105, 3, 0, 3, 0, 3967, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, -8969.76, 1547.85, 22.0191, 0, 0, 'Lieutenant General Andorov - Move'), +(1547105, 7, 0, 3, 0, 6114, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, -8941.51, 1552.21, 21.7021, 0, 0, 'Lieutenant General Andorov - Move'), +(1547105, 12, 0, 3, 0, 4472, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, -8917.92, 1563.85, 21.4079, 0, 0, 'Lieutenant General Andorov - Move'), +(1547105, 15, 0, 3, 0, 6462, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, -8888.59, 1593.67, 21.4053, 0, 0, 'Lieutenant General Andorov - Move'), +(1547105, 20, 0, 90, 154712, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov - Despawn Creature'); +DELETE FROM `generic_scripts` WHERE `id`=154712; +INSERT INTO `generic_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(154712, 0, 0, 18, 0, 345600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lieutenant General Andorov and Kaldorei Elite - Despawn with 4 day respawn time'); + +-- Assign sounds and set chat type for Rajaxx texts. +UPDATE `broadcast_text` SET `chat_type`=6, `sound_id`=8640 WHERE `entry`=11434; +UPDATE `broadcast_text` SET `chat_type`=6, `sound_id`=8639 WHERE `entry`=11433; +UPDATE `broadcast_text` SET `chat_type`=6 WHERE `entry`=11429; +UPDATE `broadcast_text` SET `chat_type`=6 WHERE `entry`=11660; + +-- Delete no longer needed custom table texts. +DELETE FROM `script_texts` WHERE `entry` IN (-1509003, -1509029, -1509030, -1509004, -1509005, -1509006, -1509007, -1509008, -1509009, -1509010, -1509011, -1509012, -1509013, -1509014, -1509015, -1509016, -1509017); + +-- 509: Current Map Id Is 509 +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (509, 33, 509, 0, 0, 0, 0); + +-- Events list for General Rajaxx +DELETE FROM `creature_ai_events` WHERE `creature_id`=15341; +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1534101, 15341, 0, 4, 0, 100, 0, 0, 0, 0, 0, 1534101, 0, 0, 'General Rajaxx - Set Instance Data on Aggro'); +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1534102, 15341, 0, 6, 0, 100, 0, 0, 0, 0, 0, 1534102, 0, 0, 'General Rajaxx - Set Instance Data on Death'); +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1534103, 15341, 0, 2, 0, 100, 0, 30, 1, 0, 0, 1534103, 0, 0, 'General Rajaxx - Enrage at 30% HP'); +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1534104, 15341, 0, 5, 0, 100, 1, 30000, 30000, 0, 0, 1534104, 0, 0, 'General Rajaxx - Say Text on Killed Unit'); +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1534105, 15341, 991, 11, 0, 100, 1, 0, 0, 0, 0, 1534105, 0, 0, 'General Rajaxx - Say Text on Spawn in Kalimdor'); +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1534106, 15341, 509, 11, 0, 100, 1, 0, 0, 0, 0, 1534106, 0, 0, 'General Rajaxx - Sat Faction on Spawn in Ahn\'Qiraj'); +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1534107, 15341, 509, 7, 0, 100, 0, 0, 0, 0, 0, 1534107, 0, 0, 'General Rajaxx - Say Text on Evade'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1534101; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1534101, 0, 0, 37, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Set Data TYPE_RAJAXX to IN_PROGRESS'), +(1534101, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Set in Combat with Zone'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1534102; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1534102, 0, 0, 37, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Set Data TYPE_RAJAXX to DONE'), +(1534102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11434, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Say Text on Death'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1534103; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1534103, 0, 0, 15, 8269, 2, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Cast Spell Enrage'), +(1534103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2384, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Say Emoted Text'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1534104; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1534104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11433, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Say Text'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1534105; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1534105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11429, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Say Text'), +(1534105, 0, 0, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Set React State to Passive'), +(1534105, 0, 0, 52, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Set Invincibility'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1534106; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1534106, 0, 0, 22, 310, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Sat Faction to Silithid'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1534107; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1534107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11660, 0, 0, 0, 0, 0, 0, 0, 0, 'General Rajaxx - Say Text'); +REPLACE INTO `creature_spells` (`entry`, `name`, `spellId_1`, `probability_1`, `castTarget_1`, `targetParam1_1`, `targetParam2_1`, `castFlags_1`, `delayInitialMin_1`, `delayInitialMax_1`, `delayRepeatMin_1`, `delayRepeatMax_1`, `scriptId_1`, `spellId_2`, `probability_2`, `castTarget_2`, `targetParam1_2`, `targetParam2_2`, `castFlags_2`, `delayInitialMin_2`, `delayInitialMax_2`, `delayRepeatMin_2`, `delayRepeatMax_2`, `scriptId_2`, `spellId_3`, `probability_3`, `castTarget_3`, `targetParam1_3`, `targetParam2_3`, `castFlags_3`, `delayInitialMin_3`, `delayInitialMax_3`, `delayRepeatMin_3`, `delayRepeatMax_3`, `scriptId_3`, `spellId_4`, `probability_4`, `castTarget_4`, `targetParam1_4`, `targetParam2_4`, `castFlags_4`, `delayInitialMin_4`, `delayInitialMax_4`, `delayRepeatMin_4`, `delayRepeatMax_4`, `scriptId_4`, `spellId_5`, `probability_5`, `castTarget_5`, `targetParam1_5`, `targetParam2_5`, `castFlags_5`, `delayInitialMin_5`, `delayInitialMax_5`, `delayRepeatMin_5`, `delayRepeatMax_5`, `scriptId_5`, `spellId_6`, `probability_6`, `castTarget_6`, `targetParam1_6`, `targetParam2_6`, `castFlags_6`, `delayInitialMin_6`, `delayInitialMax_6`, `delayRepeatMin_6`, `delayRepeatMax_6`, `scriptId_6`, `spellId_7`, `probability_7`, `castTarget_7`, `targetParam1_7`, `targetParam2_7`, `castFlags_7`, `delayInitialMin_7`, `delayInitialMax_7`, `delayRepeatMin_7`, `delayRepeatMax_7`, `scriptId_7`, `spellId_8`, `probability_8`, `castTarget_8`, `targetParam1_8`, `targetParam2_8`, `castFlags_8`, `delayInitialMin_8`, `delayInitialMax_8`, `delayRepeatMin_8`, `delayRepeatMax_8`, `scriptId_8`) VALUES (153410, 'Ruins of Ahn\'Qiraj - General Rajaxx', 25599, 100, 1, 0, 0, 64, 8, 8, 22, 25, 0, 6713, 100, 1, 0, 0, 0, 5, 5, 15, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +UPDATE `creature_template` SET `faction`=16, `unit_flags`=64, `auras`='18943', `spawn_spell_id`=12980, `spell_list_id`=153410, `ai_name`='EventAI', `script_name`='' WHERE `entry`=15341; +UPDATE `creature_onkill_reputation` SET `RewOnKillRepFaction2`=0, `MaxStanding2`=0, `RewOnKillRepValue2`=0 WHERE `creature_id`=15341; + + +-- End of migration. +END IF; +END?? +delimiter ; +CALL add_migration(); +DROP PROCEDURE IF EXISTS add_migration; diff --git a/src/game/CreatureGroups.h b/src/game/CreatureGroups.h index 036387ba3..d4f67da23 100644 --- a/src/game/CreatureGroups.h +++ b/src/game/CreatureGroups.h @@ -64,6 +64,7 @@ class CreatureGroup std::map const& GetMembers() const { return m_members; } bool ContainsGuid(ObjectGuid guid) const { return m_members.find(guid) != m_members.end(); } bool IsFormation() const { return m_options & OPTION_FORMATION_MOVE; } + bool HasGroupFlag(uint32 flag) const { return m_options & flag; } void SetLastReachedWaypoint(uint32 point) { m_lastReachedWaypoint = point; } void OnMemberAttackStart(Creature* member, Unit* target); diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index 5525c8afd..ea77e066c 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -54,6 +54,7 @@ #include "ThreadPool.h" #include "AuraRemovalMgr.h" #include "world/world_event_wareffort.h" +#include "CreatureGroups.h" Map::~Map() { @@ -3515,3 +3516,53 @@ GameObject* Map::SummonGameObject(uint32 entry, float x, float y, float z, float go->SetWorldMask(worldMask); return go; } + +Creature* Map::LoadCreatureSpawn(uint32 dbGuid, bool delaySpawn) +{ + CreatureData const* pSpawnData = sObjectMgr.GetCreatureData(dbGuid); + if (!pSpawnData) + return nullptr; + + Creature* pCreature; + ObjectGuid guid = pSpawnData->GetObjectGuid(dbGuid); + if (pCreature = GetCreature(guid)) + return pCreature; + + if (!IsLoaded(pSpawnData->position.x, pSpawnData->position.y)) + return nullptr; + + pCreature = new Creature(); + if (!pCreature->LoadFromDB(dbGuid, this, true)) + { + delete pCreature; + return nullptr; + } + + if (delaySpawn) + { + pCreature->SetRespawnTime(pCreature->GetRespawnDelay()); + if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATELY) || pCreature->IsWorldBoss()) + pCreature->SaveRespawnTime(); + } + + Add(pCreature); + return pCreature; +} + +Creature* Map::LoadCreatureSpawnWithGroup(uint32 leaderDbGuid, bool delaySpawn) +{ + Creature* pLeader = LoadCreatureSpawn(leaderDbGuid); + if (!pLeader) + return nullptr; + + if (CreatureGroup* pGroup = pLeader->GetCreatureGroup()) + { + for (auto const& itr : pGroup->GetMembers()) + LoadCreatureSpawn(itr.first.GetCounter()); + + if (pGroup->HasGroupFlag(OPTION_RESPAWN_TOGETHER) && pLeader->IsAlive()) + pGroup->RespawnAll(pLeader); + } + + return pLeader; +} diff --git a/src/game/Maps/Map.h b/src/game/Maps/Map.h index 343c69cc1..9779fadf4 100644 --- a/src/game/Maps/Map.h +++ b/src/game/Maps/Map.h @@ -495,6 +495,8 @@ class Map : public GridRefManager void IncrementSummonCountForObject(uint64 guid); void DecrementSummonCountForObject(uint64 guid); Creature* SummonCreature(uint32 entry, float x, float y, float z, float ang, TempSummonType spwtype = TEMPSUMMON_DEAD_DESPAWN, uint32 despwtime = 25000, bool asActiveObject = false); + Creature* LoadCreatureSpawn(uint32 dbGuid, bool delaySpawn = false); + Creature* LoadCreatureSpawnWithGroup(uint32 leaderDbGuid, bool delaySpawn = false); Player* GetPlayer(ObjectGuid guid); GameObject* GetGameObject(ObjectGuid const& guid) { return GetObject(guid); } @@ -636,15 +638,15 @@ class Map : public GridRefManager bool _processingSendObjUpdates = false; uint32 _objUpdatesThreads = 0; - mutable std::mutex i_objectsToClientUpdate_lock; + mutable std::mutex i_objectsToClientUpdate_lock; std::set i_objectsToClientUpdate; bool _processingUnitsRelocation = false; uint32 _unitRelocationThreads = 0; - mutable std::mutex i_unitsRelocated_lock; + mutable std::mutex i_unitsRelocated_lock; std::set i_unitsRelocated; - mutable std::mutex unitsMvtUpdate_lock; + mutable std::mutex unitsMvtUpdate_lock; std::set unitsMvtUpdate; mutable MapMutexType _corpseRemovalLock; @@ -850,6 +852,7 @@ class Map : public GridRefManager bool ScriptCommand_ResetDoorOrButton(ScriptInfo const& script, WorldObject* source, WorldObject* target); bool ScriptCommand_SetCommandState(ScriptInfo const& script, WorldObject* source, WorldObject* target); bool ScriptCommand_PlayCustomAnim(ScriptInfo const& script, WorldObject* source, WorldObject* target); + bool ScriptCommand_StartScriptOnGroup(ScriptInfo const& script, WorldObject* source, WorldObject* target); // Add any new script command functions to the array. ScriptCommandFunction const m_ScriptCommands[SCRIPT_COMMAND_MAX] = @@ -944,6 +947,7 @@ class Map : public GridRefManager &Map::ScriptCommand_ResetDoorOrButton, // 87 &Map::ScriptCommand_SetCommandState, // 88 &Map::ScriptCommand_PlayCustomAnim, // 89 + &Map::ScriptCommand_StartScriptOnGroup, // 90 }; public: diff --git a/src/game/Maps/ScriptCommands.cpp b/src/game/Maps/ScriptCommands.cpp index c79901d3a..1e1becd26 100644 --- a/src/game/Maps/ScriptCommands.cpp +++ b/src/game/Maps/ScriptCommands.cpp @@ -26,6 +26,7 @@ #include "GameEventMgr.h" #include "ObjectMgr.h" #include "Group.h" +#include "CreatureGroups.h" // Script commands should return false by default. // If they return true the rest of the script is aborted. @@ -647,6 +648,8 @@ bool Map::ScriptCommand_PlaySound(ScriptInfo const& script, WorldObject* source, if (script.playSound.flags & SF_PLAYSOUND_DISTANCE_DEPENDENT) pSource->PlayDistanceSound(script.playSound.soundId, pTarget); + else if (script.playSound.flags & SF_PLAYSOUND_TO_ALL_IN_ZONE) + PlayDirectSoundToMap(script.playSound.soundId, IsContinent() ? pSource->GetZoneId() : 0); else pSource->PlayDirectSound(script.playSound.soundId, pTarget); @@ -684,7 +687,7 @@ bool Map::ScriptCommand_DespawnCreature(ScriptInfo const& script, WorldObject* s // Fix possible crash due to double aura deletion when creature is despawned on death. uint32 const despawnDelay = !pSource->IsAlive() && (script.despawn.despawnDelay == 0) ? 1 : script.despawn.despawnDelay; - pSource->DespawnOrUnsummon(despawnDelay); + pSource->DespawnOrUnsummon(despawnDelay, script.despawn.respawnDelay); return false; } @@ -1264,8 +1267,7 @@ bool Map::ScriptCommand_SetData64(ScriptInfo const& script, WorldObject* source, return false; } -// SCRIPT_COMMAND_START_SCRIPT (39) -bool Map::ScriptCommand_StartScript(ScriptInfo const& script, WorldObject* source, WorldObject* target) +static uint32 ChooseScriptIdToStart(ScriptInfo const& script) { uint32 const roll = urand(1, 100); uint32 sum = 0; @@ -1289,8 +1291,16 @@ bool Map::ScriptCommand_StartScript(ScriptInfo const& script, WorldObject* sourc sum += currentChance; } - if (chosenId) - ScriptsStart(sGenericScripts, chosenId, source ? source->GetObjectGuid() : ObjectGuid(), target ? target->GetObjectGuid() : ObjectGuid()); + return chosenId; +} + +// SCRIPT_COMMAND_START_SCRIPT (39) +bool Map::ScriptCommand_StartScript(ScriptInfo const& script, WorldObject* source, WorldObject* target) +{ + uint32 const scriptId = ChooseScriptIdToStart(script); + + if (scriptId) + ScriptsStart(sGenericScripts, scriptId, source ? source->GetObjectGuid() : ObjectGuid(), target ? target->GetObjectGuid() : ObjectGuid()); else return ShouldAbortScript(script); @@ -2425,3 +2435,52 @@ bool Map::ScriptCommand_PlayCustomAnim(ScriptInfo const& script, WorldObject* so pGo->SendGameObjectCustomAnim(script.playCustomAnim.animId); return false; } + +// SCRIPT_COMMAND_START_SCRIPT_ON_GROUP (90) +bool Map::ScriptCommand_StartScriptOnGroup(ScriptInfo const& script, WorldObject* source, WorldObject* target) +{ + Unit* pSource = ToUnit(source); + + if (!pSource) + { + sLog.Out(LOG_BASIC, LOG_LVL_ERROR, "SCRIPT_COMMAND_START_SCRIPT_ON_GROUP (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + return ShouldAbortScript(script); + } + + uint32 const scriptId = ChooseScriptIdToStart(script); + if (!scriptId) + return ShouldAbortScript(script); + + ScriptsStart(sGenericScripts, scriptId, pSource->GetObjectGuid(), target ? target->GetObjectGuid() : ObjectGuid()); + + if (Creature* pCreature = pSource->ToCreature()) + { + if (CreatureGroup* pGroup = pCreature->GetCreatureGroup()) + { + if (pGroup->GetLeaderGuid() != pCreature->GetObjectGuid()) + ScriptsStart(sGenericScripts, scriptId, pGroup->GetLeaderGuid(), target ? target->GetObjectGuid() : ObjectGuid()); + + for (auto const& itr : pGroup->GetMembers()) + { + if (itr.first != pCreature->GetObjectGuid()) + ScriptsStart(sGenericScripts, scriptId, itr.first, target ? target->GetObjectGuid() : ObjectGuid()); + } + } + } + else if (Player* pPlayer = pSource->ToPlayer()) + { + if (Group* pGroup = pPlayer->GetGroup()) + { + for (GroupReference* itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) + { + if (Player* pMember = itr->getSource()) + { + if (pMember->GetObjectGuid() != pPlayer->GetObjectGuid()) + ScriptsStart(sGenericScripts, scriptId, pMember->GetObjectGuid(), target ? target->GetObjectGuid() : ObjectGuid()); + } + } + } + } + + return false; +} diff --git a/src/game/Maps/ScriptCommands.h b/src/game/Maps/ScriptCommands.h index 0c9cc4ac6..b1d31f44f 100644 --- a/src/game/Maps/ScriptCommands.h +++ b/src/game/Maps/ScriptCommands.h @@ -110,6 +110,7 @@ enum eScriptCommand // datalong2 = amount SCRIPT_COMMAND_DESPAWN_CREATURE = 18, // source = Creature // datalong = despawn_delay + // datalong2 = respawn_delay SCRIPT_COMMAND_SET_EQUIPMENT = 19, // source = Creature // datalong = (bool) reset_default // dataint = main-hand item_id @@ -174,7 +175,7 @@ enum eScriptCommand // datalong2 = data // datalong3 = eSetInstData64Options SCRIPT_COMMAND_START_SCRIPT = 39, // source = Map - // datalong1-4 = event_script id + // datalong1-4 = generic_script id // dataint1-4 = chance (total cant be above 100) SCRIPT_COMMAND_REMOVE_ITEM = 40, // source = Player (from provided source or target) // datalong = item_id @@ -326,6 +327,9 @@ enum eScriptCommand // datalong = command_state (see enum CommandStates) SCRIPT_COMMAND_PLAY_CUSTOM_ANIM = 89, // source = GameObject // datalong = anim_id + SCRIPT_COMMAND_START_SCRIPT_ON_GROUP = 90, // source = Unit + // datalong1-4 = generic_script id + // dataint1-4 = chance (total cant be above 100) SCRIPT_COMMAND_MAX, @@ -391,7 +395,8 @@ enum CastFlags enum ePlaySoundFlags { SF_PLAYSOUND_ONLY_TO_TARGET = 0x1, - SF_PLAYSOUND_DISTANCE_DEPENDENT = 0x2 + SF_PLAYSOUND_DISTANCE_DEPENDENT = 0x2, + SF_PLAYSOUND_TO_ALL_IN_ZONE = 0x4 }; // Possible datalong values for SCRIPT_COMMAND_MODIFY_THREAT @@ -644,6 +649,7 @@ struct ScriptInfo struct // SCRIPT_COMMAND_DESPAWN_CREATURE (18) { uint32 despawnDelay; // datalong + uint32 respawnDelay; // datalong } despawn; struct // SCRIPT_COMMAND_SET_EQUIPMENT (19) @@ -760,7 +766,8 @@ struct ScriptInfo uint32 type; // datalong3 } setData64; - struct // SCRIPT_COMMAND_START_SCRIPT (39) + // SCRIPT_COMMAND_START_SCRIPT (39) + struct // SCRIPT_COMMAND_START_SCRIPT_ON_GROUP (90) { uint32 scriptId[4]; // datalong to datalong4 uint32 unused; // data_flags diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 8aca06067..740239ae5 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -10549,22 +10549,6 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32 sLog.Out(LOG_DBERROR, LOG_LVL_ERROR, "Table `%s` has data for nonexistent creature (Entry: %u), ignoring", tableName, vendor_entry); return false; } - - // innkeepers become vendors during love is in the air even if they are not normally - if (!(cInfo->npc_flags & (UNIT_NPC_FLAG_VENDOR | UNIT_NPC_FLAG_INNKEEPER))) - { - if (!skip_vendors || skip_vendors->count(vendor_entry) == 0) - { - if (pl) - ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION); - else - sLog.Out(LOG_DBERROR, LOG_LVL_ERROR, "Table `%s` has data for creature (Entry: %u) without vendor flag, ignoring", tableName, vendor_entry); - - if (skip_vendors) - skip_vendors->insert(vendor_entry); - } - return false; - } } if (ItemPrototype const* pItemProto = GetItemPrototype(item_id)) diff --git a/src/game/Objects/Creature.cpp b/src/game/Objects/Creature.cpp index 81a32d856..c1bb30c6b 100644 --- a/src/game/Objects/Creature.cpp +++ b/src/game/Objects/Creature.cpp @@ -129,7 +129,7 @@ AssistDelayEvent::AssistDelayEvent(ObjectGuid victim, Unit& owner, std::listInsertObject(GetObjectGuid(), this); sCreatureGroupsManager->LoadCreatureGroup(this, m_creatureGroup); - if (m_creatureGroup && m_creatureGroup->IsFormation()) - SetActiveObjectState(true); + if (m_creatureGroup) + { + if (m_creatureGroup->IsFormation()) + SetActiveObjectState(true); + if (GetDeathState() == ALIVE || GetDeathState() == JUST_ALIVED) + m_creatureGroup->OnRespawn(this); + } + Unit::AddToWorld(); if (!i_AI) @@ -688,9 +694,6 @@ void Creature::Update(uint32 update_diff, uint32 diff) else SetDeathState(JUST_ALIVED); - if (CreatureGroup* group = GetCreatureGroup()) - group->OnRespawn(this); - // Call AI respawn virtual function if (AI()) { @@ -2108,21 +2111,41 @@ void Creature::Respawn() } } -void Creature::ForcedDespawn(uint32 timeMSToDespawn) +void Creature::DespawnOrUnsummon(uint32 msTimeToDespawn /*= 0*/, uint32 secsTimeToRespawn /*= 0*/) +{ + if (IsTemporarySummon()) + static_cast(this)->UnSummon(msTimeToDespawn); + else if (IsPet()) + static_cast(this)->DelayedUnsummon(msTimeToDespawn, PET_SAVE_AS_DELETED); + else + ForcedDespawn(msTimeToDespawn, secsTimeToRespawn); +} + +void Creature::ForcedDespawn(uint32 msTimeToDespawn /*= 0*/, uint32 secsTimeToRespawn /*= 0*/) { AddCreatureState(CSTATE_DESPAWNING); - if (timeMSToDespawn) + if (msTimeToDespawn) { - ForcedDespawnDelayEvent *pEvent = new ForcedDespawnDelayEvent(*this); + ForcedDespawnDelayEvent *pEvent = new ForcedDespawnDelayEvent(*this, secsTimeToRespawn); - m_Events.AddEvent(pEvent, m_Events.CalculateTime(timeMSToDespawn)); + m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTimeToDespawn)); return; } + uint32 oldRespawnDelay; + if (secsTimeToRespawn) + { + oldRespawnDelay = m_respawnDelay; + m_respawnDelay = secsTimeToRespawn; + } + if (IsAlive()) SetDeathState(JUST_DIED); + if (secsTimeToRespawn) + m_respawnDelay = oldRespawnDelay; + RemoveCorpse(); SetHealth(0); // just for nice GM-mode view ClearCreatureState(CSTATE_DESPAWNING); @@ -4090,16 +4113,6 @@ bool Creature::HasWeapon() const return itemClass == ITEM_CLASS_WEAPON; } -void Creature::DespawnOrUnsummon(uint32 msTimeToDespawn /*= 0*/) -{ - if (IsTemporarySummon()) - static_cast(this)->UnSummon(msTimeToDespawn); - else if (IsPet()) - static_cast(this)->DelayedUnsummon(msTimeToDespawn, PET_SAVE_AS_DELETED); - else - ForcedDespawn(msTimeToDespawn); -} - void Creature::StartCooldownForSummoner() { if (!HasCreatureState(CSTATE_IMPOSED_COOLDOWN)) diff --git a/src/game/Objects/Creature.h b/src/game/Objects/Creature.h index d8883fd61..8266b40e2 100644 --- a/src/game/Objects/Creature.h +++ b/src/game/Objects/Creature.h @@ -342,8 +342,8 @@ class Creature : public Unit void RemoveCorpse(); bool IsDeadByDefault() const; - void ForcedDespawn(uint32 timeMSToDespawn = 0); - void DespawnOrUnsummon(uint32 msTimeToDespawn = 0); + void ForcedDespawn(uint32 msTimeToDespawn = 0, uint32 secsTimeToRespawn = 0); + void DespawnOrUnsummon(uint32 msTimeToDespawn = 0, uint32 secsTimeToRespawn = 0); time_t const& GetRespawnTime() const { return m_respawnTime; } time_t GetRespawnTimeEx() const; @@ -674,11 +674,12 @@ class AssistDelayEvent : public BasicEvent class ForcedDespawnDelayEvent : public BasicEvent { public: - explicit ForcedDespawnDelayEvent(Creature& owner) : BasicEvent(), m_owner(owner) { } + explicit ForcedDespawnDelayEvent(Creature& owner, uint32 secsTimeToRespawn = 0) : BasicEvent(), m_owner(owner), m_secsTimeToRespawn(secsTimeToRespawn) { } bool Execute(uint64 e_time, uint32 p_time) override; private: Creature& m_owner; + uint32 m_secsTimeToRespawn; }; class TargetedEmoteEvent : public BasicEvent diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp index 533136bc0..9e8bb10f4 100644 --- a/src/game/ScriptMgr.cpp +++ b/src/game/ScriptMgr.cpp @@ -750,6 +750,7 @@ void ScriptMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) break; } case SCRIPT_COMMAND_START_SCRIPT: + case SCRIPT_COMMAND_START_SCRIPT_ON_GROUP: { if (100 < (tmp.startScript.chance[0] + tmp.startScript.chance[1] + tmp.startScript.chance[2] + tmp.startScript.chance[3])) { @@ -2357,8 +2358,8 @@ void ScriptMgr::CollectPossibleGenericIds(std::set& genericIds) Field* fields; for (const auto& script_table : script_tables) { - // From SCRIPT_COMMAND_START_SCRIPT. - std::unique_ptr result(WorldDatabase.PQuery("SELECT `datalong`, `datalong2`, `datalong3`, `datalong4` FROM `%s` WHERE `command`=39", script_table)); + // From SCRIPT_COMMAND_START_SCRIPT and SCRIPT_COMMAND_START_SCRIPT_ON_GROUP. + std::unique_ptr result(WorldDatabase.PQuery("SELECT `datalong`, `datalong2`, `datalong3`, `datalong4` FROM `%s` WHERE `command` IN (39, 90)", script_table)); if (result) { @@ -2589,7 +2590,7 @@ void DoScriptText(int32 textId, WorldObject* pSource, Unit* pTarget, int32 chatT if (chatType == CHAT_TYPE_ZONE_YELL) { if (Map* pZone = pSource->GetMap()) - pZone->PlayDirectSoundToMap(soundId); + pZone->PlayDirectSoundToMap(soundId, pZone->IsContinent() ? pSource->GetZoneId() : 0); } else pSource->PlayDirectSound(soundId); diff --git a/src/scripts/CMakeLists.txt b/src/scripts/CMakeLists.txt index edb456ad6..784b09cb3 100644 --- a/src/scripts/CMakeLists.txt +++ b/src/scripts/CMakeLists.txt @@ -220,7 +220,6 @@ set (SCRIPTS_SRCS kalimdor/silithus/ruins_of_ahnqiraj/boss_kurinnaxx.cpp kalimdor/silithus/ruins_of_ahnqiraj/boss_moam.cpp kalimdor/silithus/ruins_of_ahnqiraj/boss_ossirian.cpp - kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp kalimdor/silithus/ruins_of_ahnqiraj/npc_sandstalker.cpp kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.cpp diff --git a/src/scripts/ScriptLoader.cpp b/src/scripts/ScriptLoader.cpp index 77b6bcb01..f931bdfae 100644 --- a/src/scripts/ScriptLoader.cpp +++ b/src/scripts/ScriptLoader.cpp @@ -206,7 +206,6 @@ void AddSC_boss_buru(); void AddSC_boss_kurinnaxx(); void AddSC_boss_moam(); void AddSC_boss_ossirian(); -void AddSC_boss_rajaxx(); void AddSC_ruins_of_ahnqiraj(); void AddSC_instance_ruins_of_ahnqiraj(); void AddSC_boss_cthun(); //temple_of_ahnqiraj @@ -450,7 +449,6 @@ void AddScripts() AddSC_boss_kurinnaxx(); AddSC_boss_moam(); AddSC_boss_ossirian(); - AddSC_boss_rajaxx(); AddSC_ruins_of_ahnqiraj(); AddSC_instance_ruins_of_ahnqiraj(); AddSC_boss_cthun(); //temple_of_ahnqiraj diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_kurinnaxx.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_kurinnaxx.cpp index 06bbf7fcc..b8e0c86bc 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_kurinnaxx.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_kurinnaxx.cpp @@ -64,6 +64,10 @@ struct boss_kurinnaxxAI : public ScriptedAI m_uiTrash_Timer = 10000; m_uiWideSlash_Timer = 15000; m_bHasEnraged = false; + } + + void JustRespawned() override + { if (m_pInstance) m_pInstance->SetData(TYPE_KURINNAXX, NOT_STARTED); } diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp deleted file mode 100644 index aa3135d66..000000000 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp +++ /dev/null @@ -1,567 +0,0 @@ -/* Copyright (C) 2006 - 2010 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Rajaxx -SD%Complete: 90 -SDComment: Sometimes event bugs appear -SDCategory: Ruins of Ahn'Qiraj -EndScriptData */ - - -#include "scriptPCH.h" -#include "CreatureGroups.h" -#include "Group.h" -#include "ruins_of_ahnqiraj.h" - -#define GOSSIP_START "Let's find out." - -enum -{ - SAY_ANDOROV_READY = -1509003, - SAY_ANDOROV_INTRO2 = -1509029, - SAY_ANDOROV_ATTACK = -1509030, - SAY_ANDOROV_INTRO = -1509004, - - SAY_WAVE3 = -1509005, - SAY_WAVE4 = -1509006, - SAY_WAVE5 = -1509007, - SAY_WAVE6 = -1509008, - SAY_WAVE7 = -1509009, - SAY_WAVE8 = -1509010, - - SAY_UNK1 = -1509011, - SAY_UNK2 = -1509012, - SAY_UNK3 = -1509013, - SAY_DEATH = -1509014, - - SAY_DEAGGRO = -1509015, - SAY_KILLS_ANDOROV = -1509016, - - SAY_AQ_WAR_START = -1509017, // Yell when realm complete quest 8743 for world event - EMOTE_FRENZY = 7797, - - // General Rajaxx - SPELL_DISARM = 6713, - SPELL_FRENZY = 8269, - SPELL_SUMMON_PLAYER = 20477, - SPELL_THUNDERCRASH = 25599, - SPELL_TRASH = 3391, - - SPELL_CHARGE = 26561, - SPELL_REFLECT = 9906, - SPELL_FEAR = 19408, - SPELL_ENRAGE = 28747, - - // NPC General Andorov - SPELL_AURA_OF_COMMAND = 25516, - SPELL_BASH = 25515, - SPELL_STRIKE = 22591, - - ZONE_SILITHUS = 1377, -}; - -#ifdef DEBUG_MODE -#define DEBUG_EMOTE_YELL( crea, texte ) crea->MonsterYell( texte , 0) -#define DELAY_BETWEEN_WAVE 30000 -#else -#define DEBUG_EMOTE_YELL( crea, texte ) -#define DELAY_BETWEEN_WAVE 180000 -#endif - -#define ANDOROV_WAYPOINT_MAX 7 -#define OOC_BETWEEN_WAVE 5000 - -struct boss_rajaxxAI : public ScriptedAI -{ - boss_rajaxxAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData(); - Reset(); - } - - ScriptedInstance* m_pInstance; - - uint32 m_uiResetAggro_Timer; - uint32 m_uiThunderCrash_Timer; - uint32 m_uiTrash_Timer; - uint32 m_uiDisarm_Timer; - uint32 m_uiWave_Timer; - uint32 m_uiNextWave_Timer; - uint32 m_uiNextWaveIndex; - bool m_bHasEnraged; - - void Reset() override - { - // Rajaxx's spells - m_uiResetAggro_Timer = 20000; - m_uiThunderCrash_Timer = 25000; - m_uiDisarm_Timer = 5000; - m_bHasEnraged = false; - m_uiTrash_Timer = 30000; - - // Waves reset - m_uiWave_Timer = 1000; - m_uiNextWave_Timer = 0; - m_uiNextWaveIndex = 0; - - if (m_pInstance && m_creature->IsAlive()) - { - for (uint8 waveIndex = 0; waveIndex < WAVE_MAX; ++waveIndex) - ResetWave(waveIndex); - m_pInstance->SetData(TYPE_RAJAXX, NOT_STARTED); - } - } - - void ResetWave(uint8 waveIndex) - { - if (!m_pInstance || !m_creature->IsAlive()) - return; - if (waveIndex >= WAVE_MAX) - return; - - uint64 leaderGUID = GetLeaderGuidFromWaveIndex(waveIndex); - if (Creature* pLeader = m_pInstance->GetCreature(leaderGUID)) - if (CreatureGroup* group = pLeader->GetCreatureGroup()) - group->RespawnAll(m_creature); - } - - void StartWave(uint8 waveIndex) - { - if (!m_pInstance) - return; - - DEBUG_EMOTE_YELL(m_creature, "DEBUG : StartWave"); - if (waveIndex < WAVE_MAX) - { - for (uint8 waveInd = 0; waveInd <= waveIndex; ++waveInd) - { - uint64 leaderGUID = GetLeaderGuidFromWaveIndex(waveInd); - if (Creature* pLeader = m_pInstance->GetCreature(leaderGUID)) - { - if (pLeader->IsAlive()) - pLeader->SetInCombatWithZone(); - } - } - - switch (waveIndex) - { - case 2: - DoScriptText(SAY_WAVE3, m_creature); - break; - case 3: - DoScriptText(SAY_WAVE4, m_creature); - break; - case 4: - DoScriptText(SAY_WAVE5, m_creature); - break; - case 5: - DoScriptText(SAY_WAVE6, m_creature); - break; - case 6: - DoScriptText(SAY_WAVE7, m_creature); - break; - } - } - } - - uint64 GetLeaderGuidFromWaveIndex(uint8 waveIndex) - { - uint32 data; - - if (!m_pInstance) - return 0; - - switch (waveIndex) - { - case 0: - data = DATA_QEEZ; - break; - case 1: - data = DATA_TUUBID; - break; - case 2: - data = DATA_DRENN; - break; - case 3: - data = DATA_XURREM; - break; - case 4: - data = DATA_YEGGETH; - break; - case 5: - data = DATA_PAKKON; - break; - case 6: - data = DATA_ZERRAN; - break; - default: - return 0; - } - return m_pInstance->GetData64(data); - } - - void Aggro(Unit* pPuller) override - { - m_creature->SetInCombatWithZone(); - - if (m_pInstance) - m_pInstance->SetData(TYPE_RAJAXX, IN_PROGRESS); - } - - void JustDied(Unit* pKiller) override - { - if (!m_pInstance) - return; - - DoScriptText(SAY_DEATH, m_creature); - if (m_pInstance) - m_pInstance->SetData(TYPE_RAJAXX, DONE); - - // According to http://wowwiki.wikia.com/wiki/Cenarion_Circle_reputation_guide - // and http://wowwiki.wikia.com/wiki/General_Rajaxx, - // When Rajaxx dies, players should gain 90 (post-"nerf" 150) reputation for each - // of the NPCs that are still alive. - OnKillReputationReward(); - } - - void KilledUnit(Unit *pKilled) override - { -// if (!m_creature->IsInCombat()) -// DoScriptText(SAY_DEAGGRO, m_creature, pKilled); - } - - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) override - { - // Frenzy - if (!m_bHasEnraged && ((m_creature->GetHealth() * 100) / m_creature->GetMaxHealth()) < 30) - { - if (DoCastSpellIfCan(m_creature, SPELL_FRENZY) == CAST_OK) - { - DoScriptText(EMOTE_FRENZY, m_creature); - m_bHasEnraged = true; - } - } - } - - bool IsCurrentWaveDead() - { - if (!m_pInstance || (m_uiNextWaveIndex == 0)) - return false; - - // Count of dead mobs per wave is managed by instance script - return m_pInstance->GetData(m_uiNextWaveIndex - 1 + WAVE_OFFSET) == 0; - } - - void OnKillReputationReward() - { - FactionEntry const *factionEntry = sObjectMgr.GetFactionEntry(609); // Cenarion Circle - if (!factionEntry) { - sLog.Out(LOG_BASIC, LOG_LVL_ERROR, "Rajaxx justDied, unable to find Cenarion Circle faction"); - return; - } - std::list helpers; - GetCreatureListWithEntryInGrid(helpers, m_creature, { 15473, 15478, 15471, 987001 }, 400.0f); - - if (helpers.empty()) - return; - int alive = 0; - for (const auto it : helpers) - if (it->IsAlive()) ++alive; - - if (Player* pLootRecepient = m_creature->GetLootRecipient()) { - if (Group* pGroup = pLootRecepient->GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) - { - Player* pGroupGuy = itr->getSource(); - if (!pGroupGuy || !pGroupGuy->IsInWorld()) - continue; - - uint32 current_reputation_rank1 = pGroupGuy->GetReputationMgr().GetRank(factionEntry); - if (factionEntry && current_reputation_rank1 <= 7) { - for(int i = 0; i < alive; i++) - pGroupGuy->GetReputationMgr().ModifyReputation(factionEntry, 90); - - } - } - } - } - } - - void UpdateAI(uint32 const uiDiff) override - { - // Waves launcher - if (m_pInstance && (m_pInstance->GetData(TYPE_RAJAXX) == IN_PROGRESS)) - { - if (IsCurrentWaveDead()) - m_uiNextWave_Timer += uiDiff; - - if (m_uiNextWaveIndex < WAVE_MAX) - { - if (m_uiWave_Timer < uiDiff || m_uiNextWave_Timer > OOC_BETWEEN_WAVE) - { - StartWave(m_uiNextWaveIndex); - m_uiNextWave_Timer = 0; - m_uiNextWaveIndex++; - m_uiWave_Timer = DELAY_BETWEEN_WAVE; - } - else - m_uiWave_Timer -= uiDiff; - } - else if (m_uiNextWaveIndex == WAVE_MAX) // Rajaxx - { - if (IsCurrentWaveDead()) - { - DoScriptText(SAY_WAVE8, m_creature); - m_creature->SetInCombatWithZone(); - m_uiNextWaveIndex++; - } - } - } - - if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) - return; - - // ThunderCrash - if (m_uiThunderCrash_Timer < uiDiff) - { - if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THUNDERCRASH) == CAST_OK) - { - m_uiThunderCrash_Timer = urand(18000, 22000); - m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -100); - if (Unit* victim = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) - m_creature->AI()->AttackStart(victim); - } - } - else - m_uiThunderCrash_Timer -= uiDiff; - - // ResetAggro - if (m_uiResetAggro_Timer < uiDiff) - { - m_uiResetAggro_Timer = urand(15000, 17000); - DoScriptText(SAY_DEAGGRO, m_creature, m_creature->GetVictim()); - m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -100); - } - else - m_uiResetAggro_Timer -= uiDiff; - - /* Trash */ - if (m_uiTrash_Timer < uiDiff) - { - if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TRASH) == CAST_OK) - m_uiTrash_Timer = urand(19000, 23000); - } - else - m_uiTrash_Timer -= uiDiff; - - // Disarm - if (m_uiDisarm_Timer < uiDiff) - { - if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DISARM) == CAST_OK) - m_uiDisarm_Timer = 15000; - } - else - m_uiDisarm_Timer -= uiDiff; - - DoMeleeAttackIfReady(); - } -}; - -struct boss_rajaxxAQWarAI : public boss_rajaxxAI -{ - boss_rajaxxAQWarAI(Creature* pCreature) : boss_rajaxxAI(pCreature) - { - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_NPC); - - DoScriptText(SAY_AQ_WAR_START, m_creature); - } - - void UpdateAI(uint32 const /*uiDiff*/) override {} - - bool FillLoot(Loot* loot, Player* looter) const override - { - return true; // Do nothing. No loot drop out here. - } -}; - -struct npc_andorovAI : public ScriptedAI -{ - npc_andorovAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData(); - Reset(); - } - - ScriptedInstance* m_pInstance; - - uint32 m_uiCommandAura_Timer; - uint32 m_uiBash_Timer; - uint32 m_uiStrike_Timer; - - void Reset() override - { - m_uiCommandAura_Timer = 10000; - m_uiBash_Timer = 5000; - m_uiStrike_Timer = 15000; - m_creature->SetWalk(false); - - if (m_pInstance && m_pInstance->GetData(TYPE_RAJAXX) == NOT_STARTED) - m_pInstance->SetData(TYPE_GENERAL_ANDOROV, NOT_STARTED); - } - - void JustDied(Unit *pKiller) override - { - if (!m_pInstance) - return; - - if (Creature* pRajaxx = m_pInstance->GetCreature(m_pInstance->GetData64(DATA_RAJAXX))) - { - if (pRajaxx->IsAlive()) - DoScriptText(SAY_KILLS_ANDOROV, pRajaxx); - } - - m_pInstance->SetData(TYPE_GENERAL_ANDOROV, FAIL); - } - - void MovementInform(uint32 uiType, uint32 uiPointId) override - { - DEBUG_EMOTE_YELL(m_creature, "DEBUG : Move inform"); - if (uiType != WAYPOINT_MOTION_TYPE) - return; - - if (uiPointId == 1) - DoScriptText(SAY_ANDOROV_INTRO2, m_creature); - - m_creature->SetWalk(false); - if ((uiPointId + 1) == ANDOROV_WAYPOINT_MAX) - { - DEBUG_EMOTE_YELL(m_creature, "DEBUG : Andorov Done"); - m_pInstance->SetData(TYPE_GENERAL_ANDOROV, DONE); - StartBattle(); - } - } - - void StartEvent() - { - if (!m_pInstance) - return; - - if (m_pInstance->GetData(TYPE_GENERAL_ANDOROV) == NOT_STARTED) - { - DoScriptText(SAY_ANDOROV_INTRO, m_creature); - - m_creature->GetMotionMaster()->MoveWaypoint(0, 0, 0, 0, 0, false); - - m_pInstance->SetData(TYPE_GENERAL_ANDOROV, IN_PROGRESS); - } - else if (m_pInstance->GetData(TYPE_GENERAL_ANDOROV) == DONE) - StartBattle(); - } - - void StartBattle() - { - DEBUG_EMOTE_YELL(m_creature, "DEBUG : Start Battle"); - if (!m_pInstance) - return; - - if (m_pInstance->GetData(TYPE_RAJAXX) == NOT_STARTED) - { - DoScriptText(SAY_ANDOROV_READY, m_creature); - DoScriptText(SAY_ANDOROV_ATTACK, m_creature); - m_creature->HandleEmoteCommand(EMOTE_STATE_READY1H); - - m_pInstance->SetData(TYPE_RAJAXX, IN_PROGRESS); - } - } - - void UpdateAI(uint32 const uiDiff) override - { - if (!m_pInstance) - return; - - // Join battle if it started without us. - if (m_pInstance->GetData(TYPE_RAJAXX) == IN_PROGRESS && - m_pInstance->GetData(TYPE_GENERAL_ANDOROV) == NOT_STARTED) - StartEvent(); - - if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) - return; - - // Bash - if (m_uiBash_Timer < uiDiff) - { - if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BASH) == CAST_OK) - m_uiBash_Timer = 30000; - } - else - m_uiBash_Timer -= uiDiff; - - // Strike - if (m_uiStrike_Timer < uiDiff) - { - if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_STRIKE) == CAST_OK) - m_uiStrike_Timer = 15000; - } - else - m_uiStrike_Timer -= uiDiff; - - // Aura of command - if (m_uiCommandAura_Timer < uiDiff) - { - if (DoCastSpellIfCan(m_creature, SPELL_AURA_OF_COMMAND) == CAST_OK) - m_uiCommandAura_Timer = 15000; - } - else - m_uiCommandAura_Timer -= uiDiff; - - DoMeleeAttackIfReady(); - } - - void OnScriptEventHappened(uint32 uiEvent, uint32 uiData, WorldObject* pInvoker) override - { - if (pInvoker && pInvoker->IsPlayer()) - StartEvent(); - } -}; - -CreatureAI* GetAI_boss_rajaxx(Creature* pCreature) -{ - if (pCreature->GetMapId() == 1) - return new boss_rajaxxAQWarAI(pCreature); - - return new boss_rajaxxAI(pCreature); -} - -CreatureAI* GetAI_npc_andorov(Creature* pCreature) -{ - return new npc_andorovAI(pCreature); -} - -void AddSC_boss_rajaxx() -{ - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_andorov"; - newscript->GetAI = &GetAI_npc_andorov; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_rajaxx"; - newscript->GetAI = &GetAI_boss_rajaxx; - newscript->RegisterSelf(); -} diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp index 59313754c..5c82d65ef 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp @@ -22,6 +22,7 @@ SDCategory: Ruins of Ahn'Qiraj EndScriptData */ #include "scriptPCH.h" +#include "Group.h" #include "CreatureGroups.h" #include "ruins_of_ahnqiraj.h" @@ -33,8 +34,6 @@ instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj(Map* pMap) : ScriptedInst void instance_ruins_of_ahnqiraj::Initialize() { m_uiKurinnaxxGUID = 0; - for (uint32 & waveIndex : m_uiWaveMembersCount) - waveIndex = WAVE_MEMBERS_INIT_COUNT; m_uiBuruGUID = 0; m_uiOssirianGUID = 0; m_uiAndorovGUID = 0; @@ -137,9 +136,26 @@ void instance_ruins_of_ahnqiraj::OnCreatureEnterCombat(Creature * pCreature) if (CreatureGroup* g = pCreature->GetCreatureGroup()) if (g->GetOriginalLeaderGuid().GetEntry() == NPC_MAJOR_YEGGETH) m_lYeggethShieldList.push_back(pCreature->GetGUID()); - // If any creature from Rajaxx's wave enters combat, start Rajaxx event. - if (m_auiEncounter[TYPE_RAJAXX] == NOT_STARTED) - SetData(TYPE_RAJAXX, IN_PROGRESS); + + // Fight Change in 1.10.1 + // https://wowpedia.fandom.com/wiki/General_Rajaxx?oldid=180046 + // "Second, the strategy to NOT talk to the NPCs before you start the fight," + // "and just call them at the end to help with Rajaxx himself no longer works," + // "as soon as you pull the liutenant runs in with his group and starts to fight," + // "and actually blizzard even goofed that, if u pull before talking to the NPCs," + // "the NPCs run right past the first wave and wait at the door for them." + if (m_auiEncounter[TYPE_RAJAXX] != DONE && + (m_auiEncounter[TYPE_GENERAL_ANDOROV] == NOT_STARTED || m_auiEncounter[TYPE_GENERAL_ANDOROV] == FAIL) && + sWorld.GetWowPatch() >= WOW_PATCH_110) + { + if (Creature* pAndorov = instance->GetCreature(m_uiAndorovGUID)) + { + if (!pAndorov->IsAlive()) + pAndorov->Respawn(); + GetMap()->ScriptsStart(sGenericScripts, ANDOROV_START_SCRIPT, pAndorov->GetObjectGuid(), pAndorov->GetObjectGuid()); + SetData(TYPE_GENERAL_ANDOROV, IN_PROGRESS); + } + } m_bRajaxxEventIsToReset = false; // no break case NPC_KURINNAXX: @@ -216,16 +232,16 @@ void instance_ruins_of_ahnqiraj::OnCreatureCreate(Creature* pCreature) switch (pCreature->GetEntry()) { case NPC_KURINNAXX: - m_uiKurinnaxxGUID = pCreature->GetGUID(); + m_uiKurinnaxxGUID = pCreature->GetGUID(); break; case NPC_CAPTAIN_QEEZ: - m_uiQeezGUID = pCreature->GetGUID(); + m_uiQeezGUID = pCreature->GetGUID(); break; case NPC_CAPTAIN_TUUBID: m_uiTuubidGUID = pCreature->GetGUID(); break; case NPC_CAPTAIN_DRENN: - m_uiDrennGUID = pCreature->GetGUID(); + m_uiDrennGUID = pCreature->GetGUID(); break; case NPC_CAPTAIN_XURREM: m_uiXurremGUID = pCreature->GetGUID(); @@ -234,39 +250,25 @@ void instance_ruins_of_ahnqiraj::OnCreatureCreate(Creature* pCreature) m_uiYeggethGUID = pCreature->GetGUID(); break; case NPC_MAJOR_PAKKON: - m_uiPakkonGUID = pCreature->GetGUID(); + m_uiPakkonGUID = pCreature->GetGUID(); break; case NPC_COLONEL_ZERRAN: m_uiZerranGUID = pCreature->GetGUID(); break; case NPC_RAJAXX: - m_uiRajaxxGUID = pCreature->GetGUID(); + m_uiRajaxxGUID = pCreature->GetGUID(); break; case NPC_BURU: - m_uiBuruGUID = pCreature->GetGUID(); + m_uiBuruGUID = pCreature->GetGUID(); break; case NPC_OSSIRIAN: - m_uiOssirianGUID = pCreature->GetGUID(); + m_uiOssirianGUID = pCreature->GetGUID(); break; case NPC_GENERAL_ANDOROV: - // Andorov is spawn only if Kurinnaxx is dead and Rajaxx alive. m_uiAndorovGUID = pCreature->GetGUID(); - if ((m_auiEncounter[TYPE_KURINNAXX] != DONE) || (m_auiEncounter[TYPE_RAJAXX] == DONE)) - { - pCreature->ForcedDespawn(0); - pCreature->SetRespawnTime(AQ_RESPAWN_5_MINUTES); - // pCreature->SetRespawnTime(AQ_RESPAWN_FOUR_DAYS); - } break; case NPC_KALDOREI_ELITE: - // Elites are spawn only if Kurinnaxx is dead and Rajaxx alive. m_lKaldoreiElites.push_back(pCreature->GetGUID()); - if ((m_auiEncounter[TYPE_KURINNAXX] != DONE) || (m_auiEncounter[TYPE_RAJAXX] == DONE)) - { - pCreature->ForcedDespawn(0); - pCreature->SetRespawnTime(AQ_RESPAWN_5_MINUTES); - // pCreature->SetRespawnTime(AQ_RESPAWN_FOUR_DAYS); - } break; default: break; @@ -306,6 +308,9 @@ void instance_ruins_of_ahnqiraj::OnCreatureDeath(Creature* pCreature) case NPC_MOAM: case NPC_AYAMISS: case NPC_OSSIRIAN: + if (pCreature->GetEntry() == NPC_RAJAXX) + GiveRepAfterRajaxxDeath(pCreature); + if (m_bIsAQDoorOn) { if (GameObject* door = pCreature->GetMap()->GetGameObject(p_doorGuid)) @@ -323,20 +328,11 @@ void instance_ruins_of_ahnqiraj::OnCreatureDeath(Creature* pCreature) case NPC_COLONEL_ZERRAN: case NPC_SWARMGUARD_NEEDLER: case NPC_QIRAJI_WARRIOR: - if (pCreature->GetEntry() == NPC_SWARMGUARD_NEEDLER || pCreature->GetEntry() == NPC_QIRAJI_WARRIOR) { pCreature->ForcedDespawn(3000); pCreature->SetRespawnTime(AQ_RESPAWN_FOUR_DAYS); } - // Count deaths in Rajaxx's waves - if (GetWaveFromCreature(pCreature) > 0) - { - uint8 waveIndex = GetWaveFromCreature(pCreature) - 1; - ASSERT(waveIndex < WAVE_MAX); - if (m_uiWaveMembersCount[waveIndex] > 0) - m_uiWaveMembersCount[waveIndex]--; - } break; case NPC_GENERAL_ANDOROV: pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); @@ -368,15 +364,6 @@ uint32 instance_ruins_of_ahnqiraj::GetData(uint32 uiType) case TYPE_AYAMISS: case TYPE_OSSIRIAN: return m_auiEncounter[uiType]; - case TYPE_WAVE1: - case TYPE_WAVE2: - case TYPE_WAVE3: - case TYPE_WAVE4: - case TYPE_WAVE5: - case TYPE_WAVE6: - case TYPE_WAVE7: - ASSERT(uiType - WAVE_OFFSET < WAVE_MAX); - return m_uiWaveMembersCount[uiType - WAVE_OFFSET]; default: return 0; } @@ -393,10 +380,6 @@ void instance_ruins_of_ahnqiraj::SetData(uint32 uiType, uint32 uiData) m_uiGladiatorDeath = 0; return; case TYPE_KURINNAXX: - /** Spawn Andorov 3 minutes after Kurinaxx death */ - if (uiData == DONE) - SetAndorovSquadRespawnTime(AQ_RESPAWN_3_MINUTES); - m_auiEncounter[TYPE_KURINNAXX] = uiData; break; case TYPE_GENERAL_ANDOROV: @@ -407,7 +390,7 @@ void instance_ruins_of_ahnqiraj::SetData(uint32 uiType, uint32 uiData) } if (uiData == IN_PROGRESS) { - SetAndorovSquadFaction(1254); + SetAndorovSquadImmunity(false); if (Creature* pAndorov = instance->GetCreature(m_uiAndorovGUID)) { pAndorov->SetDefaultGossipMenuId(ANDOROV_GOSSIP_IN_PROGRESS); @@ -422,10 +405,6 @@ void instance_ruins_of_ahnqiraj::SetData(uint32 uiType, uint32 uiData) /** Respawn Andorov and elite in 15 minutes */ if (m_auiEncounter[TYPE_KURINNAXX] == DONE) SetAndorovSquadRespawnTime(AQ_RESPAWN_15_MINUTES); - - /** Reset waves casualties count */ - for (uint32 & waveIndex : m_uiWaveMembersCount) - waveIndex = WAVE_MEMBERS_INIT_COUNT; } if (uiData == DONE) { @@ -440,20 +419,11 @@ void instance_ruins_of_ahnqiraj::SetData(uint32 uiType, uint32 uiData) pAndorov->SetDefaultGossipMenuId(ANDOROV_GOSSIP_DONE); pAndorov->SetRespawnTime(AQ_RESPAWN_FOUR_DAYS); } - ForceAndorovSquadDespawn(120000); // Andorov disapears 2 minutes after end of combat + SetAndorovSquadImmunity(true); } m_bRajaxxEventIsToReset = false; m_auiEncounter[TYPE_RAJAXX] = uiData; break; - case TYPE_WAVE1: - case TYPE_WAVE2: - case TYPE_WAVE3: - case TYPE_WAVE4: - case TYPE_WAVE5: - case TYPE_WAVE6: - case TYPE_WAVE7: - m_uiWaveMembersCount[uiType - WAVE_OFFSET] = uiData; - break; case TYPE_OSSIRIAN: if (uiData == FAIL || uiData == DONE) { @@ -526,6 +496,15 @@ void instance_ruins_of_ahnqiraj::Load(char const* chrIn) void instance_ruins_of_ahnqiraj::Update(uint32 uiDiff) { + if (m_auiEncounter[TYPE_KURINNAXX] == DONE && m_auiEncounter[TYPE_RAJAXX] != DONE && !m_uiAndorovGUID) + { + if (Creature* pAndorov = GetMap()->LoadCreatureSpawnWithGroup(ANDOROV_DB_GUID)) + { + pAndorov->SetDefaultGossipMenuId(ANDOROV_GOSSIP_IN_PROGRESS); + pAndorov->GetMotionMaster()->MoveWaypoint(0, 0, 0, 0, 0, false); + } + } + if (m_bRajaxxEventIsToReset) { if (m_uiRajaxxEventResetTimer < uiDiff) @@ -599,36 +578,95 @@ void instance_ruins_of_ahnqiraj::SetAndorovSquadRespawnTime(uint32 nextRespawnDe } } -void instance_ruins_of_ahnqiraj::SetAndorovSquadFaction(uint32 faction) +void instance_ruins_of_ahnqiraj::SetAndorovSquadImmunity(bool immune) { if (Creature* pAndorov = instance->GetCreature(m_uiAndorovGUID)) { - pAndorov->SetFactionTemplateId(faction); - pAndorov->SetPvP(true); + if (immune) + pAndorov->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + else + pAndorov->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); } for (const auto& guid : m_lKaldoreiElites) { if (Creature* pElite = instance->GetCreature(guid)) { - pElite->SetFactionTemplateId(faction); - pElite->SetPvP(true); + if (immune) + pElite->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + else + pElite->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); } } } -void instance_ruins_of_ahnqiraj::ForceAndorovSquadDespawn(uint32 timeToDespawn) +void instance_ruins_of_ahnqiraj::GiveRepAfterRajaxxDeath(Creature* pRajaxx) { - if (Creature* pAndorov = instance->GetCreature(m_uiAndorovGUID)) + FactionEntry const *factionEntry = sObjectMgr.GetFactionEntry(609); // Cenarion Circle + if (!factionEntry) { - pAndorov->ForcedDespawn(timeToDespawn); - pAndorov->SetRespawnTime(AQ_RESPAWN_FOUR_DAYS); + sLog.Out(LOG_BASIC, LOG_LVL_ERROR, "Rajaxx just died, unable to find Cenarion Circle faction"); + return; } - for (const auto& guid : m_lKaldoreiElites) + + bool andorovAlive = false; + if (Creature* pAndorov = instance->GetCreature(m_uiAndorovGUID)) + if (pAndorov->IsAlive()) + andorovAlive = true; + + std::list helpers; + GetCreatureListWithEntryInGrid(helpers, pRajaxx, NPC_KALDOREI_ELITE, 400.0f); + + int helpersAlive = 0; + for (const auto it : helpers) { - if (Creature* pElite = instance->GetCreature(guid)) + if (it->IsAlive()) { - pElite->ForcedDespawn(timeToDespawn); - pElite->SetRespawnTime(AQ_RESPAWN_FOUR_DAYS); + helpersAlive++; + if (!andorovAlive) + { + it->DespawnOrUnsummon(); // kaldorei despawn if andorov is dead + it->SetRespawnTime(AQ_RESPAWN_FOUR_DAYS); + } + } + } + + if (andorovAlive) + helpersAlive++; + + // Rep gain was buffed in patch 1.10. + // Old - https://www.youtube.com/watch?v=NOF6xI7Iwj8 + // New - https://www.youtube.com/watch?v=ETO4UsKbKOY + int const repForKill = sWorld.GetWowPatch() >= WOW_PATCH_110 ? 50 : irand(33, 34); + int const repPerHelper = sWorld.GetWowPatch() >= WOW_PATCH_110 ? 45 : 30; + + auto GiveRep = [factionEntry, helpersAlive, repForKill, repPerHelper](Player* pPlayer) + { + uint32 current_reputation_rank1 = pPlayer->GetReputationMgr().GetRank(factionEntry); + if (factionEntry && current_reputation_rank1 <= 7) + { + for (int i = 0; i < 3; i++) + pPlayer->GetReputationMgr().ModifyReputation(factionEntry, repForKill); + + // you get 45 rep for every alive helper + for (int i = 0; i < helpersAlive; i++) + pPlayer->GetReputationMgr().ModifyReputation(factionEntry, repPerHelper); + } + }; + + if (Player* pLootRecepient = pRajaxx->GetLootRecipient()) + { + GiveRep(pLootRecepient); + + if (Group* pGroup = pLootRecepient->GetGroup()) + { + for (GroupReference *itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) + { + Player* pGroupGuy = itr->getSource(); + if (!pGroupGuy || !pGroupGuy->IsInWorld() || pGroupGuy == pLootRecepient) + continue; + + GiveRep(pGroupGuy); + } } } } diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.h b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.h index 115552a5e..9d8ada743 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.h +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.h @@ -29,22 +29,6 @@ enum TYPE_QIRAJI_GLADIATOR = 8, }; -/* This type of data = the count of living mobs in each wave. - The instance counts down thanks to OnCreatureDeath */ -#define WAVE_MAX 7 -#define WAVE_OFFSET 10 -#define WAVE_MEMBERS_INIT_COUNT 7 -enum -{ - TYPE_WAVE1 = WAVE_OFFSET, - TYPE_WAVE2 = WAVE_OFFSET+1, - TYPE_WAVE3 = WAVE_OFFSET+2, - TYPE_WAVE4 = WAVE_OFFSET+3, - TYPE_WAVE5 = WAVE_OFFSET+4, - TYPE_WAVE6 = WAVE_OFFSET+5, - TYPE_WAVE7 = WAVE_OFFSET+6 -}; - enum { DATA_KURINNAXX = 0, @@ -93,12 +77,18 @@ enum ANDOROV_GOSSIP_IN_PROGRESS = 7048, ANDOROV_GOSSIP_DONE = 7047, + // Guids + ANDOROV_DB_GUID = 301311, + + // Scripts + ANDOROV_START_SCRIPT = 154710, + // Crystal Weaknesses - SPELL_FIRE_WEAKNESS = 25177, - SPELL_NATURE_WEAKNESS = 25180, - SPELL_FROST_WEAKNESS = 25178, - SPELL_ARCANE_WEAKNESS = 25171, - SPELL_SHADOW_WEAKNESS = 25183, + SPELL_FIRE_WEAKNESS = 25177, + SPELL_NATURE_WEAKNESS = 25180, + SPELL_FROST_WEAKNESS = 25178, + SPELL_ARCANE_WEAKNESS = 25171, + SPELL_SHADOW_WEAKNESS = 25183, GO_OSSIRIAN_CRYSTAL = 180619, CRYSTAL_TRIGGER = 15590 @@ -149,11 +139,10 @@ public: private: uint8 GetWaveFromCreature(Creature* creature); void SetAndorovSquadRespawnTime(uint32 nextRespawnDelay); - void SetAndorovSquadFaction(uint32 faction); - void ForceAndorovSquadDespawn(uint32 timeToDespawn); + void SetAndorovSquadImmunity(bool immune); + void GiveRepAfterRajaxxDeath(Creature* pRajaxx); uint32 m_auiEncounter[INSTANCE_RUINS_AQ_MAX_ENCOUNTER]; - uint32 m_uiWaveMembersCount[WAVE_MAX]; uint64 m_uiKurinnaxxGUID; uint64 m_uiBuruGUID;