TrinityCore
Loading...
Searching...
No Matches
hallows_end.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "Containers.h"
20#include "CreatureAIImpl.h"
21#include "Player.h"
22#include "ScriptedCreature.h"
23#include "SpellAuraEffects.h"
24#include "SpellScript.h"
25
27{
28 SPELL_HALLOWS_END_CANDY_ORANGE_GIANT = 24924, // Effect 1: Apply Aura: Mod Size, Value: 30%
29 SPELL_HALLOWS_END_CANDY_SKELETON = 24925, // Effect 1: Apply Aura: Change Model (Skeleton). Effect 2: Apply Aura: Underwater Breathing
30 SPELL_HALLOWS_END_CANDY_PIRATE = 24926, // Effect 1: Apply Aura: Increase Swim Speed, Value: 50%
31 SPELL_HALLOWS_END_CANDY_GHOST = 24927, // Effect 1: Apply Aura: Levitate / Hover. Effect 2: Apply Aura: Slow Fall, Effect 3: Apply Aura: Water Walking
32 SPELL_HALLOWS_END_CANDY_FEMALE_DEFIAS_PIRATE = 44742, // Effect 1: Apply Aura: Change Model (Defias Pirate, Female). Effect 2: Increase Swim Speed, Value: 50%
33 SPELL_HALLOWS_END_CANDY_MALE_DEFIAS_PIRATE = 44743 // Effect 1: Apply Aura: Change Model (Defias Pirate, Male). Effect 2: Increase Swim Speed, Value: 50%
34};
35
43
44// 24930 - Hallow's End Candy
64
65// 24926 - Hallow's End Candy
97
102
103// 24714 - Trick
123
137
138// 24750 - Trick
140{
142
159
160 void HandleScript(SpellEffIndex /*effIndex*/)
161 {
162 Unit* caster = GetCaster();
163 if (Player* target = GetHitPlayer())
164 {
165 uint8 gender = target->GetNativeGender();
166 uint32 spellId = SPELL_TRICK_BUFF;
167 switch (urand(0, 5))
168 {
169 case 1:
171 break;
172 case 2:
174 break;
175 case 3:
177 break;
178 case 4:
180 break;
181 case 5:
182 spellId = SPELL_SKELETON_COSTUME;
183 break;
184 default:
185 break;
186 }
187
188 caster->CastSpell(target, spellId, true);
189 }
190 }
191
196};
197
207
208// 24751 - Trick or Treat
210{
212
213 bool Validate(SpellInfo const* /*spell*/) override
214 {
216 }
217
218 void HandleScript(SpellEffIndex /*effIndex*/)
219 {
220 Unit* caster = GetCaster();
221 if (Player* target = GetHitPlayer())
222 {
223 caster->CastSpell(target, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true);
224 caster->CastSpell(target, SPELL_TRICKED_OR_TREATED, true);
225 }
226 }
227
232};
233
234// 44436 - Tricky Treat
261
273
274// 24717, 24718, 24719, 24720, 24724, 24733, 24737, 24741
276{
278
293
295 {
296 Unit* caster = GetCaster();
297 Unit* target = GetHitUnit();
298
299 uint32 spellId = 0;
300 uint8 gender = target->GetNativeGender();
301
302 switch (GetSpellInfo()->Id)
303 {
306 break;
309 break;
312 break;
315 break;
318 break;
319 default:
320 return;
321 }
322 caster->CastSpell(target, spellId, true);
323 }
324
329};
330
336
337// 42144 - Headless Horseman - Create Water Bucket
359
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ GENDER_FEMALE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_MOD_INCREASE_SWIM_SPEED
#define SpellEffectFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
#define SpellHitFn(F)
#define AuraEffectRemoveFn(F, I, N, M)
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetTarget() const
Player * GetHitPlayer() const
Unit * GetCaster() const
HookList< HitHandler > AfterHit
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
SpellInfo const * GetSpellInfo() const
Definition Unit.h:769
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
virtual Gender GetNativeGender() const
Definition Unit.h:900
uint32 GetAuraCount(uint32 spellId) const
Definition Unit.cpp:4519
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void HandleApply(AuraEffect const *, AuraEffectHandleModes)
void HandleRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_hallow_end_candy_pirate)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_hallow_end_candy)
void Register() override
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
PrepareSpellScript(spell_hallow_end_create_water_bucket)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_hallow_end_trick_initial)
void HandleScript(SpellEffIndex)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_hallow_end_trick_or_treat)
void HandleScript(SpellEffIndex)
void Register() override
bool Validate(SpellInfo const *) override
void HandleScript(SpellEffIndex)
PrepareSpellScript(spell_hallow_end_trick)
void HandleScript(SpellEffIndex)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_hallow_end_tricky_treat)
PrepareSpellScript(spell_hallow_end_wand)
void Register() override
bool Validate(SpellInfo const *) override
CreateWaterBucket
@ SPELL_CREATE_WATER_BUCKET_BARREL_SPLASH
@ SPELL_JUST_LOOTED_WATER_BARREL
TrickSpells
@ SPELL_SKELETON_COSTUME
@ SPELL_LEPER_GNOME_COSTUME_MALE
@ SPELL_NINJA_COSTUME_MALE
@ SPELL_TRICK_BUFF
@ SPELL_NINJA_COSTUME_FEMALE
@ SPELL_GHOST_COSTUME_FEMALE
@ SPELL_PIRATE_COSTUME_MALE
@ SPELL_PIRATE_COSTUME_FEMALE
@ SPELL_LEPER_GNOME_COSTUME_FEMALE
@ SPELL_GHOST_COSTUME_MALE
TrickInitial
@ SPELL_TRICK_INITIAL
HallowendData
@ SPELL_HALLOWED_WAND_NINJA
@ SPELL_HALLOWED_WAND_WISP
@ SPELL_HALLOWED_WAND_SKELETON
@ SPELL_HALLOWED_WAND_BAT
@ SPELL_HALLOWED_WAND_LEPER_GNOME
@ SPELL_HALLOWED_WAND_RANDOM
@ SPELL_HALLOWED_WAND_GHOST
@ SPELL_HALLOWED_WAND_PIRATE
void AddSC_event_hallows_end()
HallowEndCandysSpells
@ SPELL_HALLOWS_END_CANDY_ORANGE_GIANT
@ SPELL_HALLOWS_END_CANDY_GHOST
@ SPELL_HALLOWS_END_CANDY_SKELETON
@ SPELL_HALLOWS_END_CANDY_MALE_DEFIAS_PIRATE
@ SPELL_HALLOWS_END_CANDY_PIRATE
@ SPELL_HALLOWS_END_CANDY_FEMALE_DEFIAS_PIRATE
TrickOrTreatSpells
@ SPELL_UPSET_TUMMY
@ SPELL_TRICKED_OR_TREATED
@ SPELL_TREAT
@ SPELL_TRICKY_TREAT_TRIGGER
@ SPELL_TRICK
@ SPELL_TRICKY_TREAT_SPEED
std::array< uint32, 4 > const CandysSpells
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108