Handle SMSG_CHARACTER_LOGIN_FAILED (0x041) for AzerothCore/Playerbot compatibility

Previously this opcode was unrecognised and silently dropped, leaving the
client stuck in ENTERING_WORLD with no feedback when the server rejected a
login (duplicate session, world down, disabled race/class, etc.). Now we
decode the LoginFailureReason byte, reset state to CHAR_LIST_RECEIVED so
the player can retry, and surface a red error message on the character screen
via the new CharLoginFailCallback. Also adds isError colour support to
CharacterScreen::setStatus so failures show in red and successes in green.
This commit is contained in:
Kelsi 2026-02-17 13:59:29 -08:00
parent 36fc1df706
commit 7cf060a9f6
11 changed files with 61 additions and 4 deletions

View file

@ -156,7 +156,8 @@ void CharacterScreen::render(game::GameHandler& gameHandler) {
// Status message
if (!statusMessage.empty()) {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.3f, 1.0f, 0.3f, 1.0f));
ImVec4 color = statusIsError ? ImVec4(1.0f, 0.3f, 0.3f, 1.0f) : ImVec4(0.3f, 1.0f, 0.3f, 1.0f);
ImGui::PushStyleColor(ImGuiCol_Text, color);
ImGui::TextWrapped("%s", statusMessage.c_str());
ImGui::PopStyleColor();
ImGui::Spacing();
@ -454,8 +455,9 @@ void CharacterScreen::render(game::GameHandler& gameHandler) {
ImGui::End();
}
void CharacterScreen::setStatus(const std::string& message) {
void CharacterScreen::setStatus(const std::string& message, bool isError) {
statusMessage = message;
statusIsError = isError;
}
void CharacterScreen::selectCharacterByName(const std::string& name) {