diff --git a/sql/updates/world/custom/custom_2019_08_14_00_world.sql b/sql/updates/world/custom/custom_2019_08_14_00_world.sql new file mode 100644 index 00000000000..3327758475a --- /dev/null +++ b/sql/updates/world/custom/custom_2019_08_14_00_world.sql @@ -0,0 +1,67 @@ +UPDATE `creature_template` SET `npcflag`= 0, `VehicleId`= 1111 WHERE `entry`= 45455; +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry`= 45455; + +DELETE FROM `creature` WHERE `guid` IN (368211, 368210); +DELETE FROM `creature_addon` WHERE `guid` IN (368211, 368210); + +SET @CGUID := 383032; +DELETE FROM `creature` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+12; +INSERT INTO `creature` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `PhaseId`, `PhaseGroup`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `VerifiedBuild`) VALUES +-- Spawned after Grandvizier Ertan died +(@CGUID+0, 45455, 657, 0, 0, 3, 169, 0, 0, 0, -775.517, -70.9323, 640.3123, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Slipstream +(@CGUID+1, 45455, 657, 0, 0, 3, 169, 0, 0, 0, -310.4583, -29.74479, 625.0833, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Slipstream +(@CGUID+2, 45455, 657, 0, 0, 3, 169, 0, 0, 0, -848.227, -68.724, 654.2203, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Slipstream +(@CGUID+3, 45455, 657, 0, 0, 3, 169, 0, 0, 0, -844.885, -205.135, 660.7083, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Slipstream +(@CGUID+4, 45504, 657, 0, 0, 3, 169, 0, 0, 0, -906.08, -176.514, 664.5053, 2.86234, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Slipstream Landing Zone +-- Spawned after Altairus died +(@CGUID+5, 45455, 657, 0, 0, 3, 169, 0, 0, 0, -1229.64, 412.26, 641.2933, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Slipstream +(@CGUID+6, 45455, 657, 0, 0, 3, 169, 0, 0, 0, -1245.21, 230.986, 690.6083, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Slipstream +(@CGUID+7, 45455, 657, 0, 0, 3, 169, 0, 0, 0, -1190.88, 125.203, 737.6243, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Slipstream +(@CGUID+8, 45455, 657, 0, 0, 3, 169, 0, 0, 0, -382.441, 42.31597, 625.0833, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Slipstream +(@CGUID+9, 45455, 657, 0, 0, 3, 169, 0, 0, 0, -1138.55, 178.524, 711.4943, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Slipstream +(@CGUID+10, 45455, 657, 0, 0, 3, 169, 0, 0, 0, -1282.07, 344.856, 660.9873, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Slipstream +(@CGUID+11, 45504, 657, 0, 0, 3, 169, 0, 0, 0, -1193.67, 472.835, 634.8653, 0.5061455, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595), -- Slipstream Landing Zone +-- Spawned after Asaad died +(@CGUID+12, 45455, 657, 0, 0, 3, 169, 0, 0, 0, -746.9566, 529.1406, 644.8316, 0, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 15595); -- Slipstream + +DELETE FROM `spawn_group_template` WHERE `groupId` IN (406, 407, 408); +INSERT INTO `spawn_group_template` (`groupId`, `groupName`, `groupFlags`) VALUES +(406, 'The Vortex Pinnacle - Grandvizier Ertan Slipstreams', 4), +(407, 'The Vortex Pinnacle - Altairus Slipstreams', 4), +(408, 'The Vortex Pinnacle - Asaad Slipstreams', 4); + +SET @SPAWNGROUP := 406; +DELETE FROM `spawn_group` WHERE `groupId`= @SPAWNGROUP; +INSERT INTO `spawn_group` (`groupId`, `spawnType`, `spawnId`) VALUES +(@SPAWNGROUP, 0, @CGUID+0), +(@SPAWNGROUP, 0, @CGUID+1), +(@SPAWNGROUP, 0, @CGUID+2), +(@SPAWNGROUP, 0, @CGUID+3), +(@SPAWNGROUP, 0, @CGUID+4); + +SET @SPAWNGROUP := 407; +DELETE FROM `spawn_group` WHERE `groupId`= @SPAWNGROUP; +INSERT INTO `spawn_group` (`groupId`, `spawnType`, `spawnId`) VALUES +(@SPAWNGROUP, 0, @CGUID+5), +(@SPAWNGROUP, 0, @CGUID+6), +(@SPAWNGROUP, 0, @CGUID+7), +(@SPAWNGROUP, 0, @CGUID+8), +(@SPAWNGROUP, 0, @CGUID+9), +(@SPAWNGROUP, 0, @CGUID+10), +(@SPAWNGROUP, 0, @CGUID+11); + +SET @SPAWNGROUP := 408; +DELETE FROM `spawn_group` WHERE `groupId`= @SPAWNGROUP; +INSERT INTO `spawn_group` (`groupId`, `spawnType`, `spawnId`) VALUES +(@SPAWNGROUP, 0, @CGUID+12); + +DELETE FROM `instance_spawn_groups` WHERE `spawnGroupId` IN (406, 407, 408); +INSERT INTO `instance_spawn_groups` (`instanceMapId`, `bossStateId`, `bossStates`, `spawnGroupId`, `flags`) VALUES +(657, 0, 8, 406, 1), -- Enable group when Grandvizier Ertan is DONE +(657, 1, 8, 407, 1), -- Enable group when Alairus is DONE +(657, 2, 8, 408, 1); -- Enable group when Asaad is DONE + +DELETE FROM `spell_target_position` WHERE `ID` IN (89499, 89501); +INSERT INTO `spell_target_position` (`ID`, `EffectIndex`, `MapID`, `PositionX`, `PositionY`, `PositionZ`, `Orientation`) VALUES +(89499, 0, 657, -906.08, -176.514, 664.5053, 2.86234), +(89501, 0, 657, -1193.67, 472.835, 634.8653, 0.5061455); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 9089ab61e66..29a9e055bf7 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -4281,6 +4281,16 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->Effects[EFFECT_0].Amplitude = 2000; }); + // Slipstream + ApplySpellFix({ + 89499, + 89501, + }, [](SpellInfo* spellInfo) + { + // The target creatures are too far away to be targeted by the core so we have to take their spawn positions instead + spellInfo->Effects[EFFECT_0].TargetB = SpellImplicitTargetInfo(TARGET_DEST_DB); + }); + // Summon Skyfall Star ApplySpellFix({ 96260 }, [](SpellInfo* spellInfo) { diff --git a/src/server/scripts/Kalimdor/VortexPinnacle/instance_vortex_pinnacle.cpp b/src/server/scripts/Kalimdor/VortexPinnacle/instance_vortex_pinnacle.cpp index b2206dcfad9..9631ed2a40d 100644 --- a/src/server/scripts/Kalimdor/VortexPinnacle/instance_vortex_pinnacle.cpp +++ b/src/server/scripts/Kalimdor/VortexPinnacle/instance_vortex_pinnacle.cpp @@ -33,36 +33,33 @@ 2 - Asaad */ -struct Slipstream +struct SlipstreamVehicleData { - uint32 entry; - uint32 vehicleId; - Position position; - uint32 data; - uint32 bossData; // boss that has to die/be dead for Slipstream to spawn + uint32 VehicleId; + uint32 GuidDataId; + Position const SpawnPosition; }; -Slipstream const SlipstreamData[Slipstreams] = +std::vector SlipStreamInfo = { - // Grand Vizier Ertan Slipstreams - { NPC_SLIPSTREAM, 1111, { -775.517f, -70.9323f, 640.3123f, 0.0f }, DATA_SLIPSTREAM_1, DATA_GRAND_VIZIER_ERTAN }, - { NPC_SLIPSTREAM, 1112, { -848.227f, -68.724f, 654.2203f, 0.0f }, DATA_SLIPSTREAM_2, DATA_GRAND_VIZIER_ERTAN }, - { NPC_SLIPSTREAM, 1113, { -844.885f, -205.135f, 660.7083f, 0.0f }, DATA_SLIPSTREAM_3, DATA_GRAND_VIZIER_ERTAN }, - // Grand Vizier Ertan Slipstream Landing Zone - { NPC_SLIPSTREAM_LANDING_ZONE, 1114, { -906.08f, -176.514f, 664.5053f, 2.86234f }, 0, DATA_GRAND_VIZIER_ERTAN }, - // Altairus Slipstreams - { NPC_SLIPSTREAM, 1111, { -1190.88f, 125.203f, 737.6243f, 0.0f }, DATA_SLIPSTREAM_4, DATA_ALTAIRUS }, - { NPC_SLIPSTREAM, 1112, { -1138.55f, 178.524f, 711.4943f, 0.0f }, DATA_SLIPSTREAM_5, DATA_ALTAIRUS }, - { NPC_SLIPSTREAM, 1149, { -1245.21f, 230.986f, 690.6083f, 0.0f }, DATA_SLIPSTREAM_6, DATA_ALTAIRUS }, - { NPC_SLIPSTREAM, 1150, { -1282.07f, 344.856f, 660.9873f, 0.0f }, DATA_SLIPSTREAM_7, DATA_ALTAIRUS }, - { NPC_SLIPSTREAM, 1113, { -1229.64f, 412.26f, 641.2933f, 0.0f }, DATA_SLIPSTREAM_8, DATA_ALTAIRUS }, - // Altairus Slipstream Landing Zone - { NPC_SLIPSTREAM_LANDING_ZONE, 1114, { -1193.67f, 472.835f, 634.8653f, 0.5061455f }, 0, DATA_ALTAIRUS }, - // Asaad Slipstream - { NPC_SLIPSTREAM, 1551, { -746.9566f, 529.1406f, 644.8316f, 0.0f }, DATA_SLIPSTREAM_9, DATA_ASAAD }, - // Entrance Slipstreams - { NPC_SLIPSTREAM, 1305, { -310.4583f, -29.74479f, 625.0833f, 0.0f }, DATA_SLIPSTREAM_10, DATA_GRAND_VIZIER_ERTAN }, - { NPC_SLIPSTREAM, 1306, { -382.441f, 42.31597f, 625.0833f, 0.0f }, DATA_SLIPSTREAM_11, DATA_ALTAIRUS }, + // Grandvizier Ertan Slipstream Link + { 1111, DATA_SLIPSTREAM_ERTAN_1, { -775.517f, -70.9323f, 640.3123f, 0.0f } }, + { 1112, DATA_SLIPSTREAM_ERTAN_2, { -848.227f, -68.724f, 654.2203f, 0.0f } }, + { 1113, DATA_SLIPSTREAM_ERTAN_3, { -844.885f, -205.135f, 660.7083f, 0.0f } }, + + // Altairus Slipstream Link + { 1111, DATA_SLIPSTREAM_ALTAIRUS_1, { -1190.88f, 125.203f, 737.6243f, 0.0f } }, + { 1112, DATA_SLIPSTREAM_ALTAIRUS_2, { -1138.55f, 178.524f, 711.4943f, 0.0f } }, + { 1149, DATA_SLIPSTREAM_ALTAIRUS_3, { -1245.21f, 230.986f, 690.6083f, 0.0f } }, + { 1150, DATA_SLIPSTREAM_ALTAIRUS_4, { -1282.07f, 344.856f, 660.9873f, 0.0f } }, + { 1113, DATA_SLIPSTREAM_ALTAIRUS_5, { -1229.64f, 412.26f, 641.2933f, 0.0f } }, + + // Asaad Slipstream Link + { 1551, DATA_SLIPSTREAM_ASAAD_1, { -746.9566f, 529.1406f, 644.8316f, 0.0f } }, + + // Entrance Slipstream Link + { 1305, DATA_SLIPSTREAM_ENTRANCE_1, { -310.4583f, -29.74479f, 625.0833f, 0.0f } }, + { 1306, DATA_SLIPSTREAM_ENTRANCE_2, { -382.441f, 42.31597f, 625.0833f, 0.0f } } }; Position const SouthZephyrSummonLocation = { -1072.87f, 432.4446f, 646.7279f, 6.157519f }; @@ -118,7 +115,6 @@ class instance_vortex_pinnacle : public InstanceMapScript LoadObjectData(creatureData, nullptr); LoadBossBoundaries(boundaries); - CheckSlipstreams(); SummonGroundingFieldPrism(FirstPrismGroundingFieldTop, FirstPrismGroundingFieldPoints); SummonGroundingFieldPrism(SecondPrismGroundingFieldTop, SecondPrismGroundingFieldPoints); @@ -127,6 +123,8 @@ class instance_vortex_pinnacle : public InstanceMapScript void OnCreatureCreate(Creature* creature) override { + InstanceScript::OnCreatureCreate(creature); + switch (creature->GetEntry()) { case NPC_HOWLING_GALE: @@ -135,22 +133,47 @@ class instance_vortex_pinnacle : public InstanceMapScript case NPC_AIR_CURRENT: airCurrentGUIDs.push_back(creature->GetGUID()); break; + case NPC_SLIPSTREAM: + for (SlipstreamVehicleData info : SlipStreamInfo) + { + if (creature->GetExactDist2d(info.SpawnPosition) < 1.0f) + { + /* + Get rid of the old vehicleId and install a new vehicle kit based on the real one. + We have to keep a vehicleId in the creature_template entry so the update_object packet + will send a initial vehicle id so the clientside visuals wont break. + */ + if (creature->GetVehicleKit()) + creature->RemoveVehicleKit(); + + creature->CreateVehicleKit(info.VehicleId, creature->GetEntry()); + if (info.GuidDataId != DATA_SLIPSTREAM_ERTAN_1 && info.GuidDataId != DATA_SLIPSTREAM_ALTAIRUS_1 && + info.GuidDataId != DATA_SLIPSTREAM_ASAAD_1 && info.GuidDataId != DATA_SLIPSTREAM_ENTRANCE_1 && + info.GuidDataId != DATA_SLIPSTREAM_ENTRANCE_2) + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + else + { + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, creature->GetPackGUID().size() + 4); + data << creature->GetPackGUID(); + data << uint32(info.VehicleId); + creature->SendMessageToSet(&data, true); + } + AddObject(creature, info.GuidDataId, true); + break; + } + } + break; default: break; } - - InstanceScript::OnCreatureCreate(creature); } - bool SetBossState(uint32 type, EncounterState state) override { InstanceScript::SetBossState(type, state); - // Spawn Slipstreams - if (state == DONE) - SummonSlipstreams(type); - if (type == DATA_ALTAIRUS && (state == DONE || state == FAIL)) { for (ObjectGuid guid : airCurrentGUIDs) @@ -172,10 +195,12 @@ class instance_vortex_pinnacle : public InstanceMapScript switch (eventId) { case EVENT_SUMMON_ZEPHYRS: - if (TempSummon* zephyr = instance->SummonCreature(NPC_ZEPHYR, SouthZephyrSummonLocation, nullptr, 18 * IN_MILLISECONDS)) - zephyr->GetMotionMaster()->MovePath(PATH_ZEPHYR_SOUTH, false); - if (TempSummon* zephyr = instance->SummonCreature(NPC_ZEPHYR, NorthZephyrSummonLocation, nullptr, 18 * IN_MILLISECONDS)) - zephyr->GetMotionMaster()->MovePath(PATH_ZEPHYR_NORTH, false); + if (instance->IsGridLoaded(SouthZephyrSummonLocation)) + if (TempSummon* zephyr = instance->SummonCreature(NPC_ZEPHYR, SouthZephyrSummonLocation, nullptr, 18 * IN_MILLISECONDS)) + zephyr->GetMotionMaster()->MovePath(PATH_ZEPHYR_SOUTH, false); + if (instance->IsGridLoaded(NorthZephyrSummonLocation)) + if (TempSummon* zephyr = instance->SummonCreature(NPC_ZEPHYR, NorthZephyrSummonLocation, nullptr, 18 * IN_MILLISECONDS)) + zephyr->GetMotionMaster()->MovePath(PATH_ZEPHYR_NORTH, false); events.Repeat(10s); break; default: @@ -185,46 +210,6 @@ class instance_vortex_pinnacle : public InstanceMapScript } private: - // Check which Slipstreams can be spawned on script init - void CheckSlipstreams() - { - if (GetBossState(DATA_GRAND_VIZIER_ERTAN) == DONE) - SummonSlipstreams(DATA_GRAND_VIZIER_ERTAN); - if (GetBossState(DATA_ALTAIRUS) == DONE) - SummonSlipstreams(DATA_ALTAIRUS); - if (GetBossState(DATA_ASAAD) == DONE) - SummonSlipstreams(DATA_ASAAD); - } - - // Spawns Slipstreams belonging bossType - void SummonSlipstreams(uint32 bossType) - { - for (uint8 i = 0; i < Slipstreams; ++i) - { - if (SlipstreamData[i].bossData != bossType) - continue; - - TempSummon* summon = instance->SummonCreature(SlipstreamData[i].entry, SlipstreamData[i].position); - if (!summon) - continue; - - AddObject(summon, SlipstreamData[i].data, true); - - if (SlipstreamData[i].data == DATA_SLIPSTREAM_1 || SlipstreamData[i].data == DATA_SLIPSTREAM_4 || - SlipstreamData[i].data == DATA_SLIPSTREAM_10 || SlipstreamData[i].data == DATA_SLIPSTREAM_11) - { - summon->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - summon->setActive(true); - } - - WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, summon->GetPackGUID().size() + 4); - data << summon->GetPackGUID(); - data << uint32(SlipstreamData[i].vehicleId); - summon->SendMessageToSet(&data, true); - } - } - // Spawns Grounding Field prism void SummonGroundingFieldPrism(Position positionTop, const Position positionPoints[PrismGroundingFieldPoints]) { diff --git a/src/server/scripts/Kalimdor/VortexPinnacle/vortex_pinnacle.cpp b/src/server/scripts/Kalimdor/VortexPinnacle/vortex_pinnacle.cpp index d84a6c047ca..7c7d81b1f50 100644 --- a/src/server/scripts/Kalimdor/VortexPinnacle/vortex_pinnacle.cpp +++ b/src/server/scripts/Kalimdor/VortexPinnacle/vortex_pinnacle.cpp @@ -24,8 +24,10 @@ #include "ScriptedCreature.h" #include "Spell.h" #include "SpellAuras.h" +#include "SpellAuraEffects.h" #include "SpellInfo.h" #include "SpellScript.h" +#include "Vehicle.h" #include "vortex_pinnacle.h" enum Texts @@ -55,19 +57,6 @@ enum Spells SPELL_HOWLING_GALE_VISUAL_WEAK = 85137, SPELL_HOWLING_GALE_KNOCKBACK_WEAK = 85085, - // Slipstream (spells Slipstream npcs cast on passenger to make it enter next Slipstream) - SPELL_SLIPSTREAM_SPELLCLICK = 84965, // spellclick - SPELL_SLIPSTREAM_FIRST = 84980, // Cast on passenger by Slipstream 1 and 4. - SPELL_SLIPSTREAM_FIRST_CONTROL_VEHICLE_AURA = 84978, // Triggered by SPELL_SLIPSTREAM_FIRST. Targets closest NPC_SLIPSTREAM. - SPELL_SLIPSTREAM_SECOND = 84988, // Cast on passenger by Slipstream 2 and 5. - SPELL_SLIPSTREAM_SECOND_CONTROL_VEHICLE_AURA = 84989, // Triggered by SPELL_SLIPSTREAM_SECOND. Targets second closest NPC_SLIPSTREAM. - SPELL_SLIPSTREAM_THIRD = 85394, // Cast on passenger by Slipstream 6. - SPELL_SLIPSTREAM_THIRD_CONTROL_VEHICLE_AURA = 85395, // Triggered by SPELL_SLIPSTREAM_THIRD. Unknown how it targets next NPC_SLIPSTREAM. - SPELL_SLIPSTREAM_FOURTH = 85397, // Cast on passenger by Slipstream 7. - SPELL_SLIPSTREAM_FOURTH_CONTROL_VEHICLE_AURA = 85396, // Triggered by SPELL_SLIPSTREAM_FORTH. Unknown how it targets next NPC_SLIPSTREAM. - SPELL_SLIPSTREAM_LAST = 85016, // Cast on passenger by Slipstream 3 and 8. - SPELL_SLIPSTREAM_LAST_CONTROL_VEHICLE_AURA = 85017, // Triggered by SPELL_SLIPSTREAM_LAST. Targets NPC_SLIPSTREAM_LANDING_ZONE. - // No one sniffed using Slipstreams at entrance, I guess they take you to Slipstream Landing Zone directly, but need spell IDs. // Possible spell IDs named 'Slipstream': 87742 Jet Stream??, 89498, 89500, 95911 // SPELL_SLIPSTREAM_LEFT = 0, @@ -206,10 +195,29 @@ struct npc_vp_howling_gale : public NullCreatureAI } }; -// 45455 - Slipstream -struct npc_slipstream : public ScriptedAI +enum Slipstreams { - npc_slipstream(Creature* creature) : ScriptedAI(creature) + // Spells + SPELL_SLIPSTREAM_ENTER = 84965, + SPELL_SLIPSTREAM_FIRST = 84980, + SPELL_SLIPSTREAM_SECOND = 84988, + SPELL_SLIPSTREAM_THIRD = 85394, + SPELL_SLIPSTREAM_FOURTH = 85397, + SPELL_SLIPSTREAM_LAST = 85016, + SPELL_SLIPSTREAM_ASAAD = 95911, + SPELL_SLIPSTREAM_SHORTCUT_ALTAIRUS = 89498, + SPELL_SLIPSTREAM_SHORTCUT_ASAAD = 89500, + SPELL_SLIPSTREAM_CONTROL_VEHICLE_FIRST = 84978, + SPELL_SLIPSTREAM_CONTROL_VEHICLE_SECOND = 84989, + SPELL_SLIPSTREAM_CONTROL_VEHICLE_THIRD = 85395, + SPELL_SLIPSTREAM_CONTROL_VEHICLE_FOURTH = 85396, + SPELL_SLIPSTREAM_CONTROL_VEHICLE_LAST = 85017 +}; + +// 45455 - Slipstream +struct npc_slipstream : public NullCreatureAI +{ + npc_slipstream(Creature* creature) : NullCreatureAI(creature), _instance(me->GetInstanceScript()), _guid(me->GetGUID()) { Initialize(); } @@ -219,30 +227,56 @@ struct npc_slipstream : public ScriptedAI me->SetExtraUnitMovementFlags(MOVEMENTFLAG2_NO_STRAFE | MOVEMENTFLAG2_NO_JUMPING); } + void OnSpellClick(Unit* clicker, bool& result) + { + if (!clicker) + return; + + if (_instance->GetGuidData(DATA_SLIPSTREAM_ERTAN_1) == _guid || _instance->GetGuidData(DATA_SLIPSTREAM_ALTAIRUS_1) == _guid) + DoCast(clicker, SPELL_SLIPSTREAM_FIRST); + else if (_instance->GetGuidData(DATA_SLIPSTREAM_ASAAD_1) == _guid) + DoCast(clicker, SPELL_SLIPSTREAM_ASAAD); + else if (_instance->GetGuidData(DATA_SLIPSTREAM_ENTRANCE_1) == _guid) + DoCast(clicker, SPELL_SLIPSTREAM_SHORTCUT_ALTAIRUS); + else if (_instance->GetGuidData(DATA_SLIPSTREAM_ENTRANCE_2) == _guid) + DoCast(clicker, SPELL_SLIPSTREAM_SHORTCUT_ASAAD); + + clicker->CastSpell(me, SPELL_SLIPSTREAM_ENTER); + result = true; + } + void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) override { if (!apply) return; - if (me->HasAura(SPELL_SLIPSTREAM_SPELLCLICK)) - DoCast(who, SPELL_SLIPSTREAM_FIRST, true); - else if (me->HasAura(SPELL_SLIPSTREAM_FIRST_CONTROL_VEHICLE_AURA)) - DoCast(who, SPELL_SLIPSTREAM_SECOND, true); - else if (me->HasAura(SPELL_SLIPSTREAM_SECOND_CONTROL_VEHICLE_AURA)) + for (AuraEffect const* effect : me->GetAuraEffectsByType(SPELL_AURA_CONTROL_VEHICLE)) { - if (InstanceScript * instance = me->GetInstanceScript()) + switch (effect->GetSpellInfo()->Id) { - if (instance->GetCreature(DATA_SLIPSTREAM_3) == me) - DoCast(who, SPELL_SLIPSTREAM_LAST, true); - else - DoCast(who, SPELL_SLIPSTREAM_THIRD, true); + case SPELL_SLIPSTREAM_CONTROL_VEHICLE_FIRST: + DoCast(who, SPELL_SLIPSTREAM_SECOND); + break; + case SPELL_SLIPSTREAM_CONTROL_VEHICLE_SECOND: + if (_instance->GetGuidData(DATA_SLIPSTREAM_ERTAN_3) == _guid) + DoCast(who, SPELL_SLIPSTREAM_LAST); + else + DoCast(who, SPELL_SLIPSTREAM_THIRD); + break; + case SPELL_SLIPSTREAM_CONTROL_VEHICLE_THIRD: + DoCast(who, SPELL_SLIPSTREAM_FOURTH); + break; + case SPELL_SLIPSTREAM_CONTROL_VEHICLE_FOURTH: + DoCast(who, SPELL_SLIPSTREAM_LAST); + break; + default: + break; } } - else if (me->HasAura(SPELL_SLIPSTREAM_THIRD_CONTROL_VEHICLE_AURA)) - DoCast(who, SPELL_SLIPSTREAM_FOURTH, true); - else if (me->HasAura(SPELL_SLIPSTREAM_FOURTH_CONTROL_VEHICLE_AURA)) - DoCast(who, SPELL_SLIPSTREAM_LAST, true); } +private: + InstanceScript* _instance; + ObjectGuid _guid; }; // 45504 - Slipstream Landing Zone (can be converted to SAI later, whatever masters say) @@ -783,64 +817,51 @@ class spell_vp_howling_gale : public AuraScript }; // 84978, 84989, 85395, 85396, 85017 - Slipstream -// TO-DO: Fix passenger entering vehicle from another vehicle, passenger's vehicle enters vehicle instead... need core fix or we must handle it in this spellscript? -class spell_slipstream : public SpellScriptLoader +class spell_slipstream : public SpellScript { -public: - spell_slipstream() : SpellScriptLoader("spell_slipstream") { } + PrepareSpellScript(spell_slipstream); - class spell_slipstream_SpellScript : public SpellScript + void SetTarget(WorldObject*& target) { - PrepareSpellScript(spell_slipstream_SpellScript); + InstanceScript* instance = GetCaster()->GetInstanceScript(); + if (!instance) + return; - void SetTarget(WorldObject*& target) + Creature* slipstream = GetCaster()->GetVehicleCreatureBase(); + if (!slipstream) + return; + + switch (GetSpellInfo()->Id) { - InstanceScript* instance = GetCaster()->GetInstanceScript(); - if (!instance) - return; - - Creature* slipstream = GetCaster()->GetVehicleCreatureBase(); - if (!slipstream) - return; - - switch (GetSpellInfo()->Id) - { - case SPELL_SLIPSTREAM_FIRST_CONTROL_VEHICLE_AURA: - if (slipstream->GetGUID() == instance->GetGuidData(DATA_SLIPSTREAM_1)) - target = instance->GetCreature(DATA_SLIPSTREAM_2); - else if (slipstream->GetGUID() == instance->GetGuidData(DATA_SLIPSTREAM_4)) - target = instance->GetCreature(DATA_SLIPSTREAM_5); - break; - case SPELL_SLIPSTREAM_SECOND_CONTROL_VEHICLE_AURA: - if (slipstream->GetGUID() == instance->GetGuidData(DATA_SLIPSTREAM_2)) - target = instance->GetCreature(DATA_SLIPSTREAM_3); - else if (slipstream->GetGUID() == instance->GetGuidData(DATA_SLIPSTREAM_5)) - target = instance->GetCreature(DATA_SLIPSTREAM_6); - break; - case SPELL_SLIPSTREAM_THIRD_CONTROL_VEHICLE_AURA: - target = instance->GetCreature(DATA_SLIPSTREAM_7); - break; - case SPELL_SLIPSTREAM_FOURTH_CONTROL_VEHICLE_AURA: - target = instance->GetCreature(DATA_SLIPSTREAM_8); - break; - case SPELL_SLIPSTREAM_LAST_CONTROL_VEHICLE_AURA: - if (Creature* landingZone = slipstream->FindNearestCreature(NPC_SLIPSTREAM_LANDING_ZONE, 100.0f)) - target = landingZone; - break; - default: - break; - } + case SPELL_SLIPSTREAM_CONTROL_VEHICLE_FIRST: + if (slipstream->GetGUID() == instance->GetGuidData(DATA_SLIPSTREAM_ERTAN_1)) + target = instance->GetCreature(DATA_SLIPSTREAM_ERTAN_2); + else if (slipstream->GetGUID() == instance->GetGuidData(DATA_SLIPSTREAM_ALTAIRUS_1)) + target = instance->GetCreature(DATA_SLIPSTREAM_ALTAIRUS_2); + break; + case SPELL_SLIPSTREAM_CONTROL_VEHICLE_SECOND: + if (slipstream->GetGUID() == instance->GetGuidData(DATA_SLIPSTREAM_ERTAN_2)) + target = instance->GetCreature(DATA_SLIPSTREAM_ERTAN_3); + else if (slipstream->GetGUID() == instance->GetGuidData(DATA_SLIPSTREAM_ALTAIRUS_2)) + target = instance->GetCreature(DATA_SLIPSTREAM_ALTAIRUS_3); + break; + case SPELL_SLIPSTREAM_CONTROL_VEHICLE_THIRD: + target = instance->GetCreature(DATA_SLIPSTREAM_ALTAIRUS_4); + break; + case SPELL_SLIPSTREAM_CONTROL_VEHICLE_FOURTH: + target = instance->GetCreature(DATA_SLIPSTREAM_ALTAIRUS_5); + break; + case SPELL_SLIPSTREAM_CONTROL_VEHICLE_LAST: + if (Creature * landingZone = slipstream->FindNearestCreature(NPC_SLIPSTREAM_LANDING_ZONE, 100.0f)) + target = landingZone; + break; + default: + break; } - - void Register() override - { - OnObjectTargetSelect += SpellObjectTargetSelectFn(spell_slipstream_SpellScript::SetTarget, EFFECT_0, TARGET_UNIT_NEARBY_ENTRY); - } - }; - - SpellScript* GetSpellScript() const override + } + void Register() override { - return new spell_slipstream_SpellScript(); + OnObjectTargetSelect += SpellObjectTargetSelectFn(spell_slipstream::SetTarget, EFFECT_0, TARGET_UNIT_NEARBY_ENTRY); } }; @@ -994,7 +1015,7 @@ void AddSC_vortex_pinnacle() new spell_lurk_ressurect(); new spell_lurk_search_victim(); RegisterAuraScript(spell_vp_howling_gale); - new spell_slipstream(); + RegisterSpellScript(spell_slipstream); new spell_grounding_field(); new spell_skyfall(); new spell_arcane_barrage(); diff --git a/src/server/scripts/Kalimdor/VortexPinnacle/vortex_pinnacle.h b/src/server/scripts/Kalimdor/VortexPinnacle/vortex_pinnacle.h index b581eb1b246..22543353168 100644 --- a/src/server/scripts/Kalimdor/VortexPinnacle/vortex_pinnacle.h +++ b/src/server/scripts/Kalimdor/VortexPinnacle/vortex_pinnacle.h @@ -23,7 +23,6 @@ #define VPScriptName "instance_vortex_pinnacle" #define DataHeader "VP" -uint32 const Slipstreams = 13; uint32 const PrismGroundingFieldPoints = 3; enum DataTypes @@ -34,18 +33,19 @@ enum DataTypes DATA_ASAAD, // Additional Data - DATA_SLIPSTREAM, - DATA_SLIPSTREAM_1, - DATA_SLIPSTREAM_2, - DATA_SLIPSTREAM_3, - DATA_SLIPSTREAM_4, - DATA_SLIPSTREAM_5, - DATA_SLIPSTREAM_6, - DATA_SLIPSTREAM_7, - DATA_SLIPSTREAM_8, - DATA_SLIPSTREAM_9, - DATA_SLIPSTREAM_10, - DATA_SLIPSTREAM_11, + DATA_SLIPSTREAM_ERTAN_1, + DATA_SLIPSTREAM_ERTAN_2, + DATA_SLIPSTREAM_ERTAN_3, + + DATA_SLIPSTREAM_ALTAIRUS_1, + DATA_SLIPSTREAM_ALTAIRUS_2, + DATA_SLIPSTREAM_ALTAIRUS_3, + DATA_SLIPSTREAM_ALTAIRUS_4, + DATA_SLIPSTREAM_ALTAIRUS_5, + + DATA_SLIPSTREAM_ASAAD_1, + DATA_SLIPSTREAM_ENTRANCE_1, + DATA_SLIPSTREAM_ENTRANCE_2 }; enum VPCreatureIds