From cccf0623ee42107f6e9de54c9ffcf1ba12a7d259 Mon Sep 17 00:00:00 2001 From: Kargatum Date: Fri, 22 Oct 2021 22:39:09 +0700 Subject: [PATCH] fix(Config): replace deprecated functions for AzerothCore (#7) --- GlobalMethods.h | 2 ++ LuaEngine.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/GlobalMethods.h b/GlobalMethods.h index ab61591..043494a 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -65,6 +65,8 @@ namespace LuaGlobalFunctions { #ifdef MANGOS Eluna::Push(L, realmID); +#elif defined(AZEROTHCORE) + Eluna::Push(L, sConfigMgr->GetOption("RealmID", 1)); #else Eluna::Push(L, sConfigMgr->GetIntDefault("RealmID", 1)); #endif diff --git a/LuaEngine.cpp b/LuaEngine.cpp index 2a6c165..efe278a 100644 --- a/LuaEngine.cpp +++ b/LuaEngine.cpp @@ -107,7 +107,12 @@ void Eluna::LoadScriptPaths() lua_scripts.clear(); lua_extensions.clear(); +#if defined(AZEROTHCORE) + lua_folderpath = eConfigMgr->GetOption("Eluna.ScriptPath", "lua_scripts"); +#else lua_folderpath = eConfigMgr->GetStringDefault("Eluna.ScriptPath", "lua_scripts"); +#endif + #ifndef ELUNA_WINDOWS if (lua_folderpath[0] == '~') if (const char* home = getenv("HOME")) @@ -215,7 +220,12 @@ void Eluna::CloseLua() void Eluna::OpenLua() { +#if defined(AZEROTHCORE) + enabled = eConfigMgr->GetOption("Eluna.Enabled", true); +#else enabled = eConfigMgr->GetBoolDefault("Eluna.Enabled", true); +#endif + if (!IsEnabled()) { ELUNA_LOG_INFO("[Eluna]: Eluna is disabled in config"); @@ -583,7 +593,12 @@ bool Eluna::ExecuteCall(int params, int res) ASSERT(false); // stack probably corrupt } +#if defined(AZEROTHCORE) + bool usetrace = eConfigMgr->GetOption("Eluna.TraceBack", false); +#else bool usetrace = eConfigMgr->GetBoolDefault("Eluna.TraceBack", false); +#endif + if (usetrace) { lua_pushcfunction(L, &StackTrace);