-
Notifications
You must be signed in to change notification settings - Fork 202
Expand file tree
/
Copy pathundercity.cpp
More file actions
162 lines (134 loc) · 4.99 KB
/
undercity.cpp
File metadata and controls
162 lines (134 loc) · 4.99 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/* This file is part of the ScriptDev2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* ScriptData
SDName: Undercity
SD%Complete: 95
SDComment: Quest support: 9180(post-event).
SDCategory: Undercity
EndScriptData */
/* ContentData
npc_lady_sylvanas_windrunner
EndContentData */
#include "precompiled.h"
/*######
## npc_lady_sylvanas_windrunner
######*/
enum
{
EMOTE_LAMENT_START = -1000193,
SAY_LAMENT_END = -1000196,
EMOTE_LAMENT_END = -1000197,
SPELL_HIGHBORNE_AURA = 37090,
SPELL_SYLVANAS_CAST = 36568,
SPELL_RIBBON_OF_SOULS = 37099,
NPC_HIGHBORNE_LAMENTER = 21628,
NPC_HIGHBORNE_BUNNY = 21641,
QUEST_ID_JOURNEY_UNDERCITY = 9180,
MAX_LAMENTERS = 4,
};
static const float aHighborneLoc[MAX_LAMENTERS][4] =
{
{1285.41f, 312.47f, -61.0f, 0.51f},
{1286.96f, 310.40f, -61.0f, 1.00f},
{1289.66f, 309.66f, -61.0f, 1.52f},
{1292.51f, 310.50f, -61.0f, 1.99f},
};
struct npc_lady_sylvanas_windrunnerAI : public ScriptedAI
{
npc_lady_sylvanas_windrunnerAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
uint32 m_uiLamentEventTimer;
uint32 m_uiSummonTimer;
void Reset() override
{
m_uiLamentEventTimer = 0;
m_uiSummonTimer = 0;
}
void JustSummoned(Creature* pSummoned) override
{
if (pSummoned->GetEntry() == NPC_HIGHBORNE_BUNNY)
pSummoned->CastSpell(pSummoned, SPELL_RIBBON_OF_SOULS, false);
else if (pSummoned->GetEntry() == NPC_HIGHBORNE_LAMENTER)
{
pSummoned->CastSpell(pSummoned, SPELL_HIGHBORNE_AURA, false);
pSummoned->SetLevitate(true);
pSummoned->GetMotionMaster()->MovePoint(0, pSummoned->GetPositionX(), pSummoned->GetPositionY(), pSummoned->GetPositionZ() + 5.0f);
}
}
void DoStartLamentEvent()
{
DoScriptText(EMOTE_LAMENT_START, m_creature);
DoCastSpellIfCan(m_creature, SPELL_SYLVANAS_CAST);
m_uiSummonTimer = 13000;
}
void UpdateAI(const uint32 uiDiff) override
{
if (m_uiLamentEventTimer)
{
if (m_uiLamentEventTimer <= uiDiff)
{
float fX, fY, fZ;
m_creature->GetRandomPoint(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 20.0f, fX, fY, fZ);
m_creature->SummonCreature(NPC_HIGHBORNE_BUNNY, fX, fY, fZ + 15.0f, 0, TEMPSUMMON_TIMED_DESPAWN, 3000);
m_uiLamentEventTimer = 2000;
if (!m_creature->HasAura(SPELL_SYLVANAS_CAST))
{
DoScriptText(SAY_LAMENT_END, m_creature);
DoScriptText(EMOTE_LAMENT_END, m_creature);
m_uiLamentEventTimer = 0;
}
}
else
m_uiLamentEventTimer -= uiDiff;
}
if (m_uiSummonTimer)
{
if (m_uiSummonTimer <= uiDiff)
{
for (uint8 i = 0; i < MAX_LAMENTERS; ++i)
m_creature->SummonCreature(NPC_HIGHBORNE_LAMENTER, aHighborneLoc[i][0], aHighborneLoc[i][1], aHighborneLoc[i][2], aHighborneLoc[i][3], TEMPSUMMON_TIMED_DESPAWN, 160000);
m_uiLamentEventTimer = 2000;
m_uiSummonTimer = 0;
}
else
m_uiSummonTimer -= uiDiff;
}
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_npc_lady_sylvanas_windrunner(Creature* pCreature)
{
return new npc_lady_sylvanas_windrunnerAI(pCreature);
}
bool QuestRewarded_npc_lady_sylvanas_windrunner(Player* /*pPlayer*/, Creature* pCreature, Quest const* pQuest)
{
if (pQuest->GetQuestId() == QUEST_ID_JOURNEY_UNDERCITY)
{
if (npc_lady_sylvanas_windrunnerAI* pSylvanAI = dynamic_cast<npc_lady_sylvanas_windrunnerAI*>(pCreature->AI()))
pSylvanAI->DoStartLamentEvent();
}
return true;
}
void AddSC_undercity()
{
Script* pNewScript;
pNewScript = new Script;
pNewScript->Name = "npc_lady_sylvanas_windrunner";
pNewScript->GetAI = &GetAI_npc_lady_sylvanas_windrunner;
pNewScript->pQuestRewardedNPC = &QuestRewarded_npc_lady_sylvanas_windrunner;
pNewScript->RegisterSelf();
}