fix(mail): use attachment item guid for WotLK take item

This commit is contained in:
Kelsi 2026-03-14 07:11:18 -07:00
parent 5a10ae9df0
commit 5fa5020af5
6 changed files with 12 additions and 11 deletions

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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);
}
}
}