From ade34a7f484dfcc7e41eddfd1014e7728c8dc2c1 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 29 Dec 2022 16:57:35 +0100 Subject: Core/Spells: Implemented SPELL_EFFECT_GIVE_EXPERIENCE and SPELL_EFFECT_GIVE_RESTED_EXPERIENCE_BONUS --- src/server/game/Quests/QuestDef.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/server/game/Quests/QuestDef.cpp') 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 @@ -356,12 +356,17 @@ 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); } -- cgit v1.2.3