fix(Core/Quest): Correct XP Display when modified by SPELL_AURA_MOD_XP_QUEST_PCT (#19060)
* fix(Core): Correct Quest XP Display when modified by SPELL_AURA_MOD_XP_QUEST_PCT The quest XP displayed on the gossip window was not modified for auras that increase quest XP gain (e.g. spell ID 57353). This commit corrects the quest XP display when accepting/returning quests. * refactor(Entities/Player): Added a `CalculateQuestRewardXP()` function to reduce duplicated code * cleanup(Entities/Creature): Removed now unused variable `playerLevel` * Apply suggestions from code review Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> --------- Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
@@ -451,7 +451,6 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
|
||||
|
||||
uint32 moneyRew = 0;
|
||||
Player* player = _session->GetPlayer();
|
||||
uint8 playerLevel = player ? player->GetLevel() : 0;
|
||||
if (player && (player->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
|
||||
{
|
||||
moneyRew = quest->GetRewMoneyMaxLevel();
|
||||
@@ -461,7 +460,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
|
||||
uint32 questXp;
|
||||
if (player && !sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player))
|
||||
{
|
||||
questXp = uint32(quest->XPValue(playerLevel) * player->GetQuestRate());
|
||||
questXp = player->CalculateQuestRewardXP(quest);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -704,7 +703,6 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUI
|
||||
|
||||
uint32 moneyRew = 0;
|
||||
Player* player = _session->GetPlayer();
|
||||
uint8 playerLevel = player ? player->GetLevel() : 0;
|
||||
if (player && (player->GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
|
||||
{
|
||||
moneyRew = quest->GetRewMoneyMaxLevel();
|
||||
@@ -714,7 +712,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUI
|
||||
uint32 questXp;
|
||||
if (player && !sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player))
|
||||
{
|
||||
questXp = uint32(quest->XPValue(playerLevel) * player->GetQuestRate());
|
||||
questXp = player->CalculateQuestRewardXP(quest);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user