/// <summary> /// Client choose server to send serverIP, server port number, sessionID ///</summary>> private static void Handle_CARequestReconnect_0X0D(ArcheAgeConnection net, PacketReader reader) { /* * [7] C>s 0ms. 23:56:45 .957 10.03.18 * ------------------------------------------------------------------------------- * TType: ArcheageServer: undef Parse: 6 EnCode: off * ------- 0 1 2 3 4 5 6 7 - 8 9 A B C D E F ------------------- * 000000 0B 00 0D 00 00 00 00 00 | 00 00 00 00 01 ............. * ------------------------------------------------------------------------------- * Archeage: "CARequestReconnect" size: 13 prot: 2 $002 * Addr: Size: Type: Description: Value: * 0000 2 word psize 11 | $000B * 0002 2 word ID 13 | $000D * 0004 4 integer p_from 0 | $00000000 * 0008 4 integer p_to 0 | $00000000 * 000C 1 byte serverId 1 | $01 * 4 integer cookie * ? WideStr[byte] MAC */ //0B00 0D00 00000000 00000000 01 //reader.Offset += 8; //Undefined Data int p_from = reader.ReadLEInt32(); int p_to = reader.ReadLEInt32(); byte serverId = reader.ReadByte(); //serverId GameServer server = GameServerController.CurrentGameServers.FirstOrDefault(n => n.Value.Id == serverId).Value; if (server != null && server.CurrentConnection != null) { if (GameServerController.AuthorizedAccounts.ContainsKey(net.CurrentAccount.AccountId)) { net.CurrentAccount.LastEnteredTime = Utility.CurrentTimeMilliseconds(); net.CurrentAccount.LastIp = net.ToString(); // IP //net.CurrentAccount.AccountId = net.CurrentAccount.AccountId; // //create session (cookie) ///var cookie = 128665876; //$07AB4914 - для теста ///net.CurrentAccount.Session = cookie; //AccountHolder.AccountList.FirstOrDefault(n => n.AccId == Convert.ToInt32(cookie)); // генерируем cookie Random random = new Random(); int cookie = random.Next(255); cookie += random.Next(255) << 8; cookie += random.Next(255) << 16; cookie += random.Next(255) << 24; net.CurrentAccount.Session = cookie; //Designated session //Передаем управление Гейм серверу net.MovedToGame = true; GameServerController.AuthorizedAccounts.Remove(net.CurrentAccount.AccountId); //отсылаем Гейм серверу информацию об аккаунте server.CurrentConnection.SendAsync(new NET_AccountInfo(clientVersion, net.CurrentAccount)); server.CurrentAuthorized.Add(net.CurrentAccount.AccountId); //отсылаем Клиенту информацию о куках net.SendAsync(new AcWorldCookie_0X0A(clientVersion, server, cookie)); } } else { Logger.Trace("No serverID requested:" + serverId); net.Dispose(); } }
/// <summary> /// для версии2014 года /// </summary> /// <param name="net"></param> /// <param name="reader"></param> private static void Handle_CARequestAuth_0X04(ArcheAgeConnection net, PacketReader reader) { //3F00 0400 0A000000 0700000000 08000000000000000000 0600 616174657374200031E34F2B72D93BB25D5F27BE8A94C47800000000000000000000000000000000 //3F00 0400 0A000000 0700000000 08000000000000000000 0600 616174657374200031E34F2B72D93BB25D5F27BE8A94C47800000000000000000000000000000000 reader.Offset += 19; //скипаем 19 байт int m_RUidLength = reader.ReadLEInt16(); //длина строки string m_Uid = reader.ReadString(m_RUidLength); //считываем ID //long accId = Convert.ToInt64(m_Uid); int m_RtokenLength = reader.ReadLEInt16(); // длина строки string m_RToken = reader.ReadHexString(m_RtokenLength); //считываем токен Account n_Current = AccountHolder.AccountList.FirstOrDefault(n => n.Name == m_Uid); if (n_Current != null) { Logger.Trace("Account ID: " + n_Current.AccountId + " & Account Name: " + n_Current.Name + " is landing"); //account numberexist if (n_Current.Token.ToLower() == m_RToken.ToLower()) { net.CurrentAccount = n_Current; if (GameServerController.AuthorizedAccounts.ContainsKey(net.CurrentAccount.AccountId)) { //Удалим результаты предыдущего коннекта для нормального реконнекта GameServerController.AuthorizedAccounts.Remove(net.CurrentAccount.AccountId); } //Write account number information Write Online account list GameServerController.AuthorizedAccounts.Add(net.CurrentAccount.AccountId, net.CurrentAccount); Logger.Trace("Account ID: " + n_Current.AccountId + " & Account Name: " + n_Current.Name + " landing success"); //net.SendAsyncHex(new NP_Hex("0C00000000000300000000000000")); net.SendAsync(new AcJoinResponse_0X00(clientVersion)); //net.SendAsyncHex(new NP_Hex("280003005833000020003236393631326537613630393431313862623735303764626334326261353934")); net.SendAsync(new AcAuthResponse_0X03(clientVersion, net)); //net.SendAsyncHex(new NP_Hex("0C00000000000300000000000000")); //net.SendAsyncHex(new NP_Hex("0C00000000000600000000000000")); // 000000000600000000000000 //0C00000000000300000000000000 //03005833000020003236393631326537613630393431313862623735303764626334326261353934 return; } Logger.Trace("Account ID: " + n_Current.AccountId + " & Account Name: " + n_Current.Name + " token verification failed:" + m_RToken.ToLower()); } else { Logger.Trace("Client try to login to a nonexistent account: " + m_Uid); //Make New Temporary if (Settings.Default.Account_AutoCreation) { Logger.Trace("Create new account: " + m_Uid); Account m_New = new Account { AccountId = AccountHolder.AccountList.Count + 1, LastEnteredTime = Utility.CurrentTimeMilliseconds(), AccessLevel = 1, LastIp = net.ToString(), Membership = 1, Name = m_Uid, Password = "******", Token = m_RToken, Characters = 0 }; net.CurrentAccount = m_New; AccountHolder.InsertOrUpdate(m_New); //Write account number information Write Online account list GameServerController.AuthorizedAccounts.Add(net.CurrentAccount.AccountId, net.CurrentAccount); Logger.Trace("Account ID: " + net.CurrentAccount.AccountId + " & Account Name: " + net.CurrentAccount.Name + " landing success"); net.SendAsyncHex(new NP_Hex("0C00000000000300000000000000")); //net.SendAsync(new AcJoinResponse_0X00(clientVersion)); net.SendAsyncHex(new NP_Hex("280003005833000020003236393631326537613630393431313862623735303764626334326261353934")); //net.SendAsync(new AcAuthResponse_0X03(clientVersion, net)); return; } net.CurrentAccount = null; Logger.Trace("Сan not create account: " + m_Uid); } //If the front did not terminate, then the account number failed to log in net.SendAsync(new NP_ACLoginDenied_0x0C()); }
/// <summary> /// 0x06_CAChallengeResponse2Packet - token Verification mode /// uid+token /// </summary> private static void Handle_CAChallengeResponse2_0X06(ArcheAgeConnection net, PacketReader reader) { reader.Offset += 19; //скипаем 19 байт int m_RUidLength = reader.ReadLEInt16(); //длина строки string m_Uid = reader.ReadString(m_RUidLength); //считываем имя "aatest" int m_RtokenLength = reader.ReadLEInt16(); // длина строки string m_RToken = reader.ReadHexString(m_RtokenLength); //считываем токен Account n_Current = AccountHolder.AccountList.FirstOrDefault(n => n.Name == m_Uid); if (n_Current != null) { Logger.Trace("Account ID: " + n_Current.AccountId + " & Account Name: " + n_Current.Name + " is landing"); //account numberexist if (n_Current.Token.ToLower() == m_RToken.ToLower()) { net.CurrentAccount = n_Current; if (GameServerController.AuthorizedAccounts.ContainsKey(net.CurrentAccount.AccountId)) { //Удалим результаты предыдущего коннекта для нормального реконнекта GameServerController.AuthorizedAccounts.Remove(net.CurrentAccount.AccountId); } //Write account number information Write Online account list GameServerController.AuthorizedAccounts.Add(net.CurrentAccount.AccountId, net.CurrentAccount); Logger.Trace("Account ID: " + n_Current.AccountId + " & Account Name: " + n_Current.Name + " landing success"); net.SendAsync(new AcJoinResponse_0X00(clientVersion)); net.SendAsync(new AcAuthResponse_0X03(clientVersion, net)); return; } Logger.Trace("Account ID: " + n_Current.AccountId + " & Account Name: " + n_Current.Name + " token verification failed:" + m_RToken.ToLower()); } else { Logger.Trace("Client try to login to a nonexistent account: " + m_Uid); //Make New Temporary if (Settings.Default.Account_AutoCreation) { Logger.Trace("Create new account: " + m_Uid); Account m_New = new Account { AccountId = AccountHolder.AccountList.Count + 1, LastEnteredTime = Utility.CurrentTimeMilliseconds(), AccessLevel = 1, LastIp = net.ToString(), Membership = 1, Name = m_Uid, Password = "******", Token = m_RToken, Characters = 0 }; net.CurrentAccount = m_New; AccountHolder.InsertOrUpdate(m_New); //Write account number information Write Online account list GameServerController.AuthorizedAccounts.Add(net.CurrentAccount.AccountId, net.CurrentAccount); Logger.Trace("Account ID: " + net.CurrentAccount.AccountId + " & Account Name: " + net.CurrentAccount.Name + " landing success"); net.SendAsync(new AcJoinResponse_0X00(clientVersion)); net.SendAsync(new AcAuthResponse_0X03(clientVersion, net)); return; } net.CurrentAccount = null; Logger.Trace("Сan not create account: " + m_Uid); } //If the front did not terminate, then the account number failed to log in net.SendAsync(new NP_ACLoginDenied_0x0C()); }
private static void Handle_SignIn(ArcheAgeConnection net, PacketReader reader) { reader.Offset += 10; //Static Data - 0A 00 00 00 07 00 00 00 00 00 string m_RLogin = reader.ReadStringSafe(reader.ReadLEInt16()); //Reading Login Account n_Current = AccountHolder.AccountList.FirstOrDefault(n => n.Name == m_RLogin); if (n_Current == null) { //Make New Temporary if (Settings.Default.Account_AutoCreation) { Account m_New = new Account(); m_New.AccountId = AccountHolder.AccountList.Count + 1; m_New.LastEnteredTime = Utility.CurrentTimeMilliseconds(); m_New.AccessLevel = 0; m_New.LastIp = net.ToString(); m_New.Membership = 0; m_New.Name = m_RLogin; net.CurrentAccount = m_New; AccountHolder.AccountList.Add(m_New); } else net.CurrentAccount = null; } else { net.CurrentAccount = n_Current; } net.SendAsync(new NP_AcceptLogin()); net.SendAsync(new NP_AESKey()); }