mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
fix: show SMSG_CAST_FAILED reason in UIError overlay
handleCastFailed was only posting to chat; now also calls addUIError so mid-cast server rejections (e.g. "Interrupted") show the same red on-screen overlay as SMSG_CAST_RESULT failures already did.
This commit is contained in:
parent
caad20285b
commit
dcf9aeed92
1 changed files with 5 additions and 6 deletions
|
|
@ -18157,21 +18157,20 @@ void GameHandler::handleCastFailed(network::Packet& packet) {
|
|||
}
|
||||
}
|
||||
|
||||
// Add system message about failed cast with readable reason
|
||||
// Show failure reason in the UIError overlay and in chat
|
||||
int powerType = -1;
|
||||
auto playerEntity = entityManager.getEntity(playerGuid);
|
||||
if (auto playerUnit = std::dynamic_pointer_cast<Unit>(playerEntity)) {
|
||||
powerType = playerUnit->getPowerType();
|
||||
}
|
||||
const char* reason = getSpellCastResultString(data.result, powerType);
|
||||
std::string errMsg = reason ? reason
|
||||
: ("Spell cast failed (error " + std::to_string(data.result) + ")");
|
||||
addUIError(errMsg);
|
||||
MessageChatData msg;
|
||||
msg.type = ChatType::SYSTEM;
|
||||
msg.language = ChatLanguage::UNIVERSAL;
|
||||
if (reason) {
|
||||
msg.message = reason;
|
||||
} else {
|
||||
msg.message = "Spell cast failed (error " + std::to_string(data.result) + ")";
|
||||
}
|
||||
msg.message = errMsg;
|
||||
addLocalChatMessage(msg);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue