diff options
author | Shauren <shauren.trinity@gmail.com> | 2022-12-29 16:57:35 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-12-29 16:57:35 +0100 |
commit | ade34a7f484dfcc7e41eddfd1014e7728c8dc2c1 (patch) | |
tree | 39bbffa357b1062f1f2e7e6a2d08690dafc2f56e /src/server/game/Quests/QuestDef.cpp | |
parent | a840bb9f5a80919a0cec722abcb9b094ac81f493 (diff) |
Core/Spells: Implemented SPELL_EFFECT_GIVE_EXPERIENCE and SPELL_EFFECT_GIVE_RESTED_EXPERIENCE_BONUS
Diffstat (limited to 'src/server/game/Quests/QuestDef.cpp')
-rw-r--r-- | src/server/game/Quests/QuestDef.cpp | 15 |
1 files changed, 10 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); } |