SpellScript::EffectHandler Class Referencefinal

#include <SpellScript.h>

Public Types

using SpellEffectFnType = void(SpellScript::*)(SpellEffIndex effIndex)
using SafeWrapperType = void(*)(SpellScript *spellScript, SpellEffIndex effIndex, SpellEffectFnType callImpl)

Public Member Functions

template<typename ScriptFunc >
 EffectHandler (ScriptFunc handler, uint8 effIndex, uint16 effName)
void Call (SpellScript *spellScript, SpellEffIndex effIndex) const
- Public Member Functions inherited from SpellScript::EffectBase
 EffectBase (uint8 effIndex, uint16 effName)
 EffectBase (EffectBase const &right)=delete
 EffectBase (EffectBase &&right) noexcept
EffectBaseoperator= (EffectBase const &right)=delete
EffectBaseoperator= (EffectBase &&right) noexcept
 ~EffectBase ()
std::string ToString () const
bool CheckEffect (SpellInfo const *spellInfo, uint8 effIndex) const override
- Public Member Functions inherited from SpellScriptBase::EffectHook
 EffectHook (uint8 effIndex)
 EffectHook (EffectHook const &right)=delete
 EffectHook (EffectHook &&right) noexcept
EffectHookoperator= (EffectHook const &right)=delete
EffectHookoperator= (EffectHook &&right) noexcept
virtual ~EffectHook ()
uint32 GetAffectedEffectsMask (SpellInfo const *spellInfo) const
bool IsEffectAffected (SpellInfo const *spellInfo, uint8 effIndex) const
virtual bool CheckEffect (SpellInfo const *spellInfo, uint8 effIndex) const =0
std::string EffIndexToString () const

Private Attributes

SpellEffectFnType _callImpl
SafeWrapperType _safeWrapper

Additional Inherited Members

- Protected Attributes inherited from SpellScriptBase::EffectHook
uint8 _effIndex

Detailed Description

Definition at line 352 of file SpellScript.h.

Member Typedef Documentation

◆ SafeWrapperType

Definition at line 357 of file SpellScript.h.

◆ SpellEffectFnType

using SpellScript::EffectHandler::SpellEffectFnType = void(SpellScript::*)(SpellEffIndex effIndex)

Definition at line 355 of file SpellScript.h.

Constructor & Destructor Documentation

◆ EffectHandler()

template<typename ScriptFunc >
SpellScript::EffectHandler::EffectHandler ( ScriptFunc  handler,
uint8  effIndex,
uint16  effName 

Definition at line 360 of file SpellScript.h.

361 : EffectBase(effIndex, effName)
362 {
363 using ScriptClass = GetScriptClass_t<ScriptFunc>;
365 static_assert(sizeof(SpellEffectFnType) >= sizeof(ScriptFunc));
366 static_assert(alignof(SpellEffectFnType) >= alignof(ScriptFunc));
368 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, SpellEffIndex>,
369 "EffectHandler signature must be \"void HandleEffect(SpellEffIndex effIndex)\"");
371 _callImpl = reinterpret_cast<SpellEffectFnType>(handler);
372 _safeWrapper = [](SpellScript* spellScript, SpellEffIndex effIndex, SpellEffectFnType callImpl) -> void
373 {
374 return (static_cast<ScriptClass*>(spellScript)->*reinterpret_cast<ScriptFunc>(callImpl))(effIndex);
375 };
376 }
Definition: SharedDefines.h:29
EffectBase(uint8 effIndex, uint16 effName)
SpellEffectFnType _callImpl
Definition: SpellScript.h:383
void(SpellScript::*)(SpellEffIndex effIndex) SpellEffectFnType
Definition: SpellScript.h:355
SafeWrapperType _safeWrapper
Definition: SpellScript.h:384

Member Function Documentation

◆ Call()

void SpellScript::EffectHandler::Call ( SpellScript spellScript,
SpellEffIndex  effIndex 
) const

Definition at line 378 of file SpellScript.h.

379 {
380 return _safeWrapper(spellScript, effIndex, _callImpl);
381 }
+ Here is the caller graph for this function:

Member Data Documentation

◆ _callImpl

SpellEffectFnType SpellScript::EffectHandler::_callImpl

Definition at line 383 of file SpellScript.h.

◆ _safeWrapper

SafeWrapperType SpellScript::EffectHandler::_safeWrapper

Definition at line 384 of file SpellScript.h.

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