feat(ElunaConfig): Add ElunaConfig using ConfigValueCache (#310)

This commit is contained in:
iThorgrim
2025-09-09 09:08:46 +02:00
committed by GitHub
parent 44f1f1f71b
commit 576d18753c
19 changed files with 121 additions and 41 deletions

View File

@@ -1105,6 +1105,7 @@ public:
void OnBeforeConfigLoad(bool reload) override void OnBeforeConfigLoad(bool reload) override
{ {
ElunaConfig::GetInstance().Initialize(reload);
if (!reload) if (!reload)
{ {
///- Initialize Lua Engine ///- Initialize Lua Engine

View File

@@ -0,0 +1,30 @@
#include "ElunaConfig.h"
ElunaConfig& ElunaConfig::GetInstance()
{
static ElunaConfig instance;
return instance;
}
ElunaConfig::ElunaConfig() : ConfigValueCache<ElunaConfigValues>(ElunaConfigValues::CONFIG_VALUE_COUNT)
{
}
void ElunaConfig::Initialize(bool reload)
{
ConfigValueCache<ElunaConfigValues>::Initialize(reload);
}
void ElunaConfig::BuildConfigCache()
{
SetConfigValue<bool>(ElunaConfigValues::ENABLED, "Eluna.Enabled", "false");
SetConfigValue<bool>(ElunaConfigValues::TRACEBACK_ENABLED, "Eluna.TraceBack", "false");
SetConfigValue<bool>(ElunaConfigValues::AUTORELOAD_ENABLED, "Eluna.AutoReload", "false");
SetConfigValue<bool>(ElunaConfigValues::BYTECODE_CACHE_ENABLED, "Eluna.BytecodeCache", "false");
SetConfigValue<std::string>(ElunaConfigValues::SCRIPT_PATH, "Eluna.ScriptPath", "lua_scripts");
SetConfigValue<std::string>(ElunaConfigValues::REQUIRE_PATH, "Eluna.RequirePaths", "");
SetConfigValue<std::string>(ElunaConfigValues::REQUIRE_CPATH, "Eluna.RequireCPaths", "");
SetConfigValue<uint32>(ElunaConfigValues::AUTORELOAD_INTERVAL, "Eluna.AutoReloadInterval", 1);
}

View File

@@ -0,0 +1,53 @@
#ifndef ELUNA_CONFIG_HPP
#define ELUNA_CONFIG_HPP
#include "ConfigValueCache.h"
enum class ElunaConfigValues : uint32
{
// Boolean
ENABLED = 0,
TRACEBACK_ENABLED,
AUTORELOAD_ENABLED,
BYTECODE_CACHE_ENABLED,
// String
SCRIPT_PATH,
REQUIRE_PATH,
REQUIRE_CPATH,
// Number
AUTORELOAD_INTERVAL,
CONFIG_VALUE_COUNT
};
class ElunaConfig final : public ConfigValueCache<ElunaConfigValues>
{
public:
static ElunaConfig& GetInstance();
void Initialize(bool reload = false);
bool IsElunaEnabled() const { return GetConfigValue<bool>(ElunaConfigValues::ENABLED); }
bool IsTraceBackEnabled() const { return GetConfigValue<bool>(ElunaConfigValues::TRACEBACK_ENABLED); }
bool IsAutoReloadEnabled() const { return GetConfigValue<bool>(ElunaConfigValues::AUTORELOAD_ENABLED); }
bool IsByteCodeCacheEnabled() const { return GetConfigValue<bool>(ElunaConfigValues::BYTECODE_CACHE_ENABLED); }
std::string_view GetScriptPath() const { return GetConfigValue(ElunaConfigValues::SCRIPT_PATH); }
std::string_view GetRequirePath() const { return GetConfigValue(ElunaConfigValues::REQUIRE_PATH); }
std::string_view GetRequireCPath() const { return GetConfigValue(ElunaConfigValues::REQUIRE_CPATH); }
uint32 GetAutoReloadInterval() const { return GetConfigValue<uint32>(ElunaConfigValues::AUTORELOAD_INTERVAL); }
protected:
void BuildConfigCache() override;
private:
ElunaConfig();
~ElunaConfig() = default;
ElunaConfig(const ElunaConfig&) = delete;
ElunaConfig& operator=(const ElunaConfig&) = delete;
};
#endif // ELUNA_CONFIG_H

View File

@@ -78,7 +78,7 @@ void Eluna::Initialize()
GEluna = new Eluna(); GEluna = new Eluna();
// Start file watcher if enabled // Start file watcher if enabled
if (eConfigMgr->GetOption<bool>("Eluna.AutoReload", false)) if (ElunaConfig::GetInstance().IsAutoReloadEnabled())
{ {
uint32 watchInterval = eConfigMgr->GetOption<uint32>("Eluna.AutoReloadInterval", 1); uint32 watchInterval = eConfigMgr->GetOption<uint32>("Eluna.AutoReloadInterval", 1);
fileWatcher = std::make_unique<ElunaFileWatcher>(); fileWatcher = std::make_unique<ElunaFileWatcher>();
@@ -117,9 +117,9 @@ void Eluna::LoadScriptPaths()
lua_scripts.clear(); lua_scripts.clear();
lua_extensions.clear(); lua_extensions.clear();
lua_folderpath = eConfigMgr->GetOption<std::string>("Eluna.ScriptPath", "lua_scripts"); lua_folderpath = ElunaConfig::GetInstance().GetScriptPath();
const std::string& lua_path_extra = eConfigMgr->GetOption<std::string>("Eluna.RequirePaths", ""); const std::string& lua_path_extra = static_cast<std::string>(ElunaConfig::GetInstance().GetRequirePath());
const std::string& lua_cpath_extra = eConfigMgr->GetOption<std::string>("Eluna.RequireCPaths", ""); const std::string& lua_cpath_extra = static_cast<std::string>(ElunaConfig::GetInstance().GetRequireCPath());
#ifndef ELUNA_WINDOWS #ifndef ELUNA_WINDOWS
if (lua_folderpath[0] == '~') if (lua_folderpath[0] == '~')
@@ -182,7 +182,6 @@ void Eluna::_ReloadEluna()
Eluna::Eluna() : Eluna::Eluna() :
event_level(0), event_level(0),
push_counter(0), push_counter(0),
enabled(false),
L(NULL), L(NULL),
eventMgr(NULL), eventMgr(NULL),
@@ -249,9 +248,7 @@ void Eluna::CloseLua()
void Eluna::OpenLua() void Eluna::OpenLua()
{ {
enabled = eConfigMgr->GetOption<bool>("Eluna.Enabled", true); if (!ElunaConfig::GetInstance().IsElunaEnabled())
if (!IsEnabled())
{ {
ELUNA_LOG_INFO("[Eluna]: Eluna is disabled in config"); ELUNA_LOG_INFO("[Eluna]: Eluna is disabled in config");
return; return;
@@ -532,7 +529,7 @@ int Eluna::TryLoadFromGlobalCache(lua_State* L, const std::string& filepath)
int Eluna::LoadScriptWithCache(lua_State* L, const std::string& filepath, bool isMoonScript, uint32* compiledCount, uint32* cachedCount) int Eluna::LoadScriptWithCache(lua_State* L, const std::string& filepath, bool isMoonScript, uint32* compiledCount, uint32* cachedCount)
{ {
bool cacheEnabled = eConfigMgr->GetOption<bool>("Eluna.BytecodeCache", true); bool cacheEnabled = ElunaConfig::GetInstance().IsByteCodeCacheEnabled();
if (cacheEnabled) if (cacheEnabled)
{ {
@@ -671,7 +668,7 @@ static bool ScriptPathComparator(const LuaScript& first, const LuaScript& second
void Eluna::RunScripts() void Eluna::RunScripts()
{ {
LOCK_ELUNA; LOCK_ELUNA;
if (!IsEnabled()) if (!ElunaConfig::GetInstance().IsElunaEnabled())
return; return;
uint32 oldMSTime = ElunaUtil::GetCurrTime(); uint32 oldMSTime = ElunaUtil::GetCurrTime();
@@ -855,7 +852,7 @@ bool Eluna::ExecuteCall(int params, int res)
ASSERT(false); // stack probably corrupt ASSERT(false); // stack probably corrupt
} }
bool usetrace = eConfigMgr->GetOption<bool>("Eluna.TraceBack", false); bool usetrace = ElunaConfig::GetInstance().IsTraceBackEnabled();
if (usetrace) if (usetrace)
{ {
lua_pushcfunction(L, &StackTrace); lua_pushcfunction(L, &StackTrace);
@@ -1576,7 +1573,7 @@ int Eluna::CallOneFunction(int number_of_functions, int number_of_arguments, int
CreatureAI* Eluna::GetAI(Creature* creature) CreatureAI* Eluna::GetAI(Creature* creature)
{ {
if (!IsEnabled()) if (!ElunaConfig::GetInstance().IsElunaEnabled())
return NULL; return NULL;
for (int i = 1; i < Hooks::CREATURE_EVENT_COUNT; ++i) for (int i = 1; i < Hooks::CREATURE_EVENT_COUNT; ++i)
@@ -1596,7 +1593,7 @@ CreatureAI* Eluna::GetAI(Creature* creature)
InstanceData* Eluna::GetInstanceData(Map* map) InstanceData* Eluna::GetInstanceData(Map* map)
{ {
if (!IsEnabled()) if (!ElunaConfig::GetInstance().IsElunaEnabled())
return NULL; return NULL;
for (int i = 1; i < Hooks::INSTANCE_EVENT_COUNT; ++i) for (int i = 1; i < Hooks::INSTANCE_EVENT_COUNT; ++i)
@@ -1662,7 +1659,7 @@ void Eluna::FreeInstanceId(uint32 instanceId)
{ {
LOCK_ELUNA; LOCK_ELUNA;
if (!IsEnabled()) if (!ElunaConfig::GetInstance().IsElunaEnabled())
return; return;
for (int i = 1; i < Hooks::INSTANCE_EVENT_COUNT; ++i) for (int i = 1; i < Hooks::INSTANCE_EVENT_COUNT; ++i)

View File

@@ -23,8 +23,9 @@
#include "HttpManager.h" #include "HttpManager.h"
#include "EventEmitter.h" #include "EventEmitter.h"
#include "TicketMgr.h" #include "TicketMgr.h"
#include "ElunaFileWatcher.h"
#include "LootMgr.h" #include "LootMgr.h"
#include "ElunaFileWatcher.h"
#include "ElunaConfig.h"
#include <mutex> #include <mutex>
#include <memory> #include <memory>
#include <vector> #include <vector>
@@ -145,7 +146,6 @@ private:
// When a hook pushes arguments to be passed to event handlers, // When a hook pushes arguments to be passed to event handlers,
// this is used to keep track of how many arguments were pushed. // this is used to keep track of how many arguments were pushed.
uint8 push_counter; uint8 push_counter;
bool enabled;
// Map from instance ID -> Lua table ref // Map from instance ID -> Lua table ref
std::unordered_map<uint32, int> instanceDataRefs; std::unordered_map<uint32, int> instanceDataRefs;
@@ -335,7 +335,6 @@ public:
void RunScripts(); void RunScripts();
bool ShouldReload() const { return reload; } bool ShouldReload() const { return reload; }
bool IsEnabled() const { return enabled && IsInitialized(); }
bool HasLuaState() const { return L != NULL; } bool HasLuaState() const { return L != NULL; }
uint64 GetCallstackId() const { return callstackid; } uint64 GetCallstackId() const { return callstackid; }
int Register(lua_State* L, uint8 reg, uint32 entry, ObjectGuid guid, uint32 instanceId, uint32 event_id, int functionRef, uint32 shots); int Register(lua_State* L, uint8 reg, uint32 entry, ObjectGuid guid, uint32 instanceId, uint32 event_id, int functionRef, uint32 shots);

View File

@@ -13,7 +13,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK(EVENT) \ #define START_HOOK(EVENT) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EventKey<BGEvents>(EVENT);\ auto key = EventKey<BGEvents>(EVENT);\
if (!BGEventBindings->HasBindingsFor(key))\ if (!BGEventBindings->HasBindingsFor(key))\

View File

@@ -14,7 +14,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK(EVENT, CREATURE) \ #define START_HOOK(EVENT, CREATURE) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto entry_key = EntryKey<CreatureEvents>(EVENT, CREATURE->GetEntry());\ auto entry_key = EntryKey<CreatureEvents>(EVENT, CREATURE->GetEntry());\
auto unique_key = UniqueObjectKey<CreatureEvents>(EVENT, CREATURE->GET_GUID(), CREATURE->GetInstanceId());\ auto unique_key = UniqueObjectKey<CreatureEvents>(EVENT, CREATURE->GET_GUID(), CREATURE->GetInstanceId());\
@@ -24,7 +24,7 @@ using namespace Hooks;
LOCK_ELUNA LOCK_ELUNA
#define START_HOOK_WITH_RETVAL(EVENT, CREATURE, RETVAL) \ #define START_HOOK_WITH_RETVAL(EVENT, CREATURE, RETVAL) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return RETVAL;\ return RETVAL;\
auto entry_key = EntryKey<CreatureEvents>(EVENT, CREATURE->GetEntry());\ auto entry_key = EntryKey<CreatureEvents>(EVENT, CREATURE->GetEntry());\
auto unique_key = UniqueObjectKey<CreatureEvents>(EVENT, CREATURE->GET_GUID(), CREATURE->GetInstanceId());\ auto unique_key = UniqueObjectKey<CreatureEvents>(EVENT, CREATURE->GET_GUID(), CREATURE->GetInstanceId());\

View File

@@ -15,7 +15,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK(EVENT, ENTRY) \ #define START_HOOK(EVENT, ENTRY) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EntryKey<GameObjectEvents>(EVENT, ENTRY);\ auto key = EntryKey<GameObjectEvents>(EVENT, ENTRY);\
if (!GameObjectEventBindings->HasBindingsFor(key))\ if (!GameObjectEventBindings->HasBindingsFor(key))\
@@ -23,7 +23,7 @@ using namespace Hooks;
LOCK_ELUNA LOCK_ELUNA
#define START_HOOK_WITH_RETVAL(EVENT, ENTRY, RETVAL) \ #define START_HOOK_WITH_RETVAL(EVENT, ENTRY, RETVAL) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return RETVAL;\ return RETVAL;\
auto key = EntryKey<GameObjectEvents>(EVENT, ENTRY);\ auto key = EntryKey<GameObjectEvents>(EVENT, ENTRY);\
if (!GameObjectEventBindings->HasBindingsFor(key))\ if (!GameObjectEventBindings->HasBindingsFor(key))\

View File

@@ -14,7 +14,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK(BINDINGS, EVENT, ENTRY) \ #define START_HOOK(BINDINGS, EVENT, ENTRY) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EntryKey<GossipEvents>(EVENT, ENTRY);\ auto key = EntryKey<GossipEvents>(EVENT, ENTRY);\
if (!BINDINGS->HasBindingsFor(key))\ if (!BINDINGS->HasBindingsFor(key))\
@@ -22,7 +22,7 @@ using namespace Hooks;
LOCK_ELUNA LOCK_ELUNA
#define START_HOOK_WITH_RETVAL(BINDINGS, EVENT, ENTRY, RETVAL) \ #define START_HOOK_WITH_RETVAL(BINDINGS, EVENT, ENTRY, RETVAL) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return RETVAL;\ return RETVAL;\
auto key = EntryKey<GossipEvents>(EVENT, ENTRY);\ auto key = EntryKey<GossipEvents>(EVENT, ENTRY);\
if (!BINDINGS->HasBindingsFor(key))\ if (!BINDINGS->HasBindingsFor(key))\

View File

@@ -13,7 +13,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK(EVENT) \ #define START_HOOK(EVENT) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EventKey<GroupEvents>(EVENT);\ auto key = EventKey<GroupEvents>(EVENT);\
if (!GroupEventBindings->HasBindingsFor(key))\ if (!GroupEventBindings->HasBindingsFor(key))\

View File

@@ -13,7 +13,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK(EVENT) \ #define START_HOOK(EVENT) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EventKey<GuildEvents>(EVENT);\ auto key = EventKey<GuildEvents>(EVENT);\
if (!GuildEventBindings->HasBindingsFor(key))\ if (!GuildEventBindings->HasBindingsFor(key))\

View File

@@ -15,7 +15,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK(EVENT, AI) \ #define START_HOOK(EVENT, AI) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto mapKey = EntryKey<InstanceEvents>(EVENT, AI->instance->GetId());\ auto mapKey = EntryKey<InstanceEvents>(EVENT, AI->instance->GetId());\
auto instanceKey = EntryKey<InstanceEvents>(EVENT, AI->instance->GetInstanceId());\ auto instanceKey = EntryKey<InstanceEvents>(EVENT, AI->instance->GetInstanceId());\
@@ -26,7 +26,7 @@ using namespace Hooks;
Push(AI->instance) Push(AI->instance)
#define START_HOOK_WITH_RETVAL(EVENT, AI, RETVAL) \ #define START_HOOK_WITH_RETVAL(EVENT, AI, RETVAL) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return RETVAL;\ return RETVAL;\
auto mapKey = EntryKey<InstanceEvents>(EVENT, AI->instance->GetId());\ auto mapKey = EntryKey<InstanceEvents>(EVENT, AI->instance->GetId());\
auto instanceKey = EntryKey<InstanceEvents>(EVENT, AI->instance->GetInstanceId());\ auto instanceKey = EntryKey<InstanceEvents>(EVENT, AI->instance->GetInstanceId());\

View File

@@ -14,7 +14,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK(EVENT, ENTRY) \ #define START_HOOK(EVENT, ENTRY) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EntryKey<ItemEvents>(EVENT, ENTRY);\ auto key = EntryKey<ItemEvents>(EVENT, ENTRY);\
if (!ItemEventBindings->HasBindingsFor(key))\ if (!ItemEventBindings->HasBindingsFor(key))\
@@ -22,7 +22,7 @@ using namespace Hooks;
LOCK_ELUNA LOCK_ELUNA
#define START_HOOK_WITH_RETVAL(EVENT, ENTRY, RETVAL) \ #define START_HOOK_WITH_RETVAL(EVENT, ENTRY, RETVAL) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return RETVAL;\ return RETVAL;\
auto key = EntryKey<ItemEvents>(EVENT, ENTRY);\ auto key = EntryKey<ItemEvents>(EVENT, ENTRY);\
if (!ItemEventBindings->HasBindingsFor(key))\ if (!ItemEventBindings->HasBindingsFor(key))\

View File

@@ -14,7 +14,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK_SERVER(EVENT) \ #define START_HOOK_SERVER(EVENT) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EventKey<ServerEvents>(EVENT);\ auto key = EventKey<ServerEvents>(EVENT);\
if (!ServerEventBindings->HasBindingsFor(key))\ if (!ServerEventBindings->HasBindingsFor(key))\
@@ -22,7 +22,7 @@ using namespace Hooks;
LOCK_ELUNA LOCK_ELUNA
#define START_HOOK_PACKET(EVENT, OPCODE) \ #define START_HOOK_PACKET(EVENT, OPCODE) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EntryKey<PacketEvents>(EVENT, OPCODE);\ auto key = EntryKey<PacketEvents>(EVENT, OPCODE);\
if (!PacketEventBindings->HasBindingsFor(key))\ if (!PacketEventBindings->HasBindingsFor(key))\

View File

@@ -14,7 +14,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK(EVENT) \ #define START_HOOK(EVENT) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EventKey<PlayerEvents>(EVENT);\ auto key = EventKey<PlayerEvents>(EVENT);\
if (!PlayerEventBindings->HasBindingsFor(key))\ if (!PlayerEventBindings->HasBindingsFor(key))\
@@ -22,7 +22,7 @@ using namespace Hooks;
LOCK_ELUNA LOCK_ELUNA
#define START_HOOK_WITH_RETVAL(EVENT, RETVAL) \ #define START_HOOK_WITH_RETVAL(EVENT, RETVAL) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return RETVAL;\ return RETVAL;\
auto key = EventKey<PlayerEvents>(EVENT);\ auto key = EventKey<PlayerEvents>(EVENT);\
if (!PlayerEventBindings->HasBindingsFor(key))\ if (!PlayerEventBindings->HasBindingsFor(key))\

View File

@@ -15,7 +15,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK(EVENT) \ #define START_HOOK(EVENT) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EventKey<ServerEvents>(EVENT);\ auto key = EventKey<ServerEvents>(EVENT);\
if (!ServerEventBindings->HasBindingsFor(key))\ if (!ServerEventBindings->HasBindingsFor(key))\
@@ -23,7 +23,7 @@ using namespace Hooks;
LOCK_ELUNA LOCK_ELUNA
#define START_HOOK_WITH_RETVAL(EVENT, RETVAL) \ #define START_HOOK_WITH_RETVAL(EVENT, RETVAL) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return RETVAL;\ return RETVAL;\
auto key = EventKey<ServerEvents>(EVENT);\ auto key = EventKey<ServerEvents>(EVENT);\
if (!ServerEventBindings->HasBindingsFor(key))\ if (!ServerEventBindings->HasBindingsFor(key))\

View File

@@ -14,7 +14,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK(EVENT, ENTRY) \ #define START_HOOK(EVENT, ENTRY) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EntryKey<SpellEvents>(EVENT, ENTRY);\ auto key = EntryKey<SpellEvents>(EVENT, ENTRY);\
if (!SpellEventBindings->HasBindingsFor(key))\ if (!SpellEventBindings->HasBindingsFor(key))\
@@ -22,7 +22,7 @@ using namespace Hooks;
LOCK_ELUNA LOCK_ELUNA
#define START_HOOK_WITH_RETVAL(EVENT, ENTRY, RETVAL) \ #define START_HOOK_WITH_RETVAL(EVENT, ENTRY, RETVAL) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return RETVAL;\ return RETVAL;\
auto key = EntryKey<SpellEvents>(EVENT, ENTRY);\ auto key = EntryKey<SpellEvents>(EVENT, ENTRY);\
if (!SpellEventBindings->HasBindingsFor(key))\ if (!SpellEventBindings->HasBindingsFor(key))\

View File

@@ -14,7 +14,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK(EVENT) \ #define START_HOOK(EVENT) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EventKey<TicketEvents>(EVENT);\ auto key = EventKey<TicketEvents>(EVENT);\
if (!TicketEventBindings->HasBindingsFor(key))\ if (!TicketEventBindings->HasBindingsFor(key))\
@@ -22,7 +22,7 @@ using namespace Hooks;
LOCK_ELUNA LOCK_ELUNA
#define START_HOOK(EVENT) \ #define START_HOOK(EVENT) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EventKey<TicketEvents>(EVENT);\ auto key = EventKey<TicketEvents>(EVENT);\
if (!TicketEventBindings->HasBindingsFor(key))\ if (!TicketEventBindings->HasBindingsFor(key))\

View File

@@ -13,7 +13,7 @@
using namespace Hooks; using namespace Hooks;
#define START_HOOK(EVENT) \ #define START_HOOK(EVENT) \
if (!IsEnabled())\ if (!ElunaConfig::GetInstance().IsElunaEnabled())\
return;\ return;\
auto key = EventKey<VehicleEvents>(EVENT);\ auto key = EventKey<VehicleEvents>(EVENT);\
if (!VehicleEventBindings->HasBindingsFor(key))\ if (!VehicleEventBindings->HasBindingsFor(key))\