-
Notifications
You must be signed in to change notification settings - Fork 202
Expand file tree
/
Copy pathgo_scripts.cpp
More file actions
371 lines (312 loc) · 11 KB
/
go_scripts.cpp
File metadata and controls
371 lines (312 loc) · 11 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
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
/* 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: GO_Scripts
SD%Complete: 100
SDComment: Quest support: 5097, 5098, 12557, 14092/14076. Barov_journal->Teaches spell 26089
SDCategory: Game Objects
EndScriptData */
/* ContentData
go_barov_journal
go_ethereum_prison
go_ethereum_stasis
go_mysterious_snow_mound
go_tele_to_dalaran_crystal
go_tele_to_violet_stand
go_andorhal_tower
go_scourge_enclosure
go_lab_work_reagents
EndContentData */
#include "precompiled.h"
/*######
## go_barov_journal
######*/
enum
{
SPELL_TAILOR_FELCLOTH_BAG = 26086,
SPELL_LEARN_FELCLOTH_BAG = 26095
};
bool GOUse_go_barov_journal(Player* pPlayer, GameObject* /*pGo*/)
{
if (pPlayer->HasSkill(SKILL_TAILORING) && pPlayer->GetBaseSkillValue(SKILL_TAILORING) >= 280 && !pPlayer->HasSpell(SPELL_TAILOR_FELCLOTH_BAG))
{
pPlayer->CastSpell(pPlayer, SPELL_LEARN_FELCLOTH_BAG, false);
}
return true;
}
/*######
## go_ethereum_prison
######*/
enum
{
FACTION_LC = 1011,
FACTION_SHAT = 935,
FACTION_CE = 942,
FACTION_CON = 933,
FACTION_KT = 989,
FACTION_SPOR = 970,
SPELL_REP_LC = 39456,
SPELL_REP_SHAT = 39457,
SPELL_REP_CE = 39460,
SPELL_REP_CON = 39474,
SPELL_REP_KT = 39475,
SPELL_REP_SPOR = 39476
};
const uint32 uiNpcPrisonEntry[] =
{
22810, 22811, 22812, 22813, 22814, 22815, // good guys
20783, 20784, 20785, 20786, 20788, 20789, 20790 // bad guys
};
bool GOUse_go_ethereum_prison(Player* pPlayer, GameObject* pGo)
{
uint8 uiRandom = urand(0, countof(uiNpcPrisonEntry) - 1);
if (Creature* pCreature = pPlayer->SummonCreature(uiNpcPrisonEntry[uiRandom],
pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), pGo->GetAngle(pPlayer),
TEMPSUMMON_TIMED_OOC_DESPAWN, 30000))
{
if (!pCreature->IsHostileTo(pPlayer))
{
uint32 uiSpell = 0;
if (FactionTemplateEntry const* pFaction = pCreature->getFactionTemplateEntry())
{
switch (pFaction->faction)
{
case FACTION_LC: uiSpell = SPELL_REP_LC; break;
case FACTION_SHAT: uiSpell = SPELL_REP_SHAT; break;
case FACTION_CE: uiSpell = SPELL_REP_CE; break;
case FACTION_CON: uiSpell = SPELL_REP_CON; break;
case FACTION_KT: uiSpell = SPELL_REP_KT; break;
case FACTION_SPOR: uiSpell = SPELL_REP_SPOR; break;
}
if (uiSpell)
pCreature->CastSpell(pPlayer, uiSpell, false);
else
script_error_log("go_ethereum_prison summoned creature (entry %u) but faction (%u) are not expected by script.", pCreature->GetEntry(), pCreature->getFaction());
}
}
}
return false;
}
/*######
## go_ethereum_stasis
######*/
const uint32 uiNpcStasisEntry[] =
{
22825, 20888, 22827, 22826, 22828
};
bool GOUse_go_ethereum_stasis(Player* pPlayer, GameObject* pGo)
{
uint8 uiRandom = urand(0, countof(uiNpcStasisEntry) - 1);
pPlayer->SummonCreature(uiNpcStasisEntry[uiRandom],
pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), pGo->GetAngle(pPlayer),
TEMPSUMMON_TIMED_OOC_DESPAWN, 30000);
return false;
}
/*######
## go_jump_a_tron
######*/
enum
{
SPELL_JUMP_A_TRON = 33382,
NPC_JUMP_A_TRON = 19041
};
bool GOUse_go_jump_a_tron(Player* pPlayer, GameObject* pGo)
{
if (Creature* pCreature = GetClosestCreatureWithEntry(pGo, NPC_JUMP_A_TRON, INTERACTION_DISTANCE))
pCreature->CastSpell(pPlayer, SPELL_JUMP_A_TRON, false);
return false;
}
/*######
## go_mysterious_snow_mound
######*/
enum
{
SPELL_SUMMON_DEEP_JORMUNGAR = 66510,
SPELL_SUMMON_MOLE_MACHINE = 66492,
SPELL_SUMMON_MARAUDER = 66491,
};
bool GOUse_go_mysterious_snow_mound(Player* pPlayer, GameObject* pGo)
{
if (urand(0, 1))
{
pPlayer->CastSpell(pPlayer, SPELL_SUMMON_DEEP_JORMUNGAR, true);
}
else
{
// This is basically wrong, but added for support.
// Mole machine would summon, along with unkonwn GO (a GO trap?) and then
// the npc would summon with base of that location.
pPlayer->CastSpell(pPlayer, SPELL_SUMMON_MOLE_MACHINE, true);
pPlayer->CastSpell(pPlayer, SPELL_SUMMON_MARAUDER, true);
}
pGo->SetLootState(GO_JUST_DEACTIVATED);
return true;
}
/*######
## go_tele_to_dalaran_crystal
######*/
enum
{
QUEST_LEARN_LEAVE_RETURN = 12790,
QUEST_TELE_CRYSTAL_FLAG = 12845
};
bool GOUse_go_tele_to_dalaran_crystal(Player* pPlayer, GameObject* /*pGo*/)
{
if (pPlayer->GetQuestRewardStatus(QUEST_TELE_CRYSTAL_FLAG))
return false;
// TODO: must send error message (what kind of message? On-screen?)
return true;
}
/*######
## go_tele_to_violet_stand
######*/
bool GOUse_go_tele_to_violet_stand(Player* pPlayer, GameObject* /*pGo*/)
{
if (pPlayer->GetQuestRewardStatus(QUEST_LEARN_LEAVE_RETURN) || pPlayer->GetQuestStatus(QUEST_LEARN_LEAVE_RETURN) == QUEST_STATUS_INCOMPLETE)
return false;
return true;
}
/*######
## go_andorhal_tower
######*/
enum
{
QUEST_ALL_ALONG_THE_WATCHTOWERS_ALLIANCE = 5097,
QUEST_ALL_ALONG_THE_WATCHTOWERS_HORDE = 5098,
NPC_ANDORHAL_TOWER_1 = 10902,
NPC_ANDORHAL_TOWER_2 = 10903,
NPC_ANDORHAL_TOWER_3 = 10904,
NPC_ANDORHAL_TOWER_4 = 10905,
GO_ANDORHAL_TOWER_1 = 176094,
GO_ANDORHAL_TOWER_2 = 176095,
GO_ANDORHAL_TOWER_3 = 176096,
GO_ANDORHAL_TOWER_4 = 176097
};
bool GOUse_go_andorhal_tower(Player* pPlayer, GameObject* pGo)
{
if (pPlayer->GetQuestStatus(QUEST_ALL_ALONG_THE_WATCHTOWERS_ALLIANCE) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_ALL_ALONG_THE_WATCHTOWERS_HORDE) == QUEST_STATUS_INCOMPLETE)
{
uint32 uiKillCredit = 0;
switch (pGo->GetEntry())
{
case GO_ANDORHAL_TOWER_1: uiKillCredit = NPC_ANDORHAL_TOWER_1; break;
case GO_ANDORHAL_TOWER_2: uiKillCredit = NPC_ANDORHAL_TOWER_2; break;
case GO_ANDORHAL_TOWER_3: uiKillCredit = NPC_ANDORHAL_TOWER_3; break;
case GO_ANDORHAL_TOWER_4: uiKillCredit = NPC_ANDORHAL_TOWER_4; break;
}
if (uiKillCredit)
pPlayer->KilledMonsterCredit(uiKillCredit);
}
return true;
}
/*######
## go_scourge_enclosure
######*/
enum
{
SPELL_GYMER_LOCK_EXPLOSION = 55529,
NPC_GYMER_LOCK_DUMMY = 29928
};
bool GOUse_go_scourge_enclosure(Player* pPlayer, GameObject* pGo)
{
std::list<Creature*> m_lResearchersList;
GetCreatureListWithEntryInGrid(m_lResearchersList, pGo, NPC_GYMER_LOCK_DUMMY, 15.0f);
if (!m_lResearchersList.empty())
{
for (std::list<Creature*>::iterator itr = m_lResearchersList.begin(); itr != m_lResearchersList.end(); ++itr)
{
(*itr)->CastSpell((*itr), SPELL_GYMER_LOCK_EXPLOSION, true);
}
}
pPlayer->KilledMonsterCredit(NPC_GYMER_LOCK_DUMMY);
return true;
}
/*######
## go_lab_work_reagents
######*/
enum
{
QUEST_LAB_WORK = 12557,
SPELL_WIRHERED_BATWING_KILL_CREDIT = 51226,
SPELL_MUDDY_MIRE_MAGGOT_KILL_CREDIT = 51227,
SPELL_AMBERSEED_KILL_CREDIT = 51228,
SPELL_CHILLED_SERPENT_MUCUS_KILL_CREDIT = 51229,
GO_AMBERSEED = 190459,
GO_CHILLED_SERPENT_MUCUS = 190462,
GO_WITHERED_BATWING = 190473,
GO_MUDDY_MIRE_MAGGOTS = 190478,
};
bool GOUse_go_lab_work_reagents(Player* pPlayer, GameObject* pGo)
{
if (pPlayer->GetQuestStatus(QUEST_LAB_WORK) == QUEST_STATUS_INCOMPLETE)
{
uint32 uiCreditSpellId = 0;
switch (pGo->GetEntry())
{
case GO_AMBERSEED: uiCreditSpellId = SPELL_AMBERSEED_KILL_CREDIT; break;
case GO_CHILLED_SERPENT_MUCUS: uiCreditSpellId = SPELL_CHILLED_SERPENT_MUCUS_KILL_CREDIT; break;
case GO_WITHERED_BATWING: uiCreditSpellId = SPELL_WIRHERED_BATWING_KILL_CREDIT; break;
case GO_MUDDY_MIRE_MAGGOTS: uiCreditSpellId = SPELL_MUDDY_MIRE_MAGGOT_KILL_CREDIT; break;
}
if (uiCreditSpellId)
pPlayer->CastSpell(pPlayer, uiCreditSpellId, true);
}
return false;
}
void AddSC_go_scripts()
{
Script* pNewScript;
pNewScript = new Script;
pNewScript->Name = "go_barov_journal";
pNewScript->pGOUse = &GOUse_go_barov_journal;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "go_ethereum_prison";
pNewScript->pGOUse = &GOUse_go_ethereum_prison;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "go_ethereum_stasis";
pNewScript->pGOUse = &GOUse_go_ethereum_stasis;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "go_jump_a_tron";
pNewScript->pGOUse = &GOUse_go_jump_a_tron;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "go_mysterious_snow_mound";
pNewScript->pGOUse = &GOUse_go_mysterious_snow_mound;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "go_tele_to_dalaran_crystal";
pNewScript->pGOUse = &GOUse_go_tele_to_dalaran_crystal;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "go_tele_to_violet_stand";
pNewScript->pGOUse = &GOUse_go_tele_to_violet_stand;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "go_andorhal_tower";
pNewScript->pGOUse = &GOUse_go_andorhal_tower;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "go_scourge_enclosure";
pNewScript->pGOUse = &GOUse_go_scourge_enclosure;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "go_lab_work_reagents";
pNewScript->pGOUse = &GOUse_go_lab_work_reagents;
pNewScript->RegisterSelf();
}