mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
tbc/classic: fix SMSG_RAID_INSTANCE_INFO format (uint32 resetTime, no extended)
TBC 2.4.3 and Classic 1.12 send resetTime as uint32 (seconds) with no extended byte, while WotLK 3.3.5a sends uint64 timestamp + extended byte. Parse the correct field widths based on expansion to prevent corrupted instance lockout data on TBC/Classic realms.
This commit is contained in:
parent
c44477fbee
commit
f63b75c388
1 changed files with 16 additions and 6 deletions
|
|
@ -11161,23 +11161,33 @@ void GameHandler::acceptBattlefield(uint32_t queueSlot) {
|
|||
}
|
||||
|
||||
void GameHandler::handleRaidInstanceInfo(network::Packet& packet) {
|
||||
// SMSG_RAID_INSTANCE_INFO: uint32 count, then for each:
|
||||
// mapId(u32) + difficulty(u32) + resetTime(u64) + locked(u8) + extended(u8)
|
||||
// TBC 2.4.3 format: mapId(4) + difficulty(4) + resetTime(4 — uint32 seconds) + locked(1)
|
||||
// WotLK 3.3.5a format: mapId(4) + difficulty(4) + resetTime(8 — uint64 timestamp) + locked(1) + extended(1)
|
||||
const bool isTbc = isActiveExpansion("tbc");
|
||||
const bool isClassic = isClassicLikeExpansion();
|
||||
const bool useTbcFormat = isTbc || isClassic;
|
||||
|
||||
if (packet.getSize() - packet.getReadPos() < 4) return;
|
||||
uint32_t count = packet.readUInt32();
|
||||
|
||||
instanceLockouts_.clear();
|
||||
instanceLockouts_.reserve(count);
|
||||
|
||||
constexpr size_t kEntrySize = 4 + 4 + 8 + 1 + 1;
|
||||
const size_t kEntrySize = useTbcFormat ? (4 + 4 + 4 + 1) : (4 + 4 + 8 + 1 + 1);
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
if (packet.getSize() - packet.getReadPos() < kEntrySize) break;
|
||||
InstanceLockout lo;
|
||||
lo.mapId = packet.readUInt32();
|
||||
lo.difficulty = packet.readUInt32();
|
||||
lo.resetTime = packet.readUInt64();
|
||||
lo.locked = packet.readUInt8() != 0;
|
||||
lo.extended = packet.readUInt8() != 0;
|
||||
if (useTbcFormat) {
|
||||
lo.resetTime = packet.readUInt32(); // TBC/Classic: 4-byte seconds
|
||||
lo.locked = packet.readUInt8() != 0;
|
||||
lo.extended = false;
|
||||
} else {
|
||||
lo.resetTime = packet.readUInt64(); // WotLK: 8-byte timestamp
|
||||
lo.locked = packet.readUInt8() != 0;
|
||||
lo.extended = packet.readUInt8() != 0;
|
||||
}
|
||||
instanceLockouts_.push_back(lo);
|
||||
LOG_INFO("Instance lockout: mapId=", lo.mapId, " diff=", lo.difficulty,
|
||||
" reset=", lo.resetTime, " locked=", lo.locked, " extended=", lo.extended);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue