mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-24 08:00:14 +00:00
tbc: fix SMSG_CAST_RESULT — no castCount prefix in TBC 2.4.3
TBC 2.4.3 SMSG_CAST_RESULT sends spellId(u32) + result(u8) = 5 bytes. WotLK 3.3.5a added a castCount(u8) prefix making it 6 bytes. Without this fix the WotLK parser was reading spellId[0] as castCount, then the remaining 3 spellId bytes plus result byte as spellId (wrong), and then whatever follows as result — producing incorrect failure messages and potentially not clearing the cast bar on TBC. Add TbcPacketParsers::parseCastResult override and a virtual base method, then route SMSG_CAST_RESULT through virtual dispatch in the game handler.
This commit is contained in:
parent
1b2c7f595e
commit
921c83df2e
3 changed files with 40 additions and 10 deletions
|
|
@ -1742,28 +1742,28 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
}
|
||||
|
||||
// ---- Cast result (WotLK extended cast failed) ----
|
||||
case Opcode::SMSG_CAST_RESULT:
|
||||
// WotLK: uint8 castCount + uint32 spellId + uint8 result [+ optional extra]
|
||||
case Opcode::SMSG_CAST_RESULT: {
|
||||
// WotLK: castCount(u8) + spellId(u32) + result(u8)
|
||||
// TBC/Classic: spellId(u32) + result(u8) (no castCount prefix)
|
||||
// If result == 0, the spell successfully began; otherwise treat like SMSG_CAST_FAILED.
|
||||
if (packet.getSize() - packet.getReadPos() >= 6) {
|
||||
/*uint8_t castCount =*/ packet.readUInt8();
|
||||
/*uint32_t spellId =*/ packet.readUInt32();
|
||||
uint8_t result = packet.readUInt8();
|
||||
if (result != 0) {
|
||||
// Failure — clear cast bar and show message
|
||||
uint32_t castResultSpellId = 0;
|
||||
uint8_t castResult = 0;
|
||||
if (packetParsers_->parseCastResult(packet, castResultSpellId, castResult)) {
|
||||
if (castResult != 0) {
|
||||
casting = false;
|
||||
currentCastSpellId = 0;
|
||||
castTimeRemaining = 0.0f;
|
||||
const char* reason = getSpellCastResultString(result, -1);
|
||||
const char* reason = getSpellCastResultString(castResult, -1);
|
||||
MessageChatData msg;
|
||||
msg.type = ChatType::SYSTEM;
|
||||
msg.language = ChatLanguage::UNIVERSAL;
|
||||
msg.message = reason ? reason
|
||||
: ("Spell cast failed (error " + std::to_string(result) + ")");
|
||||
: ("Spell cast failed (error " + std::to_string(castResult) + ")");
|
||||
addLocalChatMessage(msg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// ---- Spell failed on another unit ----
|
||||
case Opcode::SMSG_SPELL_FAILED_OTHER:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue