Core/Quests: define several quest status flags and implement QUEST_STATUS_FLAG_KILL_OBJECTIVE_COMPLETE and QUEST_STATUS_FLAG_COLLECT_OBJECTIVE_COMPLETE
This commit is contained in:
1 parent
10062737bc
commit
a04e4612d0
2 files changed
+38
-7
No files matched your search
@@ -738,6 +738,13 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGU
|
||||
packet.SuggestPartyMembers = quest->GetSuggestedPlayers();
|
||||
packet.MoneyToGet = quest->GetRewOrReqMoney() < 0 ? -quest->GetRewOrReqMoney() : 0;
|
||||
|
||||
QuestStatusData data;
|
||||
QuestStatusMap statusMap = _session->GetPlayer()->getQuestStatusMap();
|
||||
QuestStatusMap::const_iterator itr = statusMap.find(quest->GetQuestId());
|
||||
if (itr != statusMap.end())
|
||||
data = itr->second;
|
||||
|
||||
bool collectObjectiveComplete = true;
|
||||
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
|
||||
{
|
||||
if (!quest->RequiredItemId[i])
|
||||
@@ -747,6 +754,9 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGU
|
||||
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
|
||||
displayId = itemTemplate->DisplayInfoID;
|
||||
|
||||
if (data.ItemCount[i] != quest->RequiredItemCount[i])
|
||||
collectObjectiveComplete = false;
|
||||
|
||||
packet.Collect.emplace_back(quest->RequiredItemId[i], quest->RequiredItemCount[i], displayId);
|
||||
}
|
||||
|
||||
@@ -758,13 +768,21 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGU
|
||||
packet.Currency.emplace_back(quest->RequiredCurrencyId[i], quest->RequiredCurrencyCount[i]);
|
||||
}
|
||||
|
||||
// incomplete: 0
|
||||
// complete : 2
|
||||
packet.StatusFlags[0] = canComplete ? 0x2 : 0x0;
|
||||
packet.StatusFlags[1] = 0x4;
|
||||
packet.StatusFlags[2] = 0x8;
|
||||
packet.StatusFlags[3] = 0x10;
|
||||
packet.StatusFlags[4] = 0x40;
|
||||
bool killCreditObjectiveComplete = true;
|
||||
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
|
||||
{
|
||||
if (!quest->RequiredNpcOrGo[i])
|
||||
continue;
|
||||
|
||||
if (data.CreatureOrGOCount[i] != quest->RequiredNpcOrGo[i])
|
||||
collectObjectiveComplete = false;
|
||||
}
|
||||
|
||||
packet.StatusFlags[0] = killCreditObjectiveComplete ? QUEST_STATUS_FLAG_KILL_OBJECTIVE_COMPLETE : QUEST_STATUS_FLAG_NONE;
|
||||
packet.StatusFlags[1] = collectObjectiveComplete ? QUEST_STATUS_FLAG_COLLECT_OBJECTIVE_COMPLETE : QUEST_STATUS_FLAG_NONE;
|
||||
packet.StatusFlags[2] = QUEST_STATUS_FLAG_UNK_4;
|
||||
packet.StatusFlags[3] = QUEST_STATUS_FLAG_UNK_5;
|
||||
packet.StatusFlags[4] = QUEST_STATUS_FLAG_UNK_7;
|
||||
|
||||
_session->SendPacket(packet.Write());
|
||||
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_GIVER_REQUEST_ITEMS NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
|
||||
|
||||
@@ -182,6 +182,19 @@ enum QuestSpecialFlags
|
||||
QUEST_SPECIAL_FLAGS_PLAYER_KILL = 0x800 // Internal flag computed only
|
||||
};
|
||||
|
||||
enum QuestStatusFlags
|
||||
{
|
||||
QUEST_STATUS_FLAG_NONE = 0x0,
|
||||
QUEST_STATUS_FLAG_UNK_1 = 0x1, // somewhat related to repeatable quests
|
||||
QUEST_STATUS_FLAG_KILL_OBJECTIVE_COMPLETE = 0x2, // quest has its kill credit objectives completed
|
||||
QUEST_STATUS_FLAG_COLLECT_OBJECTIVE_COMPLETE = 0x4, // quest has its collect objectives completed
|
||||
QUEST_STATUS_FLAG_UNK_4 = 0x8,
|
||||
QUEST_STATUS_FLAG_UNK_5 = 0x10,
|
||||
QUEST_STATUS_FLAG_NO_ITEM_REQUEST = 0x20, // server wont send SMSG_QUEST_GIVER_REQUEST_ITEMS
|
||||
QUEST_STATUS_FLAG_UNK_7 = 0x40,
|
||||
QUEST_STATUS_FLAG_UNK_8 = 0x80
|
||||
};
|
||||
|
||||
struct QuestLocale
|
||||
{
|
||||
QuestLocale() { ObjectiveText.resize(QUEST_OBJECTIVES_COUNT); }
|
||||
|
||||
Reference in new issue
Block a user