diff options
Diffstat (limited to 'src/server/game/Quests/QuestDef.cpp')
| -rw-r--r-- | src/server/game/Quests/QuestDef.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 55100ca7396..0c106f69b4a 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -213,15 +213,12 @@ uint32 Quest::XPValue(Player* player) const else if (diffFactor > 10) diffFactor = 10; - uint32 xp = diffFactor * xpentry->Exp[_rewardXPDifficulty] / 10; - 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); + uint32 xp = RoundXPValue(diffFactor * xpentry->Exp[_rewardXPDifficulty] / 10); + if (sWorld->getIntConfig(CONFIG_MIN_QUEST_SCALED_XP_RATIO)) + { + uint32 minScaledXP = RoundXPValue(xpentry->Exp[_rewardXPDifficulty]) * sWorld->getIntConfig(CONFIG_MIN_QUEST_SCALED_XP_RATIO) / 100; + xp = std::max(minScaledXP, xp); + } return xp; } @@ -447,3 +444,15 @@ void Quest::AddQuestLevelToTitle(std::string &title, int32 level) questTitlePretty << "[" << level << "] " << title; title = questTitlePretty.str(); } + +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); +} |
