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

@ -175,6 +175,9 @@ public:
void setCharDeleteCallback(CharDeleteCallback cb) { charDeleteCallback_ = std::move(cb); }
uint8_t getLastCharDeleteResult() const { return lastCharDeleteResult_; }
using CharLoginFailCallback = std::function<void(const std::string& reason)>;
void setCharLoginFailCallback(CharLoginFailCallback cb) { charLoginFailCallback_ = std::move(cb); }
/**
* Select and log in with a character
* @param characterGuid GUID of character to log in with
@ -906,6 +909,11 @@ private:
*/
void handleCharEnum(network::Packet& packet);
/**
* Handle SMSG_CHARACTER_LOGIN_FAILED from server
*/
void handleCharLoginFailed(network::Packet& packet);
/**
* Handle SMSG_LOGIN_VERIFY_WORLD from server
*/
@ -1469,6 +1477,7 @@ private:
WorldConnectFailureCallback onFailure;
CharCreateCallback charCreateCallback_;
CharDeleteCallback charDeleteCallback_;
CharLoginFailCallback charLoginFailCallback_;
uint8_t lastCharDeleteResult_ = 0xFF;
bool pendingCharCreateResult_ = false;
bool pendingCharCreateSuccess_ = false;