TrinityCore
Loading...
Searching...
No Matches
QuestDef.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "QuestDef.h"
19#include "ConditionMgr.h"
20#include "DB2Stores.h"
21#include "Field.h"
22#include "GameTables.h"
23#include "Log.h"
24#include "ObjectMgr.h"
25#include "Player.h"
26#include "QueryResult.h"
28#include "QuestPackets.h"
29#include "QuestPools.h"
30#include "SpellMgr.h"
31#include "World.h"
32#include "WorldSession.h"
33
34#define QUEST_TEMPLATE_FIELDS (ID)(QuestType)(QuestPackageID)(ContentTuningID)(QuestSortID)(QuestInfoID)(SuggestedGroupNum)(RewardNextQuest)(RewardXPDifficulty)\
35 (RewardXPMultiplier)(RewardMoneyDifficulty)(RewardMoneyMultiplier)(RewardBonusMoney)(RewardSpell)(RewardHonor)(RewardKillHonor)(RewardFavor)(StartItem)\
36 (RewardArtifactXPDifficulty)(RewardArtifactXPMultiplier)(RewardArtifactCategoryID)(Flags)(FlagsEx)(FlagsEx2)(FlagsEx3)\
37 (RewardItem1)(RewardAmount1)(ItemDrop1)(ItemDropQuantity1)(RewardItem2)(RewardAmount2)(ItemDrop2)(ItemDropQuantity2)\
38 (RewardItem3)(RewardAmount3)(ItemDrop3)(ItemDropQuantity3)(RewardItem4)(RewardAmount4)(ItemDrop4)(ItemDropQuantity4)\
39 (RewardChoiceItemID1)(RewardChoiceItemQuantity1)(RewardChoiceItemDisplayID1)(RewardChoiceItemID2)(RewardChoiceItemQuantity2)(RewardChoiceItemDisplayID2)\
40 (RewardChoiceItemID3)(RewardChoiceItemQuantity3)(RewardChoiceItemDisplayID3)(RewardChoiceItemID4)(RewardChoiceItemQuantity4)(RewardChoiceItemDisplayID4)\
41 (RewardChoiceItemID5)(RewardChoiceItemQuantity5)(RewardChoiceItemDisplayID5)(RewardChoiceItemID6)(RewardChoiceItemQuantity6)(RewardChoiceItemDisplayID6)\
42 (POIContinent)(POIx)(POIy)(POIPriority)(RewardTitle)(RewardArenaPoints)(RewardSkillLineID)(RewardNumSkillUps)\
43 (PortraitGiver)(PortraitGiverMount)(PortraitGiverModelSceneID)(PortraitTurnIn)(RewardFactionID1)(RewardFactionValue1)(RewardFactionOverride1)(RewardFactionCapIn1)\
44 (RewardFactionID2)(RewardFactionValue2)(RewardFactionOverride2)(RewardFactionCapIn2)(RewardFactionID3)(RewardFactionValue3)(RewardFactionOverride3)(RewardFactionCapIn3)\
45 (RewardFactionID4)(RewardFactionValue4)(RewardFactionOverride4)(RewardFactionCapIn4)(RewardFactionID5)(RewardFactionValue5)(RewardFactionOverride5)(RewardFactionCapIn5)\
46 (RewardFactionFlags)(RewardCurrencyID1)(RewardCurrencyQty1)(RewardCurrencyID2)(RewardCurrencyQty2)(RewardCurrencyID3)(RewardCurrencyQty3)\
47 (RewardCurrencyID4)(RewardCurrencyQty4)(AcceptedSoundKitID)(CompleteSoundKitID)(AreaGroupID)(TimeAllowed)(AllowableRaces)(ResetByScheduler)(Expansion)\
48 (ManagedWorldStateID)(QuestSessionBonus)(LogTitle)(LogDescription)(QuestDescription)(AreaDescription)(PortraitGiverText)(PortraitGiverName)\
49 (PortraitTurnInText)(PortraitTurnInName)(QuestCompletionLog)
50
52
53Quest::Quest(QueryResult const& questRecord) : Quest(*questRecord)
54{
55}
56
57Quest::Quest(QuestTemplateQueryResult const& questRecord) :
58 RewardItemId({ questRecord.RewardItem1().GetUInt32(), questRecord.RewardItem2().GetUInt32(),
59 questRecord.RewardItem3().GetUInt32(), questRecord.RewardItem4().GetUInt32() }),
60 RewardItemCount({ questRecord.RewardAmount1().GetUInt32(), questRecord.RewardAmount2().GetUInt32(),
61 questRecord.RewardAmount3().GetUInt32(), questRecord.RewardAmount4().GetUInt32() }),
62 ItemDrop({ questRecord.ItemDrop1().GetUInt32(), questRecord.ItemDrop2().GetUInt32(),
63 questRecord.ItemDrop3().GetUInt32(), questRecord.ItemDrop4().GetUInt32() }),
64 ItemDropQuantity({ questRecord.ItemDropQuantity1().GetUInt32(), questRecord.ItemDropQuantity2().GetUInt32(),
65 questRecord.ItemDropQuantity3().GetUInt32(), questRecord.ItemDropQuantity4().GetUInt32() }),
66 RewardChoiceItemId({ questRecord.RewardChoiceItemID1().GetUInt32(), questRecord.RewardChoiceItemID2().GetUInt32(),
67 questRecord.RewardChoiceItemID3().GetUInt32(), questRecord.RewardChoiceItemID4().GetUInt32(),
68 questRecord.RewardChoiceItemID5().GetUInt32(), questRecord.RewardChoiceItemID6().GetUInt32() }),
69 RewardChoiceItemCount({ questRecord.RewardChoiceItemQuantity1().GetUInt32(), questRecord.RewardChoiceItemQuantity2().GetUInt32(),
70 questRecord.RewardChoiceItemQuantity3().GetUInt32(), questRecord.RewardChoiceItemQuantity4().GetUInt32(),
71 questRecord.RewardChoiceItemQuantity5().GetUInt32(), questRecord.RewardChoiceItemQuantity6().GetUInt32() }),
72 RewardChoiceItemDisplayId({ questRecord.RewardChoiceItemDisplayID1().GetUInt32(), questRecord.RewardChoiceItemDisplayID2().GetUInt32(),
73 questRecord.RewardChoiceItemDisplayID3().GetUInt32(), questRecord.RewardChoiceItemDisplayID4().GetUInt32(),
74 questRecord.RewardChoiceItemDisplayID5().GetUInt32(), questRecord.RewardChoiceItemDisplayID6().GetUInt32() }),
75 RewardFactionId({ questRecord.RewardFactionID1().GetUInt32(), questRecord.RewardFactionID2().GetUInt32(),
76 questRecord.RewardFactionID3().GetUInt32(), questRecord.RewardFactionID4().GetUInt32(), questRecord.RewardFactionID5().GetUInt32() }),
77 RewardFactionValue({ questRecord.RewardFactionValue1().GetInt32(), questRecord.RewardFactionValue2().GetInt32(),
78 questRecord.RewardFactionValue3().GetInt32(), questRecord.RewardFactionValue4().GetInt32(), questRecord.RewardFactionValue5().GetInt32() }),
79 RewardFactionOverride({ questRecord.RewardFactionOverride1().GetInt32(), questRecord.RewardFactionOverride2().GetInt32(),
80 questRecord.RewardFactionOverride3().GetInt32(), questRecord.RewardFactionOverride4().GetInt32(), questRecord.RewardFactionOverride5().GetInt32() }),
81 RewardFactionCapIn({ questRecord.RewardFactionCapIn1().GetInt32(), questRecord.RewardFactionCapIn2().GetInt32(),
82 questRecord.RewardFactionCapIn3().GetInt32(), questRecord.RewardFactionCapIn4().GetInt32(), questRecord.RewardFactionCapIn5().GetInt32() }),
83 RewardCurrencyId({ questRecord.RewardCurrencyID1().GetUInt32(), questRecord.RewardCurrencyID2().GetUInt32(),
84 questRecord.RewardCurrencyID3().GetUInt32(), questRecord.RewardCurrencyID4().GetUInt32() }),
85 RewardCurrencyCount({ questRecord.RewardCurrencyQty1().GetUInt32(), questRecord.RewardCurrencyQty2().GetUInt32(),
86 questRecord.RewardCurrencyQty3().GetUInt32(), questRecord.RewardCurrencyQty4().GetUInt32() }),
87 _rewItemsCount(std::ranges::count_if(RewardItemId, [](uint32 itemId) { return itemId != 0; })),
88 _rewChoiceItemsCount(std::ranges::count_if(RewardChoiceItemId, [](uint32 itemId) { return itemId != 0; })),
89 _id(questRecord.ID().GetUInt32()),
90 _type(questRecord.QuestType().GetUInt8()),
91 _packageID(questRecord.QuestPackageID().GetUInt32()),
92 _contentTuningID(questRecord.ContentTuningID().GetInt32()),
93 _questSortID(questRecord.QuestSortID().GetInt16()),
94 _questInfoID(questRecord.QuestInfoID().GetUInt16()),
95 _suggestedPlayers(questRecord.SuggestedGroupNum().GetUInt8()),
96 _nextQuestInChain(questRecord.RewardNextQuest().GetUInt32()),
97 _rewardXPDifficulty(questRecord.RewardXPDifficulty().GetUInt32()),
98 _rewardXPMultiplier(questRecord.RewardXPMultiplier().GetFloat()),
99 _rewardMoneyDifficulty(questRecord.RewardMoneyDifficulty().GetUInt32()),
100 _rewardMoneyMultiplier(questRecord.RewardMoneyMultiplier().GetFloat()),
101 _rewardBonusMoney(questRecord.RewardBonusMoney().GetUInt32()),
102 _rewardSpell(questRecord.RewardSpell().GetUInt32()),
103 _rewardHonor(questRecord.RewardHonor().GetUInt32()),
104 _rewardKillHonor(questRecord.RewardKillHonor().GetUInt32()),
105 _rewardFavor(questRecord.RewardFavor().GetInt32()),
106 _rewardArtifactXPDifficulty(questRecord.RewardArtifactXPDifficulty().GetUInt32()),
107 _rewardArtifactXPMultiplier(questRecord.RewardArtifactXPMultiplier().GetFloat()),
108 _rewardArtifactCategoryID(questRecord.RewardArtifactCategoryID().GetUInt32()),
109 _sourceItemId(questRecord.StartItem().GetUInt32()),
110 _flags(questRecord.Flags().GetUInt32()),
111 _flagsEx(questRecord.FlagsEx().GetUInt32()),
112 _flagsEx2(questRecord.FlagsEx2().GetUInt32()),
113 _flagsEx3(questRecord.FlagsEx3().GetUInt32()),
114 _poiContinent(questRecord.POIContinent().GetUInt32()),
115 _poix(questRecord.POIx().GetFloat()),
116 _poiy(questRecord.POIy().GetFloat()),
117 _poiPriority(questRecord.POIPriority().GetUInt32()),
118 _rewardTitleId(questRecord.RewardTitle().GetUInt32()),
119 _rewardArenaPoints(questRecord.RewardArenaPoints().GetUInt32()),
120 _rewardSkillId(questRecord.RewardSkillLineID().GetUInt32()),
121 _rewardSkillPoints(questRecord.RewardNumSkillUps().GetUInt32()),
122 _questGiverPortrait(questRecord.PortraitGiver().GetUInt32()),
123 _questGiverPortraitMount(questRecord.PortraitGiverMount().GetUInt32()),
124 _questGiverPortraitModelSceneId(questRecord.PortraitGiverModelSceneID().GetInt32()),
125 _questTurnInPortrait(questRecord.PortraitTurnIn().GetUInt32()),
126 _rewardReputationMask(questRecord.RewardFactionFlags().GetUInt32()),
127 _soundAccept(questRecord.AcceptedSoundKitID().GetUInt32()),
128 _soundTurnIn(questRecord.CompleteSoundKitID().GetUInt32()),
129 _areaGroupID(questRecord.AreaGroupID().GetUInt32()),
130 _limitTime(questRecord.TimeAllowed().GetInt64()),
131 _allowableRaces({ .RawValue = advstd::bit_cast<std::array<int32, 2>>(questRecord.AllowableRaces().GetUInt64()) }),
132 _expansion(questRecord.Expansion().GetInt32()),
133 _managedWorldStateID(questRecord.ManagedWorldStateID().GetInt32()),
134 _questSessionBonus(questRecord.QuestSessionBonus().GetInt32()),
135 _logTitle(questRecord.LogTitle().GetStringView()),
136 _logDescription(questRecord.LogDescription().GetStringView()),
137 _questDescription(questRecord.QuestDescription().GetStringView()),
138 _areaDescription(questRecord.AreaDescription().GetStringView()),
139 _portraitGiverText(questRecord.PortraitGiverText().GetStringView()),
140 _portraitGiverName(questRecord.PortraitGiverName().GetStringView()),
141 _portraitTurnInText(questRecord.PortraitTurnInText().GetStringView()),
142 _portraitTurnInName(questRecord.PortraitTurnInName().GetStringView()),
143 _questCompletionLog(questRecord.QuestCompletionLog().GetStringView()),
144 _resetByScheduler(questRecord.ResetByScheduler().GetBool())
145{
146}
147
149{
150 for (QuestObjective& objective : Objectives)
151 delete objective.CompletionEffect;
152}
153
155{
156 uint32 spellId = fields[1].GetUInt32();
157 uint32 playerConditionId = fields[2].GetUInt32();
158 uint32 type = fields[3].GetUInt32();
159
160 if (!sSpellMgr->GetSpellInfo(spellId, DIFFICULTY_NONE))
161 {
162 TC_LOG_ERROR("sql.sql", "Table `quest_reward_display_spell` has non-existing Spell ({}) set for quest {}. Skipped.", spellId, fields[0].GetUInt32());
163 return;
164 }
165
166 if (playerConditionId && !sPlayerConditionStore.LookupEntry(playerConditionId))
167 {
168 if (!sConditionMgr->HasConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_PLAYER_CONDITION, playerConditionId))
169 {
170 TC_LOG_ERROR("sql.sql", "Table `quest_reward_display_spell` has serverside PlayerCondition ({}) set for quest {} and spell {} without conditions. Set to 0.", playerConditionId, fields[0].GetUInt32(), spellId);
171 playerConditionId = 0;
172 }
173 }
174
176 {
177 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);
179 }
180
181 RewardDisplaySpell.emplace_back(spellId, playerConditionId, QuestCompleteSpellType(type));
182}
183
185{
186 for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
187 RewardChoiceItemType[i] = LootItemType(fields[1 + i].GetUInt8());
188}
189
191{
192 for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i)
193 {
194 if (!sEmotesStore.LookupEntry(fields[1 + i].GetUInt16()))
195 {
196 TC_LOG_ERROR("sql.sql", "Table `quest_details` has non-existing Emote{} ({}) set for quest {}. Skipped.", 1+i, fields[1+i].GetUInt16(), fields[0].GetUInt32());
197 continue;
198 }
199
200 DetailsEmote[i] = fields[1 + i].GetUInt16();
201 }
202
203 for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i)
204 DetailsEmoteDelay[i] = fields[5 + i].GetUInt32();
205}
206
208{
209 _emoteOnComplete = fields[1].GetUInt16();
210 _emoteOnIncomplete = fields[2].GetUInt16();
211
212 if (!sEmotesStore.LookupEntry(_emoteOnComplete))
213 TC_LOG_ERROR("sql.sql", "Table `quest_request_items` has non-existing EmoteOnComplete ({}) set for quest {}.", _emoteOnComplete, fields[0].GetUInt32());
214
215 if (!sEmotesStore.LookupEntry(_emoteOnIncomplete))
216 TC_LOG_ERROR("sql.sql", "Table `quest_request_items` has non-existing EmoteOnIncomplete ({}) set for quest {}.", _emoteOnIncomplete, fields[0].GetUInt32());
217
218 _emoteOnCompleteDelay = fields[3].GetUInt32();
220 _requestItemsText = fields[5].GetStringView();
221}
222
224{
225 for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i)
226 {
227 if (!sEmotesStore.LookupEntry(fields[1 + i].GetUInt16()))
228 {
229 TC_LOG_ERROR("sql.sql", "Table `quest_offer_reward` has non-existing Emote{} ({}) set for quest {}. Skipped.", 1+i, fields[1+i].GetUInt16(), fields[0].GetUInt32());
230 continue;
231 }
232
233 OfferRewardEmote[i] = fields[1 + i].GetInt16();
234 }
235
236 for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i)
237 OfferRewardEmoteDelay[i] = fields[5 + i].GetUInt32();
238
239 _offerRewardText = fields[9].GetStringView();
240}
241
243{
244 _maxLevel = fields[1].GetUInt8();
245 _allowableClasses = fields[2].GetUInt32();
246 _sourceSpellID = fields[3].GetUInt32();
247 _prevQuestID = fields[4].GetInt32();
248 _nextQuestID = fields[5].GetUInt32();
249 _exclusiveGroup = fields[6].GetInt32();
250 _breadcrumbForQuestId = fields[7].GetInt32();
251 _rewardMailTemplateId = fields[8].GetUInt32();
252 _rewardMailDelay = fields[9].GetUInt32();
253 _requiredSkillId = fields[10].GetUInt16();
254 _requiredSkillPoints = fields[11].GetUInt16();
255 _requiredMinRepFaction = fields[12].GetUInt16();
256 _requiredMaxRepFaction = fields[13].GetUInt16();
257 _requiredMinRepValue = fields[14].GetInt32();
258 _requiredMaxRepValue = fields[15].GetInt32();
259 _sourceItemIdCount = fields[16].GetUInt8();
260 _specialFlags = fields[17].GetUInt8();
261 _scriptId = sObjectMgr->GetScriptId(fields[18].GetStringView());
262
265}
266
268{
269 _rewardMailSenderEntry = fields[1].GetUInt32();
270}
271
273{
274 QuestObjective& obj = Objectives.emplace_back();
275 obj.QuestID = fields[0].GetUInt32();
276 obj.ID = fields[1].GetUInt32();
277 obj.Type = fields[2].GetUInt8();
278 obj.StorageIndex = fields[3].GetInt8();
279 obj.ObjectID = fields[4].GetInt32();
280 obj.Amount = fields[5].GetInt32();
281 obj.ConditionalAmount = fields[6].GetInt32();
282 obj.Flags = fields[7].GetUInt32();
283 obj.Flags2 = fields[8].GetUInt32();
284 obj.ProgressBarWeight = fields[9].GetFloat();
285 obj.ParentObjectiveID = fields[10].GetInt32();
286 obj.Visible = fields[11].GetBool();
287 obj.Description = fields[12].GetStringView();
288
289 bool hasCompletionEffect = std::any_of(fields + 13, fields + 18, [](Field const& f) { return !f.IsNull(); });
290 if (hasCompletionEffect)
291 {
293 obj.CompletionEffect->GameEventId = fields[13].GetUInt32OrNull();
294 obj.CompletionEffect->SpellId = fields[14].GetUInt32OrNull();
296 obj.CompletionEffect->UpdatePhaseShift = fields[16].GetBool();
297 obj.CompletionEffect->UpdateZoneAuras = fields[17].GetBool();
298 }
299
300 _usedQuestObjectiveTypes[obj.Type] = true;
301}
302
304{
305 uint32 objID = fields[1].GetUInt32();
306
307 for (QuestObjective& obj : Objectives)
308 {
309 if (obj.ID == objID)
310 {
311 uint8 effectIndex = fields[3].GetUInt8();
312 if (effectIndex >= obj.VisualEffects.size())
313 obj.VisualEffects.resize(effectIndex + 1, 0);
314
315 obj.VisualEffects[effectIndex] = fields[4].GetInt32();
316 break;
317 }
318 }
319}
320
322{
323 LocaleConstant locale = GetLocaleByName(fields[4].GetStringView());
324 if (!sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) && locale != DEFAULT_LOCALE)
325 return;
326
327 if (locale >= TOTAL_LOCALES)
328 {
329 TC_LOG_ERROR("sql.sql", "Table `quest_description_conditional` has invalid locale {} set for quest {}. Skipped.", fields[4].GetCString(), fields[0].GetUInt32());
330 return;
331 }
332
333 auto itr = std::find_if(_conditionalQuestDescription.begin(), _conditionalQuestDescription.end(), [fields](QuestConditionalText const& text)
334 {
335 return text.PlayerConditionId == fields[1].GetInt32() && text.QuestgiverCreatureId == fields[2].GetInt32();
336 });
337
338 QuestConditionalText& text = itr != _conditionalQuestDescription.end() ? *itr : _conditionalQuestDescription.emplace_back();
339 text.PlayerConditionId = fields[1].GetInt32();
340 text.QuestgiverCreatureId = fields[2].GetInt32();
341 ObjectMgr::AddLocaleString(fields[3].GetStringView(), locale, text.Text);
342}
343
345{
346 LocaleConstant locale = GetLocaleByName(fields[4].GetStringView());
347 if (!sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) && locale != DEFAULT_LOCALE)
348 return;
349
350 if (locale >= TOTAL_LOCALES)
351 {
352 TC_LOG_ERROR("sql.sql", "Table `quest_request_items_conditional` has invalid locale {} set for quest {}. Skipped.", fields[4].GetCString(), fields[0].GetUInt32());
353 return;
354 }
355
356 auto itr = std::find_if(_conditionalRequestItemsText.begin(), _conditionalRequestItemsText.end(), [fields](QuestConditionalText const& text)
357 {
358 return text.PlayerConditionId == fields[1].GetInt32() && text.QuestgiverCreatureId == fields[2].GetInt32();
359 });
360
361 QuestConditionalText& text = itr != _conditionalRequestItemsText.end() ? *itr : _conditionalRequestItemsText.emplace_back();
362 text.PlayerConditionId = fields[1].GetInt32();
363 text.QuestgiverCreatureId = fields[2].GetInt32();
364 ObjectMgr::AddLocaleString(fields[3].GetStringView(), locale, text.Text);
365}
366
368{
369 LocaleConstant locale = GetLocaleByName(fields[4].GetStringView());
370 if (!sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) && locale != DEFAULT_LOCALE)
371 return;
372
373 if (locale >= TOTAL_LOCALES)
374 {
375 TC_LOG_ERROR("sql.sql", "Table `quest_offer_reward_conditional` has invalid locale {} set for quest {}. Skipped.", fields[4].GetCString(), fields[0].GetUInt32());
376 return;
377 }
378
379 auto itr = std::find_if(_conditionalOfferRewardText.begin(), _conditionalOfferRewardText.end(), [fields](QuestConditionalText const& text)
380 {
381 return text.PlayerConditionId == fields[1].GetInt32() && text.QuestgiverCreatureId == fields[2].GetInt32();
382 });
383
384 QuestConditionalText& text = itr != _conditionalOfferRewardText.end() ? *itr : _conditionalOfferRewardText.emplace_back();
385 text.PlayerConditionId = fields[1].GetInt32();
386 text.QuestgiverCreatureId = fields[2].GetInt32();
387 ObjectMgr::AddLocaleString(fields[3].GetStringView(), locale, text.Text);
388}
389
391{
392 LocaleConstant locale = GetLocaleByName(fields[4].GetStringView());
393 if (!sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) && locale != DEFAULT_LOCALE)
394 return;
395
396 if (locale >= TOTAL_LOCALES)
397 {
398 TC_LOG_ERROR("sql.sql", "Table `quest_completion_log_conditional` has invalid locale {} set for quest {}. Skipped.", fields[4].GetCString(), fields[0].GetUInt32());
399 return;
400 }
401
402 auto itr = std::find_if(_conditionalQuestCompletionLog.begin(), _conditionalQuestCompletionLog.end(), [fields](QuestConditionalText const& text)
403 {
404 return text.PlayerConditionId == fields[1].GetInt32() && text.QuestgiverCreatureId == fields[2].GetInt32();
405 });
406
408 text.PlayerConditionId = fields[1].GetInt32();
409 text.QuestgiverCreatureId = fields[2].GetInt32();
410 ObjectMgr::AddLocaleString(fields[3].GetStringView(), locale, text.Text);
411}
412
414{
415 _treasurePickerID.push_back(fields[1].GetInt32());
416}
417
419{
420 _rewardHouseRoomIDs.push_back(fields[1].GetInt32());
421}
422
424{
425 _rewardHouseDecorIDs.push_back(fields[1].GetInt32());
426}
427
432
433uint32 Quest::XPValue(Player const* player, uint32 contentTuningId, uint32 xpDifficulty, float xpMultiplier /*= 1.0f*/, int32 expansion /*= -1*/)
434{
435 if (player)
436 {
437 uint32 questLevel = player->GetQuestLevel(contentTuningId);
438 QuestXPEntry const* questXp = sQuestXPStore.LookupEntry(questLevel);
439 if (!questXp || xpDifficulty >= 10)
440 return 0;
441
442 uint32 xp = questXp->Difficulty[xpDifficulty];
443 if (ContentTuningEntry const* contentTuning = sContentTuningStore.LookupEntry(contentTuningId))
444 xp = xp * contentTuning->QuestXpMultiplier;
445
446 int32 diffFactor = 2 * (questLevel - player->GetLevel()) + 12;
447 if (diffFactor < 1)
448 diffFactor = 1;
449 else if (diffFactor > 10)
450 diffFactor = 10;
451
452 xp = diffFactor * xp * xpMultiplier / 10;
453 if (player->GetLevel() >= GetMaxLevelForExpansion(CURRENT_EXPANSION - 1) && player->GetSession()->GetExpansion() == CURRENT_EXPANSION && expansion >= 0 && expansion < CURRENT_EXPANSION)
454 xp = uint32(xp / 9.0f);
455
456 xp = RoundXPValue(xp);
457
458 if (sWorld->getIntConfig(CONFIG_MIN_QUEST_SCALED_XP_RATIO))
459 {
460 uint32 minScaledXP = RoundXPValue(questXp->Difficulty[xpDifficulty] * xpMultiplier) * sWorld->getIntConfig(CONFIG_MIN_QUEST_SCALED_XP_RATIO) / 100;
461 xp = std::max(minScaledXP, xp);
462 }
463
464 return xp;
465 }
466
467 return 0;
468}
469
470/*static*/ bool Quest::IsTakingQuestEnabled(uint32 questId)
471{
472 if (!sQuestPoolMgr->IsQuestActive(questId))
473 return false;
474
475 return true;
476}
477
478uint32 Quest::MoneyValue(Player const* player) const
479{
480 if (QuestMoneyRewardEntry const* money = sQuestMoneyRewardStore.LookupEntry(player->GetQuestLevel(this)))
481 return money->Difficulty[GetRewMoneyDifficulty()] * GetMoneyMultiplier();
482 else
483 return 0;
484}
485
487{
488 uint32 value = 0;
489 if (Optional<ContentTuningLevels> questLevels = sDB2Manager.GetContentTuningData(GetContentTuningId(), {}))
490 if (QuestMoneyRewardEntry const* money = sQuestMoneyRewardStore.LookupEntry(questLevels->MaxLevel))
491 value = money->Difficulty[GetRewMoneyDifficulty()] * GetMoneyMultiplier();
492
493 return value;
494}
495
497{
498 return MaxMoneyValue() * sWorld->getRate(RATE_MONEY_QUEST);
499}
500
502{
503 if (QuestInfoEntry const* questInfo = sQuestInfoStore.LookupEntry(GetQuestInfoID()))
504 return static_cast<QuestTagType>(questInfo->Type);
505
506 return {};
507}
508
510{
511 if (QuestInfoEntry const* questInfo = sQuestInfoStore.LookupEntry(GetQuestInfoID()))
512 return (questInfo->Modifiers & 0x400) != 0;
513
514 return false;
515}
516
517bool Quest::IsMeta() const
518{
519 if (QuestInfoEntry const* questInfo = sQuestInfoStore.LookupEntry(GetQuestInfoID()))
520 return (questInfo->Modifiers & 0x800) != 0;
521
522 return false;
523}
524
526{
528 rewards.ItemCount = GetRewItemsCount();
529 rewards.Money = player->GetQuestMoneyReward(this);
530 rewards.XP = player->GetQuestXPReward(this);
532 rewards.Title = GetRewTitle();
534 auto displaySpellItr = rewards.SpellCompletionDisplayID.begin();
536 {
537 if (!ConditionMgr::IsPlayerMeetingCondition(player, displaySpell.PlayerConditionId))
538 continue;
539
540 *displaySpellItr = displaySpell.SpellId;
541 if (++displaySpellItr == rewards.SpellCompletionDisplayID.end())
542 break;
543 }
544
545 rewards.SpellCompletionID = GetRewSpell();
546 rewards.SkillLineID = GetRewardSkillId();
549
550 for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
551 {
552 rewards.ChoiceItems[i].LootItemType = RewardChoiceItemType[i];
553 rewards.ChoiceItems[i].Item.ItemID = RewardChoiceItemId[i];
554 rewards.ChoiceItems[i].Quantity = RewardChoiceItemCount[i];
555 }
556
557 for (uint32 i = 0; i < QUEST_REWARD_ITEM_COUNT; ++i)
558 {
559 rewards.Items[i].ItemID = RewardItemId[i];
560 rewards.Items[i].ItemQty = RewardItemCount[i];
561 }
562
563 for (uint32 i = 0; i < QUEST_REWARD_REPUTATIONS_COUNT; ++i)
564 {
565 rewards.FactionID[i] = RewardFactionId[i];
566 rewards.FactionValue[i] = RewardFactionValue[i];
568 rewards.FactionCapIn[i] = RewardFactionCapIn[i];
569 }
570
571 for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
572 {
573 rewards.Currencies[i].CurrencyID = RewardCurrencyId[i];
574 rewards.Currencies[i].CurrencyQty = RewardCurrencyCount[i];
575 }
576}
577
579{
580 // If Quest has flag to not give money on max level, it's 0
582 return 0;
583
584 // Else, return the rewarded copper sum modified by the rate
586}
587
589{
591}
592
593bool Quest::IsTurnIn() const
594{
596}
597
598bool Quest::IsRaidQuest(Difficulty difficulty) const
599{
600 switch (_questInfoID)
601 {
602 case QUEST_INFO_RAID:
603 return true;
605 return difficulty == DIFFICULTY_10_N || difficulty == DIFFICULTY_10_HC;
607 return difficulty == DIFFICULTY_25_N || difficulty == DIFFICULTY_25_HC;
608 default:
609 break;
610 }
611
613 return true;
614
615 return false;
616}
617
618bool Quest::IsAllowedInRaid(Difficulty difficulty) const
619{
620 if (IsRaidQuest(difficulty))
621 return true;
622
623 return sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_RAID);
624}
625
627{
628 uint32 honor = 0;
629
630 /*if (GetRewHonorAddition() > 0 || GetRewHonorMultiplier() > 0.0f)
631 {
632 // values stored from 0.. for 1...
633 TeamContributionPointsEntry const* tc = sTeamContributionPointsStore.LookupEntry(level);
634 if (!tc)
635 return 0;
636
637 honor = uint32(tc->Data * GetRewHonorMultiplier() * 0.1f);
638 honor += GetRewHonorAddition();
639 }*/
640
641 return honor;
642}
643
645{
646 // Dungeon Finder/Daily/Repeatable (if not weekly, monthly or seasonal) quests are never considered rewarded serverside.
647 // This affects counters and client requests for completed quests.
648 return (!IsDFQuest() && !IsDaily() && (!IsRepeatable() || IsWeekly() || IsMonthly() || IsSeasonal()));
649}
650
652{
653 QueryData = std::make_unique<WorldPacket[]>(TOTAL_LOCALES);
654
655 for (uint8 loc = LOCALE_enUS; loc < TOTAL_LOCALES; ++loc)
656 {
657 if (!sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) && loc != DEFAULT_LOCALE)
658 continue;
659
660 QueryData[loc] = BuildQueryData(static_cast<LocaleConstant>(loc), nullptr);
661 }
662}
663
665{
667
668 response.Allow = true;
669 response.QuestID = GetQuestId();
670
671 response.Info.LogTitle = GetLogTitle();
680 std::ranges::transform(GetConditionalQuestDescription(), std::back_inserter(response.Info.ConditionalQuestDescription), [loc](QuestConditionalText const& text) -> WorldPackets::Quest::ConditionalQuestText
681 {
682 std::string_view content = text.Text[LOCALE_enUS];
683 ObjectMgr::GetLocaleString(text.Text, loc, content);
684 return { .PlayerConditionID = text.PlayerConditionId, .QuestGiverCreatureID = text.QuestgiverCreatureId, .Text = content };
685 });
686
687 std::ranges::transform(GetConditionalQuestCompletionLog(), std::back_inserter(response.Info.ConditionalQuestCompletionLog), [loc](QuestConditionalText const& text) -> WorldPackets::Quest::ConditionalQuestText
688 {
689 std::string_view content = text.Text[LOCALE_enUS];
690 ObjectMgr::GetLocaleString(text.Text, loc, content);
691 return { .PlayerConditionID = text.PlayerConditionId, .QuestGiverCreatureID = text.QuestgiverCreatureId, .Text = content };
692 });
693
694 if (loc != LOCALE_enUS)
695 {
696 if (QuestTemplateLocale const* questTemplateLocale = sObjectMgr->GetQuestLocale(GetQuestId()))
697 {
698 ObjectMgr::GetLocaleString(questTemplateLocale->LogTitle, loc, response.Info.LogTitle);
699 ObjectMgr::GetLocaleString(questTemplateLocale->LogDescription, loc, response.Info.LogDescription);
700 ObjectMgr::GetLocaleString(questTemplateLocale->QuestDescription, loc, response.Info.QuestDescription);
701 ObjectMgr::GetLocaleString(questTemplateLocale->AreaDescription, loc, response.Info.AreaDescription);
702 ObjectMgr::GetLocaleString(questTemplateLocale->QuestCompletionLog, loc, response.Info.QuestCompletionLog);
703 ObjectMgr::GetLocaleString(questTemplateLocale->PortraitGiverText, loc, response.Info.PortraitGiverText);
704 ObjectMgr::GetLocaleString(questTemplateLocale->PortraitGiverName, loc, response.Info.PortraitGiverName);
705 ObjectMgr::GetLocaleString(questTemplateLocale->PortraitTurnInText, loc, response.Info.PortraitTurnInText);
706 ObjectMgr::GetLocaleString(questTemplateLocale->PortraitTurnInName, loc, response.Info.PortraitTurnInName);
707 }
708 }
709
710 response.Info.QuestID = GetQuestId();
711 response.Info.QuestType = GetQuestType();
712 response.Info.ContentTuningID = GetContentTuningId();
713 response.Info.QuestPackageID = GetQuestPackageID();
714 response.Info.QuestSortID = GetZoneOrSort();
715 response.Info.QuestInfoID = GetQuestInfoID();
716 response.Info.SuggestedGroupNum = GetSuggestedPlayers();
717 response.Info.RewardNextQuest = GetNextQuestInChain();
718 response.Info.RewardXPDifficulty = GetXPDifficulty();
719 response.Info.RewardXPMultiplier = GetXPMultiplier();
720
721 if (!HasFlag(QUEST_FLAGS_HIDE_REWARD))
722 response.Info.RewardMoney = player ? player->GetQuestMoneyReward(this) : GetMaxMoneyReward();
723
724 response.Info.RewardMoneyDifficulty = GetRewMoneyDifficulty();
725 response.Info.RewardMoneyMultiplier = GetMoneyMultiplier();
726 response.Info.RewardBonusMoney = GetRewMoneyMaxLevel();
727 for (QuestRewardDisplaySpell displaySpell : RewardDisplaySpell)
728 {
729 WorldPackets::Quest::QuestCompleteDisplaySpell& rewardDisplaySpell = response.Info.RewardDisplaySpell.emplace_back();
730 rewardDisplaySpell.SpellID = displaySpell.SpellId;
731 rewardDisplaySpell.PlayerConditionID = displaySpell.PlayerConditionId;
732 rewardDisplaySpell.Type = int32(displaySpell.Type);
733 }
734
735 response.Info.RewardSpell = GetRewSpell();
736
737 response.Info.RewardHonor = GetRewHonor();
738 response.Info.RewardKillHonor = GetRewKillHonor();
739
740 response.Info.RewardFavor = GetRewardFavor();
741
742 response.Info.RewardArtifactXPDifficulty = GetArtifactXPDifficulty();
743 response.Info.RewardArtifactXPMultiplier = GetArtifactXPMultiplier();
744 response.Info.RewardArtifactCategoryID = GetArtifactCategoryId();
745
746 response.Info.StartItem = GetSrcItemId();
747 response.Info.Flags = GetFlags();
748 response.Info.FlagsEx = GetFlagsEx();
749 response.Info.FlagsEx2 = GetFlagsEx2();
750 response.Info.FlagsEx3 = GetFlagsEx3();
751 response.Info.RewardTitle = GetRewTitle();
752 response.Info.RewardArenaPoints = GetRewArenaPoints();
753 response.Info.RewardSkillLineID = GetRewardSkillId();
754 response.Info.RewardNumSkillUps = GetRewardSkillPoints();
755 response.Info.RewardFactionFlags = GetRewardReputationMask();
756 response.Info.PortraitGiver = GetQuestGiverPortrait();
757 response.Info.PortraitGiverMount = GetQuestGiverPortraitMount();
758 response.Info.PortraitGiverModelSceneID = GetQuestGiverPortraitModelSceneId();
759 response.Info.PortraitTurnIn = GetQuestTurnInPortrait();
760
761 for (uint8 i = 0; i < QUEST_ITEM_DROP_COUNT; ++i)
762 {
763 response.Info.ItemDrop[i] = ItemDrop[i];
764 response.Info.ItemDropQuantity[i] = ItemDropQuantity[i];
765 }
766
767 if (!HasFlag(QUEST_FLAGS_HIDE_REWARD))
768 {
769 for (uint8 i = 0; i < QUEST_REWARD_ITEM_COUNT; ++i)
770 {
771 response.Info.RewardItems[i] = RewardItemId[i];
772 response.Info.RewardAmount[i] = RewardItemCount[i];
773 }
774 for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
775 {
776 response.Info.UnfilteredChoiceItems[i].ItemID = RewardChoiceItemId[i];
777 response.Info.UnfilteredChoiceItems[i].Quantity = RewardChoiceItemCount[i];
778 }
779 }
780
781 for (uint8 i = 0; i < QUEST_REWARD_REPUTATIONS_COUNT; ++i)
782 {
783 response.Info.RewardFactionID[i] = RewardFactionId[i];
784 response.Info.RewardFactionValue[i] = RewardFactionValue[i];
785 response.Info.RewardFactionOverride[i] = RewardFactionOverride[i];
786 response.Info.RewardFactionCapIn[i] = RewardFactionCapIn[i];
787 }
788
789 response.Info.POIContinent = GetPOIContinent();
790 response.Info.POIx = GetPOIx();
791 response.Info.POIy = GetPOIy();
792 response.Info.POIPriority = GetPOIPriority();
793
794 response.Info.AllowableRaces = GetAllowableRaces();
795 response.Info.TreasurePickerID = GetTreasurePickerId();
796 response.Info.Expansion = GetExpansion();
797 response.Info.ManagedWorldStateID = GetManagedWorldStateId();
798 response.Info.QuestSessionBonus = 0; //GetQuestSessionBonus(); // this is only sent while quest session is active
799 response.Info.QuestGiverCreatureID = 0; // only sent during npc interaction
800 response.Info.RewardHouseRoomIDs = GetRewardHouseRoomIds();
801 response.Info.RewardHouseDecorIDs = GetRewardRewardHouseDecorIds();
802
803 response.Info.Objectives.resize(GetObjectives().size());
804 for (std::size_t i = 0; i < GetObjectives().size(); ++i)
805 {
806 QuestObjective const& questObjective = GetObjectives()[i];
807 WorldPackets::Quest::QuestInfoObjective& responseObjective = response.Info.Objectives[i];
808
809 responseObjective.ID = questObjective.ID;
810 responseObjective.QuestID = questObjective.QuestID;
811 responseObjective.Type = questObjective.Type;
812 responseObjective.StorageIndex = questObjective.StorageIndex;
813 responseObjective.ObjectID = questObjective.ObjectID;
814 responseObjective.Amount = questObjective.Amount;
815 responseObjective.ConditionalAmount = questObjective.ConditionalAmount;
816 responseObjective.Flags = questObjective.Flags;
817 responseObjective.Flags2 = questObjective.Flags2;
818 responseObjective.ProgressBarWeight = questObjective.ProgressBarWeight;
819 responseObjective.ParentObjectiveID = questObjective.ParentObjectiveID;
820 responseObjective.Visible = questObjective.Visible;
821 responseObjective.Description = questObjective.Description;
822 responseObjective.VisualEffects = questObjective.VisualEffects;
823
824 if (loc != LOCALE_enUS)
825 {
826 if (QuestObjectivesLocale const* questObjectivesLocale = sObjectMgr->GetQuestObjectivesLocale(questObjective.ID))
827 ObjectMgr::GetLocaleString(questObjectivesLocale->Description, loc, responseObjective.Description);
828 }
829 }
830
831 for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
832 {
833 response.Info.RewardCurrencyID[i] = RewardCurrencyId[i];
834 response.Info.RewardCurrencyQty[i] = RewardCurrencyCount[i];
835 }
836
837 response.Info.AcceptedSoundKitID = GetSoundAccept();
838 response.Info.CompleteSoundKitID = GetSoundTurnIn();
839 response.Info.AreaGroupID = GetAreaGroupID();
840 response.Info.TimeAllowed = GetLimitTime();
841 response.Info.ResetByScheduler = IsResetByScheduler();
842
843 response.Write();
844 response.ShrinkToFit();
845 return response.Move();
846}
847
849{
850 if (xp <= 100)
851 return 5 * ((xp + 2) / 5);
852 else if (xp <= 500)
853 return 10 * ((xp + 5) / 10);
854 else if (xp <= 1000)
855 return 25 * ((xp + 12) / 25);
856 else
857 return 50 * ((xp + 25) / 50);
858}
LocaleConstant GetLocaleByName(std::string_view name)
Definition Common.cpp:36
LocaleConstant
Definition Common.h:51
@ TOTAL_LOCALES
Definition Common.h:65
@ LOCALE_enUS
Definition Common.h:52
#define DEFAULT_LOCALE
Definition Common.h:69
#define sConditionMgr
@ CONDITION_SOURCE_TYPE_PLAYER_CONDITION
DB2Storage< QuestMoneyRewardEntry > sQuestMoneyRewardStore("QuestMoneyReward.db2", &QuestMoneyRewardLoadInfo::Instance)
DB2Storage< QuestInfoEntry > sQuestInfoStore("QuestInfo.db2", &QuestInfoLoadInfo::Instance)
DB2Storage< EmotesEntry > sEmotesStore("Emotes.db2", &EmotesLoadInfo::Instance)
DB2Storage< QuestXPEntry > sQuestXPStore("QuestXP.db2", &QuestXpLoadInfo::Instance)
DB2Storage< PlayerConditionEntry > sPlayerConditionStore("PlayerCondition.db2", &PlayerConditionLoadInfo::Instance)
DB2Storage< ContentTuningEntry > sContentTuningStore("ContentTuning.db2", &ContentTuningLoadInfo::Instance)
#define sDB2Manager
Definition DB2Stores.h:569
Difficulty
Definition DBCEnums.h:932
@ DIFFICULTY_NONE
Definition DBCEnums.h:933
@ DIFFICULTY_25_HC
Definition DBCEnums.h:939
@ DIFFICULTY_10_N
Definition DBCEnums.h:936
@ DIFFICULTY_25_N
Definition DBCEnums.h:937
@ DIFFICULTY_10_HC
Definition DBCEnums.h:938
std::shared_ptr< ResultSet > QueryResult
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
#define TC_LOG_ERROR(filterType__, message__,...)
Definition Log.h:190
LootItemType
#define sObjectMgr
Definition ObjectMgr.h:1885
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:25
#define DEFINE_FIELD_ACCESSOR_CACHE(namespace_name, struct_name, result_type, fields_list)
#define QUEST_TEMPLATE_FIELDS
Definition QuestDef.cpp:34
QuestCompleteSpellType
Definition QuestDef.h:405
QuestTagType
Definition QuestDef.h:337
#define QUEST_ITEM_DROP_COUNT
Definition QuestDef.h:48
#define QUEST_REWARD_ITEM_COUNT
Definition QuestDef.h:50
#define QUEST_REWARD_REPUTATIONS_COUNT
Definition QuestDef.h:52
#define QUEST_EMOTE_COUNT
Definition QuestDef.h:53
#define QUEST_REWARD_CURRENCY_COUNT
Definition QuestDef.h:54
#define QUEST_REWARD_CHOICES_COUNT
Definition QuestDef.h:49
@ QUEST_FLAGS_RAID_GROUP_OK
Definition QuestDef.h:224
@ QUEST_FLAGS_AUTO_ACCEPT
Definition QuestDef.h:237
@ QUEST_FLAGS_HIDE_REWARD
Definition QuestDef.h:227
@ QUEST_FLAGS_NO_MONEY_FOR_XP
Definition QuestDef.h:226
@ QUEST_SPECIAL_FLAGS_AUTO_ACCEPT
Definition QuestDef.h:326
#define sQuestPoolMgr
Definition QuestPools.h:68
#define CURRENT_EXPANSION
constexpr uint32 GetMaxLevelForExpansion(uint32 expansion)
@ QUEST_INFO_RAID_10
@ QUEST_INFO_RAID_25
@ QUEST_INFO_RAID
@ QUEST_TYPE_TURNIN
#define sSpellMgr
Definition SpellMgr.h:812
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
Definition Util.h:565
static bool IsPlayerMeetingCondition(Player const *player, uint32 conditionId)
Class used to access individual fields of database query result.
Definition Field.h:94
float GetFloat() const noexcept
Definition Field.cpp:85
int16 GetInt16() const noexcept
Definition Field.cpp:50
bool GetBool() const noexcept
Definition Field.h:102
uint32 GetUInt32() const noexcept
Definition Field.cpp:57
uint16 GetUInt16() const noexcept
Definition Field.cpp:43
std::string_view GetStringView() const noexcept
Definition Field.cpp:118
bool IsNull() const noexcept
Definition Field.h:131
uint8 GetUInt8() const noexcept
Definition Field.cpp:29
int32 GetInt32() const noexcept
Definition Field.cpp:64
Optional< uint32 > GetUInt32OrNull() const noexcept
Definition Field.cpp:164
int8 GetInt8() const noexcept
Definition Field.cpp:36
static void AddLocaleString(std::string_view value, LocaleConstant localeConstant, std::vector< std::string > &data)
static std::string_view GetLocaleString(std::vector< std::string > const &data, LocaleConstant locale)
Definition ObjectMgr.h:1611
int32 GetQuestLevel(Quest const *quest) const
Definition Player.cpp:14352
uint32 GetQuestXPReward(Quest const *quest)
Definition Player.cpp:14981
WorldSession * GetSession() const
Definition Player.h:2272
uint32 GetQuestMoneyReward(Quest const *quest) const
Definition Player.cpp:14976
uint32 _emoteOnIncomplete
Definition QuestDef.h:857
uint32 XPValue(Player const *player) const
Definition QuestDef.cpp:428
std::vector< QuestConditionalText > _conditionalRequestItemsText
Definition QuestDef.h:863
bool IsTurnIn() const
Definition QuestDef.cpp:593
int32 _prevQuestID
Definition QuestDef.h:875
uint32 GetRewSpell() const
Definition QuestDef.h:690
std::array< int32, QUEST_REWARD_REPUTATIONS_COUNT > RewardFactionValue
Definition QuestDef.h:752
uint32 GetRewMoneyMaxLevel() const
Definition QuestDef.cpp:578
uint32 GetMaxMoneyReward() const
Definition QuestDef.cpp:496
uint32 _requiredSkillPoints
Definition QuestDef.h:882
Optional< QuestTagType > GetQuestTag() const
Definition QuestDef.cpp:501
uint32 GetRewTitle() const
Definition QuestDef.h:694
std::array< LootItemType, QUEST_REWARD_CHOICES_COUNT > RewardChoiceItemType
Definition QuestDef.h:747
std::string const & GetQuestCompletionLog() const
Definition QuestDef.h:675
uint32 GetRewardSkillId() const
Definition QuestDef.h:715
Quest(QueryResult const &questRecord)
Definition QuestDef.cpp:53
bool IsMeta() const
Definition QuestDef.cpp:517
uint32 _rewardBonusMoney
Definition QuestDef.h:801
std::string const & GetPortraitGiverName() const
Definition QuestDef.h:678
std::array< uint32, QUEST_REWARD_CURRENCY_COUNT > RewardCurrencyId
Definition QuestDef.h:755
int32 _breadcrumbForQuestId
Definition QuestDef.h:878
bool IsImportant() const
Definition QuestDef.cpp:509
void LoadQuestDetails(Field *fields)
Definition QuestDef.cpp:190
std::array< uint32, QUEST_REWARD_CHOICES_COUNT > RewardChoiceItemCount
Definition QuestDef.h:749
std::string const & GetPortraitTurnInName() const
Definition QuestDef.h:680
void LoadRewardDisplaySpell(Field *fields)
Definition QuestDef.cpp:154
uint32 _sourceItemIdCount
Definition QuestDef.h:887
static bool IsTakingQuestEnabled(uint32 questId)
Definition QuestDef.cpp:470
void LoadConditionalConditionalRequestItemsText(Field *fields)
Definition QuestDef.cpp:344
uint32 MoneyValue(Player const *player) const
Definition QuestDef.cpp:478
std::array< uint32, QUEST_REWARD_CHOICES_COUNT > RewardChoiceItemId
Definition QuestDef.h:748
std::array< uint32, QUEST_EMOTE_COUNT > DetailsEmoteDelay
Definition QuestDef.h:759
void LoadQuestRequestItems(Field *fields)
Definition QuestDef.cpp:207
void BuildQuestRewards(WorldPackets::Quest::QuestRewards &rewards, Player *player) const
Definition QuestDef.cpp:525
uint32 _requiredMinRepFaction
Definition QuestDef.h:883
std::array< uint32, QUEST_REWARD_ITEM_COUNT > RewardItemId
Definition QuestDef.h:743
uint32 MaxMoneyValue() const
Definition QuestDef.cpp:486
uint32 _requiredSkillId
Definition QuestDef.h:881
uint32 GetContentTuningId() const
Definition QuestDef.h:640
int32 _requiredMinRepValue
Definition QuestDef.h:884
std::vector< int32 > _rewardHouseDecorIDs
Definition QuestDef.h:837
uint32 _flags
Definition QuestDef.h:810
void LoadConditionalConditionalQuestDescription(Field *fields)
Definition QuestDef.cpp:321
uint32 GetRewardReputationMask() const
Definition QuestDef.h:717
static uint32 RoundXPValue(uint32 xp)
Definition QuestDef.cpp:848
std::array< uint32, QUEST_REWARD_ITEM_COUNT > RewardItemCount
Definition QuestDef.h:744
std::array< int32, QUEST_REWARD_REPUTATIONS_COUNT > RewardFactionCapIn
Definition QuestDef.h:754
bool IsDFQuest() const
Definition QuestDef.h:735
void LoadQuestMailSender(Field *fields)
Definition QuestDef.cpp:267
void LoadQuestObjective(Field *fields)
Definition QuestDef.cpp:272
QuestObjectives Objectives
Definition QuestDef.h:757
uint32 _rewardXPDifficulty
Definition QuestDef.h:797
std::string _requestItemsText
Definition QuestDef.h:860
int32 _expansion
Definition QuestDef.h:833
WorldPacket BuildQueryData(LocaleConstant loc, Player *player) const
Definition QuestDef.cpp:664
bool IsRepeatable() const
Definition QuestDef.h:705
uint32 _emoteOnIncompleteDelay
Definition QuestDef.h:859
int32 _exclusiveGroup
Definition QuestDef.h:877
std::vector< int32 > const & GetTreasurePickerId() const
Definition QuestDef.h:718
std::bitset< MAX_QUEST_OBJECTIVE_TYPE > _usedQuestObjectiveTypes
Definition QuestDef.h:890
std::vector< QuestConditionalText > _conditionalQuestDescription
Definition QuestDef.h:850
uint32 GetArtifactCategoryId() const
Definition QuestDef.h:688
void LoadConditionalConditionalOfferRewardText(Field *fields)
Definition QuestDef.cpp:367
int32 _requiredMaxRepValue
Definition QuestDef.h:886
uint32 CalculateHonorGain(uint8 level) const
Definition QuestDef.cpp:626
std::string const & GetLogTitle() const
Definition QuestDef.h:666
void LoadQuestObjectiveVisualEffect(Field *fields)
Definition QuestDef.cpp:303
uint32 _requiredMaxRepFaction
Definition QuestDef.h:885
uint32 GetQuestId() const
Definition QuestDef.h:637
uint32 _questInfoID
Definition QuestDef.h:794
void LoadQuestOfferReward(Field *fields)
Definition QuestDef.cpp:223
uint32 _rewardMailDelay
Definition QuestDef.h:880
std::string const & GetPortraitGiverText() const
Definition QuestDef.h:677
uint32 _sourceSpellID
Definition QuestDef.h:874
bool IsAutoAccept() const
Definition QuestDef.cpp:588
bool IsDaily() const
Definition QuestDef.h:728
uint32 GetQuestInfoID() const
Definition QuestDef.h:643
bool IsRaidQuest(Difficulty difficulty) const
Definition QuestDef.cpp:598
std::vector< QuestConditionalText > _conditionalQuestCompletionLog
Definition QuestDef.h:853
void LoadRewardHouseDecor(Field *fields)
Definition QuestDef.cpp:423
std::string const & GetPortraitTurnInText() const
Definition QuestDef.h:679
uint32 _type
Definition QuestDef.h:790
uint32 _scriptId
Definition QuestDef.h:891
uint32 _emoteOnCompleteDelay
Definition QuestDef.h:858
uint32 _specialFlags
Definition QuestDef.h:889
float _rewardXPMultiplier
Definition QuestDef.h:798
std::vector< int32 > _treasurePickerID
Definition QuestDef.h:832
std::string const & GetLogDescription() const
Definition QuestDef.h:667
std::array< int32, QUEST_REWARD_REPUTATIONS_COUNT > RewardFactionOverride
Definition QuestDef.h:753
std::vector< int32 > _rewardHouseRoomIDs
Definition QuestDef.h:836
void InitializeQueryData()
Definition QuestDef.cpp:651
std::array< uint32, QUEST_EMOTE_COUNT > DetailsEmote
Definition QuestDef.h:758
std::array< uint32, QUEST_REWARD_REPUTATIONS_COUNT > RewardFactionId
Definition QuestDef.h:751
uint32 GetRewItemsCount() const
Definition QuestDef.h:764
std::string const & GetAreaDescription() const
Definition QuestDef.h:670
float GetMoneyMultiplier() const
Definition QuestDef.h:662
bool IsAllowedInRaid(Difficulty difficulty) const
Definition QuestDef.cpp:618
uint32 GetRewChoiceItemsCount() const
Definition QuestDef.h:763
uint32 _allowableClasses
Definition QuestDef.h:873
bool IsWeekly() const
Definition QuestDef.h:729
std::vector< QuestConditionalText > _conditionalOfferRewardText
Definition QuestDef.h:869
bool IsSeasonal() const
Definition QuestDef.h:731
std::array< int32, QUEST_EMOTE_COUNT > OfferRewardEmote
Definition QuestDef.h:760
std::unique_ptr< WorldPacket[]> QueryData
Definition QuestDef.h:781
uint32 _maxLevel
Definition QuestDef.h:872
uint32 GetRewMoneyDifficulty() const
Definition QuestDef.h:682
std::array< uint32, QUEST_REWARD_CURRENCY_COUNT > RewardCurrencyCount
Definition QuestDef.h:756
uint32 _rewardMailSenderEntry
Definition QuestDef.h:888
std::string const & GetQuestDescription() const
Definition QuestDef.h:668
uint32 _emoteOnComplete
Definition QuestDef.h:856
void LoadRewardHouseRoom(Field *fields)
Definition QuestDef.cpp:418
void LoadConditionalConditionalQuestCompletionLog(Field *fields)
Definition QuestDef.cpp:390
bool IsMonthly() const
Definition QuestDef.h:730
bool HasFlag(QuestFlags flag) const
Definition QuestDef.h:619
std::string _offerRewardText
Definition QuestDef.h:866
uint32 _rewardMailTemplateId
Definition QuestDef.h:879
uint32 GetRewardSkillPoints() const
Definition QuestDef.h:716
std::array< uint32, QUEST_EMOTE_COUNT > OfferRewardEmoteDelay
Definition QuestDef.h:761
void LoadRewardChoiceItems(Field *fields)
Definition QuestDef.cpp:184
void LoadTreasurePickers(Field *fields)
Definition QuestDef.cpp:413
std::vector< QuestRewardDisplaySpell > RewardDisplaySpell
Definition QuestDef.h:742
uint32 _nextQuestID
Definition QuestDef.h:876
std::vector< QuestConditionalText > const & GetConditionalQuestDescription() const
Definition QuestDef.h:669
void LoadQuestTemplateAddon(Field *fields)
Definition QuestDef.cpp:242
bool CanIncreaseRewardedQuestCounters() const
Definition QuestDef.cpp:644
uint8 GetLevel() const
Definition Unit.h:757
uint8 GetExpansion() const
#define sWorld
Definition World.h:916
@ CONFIG_MIN_QUEST_SCALED_XP_RATIO
Definition World.h:281
@ RATE_MONEY_MAX_LEVEL_QUEST
Definition World.h:526
@ RATE_MONEY_QUEST
Definition World.h:525
@ CONFIG_QUEST_IGNORE_AUTO_COMPLETE
Definition World.h:166
@ CONFIG_QUEST_IGNORE_RAID
Definition World.h:126
@ CONFIG_QUEST_IGNORE_AUTO_ACCEPT
Definition World.h:165
@ CONFIG_LOAD_LOCALES
Definition World.h:200
constexpr std::size_t size()
std::vector< std::string > Text
Definition QuestDef.h:572
Optional< uint32 > SpellId
Definition QuestDef.h:474
Optional< uint32 > ConversationId
Definition QuestDef.h:475
Optional< uint32 > GameEventId
Definition QuestDef.h:473
QuestObjectiveAction * CompletionEffect
Definition QuestDef.h:496
uint32 Flags2
Definition QuestDef.h:490
std::string Description
Definition QuestDef.h:494
int8 StorageIndex
Definition QuestDef.h:485
std::vector< int32 > VisualEffects
Definition QuestDef.h:495
uint32 QuestID
Definition QuestDef.h:483
int32 ParentObjectiveID
Definition QuestDef.h:492
int32 ConditionalAmount
Definition QuestDef.h:488
float ProgressBarWeight
Definition QuestDef.h:491
std::array< uint16, 10 > Difficulty
std::span< int32 const > VisualEffects
std::vector< ConditionalQuestText > ConditionalQuestDescription
std::array< int32, QUEST_REWARD_REPUTATIONS_COUNT > FactionOverride
std::array< QuestChoiceItem, QUEST_REWARD_CHOICES_COUNT > ChoiceItems
std::array< int32, QUEST_REWARD_DISPLAY_SPELL_COUNT > SpellCompletionDisplayID
std::array< QuestRewardItem, QUEST_REWARD_ITEM_COUNT > Items
std::array< int32, QUEST_REWARD_REPUTATIONS_COUNT > FactionValue
std::array< int32, QUEST_REWARD_REPUTATIONS_COUNT > FactionCapIn
std::array< int32, QUEST_REWARD_REPUTATIONS_COUNT > FactionID
std::array< QuestRewardCurrency, QUEST_REWARD_CURRENCY_COUNT > Currencies
std::span< int32 const > TreasurePickerID