refactor(Scripts/Commands): Update cs_quest to the new model (#9267)

This commit is contained in:
Skjalf
2021-11-24 01:21:16 -03:00
committed by GitHub
parent 91552e240e
commit 2187470df7
12 changed files with 716 additions and 204 deletions

View File

@@ -736,7 +736,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
bool rewarded = IsQuestRewarded(quest_id) && !quest->IsDFQuest();
// Not give XP in case already completed once repeatable quest
uint32 XP = rewarded ? 0 : uint32(quest->XPValue(this) * GetQuestRate());
uint32 XP = rewarded ? 0 : uint32(quest->XPValue(getLevel()) * GetQuestRate());
// handle SPELL_AURA_MOD_XP_QUEST_PCT auras
Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_QUEST_PCT);
@@ -754,7 +754,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
}
// Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative
if (int32 rewOrReqMoney = quest->GetRewOrReqMoney(this))
if (int32 rewOrReqMoney = quest->GetRewOrReqMoney(getLevel()))
{
moneyRew += rewOrReqMoney;
}
@@ -2292,12 +2292,12 @@ void Player::SendQuestReward(Quest const* quest, uint32 XP)
if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
data << uint32(XP);
data << uint32(quest->GetRewOrReqMoney(this));
data << uint32(quest->GetRewOrReqMoney(getLevel()));
}
else
{
data << uint32(0);
data << uint32(quest->GetRewOrReqMoney(this) + quest->GetRewMoneyMaxLevel());
data << uint32(quest->GetRewOrReqMoney(getLevel()) + quest->GetRewMoneyMaxLevel());
}
data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));