aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Quests/QuestDef.cpp
diff options
context:
space:
mode:
authorNathan Handley <NathanHandley@users.noreply.github.com>2017-11-03 19:25:14 -0500
committerAokromes <Aokromes@users.noreply.github.com>2017-11-04 01:25:14 +0100
commit6612ec47f4cd3b8c58f3fcde0c412e6fd3e68b48 (patch)
tree49fe636e2b0b9a6435aab8305879ff77b454b5b2 /src/server/game/Quests/QuestDef.cpp
parent427f68fc6a0ae1b200e5bfac5428a68470606f4d (diff)
Core/Misc: Add functionality to allow low level quests/kills/discoveries to grant experience
Diffstat (limited to 'src/server/game/Quests/QuestDef.cpp')
-rw-r--r--src/server/game/Quests/QuestDef.cpp27
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);
+}