diff options
author | Nathan Handley <NathanHandley@users.noreply.github.com> | 2017-11-03 19:25:14 -0500 |
---|---|---|
committer | funjoker <funjoker109@gmail.com> | 2021-01-29 19:23:53 +0100 |
commit | 502f77fe8cb082843f7eb385159dd5038a059443 (patch) | |
tree | fbf86a50ac6c8f432e93e117a45e6b723a15c37a /src/server/game/Quests/QuestDef.cpp | |
parent | 2bc95a5b9a3d0d17b1f2716bbc94d930327bd480 (diff) |
Core/Misc: Add functionality to allow low level quests/kills/discoveries to grant experience
(cherry picked from commit 6612ec47f4cd3b8c58f3fcde0c412e6fd3e68b48)
Diffstat (limited to 'src/server/game/Quests/QuestDef.cpp')
-rw-r--r-- | src/server/game/Quests/QuestDef.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 3dbd3d173d0..c252076c3c4 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -291,14 +291,13 @@ uint32 Quest::XPValue(Player const* player) const if (player->getLevel() >= GetMaxLevelForExpansion(CURRENT_EXPANSION - 1) && player->GetSession()->GetExpansion() == CURRENT_EXPANSION && _expansion < CURRENT_EXPANSION) xp = uint32(xp / 9.0f); - if (xp <= 100) - xp = 5 * ((xp + 2) / 5); - else if (xp <= 500) - xp = 10 * ((xp + 5) / 10); - else if (xp <= 1000) - xp = 25 * ((xp + 12) / 25); - else - xp = 50 * ((xp + 25) / 50); + xp = RoundXPValue(xp); + + if (sWorld->getIntConfig(CONFIG_MIN_QUEST_SCALED_XP_RATIO)) + { + uint32 minScaledXP = RoundXPValue(questXp->Difficulty[_rewardXPDifficulty] * _rewardXPMultiplier) * sWorld->getIntConfig(CONFIG_MIN_QUEST_SCALED_XP_RATIO) / 100; + xp = std::max(minScaledXP, xp); + } return xp; } @@ -597,3 +596,15 @@ WorldPacket Quest::BuildQueryData(LocaleConstant loc) const return *response.Write(); } + +uint32 Quest::RoundXPValue(uint32 xp) +{ + if (xp <= 100) + return 5 * ((xp + 2) / 5); + else if (xp <= 500) + return 10 * ((xp + 5) / 10); + else if (xp <= 1000) + return 25 * ((xp + 12) / 25); + else + return 50 * ((xp + 25) / 50); +} |