Fix IndividualProgression chat commands

This commit is contained in:
郑佩茹
2022-09-17 15:02:46 -06:00
parent a6685b0bcb
commit 770cca9f50
3 changed files with 30 additions and 5 deletions

View File

@@ -18,7 +18,7 @@ bool IndividualProgression::hasPassedProgression(Player* player, ProgressionStat
return player->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value >= state;
}
bool IndividualProgression::isBeforeProgression(Player* player, ProgressionState state) const
bool IndividualProgression::isBeforeProgression(Player* player, ProgressionState state)
{
return player->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value < state;
}
@@ -34,6 +34,11 @@ void IndividualProgression::UpdateProgressionState(Player* player, ProgressionSt
}
}
void IndividualProgression::ForceUpdateProgressionState(Player* player, ProgressionState newState)
{
player->UpdatePlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE, newState);
}
void IndividualProgression::CheckAdjustments(Player* player) const
{
if (!enabled)
@@ -533,6 +538,25 @@ public:
sIndividualProgression->CheckAdjustments(player);
}
// Waiting for PR: https://github.com/azerothcore/azerothcore-wotlk/pull/13046
// void OnSetMaxLevel(Player* player, uint32& maxPlayerLevel) override
// {
// if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_NAXX40))
// {
// if (sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) > 60)
// {
// maxPlayerLevel = 60;
// }
// }
// else if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5))
// {
// if (sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) > 70)
// {
// maxPlayerLevel = 70;
// }
// }
// }
void OnMapChanged(Player* player) override
{
sIndividualProgression->CheckAdjustments(player);

View File

@@ -121,8 +121,9 @@ public:
int progressionLimit, startingProgression;
bool hasPassedProgression(Player* player, ProgressionState state) const;
bool isBeforeProgression(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) ;
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;

View File

@@ -33,10 +33,10 @@ public:
handler->SendSysMessage("Invalid progression level.");
return false;
}
Player* target = player->GetConnectedPlayer();
if (target)
player = PlayerIdentifier::FromTargetOrSelf(handler);
if (player && player->GetConnectedPlayer())
{
sIndividualProgression->UpdateProgressionState(target, static_cast<ProgressionState>(progressionLevel));
sIndividualProgression->ForceUpdateProgressionState(player->GetConnectedPlayer(), static_cast<ProgressionState>(progressionLevel));
handler->SendSysMessage("Progression state updated successfully");
}
return true;