TrinityCore
Loading...
Searching...
No Matches
midsummer.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 "CreatureAIImpl.h"
20#include "Player.h"
21#include "SpellAuraEffects.h"
22#include "SpellScript.h"
23
36
37// 45724 - Braziers Hit!
71
72// 46074 - Remove Torches
95
96// 45716 - Torch Tossing Training
97// 46630 - Torch Tossing Practice
128
129// 45907 - Torch Target Picker
151
152// 46054 - Torch Toss (land)
172
183
184// 29705, 29726, 29727 - Test Ribbon Pole Channel
186{
188
189 bool Validate(SpellInfo const* /*spellInfo*/) override
190 {
191 return ValidateSpellInfo(
192 {
197 });
198 }
199
204
205 void PeriodicTick(AuraEffect const* /*aurEff*/)
206 {
207 Unit* target = GetTarget();
208 target->CastSpell(target, SPELL_RIBBON_POLE_PERIODIC_VISUAL, true);
209
210 if (Aura* aur = target->GetAura(SPELL_RIBBON_DANCE))
211 {
212 aur->SetMaxDuration(std::min(3600000, aur->GetMaxDuration() + 180000));
213 aur->RefreshDuration();
214
215 if (aur->GetMaxDuration() == 3600000 && target->HasAura(SPELL_HAS_FULL_MIDSUMMER_SET))
216 target->CastSpell(target, SPELL_BURNING_HOT_POLE_DANCE, true);
217 }
218 else
219 target->CastSpell(target, SPELL_RIBBON_DANCE, true);
220 }
221
227};
228
229// 45406 - Holiday - Midsummer, Ribbon Pole Periodic Visual
256
275
276// 45819 - Throw Torch
278{
280
289
290 void HandleDummy(SpellEffIndex /*effIndex*/)
291 {
292 if (!GetExplTargetDest())
293 return;
294
295 Position spellDest = *GetExplTargetDest();
296 float distance = GetCaster()->GetExactDist2d(spellDest.GetPositionX(), spellDest.GetPositionY());
297
298 uint32 torchSpellID = 0;
299 uint32 torchShadowSpellID = 0;
300
301 if (distance <= 1.5f)
302 {
303 torchSpellID = SPELL_JUGGLE_TORCH_SELF;
304 torchShadowSpellID = SPELL_JUGGLE_TORCH_SHADOW_SELF;
305 spellDest = GetCaster()->GetPosition();
306 }
307 else if (distance <= 10.0f)
308 {
309 torchSpellID = SPELL_JUGGLE_TORCH_SLOW;
310 torchShadowSpellID = SPELL_JUGGLE_TORCH_SHADOW_SLOW;
311 }
312 else if (distance <= 20.0f)
313 {
314 torchSpellID = SPELL_JUGGLE_TORCH_MEDIUM;
315 torchShadowSpellID = SPELL_JUGGLE_TORCH_SHADOW_MEDIUM;
316 }
317 else
318 {
319 torchSpellID = SPELL_JUGGLE_TORCH_FAST;
320 torchShadowSpellID = SPELL_JUGGLE_TORCH_SHADOW_FAST;
321 }
322
323 GetCaster()->CastSpell(spellDest, torchSpellID);
324 GetCaster()->CastSpell(spellDest, torchShadowSpellID);
325 }
326
331};
332
333// 45644 - Juggle Torch (Catch)
335{
337
338 bool Validate(SpellInfo const* /*spellInfo*/) override
339 {
341 }
342
343 void HandleDummy(SpellEffIndex /*effIndex*/)
344 {
345 Player* player = GetHitPlayer();
346 if (!player)
347 return;
348
350 player->CastSpell(player, SPELL_GIVE_TORCH);
351 }
352
357};
358
369
370// 46747 - Fling torch
392
393// 45669 - Fling Torch
421
422// 45671 - Juggle Torch (Catch, Quest)
424{
426
437
439 {
440 Player* player = GetHitPlayer();
441 if (!player)
442 return;
443
444 if (!GetExplTargetDest())
445 return;
446
447 // Only the caster can catch the torch
448 if (player->GetGUID() != GetCaster()->GetGUID())
449 return;
450
451 uint8 requiredCatches = 0;
452 // Number of required catches depends on quest - 4 for the normal quest, 10 for the daily version
454 requiredCatches = 3;
456 requiredCatches = 9;
457
458 // Used quest item without being on quest - do nothing
459 if (requiredCatches == 0)
460 return;
461
462 if (player->GetAuraCount(SPELL_TORCHES_CAUGHT) >= requiredCatches)
463 {
467 }
468 else
469 {
470 Position dest = player->GetFirstCollisionPosition(15.0f, (float)rand_norm() * static_cast<float>(2 * M_PI));
471 player->CastSpell(player, SPELL_TORCHES_CAUGHT);
472 player->CastSpell(dest, SPELL_FLING_TORCH_TRIGGERED, true);
473 player->CastSpell(dest, SPELL_FLING_TORCH_SHADOW);
474 }
475 }
476
481};
482
483// 45676 - Juggle Torch (Quest, Missed)
503
515
516// 29126 - Cleansing Flames
517// 29137 - Cleansing Flames
518// 29135 - Cleansing Flames
519// 29136 - Cleansing Flames
520// 29138 - Cleansing Flames
521// 29139 - Cleansing Flames
522// 46672 - Cleansing Flames
523// 46671 - Cleansing Flames
548
555
556// 45458 - Holiday - Midsummer, Stamp Out Bonfire, Quest Complete
576
577// 45443 - Stamp Out Bonfire, Event
599
601{
625}
#define M_PI
Definition Common.h:72
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ QUEST_STATUS_REWARDED
Definition QuestDef.h:110
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:107
double rand_norm()
Definition Random.cpp:75
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
#define RegisterSpellScriptWithArgs(spell_script, script_name,...)
Definition ScriptMgr.h:1127
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ EFFECT_2
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_TRIGGER_MISSILE
@ TARGET_UNIT_DEST_AREA_ENTRY
@ ALLIANCE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAPPLY
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_DUMMY
@ SPELL_AURA_DETECT_AMORE
@ SPELL_AURA_PERIODIC_DUMMY
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectRemoveFn(F, I, N, M)
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetTarget() const
void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
uint8 GetStackAmount() const
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
uint32 GetTeam() const
Definition Player.h:1832
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15642
WorldLocation * GetHitDest() const
Player * GetHitPlayer() const
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
void PreventHitEffect(SpellEffIndex effIndex)
WorldLocation const * GetExplTargetDest() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition Unit.h:769
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4439
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3638
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
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
Position GetFirstCollisionPosition(float dist, float angle)
Definition Object.cpp:3257
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool Validate(SpellInfo const *) override
Definition midsummer.cpp:42
PrepareAuraScript(spell_midsummer_braziers_hit)
void HandleEffectApply(AuraEffect const *, AuraEffectHandleModes)
Definition midsummer.cpp:54
spell_midsummer_cleansing_flames(CleansingFlames triggeredSpell)
void HandleDummy(SpellEffIndex)
PrepareSpellScript(spell_midsummer_cleansing_flames)
bool Validate(SpellInfo const *) override
void HandleScriptEffect(SpellEffIndex)
PrepareSpellScript(spell_midsummer_fling_torch_catch)
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_midsummer_fling_torch_missed)
void HandleTriggerMissile(SpellEffIndex effIndex)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_midsummer_fling_torch_triggered)
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
PrepareSpellScript(spell_midsummer_fling_torch)
PrepareSpellScript(spell_midsummer_juggle_torch)
void HandleDummy(SpellEffIndex)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_midsummer_remove_torches)
void HandleDummy(SpellEffIndex)
Definition midsummer.cpp:82
bool Validate(SpellInfo const *) override
Definition midsummer.cpp:77
PrepareAuraScript(spell_midsummer_ribbon_pole_periodic_visual)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_midsummer_stamp_out_bonfire_event)
bool Validate(SpellInfo const *) override
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_midsummer_stamp_out_bonfire_quest_complete)
PrepareAuraScript(spell_midsummer_test_ribbon_pole_channel)
void PeriodicTick(AuraEffect const *)
bool Validate(SpellInfo const *) override
void HandleRemove(AuraEffect const *, AuraEffectHandleModes)
void HandleDummy(SpellEffIndex)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_midsummer_torch_catch)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_midsummer_torch_target_picker)
PrepareSpellScript(spell_midsummer_torch_toss_land)
bool Validate(SpellInfo const *) override
void HandleScript(SpellEffIndex)
PrepareAuraScript(spell_midsummer_torch_tossing_training_practice)
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
TorchSpells
Definition midsummer.cpp:25
@ SPELL_TORCH_TOSSING_TRAINING_SUCCESS_2
Definition midsummer.cpp:29
@ SPELL_TARGET_INDICATOR
Definition midsummer.cpp:32
@ SPELL_BRAZIERS_HIT
Definition midsummer.cpp:33
@ SPELL_TARGET_INDICATOR_COSMETIC
Definition midsummer.cpp:31
@ SPELL_REMOVE_TORCHES
Definition midsummer.cpp:30
@ SPELL_TORCH_TOSSING_TRAINING
Definition midsummer.cpp:26
@ SPELL_TORCH_TOSSING_TRAINING_SUCCESS_1
Definition midsummer.cpp:28
@ SPELL_TARGET_DETECT_INVISIBILITY
Definition midsummer.cpp:34
@ SPELL_TORCH_TOSSING_PRACTICE
Definition midsummer.cpp:27
FlingTorch
@ SPELL_TORCHES_CAUGHT
@ SPELL_JUGGLE_TORCH_MISSED
@ SPELL_TORCH_CATCHING_SUCCESS_ALLIANCE
@ SPELL_FLING_TORCH_SHADOW
@ SPELL_TORCH_CATCHING_REMOVE_TORCHES
@ SPELL_TORCH_CATCHING_SUCCESS_HORDE
@ SPELL_FLING_TORCH_TRIGGERED
StampOutBonfire
@ SPELL_STAMP_OUT_BONFIRE_DUMMY
@ SPELL_STAMP_OUT_BONFIRE_ART_KIT
@ SPELL_STAMP_OUT_BONFIRE_EVENT
void AddSC_event_midsummer()
RibbonPoleData
@ SPELL_TEST_RIBBON_POLE_2
@ SPELL_RIBBON_POLE_PERIODIC_VISUAL
@ SPELL_BURNING_HOT_POLE_DANCE
@ SPELL_HAS_FULL_MIDSUMMER_SET
@ SPELL_RIBBON_DANCE
@ SPELL_TEST_RIBBON_POLE_1
@ SPELL_TEST_RIBBON_POLE_3
JugglingTorch
@ SPELL_JUGGLE_TORCH_SHADOW_SLOW
@ QUEST_MORE_TORCH_CATCHING_A
@ QUEST_TORCH_CATCHING_A
@ QUEST_TORCH_CATCHING_H
@ SPELL_JUGGLE_TORCH_SELF
@ SPELL_GIVE_TORCH
@ SPELL_JUGGLE_TORCH_SHADOW_FAST
@ SPELL_JUGGLE_TORCH_SLOW
@ SPELL_JUGGLE_TORCH_SHADOW_MEDIUM
@ SPELL_JUGGLE_TORCH_SHADOW_SELF
@ QUEST_MORE_TORCH_CATCHING_H
@ SPELL_JUGGLE_TORCH_FAST
@ SPELL_JUGGLE_TORCH_MEDIUM
CleansingFlames
@ SPELL_CREATE_FLAME_OF_DARNASSUS
@ SPELL_CREATE_FLAME_OF_THE_EXODAR
@ SPELL_CREATE_FLAME_OF_IRONFORGE
@ SPELL_CREATE_FLAME_OF_STORMWIND
@ SPELL_CREATE_FLAME_OF_THE_UNDERCITY
@ SPELL_CREATE_FLAME_OF_ORGRIMMAR
@ SPELL_CREATE_FLAME_OF_THUNDER_BLUFF
@ SPELL_CREATE_FLAME_OF_SILVERMOON
float GetExactDist2d(const float x, const float y) const
Definition Position.h:109
float GetPositionX() const
Definition Position.h:79
void GetPosition(float &x, float &y) const
Definition Position.h:84
float GetPositionY() const
Definition Position.h:80