From 668c0cc22b57e5eb24e90dfa8eb90874f9279cf0 Mon Sep 17 00:00:00 2001 From: zamalaev Date: Wed, 19 Feb 2020 12:15:01 +0000 Subject: [PATCH] SMSG_AUTH_RESPONSE 5.4.7 18019 --- src/game/Server/Opcodes.h | 2 +- src/game/Server/WorldSession.cpp | 103 +++++++++++++++++++++++++++++-- src/game/Server/WorldSession.h | 1 + 3 files changed, 99 insertions(+), 7 deletions(-) diff --git a/src/game/Server/Opcodes.h b/src/game/Server/Opcodes.h index 40e21b981..ae28c7050 100644 --- a/src/game/Server/Opcodes.h +++ b/src/game/Server/Opcodes.h @@ -44,7 +44,7 @@ enum Opcodes MSG_WOW_CONNECTION = 0x4F57, // 4.3.4 15595 SMSG_AUTH_CHALLENGE = 0x0221, // 5.3.0 17055 CMSG_AUTH_SESSION = 0x14DA, // 5.4.1 17538 - SMSG_AUTH_RESPONSE = 0x0890, // 5.3.0 17055 + SMSG_AUTH_RESPONSE = 0x15A0, // 5.4.7 18019 MSG_NULL_ACTION = 0x1001, CMSG_BOOTME = 0x1002, CMSG_DBLOOKUP = 0x1003, diff --git a/src/game/Server/WorldSession.cpp b/src/game/Server/WorldSession.cpp index f1aa44145..e2a37ac9e 100644 --- a/src/game/Server/WorldSession.cpp +++ b/src/game/Server/WorldSession.cpp @@ -846,24 +846,115 @@ void WorldSession::SendAuthWaitQue(uint32 position) { if (position == 0) { - WorldPacket packet( SMSG_AUTH_RESPONSE, 2 ); - packet.WriteBit(false); - packet.WriteBit(false); - packet << uint8( AUTH_OK ); + WorldPacket packet(SMSG_AUTH_RESPONSE, 1); + packet.WriteBit(false); // no account data + packet.WriteBit(false); // no queue + packet << uint8(AUTH_OK); SendPacket(&packet); } else { - WorldPacket packet( SMSG_AUTH_RESPONSE, 1+4+1 ); + WorldPacket packet(SMSG_AUTH_RESPONSE, 6); + packet.WriteBit(false); // has account data packet.WriteBit(true); // has queue packet.WriteBit(false); // unk queue-related - packet.WriteBit(false); // has account info packet << uint8(AUTH_WAIT_QUEUE); packet << uint32(position); SendPacket(&packet); } } +struct ExpansionInfoStrunct +{ + uint8 raceOrClass; + uint8 expansion; +}; + +ExpansionInfoStrunct classExpansionInfo[MAX_CLASSES - 1] = +{ + { 1, 0 }, + { 2, 0 }, + { 3, 0 }, + { 4, 0 }, + { 5, 0 }, + { 6, 2 }, + { 7, 0 }, + { 8, 0 }, + { 9, 0 }, + { 10, 4 }, + { 11, 0 } +}; + +ExpansionInfoStrunct raceExpansionInfo[MAX_PLAYABLE_RACES] = +{ + { 1, 0 }, + { 2, 0 }, + { 3, 0 }, + { 4, 0 }, + { 5, 0 }, + { 6, 0 }, + { 7, 0 }, + { 8, 0 }, + { 9, 3 }, + { 10, 1 }, + { 11, 1 }, + { 22, 3 }, + { 24, 4 }, + { 25, 4 }, + { 26, 4 } +}; + +void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos) +{ + bool hasAccountData = true; + + WorldPacket packet(SMSG_AUTH_RESPONSE, 1 /*bits*/ + 4 + 1 + 4 + 1 + 4 + 1 + 1 + (queued ? 4 : 0)); + packet << uint8(code); + packet.WriteBit(queued); // IsInQueue + if (queued) + packet.WriteBit(1); // unk + + packet.WriteBit(hasAccountData); + if (hasAccountData) + { + packet.WriteBit(0); + packet.WriteBits(0, 21); + packet.WriteBits(0, 21); + packet.WriteBits(MAX_PLAYABLE_RACES, 23); + packet.WriteBit(0); + packet.WriteBit(0); + packet.WriteBit(0); + packet.WriteBits(MAX_CLASSES - 1, 23); + + packet << uint32(0); + packet << uint32(0); + packet << uint8(5); //TODO: FIXME uint8(Expansion()); // Unknown, these two show the same + + for (uint8 i = 0; i < MAX_PLAYABLE_RACES; ++i) + { + packet << uint8(raceExpansionInfo[i].expansion); + packet << uint8(raceExpansionInfo[i].raceOrClass); + } + + packet << uint8(5); //TODO: FIXME uint8(Expansion()); // Unknown, these two show the same + packet << uint32(0); + + for (uint8 i = 0; i < MAX_CLASSES - 1; ++i) + { + packet << uint8(classExpansionInfo[i].raceOrClass); + packet << uint8(classExpansionInfo[i].expansion); + } + + packet << uint32(0); + packet << uint32(0); + } + + if (queued) + packet << uint32(queuePos); + + SendPacket(&packet); +} + void WorldSession::LoadGlobalAccountData() { LoadAccountData( diff --git a/src/game/Server/WorldSession.h b/src/game/Server/WorldSession.h index 35cbc0c5e..fb299fdfe 100644 --- a/src/game/Server/WorldSession.h +++ b/src/game/Server/WorldSession.h @@ -349,6 +349,7 @@ class WorldSession void SendNameQueryOpcode(Player* p); void SendNameQueryOpcodeFromDB(ObjectGuid guid); static void SendNameQueryOpcodeFromDBCallBack(QueryResult* result, uint32 accountId); + void SendAuthResponse(uint8 code, bool queued, uint32 queuePos = 0); void SendTrainerList(ObjectGuid guid); void SendTrainerList(ObjectGuid guid, const std::string& strTitle);