mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
fix: correct WotLK packed guid format in SMSG_PROCRESIST and SMSG_TOTEM_CREATED
Both opcodes use packed GUIDs in WotLK 3.3.5a but were reading full uint64, causing incorrect GUID parsing and potentially matching wrong player entities. SMSG_PROCRESIST: caster + victim guids (packed in WotLK, uint64 in TBC/Classic) SMSG_TOTEM_CREATED: totem guid (packed in WotLK, uint64 in TBC/Classic)
This commit is contained in:
parent
9cd7e7978d
commit
0a17683545
1 changed files with 30 additions and 16 deletions
|
|
@ -1935,14 +1935,23 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
|
||||
// ---- Spell proc resist log ----
|
||||
case Opcode::SMSG_PROCRESIST: {
|
||||
// casterGuid(8) + victimGuid(8) + uint32 spellId + uint8 logSchoolMask
|
||||
if (packet.getSize() - packet.getReadPos() >= 17) {
|
||||
/*uint64_t caster =*/ packet.readUInt64();
|
||||
uint64_t victim = packet.readUInt64();
|
||||
uint32_t spellId = packet.readUInt32();
|
||||
if (victim == playerGuid)
|
||||
addCombatText(CombatTextEntry::MISS, 0, spellId, false);
|
||||
}
|
||||
// WotLK: packed_guid caster + packed_guid victim + uint32 spellId + ...
|
||||
// TBC/Classic: uint64 caster + uint64 victim + uint32 spellId + ...
|
||||
const bool prTbcLike = isClassicLikeExpansion() || isActiveExpansion("tbc");
|
||||
auto readPrGuid = [&]() -> uint64_t {
|
||||
if (prTbcLike)
|
||||
return (packet.getSize() - packet.getReadPos() >= 8) ? packet.readUInt64() : 0;
|
||||
return UpdateObjectParser::readPackedGuid(packet);
|
||||
};
|
||||
if (packet.getSize() - packet.getReadPos() < (prTbcLike ? 8u : 1u)) break;
|
||||
/*uint64_t caster =*/ readPrGuid();
|
||||
if (packet.getSize() - packet.getReadPos() < (prTbcLike ? 8u : 1u)) break;
|
||||
uint64_t victim = readPrGuid();
|
||||
if (packet.getSize() - packet.getReadPos() < 4) break;
|
||||
uint32_t spellId = packet.readUInt32();
|
||||
if (victim == playerGuid)
|
||||
addCombatText(CombatTextEntry::MISS, 0, spellId, false);
|
||||
packet.setReadPos(packet.getSize());
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -2896,15 +2905,20 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
break;
|
||||
}
|
||||
case Opcode::SMSG_TOTEM_CREATED: {
|
||||
// uint8 slot + uint64 guid + uint32 duration + uint32 spellId
|
||||
if (packet.getSize() - packet.getReadPos() >= 17) {
|
||||
uint8_t slot = packet.readUInt8();
|
||||
// WotLK: uint8 slot + packed_guid + uint32 duration + uint32 spellId
|
||||
// TBC/Classic: uint8 slot + uint64 guid + uint32 duration + uint32 spellId
|
||||
const bool totemTbcLike = isClassicLikeExpansion() || isActiveExpansion("tbc");
|
||||
if (packet.getSize() - packet.getReadPos() < (totemTbcLike ? 17u : 9u)) break;
|
||||
uint8_t slot = packet.readUInt8();
|
||||
if (totemTbcLike)
|
||||
/*uint64_t guid =*/ packet.readUInt64();
|
||||
uint32_t duration = packet.readUInt32();
|
||||
uint32_t spellId = packet.readUInt32();
|
||||
LOG_DEBUG("SMSG_TOTEM_CREATED: slot=", (int)slot,
|
||||
" spellId=", spellId, " duration=", duration, "ms");
|
||||
}
|
||||
else
|
||||
/*uint64_t guid =*/ UpdateObjectParser::readPackedGuid(packet);
|
||||
if (packet.getSize() - packet.getReadPos() < 8) break;
|
||||
uint32_t duration = packet.readUInt32();
|
||||
uint32_t spellId = packet.readUInt32();
|
||||
LOG_DEBUG("SMSG_TOTEM_CREATED: slot=", (int)slot,
|
||||
" spellId=", spellId, " duration=", duration, "ms");
|
||||
break;
|
||||
}
|
||||
case Opcode::SMSG_AREA_SPIRIT_HEALER_TIME: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue