fix: correct Turtle WoW SMSG_INIT_WORLD_STATES format and remove dead minRepeatMs branch

Turtle WoW is Classic 1.12-based and uses the Classic packet format for
SMSG_INIT_WORLD_STATES (no areaId uint32 field before count), not WotLK
format.  Including it in the WotLK branch caused the parser to consume 4
bytes of the count+first-key as a phantom areaId, misaligning all world
state key/value pairs (BG scores, zone events, flag states).

Also remove the dead `turtleMode ? 150 : 150` branch in
performGameObjectInteractionNow — both arms were identical so the ternary
had no effect; replace with a constexpr constant.
This commit is contained in:
Kelsi 2026-03-18 01:30:20 -07:00
parent 57b44d2347
commit 5801af41bc

View file

@ -4018,9 +4018,9 @@ void GameHandler::handlePacket(network::Packet& packet) {
}
worldStateMapId_ = packet.readUInt32();
worldStateZoneId_ = packet.readUInt32();
// WotLK adds areaId (uint32) before count; detect by checking if payload would be consistent
// WotLK adds areaId (uint32) before count; Classic/TBC/Turtle use the shorter format
size_t remaining = packet.getSize() - packet.getReadPos();
bool isWotLKFormat = isActiveExpansion("wotlk") || isActiveExpansion("turtle");
bool isWotLKFormat = isActiveExpansion("wotlk");
if (isWotLKFormat && remaining >= 6) {
packet.readUInt32(); // areaId (WotLK only)
}
@ -19764,14 +19764,12 @@ void GameHandler::interactWithGameObject(uint64_t guid) {
void GameHandler::performGameObjectInteractionNow(uint64_t guid) {
if (guid == 0) return;
if (state != WorldState::IN_WORLD || !socket) return;
bool turtleMode = isActiveExpansion("turtle");
// Rate-limit to prevent spamming the server
static uint64_t lastInteractGuid = 0;
static std::chrono::steady_clock::time_point lastInteractTime{};
auto now = std::chrono::steady_clock::now();
// Keep duplicate suppression, but allow quick retry clicks.
int64_t minRepeatMs = turtleMode ? 150 : 150;
constexpr int64_t minRepeatMs = 150;
if (guid == lastInteractGuid &&
std::chrono::duration_cast<std::chrono::milliseconds>(now - lastInteractTime).count() < minRepeatMs) {
return;