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

@ -1006,6 +1006,13 @@ void Application::setupUICallbacks() {
}
});
// Character login failure callback
gameHandler->setCharLoginFailCallback([this](const std::string& reason) {
LOG_WARNING("Character login failed: ", reason);
setState(AppState::CHARACTER_SELECTION);
uiManager->getCharacterScreen().setStatus("Login failed: " + reason, true);
});
// World entry callback (online mode) - load terrain when entering world
gameHandler->setWorldEntryCallback([this](uint32_t mapId, float x, float y, float z) {
LOG_INFO("Online world entry: mapId=", mapId, " pos=(", x, ", ", y, ", ", z, ")");
@ -1784,7 +1791,7 @@ void Application::setupUICallbacks() {
} else {
uint8_t code = gameHandler ? gameHandler->getLastCharDeleteResult() : 0xFF;
uiManager->getCharacterScreen().setStatus(
"Delete failed (code " + std::to_string(static_cast<int>(code)) + ").");
"Delete failed (code " + std::to_string(static_cast<int>(code)) + ").", true);
}
});
}