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 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

◆ FilterTargets()

void spell_class_call_handler::FilterTargets ( std::list< WorldObject * > &  targets)
inlineprivate
1026 {
1027 if (SpellInfo const* spellInfo = GetSpellInfo())
1028 {
1029 targets.remove_if([spellInfo](WorldObject const* target) -> bool
1030 {
1031 Player const* player = target->ToPlayer();
1032 if (!player || player->getClass() == CLASS_DEATH_KNIGHT) // ignore all death knights from whatever spell, for some reason the condition below is not working x.x
1033 {
1034 return true;
1035 }
1036
1037 auto it = classCallSpells.find(spellInfo->Id);
1038 if (it != classCallSpells.end()) // should never happen but only to be sure.
1039 {
1040 return target->ToPlayer()->getClass() != it->second;
1041 }
1042
1043 return false;
1044 });
1045 }
1046 }
std::unordered_map< uint32, uint8 > const classCallSpells
Definition: boss_nefarian.cpp:1003
@ CLASS_DEATH_KNIGHT
Definition: SharedDefines.h:146
Player * ToPlayer()
Definition: Object.h:195
Definition: Object.h:393
Definition: Player.h:1056
uint8 getClass() const
Definition: Unit.h:1438
Definition: SpellInfo.h:314
SpellInfo const * GetSpellInfo()
Definition: SpellScript.cpp:411

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

Referenced by Register().

◆ HandleOnHitRogue()

void spell_class_call_handler::HandleOnHitRogue ( SpellEffIndex  )
inlineprivate
1049 {
1050 Unit* caster = GetCaster();
1051 Unit* target = GetHitUnit();
1052 if (!caster || !target)
1053 {
1054 return;
1055 }
1056
1057 Position tp = caster->GetFirstCollisionPosition(5.f, 0.f);
1058 target->NearTeleportTo(tp.GetPositionX(), tp.GetPositionY(), tp.GetPositionZ(), tp.GetOrientation());
1059 }
Position GetFirstCollisionPosition(float startX, float startY, float startZ, float destX, float destY)
Definition: Object.cpp:2809
Definition: Position.h:28
float GetPositionZ() const
Definition: Position.h:119
float GetOrientation() const
Definition: Position.h:120
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
Definition: Unit.h:1302
void NearTeleportTo(Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
Definition: Unit.cpp:20250
Unit * GetHitUnit()
Definition: SpellScript.cpp:448
Unit * GetCaster()
Definition: SpellScript.cpp:401

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
1062 {
1063 if (Unit* target = GetHitUnit())
1064 {
1065 target->CastSpell(target, SPELL_SUMMON_INFERNALS, true);
1066 }
1067 }
@ SPELL_SUMMON_INFERNALS
Definition: boss_nefarian.cpp:174

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.

1070 {
1072
1074 {
1076 }
1077 else if (m_scriptSpellId == SPELL_WARLOCK)
1078 {
1080 }
1081 }
#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:167
@ SPELL_WARLOCK
Definition: boss_nefarian.cpp:165
@ 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
uint32 m_scriptSpellId
Definition: SpellScript.h:107
HookList< HitHandler > OnHit
Definition: SpellScript.h:345
HookList< EffectHandler > OnEffectLaunchTarget
Definition: SpellScript.h:334
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:353
void HandleOnHitRogue(SpellEffIndex)
Definition: boss_nefarian.cpp:1048
void HandleOnHitWarlock()
Definition: boss_nefarian.cpp:1061
void FilterTargets(std::list< WorldObject * > &targets)
Definition: boss_nefarian.cpp:1025

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.

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

References SPELL_SUMMON_INFERNALS, and _SpellScript::ValidateSpellInfo().