From f6624ceb8185e1ba91988073ed6c8749c99a652b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maicol=20Gonz=C3=A1lez?= Date: Sun, 1 Sep 2024 02:08:25 -0300 Subject: [PATCH] added exclude accounts parameter --- conf/individualProgression.conf.dist | 16 ++++++++++++++++ src/IndividualProgression.cpp | 2 ++ src/IndividualProgression.h | 4 +++- src/IndividualProgressionPlayer.cpp | 16 ++++++++++++++-- 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/conf/individualProgression.conf.dist b/conf/individualProgression.conf.dist index 1366994..5eb42bd 100644 --- a/conf/individualProgression.conf.dist +++ b/conf/individualProgression.conf.dist @@ -358,3 +358,19 @@ IndividualProgression.PvPGearRequirements = 1 # 1 - Disabled # IndividualProgression.DisableRDF = 0 +# +# IndividualProgression.ExcludeAccounts +# Description: Enable or disable the exclusion of accounts from Individual Progression. +# This is useful for accounts that are used for bots, testing, or other purposes where progression should not be enforced. +# Default: 0 - Disabled +# 1 - Enabled +# +IndividualProgression.ExcludeAccounts = 0 +# +# IndividualProgression.ExcludedAccountsRegex +# Description: A regular expression to match account names that should be excluded from Individual Progression. +# This is useful for accounts that are used for bots, testing, or other purposes where progression should not be enforced. +# Only used if ExcludeAccounts is enabled. +# Default: "" +# +IndividualProgression.ExcludedAccountsRegex = "" \ No newline at end of file diff --git a/src/IndividualProgression.cpp b/src/IndividualProgression.cpp index 98aef72..826e00f 100644 --- a/src/IndividualProgression.cpp +++ b/src/IndividualProgression.cpp @@ -315,6 +315,8 @@ private: sIndividualProgression->LoadCustomProgressionEntries(sConfigMgr->GetOption("IndividualProgression.CustomProgression", "")); sIndividualProgression->earlyDungeonSet2 = sConfigMgr->GetOption("IndividualProgression.AllowEarlyDungeonSet2", true); sIndividualProgression->pvpGearRequirements = sConfigMgr->GetOption("IndividualProgression.PvPGearRequirements", true); + sIndividualProgression->excludeAccounts = sConfigMgr->GetOption("IndividualProgression.ExcludeAccounts", false); + sIndividualProgression->excludedAccountsRegex = sConfigMgr->GetOption("IndividualProgression.ExcludedAccountsRegex", ""); } static void LoadXpValues() diff --git a/src/IndividualProgression.h b/src/IndividualProgression.h index dc795a5..7362301 100644 --- a/src/IndividualProgression.h +++ b/src/IndividualProgression.h @@ -16,6 +16,7 @@ #include "QuestDef.h" #include "GameObject.h" #include "IWorld.h" +#include typedef std::unordered_map questXpMapType; @@ -180,8 +181,9 @@ public: std::map customProgressionMap; questXpMapType questXpMap; float vanillaPowerAdjustment, vanillaHealthAdjustment, tbcPowerAdjustment, tbcHealthAdjustment, vanillaHealingAdjustment, tbcHealingAdjustment, previousGearTuning; - bool enabled, questXpFix, hunterPetLevelFix, requirePreAQQuests, enforceGroupRules, fishingFix, simpleConfigOverride, questMoneyAtLevelCap, repeatableVanillaQuestsXp, disableDefaultProgression, earlyDungeonSet2, requireNaxxStrath, pvpGearRequirements; + bool enabled, questXpFix, hunterPetLevelFix, requirePreAQQuests, enforceGroupRules, fishingFix, simpleConfigOverride, questMoneyAtLevelCap, repeatableVanillaQuestsXp, disableDefaultProgression, earlyDungeonSet2, requireNaxxStrath, pvpGearRequirements, excludeAccounts; int progressionLimit, startingProgression, tbcRacesProgressionLevel, deathKnightProgressionLevel, deathKnightStartingProgression; + std::string excludedAccountsRegex; bool hasPassedProgression(Player* player, ProgressionState state) const; static bool isBeforeProgression(Player* player, ProgressionState state) ; diff --git a/src/IndividualProgressionPlayer.cpp b/src/IndividualProgressionPlayer.cpp index 69e97e2..a12bb96 100644 --- a/src/IndividualProgressionPlayer.cpp +++ b/src/IndividualProgressionPlayer.cpp @@ -31,10 +31,11 @@ public: void OnSetMaxLevel(Player* player, uint32& maxPlayerLevel) override { - if (!sIndividualProgression->enabled) + if (!sIndividualProgression->enabled || isExcludedFromProgression(player)) { return; } + if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_NAXX40)) { if (sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) > 60) @@ -159,9 +160,20 @@ public: } } + bool isExcludedFromProgression(Player* player) + { + if(!sIndividualProgression->excludeAccounts) { + return false; + } + std::string accountName; + bool gotAccountName = AccountMgr::GetName(player->GetSession()->GetAccountId(), accountName); + std::regex excludedAccountsRegex (sIndividualProgression->excludedAccountsRegex); + return (gotAccountName && std::regex_match(accountName, excludedAccountsRegex)); + } + bool OnBeforeTeleport(Player* player, uint32 mapid, float x, float y, float z, float /*orientation*/, uint32 /*options*/, Unit* /*target*/) override { - if (!sIndividualProgression->enabled || player->IsGameMaster()) + if (!sIndividualProgression->enabled || player->IsGameMaster() || isExcludedFromProgression(player)) { return true; }