aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Quests/QuestDef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Quests/QuestDef.cpp')
-rw-r--r--src/server/game/Quests/QuestDef.cpp229
1 files changed, 169 insertions, 60 deletions
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index 3fefa812489..8d4f3b42e72 100644
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -19,20 +19,21 @@
#include "QuestDef.h"
#include "Player.h"
#include "World.h"
+#include "ObjectMgr.h"
Quest::Quest(Field* questRecord)
{
Id = questRecord[0].GetUInt32();
Method = questRecord[1].GetUInt8();
Level = questRecord[2].GetInt16();
- MinLevel = questRecord[3].GetUInt8();
- MaxLevel = questRecord[4].GetUInt8();
+ MinLevel = uint32(questRecord[3].GetInt16());
+ MaxLevel = uint32(questRecord[4].GetInt16());
ZoneOrSort = questRecord[5].GetInt16();
Type = questRecord[6].GetUInt16();
SuggestedPlayers = questRecord[7].GetUInt8();
LimitTime = questRecord[8].GetUInt32();
RequiredClasses = questRecord[9].GetUInt16();
- RequiredRaces = questRecord[10].GetUInt16();
+ RequiredRaces = questRecord[10].GetUInt32();
RequiredSkillId = questRecord[11].GetUInt16();
RequiredSkillPoints = questRecord[12].GetUInt16();
RequiredFactionId1 = questRecord[13].GetUInt16();
@@ -60,112 +61,147 @@ Quest::Quest(Field* questRecord)
SourceItemIdCount = questRecord[35].GetUInt8();
SourceSpellid = questRecord[36].GetUInt32();
Flags = questRecord[37].GetUInt32();
- uint32 SpecialFlags = questRecord[38].GetUInt8();
- RewardTitleId = questRecord[39].GetUInt8();
- RequiredPlayerKills = questRecord[40].GetUInt8();
- RewardTalents = questRecord[41].GetUInt8();
- RewardArenaPoints = questRecord[42].GetUInt16();
+ SpecialFlags = questRecord[38].GetUInt8();
+ MinimapTargetMark = questRecord[39].GetUInt8();
+ RewardTitleId = questRecord[40].GetUInt8();
+ RequiredPlayerKills = questRecord[41].GetUInt8();
+ RewardTalents = questRecord[42].GetUInt8();
+ RewardArenaPoints = questRecord[43].GetUInt16();
+ RewardSkillId = questRecord[44].GetUInt16();
+ RewardSkillPoints = questRecord[45].GetUInt8();
+ RewardReputationMask = questRecord[46].GetUInt8();
+ QuestGiverPortrait = questRecord[47].GetUInt32();
+ QuestTurnInPortrait = questRecord[48].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
- RewardItemId[i] = questRecord[43+i].GetUInt32();
+ RewardItemId[i] = questRecord[49+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
- RewardItemIdCount[i] = questRecord[47+i].GetUInt16();
+ RewardItemIdCount[i] = questRecord[53+i].GetUInt16();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- RewardChoiceItemId[i] = questRecord[51+i].GetUInt32();
+ RewardChoiceItemId[i] = questRecord[57+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- RewardChoiceItemCount[i] = questRecord[57+i].GetUInt16();
+ RewardChoiceItemCount[i] = questRecord[63+i].GetUInt16();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- RewardFactionId[i] = questRecord[63+i].GetUInt16();
+ RewardFactionId[i] = questRecord[69+i].GetUInt16();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- RewardFactionValueId[i] = questRecord[68+i].GetInt32();
+ RewardFactionValueId[i] = questRecord[74+i].GetInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- RewardFactionValueIdOverride[i] = questRecord[73+i].GetInt32();
-
- PointMapId = questRecord[78].GetUInt16();
- PointX = questRecord[79].GetFloat();
- PointY = questRecord[80].GetFloat();
- PointOption = questRecord[81].GetUInt32();
- Title = questRecord[82].GetString();
- Objectives = questRecord[83].GetString();
- Details = questRecord[84].GetString();
- EndText = questRecord[85].GetString();
- OfferRewardText = questRecord[86].GetString();
- RequestItemsText = questRecord[87].GetString();
- CompletedText = questRecord[88].GetString();
+ RewardFactionValueIdOverride[i] = questRecord[79+i].GetInt32();
+
+ PointMapId = questRecord[84].GetUInt16();
+ PointX = questRecord[85].GetFloat();
+ PointY = questRecord[86].GetFloat();
+ PointOption = questRecord[87].GetUInt32();
+ Title = questRecord[88].GetString();
+ Objectives = questRecord[89].GetString();
+ Details = questRecord[90].GetString();
+ EndText = questRecord[91].GetString();
+ CompletedText = questRecord[92].GetString();
+ OfferRewardText = questRecord[93].GetString();
+ RequestItemsText = questRecord[94].GetString();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- RequiredNpcOrGo[i] = questRecord[89+i].GetInt32();
+ RequiredNpcOrGo[i] = questRecord[95+i].GetInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- RequiredNpcOrGoCount[i] = questRecord[93+i].GetUInt16();
+ RequiredNpcOrGoCount[i] = questRecord[99+i].GetUInt16();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
- RequiredSourceItemId[i] = questRecord[97+i].GetUInt32();
+ RequiredSourceItemId[i] = questRecord[103+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
- RequiredSourceItemCount[i] = questRecord[101+i].GetUInt16();
+ RequiredSourceItemCount[i] = questRecord[107+i].GetUInt16();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
- RequiredItemId[i] = questRecord[105+i].GetUInt32();
+ RequiredItemId[i] = questRecord[111+i].GetUInt32();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
- RequiredItemCount[i] = questRecord[111+i].GetUInt16();
+ RequiredItemCount[i] = questRecord[117+i].GetUInt16();
- for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- RequiredSpellCast[i] = questRecord[117+i].GetUInt32();
+ RequiredSpell = questRecord[123].GetUInt32();
- // int8 Unknown0 = questRecord[121].GetUInt8();
+ for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) // To be removed
+ RequiredSpellCast[i] = questRecord[124+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- ObjectiveText[i] = questRecord[122+i].GetString();
+ ObjectiveText[i] = questRecord[128+i].GetString();
+
+ for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
+ RewardCurrencyId[i] = questRecord[132+i].GetUInt16();
+
+ for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
+ RewardCurrencyCount[i] = questRecord[136+i].GetUInt8();
+
+ for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i)
+ RequiredCurrencyId[i] = questRecord[140+i].GetUInt16();
+
+ for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i)
+ RequiredCurrencyCount[i] = questRecord[144+i].GetUInt8();
+
+ QuestGiverTextWindow = questRecord[148].GetString();
+ QuestGiverTargetName = questRecord[149].GetString();
+ QuestTurnTextWindow = questRecord[150].GetString();
+ QuestTurnTargetName = questRecord[151].GetString();
+ SoundAccept = questRecord[152].GetUInt16();
+ SoundTurnIn = questRecord[153].GetUInt16();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- DetailsEmote[i] = questRecord[126+i].GetUInt16();
+ DetailsEmote[i] = questRecord[154+i].GetUInt16();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- DetailsEmoteDelay[i] = questRecord[130+i].GetUInt32();
+ DetailsEmoteDelay[i] = questRecord[158+i].GetUInt32();
- EmoteOnIncomplete = questRecord[134].GetUInt16();
- EmoteOnComplete = questRecord[135].GetUInt16();
+ EmoteOnIncomplete = questRecord[162].GetUInt16();
+ EmoteOnComplete = questRecord[163].GetUInt16();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- OfferRewardEmote[i] = questRecord[136+i].GetInt16();
+ OfferRewardEmote[i] = questRecord[164+i].GetInt16();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- OfferRewardEmoteDelay[i] = questRecord[140+i].GetInt32();
+ OfferRewardEmoteDelay[i] = questRecord[168+i].GetInt32();
- //int32 WDBVerified = questRecord[144].GetInt32();
+ // int32 WDBVerified = questRecord[172].GetInt32();
- Flags |= SpecialFlags << 20;
- if (Flags & QUEST_TRINITY_FLAGS_AUTO_ACCEPT)
+ if (SpecialFlags & QUEST_SPECIAL_FLAGS_AUTO_ACCEPT)
Flags |= QUEST_FLAGS_AUTO_ACCEPT;
- m_reqitemscount = 0;
- m_reqCreatureOrGOcount = 0;
- m_rewitemscount = 0;
- m_rewchoiceitemscount = 0;
+ m_reqItemsCount = 0;
+ m_reqNpcOrGoCount = 0;
+ m_rewItemsCount = 0;
+ m_rewChoiceItemsCount = 0;
+ m_rewCurrencyCount = 0;
+ m_reqCurrencyCount = 0;
- for (int i=0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
+ for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
if (RequiredItemId[i])
- ++m_reqitemscount;
+ ++m_reqItemsCount;
- for (int i=0; i < QUEST_OBJECTIVES_COUNT; ++i)
+ for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
if (RequiredNpcOrGo[i])
- ++m_reqCreatureOrGOcount;
+ ++m_reqNpcOrGoCount;
- for (int i=0; i < QUEST_REWARDS_COUNT; ++i)
+ for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
if (RewardItemId[i])
- ++m_rewitemscount;
+ ++m_rewItemsCount;
- for (int i=0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
+ for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
if (RewardChoiceItemId[i])
- ++m_rewchoiceitemscount;
+ ++m_rewChoiceItemsCount;
+
+ for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
+ if (RewardCurrencyId[i])
+ ++m_rewCurrencyCount;
+
+ for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i)
+ if (RequiredCurrencyId[i])
+ ++m_reqCurrencyCount;
+
}
uint32 Quest::XPValue(Player* player) const
@@ -207,6 +243,79 @@ int32 Quest::GetRewOrReqMoney() const
return int32(RewardOrRequiredMoney * sWorld->getRate(RATE_DROP_MONEY));
}
+void Quest::BuildExtraQuestInfo(WorldPacket& data, Player* player) const
+{
+ data << uint32(GetRewChoiceItemsCount());
+ for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
+ data << uint32(RewardChoiceItemId[i]);
+ for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
+ data << uint32(RewardChoiceItemCount[i]);
+ for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
+ {
+ if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardChoiceItemId[i]))
+ data << uint32(itemTemplate->DisplayInfoID);
+ else
+ data << uint32(0);
+ }
+
+ data << uint32(GetReqItemsCount());
+ for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
+ data << uint32(RewardItemId[i]);
+ for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
+ data << uint32(RewardItemIdCount[i]);
+ for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
+ {
+ if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardItemId[i]))
+ data << uint32(itemTemplate->DisplayInfoID);
+ else
+ data << uint32(0);
+ }
+
+ data << uint32(GetRewOrReqMoney());
+ data << uint32(XPValue(player) * sWorld->getRate(RATE_XP_QUEST));
+
+ data << uint32(GetCharTitleId());
+ data << uint32(0); // unk
+ data << float(0.0f); // unk
+ data << uint32(GetBonusTalents());
+ data << uint32(0); // unk
+ data << uint32(GetRewardReputationMask());
+
+ /* Pre cata struct, some of these unks might be the missing values in cata:
+ // rewarded honor points. Multiply with 10 to satisfy client
+ data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
+ data << float(0); // unk, honor multiplier?
+ data << uint32(0x08); // unused by client?
+ data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
+ data << int32(quest->GetRewSpellCast()); // casted spell
+ data << uint32(0); // unknown
+ data << uint32(quest->GetBonusTalents()); // bonus talents
+ data << uint32(quest->GetRewArenaPoints()); // arena points
+ data << uint32(0);
+ */
+
+ for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
+ data << uint32(RewardFactionId[i]);
+
+ for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (zero based)?
+ data << int32(RewardFactionValueId[i]);
+
+ for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override?
+ data << uint32(RewardFactionValueIdOverride[i]);
+
+ data << uint32(GetRewSpell());
+ data << uint32(GetRewSpellCast());
+
+ for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
+ data << uint32(RewardCurrencyId[i]);
+
+ for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
+ data << uint32(RewardCurrencyCount[i]);
+
+ data << uint32(GetRewardSkillId());
+ data << uint32(GetRewardSkillPoints());
+}
+
uint32 Quest::GetRewMoneyMaxLevel() const
{
if (HasFlag(QUEST_FLAGS_NO_MONEY_FROM_XP))
@@ -257,7 +366,7 @@ uint32 Quest::CalculateHonorGain(uint8 level) const
uint32 honor = 0;
- if (GetRewHonorAddition() > 0 || GetRewHonorMultiplier() > 0.0f)
+ /*if (GetRewHonorAddition() > 0 || GetRewHonorMultiplier() > 0.0f)
{
// values stored from 0.. for 1...
TeamContributionPointsEntry const* tc = sTeamContributionPointsStore.LookupEntry(level);
@@ -266,7 +375,7 @@ uint32 Quest::CalculateHonorGain(uint8 level) const
honor = uint32(tc->value * GetRewHonorMultiplier() * 0.1f);
honor += GetRewHonorAddition();
- }
+ }*/
return honor;
}