mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-04 08:23:50 +00:00
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:
parent
36fc1df706
commit
7cf060a9f6
11 changed files with 61 additions and 4 deletions
|
|
@ -699,6 +699,10 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
}
|
||||
break;
|
||||
|
||||
case Opcode::SMSG_CHARACTER_LOGIN_FAILED:
|
||||
handleCharLoginFailed(packet);
|
||||
break;
|
||||
|
||||
case Opcode::SMSG_LOGIN_VERIFY_WORLD:
|
||||
if (state == WorldState::ENTERING_WORLD || state == WorldState::IN_WORLD) {
|
||||
handleLoginVerifyWorld(packet);
|
||||
|
|
@ -1889,6 +1893,32 @@ const Character* GameHandler::getFirstCharacter() const {
|
|||
|
||||
|
||||
|
||||
void GameHandler::handleCharLoginFailed(network::Packet& packet) {
|
||||
uint8_t reason = packet.readUInt8();
|
||||
|
||||
static const char* reasonNames[] = {
|
||||
"Login failed", // 0
|
||||
"World server is down", // 1
|
||||
"Duplicate character", // 2 (session still active)
|
||||
"No instance servers", // 3
|
||||
"Login disabled", // 4
|
||||
"Character not found", // 5
|
||||
"Locked for transfer", // 6
|
||||
"Locked by billing", // 7
|
||||
"Using remote", // 8
|
||||
};
|
||||
const char* msg = (reason < 9) ? reasonNames[reason] : "Unknown reason";
|
||||
|
||||
LOG_ERROR("SMSG_CHARACTER_LOGIN_FAILED: reason=", (int)reason, " (", msg, ")");
|
||||
|
||||
// Allow the player to re-select a character
|
||||
setState(WorldState::CHAR_LIST_RECEIVED);
|
||||
|
||||
if (charLoginFailCallback_) {
|
||||
charLoginFailCallback_(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void GameHandler::selectCharacter(uint64_t characterGuid) {
|
||||
if (state != WorldState::CHAR_LIST_RECEIVED) {
|
||||
LOG_WARNING("Cannot select character in state: ", (int)state);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ static const OpcodeNameEntry kOpcodeNames[] = {
|
|||
{"SMSG_CHAR_CREATE", LogicalOpcode::SMSG_CHAR_CREATE},
|
||||
{"SMSG_CHAR_ENUM", LogicalOpcode::SMSG_CHAR_ENUM},
|
||||
{"SMSG_CHAR_DELETE", LogicalOpcode::SMSG_CHAR_DELETE},
|
||||
{"SMSG_CHARACTER_LOGIN_FAILED", LogicalOpcode::SMSG_CHARACTER_LOGIN_FAILED},
|
||||
{"SMSG_PONG", LogicalOpcode::SMSG_PONG},
|
||||
{"SMSG_LOGIN_VERIFY_WORLD", LogicalOpcode::SMSG_LOGIN_VERIFY_WORLD},
|
||||
{"SMSG_LOGIN_SETTIMESPEED", LogicalOpcode::SMSG_LOGIN_SETTIMESPEED},
|
||||
|
|
@ -386,6 +387,7 @@ void OpcodeTable::loadWotlkDefaults() {
|
|||
{LogicalOpcode::SMSG_CHAR_CREATE, 0x03A},
|
||||
{LogicalOpcode::SMSG_CHAR_ENUM, 0x03B},
|
||||
{LogicalOpcode::SMSG_CHAR_DELETE, 0x03C},
|
||||
{LogicalOpcode::SMSG_CHARACTER_LOGIN_FAILED, 0x041},
|
||||
{LogicalOpcode::SMSG_PONG, 0x1DD},
|
||||
{LogicalOpcode::SMSG_LOGIN_VERIFY_WORLD, 0x236},
|
||||
{LogicalOpcode::SMSG_LOGIN_SETTIMESPEED, 0x042},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue