mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
fix: handle short loot-failure response in LootResponseParser
Servers send a 9-byte packet (guid+lootType) with lootType=LOOT_NONE when loot is unavailable (locked chest, another player looting, needs a key). The previous parser required ≥14 bytes (guid+lootType+gold+itemCount) and logged a spurious WARNING for every such failure response. Now: - Accept the 9-byte form; return false so the caller skips opening the loot window (correct behaviour for a failure/empty response). - Log at DEBUG level instead of WARNING for the short form. - Keep the original WARNING for genuinely malformed packets < 9 bytes.
This commit is contained in:
parent
13c096f3e9
commit
367b48af6b
1 changed files with 16 additions and 2 deletions
|
|
@ -3971,13 +3971,27 @@ network::Packet LootReleasePacket::build(uint64_t lootGuid) {
|
|||
|
||||
bool LootResponseParser::parse(network::Packet& packet, LootResponseData& data, bool isWotlkFormat) {
|
||||
data = LootResponseData{};
|
||||
if (packet.getSize() - packet.getReadPos() < 14) {
|
||||
LOG_WARNING("LootResponseParser: packet too short");
|
||||
size_t avail = packet.getSize() - packet.getReadPos();
|
||||
|
||||
// Minimum is guid(8)+lootType(1) = 9 bytes. Servers send a short packet with
|
||||
// lootType=0 (LOOT_NONE) when loot is unavailable (e.g. chest not yet opened,
|
||||
// needs a key, or another player is looting). We treat this as an empty-loot
|
||||
// signal and return false so the caller knows not to open the loot window.
|
||||
if (avail < 9) {
|
||||
LOG_WARNING("LootResponseParser: packet too short (", avail, " bytes)");
|
||||
return false;
|
||||
}
|
||||
|
||||
data.lootGuid = packet.readUInt64();
|
||||
data.lootType = packet.readUInt8();
|
||||
|
||||
// Short failure packet — no gold/item data follows.
|
||||
avail = packet.getSize() - packet.getReadPos();
|
||||
if (avail < 5) {
|
||||
LOG_DEBUG("LootResponseParser: lootType=", (int)data.lootType, " (empty/failure response)");
|
||||
return false;
|
||||
}
|
||||
|
||||
data.gold = packet.readUInt32();
|
||||
uint8_t itemCount = packet.readUInt8();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue