mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Quests: Remove RewardMoney from quest_template as it is not a static value and depends on receiving player (#27590)
This commit is contained in:
1
sql/updates/world/master/2022_01_18_00_world.sql
Normal file
1
sql/updates/world/master/2022_01_18_00_world.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE `quest_template` DROP COLUMN `RewardMoney`;
|
||||
@@ -477,7 +477,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
|
||||
_session->SendPacket(&quest->QueryData[static_cast<uint32>(_session->GetSessionDbLocaleIndex())]);
|
||||
else
|
||||
{
|
||||
WorldPacket queryPacket = quest->BuildQueryData(_session->GetSessionDbLocaleIndex());
|
||||
WorldPacket queryPacket = quest->BuildQueryData(_session->GetSessionDbLocaleIndex(), _session->GetPlayer());
|
||||
_session->SendPacket(&queryPacket);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
_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[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();
|
||||
_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();
|
||||
|
||||
@@ -492,6 +492,8 @@ class TC_GAME_API Quest
|
||||
|
||||
uint32 XPValue(Player const* player) const;
|
||||
uint32 MoneyValue(Player const* player) const;
|
||||
uint32 MaxMoneyValue() const;
|
||||
uint32 GetMaxMoneyReward() const;
|
||||
Optional<QuestTagType> GetQuestTag() const;
|
||||
|
||||
bool HasFlag(QuestFlags flag) const { return (_flags & uint32(flag)) != 0; }
|
||||
@@ -553,7 +555,6 @@ class TC_GAME_API Quest
|
||||
std::string const& GetPortraitTurnInText() const { return _portraitTurnInText; }
|
||||
std::string const& GetPortraitTurnInName() const { return _portraitTurnInName; }
|
||||
QuestObjectives const& GetObjectives() const { return Objectives; }
|
||||
uint32 GetRewMoney() const { return _rewardMoney; }
|
||||
uint32 GetRewMoneyDifficulty() const { return _rewardMoneyDifficulty; }
|
||||
uint32 GetRewHonor() const { return _rewardHonor; }
|
||||
uint32 GetRewKillHonor() const { return _rewardKillHonor; }
|
||||
@@ -637,7 +638,7 @@ class TC_GAME_API Quest
|
||||
uint16 GetEventIdForQuest() const { return _eventIdForQuest; }
|
||||
|
||||
void InitializeQueryData();
|
||||
WorldPacket BuildQueryData(LocaleConstant loc) const;
|
||||
WorldPacket BuildQueryData(LocaleConstant loc, Player* player) const;
|
||||
|
||||
void BuildQuestRewards(WorldPackets::Quest::QuestRewards& rewards, Player* player) const;
|
||||
|
||||
@@ -662,7 +663,6 @@ class TC_GAME_API Quest
|
||||
uint32 _nextQuestInChain = 0;
|
||||
uint32 _rewardXPDifficulty = 0;
|
||||
float _rewardXPMultiplier = 0.f;
|
||||
int32 _rewardMoney = 0;
|
||||
uint32 _rewardMoneyDifficulty = 0;
|
||||
float _rewardMoneyMultiplier = 0.f;
|
||||
uint32 _rewardBonusMoney = 0;
|
||||
|
||||
Reference in New Issue
Block a user