From ea4406145d5ad7e69b7725dc91f3da4075fe6658 Mon Sep 17 00:00:00 2001 From: Helias Date: Sat, 18 Apr 2020 16:47:40 +0200 Subject: [PATCH 1/8] fix(build): aligned with #1137, cast long int into int --- src/PvPScript.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/PvPScript.cpp b/src/PvPScript.cpp index df32b38..73a3c61 100644 --- a/src/PvPScript.cpp +++ b/src/PvPScript.cpp @@ -2,11 +2,11 @@ #include "Player.h" #include "Creature.h" #include "AccountMgr.h" -#include "ScriptedAI\ScriptedCreature.h" #include "ScriptMgr.h" #include "Define.h" #include "GossipDef.h" #include "Pet.h" +#include "LootMgr.h" uint32 SUMMON_CHEST; uint32 KillAnnounce; @@ -49,7 +49,7 @@ class PvPScript : public PlayerScript //Gurubashi Arena if (killed->GetMapId() == 0 && killed->GetZoneId() == 33) - for (int i = 0; i < AreatoIgnore.size(); ++i) + for (int i = 0; i < int(AreatoIgnore.size()); ++i) if (killed->GetAreaId() == AreatoIgnore[i]) return; @@ -88,7 +88,7 @@ class PvPScript : public PlayerScript if (Item* pItem = killed->GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { uint8 slot = pItem->GetSlot(); - LootStoreItem storeItem = LootStoreItem(pItem->GetEntry(), 100, LOOT_MODE_DEFAULT, 0, 1, 1); + LootStoreItem storeItem = LootStoreItem(pItem->GetEntry(), 0, 100, 0, LOOT_MODE_DEFAULT, 0, 1, 1); go->loot.AddItem(storeItem); killed->DestroyItem(INVENTORY_SLOT_BAG_0, slot, true); } @@ -118,7 +118,7 @@ class PvPScript : public PlayerScript //Gurubashi Arena if (killed->GetMapId() == 0 && killed->GetZoneId() == 33) - for (int i = 0; i < AreatoIgnore.size(); ++i) + for (int i = 0; i < int(AreatoIgnore.size()); ++i) if (killed->GetAreaId() == AreatoIgnore[i]) return; @@ -155,7 +155,7 @@ class PvPScript : public PlayerScript if (Item* pItem = killed->GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { uint8 slot = pItem->GetSlot(); - LootStoreItem storeItem = LootStoreItem(pItem->GetEntry(), 100, LOOT_MODE_DEFAULT, 0, 1, 1); + LootStoreItem storeItem = LootStoreItem(pItem->GetEntry(), 0, 100, 0, LOOT_MODE_DEFAULT, 0, 1, 1); go->loot.AddItem(storeItem); killed->DestroyItem(INVENTORY_SLOT_BAG_0, slot, true); } @@ -194,4 +194,4 @@ void AddPvPScripts() { new PvPScript(); new PvPScript_conf(); -} \ No newline at end of file +} From 6f60999c559108674554530e5fc834e06e457135 Mon Sep 17 00:00:00 2001 From: Helias Date: Sun, 30 Aug 2020 18:47:51 +0200 Subject: [PATCH 2/8] feat(CI): move from Travis to GitHub Actions --- .github/workflows/core-build.yml | 45 ++++++++++++++++++++++++++++++++ .travis.yml | 42 ----------------------------- 2 files changed, 45 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/core-build.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/core-build.yml b/.github/workflows/core-build.yml new file mode 100644 index 0000000..86c9351 --- /dev/null +++ b/.github/workflows/core-build.yml @@ -0,0 +1,45 @@ +name: core-build +on: + push: + pull_request: + +jobs: + build: + strategy: + fail-fast: false + matrix: + compiler: [clang6, clang9, clang10] + runs-on: ubuntu-20.04 + 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/mod-pvpscript' + - name: Cache + uses: actions/cache@v1.1.2 + 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 ./apps/ci/ci-install.sh + env: + CONTINUOUS_INTEGRATION: true + - 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 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3bfd0f7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -sudo: required -dist: trusty # (14.04) -# xenial (16.04) is not supported yet - -language: cpp -compiler: - - clang - -git: - depth: 1 - -before_install: - - sudo apt-get -y install build-essential libtool make cmake cmake-data openssl - - sudo apt-get -y install libssl-dev libmysqlclient-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev libace-dev - - git config user.email "travis@build.bot" && git config user.name "Travis CI" - - git tag -a -m "Travis build" init - -install: - - cd .. - - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore - - mv mod-duelreset azerothcore/modules - - cd azerothcore - - git submodule update --init --recursive - - - mysql -uroot -e 'create database test_mysql;' - - cd bin - - cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=0 -DSCRIPTS=1 -DSERVERS=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=check_install - - cd .. - -script: - - $CXX --version - - mysql -uroot < data/sql/create/create_mysql.sql - - cat data/sql/base/db_auth/*.sql | mysql -uacore -pacore auth - - cat data/sql/base/db_characters/*.sql | mysql -uacore -pacore characters - - cat data/sql/base/db_world/*.sql | mysql -uacore -pacore world - - cat data/sql/updates/db_auth/*.sql | mysql -uacore -pacore auth - - cat data/sql/updates/db_characters/*.sql | mysql -uacore -pacore characters - - cat data/sql/updates/db_world/*.sql | mysql -uacore -pacore world - - mysql -uroot < data/sql/create/drop_mysql.sql - - cd bin - - make -j 8 -k && make install - - cd check_install/bin From 328ad06c10c5d226f16cd93d1af37b4d37c5d6d2 Mon Sep 17 00:00:00 2001 From: Patrick Lewis Date: Mon, 19 Oct 2020 01:11:59 -0700 Subject: [PATCH 3/8] fix: chathandler build error (#3) --- src/PvPScript.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PvPScript.cpp b/src/PvPScript.cpp index 73a3c61..737a688 100644 --- a/src/PvPScript.cpp +++ b/src/PvPScript.cpp @@ -7,6 +7,7 @@ #include "GossipDef.h" #include "Pet.h" #include "LootMgr.h" +#include "Chat.h" uint32 SUMMON_CHEST; uint32 KillAnnounce; From 8849725d7156c8b237f309b5afd2a1d9327932f9 Mon Sep 17 00:00:00 2001 From: Patrick Lewis Date: Sat, 21 Nov 2020 18:59:01 -0800 Subject: [PATCH 4/8] docs(readme): add AzerothCore logo and build status badge (#4) --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 34852a3..caa62a7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -# PvPScript - -This is a module for [AzerothCore](http://www.azerothcore.org) +# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore +## PvPScript +### This is a module for [AzerothCore](http://www.azerothcore.org) +- Latest build status with azerothcore: [![Build Status](https://github.com/azerothcore/mod-pvpscript/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/mod-pvpscript) Current features: From 96e49052303615caece022501b8ba37524274eee Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 2 Mar 2021 21:41:05 +0300 Subject: [PATCH 5/8] fix for last PR ACE remove (#5) --- CMakeLists.txt | 2 +- src/PvPScript.cpp | 10 ---------- src/cmake/after_ws_install.cmake | 13 ------------- 3 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 src/cmake/after_ws_install.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e82bc1c..6e38c3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,6 @@ AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/PvPScript.cpp") AC_ADD_SCRIPT_LOADER("PvP" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h") -CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_CURRENT_LIST_DIR}/src/cmake/after_ws_install.cmake") +AC_ADD_CONFIG_FILE("${CMAKE_CURRENT_LIST_DIR}/conf/PvPScript.conf.dist") message("-- PvPScript CONFIGURED --") diff --git a/src/PvPScript.cpp b/src/PvPScript.cpp index 737a688..e38364c 100644 --- a/src/PvPScript.cpp +++ b/src/PvPScript.cpp @@ -173,16 +173,6 @@ class PvPScript_conf : public WorldScript void OnBeforeConfigLoad(bool reload) override { if (!reload) { - std::string conf_path = _CONF_DIR; - std::string cfg_file = conf_path + "/PvPScript.conf"; - -#ifdef WIN32 - cfg_file = "PvPScript.conf"; -#endif - std::string cfg_def_file = cfg_file + ".dist"; - sConfigMgr->LoadMore(cfg_def_file.c_str()); - sConfigMgr->LoadMore(cfg_file.c_str()); - SUMMON_CHEST = sConfigMgr->GetIntDefault("ChestID", 179697); KillAnnounce = sConfigMgr->GetIntDefault("KillAnnounce", 1); chest_despawn = sConfigMgr->GetIntDefault("ChestTimer", 120); diff --git a/src/cmake/after_ws_install.cmake b/src/cmake/after_ws_install.cmake deleted file mode 100644 index 821d878..0000000 --- a/src/cmake/after_ws_install.cmake +++ /dev/null @@ -1,13 +0,0 @@ -if ( MSVC ) - add_custom_command(TARGET worldserver - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_PvPScript_DIR}/conf/PvPScript.conf.dist ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/ - ) -elseif ( MINGW ) - add_custom_command(TARGET worldserver - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_PvPScript_DIR}/conf/PvPScript.conf.dist ${CMAKE_BINARY_DIR}/bin/ - ) -endif() - -install(FILES "${CMAKE_PvPScript_DIR}/conf/PvPScript.conf.dist" DESTINATION ${CONF_DIR}) From 8c99f217502506318641c56f342f25189623ba01 Mon Sep 17 00:00:00 2001 From: Helias Date: Sun, 30 May 2021 23:53:22 +0200 Subject: [PATCH 6/8] fix: build --- src/PvPScript.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PvPScript.cpp b/src/PvPScript.cpp index e38364c..896b9ef 100644 --- a/src/PvPScript.cpp +++ b/src/PvPScript.cpp @@ -83,7 +83,7 @@ class PvPScript : public PlayerScript } killer->AddGameObject(go); - go->SetOwnerGUID(0); //This is so killed players can also loot the chest + go->SetOwnerGUID(ObjectGuid::Empty); //This is so killed players can also loot the chest for (int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) if (Item* pItem = killed->GetItemByPos(INVENTORY_SLOT_BAG_0, i)) @@ -150,7 +150,7 @@ class PvPScript : public PlayerScript } killer->AddGameObject(go); - go->SetOwnerGUID(0); //This is so killed players can also loot the chest + go->SetOwnerGUID(ObjectGuid::Empty); //This is so killed players can also loot the chest for (int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) if (Item* pItem = killed->GetItemByPos(INVENTORY_SLOT_BAG_0, i)) From 2b7bb64ca5776fcbb9e38c6a01a4c145a673ded7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefano=20Borz=C3=AC?= Date: Mon, 31 May 2021 00:12:32 +0200 Subject: [PATCH 7/8] Update core-build.yml --- .github/workflows/core-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/core-build.yml b/.github/workflows/core-build.yml index 86c9351..6416388 100644 --- a/.github/workflows/core-build.yml +++ b/.github/workflows/core-build.yml @@ -8,8 +8,8 @@ jobs: strategy: fail-fast: false matrix: - compiler: [clang6, clang9, clang10] - runs-on: ubuntu-20.04 + compiler: [clang] + runs-on: ubuntu-latest name: ${{ matrix.compiler }} env: COMPILER: ${{ matrix.compiler }} @@ -42,4 +42,4 @@ jobs: - name: Dry run run: source ./apps/ci/ci-worldserver-dry-run.sh - name: Check startup errors - run: source ./apps/ci/ci-error-check.sh \ No newline at end of file + run: source ./apps/ci/ci-error-check.sh From 9aab94e302efe006526f11250f6358c375a2db1b Mon Sep 17 00:00:00 2001 From: Walter Pagani Date: Sun, 10 Mar 2024 19:57:02 -0300 Subject: [PATCH 8/8] chore. Update api and module (#7) --- .editorconfig | 8 ++ .gitattributes | 104 +++++++++++++++++++++ .github/ISSUE_TEMPLATE/bug_report.yml | 72 ++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.yml | 33 +++++++ .github/workflows/core-build.yml | 43 +-------- CMakeLists.txt | 9 -- README.md | 14 +-- conf/PvPScript.conf.dist | 17 ++-- pull_request_template.md | 25 +++++ src/PS_loader.cpp | 6 ++ src/PvPScript.cpp | 32 +++---- src/loader.h | 1 - 12 files changed, 288 insertions(+), 76 deletions(-) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml delete mode 100644 CMakeLists.txt create mode 100644 pull_request_template.md create mode 100644 src/PS_loader.cpp delete mode 100644 src/loader.h diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..eb64e2f --- /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/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6667b6a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,104 @@ +## 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 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/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..5610d2b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,72 @@ +name: Bug report +description: Create a bug report to help us improve. +title: "Bug: " +body: + - type: textarea + id: current + attributes: + label: Current Behaviour + description: | + Description of the problem or issue here. + Include entries of affected creatures / items / quests / spells etc. + If this is a crash, post the crashlog (upload to https://gist.github.com/) and include the link here. + Never upload files! Use GIST for text and YouTube for videos! + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected Behaviour + description: | + Tell us what should happen instead. + validations: + required: true + - type: textarea + id: reproduce + attributes: + label: Steps to reproduce the problem + description: | + What does someone else need to do to encounter the same bug? + placeholder: | + 1. Step 1 + 2. Step 2 + 3. Step 3 + validations: + required: true + - type: textarea + id: extra + attributes: + label: Extra Notes + description: | + Do you have any extra notes that can help solve the issue that does not fit any other field? + placeholder: | + None + validations: + required: false + - type: textarea + id: commit + attributes: + label: AC rev. hash/commit + description: | + Copy the result of the `.server debug` command (if you need to run it from the client get a prat addon) + validations: + required: true + - type: input + id: os + attributes: + label: Operating system + description: | + The Operating System the Server is running on. + i.e. Windows 11 x64, Debian 10 x64, macOS 12, Ubuntu 20.04 + validations: + required: true + - type: textarea + id: custom + attributes: + label: Custom changes or Modules + description: | + List which custom changes or modules you have applied, i.e. Eluna module, etc. + placeholder: | + None + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..58f79dd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,33 @@ +name: Feature request +description: Suggest an idea for this project +title: "Feature: " +body: + - type: markdown + attributes: + value: | + Thank you for taking your time to fill out a feature request. Remember to fill out all fields including the title above. + An issue that is not properly filled out will be closed. + - type: textarea + id: description + attributes: + label: Describe your feature request or suggestion in detail + description: | + A clear and concise description of what you want to happen. + validations: + required: true + - type: textarea + id: solution + attributes: + label: Describe a possible solution to your feature or suggestion in detail + description: | + A clear and concise description of any alternative solutions or features you've considered. + validations: + required: false + - type: textarea + id: additional + attributes: + label: Additional context + description: | + Add any other context or screenshots about the feature request here. + validations: + required: false diff --git a/.github/workflows/core-build.yml b/.github/workflows/core-build.yml index 6416388..921c9eb 100644 --- a/.github/workflows/core-build.yml +++ b/.github/workflows/core-build.yml @@ -1,45 +1,12 @@ name: core-build on: push: + branches: + - 'master' 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/mod-pvpscript' - - name: Cache - uses: actions/cache@v1.1.2 - 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 ./apps/ci/ci-install.sh - env: - CONTINUOUS_INTEGRATION: true - - 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 + uses: azerothcore/reusable-workflows/.github/workflows/core_build_modules.yml@main + with: + module_repo: ${{ github.event.repository.name }} diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 6e38c3e..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -CU_SET_PATH("CMAKE_PvPScript_DIR" "${CMAKE_CURRENT_LIST_DIR}") - -AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/PvPScript.cpp") - -AC_ADD_SCRIPT_LOADER("PvP" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h") - -AC_ADD_CONFIG_FILE("${CMAKE_CURRENT_LIST_DIR}/conf/PvPScript.conf.dist") - -message("-- PvPScript CONFIGURED --") diff --git a/README.md b/README.md index caa62a7..05699ab 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,19 @@ # ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore + ## PvPScript + ### This is a module for [AzerothCore](http://www.azerothcore.org) -- Latest build status with azerothcore: [![Build Status](https://github.com/azerothcore/mod-pvpscript/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/mod-pvpscript) + +- Latest build status with azerothcore: + +[![Build Status](https://github.com/azerothcore/mod-pvpscript/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/mod-pvpscript) Current features: --**Puts a players armor in a chest for other players to loot if they are killed. Only works in open world. +-**Puts a players armor in a chest for other players to loot if they are killed. Only works in open world.** Upcoming features: - ## Requirements PvPScript Module currently requires: @@ -31,7 +35,5 @@ AzerothCore v1.0.1+ If you need to change the module configuration, go to your server configuration folder (e.g. **etc**), copy `PvPScript.conf.dist` to `PvPScript.conf` and edit it as you prefer. # Show your appreciation -[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SBJFTAJKUNEXC) - - +[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SBJFTAJKUNEXC) diff --git a/conf/PvPScript.conf.dist b/conf/PvPScript.conf.dist index 42a4017..5e206f4 100644 --- a/conf/PvPScript.conf.dist +++ b/conf/PvPScript.conf.dist @@ -5,33 +5,38 @@ # Description: Enable or Disable this feature for the players to drop loot. # Default: Enabled = 1 # Disabled = 0 + PvPChest = 1 # # ChestID # Description: allows the player to spawn the chest of their choice # Default: Enabled = 179697 -# +# + ChestID = "80000" # # KillAnnounce # Description: Announces to the player who killed them. # Config: Disable = "0" : Announce = "1" : Notifaction = "2" : Both = "3" -# +# + KillAnnounce = "1" # # ChestTimer # Description: The ammount of time the chest is in world before despawn (In Seconds) # Config: Default = 120 -# +# + ChestTimer = "120" # # spawnchestIP # Description: Allow the chest to spawn if player is on the same IP address # Config: Disable = "0" -# Enable = "1" do not spawn chest if same IP -# -spawnchestIP = "1" \ No newline at end of file +# Enable = "1" do not spawn chest if same IP +# + +spawnchestIP = "1" diff --git a/pull_request_template.md b/pull_request_template.md new file mode 100644 index 0000000..21c9245 --- /dev/null +++ b/pull_request_template.md @@ -0,0 +1,25 @@ + + +## Changes Proposed: +- +- + +## Issues Addressed: + +- Closes + +## SOURCE: + + +## Tests Performed: + +- +- + + +## How to Test the Changes: + + +1. +2. +3. diff --git a/src/PS_loader.cpp b/src/PS_loader.cpp new file mode 100644 index 0000000..9f42f16 --- /dev/null +++ b/src/PS_loader.cpp @@ -0,0 +1,6 @@ +void AddPvPScripts(); + +void Addmod_pvpscriptScripts() +{ + AddPvPScripts(); +} diff --git a/src/PvPScript.cpp b/src/PvPScript.cpp index 896b9ef..9e0d5fe 100644 --- a/src/PvPScript.cpp +++ b/src/PvPScript.cpp @@ -1,4 +1,4 @@ -#include "Configuration/Config.h" +#include "Configuration/Config.h" #include "Player.h" #include "Creature.h" #include "AccountMgr.h" @@ -9,20 +9,19 @@ #include "LootMgr.h" #include "Chat.h" -uint32 SUMMON_CHEST; -uint32 KillAnnounce; +uint32 SummonChest, KillAnnounce; bool spawnchestIP; -uint32 chest_despawn; -std::vector AreatoIgnore = { 1741/*Gurubashi*/, 2177 }; +uint32 chestDespawn; +std::vector AreatoIgnore = { 1741 /*Gurubashi*/, 2177 }; class PvPScript : public PlayerScript { public: - PvPScript() : PlayerScript("PvPScript") {} + PvPScript() : PlayerScript("PvPScript") {} void OnPlayerKilledByCreature(Creature* killer, Player* killed) { - if (!sConfigMgr->GetBoolDefault("PvPChest", true)) + if (!sConfigMgr->GetOption("PvPChest", true)) return; if (!killer->IsPet()) @@ -66,7 +65,7 @@ class PvPScript : public PlayerScript // if target is killed and killer is pet if (!killed->IsAlive() && killer->IsPet()) { - if (GameObject* go = killer->SummonGameObject(SUMMON_CHEST, killed->GetPositionX(), killed->GetPositionY(), killed->GetPositionZ(), killed->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, chest_despawn, false)) + if (GameObject* go = killer->SummonGameObject(SummonChest, killed->GetPositionX(), killed->GetPositionY(), killed->GetPositionZ(), killed->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, chestDespawn, false)) { switch (KillAnnounce) { @@ -99,7 +98,7 @@ class PvPScript : public PlayerScript void OnPVPKill(Player* killer, Player* killed) { - if (!sConfigMgr->GetBoolDefault("PvPChest", true)) + if (!sConfigMgr->GetOption("PvPChest", true)) return; std::string name = killer->GetName(); @@ -133,7 +132,7 @@ class PvPScript : public PlayerScript if (!killed->IsAlive()) { - if (GameObject* go = killer->SummonGameObject(SUMMON_CHEST, killed->GetPositionX(), killed->GetPositionY(), killed->GetPositionZ(), killed->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, chest_despawn, false)) + if (GameObject* go = killer->SummonGameObject(SummonChest, killed->GetPositionX(), killed->GetPositionY(), killed->GetPositionZ(), killed->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, chestDespawn, false)) { switch (KillAnnounce) { @@ -152,7 +151,7 @@ class PvPScript : public PlayerScript killer->AddGameObject(go); go->SetOwnerGUID(ObjectGuid::Empty); //This is so killed players can also loot the chest - for (int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) + for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) if (Item* pItem = killed->GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { uint8 slot = pItem->GetSlot(); @@ -172,11 +171,12 @@ class PvPScript_conf : public WorldScript void OnBeforeConfigLoad(bool reload) override { - if (!reload) { - SUMMON_CHEST = sConfigMgr->GetIntDefault("ChestID", 179697); - KillAnnounce = sConfigMgr->GetIntDefault("KillAnnounce", 1); - chest_despawn = sConfigMgr->GetIntDefault("ChestTimer", 120); - spawnchestIP = sConfigMgr->GetBoolDefault("spawnchestIP", true); + if (!reload) + { + SummonChest = sConfigMgr->GetOption("ChestID", 179697); + KillAnnounce = sConfigMgr->GetOption("KillAnnounce", 1); + chestDespawn = sConfigMgr->GetOption("ChestTimer", 120); + spawnchestIP = sConfigMgr->GetOption("spawnchestIP", true); } } }; diff --git a/src/loader.h b/src/loader.h deleted file mode 100644 index 009aa38..0000000 --- a/src/loader.h +++ /dev/null @@ -1 +0,0 @@ -void AddPvPScripts(); \ No newline at end of file