aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
blob: d53c63a3acda251f56f7dda9266f91794e0b7d5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */

/* ScriptData
SDName: Magisters_Terrace
SD%Complete: 100
SDComment: Quest support: 11490(post-event)
SDCategory: Magisters Terrace
EndScriptData */

/* ContentData
npc_kalecgos
EndContentData */

#include "ScriptMgr.h"
#include "magisters_terrace.h"
#include "MotionMaster.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"

/*######
## npc_kalecgos
######*/

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
};

enum EventIds
{
    EVENT_KALECGOS_TRANSFORM         = 1,
    EVENT_KALECGOS_LANDING           = 2
};

class npc_kalecgos : public CreatureScript
{
public:
    npc_kalecgos() : CreatureScript("npc_kalecgos") { }

    struct npc_kalecgosAI : public ScriptedAI
    {
        npc_kalecgosAI(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);
                events.ScheduleEvent(EVENT_KALECGOS_LANDING, 2s);
            }
        }

        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, 1s);
                    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;
    };

    CreatureAI* GetAI(Creature* creature) const override
    {
        return GetMagistersTerraceAI<npc_kalecgosAI>(creature);
    }
};

void AddSC_magisters_terrace()
{
    new npc_kalecgos();
}