From 82284d6d6aa222c9b47b2151eab5fed74f2e3ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E4=BD=A9=E8=8C=B9?= Date: Mon, 7 Mar 2022 16:17:21 -0700 Subject: [PATCH] Initial commit. --- .editorconfig | 8 ++ .gitattributes | 105 +++++++++++++++++++++++++++ .github/workflows/core-build.yml | 49 +++++++++++++ .gitignore | 48 ++++++++++++ LICENSE | 21 ++++++ conf/conf.sh.dist | 32 ++++++++ conf/individualProgression.conf.dist | 61 ++++++++++++++++ include.sh | 10 +++ sql/auth/updates/.gitkeep | 0 sql/characters/updates/.gitkeep | 0 sql/world/updates/.gitkeep | 0 src/IndividualProgression.cpp | 93 ++++++++++++++++++++++++ src/IndividualProgression.h | 35 +++++++++ src/IndividualProgression_loader.cpp | 12 +++ 14 files changed, 474 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .github/workflows/core-build.yml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 conf/conf.sh.dist create mode 100644 conf/individualProgression.conf.dist create mode 100644 include.sh create mode 100644 sql/auth/updates/.gitkeep create mode 100644 sql/characters/updates/.gitkeep create mode 100644 sql/world/updates/.gitkeep create mode 100644 src/IndividualProgression.cpp create mode 100644 src/IndividualProgression.h create mode 100644 src/IndividualProgression_loader.cpp 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..7ef9001 --- /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 0000000..f66f694 --- /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 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/LICENSE b/LICENSE new file mode 100644 index 0000000..9031171 --- /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/conf/conf.sh.dist b/conf/conf.sh.dist new file mode 100644 index 0000000..0e78e8a --- /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/individualProgression.conf.dist b/conf/individualProgression.conf.dist new file mode 100644 index 0000000..afd69f2 --- /dev/null +++ b/conf/individualProgression.conf.dist @@ -0,0 +1,61 @@ +# +# Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 +# + +[worldserver] + +######################################## +# Individual Progression Configuration +######################################## +# +# IndividualProgression.Enable +# Description: Enable Individual Progression Module +# Default: 0 - Disabled +# 1 - Enabled +# + +IndividualProgression.Enable = 1 +# +# +# IndividualProgression.VanillaPowerAdjustment +# Description: Adjustment to player's attack power before completing Vanilla content +# This is meant to provide a more accurate Vanilla feeling in Vanilla content +# Applied linearly per level between levels 20 and 60 +# Set to 1 (100% of regular damage) to disable +# +# Default: 0.6 - 60% of regular damage +# +IndividualProgression.VanillaPowerAdjustment = 0.6 +# +# +# IndividualProgression.VanillaHealthAdjustmnet +# Description: Adjustment to player's max HP before completing Vanilla content +# This is meant to provide a more accurate Vanilla feeling in Vanilla content +# Applied linearly per level between levels 20 and 60 +# Set to 1 (100% of regular health) to disable +# +# Default: 0.5 - 50% of regular health +# +IndividualProgression.VanillaHealthAdjustment = 0.5 +# +# +# IndividualProgression.TBCPowerAdjustment +# Description: Adjustment to player's attack power before completing TBC content +# This is meant to provide a more accurate TBC feeling in TBC content +# Unlike Vanilla adjustment, a flat value is always used +# Set to 1 (100% of regular damage) to disable +# +# Default: 0.8 - 80% of regular damage +# +IndividualProgression.TBCPowerAdjustment = 0.8 +# +# +# IndividualProgression.TBCHealthAdjustment +# Description: Adjustment to player's max HP before completing TBC content +# This is meant to provide a more accurate TBC feeling in TBC content +# Unlike Vanilla adjustment, a flat value is always used +# Set to 1 (100% of regular health) to disable +# +# Default: 0.7 - 70% of regular health +# +IndividualProgression.VanillaHealthAdjustment = 0.7 diff --git a/include.sh b/include.sh new file mode 100644 index 0000000..a241572 --- /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/sql/auth/updates/.gitkeep b/sql/auth/updates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/sql/characters/updates/.gitkeep b/sql/characters/updates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/sql/world/updates/.gitkeep b/sql/world/updates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/IndividualProgression.cpp b/src/IndividualProgression.cpp new file mode 100644 index 0000000..072054d --- /dev/null +++ b/src/IndividualProgression.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + */ + +#include "IndividualProgression.h" + +static float vanillaPowerAdjustment, vanillaHealthAdjustment, tbcPowerAdjustment, tbcHealthAdjustment; +static bool enabled; + +class IndividualPlayerProgression_WorldScript : public WorldScript +{ +private: + void LoadConfig() + { + enabled = sConfigMgr->GetOption("IndividualProgression.Enabled", true); + vanillaPowerAdjustment = sConfigMgr->GetOption("IndividualProgression.VanillaPowerAdjustment", 1); + vanillaHealthAdjustment = sConfigMgr->GetOption("IndividualProgression.VanillaHealthAdjustment", 1); + tbcPowerAdjustment = sConfigMgr->GetOption("IndividualProgression.TBCPowerAdjustment", 1); + tbcHealthAdjustment = sConfigMgr->GetOption("IndividualProgression.TBCHealthAdjustment", 1); + } + +public: + IndividualPlayerProgression_WorldScript() : WorldScript("IndividualPowerProgression_WorldScript") { } + + void OnBeforeConfigLoad(bool /*reload*/) override + { + LoadConfig(); + } +}; +// Add player scripts +class IndividualPlayerProgression : public PlayerScript +{ +private: + void hasPassedProgression(Player* player, ProgressionState state) + { + return player->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE) >= state; + } + void UpdateProgressionState(Player* player, ProgressionState newState) + { + uint8 currentState = player->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE); + if (newState > currentState) + { + player->UpdatePlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE, newState); + } + } + +public: + IndividualPlayerProgression() : PlayerScript("IndividualProgression") { } + + void OnAfterUpdateAttackPowerAndDamage(Player* player, float& /*level*/, float& base_attPower, float& attPowerMod, float& attPowerMultiplier, bool /*ranged*/) override + { + if (!enabled) + { + return; + } + // Player is still in Vanilla content - give Vanilla damage adjustment + if (!hasPassedProgression(player, PROGRESSION_NAXX40)) + { + base_attPower *= vanillaPowerAdjustment; + } + // Player is in TBC content - give TBC damage adjustment + else if (!hasPassedProgression(player, PROGRESSION_TBC_TIER_5)) + { + base_attPower *= tbcPowerAdjustment; + } + } + + void OnAfterUpdateMaxHealth(Player* player, float& value) override + { + if (!enabled) + { + return; + } + // Player is still in Vanilla content - give Vanilla damage adjustment + if (!hasPassedProgression(player, PROGRESSION_NAXX40)) + { + value *= vanillaHealthAdjustment; + } + // Player is in TBC content - give TBC damage adjustment + else if (!hasPassedProgression(player, PROGRESSION_TBC_TIER_5)) + { + value *= tbcHealthAdjustment; + } + } + + +}; + +// Add all scripts in one +void AddSC_mod_individual_progression() +{ + new IndividualPlayerProgression(); +} diff --git a/src/IndividualProgression.h b/src/IndividualProgression.h new file mode 100644 index 0000000..927a364 --- /dev/null +++ b/src/IndividualProgression.h @@ -0,0 +1,35 @@ +#ifndef AZEROTHCORE_INDIVIDUALPROGRESSION_H +#define AZEROTHCORE_INDIVIDUALPROGRESSION_H + +#include "ScriptMgr.h" +#include "Player.h" +#include "Config.h" +#include "Chat.h" + +enum ProgressionSettings +{ + SETTING_PROGRESSION_STATE = 0 +}; + +enum ProgressionState : uint8 +{ + PROGRESSION_START = 0, + PROGRESSION_MOLTEN_CORE = 1, + PROGRESSION_ONYXIA = 2, + PROGRESSION_BLACKWING_LAIR = 3, + PROGRESSION_PRE_AQ = 4, + PROGRESSION_AQ = 5, + PROGRESSION_NAXX40 = 6, + PROGRESSION_TBC_TIER_1 = 7, // Karazhan, Gruul's Lair, Magtheridon's Lair + PROGRESSION_TBC_TIER_2 = 8, // Serpentshrine Cavern, Tempest Keep + PROGRESSION_TBC_TIER_3 = 9, // Hyjal Summit and Black Temple + PROGRESSION_TBC_TIER_4 = 10, // Zul'Aman + PROGRESSION_TBC_TIER_5 = 11, // Sunwell Plateau + PROGRESSION_WOTLK_TIER_1 = 12, // WotLK Naxx, EoE, OS + PROGRESSION_WOTLK_TIER_2 = 13, // Ulduar + PROGRESSION_WOTLK_TIER_3 = 14, // TotC + PROGRESSION_WOTLK_TIER_4 = 15, // ICC + PROGRESSION_WOTLK_TIER_5 = 16 // Ruby Sanctum +}; + +#endif //AZEROTHCORE_INDIVIDUALPROGRESSION_H diff --git a/src/IndividualProgression_loader.cpp b/src/IndividualProgression_loader.cpp new file mode 100644 index 0000000..df9aa95 --- /dev/null +++ b/src/IndividualProgression_loader.cpp @@ -0,0 +1,12 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + */ + +// From SC +void AddSC_mod_individual_progression(); + +void Addmod_individual_progressionScripts() +{ + AddSC_mod_individual_progression(); +} +