added exclude accounts parameter

This commit is contained in:
Maicol González
2024-09-01 02:08:25 -03:00
parent 65849389e6
commit f6624ceb81
4 changed files with 35 additions and 3 deletions

View File

@@ -358,3 +358,19 @@ IndividualProgression.PvPGearRequirements = 1
# 1 - Disabled # 1 - Disabled
# #
IndividualProgression.DisableRDF = 0 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 = ""

View File

@@ -315,6 +315,8 @@ private:
sIndividualProgression->LoadCustomProgressionEntries(sConfigMgr->GetOption<std::string>("IndividualProgression.CustomProgression", "")); sIndividualProgression->LoadCustomProgressionEntries(sConfigMgr->GetOption<std::string>("IndividualProgression.CustomProgression", ""));
sIndividualProgression->earlyDungeonSet2 = sConfigMgr->GetOption<bool>("IndividualProgression.AllowEarlyDungeonSet2", true); sIndividualProgression->earlyDungeonSet2 = sConfigMgr->GetOption<bool>("IndividualProgression.AllowEarlyDungeonSet2", true);
sIndividualProgression->pvpGearRequirements = sConfigMgr->GetOption<bool>("IndividualProgression.PvPGearRequirements", true); sIndividualProgression->pvpGearRequirements = sConfigMgr->GetOption<bool>("IndividualProgression.PvPGearRequirements", true);
sIndividualProgression->excludeAccounts = sConfigMgr->GetOption<bool>("IndividualProgression.ExcludeAccounts", false);
sIndividualProgression->excludedAccountsRegex = sConfigMgr->GetOption<std::string>("IndividualProgression.ExcludedAccountsRegex", "");
} }
static void LoadXpValues() static void LoadXpValues()

View File

@@ -16,6 +16,7 @@
#include "QuestDef.h" #include "QuestDef.h"
#include "GameObject.h" #include "GameObject.h"
#include "IWorld.h" #include "IWorld.h"
#include <regex>
typedef std::unordered_map<uint32, uint32> questXpMapType; typedef std::unordered_map<uint32, uint32> questXpMapType;
@@ -180,8 +181,9 @@ public:
std::map<uint32, uint8> customProgressionMap; std::map<uint32, uint8> customProgressionMap;
questXpMapType questXpMap; questXpMapType questXpMap;
float vanillaPowerAdjustment, vanillaHealthAdjustment, tbcPowerAdjustment, tbcHealthAdjustment, vanillaHealingAdjustment, tbcHealingAdjustment, previousGearTuning; 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; int progressionLimit, startingProgression, tbcRacesProgressionLevel, deathKnightProgressionLevel, deathKnightStartingProgression;
std::string excludedAccountsRegex;
bool hasPassedProgression(Player* player, ProgressionState state) const; bool hasPassedProgression(Player* player, ProgressionState state) const;
static bool isBeforeProgression(Player* player, ProgressionState state) ; static bool isBeforeProgression(Player* player, ProgressionState state) ;

View File

@@ -31,10 +31,11 @@ public:
void OnSetMaxLevel(Player* player, uint32& maxPlayerLevel) override void OnSetMaxLevel(Player* player, uint32& maxPlayerLevel) override
{ {
if (!sIndividualProgression->enabled) if (!sIndividualProgression->enabled || isExcludedFromProgression(player))
{ {
return; return;
} }
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_NAXX40)) if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_NAXX40))
{ {
if (sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) > 60) 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 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; return true;
} }