Scripts/Magister's Terrace: Script Kalecgos' appearance after using the Scryer's Orb

- Added missing waypoints, spells, emotes, proper timing... and prevent him from being summoned multiple times
Closes #13208, #16522
This commit is contained in:
Nyeriah
2016-02-10 03:03:59 -02:00
parent 6904073c9c
commit 6a56ede179
4 changed files with 106 additions and 51 deletions

View File

@@ -0,0 +1,18 @@
-- Pathing for Kalecgos Entry: 24844 'TDB FORMAT'
SET @NPC := 24844;
SET @PATH := @NPC * 10;
DELETE FROM `waypoint_data` WHERE `id`=@PATH;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_type`,`action`,`action_chance`,`wpguid`) VALUES
(@PATH,1,163.9735,-398.0906,2.083333,0,0,0,0,100,0), -- 16:16:43
(@PATH,2,164.3802,-397.1771,2.083333,0,0,0,0,100,0), -- 16:16:43
(@PATH,3,162.7923,-386.1964,15.67094,0,0,0,0,100,0), -- 16:16:43
(@PATH,4,151.5555,-345.349,5.92646,0,0,0,0,100,0), -- 16:16:43
(@PATH,5,162.2416,-299.8032,-5.436685,0,0,0,0,100,0), -- 16:16:43
(@PATH,6,199.7482,-272.3315,-7.186677,0,0,0,0,100,0), -- 16:16:43
(@PATH,7,199.7482,-272.3315,-7.186677,0,0,0,0,100,0), -- 16:16:43
(@PATH,8,199.7482,-272.3315,-7.186677,0.06981317,0,0,0,100,0); -- 16:16:54
-- 0x1C2F2C4920184300001F1D000038BF6E .go 163.9735 -398.0906 2.083333
DELETE FROM `creature_text` WHERE `entry` = 24844 AND `groupid` = 0;
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(24844, 0, 0, 'Be still, mortals, and hearken to my words.', 14, 0, 100, 0, 0, 0, 23936, 3, 'Kalecgos - SAY_KALECGOS_SPAWN');

View File

@@ -36,6 +36,8 @@ DoorData const doorData[] =
{ 0, 0, DOOR_TYPE_ROOM } // END
};
Position const KalecgosSpawnPos = { 164.3747f, -397.1197f, 2.151798f, 1.66219f };
class instance_magisters_terrace : public InstanceMapScript
{
public:
@@ -93,6 +95,10 @@ class instance_magisters_terrace : public InstanceMapScript
case NPC_DELRISSA:
DelrissaGUID = creature->GetGUID();
break;
case NPC_KALECGOS:
case NPC_HUMAN_KALECGOS:
KalecgosGUID = creature->GetGUID();
break;
default:
break;
}
@@ -139,6 +145,25 @@ class instance_magisters_terrace : public InstanceMapScript
}
}
void ProcessEvent(WorldObject* obj, uint32 eventId) override
{
if (eventId == EVENT_SPAWN_KALECGOS)
if (!ObjectAccessor::GetCreature(*obj, KalecgosGUID) && events.Empty())
events.ScheduleEvent(EVENT_SPAWN_KALECGOS, Minutes(1));
}
void Update(uint32 diff) override
{
events.Update(diff);
if (events.ExecuteEvent() == EVENT_SPAWN_KALECGOS)
if (Creature* kalecgos = instance->SummonCreature(NPC_KALECGOS, KalecgosSpawnPos))
{
kalecgos->GetMotionMaster()->MovePath(PATH_KALECGOS_FLIGHT, false);
kalecgos->AI()->Talk(SAY_KALECGOS_SPAWN);
}
}
bool SetBossState(uint32 type, EncounterState state) override
{
if (!InstanceScript::SetBossState(type, state))
@@ -177,10 +202,12 @@ class instance_magisters_terrace : public InstanceMapScript
}
protected:
EventMap events;
ObjectGuid SelinGUID;
ObjectGuid DelrissaGUID;
ObjectGuid KaelStatue[2];
ObjectGuid EscapeOrbGUID;
ObjectGuid KalecgosGUID;
uint32 DelrissaDeathCount;
};

View File

@@ -31,7 +31,7 @@ EndContentData */
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "Player.h"
#include "SpellInfo.h"
#include "magisters_terrace.h"
/*######
## npc_kalecgos
@@ -39,30 +39,29 @@ EndContentData */
enum Spells
{
SPELL_TRANSFORM_TO_KAEL = 44670,
SPELL_KALECGOS_TRANSFORM = 44670,
SPELL_TRANSFORM_VISUAL = 24085,
SPELL_CAMERA_SHAKE = 44762,
SPELL_ORB_KILL_CREDIT = 46307
};
enum Creatures
enum MovementPoints
{
NPC_KAEL = 24848 //human form entry
POINT_ID_PREPARE_LANDING = 6
};
enum Misc
enum EventIds
{
POINT_ID_LAND = 1
EVENT_KALECGOS_TRANSFORM = 1,
EVENT_KALECGOS_LANDING = 2
};
const float afKaelLandPoint[] = {225.045f, -276.236f, -5.434f};
#define GOSSIP_ITEM_KAEL_1 "Who are you?"
#define GOSSIP_ITEM_KAEL_2 "What can we do to assist you?"
#define GOSSIP_ITEM_KAEL_3 "What brings you to the Sunwell?"
#define GOSSIP_ITEM_KAEL_4 "You're not alone here?"
#define GOSSIP_ITEM_KAEL_5 "What would Kil'jaeden want with a mortal woman?"
// This is friendly keal that appear after used Orb.
// If we assume DB handle summon, summon appear somewhere outside the platform where Orb is
class npc_kalecgos : public CreatureScript
{
public:
@@ -115,52 +114,46 @@ public:
struct npc_kalecgosAI : public ScriptedAI
{
npc_kalecgosAI(Creature* creature) : ScriptedAI(creature)
npc_kalecgosAI(Creature* creature) : ScriptedAI(creature) { }
void MovementInform(uint32 type, uint32 pointId) override
{
Initialize();
}
void Initialize()
{
m_uiTransformTimer = 0;
}
uint32 m_uiTransformTimer;
void Reset() override
{
Initialize();
// we must assume he appear as dragon somewhere outside the platform of orb, and then move directly to here
if (me->GetEntry() != NPC_KAEL)
me->GetMotionMaster()->MovePoint(POINT_ID_LAND, afKaelLandPoint[0], afKaelLandPoint[1], afKaelLandPoint[2]);
}
void MovementInform(uint32 uiType, uint32 uiPointId) override
{
if (uiType != POINT_MOTION_TYPE)
if (type != WAYPOINT_MOTION_TYPE)
return;
if (uiPointId == POINT_ID_LAND)
m_uiTransformTimer = MINUTE*IN_MILLISECONDS;
}
void UpdateAI(uint32 uiDiff) override
{
if (m_uiTransformTimer)
if (pointId == POINT_ID_PREPARE_LANDING)
{
if (m_uiTransformTimer <= uiDiff)
{
DoCast(me, SPELL_ORB_KILL_CREDIT, true);
// Transform and update entry, now ready for quest/read gossip
DoCast(me, SPELL_TRANSFORM_TO_KAEL, false);
me->UpdateEntry(NPC_KAEL);
m_uiTransformTimer = 0;
} else m_uiTransformTimer -= uiDiff;
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
me->SetDisableGravity(false);
me->SetHover(false);
events.ScheduleEvent(EVENT_KALECGOS_LANDING, Seconds(2));
}
}
void UpdateAI(uint32 diff) override
{
events.Update(diff);
switch (events.ExecuteEvent())
{
case EVENT_KALECGOS_LANDING:
DoCastAOE(SPELL_CAMERA_SHAKE);
me->SetObjectScale(0.6f);
events.ScheduleEvent(EVENT_KALECGOS_TRANSFORM, Seconds(1));
break;
case EVENT_KALECGOS_TRANSFORM:
DoCast(me, SPELL_ORB_KILL_CREDIT, true);
DoCast(me, SPELL_TRANSFORM_VISUAL, false);
DoCast(me, SPELL_KALECGOS_TRANSFORM, false);
me->UpdateEntry(NPC_HUMAN_KALECGOS);
break;
default:
break;
}
}
private:
EventMap events;
};
};

View File

@@ -42,7 +42,9 @@ enum CreatureIds
{
NPC_SELIN = 24723,
NPC_DELRISSA = 24560,
NPC_FEL_CRYSTAL = 24722
NPC_FEL_CRYSTAL = 24722,
NPC_KALECGOS = 24844,
NPC_HUMAN_KALECGOS = 24848
};
enum GameObjectIds
@@ -57,4 +59,19 @@ enum GameObjectIds
GO_ESCAPE_ORB = 188173
};
enum InstanceEventIds
{
EVENT_SPAWN_KALECGOS = 16547
};
enum InstanceText
{
SAY_KALECGOS_SPAWN = 0
};
enum MovementData
{
PATH_KALECGOS_FLIGHT = 248440
};
#endif