mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
game: fix SMSG_SPELL_FAILURE GUID format for TBC/Classic vs WotLK
WotLK uses packed GUIDs in SMSG_SPELL_FAILURE / SMSG_SPELL_FAILED_OTHER.
TBC 2.4.3 and Classic 1.12 use full uint64 GUIDs. The previous fix used
UpdateObjectParser::readPackedGuid for all expansions, which would
mis-parse the caster GUID on TBC/Classic servers, leaving stale cast
bars and potentially corrupting subsequent packet reads.
Now checks isClassicLikeExpansion() || isActiveExpansion("tbc") and
reads a raw uint64 for those expansions, matching the TBC/Classic wire
format used in parseSpellStart/parseSpellGo overrides.
This commit is contained in:
parent
640eaacb8c
commit
d72912714b
1 changed files with 12 additions and 4 deletions
|
|
@ -1780,8 +1780,12 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
||||||
|
|
||||||
// ---- Spell failed on another unit ----
|
// ---- Spell failed on another unit ----
|
||||||
case Opcode::SMSG_SPELL_FAILED_OTHER: {
|
case Opcode::SMSG_SPELL_FAILED_OTHER: {
|
||||||
// packed_guid + uint8 castCount + uint32 spellId + uint8 reason
|
// WotLK: packed_guid + uint8 castCount + uint32 spellId + uint8 reason
|
||||||
uint64_t failOtherGuid = UpdateObjectParser::readPackedGuid(packet);
|
// TBC/Classic: full uint64 + uint8 castCount + uint32 spellId + uint8 reason
|
||||||
|
const bool tbcLike2 = isClassicLikeExpansion() || isActiveExpansion("tbc");
|
||||||
|
uint64_t failOtherGuid = tbcLike2
|
||||||
|
? (packet.getSize() - packet.getReadPos() >= 8 ? packet.readUInt64() : 0)
|
||||||
|
: UpdateObjectParser::readPackedGuid(packet);
|
||||||
if (failOtherGuid != 0 && failOtherGuid != playerGuid) {
|
if (failOtherGuid != 0 && failOtherGuid != playerGuid) {
|
||||||
unitCastStates_.erase(failOtherGuid);
|
unitCastStates_.erase(failOtherGuid);
|
||||||
}
|
}
|
||||||
|
|
@ -2532,8 +2536,12 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
||||||
handleSpellGo(packet);
|
handleSpellGo(packet);
|
||||||
break;
|
break;
|
||||||
case Opcode::SMSG_SPELL_FAILURE: {
|
case Opcode::SMSG_SPELL_FAILURE: {
|
||||||
// packed_guid caster + uint8 castCount + uint32 spellId + uint8 failReason
|
// WotLK: packed_guid + uint8 castCount + uint32 spellId + uint8 failReason
|
||||||
uint64_t failGuid = UpdateObjectParser::readPackedGuid(packet);
|
// TBC/Classic: full uint64 + uint8 castCount + uint32 spellId + uint8 failReason
|
||||||
|
const bool tbcOrClassic = isClassicLikeExpansion() || isActiveExpansion("tbc");
|
||||||
|
uint64_t failGuid = tbcOrClassic
|
||||||
|
? (packet.getSize() - packet.getReadPos() >= 8 ? packet.readUInt64() : 0)
|
||||||
|
: UpdateObjectParser::readPackedGuid(packet);
|
||||||
if (failGuid == playerGuid || failGuid == 0) {
|
if (failGuid == playerGuid || failGuid == 0) {
|
||||||
// Player's own cast failed
|
// Player's own cast failed
|
||||||
casting = false;
|
casting = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue