Code Cleaning - Error Messages - Progression Level Fixes (#820)

- removing some duplicate code
- adding some error messages
- removing achievements if player decides to go down in progression level.
- on login your progression level will no longer go down, if it's currently higher than the highest kill achievement you got
This commit is contained in:
Grimfeather
2025-10-22 00:57:51 +02:00
committed by GitHub
parent 0476f9c99a
commit 9c0f909b02
6 changed files with 196 additions and 112 deletions

View File

@@ -24,7 +24,7 @@ public:
return;
}
if (!isExcludedFromProgression(player))
if (!sIndividualProgression->isExcludedFromProgression(player))
{
if (player->getClass() == CLASS_DEATH_KNIGHT && sIndividualProgression->deathKnightStartingProgression && !sIndividualProgression->hasPassedProgression(player, static_cast<ProgressionState>(sIndividualProgression->deathKnightStartingProgression)))
{
@@ -40,9 +40,9 @@ public:
}
if (isExcludedFromProgression(player))
if (sIndividualProgression->isExcludedFromProgression(player))
{
sIndividualProgression->UpdateProgressionState(player, static_cast<ProgressionState>(0));
sIndividualProgression->UpdateProgressionState(player, static_cast<ProgressionState>(0));
}
sIndividualProgression->CheckAdjustments(player);
@@ -55,7 +55,7 @@ public:
void OnPlayerSetMaxLevel(Player* player, uint32& maxPlayerLevel) override
{
if (!sIndividualProgression->enabled || isExcludedFromProgression(player))
if (!sIndividualProgression->enabled || sIndividualProgression->isExcludedFromProgression(player))
{
return;
}
@@ -111,7 +111,7 @@ public:
void OnPlayerQuestComputeXP(Player* player, Quest const* quest, uint32& xpValue) override
{
if (!sIndividualProgression->enabled || !sIndividualProgression->questXpFix || isExcludedFromProgression(player))
if (!sIndividualProgression->enabled || !sIndividualProgression->questXpFix || sIndividualProgression->isExcludedFromProgression(player))
{
return;
}
@@ -128,7 +128,7 @@ public:
void OnPlayerGiveXP(Player* player, uint32& amount, Unit* /*victim*/, uint8 xpSource) override
{
if (!sIndividualProgression->enabled || isExcludedFromProgression(player))
if (!sIndividualProgression->enabled || sIndividualProgression->isExcludedFromProgression(player))
{
return;
}
@@ -152,17 +152,6 @@ public:
}
}
bool isExcludedFromProgression(Player* player)
{
if(!sIndividualProgression->excludeAccounts) {
return false;
}
std::string accountName;
bool accountNameFound = AccountMgr::GetName(player->GetSession()->GetAccountId(), accountName);
std::regex excludedAccountsRegex (sIndividualProgression->excludedAccountsRegex);
return (accountNameFound && std::regex_match(accountName, excludedAccountsRegex));
}
static bool isAttuned(Player* player)
{
if ((player->GetQuestStatus(NAXX40_ATTUNEMENT_1) == QUEST_STATUS_REWARDED) ||
@@ -179,28 +168,28 @@ public:
bool OnPlayerBeforeTeleport(Player* player, uint32 mapid, float x, float y, float z, float /*orientation*/, uint32 /*options*/, Unit* /*target*/) override
{
if (!sIndividualProgression->enabled || player->IsGameMaster() || isExcludedFromProgression(player))
if (!sIndividualProgression->enabled || player->IsGameMaster() || sIndividualProgression->isExcludedFromProgression(player))
{
return true;
}
if (mapid == MAP_ONYXIAS_LAIR && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5) && !player->HasItemCount(ITEM_DRAKEFIRE_AMULET))
{
return false;
}
}
if (mapid == MAP_BLACKWING_LAIR && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_MOLTEN_CORE))
{
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_MOLTEN_CORE);
return false;
}
if (mapid == MAP_ZUL_GURUB && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_BLACKWING_LAIR))
{
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_BLACKWING_LAIR);
return false;
}
if (mapid == MAP_AHN_QIRAJ_TEMPLE && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_AQ))
{
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_PRE_AQ);
return false;
}
if (mapid == MAP_RUINS_OF_AHN_QIRAJ && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_AQ))
{
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_PRE_AQ);
return false;
}
if (mapid == MAP_OUTLAND)
@@ -214,31 +203,39 @@ public:
uint32 zoneId = map->GetZoneId(0, x, y, z);
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_4) && zoneId == ZONE_QUELDANAS)
{
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_TBC_TIER_4);
return false;
}
}
if (mapid == MAP_ZUL_AMAN && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_3))
{
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_TBC_TIER_3);
return false;
}
if (mapid == MAP_NORTHREND && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5))
{
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_TBC_TIER_5);
return false;
}
if (mapid == MAP_ULDUAR && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_WOTLK_TIER_1))
{
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_WOTLK_TIER_1);
return false;
}
if ((mapid == MAP_TRIAL_OF_THE_CHAMPION || mapid == MAP_TRIAL_OF_THE_CRUSADER) && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_WOTLK_TIER_2)){
if ((mapid == MAP_TRIAL_OF_THE_CHAMPION || mapid == MAP_TRIAL_OF_THE_CRUSADER) && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_WOTLK_TIER_2))
{
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_WOTLK_TIER_2);
return false;
}
// This will also restrict other Frozen Halls dungeons, because Forge of Souls must be completed first to access them
if ((mapid == MAP_ICECROWN_CITADEL || mapid == MAP_THE_FORGE_OF_SOULS) && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_WOTLK_TIER_3))
{
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_WOTLK_TIER_3);
return false;
}
if (mapid == MAP_THE_RUBY_SANCTUM && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_WOTLK_TIER_4))
{
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_WOTLK_TIER_4);
return false;
}
@@ -263,7 +260,7 @@ public:
void OnPlayerCompleteQuest(Player* player, Quest const* quest) override
{
if (!sIndividualProgression->enabled || isExcludedFromProgression(player))
if (!sIndividualProgression->enabled || sIndividualProgression->isExcludedFromProgression(player))
{
return;
}
@@ -323,9 +320,9 @@ public:
if (sIndividualProgression->enforceGroupRules) // enforceGroupRules enabled
{
if (!isExcludedFromProgression(player)) // player has a normal account
if (!sIndividualProgression->isExcludedFromProgression(player)) // player has a normal account
{
if (isExcludedFromProgression(otherPlayer)) // RNDbot
if (sIndividualProgression->isExcludedFromProgression(otherPlayer)) // RNDbot
{
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC)) // player is in vanilla
{
@@ -371,7 +368,7 @@ public:
}
else // player has an excluded account
{
if (isExcludedFromProgression(otherPlayer)) // RNDbot
if (sIndividualProgression->isExcludedFromProgression(otherPlayer)) // RNDbot
{
if (player->GetLevel() <= IP_LEVEL_VANILLA) // player is in vanilla
{
@@ -430,7 +427,7 @@ public:
uint8 currentState = player->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value;
uint8 otherPlayerState = groupLeader->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value;
if (isExcludedFromProgression(player))
if (sIndividualProgression->isExcludedFromProgression(player))
{
if (currentState != otherPlayerState)
{
@@ -471,7 +468,7 @@ public:
bool OnPlayerUpdateFishingSkill(Player* player, int32 /*skill*/, int32 /*zone_skill*/, int32 chance, int32 roll) override
{
if (!sIndividualProgression->enabled || !sIndividualProgression->fishingFix || isExcludedFromProgression(player))
if (!sIndividualProgression->enabled || !sIndividualProgression->fishingFix || sIndividualProgression->isExcludedFromProgression(player))
return true;
if (chance < roll)
return false;