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
 
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 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
 
- 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
996 {
997 if (SpellInfo const* spellInfo = GetSpellInfo())
998 {
999 targets.remove_if([spellInfo](WorldObject const* target) -> bool
1000 {
1001 Player const* player = target->ToPlayer();
1002 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
1003 {
1004 return true;
1005 }
1006
1007 auto it = classCallSpells.find(spellInfo->Id);
1008 if (it != classCallSpells.end()) // should never happen but only to be sure.
1009 {
1010 return target->ToPlayer()->getClass() != it->second;
1011 }
1012
1013 return false;
1014 });
1015 }
1016 }
@ CLASS_DEATH_KNIGHT
Definition SharedDefines.h:146
std::unordered_map< uint32, uint8 > const classCallSpells
Definition boss_nefarian.cpp:973
Player * ToPlayer()
Definition Object.h:201
Definition Player.h:1081
bool IsClass(Classes playerClass, ClassContext context=CLASS_CONTEXT_NONE) const override
Definition Player.cpp:1288
Definition SpellInfo.h:316
SpellInfo const * GetSpellInfo()
Definition SpellScript.cpp:411
uint8 getClass() const
Definition Unit.h:809
Definition Object.h:410

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
1019 {
1020 Unit* caster = GetCaster();
1021 Unit* target = GetHitUnit();
1022 if (!caster || !target)
1023 {
1024 return;
1025 }
1026
1027 Position tp = caster->GetFirstCollisionPosition(5.f, 0.f);
1028 target->NearTeleportTo(tp.GetPositionX(), tp.GetPositionY(), tp.GetPositionZ(), tp.GetOrientation());
1029 }
Unit * GetHitUnit()
Definition SpellScript.cpp:448
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:636
void NearTeleportTo(Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
Definition Unit.cpp:20031
Position GetFirstCollisionPosition(float startX, float startY, float startZ, float destX, float destY)
Definition Object.cpp:2834
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
1032 {
1033 if (Unit* target = GetHitUnit())
1034 {
1035 target->CastSpell(target, SPELL_SUMMON_INFERNALS, true);
1036 }
1037 }
@ SPELL_SUMMON_INFERNALS
Definition boss_nefarian.cpp:179

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.

1040 {
1042
1044 {
1046 }
1047 else if (m_scriptSpellId == SPELL_WARLOCK)
1048 {
1050 }
1051 }
@ EFFECT_0
Definition SharedDefines.h:31
@ SPELL_EFFECT_APPLY_AURA
Definition SharedDefines.h:784
@ TARGET_UNIT_SRC_AREA_ENEMY
Definition SharedDefines.h:1420
#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:172
@ SPELL_WARLOCK
Definition boss_nefarian.cpp:170
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:1018
void HandleOnHitWarlock()
Definition boss_nefarian.cpp:1031
void FilterTargets(std::list< WorldObject * > &targets)
Definition boss_nefarian.cpp:995

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.

991 {
993 }
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: