Core/Player: Introduce separate level caps for each expansion
This commit is contained in:
1 parent
56c3d0fa11
commit
cb4e7821e3
6 files changed
+29
-20
No files matched your search
@@ -2276,7 +2276,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;
|
||||
@@ -2294,11 +2294,11 @@ void Player::GiveXP(uint32 xp, Unit* victim, float group_rate)
|
||||
uint32 nextLvlXP = GetUInt32Value(PLAYER_NEXT_LEVEL_XP);
|
||||
uint32 newXP = curXP + 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();
|
||||
@@ -2407,6 +2407,11 @@ void Player::GiveLevel(uint8 level)
|
||||
sScriptMgr->OnPlayerLevelChanged(this, oldLevel);
|
||||
}
|
||||
|
||||
bool Player::IsMaxLevel() const
|
||||
{
|
||||
return getLevel() >= GetUInt32Value(PLAYER_FIELD_MAX_LEVEL);
|
||||
}
|
||||
|
||||
void Player::InitTalentForLevel()
|
||||
{
|
||||
uint8 level = getLevel();
|
||||
@@ -2458,7 +2463,12 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
||||
PlayerLevelInfo info;
|
||||
sObjectMgr->GetPlayerLevelInfo(getRace(), getClass(), getLevel(), &info);
|
||||
|
||||
SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL));
|
||||
uint8 exp_max_lvl = DBCManager::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)
|
||||
SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, conf_max_lvl);
|
||||
else
|
||||
SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, exp_max_lvl);
|
||||
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr->GetXPForLevel(getLevel()));
|
||||
|
||||
// reset before any aura state sources (health set/aura apply)
|
||||
@@ -6138,10 +6148,8 @@ void Player::CheckAreaExploreAndOutdoor()
|
||||
|
||||
if (areaEntry->ExplorationLevel > 0)
|
||||
{
|
||||
if (getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
if (IsMaxLevel())
|
||||
SendExplorationExperience(areaId, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
int32 diff = int32(getLevel()) - areaEntry->ExplorationLevel;
|
||||
@@ -14968,7 +14976,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
|
||||
for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
|
||||
AddPct(XP, (*i)->GetAmount());
|
||||
|
||||
if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (!IsMaxLevel())
|
||||
GiveXP(XP, nullptr);
|
||||
|
||||
if (Guild* guild = GetGuild())
|
||||
@@ -16591,7 +16599,7 @@ void Player::SendQuestReward(Quest const* quest, Creature const* questGiver, uin
|
||||
sGameEventMgr->HandleQuestComplete(questId);
|
||||
|
||||
uint32 XP = 0;
|
||||
if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (!IsMaxLevel())
|
||||
XP = xp;
|
||||
|
||||
WorldPackets::Quest::QuestGiverQuestComplete packet;
|
||||
@@ -21653,7 +21661,7 @@ void Player::LeaveAllArenaTeams(ObjectGuid guid)
|
||||
void Player::SetRestBonus(float rest_bonus_new)
|
||||
{
|
||||
// Prevent resting on max level
|
||||
if (getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if (IsMaxLevel())
|
||||
rest_bonus_new = 0;
|
||||
|
||||
if (rest_bonus_new < 0)
|
||||
|
||||
Reference in new issue
Block a user