mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/Packets: updated and enabled CMSG_QUESTGIVER_ACCEPT_QUEST
This commit is contained in:
@@ -95,16 +95,11 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPackets::Quest::QuestGiverHe
|
||||
creature->AI()->sGossipHello(_player);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPackets::Quest::QuestGiverAcceptQuest& packet)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
uint32 questId;
|
||||
uint32 unk1;
|
||||
recvData >> guid >> questId >> unk1;
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST %s, quest = %u, startcheat = %u", packet.QuestGiverGUID.ToString().c_str(), packet.QuestID, packet.StartCheat);
|
||||
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST %s, quest = %u, unk1 = %u", guid.ToString().c_str(), questId, unk1);
|
||||
|
||||
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER);
|
||||
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, packet.QuestGiverGUID, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM | TYPEMASK_PLAYER);
|
||||
|
||||
#define CLOSE_GOSSIP_CLEAR_DIVIDER() \
|
||||
do { \
|
||||
@@ -121,8 +116,8 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
|
||||
if (Player* playerQuestObject = object->ToPlayer())
|
||||
{
|
||||
if ((!_player->GetDivider().IsEmpty() && _player->GetDivider() != guid) ||
|
||||
((object != _player && !playerQuestObject->CanShareQuest(questId))))
|
||||
if ((!_player->GetDivider().IsEmpty() && _player->GetDivider() != packet.QuestGiverGUID) ||
|
||||
((object != _player && !playerQuestObject->CanShareQuest(packet.QuestID))))
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_DIVIDER();
|
||||
return;
|
||||
@@ -130,7 +125,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!object->hasQuest(questId))
|
||||
if (!object->hasQuest(packet.QuestID))
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_DIVIDER();
|
||||
return;
|
||||
@@ -141,7 +136,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
if (!_player->CanInteractWithQuestGiver(object))
|
||||
return;
|
||||
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(packet.QuestID))
|
||||
{
|
||||
// prevent cheating
|
||||
if (!GetPlayer()->CanTakeQuest(quest, true))
|
||||
|
||||
@@ -426,3 +426,10 @@ void WorldPackets::Quest::QuestGiverQueryQuest::Read()
|
||||
_worldPacket >> QuestID;
|
||||
RespondToGiver = _worldPacket.ReadBit();
|
||||
}
|
||||
|
||||
void WorldPackets::Quest::QuestGiverAcceptQuest::Read()
|
||||
{
|
||||
_worldPacket >> QuestGiverGUID;
|
||||
_worldPacket >> QuestID;
|
||||
StartCheat = _worldPacket.ReadBit();
|
||||
}
|
||||
|
||||
@@ -405,6 +405,18 @@ namespace WorldPackets
|
||||
int32 QuestID = 0;
|
||||
bool RespondToGiver = false;
|
||||
};
|
||||
|
||||
class QuestGiverAcceptQuest final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
QuestGiverAcceptQuest(WorldPacket&& packet) : ClientPacket(CMSG_QUESTGIVER_ACCEPT_QUEST, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid QuestGiverGUID;
|
||||
int32 QuestID = 0;
|
||||
bool StartCheat = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -660,7 +660,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_HANDLER(CMSG_QUERY_PETITION, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Petition::QueryPetition, &WorldSession::HandleQueryPetition);
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_QUERY_SCENARIO_POI, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
DEFINE_HANDLER(CMSG_QUERY_TIME, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Query::QueryTime, &WorldSession::HandleQueryTimeOpcode);
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_QUESTGIVER_ACCEPT_QUEST, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleQuestgiverAcceptQuestOpcode);
|
||||
DEFINE_HANDLER(CMSG_QUESTGIVER_ACCEPT_QUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Quest::QuestGiverAcceptQuest, &WorldSession::HandleQuestgiverAcceptQuestOpcode);
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_QUESTGIVER_CANCEL, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
DEFINE_HANDLER(CMSG_QUESTGIVER_CHOOSE_REWARD, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Quest::QuestGiverChooseReward, &WorldSession::HandleQuestgiverChooseRewardOpcode);
|
||||
DEFINE_HANDLER(CMSG_QUESTGIVER_COMPLETE_QUEST, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Quest::QuestGiverCompleteQuest, &WorldSession::HandleQuestgiverCompleteQuest);
|
||||
|
||||
@@ -330,6 +330,7 @@ namespace WorldPackets
|
||||
class QuestGiverCompleteQuest;
|
||||
class QuestGiverRequestReward;
|
||||
class QuestGiverQueryQuest;
|
||||
class QuestGiverAcceptQuest;
|
||||
}
|
||||
|
||||
namespace Social
|
||||
@@ -1093,7 +1094,7 @@ class WorldSession
|
||||
void HandleQuestgiverStatusQueryOpcode(WorldPackets::Quest::QuestGiverStatusQuery& packet);
|
||||
void HandleQuestgiverStatusMultipleQuery(WorldPackets::Quest::QuestGiverStatusMultipleQuery& packet);
|
||||
void HandleQuestgiverHelloOpcode(WorldPackets::Quest::QuestGiverHello& packet);
|
||||
void HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvPacket);
|
||||
void HandleQuestgiverAcceptQuestOpcode(WorldPackets::Quest::QuestGiverAcceptQuest& packet);
|
||||
void HandleQuestgiverQueryQuestOpcode(WorldPackets::Quest::QuestGiverQueryQuest& packet);
|
||||
void HandleQuestgiverChooseRewardOpcode(WorldPackets::Quest::QuestGiverChooseReward& packet);
|
||||
void HandleQuestgiverRequestRewardOpcode(WorldPackets::Quest::QuestGiverRequestReward& packet);
|
||||
|
||||
Reference in New Issue
Block a user