fix: SMSG_AUCTION_BIDDER_NOTIFICATION read itemEntry at wrong offset

The handler treated the second uint32 (auctionId) as itemEntry. The
real itemEntry is at byte 24 after auctionHouseId(4)+auctionId(4)+
bidderGuid(8)+bidAmount(4)+outbidAmount(4). Outbid chat messages always
referenced the wrong item.
This commit is contained in:
Kelsi 2026-03-29 19:22:44 -07:00
parent 5b9b8b59ba
commit 731d9a88fb

View file

@ -544,24 +544,28 @@ void InventoryHandler::registerOpcodes(DispatchTable& table) {
}; };
table[Opcode::SMSG_AUCTION_BIDDER_NOTIFICATION] = [this](network::Packet& packet) { table[Opcode::SMSG_AUCTION_BIDDER_NOTIFICATION] = [this](network::Packet& packet) {
if (packet.getSize() - packet.getReadPos() >= 8) { // WotLK format: auctionHouseId(4) + auctionId(4) + bidderGuid(8) +
/*uint32_t auctionId =*/ packet.readUInt32(); // bidAmount(4) + outbidAmount(4) + itemEntry(4) + randomPropertyId(4) = 32 bytes.
uint32_t itemEntry = packet.readUInt32(); // Previously read auctionHouseId as auctionId and auctionId as itemEntry,
int32_t bidRandProp = 0; // so outbid messages always referenced the wrong item.
if (packet.getSize() - packet.getReadPos() >= 4) if (!packet.hasRemaining(32)) { packet.skipAll(); return; }
bidRandProp = static_cast<int32_t>(packet.readUInt32()); /*uint32_t auctionHouseId =*/ packet.readUInt32();
owner_.ensureItemInfo(itemEntry); /*uint32_t auctionId =*/ packet.readUInt32();
auto* info = owner_.getItemInfo(itemEntry); /*uint64_t bidderGuid =*/ packet.readUInt64();
std::string rawName2 = info && !info->name.empty() ? info->name : ("Item #" + std::to_string(itemEntry)); /*uint32_t bidAmount =*/ packet.readUInt32();
if (bidRandProp != 0) { /*uint32_t outbidAmount =*/ packet.readUInt32();
std::string suffix = owner_.getRandomPropertyName(bidRandProp); uint32_t itemEntry = packet.readUInt32();
if (!suffix.empty()) rawName2 += " " + suffix; int32_t bidRandProp = static_cast<int32_t>(packet.readUInt32());
} owner_.ensureItemInfo(itemEntry);
uint32_t bidQuality = info ? info->quality : 1u; auto* info = owner_.getItemInfo(itemEntry);
std::string bidLink = buildItemLink(itemEntry, bidQuality, rawName2); std::string rawName = info && !info->name.empty() ? info->name : ("Item #" + std::to_string(itemEntry));
owner_.addSystemChatMessage("You have been outbid on " + bidLink + "."); if (bidRandProp != 0) {
std::string suffix = owner_.getRandomPropertyName(bidRandProp);
if (!suffix.empty()) rawName += " " + suffix;
} }
packet.setReadPos(packet.getSize()); uint32_t bidQuality = info ? info->quality : 1u;
owner_.addSystemChatMessage("You have been outbid on " + buildItemLink(itemEntry, bidQuality, rawName) + ".");
packet.skipAll();
}; };
table[Opcode::SMSG_AUCTION_REMOVED_NOTIFICATION] = [this](network::Packet& packet) { table[Opcode::SMSG_AUCTION_REMOVED_NOTIFICATION] = [this](network::Packet& packet) {