diff options
-rw-r--r-- | sql/updates/world/master/2024_07_10_01_world.sql | 137 | ||||
-rw-r--r-- | src/server/scripts/Pandaria/zone_the_wandering_isle.cpp | 407 |
2 files changed, 530 insertions, 14 deletions
diff --git a/sql/updates/world/master/2024_07_10_01_world.sql b/sql/updates/world/master/2024_07_10_01_world.sql new file mode 100644 index 00000000000..4e36b434d13 --- /dev/null +++ b/sql/updates/world/master/2024_07_10_01_world.sql @@ -0,0 +1,137 @@ +-- Creature +UPDATE `creature_template_difficulty` SET `ContentTuningID`=80, `StaticFlags1`=268435456, `VerifiedBuild`=53877 WHERE (`Entry`=59652 AND `DifficultyID`=0); -- Aysa Cloudsinger +UPDATE `creature_template_difficulty` SET `StaticFlags1`=268435456, `VerifiedBuild`=53913 WHERE (`Entry`=59649 AND `DifficultyID`=0); -- Tushui Monk +UPDATE `creature_template_difficulty` SET `StaticFlags1`=268435456, `VerifiedBuild`=53913 WHERE (`Entry`=61801 AND `DifficultyID`=0); -- Amberleaf Troublemaker +UPDATE `creature_template_difficulty` SET `ContentTuningID`=80, `StaticFlags1`=268435456, `VerifiedBuild`=53913 WHERE (`Entry`=54856 AND `DifficultyID`=0); -- Master Li Fei +UPDATE `creature_template_difficulty` SET `ContentTuningID`=80, `StaticFlags1`=268435456, `VerifiedBuild`=53913 WHERE (`Entry`=59637 AND `DifficultyID`=0); -- Amberleaf Troublemaker +UPDATE `creature_template_difficulty` SET `StaticFlags1`=268435456, `VerifiedBuild`=53913 WHERE (`Entry`=59642 AND `DifficultyID`=0); -- Aysa Cloudsinger + +UPDATE `creature_template` SET `BaseAttackTime`=2000, `unit_flags`=768, `unit_flags2`=2048, `ScriptName`='npc_aysa_cloudsinger_summon' WHERE `entry`=59652; -- Aysa Cloudsinger +UPDATE `creature_template` SET `BaseAttackTime`=2000, `unit_flags`=768, `unit_flags2`=2048, `ScriptName`='npc_master_li_fei_summon' WHERE `entry`=54856; -- Master Li Fei +UPDATE `creature_template` SET `BaseAttackTime`=2000, `unit_flags2`=2048, `unit_flags3`=524288 WHERE `entry`=59637; -- Amberleaf Troublemaker +UPDATE `creature_template` SET `ScriptName`='npc_aysa_cloudsinger_cave_of_meditation', `StringId`='npc_aysa_quest_29414' WHERE `entry`=59642; +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 61801; + +UPDATE `creature` SET `StringId`='npc_aysa_after_quest_29414' WHERE `guid`=450379; + +DELETE FROM `creature_addon` WHERE `guid` = 450379; +INSERT INTO `creature_addon` (`guid`, `PathId`, `mount`, `StandState`, `AnimTier`, `VisFlags`, `SheathState`, `PvpFlags`, `emote`, `aiAnimKit`, `movementAnimKit`, `meleeAnimKit`, `visibilityDistanceType`, `auras`) VALUES +(450379, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, '85096'); -- Aysa Cloudsinger - 85096 - Generic Quest Invisibility 7 + +DELETE FROM `creature_template_addon` WHERE `entry` = 54856; +INSERT INTO `creature_template_addon` (`entry`, `PathId`, `mount`, `StandState`, `AnimTier`, `VisFlags`, `SheathState`, `PvpFlags`, `emote`, `aiAnimKit`, `movementAnimKit`, `meleeAnimKit`, `visibilityDistanceType`, `auras`) VALUES +(54856, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, '22650'); -- 54856 (Master Li Fei) - Ghost Visual + +DELETE FROM `creature` WHERE `guid` IN (450358, 450361); -- These npcs were wrong spawned +INSERT INTO `creature` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnDifficulties`, `PhaseId`, `PhaseGroup`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `curHealthPct`, `MovementType`, `npcflag`, `unit_flags`, `unit_flags2`, `unit_flags3`, `VerifiedBuild`) VALUES +(450358, 61801, 860, 5736, 5848, '0', 838, 0, 0, 0, 1187.0625, 3439.999267578125, 102.6911392211914062, 3.016042709350585937, 20, 0, 0, 100, 0, NULL, NULL, NULL, NULL, 53913), -- Amberleaf Troublemaker (Area: Cave of Meditation - Difficulty: 0) +(450361, 61801, 860, 5736, 5848, '0', 838, 0, 0, 0, 1185.7725830078125, 3448.739501953125, 102.5142288208007812, 3.500391721725463867, 20, 0, 0, 100, 0, NULL, NULL, NULL, NULL, 53913); -- Amberleaf Troublemaker (Area: Cave of Meditation - Difficulty: 0) + +DELETE FROM `creature_text` WHERE `CreatureID` IN (54567, 59642, 59652, 54856); +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES +(54567, 0, 0, 'A challenge in compassion and humility. By helping Merchant Lorvo, it would seem you\'ve passed, $c. Master Shang would be pleased.', 12, 0, 100, 2, 0, 27404, 60599, 0, 'Aysa Cloudsinger to Player'), +(54567, 1, 0, 'And so our path lays before us. Speak to Master Shang Xi, he will tell you what comes next.', 12, 0, 100, 0, 0, 27399, 60046, 0, 'Aysa Cloudsinger to Player'), +(59642, 0, 0, 'Keep those creatures at bay while I meditate. We\'ll soon have the answers we seek.', 12, 0, 100, 0, 0, 27398, 59161, 0, 'Aysa Cloudsinger to Player'), +(59652, 0, 0, 'Meet me up in the cave if you would, friend.', 12, 0, 100, 396, 0, 27397, 59147, 0, 'Aysa Cloudsinger to Player'), +(54856, 0, 0, 'Master Li Fei\'s voice echoes, \"The way of the Tushui... enlightenment through patience and meditation... the principled life.\"', 16, 0, 100, 6, 0, 0, 53129, 0, 'Master Li Fei to Player'), +(54856, 1, 0, 'Master Li Fei\'s voice echoes, \"It is good to see you again, Aysa. You\'ve come with respect, and so I shall give you the answers you seek.\"', 16, 0, 100, 1, 0, 0, 53845, 0, 'Master Li Fei to Player'), +(54856, 2, 0, 'Master Li Fei\'s voice echoes, \"Huo, the spirit of fire, is known for his hunger. He wants for tinder to eat. He needs the caress of the wind to rouse him.\"', 16, 0, 100, 1, 0, 0, 53841, 0, 'Master Li Fei to Player'), +(54856, 3, 0, 'Master Li Fei\'s voice echoes, \"If you find these things and bring them to his cave, on the far side of Wu-Song Village, you will face a challenge within.\"', 16, 0, 100, 1, 0, 0, 53842, 0, 'Master Li Fei to Player'), +(54856, 4, 0, 'Master Li Fei\'s voice echoes, \"Overcome that challenge, and you shall be graced by Huo\'s presence. Rekindle his flame, and if your spirit is pure, he shall follow you.\"', 16, 0, 100, 1, 0, 0, 53843, 0, 'Master Li Fei to Player'), +(54856, 5, 0, 'Master Li Fei\'s voice echoes, \"Go, children. We shall meet again very soon.\"', 16, 0, 100, 2, 0, 0, 53844, 0, 'Master Li Fei to Player'), +(54856, 6, 0, 'Master Li Fei fades away.', 16, 0, 100, 0, 0, 0, 53130, 0, 'Master Li Fei to Player'); + +-- Gameobject +UPDATE `gameobject` SET `phaseUseFlags`=1 WHERE `guid` IN (300018, 300098); + +-- Smart Scripts +DELETE FROM `smart_scripts` WHERE `source_type` = 0 AND `entryOrGuid` = -450358; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `Difficulties`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param_string`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `action_param7`, `action_param_string`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_param_string`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-450358, 0, 0, 0, '', 1, 0, 100, 0, 5000, 10000, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, NULL, 8, 0, 0, 0, 0, NULL, 1143.3512, 3437.6262, 104.967064, 0, 'Amberleaf Troublemaker - OOC - Move To Position'); + +DELETE FROM `smart_scripts` WHERE `source_type` = 0 AND `entryOrGuid` = -450361; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `Difficulties`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param_string`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `action_param7`, `action_param_string`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_param_string`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-450361, 0, 0, 0, '', 1, 0, 100, 0, 5000, 10000, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, NULL, 8, 0, 0, 0, 0, NULL, 1145.1484, 3432.8604, 105.24505, 0, 'Amberleaf Troublemaker - OOC - Move To Position'); + +-- Areatrigger +DELETE FROM `smart_scripts` WHERE `entryorguid`=7748 AND `source_type`=2 AND `id`=1; +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`, `event_param_string`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(7748, 2, 1, 0, 46, 0, 100, 0, 7748, 0, 0, 0, 0, '', 86, 116219, 2, 10, 450351, 54567, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'On Trigger - Cast Area Trigger Dummy Timer Aura A'); + +DELETE FROM `smart_scripts` WHERE `entryorguid` = 54567 AND `source_type` = 0; +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_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(54567, 0, 0, 0, 31, 0, 100, 0, 116219, 0, 1000, 1000, 0, 1, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Aysa Cloudsinger - On Spellhit Target - Talk'), +(54567, 0, 1, 0, 19, 0, 100, 0, 29414, 0, 0, 0, 0, 85, 114728, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Aysa Cloudsinger - On Quest Accepted - Invoker cast \'Summon Aysa\''); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceGroup`=1 AND `SourceEntry`=7748; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(22, 1, 7748, 2, 0, 1, 0, 116221, 0, 0, 1, 0, 0, '', 'Areatrigger 7748 only triggers when player has not aura 116221'), +(22, 1, 7748, 2, 0, 47, 0, 29410, 2, 0, 0, 0, 0, '', 'Areatrigger 7748 only triggers when player has completed quest 29410'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceGroup`=2 AND `SourceEntry`=7748; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(22, 2, 7748, 2, 1, 1, 0, 116219, 0, 0, 1, 0, 0, '', 'Areatrigger 7748 only triggers when player has not aura 116219'), +(22, 2, 7748, 2, 1, 47, 0, 29419, 2, 0, 0, 0, 0, '', 'Areatrigger 7748 only triggers when player has completed quest 29419'), +(22, 2, 7748, 2, 1, 47, 0, 29424, 2, 0, 0, 0, 0, '', 'Areatrigger 7748 only triggers when player has completed quest 29424'); + +DELETE FROM `areatrigger_scripts` WHERE `entry` IN (7756, 7645); +INSERT INTO `areatrigger_scripts` VALUES +(7756, 'at_cave_of_meditation'), +(7645, 'at_inside_of_cave_of_meditation'); + +-- Spells +DELETE FROM `spell_script_names` WHERE `spell_id`=116421 AND `ScriptName`='spell_meditation_timer_bar'; +INSERT INTO `spell_script_names` VALUES +(116421, 'spell_meditation_timer_bar'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceGroup`=1 AND `SourceEntry`=114728; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 114728, 0, 0, 51, 0, 5, 54567, 0, 0, 0, 0, '', 'Spell Summon Aysa can only hit Aysa Cloudsinger'); + +-- Phase +DELETE FROM `phase_area` WHERE `AreaId` = 5848 AND `PhaseId` = 838; +INSERT INTO `phase_area` (`AreaId`, `PhaseId`, `Comment`) VALUES +(5848, 838, 'See Cave of Scrolls Attack'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=26 AND `SourceGroup`=838 AND `SourceEntry`=0; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(26, 838, 0, 0, 0, 9, 0, 29414, 0, 0, 0, 0, 0, '', 'Apply Phase 838 if Quest 29414 is taken'); + +-- Waypoint +SET @ENTRY := 59652; +SET @PATHOFFSET := 0; +SET @PATH := @ENTRY * 100 + @PATHOFFSET; +DELETE FROM `waypoint_path` WHERE `PathId`= @PATH; +INSERT INTO `waypoint_path` (`PathId`, `MoveType`, `Flags`, `Comment`) VALUES +(@PATH, 1, 0, 'Aysa Cloudsinger - The Way of the Tushui Path (Run)'); + +DELETE FROM `waypoint_path_node` WHERE `PathId`= @PATH; +INSERT INTO `waypoint_path_node` (`PathId`, `NodeId`, `PositionX`, `PositionY`, `PositionZ`, `Orientation`, `Delay`) VALUES +(@PATH, 0, 1176.191, 3444.874, 103.3529, NULL, 0), +(@PATH, 1, 1149.949, 3437.170, 104.9670, NULL, 0); + +SET @ENTRY := 54856; +SET @PATHOFFSET := 0; +SET @PATH := @ENTRY * 100 + @PATHOFFSET; +DELETE FROM `waypoint_path` WHERE `PathId`= @PATH; +INSERT INTO `waypoint_path` (`PathId`, `MoveType`, `Flags`, `Comment`) VALUES +(@PATH, 0, 0, 'Master Li Fen - The Way of the Tushui Path'); + +DELETE FROM `waypoint_path_node` WHERE `PathId`= @PATH; +INSERT INTO `waypoint_path_node` (`PathId`, `NodeId`, `PositionX`, `PositionY`, `PositionZ`, `Orientation`, `Delay`) VALUES +(@PATH, 0, 1126.932, 3428.669, 105.8901, NULL, 6464), +(@PATH, 1, 1131.328, 3437.516, 105.4583, NULL, 18697), +(@PATH, 2, 1131.889, 3428.207, 105.5141, NULL, 0), +(@PATH, 3, 1130.528, 3425.503, 105.8864, NULL, 29017), +(@PATH, 4, 1129.774, 3433.302, 105.5313, NULL, 0), +(@PATH, 5, 1130.557, 3436.087, 105.4839, NULL, 0); + +DELETE FROM `spell_script_names` WHERE `spell_id`=114698; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(114698, 'spell_summon_amberleaf_troublemaker'); + +SET @ENTRY := 59637; +UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = @ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type` = 0 AND `entryOrGuid` = @ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `Difficulties`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 0, '', 11, 0, 100, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 9, 59642, 0, 50, 0, 0, 0, 0, 'On respawn - Self: Attack Creature Aysa Cloudsinger (59642) in 0 - 50 yards'); diff --git a/src/server/scripts/Pandaria/zone_the_wandering_isle.cpp b/src/server/scripts/Pandaria/zone_the_wandering_isle.cpp index dfdd821eb2f..c9a04bc31ec 100644 --- a/src/server/scripts/Pandaria/zone_the_wandering_isle.cpp +++ b/src/server/scripts/Pandaria/zone_the_wandering_isle.cpp @@ -109,12 +109,12 @@ struct npc_tushui_huojin_trainee : public ScriptedAI me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); me->CombatStop(); - _scheduler.Schedule(Seconds(1), [this](TaskContext /*task*/) + _scheduler.Schedule(1s, [this](TaskContext /*task*/) { Talk(SAY_FINISH_FIGHT); }); - _scheduler.Schedule(Seconds(3), [this](TaskContext /*task*/) + _scheduler.Schedule(3s, [this](TaskContext /*task*/) { Position currentPosition; float currentDist = 1000.0f; @@ -145,12 +145,12 @@ struct npc_tushui_huojin_trainee : public ScriptedAI void JustEngagedWith(Unit* /*attacker*/) override { - _scheduler.Schedule(Seconds(4), [this](TaskContext task) + _scheduler.Schedule(4s, [this](TaskContext task) { if (me->GetVictim()) DoCastVictim(SPELL_BLACKOUT_KICK); - task.Repeat(Seconds(8)); + task.Repeat(8s); }); } @@ -235,7 +235,7 @@ struct npc_huojin_trainee : public npc_tushui_huojin_trainee _scheduler.CancelAll(); me->SetEmoteState(EMOTE_ONESHOT_NONE); - _scheduler.Schedule(Seconds(1), [this](TaskContext /*task*/ ) + _scheduler.Schedule(1s, [this](TaskContext /*task*/ ) { me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); }); @@ -248,15 +248,15 @@ struct npc_huojin_trainee : public npc_tushui_huojin_trainee me->SetEmoteState(EMOTE_ONESHOT_NONE); me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); - _scheduler.Schedule(Seconds(1), [this](TaskContext /*task*/) + _scheduler.Schedule(1s, [this](TaskContext /*task*/) { me->SetEmoteState(EMOTE_STATE_MONKOFFENSE_READYUNARMED); }); - _scheduler.Schedule(Seconds(4), [this](TaskContext task) + _scheduler.Schedule(4s, [this](TaskContext task) { PlayRandomEmote(); - task.Repeat(Seconds(4)); + task.Repeat(4s); }); } @@ -272,7 +272,7 @@ struct npc_huojin_trainee : public npc_tushui_huojin_trainee void BeginSparringDelayed(ObjectGuid partnerGuid) { _partnerGuid = partnerGuid; - _scheduler.Schedule(Seconds(1), [this, partnerGuid](TaskContext /*task*/) + _scheduler.Schedule(1s, [this, partnerGuid](TaskContext /*task*/) { BeginSparring(partnerGuid); }); @@ -353,11 +353,11 @@ struct npc_tushui_leading_trainee : public npc_tushui_huojin_trainee void ScheduleEmoteExecution() { - _scheduler.Schedule(Seconds(1), [this](TaskContext task) + _scheduler.Schedule(1s, [this](TaskContext task) { Emote emote = PlayRandomEmote(); HandleEmoteNearbyTushuiTrainees(me, emote); - task.Repeat(Seconds(6)); + task.Repeat(6s); }); } @@ -385,16 +385,16 @@ struct npc_instructor_zhi : public ScriptedAI void JustAppeared() override { - _scheduler.Schedule(Seconds(6), [this](TaskContext task) + _scheduler.Schedule(6s, [this](TaskContext task) { Emote emote = Trinity::Containers::SelectRandomContainerElement(TraineeEmotes); me->HandleEmoteCommand(emote); - task.Schedule(Seconds(1), [this, emote](TaskContext /*task*/) + task.Schedule(1s, [this, emote](TaskContext /*task*/) { HandleEmoteNearbyTushuiTrainees(me, emote); }); - task.Repeat(Seconds(6)); + task.Repeat(6s); }); } @@ -834,6 +834,379 @@ private: TaskScheduler _scheduler; }; +// Quest 29414 - The Way of the Tushui +enum AysaCloudsingerMisc +{ + // Texts + SAY_GO_CAVE = 0, + + // Waypoints + POINT_JUMP = 1, + PATH_CAVE_OF_MEDITATION = 5965200 +}; + +constexpr Position aysaJumpPos[3] = +{ + { 1196.72f, 3492.85f, 90.9836f }, + { 1192.29f, 3478.69f, 108.788f }, + { 1197.99f, 3460.63f, 103.04f } +}; + +// 59652 - Aysa Cloudsinger (summon) +struct npc_aysa_cloudsinger_summon : public ScriptedAI +{ + npc_aysa_cloudsinger_summon(Creature* creature) : ScriptedAI(creature) { } + + void IsSummonedBy(WorldObject* summoner) override + { + if (!summoner->IsPlayer()) + return; + + Talk(SAY_GO_CAVE, summoner); + + _scheduler.Schedule(3s, [this](TaskContext task) + { + me->GetMotionMaster()->MoveJumpWithGravity(aysaJumpPos[0], 12.0f, 17.4735f); + + task.Schedule(1700ms, [this](TaskContext task) + { + me->GetMotionMaster()->MoveJumpWithGravity(aysaJumpPos[1], 12.0f, 10.7163f); + + task.Schedule(2s, [this](TaskContext /*task*/) + { + me->GetMotionMaster()->MoveJumpWithGravity(aysaJumpPos[2], 12.0f, 14.6923f, POINT_JUMP); + }); + }); + }); + } + + void MovementInform(uint32 type, uint32 pointId) override + { + if (type != EFFECT_MOTION_TYPE) + return; + + if (pointId == POINT_JUMP) + me->GetMotionMaster()->MovePath(PATH_CAVE_OF_MEDITATION, false); + } + + void WaypointPathEnded(uint32 /*nodeId*/, uint32 pathId) override + { + if (pathId == PATH_CAVE_OF_MEDITATION) + me->DespawnOrUnsummon(); + } + + void UpdateAI(uint32 diff) override + { + _scheduler.Update(diff); + } + +private: + TaskScheduler _scheduler; +}; + +enum CaveOfMeditationMisc +{ + // Quest + QUEST_THE_WAY_OF_THE_TUSHUI = 29414, + + // Spells + SPELL_MEDITATION_TIMER_BAR = 116421, + SPELL_CAVE_OF_SCROLLS_CREDIT = 102447, + SPELL_AYSA_CAVE_OF_SCROLLS_COMP = 128598, + SPELL_SUMMON_MASTER_LI_FEI = 102445, + SPELL_SUMMON_AMBERLEAF_TROUBLEMAKER = 114710, + + // Actions + ACTION_START_MEDITATION = 1, + ACTION_FINISH_MEDITATION = 2, + ACTION_FINISH_EVENT = 3, + + // Events + EVENT_SUMMON_AMBERLEAF = 1, + + // Texts + SAY_AYSA_HELP = 0, + SAY_AYSA_FINISH_MEDITATION = 1 +}; + +// 59642 - Aysa Cloudsinger (Cave of Meditation) +struct npc_aysa_cloudsinger_cave_of_meditation : public ScriptedAI +{ + npc_aysa_cloudsinger_cave_of_meditation(Creature* creature) : ScriptedAI(creature), _finishEvent(false) { } + + void DoAction(int32 action) override + { + switch (action) + { + case ACTION_START_MEDITATION: + { + _finishEvent = false; + events.ScheduleEvent(EVENT_SUMMON_AMBERLEAF, 1s); + break; + } + case ACTION_FINISH_MEDITATION: + { + events.CancelEvent(EVENT_SUMMON_AMBERLEAF); + break; + } + case ACTION_FINISH_EVENT: + { + if (_finishEvent) + return; + + Creature* aysa = me->FindNearestCreatureWithOptions(40.0f, { .StringId = "npc_aysa_after_quest_29414", .IgnorePhases = true }); + + if (!aysa) + return; + + aysa->AI()->Talk(SAY_AYSA_FINISH_MEDITATION); + _finishEvent = true; + break; + } + default: + break; + } + } + + void UpdateAI(uint32 diff) override + { + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SUMMON_AMBERLEAF: + { + DoCastSelf(SPELL_SUMMON_AMBERLEAF_TROUBLEMAKER); + events.Repeat(11s); + break; + } + default: + break; + } + } + } + +private: + EventMap events; + bool _finishEvent; +}; + +enum MasterLiFeiMisc +{ + // Waypoint + PATH_MASTER_LI = 5485600, + + // Texts + SAY_TEXT_0 = 0, + SAY_TEXT_1 = 1, + SAY_TEXT_2 = 2, + SAY_TEXT_3 = 3, + SAY_TEXT_4 = 4, + SAY_TEXT_5 = 5, + SAY_TEXT_6 = 6, + SAY_TEXT_7 = 7, + + // Spells + SPELL_UPDATE_PHASE_SHIFT_DEMON_CREATOR = 84034 +}; + +// 54856 - Master Li Fei (Summon) +struct npc_master_li_fei_summon : public ScriptedAI +{ + npc_master_li_fei_summon(Creature* creature) : ScriptedAI(creature) { } + + void FaceToPlayer() + { + if (me->IsSummon()) + { + Unit* summoner = me->ToTempSummon()->GetSummonerUnit(); + + if (!summoner) + return; + + me->SetFacingToObject(summoner); + } + } + + void IsSummonedBy(WorldObject* summoner) override + { + if (!summoner->IsPlayer()) + return; + + me->GetMotionMaster()->MovePath(PATH_MASTER_LI, false); + + Seconds delay = 23s; + + _scheduler.Schedule(delay, [this](TaskContext) + { + FaceToPlayer(); + }); + + delay += 2s; + + _scheduler.Schedule(delay, [this](TaskContext) + { + Talk(SAY_TEXT_0); + }); + + delay += 10s; + + _scheduler.Schedule(delay, [this](TaskContext) + { + Talk(SAY_TEXT_1); + }); + + delay += 12s; + + _scheduler.Schedule(delay, [this](TaskContext) + { + Talk(SAY_TEXT_2); + }); + + delay += 11s; + + _scheduler.Schedule(delay, [this](TaskContext) + { + FaceToPlayer(); + Talk(SAY_TEXT_3); + }); + + delay += 11s; + + _scheduler.Schedule(delay, [this](TaskContext) + { + Talk(SAY_TEXT_4); + }); + + delay += 9s; + + _scheduler.Schedule(delay, [this](TaskContext) + { + FaceToPlayer(); + }); + + delay += 2s; + + _scheduler.Schedule(delay, [this](TaskContext) + { + Talk(SAY_TEXT_5); + }); + + delay += 6s; + + _scheduler.Schedule(delay, [this](TaskContext) + { + Creature* aysa = me->FindNearestCreatureWithOptions(40.0f, { .StringId = "npc_aysa_quest_29414" }); + + if (!aysa) + return; + + aysa->AI()->DoAction(ACTION_FINISH_MEDITATION); + DoCastSelf(SPELL_UPDATE_PHASE_SHIFT_DEMON_CREATOR); + Talk(SAY_TEXT_6); + me->DespawnOrUnsummon(200ms); + }); + } + + void UpdateAI(uint32 diff) override + { + _scheduler.Update(diff); + } + +private: + TaskScheduler _scheduler; +}; + +// 7756 - Areatrigger +class at_cave_of_meditation : public AreaTriggerScript +{ +public: + at_cave_of_meditation() : AreaTriggerScript("at_cave_of_meditation") { } + + bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override + { + if (player->IsAlive() && player->GetQuestStatus(QUEST_THE_WAY_OF_THE_TUSHUI) == QUEST_STATUS_INCOMPLETE) + { + if (!player->HasAura(SPELL_MEDITATION_TIMER_BAR)) + player->CastSpell(player, SPELL_MEDITATION_TIMER_BAR, TRIGGERED_FULL_MASK); + + return true; + } + return false; + } + + bool OnExit(Player* player, AreaTriggerEntry const* /*trigger*/) override + { + player->RemoveAura(SPELL_MEDITATION_TIMER_BAR); + return true; + } +}; + +// 7645 - Areatrigger +class at_inside_of_cave_of_meditation : public AreaTriggerScript +{ +public: + at_inside_of_cave_of_meditation() : AreaTriggerScript("at_inside_of_cave_of_meditation") { } + + bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override + { + if (player->IsAlive() && player->GetQuestStatus(QUEST_THE_WAY_OF_THE_TUSHUI) == QUEST_STATUS_INCOMPLETE) + { + if (!player->HasAura(SPELL_SUMMON_MASTER_LI_FEI)) + { + Creature* aysa = player->FindNearestCreatureWithOptions(40.0f, { .StringId = "npc_aysa_quest_29414" }); + + if (!aysa) + return false; + + aysa->AI()->Talk(SAY_AYSA_HELP, player); + aysa->AI()->DoAction(ACTION_START_MEDITATION); + player->CastSpell(player, SPELL_SUMMON_MASTER_LI_FEI, TRIGGERED_FULL_MASK); + } + + return true; + } + return false; + } + + bool OnExit(Player* player, AreaTriggerEntry const* /*trigger*/) override + { + if (player->IsAlive() && player->GetQuestStatus(QUEST_THE_WAY_OF_THE_TUSHUI) == QUEST_STATUS_COMPLETE) + { + if (Creature* aysa = player->FindNearestCreatureWithOptions(40.0f, { .StringId = "npc_aysa_quest_29414", .IgnorePhases = true })) + aysa->AI()->DoAction(ACTION_FINISH_EVENT); + } + + return true; + } +}; + +// 116421 - Meditation Timer Bar +class spell_meditation_timer_bar : public AuraScript +{ + void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) + { + if (Unit* target = GetTarget()) + { + target->ModifyPower(POWER_ALTERNATE_POWER, 1); + + if (target->GetPowerPct(POWER_ALTERNATE_POWER) == 100) + { + target->CastSpell(GetTarget(), SPELL_CAVE_OF_SCROLLS_CREDIT, TRIGGERED_FULL_MASK); + target->CastSpell(GetTarget(), SPELL_AYSA_CAVE_OF_SCROLLS_COMP, TRIGGERED_FULL_MASK); + Remove(); + } + } + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_meditation_timer_bar::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); + } +}; + void AddSC_zone_the_wandering_isle() { RegisterCreatureAI(npc_tushui_huojin_trainee); @@ -845,9 +1218,15 @@ void AddSC_zone_the_wandering_isle() RegisterCreatureAI(npc_jaomin_ro_hawk); RegisterCreatureAI(npc_min_dimwind_summon); RegisterCreatureAI(npc_amberleaf_scamp); + RegisterCreatureAI(npc_aysa_cloudsinger_summon); + RegisterCreatureAI(npc_aysa_cloudsinger_cave_of_meditation); + RegisterCreatureAI(npc_master_li_fei_summon); RegisterSpellScript(spell_force_summoner_to_ride_vehicle); RegisterSpellScript(spell_ride_drake); + RegisterSpellScript(spell_meditation_timer_bar); new at_min_dimwind_captured(); + new at_cave_of_meditation(); + new at_inside_of_cave_of_meditation(); } |