mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-07-11 03:13:10 +00:00
[AZTH] updated scripts for to support ConfigLoad hooks and implemented custom conf file
This commit is contained in:
@@ -31,6 +31,7 @@ CMakeLists.txt.user
|
||||
# exclude in all levels
|
||||
nbproject/
|
||||
.sync.ffs_db
|
||||
*.kate-swp
|
||||
|
||||
#
|
||||
# Eclipse
|
||||
|
||||
@@ -1 +1,8 @@
|
||||
AZTH_SET_PATH("CMAKE_AZTH_DIR" "${CMAKE_CURRENT_LIST_DIR}")
|
||||
AZTH_SET_PATH("CMAKE_AZTH_SRC_DIR" "${CMAKE_CURRENT_LIST_DIR}/src/")
|
||||
|
||||
ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_AZTH_SRC_DIR}/cmake/after_ws.cmake")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/src/CMakeLists.txt")
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
[worldserver]
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
AZTH_SET_PATH("CMAKE_AZTH_DIR" "${CMAKE_CURRENT_LIST_DIR}/../")
|
||||
AZTH_SET_PATH("CMAKE_AZTH_SRC_DIR" "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
MACRO(AZTH_LOAD_SRC dir)
|
||||
AZTH_SUBDIRLIST(sub_DIRS "${CMAKE_AZTH_SRC_DIR}/server/${dir}" TRUE TRUE)
|
||||
FOREACH(subdir ${sub_DIRS})
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
if( UNIX )
|
||||
install(FILES "${CMAKE_AZTH_DIR}/conf/azth_mod.conf.dist" DESTINATION ${CONF_DIR})
|
||||
elseif( WIN32 )
|
||||
install(FILES "${CMAKE_AZTH_DIR}/conf/azth_mod.conf.dist" DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
@@ -2,6 +2,18 @@
|
||||
AZTH_LOAD_SRC("game")
|
||||
AZTH_LOAD_SRC("plugins")
|
||||
|
||||
if( NOT WIN32 )
|
||||
message("defined: ${_AZTH_MOD_CONFIG}")
|
||||
if (NOT DEFINED _AZTH_MOD_CONFIG)
|
||||
set(_AZTH_MOD_CONFIG "${CONF_DIR}/azth_mod.conf")
|
||||
endif()
|
||||
message("mod_config: ${_AZTH_MOD_CONFIG}")
|
||||
|
||||
add_definitions(-D_AZTH_MOD_CONFIG="\\"${_AZTH_MOD_CONFIG}\\"")
|
||||
|
||||
unset(_AZTH_MOD_CONFIG CACHE)
|
||||
endif()
|
||||
|
||||
AZTH_ADD_INC_PATH("${azth_DIRS}")
|
||||
|
||||
AZTH_LOAD_INC_PATHS()
|
||||
|
||||
@@ -20,6 +20,7 @@ void AddSC_npc_transmogrifier();
|
||||
void AddSC_npc_transmogrifier();
|
||||
void AddSC_hearthstone();
|
||||
void AddSC_azth_group_plg();
|
||||
void AddSC_AzthWorldScript();
|
||||
|
||||
|
||||
void AddAzthScripts()
|
||||
@@ -38,6 +39,7 @@ void AddAzthScripts()
|
||||
//sAnticheatMgr->StartScripts(); //[AZTH] Anticheat
|
||||
AddSC_hearthstone();
|
||||
AddSC_azth_group_plg();
|
||||
AddSC_AzthWorldScript();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#include "Configuration/Config.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#ifndef _AZTH_MOD_CONFIG
|
||||
# define _AZTH_MOD_CONFIG "azth_mod.conf"
|
||||
#endif
|
||||
|
||||
class AzthWorldScript : public WorldScript
|
||||
{
|
||||
public:
|
||||
AzthWorldScript() : WorldScript("AzthWorldScript") { }
|
||||
|
||||
void OnBeforeConfigLoad(bool reload) override
|
||||
{
|
||||
if (!reload) {
|
||||
std::string cfg_file = _AZTH_MOD_CONFIG;
|
||||
std::string cfg_def_file = cfg_file;
|
||||
cfg_def_file += ".dist";
|
||||
|
||||
sConfigMgr->LoadMore(cfg_def_file.c_str());
|
||||
|
||||
sConfigMgr->LoadMore(cfg_file.c_str());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_AzthWorldScript()
|
||||
{
|
||||
new AzthWorldScript();
|
||||
}
|
||||
@@ -249,15 +249,10 @@ class CrossFactionWorld : public WorldScript
|
||||
public:
|
||||
CrossFactionWorld() : WorldScript("CrossFactionWorld") { }
|
||||
|
||||
void OnConfigLoad(bool reload) override
|
||||
void OnAfterConfigLoad(bool reload) override
|
||||
{
|
||||
sCrossFaction->LoadConfig(reload);
|
||||
}
|
||||
|
||||
void OnStartup() override
|
||||
{
|
||||
sCrossFaction->LoadConfig(false);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_CrossFactionGroups()
|
||||
|
||||
@@ -422,9 +422,10 @@ class WS_Transmogrification : public WorldScript
|
||||
public:
|
||||
WS_Transmogrification() : WorldScript("WS_Transmogrification") { }
|
||||
|
||||
void OnConfigLoad(bool reload)
|
||||
void OnAfterConfigLoad(bool reload)
|
||||
{
|
||||
sT->LoadConfig(reload);
|
||||
if (reload)
|
||||
sT->LoadConfig(reload);
|
||||
}
|
||||
|
||||
void OnStartup()
|
||||
@@ -446,4 +447,4 @@ void AddSC_npc_transmogrifier()
|
||||
new npc_transmogrifier();
|
||||
new PS_Transmogrification();
|
||||
new WS_Transmogrification();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -852,9 +852,10 @@ namespace
|
||||
public:
|
||||
WS_Transmogrification() : WorldScript("WS_Transmogrification") { }
|
||||
|
||||
void OnConfigLoad(bool reload) override
|
||||
void OnAfterConfigLoad(bool reload) override
|
||||
{
|
||||
sTransmogrification->LoadConfig(reload);
|
||||
if (reload)
|
||||
sTransmogrification->LoadConfig(reload);
|
||||
}
|
||||
|
||||
void OnStartup() override
|
||||
|
||||
Reference in New Issue
Block a user