mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-26 11:52:32 +01:00
Core/Packets: convert CMSG_QUEST_LOG_REMOVE_QUEST, CMSG_QUEST_CONFIRM_ACCEPT and CMSG_QUERY_QUEST_INFO to packet class
This commit is contained in:
@@ -238,16 +238,14 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPackets::Quest::QuestGi
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestQueryOpcode(WorldPacket& recvData)
|
||||
void WorldSession::HandleQuestQueryOpcode(WorldPackets::Quest::QueryQuestInfo& packet)
|
||||
{
|
||||
if (!_player)
|
||||
return;
|
||||
|
||||
uint32 questId;
|
||||
recvData >> questId;
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUEST_QUERY quest = %u", questId);
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUERY_QUEST_INFO QuestID = %u", packet.QuestID);
|
||||
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(packet.QuestID))
|
||||
_player->PlayerTalkClass->SendQuestQueryResponse(quest);
|
||||
}
|
||||
|
||||
@@ -385,16 +383,13 @@ void WorldSession::HandleQuestLogSwapQuest(WorldPacket& recvData)
|
||||
GetPlayer()->SwapQuestSlot(slot1, slot2);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData)
|
||||
void WorldSession::HandleQuestLogRemoveQuest(WorldPackets::Quest::QuestLogRemoveQuest& packet)
|
||||
{
|
||||
uint8 slot;
|
||||
recvData >> slot;
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUEST_LOG_REMOVE_QUEST Entry = %u", packet.Entry);
|
||||
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTLOG_REMOVE_QUEST slot = %u", slot);
|
||||
|
||||
if (slot < MAX_QUEST_LOG_SIZE)
|
||||
if (packet.Entry < MAX_QUEST_LOG_SIZE)
|
||||
{
|
||||
if (uint32 questId = _player->GetQuestSlotQuestId(slot))
|
||||
if (uint32 questId = _player->GetQuestSlotQuestId(packet.Entry))
|
||||
{
|
||||
if (!_player->TakeQuestSourceItem(questId, true))
|
||||
return; // can't un-equip some items, reject quest cancel
|
||||
@@ -432,20 +427,17 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData)
|
||||
sScriptMgr->OnQuestStatusChange(_player, questId);
|
||||
}
|
||||
|
||||
_player->SetQuestSlot(slot, 0);
|
||||
_player->SetQuestSlot(packet.Entry, 0);
|
||||
|
||||
_player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData)
|
||||
void WorldSession::HandleQuestConfirmAccept(WorldPackets::Quest::QuestConfirmAccept& packet)
|
||||
{
|
||||
uint32 questId;
|
||||
recvData >> questId;
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT QuestID = %u", packet.QuestID);
|
||||
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT questId = %u", questId);
|
||||
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(packet.QuestID))
|
||||
{
|
||||
if (!quest->HasFlag(QUEST_FLAGS_PARTY_ACCEPT))
|
||||
return;
|
||||
@@ -457,7 +449,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData)
|
||||
if (!_player->IsInSameRaidWith(originalPlayer))
|
||||
return;
|
||||
|
||||
if (!originalPlayer->IsActiveQuest(questId))
|
||||
if (!originalPlayer->IsActiveQuest(packet.QuestID))
|
||||
return;
|
||||
|
||||
if (!_player->CanTakeQuest(quest, true))
|
||||
|
||||
@@ -95,3 +95,18 @@ void WorldPackets::Quest::QuestGiverStatusQuery::Read()
|
||||
{
|
||||
_worldPacket >> QuestGiverGUID;
|
||||
}
|
||||
|
||||
void WorldPackets::Quest::QuestLogRemoveQuest::Read()
|
||||
{
|
||||
_worldPacket >> Entry;
|
||||
}
|
||||
|
||||
void WorldPackets::Quest::QuestConfirmAccept::Read()
|
||||
{
|
||||
_worldPacket >> QuestID;
|
||||
}
|
||||
|
||||
void WorldPackets::Quest::QueryQuestInfo::Read()
|
||||
{
|
||||
_worldPacket >> QuestID;
|
||||
}
|
||||
|
||||
@@ -150,6 +150,36 @@ namespace WorldPackets
|
||||
|
||||
ObjectGuid QuestGiverGUID;
|
||||
};
|
||||
|
||||
class QuestLogRemoveQuest final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
QuestLogRemoveQuest(WorldPacket&& packet) : ClientPacket(CMSG_QUEST_LOG_REMOVE_QUEST, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint8 Entry = 0;
|
||||
};
|
||||
|
||||
class QuestConfirmAccept final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
QuestConfirmAccept(WorldPacket&& packet) : ClientPacket(CMSG_QUEST_CONFIRM_ACCEPT, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
int32 QuestID = 0;
|
||||
};
|
||||
|
||||
class QueryQuestInfo final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
QueryQuestInfo(WorldPacket&& packet) : ClientPacket(CMSG_QUERY_QUEST_INFO, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
int32 QuestID = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -518,11 +518,11 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_HANDLER(CMSG_QUEST_GIVER_REQUEST_REWARD, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleQuestgiverRequestRewardOpcode);
|
||||
DEFINE_HANDLER(CMSG_QUEST_GIVER_STATUS_MULTIPLE_QUERY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleQuestgiverStatusMultipleQuery);
|
||||
DEFINE_HANDLER(CMSG_QUEST_GIVER_STATUS_QUERY, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleQuestgiverStatusQueryOpcode);
|
||||
DEFINE_HANDLER(CMSG_QUESTLOG_REMOVE_QUEST, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleQuestLogRemoveQuest );
|
||||
DEFINE_HANDLER(CMSG_QUEST_LOG_REMOVE_QUEST, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleQuestLogRemoveQuest );
|
||||
DEFINE_HANDLER(CMSG_QUEST_CONFIRM_ACCEPT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleQuestConfirmAccept );
|
||||
DEFINE_HANDLER(CMSG_QUEST_NPC_QUERY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleQuestNPCQuery );
|
||||
DEFINE_HANDLER(CMSG_QUEST_POI_QUERY, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleQuestPOIQuery );
|
||||
DEFINE_HANDLER(CMSG_QUEST_QUERY, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleQuestQueryOpcode );
|
||||
DEFINE_HANDLER(CMSG_QUERY_QUEST_INFO, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleQuestQueryOpcode );
|
||||
DEFINE_HANDLER(CMSG_RANDOMIZE_CHAR_NAME, STATUS_AUTHED, PROCESS_THREADUNSAFE, &WorldSession::HandleRandomizeCharNameOpcode );
|
||||
DEFINE_HANDLER(CMSG_READY_FOR_ACCOUNT_DATA_TIMES, STATUS_AUTHED, PROCESS_THREADUNSAFE, &WorldSession::HandleReadyForAccountDataTimes );
|
||||
DEFINE_HANDLER(CMSG_READ_ITEM, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleReadItem );
|
||||
|
||||
@@ -435,12 +435,12 @@ enum OpcodeClient : uint16
|
||||
CMSG_QUEST_GIVER_REQUEST_REWARD = 0x2534,
|
||||
CMSG_QUEST_GIVER_STATUS_MULTIPLE_QUERY = 0x6305,
|
||||
CMSG_QUEST_GIVER_STATUS_QUERY = 0x4407,
|
||||
CMSG_QUESTLOG_REMOVE_QUEST = 0x0D16,
|
||||
CMSG_QUESTLOG_SWAP_QUEST = 0x0000,
|
||||
CMSG_QUEST_LOG_REMOVE_QUEST = 0x0D16,
|
||||
CMSG_QUEST_LOG_SWAP_QUEST = 0x0000,
|
||||
CMSG_QUEST_CONFIRM_ACCEPT = 0x0D15,
|
||||
CMSG_QUEST_NPC_QUERY = 0x7302,
|
||||
CMSG_QUEST_POI_QUERY = 0x4037,
|
||||
CMSG_QUEST_QUERY = 0x0D06,
|
||||
CMSG_QUERY_QUEST_INFO = 0x0D06,
|
||||
CMSG_RANDOMIZE_CHAR_NAME = 0x2413,
|
||||
CMSG_READY_FOR_ACCOUNT_DATA_TIMES = 0x2B16,
|
||||
CMSG_READ_ITEM = 0x2F16,
|
||||
|
||||
@@ -134,6 +134,9 @@ namespace WorldPackets
|
||||
class QuestGiverRequestReward;
|
||||
class QuestGiverStatusMultipleQuery;
|
||||
class QuestGiverStatusQuery;
|
||||
class QuestLogRemoveQuest;
|
||||
class QuestConfirmAccept;
|
||||
class QueryQuestInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -871,11 +874,11 @@ class TC_GAME_API WorldSession
|
||||
void HandleQuestgiverQueryQuestOpcode(WorldPackets::Quest::QuestGiverQueryQuest& packet);
|
||||
void HandleQuestgiverChooseRewardOpcode(WorldPackets::Quest::QuestGiverChooseReward& packet);
|
||||
void HandleQuestgiverRequestRewardOpcode(WorldPackets::Quest::QuestGiverRequestReward& packet);
|
||||
void HandleQuestQueryOpcode(WorldPacket& recvPacket);
|
||||
void HandleQuestQueryOpcode(WorldPackets::Quest::QueryQuestInfo& packet);
|
||||
void HandleQuestgiverCancel(WorldPacket& recvData);
|
||||
void HandleQuestLogSwapQuest(WorldPacket& recvData);
|
||||
void HandleQuestLogRemoveQuest(WorldPacket& recvData);
|
||||
void HandleQuestConfirmAccept(WorldPacket& recvData);
|
||||
void HandleQuestLogRemoveQuest(WorldPackets::Quest::QuestLogRemoveQuest& packet);
|
||||
void HandleQuestConfirmAccept(WorldPackets::Quest::QuestConfirmAccept& packet);
|
||||
void HandleQuestgiverCompleteQuest(WorldPackets::Quest::QuestGiverCompleteQuest& packet);
|
||||
void HandleQuestgiverQuestAutoLaunch(WorldPacket& recvPacket);
|
||||
void HandlePushQuestToParty(WorldPacket& recvPacket);
|
||||
|
||||
Reference in New Issue
Block a user