AzeorthCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
spell_midsummer_juggling_torch Class Reference
Inheritance diagram for spell_midsummer_juggling_torch:
SpellScript _SpellScript

Private Member Functions

 PrepareSpellScript (spell_midsummer_juggling_torch)
 
bool Load () override
 
void HandleFinish ()
 
void HandleDummy (SpellEffIndex effIndex)
 
void Register () override
 

Private Attributes

bool handled
 

Additional Inherited Members

- Public Member Functions inherited from SpellScript
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Spell *spell)
 
void _InitHit ()
 
bool _IsEffectPrevented (SpellEffIndex effIndex)
 
bool _IsDefaultEffectPrevented (SpellEffIndex effIndex)
 
void _PrepareScriptCall (SpellScriptHookType hookType)
 
void _FinishScriptCall ()
 
bool IsInCheckCastHook () const
 
bool IsInTargetHook () const
 
bool IsInHitPhase () const
 
bool IsInEffectHook () const
 
UnitGetCaster ()
 
UnitGetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObjectGetExplTargetWorldObject ()
 
UnitGetExplTargetUnit ()
 
GameObjectGetExplTargetGObj ()
 
ItemGetExplTargetItem ()
 
UnitGetHitUnit ()
 
CreatureGetHitCreature ()
 
PlayerGetHitPlayer ()
 
ItemGetHitItem ()
 
GameObjectGetHitGObj ()
 
WorldLocationGetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
SpellGetSpell ()
 
AuraGetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
ItemGetCastItem ()
 
void CreateItem (uint32 effIndex, uint32 itemId)
 
SpellInfo const * GetTriggeringSpell ()
 
void FinishCast (SpellCastResult result)
 
void Cancel ()
 
void SetCustomCastResultMessage (SpellCustomErrors result)
 
- Public Member Functions inherited from _SpellScript
 _SpellScript ()
 
virtual ~_SpellScript ()
 
virtual void _Register ()
 
virtual void _Unload ()
 
virtual void _Init (std::string const *scriptname, uint32 spellId)
 
std::string const * _GetScriptName () const
 
virtual void Register ()=0
 
virtual bool Validate (SpellInfo const *)
 
virtual bool Load ()
 
virtual void Unload ()
 
- Static Public Member Functions inherited from _SpellScript
static bool ValidateSpellInfo (std::initializer_list< uint32 > spellIds)
 
template<class T >
static bool ValidateSpellInfo (T const &spellIds)
 
- Public Attributes inherited from SpellScript
HookList< CastHandlerBeforeCast
 
HookList< CastHandlerOnCast
 
HookList< CastHandlerAfterCast
 
HookList< CheckCastHandlerOnCheckCast
 
HookList< EffectHandlerOnEffectLaunch
 
HookList< EffectHandlerOnEffectLaunchTarget
 
HookList< EffectHandlerOnEffectHit
 
HookList< EffectHandlerOnEffectHitTarget
 
HookList< BeforeHitHandlerBeforeHit
 
HookList< HitHandlerOnHit
 
HookList< HitHandlerAfterHit
 
HookList< ObjectAreaTargetSelectHandlerOnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandlerOnObjectTargetSelect
 
HookList< DestinationTargetSelectHandlerOnDestinationTargetSelect
 
virtual bool _Validate (SpellInfo const *entry)
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ HandleDummy()

void spell_midsummer_juggling_torch::HandleDummy ( SpellEffIndex  effIndex)
inlineprivate
488 {
489 PreventHitDefaultEffect(effIndex);
490 Unit* caster = GetCaster();
491 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
492 return;
493
494 if (Player* target = GetHitPlayer())
495 if (!handled && target->GetQuestRewardStatus(target->GetTeamId() == TEAM_ALLIANCE ? 11657 : 11923))
496 {
497 handled = true;
498 caster->CastSpell(target, SPELL_GIVE_TORCH, true);
499 }
500 }
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
@ SPELL_GIVE_TORCH
Definition: midsummer.cpp:455
@ TEAM_ALLIANCE
Definition: SharedDefines.h:732
TypeID GetTypeId() const
Definition: Object.h:121
Definition: Player.h:1046
Definition: Unit.h:1290
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1168
Player * GetHitPlayer()
Definition: SpellScript.cpp:471
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Definition: SpellScript.cpp:590
Unit * GetCaster()
Definition: SpellScript.cpp:401
bool handled
Definition: midsummer.cpp:464

References Unit::CastSpell(), SpellScript::GetCaster(), SpellScript::GetHitPlayer(), Object::GetTypeId(), handled, SpellScript::PreventHitDefaultEffect(), SPELL_GIVE_TORCH, TEAM_ALLIANCE, and TYPEID_PLAYER.

Referenced by Register().

◆ HandleFinish()

void spell_midsummer_juggling_torch::HandleFinish ( )
inlineprivate
467 {
468 Unit* caster = GetCaster();
469 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
470 return;
471
472 if (const WorldLocation* loc = GetExplTargetDest())
473 {
474 if (loc->GetExactDist(caster) < 3.0f)
475 caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_SELF, true);
476 else if (loc->GetExactDist(caster) < 10.0f)
477 caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_SLOW, true);
478 else if (loc->GetExactDist(caster) < 25.0f)
479 caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_MED, true);
480 else
481 caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_FAST, true);
482 }
483 else
484 caster->CastSpell(caster, SPELL_JUGGLE_SELF, true);
485 }
@ SPELL_JUGGLE_FAST
Definition: midsummer.cpp:452
@ SPELL_JUGGLE_SLOW
Definition: midsummer.cpp:450
@ SPELL_JUGGLE_SELF
Definition: midsummer.cpp:449
@ SPELL_JUGGLE_MED
Definition: midsummer.cpp:451
Definition: Position.h:251
WorldLocation const * GetExplTargetDest()
Definition: SpellScript.cpp:416

References Unit::CastSpell(), SpellScript::GetCaster(), SpellScript::GetExplTargetDest(), Object::GetTypeId(), SPELL_JUGGLE_FAST, SPELL_JUGGLE_MED, SPELL_JUGGLE_SELF, SPELL_JUGGLE_SLOW, and TYPEID_PLAYER.

Referenced by Register().

◆ Load()

bool spell_midsummer_juggling_torch::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

465{ handled = false; return true; }

References handled.

◆ PrepareSpellScript()

spell_midsummer_juggling_torch::PrepareSpellScript ( spell_midsummer_juggling_torch  )
private

◆ Register()

void spell_midsummer_juggling_torch::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

503 {
506 else
508 }
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
#define SpellCastFn(F)
Definition: SpellScript.h:324
@ SPELL_TORCH_CHECK
Definition: midsummer.cpp:454
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_DUMMY
Definition: SharedDefines.h:753
uint32 m_scriptSpellId
Definition: SpellScript.h:107
HookList< CastHandler > AfterCast
Definition: SpellScript.h:323
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
void HandleDummy(SpellEffIndex effIndex)
Definition: midsummer.cpp:487
void HandleFinish()
Definition: midsummer.cpp:466

References SpellScript::AfterCast, EFFECT_0, HandleDummy(), HandleFinish(), _SpellScript::m_scriptSpellId, SpellScript::OnEffectHitTarget, SPELL_EFFECT_DUMMY, SPELL_TORCH_CHECK, SpellCastFn, and SpellEffectFn.

Member Data Documentation

◆ handled

bool spell_midsummer_juggling_torch::handled
private

Referenced by HandleDummy(), and Load().