removed DungeonRespawn
This commit is contained in:
parent
6b80b68e2e
commit
2387970989
|
@ -1,8 +0,0 @@
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 4
|
|
||||||
tab_width = 4
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
max_line_length = 80
|
|
|
@ -1,45 +0,0 @@
|
||||||
### 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.
|
|
||||||
## =======================================================
|
|
|
@ -1,105 +0,0 @@
|
||||||
## 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
|
|
|
@ -1,11 +0,0 @@
|
||||||
name: core-build
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
uses: azerothcore/reusable-workflows/.github/workflows/core_build_modules.yml@main
|
|
||||||
with:
|
|
||||||
module_repo: ${{ github.event.repository.name }}
|
|
|
@ -1,48 +0,0 @@
|
||||||
!.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
|
|
|
@ -1,21 +0,0 @@
|
||||||
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.
|
|
|
@ -1,19 +0,0 @@
|
||||||
# ![logo](https://camo.githubusercontent.com/e4f036844d45424178f34d39dc3b0d52fdb82c07c5ef3c2aeb7e3da22c1538b3/68747470733a2f2f692e696d6775722e636f6d2f66517762386d332e706e67)Dungeon Respawn
|
|
||||||
|
|
||||||
## About
|
|
||||||
|
|
||||||
This module will teleport the player to the start of the dungeon on death.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
Just clone the module into your modules directory for your server, re-run cmake and compile.
|
|
||||||
|
|
||||||
Then enable the module in the module config.
|
|
||||||
|
|
||||||
## Contact
|
|
||||||
|
|
||||||
If you need any help you can join my [Discord Server](https://discord.gg/xdVPGcpJ8C).
|
|
||||||
|
|
||||||
## Credits
|
|
||||||
|
|
||||||
Thanks to Артём Борисов_99 from the AzerothCore Discord for the module suggestion.
|
|
|
@ -1,66 +0,0 @@
|
||||||
[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) <!-- Puedes eliminar estas líneas, pero al crear un nuevo modulo, es notificado a estas personas, por lo que está bueno que eso ocurra. -->
|
|
||||||
* [Talamortis](https://github.com/talamortis)<!-- Puedes eliminar estas líneas, pero al crear un nuevo modulo, es notificado a estas personas, por lo que está bueno que eso ocurra. -->
|
|
||||||
|
|
||||||
AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/PaqQRkd)
|
|
|
@ -1,41 +0,0 @@
|
||||||
# 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")
|
|
||||||
|
|
||||||
<!-- Video example - We can't embed videos on github, only on github.io pages. If you can, make an animated gif of your video instead (but it's not required) -->
|
|
||||||
[![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)
|
|
|
@ -1,32 +0,0 @@
|
||||||
#!/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/"
|
|
||||||
)
|
|
|
@ -1,26 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
|
||||||
#
|
|
||||||
|
|
||||||
[worldserver]
|
|
||||||
|
|
||||||
########################################
|
|
||||||
# Dungeon Respawn configuration
|
|
||||||
########################################
|
|
||||||
#
|
|
||||||
# DungeonRespawn.Enable
|
|
||||||
# Description: Enables the Dungeon Respawn module.
|
|
||||||
# Default: 0 - Disabled
|
|
||||||
# 1 - Enabled
|
|
||||||
#
|
|
||||||
|
|
||||||
DungeonRespawn.Enable = 0
|
|
||||||
|
|
||||||
#
|
|
||||||
# DungeonRespawn.RespawnHealthPct
|
|
||||||
# Description: The amount of health in % to respawn with.
|
|
||||||
# Range: 0.0 - 100.0
|
|
||||||
# Default: 100.0
|
|
||||||
#
|
|
||||||
|
|
||||||
DungeonRespawn.RespawnHealthPct = 50.0
|
|
|
@ -1,8 +0,0 @@
|
||||||
CREATE TABLE IF NOT EXISTS `dungeonrespawn_playerinfo` (
|
|
||||||
`guid` bigint(20) unsigned DEFAULT NULL,
|
|
||||||
`map` int(11) DEFAULT NULL,
|
|
||||||
`x` float DEFAULT NULL,
|
|
||||||
`y` float DEFAULT NULL,
|
|
||||||
`z` float DEFAULT NULL,
|
|
||||||
`o` float DEFAULT NULL
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
@ -1,4 +0,0 @@
|
||||||
DELETE FROM dungeonrespawn_playerinfo;
|
|
||||||
|
|
||||||
ALTER TABLE dungeonrespawn_playerinfo
|
|
||||||
MODIFY guid BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY;
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB |
|
@ -1,10 +0,0 @@
|
||||||
#!/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
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
## Set a local git commit template
|
|
||||||
git config --local commit.template ".git_commit_template.txt" ;
|
|
|
@ -1,294 +0,0 @@
|
||||||
#include "DungeonRespawn.h"
|
|
||||||
|
|
||||||
bool DSPlayerScript::IsInsideDungeonRaid(Player* player)
|
|
||||||
{
|
|
||||||
if (!player)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map* map = player->GetMap();
|
|
||||||
if (!map)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!map->IsDungeon() && !map->IsRaid())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
void DSPlayerScript::OnPlayerReleasedGhost(Player* player)
|
|
||||||
{
|
|
||||||
if (!drEnabled)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsInsideDungeonRaid(player))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
playersToTeleport.push_back(player->GetGUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSPlayerScript::ResurrectPlayer(Player* player)
|
|
||||||
{
|
|
||||||
player->ResurrectPlayer(respawnHpPct / 100.0f, false);
|
|
||||||
player->SpawnCorpseBones();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DSPlayerScript::OnBeforeTeleport(Player* player, uint32 mapid, float /*x*/, float /*y*/, float /*z*/, float /*orientation*/, uint32 /*options*/, Unit* /*target*/)
|
|
||||||
{
|
|
||||||
if (!drEnabled)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player->GetMapId() != mapid)
|
|
||||||
{
|
|
||||||
auto prData = GetOrCreateRespawnData(player);
|
|
||||||
prData->isTeleportingNewMap = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsInsideDungeonRaid(player))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player->isDead())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
GuidVector::iterator itToRemove;
|
|
||||||
bool canRestore = false;
|
|
||||||
|
|
||||||
for (auto it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
|
|
||||||
{
|
|
||||||
if (*it == player->GetGUID())
|
|
||||||
{
|
|
||||||
itToRemove = it;
|
|
||||||
canRestore = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!canRestore)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
playersToTeleport.erase(itToRemove);
|
|
||||||
|
|
||||||
auto prData = GetOrCreateRespawnData(player);
|
|
||||||
if (prData)
|
|
||||||
{
|
|
||||||
//Invalid Player Restore data, use default behaviour.
|
|
||||||
if (prData->dungeon.map == -1)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prData->dungeon.map != int32(player->GetMapId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
player->TeleportTo(prData->dungeon.map, prData->dungeon.x, prData->dungeon.y, prData->dungeon.z, prData->dungeon.o);
|
|
||||||
ResurrectPlayer(player);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSWorldScript::OnAfterConfigLoad(bool reload)
|
|
||||||
{
|
|
||||||
if (reload)
|
|
||||||
{
|
|
||||||
SaveRespawnData();
|
|
||||||
respawnData.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
drEnabled = sConfigMgr->GetOption<bool>("DungeonRespawn.Enable", false);
|
|
||||||
respawnHpPct = sConfigMgr->GetOption<float>("DungeonRespawn.RespawnHealthPct", 50.0f);
|
|
||||||
|
|
||||||
QueryResult qResult = CharacterDatabase.Query("SELECT `guid`, `map`, `x`, `y`, `z`, `o` FROM `dungeonrespawn_playerinfo`");
|
|
||||||
|
|
||||||
if (qResult)
|
|
||||||
{
|
|
||||||
uint32 dataCount = 0;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Field* fields = qResult->Fetch();
|
|
||||||
|
|
||||||
PlayerRespawnData prData;
|
|
||||||
DungeonData dData;
|
|
||||||
prData.guid = ObjectGuid(fields[0].Get<uint64>());
|
|
||||||
dData.map = fields[1].Get<int32>();
|
|
||||||
dData.x = fields[2].Get<float>();
|
|
||||||
dData.y = fields[3].Get<float>();
|
|
||||||
dData.z = fields[4].Get<float>();
|
|
||||||
dData.o = fields[5].Get<float>();
|
|
||||||
prData.dungeon = dData;
|
|
||||||
prData.isTeleportingNewMap = false;
|
|
||||||
prData.inDungeon = false;
|
|
||||||
|
|
||||||
respawnData.push_back(prData);
|
|
||||||
|
|
||||||
dataCount++;
|
|
||||||
} while (qResult->NextRow());
|
|
||||||
|
|
||||||
LOG_INFO("module", "Loaded '{}' rows from 'dungeonrespawn_playerinfo' table.", dataCount);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_INFO("module", "Loaded '0' rows from 'dungeonrespawn_playerinfo' table.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSWorldScript::OnShutdown()
|
|
||||||
{
|
|
||||||
SaveRespawnData();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSWorldScript::SaveRespawnData()
|
|
||||||
{
|
|
||||||
for (const auto& prData : respawnData)
|
|
||||||
{
|
|
||||||
if (prData.inDungeon)
|
|
||||||
{
|
|
||||||
CharacterDatabase.Execute("INSERT INTO `dungeonrespawn_playerinfo` (guid, map, x, y, z, o) VALUES ({}, {}, {}, {}, {}, {}) ON DUPLICATE KEY UPDATE map={}, x={}, y={}, z={}, o={}",
|
|
||||||
prData.guid.GetRawValue(),
|
|
||||||
prData.dungeon.map,
|
|
||||||
prData.dungeon.x,
|
|
||||||
prData.dungeon.y,
|
|
||||||
prData.dungeon.z,
|
|
||||||
prData.dungeon.o,
|
|
||||||
prData.dungeon.map,
|
|
||||||
prData.dungeon.x,
|
|
||||||
prData.dungeon.y,
|
|
||||||
prData.dungeon.z,
|
|
||||||
prData.dungeon.o);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CharacterDatabase.Execute("DELETE FROM `dungeonrespawn_playerinfo` WHERE guid = {}", prData.guid.GetRawValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerRespawnData* DSPlayerScript::GetOrCreateRespawnData(Player* player)
|
|
||||||
{
|
|
||||||
for (auto it = respawnData.begin(); it != respawnData.end(); ++it)
|
|
||||||
{
|
|
||||||
if (it != respawnData.end())
|
|
||||||
{
|
|
||||||
if (player->GetGUID() == it->guid)
|
|
||||||
{
|
|
||||||
return &(*it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateRespawnData(player);
|
|
||||||
|
|
||||||
return GetOrCreateRespawnData(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSPlayerScript::OnMapChanged(Player* player)
|
|
||||||
{
|
|
||||||
if (!player)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto prData = GetOrCreateRespawnData(player);
|
|
||||||
|
|
||||||
if (!prData)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool inDungeon = IsInsideDungeonRaid(player);
|
|
||||||
prData->inDungeon = inDungeon;
|
|
||||||
|
|
||||||
if (!inDungeon)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!prData->isTeleportingNewMap)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
prData->dungeon.map = player->GetMapId();
|
|
||||||
prData->dungeon.x = player->GetPositionX();
|
|
||||||
prData->dungeon.y = player->GetPositionY();
|
|
||||||
prData->dungeon.z = player->GetPositionZ();
|
|
||||||
prData->dungeon.o = player->GetOrientation();
|
|
||||||
|
|
||||||
prData->isTeleportingNewMap = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSPlayerScript::CreateRespawnData(Player* player)
|
|
||||||
{
|
|
||||||
DungeonData newDData;
|
|
||||||
newDData.map = -1;
|
|
||||||
newDData.x = 0;
|
|
||||||
newDData.y = 0;
|
|
||||||
newDData.z = 0;
|
|
||||||
newDData.o = 0;
|
|
||||||
|
|
||||||
PlayerRespawnData newPrData;
|
|
||||||
newPrData.dungeon = newDData;
|
|
||||||
newPrData.guid = player->GetGUID();
|
|
||||||
newPrData.isTeleportingNewMap = false;
|
|
||||||
newPrData.inDungeon = false;
|
|
||||||
|
|
||||||
respawnData.push_back(newPrData);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSPlayerScript::OnLogin(Player* player)
|
|
||||||
{
|
|
||||||
if (!player)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetOrCreateRespawnData(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSPlayerScript::OnLogout(Player* player)
|
|
||||||
{
|
|
||||||
if (!player)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto it = playersToTeleport.begin(); it < playersToTeleport.end(); ++it)
|
|
||||||
{
|
|
||||||
if (player->GetGUID() == (*it))
|
|
||||||
{
|
|
||||||
playersToTeleport.erase(it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SC_AddDungeonRespawnScripts()
|
|
||||||
{
|
|
||||||
new DSWorldScript();
|
|
||||||
new DSPlayerScript();
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
#ifndef MODULE_DUNGEONRESPAWN_H
|
|
||||||
#define MODULE_DUNGEONRESPAWN_H
|
|
||||||
|
|
||||||
#include "ScriptMgr.h"
|
|
||||||
#include "LFGMgr.h"
|
|
||||||
#include "Player.h"
|
|
||||||
#include "Config.h"
|
|
||||||
#include "Chat.h"
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
struct DungeonData
|
|
||||||
{
|
|
||||||
int32 map;
|
|
||||||
float x;
|
|
||||||
float y;
|
|
||||||
float z;
|
|
||||||
float o;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PlayerRespawnData
|
|
||||||
{
|
|
||||||
ObjectGuid guid;
|
|
||||||
DungeonData dungeon;
|
|
||||||
bool isTeleportingNewMap;
|
|
||||||
bool inDungeon;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector<PlayerRespawnData> respawnData;
|
|
||||||
|
|
||||||
bool drEnabled;
|
|
||||||
float respawnHpPct;
|
|
||||||
|
|
||||||
class DSPlayerScript : public PlayerScript
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DSPlayerScript() : PlayerScript("DSPlayerScript") { }
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::vector<ObjectGuid> playersToTeleport;
|
|
||||||
bool IsInsideDungeonRaid(Player* /*player*/);
|
|
||||||
void ResurrectPlayer(Player* /*player*/);
|
|
||||||
PlayerRespawnData* GetOrCreateRespawnData(Player* /*player*/);
|
|
||||||
void CreateRespawnData(Player* /*player*/);
|
|
||||||
void OnPlayerReleasedGhost(Player* /*player*/) override;
|
|
||||||
bool OnBeforeTeleport(Player* /*player*/, uint32 /*mapid*/, float /*x*/, float /*y*/, float /*z*/, float /*orientation*/, uint32 /*options*/, Unit* /*target*/) override;
|
|
||||||
void OnMapChanged(Player* /*player*/) override;
|
|
||||||
void OnLogin(Player* /*player*/) override;
|
|
||||||
void OnLogout(Player* /*player*/) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DSWorldScript : public WorldScript
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DSWorldScript() : WorldScript("DSWorldScript") { }
|
|
||||||
|
|
||||||
private:
|
|
||||||
void OnAfterConfigLoad(bool /*reload*/) override;
|
|
||||||
void OnShutdown() override;
|
|
||||||
void SaveRespawnData();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //MODULE_DUNGEONRESPAWN_H
|
|
|
@ -1,15 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
|
||||||
*/
|
|
||||||
|
|
||||||
// From SC
|
|
||||||
void SC_AddDungeonRespawnScripts();
|
|
||||||
|
|
||||||
// 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 AddDungeonRespawnScripts()
|
|
||||||
{
|
|
||||||
SC_AddDungeonRespawnScripts();
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue