CMSG_QUESTGIVER_QUERY_QUEST 5.4.7 (18019)

This commit is contained in:
zamalaev 2020-02-19 15:22:50 +00:00 committed by Antz
parent 64aa588278
commit 2eda56aeb8
2 changed files with 74 additions and 5 deletions

View file

@ -459,7 +459,7 @@ enum Opcodes
SMSG_QUESTGIVER_STATUS = 0x2115, // 4.3.4 15595
CMSG_QUESTGIVER_HELLO = 0x0D17, // 4.3.4 15595
SMSG_QUESTGIVER_QUEST_LIST = 0x0134, // 4.3.4 15595
CMSG_QUESTGIVER_QUERY_QUEST = 0x2F14, // 4.3.4 15595
CMSG_QUESTGIVER_QUERY_QUEST = 0x0474, // 5.4.7 18019
CMSG_QUESTGIVER_QUEST_AUTOLAUNCH = 0x1188,
SMSG_QUESTGIVER_QUEST_DETAILS = 0x2425, // 4.3.4 15595
CMSG_QUESTGIVER_ACCEPT_QUEST = 0x6B37, // 4.3.4 15595

View file

@ -204,12 +204,30 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recv_data)
_player->PlayerTalkClass->CloseGossip();
}
void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recv_data)
void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData)
{
ObjectGuid guid;
uint32 quest;
uint8 unk1;
recv_data >> guid >> quest >> unk1;
recvData >> quest;
guid[6] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[7]);
DEBUG_LOG("WORLD: Received opcode CMSG_QUESTGIVER_QUERY_QUEST - for %s to %s, quest = %u, unk1 = %u", _player->GetGuidStr().c_str(), guid.GetString().c_str(), quest, unk1);
@ -646,7 +664,58 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
{
DEBUG_LOG("WORLD: Received opcode CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY");
_player->SendQuestGiverStatusMultiple();
uint32 count = 0;
WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4);
data << uint32(count); // placeholder
for (GuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
{
uint32 dialogStatus = DIALOG_STATUS_NONE;
if (itr->IsAnyTypeCreature())
{
// need also pet quests case support
Creature* questgiver = GetPlayer()->GetMap()->GetAnyTypeCreature(*itr);
if (!questgiver || questgiver->IsHostileTo(_player))
continue;
if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
continue;
dialogStatus = sScriptMgr.GetDialogStatus(_player, questgiver);
if (dialogStatus > DIALOG_STATUS_REWARD_REP)
dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE);
data << questgiver->GetObjectGuid();
data << uint32(dialogStatus);
++count;
}
else if (itr->IsGameObject())
{
GameObject* questgiver = GetPlayer()->GetMap()->GetGameObject(*itr);
if (!questgiver)
continue;
if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
continue;
dialogStatus = sScriptMgr.GetDialogStatus(_player, questgiver);
if (dialogStatus > DIALOG_STATUS_REWARD_REP)
dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE);
data << questgiver->GetObjectGuid();
data << uint32(dialogStatus);
++count;
}
}
data.put<uint32>(0, count); // write real count
SendPacket(&data);
}
bool WorldSession::CanInteractWithQuestGiver(ObjectGuid guid, char const* descr)