From 5f21aff9bee352200f28cf56bc78e3d37840ecdc Mon Sep 17 00:00:00 2001 From: Poszer Date: Sat, 22 Jun 2019 13:13:17 +0200 Subject: Create Add-a-module.md Test preview --- docs/Add-a-module.md | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 docs/Add-a-module.md (limited to 'docs') diff --git a/docs/Add-a-module.md b/docs/Add-a-module.md new file mode 100644 index 0000000..a2be36b --- /dev/null +++ b/docs/Add-a-module.md @@ -0,0 +1,117 @@ + +## **How to add a module** + + +- Get the Module From this website [http://www.azerothcore.org/modules-catalogue/](http://www.azerothcore.org/modules-catalogue/) +- Clone it, or download. +- I'll use this for Exmple: [http://www.azerothcore.org/modules-catalogue/details.html?id=177019524](http://www.azerothcore.org/modules-catalogue/details.html?id=177019524). +- Once you downloaded it or cloned: ( Extract it, you will have than Folder looks like this : +[[images/1.png]] + + +### **The Basis** + +1. Create a folder inside modules/ directory + +2. Create a CMakeLists.txt file in the root path of your module +it will be automatically detected by cmake when you [re]configure your project. + +3. Now you can develop add anything to the main project, such as some scripts or +even an entire library + +Note: we suggest to use the [directory structure](Directory-Structure) standards of AzerothCore to better organize your modules and be familiar with main project. + +### **Add the first script** + +1. Before continue, we suggest you to follow our guide on how to create a script for AzerothCore + +2. After you’ve created your script you’ve to create a .h file to handle the script loading. + + For example ( Assuming you’ve created an src folder ): + + **src/loader.h** + + `void AddMyCustomScripts();` + + NOTE: AddMyCustomScripts is composed by: + + Add (Prefix) + + MyCustom (An unique name identifier for your script to avoid function collisions) + + Scripts ( Suffix ) + +3. Now you’ve to include your loader in your cmake using a simple MACRO ( Assuming that your script is called MyCustom.cpp ): + +``` +AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/MyCustom.cpp") +AC_ADD_SCRIPT_LOADER("MyCustom" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h") +``` + +First parameter is your module identifier + +Second parameter is the path of your loader header. + +Now you can add all scripts you want to your server just creating their instances inside AddMyCustomScripts() function, or using cmake macro above. + +### **Create a custom configuration file** + +if you need to add a custom configuration file to your module that will be installed with server, the steps are very simple. + +Before starting, you should have created the loader files described previously. + +1. Create a world script with this basic structure: + + +``` + #include "Configuration/Config.h" + #include "ScriptMgr.h" + + class MyWorldScript : public WorldScript + + { + public: + + MyWorldScript() : WorldScript("MyWorldScript") { } + + void OnBeforeConfigLoad(bool reload) override + { + if (!reload) { + std::string conf_path = _CONF_DIR; + std::string cfg_file = conf_path + "/my_custom.conf"; + sConfigMgr->LoadMore(cfg_file.c_str()); + } + } + }; + + void AddMyWorldScripts() + { + new MyWorldScript(); + } +``` + +2. Add your AddMyWorldScripts to your CMakeLists.txt created before + +3. Create a cmake file that must be loaded after binary installation and add this to your module CMakeLists.txt: + + ``` + ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_CURRENT_LIST_DIR}/after_ws_install.cmake") + ``` + + of course you can call your file as you want , the AFTER_WORLDSERVER_CMAKE hook will be launched as soon as AzerothCore prepare the worldserver installation. + +4. Inside this new cmake file you’ve to put this instructions: + +``` +install(FILES "${CMAKE_SOURCE_DIR}/your_path/my_custom.conf.dist" DESTINATION ${CONF_DIR}) +``` + +Change "your_path" part with path to your conf file, for example: + +/modules/my_module/conf/my_custom.conf.dist + +### **Add your db files to db_assembler** + +you are able to create base, updates and custom sql that will be automatically loaded in our db_assembler + +**work in progress….** -- cgit From 13e6ec8c3dcb6e784d33b62d7e599ca98fabfca5 Mon Sep 17 00:00:00 2001 From: Poszer Date: Sat, 22 Jun 2019 13:34:28 +0200 Subject: Add a module - Guide how to add modules --- docs/Add-a-module.md | 136 ++++++++++++++++----------------------------------- 1 file changed, 41 insertions(+), 95 deletions(-) (limited to 'docs') diff --git a/docs/Add-a-module.md b/docs/Add-a-module.md index a2be36b..2c00633 100644 --- a/docs/Add-a-module.md +++ b/docs/Add-a-module.md @@ -2,116 +2,62 @@ ## **How to add a module** -- Get the Module From this website [http://www.azerothcore.org/modules-catalogue/](http://www.azerothcore.org/modules-catalogue/) -- Clone it, or download. -- I'll use this for Exmple: [http://www.azerothcore.org/modules-catalogue/details.html?id=177019524](http://www.azerothcore.org/modules-catalogue/details.html?id=177019524). -- Once you downloaded it or cloned: ( Extract it, you will have than Folder looks like this : +1. Get the Module From this website [http://www.azerothcore.org/modules-catalogue/](http://www.azerothcore.org/modules-catalogue/) +2. Clone it, or download. +3. I'll use this for Exmple: [http://www.azerothcore.org/modules-catalogue/details.html?id=177019524](http://www.azerothcore.org/modules-catalogue/details.html?id=177019524). +4. Once you downloaded it or cloned: ( Extract it, you will have than Folder looks like this : [[images/1.png]] -### **The Basis** +5. Copy this folder you will have to paste it in next steps: +[[images/2.png]] -1. Create a folder inside modules/ directory +6. Now go in your AzerothCore folder in my case it's: C:\azerothcore-wotlk-master -2. Create a CMakeLists.txt file in the root path of your module -it will be automatically detected by cmake when you [re]configure your project. +7. When you are there, you will see there folder named modules like on this image: +[[images/3.png]] -3. Now you can develop add anything to the main project, such as some scripts or -even an entire library +8. Open that folder modules -> It will look like this : +[[images/4.png]] -Note: we suggest to use the [directory structure](Directory-Structure) standards of AzerothCore to better organize your modules and be familiar with main project. +9. Paste there your downloaded module ( That we use in step 4., in my case we use : NPC Services Module +And it will look like this when you paste it there : +[[images/5.png]] -### **Add the first script** +10. Than, open Cmake -> Press Configure +[[images/6.png]] -1. Before continue, we suggest you to follow our guide on how to create a script for AzerothCore +11. Than press Generate : +[[images/7.png]] -2. After you’ve created your script you’ve to create a .h file to handle the script loading. +12. And you are done. P.S You have also to check in the module folder (SQL folder) if there is any .sql file required to be executed in your database ( Like on this image ) : +[[images/8.png]] - For example ( Assuming you’ve created an src folder ): + than World : +[[images/9.png]] - **src/loader.h** +- Yes, this module have SQL which need to be executed in your World Database : +[[images/10.png]] - `void AddMyCustomScripts();` - - NOTE: AddMyCustomScripts is composed by: - - Add (Prefix) - - MyCustom (An unique name identifier for your script to avoid function collisions) - - Scripts ( Suffix ) - -3. Now you’ve to include your loader in your cmake using a simple MACRO ( Assuming that your script is called MyCustom.cpp ): +- Let's do it : +13. Open it with any text editor, or run it directly : ( I'll use Editor ) +This is what i have there : ``` -AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/MyCustom.cpp") -AC_ADD_SCRIPT_LOADER("MyCustom" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h") +DELETE FROM `creature_template` WHERE `entry` = 55003; +Set @NpcName = "Visual Weapon NPC", + @NpcSubname = "AzerothCore", + @NpcEntry = 55003, + @NpcDisplayID = 31833, + @NpcLevel = 80; + +INSERT INTO `creature_template` (`entry`, `modelid1`, `name`, `subname`, `minlevel`, `maxlevel`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `dmgschool`, `BaseAttackTime`, `RangeAttackTime`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES +(@NpcEntry, @NpcDisplayID, @NpcName, @NpcSubname, @NpcLevel, @NpcLevel, 35, 1, 1, 1.14286, 1, 1, 0, 2000, 2000, 2, 0, 2048, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 50, 50, 1, 0, 0, 1, 0, 0, 'npc_visualweapon', 12340); ``` -First parameter is your module identifier - -Second parameter is the path of your loader header. - -Now you can add all scripts you want to your server just creating their instances inside AddMyCustomScripts() function, or using cmake macro above. - -### **Create a custom configuration file** - -if you need to add a custom configuration file to your module that will be installed with server, the steps are very simple. - -Before starting, you should have created the loader files described previously. - -1. Create a world script with this basic structure: - - -``` - #include "Configuration/Config.h" - #include "ScriptMgr.h" - - class MyWorldScript : public WorldScript - - { - public: - - MyWorldScript() : WorldScript("MyWorldScript") { } - - void OnBeforeConfigLoad(bool reload) override - { - if (!reload) { - std::string conf_path = _CONF_DIR; - std::string cfg_file = conf_path + "/my_custom.conf"; - sConfigMgr->LoadMore(cfg_file.c_str()); - } - } - }; - - void AddMyWorldScripts() - { - new MyWorldScript(); - } -``` - -2. Add your AddMyWorldScripts to your CMakeLists.txt created before - -3. Create a cmake file that must be loaded after binary installation and add this to your module CMakeLists.txt: - - ``` - ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_CURRENT_LIST_DIR}/after_ws_install.cmake") - ``` - - of course you can call your file as you want , the AFTER_WORLDSERVER_CMAKE hook will be launched as soon as AzerothCore prepare the worldserver installation. - -4. Inside this new cmake file you’ve to put this instructions: - -``` -install(FILES "${CMAKE_SOURCE_DIR}/your_path/my_custom.conf.dist" DESTINATION ${CONF_DIR}) -``` - -Change "your_path" part with path to your conf file, for example: - -/modules/my_module/conf/my_custom.conf.dist - -### **Add your db files to db_assembler** - -you are able to create base, updates and custom sql that will be automatically loaded in our db_assembler +14. So, We have to run this query in the Database, Let's do it. +Open your DB Program ( Example : Navicat, HeidiSQL ) and run our code there, in this way : +[[images/11.png]] -**work in progress….** +15. We are done now. Go in game and spawn this NPC with command .npc add 55003 +@NpcEntry = 55003 <---- This is our NPC ENTRY -- cgit From dfb70621113b19ff3d947225dd5d10cea2e2ec76 Mon Sep 17 00:00:00 2001 From: Poszer <41213210+poszer@users.noreply.github.com> Date: Sun, 23 Jun 2019 18:17:57 +0200 Subject: Update Add-a-module.md Trying to show image --- docs/Add-a-module.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/Add-a-module.md b/docs/Add-a-module.md index 2c00633..a124bec 100644 --- a/docs/Add-a-module.md +++ b/docs/Add-a-module.md @@ -6,7 +6,7 @@ 2. Clone it, or download. 3. I'll use this for Exmple: [http://www.azerothcore.org/modules-catalogue/details.html?id=177019524](http://www.azerothcore.org/modules-catalogue/details.html?id=177019524). 4. Once you downloaded it or cloned: ( Extract it, you will have than Folder looks like this : -[[images/1.png]] +[[/images/1.png]] 5. Copy this folder you will have to paste it in next steps: -- cgit From 01d7ace84dd9ae95eb6be9e6fc2ecc8047c4d0b5 Mon Sep 17 00:00:00 2001 From: Poszer <41213210+poszer@users.noreply.github.com> Date: Sun, 23 Jun 2019 18:26:49 +0200 Subject: Update Add-a-module.md Edits --- docs/Add-a-module.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/Add-a-module.md b/docs/Add-a-module.md index a124bec..1f5f846 100644 --- a/docs/Add-a-module.md +++ b/docs/Add-a-module.md @@ -3,7 +3,7 @@ 1. Get the Module From this website [http://www.azerothcore.org/modules-catalogue/](http://www.azerothcore.org/modules-catalogue/) -2. Clone it, or download. +2. Clone it using git (recommended) or just download it 3. I'll use this for Exmple: [http://www.azerothcore.org/modules-catalogue/details.html?id=177019524](http://www.azerothcore.org/modules-catalogue/details.html?id=177019524). 4. Once you downloaded it or cloned: ( Extract it, you will have than Folder looks like this : [[/images/1.png]] @@ -12,7 +12,7 @@ 5. Copy this folder you will have to paste it in next steps: [[images/2.png]] -6. Now go in your AzerothCore folder in my case it's: C:\azerothcore-wotlk-master +6. Now go in your AzerothCore folder (for example C:\azerothcore-wotlk-master) 7. When you are there, you will see there folder named modules like on this image: [[images/3.png]] @@ -33,14 +33,14 @@ And it will look like this when you paste it there : 12. And you are done. P.S You have also to check in the module folder (SQL folder) if there is any .sql file required to be executed in your database ( Like on this image ) : [[images/8.png]] - than World : + then World : [[images/9.png]] -- Yes, this module have SQL which need to be executed in your World Database : +- this module has an SQL file which needs to be executed in your World Database : [[images/10.png]] - Let's do it : -13. Open it with any text editor, or run it directly : ( I'll use Editor ) +13. Open it with any text editor and copy all content from the file, or run it directly : ( I'll use Editor ) This is what i have there : ``` @@ -55,7 +55,7 @@ INSERT INTO `creature_template` (`entry`, `modelid1`, `name`, `subname`, `minlev (@NpcEntry, @NpcDisplayID, @NpcName, @NpcSubname, @NpcLevel, @NpcLevel, 35, 1, 1, 1.14286, 1, 1, 0, 2000, 2000, 2, 0, 2048, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 50, 50, 1, 0, 0, 1, 0, 0, 'npc_visualweapon', 12340); ``` -14. So, We have to run this query in the Database, Let's do it. +14. So, We have to run (paste) this query in the Database, Let's do it. Open your DB Program ( Example : Navicat, HeidiSQL ) and run our code there, in this way : [[images/11.png]] -- cgit From 552a97cb10c7762d5162083e800abed73552348b Mon Sep 17 00:00:00 2001 From: Poszer <41213210+poszer@users.noreply.github.com> Date: Sun, 23 Jun 2019 18:28:49 +0200 Subject: Update Add-a-module.md Done --- docs/Add-a-module.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/Add-a-module.md b/docs/Add-a-module.md index 1f5f846..96c212e 100644 --- a/docs/Add-a-module.md +++ b/docs/Add-a-module.md @@ -2,7 +2,7 @@ ## **How to add a module** -1. Get the Module From this website [http://www.azerothcore.org/modules-catalogue/](http://www.azerothcore.org/modules-catalogue/) +1. Get the module from this website [http://www.azerothcore.org/modules-catalogue/](http://www.azerothcore.org/modules-catalogue/) 2. Clone it using git (recommended) or just download it 3. I'll use this for Exmple: [http://www.azerothcore.org/modules-catalogue/details.html?id=177019524](http://www.azerothcore.org/modules-catalogue/details.html?id=177019524). 4. Once you downloaded it or cloned: ( Extract it, you will have than Folder looks like this : -- cgit From 9f585b73ce691fcc8331caeb1ec049bc89f80d15 Mon Sep 17 00:00:00 2001 From: Poszer <41213210+poszer@users.noreply.github.com> Date: Sun, 23 Jun 2019 18:37:38 +0200 Subject: Update Add-a-module.md Showing correctly images --- docs/Add-a-module.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'docs') diff --git a/docs/Add-a-module.md b/docs/Add-a-module.md index 96c212e..959d9e7 100644 --- a/docs/Add-a-module.md +++ b/docs/Add-a-module.md @@ -6,38 +6,38 @@ 2. Clone it using git (recommended) or just download it 3. I'll use this for Exmple: [http://www.azerothcore.org/modules-catalogue/details.html?id=177019524](http://www.azerothcore.org/modules-catalogue/details.html?id=177019524). 4. Once you downloaded it or cloned: ( Extract it, you will have than Folder looks like this : -[[/images/1.png]] +![Image]() 5. Copy this folder you will have to paste it in next steps: -[[images/2.png]] +![Image]() 6. Now go in your AzerothCore folder (for example C:\azerothcore-wotlk-master) 7. When you are there, you will see there folder named modules like on this image: -[[images/3.png]] +![Image]() 8. Open that folder modules -> It will look like this : -[[images/4.png]] +![Image]() 9. Paste there your downloaded module ( That we use in step 4., in my case we use : NPC Services Module And it will look like this when you paste it there : -[[images/5.png]] +![Image]() 10. Than, open Cmake -> Press Configure -[[images/6.png]] +![Image]() 11. Than press Generate : -[[images/7.png]] +![Image]() 12. And you are done. P.S You have also to check in the module folder (SQL folder) if there is any .sql file required to be executed in your database ( Like on this image ) : -[[images/8.png]] +![Image]() then World : -[[images/9.png]] +![Image]() - this module has an SQL file which needs to be executed in your World Database : -[[images/10.png]] +![Image]() - Let's do it : 13. Open it with any text editor and copy all content from the file, or run it directly : ( I'll use Editor ) @@ -57,7 +57,7 @@ INSERT INTO `creature_template` (`entry`, `modelid1`, `name`, `subname`, `minlev 14. So, We have to run (paste) this query in the Database, Let's do it. Open your DB Program ( Example : Navicat, HeidiSQL ) and run our code there, in this way : -[[images/11.png]] +![Image]() 15. We are done now. Go in game and spawn this NPC with command .npc add 55003 @NpcEntry = 55003 <---- This is our NPC ENTRY -- cgit