mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Player: Introduce separate level caps for each expansion (#24989)
(cherry picked from commit 3529442668)
This commit is contained in:
@@ -3419,7 +3419,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6
|
||||
break;
|
||||
}
|
||||
case ModifierTreeType::PlayerIsAtMaxExpansionLevel: // 264
|
||||
if (referencePlayer->GetLevel() != GetMaxLevelForExpansion(sWorld->getIntConfig(CONFIG_EXPANSION)))
|
||||
if (!referencePlayer->IsMaxLevel())
|
||||
return false;
|
||||
break;
|
||||
case ModifierTreeType::TransmogSource: // 265
|
||||
|
||||
@@ -2267,7 +2267,7 @@ void Player::GiveXP(uint32 xp, Unit* victim, float group_rate)
|
||||
sScriptMgr->OnGivePlayerXP(this, xp, victim);
|
||||
|
||||
// XP to money conversion processed in Player::RewardQuest
|
||||
if (level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (IsMaxLevel())
|
||||
return;
|
||||
|
||||
uint32 bonus_xp;
|
||||
@@ -2291,11 +2291,11 @@ void Player::GiveXP(uint32 xp, Unit* victim, float group_rate)
|
||||
uint32 nextLvlXP = GetXPForNextLevel();
|
||||
uint32 newXP = GetXP() + xp + bonus_xp;
|
||||
|
||||
while (newXP >= nextLvlXP && level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
while (newXP >= nextLvlXP && !IsMaxLevel())
|
||||
{
|
||||
newXP -= nextLvlXP;
|
||||
|
||||
if (level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (!IsMaxLevel())
|
||||
GiveLevel(level + 1);
|
||||
|
||||
level = GetLevel();
|
||||
@@ -2449,7 +2449,12 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
||||
PlayerLevelInfo info;
|
||||
sObjectMgr->GetPlayerLevelInfo(GetRace(), GetClass(), GetLevel(), &info);
|
||||
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::MaxLevel), sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL));
|
||||
uint8 exp_max_lvl = GetMaxLevelForExpansion(GetSession()->GetExpansion());
|
||||
uint8 conf_max_lvl = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
|
||||
if (exp_max_lvl == DEFAULT_MAX_LEVEL || exp_max_lvl >= conf_max_lvl)
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::MaxLevel), conf_max_lvl);
|
||||
else
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::MaxLevel), exp_max_lvl);
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::NextLevelXP), sObjectMgr->GetXPForLevel(GetLevel()));
|
||||
if (m_activePlayerData->XP >= m_activePlayerData->NextLevelXP)
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::XP), m_activePlayerData->NextLevelXP - 1);
|
||||
@@ -6204,7 +6209,7 @@ void Player::CheckAreaExploreAndOutdoor()
|
||||
|
||||
if (Optional<ContentTuningLevels> areaLevels = sDB2Manager.GetContentTuningData(areaEntry->ContentTuningID, m_playerData->CtrOptions->ContentTuningConditionMask))
|
||||
{
|
||||
if (GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (IsMaxLevel())
|
||||
{
|
||||
SendExplorationExperience(areaId, 0);
|
||||
}
|
||||
@@ -15725,7 +15730,7 @@ void Player::RewardQuest(Quest const* quest, LootItemType rewardType, uint32 rew
|
||||
uint32 XP = GetQuestXPReward(quest);
|
||||
|
||||
int32 moneyRew = 0;
|
||||
if (GetLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (!IsMaxLevel())
|
||||
GiveXP(XP, nullptr);
|
||||
else
|
||||
moneyRew = int32(quest->GetRewMoneyMaxLevel() * sWorld->getRate(RATE_DROP_MONEY));
|
||||
@@ -17392,7 +17397,7 @@ void Player::SendQuestReward(Quest const* quest, Creature const* questGiver, uin
|
||||
|
||||
uint32 moneyReward;
|
||||
|
||||
if (GetLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (!IsMaxLevel())
|
||||
{
|
||||
moneyReward = GetQuestMoneyReward(quest);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user