fix: handle Classic 1.12 SMSG_WEATHER missing isAbrupt byte

Classic 1.12 sends weatherType(4)+intensity(4) with no trailing isAbrupt byte;
TBC/WotLK append uint8 isAbrupt. The prior check required >= 9 bytes, so weather
never updated on Classic servers. Now accept >= 8 bytes and read isAbrupt only if
the byte is present.
This commit is contained in:
Kelsi 2026-03-11 04:25:00 -07:00
parent fed03f970c
commit d3241dce9e

View file

@ -4078,11 +4078,13 @@ void GameHandler::handlePacket(network::Packet& packet) {
break;
}
case Opcode::SMSG_WEATHER: {
// Format: uint32 weatherType, float intensity, uint8 isAbrupt
if (packet.getSize() - packet.getReadPos() >= 9) {
// Classic 1.12: uint32 weatherType + float intensity (8 bytes, no isAbrupt)
// TBC 2.4.3 / WotLK 3.3.5a: uint32 weatherType + float intensity + uint8 isAbrupt (9 bytes)
if (packet.getSize() - packet.getReadPos() >= 8) {
uint32_t wType = packet.readUInt32();
float wIntensity = packet.readFloat();
/*uint8_t isAbrupt =*/ packet.readUInt8();
if (packet.getSize() - packet.getReadPos() >= 1)
/*uint8_t isAbrupt =*/ packet.readUInt8();
weatherType_ = wType;
weatherIntensity_ = wIntensity;
const char* typeName = (wType == 1) ? "Rain" : (wType == 2) ? "Snow" : (wType == 3) ? "Storm" : "Clear";