diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 0f120d31..e8a02d5d 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -5194,9 +5194,33 @@ void GameHandler::handlePacket(network::Packet& packet) { break; // ---- Resistance/combat log ---- - case Opcode::SMSG_RESISTLOG: + case Opcode::SMSG_RESISTLOG: { + // WotLK: uint32 hitInfo + packed_guid attacker + packed_guid victim + uint32 spellId + // + float resistFactor + uint32 targetRes + uint32 resistedValue + ... + // TBC/Classic: same but full uint64 GUIDs + // Show RESIST combat text when player resists an incoming spell. + const bool rlTbcLike = isClassicLikeExpansion() || isActiveExpansion("tbc"); + auto rl_rem = [&]() { return packet.getSize() - packet.getReadPos(); }; + if (rl_rem() < 4) { packet.setReadPos(packet.getSize()); break; } + /*uint32_t hitInfo =*/ packet.readUInt32(); + if (rl_rem() < (rlTbcLike ? 8u : 1u)) { packet.setReadPos(packet.getSize()); break; } + uint64_t attackerGuid = rlTbcLike + ? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet); + if (rl_rem() < (rlTbcLike ? 8u : 1u)) { packet.setReadPos(packet.getSize()); break; } + uint64_t victimGuid = rlTbcLike + ? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet); + if (rl_rem() < 4) { packet.setReadPos(packet.getSize()); break; } + uint32_t spellId = packet.readUInt32(); + (void)attackerGuid; + // Show RESIST when player is the victim; show as caster-side MISS when player is attacker + if (victimGuid == playerGuid) { + addCombatText(CombatTextEntry::MISS, 0, spellId, false); + } else if (attackerGuid == playerGuid) { + addCombatText(CombatTextEntry::MISS, 0, spellId, true); + } packet.setReadPos(packet.getSize()); break; + } // ---- Read item results ---- case Opcode::SMSG_READ_ITEM_OK: