diff options
author | Shauren <shauren.trinity@gmail.com> | 2023-05-05 14:34:27 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2023-05-05 14:34:27 +0200 |
commit | e540d74610e14b8920570e9ece4c2aa47a4be6ed (patch) | |
tree | 306d471a6ac25f6b28157e7c0d4c683c85bd951a /src/server/game/Quests | |
parent | cdb209fda44eb500a7e8d9a0d4acd048e1ee5eec (diff) |
Core/PacketIO: Fixed quest query packet structure
Diffstat (limited to 'src/server/game/Quests')
-rw-r--r-- | src/server/game/Quests/QuestDef.cpp | 16 | ||||
-rw-r--r-- | src/server/game/Quests/QuestDef.h | 18 |
2 files changed, 30 insertions, 4 deletions
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 542bce38d3a..b4e18f2ed97 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -135,6 +135,7 @@ void Quest::LoadRewardDisplaySpell(Field* fields) { uint32 spellId = fields[1].GetUInt32(); uint32 playerConditionId = fields[2].GetUInt32(); + uint32 type = fields[3].GetUInt32(); if (!sSpellMgr->GetSpellInfo(spellId, DIFFICULTY_NONE)) { @@ -148,7 +149,13 @@ void Quest::LoadRewardDisplaySpell(Field* fields) playerConditionId = 0; } - RewardDisplaySpell.emplace_back(spellId, playerConditionId); + if (type >= AsUnderlyingType(QuestCompleteSpellType::Max)) + { + TC_LOG_ERROR("sql.sql", "Table `quest_reward_display_spell` invalid type value ({}) set for quest {} and spell {}. Set to 0.", type, fields[0].GetUInt32(), spellId); + type = AsUnderlyingType(QuestCompleteSpellType::LegacyBehavior); + } + + RewardDisplaySpell.emplace_back(spellId, playerConditionId, QuestCompleteSpellType(type)); } void Quest::LoadRewardChoiceItems(Field* fields) @@ -633,7 +640,12 @@ WorldPacket Quest::BuildQueryData(LocaleConstant loc, Player* player) const response.Info.RewardMoneyMultiplier = GetMoneyMultiplier(); response.Info.RewardBonusMoney = GetRewMoneyMaxLevel(); for (QuestRewardDisplaySpell displaySpell : RewardDisplaySpell) - response.Info.RewardDisplaySpell.push_back({ int32(displaySpell.SpellId), int32(displaySpell.PlayerConditionId) }); + { + WorldPackets::Quest::QuestCompleteDisplaySpell& rewardDisplaySpell = response.Info.RewardDisplaySpell.emplace_back(); + rewardDisplaySpell.SpellID = displaySpell.SpellId; + rewardDisplaySpell.PlayerConditionID = displaySpell.PlayerConditionId; + rewardDisplaySpell.Type = int32(displaySpell.Type); + } response.Info.RewardSpell = GetRewSpell(); diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index 7f04ef0eb25..3660d2da57f 100644 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -346,6 +346,19 @@ enum QuestObjectiveFlags QUEST_OBJECTIVE_FLAG_KILL_PLAYERS_SAME_FACTION = 0x80 }; +enum class QuestCompleteSpellType : uint32 +{ + LegacyBehavior = 0, + Follower = 1, + Tradeskill = 2, + Ability = 3, + Aura = 4, + Spell = 5, + Unlock = 6, + Companion = 7, + Max +}; + struct QuestGreeting { uint16 EmoteType; @@ -465,11 +478,12 @@ using QuestObjectives = std::vector<QuestObjective>; struct QuestRewardDisplaySpell { - QuestRewardDisplaySpell() : SpellId(0), PlayerConditionId(0) { } - QuestRewardDisplaySpell(uint32 spellId, uint32 playerConditionId) : SpellId(spellId), PlayerConditionId(playerConditionId) { } + QuestRewardDisplaySpell() : SpellId(0), PlayerConditionId(0), Type(QuestCompleteSpellType::LegacyBehavior) { } + QuestRewardDisplaySpell(uint32 spellId, uint32 playerConditionId, QuestCompleteSpellType type) : SpellId(spellId), PlayerConditionId(playerConditionId), Type(type) { } uint32 SpellId; uint32 PlayerConditionId; + QuestCompleteSpellType Type; }; struct QuestConditionalText |