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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
/*
* Copyright (C)
* Copyright (C)
*
* 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: Westfall
SD%Complete: 90
SDComment: Quest support: 155
SDCategory: Westfall
EndScriptData */
/* ContentData
npc_daphne_stilwell
EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "Player.h"
/*######
## npc_daphne_stilwell
######*/
enum DaphneStilwell
{
// Yells
SAY_DS_START = 0,
SAY_DS_DOWN_1 = 1,
SAY_DS_DOWN_2 = 2,
SAY_DS_DOWN_3 = 3,
SAY_DS_PROLOGUE = 4,
// Spells
SPELL_SHOOT = 6660,
// Quests
QUEST_TOME_VALOR = 1651,
// Creatures
NPC_DEFIAS_RAIDER = 6180,
// Equips
EQUIP_ID_RIFLE = 2511
};
class npc_daphne_stilwell : public CreatureScript
{
public:
npc_daphne_stilwell() : CreatureScript("npc_daphne_stilwell") { }
bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest)
{
if (quest->GetQuestId() == QUEST_TOME_VALOR)
{
creature->AI()->Talk(SAY_DS_START);
if (npc_escortAI* pEscortAI = CAST_AI(npc_daphne_stilwell::npc_daphne_stilwellAI, creature->AI()))
pEscortAI->Start(true, true, player->GetGUID());
}
return true;
}
CreatureAI* GetAI(Creature* creature) const
{
return new npc_daphne_stilwellAI(creature);
}
struct npc_daphne_stilwellAI : public npc_escortAI
{
npc_daphne_stilwellAI(Creature* creature) : npc_escortAI(creature), summons(me) { }
SummonList summons;
uint8 textCounter;
void Reset()
{
summons.DespawnAll();
textCounter = SAY_DS_DOWN_1;
}
void WaypointReached(uint32 waypointId)
{
Player* player = GetPlayerForEscort();
if (!player)
{
me->DespawnOrUnsummon(1);
return;
}
switch (waypointId)
{
case 4:
SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE, EQUIP_ID_RIFLE);
me->SetSheath(SHEATH_STATE_RANGED);
me->HandleEmoteCommand(EMOTE_STATE_USE_STANDING_NO_SHEATHE);
break;
case 7:
me->SummonCreature(NPC_DEFIAS_RAIDER, -11435.52f, 1601.26f, 68.06f, 4.1f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11440.96f, 1599.69f, 66.35f, 4.09f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11433.44f, 1594.24f, 66.99f, 4.05f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
break;
case 8:
me->SetSheath(SHEATH_STATE_RANGED);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11435.52f, 1601.26f, 68.06f, 4.1f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11440.96f, 1599.69f, 66.35f, 4.09f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11433.44f, 1594.24f, 66.99f, 4.05f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11428.29f, 1598.37f, 70.90f, 3.9f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
break;
case 9:
me->SetSheath(SHEATH_STATE_RANGED);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11435.52f, 1601.26f, 68.06f, 4.1f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11440.96f, 1599.69f, 66.35f, 4.09f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11433.44f, 1594.24f, 66.99f, 4.05f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11428.29f, 1598.37f, 70.90f, 3.9f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11438.14f, 1607.6f, 70.94f, 4.38f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
break;
case 10:
SetRun(false);
break;
case 11:
Talk(SAY_DS_PROLOGUE);
break;
case 13:
SetEquipmentSlots(true);
me->SetSheath(SHEATH_STATE_UNARMED);
me->HandleEmoteCommand(EMOTE_STATE_USE_STANDING_NO_SHEATHE);
break;
case 17:
SetEscortPaused(true);
player->GroupEventHappens(QUEST_TOME_VALOR, me);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
me->DespawnOrUnsummon(60000);
break;
}
}
void AttackStart(Unit* who)
{
if (me->Attack(who, false))
{
me->SetInCombatWith(who);
who->SetInCombatWith(me);
}
}
void JustSummoned(Creature* creature)
{
creature->SetHomePosition(me->GetHomePosition());
creature->GetMotionMaster()->MoveChase(me);
creature->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
creature->AI()->AttackStart(me);
creature->AddThreat(me, 0.0f);
summons.Summon(creature);
}
void SummonedCreatureDies(Creature* creature, Unit*)
{
summons.Despawn(creature);
if (summons.empty())
Talk(textCounter++, GetPlayerForEscort());
}
void Update(const uint32 diff)
{
npc_escortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
if (me->isAttackReady(BASE_ATTACK))
{
if (!me->IsWithinDist(me->GetVictim(), ATTACK_DISTANCE))
DoCastVictim(SPELL_SHOOT, true);
else
{
me->SetSheath(SHEATH_STATE_MELEE);
me->AttackerStateUpdate(me->GetVictim());
}
me->resetAttackTimer();
}
}
};
};
void AddSC_westfall()
{
new npc_daphne_stilwell();
}
|