mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-02 15:53:51 +00:00
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:
parent
5b9b8b59ba
commit
731d9a88fb
1 changed files with 21 additions and 17 deletions
|
|
@ -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) +
|
||||||
|
// bidAmount(4) + outbidAmount(4) + itemEntry(4) + randomPropertyId(4) = 32 bytes.
|
||||||
|
// Previously read auctionHouseId as auctionId and auctionId as itemEntry,
|
||||||
|
// so outbid messages always referenced the wrong item.
|
||||||
|
if (!packet.hasRemaining(32)) { packet.skipAll(); return; }
|
||||||
|
/*uint32_t auctionHouseId =*/ packet.readUInt32();
|
||||||
/*uint32_t auctionId =*/ packet.readUInt32();
|
/*uint32_t auctionId =*/ packet.readUInt32();
|
||||||
|
/*uint64_t bidderGuid =*/ packet.readUInt64();
|
||||||
|
/*uint32_t bidAmount =*/ packet.readUInt32();
|
||||||
|
/*uint32_t outbidAmount =*/ packet.readUInt32();
|
||||||
uint32_t itemEntry = packet.readUInt32();
|
uint32_t itemEntry = packet.readUInt32();
|
||||||
int32_t bidRandProp = 0;
|
int32_t bidRandProp = static_cast<int32_t>(packet.readUInt32());
|
||||||
if (packet.getSize() - packet.getReadPos() >= 4)
|
|
||||||
bidRandProp = static_cast<int32_t>(packet.readUInt32());
|
|
||||||
owner_.ensureItemInfo(itemEntry);
|
owner_.ensureItemInfo(itemEntry);
|
||||||
auto* info = owner_.getItemInfo(itemEntry);
|
auto* info = owner_.getItemInfo(itemEntry);
|
||||||
std::string rawName2 = info && !info->name.empty() ? info->name : ("Item #" + std::to_string(itemEntry));
|
std::string rawName = info && !info->name.empty() ? info->name : ("Item #" + std::to_string(itemEntry));
|
||||||
if (bidRandProp != 0) {
|
if (bidRandProp != 0) {
|
||||||
std::string suffix = owner_.getRandomPropertyName(bidRandProp);
|
std::string suffix = owner_.getRandomPropertyName(bidRandProp);
|
||||||
if (!suffix.empty()) rawName2 += " " + suffix;
|
if (!suffix.empty()) rawName += " " + suffix;
|
||||||
}
|
}
|
||||||
uint32_t bidQuality = info ? info->quality : 1u;
|
uint32_t bidQuality = info ? info->quality : 1u;
|
||||||
std::string bidLink = buildItemLink(itemEntry, bidQuality, rawName2);
|
owner_.addSystemChatMessage("You have been outbid on " + buildItemLink(itemEntry, bidQuality, rawName) + ".");
|
||||||
owner_.addSystemChatMessage("You have been outbid on " + bidLink + ".");
|
packet.skipAll();
|
||||||
}
|
|
||||||
packet.setReadPos(packet.getSize());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
table[Opcode::SMSG_AUCTION_REMOVED_NOTIFICATION] = [this](network::Packet& packet) {
|
table[Opcode::SMSG_AUCTION_REMOVED_NOTIFICATION] = [this](network::Packet& packet) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue