mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 16:38:42 +01:00
Core/Quests: Implement CMSG_QUEST_NPC_QUERY and SMSG_QUEST_NPC_QUERY_RESPONSE
Plot twist: We don't know what these packets do (but they are used)
This commit is contained in:
@@ -419,6 +419,45 @@ void WorldSession::HandleCorpseMapPositionQuery(WorldPacket& recvData)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestNPCQuery(WorldPacket& recvData)
|
||||
{
|
||||
uint32 count = recvData.ReadBits(24);
|
||||
std::map<uint32, std::vector<uint32>> quests;
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
uint32 questId;
|
||||
recvData >> questId;
|
||||
|
||||
/// @todo verify if we should only send completed quests questgivers
|
||||
if (_player->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE)
|
||||
{
|
||||
auto creatures = sObjectMgr->GetCreatureQuestInvolvedRelationReverseBounds(questId);
|
||||
for (auto it = creatures.first; it != creatures.second; ++it)
|
||||
quests[questId].push_back(it->second);
|
||||
|
||||
auto gos = sObjectMgr->GetGOQuestInvolvedRelationReverseBounds(questId);
|
||||
for (auto it = gos.first; it != gos.second; ++it)
|
||||
quests[questId].push_back(it->second | 0x80000000); // GO mask
|
||||
}
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_QUEST_NPC_QUERY_RESPONSE, 3 + count * 14);
|
||||
data.WriteBits(quests.size(), 23);
|
||||
|
||||
for (auto it = quests.begin(); it != quests.end(); ++it)
|
||||
data.WriteBits(it->second.size(), 24);
|
||||
|
||||
for (auto it = quests.begin(); it != quests.end(); ++it)
|
||||
{
|
||||
data << uint32(it->first);
|
||||
for (const auto& entry : it->second)
|
||||
data << uint32(entry);
|
||||
}
|
||||
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestPOIQuery(WorldPacket& recvData)
|
||||
{
|
||||
uint32 count;
|
||||
|
||||
Reference in New Issue
Block a user