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

Private Member Functions

 PrepareSpellScript (spell_class_call_handler)
 
bool Validate (SpellInfo const *) override
 
void FilterTargets (std::list< WorldObject * > &targets)
 
void HandleOnHitRogue (SpellEffIndex)
 
void HandleOnHitWarlock ()
 
void Register () override
 

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
 
Unit * GetCaster ()
 
GameObject * GetGObjCaster ()
 
Unit * GetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObject * GetExplTargetWorldObject ()
 
Unit * GetExplTargetUnit ()
 
GameObject * GetExplTargetGObj ()
 
Item * GetExplTargetItem ()
 
Unit * GetHitUnit ()
 
Creature * GetHitCreature ()
 
Player * GetHitPlayer ()
 
Item * GetHitItem ()
 
GameObject * GetHitGObj ()
 
WorldLocation * GetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
Spell * GetSpell ()
 
Aura * GetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
Item * GetCastItem ()
 
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 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< CastHandler > BeforeCast
 
HookList< CastHandler > OnCast
 
HookList< CastHandler > AfterCast
 
HookList< CheckCastHandler > OnCheckCast
 
HookList< EffectHandler > OnEffectLaunch
 
HookList< EffectHandler > OnEffectLaunchTarget
 
HookList< EffectHandler > OnEffectHit
 
HookList< EffectHandler > OnEffectHitTarget
 
HookList< BeforeHitHandler > BeforeHit
 
HookList< HitHandler > OnHit
 
HookList< HitHandler > AfterHit
 
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandler > OnObjectTargetSelect
 
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ FilterTargets()

void spell_class_call_handler::FilterTargets ( std::list< WorldObject * > &  targets)
inlineprivate
939 {
940 if (SpellInfo const* spellInfo = GetSpellInfo())
941 {
942 targets.remove_if([spellInfo](WorldObject const* target) -> bool
943 {
944 Player const* player = target->ToPlayer();
945 if (!player || player->IsClass(CLASS_DEATH_KNIGHT)) // ignore all death knights from whatever spell, for some reason the condition below is not working x.x
946 return true;
947
948 auto it = classCallSpells.find(spellInfo->Id);
949 if (it != classCallSpells.end()) // should never happen but only to be sure.
950 return target->ToPlayer()->getClass() != it->second;
951
952 return false;
953 });
954 }
955 }
@ CLASS_DEATH_KNIGHT
Definition SharedDefines.h:131
std::unordered_map< uint32, uint8 > const classCallSpells
Definition boss_nefarian.cpp:916
Player * ToPlayer()
Definition Object.h:208
Definition Player.h:1086
bool IsClass(Classes playerClass, ClassContext context=CLASS_CONTEXT_NONE) const override
Definition Player.cpp:1350
Definition SpellInfo.h:340
SpellInfo const * GetSpellInfo()
Definition SpellScript.cpp:416
uint8 getClass() const
Definition Unit.h:844
Definition Object.h:482

References CLASS_DEATH_KNIGHT, classCallSpells, Unit::getClass(), SpellScript::GetSpellInfo(), Player::IsClass(), and Object::ToPlayer().

Referenced by Register().

◆ HandleOnHitRogue()

void spell_class_call_handler::HandleOnHitRogue ( SpellEffIndex  )
inlineprivate
958 {
959 Unit* caster = GetCaster();
960 Unit* target = GetHitUnit();
961 if (!caster || !target)
962 return;
963
964 Position tp = caster->GetFirstCollisionPosition(5.f, 0.f);
966 }
Unit * GetHitUnit()
Definition SpellScript.cpp:453
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:665
void NearTeleportTo(Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
Definition Unit.cpp:15572
Position GetFirstCollisionPosition(float startX, float startY, float startZ, float destX, float destY)
Definition Object.cpp:2947
Definition Position.h:27
float GetPositionZ() const
Definition Position.h:123
float GetOrientation() const
Definition Position.h:124
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122

References SpellScript::GetCaster(), WorldObject::GetFirstCollisionPosition(), SpellScript::GetHitUnit(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and Unit::NearTeleportTo().

Referenced by Register().

◆ HandleOnHitWarlock()

void spell_class_call_handler::HandleOnHitWarlock ( )
inlineprivate
969 {
970 if (Unit* target = GetHitUnit())
971 target->CastSpell(target, SPELL_SUMMON_INFERNALS, true);
972 }
@ SPELL_SUMMON_INFERNALS
Definition boss_nefarian.cpp:180

References SpellScript::GetHitUnit(), and SPELL_SUMMON_INFERNALS.

Referenced by Register().

◆ PrepareSpellScript()

spell_class_call_handler::PrepareSpellScript ( spell_class_call_handler  )
private

◆ Register()

void spell_class_call_handler::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

975 {
977
979 {
981 }
982 else if (m_scriptSpellId == SPELL_WARLOCK)
983 {
985 }
986 }
@ EFFECT_0
Definition SharedDefines.h:31
@ SPELL_EFFECT_APPLY_AURA
Definition SharedDefines.h:772
@ TARGET_UNIT_SRC_AREA_ENEMY
Definition SharedDefines.h:1424
#define EFFECT_ALL
Definition SharedDefines.h:38
#define SpellEffectFn(F, I, N)
Definition SpellScript.h:337
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition SpellScript.h:354
#define SpellHitFn(F)
Definition SpellScript.h:349
@ SPELL_ROGUE
Definition boss_nefarian.cpp:173
@ SPELL_WARLOCK
Definition boss_nefarian.cpp:171
HookList< HitHandler > OnHit
Definition SpellScript.h:345
HookList< EffectHandler > OnEffectLaunchTarget
Definition SpellScript.h:334
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition SpellScript.h:353
uint32 m_scriptSpellId
Definition SpellScript.h:107
void HandleOnHitRogue(SpellEffIndex)
Definition boss_nefarian.cpp:957
void HandleOnHitWarlock()
Definition boss_nefarian.cpp:968
void FilterTargets(std::list< WorldObject * > &targets)
Definition boss_nefarian.cpp:938

References EFFECT_0, EFFECT_ALL, FilterTargets(), HandleOnHitRogue(), HandleOnHitWarlock(), _SpellScript::m_scriptSpellId, SpellScript::OnEffectLaunchTarget, SpellScript::OnHit, SpellScript::OnObjectAreaTargetSelect, SPELL_EFFECT_APPLY_AURA, SPELL_ROGUE, SPELL_WARLOCK, SpellEffectFn, SpellHitFn, SpellObjectAreaTargetSelectFn, and TARGET_UNIT_SRC_AREA_ENEMY.

◆ Validate()

bool spell_class_call_handler::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

934 {
936 }
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition SpellScript.h:125

References SPELL_SUMMON_INFERNALS, and _SpellScript::ValidateSpellInfo().


The documentation for this class was generated from the following file: