From 3712e6c5c175f2d4ee497e5cc9922942e6e074d8 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sun, 29 Mar 2026 18:46:15 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20operator=20precedence=20broke=20stabled?= =?UTF-8?q?=20pet=20parsing=20=E2=80=94=20only=20first=20pet=20shown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit !packet.hasRemaining(4) + 4 + 4 evaluated as (!hasRemaining(4))+8 due to ! binding tighter than +, making the check always truthy and breaking out of the loop after the first pet. Hunters with multiple stabled pets would see only one in the stable master UI. --- src/game/spell_handler.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/game/spell_handler.cpp b/src/game/spell_handler.cpp index e6baf8b7..8b1a16ca 100644 --- a/src/game/spell_handler.cpp +++ b/src/game/spell_handler.cpp @@ -1546,13 +1546,15 @@ void SpellHandler::handleListStabledPets(network::Packet& packet) { owner_.stabledPets_.reserve(petCount); for (uint8_t i = 0; i < petCount; ++i) { - if (!packet.hasRemaining(4) + 4 + 4) break; + // petNumber(4) + entry(4) + level(4) = 12 bytes before the name string + if (!packet.hasRemaining(12)) break; GameHandler::StabledPet pet; pet.petNumber = packet.readUInt32(); pet.entry = packet.readUInt32(); pet.level = packet.readUInt32(); pet.name = packet.readString(); - if (!packet.hasRemaining(4) + 1) break; + // displayId(4) + isActive(1) = 5 bytes after the name string + if (!packet.hasRemaining(5)) break; pet.displayId = packet.readUInt32(); pet.isActive = (packet.readUInt8() != 0); owner_.stabledPets_.push_back(std::move(pet)); @@ -1616,6 +1618,17 @@ void SpellHandler::resetCastState() { owner_.lastInteractedGoGuid_ = 0; } +void SpellHandler::resetAllState() { + knownSpells_.clear(); + spellCooldowns_.clear(); + playerAuras_.clear(); + targetAuras_.clear(); + unitAurasCache_.clear(); + unitCastStates_.clear(); + resetCastState(); + resetTalentState(); +} + void SpellHandler::resetTalentState() { talentsInitialized_ = false; learnedTalents_[0].clear();