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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
* Free Software Foundation; either version 3 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 Affero 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/>.
*/
/* Script Data Start
SDName: Redridge Mountains
SD%Complete: 100%
SDComment: Support for quest 219.
Script Data End */
#include "CreatureScript.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
enum CorporalKeeshan
{
QUEST_MISSING_IN_ACTION = 219,
SAY_CORPORAL_1 = 0,
SAY_CORPORAL_2 = 1,
SAY_CORPORAL_3 = 2,
SAY_CORPORAL_4 = 3,
SAY_CORPORAL_5 = 4,
SPELL_MOCKING_BLOW = 21008,
SPELL_SHIELD_BASH = 11972
};
class npc_corporal_keeshan : public CreatureScript
{
public:
npc_corporal_keeshan() : CreatureScript("npc_corporal_keeshan") { }
struct npc_corporal_keeshanAI : public npc_escortAI
{
npc_corporal_keeshanAI(Creature* creature) : npc_escortAI(creature) { }
void Reset() override
{
timer = 0;
phase = 0;
mockingBlowTimer = 5000;
shieldBashTimer = 8000;
me->SetImmuneToNPC(true);
}
void sQuestAccept(Player* player, Quest const* quest) override
{
if (quest->GetQuestId() == QUEST_MISSING_IN_ACTION)
{
Talk(SAY_CORPORAL_1, player);
npc_escortAI::Start(true, false, player->GetGUID(), quest);
me->SetImmuneToNPC(false);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE);
}
}
void WaypointReached(uint32 waypointId) override
{
Player* player = GetPlayerForEscort();
if (!player)
return;
if (waypointId >= 65)
me->SetWalk(false);
switch (waypointId)
{
case 39:
SetEscortPaused(true);
timer = 2000;
phase = 1;
break;
case 65:
me->SetWalk(false);
break;
case 115:
player->GroupEventHappens(QUEST_MISSING_IN_ACTION, me);
timer = 2000;
phase = 4;
break;
}
}
void UpdateAI(uint32 diff) override
{
if (HasEscortState(STATE_ESCORT_NONE))
return;
npc_escortAI::UpdateAI(diff);
if (phase)
{
if (timer <= diff)
{
switch (phase)
{
case 1:
me->SetStandState(UNIT_STAND_STATE_SIT);
timer = 1000;
phase = 2;
break;
case 2:
Talk(SAY_CORPORAL_2);
timer = 15000;
phase = 3;
break;
case 3:
Talk(SAY_CORPORAL_3);
me->SetStandState(UNIT_STAND_STATE_STAND);
SetEscortPaused(false);
timer = 0;
phase = 0;
break;
case 4:
Talk(SAY_CORPORAL_4);
timer = 2500;
phase = 5;
break;
case 5:
Talk(SAY_CORPORAL_5);
timer = 0;
phase = 0;
break;
}
}
else timer -= diff;
}
if (!UpdateVictim())
return;
if (mockingBlowTimer <= diff)
{
DoCastVictim(SPELL_MOCKING_BLOW);
mockingBlowTimer = 5000;
}
else mockingBlowTimer -= diff;
if (shieldBashTimer <= diff)
{
DoCastVictim(SPELL_MOCKING_BLOW);
shieldBashTimer = 8000;
}
else shieldBashTimer -= diff;
DoMeleeAttackIfReady();
}
private:
uint32 phase;
uint32 timer;
uint32 mockingBlowTimer;
uint32 shieldBashTimer;
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_corporal_keeshanAI(creature);
}
};
void AddSC_redridge_mountains()
{
new npc_corporal_keeshan();
}
|