fix(combatlog): parse classic spell damage shield GUIDs as packed

This commit is contained in:
Kelsi 2026-03-14 01:47:06 -07:00
parent 468880e2c8
commit b059bbcf89

View file

@ -6170,23 +6170,32 @@ void GameHandler::handlePacket(network::Packet& packet) {
// ---- Spell combat logs (consume) ---- // ---- Spell combat logs (consume) ----
case Opcode::SMSG_SPELLDAMAGESHIELD: { case Opcode::SMSG_SPELLDAMAGESHIELD: {
// Classic/TBC: uint64 victim + uint64 caster + spellId(4) + damage(4) + schoolMask(4) // Classic: packed_guid victim + packed_guid caster + spellId(4) + damage(4) + schoolMask(4)
// WotLK: packed_guid victim + packed_guid caster + spellId(4) + damage(4) + absorbed(4) + schoolMask(4) // TBC: uint64 victim + uint64 caster + spellId(4) + damage(4) + schoolMask(4)
const bool shieldClassicLike = isClassicLikeExpansion() || isActiveExpansion("tbc"); // WotLK: packed_guid victim + packed_guid caster + spellId(4) + damage(4) + absorbed(4) + schoolMask(4)
const size_t shieldMinSz = shieldClassicLike ? 24u : 2u; const bool shieldTbc = isActiveExpansion("tbc");
const bool shieldWotlkLike = !isClassicLikeExpansion() && !shieldTbc;
const size_t shieldMinSz = shieldTbc ? 24u : 2u;
if (packet.getSize() - packet.getReadPos() < shieldMinSz) { if (packet.getSize() - packet.getReadPos() < shieldMinSz) {
packet.setReadPos(packet.getSize()); break; packet.setReadPos(packet.getSize()); break;
} }
uint64_t victimGuid = shieldClassicLike if (!shieldTbc && (!hasFullPackedGuid(packet))) {
packet.setReadPos(packet.getSize()); break;
}
uint64_t victimGuid = shieldTbc
? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet); ? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet);
uint64_t casterGuid = shieldClassicLike if (packet.getSize() - packet.getReadPos() < (shieldTbc ? 8u : 1u)
|| (!shieldTbc && !hasFullPackedGuid(packet))) {
packet.setReadPos(packet.getSize()); break;
}
uint64_t casterGuid = shieldTbc
? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet); ? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet);
if (packet.getSize() - packet.getReadPos() < 12) { if (packet.getSize() - packet.getReadPos() < 12) {
packet.setReadPos(packet.getSize()); break; packet.setReadPos(packet.getSize()); break;
} }
uint32_t shieldSpellId = packet.readUInt32(); uint32_t shieldSpellId = packet.readUInt32();
uint32_t damage = packet.readUInt32(); uint32_t damage = packet.readUInt32();
if (!shieldClassicLike && packet.getSize() - packet.getReadPos() >= 4) if (shieldWotlkLike && packet.getSize() - packet.getReadPos() >= 4)
/*uint32_t absorbed =*/ packet.readUInt32(); /*uint32_t absorbed =*/ packet.readUInt32();
/*uint32_t school =*/ packet.readUInt32(); /*uint32_t school =*/ packet.readUInt32();
// Show combat text: damage shield reflect // Show combat text: damage shield reflect