Core/PacketIO: Update SMSG_QUEST_CONFIRM_ACCEPT for WoD

This commit is contained in:
Vincent-Michael
2015-04-11 14:08:19 +02:00
parent a1831e0c1e
commit b2d0e7d9d5
5 changed files with 43 additions and 17 deletions
+17 -15
View File
@@ -16257,25 +16257,27 @@ void Player::SendCanTakeQuestResponse(QuestFailedReason msg) const
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_INVALID");
}
void Player::SendQuestConfirmAccept(const Quest* quest, Player* pReceiver)
void Player::SendQuestConfirmAccept(Quest const* quest, Player* receiver)
{
if (pReceiver)
{
std::string strTitle = quest->GetLogTitle();
if (!receiver)
return;
LocaleConstant localeConstant = pReceiver->GetSession()->GetSessionDbLocaleIndex();
if (localeConstant >= 0)
if (QuestTemplateLocale const* questTemplateLocale = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
ObjectMgr::GetLocaleString(questTemplateLocale->LogTitle, localeConstant, strTitle);
std::string questTitle = quest->GetLogTitle();
uint32 questID = quest->GetQuestId();
WorldPacket data(SMSG_QUEST_CONFIRM_ACCEPT, (4 + strTitle.size() + 8));
data << uint32(quest->GetQuestId());
data << strTitle;
data << GetGUID();
pReceiver->GetSession()->SendPacket(&data);
LocaleConstant localeConstant = receiver->GetSession()->GetSessionDbLocaleIndex();
if (localeConstant >= LOCALE_enUS)
if (QuestTemplateLocale const* questTemplateLocale = sObjectMgr->GetQuestLocale(questID))
ObjectMgr::GetLocaleString(questTemplateLocale->LogTitle, localeConstant, questTitle);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_CONFIRM_ACCEPT");
}
WorldPackets::Quest::QuestConfirmAccept packet;
packet.QuestID = questID;
packet.InitiatedBy = GetGUID();
packet.QuestTitle = questTitle;
receiver->GetSession()->SendPacket(packet.Write());
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_CONFIRM_ACCEPT");
}
void Player::SendPushToPartyResponse(Player* player, uint8 msg)
+1 -1
View File
@@ -1714,7 +1714,7 @@ class Player : public Unit, public GridObject<Player>
void SendQuestFailed(uint32 questId, InventoryResult reason = EQUIP_ERR_OK);
void SendQuestTimerFailed(uint32 questId);
void SendCanTakeQuestResponse(QuestFailedReason msg) const;
void SendQuestConfirmAccept(Quest const* quest, Player* pReceiver);
void SendQuestConfirmAccept(Quest const* quest, Player* receiver);
void SendPushToPartyResponse(Player* player, uint8 msg);
void SendQuestUpdateAddCredit(Quest const* quest, ObjectGuid guid, QuestObjective const& obj, uint16 count);
void SendQuestUpdateAddPlayer(Quest const* quest, uint16 newCount, uint32 required);
@@ -469,3 +469,15 @@ WorldPacket const* WorldPackets::Quest::QuestUpdateComplete::Write()
return &_worldPacket;
}
WorldPacket const* WorldPackets::Quest::QuestConfirmAccept::Write()
{
_worldPacket << uint32(QuestID);
_worldPacket << InitiatedBy;
_worldPacket.FlushBits();
_worldPacket.WriteBits(QuestTitle.size(), 10);
_worldPacket.WriteString(QuestTitle);
return &_worldPacket;
}
@@ -464,6 +464,18 @@ namespace WorldPackets
int32 QuestID = 0;
};
class QuestConfirmAccept final : public ServerPacket
{
public:
QuestConfirmAccept() : ServerPacket(SMSG_QUEST_CONFIRM_ACCEPT, 21) { }
WorldPacket const* Write() override;
ObjectGuid InitiatedBy;
int32 QuestID = 0;
std::string QuestTitle;
};
}
}
+1 -1
View File
@@ -1512,7 +1512,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUERY_QUEST_INFO_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUERY_TIME_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_COMPLETION_NPC_RESPONSE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_CONFIRM_ACCEPT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_CONFIRM_ACCEPT, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_FORCE_REMOVED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_GIVER_INVALID_QUEST, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_GIVER_OFFER_REWARD_MESSAGE, STATUS_NEVER, CONNECTION_TYPE_REALM);