diff options
author | Naddley <64811442+Naddley@users.noreply.github.com> | 2024-02-24 06:01:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-24 06:01:49 +0100 |
commit | 345a08970d7014dbd761c815fbd10ecc88d2dc29 (patch) | |
tree | 10d044e6a36cb56609162fcf8574f13273e58730 | |
parent | 8b1dde2e9fbe969d3c28232f614ec0600b45e297 (diff) |
Scripts/ForbiddenReach: Added spawn handling for dracthyr intro personal summons (#29682)
Co-Authored-By: ModoX <moardox@gmail.com>
-rw-r--r-- | sql/updates/world/master/2024_02_24_00_world.sql | 56 | ||||
-rw-r--r-- | src/server/scripts/DragonIsles/zone_the_forbidden_reach.cpp | 129 |
2 files changed, 167 insertions, 18 deletions
diff --git a/sql/updates/world/master/2024_02_24_00_world.sql b/sql/updates/world/master/2024_02_24_00_world.sql new file mode 100644 index 00000000000..df19ee4d4aa --- /dev/null +++ b/sql/updates/world/master/2024_02_24_00_world.sql @@ -0,0 +1,56 @@ +SET @OGUID := 9003864; + +-- GameObject +DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID+0 AND @OGUID+3; +INSERT INTO `gameobject` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnDifficulties`, `PhaseId`, `PhaseGroup`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `VerifiedBuild`) VALUES +(@OGUID+0, 378473, 2570, 13769, 13806, '0', 0, 0, 5739.970703125, -3023.970458984375, 251.0890045166015625, 3.194002151489257812, 0, 0, -0.99965667724609375, 0.026201646775007247, 120, 255, 1, 53212), -- Starting Room Collision (Area: The War Creche - Difficulty: 0) CreateObject1 +(@OGUID+1, 378473, 2570, 13769, 13806, '0', 0, 0, 5754.30029296875, -3056.350830078125, 251.0890045166015625, 3.926995515823364257, 0, 0, -0.92387866973876953, 0.38268551230430603, 120, 255, 1, 53212), -- Starting Room Collision (Area: The War Creche - Difficulty: 0) CreateObject1 +(@OGUID+2, 378473, 2570, 13769, 13806, '0', 0, 0, 5818.52978515625, -3054.560791015625, 251.279998779296875, 5.480334281921386718, 0, 0, -0.39073085784912109, 0.920504987239837646, 120, 255, 1, 53212), -- Starting Room Collision (Area: The War Creche - Difficulty: 0) CreateObject1 +(@OGUID+3, 378473, 2570, 13769, 13806, '0', 0, 0, 5787.44970703125, -3069.34033203125, 251.08502197265625, 4.729844093322753906, 0, 0, -0.70090866088867187, 0.713251054286956787, 120, 255, 1, 53212); -- Starting Room Collision (Area: The War Creche - Difficulty: 0) CreateObject1 + +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 32 AND `SourceGroup` = 378473 AND `SourceEntry` = 8); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `Comment`) VALUES +(32, 8, 378473, 0, 0, 48, 0, 421735, 0, 1, 1, 'Spawn of gameobject with entry 378473 requires Quest 64864 objective 421735 complete'); + +-- Template Addon +DELETE FROM `creature_template_addon` WHERE `entry` IN (187223 /*187223 (Kodethi) - Stasis*/, 181494 /*181494 (Dervishian) - Stasis*/); +INSERT INTO `creature_template_addon` (`entry`, `PathId`, `mount`, `StandState`, `AnimTier`, `VisFlags`, `SheathState`, `PvpFlags`, `emote`, `aiAnimKit`, `movementAnimKit`, `meleeAnimKit`, `visibilityDistanceType`, `auras`) VALUES +(181494, 0, 0, 0, 0, 0, 1, 0, 0, 23987, 0, 0, 0, '382137'), -- 181494 (Dervishian) - Stasis +(187223, 0, 0, 0, 0, 0, 1, 0, 0, 23987, 0, 0, 0, '382137'); -- 187223 (Kodethi) - Stasis + +DELETE FROM `quest_template_addon` WHERE `ID` = 64864; +INSERT INTO `quest_template_addon` (`ID`, `MaxLevel`, `AllowableClasses`, `SourceSpellID`, `PrevQuestID`, `NextQuestID`, `ExclusiveGroup`, `BreadcrumbForQuestId`, `RewardMailTemplateID`, `RewardMailDelay`, `RequiredSkillID`, `RequiredSkillPoints`, `RequiredMinRepFaction`, `RequiredMaxRepFaction`, `RequiredMinRepValue`, `RequiredMaxRepValue`, `ProvidedItemCount`, `SpecialFlags`, `ScriptName`) VALUES +(64864, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 'quest_awaken_dracthyr'); + +DELETE FROM `gameobject_template_addon` WHERE `entry`=378473; +INSERT INTO `gameobject_template_addon` (`entry`, `faction`, `flags`, `WorldEffectID`, `AIAnimKitID`) VALUES +(378473, 114, 0, 0, 0); -- Starting Room Collision + +-- SpellScript names +DELETE FROM `spell_script_names` WHERE `spell_id` IN (369730, 370111, 369744); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(369730, 'spell_dracthyr_summon_dervishian'), +(370111, 'spell_dracthyr_summon_dervishian'), +(369744, 'spell_dracthyr_login'); + +-- SpellArea +DELETE FROM `spell_area` WHERE `spell` IN (369731, 370112) AND `area` = 13806; +INSERT INTO `spell_area` (`spell`, `area`, `quest_start`, `quest_end`, `aura_spell`, `racemask`, `gender`, `flags`, `quest_start_status`, `quest_end_status`) VALUES +(369731, 13806, 64864, 0, 0, 0, 2, 3, 2|8, 0), +(370112, 13806, 64864, 0, 0, 0, 2, 3, 2|8, 0); + +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 17) AND (`SourceEntry` IN (369730, 370111)); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `Comment`) VALUES +(17, 0, 369730, 0, 0, 6, 0, 469, 0, 0, 0, 'Allow spellcast if caster is Team Alliance'), +(17, 0, 370111, 0, 0, 6, 0, 67, 0, 0, 0, 'Allow spellcast if caster is Team Horde'); + +-- AreaTrigger +DELETE FROM `areatrigger_template` WHERE `IsCustom`=0 AND `Id` = 30308; +INSERT INTO `areatrigger_template` (`Id`, `IsCustom`, `Flags`, `VerifiedBuild`) VALUES +(30308, 0, 0, 53212); + +DELETE FROM `areatrigger_create_properties` WHERE `IsCustom`=0 AND `Id` = 26052; +INSERT INTO `areatrigger_create_properties` (`Id`, `IsCustom`, `AreaTriggerId`, `IsAreatriggerCustom`, `Flags`, `MoveCurveId`, `ScaleCurveId`, `MorphCurveId`, `FacingCurveId`, `AnimId`, `AnimKitId`, `DecalPropertiesId`, `TimeToTarget`, `TimeToTargetScale`, `Shape`, `ShapeData0`, `ShapeData1`, `ShapeData2`, `ShapeData3`, `ShapeData4`, `ShapeData5`, `ShapeData6`, `ShapeData7`, `VerifiedBuild`) VALUES +(26052, 0, 30308, 0, 4, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 53212); -- Spell: 382137 (Stasis) + +UPDATE `areatrigger_create_properties` SET `ScriptName` = 'at_dracthyr_stasis_feedback' WHERE `Id` = 26052 AND `IsCustom` = 0; diff --git a/src/server/scripts/DragonIsles/zone_the_forbidden_reach.cpp b/src/server/scripts/DragonIsles/zone_the_forbidden_reach.cpp index 4e9057b6c28..4c756e8afa9 100644 --- a/src/server/scripts/DragonIsles/zone_the_forbidden_reach.cpp +++ b/src/server/scripts/DragonIsles/zone_the_forbidden_reach.cpp @@ -15,6 +15,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "AreaTrigger.h" +#include "AreaTriggerAI.h" #include "ScriptMgr.h" #include "Containers.h" #include "Player.h" @@ -25,29 +27,58 @@ enum DracthyrLoginSpells { // Spells - SPELL_DRACTHYR_LOGIN = 369728, // teleports to random room, plays scene for the room, binds the home position - SPELL_STASIS_1 = 369735, // triggers 366620 - SPELL_STASIS_2 = 366620, // triggers 366636 - SPELL_STASIS_3 = 366636, // removes 365560, sends first quest (64864) - SPELL_STASIS_4 = 365560, // freeze the target - SPELL_DRACTHYR_MOVIE_ROOM_01 = 394245, // scene for room 1 - SPELL_DRACTHYR_MOVIE_ROOM_02 = 394279, // scene for room 2 - SPELL_DRACTHYR_MOVIE_ROOM_03 = 394281, // scene for room 3 - SPELL_DRACTHYR_MOVIE_ROOM_04 = 394282, // scene for room 4 - //SPELL_DRACTHYR_MOVIE_ROOM_05 = 394283, // scene for room 5 (only plays sound, unused?) + SPELL_DRACTHYR_LOGIN = 369728, // teleports to random room, plays scene for the room, binds the home position + SPELL_STASIS_1 = 369735, // triggers 366620 + SPELL_STASIS_2 = 366620, // triggers 366636 + SPELL_STASIS_3 = 366636, // removes 365560, sends first quest (64864) + SPELL_STASIS_4 = 365560, // freeze the target + SPELL_DRACTHYR_MOVIE_ROOM_01 = 394245, // scene for room 1 + SPELL_DRACTHYR_MOVIE_ROOM_02 = 394279, // scene for room 2 + SPELL_DRACTHYR_MOVIE_ROOM_03 = 394281, // scene for room 3 + SPELL_DRACTHYR_MOVIE_ROOM_04 = 394282, // scene for room 4 + //SPELL_DRACTHYR_MOVIE_ROOM_05 = 394283, // scene for room 5 (only plays sound, unused?) + SPELL_MAINTAIN_DERVISHIAN = 369731, // Alliance Personal Summon + SPELL_MAINTAIN_KODETHI = 370112, // Horde Personal Summon + SPELL_AWAKEN_DRACTYHR_QUEST_ABANDON = 369744, + SPELL_STASIS_FEEDBACK_KNOCKBACK = 364074, + SPELL_STASIS_FEEDBACK_VISUAL = 374633 }; -std::array<std::pair<uint32, Position>, 4> LoginRoomData = +struct DracthyrLoginRoom +{ + uint32 MovieSpellId; + Position PlayerPosition; + Position SummonPosition; +}; + +std::array<DracthyrLoginRoom, 4> LoginRoomData = { { - { SPELL_DRACTHYR_MOVIE_ROOM_01, { 5725.32f, -3024.26f, 251.047f, 0.01745329238474369f } }, - { SPELL_DRACTHYR_MOVIE_ROOM_02, { 5743.03f, -3067.28f, 251.047f, 0.798488140106201171f } }, - { SPELL_DRACTHYR_MOVIE_ROOM_03, { 5787.1597f, -3083.3906f, 251.04698f, 1.570796370506286621f } }, - { SPELL_DRACTHYR_MOVIE_ROOM_04, { 5829.32f, -3064.49f, 251.047f, 2.364955902099609375f } } + { + SPELL_DRACTHYR_MOVIE_ROOM_01, + { 5725.32f, -3024.26f, 251.047f, 0.01745329238474369f }, + { 5739.97216796875f, -3023.970458984375f, 251.172332763671875f, 3.193952560424804687f } + }, + { + SPELL_DRACTHYR_MOVIE_ROOM_02, + { 5743.03f, -3067.28f, 251.047f, 0.798488140106201171f }, + { 5754.3046875f, -3056.34716796875f, 251.1725006103515625f, 3.926990747451782226f } + }, + { + SPELL_DRACTHYR_MOVIE_ROOM_03, + { 5787.1597f, -3083.3906f, 251.04698f, 1.570796370506286621f }, + { 5787.44970703125f, -3069.335205078125f, 251.168121337890625f, 4.729842185974121093f } + }, + { + SPELL_DRACTHYR_MOVIE_ROOM_04, + { 5829.32f, -3064.49f, 251.047f, 2.364955902099609375f }, + { 5818.533203125f, -3054.5625f, 251.3630828857421875f, 5.480333805084228515f } + } } }; // 369728 - Dracthyr Login +// 369744 - Awaken, Dracthyr OnquestAbandon class spell_dracthyr_login : public SpellScript { bool Validate(SpellInfo const* /*spellInfo*/) override @@ -57,14 +88,14 @@ class spell_dracthyr_login : public SpellScript void HandleTeleport(SpellEffIndex /*effIndex*/) { - std::pair<uint32, Position> const& room = LoginRoomData[urand(0, 3)]; + DracthyrLoginRoom const& room = LoginRoomData[urand(0, 3)]; WorldLocation dest = GetHitUnit()->GetWorldLocation(); SetExplTargetDest(dest); - GetHitDest()->Relocate(room.second); + GetHitDest()->Relocate(room.PlayerPosition); - GetCaster()->CastSpell(GetHitUnit(), room.first, true); + GetCaster()->CastSpell(GetHitUnit(), room.MovieSpellId, true); } void Register() override @@ -90,8 +121,70 @@ public: } }; +// 369730 - Summon Dervishian +// 370111 - Summon Kodethi +class spell_dracthyr_summon_dervishian : public SpellScript +{ + void SetDest(SpellDestination& dest) + { + float currentDist = 1000.0f; + DracthyrLoginRoom const* currentRoom = nullptr; + + for (DracthyrLoginRoom const& room : LoginRoomData) + { + float dist = GetCaster()->GetDistance(room.PlayerPosition); + if (dist < currentDist) + { + currentDist = dist; + currentRoom = &room; + } + } + if (!currentRoom) + return; + + dest.Relocate(currentRoom->SummonPosition); + } + + void Register() override + { + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_dracthyr_summon_dervishian::SetDest, EFFECT_0, TARGET_DEST_NEARBY_ENTRY); + } +}; + +// 64864 - Awaken, Dracthyr +class quest_awaken_dracthyr : public QuestScript +{ +public: + quest_awaken_dracthyr() : QuestScript("quest_awaken_dracthyr") { } + + void OnQuestStatusChange(Player* player, Quest const* /*quest*/, QuestStatus /*oldStatus*/, QuestStatus newStatus) override + { + if (newStatus == QUEST_STATUS_NONE) + player->CastSpell(player, SPELL_AWAKEN_DRACTYHR_QUEST_ABANDON, false); + } +}; + +// 30308 - Stasis Feedback +struct at_dracthyr_stasis_feedback : AreaTriggerAI +{ + at_dracthyr_stasis_feedback(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { } + + void OnUnitEnter(Unit* unit) override + { + if (!unit->IsPlayer()) + return; + + unit->CastSpell(nullptr, SPELL_STASIS_FEEDBACK_KNOCKBACK, false); + if (Unit* caster = at->GetCaster()) + caster->CastSpell(caster->GetPosition(), SPELL_STASIS_FEEDBACK_VISUAL, true); + } +}; + void AddSC_zone_the_forbidden_reach() { RegisterSpellScript(spell_dracthyr_login); new scene_dracthyr_evoker_intro(); + RegisterSpellScript(spell_dracthyr_summon_dervishian); + new quest_awaken_dracthyr(); + RegisterAreaTriggerAI(at_dracthyr_stasis_feedback); } |