mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
Core/Quests: Added CMSG_QUESTGIVER_QUERY_QUEST
This commit is contained in:
@@ -202,23 +202,19 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
#undef CLOSE_GOSSIP_CLEAR_DIVIDER
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData)
|
||||
void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPackets::Quest::QuestGiverQueryQuest& packet)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
uint32 questId;
|
||||
uint8 unk1;
|
||||
recvData >> guid >> questId >> unk1;
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %s, quest = %u, unk1 = %u", guid.ToString().c_str(), questId, unk1);
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST QuestGiverGUID = %s, QuestID = %u, RespondToGiver = %u", packet.QuestGiverGUID.ToString().c_str(), packet.QuestID, packet.RespondToGiver);
|
||||
|
||||
// Verify that the guid is valid and is a questgiver or involved in the requested quest
|
||||
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM);
|
||||
if (!object || (!object->hasQuest(questId) && !object->hasInvolvedQuest(questId)))
|
||||
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, packet.QuestGiverGUID, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM);
|
||||
if (!object || (!object->hasQuest(packet.QuestID) && !object->hasInvolvedQuest(packet.QuestID)))
|
||||
{
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(packet.QuestID))
|
||||
{
|
||||
if (!_player->CanTakeQuest(quest, true))
|
||||
return;
|
||||
|
||||
@@ -419,3 +419,10 @@ void WorldPackets::Quest::QuestGiverRequestReward::Read()
|
||||
_worldPacket >> QuestGiverGUID;
|
||||
_worldPacket >> QuestID;
|
||||
}
|
||||
|
||||
void WorldPackets::Quest::QuestGiverQueryQuest::Read()
|
||||
{
|
||||
_worldPacket >> QuestGiverGUID;
|
||||
_worldPacket >> QuestID;
|
||||
RespondToGiver = _worldPacket.ReadBit();
|
||||
}
|
||||
|
||||
@@ -393,6 +393,18 @@ namespace WorldPackets
|
||||
ObjectGuid QuestGiverGUID;
|
||||
int32 QuestID = 0;
|
||||
};
|
||||
|
||||
class QuestGiverQueryQuest final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
QuestGiverQueryQuest(WorldPacket&& packet) : ClientPacket(CMSG_QUESTGIVER_QUERY_QUEST, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid QuestGiverGUID;
|
||||
int32 QuestID = 0;
|
||||
bool RespondToGiver = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -542,7 +542,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_HANDLER(CMSG_QUESTGIVER_CHOOSE_REWARD, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Quest::QuestGiverChooseReward, &WorldSession::HandleQuestgiverChooseRewardOpcode);
|
||||
DEFINE_HANDLER(CMSG_QUESTGIVER_COMPLETE_QUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Quest::QuestGiverCompleteQuest, &WorldSession::HandleQuestgiverCompleteQuest);
|
||||
DEFINE_HANDLER(CMSG_QUESTGIVER_HELLO, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Quest::QuestGiverHello, &WorldSession::HandleQuestgiverHelloOpcode);
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_QUESTGIVER_QUERY_QUEST, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleQuestgiverQueryQuestOpcode);
|
||||
DEFINE_HANDLER(CMSG_QUESTGIVER_QUERY_QUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Quest::QuestGiverQueryQuest, &WorldSession::HandleQuestgiverQueryQuestOpcode);
|
||||
DEFINE_HANDLER(CMSG_QUESTGIVER_REQUEST_REWARD, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Quest::QuestGiverRequestReward, &WorldSession::HandleQuestgiverRequestRewardOpcode);
|
||||
DEFINE_HANDLER(CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Quest::QuestGiverStatusMultipleQuery, &WorldSession::HandleQuestgiverStatusMultipleQuery);
|
||||
DEFINE_HANDLER(CMSG_QUESTGIVER_STATUS_QUERY, STATUS_LOGGEDIN, PROCESS_INPLACE, WorldPackets::Quest::QuestGiverStatusQuery, &WorldSession::HandleQuestgiverStatusQueryOpcode);
|
||||
|
||||
@@ -197,6 +197,7 @@ namespace WorldPackets
|
||||
class QuestGiverChooseReward;
|
||||
class QuestGiverCompleteQuest;
|
||||
class QuestGiverRequestReward;
|
||||
class QuestGiverQueryQuest;
|
||||
}
|
||||
|
||||
namespace Spells
|
||||
@@ -913,7 +914,7 @@ class WorldSession
|
||||
void HandleQuestgiverStatusMultipleQuery(WorldPackets::Quest::QuestGiverStatusMultipleQuery& packet);
|
||||
void HandleQuestgiverHelloOpcode(WorldPackets::Quest::QuestGiverHello& packet);
|
||||
void HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvPacket);
|
||||
void HandleQuestgiverQueryQuestOpcode(WorldPacket& recvPacket);
|
||||
void HandleQuestgiverQueryQuestOpcode(WorldPackets::Quest::QuestGiverQueryQuest& packet);
|
||||
void HandleQuestgiverChooseRewardOpcode(WorldPackets::Quest::QuestGiverChooseReward& packet);
|
||||
void HandleQuestgiverRequestRewardOpcode(WorldPackets::Quest::QuestGiverRequestReward& packet);
|
||||
void HandleQuestQueryOpcode(WorldPackets::Quest::QueryQuestInfo& packet);
|
||||
|
||||
Reference in New Issue
Block a user