Skip to content

Commit

Permalink
Core/PacketIO: updated and enabled CMSG_QUEST_CONFIRM_ACCEPT
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchesD committed Apr 17, 2015
1 parent 94c6dd8 commit 60a87b4
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16337,7 +16337,7 @@ void Player::SendQuestConfirmAccept(Quest const* quest, Player* receiver)
if (QuestTemplateLocale const* questTemplateLocale = sObjectMgr->GetQuestLocale(questID))
ObjectMgr::GetLocaleString(questTemplateLocale->LogTitle, localeConstant, questTitle);

WorldPackets::Quest::QuestConfirmAccept packet;
WorldPackets::Quest::QuestConfirmAcceptResponse packet;
packet.QuestID = questID;
packet.InitiatedBy = GetGUID();
packet.QuestTitle = questTitle;
Expand Down
11 changes: 4 additions & 7 deletions src/server/game/Handlers/QuestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,11 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPackets::Quest::QuestLogRemove
}
}

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", questId);
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT questId = %u", packet.QuestID);

if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
if (Quest const* quest = sObjectMgr->GetQuestTemplate(packet.QuestID))
{
if (!quest->HasFlag(QUEST_FLAGS_PARTY_ACCEPT))
return;
Expand All @@ -481,7 +478,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData)
if (!_player->IsInSameRaidWith(originalPlayer))
return;

if (!originalPlayer->CanShareQuest(questId))
if (!originalPlayer->CanShareQuest(packet.QuestID))
return;

if (!_player->CanTakeQuest(quest, true))
Expand Down
7 changes: 6 additions & 1 deletion src/server/game/Server/Packets/QuestPackets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ WorldPacket const* WorldPackets::Quest::QuestUpdateComplete::Write()
return &_worldPacket;
}

WorldPacket const* WorldPackets::Quest::QuestConfirmAccept::Write()
WorldPacket const* WorldPackets::Quest::QuestConfirmAcceptResponse::Write()
{
_worldPacket << uint32(QuestID);
_worldPacket << InitiatedBy;
Expand All @@ -480,3 +480,8 @@ WorldPacket const* WorldPackets::Quest::QuestConfirmAccept::Write()

return &_worldPacket;
}

void WorldPackets::Quest::QuestConfirmAccept::Read()
{
_worldPacket >> QuestID;
}
14 changes: 12 additions & 2 deletions src/server/game/Server/Packets/QuestPackets.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,17 +465,27 @@ namespace WorldPackets
int32 QuestID = 0;
};

class QuestConfirmAccept final : public ServerPacket
class QuestConfirmAcceptResponse final : public ServerPacket
{
public:
QuestConfirmAccept() : ServerPacket(SMSG_QUEST_CONFIRM_ACCEPT, 21) { }
QuestConfirmAcceptResponse() : ServerPacket(SMSG_QUEST_CONFIRM_ACCEPT, 21) { }

WorldPacket const* Write() override;

ObjectGuid InitiatedBy;
int32 QuestID = 0;
std::string QuestTitle;
};

class QuestConfirmAccept final : public ClientPacket
{
public:
QuestConfirmAccept(WorldPacket&& packet) : ClientPacket(CMSG_QUEST_CONFIRM_ACCEPT, std::move(packet)) { }

void Read() override;

int32 QuestID = 0;
};
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Server/Protocol/Opcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ void OpcodeTable::Initialize()
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_HANDLER(CMSG_QUERY_VOID_STORAGE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::VoidStorage::QueryVoidStorage, &WorldSession::HandleVoidStorageQuery);
DEFINE_OPCODE_HANDLER_OLD(CMSG_QUEST_CONFIRM_ACCEPT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleQuestConfirmAccept );
DEFINE_HANDLER(CMSG_QUEST_CONFIRM_ACCEPT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Quest::QuestConfirmAccept, &WorldSession::HandleQuestConfirmAccept);
DEFINE_HANDLER(CMSG_QUEST_GIVER_ACCEPT_QUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Quest::QuestGiverAcceptQuest, &WorldSession::HandleQuestgiverAcceptQuestOpcode);
DEFINE_HANDLER(CMSG_QUEST_GIVER_CHOOSE_REWARD, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Quest::QuestGiverChooseReward, &WorldSession::HandleQuestgiverChooseRewardOpcode);
DEFINE_HANDLER(CMSG_QUEST_GIVER_COMPLETE_QUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Quest::QuestGiverCompleteQuest, &WorldSession::HandleQuestgiverCompleteQuest);
Expand Down Expand Up @@ -1588,7 +1588,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SCENE_OBJECT_PET_BATTLE_REPLACEMENTS_MADE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SCENE_OBJECT_PET_BATTLE_ROUND_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SCRIPT_CAST, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SELL_RESPONSE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SELL_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SEND_ITEM_PASSIVES, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SEND_KNOWN_SPELLS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SEND_RAID_TARGET_UPDATE_ALL, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
Expand Down
3 changes: 2 additions & 1 deletion src/server/game/Server/WorldSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ namespace WorldPackets

namespace Quest
{
class QuestConfirmAccept;
class QuestGiverStatusQuery;
class QuestGiverStatusMultipleQuery;
class QuestGiverHello;
Expand Down Expand Up @@ -1205,7 +1206,7 @@ class WorldSession
void HandleQuestgiverCancel(WorldPacket& recvData);
void HandleQuestLogSwapQuest(WorldPacket& recvData);
void HandleQuestLogRemoveQuest(WorldPackets::Quest::QuestLogRemoveQuest& packet);
void HandleQuestConfirmAccept(WorldPacket& recvData);
void HandleQuestConfirmAccept(WorldPackets::Quest::QuestConfirmAccept& packet);
void HandleQuestgiverCompleteQuest(WorldPackets::Quest::QuestGiverCompleteQuest& packet);
void HandleQuestgiverQuestAutoLaunch(WorldPacket& recvPacket);
void HandlePushQuestToParty(WorldPacket& recvPacket);
Expand Down

0 comments on commit 60a87b4

Please sign in to comment.