diff options
Diffstat (limited to 'src/server/game/Quests/QuestDef.cpp')
-rw-r--r-- | src/server/game/Quests/QuestDef.cpp | 138 |
1 files changed, 76 insertions, 62 deletions
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index e85f559ec2a..519c5873f6c 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -41,27 +41,26 @@ Quest::Quest(Field* questRecord) _nextQuestInChain = questRecord[7].GetUInt32(); _rewardXPDifficulty = questRecord[8].GetUInt32(); _rewardXPMultiplier = questRecord[9].GetFloat(); - _rewardMoney = questRecord[10].GetUInt32(); - _rewardMoneyDifficulty = questRecord[11].GetUInt32(); - _rewardMoneyMultiplier = questRecord[12].GetFloat(); - _rewardBonusMoney = questRecord[13].GetUInt32(); - _rewardSpell = questRecord[14].GetUInt32(); - _rewardHonor = questRecord[15].GetUInt32(); - _rewardKillHonor = questRecord[16].GetUInt32(); - _sourceItemId = questRecord[17].GetUInt32(); - _rewardArtifactXPDifficulty = questRecord[18].GetUInt32(); - _rewardArtifactXPMultiplier = questRecord[19].GetFloat(); - _rewardArtifactCategoryID = questRecord[20].GetUInt32(); - _flags = questRecord[21].GetUInt32(); - _flagsEx = questRecord[22].GetUInt32(); - _flagsEx2 = questRecord[23].GetUInt32(); + _rewardMoneyDifficulty = questRecord[10].GetUInt32(); + _rewardMoneyMultiplier = questRecord[11].GetFloat(); + _rewardBonusMoney = questRecord[12].GetUInt32(); + _rewardSpell = questRecord[13].GetUInt32(); + _rewardHonor = questRecord[14].GetUInt32(); + _rewardKillHonor = questRecord[15].GetUInt32(); + _sourceItemId = questRecord[16].GetUInt32(); + _rewardArtifactXPDifficulty = questRecord[17].GetUInt32(); + _rewardArtifactXPMultiplier = questRecord[18].GetFloat(); + _rewardArtifactCategoryID = questRecord[19].GetUInt32(); + _flags = questRecord[20].GetUInt32(); + _flagsEx = questRecord[21].GetUInt32(); + _flagsEx2 = questRecord[22].GetUInt32(); for (uint32 i = 0; i < QUEST_ITEM_DROP_COUNT; ++i) { - RewardItemId[i] = questRecord[24 + i * 4].GetUInt32(); - RewardItemCount[i] = questRecord[25 + i * 4].GetUInt32(); - ItemDrop[i] = questRecord[26 + i * 4].GetUInt32(); - ItemDropQuantity[i] = questRecord[27 + i * 4].GetUInt32(); + RewardItemId[i] = questRecord[23 + i * 4].GetUInt32(); + RewardItemCount[i] = questRecord[24 + i * 4].GetUInt32(); + ItemDrop[i] = questRecord[25 + i * 4].GetUInt32(); + ItemDropQuantity[i] = questRecord[26 + i * 4].GetUInt32(); if (RewardItemId[i]) ++_rewItemsCount; @@ -69,67 +68,67 @@ Quest::Quest(Field* questRecord) for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) { - RewardChoiceItemId[i] = questRecord[40 + i * 3].GetUInt32(); - RewardChoiceItemCount[i] = questRecord[41 + i * 3].GetUInt32(); - RewardChoiceItemDisplayId[i] = questRecord[42 + i * 3].GetUInt32(); + RewardChoiceItemId[i] = questRecord[39 + i * 3].GetUInt32(); + RewardChoiceItemCount[i] = questRecord[40 + i * 3].GetUInt32(); + RewardChoiceItemDisplayId[i] = questRecord[41 + i * 3].GetUInt32(); if (RewardChoiceItemId[i]) ++_rewChoiceItemsCount; } - _poiContinent = questRecord[58].GetUInt32(); - _poix = questRecord[59].GetFloat(); - _poiy = questRecord[60].GetFloat(); - _poiPriority = questRecord[61].GetUInt32(); + _poiContinent = questRecord[57].GetUInt32(); + _poix = questRecord[58].GetFloat(); + _poiy = questRecord[59].GetFloat(); + _poiPriority = questRecord[60].GetUInt32(); - _rewardTitleId = questRecord[62].GetUInt32(); - _rewardArenaPoints = questRecord[63].GetUInt32(); - _rewardSkillId = questRecord[64].GetUInt32(); - _rewardSkillPoints = questRecord[65].GetUInt32(); + _rewardTitleId = questRecord[61].GetUInt32(); + _rewardArenaPoints = questRecord[62].GetUInt32(); + _rewardSkillId = questRecord[63].GetUInt32(); + _rewardSkillPoints = questRecord[64].GetUInt32(); - _questGiverPortrait = questRecord[66].GetUInt32(); - _questGiverPortraitMount = questRecord[67].GetUInt32(); - _questGiverPortraitModelSceneId = questRecord[68].GetInt32(); - _questTurnInPortrait = questRecord[69].GetUInt32(); + _questGiverPortrait = questRecord[65].GetUInt32(); + _questGiverPortraitMount = questRecord[66].GetUInt32(); + _questGiverPortraitModelSceneId = questRecord[67].GetInt32(); + _questTurnInPortrait = questRecord[68].GetUInt32(); for (uint32 i = 0; i < QUEST_REWARD_REPUTATIONS_COUNT; ++i) { - RewardFactionId[i] = questRecord[70 + i * 4].GetUInt32(); - RewardFactionValue[i] = questRecord[71 + i * 4].GetInt32(); - RewardFactionOverride[i] = questRecord[72 + i * 4].GetInt32(); - RewardFactionCapIn[i] = questRecord[73 + i * 4].GetInt32(); + RewardFactionId[i] = questRecord[69 + i * 4].GetUInt32(); + RewardFactionValue[i] = questRecord[70 + i * 4].GetInt32(); + RewardFactionOverride[i] = questRecord[71 + i * 4].GetInt32(); + RewardFactionCapIn[i] = questRecord[72 + i * 4].GetInt32(); } - _rewardReputationMask = questRecord[90].GetUInt32(); + _rewardReputationMask = questRecord[89].GetUInt32(); for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) { - RewardCurrencyId[i] = questRecord[91 + i * 2].GetUInt32(); - RewardCurrencyCount[i] = questRecord[92 + i * 2].GetUInt32(); + RewardCurrencyId[i] = questRecord[90 + i * 2].GetUInt32(); + RewardCurrencyCount[i] = questRecord[91 + i * 2].GetUInt32(); if (RewardCurrencyId[i]) ++_rewCurrencyCount; } - _soundAccept = questRecord[99].GetUInt32(); - _soundTurnIn = questRecord[100].GetUInt32(); - _areaGroupID = questRecord[101].GetUInt32(); - _limitTime = questRecord[102].GetUInt32(); - _allowableRaces.RawValue = questRecord[103].GetUInt64(); - _treasurePickerID = questRecord[104].GetInt32(); - _expansion = questRecord[105].GetInt32(); - _managedWorldStateID = questRecord[106].GetInt32(); - _questSessionBonus = questRecord[107].GetInt32(); - - _logTitle = questRecord[108].GetString(); - _logDescription = questRecord[109].GetString(); - _questDescription = questRecord[110].GetString(); - _areaDescription = questRecord[111].GetString(); - _portraitGiverText = questRecord[112].GetString(); - _portraitGiverName = questRecord[113].GetString(); - _portraitTurnInText = questRecord[114].GetString(); - _portraitTurnInName = questRecord[115].GetString(); - _questCompletionLog = questRecord[116].GetString(); + _soundAccept = questRecord[98].GetUInt32(); + _soundTurnIn = questRecord[99].GetUInt32(); + _areaGroupID = questRecord[100].GetUInt32(); + _limitTime = questRecord[101].GetUInt32(); + _allowableRaces.RawValue = questRecord[102].GetUInt64(); + _treasurePickerID = questRecord[103].GetInt32(); + _expansion = questRecord[104].GetInt32(); + _managedWorldStateID = questRecord[105].GetInt32(); + _questSessionBonus = questRecord[106].GetInt32(); + + _logTitle = questRecord[107].GetString(); + _logDescription = questRecord[108].GetString(); + _questDescription = questRecord[109].GetString(); + _areaDescription = questRecord[110].GetString(); + _portraitGiverText = questRecord[111].GetString(); + _portraitGiverName = questRecord[112].GetString(); + _portraitTurnInText = questRecord[113].GetString(); + _portraitTurnInName = questRecord[114].GetString(); + _questCompletionLog = questRecord[115].GetString(); } void Quest::LoadRewardDisplaySpell(Field* fields) @@ -325,6 +324,21 @@ uint32 Quest::MoneyValue(Player const* player) const return 0; } +uint32 Quest::MaxMoneyValue() const +{ + uint32 value = 0; + if (Optional<ContentTuningLevels> questLevels = sDB2Manager.GetContentTuningData(GetContentTuningId(), 0)) + if (QuestMoneyRewardEntry const* money = sQuestMoneyRewardStore.LookupEntry(questLevels->MaxLevel)) + value = money->Difficulty[GetRewMoneyDifficulty()] * GetMoneyMultiplier(); + + return value; +} + +uint32 Quest::GetMaxMoneyReward() const +{ + return MaxMoneyValue() * sWorld->getRate(RATE_MONEY_QUEST); +} + Optional<QuestTagType> Quest::GetQuestTag() const { if (QuestInfoEntry const* questInfo = sQuestInfoStore.LookupEntry(GetQuestInfoID())) @@ -463,10 +477,10 @@ bool Quest::CanIncreaseRewardedQuestCounters() const void Quest::InitializeQueryData() { for (uint8 loc = LOCALE_enUS; loc < TOTAL_LOCALES; ++loc) - QueryData[loc] = BuildQueryData(static_cast<LocaleConstant>(loc)); + QueryData[loc] = BuildQueryData(static_cast<LocaleConstant>(loc), nullptr); } -WorldPacket Quest::BuildQueryData(LocaleConstant loc) const +WorldPacket Quest::BuildQueryData(LocaleConstant loc, Player* player) const { WorldPackets::Quest::QueryQuestInfoResponse response; @@ -511,7 +525,7 @@ WorldPacket Quest::BuildQueryData(LocaleConstant loc) const response.Info.RewardXPMultiplier = GetXPMultiplier(); if (!HasFlag(QUEST_FLAGS_HIDDEN_REWARDS)) - response.Info.RewardMoney = GetRewMoney(); + response.Info.RewardMoney = player ? player->GetQuestMoneyReward(this) : GetMaxMoneyReward(); response.Info.RewardMoneyDifficulty = GetRewMoneyDifficulty(); response.Info.RewardMoneyMultiplier = GetMoneyMultiplier(); |