mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
game: implement SMSG_RESISTLOG combat text (resist/miss display for all expansions)
This commit is contained in:
parent
5d2bc9503d
commit
c011d724c6
1 changed files with 25 additions and 1 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue