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

View File

@@ -23,6 +23,7 @@
ObjectData const creatureData[] =
{
{ NPC_KAEL_THAS, DATA_KAELTHAS },
{ NPC_KALECGOS, DATA_KALECGOS },
{ 0, 0 }
};
@@ -59,27 +60,19 @@ public:
LoadDoorData(doorData);
}
ObjectGuid EscapeOrbGUID;
ObjectGuid DelrissaGUID;
ObjectGuid KaelGUID;
void ProcessEvent(WorldObject* /*obj*/, uint32 eventId) override
{
if (eventId == EVENT_SPAWN_KALECGOS)
{
if (!GetCreature(DATA_KALECGOS) && !scheduler.IsGroupScheduled(DATA_KALECGOS))
{
scheduler.Schedule(1min, 1min, DATA_KALECGOS,[this](TaskContext)
{
if (Creature* kalecgos = instance->SummonCreature(NPC_KALECGOS, KalecgosSpawnPos))
{
kalecgos->GetMotionMaster()->MovePath(PATH_KALECGOS_FLIGHT, false);
kalecgos->AI()->Talk(SAY_KALECGOS_SPAWN);
}
});
}
}
}
void OnCreatureCreate(Creature* creature) override
@@ -89,12 +82,9 @@ public:
case NPC_DELRISSA:
DelrissaGUID = creature->GetGUID();
break;
case NPC_KAEL_THAS:
KaelGUID = creature->GetGUID();
break;
case NPC_PHOENIX:
case NPC_PHOENIX_EGG:
if (Creature* kael = instance->GetCreature(KaelGUID))
if (Creature* kael = GetCreature(DATA_KAELTHAS))
kael->AI()->JustSummoned(creature);
break;
}
@@ -105,9 +95,7 @@ public:
ObjectGuid GetGuidData(uint32 identifier) const override
{
if (identifier == NPC_DELRISSA)
{
return DelrissaGUID;
}
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()
{
new instance_magisters_terrace();
RegisterMagistersTerraceCreatureAI(npc_kalecgos);
}

View File

@@ -42,8 +42,7 @@ enum MTCreatures
NPC_KAEL_THAS = 24664,
NPC_PHOENIX = 21362,
NPC_PHOENIX_EGG = 21364,
NPC_KALECGOS = 24844,
NPC_HUMAN_KALECGOS = 24848
NPC_KALECGOS = 24844
};
enum MTGameObjects
@@ -61,11 +60,6 @@ enum InstanceEventIds
EVENT_SPAWN_KALECGOS = 16547
};
enum InstanceText
{
SAY_KALECGOS_SPAWN = 0
};
enum MovementData
{
PATH_KALECGOS_FLIGHT = 248440