mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +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;
|
int powerType = -1;
|
||||||
auto playerEntity = entityManager.getEntity(playerGuid);
|
auto playerEntity = entityManager.getEntity(playerGuid);
|
||||||
if (auto playerUnit = std::dynamic_pointer_cast<Unit>(playerEntity)) {
|
if (auto playerUnit = std::dynamic_pointer_cast<Unit>(playerEntity)) {
|
||||||
powerType = playerUnit->getPowerType();
|
powerType = playerUnit->getPowerType();
|
||||||
}
|
}
|
||||||
const char* reason = getSpellCastResultString(data.result, powerType);
|
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;
|
MessageChatData msg;
|
||||||
msg.type = ChatType::SYSTEM;
|
msg.type = ChatType::SYSTEM;
|
||||||
msg.language = ChatLanguage::UNIVERSAL;
|
msg.language = ChatLanguage::UNIVERSAL;
|
||||||
if (reason) {
|
msg.message = errMsg;
|
||||||
msg.message = reason;
|
|
||||||
} else {
|
|
||||||
msg.message = "Spell cast failed (error " + std::to_string(data.result) + ")";
|
|
||||||
}
|
|
||||||
addLocalChatMessage(msg);
|
addLocalChatMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue