里,因为打算把这部分写到模块的配置文件里,目前没有弄.
-```
-###################################################################################################
-# ELUNA SETTINGS
-#
-# Eluna.Enabled
-# Description: Enable or disable Eluna LuaEngine
-# Default: true - (enabled)
-# false - (disabled)
-#
-# Eluna.TraceBack
-# Description: Sets whether to use debug.traceback function on a lua error or not.
-# Notice that you can redefine the function.
-# Default: false - (use default error output)
-# true - (use debug.traceback function)
-#
-# Eluna.ScriptPath
-# Description: Sets the location of the script folder to load scripts from
-# The path can be relative or absolute.
-# Default: "lua_scripts"
-#
-
-Eluna.Enabled = true
-Eluna.TraceBack = false
-Eluna.ScriptPath = "lua_scripts"
-```
-4.据说最近的eluna可以去掉单线程限制,目前我还没去掉,如果需要去掉的话
-src\server\game\Maps\MapManager.cpp
-```
-#ifdef ELUNA
- if (num_threads > 1)
- {
- // Force 1 thread for Eluna as lua is single threaded. By default thread count is 1
- // This should allow us not to use mutex locks
- ELUNA_LOG_ERROR("MAP:Map update threads set to %i, when Eluna only allows 1, changing to 1", num_threads);
- num_threads = 1;
- }
-#endif
-```
-把这段去掉
-
-
+azerothcore:
+https://github.com/AyaseCore/azerothcore-wotlk/tree/ElunaAzerothWotlk
+eluna:
+https://github.com/AyaseCore/Eluna/tree/ElunaAzerothWotlk
+azerothcore-module:
+https://github.com/AyaseCore/mod-LuaEngine
From 20c29ebb856bf06b0fc82051f1a08739f54a6d5b Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Sun, 29 Apr 2018 01:58:16 +0000
Subject: [PATCH 006/112] Update README.md
---
README.md | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/README.md b/README.md
index 542943b..2b685b7 100644
--- a/README.md
+++ b/README.md
@@ -7,8 +7,17 @@ OnConfigLoad(bool reload) => OnConfigLoad(bool reload, bool isBefore)
```
azerothcore:
+
https://github.com/AyaseCore/azerothcore-wotlk/tree/ElunaAzerothWotlk
+
+
eluna:
+
https://github.com/AyaseCore/Eluna/tree/ElunaAzerothWotlk
+
+
azerothcore-module:
+
https://github.com/AyaseCore/mod-LuaEngine
+
+
From 4162b3448e8740988968d16ec3ae44e7e42724ba Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Sun, 29 Apr 2018 21:52:59 +0800
Subject: [PATCH 007/112] Set theme jekyll-theme-slate
---
_config.yml | 1 +
1 file changed, 1 insertion(+)
create mode 100644 _config.yml
diff --git a/_config.yml b/_config.yml
new file mode 100644
index 0000000..c741881
--- /dev/null
+++ b/_config.yml
@@ -0,0 +1 @@
+theme: jekyll-theme-slate
\ No newline at end of file
From b74ad92c55e65a418e7e4d662852c0f326eb8f10 Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Wed, 2 May 2018 01:59:44 +0000
Subject: [PATCH 008/112] Update README.md
---
README.md | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 2b685b7..d24d0e3 100644
--- a/README.md
+++ b/README.md
@@ -6,18 +6,26 @@ Eluna API changes:(更改了一个eluna的api)
OnConfigLoad(bool reload) => OnConfigLoad(bool reload, bool isBefore)
```
-azerothcore:
+-------
+
+1. Merge my acore's ElunaAzerothwotlk branch.
https://github.com/AyaseCore/azerothcore-wotlk/tree/ElunaAzerothWotlk
-eluna:
-
-https://github.com/AyaseCore/Eluna/tree/ElunaAzerothWotlk
-
-
-azerothcore-module:
+2.Pull my lua module. Put it in the modules folder of acore.
https://github.com/AyaseCore/mod-LuaEngine
+3.Open folders:Modules /mod-LuaEngine/LuaEngine.
+
+
+4.Pull the ElunaAzerothwotlk branch of my eluna.
+
+https://github.com/AyaseCore/Eluna/tree/ElunaAzerothWotlk
+
+
+5.And then recompile.
+
+
From 0591565106777945c053cc9704cd24cc9934ebd0 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Fri, 4 May 2018 21:46:17 +0800
Subject: [PATCH 009/112] fix(test) #1 Ubuntu - Cant Link Library after Compile
---
CMakeLists.txt | 5 ++++-
LuaEngine | 2 +-
cmake/after_gs_install.cmake | 21 +++++++++++++++++++++
cmake/before_gs_install.cmake | 16 ++++++++++++++++
4 files changed, 42 insertions(+), 2 deletions(-)
create mode 100644 cmake/after_gs_install.cmake
create mode 100644 cmake/before_gs_install.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 04f922d..c3c0329 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,9 +1,12 @@
if( ELUNA )
CU_SET_PATH("CMAKE_MOD_ELUNA_ENGINE_DIR" "${CMAKE_CURRENT_LIST_DIR}")
add_subdirectory(lualib)
- add_subdirectory(LuaEngine)
+ #add_subdirectory(LuaEngine)
+ CU_ADD_HOOK(BEFORE_GAME_LIBRARY "${CMAKE_CURRENT_LIST_DIR}/cmake/before_gs_install.cmake")
+ CU_ADD_HOOK(AFTER_GAME_LIBRARY "${CMAKE_CURRENT_LIST_DIR}/cmake/after_gs_install.cmake")
CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_CURRENT_LIST_DIR}/cmake/after_ws_install.cmake")
+
install(FILES "${CMAKE_MOD_ELUNA_ENGINE_DIR}/conf/mod_LuaEngine.conf.dist" DESTINATION ${CONF_DIR})
endif()
diff --git a/LuaEngine b/LuaEngine
index 629e503..909e514 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 629e50357f7faa85173ae1181b4e81e4f1518e73
+Subproject commit 909e51499870287c3a9bf22a4b8e379aa9ea2594
diff --git a/cmake/after_gs_install.cmake b/cmake/after_gs_install.cmake
new file mode 100644
index 0000000..d7e00af
--- /dev/null
+++ b/cmake/after_gs_install.cmake
@@ -0,0 +1,21 @@
+
+add_dependencies(game lualib)
+target_link_libraries(game lualib)
+
+if( WIN32 )
+ if ( MSVC )
+ add_custom_command(TARGET game
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/lua_scripts/extensions/"
+ COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/lua_scripts/extensions/"
+ )
+ elseif ( MINGW )
+ add_custom_command(TARGET game
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/lua_scripts/extensions/"
+ COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/lua_scripts/extensions/"
+ )
+ endif()
+endif()
+
+install(DIRECTORY extensions DESTINATION "${BIN_DIR}/lua_scripts/")
diff --git a/cmake/before_gs_install.cmake b/cmake/before_gs_install.cmake
new file mode 100644
index 0000000..d893169
--- /dev/null
+++ b/cmake/before_gs_install.cmake
@@ -0,0 +1,16 @@
+file(GLOB_RECURSE method_headers ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/*Methods.h)
+file(GLOB_RECURSE sources_ElunaFile_CPP ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/*.cpp )
+file(GLOB_RECURSE sources_ElunaFile_H ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/*.h)
+
+set(game_STAT_SRCS
+ ${game_STAT_SRCS}
+ ${sources_ElunaFile_H}
+ ${sources_ElunaFile_CPP}
+)
+
+source_group("LuaEngine\\Methods" FILES ${method_headers})
+
+source_group("LuaEngine\\Header Files" FILES ${sources_ElunaFile_H})
+
+source_group("LuaEngine\\Source Files" FILES ${sources_ElunaFile_CPP})
+
From 10df006b11a72bf40bc7149b1a3ad89c60f3fdf6 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Fri, 4 May 2018 23:37:56 +0800
Subject: [PATCH 010/112] some change
---
cmake/after_gs_install.cmake | 7 +++++++
cmake/after_ws_install.cmake | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/cmake/after_gs_install.cmake b/cmake/after_gs_install.cmake
index d7e00af..a3ce693 100644
--- a/cmake/after_gs_install.cmake
+++ b/cmake/after_gs_install.cmake
@@ -1,4 +1,11 @@
+include_directories(
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
+)
+
+
add_dependencies(game lualib)
target_link_libraries(game lualib)
diff --git a/cmake/after_ws_install.cmake b/cmake/after_ws_install.cmake
index 06387bd..91bbc6f 100644
--- a/cmake/after_ws_install.cmake
+++ b/cmake/after_ws_install.cmake
@@ -1,3 +1,10 @@
+
+include_directories(
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
+)
+
if( WIN32 )
if ( MSVC )
add_custom_command(TARGET worldserver
From d514a2032953c060440b6ee4415f867774917653 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Sun, 6 May 2018 18:24:43 +0800
Subject: [PATCH 011/112] modify the directory compatible Linux.
---
cmake/after_gs_install.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/after_gs_install.cmake b/cmake/after_gs_install.cmake
index a3ce693..7254cb2 100644
--- a/cmake/after_gs_install.cmake
+++ b/cmake/after_gs_install.cmake
@@ -25,4 +25,4 @@ if( WIN32 )
endif()
endif()
-install(DIRECTORY extensions DESTINATION "${BIN_DIR}/lua_scripts/")
+install(DIRECTORY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" DESTINATION "${CMAKE_INSTALL_PREFIX}/bin/lua_scripts/")
From 35b154c93bc65b3fab7defc7b3cea1c93f5b0622 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Sun, 6 May 2018 19:54:14 +0800
Subject: [PATCH 012/112] cmake change
---
CMakeLists.txt | 2 +-
cmake/before_script_install.cmake | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
create mode 100644 cmake/before_script_install.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c3c0329..673fa30 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,10 @@
if( ELUNA )
CU_SET_PATH("CMAKE_MOD_ELUNA_ENGINE_DIR" "${CMAKE_CURRENT_LIST_DIR}")
add_subdirectory(lualib)
- #add_subdirectory(LuaEngine)
CU_ADD_HOOK(BEFORE_GAME_LIBRARY "${CMAKE_CURRENT_LIST_DIR}/cmake/before_gs_install.cmake")
CU_ADD_HOOK(AFTER_GAME_LIBRARY "${CMAKE_CURRENT_LIST_DIR}/cmake/after_gs_install.cmake")
+ CU_ADD_HOOK(BEFORE_SCRIPTS_LIBRARY "${CMAKE_CURRENT_LIST_DIR}/cmake/before_script_install.cmake")
CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_CURRENT_LIST_DIR}/cmake/after_ws_install.cmake")
install(FILES "${CMAKE_MOD_ELUNA_ENGINE_DIR}/conf/mod_LuaEngine.conf.dist" DESTINATION ${CONF_DIR})
diff --git a/cmake/before_script_install.cmake b/cmake/before_script_install.cmake
new file mode 100644
index 0000000..cce9e1d
--- /dev/null
+++ b/cmake/before_script_install.cmake
@@ -0,0 +1,5 @@
+include_directories(
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
+)
\ No newline at end of file
From 629cf03312d0901c09289c6f76f4db1c521e5bf4 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Mon, 7 May 2018 23:17:51 +0800
Subject: [PATCH 013/112] submodule update
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 909e514..7d71daa 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 909e51499870287c3a9bf22a4b8e379aa9ea2594
+Subproject commit 7d71daa8f78df69c2219379bd419b50e0dcbb37d
From 077d949206e7cb191cddb070fe54a2315ff5be7a Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Tue, 15 May 2018 23:11:32 +0800
Subject: [PATCH 014/112] Modify the eluna module installation method.
---
CMakeLists.txt | 14 +++-----------
cmake/after_load_conf.cmake | 9 +++++++++
2 files changed, 12 insertions(+), 11 deletions(-)
create mode 100644 cmake/after_load_conf.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 673fa30..1acb733 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,14 +1,6 @@
-if( ELUNA )
- CU_SET_PATH("CMAKE_MOD_ELUNA_ENGINE_DIR" "${CMAKE_CURRENT_LIST_DIR}")
- add_subdirectory(lualib)
-
- CU_ADD_HOOK(BEFORE_GAME_LIBRARY "${CMAKE_CURRENT_LIST_DIR}/cmake/before_gs_install.cmake")
- CU_ADD_HOOK(AFTER_GAME_LIBRARY "${CMAKE_CURRENT_LIST_DIR}/cmake/after_gs_install.cmake")
- CU_ADD_HOOK(BEFORE_SCRIPTS_LIBRARY "${CMAKE_CURRENT_LIST_DIR}/cmake/before_script_install.cmake")
- CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_CURRENT_LIST_DIR}/cmake/after_ws_install.cmake")
-
- install(FILES "${CMAKE_MOD_ELUNA_ENGINE_DIR}/conf/mod_LuaEngine.conf.dist" DESTINATION ${CONF_DIR})
-endif()
+CU_SET_PATH("CMAKE_MOD_ELUNA_ENGINE_DIR" "${CMAKE_CURRENT_LIST_DIR}")
+CU_ADD_HOOK(AFTER_LOAD_CONF "${CMAKE_CURRENT_LIST_DIR}/cmake/after_load_conf.cmake")
+
diff --git a/cmake/after_load_conf.cmake b/cmake/after_load_conf.cmake
new file mode 100644
index 0000000..c7fcfba
--- /dev/null
+++ b/cmake/after_load_conf.cmake
@@ -0,0 +1,9 @@
+add_subdirectory(${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib)
+add_definitions(-DELUNA)
+CU_ADD_HOOK(BEFORE_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/before_gs_install.cmake")
+CU_ADD_HOOK(AFTER_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_gs_install.cmake")
+CU_ADD_HOOK(BEFORE_SCRIPTS_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/before_script_install.cmake")
+CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_ws_install.cmake")
+
+message("[Eluna Module] LuaEngine is enable!")
+
From 6ed6370d097b41e73906d258e440b4eb0d0fe671 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Tue, 15 May 2018 23:45:30 +0800
Subject: [PATCH 015/112] add some define in the cmake.
---
cmake/after_load_conf.cmake | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cmake/after_load_conf.cmake b/cmake/after_load_conf.cmake
index c7fcfba..2e682cb 100644
--- a/cmake/after_load_conf.cmake
+++ b/cmake/after_load_conf.cmake
@@ -1,9 +1,11 @@
add_subdirectory(${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib)
add_definitions(-DELUNA)
+add_definitions(-DAZEROTHCORE)
+add_definitions(-DWOTLK)
CU_ADD_HOOK(BEFORE_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/before_gs_install.cmake")
CU_ADD_HOOK(AFTER_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_gs_install.cmake")
CU_ADD_HOOK(BEFORE_SCRIPTS_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/before_script_install.cmake")
CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_ws_install.cmake")
-message("[Eluna Module] LuaEngine is enable!")
+message("** [Eluna Module] LuaEngine is enable!")
From 25e0e5405b52b931f3e5100dc57f80ef15d180bd Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Wed, 16 May 2018 20:01:43 +0800
Subject: [PATCH 016/112] update lua version:5.2.3 to 5.2.4
---
lualib/ldblib.c | 12 +++++++++++-
lualib/ldebug.c | 21 +++++++++++++++++++--
lualib/lgc.c | 4 ++--
lualib/llex.c | 4 ++--
lualib/lobject.h | 6 +++---
lualib/lopcodes.h | 4 ++--
lualib/ltablib.c | 10 ++++++----
lualib/lua.h | 8 ++++----
lualib/luaconf.h | 6 +++---
9 files changed, 52 insertions(+), 23 deletions(-)
diff --git a/lualib/ldblib.c b/lualib/ldblib.c
index 84fe3c7..bd8df9d 100644
--- a/lualib/ldblib.c
+++ b/lualib/ldblib.c
@@ -1,5 +1,5 @@
/*
-** $Id: ldblib.c,v 1.132.1.1 2013/04/12 18:48:47 roberto Exp $
+** $Id: ldblib.c,v 1.132.1.2 2015/02/19 17:16:55 roberto Exp $
** Interface from Lua to its debug API
** See Copyright Notice in lua.h
*/
@@ -21,6 +21,11 @@
#define HOOKKEY "_HKEY"
+static void checkstack (lua_State *L, lua_State *L1, int n) {
+ if (L != L1 && !lua_checkstack(L1, n))
+ luaL_error(L, "stack overflow");
+}
+
static int db_getregistry (lua_State *L) {
lua_pushvalue(L, LUA_REGISTRYINDEX);
@@ -114,6 +119,7 @@ static int db_getinfo (lua_State *L) {
int arg;
lua_State *L1 = getthread(L, &arg);
const char *options = luaL_optstring(L, arg+2, "flnStu");
+ checkstack(L, L1, 3);
if (lua_isnumber(L, arg+1)) {
if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) {
lua_pushnil(L); /* level out of range */
@@ -173,6 +179,7 @@ static int db_getlocal (lua_State *L) {
else { /* stack-level argument */
if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */
return luaL_argerror(L, arg+1, "level out of range");
+ checkstack(L, L1, 1);
name = lua_getlocal(L1, &ar, nvar);
if (name) {
lua_xmove(L1, L, 1); /* push local value */
@@ -196,6 +203,7 @@ static int db_setlocal (lua_State *L) {
return luaL_argerror(L, arg+1, "level out of range");
luaL_checkany(L, arg+3);
lua_settop(L, arg+3);
+ checkstack(L, L1, 1);
lua_xmove(L, L1, 1);
lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2)));
return 1;
@@ -313,6 +321,7 @@ static int db_sethook (lua_State *L) {
lua_pushvalue(L, -1);
lua_setmetatable(L, -2); /* setmetatable(hooktable) = hooktable */
}
+ checkstack(L, L1, 1);
lua_pushthread(L1); lua_xmove(L1, L, 1);
lua_pushvalue(L, arg+1);
lua_rawset(L, -3); /* set new hook */
@@ -331,6 +340,7 @@ static int db_gethook (lua_State *L) {
lua_pushliteral(L, "external hook");
else {
gethooktable(L);
+ checkstack(L, L1, 1);
lua_pushthread(L1); lua_xmove(L1, L, 1);
lua_rawget(L, -2); /* get hook */
lua_remove(L, -2); /* remove hook table */
diff --git a/lualib/ldebug.c b/lualib/ldebug.c
index 20d663e..9611846 100644
--- a/lualib/ldebug.c
+++ b/lualib/ldebug.c
@@ -1,5 +1,5 @@
/*
-** $Id: ldebug.c,v 2.90.1.3 2013/05/16 16:04:15 roberto Exp $
+** $Id: ldebug.c,v 2.90.1.4 2015/02/19 17:05:13 roberto Exp $
** Debug Interface
** See Copyright Notice in lua.h
*/
@@ -47,6 +47,16 @@ static int currentline (CallInfo *ci) {
}
+static void swapextra (lua_State *L) {
+ if (L->status == LUA_YIELD) {
+ CallInfo *ci = L->ci; /* get function that yielded */
+ StkId temp = ci->func; /* exchange its 'func' and 'extra' values */
+ ci->func = restorestack(L, ci->extra);
+ ci->extra = savestack(L, temp);
+ }
+}
+
+
/*
** this function can be called asynchronous (e.g. during a signal)
*/
@@ -144,6 +154,7 @@ static const char *findlocal (lua_State *L, CallInfo *ci, int n,
LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
const char *name;
lua_lock(L);
+ swapextra(L);
if (ar == NULL) { /* information about non-active function? */
if (!isLfunction(L->top - 1)) /* not a Lua function? */
name = NULL;
@@ -158,6 +169,7 @@ LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
api_incr_top(L);
}
}
+ swapextra(L);
lua_unlock(L);
return name;
}
@@ -165,11 +177,14 @@ LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
StkId pos = 0; /* to avoid warnings */
- const char *name = findlocal(L, ar->i_ci, n, &pos);
+ const char *name;
lua_lock(L);
+ swapextra(L);
+ name = findlocal(L, ar->i_ci, n, &pos);
if (name)
setobjs2s(L, pos, L->top - 1);
L->top--; /* pop value */
+ swapextra(L);
lua_unlock(L);
return name;
}
@@ -269,6 +284,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
CallInfo *ci;
StkId func;
lua_lock(L);
+ swapextra(L);
if (*what == '>') {
ci = NULL;
func = L->top - 1;
@@ -287,6 +303,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
setobjs2s(L, L->top, func);
api_incr_top(L);
}
+ swapextra(L);
if (strchr(what, 'L'))
collectvalidlines(L, cl);
lua_unlock(L);
diff --git a/lualib/lgc.c b/lualib/lgc.c
index 52460dc..553fd17 100644
--- a/lualib/lgc.c
+++ b/lualib/lgc.c
@@ -1,5 +1,5 @@
/*
-** $Id: lgc.c,v 2.140.1.2 2013/04/26 18:22:05 roberto Exp $
+** $Id: lgc.c,v 2.140.1.3 2014/09/01 16:55:08 roberto Exp $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@@ -403,7 +403,7 @@ static int traverseephemeron (global_State *g, Table *h) {
reallymarkobject(g, gcvalue(gval(n))); /* mark it now */
}
}
- if (prop)
+ if (g->gcstate != GCSatomic || prop)
linktable(h, &g->ephemeron); /* have to propagate again */
else if (hasclears) /* does table have white keys? */
linktable(h, &g->allweak); /* may have to clean white keys */
diff --git a/lualib/llex.c b/lualib/llex.c
index c4b820e..32cdcf1 100644
--- a/lualib/llex.c
+++ b/lualib/llex.c
@@ -1,5 +1,5 @@
/*
-** $Id: llex.c,v 2.63.1.2 2013/08/30 15:49:41 roberto Exp $
+** $Id: llex.c,v 2.63.1.3 2015/02/09 17:56:34 roberto Exp $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
@@ -152,7 +152,7 @@ static void inclinenumber (LexState *ls) {
if (currIsNewline(ls) && ls->current != old)
next(ls); /* skip `\n\r' or `\r\n' */
if (++ls->linenumber >= MAX_INT)
- luaX_syntaxerror(ls, "chunk has too many lines");
+ lexerror(ls, "chunk has too many lines", 0);
}
diff --git a/lualib/lobject.h b/lualib/lobject.h
index 3a630b9..bc0bb69 100644
--- a/lualib/lobject.h
+++ b/lualib/lobject.h
@@ -1,5 +1,5 @@
/*
-** $Id: lobject.h,v 2.71.1.1 2013/04/12 18:48:47 roberto Exp $
+** $Id: lobject.h,v 2.71.1.2 2014/05/07 14:14:58 roberto Exp $
** Type definitions for Lua objects
** See Copyright Notice in lua.h
*/
@@ -561,12 +561,12 @@ typedef struct Table {
CommonHeader;
lu_byte flags; /* 1<= R(A) + 1 */
+OP_JMP,/* A sBx pc+=sBx; if (A) close all upvalues >= R(A - 1) */
OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */
OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */
OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */
diff --git a/lualib/ltablib.c b/lualib/ltablib.c
index 6001224..99764d2 100644
--- a/lualib/ltablib.c
+++ b/lualib/ltablib.c
@@ -1,10 +1,11 @@
/*
-** $Id: ltablib.c,v 1.65.1.1 2013/04/12 18:48:47 roberto Exp $
+** $Id: ltablib.c,v 1.65.1.2 2014/05/07 16:32:55 roberto Exp $
** Library for Table Manipulation
** See Copyright Notice in lua.h
*/
+#include
#include
#define ltablib_c
@@ -134,13 +135,14 @@ static int pack (lua_State *L) {
static int unpack (lua_State *L) {
- int i, e, n;
+ int i, e;
+ unsigned int n;
luaL_checktype(L, 1, LUA_TTABLE);
i = luaL_optint(L, 2, 1);
e = luaL_opt(L, luaL_checkint, 3, luaL_len(L, 1));
if (i > e) return 0; /* empty range */
- n = e - i + 1; /* number of elements */
- if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */
+ n = (unsigned int)e - (unsigned int)i; /* number of elements minus 1 */
+ if (n > (INT_MAX - 10) || !lua_checkstack(L, ++n))
return luaL_error(L, "too many results to unpack");
lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */
while (i++ < e) /* push arg[i + 1...e] */
diff --git a/lualib/lua.h b/lualib/lua.h
index 149a2c3..ff4a108 100644
--- a/lualib/lua.h
+++ b/lualib/lua.h
@@ -1,5 +1,5 @@
/*
-** $Id: lua.h,v 1.285.1.2 2013/11/11 12:09:16 roberto Exp $
+** $Id: lua.h,v 1.285.1.4 2015/02/21 14:04:50 roberto Exp $
** Lua - A Scripting Language
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
** See Copyright Notice at the end of this file
@@ -19,11 +19,11 @@
#define LUA_VERSION_MAJOR "5"
#define LUA_VERSION_MINOR "2"
#define LUA_VERSION_NUM 502
-#define LUA_VERSION_RELEASE "3"
+#define LUA_VERSION_RELEASE "4"
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
-#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2013 Lua.org, PUC-Rio"
+#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2015 Lua.org, PUC-Rio"
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
@@ -418,7 +418,7 @@ struct lua_Debug {
/******************************************************************************
-* Copyright (C) 1994-2013 Lua.org, PUC-Rio.
+* Copyright (C) 1994-2015 Lua.org, PUC-Rio.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
diff --git a/lualib/luaconf.h b/lualib/luaconf.h
index 18be9a9..1b0ff59 100644
--- a/lualib/luaconf.h
+++ b/lualib/luaconf.h
@@ -1,5 +1,5 @@
/*
-** $Id: luaconf.h,v 1.176.1.1 2013/04/12 18:48:47 roberto Exp $
+** $Id: luaconf.h,v 1.176.1.2 2013/11/21 17:26:16 roberto Exp $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/
@@ -326,7 +326,7 @@
/*
-@@ LUA_INT32 is an signed integer with exactly 32 bits.
+@@ LUA_INT32 is a signed integer with exactly 32 bits.
@@ LUAI_UMEM is an unsigned integer big enough to count the total
@* memory used by Lua.
@@ LUAI_MEM is a signed integer big enough to count the total memory
@@ -350,7 +350,7 @@
/*
@@ LUAI_MAXSTACK limits the size of the Lua stack.
** CHANGE it if you need a different limit. This limit is arbitrary;
-** its only purpose is to stop Lua to consume unlimited stack
+** its only purpose is to stop Lua from consuming unlimited stack
** space (and to reserve some numbers for pseudo-indices).
*/
#if LUAI_BITSINT >= 32
From 632054a0bdf516da7b3ba511c3d93ec360fea657 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Thu, 17 May 2018 22:25:09 +0800
Subject: [PATCH 017/112] redo LuaEngine file.
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 7d71daa..6f06eca 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 7d71daa8f78df69c2219379bd419b50e0dcbb37d
+Subproject commit 6f06ecaba69ba6479e192808636d462b96b58bf1
From 4f4ad232e740221b13c1ccae67539aec3767ca22 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Wed, 23 May 2018 22:38:31 +0800
Subject: [PATCH 018/112] merge "skeleton-module"
---
.editorconfig | 8 ++++++
.gitattributes | 62 +++++++++++++++++++++++++++++++++++++++++
.gitignore | 48 +++++++++++++++++++++++++++++++
include.sh | 0
sql/auth/.gitkeep | 0
sql/characters/.gitkeep | 0
sql/world/.gitkeep | 0
7 files changed, 118 insertions(+)
create mode 100644 .editorconfig
create mode 100644 .gitattributes
create mode 100644 .gitignore
create mode 100644 include.sh
create mode 100644 sql/auth/.gitkeep
create mode 100644 sql/characters/.gitkeep
create mode 100644 sql/world/.gitkeep
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..eb64e2f
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,8 @@
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 4
+tab_width = 4
+insert_final_newline = true
+trim_trailing_whitespace = true
+max_line_length = 80
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..823b0b0
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,62 @@
+## AUTO-DETECT
+## Handle line endings automatically for files detected as
+## text and leave all files detected as binary untouched.
+## This will handle all files NOT defined below.
+* text=auto eol=lf
+
+# Text
+*.conf
+*.conf.dist
+*.txt
+*.md
+*.cmake
+
+# Bash
+*.sh text
+
+# Lua if lua module?
+*.lua
+
+# SQL
+*.sql
+
+# C++
+*.c text
+*.cc text
+*.cxx text
+*.cpp text
+*.c++ text
+*.hpp text
+*.h text
+*.h++ text
+*.hh text
+
+
+## For documentation
+
+# Documents
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
+
+
+# Graphics
+*.png binary
+*.jpg binary
+*.jpeg binary
+*.gif binary
+*.tif binary
+*.tiff binary
+*.ico binary
+# SVG treated as an asset (binary) by default. If you want to treat it as text,
+# comment-out the following line and uncomment the line after.
+*.svg binary
+#*.svg text
+*.eps binary
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d011fdd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,48 @@
+!.gitignore
+
+#
+#Generic
+#
+
+.directory
+.mailmap
+*.orig
+*.rej
+*~
+.hg/
+*.kdev*
+.DS_Store
+CMakeLists.txt.user
+*.bak
+*.patch
+*.diff
+*.REMOTE.*
+*.BACKUP.*
+*.BASE.*
+*.LOCAL.*
+
+#
+# IDE & other softwares
+#
+/.settings/
+/.externalToolBuilders/*
+# exclude in all levels
+nbproject/
+.sync.ffs_db
+*.kate-swp
+
+#
+# Eclipse
+#
+*.pydevproject
+.metadata
+.gradle
+tmp/
+*.tmp
+*.swp
+*~.nib
+local.properties
+.settings/
+.loadpath
+.project
+.cproject
diff --git a/include.sh b/include.sh
new file mode 100644
index 0000000..e69de29
diff --git a/sql/auth/.gitkeep b/sql/auth/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/sql/characters/.gitkeep b/sql/characters/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/sql/world/.gitkeep b/sql/world/.gitkeep
new file mode 100644
index 0000000..e69de29
From f9570085f4750235101b0dda9f55da45c8a249ca Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Wed, 23 May 2018 23:11:39 +0800
Subject: [PATCH 019/112] update readme.md
---
README.md | 36 +++++++++++-------------------------
README_EN.md | 17 +++++++++++++++++
2 files changed, 28 insertions(+), 25 deletions(-)
create mode 100644 README_EN.md
diff --git a/README.md b/README.md
index d24d0e3..8164476 100644
--- a/README.md
+++ b/README.md
@@ -1,31 +1,17 @@
# mod-LuaEngine
-azerothcore 的 eluna 模块
+中文|[english](README_EN.md)
-Eluna API changes:(更改了一个eluna的api)
+一个用于AzerothCore的ELUNA模块.
+
+为了兼容AzerothCore.更改了一个eluna的api
```
OnConfigLoad(bool reload) => OnConfigLoad(bool reload, bool isBefore)
```
--------
-
-1. Merge my acore's ElunaAzerothwotlk branch.
-
-https://github.com/AyaseCore/azerothcore-wotlk/tree/ElunaAzerothWotlk
-
-
-2.Pull my lua module. Put it in the modules folder of acore.
-
-https://github.com/AyaseCore/mod-LuaEngine
-
-
-3.Open folders:Modules /mod-LuaEngine/LuaEngine.
-
-
-4.Pull the ElunaAzerothwotlk branch of my eluna.
-
-https://github.com/AyaseCore/Eluna/tree/ElunaAzerothWotlk
-
-
-5.And then recompile.
-
-
+如何安装:
+* 下载这个模块:[download](https://github.com/AyaseCore/mod-LuaEngine/archive/master.zip)
+* 解压并放到Azerothcore源码的modules文件夹中.
+* 下载ELUNA的核心文件:[download](https://github.com/AyaseCore/Eluna/archive/ElunaAzerothWotlk.zip)
+* 解压并放置到模块的LuaEngine文件夹中:mod-LuaEngine/LuaEngine
+* 重新cmake.
+* 重新生成.
diff --git a/README_EN.md b/README_EN.md
new file mode 100644
index 0000000..d2115fd
--- /dev/null
+++ b/README_EN.md
@@ -0,0 +1,17 @@
+# mod-LuaEngine
+[chinese](README.md) | english
+
+a Eluna module for AzerothCore
+
+To make Eluna compatible with Azerothcore.one lua Api has been changed.
+```
+OnConfigLoad(bool reload) => OnConfigLoad(bool reload, bool isBefore)
+```
+
+How to install:
+* download this module:[download](https://github.com/AyaseCore/mod-LuaEngine/archive/master.zip)
+* unzip this module.Put it in the modules folder of the Azerothcore.
+* download ELUNA core file:[download](https://github.com/AyaseCore/Eluna/archive/ElunaAzerothWotlk.zip)
+* unzip,Put it in the lua module folder:mod-LuaEngine/LuaEngine
+* cmake again
+* rebuild.
From 13e33ecace190d85cf14beb30f73ecb3b4bbf709 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Thu, 31 May 2018 19:24:05 +0800
Subject: [PATCH 020/112] link branch :elunaAzerothwotlk.
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 6f06eca..35295a3 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 6f06ecaba69ba6479e192808636d462b96b58bf1
+Subproject commit 35295a3f9acafce9c22b871463724266205779d8
From 85792eaf6fb22696879aaaedd5913de1a8b91e75 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Thu, 7 Jun 2018 20:51:22 +0800
Subject: [PATCH 021/112] submodule change.
---
.gitmodules | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.gitmodules b/.gitmodules
index 470fc63..daac882 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,4 @@
[submodule "LuaEngine"]
path = LuaEngine
- url = https://github.com/AyaseCore/Eluna.git
- branch = ElunaAzerothWotlk
+ url = https://github.com/ElunaLuaEngine/Eluna.git
+ branch = master
From 6e1c062b5381b08b189a6c7fef96614ea49c72e9 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Thu, 7 Jun 2018 20:52:28 +0800
Subject: [PATCH 022/112] Change the submodule to the official eluna.
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 35295a3..9b5499d 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 35295a3f9acafce9c22b871463724266205779d8
+Subproject commit 9b5499db9cf8ba05893455a276f55cc132e3bf73
From cd53cc25b1d98d397c66bb219480220c58d4da60 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Fri, 8 Jun 2018 22:41:25 +0800
Subject: [PATCH 023/112] update readme.md
---
README.md | 24 ++++++++++++++----------
README_CN.md | 21 +++++++++++++++++++++
README_EN.md | 17 -----------------
3 files changed, 35 insertions(+), 27 deletions(-)
create mode 100644 README_CN.md
delete mode 100644 README_EN.md
diff --git a/README.md b/README.md
index 8164476..a13ec10 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,21 @@
# mod-LuaEngine
-中文|[english](README_EN.md)
+ english | [chinese](README_CN.md)
-一个用于AzerothCore的ELUNA模块.
+a Eluna module for AzerothCore
-为了兼容AzerothCore.更改了一个eluna的api
+To make Eluna compatible with Azerothcore.one lua Api has been changed.
```
OnConfigLoad(bool reload) => OnConfigLoad(bool reload, bool isBefore)
```
-如何安装:
-* 下载这个模块:[download](https://github.com/AyaseCore/mod-LuaEngine/archive/master.zip)
-* 解压并放到Azerothcore源码的modules文件夹中.
-* 下载ELUNA的核心文件:[download](https://github.com/AyaseCore/Eluna/archive/ElunaAzerothWotlk.zip)
-* 解压并放置到模块的LuaEngine文件夹中:mod-LuaEngine/LuaEngine
-* 重新cmake.
-* 重新生成.
+How to install:
+* download or clone this module:
+> [download zip file.](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
+> clone `git clone https://github.com/azerothcore/mod-eluna-lua-engine.git`
+* Put it in the modules folder of the Azerothcore.
+* download or clone the ELUNA core file:
+> [download zip file.](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
+> clone `git clone https://github.com/ElunaLuaEngine/Eluna.git`
+* Put it in the lua module folder:mod-LuaEngine/LuaEngine
+* cmake again
+* rebuild.
\ No newline at end of file
diff --git a/README_CN.md b/README_CN.md
new file mode 100644
index 0000000..7093e8f
--- /dev/null
+++ b/README_CN.md
@@ -0,0 +1,21 @@
+# mod-LuaEngine
+[english](README.md) | 中文
+
+一个用于AzerothCore的ELUNA模块.
+
+为了兼容AzerothCore.更改了一个eluna的api
+```
+OnConfigLoad(bool reload) => OnConfigLoad(bool reload, bool isBefore)
+```
+
+如何安装:
+* 下载或者克隆这个模块:
+> [下载zip压缩包](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
+> 或者克隆 `git clone https://github.com/azerothcore/mod-eluna-lua-engine.git`
+* 解压并放到Azerothcore源码的modules文件夹中.
+* 下载或者克隆ELUNA的核心文件:
+> [download zip file.](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
+> clone `git clone https://github.com/ElunaLuaEngine/Eluna.git`
+* 解压并放置到模块的LuaEngine文件夹中:mod-LuaEngine/LuaEngine
+* 重新cmake.
+* 重新生成.
\ No newline at end of file
diff --git a/README_EN.md b/README_EN.md
deleted file mode 100644
index d2115fd..0000000
--- a/README_EN.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# mod-LuaEngine
-[chinese](README.md) | english
-
-a Eluna module for AzerothCore
-
-To make Eluna compatible with Azerothcore.one lua Api has been changed.
-```
-OnConfigLoad(bool reload) => OnConfigLoad(bool reload, bool isBefore)
-```
-
-How to install:
-* download this module:[download](https://github.com/AyaseCore/mod-LuaEngine/archive/master.zip)
-* unzip this module.Put it in the modules folder of the Azerothcore.
-* download ELUNA core file:[download](https://github.com/AyaseCore/Eluna/archive/ElunaAzerothWotlk.zip)
-* unzip,Put it in the lua module folder:mod-LuaEngine/LuaEngine
-* cmake again
-* rebuild.
From da01904615591f07f028fcb99bd99023c980a0cc Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Fri, 8 Jun 2018 22:59:46 +0800
Subject: [PATCH 024/112] Update README.md
---
README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index a13ec10..b1e3fcc 100644
--- a/README.md
+++ b/README.md
@@ -11,11 +11,11 @@ OnConfigLoad(bool reload) => OnConfigLoad(bool reload, bool isBefore)
How to install:
* download or clone this module:
> [download zip file.](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
-> clone `git clone https://github.com/azerothcore/mod-eluna-lua-engine.git`
+> or clone `git clone https://github.com/azerothcore/mod-eluna-lua-engine.git`
* Put it in the modules folder of the Azerothcore.
* download or clone the ELUNA core file:
> [download zip file.](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
-> clone `git clone https://github.com/ElunaLuaEngine/Eluna.git`
+> or clone `git clone https://github.com/ElunaLuaEngine/Eluna.git`
* Put it in the lua module folder:mod-LuaEngine/LuaEngine
* cmake again
-* rebuild.
\ No newline at end of file
+* rebuild.
From b49fd65a0d4e2f1fa51a8e0c56fe7c2a06f42016 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Mon, 11 Jun 2018 22:39:12 +0800
Subject: [PATCH 025/112] Eluna update version
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 9b5499d..a4ef7ee 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 9b5499db9cf8ba05893455a276f55cc132e3bf73
+Subproject commit a4ef7eeaec044548a39f3e2b9db582cd78e4eb91
From 0b12fbb05328455267137d159165b976afaa7e06 Mon Sep 17 00:00:00 2001
From: MaloW
Date: Mon, 16 Jul 2018 23:52:12 +0200
Subject: [PATCH 026/112] Update README.md
Updated installation guide to avoid an issue where LuaEngine.h would not be included properly in the project.
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index b1e3fcc..05d21ab 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ How to install:
* Put it in the modules folder of the Azerothcore.
* download or clone the ELUNA core file:
> [download zip file.](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
-> or clone `git clone https://github.com/ElunaLuaEngine/Eluna.git`
-* Put it in the lua module folder:mod-LuaEngine/LuaEngine
+> or clone `git clone https://github.com/ElunaLuaEngine/Eluna.git .`
+* Put it in the lua module folder:mod-LuaEngine/LuaEngine. (If you downloaded the zip-file you'll want to move all the files inside the Eluna-master folder into the mod-eluna-lua-engine/LuaEngine folder. LuaEngine.h needs to be directly under mod-eluna-lua-engine/LuaEngine without any extra sub-folders.)
* cmake again
* rebuild.
From fcdee8ab330843396f613db4885ed2bd4a4b1e1c Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Thu, 15 Nov 2018 23:22:17 +0800
Subject: [PATCH 027/112] Set theme jekyll-theme-architect
---
_config.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/_config.yml b/_config.yml
index c741881..3397c9a 100644
--- a/_config.yml
+++ b/_config.yml
@@ -1 +1 @@
-theme: jekyll-theme-slate
\ No newline at end of file
+theme: jekyll-theme-architect
\ No newline at end of file
From 8e08b6a9fc2b1da484bc766de05873d12233fd5e Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Mon, 18 Feb 2019 23:31:48 +0800
Subject: [PATCH 028/112] Eluna update version.
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index a4ef7ee..e1d151b 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit a4ef7eeaec044548a39f3e2b9db582cd78e4eb91
+Subproject commit e1d151b86204e53e04e8ec3d971faf1fa944d3cc
From 12ab5ef9495cd26a301fbca23541c82e041a9466 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Mon, 18 Feb 2019 23:45:56 +0800
Subject: [PATCH 029/112] update readme.md
---
README.md | 23 +++++++++++------------
README_CN.md | 20 +++++++++-----------
2 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/README.md b/README.md
index b1e3fcc..f8e312d 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,20 @@
# mod-LuaEngine
english | [chinese](README_CN.md)
-a Eluna module for AzerothCore
-
-To make Eluna compatible with Azerothcore.one lua Api has been changed.
-```
-OnConfigLoad(bool reload) => OnConfigLoad(bool reload, bool isBefore)
-```
+a Eluna module for AzerothCore.
How to install:
-* download or clone this module:
+
+1. download or clone this module:
> [download zip file.](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
> or clone `git clone https://github.com/azerothcore/mod-eluna-lua-engine.git`
-* Put it in the modules folder of the Azerothcore.
-* download or clone the ELUNA core file:
+2. Put it in the modules folder of the Azerothcore.
+3. download or clone the ELUNA core file:
> [download zip file.](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
> or clone `git clone https://github.com/ElunaLuaEngine/Eluna.git`
-* Put it in the lua module folder:mod-LuaEngine/LuaEngine
-* cmake again
-* rebuild.
+4. Put it in the lua module folder:mod-LuaEngine/LuaEngine
+5. cmake again
+6. rebuild.
+
+Eluna API : [http://www.elunaengine.com/](http://www.elunaengine.com/)
+
diff --git a/README_CN.md b/README_CN.md
index 7093e8f..de371c4 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -3,19 +3,17 @@
一个用于AzerothCore的ELUNA模块.
-为了兼容AzerothCore.更改了一个eluna的api
-```
-OnConfigLoad(bool reload) => OnConfigLoad(bool reload, bool isBefore)
-```
-
如何安装:
-* 下载或者克隆这个模块:
+
+1. 下载或者克隆这个模块:
> [下载zip压缩包](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
> 或者克隆 `git clone https://github.com/azerothcore/mod-eluna-lua-engine.git`
-* 解压并放到Azerothcore源码的modules文件夹中.
-* 下载或者克隆ELUNA的核心文件:
+2. 解压并放到Azerothcore源码的modules文件夹中.
+3. 下载或者克隆ELUNA的核心文件:
> [download zip file.](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
> clone `git clone https://github.com/ElunaLuaEngine/Eluna.git`
-* 解压并放置到模块的LuaEngine文件夹中:mod-LuaEngine/LuaEngine
-* 重新cmake.
-* 重新生成.
\ No newline at end of file
+4. 解压并放置到模块的LuaEngine文件夹中:mod-LuaEngine/LuaEngine
+5. 重新cmake.
+6. 重新生成.
+
+Eluna API : [http://www.elunaengine.com/](http://www.elunaengine.com/)
\ No newline at end of file
From bd28c0a0455118ac98957604a843e157df3b9309 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Wed, 20 Feb 2019 20:12:49 +0800
Subject: [PATCH 030/112] merge 'skeleton-module'
---
.git_commit_template.txt | 49 ++++++++++++++++++++++
.gitattributes | 89 +++++++++++++++++++++++++++++-----------
.gitignore | 2 +-
sql/README.md | 24 +++++++++++
4 files changed, 140 insertions(+), 24 deletions(-)
create mode 100644 .git_commit_template.txt
create mode 100644 sql/README.md
diff --git a/.git_commit_template.txt b/.git_commit_template.txt
new file mode 100644
index 0000000..708b551
--- /dev/null
+++ b/.git_commit_template.txt
@@ -0,0 +1,49 @@
+### TITLE
+## Type(Scope/Subscope): Commit ultra short explanation
+## |---- Write below the examples with a maximum of 50 characters ----|
+## Example 1: fix(DB/SAI): Missing spell to NPC Hogger
+## Example 2: fix(CORE/Raid): Phase 2 of Ragnaros
+## Example 3: feat(CORE/Commands): New GM command to do something
+
+
+### DESCRIPTION
+## Explain why this change is being made, what does it fix etc...
+## |---- Write below the examples with a maximum of 72 characters per lines ----|
+## Example: Hogger (id: 492) was not charging player when being engaged.
+
+
+## Provide links to any issue, commit, pull request or other resource
+## Example 1: Closes issue #23
+## Example 2: Ported from other project's commit (link)
+## Example 3: References taken from wowpedia / wowhead / wowwiki / https://wowgaming.altervista.org/aowow/
+
+
+
+## =======================================================
+## EXTRA INFOS
+## =======================================================
+## "Type" can be:
+## feat (new feature)
+## fix (bug fix)
+## refactor (refactoring production code)
+## style (formatting, missing semi colons, etc; no code change)
+## docs (changes to documentation)
+## test (adding or refactoring tests; no production code change)
+## chore (updating bash scripts, git files etc; no production code change)
+## --------------------
+## Remember to
+## Capitalize the subject line
+## Use the imperative mood in the subject line
+## Do not end the subject line with a period
+## Separate subject from body with a blank line
+## Use the body to explain what and why rather than how
+## Can use multiple lines with "-" for bullet points in body
+## --------------------
+## More info here https://www.conventionalcommits.org/en/v1.0.0-beta.2/
+## =======================================================
+## "Scope" can be:
+## CORE (core related, c++)
+## DB (database related, sql)
+## =======================================================
+## "Subscope" is optional and depends on the nature of the commit.
+## =======================================================
diff --git a/.gitattributes b/.gitattributes
index 823b0b0..7ef9001 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -5,22 +5,19 @@
* text=auto eol=lf
# Text
-*.conf
-*.conf.dist
-*.txt
-*.md
-*.cmake
+*.conf text
+*.conf.dist text
+*.cmake text
-# Bash
+## Scripts
*.sh text
+*.fish text
+*.lua text
-# Lua if lua module?
-*.lua
+## SQL
+*.sql text
-# SQL
-*.sql
-
-# C++
+## C++
*.c text
*.cc text
*.cxx text
@@ -46,17 +43,63 @@
*.rtf diff=astextplain
*.RTF diff=astextplain
+## DOCUMENTATION
+*.markdown text
+*.md text
+*.mdwn text
+*.mdown text
+*.mkd text
+*.mkdn text
+*.mdtxt text
+*.mdtext text
+*.txt text
+AUTHORS text
+CHANGELOG text
+CHANGES text
+CONTRIBUTING text
+COPYING text
+copyright text
+*COPYRIGHT* text
+INSTALL text
+license text
+LICENSE text
+NEWS text
+readme text
+*README* text
+TODO text
-# Graphics
-*.png binary
-*.jpg binary
+## GRAPHICS
+*.ai binary
+*.bmp binary
+*.eps binary
+*.gif binary
+*.ico binary
+*.jng binary
+*.jp2 binary
+*.jpg binary
*.jpeg binary
-*.gif binary
-*.tif binary
+*.jpx binary
+*.jxr binary
+*.pdf binary
+*.png binary
+*.psb binary
+*.psd binary
+*.svg text
+*.svgz binary
+*.tif binary
*.tiff binary
-*.ico binary
-# SVG treated as an asset (binary) by default. If you want to treat it as text,
-# comment-out the following line and uncomment the line after.
-*.svg binary
-#*.svg text
-*.eps binary
+*.wbmp binary
+*.webp binary
+
+
+## ARCHIVES
+*.7z binary
+*.gz binary
+*.jar binary
+*.rar binary
+*.tar binary
+*.zip binary
+
+## EXECUTABLES
+*.exe binary
+*.pyc binary
diff --git a/.gitignore b/.gitignore
index d011fdd..c6e1299 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,7 +8,7 @@
.mailmap
*.orig
*.rej
-*~
+*.*~
.hg/
*.kdev*
.DS_Store
diff --git a/sql/README.md b/sql/README.md
new file mode 100644
index 0000000..3afd348
--- /dev/null
+++ b/sql/README.md
@@ -0,0 +1,24 @@
+# BEST PRACTICES
+
+## Create a new table
+
+**Example:**
+```
+CREATE TABLE IF NOT EXISTS `table`(
+ `id` int(11) unsigned NOT NULL,
+ `active` BOOLEAN DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+```
+
+**Boolean datatype in mysql:**
+Use "TinyInt(1)"" or "Boolean" (this is the same thing)
+
+"bit(1)" can also work, but it may require a syntax like b'(0) and b'(1) when inserting (not sure).
+
+If there are multiple booleans in the same table, bit(1) is better, otherwise it's the same result.
+
+
+## Resources
+
+https://www.w3schools.com/sql/sql_datatypes.asp
From 542c7213c384004d13e65b2777d15da26e9e8606 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Wed, 20 Feb 2019 20:17:44 +0800
Subject: [PATCH 031/112] Use the new CMAKE macro.
---
cmake/after_load_conf.cmake | 2 ++
cmake/after_ws_install.cmake | 16 ----------------
2 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/cmake/after_load_conf.cmake b/cmake/after_load_conf.cmake
index 2e682cb..3ed0075 100644
--- a/cmake/after_load_conf.cmake
+++ b/cmake/after_load_conf.cmake
@@ -7,5 +7,7 @@ CU_ADD_HOOK(AFTER_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_gs_ins
CU_ADD_HOOK(BEFORE_SCRIPTS_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/before_script_install.cmake")
CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_ws_install.cmake")
+AC_ADD_CONFIG_FILE("${CMAKE_CURRENT_LIST_DIR}/conf/mod_LuaEngine.conf.dist")
+
message("** [Eluna Module] LuaEngine is enable!")
diff --git a/cmake/after_ws_install.cmake b/cmake/after_ws_install.cmake
index 91bbc6f..c2912ab 100644
--- a/cmake/after_ws_install.cmake
+++ b/cmake/after_ws_install.cmake
@@ -4,19 +4,3 @@ include_directories(
${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
)
-
-if( WIN32 )
- if ( MSVC )
- add_custom_command(TARGET worldserver
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_MOD_ELUNA_ENGINE_DIR}/conf/mod_LuaEngine.conf.dist" ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/
- )
- elseif ( MINGW )
- add_custom_command(TARGET worldserver
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_MOD_ELUNA_ENGINE_DIR}/conf/mod_LuaEngine.conf.dist" ${CMAKE_BINARY_DIR}/bin/
- )
- endif()
-endif()
-
-install(FILES "${CMAKE_MOD_ELUNA_ENGINE_DIR}/conf/mod_LuaEngine.conf.dist" DESTINATION ${CONF_DIR})
\ No newline at end of file
From e541cb22b218d58a3cbe7c6a2f21893e12365363 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Wed, 20 Feb 2019 20:31:57 +0800
Subject: [PATCH 032/112] Fix config file directory error.
---
cmake/after_load_conf.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/after_load_conf.cmake b/cmake/after_load_conf.cmake
index 3ed0075..2c10f00 100644
--- a/cmake/after_load_conf.cmake
+++ b/cmake/after_load_conf.cmake
@@ -7,7 +7,7 @@ CU_ADD_HOOK(AFTER_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_gs_ins
CU_ADD_HOOK(BEFORE_SCRIPTS_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/before_script_install.cmake")
CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_ws_install.cmake")
-AC_ADD_CONFIG_FILE("${CMAKE_CURRENT_LIST_DIR}/conf/mod_LuaEngine.conf.dist")
+AC_ADD_CONFIG_FILE("${CMAKE_MOD_ELUNA_ENGINE_DIR}/conf/mod_LuaEngine.conf.dist")
message("** [Eluna Module] LuaEngine is enable!")
From 940ed6fa801d6c8991d932d42ad56247ce8ebc19 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Sat, 9 Mar 2019 22:45:01 +0800
Subject: [PATCH 033/112] Move files ObjectGuid.h.
---
cmake/after_gs_install.cmake | 2 +-
cmake/after_ws_install.cmake | 2 +-
cmake/before_script_install.cmake | 2 +-
ObjectGuid.h => src/ObjectGuid.h | 0
4 files changed, 3 insertions(+), 3 deletions(-)
rename ObjectGuid.h => src/ObjectGuid.h (100%)
diff --git a/cmake/after_gs_install.cmake b/cmake/after_gs_install.cmake
index 7254cb2..19722a5 100644
--- a/cmake/after_gs_install.cmake
+++ b/cmake/after_gs_install.cmake
@@ -1,8 +1,8 @@
include_directories(
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}
${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}/src
)
diff --git a/cmake/after_ws_install.cmake b/cmake/after_ws_install.cmake
index c2912ab..3fbebd1 100644
--- a/cmake/after_ws_install.cmake
+++ b/cmake/after_ws_install.cmake
@@ -1,6 +1,6 @@
include_directories(
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}
${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}/src
)
diff --git a/cmake/before_script_install.cmake b/cmake/before_script_install.cmake
index cce9e1d..7487800 100644
--- a/cmake/before_script_install.cmake
+++ b/cmake/before_script_install.cmake
@@ -1,5 +1,5 @@
include_directories(
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}
${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}/src
)
\ No newline at end of file
diff --git a/ObjectGuid.h b/src/ObjectGuid.h
similarity index 100%
rename from ObjectGuid.h
rename to src/ObjectGuid.h
From 157d833327b7a9df53d0fc2c1d01f4f3222ae1b0 Mon Sep 17 00:00:00 2001
From: Ayase <137056643@qq.com>
Date: Sat, 9 Mar 2019 23:05:11 +0800
Subject: [PATCH 034/112] update README.md
---
README.md | 4 ++--
README_CN.md | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index b293d55..cfe8345 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# mod-LuaEngine
- english | [chinese](README_CN.md)
+ english | [中文说明](README_CN.md)
a Eluna module for AzerothCore.
@@ -12,7 +12,7 @@ How to install:
3. download or clone the ELUNA core file:
> [download zip file.](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
> or clone `git clone https://github.com/ElunaLuaEngine/Eluna.git .`
-* Put it in the lua module folder:mod-LuaEngine/LuaEngine. (If you downloaded the zip-file you'll want to move all the files inside the Eluna-master folder into the mod-eluna-lua-engine/LuaEngine folder. LuaEngine.h needs to be directly under mod-eluna-lua-engine/LuaEngine without any extra sub-folders.)
+4. Put it in the lua module folder:mod-LuaEngine/LuaEngine. (If you downloaded the zip-file you'll want to move all the files inside the `Eluna-master` folder into the `mod-eluna-lua-engine/LuaEngine` folder. `LuaEngine.h` needs to be directly under `mod-eluna-lua-engine/LuaEngine` without any extra sub-folders.)
5. cmake again
6. rebuild.
diff --git a/README_CN.md b/README_CN.md
index de371c4..87d0f5c 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -12,7 +12,7 @@
3. 下载或者克隆ELUNA的核心文件:
> [download zip file.](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
> clone `git clone https://github.com/ElunaLuaEngine/Eluna.git`
-4. 解压并放置到模块的LuaEngine文件夹中:mod-LuaEngine/LuaEngine
+4. 解压并放置到模块的LuaEngine文件夹中:mod-LuaEngine/LuaEngine(如果下载了zip文件,你需要将`Eluna-master`文件夹中的所有文件移动到`mod-eluna-lua-engine/LuaEngine`文件夹中。`LuaEngine.h`需要直接位于目录:`mod-eluna-lua-engine/LuaEngine`之下,不要有任何的子文件夹。)
5. 重新cmake.
6. 重新生成.
From 1c93c564950f2205ab323e3e62ad8c08307761a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefano=20Borz=C3=AC?=
Date: Wed, 27 Mar 2019 18:10:19 +0100
Subject: [PATCH 035/112] Added icon for the modules catalogue (#10)
---
icon.png | Bin 0 -> 4095 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 icon.png
diff --git a/icon.png b/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..35e9047b02d06cf73c245878dfc1ad1ef38aed04
GIT binary patch
literal 4095
zcma)9XE+;<*9~H(W@@j*D790xHj$_mTdh)?+N!ovQX@!-Ql-?a+Oca>J63EpYt|lB
zE!C?2{XV~6-gBRG&vVb`bD!tlctd?nS{e=-002O%t%WqcR;T|+MRDDI*I%1n3x$KO
zCKB-PzshSbPQ7-heYGr~0stWJeuG4{vdrob-Uwy
zm`7b}4z6ZKf`C+R%uc$$90f=)FqyHAQx|RAQLfZ8cwk<%`xd{~$38HTxd)*&CSATo
zgHF&5@+e%sTM2Z6i4`0GNd*L){)ivvT=0`Hl4?V!p&etYrI!)MK`ZUYe~8W7*+DDh
zy#E)uiE8+aoTSl!-Mf5hcZ^J9X{qDsaunwB1lf{s4Al(a*mWt;R%|%js?cX+7CE6j
zm&*2=KUCH|7IFjNU}S`39#N?fC!urr$#B;gZQlG+u+C$Qt?gyD+8#p@=~!|Aw4raIl=Q>ov4Fv)eKkd%o
z;LeM=
z23kuq7DX=*{L)eLM<72A<}JJynKY~8ohZC;QC=0pgvPUp5U__&V*SBo+E<*?-_Twq
zQmUNu&a|*xW87i*A~~a<*;3?&5-k>ify-mRlS0GeHO_h5XP%Blh`$uxreteb8~j&o
z*AsT={0R0&0~=?a)RhrJ1!jyVuPI?EJfp%9$Pyi`PF##wT)l5`MUV(a_s|b&chdUl
zg)#KHol2|x+Os3wT9G0uW01M_rKOl9EdOUPhUe3cSP#bS>x~9zLV}e_@|@hIRAJ~%
z$0jluJ63xhZVx|c)Wua?3Mi2C^kn>D)K>es4-#MJW1^p=PvL|S^?+>J2U>3!Glk}4
z+Gu7!=1FUrv7+iPpdHgnlof)1y%`+FA_8W
zMwE<{DK~K`nC6&B=`?H(&u*&joQ2_{L-<1L>>apa?eaUDUq~?rJv`y4wq}mKZ9<#?WE#|s%WDv4FXqWi&
zaP9RjaHPuU<-k;N@X41>S)6Ym1jODd7n^f3#gG}JrKH1LmUtV~**k0!X!L97?j7$%
zt$+ht!w}X&-WNRTGE|e)n4WR=6q#rl1tE>poB$l{g?Q=`Eti=N>RhgODdus8k>YI4
z$$5T~2UK2^!eIo2S+aai42VA55X&|V{t}^FEytmKpj*F$k!$4h1C8@y%F5k#-7Efz
zJEs^}2_y%9o9RL-{)>aXqt@hcwcl!?bBBsJdGaP_%(KN)x}UTOPMhLgPKQq44Bo3u
z_+}Y#JLa>ez1omwuQ5i4Aw>Wgihgg;hOC$Gn#l~iEz%^@sT!<93-hMAe}qKAY<#T8
z@Ih@!LIkqichm$FwwZjIe2R1#N-{Orrhky_qux?0i!C@-bi+e6cTPJ6LXSX`X2~}aR!mxnxf5b
zf~c?|-PE(Xc7JFJp|kKTAdj{Gf&}Q2`g-MSLDrXl&bQ4zLz&`W{Dh(8JqxtbRp3p6
z9fak9VUlBjVoaRG^1Z5eHpAT`^y37B>a%-!CvscbuijarMiN__?rw*z9#B+vNwuj&
z?x>;D$7CPvLv7LmTpbjeb#y{j&b8~2Bdl0J{}PkeBs
zp2X==g;tusvQVkRzFp-rwY|R?N*c90@~qjUZb3``CB$mj*{XE11)cVWjN>x&F{yoV
zKslLiEj<{!Y5$X~7j;Wz?aZYapTJ-I+dPqWAxThcTa8Wb1_!<|*&^G}x;)waByG9G
z29VtglgbVzLHUT9yF#6V(zG-|HYyO50zQrlHccAXq{tw2FcVRk<;m
z1hh@tuqvaZCcA*8N%VzhqL64RI}=R8-pZ|HT~I9o*i#Ny?I#3#zJcmpI+N-s5$>)R
zs&nh&(4O?=t#JB$VG$cc_TIU>G`G^7c)Ny<)xfZ=FejNVomWdvSY%-!=UDQw9U5Q}
z#G9@Tq=!=Qzt~k4s2MG2L1TWeZwXa!X$M=fx_;h%I5hl`*G3{^B5
zD0~^3bDA>pz3z73+cpEAd;vIMQjT$9(4b6Fxdrfu_s~I966;xx-^18sxWR*9N{5jE
zy&R{9XuGf57R$h;k*kT5ZDsGRJRlA^&0>tRnTL^+lvK>cf2GfpRU_pCSKBP&+uDCz
zxvv^fl|C*x4oOZ-(Cb?e5h=gtn>Y|(;^jPD=we%
zjyP|U8*-roLBm1mL7s56`R8`hJi2h*NIV7=GwreH`5syYG-yP#YayI}b~iJYdBS8{
z{`yIXdbL{3DjHCfem4V@tG%GQ2O)+pHS!hd5p8jYQQjo7y&=n-ZEiHRqLSy``ya(6
zB!-nxQkQ%~f2fSuJ}{I|U2lq4>SMd*
zo6b)y0k;d8U;|RUAI;$l5j6ouQLlVQRg7D>D<0+x7c#P=IfaY2xovAtM`y!cd=%!L
zOmu+B`G;3$*bKM%w8l)=1V%&~ABQXbl`r#%gt7(kw72TH689@J`V!YeY#l1ci^PbH
zxH@s?o@z4eu90aY*6hB06Qj|aiTSXHo|!xH4P|Rkg>%E9q2Y%!9Fk}0ZmjK1J{mMn
z6iA-9kRqZ~nP!Vjqdzz5_h)-7>}NF{Za3`I@HX8LwI*YC?aC=tDX|26(4d{O@L~u(S47g5MN=C_5
z(~+ziO)S`AS?_hkVC`U>TC>)o}qflh)V`PU?cBkF#0u8divqZ~#a1arCCyKERxZnu3&
zjQq?zR%y4U+{&rku`s|df*vqJRpZ!-Ig;2YlqVWACnU0z|i*KnCeOBNL1~3cCahqxLNJ8he_GyIOl6-<}}4+liXf1Z)WRO}R>0CBeW^
zx#PuQLVn+KUEzVJIhE(xY;iyrKI<2?(L<@njN2g@n-3uJ5NYkK`lL}&T`L#kxYUvk
zTH`=`%ws`cjA*j3bt4YfNNGOI_yPJ|Mju5gU!^>N9{J#-HN}5shDE6d@TL&_0^3bk
zkBXheh3tF~PFzWf>;%Q!QxBK4BF*@nDk)8lq*{Faq2<_8mH(P@u5^&Igo8fdX{3;E
zw*F?tF9W%js)>)Wt^uWs1-KlGko2;>WP|687pDen%C!LgQ^U-z220-RBD;a2QK-AV
z^IE=Wi0u+ce>^1hOlrR&H+9D>QiWy<%JqsW=ug$uNnVcTg76XPt-NVKslQGr8fG%4
zR6zMy_C8)H&xBp&lJzEYjD#S}GiE)={}0&B&4v2uqkqgK%JDFR$jk(f4FlFYMezNd
z#2)`VX?38JSx;?g-a0xH{)3>3n23AB<{S@skE;`F&{i$)b-Wm3WWb%d|Ip^cJh;T%wgv4UMfy_zoqm~e!Kf*qh
zkFp{w$xDHxke;lgLN9TW?X2zUV79V7qSt+yNp)I>&M%qy{flZ9A)pCGI0b-=gIZmu
zy5+6!1)icK5%3^y#y7{>>+q7wV{kjy+;mkzm2^<8;jDgTh(NWP8UG1ls@lC#dEaDU
zZ%?)j@qVX2@f#isZ7RJWuI(lnqA+##J;qcY6bYSM;_{6=HGGD
zy8T6H)_X6}vpXXDx4GEk1<4stfBF#JHI)
Date: Sun, 31 Mar 2019 00:06:24 +0800
Subject: [PATCH 036/112] Eluna update version.
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index e1d151b..adf722a 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit e1d151b86204e53e04e8ec3d971faf1fa944d3cc
+Subproject commit adf722a18111c316783ed65392d7b57934f39b07
From e27b9e0d892d1627b1bccc16f7ceeca9f9bcbe61 Mon Sep 17 00:00:00 2001
From: Kargatum
Date: Wed, 3 Apr 2019 12:32:07 +0700
Subject: [PATCH 037/112] Cmake: Rewrite build and use inherited dependencies
(#12)
---
CMakeLists.txt | 7 +--
cmake/after_gs_install.cmake | 43 ++++++++++---------
...f.cmake => after_load_cmake_modules.cmake} | 3 +-
cmake/after_ws_install.cmake | 6 ---
cmake/before_gs_install.cmake | 11 ++---
cmake/before_script_install.cmake | 5 ---
lualib/CMakeLists.txt | 31 ++++++++-----
7 files changed, 50 insertions(+), 56 deletions(-)
rename cmake/{after_load_conf.cmake => after_load_cmake_modules.cmake} (99%)
delete mode 100644 cmake/after_ws_install.cmake
delete mode 100644 cmake/before_script_install.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1acb733..54641af 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,2 @@
CU_SET_PATH("CMAKE_MOD_ELUNA_ENGINE_DIR" "${CMAKE_CURRENT_LIST_DIR}")
-CU_ADD_HOOK(AFTER_LOAD_CONF "${CMAKE_CURRENT_LIST_DIR}/cmake/after_load_conf.cmake")
-
-
-
-
-
+CU_ADD_HOOK(AFTER_LOAD_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake/after_load_cmake_modules.cmake")
diff --git a/cmake/after_gs_install.cmake b/cmake/after_gs_install.cmake
index 19722a5..9808df3 100644
--- a/cmake/after_gs_install.cmake
+++ b/cmake/after_gs_install.cmake
@@ -1,28 +1,31 @@
+CollectIncludeDirectories(
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}
+ PUBLIC_INCLUDES)
-include_directories(
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}/src
-)
-
+target_include_directories(game-interface
+ INTERFACE
+ ${PUBLIC_INCLUDES})
add_dependencies(game lualib)
-target_link_libraries(game lualib)
+
+target_link_libraries(game
+ PUBLIC
+ lualib)
if( WIN32 )
- if ( MSVC )
- add_custom_command(TARGET game
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/lua_scripts/extensions/"
- COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/lua_scripts/extensions/"
- )
- elseif ( MINGW )
- add_custom_command(TARGET game
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/lua_scripts/extensions/"
- COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/lua_scripts/extensions/"
- )
- endif()
+ if ( MSVC )
+ add_custom_command(TARGET game
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/lua_scripts/extensions/"
+ COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/lua_scripts/extensions/"
+ )
+ elseif ( MINGW )
+ add_custom_command(TARGET game
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/lua_scripts/extensions/"
+ COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/lua_scripts/extensions/"
+ )
+ endif()
endif()
install(DIRECTORY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" DESTINATION "${CMAKE_INSTALL_PREFIX}/bin/lua_scripts/")
diff --git a/cmake/after_load_conf.cmake b/cmake/after_load_cmake_modules.cmake
similarity index 99%
rename from cmake/after_load_conf.cmake
rename to cmake/after_load_cmake_modules.cmake
index 2c10f00..9876317 100644
--- a/cmake/after_load_conf.cmake
+++ b/cmake/after_load_cmake_modules.cmake
@@ -1,7 +1,9 @@
add_subdirectory(${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib)
+
add_definitions(-DELUNA)
add_definitions(-DAZEROTHCORE)
add_definitions(-DWOTLK)
+
CU_ADD_HOOK(BEFORE_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/before_gs_install.cmake")
CU_ADD_HOOK(AFTER_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_gs_install.cmake")
CU_ADD_HOOK(BEFORE_SCRIPTS_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/before_script_install.cmake")
@@ -10,4 +12,3 @@ CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_w
AC_ADD_CONFIG_FILE("${CMAKE_MOD_ELUNA_ENGINE_DIR}/conf/mod_LuaEngine.conf.dist")
message("** [Eluna Module] LuaEngine is enable!")
-
diff --git a/cmake/after_ws_install.cmake b/cmake/after_ws_install.cmake
deleted file mode 100644
index 3fbebd1..0000000
--- a/cmake/after_ws_install.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-
-include_directories(
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}/src
-)
diff --git a/cmake/before_gs_install.cmake b/cmake/before_gs_install.cmake
index d893169..95b99b0 100644
--- a/cmake/before_gs_install.cmake
+++ b/cmake/before_gs_install.cmake
@@ -2,15 +2,12 @@ file(GLOB_RECURSE method_headers ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/*Method
file(GLOB_RECURSE sources_ElunaFile_CPP ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/*.cpp )
file(GLOB_RECURSE sources_ElunaFile_H ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/*.h)
-set(game_STAT_SRCS
- ${game_STAT_SRCS}
- ${sources_ElunaFile_H}
- ${sources_ElunaFile_CPP}
+set(ElunaLuaEngineFiles
+ ${ElunaLuaEngineFiles}
+ ${sources_ElunaFile_H}
+ ${sources_ElunaFile_CPP}
)
source_group("LuaEngine\\Methods" FILES ${method_headers})
-
source_group("LuaEngine\\Header Files" FILES ${sources_ElunaFile_H})
-
source_group("LuaEngine\\Source Files" FILES ${sources_ElunaFile_CPP})
-
diff --git a/cmake/before_script_install.cmake b/cmake/before_script_install.cmake
deleted file mode 100644
index 7487800..0000000
--- a/cmake/before_script_install.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-include_directories(
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}/src
-)
\ No newline at end of file
diff --git a/lualib/CMakeLists.txt b/lualib/CMakeLists.txt
index c201500..b1bf6e4 100644
--- a/lualib/CMakeLists.txt
+++ b/lualib/CMakeLists.txt
@@ -4,16 +4,25 @@
# Please see the included DOCS/LICENSE.md for more information
#
-file(GLOB sources *.c)
-list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/lua.c)
-list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/luac.c)
-
-set(lua_STAT_SRCS
- ${sources}
-)
-
-include_directories(
+CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
-)
+ PRIVATE_SOURCES
+ # Exclude
+ ${CMAKE_CURRENT_SOURCE_DIR}/Debugging
+ ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
-add_library(lualib STATIC ${lua_STAT_SRCS})
+list(REMOVE_ITEM PRIVATE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/lua.c)
+list(REMOVE_ITEM PRIVATE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/luac.c)
+
+add_library(lualib STATIC
+ ${PRIVATE_SOURCES})
+
+CollectIncludeDirectories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PUBLIC_INCLUDES)
+
+target_include_directories(lualib
+ PUBLIC
+ ${PUBLIC_INCLUDES}
+ PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR})
From 56ec11eed7552c274a93667df6313a8b1ca7ed49 Mon Sep 17 00:00:00 2001
From: Kargatum
Date: Wed, 3 Apr 2019 12:51:03 +0700
Subject: [PATCH 038/112] Cmake: Delete unused hooks (#13)
---
cmake/after_load_cmake_modules.cmake | 2 --
1 file changed, 2 deletions(-)
diff --git a/cmake/after_load_cmake_modules.cmake b/cmake/after_load_cmake_modules.cmake
index 9876317..eb7b43b 100644
--- a/cmake/after_load_cmake_modules.cmake
+++ b/cmake/after_load_cmake_modules.cmake
@@ -6,8 +6,6 @@ add_definitions(-DWOTLK)
CU_ADD_HOOK(BEFORE_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/before_gs_install.cmake")
CU_ADD_HOOK(AFTER_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_gs_install.cmake")
-CU_ADD_HOOK(BEFORE_SCRIPTS_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/before_script_install.cmake")
-CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_ws_install.cmake")
AC_ADD_CONFIG_FILE("${CMAKE_MOD_ELUNA_ENGINE_DIR}/conf/mod_LuaEngine.conf.dist")
From f92ef4bc64e2f8e2528d602a0b37e902e842365b Mon Sep 17 00:00:00 2001
From: Stoabrogga <38475780+Stoabrogga@users.noreply.github.com>
Date: Sat, 6 Apr 2019 00:14:32 +0200
Subject: [PATCH 039/112] feat(CI): Travis integration (#11)
---
.travis.yml | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++
LuaEngine | 2 +-
2 files changed, 78 insertions(+), 1 deletion(-)
create mode 100644 .travis.yml
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..c1538c7
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,77 @@
+sudo: required
+dist: xenial # (16.04)
+# bionic (18.04) is not yet available in travis
+
+language: cpp
+
+cache: ccache
+
+addons:
+ apt:
+ update: true
+
+services:
+ - mysql
+
+git:
+ depth: 10
+
+stages:
+ - prepare_cache
+ - run
+
+jobs:
+ include:
+ - stage: prepare_cache
+ env: TRAVIS_BUILD_ID="1"
+ before_install:
+ - cd ..
+ - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk
+ - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules
+ - cd azerothcore-wotlk
+ - source ./apps/ci/ci-before_install.sh
+ install:
+ - source ./apps/ci/ci-install.sh OFF
+ script:
+ - source ./apps/ci/ci-compile.sh
+
+ - stage: run
+ env: TRAVIS_BUILD_ID="1"
+ before_install:
+ - cd ..
+ - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk
+ - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules
+ - cd azerothcore-wotlk
+ - source ./apps/ci/ci-before_install.sh
+ install:
+ - source ./apps/ci/ci-install.sh ON
+ - source ./apps/ci/ci-import-db.sh
+ script:
+ - source ./apps/ci/ci-compile.sh
+ - source ./apps/ci/ci-worldserver-dry-run.sh
+
+ - stage: prepare_cache
+ env: TRAVIS_BUILD_ID="2"
+ before_install:
+ - cd ..
+ - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk
+ - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules
+ - cd azerothcore-wotlk
+ - source ./apps/ci/ci-before_install.sh
+ install:
+ - source ./apps/ci/ci-install.sh OFF
+ script:
+ - source ./apps/ci/ci-compile.sh
+
+ - stage: run
+ env: TRAVIS_BUILD_ID="2"
+ before_install:
+ - cd ..
+ - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk
+ - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules
+ - cd azerothcore-wotlk
+ - source ./apps/ci/ci-before_install.sh
+ install:
+ - source ./apps/ci/ci-install.sh ON
+ script:
+ - source ./apps/ci/ci-compile.sh
diff --git a/LuaEngine b/LuaEngine
index adf722a..c027d0b 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit adf722a18111c316783ed65392d7b57934f39b07
+Subproject commit c027d0bcb5868e87413214e9b68e99b33db41039
From 2ee4125ea64a5ee8a26f91a24b5a37aa1dd0f01c Mon Sep 17 00:00:00 2001
From: Walter Pagani
Date: Thu, 25 Jul 2019 15:32:11 -0300
Subject: [PATCH 040/112] docs: Add README spanish translation (#14)
---
README.md | 2 +-
README_CN.md | 2 +-
README_ES.md | 19 +++++++++++++++++++
3 files changed, 21 insertions(+), 2 deletions(-)
create mode 100644 README_ES.md
diff --git a/README.md b/README.md
index cfe8345..9fcccb2 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# mod-LuaEngine
- english | [中文说明](README_CN.md)
+[english](README.md) | [中文说明](README_CN.md) | [Español](README_ES.md)
a Eluna module for AzerothCore.
diff --git a/README_CN.md b/README_CN.md
index 87d0f5c..56776fd 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -1,5 +1,5 @@
# mod-LuaEngine
-[english](README.md) | 中文
+[english](README.md) | [中文说明](README_CN.md) | [Español](README_ES.md)
一个用于AzerothCore的ELUNA模块.
diff --git a/README_ES.md b/README_ES.md
new file mode 100644
index 0000000..b33b262
--- /dev/null
+++ b/README_ES.md
@@ -0,0 +1,19 @@
+# mod-LuaEngine
+ [English](README.md) | [中文说明](README_CN.md) | [Español](README_ES.md)
+
+Un módulo de Eluna para AzerothCore.
+
+Cómo instalar:
+
+1. Descargar o clonar este módulo:
+> [Descargar archivo zip](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
+> o clonar `git clone https://github.com/azerothcore/mod-eluna-lua-engine.git`
+2. Póngalo en la carpeta de módulos del Azerothcore.
+> $HOME/azerothcore/modules/
+3. Descargar o clonar el archivo central de ELUNA:
+> [Descargar archivo zip](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
+> o clonar `git clone https://github.com/ElunaLuaEngine/Eluna.git .`
+4. Dentro de la carpeta del módulo de Eluna de Azeroth, se encuentra una carpeta / directorio llamado: `LuaEngine` (mod-eluna-lua-engine/LuaEngine). Debe depositar los ficheros de lua, directamente dentro de esa carpeta. Los archivos directamente, no un directorio y luego los ficheros dentro. Por eso te utiliza el “.” cuando se está clonando, para que no genere un directorio nuevo.
+5. Una vez copiado los ficheros y descargado el modulo, debes volver a compilar. Si seguiste la guía de instalación, debiste haber generado un directorio build, dentro de azerothcore. Dirígete a él y realiza la compilación como lo menciona en la guía.
+
+Eluna API : [http://www.elunaengine.com/](http://www.elunaengine.com/)
From 0b4f92cbe160175064ba7b09b220cb2a5175ded7 Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Thu, 3 Oct 2019 13:51:30 +0800
Subject: [PATCH 041/112] Eluna update version.
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index c027d0b..897d5e9 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit c027d0bcb5868e87413214e9b68e99b33db41039
+Subproject commit 897d5e915978817d948d8f2745fa977eea048c47
From 4628f0cb728b91b3e6f67526a6b354e9d0601bf9 Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Thu, 3 Oct 2019 13:53:17 +0800
Subject: [PATCH 042/112] =?UTF-8?q?=E4=BF=AE=E6=AD=A3api=E5=9C=B0=E5=9D=80?=
=?UTF-8?q?=E5=A4=B1=E6=95=88.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 4 ++--
README_CN.md | 3 ++-
README_ES.md | 3 ++-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 9fcccb2..05df3cc 100644
--- a/README.md
+++ b/README.md
@@ -16,5 +16,5 @@ How to install:
5. cmake again
6. rebuild.
-Eluna API : [http://www.elunaengine.com/](http://www.elunaengine.com/)
-
+Eluna API :
+[http://elunaluaengine.github.io/](http://elunaluaengine.github.io/)
diff --git a/README_CN.md b/README_CN.md
index 56776fd..8e21a58 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -16,4 +16,5 @@
5. 重新cmake.
6. 重新生成.
-Eluna API : [http://www.elunaengine.com/](http://www.elunaengine.com/)
\ No newline at end of file
+Eluna API :
+[http://elunaluaengine.github.io/](http://elunaluaengine.github.io/)
\ No newline at end of file
diff --git a/README_ES.md b/README_ES.md
index b33b262..39f6161 100644
--- a/README_ES.md
+++ b/README_ES.md
@@ -16,4 +16,5 @@ Cómo instalar:
4. Dentro de la carpeta del módulo de Eluna de Azeroth, se encuentra una carpeta / directorio llamado: `LuaEngine` (mod-eluna-lua-engine/LuaEngine). Debe depositar los ficheros de lua, directamente dentro de esa carpeta. Los archivos directamente, no un directorio y luego los ficheros dentro. Por eso te utiliza el “.” cuando se está clonando, para que no genere un directorio nuevo.
5. Una vez copiado los ficheros y descargado el modulo, debes volver a compilar. Si seguiste la guía de instalación, debiste haber generado un directorio build, dentro de azerothcore. Dirígete a él y realiza la compilación como lo menciona en la guía.
-Eluna API : [http://www.elunaengine.com/](http://www.elunaengine.com/)
+Eluna API :
+[http://elunaluaengine.github.io/](http://elunaluaengine.github.io/)
From fb67bdef989634b822f5dc671e20647a0581734e Mon Sep 17 00:00:00 2001
From: Kargatum
Date: Mon, 11 Nov 2019 23:16:16 +0700
Subject: [PATCH 043/112] Update LuaEngine to actual (#19)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 897d5e9..8fe15b7 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 897d5e915978817d948d8f2745fa977eea048c47
+Subproject commit 8fe15b76a8c3ab040cc61aba870b5ab92afa3d11
From d544a70792106d45b1fcd9db3781d7f427d1188c Mon Sep 17 00:00:00 2001
From: Viste
Date: Sun, 24 Nov 2019 15:01:53 +0300
Subject: [PATCH 044/112] update LuaEngine to latest (#20)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 8fe15b7..dab3724 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 8fe15b76a8c3ab040cc61aba870b5ab92afa3d11
+Subproject commit dab372408c0b7038e646fe8c3a42059163476925
From f31d3e3dfe420ceccfe0f2c3a2f8f78b94384851 Mon Sep 17 00:00:00 2001
From: VhiperDEV <39068627+vhiperdev@users.noreply.github.com>
Date: Mon, 2 Dec 2019 06:36:36 -0300
Subject: [PATCH 045/112] fix build azerothcore (#21)
---
.travis.yml | 3 +--
LuaEngine | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index c1538c7..848d188 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,5 @@
sudo: required
-dist: xenial # (16.04)
-# bionic (18.04) is not yet available in travis
+dist: bionic # (18.04)
language: cpp
diff --git a/LuaEngine b/LuaEngine
index dab3724..35e85a7 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit dab372408c0b7038e646fe8c3a42059163476925
+Subproject commit 35e85a71ae723db0b5ab915bf4bf7bad1e8f0c9f
From b6e3ed364d58f75b0961775c482e09e2f8f452e9 Mon Sep 17 00:00:00 2001
From: Rochet2
Date: Fri, 3 Jan 2020 22:11:06 +0200
Subject: [PATCH 046/112] Try fix warning
---
lualib/CMakeLists.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lualib/CMakeLists.txt b/lualib/CMakeLists.txt
index b1bf6e4..3f97344 100644
--- a/lualib/CMakeLists.txt
+++ b/lualib/CMakeLists.txt
@@ -26,3 +26,9 @@ target_include_directories(lualib
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
+
+if (APPLE)
+ target_compile_definitions(lualib PUBLIC LUA_USE_MACOSX)
+elseif (UNIX)
+ target_compile_definitions(lualib PUBLIC LUA_USE_LINUX)
+endif()
From 363ca13f230beacc9ce96baddfc6bd9e753f8033 Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Sun, 22 Mar 2020 22:25:36 +0800
Subject: [PATCH 047/112] Eluna update version.
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 35e85a7..3d9ce19 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 35e85a71ae723db0b5ab915bf4bf7bad1e8f0c9f
+Subproject commit 3d9ce1911eb6050d8629d76f7bda2d24ee48b542
From 574c6c589df52dcbed013d5b2d5f4a1b18b28625 Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Mon, 23 Mar 2020 22:19:30 +0800
Subject: [PATCH 048/112] Avoid including redundant directories.
---
cmake/after_gs_install.cmake | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/cmake/after_gs_install.cmake b/cmake/after_gs_install.cmake
index 9808df3..0ac0155 100644
--- a/cmake/after_gs_install.cmake
+++ b/cmake/after_gs_install.cmake
@@ -1,6 +1,9 @@
-CollectIncludeDirectories(
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}
- PUBLIC_INCLUDES)
+set(PUBLIC_INCLUDES
+ ${PUBLIC_INCLUDES}
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
+ ${CMAKE_MOD_ELUNA_ENGINE_DIR}/src
+)
target_include_directories(game-interface
INTERFACE
From 2e7300be214a0bba205a55e39507a0d8df2ea1c3 Mon Sep 17 00:00:00 2001
From: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
Date: Thu, 9 Apr 2020 20:52:33 +0200
Subject: [PATCH 049/112] Update LuaEngine
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 3d9ce19..c83e3a3 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 3d9ce1911eb6050d8629d76f7bda2d24ee48b542
+Subproject commit c83e3a33a01df47b63e152fa8405292e1b616a2a
From 81506786b0ee68ba632a8aa9b7cd0324c18a6496 Mon Sep 17 00:00:00 2001
From: Rochet2
Date: Fri, 10 Apr 2020 01:31:30 +0300
Subject: [PATCH 050/112] Eluna update version
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index c83e3a3..f7adf33 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit c83e3a33a01df47b63e152fa8405292e1b616a2a
+Subproject commit f7adf330284995eca84a68be538fdbe0978a107d
From 3419e76486752f9fd72fdf390b45485ab4ab9caa Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Tue, 2 Jun 2020 22:49:42 +0800
Subject: [PATCH 051/112] =?UTF-8?q?=E6=9D=82=E9=A1=B9=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
cmake/after_gs_install.cmake | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/cmake/after_gs_install.cmake b/cmake/after_gs_install.cmake
index 0ac0155..5dc331d 100644
--- a/cmake/after_gs_install.cmake
+++ b/cmake/after_gs_install.cmake
@@ -16,19 +16,14 @@ target_link_libraries(game
lualib)
if( WIN32 )
- if ( MSVC )
- add_custom_command(TARGET game
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/lua_scripts/extensions/"
- COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/lua_scripts/extensions/"
- )
- elseif ( MINGW )
- add_custom_command(TARGET game
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/lua_scripts/extensions/"
- COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/lua_scripts/extensions/"
- )
+ if (MSVC)
+ set(MSVC_CONFIGURATION_NAME $(ConfigurationName)/)
endif()
+ add_custom_command(TARGET game
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/${MSVC_CONFIGURATION_NAME}lua_scripts/extensions/"
+ COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/${MSVC_CONFIGURATION_NAME}lua_scripts/extensions/"
+ )
endif()
install(DIRECTORY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" DESTINATION "${CMAKE_INSTALL_PREFIX}/bin/lua_scripts/")
From 2aba9a4c051bf0d60547f0b41053f8ef573503f8 Mon Sep 17 00:00:00 2001
From: Rochet2
Date: Sun, 16 Aug 2020 14:42:50 +0300
Subject: [PATCH 052/112] feat(CI): move from Travis to GitHub Actions (#30)
---
.github/workflows/core_build.yml | 45 +++++++++++++++++++
.travis.yml | 76 --------------------------------
2 files changed, 45 insertions(+), 76 deletions(-)
create mode 100644 .github/workflows/core_build.yml
delete mode 100644 .travis.yml
diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml
new file mode 100644
index 0000000..7e43788
--- /dev/null
+++ b/.github/workflows/core_build.yml
@@ -0,0 +1,45 @@
+name: core-build
+on:
+ push:
+ pull_request:
+
+jobs:
+ build:
+ strategy:
+ fail-fast: false
+ matrix:
+ compiler: [clang6, clang9, clang10]
+ runs-on: ubuntu-20.04
+ name: ${{ matrix.compiler }}
+ env:
+ COMPILER: ${{ matrix.compiler }}
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ repository: 'azerothcore/azerothcore-wotlk'
+ ref: 'master'
+ submodules: 'recursive'
+ - uses: actions/checkout@v2
+ with:
+ submodules: 'recursive'
+ path: 'modules/mod-eluna-lua-engine'
+ - name: Cache
+ uses: actions/cache@v1.1.2
+ with:
+ path: /home/runner/.ccache
+ key: ccache:${{ matrix.compiler }}:${{ github.ref }}:${{ github.sha }}
+ restore-keys: |
+ ccache:${{ matrix.compiler }}:${{ github.ref }}
+ ccache:${{ matrix.compiler }}
+ - name: Configure OS
+ run: source ./apps/ci/ci-install.sh
+ env:
+ CONTINUOUS_INTEGRATION: true
+ - name: Import db
+ run: source ./apps/ci/ci-import-db.sh
+ - name: Build
+ run: source ./apps/ci/ci-compile.sh
+ - name: Dry run
+ run: source ./apps/ci/ci-worldserver-dry-run.sh
+ - name: Check startup errors
+ run: source ./apps/ci/ci-error-check.sh
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 848d188..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,76 +0,0 @@
-sudo: required
-dist: bionic # (18.04)
-
-language: cpp
-
-cache: ccache
-
-addons:
- apt:
- update: true
-
-services:
- - mysql
-
-git:
- depth: 10
-
-stages:
- - prepare_cache
- - run
-
-jobs:
- include:
- - stage: prepare_cache
- env: TRAVIS_BUILD_ID="1"
- before_install:
- - cd ..
- - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk
- - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules
- - cd azerothcore-wotlk
- - source ./apps/ci/ci-before_install.sh
- install:
- - source ./apps/ci/ci-install.sh OFF
- script:
- - source ./apps/ci/ci-compile.sh
-
- - stage: run
- env: TRAVIS_BUILD_ID="1"
- before_install:
- - cd ..
- - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk
- - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules
- - cd azerothcore-wotlk
- - source ./apps/ci/ci-before_install.sh
- install:
- - source ./apps/ci/ci-install.sh ON
- - source ./apps/ci/ci-import-db.sh
- script:
- - source ./apps/ci/ci-compile.sh
- - source ./apps/ci/ci-worldserver-dry-run.sh
-
- - stage: prepare_cache
- env: TRAVIS_BUILD_ID="2"
- before_install:
- - cd ..
- - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk
- - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules
- - cd azerothcore-wotlk
- - source ./apps/ci/ci-before_install.sh
- install:
- - source ./apps/ci/ci-install.sh OFF
- script:
- - source ./apps/ci/ci-compile.sh
-
- - stage: run
- env: TRAVIS_BUILD_ID="2"
- before_install:
- - cd ..
- - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk
- - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules
- - cd azerothcore-wotlk
- - source ./apps/ci/ci-before_install.sh
- install:
- - source ./apps/ci/ci-install.sh ON
- script:
- - source ./apps/ci/ci-compile.sh
From 6a474a2e83c689e214b5f32e33ab7c9688114ea4 Mon Sep 17 00:00:00 2001
From: Patrick Lewis
Date: Sat, 21 Nov 2020 02:34:53 -0800
Subject: [PATCH 053/112] docs(readme): add AzerothCore logo and build status
badge (#33)
---
README.md | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 05df3cc..1f1fc2a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,7 @@
-# mod-LuaEngine
+#  AzerothCore
+## mod-LuaEngine
+- Latest build status with azerothcore: [](https://github.com/azerothcore/mod-eluna-lua-engine)
+
[english](README.md) | [中文说明](README_CN.md) | [Español](README_ES.md)
a Eluna module for AzerothCore.
From fcee06f26782a8ddf1d5ed85ff957e377c19047b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Mon, 23 Nov 2020 13:28:03 +0100
Subject: [PATCH 054/112] fix(build): update Eluna to latest version (#34)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index f7adf33..f117491 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit f7adf330284995eca84a68be538fdbe0978a107d
+Subproject commit f117491095ca29b55227717af84cd7d4257426c9
From e05489f61be4c18d981748a8813764f5a7550940 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Mon, 23 Nov 2020 15:40:40 +0100
Subject: [PATCH 055/112] docs: improve README.md (#35)
---
README.md | 44 ++++++++++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 14 deletions(-)
diff --git a/README.md b/README.md
index 1f1fc2a..a9a394a 100644
--- a/README.md
+++ b/README.md
@@ -1,23 +1,39 @@
-#  AzerothCore
-## mod-LuaEngine
+#  mod-eluna-lua-engine for AzerothCore
- Latest build status with azerothcore: [](https://github.com/azerothcore/mod-eluna-lua-engine)
[english](README.md) | [中文说明](README_CN.md) | [Español](README_ES.md)
-a Eluna module for AzerothCore.
+An [Eluna](https://github.com/ElunaLuaEngine/Eluna) module for AzerothCore.
-How to install:
+## How to install:
-1. download or clone this module:
-> [download zip file.](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
-> or clone `git clone https://github.com/azerothcore/mod-eluna-lua-engine.git`
-2. Put it in the modules folder of the Azerothcore.
-3. download or clone the ELUNA core file:
-> [download zip file.](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
-> or clone `git clone https://github.com/ElunaLuaEngine/Eluna.git .`
-4. Put it in the lua module folder:mod-LuaEngine/LuaEngine. (If you downloaded the zip-file you'll want to move all the files inside the `Eluna-master` folder into the `mod-eluna-lua-engine/LuaEngine` folder. `LuaEngine.h` needs to be directly under `mod-eluna-lua-engine/LuaEngine` without any extra sub-folders.)
-5. cmake again
-6. rebuild.
+### 1) Download the sources
+
+You can get the sources either using git (recommended) or downloading them manually.
+
+#### download with git (recommended)
+
+1. open a terminal inside your `azerothcore-wotlk` folder
+2. go inside the **modules** folder: `cd modules`
+3. download the module sources using:
+```
+git clone https://github.com/azerothcore/mod-eluna-lua-engine.git
+```
+4. go inside the **mod-eluna-lua-engine** folder: `cd mod-eluna-lua-engine`
+5. download the Eluna sources using `git submodule update --init`
+
+Optional: if you need to update Eluna to the latest version, you can `cd LuaEngine` and run `git pull` from there.
+
+#### download manually
+
+1. download [mod-eluna-lua-engine](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
+2. extract it move the folder **mod-eluna-lua-engine** inside the **modules** folder of your azerothcore-wotlk sources
+3. download [Eluna](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
+4. extract it and move all the files inside the `Eluna-master` folder into the `mod-eluna-lua-engine/LuaEngine` folder. `LuaEngine.h` needs to be directly under `mod-eluna-lua-engine/LuaEngine` without any extra sub-folders.
+
+### 2) Build
+
+You need to run the cmake again and and rebuild the project.
Eluna API :
[http://elunaluaengine.github.io/](http://elunaluaengine.github.io/)
From 605f43b8adbeae16255ea659d398272805726f4b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Thu, 3 Dec 2020 09:46:55 +0100
Subject: [PATCH 056/112] fix: update Eluna (#36)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index f117491..6d7ab9c 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit f117491095ca29b55227717af84cd7d4257426c9
+Subproject commit 6d7ab9c35efa323d9b432276e7f71b277ce7d139
From fce22f208500973e6696cee05e38b5097092c977 Mon Sep 17 00:00:00 2001
From: Helias
Date: Sat, 27 Mar 2021 12:41:01 +0100
Subject: [PATCH 057/112] chore: update submodule
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 6d7ab9c..8f5c469 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 6d7ab9c35efa323d9b432276e7f71b277ce7d139
+Subproject commit 8f5c4699b2531c408b615f55270541a7267c742b
From cfc557a6751c54906ce4c03457d0a79fb9fdb251 Mon Sep 17 00:00:00 2001
From: Helias
Date: Sat, 17 Apr 2021 15:21:23 +0200
Subject: [PATCH 058/112] fix: build, update LuaEngine
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 8f5c469..ca5f1bb 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 8f5c4699b2531c408b615f55270541a7267c742b
+Subproject commit ca5f1bb59dd0abc5d61a65a56415f5703eaede74
From 6aa494f4b38fd1413e5c0f297aa6fa600f519cea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Mon, 26 Apr 2021 22:02:57 +0200
Subject: [PATCH 059/112] feat: update to latest Eluna (#41)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index ca5f1bb..2962d4f 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit ca5f1bb59dd0abc5d61a65a56415f5703eaede74
+Subproject commit 2962d4fea3708cf22964d1cc750290b8980b313f
From bb18a86cee8ab9d22b09ff4cb47ecedbb5c128d5 Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Wed, 12 May 2021 17:46:06 +0800
Subject: [PATCH 060/112] remove 'ObjectGuid.h', AC already supports
ObjectGuid.
---
cmake/after_gs_install.cmake | 1 -
src/ObjectGuid.h | 92 ------------------------------------
2 files changed, 93 deletions(-)
delete mode 100644 src/ObjectGuid.h
diff --git a/cmake/after_gs_install.cmake b/cmake/after_gs_install.cmake
index 5dc331d..de63c48 100644
--- a/cmake/after_gs_install.cmake
+++ b/cmake/after_gs_install.cmake
@@ -2,7 +2,6 @@ set(PUBLIC_INCLUDES
${PUBLIC_INCLUDES}
${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}/src
)
target_include_directories(game-interface
diff --git a/src/ObjectGuid.h b/src/ObjectGuid.h
deleted file mode 100644
index 7a6e3a3..0000000
--- a/src/ObjectGuid.h
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifndef ObjectGuid_h__
-#define ObjectGuid_h__
-
-#include "ObjectDefines.h"
-
-class ObjectGuid
-{
-public:
- ObjectGuid() : _guid(0) { }
-
- ObjectGuid(uint64 guid) : _guid(guid) { }
-
- operator uint64() const { return _guid; }
-
- void Set(uint64 guid) { _guid = guid; }
- void Clear() { _guid = 0; }
-
- HighGuid GetHigh() const { return HighGuid((_guid >> 48) & 0x0000FFFF); }
- uint32 GetEntry() const { return HasEntry() ? uint32((_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; }
- uint32 GetCounter() const
- {
- return HasEntry()
- ? uint32(_guid & UI64LIT(0x0000000000FFFFFF))
- : uint32(_guid & UI64LIT(0x00000000FFFFFFFF));
- }
-
- static uint32 GetMaxCounter(HighGuid high)
- {
- return HasEntry(high)
- ? uint32(0x00FFFFFF)
- : uint32(0xFFFFFFFF);
- }
-
- uint32 GetMaxCounter() const { return GetMaxCounter(GetHigh()); }
-
- bool IsEmpty() const { return _guid == 0; }
- bool IsCreature() const { return GetHigh() == HIGHGUID_UNIT; }
- bool IsPet() const { return GetHigh() == HIGHGUID_PET; }
- bool IsVehicle() const { return GetHigh() == HIGHGUID_VEHICLE; }
- bool IsCreatureOrPet() const { return IsCreature() || IsPet(); }
- bool IsCreatureOrVehicle() const { return IsCreature() || IsVehicle(); }
- bool IsAnyTypeCreature() const { return IsCreature() || IsPet() || IsVehicle(); }
- bool IsPlayer() const { return !IsEmpty() && GetHigh() == HIGHGUID_PLAYER; }
- bool IsUnit() const { return IsAnyTypeCreature() || IsPlayer(); }
- bool IsItem() const { return GetHigh() == HIGHGUID_ITEM; }
- bool IsGameObject() const { return GetHigh() == HIGHGUID_GAMEOBJECT; }
- bool IsDynamicObject() const { return GetHigh() == HIGHGUID_DYNAMICOBJECT; }
- bool IsCorpse() const { return GetHigh() == HIGHGUID_CORPSE; }
- bool IsTransport() const { return GetHigh() == HIGHGUID_TRANSPORT; }
- bool IsMOTransport() const { return GetHigh() == HIGHGUID_MO_TRANSPORT; }
- bool IsAnyTypeGameObject() const { return IsGameObject() || IsTransport() || IsMOTransport(); }
- bool IsInstance() const { return GetHigh() == HIGHGUID_INSTANCE; }
- bool IsGroup() const { return GetHigh() == HIGHGUID_GROUP; }
-
- bool operator!() const { return IsEmpty(); }
-
- char const* GetTypeName() { return GetLogNameForGuid(_guid); }
- char const* GetTypeName() const { return !IsEmpty() ? GetTypeName() : "None"; }
-
-private:
- static bool HasEntry(HighGuid high)
- {
- switch (high)
- {
- case HIGHGUID_ITEM:
- case HIGHGUID_PLAYER:
- case HIGHGUID_DYNAMICOBJECT:
- case HIGHGUID_CORPSE:
- case HIGHGUID_MO_TRANSPORT:
- case HIGHGUID_INSTANCE:
- case HIGHGUID_GROUP:
- return false;
- case HIGHGUID_GAMEOBJECT:
- case HIGHGUID_TRANSPORT:
- case HIGHGUID_UNIT:
- case HIGHGUID_PET:
- case HIGHGUID_VEHICLE:
- default:
- return true;
- }
- }
-
- bool HasEntry() const { return HasEntry(GetHigh()); }
-
- explicit ObjectGuid(uint32 const&) = delete; // no implementation, used to catch wrong type assignment
- ObjectGuid(HighGuid, uint32, uint64 counter) = delete; // no implementation, used to catch wrong type assignment
- ObjectGuid(HighGuid, uint64 counter) = delete; // no implementation, used to catch wrong type assignment
-
- uint64 _guid;
-};
-
-#endif // ObjectGuid_h__
\ No newline at end of file
From 10f5840d2fb063f9d9ca57af280b7bd2c61d8b99 Mon Sep 17 00:00:00 2001
From: Kargatum
Date: Thu, 13 May 2021 14:21:14 +0700
Subject: [PATCH 061/112] feat(CI): set only default version clang (#43)
---
.github/workflows/core_build.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml
index 7e43788..34d5439 100644
--- a/.github/workflows/core_build.yml
+++ b/.github/workflows/core_build.yml
@@ -8,8 +8,8 @@ jobs:
strategy:
fail-fast: false
matrix:
- compiler: [clang6, clang9, clang10]
- runs-on: ubuntu-20.04
+ compiler: [clang]
+ runs-on: ubuntu-latest
name: ${{ matrix.compiler }}
env:
COMPILER: ${{ matrix.compiler }}
From 87b2426fa519d02297e2e385fa2164a40c0df90a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Mon, 31 May 2021 18:46:19 +0200
Subject: [PATCH 062/112] feat: update to latest Eluna (#46)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 2962d4f..841ddd4 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 2962d4fea3708cf22964d1cc750290b8980b313f
+Subproject commit 841ddd4db713750d52546b7b3814a992d1793319
From d3003fae9beff968d0826674d6bc59fec0f1b5bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Thu, 3 Jun 2021 14:51:42 +0200
Subject: [PATCH 063/112] feat: update to latest Eluna (#47)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 841ddd4..dbf6ed9 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 841ddd4db713750d52546b7b3814a992d1793319
+Subproject commit dbf6ed96f149420bec8f35a66e7dca31a324555f
From 81548013dc0748c1aeb15179fed6b7fe861b64bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Sat, 5 Jun 2021 13:53:24 +0200
Subject: [PATCH 064/112] feat: update to latest Eluna (#48)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index dbf6ed9..2861199 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit dbf6ed96f149420bec8f35a66e7dca31a324555f
+Subproject commit 286119950f6f1bd82cfc50886da9ebda6e0a8b0c
From 4766cec9b7d0151971b6de1e31f3e8c4c5eee365 Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Mon, 21 Jun 2021 00:09:58 +0800
Subject: [PATCH 065/112] Update README_CN.md
---
README_CN.md | 50 ++++++++++++++++++++++++++++++++++++--------------
1 file changed, 36 insertions(+), 14 deletions(-)
diff --git a/README_CN.md b/README_CN.md
index 8e21a58..a3f0a31 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -1,20 +1,42 @@
-# mod-LuaEngine
+
+#  mod-eluna-lua-engine for AzerothCore
+- Latest build status with azerothcore: [](https://github.com/azerothcore/mod-eluna-lua-engine)
+
[english](README.md) | [中文说明](README_CN.md) | [Español](README_ES.md)
-一个用于AzerothCore的ELUNA模块.
+一个用于Azerothcore的[Eluna](https://github.com/ElunaLuaEngine/Eluna)模块.
-如何安装:
+## 如何安装:
+
+### 1) 下载源码
+
+你可以使用git(推荐)或手动下载源代码的方法安装。
+
+#### 使用git(推荐)下载
+
+1. 在你的`azerothcore-wotlk`源码文件夹中打开命令行(win的用户进入目录后shift+鼠标右键可以通过右键菜单打开)
+2. 进入 **modules** 文件夹,命令行中输入: `cd modules`
+3. 下载模块源码:
+```
+git clone https://github.com/azerothcore/mod-eluna-lua-engine.git
+```
+4. 下载模块源码后进入文件夹 **mod-eluna-lua-engine**,命令行中输入: `cd mod-eluna-lua-engine`
+5. 下载Eluna源码,命令行中输入: `git submodule update --init`
+
+可选: 模块中集成的Eluna是稳定版本,如果你要更新Eluna到最新版本,你可以进入目录**LuaEngine**(命令行输入:`cd LuaEngine`),进入后输入`git pull`获取即可更新最新版本.
+请注意,最新版本可能和稳定版的源码不匹配.视情况可能需要自行修正.
+
+#### 手动下载
+
+1. 下载 [mod-eluna-lua-engine](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
+2. 解压到你的`azerothcore-wotlk`源码中的**modules**文件夹中,请确保路径看起来是这样的`azerothcore-wotlk/modules/mod-eluna-lua-engine`
+3. 下载 [Eluna](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
+4. 把文件解压到 `mod-eluna-lua-engine/LuaEngine`. `LuaEngine.h`这个文件的路径看起来应该是这样的`mod-eluna-lua-engine/LuaEngine/LuaEngine.h`.
+
+### 2) 生成
+
+你需要重新CMake并重新生成你的项目.
-1. 下载或者克隆这个模块:
-> [下载zip压缩包](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
-> 或者克隆 `git clone https://github.com/azerothcore/mod-eluna-lua-engine.git`
-2. 解压并放到Azerothcore源码的modules文件夹中.
-3. 下载或者克隆ELUNA的核心文件:
-> [download zip file.](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
-> clone `git clone https://github.com/ElunaLuaEngine/Eluna.git`
-4. 解压并放置到模块的LuaEngine文件夹中:mod-LuaEngine/LuaEngine(如果下载了zip文件,你需要将`Eluna-master`文件夹中的所有文件移动到`mod-eluna-lua-engine/LuaEngine`文件夹中。`LuaEngine.h`需要直接位于目录:`mod-eluna-lua-engine/LuaEngine`之下,不要有任何的子文件夹。)
-5. 重新cmake.
-6. 重新生成.
Eluna API :
-[http://elunaluaengine.github.io/](http://elunaluaengine.github.io/)
\ No newline at end of file
+[http://elunaluaengine.github.io/](http://elunaluaengine.github.io/)
From 982cbfa1c36292e12c25644fc10e51d4e1df8bfb Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Mon, 21 Jun 2021 00:14:19 +0800
Subject: [PATCH 066/112] Fixed log not showing.
---
conf/mod_LuaEngine.conf.dist | 89 ++++++++++++++++++++++++++++++++++++
1 file changed, 89 insertions(+)
diff --git a/conf/mod_LuaEngine.conf.dist b/conf/mod_LuaEngine.conf.dist
index d3490f0..0fd798c 100644
--- a/conf/mod_LuaEngine.conf.dist
+++ b/conf/mod_LuaEngine.conf.dist
@@ -23,3 +23,92 @@
Eluna.Enabled = true
Eluna.TraceBack = false
Eluna.ScriptPath = "lua_scripts"
+
+
+###################################################################################################
+# LOGGING SYSTEM SETTINGS
+#
+# Appender config values: Given an appender "name"
+# Appender.name
+# Description: Defines 'where to log'.
+# Format: Type,LogLevel,Flags,optional1,optional2,optional3
+#
+# Type
+# 0 - (None)
+# 1 - (Console)
+# 2 - (File)
+# 3 - (DB)
+#
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Fatal)
+# 2 - (Error)
+# 3 - (Warning)
+# 4 - (Info)
+# 5 - (Debug)
+# 6 - (Trace)
+#
+# Flags:
+# 0 - None
+# 1 - Prefix Timestamp to the text
+# 2 - Prefix Log Level to the text
+# 4 - Prefix Log Filter type to the text
+# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS
+# (Only used with Type = 2)
+# 16 - Make a backup of existing file before overwrite
+# (Only used with Mode = w)
+#
+# Colors (read as optional1 if Type = Console)
+# Format: "fatal error warn info debug trace"
+# 0 - BLACK
+# 1 - RED
+# 2 - GREEN
+# 3 - BROWN
+# 4 - BLUE
+# 5 - MAGENTA
+# 6 - CYAN
+# 7 - GREY
+# 8 - YELLOW
+# 9 - LRED
+# 10 - LGREEN
+# 11 - LBLUE
+# 12 - LMAGENTA
+# 13 - LCYAN
+# 14 - WHITE
+# Example: "1 9 3 6 5 8"
+#
+# File: Name of the file (read as optional1 if Type = File)
+# Allows to use one "%s" to create dynamic files
+#
+# Mode: Mode to open the file (read as optional2 if Type = File)
+# a - (Append)
+# w - (Overwrite)
+#
+# MaxFileSize: Maximum file size of the log file before creating a new log file
+# (read as optional3 if Type = File)
+# Size is measured in bytes expressed in a 64-bit unsigned integer.
+# Maximum value is 4294967295 (4 GB). Leave blank for no limit.
+# NOTE: Does not work with dynamic filenames.
+# Example: 536870912 (512 MB)
+#
+Appender.ElunaLog=2,5,0,eluna.log,w
+Appender.ElunaConsole=1,4,0,"0 9 0 3 5 0"
+
+# Logger config values: Given a logger "name"
+# Logger.name
+# Description: Defines 'What to log'
+# Format: LogLevel,AppenderList
+#
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Fatal)
+# 2 - (Error)
+# 3 - (Warning)
+# 4 - (Info)
+# 5 - (Debug)
+# 6 - (Trace)
+#
+# AppenderList: List of appenders linked to logger
+# (Using spaces as separator).
+#
+Logger.eluna=6,ElunaLog ElunaConsole
From edabf159367bcd88bf6a81f39961a317c270eb55 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Sat, 26 Jun 2021 01:35:59 +0200
Subject: [PATCH 067/112] feat: update to latest Eluna (#50)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 2861199..89ee3b1 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 286119950f6f1bd82cfc50886da9ebda6e0a8b0c
+Subproject commit 89ee3b166e9b3d247cd77d4128e400bbd052833d
From 888430dff40d6b8a0f7ff67b13fec0b6457d60d3 Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Fri, 2 Jul 2021 22:05:13 +0800
Subject: [PATCH 068/112] Update README_CN.md
---
README_CN.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README_CN.md b/README_CN.md
index a3f0a31..ec2b68a 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -1,6 +1,6 @@
#  mod-eluna-lua-engine for AzerothCore
-- Latest build status with azerothcore: [](https://github.com/azerothcore/mod-eluna-lua-engine)
+- 最新版本在Azerothcore的构建状态: [](https://github.com/azerothcore/mod-eluna-lua-engine)
[english](README.md) | [中文说明](README_CN.md) | [Español](README_ES.md)
From 6d13edfb5113fcd325e894cef1c97c22ca589312 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Fri, 16 Jul 2021 14:41:52 +0200
Subject: [PATCH 069/112] feat: update to latest Eluna (#51)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 89ee3b1..f9aaee3 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 89ee3b166e9b3d247cd77d4128e400bbd052833d
+Subproject commit f9aaee345ba6600bd068b530bc46c3619135b4f9
From 506a1ac522ce8b6e66d60a8d897422079036d366 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Wed, 25 Aug 2021 12:40:24 +0200
Subject: [PATCH 070/112] feat: update to latest Eluna (#52)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index f9aaee3..a6a7553 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit f9aaee345ba6600bd068b530bc46c3619135b4f9
+Subproject commit a6a75531620b0d27935ecde2bcb7b54e526f1ba6
From 3b943f78c6b6e21c80c6f400a64cf5ce14919622 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Wed, 15 Sep 2021 12:52:01 +0200
Subject: [PATCH 071/112] feat: update to latest Eluna (#55)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index a6a7553..c76bc5d 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit a6a75531620b0d27935ecde2bcb7b54e526f1ba6
+Subproject commit c76bc5d0983bcab60842b8d9aef40a9ae50a2638
From e45a79958a748a5c4c9f88d43846c37e643e3a91 Mon Sep 17 00:00:00 2001
From: UltraNix
Date: Sat, 25 Sep 2021 19:23:32 +0200
Subject: [PATCH 072/112] New player event: PLAYER_EVENT_ON_PET_ADDED_TO_WORLD
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index c76bc5d..a137f30 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit c76bc5d0983bcab60842b8d9aef40a9ae50a2638
+Subproject commit a137f30e6de475ccf0dbdd9cf99ef503ba75c665
From 2e3fd3941c5955ac2e13dfb458862075a6dde2ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Mon, 4 Oct 2021 16:52:55 +0200
Subject: [PATCH 073/112] fix: restore latest Eluna master (#59)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index a137f30..b12521e 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit a137f30e6de475ccf0dbdd9cf99ef503ba75c665
+Subproject commit b12521e587f9fa382b43ea17dc75f09bc253e895
From ab11bd6569fa64f6650ca59e45f8f7a02b162100 Mon Sep 17 00:00:00 2001
From: Axel Cocat
Date: Fri, 8 Oct 2021 13:48:00 +0200
Subject: [PATCH 074/112] feat: change LuaEngine submodule to AzerothCore's
fork (#60)
---
.gitmodules | 2 +-
LuaEngine | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.gitmodules b/.gitmodules
index daac882..8e2b3f1 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,4 @@
[submodule "LuaEngine"]
path = LuaEngine
- url = https://github.com/ElunaLuaEngine/Eluna.git
+ url = https://github.com/azerothcore/Eluna.git
branch = master
diff --git a/LuaEngine b/LuaEngine
index b12521e..63b2b84 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit b12521e587f9fa382b43ea17dc75f09bc253e895
+Subproject commit 63b2b84e8bafcc1268bdef4f31df10e53b29b725
From 2858534e35ee3aff6ff06ca62f726f463b8be4b0 Mon Sep 17 00:00:00 2001
From: Axel Cocat
Date: Fri, 8 Oct 2021 16:40:48 +0200
Subject: [PATCH 075/112] feat: update to latest Eluna (#61)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 63b2b84..a3f1218 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 63b2b84e8bafcc1268bdef4f31df10e53b29b725
+Subproject commit a3f12188b8823024f0d210ea90aa92d101c6acc4
From 9ac67c412084f877e267c08020663b01b779ce47 Mon Sep 17 00:00:00 2001
From: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
Date: Thu, 14 Oct 2021 19:28:43 +0200
Subject: [PATCH 076/112] Update eluna to LuaEngine
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index a3f1218..f18b282 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit a3f12188b8823024f0d210ea90aa92d101c6acc4
+Subproject commit f18b282a9cf957f1cc7f8aac3616709c71c70a0d
From 126f7ebf5327c472a627a579431f6c26d335e4b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Fri, 15 Oct 2021 11:48:34 +0200
Subject: [PATCH 077/112] fix: update to latest eluna (#63)
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index f18b282..c0b8e21 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit f18b282a9cf957f1cc7f8aac3616709c71c70a0d
+Subproject commit c0b8e217287dfe87a910922e1c029810509f974c
From 90e783dfc5d7d9b50a7cc92a19fc45b857003ec9 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Tue, 19 Oct 2021 13:04:00 +0200
Subject: [PATCH 078/112] docs(README): update Eluna link (#64)
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a9a394a..89b5c91 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ Optional: if you need to update Eluna to the latest version, you can `cd LuaEngi
1. download [mod-eluna-lua-engine](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
2. extract it move the folder **mod-eluna-lua-engine** inside the **modules** folder of your azerothcore-wotlk sources
-3. download [Eluna](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
+3. download [Eluna](https://github.com/Azerothcore/Eluna/archive/master.zip)
4. extract it and move all the files inside the `Eluna-master` folder into the `mod-eluna-lua-engine/LuaEngine` folder. `LuaEngine.h` needs to be directly under `mod-eluna-lua-engine/LuaEngine` without any extra sub-folders.
### 2) Build
From de4ea7469b44d627e41d55b36fa88b4f0ff1cefe Mon Sep 17 00:00:00 2001
From: Winfidonarleyan
Date: Fri, 22 Oct 2021 22:52:08 +0700
Subject: [PATCH 079/112] feat(Misc): update LuaEngine to
cccf0623ee42107f6e9de54c9ffcf1ba12a7d259
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index c0b8e21..cccf062 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit c0b8e217287dfe87a910922e1c029810509f974c
+Subproject commit cccf0623ee42107f6e9de54c9ffcf1ba12a7d259
From 8f159c7e94241057007e1a39101d507d4553f05a Mon Sep 17 00:00:00 2001
From: ayase <137056643@qq.com>
Date: Sat, 23 Oct 2021 11:10:55 +0800
Subject: [PATCH 080/112] Update README_CN.md
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
更改下载eluna的链接,添加中文文档地址
---
README_CN.md | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/README_CN.md b/README_CN.md
index ec2b68a..36a7152 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -30,7 +30,7 @@ git clone https://github.com/azerothcore/mod-eluna-lua-engine.git
1. 下载 [mod-eluna-lua-engine](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
2. 解压到你的`azerothcore-wotlk`源码中的**modules**文件夹中,请确保路径看起来是这样的`azerothcore-wotlk/modules/mod-eluna-lua-engine`
-3. 下载 [Eluna](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
+3. 下载 [Eluna](https://github.com/azerothcore/Eluna/archive/master.zip)
4. 把文件解压到 `mod-eluna-lua-engine/LuaEngine`. `LuaEngine.h`这个文件的路径看起来应该是这样的`mod-eluna-lua-engine/LuaEngine/LuaEngine.h`.
### 2) 生成
@@ -40,3 +40,6 @@ git clone https://github.com/azerothcore/mod-eluna-lua-engine.git
Eluna API :
[http://elunaluaengine.github.io/](http://elunaluaengine.github.io/)
+Eluna 中文文档(重构):
+[http://wiki.uiwow.com/doku.php/eluna:start](http://wiki.uiwow.com/doku.php/eluna:start)
+
From c47fedf9db0d7aed6248ca84d8591e85af08af59 Mon Sep 17 00:00:00 2001
From: fborzi
Date: Mon, 1 Nov 2021 12:33:59 +0100
Subject: [PATCH 081/112] feat(Eluna): update to latest Eluna
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index cccf062..437ab62 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit cccf0623ee42107f6e9de54c9ffcf1ba12a7d259
+Subproject commit 437ab629969ece89d8add3ac74e1e67e491370fc
From 5e7e1eec349f673d795b07ca0c3893c692dbde81 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Fri, 5 Nov 2021 09:25:34 +0100
Subject: [PATCH 082/112] feat: update to latest Eluna
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index 437ab62..df8b3ef 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit 437ab629969ece89d8add3ac74e1e67e491370fc
+Subproject commit df8b3efbbe2092fab76d86211140037839e2cba0
From 302cb7ee2606e5fe6b769726639620e4149e6cab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Sun, 14 Nov 2021 20:59:29 +0100
Subject: [PATCH 083/112] docs(README): add Eluna update procedure (#68)
---
README.md | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/README.md b/README.md
index 89b5c91..733d7e8 100644
--- a/README.md
+++ b/README.md
@@ -37,3 +37,18 @@ You need to run the cmake again and and rebuild the project.
Eluna API :
[http://elunaluaengine.github.io/](http://elunaluaengine.github.io/)
+
+## How to update the Eluna version (for project mainteners)
+
+1) `cd` into `mod-eluna-lua-engine`
+2) `git checkout master`
+3) cd `LuaEngine`
+4) `git checkout master`
+5) `git pull`
+6) `cd ..` so you get back to `mod-eluna-lua-engine`
+7) `git checkout -b some-new-unique-branch-name`
+8) `git add LuaEngine`
+9) `git commit -m "feat: update Eluna version"`
+10) `git push`
+11) The terminal will tell you something like `fatal: The current branch some-new-unique-branch-name has no upstream branch.` and suggest the command to use, for example: `git push --set-upstream origin some-new-unique-branch-name`
+12) Open [the repo on Github](https://github.com/azerothcore/mod-eluna-lua-engine) and create a new PR
From b7717d5020f75fbbcc628102c982d4ebb8cc58dc Mon Sep 17 00:00:00 2001
From: fborzi
Date: Sun, 14 Nov 2021 21:01:35 +0100
Subject: [PATCH 084/112] feat: update to latest Eluna
---
LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LuaEngine b/LuaEngine
index df8b3ef..ccf3372 160000
--- a/LuaEngine
+++ b/LuaEngine
@@ -1 +1 @@
-Subproject commit df8b3efbbe2092fab76d86211140037839e2cba0
+Subproject commit ccf337262c2573f345e54b2973678f5dbf282aa2
From 1c1e17e578b1ff7df24a4d350c4dcf261fa48094 Mon Sep 17 00:00:00 2001
From: Kargatum
Date: Thu, 2 Dec 2021 20:29:13 +0700
Subject: [PATCH 085/112] feat(Misc): add support new modules loading api (#71)
---
.gitmodules | 2 +-
CMakeLists.txt | 2 -
cmake/after_gs_install.cmake | 28 -
cmake/after_load_cmake_modules.cmake | 12 -
cmake/before_gs_install.cmake | 13 -
src/ElunaLuaEngine_SC.cpp | 943 ++++++++++++++++++++++++++
LuaEngine => src/LuaEngine | 0
src/eluna_lua_engine_loader.cpp | 25 +
{lualib => src/lualib}/CMakeLists.txt | 0
{lualib => src/lualib}/lapi.c | 0
{lualib => src/lualib}/lapi.h | 0
{lualib => src/lualib}/lauxlib.c | 0
{lualib => src/lualib}/lauxlib.h | 0
{lualib => src/lualib}/lbaselib.c | 0
{lualib => src/lualib}/lbitlib.c | 0
{lualib => src/lualib}/lcode.c | 0
{lualib => src/lualib}/lcode.h | 0
{lualib => src/lualib}/lcorolib.c | 0
{lualib => src/lualib}/lctype.c | 0
{lualib => src/lualib}/lctype.h | 0
{lualib => src/lualib}/ldblib.c | 0
{lualib => src/lualib}/ldebug.c | 0
{lualib => src/lualib}/ldebug.h | 0
{lualib => src/lualib}/ldo.c | 0
{lualib => src/lualib}/ldo.h | 0
{lualib => src/lualib}/ldump.c | 0
{lualib => src/lualib}/lfunc.c | 0
{lualib => src/lualib}/lfunc.h | 0
{lualib => src/lualib}/lgc.c | 0
{lualib => src/lualib}/lgc.h | 0
{lualib => src/lualib}/linit.c | 0
{lualib => src/lualib}/liolib.c | 0
{lualib => src/lualib}/llex.c | 0
{lualib => src/lualib}/llex.h | 0
{lualib => src/lualib}/llimits.h | 0
{lualib => src/lualib}/lmathlib.c | 0
{lualib => src/lualib}/lmem.c | 0
{lualib => src/lualib}/lmem.h | 0
{lualib => src/lualib}/loadlib.c | 0
{lualib => src/lualib}/lobject.c | 0
{lualib => src/lualib}/lobject.h | 0
{lualib => src/lualib}/lopcodes.c | 0
{lualib => src/lualib}/lopcodes.h | 0
{lualib => src/lualib}/loslib.c | 0
{lualib => src/lualib}/lparser.c | 0
{lualib => src/lualib}/lparser.h | 0
{lualib => src/lualib}/lstate.c | 0
{lualib => src/lualib}/lstate.h | 0
{lualib => src/lualib}/lstring.c | 0
{lualib => src/lualib}/lstring.h | 0
{lualib => src/lualib}/lstrlib.c | 0
{lualib => src/lualib}/ltable.c | 0
{lualib => src/lualib}/ltable.h | 0
{lualib => src/lualib}/ltablib.c | 0
{lualib => src/lualib}/ltm.c | 0
{lualib => src/lualib}/ltm.h | 0
{lualib => src/lualib}/lua.c | 0
{lualib => src/lualib}/lua.h | 0
{lualib => src/lualib}/lua.hpp | 0
{lualib => src/lualib}/luac.c | 0
{lualib => src/lualib}/luaconf.h | 0
{lualib => src/lualib}/lualib.h | 0
{lualib => src/lualib}/lundump.c | 0
{lualib => src/lualib}/lundump.h | 0
{lualib => src/lualib}/lvm.c | 0
{lualib => src/lualib}/lvm.h | 0
{lualib => src/lualib}/lzio.c | 0
{lualib => src/lualib}/lzio.h | 0
68 files changed, 969 insertions(+), 56 deletions(-)
delete mode 100644 CMakeLists.txt
delete mode 100644 cmake/after_gs_install.cmake
delete mode 100644 cmake/after_load_cmake_modules.cmake
delete mode 100644 cmake/before_gs_install.cmake
create mode 100644 src/ElunaLuaEngine_SC.cpp
rename LuaEngine => src/LuaEngine (100%)
create mode 100644 src/eluna_lua_engine_loader.cpp
rename {lualib => src/lualib}/CMakeLists.txt (100%)
rename {lualib => src/lualib}/lapi.c (100%)
rename {lualib => src/lualib}/lapi.h (100%)
rename {lualib => src/lualib}/lauxlib.c (100%)
rename {lualib => src/lualib}/lauxlib.h (100%)
rename {lualib => src/lualib}/lbaselib.c (100%)
rename {lualib => src/lualib}/lbitlib.c (100%)
rename {lualib => src/lualib}/lcode.c (100%)
rename {lualib => src/lualib}/lcode.h (100%)
rename {lualib => src/lualib}/lcorolib.c (100%)
rename {lualib => src/lualib}/lctype.c (100%)
rename {lualib => src/lualib}/lctype.h (100%)
rename {lualib => src/lualib}/ldblib.c (100%)
rename {lualib => src/lualib}/ldebug.c (100%)
rename {lualib => src/lualib}/ldebug.h (100%)
rename {lualib => src/lualib}/ldo.c (100%)
rename {lualib => src/lualib}/ldo.h (100%)
rename {lualib => src/lualib}/ldump.c (100%)
rename {lualib => src/lualib}/lfunc.c (100%)
rename {lualib => src/lualib}/lfunc.h (100%)
rename {lualib => src/lualib}/lgc.c (100%)
rename {lualib => src/lualib}/lgc.h (100%)
rename {lualib => src/lualib}/linit.c (100%)
rename {lualib => src/lualib}/liolib.c (100%)
rename {lualib => src/lualib}/llex.c (100%)
rename {lualib => src/lualib}/llex.h (100%)
rename {lualib => src/lualib}/llimits.h (100%)
rename {lualib => src/lualib}/lmathlib.c (100%)
rename {lualib => src/lualib}/lmem.c (100%)
rename {lualib => src/lualib}/lmem.h (100%)
rename {lualib => src/lualib}/loadlib.c (100%)
rename {lualib => src/lualib}/lobject.c (100%)
rename {lualib => src/lualib}/lobject.h (100%)
rename {lualib => src/lualib}/lopcodes.c (100%)
rename {lualib => src/lualib}/lopcodes.h (100%)
rename {lualib => src/lualib}/loslib.c (100%)
rename {lualib => src/lualib}/lparser.c (100%)
rename {lualib => src/lualib}/lparser.h (100%)
rename {lualib => src/lualib}/lstate.c (100%)
rename {lualib => src/lualib}/lstate.h (100%)
rename {lualib => src/lualib}/lstring.c (100%)
rename {lualib => src/lualib}/lstring.h (100%)
rename {lualib => src/lualib}/lstrlib.c (100%)
rename {lualib => src/lualib}/ltable.c (100%)
rename {lualib => src/lualib}/ltable.h (100%)
rename {lualib => src/lualib}/ltablib.c (100%)
rename {lualib => src/lualib}/ltm.c (100%)
rename {lualib => src/lualib}/ltm.h (100%)
rename {lualib => src/lualib}/lua.c (100%)
rename {lualib => src/lualib}/lua.h (100%)
rename {lualib => src/lualib}/lua.hpp (100%)
rename {lualib => src/lualib}/luac.c (100%)
rename {lualib => src/lualib}/luaconf.h (100%)
rename {lualib => src/lualib}/lualib.h (100%)
rename {lualib => src/lualib}/lundump.c (100%)
rename {lualib => src/lualib}/lundump.h (100%)
rename {lualib => src/lualib}/lvm.c (100%)
rename {lualib => src/lualib}/lvm.h (100%)
rename {lualib => src/lualib}/lzio.c (100%)
rename {lualib => src/lualib}/lzio.h (100%)
diff --git a/.gitmodules b/.gitmodules
index 8e2b3f1..1bb8b63 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,4 @@
[submodule "LuaEngine"]
- path = LuaEngine
+ path = src/LuaEngine
url = https://github.com/azerothcore/Eluna.git
branch = master
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 54641af..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-CU_SET_PATH("CMAKE_MOD_ELUNA_ENGINE_DIR" "${CMAKE_CURRENT_LIST_DIR}")
-CU_ADD_HOOK(AFTER_LOAD_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake/after_load_cmake_modules.cmake")
diff --git a/cmake/after_gs_install.cmake b/cmake/after_gs_install.cmake
deleted file mode 100644
index de63c48..0000000
--- a/cmake/after_gs_install.cmake
+++ /dev/null
@@ -1,28 +0,0 @@
-set(PUBLIC_INCLUDES
- ${PUBLIC_INCLUDES}
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
- ${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
-)
-
-target_include_directories(game-interface
- INTERFACE
- ${PUBLIC_INCLUDES})
-
-add_dependencies(game lualib)
-
-target_link_libraries(game
- PUBLIC
- lualib)
-
-if( WIN32 )
- if (MSVC)
- set(MSVC_CONFIGURATION_NAME $(ConfigurationName)/)
- endif()
- add_custom_command(TARGET game
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/${MSVC_CONFIGURATION_NAME}lua_scripts/extensions/"
- COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/${MSVC_CONFIGURATION_NAME}lua_scripts/extensions/"
- )
-endif()
-
-install(DIRECTORY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" DESTINATION "${CMAKE_INSTALL_PREFIX}/bin/lua_scripts/")
diff --git a/cmake/after_load_cmake_modules.cmake b/cmake/after_load_cmake_modules.cmake
deleted file mode 100644
index eb7b43b..0000000
--- a/cmake/after_load_cmake_modules.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-add_subdirectory(${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib)
-
-add_definitions(-DELUNA)
-add_definitions(-DAZEROTHCORE)
-add_definitions(-DWOTLK)
-
-CU_ADD_HOOK(BEFORE_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/before_gs_install.cmake")
-CU_ADD_HOOK(AFTER_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_gs_install.cmake")
-
-AC_ADD_CONFIG_FILE("${CMAKE_MOD_ELUNA_ENGINE_DIR}/conf/mod_LuaEngine.conf.dist")
-
-message("** [Eluna Module] LuaEngine is enable!")
diff --git a/cmake/before_gs_install.cmake b/cmake/before_gs_install.cmake
deleted file mode 100644
index 95b99b0..0000000
--- a/cmake/before_gs_install.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-file(GLOB_RECURSE method_headers ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/*Methods.h)
-file(GLOB_RECURSE sources_ElunaFile_CPP ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/*.cpp )
-file(GLOB_RECURSE sources_ElunaFile_H ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/*.h)
-
-set(ElunaLuaEngineFiles
- ${ElunaLuaEngineFiles}
- ${sources_ElunaFile_H}
- ${sources_ElunaFile_CPP}
-)
-
-source_group("LuaEngine\\Methods" FILES ${method_headers})
-source_group("LuaEngine\\Header Files" FILES ${sources_ElunaFile_H})
-source_group("LuaEngine\\Source Files" FILES ${sources_ElunaFile_CPP})
diff --git a/src/ElunaLuaEngine_SC.cpp b/src/ElunaLuaEngine_SC.cpp
new file mode 100644
index 0000000..6ab9cfe
--- /dev/null
+++ b/src/ElunaLuaEngine_SC.cpp
@@ -0,0 +1,943 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "Chat.h"
+#include "ElunaEventMgr.h"
+#include "Log.h"
+#include "LuaEngine.h"
+#include "Pet.h"
+#include "Player.h"
+#include "ScriptMgr.h"
+#include "ScriptedGossip.h"
+
+class Eluna_AllCreatureScript : public AllCreatureScript
+{
+public:
+ Eluna_AllCreatureScript() : AllCreatureScript("Eluna_AllCreatureScript") { }
+
+ // Creature
+ bool CanCreatureGossipHello(Player* player, Creature* creature) override
+ {
+ if (sEluna->OnGossipHello(player, creature))
+ return true;
+
+ return false;
+ }
+
+ bool CanCreatureGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) override
+ {
+ if (sEluna->OnGossipSelect(player, creature, sender, action))
+ return true;
+
+ return false;
+ }
+
+ bool CanCreatureGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code) override
+ {
+ if (sEluna->OnGossipSelectCode(player, creature, sender, action, code))
+ return true;
+
+ return false;
+ }
+
+ void OnCreatureAddWorld(Creature* creature) override
+ {
+ sEluna->OnAddToWorld(creature);
+
+ if (creature->IsGuardian() && creature->ToTempSummon() && creature->ToTempSummon()->GetSummonerGUID().IsPlayer())
+ sEluna->OnPetAddedToWorld(creature->ToTempSummon()->GetSummonerUnit()->ToPlayer(), creature);
+ }
+
+ void OnCreatureRemoveWorld(Creature* creature) override
+ {
+ sEluna->OnRemoveFromWorld(creature);
+ }
+
+ bool CanCreatureQuestAccept(Player* player, Creature* creature, Quest const* quest) override
+ {
+ sEluna->OnQuestAccept(player, creature, quest);
+ return false;
+ }
+
+ bool CanCreatureQuestReward(Player* player, Creature* creature, Quest const* quest, uint32 opt) override
+ {
+ if (sEluna->OnQuestReward(player, creature, quest, opt))
+ {
+ ClearGossipMenuFor(player);
+ return true;
+ }
+
+ return false;
+ }
+
+ CreatureAI* GetCreatureAI(Creature* creature) const override
+ {
+ if (CreatureAI* luaAI = sEluna->GetAI(creature))
+ return luaAI;
+
+ return nullptr;
+ }
+};
+
+class Eluna_AllGameObjectScript : public AllGameObjectScript
+{
+public:
+ Eluna_AllGameObjectScript() : AllGameObjectScript("Eluna_AllGameObjectScript") { }
+
+ void OnGameObjectAddWorld(GameObject* go) override
+ {
+ sEluna->OnAddToWorld(go);
+ }
+
+ void OnGameObjectRemoveWorld(GameObject* go) override
+ {
+ sEluna->OnRemoveFromWorld(go);
+ }
+
+ void OnGameObjectUpdate(GameObject* go, uint32 diff) override
+ {
+ sEluna->UpdateAI(go, diff);
+ }
+
+ bool CanGameObjectGossipHello(Player* player, GameObject* go) override
+ {
+ if (sEluna->OnGossipHello(player, go))
+ return true;
+
+ if (sEluna->OnGameObjectUse(player, go))
+ return true;
+
+ return false;
+ }
+
+ void OnGameObjectDamaged(GameObject* go, Player* player) override
+ {
+ sEluna->OnDamaged(go, player);
+ }
+
+ void OnGameObjectDestroyed(GameObject* go, Player* player) override
+ {
+ sEluna->OnDestroyed(go, player);
+ }
+
+ void OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* /*unit*/) override
+ {
+ sEluna->OnLootStateChanged(go, state);
+ }
+
+ void OnGameObjectStateChanged(GameObject* go, uint32 state) override
+ {
+ sEluna->OnGameObjectStateChanged(go, state);
+ }
+
+ bool CanGameObjectQuestAccept(Player* player, GameObject* go, Quest const* quest) override
+ {
+ sEluna->OnQuestAccept(player, go, quest);
+ return false;
+ }
+
+ bool CanGameObjectGossipSelect(Player* player, GameObject* go, uint32 sender, uint32 action) override
+ {
+ if (sEluna->OnGossipSelect(player, go, sender, action))
+ return true;
+
+ return false;
+ }
+
+ bool CanGameObjectGossipSelectCode(Player* player, GameObject* go, uint32 sender, uint32 action, const char* code) override
+ {
+ if (sEluna->OnGossipSelectCode(player, go, sender, action, code))
+ return true;
+
+ return false;
+ }
+
+ bool CanGameObjectQuestReward(Player* player, GameObject* go, Quest const* quest, uint32 opt) override
+ {
+ if (sEluna->OnQuestAccept(player, go, quest))
+ return false;
+
+ if (sEluna->OnQuestReward(player, go, quest, opt))
+ return false;
+
+ return true;
+ }
+
+ GameObjectAI* GetGameObjectAI(GameObject* go) const override
+ {
+ sEluna->OnSpawn(go);
+ return nullptr;
+ }
+};
+
+class Eluna_AllItemScript : public AllItemScript
+{
+public:
+ Eluna_AllItemScript() : AllItemScript("Eluna_AllItemScript") { }
+
+ bool CanItemQuestAccept(Player* player, Item* item, Quest const* quest) override
+ {
+ if (sEluna->OnQuestAccept(player, item, quest))
+ return false;
+
+ return true;
+ }
+
+ bool CanItemUse(Player* player, Item* item, SpellCastTargets const& targets) override
+ {
+ if (!sEluna->OnUse(player, item, targets))
+ return true;
+
+ return false;
+ }
+
+ bool CanItemExpire(Player* player, ItemTemplate const* proto) override
+ {
+ if (sEluna->OnExpire(player, proto))
+ return false;
+
+ return true;
+ }
+
+ bool CanItemRemove(Player* player, Item* item) override
+ {
+ if (sEluna->OnRemove(player, item))
+ return false;
+
+ return true;
+ }
+
+ void OnItemGossipSelect(Player* player, Item* item, uint32 sender, uint32 action) override
+ {
+ sEluna->HandleGossipSelectOption(player, item, sender, action, "");
+ }
+
+ void OnItemGossipSelectCode(Player* player, Item* item, uint32 sender, uint32 action, const char* code) override
+ {
+ sEluna->HandleGossipSelectOption(player, item, sender, action, code);
+ }
+};
+
+class Eluna_AllMapScript : public AllMapScript
+{
+public:
+ Eluna_AllMapScript() : AllMapScript("Eluna_AllMapScript") { }
+
+ void OnBeforeCreateInstanceScript(InstanceMap* instanceMap, InstanceScript* instanceData, bool /*load*/, std::string /*data*/, uint32 /*completedEncounterMask*/) override
+ {
+ instanceData = sEluna->GetInstanceData(instanceMap);
+ }
+
+ void OnDestroyInstance(MapInstanced* /*mapInstanced*/, Map* map) override
+ {
+ sEluna->FreeInstanceId(map->GetInstanceId());
+ }
+
+ void OnCreateMap(Map* map) override
+ {
+ sEluna->OnCreate(map);
+ }
+
+ void OnDestroyMap(Map* map) override
+ {
+ sEluna->OnDestroy(map);
+ }
+
+ void OnPlayerEnterAll(Map* map, Player* player) override
+ {
+ sEluna->OnPlayerEnter(map, player);
+ }
+
+ void OnPlayerLeaveAll(Map* map, Player* player) override
+ {
+ sEluna->OnPlayerLeave(map, player);
+ }
+
+ void OnMapUpdate(Map* map, uint32 diff) override
+ {
+ sEluna->OnUpdate(map, diff);
+ }
+};
+
+class Eluna_AuctionHouseScript : public AuctionHouseScript
+{
+public:
+ Eluna_AuctionHouseScript() : AuctionHouseScript("Eluna_AuctionHouseScript") { }
+
+ void OnAuctionAdd(AuctionHouseObject* ah, AuctionEntry* entry) override
+ {
+ sEluna->OnAdd(ah, entry);
+ }
+
+ void OnAuctionRemove(AuctionHouseObject* ah, AuctionEntry* entry) override
+ {
+ sEluna->OnRemove(ah, entry);
+ }
+
+ void OnAuctionSuccessful(AuctionHouseObject* ah, AuctionEntry* entry) override
+ {
+ sEluna->OnSuccessful(ah, entry);
+ }
+
+ void OnAuctionExpire(AuctionHouseObject* ah, AuctionEntry* entry) override
+ {
+ sEluna->OnExpire(ah, entry);
+ }
+};
+
+class Eluna_BGScript : public BGScript
+{
+public:
+ Eluna_BGScript() : BGScript("Eluna_BGScript") { }
+
+ void OnBattlegroundStart(Battleground* bg) override
+ {
+ sEluna->OnBGStart(bg, bg->GetBgTypeID(), bg->GetInstanceID());
+ }
+
+ void OnBattlegroundEnd(Battleground* bg, TeamId winnerTeam) override
+ {
+ sEluna->OnBGEnd(bg, bg->GetBgTypeID(), bg->GetInstanceID(), winnerTeam);
+ }
+
+ void OnBattlegroundDestroy(Battleground* bg) override
+ {
+ sEluna->OnBGDestroy(bg, bg->GetBgTypeID(), bg->GetInstanceID());
+ }
+
+ void OnBattlegroundCreate(Battleground* bg) override
+ {
+ sEluna->OnBGCreate(bg, bg->GetBgTypeID(), bg->GetInstanceID());
+ }
+};
+
+class Eluna_CommandSC : public CommandSC
+{
+public:
+ Eluna_CommandSC() : CommandSC("Eluna_CommandSC") { }
+
+ bool CanExecuteCommand(ChatHandler& handler, std::string_view cmdStr) override
+ {
+ if (!sEluna->OnCommand(handler.IsConsole() ? nullptr : handler.GetSession()->GetPlayer(), std::string(cmdStr).c_str()))
+ {
+ return false;
+ }
+
+ return true;
+ }
+};
+
+class Eluna_ElunaScript : public ElunaScript
+{
+public:
+ Eluna_ElunaScript() : ElunaScript("Eluna_ElunaScript") { }
+
+ // Weather
+ void OnWeatherChange(Weather* weather, WeatherState state, float grade) override
+ {
+ sEluna->OnChange(weather, weather->GetZone(), state, grade);
+ }
+
+ // AreaTriger
+ bool CanAreaTrigger(Player* player, AreaTrigger const* trigger) override
+ {
+ if (sEluna->OnAreaTrigger(player, trigger))
+ return false;
+
+ return true;
+ }
+};
+
+class Eluna_GameEventScript : public GameEventScript
+{
+public:
+ Eluna_GameEventScript() : GameEventScript("Eluna_GameEventScript") { }
+
+ void OnEventStart(uint16 eventID)
+ {
+ sEluna->OnGameEventStart(eventID);
+ }
+
+ void OnEventStop(uint16 eventID)
+ {
+ sEluna->OnGameEventStop(eventID);
+ }
+};
+
+class Eluna_GroupScript : public GroupScript
+{
+public:
+ Eluna_GroupScript() : GroupScript("Eluna_GroupScript") { }
+
+ void OnAddMember(Group* group, ObjectGuid guid) override
+ {
+ sEluna->OnAddMember(group, guid);
+ }
+
+ void OnInviteMember(Group* group, ObjectGuid guid) override
+ {
+ sEluna->OnInviteMember(group, guid);
+ }
+
+ void OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid /* kicker */, const char* /* reason */) override
+ {
+ sEluna->OnRemoveMember(group, guid, method);
+ }
+
+ void OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) override
+ {
+ sEluna->OnChangeLeader(group, newLeaderGuid, oldLeaderGuid);
+ }
+
+ void OnDisband(Group* group) override
+ {
+ sEluna->OnDisband(group);
+ }
+};
+
+class Eluna_GuildScript : public GuildScript
+{
+public:
+ Eluna_GuildScript() : GuildScript("Eluna_GuildScript") { }
+
+ void OnAddMember(Guild* guild, Player* player, uint8& plRank) override
+ {
+ sEluna->OnAddMember(guild, player, plRank);
+ }
+
+ void OnRemoveMember(Guild* guild, Player* player, bool isDisbanding, bool /*isKicked*/) override
+ {
+ sEluna->OnRemoveMember(guild, player, isDisbanding);
+ }
+
+ void OnMOTDChanged(Guild* guild, const std::string& newMotd) override
+ {
+ sEluna->OnMOTDChanged(guild, newMotd);
+ }
+
+ void OnInfoChanged(Guild* guild, const std::string& newInfo) override
+ {
+ sEluna->OnInfoChanged(guild, newInfo);
+ }
+
+ void OnCreate(Guild* guild, Player* leader, const std::string& name) override
+ {
+ sEluna->OnCreate(guild, leader, name);
+ }
+
+ void OnDisband(Guild* guild) override
+ {
+ sEluna->OnDisband(guild);
+ }
+
+ void OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair) override
+ {
+ sEluna->OnMemberWitdrawMoney(guild, player, amount, isRepair);
+ }
+
+ void OnMemberDepositMoney(Guild* guild, Player* player, uint32& amount) override
+ {
+ sEluna->OnMemberDepositMoney(guild, player, amount);
+ }
+
+ void OnItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId,
+ bool isDestBank, uint8 destContainer, uint8 destSlotId) override
+ {
+ sEluna->OnItemMove(guild, player, pItem, isSrcBank, srcContainer, srcSlotId, isDestBank, destContainer, destSlotId);
+ }
+
+ void OnEvent(Guild* guild, uint8 eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2, uint8 newRank) override
+ {
+ sEluna->OnEvent(guild, eventType, playerGuid1, playerGuid2, newRank);
+ }
+
+ void OnBankEvent(Guild* guild, uint8 eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId) override
+ {
+ sEluna->OnBankEvent(guild, eventType, tabId, playerGuid, itemOrMoney, itemStackCount, destTabId);
+ }
+};
+
+class Eluna_LootScript : public LootScript
+{
+public:
+ Eluna_LootScript() : LootScript("Eluna_LootScript") { }
+
+ void OnLootMoney(Player* player, uint32 gold) override
+ {
+ sEluna->OnLootMoney(player, gold);
+ }
+};
+
+class Eluna_MiscScript : public MiscScript
+{
+public:
+ Eluna_MiscScript() : MiscScript("Eluna_MiscScript") { }
+
+ void GetDialogStatus(Player* player, Object* questgiver) override
+ {
+ if (questgiver->GetTypeId() == TYPEID_GAMEOBJECT)
+ sEluna->GetDialogStatus(player, questgiver->ToGameObject());
+ else if (questgiver->GetTypeId() == TYPEID_UNIT)
+ sEluna->GetDialogStatus(player, questgiver->ToCreature());
+ }
+};
+
+class Eluna_PetScript : public PetScript
+{
+public:
+ Eluna_PetScript() : PetScript("Eluna_PetScript") { }
+
+ void OnPetAddToWorld(Pet* pet) override
+ {
+ sEluna->OnPetAddedToWorld(pet->GetOwner(), pet);
+ }
+};
+
+class Eluna_PlayerScript : public PlayerScript
+{
+public:
+ Eluna_PlayerScript() : PlayerScript("Eluna_PlayerScript") { }
+
+ void OnPlayerResurrect(Player* player, float /*restore_percent*/, bool /*applySickness*/) override
+ {
+ sEluna->OnResurrect(player);
+ }
+
+ bool CanPlayerUseChat(Player* player, uint32 type, uint32 lang, std::string& msg) override
+ {
+ if (type != CHAT_MSG_SAY && type != CHAT_MSG_YELL && type != CHAT_MSG_EMOTE)
+ return true;
+
+ if (!sEluna->OnChat(player, type, lang, msg))
+ return false;
+
+ return true;
+ }
+
+ bool CanPlayerUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Player* target) override
+ {
+ if (!sEluna->OnChat(player, type, lang, msg, target))
+ return false;
+
+ return true;
+ }
+
+ bool CanPlayerUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) override
+ {
+ if (!sEluna->OnChat(player, type, lang, msg, group))
+ return false;
+
+ return true;
+ }
+
+ bool CanPlayerUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild) override
+ {
+ if (!sEluna->OnChat(player, type, lang, msg, guild))
+ return false;
+
+ return true;
+ }
+
+ bool CanPlayerUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Channel* channel) override
+ {
+ if (!sEluna->OnChat(player, type, lang, msg, channel))
+ return false;
+
+ return true;
+ }
+
+ void OnLootItem(Player* player, Item* item, uint32 count, ObjectGuid lootguid) override
+ {
+ sEluna->OnLootItem(player, item, count, lootguid);
+ }
+
+ void OnPlayerLearnTalents(Player* player, uint32 talentId, uint32 talentRank, uint32 spellid) override
+ {
+ sEluna->OnLearnTalents(player, talentId, talentRank, spellid);
+ }
+
+ bool CanUseItem(Player* player, ItemTemplate const* proto, InventoryResult& result) override
+ {
+ result = sEluna->OnCanUseItem(player, proto->ItemId);
+ return result != EQUIP_ERR_OK ? false : true;
+ }
+
+ void OnEquip(Player* player, Item* it, uint8 bag, uint8 slot, bool /*update*/) override
+ {
+ sEluna->OnEquip(player, it, bag, slot);
+ }
+
+ void OnPlayerEnterCombat(Player* player, Unit* enemy) override
+ {
+ sEluna->OnPlayerEnterCombat(player, enemy);
+ }
+
+ void OnPlayerLeaveCombat(Player* player) override
+ {
+ sEluna->OnPlayerLeaveCombat(player);
+ }
+
+ bool CanRepopAtGraveyard(Player* player) override
+ {
+ sEluna->OnRepop(player);
+ return true;
+ }
+
+ void OnQuestAbandon(Player* player, uint32 questId) override
+ {
+ sEluna->OnQuestAbandon(player, questId);
+ }
+
+ void OnMapChanged(Player* player) override
+ {
+ sEluna->OnMapChanged(player);
+ }
+
+ void OnGossipSelect(Player* player, uint32 menu_id, uint32 sender, uint32 action) override
+ {
+ sEluna->HandleGossipSelectOption(player, menu_id, sender, action, "");
+ }
+
+ void OnGossipSelectCode(Player* player, uint32 menu_id, uint32 sender, uint32 action, const char* code) override
+ {
+ sEluna->HandleGossipSelectOption(player, menu_id, sender, action, code);
+ }
+
+ void OnPVPKill(Player* killer, Player* killed) override
+ {
+ sEluna->OnPVPKill(killer, killed);
+ }
+
+ void OnCreatureKill(Player* killer, Creature* killed) override
+ {
+ sEluna->OnCreatureKill(killer, killed);
+ }
+
+ void OnPlayerKilledByCreature(Creature* killer, Player* killed) override
+ {
+ sEluna->OnPlayerKilledByCreature(killer, killed);
+ }
+
+ void OnLevelChanged(Player* player, uint8 oldLevel) override
+ {
+ sEluna->OnLevelChanged(player, oldLevel);
+ }
+
+ void OnFreeTalentPointsChanged(Player* player, uint32 points) override
+ {
+ sEluna->OnFreeTalentPointsChanged(player, points);
+ }
+
+ void OnTalentsReset(Player* player, bool noCost) override
+ {
+ sEluna->OnTalentsReset(player, noCost);
+ }
+
+ void OnMoneyChanged(Player* player, int32& amount) override
+ {
+ sEluna->OnMoneyChanged(player, amount);
+ }
+
+ void OnGiveXP(Player* player, uint32& amount, Unit* victim) override
+ {
+ sEluna->OnGiveXP(player, amount, victim);
+ }
+
+ void OnReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental) override
+ {
+ sEluna->OnReputationChange(player, factionID, standing, incremental);
+ }
+
+ void OnDuelRequest(Player* target, Player* challenger) override
+ {
+ sEluna->OnDuelRequest(target, challenger);
+ }
+
+ void OnDuelStart(Player* player1, Player* player2) override
+ {
+ sEluna->OnDuelStart(player1, player2);
+ }
+
+ void OnDuelEnd(Player* winner, Player* loser, DuelCompleteType type) override
+ {
+ sEluna->OnDuelEnd(winner, loser, type);
+ }
+
+ void OnEmote(Player* player, uint32 emote) override
+ {
+ sEluna->OnEmote(player, emote);
+ }
+
+ void OnTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, ObjectGuid guid) override
+ {
+ sEluna->OnTextEmote(player, textEmote, emoteNum, guid);
+ }
+
+ void OnSpellCast(Player* player, Spell* spell, bool skipCheck) override
+ {
+ sEluna->OnSpellCast(player, spell, skipCheck);
+ }
+
+ void OnLogin(Player* player) override
+ {
+ sEluna->OnLogin(player);
+ }
+
+ void OnLogout(Player* player) override
+ {
+ sEluna->OnLogout(player);
+ }
+
+ void OnCreate(Player* player) override
+ {
+ sEluna->OnCreate(player);
+ }
+
+ void OnSave(Player* player) override
+ {
+ sEluna->OnSave(player);
+ }
+
+ void OnDelete(ObjectGuid guid, uint32 /*accountId*/) override
+ {
+ sEluna->OnDelete(guid.GetCounter());
+ }
+
+ void OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent) override
+ {
+ sEluna->OnBindToInstance(player, difficulty, mapid, permanent);
+ }
+
+ void OnUpdateZone(Player* player, uint32 newZone, uint32 newArea) override
+ {
+ sEluna->OnUpdateZone(player, newZone, newArea);
+ }
+
+ void OnFirstLogin(Player* player) override
+ {
+ sEluna->OnFirstLogin(player);
+ }
+};
+
+class Eluna_ServerScript : public ServerScript
+{
+public:
+ Eluna_ServerScript() : ServerScript("Eluna_ServerScript") { }
+
+ bool CanPacketSend(WorldSession* session, WorldPacket& packet) override
+ {
+ if (!sEluna->OnPacketSend(session, packet))
+ return false;
+
+ return true;
+ }
+
+ bool CanPacketReceive(WorldSession* session, WorldPacket& packet) override
+ {
+ if (!sEluna->OnPacketReceive(session, packet))
+ return false;
+
+ return true;
+ }
+};
+
+class Eluna_SpellSC : public SpellSC
+{
+public:
+ Eluna_SpellSC() : SpellSC("Eluna_SpellSC") { }
+
+ void OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, GameObject* gameObjTarget) override
+ {
+ sEluna->OnDummyEffect(caster, spellID, effIndex, gameObjTarget);
+ }
+
+ void OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, Creature* creatureTarget) override
+ {
+ sEluna->OnDummyEffect(caster, spellID, effIndex, creatureTarget);
+ }
+
+ void OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, Item* itemTarget) override
+ {
+ sEluna->OnDummyEffect(caster, spellID, effIndex, itemTarget);
+ }
+};
+
+class Eluna_UnitScript : public UnitScript
+{
+public:
+ Eluna_UnitScript() : UnitScript("Eluna_UnitScript") { }
+
+ void OnUnitUpdate(Unit* unit, uint32 diff) override
+ {
+ unit->elunaEvents->Update(diff);
+ }
+};
+
+class Eluna_VehicleScript : public VehicleScript
+{
+public:
+ Eluna_VehicleScript() : VehicleScript("Eluna_VehicleScript") { }
+
+ void OnInstall(Vehicle* veh) override
+ {
+ sEluna->OnInstall(veh);
+ }
+
+ void OnUninstall(Vehicle* veh) override
+ {
+ sEluna->OnUninstall(veh);
+ }
+
+ void OnInstallAccessory(Vehicle* veh, Creature* accessory) override
+ {
+ sEluna->OnInstallAccessory(veh, accessory);
+ }
+
+ void OnAddPassenger(Vehicle* veh, Unit* passenger, int8 seatId) override
+ {
+ sEluna->OnAddPassenger(veh, passenger, seatId);
+ }
+
+ void OnRemovePassenger(Vehicle* veh, Unit* passenger) override
+ {
+ sEluna->OnRemovePassenger(veh, passenger);
+ }
+};
+
+class Eluna_WorldObjectScript : public WorldObjectScript
+{
+public:
+ Eluna_WorldObjectScript() : WorldObjectScript("Eluna_WorldObjectScript") { }
+
+ void OnWorldObjectDestroy(WorldObject* object) override
+ {
+ delete object->elunaEvents;
+ object->elunaEvents = nullptr;
+ }
+
+ void OnWorldObjectCreate(WorldObject* object) override
+ {
+ object->elunaEvents = nullptr;
+ }
+
+ void OnWorldObjectSetMap(WorldObject* object, Map* /*map*/) override
+ {
+ delete object->elunaEvents;
+
+ // On multithread replace this with a pointer to map's Eluna pointer stored in a map
+ object->elunaEvents = new ElunaEventProcessor(&Eluna::GEluna, object);
+ }
+
+ void OnWorldObjectResetMap(WorldObject* object) override
+ {
+ delete object->elunaEvents;
+ object->elunaEvents = nullptr;
+ }
+
+ void OnWorldObjectUpdate(WorldObject* object, uint32 diff) override
+ {
+ object->elunaEvents->Update(diff);
+ }
+};
+
+class Eluna_WorldScript : public WorldScript
+{
+public:
+ Eluna_WorldScript() : WorldScript("Eluna_WorldScript") { }
+
+ void OnOpenStateChange(bool open) override
+ {
+ sEluna->OnOpenStateChange(open);
+ }
+
+ void OnBeforeConfigLoad(bool reload) override
+ {
+ if (!reload)
+ {
+ ///- Initialize Lua Engine
+ LOG_INFO("eluna", "Initialize Eluna Lua Engine...");
+ Eluna::Initialize();
+ }
+
+ sEluna->OnConfigLoad(reload, true);
+ }
+
+ void OnAfterConfigLoad(bool reload) override
+ {
+ sEluna->OnConfigLoad(reload, false);
+ }
+
+ void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask) override
+ {
+ sEluna->OnShutdownInitiate(code, mask);
+ }
+
+ void OnShutdownCancel() override
+ {
+ sEluna->OnShutdownCancel();
+ }
+
+ void OnUpdate(uint32 diff) override
+ {
+ sEluna->OnWorldUpdate(diff);
+ }
+
+ void OnStartup() override
+ {
+ sEluna->OnStartup();
+ }
+
+ void OnShutdown() override
+ {
+ sEluna->OnShutdown();
+ Eluna::Uninitialize();
+ }
+
+ void OnBeforeWorldInitialized() override
+ {
+ ///- Run eluna scripts.
+ // in multithread foreach: run scripts
+ sEluna->RunScripts();
+ sEluna->OnConfigLoad(false, false); // Must be done after Eluna is initialized and scripts have run.
+ }
+};
+
+// Group all custom scripts
+void AddSC_ElunaLuaEngine()
+{
+ new Eluna_AllCreatureScript();
+ new Eluna_AllGameObjectScript();
+ new Eluna_AllItemScript();
+ new Eluna_AllMapScript();
+ new Eluna_AuctionHouseScript();
+ new Eluna_BGScript();
+ new Eluna_CommandSC();
+ new Eluna_ElunaScript();
+ new Eluna_GameEventScript();
+ new Eluna_GroupScript();
+ new Eluna_GuildScript();
+ new Eluna_LootScript();
+ new Eluna_MiscScript();
+ new Eluna_PetScript();
+ new Eluna_PlayerScript();
+ new Eluna_ServerScript();
+ new Eluna_SpellSC();
+ new Eluna_UnitScript();
+ new Eluna_VehicleScript();
+ new Eluna_WorldObjectScript();
+ new Eluna_WorldScript();
+}
diff --git a/LuaEngine b/src/LuaEngine
similarity index 100%
rename from LuaEngine
rename to src/LuaEngine
diff --git a/src/eluna_lua_engine_loader.cpp b/src/eluna_lua_engine_loader.cpp
new file mode 100644
index 0000000..12040dc
--- /dev/null
+++ b/src/eluna_lua_engine_loader.cpp
@@ -0,0 +1,25 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+// From SC
+void AddSC_ElunaLuaEngine();
+
+// Add all
+void Addmod_eluna_lua_engineScripts()
+{
+ AddSC_ElunaLuaEngine();
+}
diff --git a/lualib/CMakeLists.txt b/src/lualib/CMakeLists.txt
similarity index 100%
rename from lualib/CMakeLists.txt
rename to src/lualib/CMakeLists.txt
diff --git a/lualib/lapi.c b/src/lualib/lapi.c
similarity index 100%
rename from lualib/lapi.c
rename to src/lualib/lapi.c
diff --git a/lualib/lapi.h b/src/lualib/lapi.h
similarity index 100%
rename from lualib/lapi.h
rename to src/lualib/lapi.h
diff --git a/lualib/lauxlib.c b/src/lualib/lauxlib.c
similarity index 100%
rename from lualib/lauxlib.c
rename to src/lualib/lauxlib.c
diff --git a/lualib/lauxlib.h b/src/lualib/lauxlib.h
similarity index 100%
rename from lualib/lauxlib.h
rename to src/lualib/lauxlib.h
diff --git a/lualib/lbaselib.c b/src/lualib/lbaselib.c
similarity index 100%
rename from lualib/lbaselib.c
rename to src/lualib/lbaselib.c
diff --git a/lualib/lbitlib.c b/src/lualib/lbitlib.c
similarity index 100%
rename from lualib/lbitlib.c
rename to src/lualib/lbitlib.c
diff --git a/lualib/lcode.c b/src/lualib/lcode.c
similarity index 100%
rename from lualib/lcode.c
rename to src/lualib/lcode.c
diff --git a/lualib/lcode.h b/src/lualib/lcode.h
similarity index 100%
rename from lualib/lcode.h
rename to src/lualib/lcode.h
diff --git a/lualib/lcorolib.c b/src/lualib/lcorolib.c
similarity index 100%
rename from lualib/lcorolib.c
rename to src/lualib/lcorolib.c
diff --git a/lualib/lctype.c b/src/lualib/lctype.c
similarity index 100%
rename from lualib/lctype.c
rename to src/lualib/lctype.c
diff --git a/lualib/lctype.h b/src/lualib/lctype.h
similarity index 100%
rename from lualib/lctype.h
rename to src/lualib/lctype.h
diff --git a/lualib/ldblib.c b/src/lualib/ldblib.c
similarity index 100%
rename from lualib/ldblib.c
rename to src/lualib/ldblib.c
diff --git a/lualib/ldebug.c b/src/lualib/ldebug.c
similarity index 100%
rename from lualib/ldebug.c
rename to src/lualib/ldebug.c
diff --git a/lualib/ldebug.h b/src/lualib/ldebug.h
similarity index 100%
rename from lualib/ldebug.h
rename to src/lualib/ldebug.h
diff --git a/lualib/ldo.c b/src/lualib/ldo.c
similarity index 100%
rename from lualib/ldo.c
rename to src/lualib/ldo.c
diff --git a/lualib/ldo.h b/src/lualib/ldo.h
similarity index 100%
rename from lualib/ldo.h
rename to src/lualib/ldo.h
diff --git a/lualib/ldump.c b/src/lualib/ldump.c
similarity index 100%
rename from lualib/ldump.c
rename to src/lualib/ldump.c
diff --git a/lualib/lfunc.c b/src/lualib/lfunc.c
similarity index 100%
rename from lualib/lfunc.c
rename to src/lualib/lfunc.c
diff --git a/lualib/lfunc.h b/src/lualib/lfunc.h
similarity index 100%
rename from lualib/lfunc.h
rename to src/lualib/lfunc.h
diff --git a/lualib/lgc.c b/src/lualib/lgc.c
similarity index 100%
rename from lualib/lgc.c
rename to src/lualib/lgc.c
diff --git a/lualib/lgc.h b/src/lualib/lgc.h
similarity index 100%
rename from lualib/lgc.h
rename to src/lualib/lgc.h
diff --git a/lualib/linit.c b/src/lualib/linit.c
similarity index 100%
rename from lualib/linit.c
rename to src/lualib/linit.c
diff --git a/lualib/liolib.c b/src/lualib/liolib.c
similarity index 100%
rename from lualib/liolib.c
rename to src/lualib/liolib.c
diff --git a/lualib/llex.c b/src/lualib/llex.c
similarity index 100%
rename from lualib/llex.c
rename to src/lualib/llex.c
diff --git a/lualib/llex.h b/src/lualib/llex.h
similarity index 100%
rename from lualib/llex.h
rename to src/lualib/llex.h
diff --git a/lualib/llimits.h b/src/lualib/llimits.h
similarity index 100%
rename from lualib/llimits.h
rename to src/lualib/llimits.h
diff --git a/lualib/lmathlib.c b/src/lualib/lmathlib.c
similarity index 100%
rename from lualib/lmathlib.c
rename to src/lualib/lmathlib.c
diff --git a/lualib/lmem.c b/src/lualib/lmem.c
similarity index 100%
rename from lualib/lmem.c
rename to src/lualib/lmem.c
diff --git a/lualib/lmem.h b/src/lualib/lmem.h
similarity index 100%
rename from lualib/lmem.h
rename to src/lualib/lmem.h
diff --git a/lualib/loadlib.c b/src/lualib/loadlib.c
similarity index 100%
rename from lualib/loadlib.c
rename to src/lualib/loadlib.c
diff --git a/lualib/lobject.c b/src/lualib/lobject.c
similarity index 100%
rename from lualib/lobject.c
rename to src/lualib/lobject.c
diff --git a/lualib/lobject.h b/src/lualib/lobject.h
similarity index 100%
rename from lualib/lobject.h
rename to src/lualib/lobject.h
diff --git a/lualib/lopcodes.c b/src/lualib/lopcodes.c
similarity index 100%
rename from lualib/lopcodes.c
rename to src/lualib/lopcodes.c
diff --git a/lualib/lopcodes.h b/src/lualib/lopcodes.h
similarity index 100%
rename from lualib/lopcodes.h
rename to src/lualib/lopcodes.h
diff --git a/lualib/loslib.c b/src/lualib/loslib.c
similarity index 100%
rename from lualib/loslib.c
rename to src/lualib/loslib.c
diff --git a/lualib/lparser.c b/src/lualib/lparser.c
similarity index 100%
rename from lualib/lparser.c
rename to src/lualib/lparser.c
diff --git a/lualib/lparser.h b/src/lualib/lparser.h
similarity index 100%
rename from lualib/lparser.h
rename to src/lualib/lparser.h
diff --git a/lualib/lstate.c b/src/lualib/lstate.c
similarity index 100%
rename from lualib/lstate.c
rename to src/lualib/lstate.c
diff --git a/lualib/lstate.h b/src/lualib/lstate.h
similarity index 100%
rename from lualib/lstate.h
rename to src/lualib/lstate.h
diff --git a/lualib/lstring.c b/src/lualib/lstring.c
similarity index 100%
rename from lualib/lstring.c
rename to src/lualib/lstring.c
diff --git a/lualib/lstring.h b/src/lualib/lstring.h
similarity index 100%
rename from lualib/lstring.h
rename to src/lualib/lstring.h
diff --git a/lualib/lstrlib.c b/src/lualib/lstrlib.c
similarity index 100%
rename from lualib/lstrlib.c
rename to src/lualib/lstrlib.c
diff --git a/lualib/ltable.c b/src/lualib/ltable.c
similarity index 100%
rename from lualib/ltable.c
rename to src/lualib/ltable.c
diff --git a/lualib/ltable.h b/src/lualib/ltable.h
similarity index 100%
rename from lualib/ltable.h
rename to src/lualib/ltable.h
diff --git a/lualib/ltablib.c b/src/lualib/ltablib.c
similarity index 100%
rename from lualib/ltablib.c
rename to src/lualib/ltablib.c
diff --git a/lualib/ltm.c b/src/lualib/ltm.c
similarity index 100%
rename from lualib/ltm.c
rename to src/lualib/ltm.c
diff --git a/lualib/ltm.h b/src/lualib/ltm.h
similarity index 100%
rename from lualib/ltm.h
rename to src/lualib/ltm.h
diff --git a/lualib/lua.c b/src/lualib/lua.c
similarity index 100%
rename from lualib/lua.c
rename to src/lualib/lua.c
diff --git a/lualib/lua.h b/src/lualib/lua.h
similarity index 100%
rename from lualib/lua.h
rename to src/lualib/lua.h
diff --git a/lualib/lua.hpp b/src/lualib/lua.hpp
similarity index 100%
rename from lualib/lua.hpp
rename to src/lualib/lua.hpp
diff --git a/lualib/luac.c b/src/lualib/luac.c
similarity index 100%
rename from lualib/luac.c
rename to src/lualib/luac.c
diff --git a/lualib/luaconf.h b/src/lualib/luaconf.h
similarity index 100%
rename from lualib/luaconf.h
rename to src/lualib/luaconf.h
diff --git a/lualib/lualib.h b/src/lualib/lualib.h
similarity index 100%
rename from lualib/lualib.h
rename to src/lualib/lualib.h
diff --git a/lualib/lundump.c b/src/lualib/lundump.c
similarity index 100%
rename from lualib/lundump.c
rename to src/lualib/lundump.c
diff --git a/lualib/lundump.h b/src/lualib/lundump.h
similarity index 100%
rename from lualib/lundump.h
rename to src/lualib/lundump.h
diff --git a/lualib/lvm.c b/src/lualib/lvm.c
similarity index 100%
rename from lualib/lvm.c
rename to src/lualib/lvm.c
diff --git a/lualib/lvm.h b/src/lualib/lvm.h
similarity index 100%
rename from lualib/lvm.h
rename to src/lualib/lvm.h
diff --git a/lualib/lzio.c b/src/lualib/lzio.c
similarity index 100%
rename from lualib/lzio.c
rename to src/lualib/lzio.c
diff --git a/lualib/lzio.h b/src/lualib/lzio.h
similarity index 100%
rename from lualib/lzio.h
rename to src/lualib/lzio.h
From f68d83e8c6ecf64844a42aaa8ad25cb8aa0a3a17 Mon Sep 17 00:00:00 2001
From: Kargatum
Date: Sat, 4 Dec 2021 18:28:12 +0700
Subject: [PATCH 086/112] fix(AreaTrigger): correct condition (#72)
---
src/ElunaLuaEngine_SC.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ElunaLuaEngine_SC.cpp b/src/ElunaLuaEngine_SC.cpp
index 6ab9cfe..0d5ac75 100644
--- a/src/ElunaLuaEngine_SC.cpp
+++ b/src/ElunaLuaEngine_SC.cpp
@@ -356,9 +356,9 @@ public:
bool CanAreaTrigger(Player* player, AreaTrigger const* trigger) override
{
if (sEluna->OnAreaTrigger(player, trigger))
- return false;
+ return true;
- return true;
+ return false;
}
};
From 36a0fe51556b809a3468b781e4162a1307183b72 Mon Sep 17 00:00:00 2001
From: anzz1
Date: Wed, 5 Jan 2022 17:10:06 +0200
Subject: [PATCH 087/112] Update README.md
Change manual instructions to reflect the change that LuaEngine folder needs to be at `mod-eluna-lua-engine/src/LuaEngine` instead of `mod-eluna-lua-engine/LuaEngine`
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 733d7e8..7d9e2f2 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ Optional: if you need to update Eluna to the latest version, you can `cd LuaEngi
1. download [mod-eluna-lua-engine](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
2. extract it move the folder **mod-eluna-lua-engine** inside the **modules** folder of your azerothcore-wotlk sources
3. download [Eluna](https://github.com/Azerothcore/Eluna/archive/master.zip)
-4. extract it and move all the files inside the `Eluna-master` folder into the `mod-eluna-lua-engine/LuaEngine` folder. `LuaEngine.h` needs to be directly under `mod-eluna-lua-engine/LuaEngine` without any extra sub-folders.
+4. extract it and move all the files inside the `Eluna-master` folder into the `mod-eluna-lua-engine/src/LuaEngine` folder. `LuaEngine.h` needs to be directly under `mod-eluna-lua-engine/src/LuaEngine` without any extra sub-folders.
### 2) Build
From 474b9c565bab3a346c91b9b0eb7ef6a54e516811 Mon Sep 17 00:00:00 2001
From: Nefertumm
Date: Sat, 15 Jan 2022 20:20:44 -0300
Subject: [PATCH 088/112] Fix(build): update Eluna version
---
src/LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/LuaEngine b/src/LuaEngine
index ccf3372..9fbfec1 160000
--- a/src/LuaEngine
+++ b/src/LuaEngine
@@ -1 +1 @@
-Subproject commit ccf337262c2573f345e54b2973678f5dbf282aa2
+Subproject commit 9fbfec18df9430808417edeb926f644a317e6b3a
From 8302a0d383a8255fc0885219c4dbc39ab358a9a5 Mon Sep 17 00:00:00 2001
From: Kargatum
Date: Fri, 21 Jan 2022 22:21:50 +0700
Subject: [PATCH 089/112] fix(Misc): correct `Eluna::Uninitialize` (#84)
---
src/ElunaLuaEngine_SC.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/ElunaLuaEngine_SC.cpp b/src/ElunaLuaEngine_SC.cpp
index 0d5ac75..868b246 100644
--- a/src/ElunaLuaEngine_SC.cpp
+++ b/src/ElunaLuaEngine_SC.cpp
@@ -904,6 +904,10 @@ public:
void OnShutdown() override
{
sEluna->OnShutdown();
+ }
+
+ void OnAfterUnloadAllMaps() override
+ {
Eluna::Uninitialize();
}
From c35f531f812bdf75972dc197d168d337c094e080 Mon Sep 17 00:00:00 2001
From: Kargatum
Date: Mon, 24 Jan 2022 18:00:09 +0700
Subject: [PATCH 090/112] feat(Misc): update LuaEngine (#85)
---
src/LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/LuaEngine b/src/LuaEngine
index 9fbfec1..5ead47b 160000
--- a/src/LuaEngine
+++ b/src/LuaEngine
@@ -1 +1 @@
-Subproject commit 9fbfec18df9430808417edeb926f644a317e6b3a
+Subproject commit 5ead47b73310e936444ffbf005fb894a902cf67c
From 82b66879aa4671a519fa79a3ba4fc390251a77e2 Mon Sep 17 00:00:00 2001
From: Nefertumm
Date: Wed, 2 Feb 2022 13:07:54 -0300
Subject: [PATCH 091/112] feat: Update Eluna version + ReputationHook (#87)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Fix(build): OnReputationChange from void to bool
* feat: Update Eluna version + Reputation hook
* Update src/ElunaLuaEngine_SC.cpp
Co-authored-by: Stefano Borzì
Co-authored-by: Stefano Borzì
---
src/ElunaLuaEngine_SC.cpp | 4 ++--
src/LuaEngine | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/ElunaLuaEngine_SC.cpp b/src/ElunaLuaEngine_SC.cpp
index 868b246..7a1d70e 100644
--- a/src/ElunaLuaEngine_SC.cpp
+++ b/src/ElunaLuaEngine_SC.cpp
@@ -657,9 +657,9 @@ public:
sEluna->OnGiveXP(player, amount, victim);
}
- void OnReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental) override
+ bool OnReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental) override
{
- sEluna->OnReputationChange(player, factionID, standing, incremental);
+ return sEluna->OnReputationChange(player, factionID, standing, incremental);
}
void OnDuelRequest(Player* target, Player* challenger) override
diff --git a/src/LuaEngine b/src/LuaEngine
index 5ead47b..51230f7 160000
--- a/src/LuaEngine
+++ b/src/LuaEngine
@@ -1 +1 @@
-Subproject commit 5ead47b73310e936444ffbf005fb894a902cf67c
+Subproject commit 51230f73eab720fb8e570d7791758a821cd154e1
From 84f2edc6dfeb251714bece0f0874be8dde005620 Mon Sep 17 00:00:00 2001
From: Kargatum
Date: Sat, 5 Feb 2022 07:21:31 +0700
Subject: [PATCH 092/112] feat(DB): add support new db api (#88)
---
src/LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/LuaEngine b/src/LuaEngine
index 51230f7..61d13b7 160000
--- a/src/LuaEngine
+++ b/src/LuaEngine
@@ -1 +1 @@
-Subproject commit 51230f73eab720fb8e570d7791758a821cd154e1
+Subproject commit 61d13b7ffc69bbb3564f2d2677a495a5df54ad1e
From 19e0f03b2d562ac67b07fc3cbce59e409ad1cb78 Mon Sep 17 00:00:00 2001
From: Axel Cocat
Date: Tue, 15 Feb 2022 10:38:12 +0100
Subject: [PATCH 093/112] feat: pass ChatHandler to OnCommand call
---
src/ElunaLuaEngine_SC.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ElunaLuaEngine_SC.cpp b/src/ElunaLuaEngine_SC.cpp
index 7a1d70e..89907bd 100644
--- a/src/ElunaLuaEngine_SC.cpp
+++ b/src/ElunaLuaEngine_SC.cpp
@@ -332,7 +332,7 @@ public:
bool CanExecuteCommand(ChatHandler& handler, std::string_view cmdStr) override
{
- if (!sEluna->OnCommand(handler.IsConsole() ? nullptr : handler.GetSession()->GetPlayer(), std::string(cmdStr).c_str()))
+ if (!sEluna->OnCommand(handler, std::string(cmdStr).c_str()))
{
return false;
}
From e6a69a70e266dddc81546f0bccf63406dc16de04 Mon Sep 17 00:00:00 2001
From: Axel Cocat
Date: Sun, 20 Feb 2022 18:35:57 +0100
Subject: [PATCH 094/112] feat: update submodule
---
src/LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/LuaEngine b/src/LuaEngine
index 61d13b7..796dff5 160000
--- a/src/LuaEngine
+++ b/src/LuaEngine
@@ -1 +1 @@
-Subproject commit 61d13b7ffc69bbb3564f2d2677a495a5df54ad1e
+Subproject commit 796dff57b50b1bbf98adfc9ee4ccd1de65f752be
From 59a71445caafff0c0ac07f520544bb6bb201a13a Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Thu, 24 Mar 2022 20:54:19 +0100
Subject: [PATCH 095/112] chore: update readme
---
README.md | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index 7d9e2f2..dbb23e4 100644
--- a/README.md
+++ b/README.md
@@ -9,9 +9,9 @@ An [Eluna](https://github.com/ElunaLuaEngine/Eluna) module for AzerothCore.
### 1) Download the sources
-You can get the sources either using git (recommended) or downloading them manually.
+You can get the sources using git.
-#### download with git (recommended)
+#### download with git
1. open a terminal inside your `azerothcore-wotlk` folder
2. go inside the **modules** folder: `cd modules`
@@ -22,21 +22,15 @@ git clone https://github.com/azerothcore/mod-eluna-lua-engine.git
4. go inside the **mod-eluna-lua-engine** folder: `cd mod-eluna-lua-engine`
5. download the Eluna sources using `git submodule update --init`
-Optional: if you need to update Eluna to the latest version, you can `cd LuaEngine` and run `git pull` from there.
+Optional: if you need to update Eluna to the latest version, you can `cd src` and `cd LuaEngine` and run `git pull` from there.
-#### download manually
-
-1. download [mod-eluna-lua-engine](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
-2. extract it move the folder **mod-eluna-lua-engine** inside the **modules** folder of your azerothcore-wotlk sources
-3. download [Eluna](https://github.com/Azerothcore/Eluna/archive/master.zip)
-4. extract it and move all the files inside the `Eluna-master` folder into the `mod-eluna-lua-engine/src/LuaEngine` folder. `LuaEngine.h` needs to be directly under `mod-eluna-lua-engine/src/LuaEngine` without any extra sub-folders.
### 2) Build
You need to run the cmake again and and rebuild the project.
-Eluna API :
-[http://elunaluaengine.github.io/](http://elunaluaengine.github.io/)
+Eluna API for AC:
+[https://www.azerothcore.org/pages/eluna/index.html](https://www.azerothcore.org/pages/eluna/index.html)
## How to update the Eluna version (for project mainteners)
From 35da9552aeedd436345faece5699bbd9e9fc9466 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francesco=20Borz=C3=AC?=
Date: Fri, 25 Mar 2022 12:42:15 +0100
Subject: [PATCH 096/112] fix: submodule (#93)
---
src/LuaEngine | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/LuaEngine b/src/LuaEngine
index 796dff5..6fb5300 160000
--- a/src/LuaEngine
+++ b/src/LuaEngine
@@ -1 +1 @@
-Subproject commit 796dff57b50b1bbf98adfc9ee4ccd1de65f752be
+Subproject commit 6fb5300b4eee16a7a3f9c9000edcfca5e504b842
From 30797110eeefc5a61d3a870677be942ed4d0447f Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Sat, 26 Mar 2022 21:29:04 +0100
Subject: [PATCH 097/112] chore: move files
---
.editorconfig => src/LuaEngine/.editorconfig | 0
.../LuaEngine/.github}/workflows/build.yml | 0
.../LuaEngine/.github}/workflows/create-pr.sh | 0
.../LuaEngine/.github}/workflows/documentation.yml | 0
.gitignore => src/LuaEngine/.gitignore | 0
AuraMethods.h => src/LuaEngine/AuraMethods.h | 0
.../LuaEngine/BattleGroundHooks.cpp | 0
.../LuaEngine/BattleGroundMethods.h | 0
BindingMap.h => src/LuaEngine/BindingMap.h | 0
CMakeLists.txt => src/LuaEngine/CMakeLists.txt | 0
.../LuaEngine/ChatHandlerMethods.h | 0
CorpseMethods.h => src/LuaEngine/CorpseMethods.h | 0
.../LuaEngine/CreatureHooks.cpp | 0
.../LuaEngine/CreatureMethods.h | 0
.../LuaEngine/ElunaCreatureAI.h | 0
.../LuaEngine/ElunaEventMgr.cpp | 0
ElunaEventMgr.h => src/LuaEngine/ElunaEventMgr.h | 0
ElunaIncludes.h => src/LuaEngine/ElunaIncludes.h | 0
.../LuaEngine/ElunaInstanceAI.cpp | 0
.../LuaEngine/ElunaInstanceAI.h | 0
.../LuaEngine/ElunaQueryMethods.h | 0
ElunaTemplate.h => src/LuaEngine/ElunaTemplate.h | 0
ElunaUtility.cpp => src/LuaEngine/ElunaUtility.cpp | 0
ElunaUtility.h => src/LuaEngine/ElunaUtility.h | 0
.../LuaEngine/GameObjectHooks.cpp | 0
.../LuaEngine/GameObjectMethods.h | 0
GlobalMethods.h => src/LuaEngine/GlobalMethods.h | 0
GossipHooks.cpp => src/LuaEngine/GossipHooks.cpp | 0
GroupHooks.cpp => src/LuaEngine/GroupHooks.cpp | 0
GroupMethods.h => src/LuaEngine/GroupMethods.h | 0
GuildHooks.cpp => src/LuaEngine/GuildHooks.cpp | 0
GuildMethods.h => src/LuaEngine/GuildMethods.h | 0
HookHelpers.h => src/LuaEngine/HookHelpers.h | 0
Hooks.h => src/LuaEngine/Hooks.h | 0
HttpManager.cpp => src/LuaEngine/HttpManager.cpp | 0
HttpManager.h => src/LuaEngine/HttpManager.h | 0
.../LuaEngine/InstanceHooks.cpp | 0
ItemHooks.cpp => src/LuaEngine/ItemHooks.cpp | 0
ItemMethods.h => src/LuaEngine/ItemMethods.h | 0
LICENSE => src/LuaEngine/LICENSE | 0
LuaEngine.cpp => src/LuaEngine/LuaEngine.cpp | 0
LuaEngine.h => src/LuaEngine/LuaEngine.h | 0
LuaFunctions.cpp => src/LuaEngine/LuaFunctions.cpp | 0
MapMethods.h => src/LuaEngine/MapMethods.h | 0
ObjectMethods.h => src/LuaEngine/ObjectMethods.h | 0
PacketHooks.cpp => src/LuaEngine/PacketHooks.cpp | 0
PlayerHooks.cpp => src/LuaEngine/PlayerHooks.cpp | 0
PlayerMethods.h => src/LuaEngine/PlayerMethods.h | 0
QuestMethods.h => src/LuaEngine/QuestMethods.h | 0
README.md => src/LuaEngine/README.md | 0
ServerHooks.cpp => src/LuaEngine/ServerHooks.cpp | 0
SpellMethods.h => src/LuaEngine/SpellMethods.h | 0
UnitMethods.h => src/LuaEngine/UnitMethods.h | 0
VehicleHooks.cpp => src/LuaEngine/VehicleHooks.cpp | 0
VehicleMethods.h => src/LuaEngine/VehicleMethods.h | 0
.../LuaEngine/WorldObjectMethods.h | 0
.../LuaEngine/WorldPacketMethods.h | 0
{docs => src/LuaEngine/docs}/.gitignore | 0
{docs => src/LuaEngine/docs}/CONTRIBUTING.md | 0
{docs => src/LuaEngine/docs}/DOC_GEN.md | 0
{docs => src/LuaEngine/docs}/Eluna.png | Bin
{docs => src/LuaEngine/docs}/ElunaDoc/.gitignore | 0
{docs => src/LuaEngine/docs}/ElunaDoc/__init__.py | 0
{docs => src/LuaEngine/docs}/ElunaDoc/__main__.py | 0
{docs => src/LuaEngine/docs}/ElunaDoc/parser.py | 0
.../docs}/ElunaDoc/static/FiraSans-Medium.woff | Bin
.../docs}/ElunaDoc/static/FiraSans-Regular.woff | Bin
.../docs}/ElunaDoc/static/Heuristica-Italic.woff | Bin
.../ElunaDoc/static/SourceCodePro-Regular.woff | Bin
.../ElunaDoc/static/SourceCodePro-Semibold.woff | Bin
.../docs}/ElunaDoc/static/SourceSerifPro-Bold.woff | Bin
.../ElunaDoc/static/SourceSerifPro-Regular.woff | Bin
.../LuaEngine/docs}/ElunaDoc/static/eluna-logo.png | Bin
.../LuaEngine/docs}/ElunaDoc/static/favicon.ico | Bin
.../LuaEngine/docs}/ElunaDoc/static/jquery.js | 0
.../LuaEngine/docs}/ElunaDoc/static/main.css | 0
.../LuaEngine/docs}/ElunaDoc/static/main.js | 0
.../LuaEngine/docs}/ElunaDoc/static/normalize.css | 0
.../LuaEngine/docs}/ElunaDoc/templates/_base.html | 0
.../LuaEngine/docs}/ElunaDoc/templates/class.html | 0
.../LuaEngine/docs}/ElunaDoc/templates/date.js | 0
.../LuaEngine/docs}/ElunaDoc/templates/enum.html | 0
.../LuaEngine/docs}/ElunaDoc/templates/index.html | 0
.../LuaEngine/docs}/ElunaDoc/templates/method.html | 0
.../docs}/ElunaDoc/templates/search-index.js | 0
.../LuaEngine/docs}/ElunaDoc/templates/sidebar.js | 0
{docs => src/LuaEngine/docs}/IMPL_DETAILS.md | 0
{docs => src/LuaEngine/docs}/INSTALL.md | 0
{docs => src/LuaEngine/docs}/MERGING.md | 0
{docs => src/LuaEngine/docs}/USAGE.md | 0
.../LuaEngine/extensions}/ObjectVariables.ext | 0
.../LuaEngine/extensions}/StackTracePlus/LICENSE | 0
.../LuaEngine/extensions}/StackTracePlus/README.md | 0
.../extensions}/StackTracePlus/StackTracePlus.ext | 0
{extensions => src/LuaEngine/extensions}/_Misc.ext | 0
{libs => src/LuaEngine/libs}/httplib.h | 0
{libs => src/LuaEngine/libs}/rigtorp/SPSCQueue.h | 0
lmarshal.cpp => src/LuaEngine/lmarshal.cpp | 0
lmarshal.h => src/LuaEngine/lmarshal.h | 0
99 files changed, 0 insertions(+), 0 deletions(-)
rename .editorconfig => src/LuaEngine/.editorconfig (100%)
rename {.github => src/LuaEngine/.github}/workflows/build.yml (100%)
rename {.github => src/LuaEngine/.github}/workflows/create-pr.sh (100%)
rename {.github => src/LuaEngine/.github}/workflows/documentation.yml (100%)
rename .gitignore => src/LuaEngine/.gitignore (100%)
rename AuraMethods.h => src/LuaEngine/AuraMethods.h (100%)
rename BattleGroundHooks.cpp => src/LuaEngine/BattleGroundHooks.cpp (100%)
rename BattleGroundMethods.h => src/LuaEngine/BattleGroundMethods.h (100%)
rename BindingMap.h => src/LuaEngine/BindingMap.h (100%)
rename CMakeLists.txt => src/LuaEngine/CMakeLists.txt (100%)
rename ChatHandlerMethods.h => src/LuaEngine/ChatHandlerMethods.h (100%)
rename CorpseMethods.h => src/LuaEngine/CorpseMethods.h (100%)
rename CreatureHooks.cpp => src/LuaEngine/CreatureHooks.cpp (100%)
rename CreatureMethods.h => src/LuaEngine/CreatureMethods.h (100%)
rename ElunaCreatureAI.h => src/LuaEngine/ElunaCreatureAI.h (100%)
rename ElunaEventMgr.cpp => src/LuaEngine/ElunaEventMgr.cpp (100%)
rename ElunaEventMgr.h => src/LuaEngine/ElunaEventMgr.h (100%)
rename ElunaIncludes.h => src/LuaEngine/ElunaIncludes.h (100%)
rename ElunaInstanceAI.cpp => src/LuaEngine/ElunaInstanceAI.cpp (100%)
rename ElunaInstanceAI.h => src/LuaEngine/ElunaInstanceAI.h (100%)
rename ElunaQueryMethods.h => src/LuaEngine/ElunaQueryMethods.h (100%)
rename ElunaTemplate.h => src/LuaEngine/ElunaTemplate.h (100%)
rename ElunaUtility.cpp => src/LuaEngine/ElunaUtility.cpp (100%)
rename ElunaUtility.h => src/LuaEngine/ElunaUtility.h (100%)
rename GameObjectHooks.cpp => src/LuaEngine/GameObjectHooks.cpp (100%)
rename GameObjectMethods.h => src/LuaEngine/GameObjectMethods.h (100%)
rename GlobalMethods.h => src/LuaEngine/GlobalMethods.h (100%)
rename GossipHooks.cpp => src/LuaEngine/GossipHooks.cpp (100%)
rename GroupHooks.cpp => src/LuaEngine/GroupHooks.cpp (100%)
rename GroupMethods.h => src/LuaEngine/GroupMethods.h (100%)
rename GuildHooks.cpp => src/LuaEngine/GuildHooks.cpp (100%)
rename GuildMethods.h => src/LuaEngine/GuildMethods.h (100%)
rename HookHelpers.h => src/LuaEngine/HookHelpers.h (100%)
rename Hooks.h => src/LuaEngine/Hooks.h (100%)
rename HttpManager.cpp => src/LuaEngine/HttpManager.cpp (100%)
rename HttpManager.h => src/LuaEngine/HttpManager.h (100%)
rename InstanceHooks.cpp => src/LuaEngine/InstanceHooks.cpp (100%)
rename ItemHooks.cpp => src/LuaEngine/ItemHooks.cpp (100%)
rename ItemMethods.h => src/LuaEngine/ItemMethods.h (100%)
rename LICENSE => src/LuaEngine/LICENSE (100%)
rename LuaEngine.cpp => src/LuaEngine/LuaEngine.cpp (100%)
rename LuaEngine.h => src/LuaEngine/LuaEngine.h (100%)
rename LuaFunctions.cpp => src/LuaEngine/LuaFunctions.cpp (100%)
rename MapMethods.h => src/LuaEngine/MapMethods.h (100%)
rename ObjectMethods.h => src/LuaEngine/ObjectMethods.h (100%)
rename PacketHooks.cpp => src/LuaEngine/PacketHooks.cpp (100%)
rename PlayerHooks.cpp => src/LuaEngine/PlayerHooks.cpp (100%)
rename PlayerMethods.h => src/LuaEngine/PlayerMethods.h (100%)
rename QuestMethods.h => src/LuaEngine/QuestMethods.h (100%)
rename README.md => src/LuaEngine/README.md (100%)
rename ServerHooks.cpp => src/LuaEngine/ServerHooks.cpp (100%)
rename SpellMethods.h => src/LuaEngine/SpellMethods.h (100%)
rename UnitMethods.h => src/LuaEngine/UnitMethods.h (100%)
rename VehicleHooks.cpp => src/LuaEngine/VehicleHooks.cpp (100%)
rename VehicleMethods.h => src/LuaEngine/VehicleMethods.h (100%)
rename WorldObjectMethods.h => src/LuaEngine/WorldObjectMethods.h (100%)
rename WorldPacketMethods.h => src/LuaEngine/WorldPacketMethods.h (100%)
rename {docs => src/LuaEngine/docs}/.gitignore (100%)
rename {docs => src/LuaEngine/docs}/CONTRIBUTING.md (100%)
rename {docs => src/LuaEngine/docs}/DOC_GEN.md (100%)
rename {docs => src/LuaEngine/docs}/Eluna.png (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/.gitignore (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/__init__.py (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/__main__.py (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/parser.py (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/static/FiraSans-Medium.woff (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/static/FiraSans-Regular.woff (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/static/Heuristica-Italic.woff (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/static/SourceCodePro-Regular.woff (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/static/SourceCodePro-Semibold.woff (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/static/SourceSerifPro-Bold.woff (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/static/SourceSerifPro-Regular.woff (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/static/eluna-logo.png (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/static/favicon.ico (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/static/jquery.js (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/static/main.css (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/static/main.js (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/static/normalize.css (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/templates/_base.html (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/templates/class.html (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/templates/date.js (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/templates/enum.html (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/templates/index.html (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/templates/method.html (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/templates/search-index.js (100%)
rename {docs => src/LuaEngine/docs}/ElunaDoc/templates/sidebar.js (100%)
rename {docs => src/LuaEngine/docs}/IMPL_DETAILS.md (100%)
rename {docs => src/LuaEngine/docs}/INSTALL.md (100%)
rename {docs => src/LuaEngine/docs}/MERGING.md (100%)
rename {docs => src/LuaEngine/docs}/USAGE.md (100%)
rename {extensions => src/LuaEngine/extensions}/ObjectVariables.ext (100%)
rename {extensions => src/LuaEngine/extensions}/StackTracePlus/LICENSE (100%)
rename {extensions => src/LuaEngine/extensions}/StackTracePlus/README.md (100%)
rename {extensions => src/LuaEngine/extensions}/StackTracePlus/StackTracePlus.ext (100%)
rename {extensions => src/LuaEngine/extensions}/_Misc.ext (100%)
rename {libs => src/LuaEngine/libs}/httplib.h (100%)
rename {libs => src/LuaEngine/libs}/rigtorp/SPSCQueue.h (100%)
rename lmarshal.cpp => src/LuaEngine/lmarshal.cpp (100%)
rename lmarshal.h => src/LuaEngine/lmarshal.h (100%)
diff --git a/.editorconfig b/src/LuaEngine/.editorconfig
similarity index 100%
rename from .editorconfig
rename to src/LuaEngine/.editorconfig
diff --git a/.github/workflows/build.yml b/src/LuaEngine/.github/workflows/build.yml
similarity index 100%
rename from .github/workflows/build.yml
rename to src/LuaEngine/.github/workflows/build.yml
diff --git a/.github/workflows/create-pr.sh b/src/LuaEngine/.github/workflows/create-pr.sh
similarity index 100%
rename from .github/workflows/create-pr.sh
rename to src/LuaEngine/.github/workflows/create-pr.sh
diff --git a/.github/workflows/documentation.yml b/src/LuaEngine/.github/workflows/documentation.yml
similarity index 100%
rename from .github/workflows/documentation.yml
rename to src/LuaEngine/.github/workflows/documentation.yml
diff --git a/.gitignore b/src/LuaEngine/.gitignore
similarity index 100%
rename from .gitignore
rename to src/LuaEngine/.gitignore
diff --git a/AuraMethods.h b/src/LuaEngine/AuraMethods.h
similarity index 100%
rename from AuraMethods.h
rename to src/LuaEngine/AuraMethods.h
diff --git a/BattleGroundHooks.cpp b/src/LuaEngine/BattleGroundHooks.cpp
similarity index 100%
rename from BattleGroundHooks.cpp
rename to src/LuaEngine/BattleGroundHooks.cpp
diff --git a/BattleGroundMethods.h b/src/LuaEngine/BattleGroundMethods.h
similarity index 100%
rename from BattleGroundMethods.h
rename to src/LuaEngine/BattleGroundMethods.h
diff --git a/BindingMap.h b/src/LuaEngine/BindingMap.h
similarity index 100%
rename from BindingMap.h
rename to src/LuaEngine/BindingMap.h
diff --git a/CMakeLists.txt b/src/LuaEngine/CMakeLists.txt
similarity index 100%
rename from CMakeLists.txt
rename to src/LuaEngine/CMakeLists.txt
diff --git a/ChatHandlerMethods.h b/src/LuaEngine/ChatHandlerMethods.h
similarity index 100%
rename from ChatHandlerMethods.h
rename to src/LuaEngine/ChatHandlerMethods.h
diff --git a/CorpseMethods.h b/src/LuaEngine/CorpseMethods.h
similarity index 100%
rename from CorpseMethods.h
rename to src/LuaEngine/CorpseMethods.h
diff --git a/CreatureHooks.cpp b/src/LuaEngine/CreatureHooks.cpp
similarity index 100%
rename from CreatureHooks.cpp
rename to src/LuaEngine/CreatureHooks.cpp
diff --git a/CreatureMethods.h b/src/LuaEngine/CreatureMethods.h
similarity index 100%
rename from CreatureMethods.h
rename to src/LuaEngine/CreatureMethods.h
diff --git a/ElunaCreatureAI.h b/src/LuaEngine/ElunaCreatureAI.h
similarity index 100%
rename from ElunaCreatureAI.h
rename to src/LuaEngine/ElunaCreatureAI.h
diff --git a/ElunaEventMgr.cpp b/src/LuaEngine/ElunaEventMgr.cpp
similarity index 100%
rename from ElunaEventMgr.cpp
rename to src/LuaEngine/ElunaEventMgr.cpp
diff --git a/ElunaEventMgr.h b/src/LuaEngine/ElunaEventMgr.h
similarity index 100%
rename from ElunaEventMgr.h
rename to src/LuaEngine/ElunaEventMgr.h
diff --git a/ElunaIncludes.h b/src/LuaEngine/ElunaIncludes.h
similarity index 100%
rename from ElunaIncludes.h
rename to src/LuaEngine/ElunaIncludes.h
diff --git a/ElunaInstanceAI.cpp b/src/LuaEngine/ElunaInstanceAI.cpp
similarity index 100%
rename from ElunaInstanceAI.cpp
rename to src/LuaEngine/ElunaInstanceAI.cpp
diff --git a/ElunaInstanceAI.h b/src/LuaEngine/ElunaInstanceAI.h
similarity index 100%
rename from ElunaInstanceAI.h
rename to src/LuaEngine/ElunaInstanceAI.h
diff --git a/ElunaQueryMethods.h b/src/LuaEngine/ElunaQueryMethods.h
similarity index 100%
rename from ElunaQueryMethods.h
rename to src/LuaEngine/ElunaQueryMethods.h
diff --git a/ElunaTemplate.h b/src/LuaEngine/ElunaTemplate.h
similarity index 100%
rename from ElunaTemplate.h
rename to src/LuaEngine/ElunaTemplate.h
diff --git a/ElunaUtility.cpp b/src/LuaEngine/ElunaUtility.cpp
similarity index 100%
rename from ElunaUtility.cpp
rename to src/LuaEngine/ElunaUtility.cpp
diff --git a/ElunaUtility.h b/src/LuaEngine/ElunaUtility.h
similarity index 100%
rename from ElunaUtility.h
rename to src/LuaEngine/ElunaUtility.h
diff --git a/GameObjectHooks.cpp b/src/LuaEngine/GameObjectHooks.cpp
similarity index 100%
rename from GameObjectHooks.cpp
rename to src/LuaEngine/GameObjectHooks.cpp
diff --git a/GameObjectMethods.h b/src/LuaEngine/GameObjectMethods.h
similarity index 100%
rename from GameObjectMethods.h
rename to src/LuaEngine/GameObjectMethods.h
diff --git a/GlobalMethods.h b/src/LuaEngine/GlobalMethods.h
similarity index 100%
rename from GlobalMethods.h
rename to src/LuaEngine/GlobalMethods.h
diff --git a/GossipHooks.cpp b/src/LuaEngine/GossipHooks.cpp
similarity index 100%
rename from GossipHooks.cpp
rename to src/LuaEngine/GossipHooks.cpp
diff --git a/GroupHooks.cpp b/src/LuaEngine/GroupHooks.cpp
similarity index 100%
rename from GroupHooks.cpp
rename to src/LuaEngine/GroupHooks.cpp
diff --git a/GroupMethods.h b/src/LuaEngine/GroupMethods.h
similarity index 100%
rename from GroupMethods.h
rename to src/LuaEngine/GroupMethods.h
diff --git a/GuildHooks.cpp b/src/LuaEngine/GuildHooks.cpp
similarity index 100%
rename from GuildHooks.cpp
rename to src/LuaEngine/GuildHooks.cpp
diff --git a/GuildMethods.h b/src/LuaEngine/GuildMethods.h
similarity index 100%
rename from GuildMethods.h
rename to src/LuaEngine/GuildMethods.h
diff --git a/HookHelpers.h b/src/LuaEngine/HookHelpers.h
similarity index 100%
rename from HookHelpers.h
rename to src/LuaEngine/HookHelpers.h
diff --git a/Hooks.h b/src/LuaEngine/Hooks.h
similarity index 100%
rename from Hooks.h
rename to src/LuaEngine/Hooks.h
diff --git a/HttpManager.cpp b/src/LuaEngine/HttpManager.cpp
similarity index 100%
rename from HttpManager.cpp
rename to src/LuaEngine/HttpManager.cpp
diff --git a/HttpManager.h b/src/LuaEngine/HttpManager.h
similarity index 100%
rename from HttpManager.h
rename to src/LuaEngine/HttpManager.h
diff --git a/InstanceHooks.cpp b/src/LuaEngine/InstanceHooks.cpp
similarity index 100%
rename from InstanceHooks.cpp
rename to src/LuaEngine/InstanceHooks.cpp
diff --git a/ItemHooks.cpp b/src/LuaEngine/ItemHooks.cpp
similarity index 100%
rename from ItemHooks.cpp
rename to src/LuaEngine/ItemHooks.cpp
diff --git a/ItemMethods.h b/src/LuaEngine/ItemMethods.h
similarity index 100%
rename from ItemMethods.h
rename to src/LuaEngine/ItemMethods.h
diff --git a/LICENSE b/src/LuaEngine/LICENSE
similarity index 100%
rename from LICENSE
rename to src/LuaEngine/LICENSE
diff --git a/LuaEngine.cpp b/src/LuaEngine/LuaEngine.cpp
similarity index 100%
rename from LuaEngine.cpp
rename to src/LuaEngine/LuaEngine.cpp
diff --git a/LuaEngine.h b/src/LuaEngine/LuaEngine.h
similarity index 100%
rename from LuaEngine.h
rename to src/LuaEngine/LuaEngine.h
diff --git a/LuaFunctions.cpp b/src/LuaEngine/LuaFunctions.cpp
similarity index 100%
rename from LuaFunctions.cpp
rename to src/LuaEngine/LuaFunctions.cpp
diff --git a/MapMethods.h b/src/LuaEngine/MapMethods.h
similarity index 100%
rename from MapMethods.h
rename to src/LuaEngine/MapMethods.h
diff --git a/ObjectMethods.h b/src/LuaEngine/ObjectMethods.h
similarity index 100%
rename from ObjectMethods.h
rename to src/LuaEngine/ObjectMethods.h
diff --git a/PacketHooks.cpp b/src/LuaEngine/PacketHooks.cpp
similarity index 100%
rename from PacketHooks.cpp
rename to src/LuaEngine/PacketHooks.cpp
diff --git a/PlayerHooks.cpp b/src/LuaEngine/PlayerHooks.cpp
similarity index 100%
rename from PlayerHooks.cpp
rename to src/LuaEngine/PlayerHooks.cpp
diff --git a/PlayerMethods.h b/src/LuaEngine/PlayerMethods.h
similarity index 100%
rename from PlayerMethods.h
rename to src/LuaEngine/PlayerMethods.h
diff --git a/QuestMethods.h b/src/LuaEngine/QuestMethods.h
similarity index 100%
rename from QuestMethods.h
rename to src/LuaEngine/QuestMethods.h
diff --git a/README.md b/src/LuaEngine/README.md
similarity index 100%
rename from README.md
rename to src/LuaEngine/README.md
diff --git a/ServerHooks.cpp b/src/LuaEngine/ServerHooks.cpp
similarity index 100%
rename from ServerHooks.cpp
rename to src/LuaEngine/ServerHooks.cpp
diff --git a/SpellMethods.h b/src/LuaEngine/SpellMethods.h
similarity index 100%
rename from SpellMethods.h
rename to src/LuaEngine/SpellMethods.h
diff --git a/UnitMethods.h b/src/LuaEngine/UnitMethods.h
similarity index 100%
rename from UnitMethods.h
rename to src/LuaEngine/UnitMethods.h
diff --git a/VehicleHooks.cpp b/src/LuaEngine/VehicleHooks.cpp
similarity index 100%
rename from VehicleHooks.cpp
rename to src/LuaEngine/VehicleHooks.cpp
diff --git a/VehicleMethods.h b/src/LuaEngine/VehicleMethods.h
similarity index 100%
rename from VehicleMethods.h
rename to src/LuaEngine/VehicleMethods.h
diff --git a/WorldObjectMethods.h b/src/LuaEngine/WorldObjectMethods.h
similarity index 100%
rename from WorldObjectMethods.h
rename to src/LuaEngine/WorldObjectMethods.h
diff --git a/WorldPacketMethods.h b/src/LuaEngine/WorldPacketMethods.h
similarity index 100%
rename from WorldPacketMethods.h
rename to src/LuaEngine/WorldPacketMethods.h
diff --git a/docs/.gitignore b/src/LuaEngine/docs/.gitignore
similarity index 100%
rename from docs/.gitignore
rename to src/LuaEngine/docs/.gitignore
diff --git a/docs/CONTRIBUTING.md b/src/LuaEngine/docs/CONTRIBUTING.md
similarity index 100%
rename from docs/CONTRIBUTING.md
rename to src/LuaEngine/docs/CONTRIBUTING.md
diff --git a/docs/DOC_GEN.md b/src/LuaEngine/docs/DOC_GEN.md
similarity index 100%
rename from docs/DOC_GEN.md
rename to src/LuaEngine/docs/DOC_GEN.md
diff --git a/docs/Eluna.png b/src/LuaEngine/docs/Eluna.png
similarity index 100%
rename from docs/Eluna.png
rename to src/LuaEngine/docs/Eluna.png
diff --git a/docs/ElunaDoc/.gitignore b/src/LuaEngine/docs/ElunaDoc/.gitignore
similarity index 100%
rename from docs/ElunaDoc/.gitignore
rename to src/LuaEngine/docs/ElunaDoc/.gitignore
diff --git a/docs/ElunaDoc/__init__.py b/src/LuaEngine/docs/ElunaDoc/__init__.py
similarity index 100%
rename from docs/ElunaDoc/__init__.py
rename to src/LuaEngine/docs/ElunaDoc/__init__.py
diff --git a/docs/ElunaDoc/__main__.py b/src/LuaEngine/docs/ElunaDoc/__main__.py
similarity index 100%
rename from docs/ElunaDoc/__main__.py
rename to src/LuaEngine/docs/ElunaDoc/__main__.py
diff --git a/docs/ElunaDoc/parser.py b/src/LuaEngine/docs/ElunaDoc/parser.py
similarity index 100%
rename from docs/ElunaDoc/parser.py
rename to src/LuaEngine/docs/ElunaDoc/parser.py
diff --git a/docs/ElunaDoc/static/FiraSans-Medium.woff b/src/LuaEngine/docs/ElunaDoc/static/FiraSans-Medium.woff
similarity index 100%
rename from docs/ElunaDoc/static/FiraSans-Medium.woff
rename to src/LuaEngine/docs/ElunaDoc/static/FiraSans-Medium.woff
diff --git a/docs/ElunaDoc/static/FiraSans-Regular.woff b/src/LuaEngine/docs/ElunaDoc/static/FiraSans-Regular.woff
similarity index 100%
rename from docs/ElunaDoc/static/FiraSans-Regular.woff
rename to src/LuaEngine/docs/ElunaDoc/static/FiraSans-Regular.woff
diff --git a/docs/ElunaDoc/static/Heuristica-Italic.woff b/src/LuaEngine/docs/ElunaDoc/static/Heuristica-Italic.woff
similarity index 100%
rename from docs/ElunaDoc/static/Heuristica-Italic.woff
rename to src/LuaEngine/docs/ElunaDoc/static/Heuristica-Italic.woff
diff --git a/docs/ElunaDoc/static/SourceCodePro-Regular.woff b/src/LuaEngine/docs/ElunaDoc/static/SourceCodePro-Regular.woff
similarity index 100%
rename from docs/ElunaDoc/static/SourceCodePro-Regular.woff
rename to src/LuaEngine/docs/ElunaDoc/static/SourceCodePro-Regular.woff
diff --git a/docs/ElunaDoc/static/SourceCodePro-Semibold.woff b/src/LuaEngine/docs/ElunaDoc/static/SourceCodePro-Semibold.woff
similarity index 100%
rename from docs/ElunaDoc/static/SourceCodePro-Semibold.woff
rename to src/LuaEngine/docs/ElunaDoc/static/SourceCodePro-Semibold.woff
diff --git a/docs/ElunaDoc/static/SourceSerifPro-Bold.woff b/src/LuaEngine/docs/ElunaDoc/static/SourceSerifPro-Bold.woff
similarity index 100%
rename from docs/ElunaDoc/static/SourceSerifPro-Bold.woff
rename to src/LuaEngine/docs/ElunaDoc/static/SourceSerifPro-Bold.woff
diff --git a/docs/ElunaDoc/static/SourceSerifPro-Regular.woff b/src/LuaEngine/docs/ElunaDoc/static/SourceSerifPro-Regular.woff
similarity index 100%
rename from docs/ElunaDoc/static/SourceSerifPro-Regular.woff
rename to src/LuaEngine/docs/ElunaDoc/static/SourceSerifPro-Regular.woff
diff --git a/docs/ElunaDoc/static/eluna-logo.png b/src/LuaEngine/docs/ElunaDoc/static/eluna-logo.png
similarity index 100%
rename from docs/ElunaDoc/static/eluna-logo.png
rename to src/LuaEngine/docs/ElunaDoc/static/eluna-logo.png
diff --git a/docs/ElunaDoc/static/favicon.ico b/src/LuaEngine/docs/ElunaDoc/static/favicon.ico
similarity index 100%
rename from docs/ElunaDoc/static/favicon.ico
rename to src/LuaEngine/docs/ElunaDoc/static/favicon.ico
diff --git a/docs/ElunaDoc/static/jquery.js b/src/LuaEngine/docs/ElunaDoc/static/jquery.js
similarity index 100%
rename from docs/ElunaDoc/static/jquery.js
rename to src/LuaEngine/docs/ElunaDoc/static/jquery.js
diff --git a/docs/ElunaDoc/static/main.css b/src/LuaEngine/docs/ElunaDoc/static/main.css
similarity index 100%
rename from docs/ElunaDoc/static/main.css
rename to src/LuaEngine/docs/ElunaDoc/static/main.css
diff --git a/docs/ElunaDoc/static/main.js b/src/LuaEngine/docs/ElunaDoc/static/main.js
similarity index 100%
rename from docs/ElunaDoc/static/main.js
rename to src/LuaEngine/docs/ElunaDoc/static/main.js
diff --git a/docs/ElunaDoc/static/normalize.css b/src/LuaEngine/docs/ElunaDoc/static/normalize.css
similarity index 100%
rename from docs/ElunaDoc/static/normalize.css
rename to src/LuaEngine/docs/ElunaDoc/static/normalize.css
diff --git a/docs/ElunaDoc/templates/_base.html b/src/LuaEngine/docs/ElunaDoc/templates/_base.html
similarity index 100%
rename from docs/ElunaDoc/templates/_base.html
rename to src/LuaEngine/docs/ElunaDoc/templates/_base.html
diff --git a/docs/ElunaDoc/templates/class.html b/src/LuaEngine/docs/ElunaDoc/templates/class.html
similarity index 100%
rename from docs/ElunaDoc/templates/class.html
rename to src/LuaEngine/docs/ElunaDoc/templates/class.html
diff --git a/docs/ElunaDoc/templates/date.js b/src/LuaEngine/docs/ElunaDoc/templates/date.js
similarity index 100%
rename from docs/ElunaDoc/templates/date.js
rename to src/LuaEngine/docs/ElunaDoc/templates/date.js
diff --git a/docs/ElunaDoc/templates/enum.html b/src/LuaEngine/docs/ElunaDoc/templates/enum.html
similarity index 100%
rename from docs/ElunaDoc/templates/enum.html
rename to src/LuaEngine/docs/ElunaDoc/templates/enum.html
diff --git a/docs/ElunaDoc/templates/index.html b/src/LuaEngine/docs/ElunaDoc/templates/index.html
similarity index 100%
rename from docs/ElunaDoc/templates/index.html
rename to src/LuaEngine/docs/ElunaDoc/templates/index.html
diff --git a/docs/ElunaDoc/templates/method.html b/src/LuaEngine/docs/ElunaDoc/templates/method.html
similarity index 100%
rename from docs/ElunaDoc/templates/method.html
rename to src/LuaEngine/docs/ElunaDoc/templates/method.html
diff --git a/docs/ElunaDoc/templates/search-index.js b/src/LuaEngine/docs/ElunaDoc/templates/search-index.js
similarity index 100%
rename from docs/ElunaDoc/templates/search-index.js
rename to src/LuaEngine/docs/ElunaDoc/templates/search-index.js
diff --git a/docs/ElunaDoc/templates/sidebar.js b/src/LuaEngine/docs/ElunaDoc/templates/sidebar.js
similarity index 100%
rename from docs/ElunaDoc/templates/sidebar.js
rename to src/LuaEngine/docs/ElunaDoc/templates/sidebar.js
diff --git a/docs/IMPL_DETAILS.md b/src/LuaEngine/docs/IMPL_DETAILS.md
similarity index 100%
rename from docs/IMPL_DETAILS.md
rename to src/LuaEngine/docs/IMPL_DETAILS.md
diff --git a/docs/INSTALL.md b/src/LuaEngine/docs/INSTALL.md
similarity index 100%
rename from docs/INSTALL.md
rename to src/LuaEngine/docs/INSTALL.md
diff --git a/docs/MERGING.md b/src/LuaEngine/docs/MERGING.md
similarity index 100%
rename from docs/MERGING.md
rename to src/LuaEngine/docs/MERGING.md
diff --git a/docs/USAGE.md b/src/LuaEngine/docs/USAGE.md
similarity index 100%
rename from docs/USAGE.md
rename to src/LuaEngine/docs/USAGE.md
diff --git a/extensions/ObjectVariables.ext b/src/LuaEngine/extensions/ObjectVariables.ext
similarity index 100%
rename from extensions/ObjectVariables.ext
rename to src/LuaEngine/extensions/ObjectVariables.ext
diff --git a/extensions/StackTracePlus/LICENSE b/src/LuaEngine/extensions/StackTracePlus/LICENSE
similarity index 100%
rename from extensions/StackTracePlus/LICENSE
rename to src/LuaEngine/extensions/StackTracePlus/LICENSE
diff --git a/extensions/StackTracePlus/README.md b/src/LuaEngine/extensions/StackTracePlus/README.md
similarity index 100%
rename from extensions/StackTracePlus/README.md
rename to src/LuaEngine/extensions/StackTracePlus/README.md
diff --git a/extensions/StackTracePlus/StackTracePlus.ext b/src/LuaEngine/extensions/StackTracePlus/StackTracePlus.ext
similarity index 100%
rename from extensions/StackTracePlus/StackTracePlus.ext
rename to src/LuaEngine/extensions/StackTracePlus/StackTracePlus.ext
diff --git a/extensions/_Misc.ext b/src/LuaEngine/extensions/_Misc.ext
similarity index 100%
rename from extensions/_Misc.ext
rename to src/LuaEngine/extensions/_Misc.ext
diff --git a/libs/httplib.h b/src/LuaEngine/libs/httplib.h
similarity index 100%
rename from libs/httplib.h
rename to src/LuaEngine/libs/httplib.h
diff --git a/libs/rigtorp/SPSCQueue.h b/src/LuaEngine/libs/rigtorp/SPSCQueue.h
similarity index 100%
rename from libs/rigtorp/SPSCQueue.h
rename to src/LuaEngine/libs/rigtorp/SPSCQueue.h
diff --git a/lmarshal.cpp b/src/LuaEngine/lmarshal.cpp
similarity index 100%
rename from lmarshal.cpp
rename to src/LuaEngine/lmarshal.cpp
diff --git a/lmarshal.h b/src/LuaEngine/lmarshal.h
similarity index 100%
rename from lmarshal.h
rename to src/LuaEngine/lmarshal.h
From 882c07c3cfcab6140db2a209e41af51d22f7a078 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Sat, 26 Mar 2022 21:34:21 +0100
Subject: [PATCH 098/112] Copy mod-eluna-lua-engine
Copy https://github.com/azerothcore/mod-eluna-lua-engine/tree/35da9552aeedd436345faece5699bbd9e9fc9466 here.
---
.editorconfig | 8 +
.git_commit_template.txt | 49 +
.gitattributes | 105 ++
.github/workflows/core_build.yml | 45 +
.gitignore | 48 +
.gitmodules | 4 +
README.md | 48 +
README_CN.md | 45 +
README_ES.md | 20 +
_config.yml | 1 +
conf/mod_LuaEngine.conf.dist | 114 +++
icon.png | Bin 0 -> 4095 bytes
include.sh | 0
sql/README.md | 24 +
sql/auth/.gitkeep | 0
sql/characters/.gitkeep | 0
sql/world/.gitkeep | 0
src/ElunaLuaEngine_SC.cpp | 947 +++++++++++++++++
src/eluna_lua_engine_loader.cpp | 25 +
src/lualib/CMakeLists.txt | 34 +
src/lualib/lapi.c | 1284 +++++++++++++++++++++++
src/lualib/lapi.h | 24 +
src/lualib/lauxlib.c | 959 +++++++++++++++++
src/lualib/lauxlib.h | 212 ++++
src/lualib/lbaselib.c | 458 +++++++++
src/lualib/lbitlib.c | 212 ++++
src/lualib/lcode.c | 881 ++++++++++++++++
src/lualib/lcode.h | 83 ++
src/lualib/lcorolib.c | 155 +++
src/lualib/lctype.c | 52 +
src/lualib/lctype.h | 95 ++
src/lualib/ldblib.c | 408 ++++++++
src/lualib/ldebug.c | 610 +++++++++++
src/lualib/ldebug.h | 34 +
src/lualib/ldo.c | 681 +++++++++++++
src/lualib/ldo.h | 46 +
src/lualib/ldump.c | 173 ++++
src/lualib/lfunc.c | 161 +++
src/lualib/lfunc.h | 33 +
src/lualib/lgc.c | 1220 ++++++++++++++++++++++
src/lualib/lgc.h | 157 +++
src/lualib/linit.c | 67 ++
src/lualib/liolib.c | 666 ++++++++++++
src/lualib/llex.c | 530 ++++++++++
src/lualib/llex.h | 78 ++
src/lualib/llimits.h | 309 ++++++
src/lualib/lmathlib.c | 279 +++++
src/lualib/lmem.c | 99 ++
src/lualib/lmem.h | 57 ++
src/lualib/loadlib.c | 725 +++++++++++++
src/lualib/lobject.c | 287 ++++++
src/lualib/lobject.h | 607 +++++++++++
src/lualib/lopcodes.c | 107 ++
src/lualib/lopcodes.h | 288 ++++++
src/lualib/loslib.c | 323 ++++++
src/lualib/lparser.c | 1638 ++++++++++++++++++++++++++++++
src/lualib/lparser.h | 119 +++
src/lualib/lstate.c | 323 ++++++
src/lualib/lstate.h | 228 +++++
src/lualib/lstring.c | 185 ++++
src/lualib/lstring.h | 46 +
src/lualib/lstrlib.c | 1019 +++++++++++++++++++
src/lualib/ltable.c | 588 +++++++++++
src/lualib/ltable.h | 45 +
src/lualib/ltablib.c | 285 ++++++
src/lualib/ltm.c | 77 ++
src/lualib/ltm.h | 57 ++
src/lualib/lua.c | 497 +++++++++
src/lualib/lua.h | 444 ++++++++
src/lualib/lua.hpp | 9 +
src/lualib/luac.c | 432 ++++++++
src/lualib/luaconf.h | 551 ++++++++++
src/lualib/lualib.h | 55 +
src/lualib/lundump.c | 258 +++++
src/lualib/lundump.h | 28 +
src/lualib/lvm.c | 867 ++++++++++++++++
src/lualib/lvm.h | 44 +
src/lualib/lzio.c | 76 ++
src/lualib/lzio.h | 65 ++
79 files changed, 21813 insertions(+)
create mode 100644 .editorconfig
create mode 100644 .git_commit_template.txt
create mode 100644 .gitattributes
create mode 100644 .github/workflows/core_build.yml
create mode 100644 .gitignore
create mode 100644 .gitmodules
create mode 100644 README.md
create mode 100644 README_CN.md
create mode 100644 README_ES.md
create mode 100644 _config.yml
create mode 100644 conf/mod_LuaEngine.conf.dist
create mode 100644 icon.png
create mode 100644 include.sh
create mode 100644 sql/README.md
create mode 100644 sql/auth/.gitkeep
create mode 100644 sql/characters/.gitkeep
create mode 100644 sql/world/.gitkeep
create mode 100644 src/ElunaLuaEngine_SC.cpp
create mode 100644 src/eluna_lua_engine_loader.cpp
create mode 100644 src/lualib/CMakeLists.txt
create mode 100644 src/lualib/lapi.c
create mode 100644 src/lualib/lapi.h
create mode 100644 src/lualib/lauxlib.c
create mode 100644 src/lualib/lauxlib.h
create mode 100644 src/lualib/lbaselib.c
create mode 100644 src/lualib/lbitlib.c
create mode 100644 src/lualib/lcode.c
create mode 100644 src/lualib/lcode.h
create mode 100644 src/lualib/lcorolib.c
create mode 100644 src/lualib/lctype.c
create mode 100644 src/lualib/lctype.h
create mode 100644 src/lualib/ldblib.c
create mode 100644 src/lualib/ldebug.c
create mode 100644 src/lualib/ldebug.h
create mode 100644 src/lualib/ldo.c
create mode 100644 src/lualib/ldo.h
create mode 100644 src/lualib/ldump.c
create mode 100644 src/lualib/lfunc.c
create mode 100644 src/lualib/lfunc.h
create mode 100644 src/lualib/lgc.c
create mode 100644 src/lualib/lgc.h
create mode 100644 src/lualib/linit.c
create mode 100644 src/lualib/liolib.c
create mode 100644 src/lualib/llex.c
create mode 100644 src/lualib/llex.h
create mode 100644 src/lualib/llimits.h
create mode 100644 src/lualib/lmathlib.c
create mode 100644 src/lualib/lmem.c
create mode 100644 src/lualib/lmem.h
create mode 100644 src/lualib/loadlib.c
create mode 100644 src/lualib/lobject.c
create mode 100644 src/lualib/lobject.h
create mode 100644 src/lualib/lopcodes.c
create mode 100644 src/lualib/lopcodes.h
create mode 100644 src/lualib/loslib.c
create mode 100644 src/lualib/lparser.c
create mode 100644 src/lualib/lparser.h
create mode 100644 src/lualib/lstate.c
create mode 100644 src/lualib/lstate.h
create mode 100644 src/lualib/lstring.c
create mode 100644 src/lualib/lstring.h
create mode 100644 src/lualib/lstrlib.c
create mode 100644 src/lualib/ltable.c
create mode 100644 src/lualib/ltable.h
create mode 100644 src/lualib/ltablib.c
create mode 100644 src/lualib/ltm.c
create mode 100644 src/lualib/ltm.h
create mode 100644 src/lualib/lua.c
create mode 100644 src/lualib/lua.h
create mode 100644 src/lualib/lua.hpp
create mode 100644 src/lualib/luac.c
create mode 100644 src/lualib/luaconf.h
create mode 100644 src/lualib/lualib.h
create mode 100644 src/lualib/lundump.c
create mode 100644 src/lualib/lundump.h
create mode 100644 src/lualib/lvm.c
create mode 100644 src/lualib/lvm.h
create mode 100644 src/lualib/lzio.c
create mode 100644 src/lualib/lzio.h
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..eb64e2f
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,8 @@
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 4
+tab_width = 4
+insert_final_newline = true
+trim_trailing_whitespace = true
+max_line_length = 80
diff --git a/.git_commit_template.txt b/.git_commit_template.txt
new file mode 100644
index 0000000..708b551
--- /dev/null
+++ b/.git_commit_template.txt
@@ -0,0 +1,49 @@
+### TITLE
+## Type(Scope/Subscope): Commit ultra short explanation
+## |---- Write below the examples with a maximum of 50 characters ----|
+## Example 1: fix(DB/SAI): Missing spell to NPC Hogger
+## Example 2: fix(CORE/Raid): Phase 2 of Ragnaros
+## Example 3: feat(CORE/Commands): New GM command to do something
+
+
+### DESCRIPTION
+## Explain why this change is being made, what does it fix etc...
+## |---- Write below the examples with a maximum of 72 characters per lines ----|
+## Example: Hogger (id: 492) was not charging player when being engaged.
+
+
+## Provide links to any issue, commit, pull request or other resource
+## Example 1: Closes issue #23
+## Example 2: Ported from other project's commit (link)
+## Example 3: References taken from wowpedia / wowhead / wowwiki / https://wowgaming.altervista.org/aowow/
+
+
+
+## =======================================================
+## EXTRA INFOS
+## =======================================================
+## "Type" can be:
+## feat (new feature)
+## fix (bug fix)
+## refactor (refactoring production code)
+## style (formatting, missing semi colons, etc; no code change)
+## docs (changes to documentation)
+## test (adding or refactoring tests; no production code change)
+## chore (updating bash scripts, git files etc; no production code change)
+## --------------------
+## Remember to
+## Capitalize the subject line
+## Use the imperative mood in the subject line
+## Do not end the subject line with a period
+## Separate subject from body with a blank line
+## Use the body to explain what and why rather than how
+## Can use multiple lines with "-" for bullet points in body
+## --------------------
+## More info here https://www.conventionalcommits.org/en/v1.0.0-beta.2/
+## =======================================================
+## "Scope" can be:
+## CORE (core related, c++)
+## DB (database related, sql)
+## =======================================================
+## "Subscope" is optional and depends on the nature of the commit.
+## =======================================================
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..7ef9001
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,105 @@
+## AUTO-DETECT
+## Handle line endings automatically for files detected as
+## text and leave all files detected as binary untouched.
+## This will handle all files NOT defined below.
+* text=auto eol=lf
+
+# Text
+*.conf text
+*.conf.dist text
+*.cmake text
+
+## Scripts
+*.sh text
+*.fish text
+*.lua text
+
+## SQL
+*.sql text
+
+## C++
+*.c text
+*.cc text
+*.cxx text
+*.cpp text
+*.c++ text
+*.hpp text
+*.h text
+*.h++ text
+*.hh text
+
+
+## For documentation
+
+# Documents
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
+
+## DOCUMENTATION
+*.markdown text
+*.md text
+*.mdwn text
+*.mdown text
+*.mkd text
+*.mkdn text
+*.mdtxt text
+*.mdtext text
+*.txt text
+AUTHORS text
+CHANGELOG text
+CHANGES text
+CONTRIBUTING text
+COPYING text
+copyright text
+*COPYRIGHT* text
+INSTALL text
+license text
+LICENSE text
+NEWS text
+readme text
+*README* text
+TODO text
+
+## GRAPHICS
+*.ai binary
+*.bmp binary
+*.eps binary
+*.gif binary
+*.ico binary
+*.jng binary
+*.jp2 binary
+*.jpg binary
+*.jpeg binary
+*.jpx binary
+*.jxr binary
+*.pdf binary
+*.png binary
+*.psb binary
+*.psd binary
+*.svg text
+*.svgz binary
+*.tif binary
+*.tiff binary
+*.wbmp binary
+*.webp binary
+
+
+## ARCHIVES
+*.7z binary
+*.gz binary
+*.jar binary
+*.rar binary
+*.tar binary
+*.zip binary
+
+## EXECUTABLES
+*.exe binary
+*.pyc binary
diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml
new file mode 100644
index 0000000..34d5439
--- /dev/null
+++ b/.github/workflows/core_build.yml
@@ -0,0 +1,45 @@
+name: core-build
+on:
+ push:
+ pull_request:
+
+jobs:
+ build:
+ strategy:
+ fail-fast: false
+ matrix:
+ compiler: [clang]
+ runs-on: ubuntu-latest
+ name: ${{ matrix.compiler }}
+ env:
+ COMPILER: ${{ matrix.compiler }}
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ repository: 'azerothcore/azerothcore-wotlk'
+ ref: 'master'
+ submodules: 'recursive'
+ - uses: actions/checkout@v2
+ with:
+ submodules: 'recursive'
+ path: 'modules/mod-eluna-lua-engine'
+ - name: Cache
+ uses: actions/cache@v1.1.2
+ with:
+ path: /home/runner/.ccache
+ key: ccache:${{ matrix.compiler }}:${{ github.ref }}:${{ github.sha }}
+ restore-keys: |
+ ccache:${{ matrix.compiler }}:${{ github.ref }}
+ ccache:${{ matrix.compiler }}
+ - name: Configure OS
+ run: source ./apps/ci/ci-install.sh
+ env:
+ CONTINUOUS_INTEGRATION: true
+ - name: Import db
+ run: source ./apps/ci/ci-import-db.sh
+ - name: Build
+ run: source ./apps/ci/ci-compile.sh
+ - name: Dry run
+ run: source ./apps/ci/ci-worldserver-dry-run.sh
+ - name: Check startup errors
+ run: source ./apps/ci/ci-error-check.sh
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c6e1299
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,48 @@
+!.gitignore
+
+#
+#Generic
+#
+
+.directory
+.mailmap
+*.orig
+*.rej
+*.*~
+.hg/
+*.kdev*
+.DS_Store
+CMakeLists.txt.user
+*.bak
+*.patch
+*.diff
+*.REMOTE.*
+*.BACKUP.*
+*.BASE.*
+*.LOCAL.*
+
+#
+# IDE & other softwares
+#
+/.settings/
+/.externalToolBuilders/*
+# exclude in all levels
+nbproject/
+.sync.ffs_db
+*.kate-swp
+
+#
+# Eclipse
+#
+*.pydevproject
+.metadata
+.gradle
+tmp/
+*.tmp
+*.swp
+*~.nib
+local.properties
+.settings/
+.loadpath
+.project
+.cproject
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..1bb8b63
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,4 @@
+[submodule "LuaEngine"]
+ path = src/LuaEngine
+ url = https://github.com/azerothcore/Eluna.git
+ branch = master
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..dbb23e4
--- /dev/null
+++ b/README.md
@@ -0,0 +1,48 @@
+#  mod-eluna-lua-engine for AzerothCore
+- Latest build status with azerothcore: [](https://github.com/azerothcore/mod-eluna-lua-engine)
+
+[english](README.md) | [中文说明](README_CN.md) | [Español](README_ES.md)
+
+An [Eluna](https://github.com/ElunaLuaEngine/Eluna) module for AzerothCore.
+
+## How to install:
+
+### 1) Download the sources
+
+You can get the sources using git.
+
+#### download with git
+
+1. open a terminal inside your `azerothcore-wotlk` folder
+2. go inside the **modules** folder: `cd modules`
+3. download the module sources using:
+```
+git clone https://github.com/azerothcore/mod-eluna-lua-engine.git
+```
+4. go inside the **mod-eluna-lua-engine** folder: `cd mod-eluna-lua-engine`
+5. download the Eluna sources using `git submodule update --init`
+
+Optional: if you need to update Eluna to the latest version, you can `cd src` and `cd LuaEngine` and run `git pull` from there.
+
+
+### 2) Build
+
+You need to run the cmake again and and rebuild the project.
+
+Eluna API for AC:
+[https://www.azerothcore.org/pages/eluna/index.html](https://www.azerothcore.org/pages/eluna/index.html)
+
+## How to update the Eluna version (for project mainteners)
+
+1) `cd` into `mod-eluna-lua-engine`
+2) `git checkout master`
+3) cd `LuaEngine`
+4) `git checkout master`
+5) `git pull`
+6) `cd ..` so you get back to `mod-eluna-lua-engine`
+7) `git checkout -b some-new-unique-branch-name`
+8) `git add LuaEngine`
+9) `git commit -m "feat: update Eluna version"`
+10) `git push`
+11) The terminal will tell you something like `fatal: The current branch some-new-unique-branch-name has no upstream branch.` and suggest the command to use, for example: `git push --set-upstream origin some-new-unique-branch-name`
+12) Open [the repo on Github](https://github.com/azerothcore/mod-eluna-lua-engine) and create a new PR
diff --git a/README_CN.md b/README_CN.md
new file mode 100644
index 0000000..36a7152
--- /dev/null
+++ b/README_CN.md
@@ -0,0 +1,45 @@
+
+#  mod-eluna-lua-engine for AzerothCore
+- 最新版本在Azerothcore的构建状态: [](https://github.com/azerothcore/mod-eluna-lua-engine)
+
+[english](README.md) | [中文说明](README_CN.md) | [Español](README_ES.md)
+
+一个用于Azerothcore的[Eluna](https://github.com/ElunaLuaEngine/Eluna)模块.
+
+## 如何安装:
+
+### 1) 下载源码
+
+你可以使用git(推荐)或手动下载源代码的方法安装。
+
+#### 使用git(推荐)下载
+
+1. 在你的`azerothcore-wotlk`源码文件夹中打开命令行(win的用户进入目录后shift+鼠标右键可以通过右键菜单打开)
+2. 进入 **modules** 文件夹,命令行中输入: `cd modules`
+3. 下载模块源码:
+```
+git clone https://github.com/azerothcore/mod-eluna-lua-engine.git
+```
+4. 下载模块源码后进入文件夹 **mod-eluna-lua-engine**,命令行中输入: `cd mod-eluna-lua-engine`
+5. 下载Eluna源码,命令行中输入: `git submodule update --init`
+
+可选: 模块中集成的Eluna是稳定版本,如果你要更新Eluna到最新版本,你可以进入目录**LuaEngine**(命令行输入:`cd LuaEngine`),进入后输入`git pull`获取即可更新最新版本.
+请注意,最新版本可能和稳定版的源码不匹配.视情况可能需要自行修正.
+
+#### 手动下载
+
+1. 下载 [mod-eluna-lua-engine](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
+2. 解压到你的`azerothcore-wotlk`源码中的**modules**文件夹中,请确保路径看起来是这样的`azerothcore-wotlk/modules/mod-eluna-lua-engine`
+3. 下载 [Eluna](https://github.com/azerothcore/Eluna/archive/master.zip)
+4. 把文件解压到 `mod-eluna-lua-engine/LuaEngine`. `LuaEngine.h`这个文件的路径看起来应该是这样的`mod-eluna-lua-engine/LuaEngine/LuaEngine.h`.
+
+### 2) 生成
+
+你需要重新CMake并重新生成你的项目.
+
+
+Eluna API :
+[http://elunaluaengine.github.io/](http://elunaluaengine.github.io/)
+Eluna 中文文档(重构):
+[http://wiki.uiwow.com/doku.php/eluna:start](http://wiki.uiwow.com/doku.php/eluna:start)
+
diff --git a/README_ES.md b/README_ES.md
new file mode 100644
index 0000000..39f6161
--- /dev/null
+++ b/README_ES.md
@@ -0,0 +1,20 @@
+# mod-LuaEngine
+ [English](README.md) | [中文说明](README_CN.md) | [Español](README_ES.md)
+
+Un módulo de Eluna para AzerothCore.
+
+Cómo instalar:
+
+1. Descargar o clonar este módulo:
+> [Descargar archivo zip](https://github.com/azerothcore/mod-eluna-lua-engine/archive/master.zip)
+> o clonar `git clone https://github.com/azerothcore/mod-eluna-lua-engine.git`
+2. Póngalo en la carpeta de módulos del Azerothcore.
+> $HOME/azerothcore/modules/
+3. Descargar o clonar el archivo central de ELUNA:
+> [Descargar archivo zip](https://github.com/ElunaLuaEngine/Eluna/archive/master.zip)
+> o clonar `git clone https://github.com/ElunaLuaEngine/Eluna.git .`
+4. Dentro de la carpeta del módulo de Eluna de Azeroth, se encuentra una carpeta / directorio llamado: `LuaEngine` (mod-eluna-lua-engine/LuaEngine). Debe depositar los ficheros de lua, directamente dentro de esa carpeta. Los archivos directamente, no un directorio y luego los ficheros dentro. Por eso te utiliza el “.” cuando se está clonando, para que no genere un directorio nuevo.
+5. Una vez copiado los ficheros y descargado el modulo, debes volver a compilar. Si seguiste la guía de instalación, debiste haber generado un directorio build, dentro de azerothcore. Dirígete a él y realiza la compilación como lo menciona en la guía.
+
+Eluna API :
+[http://elunaluaengine.github.io/](http://elunaluaengine.github.io/)
diff --git a/_config.yml b/_config.yml
new file mode 100644
index 0000000..3397c9a
--- /dev/null
+++ b/_config.yml
@@ -0,0 +1 @@
+theme: jekyll-theme-architect
\ No newline at end of file
diff --git a/conf/mod_LuaEngine.conf.dist b/conf/mod_LuaEngine.conf.dist
new file mode 100644
index 0000000..0fd798c
--- /dev/null
+++ b/conf/mod_LuaEngine.conf.dist
@@ -0,0 +1,114 @@
+[worldserver]
+
+###################################################################################################
+# ELUNA SETTINGS
+#
+# Eluna.Enabled
+# Description: Enable or disable Eluna LuaEngine
+# Default: true - (enabled)
+# false - (disabled)
+#
+# Eluna.TraceBack
+# Description: Sets whether to use debug.traceback function on a lua error or not.
+# Notice that you can redefine the function.
+# Default: false - (use default error output)
+# true - (use debug.traceback function)
+#
+# Eluna.ScriptPath
+# Description: Sets the location of the script folder to load scripts from
+# The path can be relative or absolute.
+# Default: "lua_scripts"
+#
+
+Eluna.Enabled = true
+Eluna.TraceBack = false
+Eluna.ScriptPath = "lua_scripts"
+
+
+###################################################################################################
+# LOGGING SYSTEM SETTINGS
+#
+# Appender config values: Given an appender "name"
+# Appender.name
+# Description: Defines 'where to log'.
+# Format: Type,LogLevel,Flags,optional1,optional2,optional3
+#
+# Type
+# 0 - (None)
+# 1 - (Console)
+# 2 - (File)
+# 3 - (DB)
+#
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Fatal)
+# 2 - (Error)
+# 3 - (Warning)
+# 4 - (Info)
+# 5 - (Debug)
+# 6 - (Trace)
+#
+# Flags:
+# 0 - None
+# 1 - Prefix Timestamp to the text
+# 2 - Prefix Log Level to the text
+# 4 - Prefix Log Filter type to the text
+# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS
+# (Only used with Type = 2)
+# 16 - Make a backup of existing file before overwrite
+# (Only used with Mode = w)
+#
+# Colors (read as optional1 if Type = Console)
+# Format: "fatal error warn info debug trace"
+# 0 - BLACK
+# 1 - RED
+# 2 - GREEN
+# 3 - BROWN
+# 4 - BLUE
+# 5 - MAGENTA
+# 6 - CYAN
+# 7 - GREY
+# 8 - YELLOW
+# 9 - LRED
+# 10 - LGREEN
+# 11 - LBLUE
+# 12 - LMAGENTA
+# 13 - LCYAN
+# 14 - WHITE
+# Example: "1 9 3 6 5 8"
+#
+# File: Name of the file (read as optional1 if Type = File)
+# Allows to use one "%s" to create dynamic files
+#
+# Mode: Mode to open the file (read as optional2 if Type = File)
+# a - (Append)
+# w - (Overwrite)
+#
+# MaxFileSize: Maximum file size of the log file before creating a new log file
+# (read as optional3 if Type = File)
+# Size is measured in bytes expressed in a 64-bit unsigned integer.
+# Maximum value is 4294967295 (4 GB). Leave blank for no limit.
+# NOTE: Does not work with dynamic filenames.
+# Example: 536870912 (512 MB)
+#
+Appender.ElunaLog=2,5,0,eluna.log,w
+Appender.ElunaConsole=1,4,0,"0 9 0 3 5 0"
+
+# Logger config values: Given a logger "name"
+# Logger.name
+# Description: Defines 'What to log'
+# Format: LogLevel,AppenderList
+#
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Fatal)
+# 2 - (Error)
+# 3 - (Warning)
+# 4 - (Info)
+# 5 - (Debug)
+# 6 - (Trace)
+#
+# AppenderList: List of appenders linked to logger
+# (Using spaces as separator).
+#
+Logger.eluna=6,ElunaLog ElunaConsole
diff --git a/icon.png b/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..35e9047b02d06cf73c245878dfc1ad1ef38aed04
GIT binary patch
literal 4095
zcma)9XE+;<*9~H(W@@j*D790xHj$_mTdh)?+N!ovQX@!-Ql-?a+Oca>J63EpYt|lB
zE!C?2{XV~6-gBRG&vVb`bD!tlctd?nS{e=-002O%t%WqcR;T|+MRDDI*I%1n3x$KO
zCKB-PzshSbPQ7-heYGr~0stWJeuG4{vdrob-Uwy
zm`7b}4z6ZKf`C+R%uc$$90f=)FqyHAQx|RAQLfZ8cwk<%`xd{~$38HTxd)*&CSATo
zgHF&5@+e%sTM2Z6i4`0GNd*L){)ivvT=0`Hl4?V!p&etYrI!)MK`ZUYe~8W7*+DDh
zy#E)uiE8+aoTSl!-Mf5hcZ^J9X{qDsaunwB1lf{s4Al(a*mWt;R%|%js?cX+7CE6j
zm&*2=KUCH|7IFjNU}S`39#N?fC!urr$#B;gZQlG+u+C$Qt?gyD+8#p@=~!|Aw4raIl=Q>ov4Fv)eKkd%o
z;LeM=
z23kuq7DX=*{L)eLM<72A<}JJynKY~8ohZC;QC=0pgvPUp5U__&V*SBo+E<*?-_Twq
zQmUNu&a|*xW87i*A~~a<*;3?&5-k>ify-mRlS0GeHO_h5XP%Blh`$uxreteb8~j&o
z*AsT={0R0&0~=?a)RhrJ1!jyVuPI?EJfp%9$Pyi`PF##wT)l5`MUV(a_s|b&chdUl
zg)#KHol2|x+Os3wT9G0uW01M_rKOl9EdOUPhUe3cSP#bS>x~9zLV}e_@|@hIRAJ~%
z$0jluJ63xhZVx|c)Wua?3Mi2C^kn>D)K>es4-#MJW1^p=PvL|S^?+>J2U>3!Glk}4
z+Gu7!=1FUrv7+iPpdHgnlof)1y%`+FA_8W
zMwE<{DK~K`nC6&B=`?H(&u*&joQ2_{L-<1L>>apa?eaUDUq~?rJv`y4wq}mKZ9<#?WE#|s%WDv4FXqWi&
zaP9RjaHPuU<-k;N@X41>S)6Ym1jODd7n^f3#gG}JrKH1LmUtV~**k0!X!L97?j7$%
zt$+ht!w}X&-WNRTGE|e)n4WR=6q#rl1tE>poB$l{g?Q=`Eti=N>RhgODdus8k>YI4
z$$5T~2UK2^!eIo2S+aai42VA55X&|V{t}^FEytmKpj*F$k!$4h1C8@y%F5k#-7Efz
zJEs^}2_y%9o9RL-{)>aXqt@hcwcl!?bBBsJdGaP_%(KN)x}UTOPMhLgPKQq44Bo3u
z_+}Y#JLa>ez1omwuQ5i4Aw>Wgihgg;hOC$Gn#l~iEz%^@sT!<93-hMAe}qKAY<#T8
z@Ih@!LIkqichm$FwwZjIe2R1#N-{Orrhky_qux?0i!C@-bi+e6cTPJ6LXSX`X2~}aR!mxnxf5b
zf~c?|-PE(Xc7JFJp|kKTAdj{Gf&}Q2`g-MSLDrXl&bQ4zLz&`W{Dh(8JqxtbRp3p6
z9fak9VUlBjVoaRG^1Z5eHpAT`^y37B>a%-!CvscbuijarMiN__?rw*z9#B+vNwuj&
z?x>;D$7CPvLv7LmTpbjeb#y{j&b8~2Bdl0J{}PkeBs
zp2X==g;tusvQVkRzFp-rwY|R?N*c90@~qjUZb3``CB$mj*{XE11)cVWjN>x&F{yoV
zKslLiEj<{!Y5$X~7j;Wz?aZYapTJ-I+dPqWAxThcTa8Wb1_!<|*&^G}x;)waByG9G
z29VtglgbVzLHUT9yF#6V(zG-|HYyO50zQrlHccAXq{tw2FcVRk<;m
z1hh@tuqvaZCcA*8N%VzhqL64RI}=R8-pZ|HT~I9o*i#Ny?I#3#zJcmpI+N-s5$>)R
zs&nh&(4O?=t#JB$VG$cc_TIU>G`G^7c)Ny<)xfZ=FejNVomWdvSY%-!=UDQw9U5Q}
z#G9@Tq=!=Qzt~k4s2MG2L1TWeZwXa!X$M=fx_;h%I5hl`*G3{^B5
zD0~^3bDA>pz3z73+cpEAd;vIMQjT$9(4b6Fxdrfu_s~I966;xx-^18sxWR*9N{5jE
zy&R{9XuGf57R$h;k*kT5ZDsGRJRlA^&0>tRnTL^+lvK>cf2GfpRU_pCSKBP&+uDCz
zxvv^fl|C*x4oOZ-(Cb?e5h=gtn>Y|(;^jPD=we%
zjyP|U8*-roLBm1mL7s56`R8`hJi2h*NIV7=GwreH`5syYG-yP#YayI}b~iJYdBS8{
z{`yIXdbL{3DjHCfem4V@tG%GQ2O)+pHS!hd5p8jYQQjo7y&=n-ZEiHRqLSy``ya(6
zB!-nxQkQ%~f2fSuJ}{I|U2lq4>SMd*
zo6b)y0k;d8U;|RUAI;$l5j6ouQLlVQRg7D>D<0+x7c#P=IfaY2xovAtM`y!cd=%!L
zOmu+B`G;3$*bKM%w8l)=1V%&~ABQXbl`r#%gt7(kw72TH689@J`V!YeY#l1ci^PbH
zxH@s?o@z4eu90aY*6hB06Qj|aiTSXHo|!xH4P|Rkg>%E9q2Y%!9Fk}0ZmjK1J{mMn
z6iA-9kRqZ~nP!Vjqdzz5_h)-7>}NF{Za3`I@HX8LwI*YC?aC=tDX|26(4d{O@L~u(S47g5MN=C_5
z(~+ziO)S`AS?_hkVC`U>TC>)o}qflh)V`PU?cBkF#0u8divqZ~#a1arCCyKERxZnu3&
zjQq?zR%y4U+{&rku`s|df*vqJRpZ!-Ig;2YlqVWACnU0z|i*KnCeOBNL1~3cCahqxLNJ8he_GyIOl6-<}}4+liXf1Z)WRO}R>0CBeW^
zx#PuQLVn+KUEzVJIhE(xY;iyrKI<2?(L<@njN2g@n-3uJ5NYkK`lL}&T`L#kxYUvk
zTH`=`%ws`cjA*j3bt4YfNNGOI_yPJ|Mju5gU!^>N9{J#-HN}5shDE6d@TL&_0^3bk
zkBXheh3tF~PFzWf>;%Q!QxBK4BF*@nDk)8lq*{Faq2<_8mH(P@u5^&Igo8fdX{3;E
zw*F?tF9W%js)>)Wt^uWs1-KlGko2;>WP|687pDen%C!LgQ^U-z220-RBD;a2QK-AV
z^IE=Wi0u+ce>^1hOlrR&H+9D>QiWy<%JqsW=ug$uNnVcTg76XPt-NVKslQGr8fG%4
zR6zMy_C8)H&xBp&lJzEYjD#S}GiE)={}0&B&4v2uqkqgK%JDFR$jk(f4FlFYMezNd
z#2)`VX?38JSx;?g-a0xH{)3>3n23AB<{S@skE;`F&{i$)b-Wm3WWb%d|Ip^cJh;T%wgv4UMfy_zoqm~e!Kf*qh
zkFp{w$xDHxke;lgLN9TW?X2zUV79V7qSt+yNp)I>&M%qy{flZ9A)pCGI0b-=gIZmu
zy5+6!1)icK5%3^y#y7{>>+q7wV{kjy+;mkzm2^<8;jDgTh(NWP8UG1ls@lC#dEaDU
zZ%?)j@qVX2@f#isZ7RJWuI(lnqA+##J;qcY6bYSM;_{6=HGGD
zy8T6H)_X6}vpXXDx4GEk1<4stfBF#JHI).
+ */
+
+#include "Chat.h"
+#include "ElunaEventMgr.h"
+#include "Log.h"
+#include "LuaEngine.h"
+#include "Pet.h"
+#include "Player.h"
+#include "ScriptMgr.h"
+#include "ScriptedGossip.h"
+
+class Eluna_AllCreatureScript : public AllCreatureScript
+{
+public:
+ Eluna_AllCreatureScript() : AllCreatureScript("Eluna_AllCreatureScript") { }
+
+ // Creature
+ bool CanCreatureGossipHello(Player* player, Creature* creature) override
+ {
+ if (sEluna->OnGossipHello(player, creature))
+ return true;
+
+ return false;
+ }
+
+ bool CanCreatureGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) override
+ {
+ if (sEluna->OnGossipSelect(player, creature, sender, action))
+ return true;
+
+ return false;
+ }
+
+ bool CanCreatureGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code) override
+ {
+ if (sEluna->OnGossipSelectCode(player, creature, sender, action, code))
+ return true;
+
+ return false;
+ }
+
+ void OnCreatureAddWorld(Creature* creature) override
+ {
+ sEluna->OnAddToWorld(creature);
+
+ if (creature->IsGuardian() && creature->ToTempSummon() && creature->ToTempSummon()->GetSummonerGUID().IsPlayer())
+ sEluna->OnPetAddedToWorld(creature->ToTempSummon()->GetSummonerUnit()->ToPlayer(), creature);
+ }
+
+ void OnCreatureRemoveWorld(Creature* creature) override
+ {
+ sEluna->OnRemoveFromWorld(creature);
+ }
+
+ bool CanCreatureQuestAccept(Player* player, Creature* creature, Quest const* quest) override
+ {
+ sEluna->OnQuestAccept(player, creature, quest);
+ return false;
+ }
+
+ bool CanCreatureQuestReward(Player* player, Creature* creature, Quest const* quest, uint32 opt) override
+ {
+ if (sEluna->OnQuestReward(player, creature, quest, opt))
+ {
+ ClearGossipMenuFor(player);
+ return true;
+ }
+
+ return false;
+ }
+
+ CreatureAI* GetCreatureAI(Creature* creature) const override
+ {
+ if (CreatureAI* luaAI = sEluna->GetAI(creature))
+ return luaAI;
+
+ return nullptr;
+ }
+};
+
+class Eluna_AllGameObjectScript : public AllGameObjectScript
+{
+public:
+ Eluna_AllGameObjectScript() : AllGameObjectScript("Eluna_AllGameObjectScript") { }
+
+ void OnGameObjectAddWorld(GameObject* go) override
+ {
+ sEluna->OnAddToWorld(go);
+ }
+
+ void OnGameObjectRemoveWorld(GameObject* go) override
+ {
+ sEluna->OnRemoveFromWorld(go);
+ }
+
+ void OnGameObjectUpdate(GameObject* go, uint32 diff) override
+ {
+ sEluna->UpdateAI(go, diff);
+ }
+
+ bool CanGameObjectGossipHello(Player* player, GameObject* go) override
+ {
+ if (sEluna->OnGossipHello(player, go))
+ return true;
+
+ if (sEluna->OnGameObjectUse(player, go))
+ return true;
+
+ return false;
+ }
+
+ void OnGameObjectDamaged(GameObject* go, Player* player) override
+ {
+ sEluna->OnDamaged(go, player);
+ }
+
+ void OnGameObjectDestroyed(GameObject* go, Player* player) override
+ {
+ sEluna->OnDestroyed(go, player);
+ }
+
+ void OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* /*unit*/) override
+ {
+ sEluna->OnLootStateChanged(go, state);
+ }
+
+ void OnGameObjectStateChanged(GameObject* go, uint32 state) override
+ {
+ sEluna->OnGameObjectStateChanged(go, state);
+ }
+
+ bool CanGameObjectQuestAccept(Player* player, GameObject* go, Quest const* quest) override
+ {
+ sEluna->OnQuestAccept(player, go, quest);
+ return false;
+ }
+
+ bool CanGameObjectGossipSelect(Player* player, GameObject* go, uint32 sender, uint32 action) override
+ {
+ if (sEluna->OnGossipSelect(player, go, sender, action))
+ return true;
+
+ return false;
+ }
+
+ bool CanGameObjectGossipSelectCode(Player* player, GameObject* go, uint32 sender, uint32 action, const char* code) override
+ {
+ if (sEluna->OnGossipSelectCode(player, go, sender, action, code))
+ return true;
+
+ return false;
+ }
+
+ bool CanGameObjectQuestReward(Player* player, GameObject* go, Quest const* quest, uint32 opt) override
+ {
+ if (sEluna->OnQuestAccept(player, go, quest))
+ return false;
+
+ if (sEluna->OnQuestReward(player, go, quest, opt))
+ return false;
+
+ return true;
+ }
+
+ GameObjectAI* GetGameObjectAI(GameObject* go) const override
+ {
+ sEluna->OnSpawn(go);
+ return nullptr;
+ }
+};
+
+class Eluna_AllItemScript : public AllItemScript
+{
+public:
+ Eluna_AllItemScript() : AllItemScript("Eluna_AllItemScript") { }
+
+ bool CanItemQuestAccept(Player* player, Item* item, Quest const* quest) override
+ {
+ if (sEluna->OnQuestAccept(player, item, quest))
+ return false;
+
+ return true;
+ }
+
+ bool CanItemUse(Player* player, Item* item, SpellCastTargets const& targets) override
+ {
+ if (!sEluna->OnUse(player, item, targets))
+ return true;
+
+ return false;
+ }
+
+ bool CanItemExpire(Player* player, ItemTemplate const* proto) override
+ {
+ if (sEluna->OnExpire(player, proto))
+ return false;
+
+ return true;
+ }
+
+ bool CanItemRemove(Player* player, Item* item) override
+ {
+ if (sEluna->OnRemove(player, item))
+ return false;
+
+ return true;
+ }
+
+ void OnItemGossipSelect(Player* player, Item* item, uint32 sender, uint32 action) override
+ {
+ sEluna->HandleGossipSelectOption(player, item, sender, action, "");
+ }
+
+ void OnItemGossipSelectCode(Player* player, Item* item, uint32 sender, uint32 action, const char* code) override
+ {
+ sEluna->HandleGossipSelectOption(player, item, sender, action, code);
+ }
+};
+
+class Eluna_AllMapScript : public AllMapScript
+{
+public:
+ Eluna_AllMapScript() : AllMapScript("Eluna_AllMapScript") { }
+
+ void OnBeforeCreateInstanceScript(InstanceMap* instanceMap, InstanceScript* instanceData, bool /*load*/, std::string /*data*/, uint32 /*completedEncounterMask*/) override
+ {
+ instanceData = sEluna->GetInstanceData(instanceMap);
+ }
+
+ void OnDestroyInstance(MapInstanced* /*mapInstanced*/, Map* map) override
+ {
+ sEluna->FreeInstanceId(map->GetInstanceId());
+ }
+
+ void OnCreateMap(Map* map) override
+ {
+ sEluna->OnCreate(map);
+ }
+
+ void OnDestroyMap(Map* map) override
+ {
+ sEluna->OnDestroy(map);
+ }
+
+ void OnPlayerEnterAll(Map* map, Player* player) override
+ {
+ sEluna->OnPlayerEnter(map, player);
+ }
+
+ void OnPlayerLeaveAll(Map* map, Player* player) override
+ {
+ sEluna->OnPlayerLeave(map, player);
+ }
+
+ void OnMapUpdate(Map* map, uint32 diff) override
+ {
+ sEluna->OnUpdate(map, diff);
+ }
+};
+
+class Eluna_AuctionHouseScript : public AuctionHouseScript
+{
+public:
+ Eluna_AuctionHouseScript() : AuctionHouseScript("Eluna_AuctionHouseScript") { }
+
+ void OnAuctionAdd(AuctionHouseObject* ah, AuctionEntry* entry) override
+ {
+ sEluna->OnAdd(ah, entry);
+ }
+
+ void OnAuctionRemove(AuctionHouseObject* ah, AuctionEntry* entry) override
+ {
+ sEluna->OnRemove(ah, entry);
+ }
+
+ void OnAuctionSuccessful(AuctionHouseObject* ah, AuctionEntry* entry) override
+ {
+ sEluna->OnSuccessful(ah, entry);
+ }
+
+ void OnAuctionExpire(AuctionHouseObject* ah, AuctionEntry* entry) override
+ {
+ sEluna->OnExpire(ah, entry);
+ }
+};
+
+class Eluna_BGScript : public BGScript
+{
+public:
+ Eluna_BGScript() : BGScript("Eluna_BGScript") { }
+
+ void OnBattlegroundStart(Battleground* bg) override
+ {
+ sEluna->OnBGStart(bg, bg->GetBgTypeID(), bg->GetInstanceID());
+ }
+
+ void OnBattlegroundEnd(Battleground* bg, TeamId winnerTeam) override
+ {
+ sEluna->OnBGEnd(bg, bg->GetBgTypeID(), bg->GetInstanceID(), winnerTeam);
+ }
+
+ void OnBattlegroundDestroy(Battleground* bg) override
+ {
+ sEluna->OnBGDestroy(bg, bg->GetBgTypeID(), bg->GetInstanceID());
+ }
+
+ void OnBattlegroundCreate(Battleground* bg) override
+ {
+ sEluna->OnBGCreate(bg, bg->GetBgTypeID(), bg->GetInstanceID());
+ }
+};
+
+class Eluna_CommandSC : public CommandSC
+{
+public:
+ Eluna_CommandSC() : CommandSC("Eluna_CommandSC") { }
+
+ bool CanExecuteCommand(ChatHandler& handler, std::string_view cmdStr) override
+ {
+ if (!sEluna->OnCommand(handler, std::string(cmdStr).c_str()))
+ {
+ return false;
+ }
+
+ return true;
+ }
+};
+
+class Eluna_ElunaScript : public ElunaScript
+{
+public:
+ Eluna_ElunaScript() : ElunaScript("Eluna_ElunaScript") { }
+
+ // Weather
+ void OnWeatherChange(Weather* weather, WeatherState state, float grade) override
+ {
+ sEluna->OnChange(weather, weather->GetZone(), state, grade);
+ }
+
+ // AreaTriger
+ bool CanAreaTrigger(Player* player, AreaTrigger const* trigger) override
+ {
+ if (sEluna->OnAreaTrigger(player, trigger))
+ return true;
+
+ return false;
+ }
+};
+
+class Eluna_GameEventScript : public GameEventScript
+{
+public:
+ Eluna_GameEventScript() : GameEventScript("Eluna_GameEventScript") { }
+
+ void OnEventStart(uint16 eventID)
+ {
+ sEluna->OnGameEventStart(eventID);
+ }
+
+ void OnEventStop(uint16 eventID)
+ {
+ sEluna->OnGameEventStop(eventID);
+ }
+};
+
+class Eluna_GroupScript : public GroupScript
+{
+public:
+ Eluna_GroupScript() : GroupScript("Eluna_GroupScript") { }
+
+ void OnAddMember(Group* group, ObjectGuid guid) override
+ {
+ sEluna->OnAddMember(group, guid);
+ }
+
+ void OnInviteMember(Group* group, ObjectGuid guid) override
+ {
+ sEluna->OnInviteMember(group, guid);
+ }
+
+ void OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid /* kicker */, const char* /* reason */) override
+ {
+ sEluna->OnRemoveMember(group, guid, method);
+ }
+
+ void OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) override
+ {
+ sEluna->OnChangeLeader(group, newLeaderGuid, oldLeaderGuid);
+ }
+
+ void OnDisband(Group* group) override
+ {
+ sEluna->OnDisband(group);
+ }
+};
+
+class Eluna_GuildScript : public GuildScript
+{
+public:
+ Eluna_GuildScript() : GuildScript("Eluna_GuildScript") { }
+
+ void OnAddMember(Guild* guild, Player* player, uint8& plRank) override
+ {
+ sEluna->OnAddMember(guild, player, plRank);
+ }
+
+ void OnRemoveMember(Guild* guild, Player* player, bool isDisbanding, bool /*isKicked*/) override
+ {
+ sEluna->OnRemoveMember(guild, player, isDisbanding);
+ }
+
+ void OnMOTDChanged(Guild* guild, const std::string& newMotd) override
+ {
+ sEluna->OnMOTDChanged(guild, newMotd);
+ }
+
+ void OnInfoChanged(Guild* guild, const std::string& newInfo) override
+ {
+ sEluna->OnInfoChanged(guild, newInfo);
+ }
+
+ void OnCreate(Guild* guild, Player* leader, const std::string& name) override
+ {
+ sEluna->OnCreate(guild, leader, name);
+ }
+
+ void OnDisband(Guild* guild) override
+ {
+ sEluna->OnDisband(guild);
+ }
+
+ void OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair) override
+ {
+ sEluna->OnMemberWitdrawMoney(guild, player, amount, isRepair);
+ }
+
+ void OnMemberDepositMoney(Guild* guild, Player* player, uint32& amount) override
+ {
+ sEluna->OnMemberDepositMoney(guild, player, amount);
+ }
+
+ void OnItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId,
+ bool isDestBank, uint8 destContainer, uint8 destSlotId) override
+ {
+ sEluna->OnItemMove(guild, player, pItem, isSrcBank, srcContainer, srcSlotId, isDestBank, destContainer, destSlotId);
+ }
+
+ void OnEvent(Guild* guild, uint8 eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2, uint8 newRank) override
+ {
+ sEluna->OnEvent(guild, eventType, playerGuid1, playerGuid2, newRank);
+ }
+
+ void OnBankEvent(Guild* guild, uint8 eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId) override
+ {
+ sEluna->OnBankEvent(guild, eventType, tabId, playerGuid, itemOrMoney, itemStackCount, destTabId);
+ }
+};
+
+class Eluna_LootScript : public LootScript
+{
+public:
+ Eluna_LootScript() : LootScript("Eluna_LootScript") { }
+
+ void OnLootMoney(Player* player, uint32 gold) override
+ {
+ sEluna->OnLootMoney(player, gold);
+ }
+};
+
+class Eluna_MiscScript : public MiscScript
+{
+public:
+ Eluna_MiscScript() : MiscScript("Eluna_MiscScript") { }
+
+ void GetDialogStatus(Player* player, Object* questgiver) override
+ {
+ if (questgiver->GetTypeId() == TYPEID_GAMEOBJECT)
+ sEluna->GetDialogStatus(player, questgiver->ToGameObject());
+ else if (questgiver->GetTypeId() == TYPEID_UNIT)
+ sEluna->GetDialogStatus(player, questgiver->ToCreature());
+ }
+};
+
+class Eluna_PetScript : public PetScript
+{
+public:
+ Eluna_PetScript() : PetScript("Eluna_PetScript") { }
+
+ void OnPetAddToWorld(Pet* pet) override
+ {
+ sEluna->OnPetAddedToWorld(pet->GetOwner(), pet);
+ }
+};
+
+class Eluna_PlayerScript : public PlayerScript
+{
+public:
+ Eluna_PlayerScript() : PlayerScript("Eluna_PlayerScript") { }
+
+ void OnPlayerResurrect(Player* player, float /*restore_percent*/, bool /*applySickness*/) override
+ {
+ sEluna->OnResurrect(player);
+ }
+
+ bool CanPlayerUseChat(Player* player, uint32 type, uint32 lang, std::string& msg) override
+ {
+ if (type != CHAT_MSG_SAY && type != CHAT_MSG_YELL && type != CHAT_MSG_EMOTE)
+ return true;
+
+ if (!sEluna->OnChat(player, type, lang, msg))
+ return false;
+
+ return true;
+ }
+
+ bool CanPlayerUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Player* target) override
+ {
+ if (!sEluna->OnChat(player, type, lang, msg, target))
+ return false;
+
+ return true;
+ }
+
+ bool CanPlayerUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) override
+ {
+ if (!sEluna->OnChat(player, type, lang, msg, group))
+ return false;
+
+ return true;
+ }
+
+ bool CanPlayerUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild) override
+ {
+ if (!sEluna->OnChat(player, type, lang, msg, guild))
+ return false;
+
+ return true;
+ }
+
+ bool CanPlayerUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Channel* channel) override
+ {
+ if (!sEluna->OnChat(player, type, lang, msg, channel))
+ return false;
+
+ return true;
+ }
+
+ void OnLootItem(Player* player, Item* item, uint32 count, ObjectGuid lootguid) override
+ {
+ sEluna->OnLootItem(player, item, count, lootguid);
+ }
+
+ void OnPlayerLearnTalents(Player* player, uint32 talentId, uint32 talentRank, uint32 spellid) override
+ {
+ sEluna->OnLearnTalents(player, talentId, talentRank, spellid);
+ }
+
+ bool CanUseItem(Player* player, ItemTemplate const* proto, InventoryResult& result) override
+ {
+ result = sEluna->OnCanUseItem(player, proto->ItemId);
+ return result != EQUIP_ERR_OK ? false : true;
+ }
+
+ void OnEquip(Player* player, Item* it, uint8 bag, uint8 slot, bool /*update*/) override
+ {
+ sEluna->OnEquip(player, it, bag, slot);
+ }
+
+ void OnPlayerEnterCombat(Player* player, Unit* enemy) override
+ {
+ sEluna->OnPlayerEnterCombat(player, enemy);
+ }
+
+ void OnPlayerLeaveCombat(Player* player) override
+ {
+ sEluna->OnPlayerLeaveCombat(player);
+ }
+
+ bool CanRepopAtGraveyard(Player* player) override
+ {
+ sEluna->OnRepop(player);
+ return true;
+ }
+
+ void OnQuestAbandon(Player* player, uint32 questId) override
+ {
+ sEluna->OnQuestAbandon(player, questId);
+ }
+
+ void OnMapChanged(Player* player) override
+ {
+ sEluna->OnMapChanged(player);
+ }
+
+ void OnGossipSelect(Player* player, uint32 menu_id, uint32 sender, uint32 action) override
+ {
+ sEluna->HandleGossipSelectOption(player, menu_id, sender, action, "");
+ }
+
+ void OnGossipSelectCode(Player* player, uint32 menu_id, uint32 sender, uint32 action, const char* code) override
+ {
+ sEluna->HandleGossipSelectOption(player, menu_id, sender, action, code);
+ }
+
+ void OnPVPKill(Player* killer, Player* killed) override
+ {
+ sEluna->OnPVPKill(killer, killed);
+ }
+
+ void OnCreatureKill(Player* killer, Creature* killed) override
+ {
+ sEluna->OnCreatureKill(killer, killed);
+ }
+
+ void OnPlayerKilledByCreature(Creature* killer, Player* killed) override
+ {
+ sEluna->OnPlayerKilledByCreature(killer, killed);
+ }
+
+ void OnLevelChanged(Player* player, uint8 oldLevel) override
+ {
+ sEluna->OnLevelChanged(player, oldLevel);
+ }
+
+ void OnFreeTalentPointsChanged(Player* player, uint32 points) override
+ {
+ sEluna->OnFreeTalentPointsChanged(player, points);
+ }
+
+ void OnTalentsReset(Player* player, bool noCost) override
+ {
+ sEluna->OnTalentsReset(player, noCost);
+ }
+
+ void OnMoneyChanged(Player* player, int32& amount) override
+ {
+ sEluna->OnMoneyChanged(player, amount);
+ }
+
+ void OnGiveXP(Player* player, uint32& amount, Unit* victim) override
+ {
+ sEluna->OnGiveXP(player, amount, victim);
+ }
+
+ bool OnReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental) override
+ {
+ return sEluna->OnReputationChange(player, factionID, standing, incremental);
+ }
+
+ void OnDuelRequest(Player* target, Player* challenger) override
+ {
+ sEluna->OnDuelRequest(target, challenger);
+ }
+
+ void OnDuelStart(Player* player1, Player* player2) override
+ {
+ sEluna->OnDuelStart(player1, player2);
+ }
+
+ void OnDuelEnd(Player* winner, Player* loser, DuelCompleteType type) override
+ {
+ sEluna->OnDuelEnd(winner, loser, type);
+ }
+
+ void OnEmote(Player* player, uint32 emote) override
+ {
+ sEluna->OnEmote(player, emote);
+ }
+
+ void OnTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, ObjectGuid guid) override
+ {
+ sEluna->OnTextEmote(player, textEmote, emoteNum, guid);
+ }
+
+ void OnSpellCast(Player* player, Spell* spell, bool skipCheck) override
+ {
+ sEluna->OnSpellCast(player, spell, skipCheck);
+ }
+
+ void OnLogin(Player* player) override
+ {
+ sEluna->OnLogin(player);
+ }
+
+ void OnLogout(Player* player) override
+ {
+ sEluna->OnLogout(player);
+ }
+
+ void OnCreate(Player* player) override
+ {
+ sEluna->OnCreate(player);
+ }
+
+ void OnSave(Player* player) override
+ {
+ sEluna->OnSave(player);
+ }
+
+ void OnDelete(ObjectGuid guid, uint32 /*accountId*/) override
+ {
+ sEluna->OnDelete(guid.GetCounter());
+ }
+
+ void OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent) override
+ {
+ sEluna->OnBindToInstance(player, difficulty, mapid, permanent);
+ }
+
+ void OnUpdateZone(Player* player, uint32 newZone, uint32 newArea) override
+ {
+ sEluna->OnUpdateZone(player, newZone, newArea);
+ }
+
+ void OnFirstLogin(Player* player) override
+ {
+ sEluna->OnFirstLogin(player);
+ }
+};
+
+class Eluna_ServerScript : public ServerScript
+{
+public:
+ Eluna_ServerScript() : ServerScript("Eluna_ServerScript") { }
+
+ bool CanPacketSend(WorldSession* session, WorldPacket& packet) override
+ {
+ if (!sEluna->OnPacketSend(session, packet))
+ return false;
+
+ return true;
+ }
+
+ bool CanPacketReceive(WorldSession* session, WorldPacket& packet) override
+ {
+ if (!sEluna->OnPacketReceive(session, packet))
+ return false;
+
+ return true;
+ }
+};
+
+class Eluna_SpellSC : public SpellSC
+{
+public:
+ Eluna_SpellSC() : SpellSC("Eluna_SpellSC") { }
+
+ void OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, GameObject* gameObjTarget) override
+ {
+ sEluna->OnDummyEffect(caster, spellID, effIndex, gameObjTarget);
+ }
+
+ void OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, Creature* creatureTarget) override
+ {
+ sEluna->OnDummyEffect(caster, spellID, effIndex, creatureTarget);
+ }
+
+ void OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, Item* itemTarget) override
+ {
+ sEluna->OnDummyEffect(caster, spellID, effIndex, itemTarget);
+ }
+};
+
+class Eluna_UnitScript : public UnitScript
+{
+public:
+ Eluna_UnitScript() : UnitScript("Eluna_UnitScript") { }
+
+ void OnUnitUpdate(Unit* unit, uint32 diff) override
+ {
+ unit->elunaEvents->Update(diff);
+ }
+};
+
+class Eluna_VehicleScript : public VehicleScript
+{
+public:
+ Eluna_VehicleScript() : VehicleScript("Eluna_VehicleScript") { }
+
+ void OnInstall(Vehicle* veh) override
+ {
+ sEluna->OnInstall(veh);
+ }
+
+ void OnUninstall(Vehicle* veh) override
+ {
+ sEluna->OnUninstall(veh);
+ }
+
+ void OnInstallAccessory(Vehicle* veh, Creature* accessory) override
+ {
+ sEluna->OnInstallAccessory(veh, accessory);
+ }
+
+ void OnAddPassenger(Vehicle* veh, Unit* passenger, int8 seatId) override
+ {
+ sEluna->OnAddPassenger(veh, passenger, seatId);
+ }
+
+ void OnRemovePassenger(Vehicle* veh, Unit* passenger) override
+ {
+ sEluna->OnRemovePassenger(veh, passenger);
+ }
+};
+
+class Eluna_WorldObjectScript : public WorldObjectScript
+{
+public:
+ Eluna_WorldObjectScript() : WorldObjectScript("Eluna_WorldObjectScript") { }
+
+ void OnWorldObjectDestroy(WorldObject* object) override
+ {
+ delete object->elunaEvents;
+ object->elunaEvents = nullptr;
+ }
+
+ void OnWorldObjectCreate(WorldObject* object) override
+ {
+ object->elunaEvents = nullptr;
+ }
+
+ void OnWorldObjectSetMap(WorldObject* object, Map* /*map*/) override
+ {
+ delete object->elunaEvents;
+
+ // On multithread replace this with a pointer to map's Eluna pointer stored in a map
+ object->elunaEvents = new ElunaEventProcessor(&Eluna::GEluna, object);
+ }
+
+ void OnWorldObjectResetMap(WorldObject* object) override
+ {
+ delete object->elunaEvents;
+ object->elunaEvents = nullptr;
+ }
+
+ void OnWorldObjectUpdate(WorldObject* object, uint32 diff) override
+ {
+ object->elunaEvents->Update(diff);
+ }
+};
+
+class Eluna_WorldScript : public WorldScript
+{
+public:
+ Eluna_WorldScript() : WorldScript("Eluna_WorldScript") { }
+
+ void OnOpenStateChange(bool open) override
+ {
+ sEluna->OnOpenStateChange(open);
+ }
+
+ void OnBeforeConfigLoad(bool reload) override
+ {
+ if (!reload)
+ {
+ ///- Initialize Lua Engine
+ LOG_INFO("eluna", "Initialize Eluna Lua Engine...");
+ Eluna::Initialize();
+ }
+
+ sEluna->OnConfigLoad(reload, true);
+ }
+
+ void OnAfterConfigLoad(bool reload) override
+ {
+ sEluna->OnConfigLoad(reload, false);
+ }
+
+ void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask) override
+ {
+ sEluna->OnShutdownInitiate(code, mask);
+ }
+
+ void OnShutdownCancel() override
+ {
+ sEluna->OnShutdownCancel();
+ }
+
+ void OnUpdate(uint32 diff) override
+ {
+ sEluna->OnWorldUpdate(diff);
+ }
+
+ void OnStartup() override
+ {
+ sEluna->OnStartup();
+ }
+
+ void OnShutdown() override
+ {
+ sEluna->OnShutdown();
+ }
+
+ void OnAfterUnloadAllMaps() override
+ {
+ Eluna::Uninitialize();
+ }
+
+ void OnBeforeWorldInitialized() override
+ {
+ ///- Run eluna scripts.
+ // in multithread foreach: run scripts
+ sEluna->RunScripts();
+ sEluna->OnConfigLoad(false, false); // Must be done after Eluna is initialized and scripts have run.
+ }
+};
+
+// Group all custom scripts
+void AddSC_ElunaLuaEngine()
+{
+ new Eluna_AllCreatureScript();
+ new Eluna_AllGameObjectScript();
+ new Eluna_AllItemScript();
+ new Eluna_AllMapScript();
+ new Eluna_AuctionHouseScript();
+ new Eluna_BGScript();
+ new Eluna_CommandSC();
+ new Eluna_ElunaScript();
+ new Eluna_GameEventScript();
+ new Eluna_GroupScript();
+ new Eluna_GuildScript();
+ new Eluna_LootScript();
+ new Eluna_MiscScript();
+ new Eluna_PetScript();
+ new Eluna_PlayerScript();
+ new Eluna_ServerScript();
+ new Eluna_SpellSC();
+ new Eluna_UnitScript();
+ new Eluna_VehicleScript();
+ new Eluna_WorldObjectScript();
+ new Eluna_WorldScript();
+}
diff --git a/src/eluna_lua_engine_loader.cpp b/src/eluna_lua_engine_loader.cpp
new file mode 100644
index 0000000..12040dc
--- /dev/null
+++ b/src/eluna_lua_engine_loader.cpp
@@ -0,0 +1,25 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+// From SC
+void AddSC_ElunaLuaEngine();
+
+// Add all
+void Addmod_eluna_lua_engineScripts()
+{
+ AddSC_ElunaLuaEngine();
+}
diff --git a/src/lualib/CMakeLists.txt b/src/lualib/CMakeLists.txt
new file mode 100644
index 0000000..3f97344
--- /dev/null
+++ b/src/lualib/CMakeLists.txt
@@ -0,0 +1,34 @@
+#
+# Copyright (C) 2010 - 2014 Eluna Lua Engine
+# This program is free software licensed under GPL version 3
+# Please see the included DOCS/LICENSE.md for more information
+#
+
+CollectSourceFiles(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PRIVATE_SOURCES
+ # Exclude
+ ${CMAKE_CURRENT_SOURCE_DIR}/Debugging
+ ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
+
+list(REMOVE_ITEM PRIVATE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/lua.c)
+list(REMOVE_ITEM PRIVATE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/luac.c)
+
+add_library(lualib STATIC
+ ${PRIVATE_SOURCES})
+
+CollectIncludeDirectories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PUBLIC_INCLUDES)
+
+target_include_directories(lualib
+ PUBLIC
+ ${PUBLIC_INCLUDES}
+ PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR})
+
+if (APPLE)
+ target_compile_definitions(lualib PUBLIC LUA_USE_MACOSX)
+elseif (UNIX)
+ target_compile_definitions(lualib PUBLIC LUA_USE_LINUX)
+endif()
diff --git a/src/lualib/lapi.c b/src/lualib/lapi.c
new file mode 100644
index 0000000..d011431
--- /dev/null
+++ b/src/lualib/lapi.c
@@ -0,0 +1,1284 @@
+/*
+** $Id: lapi.c,v 2.171.1.1 2013/04/12 18:48:47 roberto Exp $
+** Lua API
+** See Copyright Notice in lua.h
+*/
+
+
+#include
+#include
+
+#define lapi_c
+#define LUA_CORE
+
+#include "lua.h"
+
+#include "lapi.h"
+#include "ldebug.h"
+#include "ldo.h"
+#include "lfunc.h"
+#include "lgc.h"
+#include "lmem.h"
+#include "lobject.h"
+#include "lstate.h"
+#include "lstring.h"
+#include "ltable.h"
+#include "ltm.h"
+#include "lundump.h"
+#include "lvm.h"
+
+
+
+const char lua_ident[] =
+ "$LuaVersion: " LUA_COPYRIGHT " $"
+ "$LuaAuthors: " LUA_AUTHORS " $";
+
+
+/* value at a non-valid index */
+#define NONVALIDVALUE cast(TValue *, luaO_nilobject)
+
+/* corresponding test */
+#define isvalid(o) ((o) != luaO_nilobject)
+
+/* test for pseudo index */
+#define ispseudo(i) ((i) <= LUA_REGISTRYINDEX)
+
+/* test for valid but not pseudo index */
+#define isstackindex(i, o) (isvalid(o) && !ispseudo(i))
+
+#define api_checkvalidindex(L, o) api_check(L, isvalid(o), "invalid index")
+
+#define api_checkstackindex(L, i, o) \
+ api_check(L, isstackindex(i, o), "index not in the stack")
+
+
+static TValue *index2addr (lua_State *L, int idx) {
+ CallInfo *ci = L->ci;
+ if (idx > 0) {
+ TValue *o = ci->func + idx;
+ api_check(L, idx <= ci->top - (ci->func + 1), "unacceptable index");
+ if (o >= L->top) return NONVALIDVALUE;
+ else return o;
+ }
+ else if (!ispseudo(idx)) { /* negative index */
+ api_check(L, idx != 0 && -idx <= L->top - (ci->func + 1), "invalid index");
+ return L->top + idx;
+ }
+ else if (idx == LUA_REGISTRYINDEX)
+ return &G(L)->l_registry;
+ else { /* upvalues */
+ idx = LUA_REGISTRYINDEX - idx;
+ api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large");
+ if (ttislcf(ci->func)) /* light C function? */
+ return NONVALIDVALUE; /* it has no upvalues */
+ else {
+ CClosure *func = clCvalue(ci->func);
+ return (idx <= func->nupvalues) ? &func->upvalue[idx-1] : NONVALIDVALUE;
+ }
+ }
+}
+
+
+/*
+** to be called by 'lua_checkstack' in protected mode, to grow stack
+** capturing memory errors
+*/
+static void growstack (lua_State *L, void *ud) {
+ int size = *(int *)ud;
+ luaD_growstack(L, size);
+}
+
+
+LUA_API int lua_checkstack (lua_State *L, int size) {
+ int res;
+ CallInfo *ci = L->ci;
+ lua_lock(L);
+ if (L->stack_last - L->top > size) /* stack large enough? */
+ res = 1; /* yes; check is OK */
+ else { /* no; need to grow stack */
+ int inuse = cast_int(L->top - L->stack) + EXTRA_STACK;
+ if (inuse > LUAI_MAXSTACK - size) /* can grow without overflow? */
+ res = 0; /* no */
+ else /* try to grow stack */
+ res = (luaD_rawrunprotected(L, &growstack, &size) == LUA_OK);
+ }
+ if (res && ci->top < L->top + size)
+ ci->top = L->top + size; /* adjust frame top */
+ lua_unlock(L);
+ return res;
+}
+
+
+LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
+ int i;
+ if (from == to) return;
+ lua_lock(to);
+ api_checknelems(from, n);
+ api_check(from, G(from) == G(to), "moving among independent states");
+ api_check(from, to->ci->top - to->top >= n, "not enough elements to move");
+ from->top -= n;
+ for (i = 0; i < n; i++) {
+ setobj2s(to, to->top++, from->top + i);
+ }
+ lua_unlock(to);
+}
+
+
+LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {
+ lua_CFunction old;
+ lua_lock(L);
+ old = G(L)->panic;
+ G(L)->panic = panicf;
+ lua_unlock(L);
+ return old;
+}
+
+
+LUA_API const lua_Number *lua_version (lua_State *L) {
+ static const lua_Number version = LUA_VERSION_NUM;
+ if (L == NULL) return &version;
+ else return G(L)->version;
+}
+
+
+
+/*
+** basic stack manipulation
+*/
+
+
+/*
+** convert an acceptable stack index into an absolute index
+*/
+LUA_API int lua_absindex (lua_State *L, int idx) {
+ return (idx > 0 || ispseudo(idx))
+ ? idx
+ : cast_int(L->top - L->ci->func + idx);
+}
+
+
+LUA_API int lua_gettop (lua_State *L) {
+ return cast_int(L->top - (L->ci->func + 1));
+}
+
+
+LUA_API void lua_settop (lua_State *L, int idx) {
+ StkId func = L->ci->func;
+ lua_lock(L);
+ if (idx >= 0) {
+ api_check(L, idx <= L->stack_last - (func + 1), "new top too large");
+ while (L->top < (func + 1) + idx)
+ setnilvalue(L->top++);
+ L->top = (func + 1) + idx;
+ }
+ else {
+ api_check(L, -(idx+1) <= (L->top - (func + 1)), "invalid new top");
+ L->top += idx+1; /* `subtract' index (index is negative) */
+ }
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_remove (lua_State *L, int idx) {
+ StkId p;
+ lua_lock(L);
+ p = index2addr(L, idx);
+ api_checkstackindex(L, idx, p);
+ while (++p < L->top) setobjs2s(L, p-1, p);
+ L->top--;
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_insert (lua_State *L, int idx) {
+ StkId p;
+ StkId q;
+ lua_lock(L);
+ p = index2addr(L, idx);
+ api_checkstackindex(L, idx, p);
+ for (q = L->top; q > p; q--) /* use L->top as a temporary */
+ setobjs2s(L, q, q - 1);
+ setobjs2s(L, p, L->top);
+ lua_unlock(L);
+}
+
+
+static void moveto (lua_State *L, TValue *fr, int idx) {
+ TValue *to = index2addr(L, idx);
+ api_checkvalidindex(L, to);
+ setobj(L, to, fr);
+ if (idx < LUA_REGISTRYINDEX) /* function upvalue? */
+ luaC_barrier(L, clCvalue(L->ci->func), fr);
+ /* LUA_REGISTRYINDEX does not need gc barrier
+ (collector revisits it before finishing collection) */
+}
+
+
+LUA_API void lua_replace (lua_State *L, int idx) {
+ lua_lock(L);
+ api_checknelems(L, 1);
+ moveto(L, L->top - 1, idx);
+ L->top--;
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) {
+ TValue *fr;
+ lua_lock(L);
+ fr = index2addr(L, fromidx);
+ moveto(L, fr, toidx);
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_pushvalue (lua_State *L, int idx) {
+ lua_lock(L);
+ setobj2s(L, L->top, index2addr(L, idx));
+ api_incr_top(L);
+ lua_unlock(L);
+}
+
+
+
+/*
+** access functions (stack -> C)
+*/
+
+
+LUA_API int lua_type (lua_State *L, int idx) {
+ StkId o = index2addr(L, idx);
+ return (isvalid(o) ? ttypenv(o) : LUA_TNONE);
+}
+
+
+LUA_API const char *lua_typename (lua_State *L, int t) {
+ UNUSED(L);
+ return ttypename(t);
+}
+
+
+LUA_API int lua_iscfunction (lua_State *L, int idx) {
+ StkId o = index2addr(L, idx);
+ return (ttislcf(o) || (ttisCclosure(o)));
+}
+
+
+LUA_API int lua_isnumber (lua_State *L, int idx) {
+ TValue n;
+ const TValue *o = index2addr(L, idx);
+ return tonumber(o, &n);
+}
+
+
+LUA_API int lua_isstring (lua_State *L, int idx) {
+ int t = lua_type(L, idx);
+ return (t == LUA_TSTRING || t == LUA_TNUMBER);
+}
+
+
+LUA_API int lua_isuserdata (lua_State *L, int idx) {
+ const TValue *o = index2addr(L, idx);
+ return (ttisuserdata(o) || ttislightuserdata(o));
+}
+
+
+LUA_API int lua_rawequal (lua_State *L, int index1, int index2) {
+ StkId o1 = index2addr(L, index1);
+ StkId o2 = index2addr(L, index2);
+ return (isvalid(o1) && isvalid(o2)) ? luaV_rawequalobj(o1, o2) : 0;
+}
+
+
+LUA_API void lua_arith (lua_State *L, int op) {
+ StkId o1; /* 1st operand */
+ StkId o2; /* 2nd operand */
+ lua_lock(L);
+ if (op != LUA_OPUNM) /* all other operations expect two operands */
+ api_checknelems(L, 2);
+ else { /* for unary minus, add fake 2nd operand */
+ api_checknelems(L, 1);
+ setobjs2s(L, L->top, L->top - 1);
+ L->top++;
+ }
+ o1 = L->top - 2;
+ o2 = L->top - 1;
+ if (ttisnumber(o1) && ttisnumber(o2)) {
+ setnvalue(o1, luaO_arith(op, nvalue(o1), nvalue(o2)));
+ }
+ else
+ luaV_arith(L, o1, o1, o2, cast(TMS, op - LUA_OPADD + TM_ADD));
+ L->top--;
+ lua_unlock(L);
+}
+
+
+LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) {
+ StkId o1, o2;
+ int i = 0;
+ lua_lock(L); /* may call tag method */
+ o1 = index2addr(L, index1);
+ o2 = index2addr(L, index2);
+ if (isvalid(o1) && isvalid(o2)) {
+ switch (op) {
+ case LUA_OPEQ: i = equalobj(L, o1, o2); break;
+ case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break;
+ case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break;
+ default: api_check(L, 0, "invalid option");
+ }
+ }
+ lua_unlock(L);
+ return i;
+}
+
+
+LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *isnum) {
+ TValue n;
+ const TValue *o = index2addr(L, idx);
+ if (tonumber(o, &n)) {
+ if (isnum) *isnum = 1;
+ return nvalue(o);
+ }
+ else {
+ if (isnum) *isnum = 0;
+ return 0;
+ }
+}
+
+
+LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *isnum) {
+ TValue n;
+ const TValue *o = index2addr(L, idx);
+ if (tonumber(o, &n)) {
+ lua_Integer res;
+ lua_Number num = nvalue(o);
+ lua_number2integer(res, num);
+ if (isnum) *isnum = 1;
+ return res;
+ }
+ else {
+ if (isnum) *isnum = 0;
+ return 0;
+ }
+}
+
+
+LUA_API lua_Unsigned lua_tounsignedx (lua_State *L, int idx, int *isnum) {
+ TValue n;
+ const TValue *o = index2addr(L, idx);
+ if (tonumber(o, &n)) {
+ lua_Unsigned res;
+ lua_Number num = nvalue(o);
+ lua_number2unsigned(res, num);
+ if (isnum) *isnum = 1;
+ return res;
+ }
+ else {
+ if (isnum) *isnum = 0;
+ return 0;
+ }
+}
+
+
+LUA_API int lua_toboolean (lua_State *L, int idx) {
+ const TValue *o = index2addr(L, idx);
+ return !l_isfalse(o);
+}
+
+
+LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
+ StkId o = index2addr(L, idx);
+ if (!ttisstring(o)) {
+ lua_lock(L); /* `luaV_tostring' may create a new string */
+ if (!luaV_tostring(L, o)) { /* conversion failed? */
+ if (len != NULL) *len = 0;
+ lua_unlock(L);
+ return NULL;
+ }
+ luaC_checkGC(L);
+ o = index2addr(L, idx); /* previous call may reallocate the stack */
+ lua_unlock(L);
+ }
+ if (len != NULL) *len = tsvalue(o)->len;
+ return svalue(o);
+}
+
+
+LUA_API size_t lua_rawlen (lua_State *L, int idx) {
+ StkId o = index2addr(L, idx);
+ switch (ttypenv(o)) {
+ case LUA_TSTRING: return tsvalue(o)->len;
+ case LUA_TUSERDATA: return uvalue(o)->len;
+ case LUA_TTABLE: return luaH_getn(hvalue(o));
+ default: return 0;
+ }
+}
+
+
+LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {
+ StkId o = index2addr(L, idx);
+ if (ttislcf(o)) return fvalue(o);
+ else if (ttisCclosure(o))
+ return clCvalue(o)->f;
+ else return NULL; /* not a C function */
+}
+
+
+LUA_API void *lua_touserdata (lua_State *L, int idx) {
+ StkId o = index2addr(L, idx);
+ switch (ttypenv(o)) {
+ case LUA_TUSERDATA: return (rawuvalue(o) + 1);
+ case LUA_TLIGHTUSERDATA: return pvalue(o);
+ default: return NULL;
+ }
+}
+
+
+LUA_API lua_State *lua_tothread (lua_State *L, int idx) {
+ StkId o = index2addr(L, idx);
+ return (!ttisthread(o)) ? NULL : thvalue(o);
+}
+
+
+LUA_API const void *lua_topointer (lua_State *L, int idx) {
+ StkId o = index2addr(L, idx);
+ switch (ttype(o)) {
+ case LUA_TTABLE: return hvalue(o);
+ case LUA_TLCL: return clLvalue(o);
+ case LUA_TCCL: return clCvalue(o);
+ case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o)));
+ case LUA_TTHREAD: return thvalue(o);
+ case LUA_TUSERDATA:
+ case LUA_TLIGHTUSERDATA:
+ return lua_touserdata(L, idx);
+ default: return NULL;
+ }
+}
+
+
+
+/*
+** push functions (C -> stack)
+*/
+
+
+LUA_API void lua_pushnil (lua_State *L) {
+ lua_lock(L);
+ setnilvalue(L->top);
+ api_incr_top(L);
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
+ lua_lock(L);
+ setnvalue(L->top, n);
+ luai_checknum(L, L->top,
+ luaG_runerror(L, "C API - attempt to push a signaling NaN"));
+ api_incr_top(L);
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) {
+ lua_lock(L);
+ setnvalue(L->top, cast_num(n));
+ api_incr_top(L);
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_pushunsigned (lua_State *L, lua_Unsigned u) {
+ lua_Number n;
+ lua_lock(L);
+ n = lua_unsigned2number(u);
+ setnvalue(L->top, n);
+ api_incr_top(L);
+ lua_unlock(L);
+}
+
+
+LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) {
+ TString *ts;
+ lua_lock(L);
+ luaC_checkGC(L);
+ ts = luaS_newlstr(L, s, len);
+ setsvalue2s(L, L->top, ts);
+ api_incr_top(L);
+ lua_unlock(L);
+ return getstr(ts);
+}
+
+
+LUA_API const char *lua_pushstring (lua_State *L, const char *s) {
+ if (s == NULL) {
+ lua_pushnil(L);
+ return NULL;
+ }
+ else {
+ TString *ts;
+ lua_lock(L);
+ luaC_checkGC(L);
+ ts = luaS_new(L, s);
+ setsvalue2s(L, L->top, ts);
+ api_incr_top(L);
+ lua_unlock(L);
+ return getstr(ts);
+ }
+}
+
+
+LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt,
+ va_list argp) {
+ const char *ret;
+ lua_lock(L);
+ luaC_checkGC(L);
+ ret = luaO_pushvfstring(L, fmt, argp);
+ lua_unlock(L);
+ return ret;
+}
+
+
+LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) {
+ const char *ret;
+ va_list argp;
+ lua_lock(L);
+ luaC_checkGC(L);
+ va_start(argp, fmt);
+ ret = luaO_pushvfstring(L, fmt, argp);
+ va_end(argp);
+ lua_unlock(L);
+ return ret;
+}
+
+
+LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
+ lua_lock(L);
+ if (n == 0) {
+ setfvalue(L->top, fn);
+ }
+ else {
+ Closure *cl;
+ api_checknelems(L, n);
+ api_check(L, n <= MAXUPVAL, "upvalue index too large");
+ luaC_checkGC(L);
+ cl = luaF_newCclosure(L, n);
+ cl->c.f = fn;
+ L->top -= n;
+ while (n--)
+ setobj2n(L, &cl->c.upvalue[n], L->top + n);
+ setclCvalue(L, L->top, cl);
+ }
+ api_incr_top(L);
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_pushboolean (lua_State *L, int b) {
+ lua_lock(L);
+ setbvalue(L->top, (b != 0)); /* ensure that true is 1 */
+ api_incr_top(L);
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_pushlightuserdata (lua_State *L, void *p) {
+ lua_lock(L);
+ setpvalue(L->top, p);
+ api_incr_top(L);
+ lua_unlock(L);
+}
+
+
+LUA_API int lua_pushthread (lua_State *L) {
+ lua_lock(L);
+ setthvalue(L, L->top, L);
+ api_incr_top(L);
+ lua_unlock(L);
+ return (G(L)->mainthread == L);
+}
+
+
+
+/*
+** get functions (Lua -> stack)
+*/
+
+
+LUA_API void lua_getglobal (lua_State *L, const char *var) {
+ Table *reg = hvalue(&G(L)->l_registry);
+ const TValue *gt; /* global table */
+ lua_lock(L);
+ gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
+ setsvalue2s(L, L->top++, luaS_new(L, var));
+ luaV_gettable(L, gt, L->top - 1, L->top - 1);
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_gettable (lua_State *L, int idx) {
+ StkId t;
+ lua_lock(L);
+ t = index2addr(L, idx);
+ luaV_gettable(L, t, L->top - 1, L->top - 1);
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_getfield (lua_State *L, int idx, const char *k) {
+ StkId t;
+ lua_lock(L);
+ t = index2addr(L, idx);
+ setsvalue2s(L, L->top, luaS_new(L, k));
+ api_incr_top(L);
+ luaV_gettable(L, t, L->top - 1, L->top - 1);
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_rawget (lua_State *L, int idx) {
+ StkId t;
+ lua_lock(L);
+ t = index2addr(L, idx);
+ api_check(L, ttistable(t), "table expected");
+ setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1));
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_rawgeti (lua_State *L, int idx, int n) {
+ StkId t;
+ lua_lock(L);
+ t = index2addr(L, idx);
+ api_check(L, ttistable(t), "table expected");
+ setobj2s(L, L->top, luaH_getint(hvalue(t), n));
+ api_incr_top(L);
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_rawgetp (lua_State *L, int idx, const void *p) {
+ StkId t;
+ TValue k;
+ lua_lock(L);
+ t = index2addr(L, idx);
+ api_check(L, ttistable(t), "table expected");
+ setpvalue(&k, cast(void *, p));
+ setobj2s(L, L->top, luaH_get(hvalue(t), &k));
+ api_incr_top(L);
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_createtable (lua_State *L, int narray, int nrec) {
+ Table *t;
+ lua_lock(L);
+ luaC_checkGC(L);
+ t = luaH_new(L);
+ sethvalue(L, L->top, t);
+ api_incr_top(L);
+ if (narray > 0 || nrec > 0)
+ luaH_resize(L, t, narray, nrec);
+ lua_unlock(L);
+}
+
+
+LUA_API int lua_getmetatable (lua_State *L, int objindex) {
+ const TValue *obj;
+ Table *mt = NULL;
+ int res;
+ lua_lock(L);
+ obj = index2addr(L, objindex);
+ switch (ttypenv(obj)) {
+ case LUA_TTABLE:
+ mt = hvalue(obj)->metatable;
+ break;
+ case LUA_TUSERDATA:
+ mt = uvalue(obj)->metatable;
+ break;
+ default:
+ mt = G(L)->mt[ttypenv(obj)];
+ break;
+ }
+ if (mt == NULL)
+ res = 0;
+ else {
+ sethvalue(L, L->top, mt);
+ api_incr_top(L);
+ res = 1;
+ }
+ lua_unlock(L);
+ return res;
+}
+
+
+LUA_API void lua_getuservalue (lua_State *L, int idx) {
+ StkId o;
+ lua_lock(L);
+ o = index2addr(L, idx);
+ api_check(L, ttisuserdata(o), "userdata expected");
+ if (uvalue(o)->env) {
+ sethvalue(L, L->top, uvalue(o)->env);
+ } else
+ setnilvalue(L->top);
+ api_incr_top(L);
+ lua_unlock(L);
+}
+
+
+/*
+** set functions (stack -> Lua)
+*/
+
+
+LUA_API void lua_setglobal (lua_State *L, const char *var) {
+ Table *reg = hvalue(&G(L)->l_registry);
+ const TValue *gt; /* global table */
+ lua_lock(L);
+ api_checknelems(L, 1);
+ gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
+ setsvalue2s(L, L->top++, luaS_new(L, var));
+ luaV_settable(L, gt, L->top - 1, L->top - 2);
+ L->top -= 2; /* pop value and key */
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_settable (lua_State *L, int idx) {
+ StkId t;
+ lua_lock(L);
+ api_checknelems(L, 2);
+ t = index2addr(L, idx);
+ luaV_settable(L, t, L->top - 2, L->top - 1);
+ L->top -= 2; /* pop index and value */
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_setfield (lua_State *L, int idx, const char *k) {
+ StkId t;
+ lua_lock(L);
+ api_checknelems(L, 1);
+ t = index2addr(L, idx);
+ setsvalue2s(L, L->top++, luaS_new(L, k));
+ luaV_settable(L, t, L->top - 1, L->top - 2);
+ L->top -= 2; /* pop value and key */
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_rawset (lua_State *L, int idx) {
+ StkId t;
+ lua_lock(L);
+ api_checknelems(L, 2);
+ t = index2addr(L, idx);
+ api_check(L, ttistable(t), "table expected");
+ setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1);
+ invalidateTMcache(hvalue(t));
+ luaC_barrierback(L, gcvalue(t), L->top-1);
+ L->top -= 2;
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_rawseti (lua_State *L, int idx, int n) {
+ StkId t;
+ lua_lock(L);
+ api_checknelems(L, 1);
+ t = index2addr(L, idx);
+ api_check(L, ttistable(t), "table expected");
+ luaH_setint(L, hvalue(t), n, L->top - 1);
+ luaC_barrierback(L, gcvalue(t), L->top-1);
+ L->top--;
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) {
+ StkId t;
+ TValue k;
+ lua_lock(L);
+ api_checknelems(L, 1);
+ t = index2addr(L, idx);
+ api_check(L, ttistable(t), "table expected");
+ setpvalue(&k, cast(void *, p));
+ setobj2t(L, luaH_set(L, hvalue(t), &k), L->top - 1);
+ luaC_barrierback(L, gcvalue(t), L->top - 1);
+ L->top--;
+ lua_unlock(L);
+}
+
+
+LUA_API int lua_setmetatable (lua_State *L, int objindex) {
+ TValue *obj;
+ Table *mt;
+ lua_lock(L);
+ api_checknelems(L, 1);
+ obj = index2addr(L, objindex);
+ if (ttisnil(L->top - 1))
+ mt = NULL;
+ else {
+ api_check(L, ttistable(L->top - 1), "table expected");
+ mt = hvalue(L->top - 1);
+ }
+ switch (ttypenv(obj)) {
+ case LUA_TTABLE: {
+ hvalue(obj)->metatable = mt;
+ if (mt) {
+ luaC_objbarrierback(L, gcvalue(obj), mt);
+ luaC_checkfinalizer(L, gcvalue(obj), mt);
+ }
+ break;
+ }
+ case LUA_TUSERDATA: {
+ uvalue(obj)->metatable = mt;
+ if (mt) {
+ luaC_objbarrier(L, rawuvalue(obj), mt);
+ luaC_checkfinalizer(L, gcvalue(obj), mt);
+ }
+ break;
+ }
+ default: {
+ G(L)->mt[ttypenv(obj)] = mt;
+ break;
+ }
+ }
+ L->top--;
+ lua_unlock(L);
+ return 1;
+}
+
+
+LUA_API void lua_setuservalue (lua_State *L, int idx) {
+ StkId o;
+ lua_lock(L);
+ api_checknelems(L, 1);
+ o = index2addr(L, idx);
+ api_check(L, ttisuserdata(o), "userdata expected");
+ if (ttisnil(L->top - 1))
+ uvalue(o)->env = NULL;
+ else {
+ api_check(L, ttistable(L->top - 1), "table expected");
+ uvalue(o)->env = hvalue(L->top - 1);
+ luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1));
+ }
+ L->top--;
+ lua_unlock(L);
+}
+
+
+/*
+** `load' and `call' functions (run Lua code)
+*/
+
+
+#define checkresults(L,na,nr) \
+ api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \
+ "results from function overflow current stack size")
+
+
+LUA_API int lua_getctx (lua_State *L, int *ctx) {
+ if (L->ci->callstatus & CIST_YIELDED) {
+ if (ctx) *ctx = L->ci->u.c.ctx;
+ return L->ci->u.c.status;
+ }
+ else return LUA_OK;
+}
+
+
+LUA_API void lua_callk (lua_State *L, int nargs, int nresults, int ctx,
+ lua_CFunction k) {
+ StkId func;
+ lua_lock(L);
+ api_check(L, k == NULL || !isLua(L->ci),
+ "cannot use continuations inside hooks");
+ api_checknelems(L, nargs+1);
+ api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread");
+ checkresults(L, nargs, nresults);
+ func = L->top - (nargs+1);
+ if (k != NULL && L->nny == 0) { /* need to prepare continuation? */
+ L->ci->u.c.k = k; /* save continuation */
+ L->ci->u.c.ctx = ctx; /* save context */
+ luaD_call(L, func, nresults, 1); /* do the call */
+ }
+ else /* no continuation or no yieldable */
+ luaD_call(L, func, nresults, 0); /* just do the call */
+ adjustresults(L, nresults);
+ lua_unlock(L);
+}
+
+
+
+/*
+** Execute a protected call.
+*/
+struct CallS { /* data to `f_call' */
+ StkId func;
+ int nresults;
+};
+
+
+static void f_call (lua_State *L, void *ud) {
+ struct CallS *c = cast(struct CallS *, ud);
+ luaD_call(L, c->func, c->nresults, 0);
+}
+
+
+
+LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
+ int ctx, lua_CFunction k) {
+ struct CallS c;
+ int status;
+ ptrdiff_t func;
+ lua_lock(L);
+ api_check(L, k == NULL || !isLua(L->ci),
+ "cannot use continuations inside hooks");
+ api_checknelems(L, nargs+1);
+ api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread");
+ checkresults(L, nargs, nresults);
+ if (errfunc == 0)
+ func = 0;
+ else {
+ StkId o = index2addr(L, errfunc);
+ api_checkstackindex(L, errfunc, o);
+ func = savestack(L, o);
+ }
+ c.func = L->top - (nargs+1); /* function to be called */
+ if (k == NULL || L->nny > 0) { /* no continuation or no yieldable? */
+ c.nresults = nresults; /* do a 'conventional' protected call */
+ status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func);
+ }
+ else { /* prepare continuation (call is already protected by 'resume') */
+ CallInfo *ci = L->ci;
+ ci->u.c.k = k; /* save continuation */
+ ci->u.c.ctx = ctx; /* save context */
+ /* save information for error recovery */
+ ci->extra = savestack(L, c.func);
+ ci->u.c.old_allowhook = L->allowhook;
+ ci->u.c.old_errfunc = L->errfunc;
+ L->errfunc = func;
+ /* mark that function may do error recovery */
+ ci->callstatus |= CIST_YPCALL;
+ luaD_call(L, c.func, nresults, 1); /* do the call */
+ ci->callstatus &= ~CIST_YPCALL;
+ L->errfunc = ci->u.c.old_errfunc;
+ status = LUA_OK; /* if it is here, there were no errors */
+ }
+ adjustresults(L, nresults);
+ lua_unlock(L);
+ return status;
+}
+
+
+LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
+ const char *chunkname, const char *mode) {
+ ZIO z;
+ int status;
+ lua_lock(L);
+ if (!chunkname) chunkname = "?";
+ luaZ_init(L, &z, reader, data);
+ status = luaD_protectedparser(L, &z, chunkname, mode);
+ if (status == LUA_OK) { /* no errors? */
+ LClosure *f = clLvalue(L->top - 1); /* get newly created function */
+ if (f->nupvalues == 1) { /* does it have one upvalue? */
+ /* get global table from registry */
+ Table *reg = hvalue(&G(L)->l_registry);
+ const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
+ /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */
+ setobj(L, f->upvals[0]->v, gt);
+ luaC_barrier(L, f->upvals[0], gt);
+ }
+ }
+ lua_unlock(L);
+ return status;
+}
+
+
+LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) {
+ int status;
+ TValue *o;
+ lua_lock(L);
+ api_checknelems(L, 1);
+ o = L->top - 1;
+ if (isLfunction(o))
+ status = luaU_dump(L, getproto(o), writer, data, 0);
+ else
+ status = 1;
+ lua_unlock(L);
+ return status;
+}
+
+
+LUA_API int lua_status (lua_State *L) {
+ return L->status;
+}
+
+
+/*
+** Garbage-collection function
+*/
+
+LUA_API int lua_gc (lua_State *L, int what, int data) {
+ int res = 0;
+ global_State *g;
+ lua_lock(L);
+ g = G(L);
+ switch (what) {
+ case LUA_GCSTOP: {
+ g->gcrunning = 0;
+ break;
+ }
+ case LUA_GCRESTART: {
+ luaE_setdebt(g, 0);
+ g->gcrunning = 1;
+ break;
+ }
+ case LUA_GCCOLLECT: {
+ luaC_fullgc(L, 0);
+ break;
+ }
+ case LUA_GCCOUNT: {
+ /* GC values are expressed in Kbytes: #bytes/2^10 */
+ res = cast_int(gettotalbytes(g) >> 10);
+ break;
+ }
+ case LUA_GCCOUNTB: {
+ res = cast_int(gettotalbytes(g) & 0x3ff);
+ break;
+ }
+ case LUA_GCSTEP: {
+ if (g->gckind == KGC_GEN) { /* generational mode? */
+ res = (g->GCestimate == 0); /* true if it will do major collection */
+ luaC_forcestep(L); /* do a single step */
+ }
+ else {
+ lu_mem debt = cast(lu_mem, data) * 1024 - GCSTEPSIZE;
+ if (g->gcrunning)
+ debt += g->GCdebt; /* include current debt */
+ luaE_setdebt(g, debt);
+ luaC_forcestep(L);
+ if (g->gcstate == GCSpause) /* end of cycle? */
+ res = 1; /* signal it */
+ }
+ break;
+ }
+ case LUA_GCSETPAUSE: {
+ res = g->gcpause;
+ g->gcpause = data;
+ break;
+ }
+ case LUA_GCSETMAJORINC: {
+ res = g->gcmajorinc;
+ g->gcmajorinc = data;
+ break;
+ }
+ case LUA_GCSETSTEPMUL: {
+ res = g->gcstepmul;
+ g->gcstepmul = data;
+ break;
+ }
+ case LUA_GCISRUNNING: {
+ res = g->gcrunning;
+ break;
+ }
+ case LUA_GCGEN: { /* change collector to generational mode */
+ luaC_changemode(L, KGC_GEN);
+ break;
+ }
+ case LUA_GCINC: { /* change collector to incremental mode */
+ luaC_changemode(L, KGC_NORMAL);
+ break;
+ }
+ default: res = -1; /* invalid option */
+ }
+ lua_unlock(L);
+ return res;
+}
+
+
+
+/*
+** miscellaneous functions
+*/
+
+
+LUA_API int lua_error (lua_State *L) {
+ lua_lock(L);
+ api_checknelems(L, 1);
+ luaG_errormsg(L);
+ /* code unreachable; will unlock when control actually leaves the kernel */
+ return 0; /* to avoid warnings */
+}
+
+
+LUA_API int lua_next (lua_State *L, int idx) {
+ StkId t;
+ int more;
+ lua_lock(L);
+ t = index2addr(L, idx);
+ api_check(L, ttistable(t), "table expected");
+ more = luaH_next(L, hvalue(t), L->top - 1);
+ if (more) {
+ api_incr_top(L);
+ }
+ else /* no more elements */
+ L->top -= 1; /* remove key */
+ lua_unlock(L);
+ return more;
+}
+
+
+LUA_API void lua_concat (lua_State *L, int n) {
+ lua_lock(L);
+ api_checknelems(L, n);
+ if (n >= 2) {
+ luaC_checkGC(L);
+ luaV_concat(L, n);
+ }
+ else if (n == 0) { /* push empty string */
+ setsvalue2s(L, L->top, luaS_newlstr(L, "", 0));
+ api_incr_top(L);
+ }
+ /* else n == 1; nothing to do */
+ lua_unlock(L);
+}
+
+
+LUA_API void lua_len (lua_State *L, int idx) {
+ StkId t;
+ lua_lock(L);
+ t = index2addr(L, idx);
+ luaV_objlen(L, L->top, t);
+ api_incr_top(L);
+ lua_unlock(L);
+}
+
+
+LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) {
+ lua_Alloc f;
+ lua_lock(L);
+ if (ud) *ud = G(L)->ud;
+ f = G(L)->frealloc;
+ lua_unlock(L);
+ return f;
+}
+
+
+LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) {
+ lua_lock(L);
+ G(L)->ud = ud;
+ G(L)->frealloc = f;
+ lua_unlock(L);
+}
+
+
+LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
+ Udata *u;
+ lua_lock(L);
+ luaC_checkGC(L);
+ u = luaS_newudata(L, size, NULL);
+ setuvalue(L, L->top, u);
+ api_incr_top(L);
+ lua_unlock(L);
+ return u + 1;
+}
+
+
+
+static const char *aux_upvalue (StkId fi, int n, TValue **val,
+ GCObject **owner) {
+ switch (ttype(fi)) {
+ case LUA_TCCL: { /* C closure */
+ CClosure *f = clCvalue(fi);
+ if (!(1 <= n && n <= f->nupvalues)) return NULL;
+ *val = &f->upvalue[n-1];
+ if (owner) *owner = obj2gco(f);
+ return "";
+ }
+ case LUA_TLCL: { /* Lua closure */
+ LClosure *f = clLvalue(fi);
+ TString *name;
+ Proto *p = f->p;
+ if (!(1 <= n && n <= p->sizeupvalues)) return NULL;
+ *val = f->upvals[n-1]->v;
+ if (owner) *owner = obj2gco(f->upvals[n - 1]);
+ name = p->upvalues[n-1].name;
+ return (name == NULL) ? "" : getstr(name);
+ }
+ default: return NULL; /* not a closure */
+ }
+}
+
+
+LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) {
+ const char *name;
+ TValue *val = NULL; /* to avoid warnings */
+ lua_lock(L);
+ name = aux_upvalue(index2addr(L, funcindex), n, &val, NULL);
+ if (name) {
+ setobj2s(L, L->top, val);
+ api_incr_top(L);
+ }
+ lua_unlock(L);
+ return name;
+}
+
+
+LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {
+ const char *name;
+ TValue *val = NULL; /* to avoid warnings */
+ GCObject *owner = NULL; /* to avoid warnings */
+ StkId fi;
+ lua_lock(L);
+ fi = index2addr(L, funcindex);
+ api_checknelems(L, 1);
+ name = aux_upvalue(fi, n, &val, &owner);
+ if (name) {
+ L->top--;
+ setobj(L, val, L->top);
+ luaC_barrier(L, owner, L->top);
+ }
+ lua_unlock(L);
+ return name;
+}
+
+
+static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) {
+ LClosure *f;
+ StkId fi = index2addr(L, fidx);
+ api_check(L, ttisLclosure(fi), "Lua function expected");
+ f = clLvalue(fi);
+ api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index");
+ if (pf) *pf = f;
+ return &f->upvals[n - 1]; /* get its upvalue pointer */
+}
+
+
+LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) {
+ StkId fi = index2addr(L, fidx);
+ switch (ttype(fi)) {
+ case LUA_TLCL: { /* lua closure */
+ return *getupvalref(L, fidx, n, NULL);
+ }
+ case LUA_TCCL: { /* C closure */
+ CClosure *f = clCvalue(fi);
+ api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index");
+ return &f->upvalue[n - 1];
+ }
+ default: {
+ api_check(L, 0, "closure expected");
+ return NULL;
+ }
+ }
+}
+
+
+LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1,
+ int fidx2, int n2) {
+ LClosure *f1;
+ UpVal **up1 = getupvalref(L, fidx1, n1, &f1);
+ UpVal **up2 = getupvalref(L, fidx2, n2, NULL);
+ *up1 = *up2;
+ luaC_objbarrier(L, f1, *up2);
+}
+
diff --git a/src/lualib/lapi.h b/src/lualib/lapi.h
new file mode 100644
index 0000000..c7d34ad
--- /dev/null
+++ b/src/lualib/lapi.h
@@ -0,0 +1,24 @@
+/*
+** $Id: lapi.h,v 2.7.1.1 2013/04/12 18:48:47 roberto Exp $
+** Auxiliary functions from Lua API
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lapi_h
+#define lapi_h
+
+
+#include "llimits.h"
+#include "lstate.h"
+
+#define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \
+ "stack overflow");}
+
+#define adjustresults(L,nres) \
+ { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; }
+
+#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \
+ "not enough elements in the stack")
+
+
+#endif
diff --git a/src/lualib/lauxlib.c b/src/lualib/lauxlib.c
new file mode 100644
index 0000000..b00f8c7
--- /dev/null
+++ b/src/lualib/lauxlib.c
@@ -0,0 +1,959 @@
+/*
+** $Id: lauxlib.c,v 1.248.1.1 2013/04/12 18:48:47 roberto Exp $
+** Auxiliary functions for building Lua libraries
+** See Copyright Notice in lua.h
+*/
+
+
+#include
+#include
+#include
+#include
+#include
+
+
+/* This file uses only the official API of Lua.
+** Any function declared here could be written as an application function.
+*/
+
+#define lauxlib_c
+#define LUA_LIB
+
+#include "lua.h"
+
+#include "lauxlib.h"
+
+
+/*
+** {======================================================
+** Traceback
+** =======================================================
+*/
+
+
+#define LEVELS1 12 /* size of the first part of the stack */
+#define LEVELS2 10 /* size of the second part of the stack */
+
+
+
+/*
+** search for 'objidx' in table at index -1.
+** return 1 + string at top if find a good name.
+*/
+static int findfield (lua_State *L, int objidx, int level) {
+ if (level == 0 || !lua_istable(L, -1))
+ return 0; /* not found */
+ lua_pushnil(L); /* start 'next' loop */
+ while (lua_next(L, -2)) { /* for each pair in table */
+ if (lua_type(L, -2) == LUA_TSTRING) { /* ignore non-string keys */
+ if (lua_rawequal(L, objidx, -1)) { /* found object? */
+ lua_pop(L, 1); /* remove value (but keep name) */
+ return 1;
+ }
+ else if (findfield(L, objidx, level - 1)) { /* try recursively */
+ lua_remove(L, -2); /* remove table (but keep name) */
+ lua_pushliteral(L, ".");
+ lua_insert(L, -2); /* place '.' between the two names */
+ lua_concat(L, 3);
+ return 1;
+ }
+ }
+ lua_pop(L, 1); /* remove value */
+ }
+ return 0; /* not found */
+}
+
+
+static int pushglobalfuncname (lua_State *L, lua_Debug *ar) {
+ int top = lua_gettop(L);
+ lua_getinfo(L, "f", ar); /* push function */
+ lua_pushglobaltable(L);
+ if (findfield(L, top + 1, 2)) {
+ lua_copy(L, -1, top + 1); /* move name to proper place */
+ lua_pop(L, 2); /* remove pushed values */
+ return 1;
+ }
+ else {
+ lua_settop(L, top); /* remove function and global table */
+ return 0;
+ }
+}
+
+
+static void pushfuncname (lua_State *L, lua_Debug *ar) {
+ if (*ar->namewhat != '\0') /* is there a name? */
+ lua_pushfstring(L, "function " LUA_QS, ar->name);
+ else if (*ar->what == 'm') /* main? */
+ lua_pushliteral(L, "main chunk");
+ else if (*ar->what == 'C') {
+ if (pushglobalfuncname(L, ar)) {
+ lua_pushfstring(L, "function " LUA_QS, lua_tostring(L, -1));
+ lua_remove(L, -2); /* remove name */
+ }
+ else
+ lua_pushliteral(L, "?");
+ }
+ else
+ lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined);
+}
+
+
+static int countlevels (lua_State *L) {
+ lua_Debug ar;
+ int li = 1, le = 1;
+ /* find an upper bound */
+ while (lua_getstack(L, le, &ar)) { li = le; le *= 2; }
+ /* do a binary search */
+ while (li < le) {
+ int m = (li + le)/2;
+ if (lua_getstack(L, m, &ar)) li = m + 1;
+ else le = m;
+ }
+ return le - 1;
+}
+
+
+LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1,
+ const char *msg, int level) {
+ lua_Debug ar;
+ int top = lua_gettop(L);
+ int numlevels = countlevels(L1);
+ int mark = (numlevels > LEVELS1 + LEVELS2) ? LEVELS1 : 0;
+ if (msg) lua_pushfstring(L, "%s\n", msg);
+ lua_pushliteral(L, "stack traceback:");
+ while (lua_getstack(L1, level++, &ar)) {
+ if (level == mark) { /* too many levels? */
+ lua_pushliteral(L, "\n\t..."); /* add a '...' */
+ level = numlevels - LEVELS2; /* and skip to last ones */
+ }
+ else {
+ lua_getinfo(L1, "Slnt", &ar);
+ lua_pushfstring(L, "\n\t%s:", ar.short_src);
+ if (ar.currentline > 0)
+ lua_pushfstring(L, "%d:", ar.currentline);
+ lua_pushliteral(L, " in ");
+ pushfuncname(L, &ar);
+ if (ar.istailcall)
+ lua_pushliteral(L, "\n\t(...tail calls...)");
+ lua_concat(L, lua_gettop(L) - top);
+ }
+ }
+ lua_concat(L, lua_gettop(L) - top);
+}
+
+/* }====================================================== */
+
+
+/*
+** {======================================================
+** Error-report functions
+** =======================================================
+*/
+
+LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {
+ lua_Debug ar;
+ if (!lua_getstack(L, 0, &ar)) /* no stack frame? */
+ return luaL_error(L, "bad argument #%d (%s)", narg, extramsg);
+ lua_getinfo(L, "n", &ar);
+ if (strcmp(ar.namewhat, "method") == 0) {
+ narg--; /* do not count `self' */
+ if (narg == 0) /* error is in the self argument itself? */
+ return luaL_error(L, "calling " LUA_QS " on bad self (%s)",
+ ar.name, extramsg);
+ }
+ if (ar.name == NULL)
+ ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?";
+ return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)",
+ narg, ar.name, extramsg);
+}
+
+
+static int typeerror (lua_State *L, int narg, const char *tname) {
+ const char *msg = lua_pushfstring(L, "%s expected, got %s",
+ tname, luaL_typename(L, narg));
+ return luaL_argerror(L, narg, msg);
+}
+
+
+static void tag_error (lua_State *L, int narg, int tag) {
+ typeerror(L, narg, lua_typename(L, tag));
+}
+
+
+LUALIB_API void luaL_where (lua_State *L, int level) {
+ lua_Debug ar;
+ if (lua_getstack(L, level, &ar)) { /* check function at level */
+ lua_getinfo(L, "Sl", &ar); /* get info about it */
+ if (ar.currentline > 0) { /* is there info? */
+ lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline);
+ return;
+ }
+ }
+ lua_pushliteral(L, ""); /* else, no information available... */
+}
+
+
+LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
+ va_list argp;
+ va_start(argp, fmt);
+ luaL_where(L, 1);
+ lua_pushvfstring(L, fmt, argp);
+ va_end(argp);
+ lua_concat(L, 2);
+ return lua_error(L);
+}
+
+
+LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) {
+ int en = errno; /* calls to Lua API may change this value */
+ if (stat) {
+ lua_pushboolean(L, 1);
+ return 1;
+ }
+ else {
+ lua_pushnil(L);
+ if (fname)
+ lua_pushfstring(L, "%s: %s", fname, strerror(en));
+ else
+ lua_pushstring(L, strerror(en));
+ lua_pushinteger(L, en);
+ return 3;
+ }
+}
+
+
+#if !defined(inspectstat) /* { */
+
+#if defined(LUA_USE_POSIX)
+
+#include
+
+/*
+** use appropriate macros to interpret 'pclose' return status
+*/
+#define inspectstat(stat,what) \
+ if (WIFEXITED(stat)) { stat = WEXITSTATUS(stat); } \
+ else if (WIFSIGNALED(stat)) { stat = WTERMSIG(stat); what = "signal"; }
+
+#else
+
+#define inspectstat(stat,what) /* no op */
+
+#endif
+
+#endif /* } */
+
+
+LUALIB_API int luaL_execresult (lua_State *L, int stat) {
+ const char *what = "exit"; /* type of termination */
+ if (stat == -1) /* error? */
+ return luaL_fileresult(L, 0, NULL);
+ else {
+ inspectstat(stat, what); /* interpret result */
+ if (*what == 'e' && stat == 0) /* successful termination? */
+ lua_pushboolean(L, 1);
+ else
+ lua_pushnil(L);
+ lua_pushstring(L, what);
+ lua_pushinteger(L, stat);
+ return 3; /* return true/nil,what,code */
+ }
+}
+
+/* }====================================================== */
+
+
+/*
+** {======================================================
+** Userdata's metatable manipulation
+** =======================================================
+*/
+
+LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
+ luaL_getmetatable(L, tname); /* try to get metatable */
+ if (!lua_isnil(L, -1)) /* name already in use? */
+ return 0; /* leave previous value on top, but return 0 */
+ lua_pop(L, 1);
+ lua_newtable(L); /* create metatable */
+ lua_pushvalue(L, -1);
+ lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */
+ return 1;
+}
+
+
+LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) {
+ luaL_getmetatable(L, tname);
+ lua_setmetatable(L, -2);
+}
+
+
+LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) {
+ void *p = lua_touserdata(L, ud);
+ if (p != NULL) { /* value is a userdata? */
+ if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
+ luaL_getmetatable(L, tname); /* get correct metatable */
+ if (!lua_rawequal(L, -1, -2)) /* not the same? */
+ p = NULL; /* value is a userdata with wrong metatable */
+ lua_pop(L, 2); /* remove both metatables */
+ return p;
+ }
+ }
+ return NULL; /* value is not a userdata with a metatable */
+}
+
+
+LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {
+ void *p = luaL_testudata(L, ud, tname);
+ if (p == NULL) typeerror(L, ud, tname);
+ return p;
+}
+
+/* }====================================================== */
+
+
+/*
+** {======================================================
+** Argument check functions
+** =======================================================
+*/
+
+LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
+ const char *const lst[]) {
+ const char *name = (def) ? luaL_optstring(L, narg, def) :
+ luaL_checkstring(L, narg);
+ int i;
+ for (i=0; lst[i]; i++)
+ if (strcmp(lst[i], name) == 0)
+ return i;
+ return luaL_argerror(L, narg,
+ lua_pushfstring(L, "invalid option " LUA_QS, name));
+}
+
+
+LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg) {
+ /* keep some extra space to run error routines, if needed */
+ const int extra = LUA_MINSTACK;
+ if (!lua_checkstack(L, space + extra)) {
+ if (msg)
+ luaL_error(L, "stack overflow (%s)", msg);
+ else
+ luaL_error(L, "stack overflow");
+ }
+}
+
+
+LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) {
+ if (lua_type(L, narg) != t)
+ tag_error(L, narg, t);
+}
+
+
+LUALIB_API void luaL_checkany (lua_State *L, int narg) {
+ if (lua_type(L, narg) == LUA_TNONE)
+ luaL_argerror(L, narg, "value expected");
+}
+
+
+LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) {
+ const char *s = lua_tolstring(L, narg, len);
+ if (!s) tag_error(L, narg, LUA_TSTRING);
+ return s;
+}
+
+
+LUALIB_API const char *luaL_optlstring (lua_State *L, int narg,
+ const char *def, size_t *len) {
+ if (lua_isnoneornil(L, narg)) {
+ if (len)
+ *len = (def ? strlen(def) : 0);
+ return def;
+ }
+ else return luaL_checklstring(L, narg, len);
+}
+
+
+LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) {
+ int isnum;
+ lua_Number d = lua_tonumberx(L, narg, &isnum);
+ if (!isnum)
+ tag_error(L, narg, LUA_TNUMBER);
+ return d;
+}
+
+
+LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) {
+ return luaL_opt(L, luaL_checknumber, narg, def);
+}
+
+
+LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) {
+ int isnum;
+ lua_Integer d = lua_tointegerx(L, narg, &isnum);
+ if (!isnum)
+ tag_error(L, narg, LUA_TNUMBER);
+ return d;
+}
+
+
+LUALIB_API lua_Unsigned luaL_checkunsigned (lua_State *L, int narg) {
+ int isnum;
+ lua_Unsigned d = lua_tounsignedx(L, narg, &isnum);
+ if (!isnum)
+ tag_error(L, narg, LUA_TNUMBER);
+ return d;
+}
+
+
+LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg,
+ lua_Integer def) {
+ return luaL_opt(L, luaL_checkinteger, narg, def);
+}
+
+
+LUALIB_API lua_Unsigned luaL_optunsigned (lua_State *L, int narg,
+ lua_Unsigned def) {
+ return luaL_opt(L, luaL_checkunsigned, narg, def);
+}
+
+/* }====================================================== */
+
+
+/*
+** {======================================================
+** Generic Buffer manipulation
+** =======================================================
+*/
+
+/*
+** check whether buffer is using a userdata on the stack as a temporary
+** buffer
+*/
+#define buffonstack(B) ((B)->b != (B)->initb)
+
+
+/*
+** returns a pointer to a free area with at least 'sz' bytes
+*/
+LUALIB_API char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz) {
+ lua_State *L = B->L;
+ if (B->size - B->n < sz) { /* not enough space? */
+ char *newbuff;
+ size_t newsize = B->size * 2; /* double buffer size */
+ if (newsize - B->n < sz) /* not big enough? */
+ newsize = B->n + sz;
+ if (newsize < B->n || newsize - B->n < sz)
+ luaL_error(L, "buffer too large");
+ /* create larger buffer */
+ newbuff = (char *)lua_newuserdata(L, newsize * sizeof(char));
+ /* move content to new buffer */
+ memcpy(newbuff, B->b, B->n * sizeof(char));
+ if (buffonstack(B))
+ lua_remove(L, -2); /* remove old buffer */
+ B->b = newbuff;
+ B->size = newsize;
+ }
+ return &B->b[B->n];
+}
+
+
+LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) {
+ char *b = luaL_prepbuffsize(B, l);
+ memcpy(b, s, l * sizeof(char));
+ luaL_addsize(B, l);
+}
+
+
+LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {
+ luaL_addlstring(B, s, strlen(s));
+}
+
+
+LUALIB_API void luaL_pushresult (luaL_Buffer *B) {
+ lua_State *L = B->L;
+ lua_pushlstring(L, B->b, B->n);
+ if (buffonstack(B))
+ lua_remove(L, -2); /* remove old buffer */
+}
+
+
+LUALIB_API void luaL_pushresultsize (luaL_Buffer *B, size_t sz) {
+ luaL_addsize(B, sz);
+ luaL_pushresult(B);
+}
+
+
+LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
+ lua_State *L = B->L;
+ size_t l;
+ const char *s = lua_tolstring(L, -1, &l);
+ if (buffonstack(B))
+ lua_insert(L, -2); /* put value below buffer */
+ luaL_addlstring(B, s, l);
+ lua_remove(L, (buffonstack(B)) ? -2 : -1); /* remove value */
+}
+
+
+LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {
+ B->L = L;
+ B->b = B->initb;
+ B->n = 0;
+ B->size = LUAL_BUFFERSIZE;
+}
+
+
+LUALIB_API char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz) {
+ luaL_buffinit(L, B);
+ return luaL_prepbuffsize(B, sz);
+}
+
+/* }====================================================== */
+
+
+/*
+** {======================================================
+** Reference system
+** =======================================================
+*/
+
+/* index of free-list header */
+#define freelist 0
+
+
+LUALIB_API int luaL_ref (lua_State *L, int t) {
+ int ref;
+ if (lua_isnil(L, -1)) {
+ lua_pop(L, 1); /* remove from stack */
+ return LUA_REFNIL; /* `nil' has a unique fixed reference */
+ }
+ t = lua_absindex(L, t);
+ lua_rawgeti(L, t, freelist); /* get first free element */
+ ref = (int)lua_tointeger(L, -1); /* ref = t[freelist] */
+ lua_pop(L, 1); /* remove it from stack */
+ if (ref != 0) { /* any free element? */
+ lua_rawgeti(L, t, ref); /* remove it from list */
+ lua_rawseti(L, t, freelist); /* (t[freelist] = t[ref]) */
+ }
+ else /* no free elements */
+ ref = (int)lua_rawlen(L, t) + 1; /* get a new reference */
+ lua_rawseti(L, t, ref);
+ return ref;
+}
+
+
+LUALIB_API void luaL_unref (lua_State *L, int t, int ref) {
+ if (ref >= 0) {
+ t = lua_absindex(L, t);
+ lua_rawgeti(L, t, freelist);
+ lua_rawseti(L, t, ref); /* t[ref] = t[freelist] */
+ lua_pushinteger(L, ref);
+ lua_rawseti(L, t, freelist); /* t[freelist] = ref */
+ }
+}
+
+/* }====================================================== */
+
+
+/*
+** {======================================================
+** Load functions
+** =======================================================
+*/
+
+typedef struct LoadF {
+ int n; /* number of pre-read characters */
+ FILE *f; /* file being read */
+ char buff[LUAL_BUFFERSIZE]; /* area for reading file */
+} LoadF;
+
+
+static const char *getF (lua_State *L, void *ud, size_t *size) {
+ LoadF *lf = (LoadF *)ud;
+ (void)L; /* not used */
+ if (lf->n > 0) { /* are there pre-read characters to be read? */
+ *size = lf->n; /* return them (chars already in buffer) */
+ lf->n = 0; /* no more pre-read characters */
+ }
+ else { /* read a block from file */
+ /* 'fread' can return > 0 *and* set the EOF flag. If next call to
+ 'getF' called 'fread', it might still wait for user input.
+ The next check avoids this problem. */
+ if (feof(lf->f)) return NULL;
+ *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); /* read block */
+ }
+ return lf->buff;
+}
+
+
+static int errfile (lua_State *L, const char *what, int fnameindex) {
+ const char *serr = strerror(errno);
+ const char *filename = lua_tostring(L, fnameindex) + 1;
+ lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr);
+ lua_remove(L, fnameindex);
+ return LUA_ERRFILE;
+}
+
+
+static int skipBOM (LoadF *lf) {
+ const char *p = "\xEF\xBB\xBF"; /* Utf8 BOM mark */
+ int c;
+ lf->n = 0;
+ do {
+ c = getc(lf->f);
+ if (c == EOF || c != *(const unsigned char *)p++) return c;
+ lf->buff[lf->n++] = c; /* to be read by the parser */
+ } while (*p != '\0');
+ lf->n = 0; /* prefix matched; discard it */
+ return getc(lf->f); /* return next character */
+}
+
+
+/*
+** reads the first character of file 'f' and skips an optional BOM mark
+** in its beginning plus its first line if it starts with '#'. Returns
+** true if it skipped the first line. In any case, '*cp' has the
+** first "valid" character of the file (after the optional BOM and
+** a first-line comment).
+*/
+static int skipcomment (LoadF *lf, int *cp) {
+ int c = *cp = skipBOM(lf);
+ if (c == '#') { /* first line is a comment (Unix exec. file)? */
+ do { /* skip first line */
+ c = getc(lf->f);
+ } while (c != EOF && c != '\n') ;
+ *cp = getc(lf->f); /* skip end-of-line, if present */
+ return 1; /* there was a comment */
+ }
+ else return 0; /* no comment */
+}
+
+
+LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename,
+ const char *mode) {
+ LoadF lf;
+ int status, readstatus;
+ int c;
+ int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */
+ if (filename == NULL) {
+ lua_pushliteral(L, "=stdin");
+ lf.f = stdin;
+ }
+ else {
+ lua_pushfstring(L, "@%s", filename);
+ lf.f = fopen(filename, "r");
+ if (lf.f == NULL) return errfile(L, "open", fnameindex);
+ }
+ if (skipcomment(&lf, &c)) /* read initial portion */
+ lf.buff[lf.n++] = '\n'; /* add line to correct line numbers */
+ if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */
+ lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */
+ if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
+ skipcomment(&lf, &c); /* re-read initial portion */
+ }
+ if (c != EOF)
+ lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */
+ status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode);
+ readstatus = ferror(lf.f);
+ if (filename) fclose(lf.f); /* close file (even in case of errors) */
+ if (readstatus) {
+ lua_settop(L, fnameindex); /* ignore results from `lua_load' */
+ return errfile(L, "read", fnameindex);
+ }
+ lua_remove(L, fnameindex);
+ return status;
+}
+
+
+typedef struct LoadS {
+ const char *s;
+ size_t size;
+} LoadS;
+
+
+static const char *getS (lua_State *L, void *ud, size_t *size) {
+ LoadS *ls = (LoadS *)ud;
+ (void)L; /* not used */
+ if (ls->size == 0) return NULL;
+ *size = ls->size;
+ ls->size = 0;
+ return ls->s;
+}
+
+
+LUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t size,
+ const char *name, const char *mode) {
+ LoadS ls;
+ ls.s = buff;
+ ls.size = size;
+ return lua_load(L, getS, &ls, name, mode);
+}
+
+
+LUALIB_API int luaL_loadstring (lua_State *L, const char *s) {
+ return luaL_loadbuffer(L, s, strlen(s), s);
+}
+
+/* }====================================================== */
+
+
+
+LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) {
+ if (!lua_getmetatable(L, obj)) /* no metatable? */
+ return 0;
+ lua_pushstring(L, event);
+ lua_rawget(L, -2);
+ if (lua_isnil(L, -1)) {
+ lua_pop(L, 2); /* remove metatable and metafield */
+ return 0;
+ }
+ else {
+ lua_remove(L, -2); /* remove only metatable */
+ return 1;
+ }
+}
+
+
+LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {
+ obj = lua_absindex(L, obj);
+ if (!luaL_getmetafield(L, obj, event)) /* no metafield? */
+ return 0;
+ lua_pushvalue(L, obj);
+ lua_call(L, 1, 1);
+ return 1;
+}
+
+
+LUALIB_API int luaL_len (lua_State *L, int idx) {
+ int l;
+ int isnum;
+ lua_len(L, idx);
+ l = (int)lua_tointegerx(L, -1, &isnum);
+ if (!isnum)
+ luaL_error(L, "object length is not a number");
+ lua_pop(L, 1); /* remove object */
+ return l;
+}
+
+
+LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) {
+ if (!luaL_callmeta(L, idx, "__tostring")) { /* no metafield? */
+ switch (lua_type(L, idx)) {
+ case LUA_TNUMBER:
+ case LUA_TSTRING:
+ lua_pushvalue(L, idx);
+ break;
+ case LUA_TBOOLEAN:
+ lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false"));
+ break;
+ case LUA_TNIL:
+ lua_pushliteral(L, "nil");
+ break;
+ default:
+ lua_pushfstring(L, "%s: %p", luaL_typename(L, idx),
+ lua_topointer(L, idx));
+ break;
+ }
+ }
+ return lua_tolstring(L, -1, len);
+}
+
+
+/*
+** {======================================================
+** Compatibility with 5.1 module functions
+** =======================================================
+*/
+#if defined(LUA_COMPAT_MODULE)
+
+static const char *luaL_findtable (lua_State *L, int idx,
+ const char *fname, int szhint) {
+ const char *e;
+ if (idx) lua_pushvalue(L, idx);
+ do {
+ e = strchr(fname, '.');
+ if (e == NULL) e = fname + strlen(fname);
+ lua_pushlstring(L, fname, e - fname);
+ lua_rawget(L, -2);
+ if (lua_isnil(L, -1)) { /* no such field? */
+ lua_pop(L, 1); /* remove this nil */
+ lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */
+ lua_pushlstring(L, fname, e - fname);
+ lua_pushvalue(L, -2);
+ lua_settable(L, -4); /* set new table into field */
+ }
+ else if (!lua_istable(L, -1)) { /* field has a non-table value? */
+ lua_pop(L, 2); /* remove table and value */
+ return fname; /* return problematic part of the name */
+ }
+ lua_remove(L, -2); /* remove previous table */
+ fname = e + 1;
+ } while (*e == '.');
+ return NULL;
+}
+
+
+/*
+** Count number of elements in a luaL_Reg list.
+*/
+static int libsize (const luaL_Reg *l) {
+ int size = 0;
+ for (; l && l->name; l++) size++;
+ return size;
+}
+
+
+/*
+** Find or create a module table with a given name. The function
+** first looks at the _LOADED table and, if that fails, try a
+** global variable with that name. In any case, leaves on the stack
+** the module table.
+*/
+LUALIB_API void luaL_pushmodule (lua_State *L, const char *modname,
+ int sizehint) {
+ luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1); /* get _LOADED table */
+ lua_getfield(L, -1, modname); /* get _LOADED[modname] */
+ if (!lua_istable(L, -1)) { /* not found? */
+ lua_pop(L, 1); /* remove previous result */
+ /* try global variable (and create one if it does not exist) */
+ lua_pushglobaltable(L);
+ if (luaL_findtable(L, 0, modname, sizehint) != NULL)
+ luaL_error(L, "name conflict for module " LUA_QS, modname);
+ lua_pushvalue(L, -1);
+ lua_setfield(L, -3, modname); /* _LOADED[modname] = new table */
+ }
+ lua_remove(L, -2); /* remove _LOADED table */
+}
+
+
+LUALIB_API void luaL_openlib (lua_State *L, const char *libname,
+ const luaL_Reg *l, int nup) {
+ luaL_checkversion(L);
+ if (libname) {
+ luaL_pushmodule(L, libname, libsize(l)); /* get/create library table */
+ lua_insert(L, -(nup + 1)); /* move library table to below upvalues */
+ }
+ if (l)
+ luaL_setfuncs(L, l, nup);
+ else
+ lua_pop(L, nup); /* remove upvalues */
+}
+
+#endif
+/* }====================================================== */
+
+/*
+** set functions from list 'l' into table at top - 'nup'; each
+** function gets the 'nup' elements at the top as upvalues.
+** Returns with only the table at the stack.
+*/
+LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
+ luaL_checkversion(L);
+ luaL_checkstack(L, nup, "too many upvalues");
+ for (; l->name != NULL; l++) { /* fill the table with given functions */
+ int i;
+ for (i = 0; i < nup; i++) /* copy upvalues to the top */
+ lua_pushvalue(L, -nup);
+ lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
+ lua_setfield(L, -(nup + 2), l->name);
+ }
+ lua_pop(L, nup); /* remove upvalues */
+}
+
+
+/*
+** ensure that stack[idx][fname] has a table and push that table
+** into the stack
+*/
+LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) {
+ lua_getfield(L, idx, fname);
+ if (lua_istable(L, -1)) return 1; /* table already there */
+ else {
+ lua_pop(L, 1); /* remove previous result */
+ idx = lua_absindex(L, idx);
+ lua_newtable(L);
+ lua_pushvalue(L, -1); /* copy to be left at top */
+ lua_setfield(L, idx, fname); /* assign new table to field */
+ return 0; /* false, because did not find table there */
+ }
+}
+
+
+/*
+** stripped-down 'require'. Calls 'openf' to open a module,
+** registers the result in 'package.loaded' table and, if 'glb'
+** is true, also registers the result in the global table.
+** Leaves resulting module on the top.
+*/
+LUALIB_API void luaL_requiref (lua_State *L, const char *modname,
+ lua_CFunction openf, int glb) {
+ lua_pushcfunction(L, openf);
+ lua_pushstring(L, modname); /* argument to open function */
+ lua_call(L, 1, 1); /* open module */
+ luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
+ lua_pushvalue(L, -2); /* make copy of module (call result) */
+ lua_setfield(L, -2, modname); /* _LOADED[modname] = module */
+ lua_pop(L, 1); /* remove _LOADED table */
+ if (glb) {
+ lua_pushvalue(L, -1); /* copy of 'mod' */
+ lua_setglobal(L, modname); /* _G[modname] = module */
+ }
+}
+
+
+LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p,
+ const char *r) {
+ const char *wild;
+ size_t l = strlen(p);
+ luaL_Buffer b;
+ luaL_buffinit(L, &b);
+ while ((wild = strstr(s, p)) != NULL) {
+ luaL_addlstring(&b, s, wild - s); /* push prefix */
+ luaL_addstring(&b, r); /* push replacement in place of pattern */
+ s = wild + l; /* continue after `p' */
+ }
+ luaL_addstring(&b, s); /* push last suffix */
+ luaL_pushresult(&b);
+ return lua_tostring(L, -1);
+}
+
+
+static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
+ (void)ud; (void)osize; /* not used */
+ if (nsize == 0) {
+ free(ptr);
+ return NULL;
+ }
+ else
+ return realloc(ptr, nsize);
+}
+
+
+static int panic (lua_State *L) {
+ luai_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n",
+ lua_tostring(L, -1));
+ return 0; /* return to Lua to abort */
+}
+
+
+LUALIB_API lua_State *luaL_newstate (void) {
+ lua_State *L = lua_newstate(l_alloc, NULL);
+ if (L) lua_atpanic(L, &panic);
+ return L;
+}
+
+
+LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver) {
+ const lua_Number *v = lua_version(L);
+ if (v != lua_version(NULL))
+ luaL_error(L, "multiple Lua VMs detected");
+ else if (*v != ver)
+ luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f",
+ ver, *v);
+ /* check conversions number -> integer types */
+ lua_pushnumber(L, -(lua_Number)0x1234);
+ if (lua_tointeger(L, -1) != -0x1234 ||
+ lua_tounsigned(L, -1) != (lua_Unsigned)-0x1234)
+ luaL_error(L, "bad conversion number->int;"
+ " must recompile Lua with proper settings");
+ lua_pop(L, 1);
+}
+
diff --git a/src/lualib/lauxlib.h b/src/lualib/lauxlib.h
new file mode 100644
index 0000000..0fb023b
--- /dev/null
+++ b/src/lualib/lauxlib.h
@@ -0,0 +1,212 @@
+/*
+** $Id: lauxlib.h,v 1.120.1.1 2013/04/12 18:48:47 roberto Exp $
+** Auxiliary functions for building Lua libraries
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef lauxlib_h
+#define lauxlib_h
+
+
+#include