AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ScriptMgrMacros.h File Reference
#include "ScriptMgr.h"

Go to the source code of this file.

Macros

#define CALL_ENABLED_HOOKS(scriptType, hookType, action)
 
#define CALL_ENABLED_BOOLEAN_HOOKS(scriptType, hookType, action)
 
#define CALL_ENABLED_BOOLEAN_HOOKS_WITH_DEFAULT_FALSE(scriptType, hookType, action)
 

Functions

template<typename ScriptName >
Optional< bool > IsValidBoolScript (std::function< bool(ScriptName *)> executeHook)
 
template<typename ScriptName , class T >
T * GetReturnAIScript (std::function< T *(ScriptName *)> executeHook)
 
template<typename ScriptName >
void ExecuteScript (std::function< void(ScriptName *)> executeHook)
 
bool ReturnValidBool (Optional< bool > ret, bool need=false)
 

Macro Definition Documentation

◆ CALL_ENABLED_BOOLEAN_HOOKS

#define CALL_ENABLED_BOOLEAN_HOOKS (   scriptType,
  hookType,
  action 
)
Value:
return true; \
for (auto const& script : ScriptRegistry<scriptType>::EnabledHooks[hookType]) { if (action) return false; } \
return true;
Definition: ScriptMgr.h:710

◆ CALL_ENABLED_BOOLEAN_HOOKS_WITH_DEFAULT_FALSE

#define CALL_ENABLED_BOOLEAN_HOOKS_WITH_DEFAULT_FALSE (   scriptType,
  hookType,
  action 
)
Value:
return false; \
for (auto const& script : ScriptRegistry<scriptType>::EnabledHooks[hookType]) { if (action) return true; } \
return false;

◆ CALL_ENABLED_HOOKS

#define CALL_ENABLED_HOOKS (   scriptType,
  hookType,
  action 
)
Value:
if (!ScriptRegistry<scriptType>::EnabledHooks[hookType].empty()) \
for (auto const& script : ScriptRegistry<scriptType>::EnabledHooks[hookType]) { action; }

Function Documentation

◆ ExecuteScript()

template<typename ScriptName >
void ExecuteScript ( std::function< void(ScriptName *)>  executeHook)
inline
57{
59 return;
60
61 for (auto const& [scriptID, script] : ScriptRegistry<ScriptName>::ScriptPointerList)
62 {
63 executeHook(script);
64 }
65}

◆ GetReturnAIScript()

template<typename ScriptName , class T >
T * GetReturnAIScript ( std::function< T *(ScriptName *)>  executeHook)
inline
40{
42 return nullptr;
43
44 for (auto const& [scriptID, script] : ScriptRegistry<ScriptName>::ScriptPointerList)
45 {
46 if (T* scriptAI = executeHook(script))
47 {
48 return scriptAI;
49 }
50 }
51
52 return nullptr;
53}

◆ IsValidBoolScript()

template<typename ScriptName >
Optional< bool > IsValidBoolScript ( std::function< bool(ScriptName *)>  executeHook)
inline
25{
27 return {};
28
29 for (auto const& [scriptID, script] : ScriptRegistry<ScriptName>::ScriptPointerList)
30 {
31 if (executeHook(script))
32 return true;
33 }
34
35 return false;
36}

◆ ReturnValidBool()

bool ReturnValidBool ( Optional< bool >  ret,
bool  need = false 
)
inline
68{
69 return ret && *ret ? need : !need;
70}