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
52
58
59// 24930 - Hallow's End Candy
77
78// 24926 - Hallow's End Candy
108
122
123// 24750 - Trick
125{
142
143 void HandleScript(SpellEffIndex /*effIndex*/)
144 {
145 Unit* caster = GetCaster();
146 if (Player* target = GetHitPlayer())
147 {
148 uint8 gender = target->GetNativeGender();
149 uint32 spellId = SPELL_TRICK_BUFF;
150 switch (urand(0, 5))
151 {
152 case 1:
154 break;
155 case 2:
157 break;
158 case 3:
160 break;
161 case 4:
163 break;
164 case 5:
165 spellId = SPELL_SKELETON_COSTUME;
166 break;
167 default:
168 break;
169 }
170
171 caster->CastSpell(target, spellId, true);
172 }
173 }
174
179};
180
190
191// 24751 - Trick or Treat
193{
194 bool Validate(SpellInfo const* /*spell*/) override
195 {
197 }
198
199 void HandleScript(SpellEffIndex /*effIndex*/)
200 {
201 Unit* caster = GetCaster();
202 if (Player* target = GetHitPlayer())
203 {
204 caster->CastSpell(target, roll_chance(50) ? SPELL_TRICK : SPELL_TREAT, true);
205 caster->CastSpell(target, SPELL_TRICKED_OR_TREATED, true);
206 }
207 }
208
213};
214
215// 44436 - Tricky Treat
217{
218 bool Validate(SpellInfo const* /*spell*/) override
219 {
220 return ValidateSpellInfo(
221 {
225 });
226 }
227
228 void HandleScript(SpellEffIndex /*effIndex*/)
229 {
230 Unit* caster = GetCaster();
232 caster->CastSpell(caster, SPELL_UPSET_TUMMY, true);
233 }
234
239};
240
252
253// 24717, 24718, 24719, 24720, 24724, 24733, 24737, 24741
255{
270
272 {
273 Unit* caster = GetCaster();
274 Unit* target = GetHitUnit();
275
276 uint32 spellId = 0;
277 uint8 gender = target->GetNativeGender();
278
279 switch (GetSpellInfo()->Id)
280 {
283 break;
286 break;
289 break;
292 break;
295 break;
296 default:
297 return;
298 }
299 caster->CastSpell(target, spellId, true);
300 }
301
306};
307
308// 97135 - Children's Costume Aura
344
345// 191547 - Powder Blast
364
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
bool roll_chance(T chance)
Definition Random.h:55
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ GENDER_FEMALE
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PROC_TRIGGER_SPELL
@ SPELL_AURA_MOD_INCREASE_SWIM_SPEED
@ SPELL_AURA_PERIODIC_DUMMY
#define AuraEffectProcFn(F, I, N)
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
#define SpellHitFn(F)
#define AuraEffectRemoveFn(F, I, N, M)
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetTarget() const
HookList< EffectProcHandler > OnEffectProc
Unit * GetProcTarget() const
Definition Unit.h:501
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
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:635
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3828
virtual Gender GetNativeGender() const
Definition Unit.h:769
uint32 GetAuraCount(uint32 spellId) const
Definition Unit.cpp:4788
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
void HandleApply(AuraEffect const *, AuraEffectHandleModes)
void HandleRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void Register() override
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
bool Validate(SpellInfo const *) override
void HandleScript(SpellEffIndex)
void Register() override
bool Validate(SpellInfo const *) override
void HandleScript(SpellEffIndex)
void HandleScript(SpellEffIndex)
bool Validate(SpellInfo const *) override
void Register() override
bool Validate(SpellInfo const *) override
void HandleAfterApply(AuraEffect const *aurEff, AuraEffectHandleModes)
static constexpr std::array< uint32, 5 > ChildrensCustomeSpells
void HandlePeriodic(AuraEffect const *aurEff)
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect *, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
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
HallowsEndChildrensCustomeSpells
@ SPELL_HALLOWS_END_SCARY_PUMPKIN_MASK
@ SPELL_HALLOWS_END_FANCY_TOP_HAT
@ SPELL_HALLOWS_END_SCARY_TIKI_MASK
@ SPELL_HALLOWS_END_SCARY_WITCH_HAT
@ SPELL_HALLOWS_END_SCARY_TIKI_MASK_2
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
HallowsEndMiscSpells
@ SPELL_HALLOWS_END_DUMMY_NUKE
@ SPELL_HALLOWS_END_DREAD_FERTILIZER
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) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110