game: implement SMSG_RESISTLOG combat text (resist/miss display for all expansions)

This commit is contained in:
Kelsi 2026-03-10 00:16:13 -07:00
parent 5d2bc9503d
commit c011d724c6

View file

@ -5194,9 +5194,33 @@ void GameHandler::handlePacket(network::Packet& packet) {
break; break;
// ---- Resistance/combat log ---- // ---- 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()); packet.setReadPos(packet.getSize());
break; break;
}
// ---- Read item results ---- // ---- Read item results ----
case Opcode::SMSG_READ_ITEM_OK: case Opcode::SMSG_READ_ITEM_OK: