mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
fix(mail): use attachment item guid for WotLK take item
This commit is contained in:
parent
5a10ae9df0
commit
5fa5020af5
6 changed files with 12 additions and 11 deletions
|
|
@ -1978,7 +1978,7 @@ public:
|
|||
const std::array<MailAttachSlot, 12>& getMailAttachments() const { return mailAttachments_; }
|
||||
int getMailAttachmentCount() const;
|
||||
void mailTakeMoney(uint32_t mailId);
|
||||
void mailTakeItem(uint32_t mailId, uint32_t itemIndex);
|
||||
void mailTakeItem(uint32_t mailId, uint32_t itemGuidLow);
|
||||
void mailDelete(uint32_t mailId);
|
||||
void mailMarkAsRead(uint32_t mailId);
|
||||
void refreshMailList();
|
||||
|
|
|
|||
|
|
@ -266,8 +266,8 @@ public:
|
|||
virtual bool parseMailList(network::Packet& packet, std::vector<MailMessage>& inbox);
|
||||
|
||||
/** Build CMSG_MAIL_TAKE_ITEM */
|
||||
virtual network::Packet buildMailTakeItem(uint64_t mailboxGuid, uint32_t mailId, uint32_t itemSlot) {
|
||||
return MailTakeItemPacket::build(mailboxGuid, mailId, itemSlot);
|
||||
virtual network::Packet buildMailTakeItem(uint64_t mailboxGuid, uint32_t mailId, uint32_t itemGuidLow) {
|
||||
return MailTakeItemPacket::build(mailboxGuid, mailId, itemGuidLow);
|
||||
}
|
||||
|
||||
/** Build CMSG_MAIL_DELETE */
|
||||
|
|
@ -404,7 +404,7 @@ public:
|
|||
uint32_t money, uint32_t cod,
|
||||
const std::vector<uint64_t>& itemGuids = {}) override;
|
||||
bool parseMailList(network::Packet& packet, std::vector<MailMessage>& inbox) override;
|
||||
network::Packet buildMailTakeItem(uint64_t mailboxGuid, uint32_t mailId, uint32_t itemSlot) override;
|
||||
network::Packet buildMailTakeItem(uint64_t mailboxGuid, uint32_t mailId, uint32_t itemGuidLow) override;
|
||||
network::Packet buildMailDelete(uint64_t mailboxGuid, uint32_t mailId, uint32_t mailTemplateId) override;
|
||||
network::Packet buildItemQuery(uint32_t entry, uint64_t guid) override;
|
||||
bool parseItemQueryResponse(network::Packet& packet, ItemQueryResponseData& data) override;
|
||||
|
|
|
|||
|
|
@ -2517,7 +2517,7 @@ public:
|
|||
/** CMSG_MAIL_TAKE_ITEM packet builder */
|
||||
class MailTakeItemPacket {
|
||||
public:
|
||||
static network::Packet build(uint64_t mailboxGuid, uint32_t mailId, uint32_t itemIndex);
|
||||
static network::Packet build(uint64_t mailboxGuid, uint32_t mailId, uint32_t itemGuidLow);
|
||||
};
|
||||
|
||||
/** CMSG_MAIL_DELETE packet builder */
|
||||
|
|
|
|||
|
|
@ -22136,9 +22136,9 @@ void GameHandler::mailTakeMoney(uint32_t mailId) {
|
|||
socket->send(packet);
|
||||
}
|
||||
|
||||
void GameHandler::mailTakeItem(uint32_t mailId, uint32_t itemIndex) {
|
||||
void GameHandler::mailTakeItem(uint32_t mailId, uint32_t itemGuidLow) {
|
||||
if (state != WorldState::IN_WORLD || !socket || mailboxGuid_ == 0) return;
|
||||
auto packet = packetParsers_->buildMailTakeItem(mailboxGuid_, mailId, itemIndex);
|
||||
auto packet = packetParsers_->buildMailTakeItem(mailboxGuid_, mailId, itemGuidLow);
|
||||
socket->send(packet);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5069,11 +5069,12 @@ network::Packet MailTakeMoneyPacket::build(uint64_t mailboxGuid, uint32_t mailId
|
|||
return packet;
|
||||
}
|
||||
|
||||
network::Packet MailTakeItemPacket::build(uint64_t mailboxGuid, uint32_t mailId, uint32_t itemIndex) {
|
||||
network::Packet MailTakeItemPacket::build(uint64_t mailboxGuid, uint32_t mailId, uint32_t itemGuidLow) {
|
||||
network::Packet packet(wireOpcode(Opcode::CMSG_MAIL_TAKE_ITEM));
|
||||
packet.writeUInt64(mailboxGuid);
|
||||
packet.writeUInt32(mailId);
|
||||
packet.writeUInt32(itemIndex);
|
||||
// WotLK expects attachment item GUID low, not attachment slot index.
|
||||
packet.writeUInt32(itemGuidLow);
|
||||
return packet;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17716,7 +17716,7 @@ void GameScreen::renderMailWindow(game::GameHandler& gameHandler) {
|
|||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::SmallButton("Take")) {
|
||||
gameHandler.mailTakeItem(mail.messageId, att.slot);
|
||||
gameHandler.mailTakeItem(mail.messageId, att.itemGuidLow);
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
|
|
@ -17725,7 +17725,7 @@ void GameScreen::renderMailWindow(game::GameHandler& gameHandler) {
|
|||
if (mail.attachments.size() > 1) {
|
||||
if (ImGui::SmallButton("Take All")) {
|
||||
for (const auto& att2 : mail.attachments) {
|
||||
gameHandler.mailTakeItem(mail.messageId, att2.slot);
|
||||
gameHandler.mailTakeItem(mail.messageId, att2.itemGuidLow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue