diff --git a/sql/updates/world/3.3.5/2025_12_28_00_world.sql b/sql/updates/world/3.3.5/2025_12_28_00_world.sql new file mode 100644 index 00000000000..fb53a760b09 --- /dev/null +++ b/sql/updates/world/3.3.5/2025_12_28_00_world.sql @@ -0,0 +1,175 @@ +-- +UPDATE `gossip_menu_option` SET `MenuID` = 202 WHERE `MenuID` = 201; + +UPDATE `smart_scripts` SET `action_param1` = 0, `action_param3` = 1 WHERE `entryorguid` = 3669 AND `source_type` = 0 AND `id` = 0; +UPDATE `smart_scripts` SET `action_param1` = 1, `action_param3` = 1 WHERE `entryorguid` = 3670 AND `source_type` = 0 AND `id` = 0; +UPDATE `smart_scripts` SET `action_param1` = 2, `action_param3` = 1 WHERE `entryorguid` = 3671 AND `source_type` = 0 AND `id` = 0; +UPDATE `smart_scripts` SET `action_param1` = 3, `action_param3` = 1 WHERE `entryorguid` = 3673 AND `source_type` = 0 AND `id` = 0; +UPDATE `smart_scripts` SET `action_param1` = 4, `action_param3` = 1 WHERE `entryorguid` = 3654 AND `source_type` = 0 AND `id` = 0; + +UPDATE `creature_template` SET `unit_flags` = 0 WHERE `entry` = 3678; + +UPDATE `creature_template` SET `flags_extra` = `flags_extra` |512 WHERE `entry` IN (3678,3679); + +DELETE FROM `creature_text` WHERE `CreatureID` IN (3678,3679); +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES +(3678,0,0,"At last! Naralex can be awakened! Come aid me, brave adventurers!",14,0,100,0,0,0,2101,0,"Disciple of Naralex SAY_ALL_DONE"), +(3678,1,0,"I must make the necessary preparations before the awakening ritual can begin. You must protect me!",12,0,100,1,0,0,1255,0,"Disciple of Naralex SAY_PROGRESS_1"), +(3678,2,0,"These caverns were once a temple of promise for regrowth in the Barrens. Now, they are the halls of nightmares.",12,0,100,1,0,0,1256,0,"Disciple of Naralex SAY_PROGRESS_2"), +(3678,3,0,"Come. We must continue. There is much to be done before we can pull Naralex from his nightmare.",12,0,100,25,0,0,1257,0,"Disciple of Naralex SAY_PROGRESS_3"), +(3678,4,0,"Within this circle of fire I must cast the spell to banish the spirits of the slain Fanglords.",12,0,100,0,0,0,1258,0,"Disciple of Naralex SAY_PROGRESS_4"), +(3678,5,0,"The caverns have been purified. To Naralex's chamber we go!",12,0,100,1,0,0,1259,0,"Disciple of Naralex SAY_PROGRESS_5"), +(3678,6,0,"Beyond this corridor, Naralex lies in fitful sleep. Let us go awaken him before it is too late.",12,0,100,25,0,0,1263,0,"Disciple of Naralex SAY_PROGRESS_6"), +(3678,7,0,"Protect me brave souls as I delve into the Emerald Dream to rescue Naralex and put an end to this corruption!",12,0,100,20,0,0,1264,0,"Disciple of Naralex SAY_PROGRESS_7"), +(3678,8,0,"%s begins to perform the awakening ritual on Naralex.",16,0,100,0,0,0,1265,0,"Disciple of Naralex SAY_PROGRESS_8"), +(3678,9,0,"At last! Naralex awakes from the nightmare.",12,0,100,25,0,0,1267,0,"Disciple of Naralex SAY_PROGRESS_9"), + +(3678,10,0,"Attacked! Help get this $n off of me!",12,0,100,0,0,0,1273,0,"Disciple of Naralex SAY_AGGRO"), +(3678,10,1,"Deal with this $n! I need to prepare to awake Naralex!",12,0,100,0,0,0,1274,0,"Disciple of Naralex SAY_AGGRO"), +(3678,10,2,"I can't handle this $n alone! Help!",12,0,100,0,0,0,1275,0,"Disciple of Naralex SAY_AGGRO"), +(3678,10,3,"This $n is a minion from Naralex's nightmare no doubt!",12,0,100,0,0,0,1276,0,"Disciple of Naralex SAY_AGGRO"), +(3678,10,4,"Help!",12,0,100,0,0,0,1277,0,"Disciple of Naralex SAY_AGGRO"), + +(3679,0,0,"%s tosses fitfully in troubled sleep.",16,0,100,0,0,0,1268,0,"Naralex EMOTE_AWAKENING_1"), +(3679,1,0,"%s writhes in agony. The Disciple seems to be breaking through.",16,0,100,0,0,0,1269,0,"Naralex EMOTE_AWAKENING_2"), +(3679,2,0,"%s dreams up a horrendous vision. Something stirs beneath the murky waters.",16,0,100,0,0,0,1270,0,"Naralex EMOTE_AWAKENING_3"), +(3679,3,0,"I AM AWAKE, AT LAST!",14,0,100,15,0,5789,1271,0,"Naralex SAY_AWAKENING_4"), +(3679,4,0,"Ah, to be pulled from the dreaded nightmare! I thank you, my loyal Disciple, along with your brave companions.",12,0,100,2,0,0,1272,0,"Naralex SAY_AWAKENING_5"), +(3679,5,0,"We must go and gather with the other Disciples. There is much work to be done before I can make another attempt to restore the Barrens. Farewell, brave souls!",12,0,100,1,0,0,2103,0,"Naralex SAY_AWAKENING_6"); + +DELETE FROM `creature_summon_groups` WHERE `summonerId` = 3678 AND `summonerType` = 0; +INSERT INTO `creature_summon_groups` (`summonerId`,`summonerType`,`groupId`,`entry`,`position_x`,`position_y`,`position_z`,`orientation`,`summonType`,`summonTime`,`Comment`) VALUES +(3678,0,0,3636,-67.947014,206.72076,-93.50498,1.890911,6,300000,"Disciple of Naralex - Group 0 - Deviate Ravager"), +(3678,0,0,3636,-69.287880,211.94266,-93.44985,4.095106,6,300000,"Disciple of Naralex - Group 0 - Deviate Ravager"), + +(3678,0,1,5048,-60.2539,273.098,-92.760864,0.40142572,6,300000,"Disciple of Naralex - Group 1 - Deviate Adder"), +(3678,0,1,5048,-50.1238,274.717,-92.760864,3.03687290,6,300000,"Disciple of Naralex - Group 1 - Deviate Adder"), +(3678,0,1,5048,-57.5453,280.207,-92.760864,5.07890800,6,300000,"Disciple of Naralex - Group 1 - Deviate Adder"), + +(3678,0,2,5762,171.395,213.766,-105.507670,5.0440016,6,300000,"Disciple of Naralex - Group 2 - Deviate Moccasin"), +(3678,0,2,5762,171.690,213.234,-105.419660,1.6231562,6,300000,"Disciple of Naralex - Group 2 - Deviate Moccasin"), +(3678,0,2,5762,178.669,262.253,-106.152664,1.3264502,6,300000,"Disciple of Naralex - Group 2 - Deviate Moccasin"), + +(3678,0,3,5763,125.646,169.517,-106.152664,0.94247776,6,300000,"Disciple of Naralex - Group 3 - Nightmare Ectoplasm"), +(3678,0,3,5763,155.845,186.688,-107.083664,0.05235988,6,300000,"Disciple of Naralex - Group 3 - Nightmare Ectoplasm"), +(3678,0,3,5763,162.067,218.715,-105.362660,1.98967530,6,300000,"Disciple of Naralex - Group 3 - Nightmare Ectoplasm"), +(3678,0,3,5763,96.7788,283.762,-104.785670,3.82227100,6,300000,"Disciple of Naralex - Group 3 - Nightmare Ectoplasm"), +(3678,0,3,5763,126.322,282.248,-103.797660,0.94247776,6,300000,"Disciple of Naralex - Group 3 - Nightmare Ectoplasm"), +(3678,0,3,5763,164.627,274.123,-107.297660,4.66002900,6,300000,"Disciple of Naralex - Group 3 - Nightmare Ectoplasm"), +(3678,0,3,5763,144.843,278.079,-104.574660,4.43313650,6,300000,"Disciple of Naralex - Group 3 - Nightmare Ectoplasm"), + +(3678,0,4,3654,150.943,262.797,-103.90366,3.700098,6,300000,"Disciple of Naralex - Group 4 - Mutanus the Devourer"); + +DELETE FROM `waypoint_data` WHERE `id` = 29426; + +DELETE FROM `waypoint_data` WHERE `id` IN (367800,367801,367802,367803,367804,367900); +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_type`,`action`,`action_chance`,`wpguid`) VALUES +(367800,1,-113.91917,142.769,-80.914154,NULL,0,0,0,100,0), +(367800,2,-111.23017,153.39638,-80.598915,NULL,0,0,0,100,0), +(367800,3,-110.97073,165.60736,-79.444725,NULL,0,0,0,100,0), +(367800,4,-109.30049,181.25143,-79.76007,NULL,0,0,0,100,0), +(367800,5,-110.1942,190.9626,-80.42993,NULL,0,0,0,100,0), +(367800,6,-109.58964,199.15425,-81.23881,NULL,0,0,0,100,0), +(367800,7,-110.56909,206.86935,-82.88934,NULL,0,0,0,100,0), +(367800,8,-110.30787,216.23227,-85.9362,NULL,0,0,0,100,0), +(367800,9,-108.06385,227.87166,-89.926414,NULL,0,0,0,100,0), +(367800,10,-104.28827,234.40804,-91.64163,NULL,0,0,0,100,0), + +(367801,1,-99.53033,230.78362,-91.13202,NULL,0,0,0,100,0), +(367801,2,-97.78033,229.78362,-90.88202,NULL,0,0,0,100,0), +(367801,3,-95.03033,229.03362,-90.38202,NULL,0,0,0,100,0), +(367801,4,-93.78033,228.78362,-90.38202,NULL,0,0,0,100,0), +(367801,5,-91.78033,228.28362,-90.38202,NULL,0,0,0,100,0), +(367801,6,-90.78033,228.28362,-91.13202,NULL,0,0,0,100,0), +(367801,7,-87.28033,227.78362,-92.38202,NULL,0,0,0,100,0), +(367801,8,-85.272385,227.1592,-93.12241,NULL,0,0,0,100,0), +(367801,9,-81.619774,223.63588,-93.58602,NULL,0,0,0,100,0), +(367801,10,-71.02429,212.48766,-93.52011,NULL,0,0,0,100,0), +(367801,11,-66.8499,209.88943,-93.30499,NULL,0,0,0,100,0), +(367801,12,-61.41215,207.00401,-93.55031,NULL,0,0,0,100,0), +(367801,13,-49.681805,204.15556,-95.96281,NULL,0,0,0,100,0), +(367801,14,-41.188667,204.99422,-96.51606,NULL,0,0,0,100,0), +(367801,15,-35.381386,212.98494,-96.097084,NULL,0,0,0,100,0), +(367801,16,-33.46709,223.27979,-95.68127,NULL,0,0,0,100,0), +(367801,17,-31.874804,231.84636,-94.49322,NULL,0,0,0,100,0), +(367801,18,-33.1077,240.3214,-93.5856,NULL,0,0,0,100,0), +(367801,19,-38.079693,250.99289,-93.11742,NULL,0,0,0,100,0), +(367801,20,-43.072884,259.32315,-92.84188,NULL,0,0,0,100,0), +(367801,21,-54.713943,273.85025,-92.84426,NULL,0,0,0,100,0), + +(367802,1,-49.880116,287.8062,-92.24503,NULL,0,0,0,100,0), +(367802,2,-47.99677,295.32455,-90.81826,NULL,0,0,0,100,0), +(367802,3,-38.468487,306.85004,-89.96177,NULL,0,0,0,100,0), +(367802,4,-34.199474,309.35944,-89.57565,NULL,0,0,0,100,0), +(367802,5,-23.514927,310.80438,-88.513176,NULL,0,0,0,100,0), +(367802,6,-9.611309,305.38797,-88.19709,NULL,0,0,0,100,0), +(367802,7,-3.915017,301.293,-86.814804,NULL,0,0,0,100,0), +(367802,8,-0.235204,294.51816,-85.46129,NULL,0,0,0,100,0), +(367802,9,3.204272,288.31448,-85.4905,NULL,0,0,0,100,0), +(367802,10,10.753059,278.38467,-85.8368,NULL,0,0,0,100,0), +(367802,11,16.977774,273.39676,-86.23834,NULL,0,0,0,100,0), +(367802,12,25.977861,264.6067,-86.788,NULL,0,0,0,100,0), +(367802,13,29.228964,257.175,-87.57598,NULL,0,0,0,100,0), +(367802,14,30.13821,248.86757,-87.36985,NULL,0,0,0,100,0), +(367802,15,38.86757,240.09755,-87.588615,NULL,0,0,0,100,0), +(367802,16,43.998184,234.17651,-87.98252,NULL,0,0,0,100,0), +(367802,17,48.403416,229.11066,-88.36456,NULL,0,0,0,100,0), +(367802,18,54.5601,210.85043,-89.80927,NULL,0,0,0,100,0), + +(367803,1,67.69076,205.52835,-92.56347,NULL,0,0,0,100,0), +(367803,2,71.46944,206.84753,-93.108925,NULL,0,0,0,100,0), +(367803,3,77.15617,209.72255,-93.07799,NULL,0,0,0,100,0), +(367803,4,80.431854,214.86958,-93.177925,NULL,0,0,0,100,0), +(367803,5,83.29396,220.0915,-93.69437,NULL,0,0,0,100,0), +(367803,6,86.2444,225.64459,-94.54216,NULL,0,0,0,100,0), +(367803,7,89.99905,229.58038,-95.01256,NULL,0,0,0,100,0), +(367803,8,94.13328,232.7041,-95.36724,NULL,0,0,0,100,0), +(367803,9,99.00888,233.9866,-95.57549,NULL,0,0,0,100,0), +(367803,10,104.59536,233.409,-95.82651,NULL,0,0,0,100,0), +(367803,11,109.07845,232.6175,-96.046,NULL,0,0,0,100,0), +(367803,12,112.8708,233.57512,-96.32112,NULL,0,0,0,100,0), +(367803,13,114.51453,235.30222,-96.160706,NULL,0,0,0,100,0), +(367803,14,114.94154,237.7185,-96.02783,NULL,0,0,0,100,0), + +(367804,1,119.04473,234.3336,-94.031525,NULL,0,1,0,100,0), +(367804,2,123.39298,232.1507,-93.80932,NULL,0,1,0,100,0), +(367804,3,129.23982,232.90259,-94.39268,NULL,0,1,0,100,0), +(367804,4,133.76927,236.9294,-95.39268,NULL,0,1,0,100,0), +(367804,5,136.03003,244.8155,-95.80936,NULL,0,1,0,100,0), +(367804,6,134.06624,253.92725,-95.1149,NULL,0,1,0,100,0), +(367804,7,123.16401,266.276,-93.587135,NULL,0,1,0,100,0), +(367804,8,113.3055,265.7754,-91.4482,NULL,0,1,0,100,0), +(367804,9,95.87152,250.9106,-87.55935,NULL,0,1,0,100,0), +(367804,10,87.43284,232.42879,-85.761505,NULL,0,1,0,100,0), +(367804,11,83.19081,218.43571,-84.08354,NULL,0,1,0,100,0), +(367804,12,70.24749,206.56226,-85.1376,NULL,0,1,0,100,0), +(367804,13,47.183872,206.66559,-83.493935,NULL,0,1,0,100,0), +(367804,14,34.54772,204.78317,-82.05306,NULL,0,1,0,100,0), +(367804,15,7.085161,202.25589,-77.79443,NULL,0,1,0,100,0), +(367804,16,-42.047256,203.44832,-83.76682,NULL,0,1,0,100,0), +(367804,17,-65.46242,208.19424,-83.76682,NULL,0,1,0,100,0), +(367804,18,-84.21845,225.56584,-83.76682,NULL,0,1,0,100,0), + +(367900,1,117.57947,245.2589,-92.93683,NULL,0,1,0,100,0), +(367900,2,122.07437,244.77504,-91.96459,NULL,0,1,0,100,0), +(367900,3,126.5081,244.80745,-91.52022,NULL,0,1,0,100,0), +(367900,4,130.2855,244.1119,-91.49244,NULL,0,1,0,100,0), +(367900,5,131.33621,246.79683,-90.96464,NULL,0,1,0,100,0), +(367900,6,131.5437,250.70665,-90.85357,NULL,0,1,0,100,0), +(367900,7,131.16864,254.23598,-90.909134,NULL,0,1,0,100,0), +(367900,8,129.56184,256.8811,-90.77021,NULL,0,1,0,100,0), +(367900,9,125.7399,260.43616,-90.35347,NULL,0,1,0,100,0), +(367900,10,120.87533,261.45663,-91.15907,NULL,0,1,0,100,0), +(367900,11,116.536,261.01016,-91.46457,NULL,0,1,0,100,0), +(367900,12,107.43984,258.64542,-91.270226,NULL,0,1,0,100,0), +(367900,13,98.73815,250.1042,-90.18684,NULL,0,1,0,100,0), +(367900,14,91.52554,238.34152,-89.32576,NULL,0,1,0,100,0), +(367900,15,88.4579,228.32156,-88.59779,NULL,0,1,0,100,0), +(367900,16,83.84989,220.01965,-86.313835,NULL,0,1,0,100,0), +(367900,17,77.0841,211.77414,-84.73362,NULL,0,1,0,100,0), +(367900,18,67.49621,205.84052,-84.928276,NULL,0,1,0,100,0), +(367900,19,53.191616,205.93796,-84.08481,NULL,0,1,0,100,0), +(367900,20,33.344265,203.22813,-79.139854,NULL,0,1,0,100,0), +(367900,21,5.091723,198.6573,-71.71256,NULL,0,1,0,100,0), +(367900,22,-32.916367,204.26924,-83.12926,NULL,0,1,0,100,0), +(367900,23,-62.042313,206.22604,-83.12926,NULL,0,1,0,100,0); diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp index e80cca280fc..6f72fcdae64 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp @@ -15,21 +15,18 @@ * with this program. If not, see . */ -/* ScriptData -SDName: Instance_Wailing_Caverns -SD%Complete: 99 -SDComment: Everything seems to work, still need some checking -SDCategory: Wailing Caverns -EndScriptData */ - #include "ScriptMgr.h" #include "Creature.h" +#include "CreatureAI.h" #include "InstanceScript.h" -#include "Log.h" -#include "Map.h" #include "wailing_caverns.h" -#define MAX_ENCOUNTER 9 +static constexpr ObjectData creatureData[] = +{ + { NPC_DISCIPLE, DATA_DISCIPLE }, + { NPC_NARALEX, DATA_NARALEX }, + { 0, 0 } // END +}; class instance_wailing_caverns : public InstanceMapScript { @@ -46,100 +43,37 @@ public: instance_wailing_caverns_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { SetHeaders(DataHeader); - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - yelled = false; + SetBossNumber(EncounterCount); + LoadObjectData(creatureData, nullptr); } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - bool yelled; - ObjectGuid NaralexGUID; - - void OnCreatureCreate(Creature* creature) override + bool SetBossState(uint32 type, EncounterState state) override { - if (creature->GetEntry() == DATA_NARALEX) - NaralexGUID = creature->GetGUID(); - } + if (!InstanceScript::SetBossState(type, state)) + return false; - void SetData(uint32 type, uint32 data) override - { switch (type) { - case TYPE_LORD_COBRAHN: m_auiEncounter[0] = data;break; - case TYPE_LORD_PYTHAS: m_auiEncounter[1] = data;break; - case TYPE_LADY_ANACONDRA: m_auiEncounter[2] = data;break; - case TYPE_LORD_SERPENTIS: m_auiEncounter[3] = data;break; - case TYPE_NARALEX_EVENT: m_auiEncounter[4] = data;break; - case TYPE_NARALEX_PART1: m_auiEncounter[5] = data;break; - case TYPE_NARALEX_PART2: m_auiEncounter[6] = data;break; - case TYPE_NARALEX_PART3: m_auiEncounter[7] = data;break; - case TYPE_MUTANUS_THE_DEVOURER: m_auiEncounter[8] = data;break; - case TYPE_NARALEX_YELLED: yelled = true; break; + case DATA_LORD_COBRAHN: + case DATA_LORD_PYTHAS: + case DATA_LADY_ANACONDRA: + case DATA_LORD_SERPENTIS: + if (state == DONE) + { + if (GetBossState(DATA_LORD_COBRAHN) == DONE && GetBossState(DATA_LORD_PYTHAS) == DONE + && GetBossState(DATA_LADY_ANACONDRA) == DONE && GetBossState(DATA_LORD_SERPENTIS) == DONE) + { + if (Creature* disciple = GetCreature(DATA_DISCIPLE)) + disciple->AI()->DoAction(ACTION_ALL_DONE); + } + } + break; + default: + break; } - if (data == DONE)SaveToDB(); + return true; } - - uint32 GetData(uint32 type) const override - { - switch (type) - { - case TYPE_LORD_COBRAHN: return m_auiEncounter[0]; - case TYPE_LORD_PYTHAS: return m_auiEncounter[1]; - case TYPE_LADY_ANACONDRA: return m_auiEncounter[2]; - case TYPE_LORD_SERPENTIS: return m_auiEncounter[3]; - case TYPE_NARALEX_EVENT: return m_auiEncounter[4]; - case TYPE_NARALEX_PART1: return m_auiEncounter[5]; - case TYPE_NARALEX_PART2: return m_auiEncounter[6]; - case TYPE_NARALEX_PART3: return m_auiEncounter[7]; - case TYPE_MUTANUS_THE_DEVOURER: return m_auiEncounter[8]; - case TYPE_NARALEX_YELLED: return yelled; - } - return 0; - } - - ObjectGuid GetGuidData(uint32 data) const override - { - if (data == DATA_NARALEX)return NaralexGUID; - return ObjectGuid::Empty; - } - - std::string GetSaveData() override - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' - << m_auiEncounter[3] << ' ' << m_auiEncounter[4] << ' ' << m_auiEncounter[5] << ' ' - << m_auiEncounter[6] << ' ' << m_auiEncounter[7] << ' ' << m_auiEncounter[8]; - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(char const* in) override - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] - >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] >> m_auiEncounter[8]; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] != DONE) - m_auiEncounter[i] = NOT_STARTED; - - OUT_LOAD_INST_DATA_COMPLETE; - } - }; - }; void AddSC_instance_wailing_caverns() diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp index 3e683d4e9f6..a195ffea501 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp @@ -15,366 +15,377 @@ * with this program. If not, see . */ -/* ScriptData -SDName: Wailing Caverns -SD%Complete: 95 -SDComment: Need to add skill usage for Disciple of Naralex -SDCategory: Wailing Caverns -EndScriptData */ - -/* ContentData -EndContentData */ - #include "ScriptMgr.h" #include "InstanceScript.h" #include "MotionMaster.h" -#include "ObjectAccessor.h" #include "Player.h" -#include "ScriptedEscortAI.h" +#include "ScriptedCreature.h" #include "ScriptedGossip.h" -#include "TemporarySummon.h" #include "wailing_caverns.h" -/*###### -## npc_disciple_of_naralex -######*/ +/* + * Spawns are supposed to be pooled, NYI + * Some spawns attack on spawn, some moves to position, NYI, all attacks on spawn currently + * This is based on Cata sniffs and WotLK classic video, timers were changed in Cata and requires to be revisited + */ -enum Enums +enum DiscipleTexts { - SAY_AT_LAST = 0, - SAY_MAKE_PREPARATIONS = 1, - SAY_TEMPLE_OF_PROMISE = 2, - SAY_MUST_CONTINUE = 3, - SAY_BANISH_THE_SPIRITS = 4, - SAY_CAVERNS_PURIFIED = 5, - SAY_BEYOND_THIS_CORRIDOR = 6, - SAY_EMERALD_DREAM = 7, - EMOTE_AWAKENING_RITUAL = 8, - EMOTE_TROUBLED_SLEEP = 0, - EMOTE_WRITHE_IN_AGONY = 1, - EMOTE_HORRENDOUS_VISION = 2, - SAY_MUTANUS_THE_DEVOURER = 9, - SAY_I_AM_AWAKE = 3, - SAY_NARALEX_AWAKES = 10, - SAY_THANK_YOU = 4, - SAY_FAREWELL = 5, - SAY_ATTACKED = 11, + // Disciple + SAY_ALL_DONE = 0, + SAY_PROGRESS_1 = 1, + SAY_PROGRESS_2 = 2, + SAY_PROGRESS_3 = 3, + SAY_PROGRESS_4 = 4, + SAY_PROGRESS_5 = 5, + SAY_PROGRESS_6 = 6, + SAY_PROGRESS_7 = 7, + SAY_PROGRESS_8 = 8, + SAY_PROGRESS_9 = 9, + SAY_AGGRO = 10, - GOSSIP_OPTION_LET_EVENT_BEGIN = 201, - NPC_TEXT_NARALEX_SLEEPS_AGAIN = 698, - NPC_TEXT_FANGLORDS_ARE_DEAD = 699, - - SPELL_MARK_OF_THE_WILD_RANK_2 = 5232, - SPELL_SERPENTINE_CLEANSING = 6270, - SPELL_NARALEXS_AWAKENING = 6271, - SPELL_FLIGHT_FORM = 33943, - - NPC_DEVIATE_RAVAGER = 3636, - NPC_DEVIATE_VIPER = 5755, - NPC_DEVIATE_MOCCASIN = 5762, - NPC_NIGHTMARE_ECTOPLASM = 5763, - NPC_MUTANUS_THE_DEVOURER = 3654, - - PATH_ESCORT_NARALEX_DISCIPLE = 29426, + // Naralex + EMOTE_AWAKENING_1 = 0, + EMOTE_AWAKENING_2 = 1, + EMOTE_AWAKENING_3 = 2, + SAY_AWAKENING_4 = 3, + SAY_AWAKENING_5 = 4, + SAY_AWAKENING_6 = 5 }; -class npc_disciple_of_naralex : public CreatureScript +enum DiscipleSpells { -public: - npc_disciple_of_naralex() : CreatureScript("npc_disciple_of_naralex") { } + SPELL_MARK_OF_THE_WILD = 5232, + SPELL_SERPENTINE_CLEANSING = 6270, + SPELL_NARALEXS_AWAKENING = 6271, + SPELL_OWL_FORM = 8153, - struct npc_disciple_of_naralexAI : public EscortAI + SPELL_SLEEP = 1090, + SPELL_DRUIDS_POTION = 8141 +}; + +enum DiscipleEvents +{ + EVENT_PROGRESS_1 = 1, + EVENT_PROGRESS_2, + EVENT_PROGRESS_3, + EVENT_PROGRESS_4, + EVENT_PROGRESS_5, + EVENT_PROGRESS_6, + EVENT_PROGRESS_7, + EVENT_PROGRESS_8, + EVENT_PROGRESS_9, + EVENT_PROGRESS_10, + EVENT_PROGRESS_11, + EVENT_PROGRESS_12, + EVENT_PROGRESS_13, + EVENT_PROGRESS_14, + EVENT_PROGRESS_15, + EVENT_PROGRESS_16, + EVENT_PROGRESS_17, + EVENT_PROGRESS_18, + EVENT_PROGRESS_19, + EVENT_PROGRESS_20, + EVENT_PROGRESS_21, + EVENT_PROGRESS_22, + EVENT_PROGRESS_23, + EVENT_PROGRESS_24, + EVENT_PROGRESS_25, + EVENT_PROGRESS_26, + EVENT_PROGRESS_27, + + EVENT_SLEEP, + EVENT_DRUIDS_POTION +}; + +enum DisciplePaths +{ + PATH_PROGRESS_1 = 367800, + PATH_PROGRESS_2 = 367801, + PATH_PROGRESS_3 = 367802, + PATH_PROGRESS_4 = 367803, + PATH_PROGRESS_5 = 367804, + PATH_NARALEX = 367900 +}; + +enum DiscipleSummonGroups +{ + SUMMON_GROUP_1 = 0, + SUMMON_GROUP_2 = 1, + SUMMON_GROUP_3 = 2, + SUMMON_GROUP_4 = 3, + SUMMON_GROUP_5 = 4 +}; + +enum DiscipleMisc +{ + GOSSIP_MENU_EVENT = 202 +}; + +// 3678 - Disciple of Naralex +struct npc_disciple_of_naralex : public ScriptedAI +{ + npc_disciple_of_naralex(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { } + + void Reset() override { - npc_disciple_of_naralexAI(Creature* creature) : EscortAI(creature) + _combatEvents.Reset(); + } + + void JustEngagedWith(Unit* who) override + { + _combatEvents.ScheduleEvent(EVENT_SLEEP, 5s, 10s); + _combatEvents.ScheduleEvent(EVENT_DRUIDS_POTION, 5s, 10s); + + if (roll_chance_i(30)) + Talk(SAY_AGGRO, who); + } + + void JustSummoned(Creature* summoned) override + { + summoned->AI()->AttackStart(me); + } + + void DoAction(int32 action) override + { + if (action == ACTION_ALL_DONE) + Talk(SAY_ALL_DONE); + } + + void WaypointPathEnded(uint32/* waypointId*/, uint32 pathId) override + { + switch (pathId) { - instance = creature->GetInstanceScript(); - eventTimer = 0; - currentEvent = 0; - eventProgress = 0; - me->setActive(true); - me->SetFarVisible(true); - me->SetImmuneToPC(false); + case PATH_PROGRESS_1: + _events.ScheduleEvent(EVENT_PROGRESS_4, 1s); + break; + case PATH_PROGRESS_2: + _events.ScheduleEvent(EVENT_PROGRESS_8, 0s); + break; + case PATH_PROGRESS_3: + _events.ScheduleEvent(EVENT_PROGRESS_12, 1s); + break; + case PATH_PROGRESS_4: + _events.ScheduleEvent(EVENT_PROGRESS_14, 1s); + break; + case PATH_PROGRESS_5: + _events.ScheduleEvent(EVENT_PROGRESS_27, 0s); + break; + default: + break; } + } - uint32 eventTimer; - uint32 currentEvent; - uint32 eventProgress; - InstanceScript* instance; - - void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override + void UpdateAI(uint32 diff) override + { + if (!me->IsInCombat()) { - switch (waypointId) + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) { - case 4: - eventProgress = 1; - currentEvent = TYPE_NARALEX_PART1; - instance->SetData(TYPE_NARALEX_PART1, IN_PROGRESS); - break; - case 5: - Talk(SAY_MUST_CONTINUE); - instance->SetData(TYPE_NARALEX_PART1, DONE); - break; - case 11: - eventProgress = 1; - currentEvent = TYPE_NARALEX_PART2; - instance->SetData(TYPE_NARALEX_PART2, IN_PROGRESS); - break; - case 19: - Talk(SAY_BEYOND_THIS_CORRIDOR); - break; - case 24: - eventProgress = 1; - currentEvent = TYPE_NARALEX_PART3; - instance->SetData(TYPE_NARALEX_PART3, IN_PROGRESS); - break; - } - } - - void Reset() override - { - - } - - void JustEngagedWith(Unit* who) override - { - Talk(SAY_ATTACKED, who); - } - - void JustDied(Unit* /*killer*/) override - { - instance->SetData(TYPE_NARALEX_EVENT, FAIL); - instance->SetData(TYPE_NARALEX_PART1, FAIL); - instance->SetData(TYPE_NARALEX_PART2, FAIL); - instance->SetData(TYPE_NARALEX_PART3, FAIL); - } - - void JustSummoned(Creature* summoned) override - { - summoned->AI()->AttackStart(me); - } - - void UpdateAI(uint32 diff) override - { - if (currentEvent != TYPE_NARALEX_PART3) - EscortAI::UpdateAI(diff); - - if (eventTimer <= diff) - { - eventTimer = 0; - if (instance->GetData(currentEvent) == IN_PROGRESS) + switch (eventId) { - switch (currentEvent) - { - case TYPE_NARALEX_PART1: - if (eventProgress == 1) - { - ++eventProgress; - Talk(SAY_TEMPLE_OF_PROMISE); - me->SummonCreature(NPC_DEVIATE_RAVAGER, -82.1763f, 227.874f, -93.3233f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5s); - me->SummonCreature(NPC_DEVIATE_RAVAGER, -72.9506f, 216.645f, -93.6756f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5s); - } + case EVENT_PROGRESS_1: + me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE); + me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP); + _events.ScheduleEvent(EVENT_PROGRESS_2, 10s); break; - case TYPE_NARALEX_PART2: - if (eventProgress == 1) - { - ++eventProgress; - Talk(SAY_BANISH_THE_SPIRITS); - DoCast(me, SPELL_SERPENTINE_CLEANSING); - //CAST_AI(EscortAI, me->AI())->SetCanDefend(false); - eventTimer = 30000; - me->SummonCreature(NPC_DEVIATE_VIPER, -61.5261f, 273.676f, -92.8442f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5s); - me->SummonCreature(NPC_DEVIATE_VIPER, -58.4658f, 280.799f, -92.8393f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5s); - me->SummonCreature(NPC_DEVIATE_VIPER, -50.002f, 278.578f, -92.8442f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5s); - } - else - if (eventProgress == 2) - { - //CAST_AI(EscortAI, me->AI())->SetCanDefend(true); - Talk(SAY_CAVERNS_PURIFIED); - instance->SetData(TYPE_NARALEX_PART2, DONE); - if (me->HasAura(SPELL_SERPENTINE_CLEANSING)) - me->RemoveAura(SPELL_SERPENTINE_CLEANSING); - } + case EVENT_PROGRESS_2: + Talk(SAY_PROGRESS_1); + _events.ScheduleEvent(EVENT_PROGRESS_3, 3500ms); + break; + case EVENT_PROGRESS_3: + me->GetMotionMaster()->MovePath(PATH_PROGRESS_1, false); break; - case TYPE_NARALEX_PART3: - if (eventProgress == 1) - { - ++eventProgress; - eventTimer = 4000; - me->SetStandState(UNIT_STAND_STATE_KNEEL); - Talk(SAY_EMERALD_DREAM); - } - else - if (eventProgress == 2) - { - ++eventProgress; - eventTimer = 15000; - //CAST_AI(EscortAI, me->AI())->SetCanDefend(false); - if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) - DoCast(naralex, SPELL_NARALEXS_AWAKENING, true); - Talk(EMOTE_AWAKENING_RITUAL); - } - else - if (eventProgress == 3) - { - ++eventProgress; - eventTimer = 15000; - if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) - naralex->AI()->Talk(EMOTE_TROUBLED_SLEEP); - me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943f, 199.701f, -103.529f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s); - me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08f, 221.13f, -103.609f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s); - me->SummonCreature(NPC_DEVIATE_MOCCASIN, 128.007f, 227.428f, -97.421f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s); - } - else - if (eventProgress == 4) - { - ++eventProgress; - eventTimer = 30000; - if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) - naralex->AI()->Talk(EMOTE_WRITHE_IN_AGONY); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413f, 207.188f, -102.469f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857f, 218.645f, -102.905f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 105.102f, 227.211f, -102.752f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 153.372f, 235.149f, -102.826f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 149.524f, 251.113f, -102.558f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 136.208f, 266.466f, -102.977f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 126.167f, 274.759f, -102.962f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s); - } - else - if (eventProgress == 5) - { - ++eventProgress; - if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) - naralex->AI()->Talk(EMOTE_HORRENDOUS_VISION); - if (Creature* mutanus = me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872f, 262.905f, -103.503f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5min)) - Talk(SAY_MUTANUS_THE_DEVOURER, mutanus); - instance->SetData(TYPE_MUTANUS_THE_DEVOURER, IN_PROGRESS); - } - else - if (eventProgress == 6 && instance->GetData(TYPE_MUTANUS_THE_DEVOURER) == DONE) - { - ++eventProgress; - eventTimer = 3000; - if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) - { - if (me->HasAura(SPELL_NARALEXS_AWAKENING)) - me->RemoveAura(SPELL_NARALEXS_AWAKENING); - naralex->SetStandState(UNIT_STAND_STATE_STAND); - naralex->AI()->Talk(SAY_I_AM_AWAKE); - } - Talk(SAY_NARALEX_AWAKES); - } - else - if (eventProgress == 7) - { - ++eventProgress; - eventTimer = 6000; - if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) - naralex->AI()->Talk(SAY_THANK_YOU); - } - else - if (eventProgress == 8) - { - ++eventProgress; - eventTimer = 8000; - if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) - { - naralex->AI()->Talk(SAY_FAREWELL); - naralex->AddAura(SPELL_FLIGHT_FORM, naralex); - } - me->SetStandState(UNIT_STAND_STATE_STAND); - me->AddAura(SPELL_FLIGHT_FORM, me); - } - else - if (eventProgress == 9) - { - ++eventProgress; - eventTimer = 1500; - if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) - naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ()); - } - else - if (eventProgress == 10) - { - ++eventProgress; - eventTimer = 2500; - if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) - { - naralex->GetMotionMaster()->MovePoint(0, 117.095512f, 247.107971f, -96.167870f); - naralex->GetMotionMaster()->MovePoint(1, 90.388809f, 276.135406f, -83.389801f); - } - me->GetMotionMaster()->MovePoint(26, 117.095512f, 247.107971f, -96.167870f); - me->GetMotionMaster()->MovePoint(27, 144.375443f, 281.045837f, -82.477135f); - } - else - if (eventProgress == 11) - { - if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) - naralex->SetVisible(false); - me->SetVisible(false); - instance->SetData(TYPE_NARALEX_PART3, DONE); - } + case EVENT_PROGRESS_4: + Talk(SAY_PROGRESS_2); + _events.ScheduleEvent(EVENT_PROGRESS_5, 7s); + break; + case EVENT_PROGRESS_5: + me->SummonCreatureGroup(SUMMON_GROUP_1); + _events.ScheduleEvent(EVENT_PROGRESS_6, 10s); + break; + case EVENT_PROGRESS_6: + me->SetFacingTo(5.742133140563964843f); + Talk(SAY_PROGRESS_3); + _events.ScheduleEvent(EVENT_PROGRESS_7, 3s); + break; + case EVENT_PROGRESS_7: + me->GetMotionMaster()->MovePath(PATH_PROGRESS_2, false); + break; + + case EVENT_PROGRESS_8: + DoCastSelf(SPELL_SERPENTINE_CLEANSING); + Talk(SAY_PROGRESS_4); + _events.ScheduleEvent(EVENT_PROGRESS_9, 18s); + break; + case EVENT_PROGRESS_9: + me->SummonCreatureGroup(SUMMON_GROUP_2); + _events.ScheduleEvent(EVENT_PROGRESS_10, 12s); + break; + case EVENT_PROGRESS_10: + Talk(SAY_PROGRESS_5); + _events.ScheduleEvent(EVENT_PROGRESS_11, 5s); + break; + case EVENT_PROGRESS_11: + me->GetMotionMaster()->MovePath(PATH_PROGRESS_3, false); + break; + + case EVENT_PROGRESS_12: + Talk(SAY_PROGRESS_6); + _events.ScheduleEvent(EVENT_PROGRESS_13, 5s); + break; + case EVENT_PROGRESS_13: + me->GetMotionMaster()->MovePath(PATH_PROGRESS_4, false); + break; + + case EVENT_PROGRESS_14: + Talk(SAY_PROGRESS_7); + _events.ScheduleEvent(EVENT_PROGRESS_15, 5s); + break; + case EVENT_PROGRESS_15: + DoCastSelf(SPELL_NARALEXS_AWAKENING); + Talk(SAY_PROGRESS_8); + _events.ScheduleEvent(EVENT_PROGRESS_16, 4s); + break; + case EVENT_PROGRESS_16: + me->SummonCreatureGroup(SUMMON_GROUP_3); + _events.ScheduleEvent(EVENT_PROGRESS_17, 15s); + break; + case EVENT_PROGRESS_17: + if (Creature* naralex = _instance->GetCreature(DATA_NARALEX)) + naralex->AI()->Talk(EMOTE_AWAKENING_1); + _events.ScheduleEvent(EVENT_PROGRESS_18, 25s); + break; + case EVENT_PROGRESS_18: + me->SummonCreatureGroup(SUMMON_GROUP_4); + _events.ScheduleEvent(EVENT_PROGRESS_19, 20s); + break; + case EVENT_PROGRESS_19: + if (Creature* naralex = _instance->GetCreature(DATA_NARALEX)) + naralex->AI()->Talk(EMOTE_AWAKENING_2); + _events.ScheduleEvent(EVENT_PROGRESS_20, 30s); + break; + case EVENT_PROGRESS_20: + if (Creature* naralex = _instance->GetCreature(DATA_NARALEX)) + naralex->AI()->Talk(EMOTE_AWAKENING_3); + me->SummonCreatureGroup(SUMMON_GROUP_5); + _events.ScheduleEvent(EVENT_PROGRESS_21, 25s); + break; + case EVENT_PROGRESS_21: + { + if (Creature* naralex = _instance->GetCreature(DATA_NARALEX)) + { + naralex->SetStandState(UNIT_STAND_STATE_STAND); + naralex->AI()->Talk(SAY_AWAKENING_4); + } + _events.ScheduleEvent(EVENT_PROGRESS_22, 3s); + break; + } + case EVENT_PROGRESS_22: + me->RemoveAurasDueToSpell(SPELL_NARALEXS_AWAKENING); + Talk(SAY_PROGRESS_9); + _events.ScheduleEvent(EVENT_PROGRESS_23, 3s); + break; + case EVENT_PROGRESS_23: + if (Creature* naralex = _instance->GetCreature(DATA_NARALEX)) + naralex->AI()->Talk(SAY_AWAKENING_5); + _events.ScheduleEvent(EVENT_PROGRESS_24, 6s); + break; + case EVENT_PROGRESS_24: + if (Creature* naralex = _instance->GetCreature(DATA_NARALEX)) + naralex->AI()->Talk(SAY_AWAKENING_6); + _events.ScheduleEvent(EVENT_PROGRESS_25, 3s); + break; + case EVENT_PROGRESS_25: + DoCastSelf(SPELL_OWL_FORM); + if (Creature* naralex = _instance->GetCreature(DATA_NARALEX)) + naralex->CastSpell(naralex, SPELL_OWL_FORM); + me->SetFaction(FACTION_FRIENDLY); + _events.ScheduleEvent(EVENT_PROGRESS_26, 8s); + break; + case EVENT_PROGRESS_26: + { + if (Creature* naralex = _instance->GetCreature(DATA_NARALEX)) + { + naralex->SetDisableGravity(true); + naralex->GetMotionMaster()->MovePath(PATH_NARALEX, false); + } + me->SetDisableGravity(true); + me->GetMotionMaster()->MovePath(PATH_PROGRESS_5, false); break; } - } - } else eventTimer -= diff; - } - bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override - { - uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId); - ClearGossipMenuFor(player); - if (action == GOSSIP_ACTION_INFO_DEF + 1) - { - CloseGossipMenuFor(player); - if (instance) - instance->SetData(TYPE_NARALEX_EVENT, IN_PROGRESS); - - Talk(SAY_MAKE_PREPARATIONS); - - me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE); - me->SetImmuneToPC(false); - - LoadPath(PATH_ESCORT_NARALEX_DISCIPLE); - Start(false, player->GetGUID()); - SetDespawnAtFar(false); - SetDespawnAtEnd(false); - } - return true; - } - - bool OnGossipHello(Player* player) override - { - DoCast(player, SPELL_MARK_OF_THE_WILD_RANK_2, true); - if ((instance->GetData(TYPE_LORD_COBRAHN) == DONE) && (instance->GetData(TYPE_LORD_PYTHAS) == DONE) && - (instance->GetData(TYPE_LADY_ANACONDRA) == DONE) && (instance->GetData(TYPE_LORD_SERPENTIS) == DONE)) - { - InitGossipMenuFor(player, GOSSIP_OPTION_LET_EVENT_BEGIN); - AddGossipItemFor(player, GOSSIP_OPTION_LET_EVENT_BEGIN, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - SendGossipMenuFor(player, NPC_TEXT_FANGLORDS_ARE_DEAD, me->GetGUID()); - - if (!instance->GetData(TYPE_NARALEX_YELLED)) - { - Talk(SAY_AT_LAST); - instance->SetData(TYPE_NARALEX_YELLED, 1); + case EVENT_PROGRESS_27: + if (Creature* naralex = _instance->GetCreature(DATA_NARALEX)) + naralex->DespawnOrUnsummon(); + me->DespawnOrUnsummon(); + break; + default: + break; } } - else - { - SendGossipMenuFor(player, NPC_TEXT_NARALEX_SLEEPS_AGAIN, me->GetGUID()); - } - return true; } - }; - CreatureAI* GetAI(Creature* creature) const override - { - return GetWailingCavernsAI(creature); + if (!UpdateVictim()) + return; + + _combatEvents.Update(diff); + + while (uint32 eventId = _combatEvents.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SLEEP: + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) + DoCast(target, SPELL_SLEEP); + _combatEvents.Repeat(20s, 30s); + break; + case EVENT_DRUIDS_POTION: + if (HealthBelowPct(80)) + DoCastSelf(SPELL_DRUIDS_POTION); + _combatEvents.Repeat(10s, 15s); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); } + + bool OnGossipHello(Player* player) override + { + DoCast(player, SPELL_MARK_OF_THE_WILD); + + if (_instance->GetBossState(DATA_LORD_COBRAHN) == DONE && _instance->GetBossState(DATA_LORD_PYTHAS) == DONE + && _instance->GetBossState(DATA_LADY_ANACONDRA) == DONE && _instance->GetBossState(DATA_LORD_SERPENTIS) == DONE) + { + player->PrepareGossipMenu(me, GOSSIP_MENU_EVENT, true); + player->SendPreparedGossip(me); + return true; + } + + return false; + } + + bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override + { + CloseGossipMenuFor(player); + _events.ScheduleEvent(EVENT_PROGRESS_1, 0s); + + return false; + } + +private: + EventMap _events; + EventMap _combatEvents; + InstanceScript* _instance; }; void AddSC_wailing_caverns() { - new npc_disciple_of_naralex(); + RegisterWailingCavernsCreatureAI(npc_disciple_of_naralex); } diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h index ffbfd30effb..b37536b3519 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h @@ -23,20 +23,29 @@ #define WCScriptName "instance_wailing_caverns" #define DataHeader "WC" +constexpr uint32 EncounterCount = 5; + enum WCDataTypes { - TYPE_LORD_COBRAHN = 1, - TYPE_LORD_PYTHAS = 2, - TYPE_LADY_ANACONDRA = 3, - TYPE_LORD_SERPENTIS = 4, - TYPE_NARALEX_EVENT = 5, - TYPE_NARALEX_PART1 = 6, - TYPE_NARALEX_PART2 = 7, - TYPE_NARALEX_PART3 = 8, - TYPE_MUTANUS_THE_DEVOURER = 9, - TYPE_NARALEX_YELLED = 10, + DATA_LORD_COBRAHN = 0, // Used in SAI (Creature 3669) + DATA_LORD_PYTHAS = 1, // Used in SAI (Creature 3670) + DATA_LADY_ANACONDRA = 2, // Used in SAI (Creature 3671) + DATA_LORD_SERPENTIS = 3, // Used in SAI (Creature 3673) + DATA_MUTANUS_THE_DEVOURER = 4, // Used in SAI (Creature 3654) - DATA_NARALEX = 3679, + DATA_DISCIPLE, + DATA_NARALEX +}; + +enum WCCreatureIds +{ + NPC_DISCIPLE = 3678, + NPC_NARALEX = 3679 +}; + +enum WCActions +{ + ACTION_ALL_DONE = 0 }; template @@ -45,4 +54,6 @@ inline AI* GetWailingCavernsAI(T* obj) return GetInstanceAI(obj, WCScriptName); } +#define RegisterWailingCavernsCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetWailingCavernsAI) + #endif