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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
|
/*
* 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/>.
*/
#include "ScriptMgr.h"
#include "CreatureAIImpl.h"
#include "Player.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "World.h"
enum RamBlaBla
{
SPELL_GIDDYUP = 42924,
SPELL_RENTAL_RACING_RAM = 43883,
SPELL_SWIFT_WORK_RAM = 43880,
SPELL_RENTAL_RACING_RAM_AURA = 42146,
SPELL_RAM_LEVEL_NEUTRAL = 43310,
SPELL_RAM_TROT = 42992,
SPELL_RAM_CANTER = 42993,
SPELL_RAM_GALLOP = 42994,
SPELL_RAM_FATIGUE = 43052,
SPELL_EXHAUSTED_RAM = 43332,
SPELL_RELAY_RACE_TURN_IN = 44501,
// Quest
SPELL_BREWFEST_QUEST_SPEED_BUNNY_GREEN = 43345,
SPELL_BREWFEST_QUEST_SPEED_BUNNY_YELLOW = 43346,
SPELL_BREWFEST_QUEST_SPEED_BUNNY_RED = 43347
};
// 42924 - Giddyup!
class spell_brewfest_giddyup : public AuraScript
{
PrepareAuraScript(spell_brewfest_giddyup);
void OnChange(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (!target->HasAura(SPELL_RENTAL_RACING_RAM) && !target->HasAura(SPELL_SWIFT_WORK_RAM))
{
target->RemoveAura(GetId());
return;
}
if (target->HasAura(SPELL_EXHAUSTED_RAM))
return;
switch (GetStackAmount())
{
case 1: // green
target->RemoveAura(SPELL_RAM_LEVEL_NEUTRAL);
target->RemoveAura(SPELL_RAM_CANTER);
target->CastSpell(target, SPELL_RAM_TROT, true);
break;
case 6: // yellow
target->RemoveAura(SPELL_RAM_TROT);
target->RemoveAura(SPELL_RAM_GALLOP);
target->CastSpell(target, SPELL_RAM_CANTER, true);
break;
case 11: // red
target->RemoveAura(SPELL_RAM_CANTER);
target->CastSpell(target, SPELL_RAM_GALLOP, true);
break;
default:
break;
}
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEFAULT)
{
target->RemoveAura(SPELL_RAM_TROT);
target->CastSpell(target, SPELL_RAM_LEVEL_NEUTRAL, true);
}
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
GetTarget()->RemoveAuraFromStack(GetId());
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_brewfest_giddyup::OnChange, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_brewfest_giddyup::OnChange, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_brewfest_giddyup::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
// 43310 - Ram Level - Neutral
// 42992 - Ram - Trot
// 42993 - Ram - Canter
// 42994 - Ram - Gallop
class spell_brewfest_ram : public AuraScript
{
PrepareAuraScript(spell_brewfest_ram);
void OnPeriodic(AuraEffect const* aurEff)
{
Unit* target = GetTarget();
if (target->HasAura(SPELL_EXHAUSTED_RAM))
return;
switch (GetId())
{
case SPELL_RAM_LEVEL_NEUTRAL:
if (Aura* aura = target->GetAura(SPELL_RAM_FATIGUE))
aura->ModStackAmount(-4);
break;
case SPELL_RAM_TROT: // green
if (Aura* aura = target->GetAura(SPELL_RAM_FATIGUE))
aura->ModStackAmount(-2);
if (aurEff->GetTickNumber() == 4)
target->CastSpell(target, SPELL_BREWFEST_QUEST_SPEED_BUNNY_GREEN, true);
break;
case SPELL_RAM_CANTER:
{
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.AddSpellMod(SPELLVALUE_AURA_STACK, 1);
target->CastSpell(target, SPELL_RAM_FATIGUE, args);
if (aurEff->GetTickNumber() == 8)
target->CastSpell(target, SPELL_BREWFEST_QUEST_SPEED_BUNNY_YELLOW, true);
break;
}
case SPELL_RAM_GALLOP:
{
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.AddSpellMod(SPELLVALUE_AURA_STACK, target->HasAura(SPELL_RAM_FATIGUE) ? 4 : 5 /*Hack*/);
target->CastSpell(target, SPELL_RAM_FATIGUE, args);
if (aurEff->GetTickNumber() == 8)
target->CastSpell(target, SPELL_BREWFEST_QUEST_SPEED_BUNNY_RED, true);
break;
}
default:
break;
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_brewfest_ram::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
}
};
// 43052 - Ram Fatigue
class spell_brewfest_ram_fatigue : public AuraScript
{
PrepareAuraScript(spell_brewfest_ram_fatigue);
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (GetStackAmount() == 101)
{
target->RemoveAura(SPELL_RAM_LEVEL_NEUTRAL);
target->RemoveAura(SPELL_RAM_TROT);
target->RemoveAura(SPELL_RAM_CANTER);
target->RemoveAura(SPELL_RAM_GALLOP);
target->RemoveAura(SPELL_GIDDYUP);
target->CastSpell(target, SPELL_EXHAUSTED_RAM, true);
}
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_brewfest_ram_fatigue::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
// 43450 - Brewfest - apple trap - friendly DND
class spell_brewfest_apple_trap : public AuraScript
{
PrepareAuraScript(spell_brewfest_apple_trap);
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->RemoveAura(SPELL_RAM_FATIGUE);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_brewfest_apple_trap::OnApply, EFFECT_0, SPELL_AURA_FORCE_REACTION, AURA_EFFECT_HANDLE_REAL);
}
};
// 43332 - Exhausted Ram
class spell_brewfest_exhausted_ram : public AuraScript
{
PrepareAuraScript(spell_brewfest_exhausted_ram);
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->CastSpell(target, SPELL_RAM_LEVEL_NEUTRAL, true);
}
void Register() override
{
OnEffectRemove += AuraEffectApplyFn(spell_brewfest_exhausted_ram::OnRemove, EFFECT_0, SPELL_AURA_MOD_DECREASE_SPEED, AURA_EFFECT_HANDLE_REAL);
}
};
// 43714 - Brewfest - Relay Race - Intro - Force - Player to throw- DND
class spell_brewfest_relay_race_intro_force_player_to_throw : public SpellScript
{
PrepareSpellScript(spell_brewfest_relay_race_intro_force_player_to_throw);
void HandleForceCast(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
// All this spells trigger a spell that requires reagents; if the
// triggered spell is cast as "triggered", reagents are not consumed
GetHitUnit()->CastSpell(nullptr, GetEffectInfo().TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST));
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_brewfest_relay_race_intro_force_player_to_throw::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
}
};
// 43755 - Brewfest - Daily - Relay Race - Player - Increase Mount Duration - DND
class spell_brewfest_relay_race_turn_in : public SpellScript
{
PrepareSpellScript(spell_brewfest_relay_race_turn_in);
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Aura* aura = GetHitUnit()->GetAura(SPELL_SWIFT_WORK_RAM))
{
aura->SetDuration(aura->GetDuration() + 30 * IN_MILLISECONDS);
GetCaster()->CastSpell(GetHitUnit(), SPELL_RELAY_RACE_TURN_IN, TRIGGERED_FULL_MASK);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_brewfest_relay_race_turn_in::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
// 43876 - Dismount Ram
class spell_brewfest_dismount_ram : public SpellScript
{
PrepareSpellScript(spell_brewfest_dismount_ram);
void HandleScript(SpellEffIndex /*effIndex*/)
{
GetCaster()->RemoveAura(SPELL_RENTAL_RACING_RAM);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_brewfest_dismount_ram::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
enum RamBlub
{
// Horde
QUEST_BARK_FOR_DROHNS_DISTILLERY = 11407,
QUEST_BARK_FOR_TCHALIS_VOODOO_BREWERY = 11408,
// Alliance
QUEST_BARK_BARLEYBREW = 11293,
QUEST_BARK_FOR_THUNDERBREWS = 11294,
// Bark for Drohn's Distillery!
SAY_DROHN_DISTILLERY_1 = 23520,
SAY_DROHN_DISTILLERY_2 = 23521,
SAY_DROHN_DISTILLERY_3 = 23522,
SAY_DROHN_DISTILLERY_4 = 23523,
// Bark for T'chali's Voodoo Brewery!
SAY_TCHALIS_VOODOO_1 = 23524,
SAY_TCHALIS_VOODOO_2 = 23525,
SAY_TCHALIS_VOODOO_3 = 23526,
SAY_TCHALIS_VOODOO_4 = 23527,
// Bark for the Barleybrews!
SAY_BARLEYBREW_1 = 23464,
SAY_BARLEYBREW_2 = 23465,
SAY_BARLEYBREW_3 = 23466,
SAY_BARLEYBREW_4 = 22941,
// Bark for the Thunderbrews!
SAY_THUNDERBREWS_1 = 23467,
SAY_THUNDERBREWS_2 = 23468,
SAY_THUNDERBREWS_3 = 23469,
SAY_THUNDERBREWS_4 = 22942
};
// 43259 Brewfest - Barker Bunny 1
// 43260 Brewfest - Barker Bunny 2
// 43261 Brewfest - Barker Bunny 3
// 43262 Brewfest - Barker Bunny 4
class spell_brewfest_barker_bunny : public AuraScript
{
PrepareAuraScript(spell_brewfest_barker_bunny);
bool Load() override
{
return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Player* target = GetTarget()->ToPlayer();
uint32 BroadcastTextId = 0;
if (target->GetQuestStatus(QUEST_BARK_FOR_DROHNS_DISTILLERY) == QUEST_STATUS_INCOMPLETE ||
target->GetQuestStatus(QUEST_BARK_FOR_DROHNS_DISTILLERY) == QUEST_STATUS_COMPLETE)
BroadcastTextId = RAND(SAY_DROHN_DISTILLERY_1, SAY_DROHN_DISTILLERY_2, SAY_DROHN_DISTILLERY_3, SAY_DROHN_DISTILLERY_4);
if (target->GetQuestStatus(QUEST_BARK_FOR_TCHALIS_VOODOO_BREWERY) == QUEST_STATUS_INCOMPLETE ||
target->GetQuestStatus(QUEST_BARK_FOR_TCHALIS_VOODOO_BREWERY) == QUEST_STATUS_COMPLETE)
BroadcastTextId = RAND(SAY_TCHALIS_VOODOO_1, SAY_TCHALIS_VOODOO_2, SAY_TCHALIS_VOODOO_3, SAY_TCHALIS_VOODOO_4);
if (target->GetQuestStatus(QUEST_BARK_BARLEYBREW) == QUEST_STATUS_INCOMPLETE ||
target->GetQuestStatus(QUEST_BARK_BARLEYBREW) == QUEST_STATUS_COMPLETE)
BroadcastTextId = RAND(SAY_BARLEYBREW_1, SAY_BARLEYBREW_2, SAY_BARLEYBREW_3, SAY_BARLEYBREW_4);
if (target->GetQuestStatus(QUEST_BARK_FOR_THUNDERBREWS) == QUEST_STATUS_INCOMPLETE ||
target->GetQuestStatus(QUEST_BARK_FOR_THUNDERBREWS) == QUEST_STATUS_COMPLETE)
BroadcastTextId = RAND(SAY_THUNDERBREWS_1, SAY_THUNDERBREWS_2, SAY_THUNDERBREWS_3, SAY_THUNDERBREWS_4);
if (BroadcastTextId)
target->Talk(BroadcastTextId, CHAT_MSG_SAY, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), target);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_brewfest_barker_bunny::OnApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
enum BrewfestMountTransformation
{
SPELL_MOUNT_RAM_100 = 43900,
SPELL_MOUNT_RAM_60 = 43899,
SPELL_MOUNT_KODO_100 = 49379,
SPELL_MOUNT_KODO_60 = 49378,
SPELL_BREWFEST_MOUNT_TRANSFORM = 49357,
SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE = 52845,
};
// 49357 - Brewfest Mount Transformation
// 52845 - Brewfest Mount Transformation (Faction Swap)
class spell_brewfest_mount_transformation : public SpellScript
{
PrepareSpellScript(spell_brewfest_mount_transformation);
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo(
{
SPELL_MOUNT_RAM_100,
SPELL_MOUNT_RAM_60,
SPELL_MOUNT_KODO_100,
SPELL_MOUNT_KODO_60
});
}
void HandleDummy(SpellEffIndex /* effIndex */)
{
Player* caster = GetCaster()->ToPlayer();
if (caster->HasAuraType(SPELL_AURA_MOUNTED))
{
caster->RemoveAurasByType(SPELL_AURA_MOUNTED);
uint32 spell_id;
switch (GetSpellInfo()->Id)
{
case SPELL_BREWFEST_MOUNT_TRANSFORM:
if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100;
else
spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60;
break;
case SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE:
if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100;
else
spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60;
break;
default:
return;
}
caster->CastSpell(caster, spell_id, true);
}
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_brewfest_mount_transformation::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
enum CreateEmptyBrewBottle
{
SPELL_BOTM_CREATE_EMPTY_BREW_BOTTLE = 51655
};
// 42254, 42255, 42256, 42257, 42258, 42259, 42260, 42261, 42263, 42264, 43959, 43961 - Weak Alcohol
class spell_brewfest_botm_weak_alcohol : public SpellScript
{
PrepareSpellScript(spell_brewfest_botm_weak_alcohol);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_BOTM_CREATE_EMPTY_BREW_BOTTLE });
}
void HandleAfterCast()
{
GetCaster()->CastSpell(GetCaster(), SPELL_BOTM_CREATE_EMPTY_BREW_BOTTLE, true);
}
void Register() override
{
AfterCast += SpellCastFn(spell_brewfest_botm_weak_alcohol::HandleAfterCast);
}
};
enum EmptyBottleThrow
{
SPELL_BOTM_EMPTY_BOTTLE_THROW_IMPACT_CREATURE = 51695, // Just unit, not creature
SPELL_BOTM_EMPTY_BOTTLE_THROW_IMPACT_GROUND = 51697
};
// 51694 - BOTM - Empty Bottle Throw - Resolve
class spell_brewfest_botm_empty_bottle_throw_resolve : public SpellScript
{
PrepareSpellScript(spell_brewfest_botm_empty_bottle_throw_resolve);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo(
{
SPELL_BOTM_EMPTY_BOTTLE_THROW_IMPACT_CREATURE,
SPELL_BOTM_EMPTY_BOTTLE_THROW_IMPACT_GROUND
});
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
caster->CastSpell(target, SPELL_BOTM_EMPTY_BOTTLE_THROW_IMPACT_CREATURE, true);
else
caster->CastSpell(GetHitDest()->GetPosition(), SPELL_BOTM_EMPTY_BOTTLE_THROW_IMPACT_GROUND, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_brewfest_botm_empty_bottle_throw_resolve::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
void AddSC_event_brewfest()
{
RegisterSpellScript(spell_brewfest_giddyup);
RegisterSpellScript(spell_brewfest_ram);
RegisterSpellScript(spell_brewfest_ram_fatigue);
RegisterSpellScript(spell_brewfest_apple_trap);
RegisterSpellScript(spell_brewfest_exhausted_ram);
RegisterSpellScript(spell_brewfest_relay_race_intro_force_player_to_throw);
RegisterSpellScript(spell_brewfest_relay_race_turn_in);
RegisterSpellScript(spell_brewfest_dismount_ram);
RegisterSpellScript(spell_brewfest_barker_bunny);
RegisterSpellScript(spell_brewfest_mount_transformation);
RegisterSpellScript(spell_brewfest_botm_weak_alcohol);
RegisterSpellScript(spell_brewfest_botm_empty_bottle_throw_resolve);
}
|