mirror of
https://github.com/NathanHandley/mod-ah-bot-plus.git
synced 2026-01-13 01:08:37 +00:00
First commit for skeleton module
DB part must be implemented yet
This commit is contained in:
48
.gitignore
vendored
Normal file
48
.gitignore
vendored
Normal file
@@ -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
|
||||||
8
CMakeLists.txt
Normal file
8
CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/MyWorld.cpp")
|
||||||
|
AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/MyPlayer.cpp")
|
||||||
|
|
||||||
|
AC_ADD_SCRIPT_LOADER("MyWorld" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h")
|
||||||
|
AC_ADD_SCRIPT_LOADER("MyPlayer" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h")
|
||||||
|
|
||||||
|
CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_CURRENT_LIST_DIR}/src/cmake/after_ws_install.cmake")
|
||||||
8
conf/my_custom.conf.dist
Normal file
8
conf/my_custom.conf.dist
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[worldserver]
|
||||||
|
|
||||||
|
#
|
||||||
|
# Enable Hello World message at server start
|
||||||
|
# default: false
|
||||||
|
#
|
||||||
|
|
||||||
|
MyCustom.enableHelloWorld=false
|
||||||
0
include.sh
Normal file
0
include.sh
Normal file
24
src/MyPlayer.cpp
Normal file
24
src/MyPlayer.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
This plugin can be used for common player customizations
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ScriptMgr.h"
|
||||||
|
#include "Player.h"
|
||||||
|
#include "Configuration/Config.h"
|
||||||
|
|
||||||
|
class MyPlayer : public PlayerScript{
|
||||||
|
public:
|
||||||
|
|
||||||
|
MyPlayer() : PlayerScript("MyPlayer") { }
|
||||||
|
|
||||||
|
void OnLogin(Player* player) override {
|
||||||
|
if (sConfigMgr->GetBoolDefault("MyCustom.enableHelloWorld", false)) {
|
||||||
|
ChatHandler(player->GetSession()).SendSysMessage("Hello World from Skeleton-Module!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void AddMyPlayerScripts() {
|
||||||
|
new MyPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
26
src/MyWorld.cpp
Normal file
26
src/MyWorld.cpp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#include "Configuration/Config.h"
|
||||||
|
#include "ScriptMgr.h"
|
||||||
|
|
||||||
|
class MyWorld : public WorldScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyWorld() : WorldScript("MyWorld") { }
|
||||||
|
|
||||||
|
void OnBeforeConfigLoad(bool reload) override
|
||||||
|
{
|
||||||
|
if (!reload) {
|
||||||
|
std::string conf_path = _CONF_DIR;
|
||||||
|
std::string cfg_file = conf_path + "/my_custom.conf";
|
||||||
|
std::string cfg_def_file = cfg_file +".dist";
|
||||||
|
|
||||||
|
sConfigMgr->LoadMore(cfg_def_file.c_str());
|
||||||
|
|
||||||
|
sConfigMgr->LoadMore(cfg_file.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void AddMyWorldScripts()
|
||||||
|
{
|
||||||
|
new MyWorld();
|
||||||
|
}
|
||||||
5
src/cmake/after_ws_install.cmake
Normal file
5
src/cmake/after_ws_install.cmake
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if( UNIX )
|
||||||
|
install(FILES "${CMAKE_SOURCE_DIR}/modules/skeleton-module/conf/my_custom.conf.dist" DESTINATION ${CONF_DIR})
|
||||||
|
elseif( WIN32 )
|
||||||
|
install(FILES "${CMAKE_SOURCE_DIR}/modules/skeleton-module/conf/my_custom.conf.dist" DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
endif()
|
||||||
2
src/loader.h
Normal file
2
src/loader.h
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
void AddMyWorldScripts();
|
||||||
|
void AddMyPlayerScripts();
|
||||||
Reference in New Issue
Block a user