fix: fire UNIT_SPELLCAST_FAILED/STOP for other units on SPELL_FAILED_OTHER

SMSG_SPELL_FAILED_OTHER was clearing the unit cast state but not firing
addon events. Cast bar addons (Quartz, ClassicCastbars) showing target/
focus cast bars need UNIT_SPELLCAST_FAILED and UNIT_SPELLCAST_STOP to
clear the bar when another unit's cast fails.

Now fires both events for target and focus units, matching the behavior
already implemented for the player's own cast failures.
This commit is contained in:
Kelsi 2026-03-21 05:22:17 -07:00
parent 7f0d9fe432
commit a02e021730

View file

@ -2344,6 +2344,16 @@ void GameHandler::handlePacket(network::Packet& packet) {
: UpdateObjectParser::readPackedGuid(packet); : UpdateObjectParser::readPackedGuid(packet);
if (failOtherGuid != 0 && failOtherGuid != playerGuid) { if (failOtherGuid != 0 && failOtherGuid != playerGuid) {
unitCastStates_.erase(failOtherGuid); unitCastStates_.erase(failOtherGuid);
// Fire cast failure events so cast bar addons clear the bar
if (addonEventCallback_) {
std::string unitId;
if (failOtherGuid == targetGuid) unitId = "target";
else if (failOtherGuid == focusGuid) unitId = "focus";
if (!unitId.empty()) {
addonEventCallback_("UNIT_SPELLCAST_FAILED", {unitId});
addonEventCallback_("UNIT_SPELLCAST_STOP", {unitId});
}
}
} }
packet.setReadPos(packet.getSize()); packet.setReadPos(packet.getSize());
break; break;