fix: add Classic parseCastResult override with result enum +1 shift

Classic 1.12 SMSG_CAST_RESULT uses an enum starting at 0=AFFECTING_COMBAT
(no SUCCESS entry), while WotLK starts at 0=SUCCESS, 1=AFFECTING_COMBAT.
Without this override, Classic result codes were handled by TBC's
parseCastResult which passed them unshifted, causing result 0
(AFFECTING_COMBAT) to be silently treated as success with no error shown.

This applies the same +1 shift used in parseCastFailed so all Classic
spell failure codes map correctly to getSpellCastResultString.
This commit is contained in:
Kelsi 2026-03-11 03:53:18 -07:00
parent 2f0809b570
commit d6e398d814
2 changed files with 17 additions and 0 deletions

View file

@ -389,6 +389,7 @@ public:
network::Packet buildCastSpell(uint32_t spellId, uint64_t targetGuid, uint8_t castCount) override;
network::Packet buildUseItem(uint8_t bagIndex, uint8_t slotIndex, uint64_t itemGuid, uint32_t spellId = 0) override;
bool parseCastFailed(network::Packet& packet, CastFailedData& data) override;
bool parseCastResult(network::Packet& packet, uint32_t& spellId, uint8_t& result) override;
bool parseMessageChat(network::Packet& packet, MessageChatData& data) override;
bool parseGameObjectQueryResponse(network::Packet& packet, GameObjectQueryResponseData& data) override;
// Classic 1.12 SMSG_CREATURE_QUERY_RESPONSE lacks the iconName string that TBC/WotLK include

View file

@ -633,6 +633,22 @@ bool ClassicPacketParsers::parseCastFailed(network::Packet& packet, CastFailedDa
return true;
}
// ============================================================================
// Classic SMSG_CAST_RESULT: same layout as parseCastFailed (spellId + result),
// but the result enum starts at 0=AFFECTING_COMBAT (no SUCCESS entry).
// Apply the same +1 shift used in parseCastFailed so the result codes
// align with WotLK's getSpellCastResultString table.
// ============================================================================
bool ClassicPacketParsers::parseCastResult(network::Packet& packet, uint32_t& spellId, uint8_t& result) {
if (packet.getSize() - packet.getReadPos() < 5) return false;
spellId = packet.readUInt32();
uint8_t vanillaResult = packet.readUInt8();
// Shift +1: Vanilla result 0=AFFECTING_COMBAT maps to WotLK result 1=AFFECTING_COMBAT
result = vanillaResult + 1;
LOG_DEBUG("[Classic] Cast result: spell=", spellId, " vanillaResult=", (int)vanillaResult);
return true;
}
// ============================================================================
// Classic 1.12.1 parseCharEnum
// Differences from TBC: