refactor(Scripts/MagisterTerrace): Move Kalecgos script to SAI (#20495)

* refactor(Scripts/MagisterTerrace): Move Kalecgos script to SAI

* Update instance_magisters_terrace.cpp
This commit is contained in:
Andrew
2024-11-10 20:58:51 -03:00
committed by GitHub
parent aede0020cb
commit 7f558f4e38
3 changed files with 19 additions and 67 deletions
@@ -0,0 +1,16 @@
--
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = 24844;
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 24844) AND (`source_type` = 0) AND (`id` IN (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
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_param6`, `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
(24844, 0, 0, 1, 34, 0, 100, 0, 0, 6, 0, 0, 0, 0, 5, 293, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Kalecgos - On Reached Point 6 - Play Emote 293'),
(24844, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 207, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Kalecgos - On Reached Point 6 - Set hover 0'),
(24844, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 67, 0, 2000, 2000, 0, 0, 100, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Kalecgos - On Reached Point 6 - Create Timed Event'),
(24844, 0, 3, 4, 59, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 44762, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Kalecgos - On Timed Event 0 Triggered - Cast \'Camera Shake - Med\''),
(24844, 0, 4, 5, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 227, 0.6, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Kalecgos - On Timed Event 0 Triggered - Set Scale to 0.6%'),
(24844, 0, 5, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 67, 1, 1000, 1000, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Kalecgos - On Timed Event 0 Triggered - Create Timed Event'),
(24844, 0, 6, 7, 59, 0, 100, 0, 1, 0, 0, 0, 0, 0, 11, 46307, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Kalecgos - On Timed Event 1 Triggered - Cast \'Scrying Orb Kill Credit\''),
(24844, 0, 7, 8, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 24085, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Kalecgos - On Timed Event 1 Triggered - Cast \'Transform Visual\''),
(24844, 0, 8, 9, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 44670, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Kalecgos - On Timed Event 1 Triggered - Cast \'KalecgosTransform into Kalec\''),
(24844, 0, 9, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 36, 24848, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Kalecgos - On Timed Event 1 Triggered - Update Template To \'Kalecgos\''),
(24844, 0, 10, 0, 25, 0, 100, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Kalecgos - On Reset - Say Line 0');
@@ -23,6 +23,7 @@
ObjectData const creatureData[] = ObjectData const creatureData[] =
{ {
{ NPC_KAEL_THAS, DATA_KAELTHAS },
{ NPC_KALECGOS, DATA_KALECGOS }, { NPC_KALECGOS, DATA_KALECGOS },
{ 0, 0 } { 0, 0 }
}; };
@@ -59,28 +60,20 @@ public:
LoadDoorData(doorData); LoadDoorData(doorData);
} }
ObjectGuid EscapeOrbGUID;
ObjectGuid DelrissaGUID; ObjectGuid DelrissaGUID;
ObjectGuid KaelGUID;
void ProcessEvent(WorldObject* /*obj*/, uint32 eventId) override void ProcessEvent(WorldObject* /*obj*/, uint32 eventId) override
{ {
if (eventId == EVENT_SPAWN_KALECGOS) if (eventId == EVENT_SPAWN_KALECGOS)
{
if (!GetCreature(DATA_KALECGOS) && !scheduler.IsGroupScheduled(DATA_KALECGOS)) if (!GetCreature(DATA_KALECGOS) && !scheduler.IsGroupScheduled(DATA_KALECGOS))
{ {
scheduler.Schedule(1min, 1min, DATA_KALECGOS,[this](TaskContext) scheduler.Schedule(1min, 1min, DATA_KALECGOS,[this](TaskContext)
{ {
if (Creature* kalecgos = instance->SummonCreature(NPC_KALECGOS, KalecgosSpawnPos)) if (Creature* kalecgos = instance->SummonCreature(NPC_KALECGOS, KalecgosSpawnPos))
{
kalecgos->GetMotionMaster()->MovePath(PATH_KALECGOS_FLIGHT, false); kalecgos->GetMotionMaster()->MovePath(PATH_KALECGOS_FLIGHT, false);
kalecgos->AI()->Talk(SAY_KALECGOS_SPAWN);
}
}); });
} }
} }
}
void OnCreatureCreate(Creature* creature) override void OnCreatureCreate(Creature* creature) override
{ {
@@ -89,12 +82,9 @@ public:
case NPC_DELRISSA: case NPC_DELRISSA:
DelrissaGUID = creature->GetGUID(); DelrissaGUID = creature->GetGUID();
break; break;
case NPC_KAEL_THAS:
KaelGUID = creature->GetGUID();
break;
case NPC_PHOENIX: case NPC_PHOENIX:
case NPC_PHOENIX_EGG: case NPC_PHOENIX_EGG:
if (Creature* kael = instance->GetCreature(KaelGUID)) if (Creature* kael = GetCreature(DATA_KAELTHAS))
kael->AI()->JustSummoned(creature); kael->AI()->JustSummoned(creature);
break; break;
} }
@@ -105,9 +95,7 @@ public:
ObjectGuid GetGuidData(uint32 identifier) const override ObjectGuid GetGuidData(uint32 identifier) const override
{ {
if (identifier == NPC_DELRISSA) if (identifier == NPC_DELRISSA)
{
return DelrissaGUID; return DelrissaGUID;
}
return ObjectGuid::Empty; return ObjectGuid::Empty;
} }
@@ -119,53 +107,7 @@ public:
} }
}; };
enum Spells
{
SPELL_KALECGOS_TRANSFORM = 44670,
SPELL_TRANSFORM_VISUAL = 24085,
SPELL_CAMERA_SHAKE = 44762,
SPELL_ORB_KILL_CREDIT = 46307
};
enum MovementPoints
{
POINT_ID_PREPARE_LANDING = 6
};
struct npc_kalecgos : public ScriptedAI
{
npc_kalecgos(Creature* creature) : ScriptedAI(creature) { }
void MovementInform(uint32 type, uint32 pointId) override
{
if (type != WAYPOINT_MOTION_TYPE)
return;
if (pointId == POINT_ID_PREPARE_LANDING)
{
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
me->SetDisableGravity(false);
me->SetHover(false);
me->m_Events.AddEventAtOffset([this]()
{
DoCastAOE(SPELL_CAMERA_SHAKE);
me->SetObjectScale(0.6f);
me->m_Events.AddEventAtOffset([this]()
{
DoCastSelf(SPELL_ORB_KILL_CREDIT, true);
DoCastSelf(SPELL_TRANSFORM_VISUAL);
DoCastSelf(SPELL_KALECGOS_TRANSFORM);
me->UpdateEntry(NPC_HUMAN_KALECGOS);
}, 1s);
}, 2s);
}
}
};
void AddSC_instance_magisters_terrace() void AddSC_instance_magisters_terrace()
{ {
new instance_magisters_terrace(); new instance_magisters_terrace();
RegisterMagistersTerraceCreatureAI(npc_kalecgos);
} }
@@ -42,8 +42,7 @@ enum MTCreatures
NPC_KAEL_THAS = 24664, NPC_KAEL_THAS = 24664,
NPC_PHOENIX = 21362, NPC_PHOENIX = 21362,
NPC_PHOENIX_EGG = 21364, NPC_PHOENIX_EGG = 21364,
NPC_KALECGOS = 24844, NPC_KALECGOS = 24844
NPC_HUMAN_KALECGOS = 24848
}; };
enum MTGameObjects enum MTGameObjects
@@ -61,11 +60,6 @@ enum InstanceEventIds
EVENT_SPAWN_KALECGOS = 16547 EVENT_SPAWN_KALECGOS = 16547
}; };
enum InstanceText
{
SAY_KALECGOS_SPAWN = 0
};
enum MovementData enum MovementData
{ {
PATH_KALECGOS_FLIGHT = 248440 PATH_KALECGOS_FLIGHT = 248440