From 426bb0f99c96cad8b5003b19486ad63205bfa534 Mon Sep 17 00:00:00 2001 From: Walter Pagani Date: Mon, 17 Jul 2023 09:16:06 -0300 Subject: [PATCH] feat. Update module to work with the latest emulator version (#8) --- .editorconfig | 8 ++ .gitattributes | 107 ++++++++++++++++++++- .github/ISSUE_TEMPLATE/bug_report.yml | 72 ++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.yml | 33 +++++++ .github/README.md | 9 ++ .github/workflows/core-build.yml | 42 +------- .gitignore | 48 +++++++++ CMakeLists.txt | 7 -- README.md | 5 - pull_request_template.md | 25 +++++ src/loader_account_mount.cpp | 11 +++ src/loader_account_mount.h | 1 - src/mod_account_mount.cpp | 25 ++--- 13 files changed, 328 insertions(+), 65 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/README.md create mode 100644 .gitignore delete mode 100644 CMakeLists.txt delete mode 100644 README.md create mode 100644 pull_request_template.md create mode 100644 src/loader_account_mount.cpp delete mode 100644 src/loader_account_mount.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 index dfe0770..7ef9001 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,105 @@ -# Auto detect text files and perform LF normalization -* text=auto +## 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/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/README.md b/.github/README.md new file mode 100644 index 0000000..49c8d3f --- /dev/null +++ b/.github/README.md @@ -0,0 +1,9 @@ +# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore + +## mod-account-mounts + +- Latest build status with azerothcore: + +[![Build Status](https://github.com/azerothcore/mod-account-mounts/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/mod-account-mounts) + +Credits: ConanHun513 diff --git a/.github/workflows/core-build.yml b/.github/workflows/core-build.yml index 750c1d7..a178aed 100644 --- a/.github/workflows/core-build.yml +++ b/.github/workflows/core-build.yml @@ -2,44 +2,10 @@ name: core-build on: push: pull_request: + workflow_dispatch: 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-account-mounts' - - 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/.gitignore b/.gitignore new file mode 100644 index 0000000..c6e1299 --- /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/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index adf09a3..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -CU_SET_PATH("CMAKE_MOD_ACCOUNT_MOUNTS_DIR" "${CMAKE_CURRENT_LIST_DIR}") - -AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/mod_account_mount.cpp") - -AC_ADD_SCRIPT_LOADER("AccountMounts" "${CMAKE_CURRENT_LIST_DIR}/src/loader_account_mount.h") - -AC_ADD_CONFIG_FILE("${CMAKE_CURRENT_LIST_DIR}/conf/mod_account_mount.conf.dist") diff --git a/README.md b/README.md deleted file mode 100644 index 329d160..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore -## mod-account-mounts -- Latest build status with azerothcore: [![Build Status](https://github.com/azerothcore/mod-account-mounts/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/mod-account-mounts) - -Credits: ConanHun513 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/loader_account_mount.cpp b/src/loader_account_mount.cpp new file mode 100644 index 0000000..4eb2680 --- /dev/null +++ b/src/loader_account_mount.cpp @@ -0,0 +1,11 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * +*/ + +void AddAccountMountsScripts(); + +void Addmod_account_mountsScripts() +{ + AddAccountMountsScripts(); +} diff --git a/src/loader_account_mount.h b/src/loader_account_mount.h deleted file mode 100644 index 9a957e5..0000000 --- a/src/loader_account_mount.h +++ /dev/null @@ -1 +0,0 @@ -void AddAccountMountsScripts(); diff --git a/src/mod_account_mount.cpp b/src/mod_account_mount.cpp index 383ada9..039b97a 100644 --- a/src/mod_account_mount.cpp +++ b/src/mod_account_mount.cpp @@ -6,32 +6,33 @@ class AccountMounts : public PlayerScript { static const bool limitrace = false; // This set to true will only learn mounts from chars on the same team, do what you want. + public: AccountMounts() : PlayerScript("AccountMounts") { } void OnLogin(Player* pPlayer) { - if (sConfigMgr->GetBoolDefault("Account.Mounts.Enable", true)) + if (sConfigMgr->GetOption("Account.Mounts.Enable", true)) { - if (sConfigMgr->GetBoolDefault("Account.Mounts.Announce", false)) + if (sConfigMgr->GetOption("Account.Mounts.Announce", false)) { ChatHandler(pPlayer->GetSession()).SendSysMessage("This server is running the |cff4CFF00AccountMounts |rmodule."); } + std::vector Guids; uint32 playerGUID = pPlayer->GetGUID().GetCounter(); - QueryResult result1 = CharacterDatabase.PQuery("SELECT guid, race FROM characters WHERE account = %u", playerGUID); + QueryResult result1 = CharacterDatabase.Query("SELECT `guid`, `race` FROM `characters` WHERE `account`={};", playerGUID); + if (!result1) return; do { Field* fields = result1->Fetch(); - - //uint32 guid = fields[0].GetUInt32(); //unused variable - uint32 race = fields[1].GetUInt8(); + uint32 race = fields[1].Get(); if ((Player::TeamIdForRace(race) == Player::TeamIdForRace(pPlayer->getRace())) || !limitrace) - Guids.push_back(result1->Fetch()[0].GetUInt32()); + Guids.push_back(result1->Fetch()[0].Get()); } while (result1->NextRow()); @@ -39,13 +40,13 @@ public: for (auto& i : Guids) { - QueryResult result2 = CharacterDatabase.PQuery("SELECT spell FROM character_spell WHERE guid = %u", i); + QueryResult result2 = CharacterDatabase.Query("SELECT `spell` FROM `character_spell` WHERE `guid`={};", i); if (!result2) continue; do { - Spells.push_back(result2->Fetch()[0].GetUInt32()); + Spells.push_back(result2->Fetch()[0].Get()); } while (result2->NextRow()); } @@ -53,13 +54,13 @@ public: { auto sSpell = sSpellStore.LookupEntry(i); if (sSpell->Effect[0] == SPELL_EFFECT_APPLY_AURA && sSpell->EffectApplyAuraName[0] == SPELL_AURA_MOUNTED) - pPlayer->learnSpell(sSpell->Id); + pPlayer->learnSpell(sSpell->Id); } } - } + } }; void AddAccountMountsScripts() { - new AccountMounts; + new AccountMounts(); }