From 6ef7627c691760a467ae4b9a709033fa33bdf09c Mon Sep 17 00:00:00 2001 From: Patrick Lewis Date: Wed, 4 Nov 2020 12:32:33 -0800 Subject: [PATCH] fix(Script/ICC): Spirit Alarm and Deathbound Ward (#3592) --- .../rev_1600110155751496900.sql | 69 +++++++++++++++++++ .../IcecrownCitadel/icecrown_citadel.cpp | 26 ++++--- .../instance_icecrown_citadel.cpp | 40 ++++++++--- 3 files changed, 117 insertions(+), 18 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1600110155751496900.sql diff --git a/data/sql/updates/pending_db_world/rev_1600110155751496900.sql b/data/sql/updates/pending_db_world/rev_1600110155751496900.sql new file mode 100644 index 000000000..e4cc8373e --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1600110155751496900.sql @@ -0,0 +1,69 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1600110155751496900'); + +-- Deathbound Ward Aura +UPDATE `creature_template_addon` SET `auras` = "" WHERE `entry` IN (37007,38031); + +-- Deathbound Ward Guid +SET @DW_GUID_FIRST := 200987; +SET @DW_GUID_SECOND := 201043; +SET @DW_GUID_THIRD := 201108; +SET @DW_GUID_FOURTH := 201130; + +-- Deathbound Ward Waypoints +SET @DW_WAYPOINT_FIRST := 3700700; +SET @DW_WAYPOINT_SECOND := 3700701; +SET @DW_WAYPOINT_THIRD := 3700702; +SET @DW_WAYPOINT_FOURTH := 3700703; + +DELETE FROM `smart_scripts` WHERE `source_type` = 0 AND `entryorguid` IN(-@DW_GUID_FIRST, -@DW_GUID_SECOND, -@DW_GUID_THIRD, -@DW_GUID_FOURTH); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-@DW_GUID_FIRST, 0, 0, 0, 11, 0, 100, 0, 0, 0, 0, 0, 0, 75, 70733, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - On Respawn - Add Aura \'Stoneform\''), +(-@DW_GUID_FIRST, 0, 1, 0, 0, 0, 100, 0, 3000, 6000, 6000, 8000, 0, 11, 71021, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - In Combat - Cast \'Saber Lash\''), +(-@DW_GUID_FIRST, 0, 2, 0, 0, 0, 100, 0, 6000, 8000, 6000, 12000, 0, 11, 71022, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - In Combat - Cast \'Disrupting Shout\''), +(-@DW_GUID_FIRST, 0, 3, 0, 38, 0, 100, 0, 1, 1, 0, 0, 0, 53, 0, @DW_WAYPOINT_FIRST, 1, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - On Data Set 1 1 - Start Waypoint'), + +(-@DW_GUID_SECOND, 0, 0, 0, 11, 0, 100, 0, 0, 0, 0, 0, 0, 75, 70733, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - On Respawn - Add Aura \'Stoneform\''), +(-@DW_GUID_SECOND, 0, 1, 0, 0, 0, 100, 0, 3000, 6000, 6000, 8000, 0, 11, 71021, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - In Combat - Cast \'Saber Lash\''), +(-@DW_GUID_SECOND, 0, 2, 0, 0, 0, 100, 0, 6000, 8000, 6000, 12000, 0, 11, 71022, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - In Combat - Cast \'Disrupting Shout\''), +(-@DW_GUID_SECOND, 0, 3, 0, 38, 0, 100, 0, 1, 1, 0, 0, 0, 53, 0, @DW_WAYPOINT_SECOND, 1, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - On Data Set 1 1 - Start Waypoint'), + +(-@DW_GUID_THIRD, 0, 0, 0, 11, 0, 100, 0, 0, 0, 0, 0, 0, 75, 70733, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - On Respawn - Add Aura \'Stoneform\''), +(-@DW_GUID_THIRD, 0, 1, 0, 0, 0, 100, 0, 3000, 6000, 6000, 8000, 0, 11, 71021, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - In Combat - Cast \'Saber Lash\''), +(-@DW_GUID_THIRD, 0, 2, 0, 0, 0, 100, 0, 6000, 8000, 6000, 12000, 0, 11, 71022, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - In Combat - Cast \'Disrupting Shout\''), +(-@DW_GUID_THIRD, 0, 3, 0, 38, 0, 100, 0, 1, 1, 0, 0, 0, 53, 0, @DW_WAYPOINT_THIRD, 1, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - On Data Set 1 1 - Start Waypoint'), + +(-@DW_GUID_FOURTH, 0, 0, 0, 11, 0, 100, 0, 0, 0, 0, 0, 0, 75, 70733, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - On Respawn - Add Aura \'Stoneform\''), +(-@DW_GUID_FOURTH, 0, 1, 0, 0, 0, 100, 0, 3000, 6000, 6000, 8000, 0, 11, 71021, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - In Combat - Cast \'Saber Lash\''), +(-@DW_GUID_FOURTH, 0, 2, 0, 0, 0, 100, 0, 6000, 8000, 6000, 12000, 0, 11, 71022, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - In Combat - Cast \'Disrupting Shout\''), +(-@DW_GUID_FOURTH, 0, 3, 0, 38, 0, 100, 0, 1, 1, 0, 0, 0, 53, 0, @DW_WAYPOINT_FOURTH, 1, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Deathbound Ward - On Data Set 1 1 - Start Waypoint'); + +DELETE FROM `waypoints` WHERE `entry` IN (@DW_WAYPOINT_FIRST, @DW_WAYPOINT_SECOND, @DW_WAYPOINT_THIRD, @DW_WAYPOINT_FOURTH); +INSERT INTO `waypoints`(`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `point_comment`) VALUES +(@DW_WAYPOINT_FIRST, 1, -194.583, 2159.04, 37.9852, NULL), +(@DW_WAYPOINT_FIRST, 2, -172.52, 2178.91, 37.9852, NULL), +(@DW_WAYPOINT_FIRST, 3, -173.356, 2244.59, 37.9851, NULL), +(@DW_WAYPOINT_FIRST, 4, -191.483, 2259.81, 37.9851, NULL), +(@DW_WAYPOINT_FIRST, 5, -233.296, 2241.13, 37.9851, NULL), +(@DW_WAYPOINT_FIRST, 6, -242.451, 2222.78, 42.5646, NULL), +(@DW_WAYPOINT_FIRST, 7, -242.6, 2201.63, 42.5646, NULL), +(@DW_WAYPOINT_FIRST, 8, -233.272, 2183.1, 37.9851, NULL), +(@DW_WAYPOINT_FIRST, 9, -194.583, 2159.04, 37.9852, NULL), +(@DW_WAYPOINT_SECOND, 1, -191.483, 2259.81, 37.9851, NULL), +(@DW_WAYPOINT_SECOND, 2, -233.296, 2241.13, 37.9851, NULL), +(@DW_WAYPOINT_SECOND, 3, -242.451, 2222.78, 42.5646, NULL), +(@DW_WAYPOINT_SECOND, 4, -242.6, 2201.63, 42.5646, NULL), +(@DW_WAYPOINT_SECOND, 5, -233.272, 2183.1, 37.9851, NULL), +(@DW_WAYPOINT_SECOND, 6, -194.583, 2159.04, 37.9852, NULL), +(@DW_WAYPOINT_SECOND, 7, -172.52, 2178.91, 37.9852, NULL), +(@DW_WAYPOINT_SECOND, 8, -173.356, 2244.59, 37.9851, NULL), +(@DW_WAYPOINT_SECOND, 9, -191.483, 2259.81, 37.9851, NULL), +(@DW_WAYPOINT_THIRD, 1, -276.016, 2211.87, 42.5645, NULL), +(@DW_WAYPOINT_THIRD, 2, -239.08, 2211.49, 42.5645, NULL), +(@DW_WAYPOINT_THIRD, 3, -213.092, 2211.63, 35.2335, NULL), +(@DW_WAYPOINT_THIRD, 4, -239.08, 2211.49, 42.5645, NULL), +(@DW_WAYPOINT_THIRD, 5, -350.122, 2211.61, 42.4406, NULL), +(@DW_WAYPOINT_THIRD, 6, -276.016, 2211.87, 42.5645, NULL), +(@DW_WAYPOINT_FOURTH, 1, -301.121, 2212.05, 42.0128, NULL), +(@DW_WAYPOINT_FOURTH, 2, -350.122, 2211.61, 42.4406, NULL), +(@DW_WAYPOINT_FOURTH, 3, -245.857, 2211.23, 42.5645, NULL), +(@DW_WAYPOINT_FOURTH, 4, -301.121, 2212.05, 42.0128, NULL); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 1388a68ff..633e32a73 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1946,34 +1946,40 @@ public: void HandleEvent(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - float range = 0.0f; + uint32 trapId = 0; switch (GetSpellInfo()->Effects[effIndex].MiscValue) { case EVENT_AWAKEN_WARD_1: + trapId = GO_SPIRIT_ALARM_1; + break; case EVENT_AWAKEN_WARD_2: - range = 100.0f; + trapId = GO_SPIRIT_ALARM_2; break; case EVENT_AWAKEN_WARD_3: + trapId = GO_SPIRIT_ALARM_3; + break; case EVENT_AWAKEN_WARD_4: - range = 50.0f; + trapId = GO_SPIRIT_ALARM_4; break; default: return; } + if (GameObject* trap = GetCaster()->FindNearestGameObject(trapId, 5.0f)) + { + trap->SetRespawnTime(trap->GetGOInfo()->GetAutoCloseTime() / IN_MILLISECONDS); + } + std::list wards; - GetCaster()->GetCreatureListWithEntryInGrid(wards, NPC_DEATHBOUND_WARD, range); + GetCaster()->GetCreatureListWithEntryInGrid(wards, NPC_DEATHBOUND_WARD, 150.0f); wards.sort(acore::ObjectDistanceOrderPred(GetCaster())); for (std::list::iterator itr = wards.begin(); itr != wards.end(); ++itr) { if ((*itr)->IsAlive() && (*itr)->HasAura(SPELL_STONEFORM)) { - if (Player* target = (*itr)->SelectNearestPlayer(150.0f)) - { - (*itr)->AI()->Talk(SAY_TRAP_ACTIVATE); - (*itr)->RemoveAurasDueToSpell(SPELL_STONEFORM); - (*itr)->AI()->AttackStart(target); - } + (*itr)->AI()->Talk(SAY_TRAP_ACTIVATE); + (*itr)->RemoveAurasDueToSpell(SPELL_STONEFORM); + (*itr)->AI()->SetData(1, 1); break; } } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 516f1db4d..717566b41 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -109,6 +109,12 @@ Position const MuradinSpawnPos = { -47.34549f, 2208.087f, 27.98586f, 3.106686f Position const UtherSpawnPos = { -26.58507f, 2211.524f, 30.19898f, 3.124139f }; Position const SylvanasSpawnPos = { -41.45833f, 2222.891f, 27.98586f, 3.647738f }; +// Set position traps Spirit Alarm +std::vector GoSpiritAlarm_1 = { { -160.96f, 2210.46f, 35.24f, 0.0f }, { -176.27f, 2201.93f, 35.24f, 0.0f}, { -207.83f, 2207.38f, 35.24f, 0.0f } }; +std::vector GoSpiritAlarm_2 = { { -178.41f, 2225.11f, 35.24f, 0.0f }, { -195.23f, 2221.55f, 35.24f, 0.0f}, { -209.94f, 2250.34f, 37.99f, 0.0f } }; +std::vector GoSpiritAlarm_3 = { { -289.80f, 2216.60f, 42.39f, 0.0f }, { -317.76f, 2216.11f, 42.57f, 0.0f}, { -301.07f, 2216.62f, 42.0f, 0.0f } }; +std::vector GoSpiritAlarm_4 = { { -276.07f, 2206.76f, 42.57f, 0.0f }, { -304.44f, 2199.11f, 41.99f, 0.0f}, { -292.82f, 2204.61f, 42.02f, 0.0f } }; + class RespawnEvent : public BasicEvent { public: @@ -674,14 +680,7 @@ public: case GO_SPIRIT_ALARM_2: case GO_SPIRIT_ALARM_3: case GO_SPIRIT_ALARM_4: - { - Position pos[4 * 3] = {{-160.96f, 2210.46f, 35.24f, 0.0f}, {-176.27f, 2201.93f, 35.24f, 0.0f}, {-207.83f, 2207.38f, 35.24f, 0.0f}, - {-178.41f, 2225.11f, 35.24f, 0.0f}, {-195.23f, 2221.55f, 35.24f, 0.0f}, {-209.94f, 2250.34f, 37.99f, 0.0f}, - {-289.80f, 2216.60f, 42.39f, 0.0f}, {-317.76f, 2216.11f, 42.57f, 0.0f}, {-301.07f, 2216.62f, 42.0f, 0.0f}, - {-276.07f, 2206.76f, 42.57f, 0.0f}, {-304.44f, 2199.11f, 41.99f, 0.0f}, {-292.82f, 2204.61f, 42.02f, 0.0f} - }; - go->SetPosition(pos[3 * (go->GetEntry() - GO_SPIRIT_ALARM_1) + urand(0, 2)]); - } + SetPositionTraps(go); break; case GO_GEIST_ALARM_1: case GO_GEIST_ALARM_2: @@ -1872,6 +1871,31 @@ public: break; } } + + void SetPositionTraps(GameObject* go) + { + std::vector trapPositions; + + switch (go->GetEntry()) + { + case GO_SPIRIT_ALARM_1: + trapPositions = GoSpiritAlarm_1; + break; + case GO_SPIRIT_ALARM_2: + trapPositions = GoSpiritAlarm_2; + break; + case GO_SPIRIT_ALARM_3: + trapPositions = GoSpiritAlarm_3; + break; + case GO_SPIRIT_ALARM_4: + trapPositions = GoSpiritAlarm_4; + break; + default: + return; + } + + go->Relocate(acore::Containers::SelectRandomContainerElement(trapPositions)); + } protected: // pussywizard: