Remove Previous Gear Tuning (#797)

- removed the custom setting PreviousGearTuning
- removed computedHealingAdjustment
- removed checkIPProgression(player) on PlayerMapChanged
- excluded accounts now also get adjustment checks on login.
- now using an aura for HP adjustments
This commit is contained in:
Grimfeather
2025-10-09 19:34:31 +02:00
committed by GitHub
parent 2369c4ec1a
commit b3d5a4c281
4 changed files with 66 additions and 186 deletions

View File

@@ -103,18 +103,6 @@ IndividualProgression.TBCHealthAdjustment = 1
#
IndividualProgression.QuestXPFix = 1
# IndividualProgression.PreviousGearTuning
#
# Description: Reduces the power of previous expansion end-game gear when entering the next expansion for leveling.
# This resolves a balancing problem where players would not get any useful gear until near the end of the leveling experience,
# as well as overpowering the leveling content. This is particularly true in TBC leveling due to the strength of Naxx 40 gear.
# Set to 0 (0% adjustment) to disable
#
# Default: 0 - Disabled
# 0.01 - 1% reduced health and damage per previous expansion epic
#
IndividualProgression.PreviousGearTuning = 0
# IndividualProgression.RequireNaxxStrathEntrance
#
# Description: If enabled, this will require players to first enter Naxx 40 through the original beta entrance in the back of Stratholme,

View File

@@ -14,7 +14,10 @@ IndividualProgression* IndividualProgression::instance()
bool IndividualProgression::hasPassedProgression(Player* player, ProgressionState state) const
{
if (progressionLimit && state >= progressionLimit)
{
return false;
}
return player->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value >= state;
}
@@ -26,7 +29,10 @@ bool IndividualProgression::isBeforeProgression(Player* player, ProgressionState
void IndividualProgression::UpdateProgressionState(Player* player, ProgressionState newState) const
{
if (progressionLimit && newState > progressionLimit)
{
return;
}
uint8 currentState = player->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value;
if (newState > currentState)
{
@@ -42,115 +48,47 @@ void IndividualProgression::ForceUpdateProgressionState(Player* player, Progress
void IndividualProgression::CheckAdjustments(Player* player) const
{
if (!enabled)
{
{
return;
}
if (!hasPassedProgression(player, PROGRESSION_NAXX40) || (!hasPassedProgression(player, PROGRESSION_NAXX40) && (player->GetLevel() <= IP_LEVEL_VANILLA)))
}
if (!hasPassedProgression(player, PROGRESSION_PRE_TBC) || (!hasPassedProgression(player, PROGRESSION_PRE_TBC) && (player->GetLevel() <= IP_LEVEL_VANILLA)))
{
AdjustVanillaStats(player);
float adjustmentApplyPercent = (player->GetLevel() - 10.0f) / 50.0f;
float PowerAdjustmentValue = -100.0f * (1.0f - vanillaPowerAdjustment);
float computedPowerAdjustment = player->GetLevel() > 10 ? (PowerAdjustmentValue * adjustmentApplyPercent) : 0;
float HealthAdjustmentAmount = -100.0f * (1.0f - vanillaHealthAdjustment);
float computedHealthAdjustment = player->GetLevel() > 10 ? (HealthAdjustmentAmount * adjustmentApplyPercent) : 0;
AdjustStats(player, computedPowerAdjustment, computedHealthAdjustment);
}
else if (!hasPassedProgression(player, PROGRESSION_TBC_TIER_5) || (!hasPassedProgression(player, PROGRESSION_TBC_TIER_5) && (player->GetLevel() <= IP_LEVEL_TBC)))
{
AdjustTBCStats(player);
}
else
{
AdjustWotLKStats(player);
float computedPowerAdjustment = -100.0f * (1.0f - tbcPowerAdjustment);
AdjustStats(player, computedPowerAdjustment, tbcHealthAdjustment);
}
if (player->getClass() == CLASS_HUNTER)
{
// Remove the 15% built-in ranged haste that was added to hunters in WotLK
// This lets us add haste spells back to quivers
// Remove the 15% built-in ranged haste that was added to hunters in WotLK - This lets us add haste spells back to quivers
player->RemoveAura(RANGED_HASTE_SPELL);
player->CastSpell(player, RANGED_HASTE_SPELL, false);
}
}
void IndividualProgression::CheckHPAdjustments(Player* player) const
void IndividualProgression::AdjustStats(Player* player, float computedPowerAdjustment, float computedHealthAdjustment)
{
if (!enabled)
{
return;
}
player->SetMaxHealth(player->GetMaxHealth()); // just to trigger OnPlayerAfterUpdateMaxHealth
}
void IndividualProgression::ApplyGearStatsTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const
{
if (item->Quality != ITEM_QUALITY_EPIC) // Non-endgame gear is okay
return;
if ((hasPassedProgression(player, PROGRESSION_NAXX40) && (item->RequiredLevel <= IP_LEVEL_VANILLA)) ||
(hasPassedProgression(player, PROGRESSION_TBC_TIER_5) && (item->RequiredLevel <= IP_LEVEL_TBC)))
{
computedAdjustment -= (100.0f * previousGearTuning);
}
}
void IndividualProgression::ComputeGearTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const
{
if (item->Quality != ITEM_QUALITY_EPIC) // Non-endgame gear is okay
return;
if ((hasPassedProgression(player, PROGRESSION_NAXX40) && (item->RequiredLevel <= IP_LEVEL_VANILLA)) ||
(hasPassedProgression(player, PROGRESSION_TBC_TIER_5) && (item->RequiredLevel <= IP_LEVEL_TBC)))
{
computedAdjustment += previousGearTuning;
}
}
void IndividualProgression::AdjustVanillaStats(Player* player) const
{
float adjustmentValue = -100.0f * (1.0f - vanillaPowerAdjustment);
float adjustmentApplyPercent = (player->GetLevel() - 10.0f) / 50.0f;
float computedAdjustment = player->GetLevel() > 10 ? (adjustmentValue * adjustmentApplyPercent) : 0;
float adjustmentHealingValue = -100.0f * (1.0f - vanillaHealingAdjustment);
float adjustmentHealingApplyPercent = (player->GetLevel() - 10.0f) / 50.0f;
float computedHealingAdjustment = player->GetLevel() > 10 ? (adjustmentHealingValue * adjustmentHealingApplyPercent) : 0;
AdjustStats(player, computedAdjustment, computedHealingAdjustment);
}
void IndividualProgression::AdjustTBCStats(Player* player) const
{
float adjustmentValue = -100.0f * (1.0f - tbcPowerAdjustment);
float adjustmentApplyPercent = 1;
float computedAdjustment = player->GetLevel() > 10 ? (adjustmentValue * adjustmentApplyPercent) : 0;
float adjustmentHealingValue = -100.0f * (1.0f - tbcHealingAdjustment);
float adjustmentHealingApplyPercent = 1;
float computedHealingAdjustment = player->GetLevel() > 10 ? (adjustmentHealingValue * adjustmentHealingApplyPercent) : 0;
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{
if (Item *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
{
ApplyGearStatsTuning(player, computedAdjustment, item->GetTemplate());
ApplyGearStatsTuning(player, computedHealingAdjustment, item->GetTemplate());
}
}
AdjustStats(player, computedAdjustment, computedHealingAdjustment);
}
void IndividualProgression::AdjustWotLKStats(Player* player) const
{
float computedAdjustment = 0;
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{
if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
ApplyGearStatsTuning(player, computedAdjustment, item->GetTemplate());
}
AdjustStats(player, computedAdjustment, computedAdjustment);
}
void IndividualProgression::AdjustStats(Player* player, float computedAdjustment, float /*computedHealingAdjustment*/)
{
// int32 bp0 = 0; // This would be the damage taken adjustment value, but we are already adjusting health
auto bp1 = static_cast<int32>(computedAdjustment);
// auto bp1Healing = static_cast<int32>(computedHealingAdjustment);
auto bp1 = static_cast<int32>(computedPowerAdjustment);
auto bp2 = static_cast<int32>(computedHealthAdjustment);
player->RemoveAura(ABSORB_SPELL);
player->CastCustomSpell(player, ABSORB_SPELL, &bp1, nullptr, nullptr, false);
player->RemoveAura(HP_AURA_SPELL);
player->CastCustomSpell(player, HP_AURA_SPELL, &bp2, nullptr, nullptr, false);
}
float IndividualProgression::ComputeVanillaAdjustment(uint8 playerLevel, float configAdjustmentValue)
@@ -170,8 +108,7 @@ uint8 IndividualProgression::GetAccountProgression(uint32 accountId)
uint8 progressionLevel = 0;
if (!sWorld->getBoolConfig(CONFIG_PLAYER_SETTINGS_ENABLED))
{
// Prevent crash if player settings are not enabled
return 0;
return 0; // Prevent crash if player settings are not enabled
}
QueryResult result = CharacterDatabase.Query("SELECT `data` FROM `character_settings` WHERE `source` = 'mod-individual-progression' AND `guid` IN (SELECT `guid` FROM `characters` WHERE `account` = {});", accountId);
if (result)
@@ -423,7 +360,6 @@ private:
sIndividualProgression->enforceGroupRules = sConfigMgr->GetOption<bool>("IndividualProgression.EnforceGroupRules", true);
sIndividualProgression->fishingFix = sConfigMgr->GetOption<bool>("IndividualProgression.FishingFix", true);
sIndividualProgression->simpleConfigOverride = sConfigMgr->GetOption<bool>("IndividualProgression.SimpleConfigOverride", true);
sIndividualProgression->previousGearTuning = sConfigMgr->GetOption<float>("IndividualProgression.PreviousGearTuning", 0);
sIndividualProgression->progressionLimit = sConfigMgr->GetOption<uint8>("IndividualProgression.ProgressionLimit", 0);
sIndividualProgression->startingProgression = sConfigMgr->GetOption<uint8>("IndividualProgression.StartingProgression", 0);
sIndividualProgression->questMoneyAtLevelCap = sConfigMgr->GetOption<bool>("IndividualProgression.QuestMoneyAtLevelCap", true);

View File

@@ -250,7 +250,7 @@ public:
std::map<uint32, uint8> customProgressionMap;
questXpMapType questXpMap;
float vanillaPowerAdjustment, vanillaHealthAdjustment, tbcPowerAdjustment, tbcHealthAdjustment, vanillaHealingAdjustment, tbcHealingAdjustment, previousGearTuning;
float vanillaPowerAdjustment, vanillaHealthAdjustment, tbcPowerAdjustment, tbcHealthAdjustment, vanillaHealingAdjustment, tbcHealingAdjustment;
bool enabled, questXpFix, hunterPetLevelFix, enforceGroupRules, fishingFix, simpleConfigOverride, questMoneyAtLevelCap, repeatableVanillaQuestsXp, disableDefaultProgression, earlyDungeonSet2, requireNaxxStrath, pvpGearRequirements, DisableRDF, excludeAccounts;
int progressionLimit, startingProgression, tbcRacesProgressionLevel, deathKnightProgressionLevel, deathKnightStartingProgression;
std::string excludedAccountsRegex;
@@ -260,9 +260,7 @@ public:
void UpdateProgressionState(Player* player, ProgressionState newState) const;
static void ForceUpdateProgressionState(Player* player, ProgressionState newState);
void CheckAdjustments(Player* player) const;
void CheckHPAdjustments(Player* player) const;
void ApplyGearStatsTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const;
void ComputeGearTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const;
void AdjustVanillaStats(Player* player) const;
void AdjustTBCStats(Player* player) const;
void AdjustWotLKStats(Player* player) const;
@@ -271,7 +269,7 @@ public:
void UpdateProgressionQuests(Player* player);
void checkKillProgression(Player* player, Creature* killed);
static void LoadCustomProgressionEntries(const std::string& customProgressionString);
static void AdjustStats(Player* player, float computedAdjustment, float computedHealingAdjustment);
static void AdjustStats(Player* player, float computedPowerAdjustment, float computedHealthAdjustment);
static float ComputeVanillaAdjustment(uint8 playerLevel, float configAdjustmentValue);
static uint8 GetAccountProgression(uint32 accountId);
};

View File

@@ -19,24 +19,27 @@ public:
void OnPlayerLogin(Player* player) override
{
if (!sIndividualProgression->enabled || isExcludedFromProgression(player))
if (!sIndividualProgression->enabled)
{
return;
}
if (player->getClass() == CLASS_DEATH_KNIGHT && sIndividualProgression->deathKnightStartingProgression && !sIndividualProgression->hasPassedProgression(player, static_cast<ProgressionState>(sIndividualProgression->deathKnightStartingProgression)))
if (!isExcludedFromProgression(player))
{
sIndividualProgression->UpdateProgressionState(player, static_cast<ProgressionState>(sIndividualProgression->deathKnightStartingProgression));
}
if (sIndividualProgression->startingProgression && !sIndividualProgression->hasPassedProgression(player, static_cast<ProgressionState>(sIndividualProgression->startingProgression)))
{
sIndividualProgression->UpdateProgressionState(player, static_cast<ProgressionState>(sIndividualProgression->startingProgression));
}
if (player->getClass() == CLASS_DEATH_KNIGHT && sIndividualProgression->deathKnightStartingProgression && !sIndividualProgression->hasPassedProgression(player, static_cast<ProgressionState>(sIndividualProgression->deathKnightStartingProgression)))
{
sIndividualProgression->UpdateProgressionState(player, static_cast<ProgressionState>(sIndividualProgression->deathKnightStartingProgression));
}
if (sIndividualProgression->startingProgression && !sIndividualProgression->hasPassedProgression(player, static_cast<ProgressionState>(sIndividualProgression->startingProgression)))
{
sIndividualProgression->UpdateProgressionState(player, static_cast<ProgressionState>(sIndividualProgression->startingProgression));
}
sIndividualProgression->checkIPProgression(player);
sIndividualProgression->UpdateProgressionQuests(player);
}
sIndividualProgression->CheckAdjustments(player);
sIndividualProgression->CheckHPAdjustments(player);
sIndividualProgression->checkIPProgression(player);
sIndividualProgression->UpdateProgressionQuests(player);
if (sIndividualProgression->enabled)
{
@@ -70,7 +73,6 @@ public:
void OnPlayerMapChanged(Player* player) override
{
sIndividualProgression->CheckAdjustments(player);
sIndividualProgression->checkIPProgression(player);
}
void OnPlayerLevelChanged(Player* player, uint8 /*oldLevel*/) override
@@ -94,47 +96,13 @@ public:
{
return false;
}
// Player is still in Vanilla content - give money at 60 level cap
return ((!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) && player->GetLevel() == IP_LEVEL_VANILLA) ||
// Player is in TBC content - give money at 70 level cap
(!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5) && player->GetLevel() == IP_LEVEL_TBC));
}
void OnPlayerAfterUpdateMaxHealth(Player* player, float& value) override
{
// TODO: This should be adjust to use an aura like damage adjustment. This is more robust to update when changing equipment, etc.
if (!sIndividualProgression->enabled)
{
return;
}
float gearAdjustment = 0.0;
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{
if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
sIndividualProgression->ComputeGearTuning(player, gearAdjustment, item->GetTemplate());
}
// Player is still in Vanilla content - give Vanilla health adjustment
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) || (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) && (player->GetLevel() <= IP_LEVEL_VANILLA)))
{
float adjustmentAmount = 1.0f - sIndividualProgression->vanillaHealthAdjustment;
float applyPercent = ((player->GetLevel() - 10.0f) / 50.0f);
float computedAdjustment = player->GetLevel() > 10 ? 1.0f - applyPercent * adjustmentAmount : 1.0f;
value *= computedAdjustment;
}
// Player is in TBC content - give TBC health adjustment
else if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5) || (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5) && (player->GetLevel() <= IP_LEVEL_TBC)))
{
value *= (sIndividualProgression->tbcHealthAdjustment - gearAdjustment);
}
// Player is in WotLK content - only need to check gear adjustment
else
{
value *= 1 - gearAdjustment;
}
}
void OnPlayerQuestComputeXP(Player* player, Quest const* quest, uint32& xpValue) override
{
if (!sIndividualProgression->enabled || !sIndividualProgression->questXpFix || isExcludedFromProgression(player))
@@ -1266,17 +1234,6 @@ public:
class IndividualPlayerProgression_UnitScript : public UnitScript
{
private:
static float computeTotalGearTuning(Player* player)
{
float gearAdjustment = 0.0;
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{
if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
sIndividualProgression->ComputeGearTuning(player, gearAdjustment, item->GetTemplate());
}
return gearAdjustment;
}
public:
IndividualPlayerProgression_UnitScript() : UnitScript("IndividualPlayerProgression_UnitScript") { }
@@ -1311,18 +1268,18 @@ public:
return;
}
Player* player = isPet ? healer->GetOwner()->ToPlayer() : healer->ToPlayer();
float gearAdjustment = computeTotalGearTuning(player);
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) || (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) && (player->GetLevel() <= IP_LEVEL_VANILLA)))
{
heal *= (sIndividualProgression->ComputeVanillaAdjustment(player->GetLevel(), sIndividualProgression->vanillaHealingAdjustment) - gearAdjustment);
heal *= sIndividualProgression->ComputeVanillaAdjustment(player->GetLevel(), sIndividualProgression->vanillaHealingAdjustment);
}
else if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5) || (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5) && (player->GetLevel() <= IP_LEVEL_TBC)))
{
heal *= (sIndividualProgression->tbcHealingAdjustment - gearAdjustment);
heal *= sIndividualProgression->tbcHealingAdjustment;
}
else
{
heal *= 1.0f - gearAdjustment;
return;
}
}
@@ -1330,24 +1287,25 @@ public:
{
if (!sIndividualProgression->enabled || !attacker)
return;
bool isPet = attacker->GetOwner() && attacker->GetOwner()->GetTypeId() == TYPEID_PLAYER;
if (!isPet && attacker->GetTypeId() != TYPEID_PLAYER)
{
return;
}
Player* player = isPet ? attacker->GetOwner()->ToPlayer() : attacker->ToPlayer();
float gearAdjustment = computeTotalGearTuning(player);
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) || (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) && (player->GetLevel() <= IP_LEVEL_VANILLA)))
{
damage *= (sIndividualProgression->ComputeVanillaAdjustment(player->GetLevel(), sIndividualProgression->vanillaPowerAdjustment) - gearAdjustment);
damage *= sIndividualProgression->ComputeVanillaAdjustment(player->GetLevel(), sIndividualProgression->vanillaPowerAdjustment);
}
else if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5) || (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5) && (player->GetLevel() <= IP_LEVEL_TBC)))
{
damage *= (sIndividualProgression->tbcPowerAdjustment - gearAdjustment);
damage *= sIndividualProgression->tbcPowerAdjustment;
}
else
{
damage *= 1.0f - gearAdjustment;
return;
}
}
@@ -1362,18 +1320,18 @@ public:
return;
}
Player* player = isPet ? attacker->GetOwner()->ToPlayer() : attacker->ToPlayer();
float gearAdjustment = computeTotalGearTuning(player);
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) || (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) && (player->GetLevel() <= IP_LEVEL_VANILLA)))
{
damage *= (sIndividualProgression->ComputeVanillaAdjustment(player->GetLevel(), sIndividualProgression->vanillaPowerAdjustment) - gearAdjustment);
damage *= sIndividualProgression->ComputeVanillaAdjustment(player->GetLevel(), sIndividualProgression->vanillaPowerAdjustment);
}
else if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5) || (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5) && (player->GetLevel() <= IP_LEVEL_TBC)))
{
damage *= (sIndividualProgression->tbcPowerAdjustment - gearAdjustment);
damage *= sIndividualProgression->tbcPowerAdjustment;
}
else
{
damage *= 1.0f - gearAdjustment;
return;
}
}
@@ -1397,18 +1355,18 @@ public:
return;
}
Player* player = isPet ? attacker->GetOwner()->ToPlayer() : attacker->ToPlayer();
float gearAdjustment = computeTotalGearTuning(player);
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) || (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) && (player->GetLevel() <= IP_LEVEL_VANILLA)))
{
damage *= (sIndividualProgression->ComputeVanillaAdjustment(player->GetLevel(), sIndividualProgression->vanillaPowerAdjustment) - gearAdjustment);
damage *= sIndividualProgression->ComputeVanillaAdjustment(player->GetLevel(), sIndividualProgression->vanillaPowerAdjustment);
}
else if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5) || (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5) && (player->GetLevel() <= IP_LEVEL_TBC)))
{
damage *= (sIndividualProgression->tbcPowerAdjustment - gearAdjustment);
damage *= sIndividualProgression->tbcPowerAdjustment;
}
else
{
damage *= 1.0f - gearAdjustment;
return;
}
}