From 02a1b5cbf3ba9801bc9c4f579aa22152c25ca625 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 18 Mar 2026 09:59:54 -0700 Subject: [PATCH] fix: show reflected spell name in combat text SMSG_SPELL_MISS_LOG REFLECT entries include a reflectSpellId field that was parsed but discarded. Now store it in SpellMissLogEntry and pass it to addCombatText, so floating combat text shows the actual reflected spell name instead of the original cast spell. --- src/game/game_handler.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index eac38722..a918db20 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -2951,6 +2951,7 @@ void GameHandler::handlePacket(network::Packet& packet) { struct SpellMissLogEntry { uint64_t victimGuid = 0; uint8_t missInfo = 0; + uint32_t reflectSpellId = 0; // Only valid when missInfo==11 (REFLECT) }; std::vector parsedMisses; parsedMisses.reserve(storedLimit); @@ -2969,17 +2970,18 @@ void GameHandler::handlePacket(network::Packet& packet) { } const uint8_t missInfo = packet.readUInt8(); // REFLECT (11): extra uint32 reflectSpellId + uint8 reflectResult + uint32_t reflectSpellId = 0; if (missInfo == 11) { if (packet.getSize() - packet.getReadPos() >= 5) { - /*uint32_t reflectSpellId =*/ packet.readUInt32(); - /*uint8_t reflectResult =*/ packet.readUInt8(); + reflectSpellId = packet.readUInt32(); + /*uint8_t reflectResult =*/ packet.readUInt8(); } else { truncated = true; break; } } if (i < storedLimit) { - parsedMisses.push_back({victimGuid, missInfo}); + parsedMisses.push_back({victimGuid, missInfo, reflectSpellId}); } } @@ -2992,12 +2994,15 @@ void GameHandler::handlePacket(network::Packet& packet) { const uint64_t victimGuid = miss.victimGuid; const uint8_t missInfo = miss.missInfo; CombatTextEntry::Type ct = combatTextTypeFromSpellMissInfo(missInfo); + // For REFLECT, use the reflected spell ID so combat text shows the spell name + uint32_t combatSpellId = (ct == CombatTextEntry::REFLECT && miss.reflectSpellId != 0) + ? miss.reflectSpellId : spellId; if (casterGuid == playerGuid) { // We cast a spell and it missed the target - addCombatText(ct, 0, spellId, true, 0, casterGuid, victimGuid); + addCombatText(ct, 0, combatSpellId, true, 0, casterGuid, victimGuid); } else if (victimGuid == playerGuid) { // Enemy spell missed us (we dodged/parried/blocked/resisted/etc.) - addCombatText(ct, 0, spellId, false, 0, casterGuid, victimGuid); + addCombatText(ct, 0, combatSpellId, false, 0, casterGuid, victimGuid); } } break;