TrinityCore
SpellScript::ObjectAreaTargetSelectHandler Class Referencefinal

#include <SpellScript.h>

Classes

union  SpellObjectAreaTargetSelectFnType
 

Public Types

using SafeWrapperType = void(*)(SpellScript *spellScript, std::list< WorldObject * > &targets, SpellObjectAreaTargetSelectFnType callImpl)
 

Public Member Functions

template<typename ScriptFunc >
 ObjectAreaTargetSelectHandler (ScriptFunc handler, uint8 effIndex, uint16 targetType)
 
void Call (SpellScript *spellScript, std::list< WorldObject * > &targets) const
 
- Public Member Functions inherited from SpellScript::TargetHook
 TargetHook (uint8 effectIndex, uint16 targetType, bool area, bool dest)
 
 TargetHook (TargetHook const &right)=delete
 
 TargetHook (TargetHook &&right) noexcept
 
TargetHookoperator= (TargetHook const &right)=delete
 
TargetHookoperator= (TargetHook &&right) noexcept
 
virtual ~TargetHook ()
 
bool CheckEffect (SpellInfo const *spellInfo, uint8 effIndex) const override
 
std::string ToString () const
 
uint16 GetTarget () const
 
- 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

SpellObjectAreaTargetSelectFnType _callImpl
 
SafeWrapperType _safeWrapper
 

Additional Inherited Members

- Protected Attributes inherited from SpellScript::TargetHook
uint16 _targetType
 
bool _area
 
bool _dest
 
- Protected Attributes inherited from SpellScriptBase::EffectHook
uint8 _effIndex
 

Detailed Description

Definition at line 525 of file SpellScript.h.

Member Typedef Documentation

◆ SafeWrapperType

Definition at line 534 of file SpellScript.h.

Constructor & Destructor Documentation

◆ ObjectAreaTargetSelectHandler()

template<typename ScriptFunc >
SpellScript::ObjectAreaTargetSelectHandler::ObjectAreaTargetSelectHandler ( ScriptFunc  handler,
uint8  effIndex,
uint16  targetType 
)
inlineexplicit

Definition at line 537 of file SpellScript.h.

538 : TargetHook(effIndex, targetType, true, false)
539 {
540 using ScriptClass = GetScriptClass_t<ScriptFunc>;
541
542 static_assert(sizeof(SpellObjectAreaTargetSelectFnType) >= sizeof(ScriptFunc));
543 static_assert(alignof(SpellObjectAreaTargetSelectFnType) >= alignof(ScriptFunc));
544
545 if constexpr (!std::is_void_v<ScriptClass>)
546 {
547 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, std::list<WorldObject*>&>,
548 "ObjectAreaTargetSelectHandler signature must be \"void SetTargets(std::list<WorldObject*>& targets)\"");
549
550 _callImpl = { .Member = reinterpret_cast<decltype(SpellObjectAreaTargetSelectFnType::Member)>(handler) };
551 _safeWrapper = [](SpellScript* spellScript, std::list<WorldObject*>& targets, SpellObjectAreaTargetSelectFnType callImpl) -> void
552 {
553 return (static_cast<ScriptClass*>(spellScript)->*reinterpret_cast<ScriptFunc>(callImpl.Member))(targets);
554 };
555 }
556 else
557 {
558 static_assert(std::is_invocable_r_v<void, ScriptFunc, std::list<WorldObject*>&>,
559 "ObjectAreaTargetSelectHandler signature must be \"static void SetTargets(std::list<WorldObject*>& targets)\"");
560
561 _callImpl = { .Static = reinterpret_cast<decltype(SpellObjectAreaTargetSelectFnType::Static)>(handler) };
562 _safeWrapper = [](SpellScript* /*spellScript*/, std::list<WorldObject*>& targets, SpellObjectAreaTargetSelectFnType callImpl) -> void
563 {
564 return reinterpret_cast<ScriptFunc>(callImpl.Static)(targets);
565 };
566 }
567 }
SpellObjectAreaTargetSelectFnType _callImpl
Definition: SpellScript.h:574
TargetHook(uint8 effectIndex, uint16 targetType, bool area, bool dest)
void(SpellScript::* Member)(std::list< WorldObject * > &targets)
Definition: SpellScript.h:530

Member Function Documentation

◆ Call()

void SpellScript::ObjectAreaTargetSelectHandler::Call ( SpellScript spellScript,
std::list< WorldObject * > &  targets 
) const
inline

Definition at line 569 of file SpellScript.h.

570 {
571 return _safeWrapper(spellScript, targets, _callImpl);
572 }
+ Here is the caller graph for this function:

Member Data Documentation

◆ _callImpl

SpellObjectAreaTargetSelectFnType SpellScript::ObjectAreaTargetSelectHandler::_callImpl
private

Definition at line 574 of file SpellScript.h.

◆ _safeWrapper

SafeWrapperType SpellScript::ObjectAreaTargetSelectHandler::_safeWrapper
private

Definition at line 575 of file SpellScript.h.


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