From b3d00ccb2608ad7e87e3af29855dbe60e6a2b264 Mon Sep 17 00:00:00 2001 From: UltraNix Date: Thu, 30 Dec 2021 17:13:09 +0100 Subject: [PATCH] Initial commit - mod-playerbots --- .editorconfig | 8 +++ .git_commit_template.txt | 45 ++++++++++++ .gitattributes | 105 ++++++++++++++++++++++++++++ .github/workflows/core-build.yml | 49 +++++++++++++ .gitignore | 48 +++++++++++++ LICENSE | 21 ++++++ README.md | 25 +++++++ README_ES.md | 66 +++++++++++++++++ README_example.md | 41 +++++++++++ conf/conf.sh.dist | 32 +++++++++ conf/my_custom.conf.dist | 17 +++++ include.sh | 10 +++ setup_git_commit_template.sh | 4 ++ sql/README.md | 32 +++++++++ sql/auth/base/development.sql | 3 + sql/auth/base/production.sql | 3 + sql/auth/base/structure.sql | 2 + sql/auth/updates/.gitkeep | 0 sql/characters/base/development.sql | 3 + sql/characters/base/production.sql | 3 + sql/characters/base/structure.sql | 2 + sql/characters/updates/.gitkeep | 0 sql/world/base/development.sql | 3 + sql/world/base/production.sql | 3 + sql/world/base/structure.sql | 2 + sql/world/updates/.gitkeep | 0 src/MP_loader.cpp | 15 ++++ src/MyPlayer.cpp | 29 ++++++++ 28 files changed, 571 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 LICENSE create mode 100644 README.md create mode 100644 README_ES.md create mode 100644 README_example.md create mode 100644 conf/conf.sh.dist create mode 100644 conf/my_custom.conf.dist create mode 100644 include.sh create mode 100644 setup_git_commit_template.sh create mode 100644 sql/README.md create mode 100644 sql/auth/base/development.sql create mode 100644 sql/auth/base/production.sql create mode 100644 sql/auth/base/structure.sql create mode 100644 sql/auth/updates/.gitkeep create mode 100644 sql/characters/base/development.sql create mode 100644 sql/characters/base/production.sql create mode 100644 sql/characters/base/structure.sql create mode 100644 sql/characters/updates/.gitkeep create mode 100644 sql/world/base/development.sql create mode 100644 sql/world/base/production.sql create mode 100644 sql/world/base/structure.sql create mode 100644 sql/world/updates/.gitkeep create mode 100644 src/MP_loader.cpp create mode 100644 src/MyPlayer.cpp diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..eb64e2fa --- /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 00000000..5c5d9336 --- /dev/null +++ b/.git_commit_template.txt @@ -0,0 +1,45 @@ +### 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 00000000..7ef9001e --- /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 00000000..f66f6942 --- /dev/null +++ b/.github/workflows/core-build.yml @@ -0,0 +1,49 @@ +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/skeleton-module' + - name: Cache + uses: actions/cache@v2 + 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 ./acore.sh install-deps + env: + CONTINUOUS_INTEGRATION: true + - name: Create conf/config.sh + run: source ./apps/ci/ci-conf.sh + - 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 + - name: Run unit tests + run: source ./apps/ci/ci-run-unit-tests.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..c6e12994 --- /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/LICENSE b/LICENSE new file mode 100644 index 00000000..9031171d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 AzerothCore + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..fcfe61f1 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# SKELETON - Module template + +[English](README.md) | [Español](README_ES.md) + + +## How to create your own module + +1. Use the script `create_module.sh` located in [`modules/`](https://github.com/azerothcore/azerothcore-wotlk/tree/master/modules) to start quickly with all the files you need and your git repo configured correctly (heavily recommended). +1. You can then use these scripts to start your project: https://github.com/azerothcore/azerothcore-boilerplates +1. Do not hesitate to compare with some of our newer/bigger/famous modules. +1. Edit the `README.md` and other files (`include.sh` etc...) to fit your module. Note: the README is automatically created from `README_example.md` when you use the script `create_module.sh`. +1. Publish your module to our [catalogue](https://github.com/azerothcore/modules-catalogue). + + +## How to test your module? + +Disable PCH (precompiled headers) and try to compile. To disable PCH, set `-DNOPCH=1` with Cmake (more info [here](http://www.azerothcore.org/wiki/CMake-options)). + +If you forgot some headers, it is time to add them! + +## Licensing + +The default license of the skeleton-module template is the MIT but you can use a different license for your own modules. + +So modules can also be kept private. However, if you need to add new hooks to the core, as well as improving existing ones, you have to share your improvements because the main core is released under the AGPL license. Please [provide a PR](https://www.azerothcore.org/wiki/How-to-create-a-PR) if that is the case. diff --git a/README_ES.md b/README_ES.md new file mode 100644 index 00000000..d7d6ddcd --- /dev/null +++ b/README_ES.md @@ -0,0 +1,66 @@ + [English](README.md) | [Español](README_ES.md) + +# PARTE 1 - Cómo crear su propio módulo + +Puede utilizar estos scripts para iniciar su proyecto: + +[Ejemplos de scripts](https://github.com/azerothcore/azerothcore-boilerplates) + +### ¿Cómo probar su módulo? + +Desactivar PCH (cabeceras pre-compiladas) e intentar compilar. Si ha olvidado algunas cabeceras, es hora de añadirlas. Para desactivar PCH, siga este [link](https://github.com/azerothcore/azerothcore-wotlk/wiki/CMake-options) y ponga `USE_COREPCH ` a 0 con Cmake. + +------------------------------------------------------- + +# PARTE 2 - EJEMPLO DE UN README.md +Recuerde que el README.md le explica al resto de las personas que es lo que hace su módulo. Recomendamos escribirlo en ingles quizás, aunque puede ser traducido luego a otros idiomas. + +# MI NUEVO MÓDULO (título) + +## Descripción + +Este módulo permite hacer esto y esto. +(Debe explicar para que se va a utilizar el modulo, cuál es su utilidad) + +## Cómo utilizar + +Haz esto y aquello. + +Puedes agregar una carpeta de pantalla: + +[screenshot](/screenshots/my_module.png?raw=true "screenshot") + +O incluso un video donde expliques su uso: + +[Youtube](https://www.youtube.com/watch?v=T6UEX47mPeE) + + +## Requisitos + +Se debe especificar que versión de azerothcore requiere, porque podría ser incompatible con alguna más adelante. Entonces aclarar por las dudas su compatibilidad no está de más. + +Mi nuevo módulo requiere: + +- AzerothCore v4.0.0+ + + +## Instalación + +``` +1) Simplemente coloque el módulo dentro del directorio `modules` de AzerothCore (repositorio), no la compilación. +2) Importe el SQL manualmente a la base de datos correcta (auth, mundo o caracteres) o con el `db_assembler.sh` (si se proporciona `include.sh`). +3) Vuelva a ejecutar el Cmake y genere la compilación necesaria. (Revise la guía) +``` + +## Editar la configuración del módulo (opcional) + +Si necesita cambiar la configuración del módulo, vaya a la carpeta de configuración de su servidor (donde está su `worldserver` o `worldserver.exe`), copie `my_module.conf.dist` a `my_module.conf` y edite ese nuevo archivo. + + +## Créditos + +* [Yo](https://github.com/YOUR_GITHUB_NAME) (autor del módulo) Edite el enlace para que apunte a su github si lo desea. +* [BarbzYHOOL](https://github.com/barbzyhool) +* [Talamortis](https://github.com/talamortis) + +AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/PaqQRkd) diff --git a/README_example.md b/README_example.md new file mode 100644 index 00000000..f31dca8d --- /dev/null +++ b/README_example.md @@ -0,0 +1,41 @@ +# MY_NEW_MODULE + +## Description + +This module allows to do this and this. + + +## How to use ingame + +Do this and that. + +![my_new_module screenshot](/screenshots/my_module.png?raw=true "my_new_module screenshot") + + +[![Youtube Link](https://i.imgur.com/Jhrdgv6.png)](https://www.youtube.com/watch?v=T6UEX47mPeE) + + +## Requirements + +My_new_module requires: + +- AzerothCore v4.0.0+ + + +## Installation + +``` +1) Simply `git clone` the module under the `modules` directory of your AzerothCore source or copy paste it manually. +2) Import the SQL manually to the right Database (auth, world or characters) or with the `db_assembler.sh` (if `include.sh` provided). +3) Re-run cmake and launch a clean build of AzerothCore. +``` + +## Edit the module's configuration (optional) + +If you need to change the module configuration, go to your server configuration directory (where your `worldserver` or `worldserver.exe` is), copy `my_module.conf.dist` to `my_module.conf` and edit that new file. + + +## Credits + +* [Me](https://github.com/YOUR_GITHUB_NAME) (author of the module): Check out my soundcloud - Join my discord +* AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/PaqQRkd) diff --git a/conf/conf.sh.dist b/conf/conf.sh.dist new file mode 100644 index 00000000..0e78e8aa --- /dev/null +++ b/conf/conf.sh.dist @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +## CUSTOM SQL - Important file used by the db_assembler.sh +## Keep only the required variables (base sql files or updates, depending on the DB) + +## BASE SQL + +DB_AUTH_CUSTOM_PATHS+=( + "$MOD_SKELETON_ROOT/sql/auth/base/" +) + +DB_CHARACTERS_CUSTOM_PATHS+=( + "$MOD_SKELETON_ROOT/sql/characters/base/" +) + +DB_WORLD_CUSTOM_PATHS+=( + "$MOD_SKELETON_ROOT/sql/world/base/" +) + +## UPDATES + +DB_AUTH_UPDATES_PATHS+=( + "$MOD_SKELETON_ROOT/sql/auth/updates/" +) + +DB_CHARACTERS_UPDATES_PATHS+=( + "$MOD_SKELETON_ROOT/sql/characters/updates/" +) + +DB_WORLD_UPDATES_PATHS+=( + "$MOD_SKELETON_ROOT/sql/world/updates/" +) diff --git a/conf/my_custom.conf.dist b/conf/my_custom.conf.dist new file mode 100644 index 00000000..d38b74a1 --- /dev/null +++ b/conf/my_custom.conf.dist @@ -0,0 +1,17 @@ +# +# Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 +# + +[worldserver] + +######################################## +# My module configuration +######################################## +# +# MyModule.Enable +# Description: Enable my module and print "Hello World" message at server start +# Default: 0 - Disabled +# 1 - Enabled +# + +MyModule.Enable = 0 diff --git a/include.sh b/include.sh new file mode 100644 index 00000000..a2415726 --- /dev/null +++ b/include.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +## GETS THE CURRENT MODULE ROOT DIRECTORY +MOD_SKELETON_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )" + +source $MOD_SKELETON_ROOT"/conf/conf.sh.dist" + +if [ -f $MOD_SKELETON_ROOT"/conf/conf.sh" ]; then + source $MOD_SKELETON_ROOT"/conf/conf.sh" +fi diff --git a/setup_git_commit_template.sh b/setup_git_commit_template.sh new file mode 100644 index 00000000..7b52062d --- /dev/null +++ b/setup_git_commit_template.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +## Set a local git commit template +git config --local commit.template ".git_commit_template.txt" ; diff --git a/sql/README.md b/sql/README.md new file mode 100644 index 00000000..b00e17fd --- /dev/null +++ b/sql/README.md @@ -0,0 +1,32 @@ +# NEW MODULE - SQL BEST PRACTICES + +## Create a new table + +**Example:** +``` +CREATE TABLE IF NOT EXISTS `table`( + `id` int(11) unsigned NOT NULL, + `column` smallint(6) unsigned, + `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. + + +## Rules + +- Use `InnoDB` as engine for dynamic tables (most likely in the `auth` and `characters` databases). +- Use `MyISAM` for **read-only** tables (in `world` database), but if you're not sure, just use innoDB. +- Use `utf8` as charset. + + +## Resources + +https://www.w3schools.com/sql/sql_datatypes.asp diff --git a/sql/auth/base/development.sql b/sql/auth/base/development.sql new file mode 100644 index 00000000..b24e9bfa --- /dev/null +++ b/sql/auth/base/development.sql @@ -0,0 +1,3 @@ +-- Put only sql data in this file (insert, update, replace into, delete etc...). +-- If you don't use this database, then delete this file. +-- If no data, just delete this file. diff --git a/sql/auth/base/production.sql b/sql/auth/base/production.sql new file mode 100644 index 00000000..b24e9bfa --- /dev/null +++ b/sql/auth/base/production.sql @@ -0,0 +1,3 @@ +-- Put only sql data in this file (insert, update, replace into, delete etc...). +-- If you don't use this database, then delete this file. +-- If no data, just delete this file. diff --git a/sql/auth/base/structure.sql b/sql/auth/base/structure.sql new file mode 100644 index 00000000..039a0cad --- /dev/null +++ b/sql/auth/base/structure.sql @@ -0,0 +1,2 @@ +-- Put only sql structure in this file (create table if exists, delete table, alter table etc...). +-- If you don't use this database, then delete this file. diff --git a/sql/auth/updates/.gitkeep b/sql/auth/updates/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/sql/characters/base/development.sql b/sql/characters/base/development.sql new file mode 100644 index 00000000..b24e9bfa --- /dev/null +++ b/sql/characters/base/development.sql @@ -0,0 +1,3 @@ +-- Put only sql data in this file (insert, update, replace into, delete etc...). +-- If you don't use this database, then delete this file. +-- If no data, just delete this file. diff --git a/sql/characters/base/production.sql b/sql/characters/base/production.sql new file mode 100644 index 00000000..b24e9bfa --- /dev/null +++ b/sql/characters/base/production.sql @@ -0,0 +1,3 @@ +-- Put only sql data in this file (insert, update, replace into, delete etc...). +-- If you don't use this database, then delete this file. +-- If no data, just delete this file. diff --git a/sql/characters/base/structure.sql b/sql/characters/base/structure.sql new file mode 100644 index 00000000..039a0cad --- /dev/null +++ b/sql/characters/base/structure.sql @@ -0,0 +1,2 @@ +-- Put only sql structure in this file (create table if exists, delete table, alter table etc...). +-- If you don't use this database, then delete this file. diff --git a/sql/characters/updates/.gitkeep b/sql/characters/updates/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/sql/world/base/development.sql b/sql/world/base/development.sql new file mode 100644 index 00000000..b24e9bfa --- /dev/null +++ b/sql/world/base/development.sql @@ -0,0 +1,3 @@ +-- Put only sql data in this file (insert, update, replace into, delete etc...). +-- If you don't use this database, then delete this file. +-- If no data, just delete this file. diff --git a/sql/world/base/production.sql b/sql/world/base/production.sql new file mode 100644 index 00000000..b24e9bfa --- /dev/null +++ b/sql/world/base/production.sql @@ -0,0 +1,3 @@ +-- Put only sql data in this file (insert, update, replace into, delete etc...). +-- If you don't use this database, then delete this file. +-- If no data, just delete this file. diff --git a/sql/world/base/structure.sql b/sql/world/base/structure.sql new file mode 100644 index 00000000..039a0cad --- /dev/null +++ b/sql/world/base/structure.sql @@ -0,0 +1,2 @@ +-- Put only sql structure in this file (create table if exists, delete table, alter table etc...). +-- If you don't use this database, then delete this file. diff --git a/sql/world/updates/.gitkeep b/sql/world/updates/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/src/MP_loader.cpp b/src/MP_loader.cpp new file mode 100644 index 00000000..a640a26c --- /dev/null +++ b/src/MP_loader.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + */ + +// From SC +void AddMyPlayerScripts(); + +// Add all +// cf. the naming convention https://github.com/azerothcore/azerothcore-wotlk/blob/master/doc/changelog/master.md#how-to-upgrade-4 +// additionally replace all '-' in the module folder name with '_' here +void Addskeleton_moduleScripts() +{ + AddMyPlayerScripts(); +} + diff --git a/src/MyPlayer.cpp b/src/MyPlayer.cpp new file mode 100644 index 00000000..3973b7fd --- /dev/null +++ b/src/MyPlayer.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + */ + +#include "ScriptMgr.h" +#include "Player.h" +#include "Config.h" +#include "Chat.h" + +// Add player scripts +class MyPlayer : public PlayerScript +{ +public: + MyPlayer() : PlayerScript("MyPlayer") { } + + void OnLogin(Player* player) override + { + if (sConfigMgr->GetOption("MyModule.Enable", false)) + { + ChatHandler(player->GetSession()).SendSysMessage("Hello World from Skeleton-Module!"); + } + } +}; + +// Add all scripts in one +void AddMyPlayerScripts() +{ + new MyPlayer(); +}