aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Quests
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-12-29 16:57:35 +0100
committerShauren <shauren.trinity@gmail.com>2022-12-29 16:57:35 +0100
commitade34a7f484dfcc7e41eddfd1014e7728c8dc2c1 (patch)
tree39bbffa357b1062f1f2e7e6a2d08690dafc2f56e /src/server/game/Quests
parenta840bb9f5a80919a0cec722abcb9b094ac81f493 (diff)
Core/Spells: Implemented SPELL_EFFECT_GIVE_EXPERIENCE and SPELL_EFFECT_GIVE_RESTED_EXPERIENCE_BONUS
Diffstat (limited to 'src/server/game/Quests')
-rw-r--r--src/server/game/Quests/QuestDef.cpp15
-rw-r--r--src/server/game/Quests/QuestDef.h1
2 files changed, 11 insertions, 5 deletions
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index e402dc6c214..8d059c3340e 100644
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -357,11 +357,16 @@ void Quest::LoadConditionalConditionalQuestCompletionLog(Field* fields)
uint32 Quest::XPValue(Player const* player) const
{
+ return XPValue(player, GetContentTuningId(), _rewardXPDifficulty, _rewardXPMultiplier, _expansion);
+}
+
+uint32 Quest::XPValue(Player const* player, uint32 contentTuningId, uint32 xpDifficulty, float xpMultiplier /*= 1.0f*/, int32 expansion /*= -1*/)
+{
if (player)
{
- uint32 questLevel = player->GetQuestLevel(this);
+ uint32 questLevel = player->GetQuestLevel(contentTuningId);
QuestXPEntry const* questXp = sQuestXPStore.LookupEntry(questLevel);
- if (!questXp || _rewardXPDifficulty >= 10)
+ if (!questXp || xpDifficulty >= 10)
return 0;
int32 diffFactor = 2 * (questLevel - player->GetLevel()) + 12;
@@ -370,15 +375,15 @@ uint32 Quest::XPValue(Player const* player) const
else if (diffFactor > 10)
diffFactor = 10;
- uint32 xp = diffFactor * questXp->Difficulty[_rewardXPDifficulty] * _rewardXPMultiplier / 10;
- if (player->GetLevel() >= GetMaxLevelForExpansion(CURRENT_EXPANSION - 1) && player->GetSession()->GetExpansion() == CURRENT_EXPANSION && _expansion < CURRENT_EXPANSION)
+ uint32 xp = diffFactor * questXp->Difficulty[xpDifficulty] * xpMultiplier / 10;
+ if (player->GetLevel() >= GetMaxLevelForExpansion(CURRENT_EXPANSION - 1) && player->GetSession()->GetExpansion() == CURRENT_EXPANSION && expansion >= 0 && expansion < CURRENT_EXPANSION)
xp = uint32(xp / 9.0f);
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;
+ uint32 minScaledXP = RoundXPValue(questXp->Difficulty[xpDifficulty] * xpMultiplier) * sWorld->getIntConfig(CONFIG_MIN_QUEST_SCALED_XP_RATIO) / 100;
xp = std::max(minScaledXP, xp);
}
diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h
index e0bbc363226..7f04ef0eb25 100644
--- a/src/server/game/Quests/QuestDef.h
+++ b/src/server/game/Quests/QuestDef.h
@@ -505,6 +505,7 @@ class TC_GAME_API Quest
void LoadConditionalConditionalQuestCompletionLog(Field* fields);
uint32 XPValue(Player const* player) const;
+ static uint32 XPValue(Player const* player, uint32 contentTuningId, uint32 xpDifficulty, float xpMultiplier = 1.0f, int32 expansion = -1);
uint32 MoneyValue(Player const* player) const;
uint32 MaxMoneyValue() const;
uint32 GetMaxMoneyReward() const;