Add config option for custom progression

This commit is contained in:
郑佩茹
2022-09-21 15:41:34 -06:00
parent e97afeee40
commit 4a6ad45951
4 changed files with 71 additions and 3 deletions

View File

@@ -268,3 +268,27 @@ IndividualProgression.DeathKnightUnlockProgression = 11
#
IndividualProgression.DeathKnightStartingProgression = 11
#
# IndividualProgression.DisableDefaultProgression
# Description: Disable the regular progression flow, so progression must be advanced through custom creature progression entries
#
# Default: 0 - Disabled
# 1 - Enabled
#
#
IndividualProgression.DisableDefaultProgression = 0
#
# IndividualProgression.CustomProgression
# Description: A list of creature IDs paired to progression states. When a creature on the list is defeated by a player,
# the player will be set to that progression state. Used for custom, non-standard progression.
# Not needed for regular, Blizz-like progress through expansions, which works by default.
# Example: IndividualProgression.CustomProgression="448 6, 639 11"
# This example would allow players access to TBC content for defeating Hogger (entry 448), and Northrend content for defeating VanCleef (entry 639)
# Leave empty to disable (default.)
#
# Default: "" - Disabled (default)
#
#
IndividualProgression.CustomProgression = ""

View File

@@ -208,12 +208,39 @@ uint8 IndividualProgression::GetAccountProgression(uint32 accountId)
return progressionLevel;
}
void IndividualProgression::LoadCustomProgressionEntries(std::string const& customProgressionString)
{
std::string delimitedValue;
std::stringstream customProgressionStream;
customProgressionStream.str(customProgressionString);
while (std::getline(customProgressionStream, delimitedValue, ','))
{
std::string pairOne, pairTwo;
std::stringstream progressionPairStream(delimitedValue);
progressionPairStream>>pairOne>>pairTwo;
uint32 creatureEntryId = atoi(pairOne.c_str());
uint8 progressionValue = atoi(pairTwo.c_str());
sIndividualProgression->customProgressionMap[creatureEntryId] = progressionValue;
}
}
bool IndividualProgression::hasCustomProgressionValue(uint32 creatureEntry)
{
if (customProgressionMap.empty())
{
return false;
}
return (customProgressionMap.find(creatureEntry) != customProgressionMap.end());
}
class IndividualPlayerProgression_WorldScript : public WorldScript
{
private:
static void LoadConfig()
{
sIndividualProgression->customProgressionMap.clear();
sIndividualProgression->enabled = sConfigMgr->GetOption<bool>("IndividualProgression.Enable", true);
sIndividualProgression->vanillaPowerAdjustment = sConfigMgr->GetOption<float>("IndividualProgression.VanillaPowerAdjustment", 1);
sIndividualProgression->vanillaHealingAdjustment = sConfigMgr->GetOption<float>("IndividualProgression.VanillaHealingAdjustment", 1);
@@ -232,9 +259,11 @@ private:
sIndividualProgression->startingProgression = sConfigMgr->GetOption<uint8>("IndividualProgression.StartingProgression", 0);
sIndividualProgression->questMoneyAtLevelCap = sConfigMgr->GetOption<bool>("IndividualProgression.QuestMoneyAtLevelCap", true);
sIndividualProgression->repeatableVanillaQuestsXp = sConfigMgr->GetOption<bool>("IndividualProgression.RepeatableVanillaQuestsXP", true);
sIndividualProgression->disableDefaultProgression = sConfigMgr->GetOption<bool>("IndividualProgression.DisableDefaultProgression", false);
sIndividualProgression->tbcRacesProgressionLevel = sConfigMgr->GetOption<uint8>("IndividualProgression.TbcRacesUnlockProgression", 0);
sIndividualProgression->deathKnightProgressionLevel = sConfigMgr->GetOption<uint8>("IndividualProgression.DeathKnightUnlockProgression", 11);
sIndividualProgression->deathKnightStartingProgression = sConfigMgr->GetOption<uint8>("IndividualProgression.DeathKnightStartingProgression", 11);
sIndividualProgression->LoadCustomProgressionEntries(sConfigMgr->GetOption<std::string>("IndividualProgression.CustomProgression", ""));
}
static void LoadXpValues()

View File

@@ -117,21 +117,24 @@ class IndividualProgression
public:
static IndividualProgression* instance();
std::map<uint32, uint8> customProgressionMap;
questXpMapType questXpMap;
float vanillaPowerAdjustment, vanillaHealthAdjustment, tbcPowerAdjustment, tbcHealthAdjustment, vanillaHealingAdjustment, tbcHealingAdjustment, previousGearTuning;
bool enabled, questXpFix, hunterPetLevelFix, requirePreAQQuests, enforceGroupRules, fishingFix, simpleConfigOverride, questMoneyAtLevelCap, repeatableVanillaQuestsXp;
bool enabled, questXpFix, hunterPetLevelFix, requirePreAQQuests, enforceGroupRules, fishingFix, simpleConfigOverride, questMoneyAtLevelCap, repeatableVanillaQuestsXp, disableDefaultProgression;
int progressionLimit, startingProgression, tbcRacesProgressionLevel, deathKnightProgressionLevel, deathKnightStartingProgression;
bool hasPassedProgression(Player* player, ProgressionState state) const;
static bool isBeforeProgression(Player* player, ProgressionState state) ;
void UpdateProgressionState(Player* player, ProgressionState newState) const;
static void ForceUpdateProgressionState(Player* player, ProgressionState newState) ;
static void ForceUpdateProgressionState(Player* player, ProgressionState newState);
void CheckAdjustments(Player* player) const;
void ApplyGearStatsTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const;
void ApplyGearHealthTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const;
void AdjustVanillaStats(Player* player) const;
void AdjustTBCStats(Player* player) const;
void AdjustWotLKStats(Player* player) const;
bool hasCustomProgressionValue(uint32 creatureEntry);
static void LoadCustomProgressionEntries(const std::string& customProgressionString);
static void AdjustStats(Player* player, float computedAdjustment, float computedHealingAdjustment);
static uint8 GetAccountProgression(uint32 accountId);
};

View File

@@ -209,7 +209,10 @@ public:
switch (quest->GetQuestId())
{
case MIGHT_OF_KALIMDOR:
sIndividualProgression->UpdateProgressionState(player, PROGRESSION_PRE_AQ);
if (!sIndividualProgression->disableDefaultProgression)
{
sIndividualProgression->UpdateProgressionState(player, PROGRESSION_PRE_AQ);
}
break;
case QUEST_MORROWGRAIN:
case QUEST_TROLL_NECKLACE:
@@ -257,6 +260,15 @@ public:
return;
}
if (sIndividualProgression->hasCustomProgressionValue(killed->GetEntry()))
{
sIndividualProgression->UpdateProgressionState(killer, static_cast<ProgressionState>(sIndividualProgression->customProgressionMap[killed->GetEntry()]));
}
if (sIndividualProgression->disableDefaultProgression)
{
return;
}
switch (killed->GetEntry())
{
case RAGNAROS: